summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-28 14:33:09 (UTC)
committer zecke <zecke>2003-08-28 14:33:09 (UTC)
commit2394427a5c34384131922fb6c2a1d35dee3e1197 (patch) (side-by-side diff)
treec70a5153f7a3b53e864226b521e5cef50855198b
parentf3c6caca7e96488ad9e1873e9c853f11b17a944e (diff)
downloadopie-2394427a5c34384131922fb6c2a1d35dee3e1197.zip
opie-2394427a5c34384131922fb6c2a1d35dee3e1197.tar.gz
opie-2394427a5c34384131922fb6c2a1d35dee3e1197.tar.bz2
Make it compile with Opie
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index 033dd10..7f9366e 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -1,58 +1,59 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "documentlist.h"
#include "serverinterface.h"
+#include "launcherglobal.h"
#include <qtopia/mimetype.h>
#include <qtopia/resource.h>
#include <qtopia/global.h>
-#include <qtopia/categories.h>
+#include <qtopia/private/categories.h>
#include <qtopia/qpeapplication.h>
#include <qtopia/applnk.h>
#include <qtopia/storage.h>
#ifdef Q_WS_QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
#include <qtimer.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include <qfile.h>
#include <qdir.h>
#include <qpainter.h>
#include <qimage.h>
#include <qcopchannel_qws.h>
#include <qlistview.h>
#include <qlist.h>
#include <qpixmap.h>
AppLnkSet *DocumentList::appLnkSet = 0;
static const int MAX_SEARCH_DEPTH = 10;
class DocumentListPrivate : public QObject {
Q_OBJECT
public:
DocumentListPrivate( ServerInterface *gui );
~DocumentListPrivate();
void initialize();
@@ -213,95 +214,95 @@ void DocumentList::reloadAppLnks()
QPixmap pm = appLnkSet->typePixmap(*ittypes);
QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes);
if (pm.isNull()) {
QImage img( Resource::loadImage( "UnknownDocument" ) );
pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
}
//qDebug("adding type %s", (*ittypes).latin1());
// ### our current launcher expects docs tab to be last
d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
}
prevTypeList.remove(*ittypes);
}
}
for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
//qDebug("removing type %s", (*ittypes).latin1());
d->serverGui->typeRemoved(*ittypes);
}
prevTypeList = types;
}
QListIterator<AppLnk> itapp( appLnkSet->children() );
AppLnk* l;
while ( (l=itapp.current()) ) {
++itapp;
if ( d->sendAppLnks && d->serverGui )
d->serverGui->applicationAdded( l->type(), *l );
}
- if ( d->sendAppLnks && d->serverGui )
+ if ( d->sendAppLnks && d->serverGui )
d->serverGui->applicationScanningProgress( 100 );
}
void DocumentList::reloadDocLnks()
{
if ( !d->scanDocs )
return;
if ( d->sendDocLnks && d->serverGui ) {
d->serverGui->documentScanningProgress( 0 );
d->serverGui->allDocumentsRemoved();
}
rescan();
}
void DocumentList::linkChanged( QString arg )
{
//qDebug( "linkchanged( %s )", arg.latin1() );
- if ( arg.isNull() || Global::isAppLnkFileName( arg ) ) {
+ if ( arg.isNull() || Opie::Global::isAppLnkFileName( arg ) ) {
reloadAppLnks();
} else {
const QList<DocLnk> &list = d->dls.children();
QListIterator<DocLnk> it( list );
while ( it.current() ) {
DocLnk *doc = it.current();
++it;
- if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
+ if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
|| ( doc->fileKnown() && doc->file() == arg ) ) {
//qDebug( "found old link" );
DocLnk* dl = new DocLnk( arg );
// add new one if it exists and matches the mimetype
if ( d->store( dl ) ) {
// Existing link has been changed, send old link ref and a ref
// to the new link
//qDebug( "change case" );
if ( d->serverGui )
d->serverGui->documentChanged( *doc, *dl );
} else {
// Link has been removed or doesn't match the mimetypes any more
// so we aren't interested in it, so take it away from the list
//qDebug( "removal case" );
if ( d->serverGui )
d->serverGui->documentRemoved( *doc );
}
d->dls.remove( doc ); // remove old link from docLnkSet
delete doc;
return;
}
}
// Didn't find existing link, must be new
DocLnk* dl = new DocLnk( arg );
if ( d->store( dl ) ) {
// Add if it's a link we are interested in
//qDebug( "add case" );
add( *dl );
}
@@ -427,66 +428,66 @@ void DocumentListPrivate::initialize()
reference.clear();
QDir docDir( QPEApplication::documentDir() );
if ( docDir.exists() )
docPaths += QPEApplication::documentDir();
int i = 1;
const QList<FileSystem> &fs = storage->fileSystems();
QListIterator<FileSystem> it( fs );
for ( ; it.current(); ++it )
if ( (*it)->isRemovable() ) {
docPaths += (*it)->path();
i++;
}
for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
if ( listDirs[i] ) {
delete listDirs[i];
listDirs[i] = 0;
}
lists[i] = 0;
listPositions[i] = 0;
}
docPathsSearched = 0;
searchDepth = -1;
state = Find;
dit = 0;
}
DocumentListPrivate::~DocumentListPrivate()
{
- for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ )
- if ( listDirs[i] )
+ for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ )
+ if ( listDirs[i] )
delete listDirs[i];
delete dit;
}
void DocumentListPrivate::estimatedPercentScanned()
{
double overallProgress = 0.0;
double levelWeight = 75.0;
int topCount = docPaths.count();
if ( topCount > 1 ) {
levelWeight = levelWeight / topCount;
overallProgress += (docPathsSearched - 1) * levelWeight;
}
for ( int d = 0; d <= searchDepth; d++ ) {
if ( listDirs[d] ) {
int items = lists[d]->count();
if ( items > 1 ) {
levelWeight = levelWeight / items;
// Take in to account "." and ".."
overallProgress += (listPositions[d] - 3) * levelWeight;
}
} else {
break;
}
}
// qDebug( "overallProgress: %f", overallProgress );
if ( serverGui )
@@ -593,54 +594,54 @@ const DocLnk *DocumentListPrivate::iterate()
if ( serverGui )
serverGui->documentScanningProgress( 75 );
}
static int iterationI;
static int iterationCount;
if ( state == RemoveKnownFiles ) {
//qDebug("state RemoveKnownFiles");
const QList<DocLnk> &list = dls.children();
for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
reference.remove( (*it)->file() );
// ### does this need to be deleted?
}
dit = new QDictIterator<void>(reference);
state = MakeUnknownFiles;
iterationI = 0;
iterationCount = dit->count();
}
if ( state == MakeUnknownFiles ) {
//qDebug("state MakeUnknownFiles");
for (void* c; (c=dit->current()); ++(*dit) ) {
if ( c == MAGIC_NUMBER ) {
DocLnk* dl = new DocLnk;
QFileInfo fi( dit->currentKey() );
dl->setFile( fi.filePath() );
dl->setName( fi.baseName() );
if ( store(dl) ) {
++*dit;
iterationI++;
- if ( serverGui )
+ if ( serverGui )
serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount );
return dl;
}
}
iterationI++;
}
delete dit;
dit = 0;
state = Done;
}
//qDebug("state Done");
return NULL;
}
#include "documentlist.moc"