summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-11 21:10:16 (UTC)
committer alwin <alwin>2004-11-11 21:10:16 (UTC)
commitd2d25a3c1e60a34436cd93e5214a35b3edd05c6c (patch) (side-by-side diff)
tree0c1bd62dd09e7a86292399f68c823b7eb6ae031e
parente85cf7184c3444e26c1858d0564fa5d3614dd7b5 (diff)
downloadopie-d2d25a3c1e60a34436cd93e5214a35b3edd05c6c.zip
opie-d2d25a3c1e60a34436cd93e5214a35b3edd05c6c.tar.gz
opie-d2d25a3c1e60a34436cd93e5214a35b3edd05c6c.tar.bz2
- flush icon cache if reloading all documents
- send QCop message when the doctab is enabled/disabled so the disabled widget appears or the doc-list will reread
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp610
-rw-r--r--core/launcher/documentlist.h3
-rw-r--r--core/launcher/launcher.cpp107
-rw-r--r--core/launcher/launcher.h1
-rw-r--r--core/launcher/launcherview.cpp4
-rw-r--r--core/launcher/server.cpp210
6 files changed, 483 insertions, 452 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
index d8e7a83..9781a32 100644
--- a/core/launcher/documentlist.cpp
+++ b/core/launcher/documentlist.cpp
@@ -101,5 +101,5 @@ public:
*/
DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/,
- QObject *parent, const char *name )
+ QObject *parent, const char *name )
: QObject( parent, name )
{
@@ -132,5 +132,5 @@ void DocumentList::add( const DocLnk& doc )
{
if ( d->serverGui && QFile::exists( doc.file() ) )
- d->serverGui->documentAdded( doc );
+ d->serverGui->documentAdded( doc );
}
@@ -153,5 +153,5 @@ void DocumentList::resume()
{
if ( d->tid == 0 ) {
- d->tid = startTimer( 20 );
+ d->tid = startTimer( 20 );
//odebug << "resumed " << d->tid << "" << oendl;
}
@@ -173,5 +173,5 @@ void DocumentList::resendWorker()
const QList<DocLnk> &list = d->dls.children();
for ( QListIterator<DocLnk> it( list ); it.current(); ++it )
- add( *(*it) );
+ add( *(*it) );
resume();
}
@@ -190,20 +190,20 @@ void DocumentList::timerEvent( QTimerEvent *te )
{
if ( te->timerId() == d->tid ) {
- // Do 3 at a time
+ // Do 3 at a time
if ( d->serverGui )
d->serverGui->aboutToAddBegin();
- for (int i = 0; i < 3; i++ ) {
- const DocLnk *lnk = d->iterate();
- if ( lnk ) {
- add( *lnk );
- } else {
- // stop when done
- pause();
- if ( d->serverGui )
- d->serverGui->documentScanningProgress( 100 );
- if ( d->needToSendAllDocLinks )
- sendAllDocLinks();
- break;
- }
+ for (int i = 0; i < 3; i++ ) {
+ const DocLnk *lnk = d->iterate();
+ if ( lnk ) {
+ add( *lnk );
+ } else {
+ // stop when done
+ pause();
+ if ( d->serverGui )
+ d->serverGui->documentScanningProgress( 100 );
+ if ( d->needToSendAllDocLinks )
+ sendAllDocLinks();
+ break;
+ }
}
if ( d->serverGui )
@@ -216,6 +216,6 @@ void DocumentList::reloadAppLnks()
{
if ( d->sendAppLnks && d->serverGui ) {
- d->serverGui->applicationScanningProgress( 0 );
- d->serverGui->allApplicationsRemoved();
+ d->serverGui->applicationScanningProgress( 0 );
+ d->serverGui->allApplicationsRemoved();
}
@@ -224,32 +224,32 @@ void DocumentList::reloadAppLnks()
if ( d->sendAppLnks && d->serverGui ) {
- static QStringList prevTypeList;
- QStringList types = appLnkSet->types();
- for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
- if ( !(*ittypes).isEmpty() ) {
- if ( !prevTypeList.contains(*ittypes) ) {
- QString name = appLnkSet->typeName(*ittypes);
- 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() );
- }
+ static QStringList prevTypeList;
+ QStringList types = appLnkSet->types();
+ for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
+ if ( !(*ittypes).isEmpty() ) {
+ if ( !prevTypeList.contains(*ittypes) ) {
+ QString name = appLnkSet->typeName(*ittypes);
+ 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() );
+ }
//odebug << "adding type " << (*ittypes) << "" << oendl;
- // ### 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) {
+ // ### 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) {
//odebug << "removing type " << (*ittypes) << "" << oendl;
- d->serverGui->typeRemoved(*ittypes);
- }
- prevTypeList = types;
+ d->serverGui->typeRemoved(*ittypes);
+ }
+ prevTypeList = types;
}
@@ -257,11 +257,11 @@ void DocumentList::reloadAppLnks()
AppLnk* l;
while ( (l=itapp.current()) ) {
- ++itapp;
- if ( d->sendAppLnks && d->serverGui )
- d->serverGui->applicationAdded( l->type(), *l );
+ ++itapp;
+ if ( d->sendAppLnks && d->serverGui )
+ d->serverGui->applicationAdded( l->type(), *l );
}
if ( d->sendAppLnks && d->serverGui )
- d->serverGui->applicationScanningProgress( 100 );
+ d->serverGui->applicationScanningProgress( 100 );
}
@@ -269,9 +269,9 @@ void DocumentList::reloadDocLnks()
{
if ( !d->scanDocs )
- return;
+ return;
if ( d->sendDocLnks && d->serverGui ) {
- d->serverGui->documentScanningProgress( 0 );
- d->serverGui->allDocumentsRemoved();
+ d->serverGui->documentScanningProgress( 0 );
+ d->serverGui->allDocumentsRemoved();
}
@@ -279,49 +279,57 @@ void DocumentList::reloadDocLnks()
}
+void DocumentList::reforceDocuments()
+{
+ Config cfg( "Launcher" );
+ cfg.setGroup( "DocTab" );
+ d->scanDocs = cfg.readBoolEntry( "Enable", true );
+ reloadDocLnks();
+}
+
void DocumentList::linkChanged( QString arg )
{
- //odebug << "linkchanged( " << arg << " )" << oendl;
+ odebug << "linkchanged( " << arg << " )" << oendl;
if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) {
- reloadAppLnks();
+ 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 )
- || ( doc->fileKnown() && doc->file() == arg ) ) {
+ 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 )
+ || ( doc->fileKnown() && doc->file() == arg ) ) {
//odebug << "found old link" << oendl;
- 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
+ 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
//odebug << "change case" << oendl;
- if ( d->serverGui )
- d->serverGui->documentChanged( *doc, *dl );
+ 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
+ } 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
//odebug << "removal case" << oendl;
- 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
+ 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
//odebug << "add case" << oendl;
- add( *dl );
- }
+ add( *dl );
+ }
}
@@ -341,32 +349,32 @@ void DocumentList::DiffAppLnks()
if ( d->sendAppLnks && d->serverGui ) {
- static QStringList prevTypeList = appLnkSet->types();
- QStringList types = appLnkSet2->types();
- for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
- if ( !(*ittypes).isEmpty() ) {
- if ( !prevTypeList.contains(*ittypes) ) {
- QString name = appLnkSet2->typeName(*ittypes);
- QPixmap pm = appLnkSet2->typePixmap(*ittypes);
- QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes);
-
- if (pm.isNull()) {
- QImage img( Resource::loadImage( "UnknownDocument" ) );
- pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
- bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
- }
+ static QStringList prevTypeList = appLnkSet->types();
+ QStringList types = appLnkSet2->types();
+ for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
+ if ( !(*ittypes).isEmpty() ) {
+ if ( !prevTypeList.contains(*ittypes) ) {
+ QString name = appLnkSet2->typeName(*ittypes);
+ QPixmap pm = appLnkSet2->typePixmap(*ittypes);
+ QPixmap bgPm = appLnkSet2->typeBigPixmap(*ittypes);
+
+ if (pm.isNull()) {
+ QImage img( Resource::loadImage( "UnknownDocument" ) );
+ pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
+ bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
+ }
odebug << "adding type " << (*ittypes) << "" << oendl;
- // ### 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) {
+ // ### 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) {
odebug << "removing type " << (*ittypes) << "" << oendl;
- d->serverGui->typeRemoved(*ittypes);
- }
- prevTypeList = types;
+ d->serverGui->typeRemoved(*ittypes);
+ }
+ prevTypeList = types;
}
@@ -380,33 +388,33 @@ void DocumentList::DiffAppLnks()
while ( (j=it2.current()) ) {
- it1 = appLnkSet->children();
- found = false;
- while ( (i=it1.current()) ){
- if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
- found = true;
- ++it1;
- }
- if (!found) {
- odebug << "Item " << j->name().ascii() << " needs to be added" << oendl;
- d->serverGui->applicationAdded( j->type(), *j );
- }
- ++it2;
+ it1 = appLnkSet->children();
+ found = false;
+ while ( (i=it1.current()) ){
+ if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
+ found = true;
+ ++it1;
+ }
+ if (!found) {
+ odebug << "Item " << j->name().ascii() << " needs to be added" << oendl;
+ d->serverGui->applicationAdded( j->type(), *j );
+ }
+ ++it2;
}
it1 = appLnkSet->children();
while ( (i=it1.current()) ) {
- it2 = appLnkSet2->children();
- found = false;
- while ( (j=it2.current()) ){
- if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
- found = true;
- ++it2;
- }
- if (!found) {
- odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl;
- d->serverGui->applicationRemoved( i->type(), *i );
- }
+ it2 = appLnkSet2->children();
+ found = false;
+ while ( (j=it2.current()) ){
+ if (strcmp(i->name().ascii(),j->name().ascii()) == 0)
+ found = true;
+ ++it2;
+ }
+ if (!found) {
+ odebug << "Item " << i->name().ascii() << " needs to be removed" << oendl;
+ d->serverGui->applicationRemoved( i->type(), *i );
+ }
- ++it1;
+ ++it1;
}
@@ -437,8 +445,8 @@ void DocumentList::sendAllDocLinks()
{
if ( d->tid != 0 ) {
- // We are in the middle of scanning, set a flag so
- // we do this when we finish our scanning
- d->needToSendAllDocLinks = true;
- return;
+ // We are in the middle of scanning, set a flag so
+ // we do this when we finish our scanning
+ d->needToSendAllDocLinks = true;
+ return;
}
@@ -446,40 +454,40 @@ void DocumentList::sendAllDocLinks()
Categories cats;
for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) {
- DocLnk *doc = it.current();
- QFileInfo fi( doc->file() );
- if ( !fi.exists() )
- continue;
-
- bool fake = !doc->linkFileKnown();
- if ( !fake ) {
- QFile f( doc->linkFile() );
- if ( f.open( IO_ReadOnly ) ) {
- QTextStream ts( &f );
- ts.setEncoding( QTextStream::UnicodeUTF8 );
- QString docLnk = ts.read();
- // Strip out the (stale) LinkFile entry
- int start = docLnk.find( "\nLinkFile = " ) + 1;
- if ( start > 0 ) {
- int end = docLnk.find( "\n", start + 1 ) + 1;
- contents += docLnk.left(start);
- contents += docLnk.mid(end);
- } else {
- contents += docLnk;
- }
- contents += "LinkFile = " + doc->linkFile() + "\n";
-
- f.close();
- } else
- fake = TRUE;
- }
- if (fake) {
- contents += "[Desktop Entry]\n"; // No tr
- contents += "Categories = " + // No tr
- cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
- contents += "Name = "+doc->name()+"\n"; // No tr
- contents += "Type = "+doc->type()+"\n"; // No tr
- }
- contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
- contents += QString("Size = %1\n").arg( fi.size() ); // No tr
+ DocLnk *doc = it.current();
+ QFileInfo fi( doc->file() );
+ if ( !fi.exists() )
+ continue;
+
+ bool fake = !doc->linkFileKnown();
+ if ( !fake ) {
+ QFile f( doc->linkFile() );
+ if ( f.open( IO_ReadOnly ) ) {
+ QTextStream ts( &f );
+ ts.setEncoding( QTextStream::UnicodeUTF8 );
+ QString docLnk = ts.read();
+ // Strip out the (stale) LinkFile entry
+ int start = docLnk.find( "\nLinkFile = " ) + 1;
+ if ( start > 0 ) {
+ int end = docLnk.find( "\n", start + 1 ) + 1;
+ contents += docLnk.left(start);
+ contents += docLnk.mid(end);
+ } else {
+ contents += docLnk;
+ }
+ contents += "LinkFile = " + doc->linkFile() + "\n";
+
+ f.close();
+ } else
+ fake = TRUE;
+ }
+ if (fake) {
+ contents += "[Desktop Entry]\n"; // No tr
+ contents += "Categories = " + // No tr
+ cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
+ contents += "Name = "+doc->name()+"\n"; // No tr
+ contents += "Type = "+doc->type()+"\n"; // No tr
+ }
+ contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
+ contents += QString("Size = %1\n").arg( fi.size() ); // No tr
}
@@ -522,14 +530,14 @@ DocumentListPrivate::DocumentListPrivate( ServerInterface *gui )
serverGui = gui;
if ( serverGui ) {
- sendAppLnks = serverGui->requiresApplications();
- sendDocLnks = serverGui->requiresDocuments();
+ sendAppLnks = serverGui->requiresApplications();
+ sendDocLnks = serverGui->requiresDocuments();
} else {
- sendAppLnks = false;
- sendDocLnks = false;
+ sendAppLnks = false;
+ sendDocLnks = false;
}
for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
- listDirs[i] = 0;
- lists[i] = 0;
- listPositions[i] = 0;
+ listDirs[i] = 0;
+ lists[i] = 0;
+ listPositions[i] = 0;
}
initialize();
@@ -582,5 +590,5 @@ void DocumentListPrivate::initialize()
QDir docDir( QPEApplication::documentDir() );
if ( docDir.exists() )
- docPaths += QPEApplication::documentDir();
+ docPaths += QPEApplication::documentDir();
int i = 1;
const QList<FileSystem> &fs = storage->fileSystems();
@@ -594,10 +602,10 @@ void DocumentListPrivate::initialize()
for ( int i = 0; i < MAX_SEARCH_DEPTH; ++i ) {
- if ( listDirs[i] ) {
- delete listDirs[i];
- listDirs[i] = 0;
- }
- lists[i] = 0;
- listPositions[i] = 0;
+ if ( listDirs[i] ) {
+ delete listDirs[i];
+ listDirs[i] = 0;
+ }
+ lists[i] = 0;
+ listPositions[i] = 0;
}
@@ -612,6 +620,6 @@ DocumentListPrivate::~DocumentListPrivate()
{
for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ )
- if ( listDirs[i] )
- delete listDirs[i];
+ if ( listDirs[i] )
+ delete listDirs[i];
delete dit;
}
@@ -625,19 +633,19 @@ void DocumentListPrivate::estimatedPercentScanned()
int topCount = docPaths.count();
if ( topCount > 1 ) {
- levelWeight = levelWeight / topCount;
- overallProgress += (docPathsSearched - 1) * levelWeight;
+ 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;
- }
+ 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;
+ }
}
@@ -645,5 +653,5 @@ void DocumentListPrivate::estimatedPercentScanned()
if ( serverGui )
- serverGui->documentScanningProgress( (int)overallProgress );
+ serverGui->documentScanningProgress( (int)overallProgress );
}
@@ -652,61 +660,61 @@ const QString DocumentListPrivate::nextFile()
{
while ( TRUE ) {
- while ( searchDepth < 0 ) {
- // go to next base path
- if ( docPathsSearched >= docPaths.count() ) {
- // end of base paths
- return QString::null;
- } else {
- QDir dir( docPaths[docPathsSearched] );
+ while ( searchDepth < 0 ) {
+ // go to next base path
+ if ( docPathsSearched >= docPaths.count() ) {
+ // end of base paths
+ return QString::null;
+ } else {
+ QDir dir( docPaths[docPathsSearched] );
// odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl;
- docPathsSearched++;
- if ( !dir.exists( ".Qtopia-ignore" ) ) {
- listDirs[0] = new QDir( dir );
- lists[0] = listDirs[0]->entryInfoList();
- listPositions[0] = 0;
- searchDepth = 0;
- }
- }
- }
-
- const QFileInfoList *fil = lists[searchDepth];
+ docPathsSearched++;
+ if ( !dir.exists( ".Qtopia-ignore" ) ) {
+ listDirs[0] = new QDir( dir );
+ lists[0] = listDirs[0]->entryInfoList();
+ listPositions[0] = 0;
+ searchDepth = 0;
+ }
+ }
+ }
+
+ const QFileInfoList *fil = lists[searchDepth];
if (!fil) {
return QString::null;
}
- QFileInfoList *fl = (QFileInfoList *)fil;
- unsigned int pos = listPositions[searchDepth];
-
- if ( pos >= fl->count() ) {
- // go up a depth
- delete listDirs[searchDepth];
- listDirs[searchDepth] = 0;
- lists[searchDepth] = 0;
- listPositions[searchDepth] = 0;
- searchDepth--;
- } else {
- const QFileInfo *fi = fl->at(pos);
- listPositions[searchDepth]++;
- QString bn = fi->fileName();
- if ( bn[0] != '.' ) {
- if ( fi->isDir() ) {
- if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) {
- // go down a depth
- QDir dir( fi->filePath() );
+ QFileInfoList *fl = (QFileInfoList *)fil;
+ unsigned int pos = listPositions[searchDepth];
+
+ if ( pos >= fl->count() ) {
+ // go up a depth
+ delete listDirs[searchDepth];
+ listDirs[searchDepth] = 0;
+ lists[searchDepth] = 0;
+ listPositions[searchDepth] = 0;
+ searchDepth--;
+ } else {
+ const QFileInfo *fi = fl->at(pos);
+ listPositions[searchDepth]++;
+ QString bn = fi->fileName();
+ if ( bn[0] != '.' ) {
+ if ( fi->isDir() ) {
+ if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) {
+ // go down a depth
+ QDir dir( fi->filePath() );
// odebug << "now going in to path: " << bn << "" << oendl;
- if ( !dir.exists( ".Qtopia-ignore" ) ) {
- if ( searchDepth < MAX_SEARCH_DEPTH - 1) {
- searchDepth++;
- listDirs[searchDepth] = new QDir( dir );
- lists[searchDepth] = listDirs[searchDepth]->entryInfoList();
- listPositions[searchDepth] = 0;
- }
- }
- }
- } else {
- estimatedPercentScanned();
- return fl->at(pos)->filePath();
- }
- }
- }
+ if ( !dir.exists( ".Qtopia-ignore" ) ) {
+ if ( searchDepth < MAX_SEARCH_DEPTH - 1) {
+ searchDepth++;
+ listDirs[searchDepth] = new QDir( dir );
+ lists[searchDepth] = listDirs[searchDepth]->entryInfoList();
+ listPositions[searchDepth] = 0;
+ }
+ }
+ }
+ } else {
+ estimatedPercentScanned();
+ return fl->at(pos)->filePath();
+ }
+ }
+ }
}
@@ -719,6 +727,6 @@ bool DocumentListPrivate::store( DocLnk* dl )
// if ( dl->fileKnown() && !dl->file().isEmpty() ) {
if ( dl && dl->fileKnown() ) {
- dls.add( dl ); // store
- return TRUE;
+ dls.add( dl ); // store
+ return TRUE;
}
@@ -729,5 +737,5 @@ bool DocumentListPrivate::store( DocLnk* dl )
-#define MAGIC_NUMBER ((void*)2)
+#define MAGIC_NUMBER ((void*)2)
const DocLnk *DocumentListPrivate::iterate()
@@ -735,19 +743,19 @@ const DocLnk *DocumentListPrivate::iterate()
if ( state == Find ) {
//odebug << "state Find" << oendl;
- QString file = nextFile();
- while ( !file.isNull() ) {
- if ( file.right(8) == ".desktop" ) { // No tr
- DocLnk* dl = new DocLnk( file );
- if ( store(dl) )
- return dl;
- } else {
- reference.insert( file, MAGIC_NUMBER );
- }
- file = nextFile();
- }
- state = RemoveKnownFiles;
-
- if ( serverGui )
- serverGui->documentScanningProgress( 75 );
+ QString file = nextFile();
+ while ( !file.isNull() ) {
+ if ( file.right(8) == ".desktop" ) { // No tr
+ DocLnk* dl = new DocLnk( file );
+ if ( store(dl) )
+ return dl;
+ } else {
+ reference.insert( file, MAGIC_NUMBER );
+ }
+ file = nextFile();
+ }
+ state = RemoveKnownFiles;
+
+ if ( serverGui )
+ serverGui->documentScanningProgress( 75 );
}
@@ -757,38 +765,38 @@ const DocLnk *DocumentListPrivate::iterate()
if ( state == RemoveKnownFiles ) {
//odebug << "state RemoveKnownFiles" << oendl;
- 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;
+ 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();
+ iterationI = 0;
+ iterationCount = dit->count();
}
if ( state == MakeUnknownFiles ) {
//odebug << "state MakeUnknownFiles" << oendl;
- 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 )
- serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount );
- return dl;
- }
- }
- iterationI++;
- }
-
- delete dit;
- dit = 0;
- state = Done;
+ 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 )
+ serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount );
+ return dl;
+ }
+ }
+ iterationI++;
+ }
+
+ delete dit;
+ dit = 0;
+ state = Done;
}
diff --git a/core/launcher/documentlist.h b/core/launcher/documentlist.h
index 232bb6a..8b69e95 100644
--- a/core/launcher/documentlist.h
+++ b/core/launcher/documentlist.h
@@ -33,5 +33,5 @@ class DocumentList : public QObject {
public:
DocumentList( ServerInterface *serverGui, bool scanDocs = TRUE,
- QObject *parent = 0, const char *name = 0 );
+ QObject *parent = 0, const char *name = 0 );
~DocumentList();
@@ -43,4 +43,5 @@ public:
void reloadAppLnks();
void reloadDocLnks();
+ void reforceDocuments();
void DiffAppLnks();
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index ccc2114..970b8cb 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -389,49 +389,49 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &
QDataStream stream( data, IO_ReadOnly );
if ( msg == "setTabView(QString,int)" ) {
- QString id;
- stream >> id;
- int mode;
- stream >> mode;
- if ( view(id) )
- view(id)->setViewMode( (LauncherView::ViewMode)mode );
+ QString id;
+ stream >> id;
+ int mode;
+ stream >> mode;
+ if ( view(id) )
+ view(id)->setViewMode( (LauncherView::ViewMode)mode );
} else if ( msg == "setTabBackground(QString,int,QString)" ) {
- QString id;
- stream >> id;
- int mode;
- stream >> mode;
- QString pixmapOrColor;
- stream >> pixmapOrColor;
- if ( view(id) )
- view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
- if ( id == "Documents" )
- docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
+ QString id;
+ stream >> id;
+ int mode;
+ stream >> mode;
+ QString pixmapOrColor;
+ stream >> pixmapOrColor;
+ if ( view(id) )
+ view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
+ if ( id == "Documents" )
+ docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
} else if ( msg == "setTextColor(QString,QString)" ) {
- QString id;
- stream >> id;
- QString color;
- stream >> color;
- if ( view(id) )
- view(id)->setTextColor( QColor(color) );
- if ( id == "Documents" )
- docLoadingWidget->setTextColor( QColor(color) );
+ QString id;
+ stream >> id;
+ QString color;
+ stream >> color;
+ if ( view(id) )
+ view(id)->setTextColor( QColor(color) );
+ if ( id == "Documents" )
+ docLoadingWidget->setTextColor( QColor(color) );
} else if ( msg == "setFont(QString,QString,int,int,int)" ) {
- QString id;
- stream >> id;
- QString fam;
- stream >> fam;
- int size;
- stream >> size;
- int weight;
- stream >> weight;
- int italic;
- stream >> italic;
- if ( view(id) ) {
- if ( !fam.isEmpty() ) {
- view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
- odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
- } else {
- view(id)->clearViewFont();
+ QString id;
+ stream >> id;
+ QString fam;
+ stream >> fam;
+ int size;
+ stream >> size;
+ int weight;
+ stream >> weight;
+ int italic;
+ stream >> italic;
+ if ( view(id) ) {
+ if ( !fam.isEmpty() ) {
+ view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
+ odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
+ } else {
+ view(id)->clearViewFont();
+ }
}
- }
}else if ( msg == "setBusyIndicatorType(QString)" ) {
QString type;
@@ -442,10 +442,31 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &
if (categoryBar)
categoryBar->nextTab();
- }else
+ }else {
static_cast<QWidget*>(parent())->raise();
+ }
+ } else if (msg=="doctabEnabled(int)") {
+ int id; stream >> id;
+ odebug << "Doctab enabled " << id << oendl;
+ reCheckDoctab(id);
}
}
-
+void LauncherTabWidget::reCheckDoctab(int how)
+{
+ if ((bool)how == docTabEnabled) {
+ /* nothing to do */
+ return;
+ }
+ if (docLoadingWidget) {
+ stack->removeWidget(docLoadingWidget);
+ delete docLoadingWidget;
+ docLoadingWidget = 0;
+ }
+ createDocLoadingWidget();
+ {
+ QCopEnvelope( "QPE/System", "reforceDocuments()" );
+ odebug << "Sending doc rescan" << oendl;
+ }
+}
//---------------------------------------------------------------------------
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h
index db6ac54..b741064 100644
--- a/core/launcher/launcher.h
+++ b/core/launcher/launcher.h
@@ -82,4 +82,5 @@ protected:
void paletteChange( const QPalette &p );
void styleChange( QStyle & );
+ void reCheckDoctab(int how);
private:
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index c9efacb..2783423 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -333,7 +333,4 @@ void LauncherIconView::setSortMethod( SortMethod m )
void LauncherIconView::setCategoryFilter( int catfilter, bool resort )
{
- Categories cat;
- cat.load( categoryFileName() );
- QString str;
if ( catfilter == -2 )
cf = 0;
@@ -1084,4 +1081,5 @@ void LauncherView::removeAllItems()
{
odebug << "LauncherView::removeAllItems()" << oendl;
+ if (LauncherIconView::sm_EyeCache) LauncherIconView::sm_EyeCache->clear();
icons->clear();
}
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 42186d3..15cd686 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -165,5 +165,5 @@ Server::Server() :
QCopChannel *desktopChannel = new QCopChannel( "QPE/Desktop", this );
connect( desktopChannel, SIGNAL(received( const QCString &, const QByteArray & )),
- this, SLOT(desktopMessage( const QCString &, const QByteArray & )) );
+ this, SLOT(desktopMessage( const QCString &, const QByteArray & )) );
#endif
@@ -217,18 +217,18 @@ static bool hasVisibleWindow(const QString& clientname, bool partial)
QWSWindow* w;
for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
- if ( w->client()->identity() == clientname ) {
- if ( partial && !w->isFullyObscured() )
- return TRUE;
- if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
+ if ( w->client()->identity() == clientname ) {
+ if ( partial && !w->isFullyObscured() )
+ return TRUE;
+ if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
# if QT_VERSION < 0x030000
- QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
- QSize(qt_screen->width(),qt_screen->height()) );
+ QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
+ QSize(qt_screen->width(),qt_screen->height()) );
# else
- QRect mwr = qt_maxWindowRect;
+ QRect mwr = qt_maxWindowRect;
# endif
- if ( mwr.contains(w->requested().boundingRect()) )
- return TRUE;
- }
- }
+ if ( mwr.contains(w->requested().boundingRect()) )
+ return TRUE;
+ }
+ }
}
#endif
@@ -343,4 +343,6 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl;
docList->linkChanged(link);
+ } else if (msg =="reforceDocuments()") {
+ docList->reforceDocuments();
} else if ( msg == "serviceChanged(QString)" ) {
MimeType::updateApplications();
@@ -433,6 +435,6 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
} else if ( msg == "sendInstallLocations()" ) {
#ifndef QT_NO_COP
- QCopEnvelope e( "QPE/Desktop", "installLocations(QString)" );
- e << installLocationsString();
+ QCopEnvelope e( "QPE/Desktop", "installLocations(QString)" );
+ e << installLocationsString();
#endif
} else if ( msg == "sendSyncDate(QString)" ) {
@@ -471,7 +473,7 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data)
#ifdef QPE_HAVE_DIRECT_ACCESS
else if ( msg == "prepareDirectAccess()" ) {
- prepareDirectAccess();
+ prepareDirectAccess();
} else if ( msg == "postDirectAccess()" ) {
- postDirectAccess();
+ postDirectAccess();
}
#endif
@@ -558,20 +560,20 @@ QString Server::cardInfoString()
QString homeFs, homeFsPath;
for ( ; it.current(); ++it ) {
- int k4 = (*it)->blockSize()/256;
- if ( (*it)->isRemovable() ) {
- s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr
- + QString::number( (*it)->availBlocks() * k4/4 )
- + "K " + (*it)->options() + ";";
- } else if ( homeDir.contains( (*it)->path() ) &&
- (*it)->path().length() > homeFsPath.length() ) {
- homeFsPath = (*it)->path();
- homeFs =
- (*it)->name() + "=" + homeDir + "/Documents " // No tr
- + QString::number( (*it)->availBlocks() * k4/4 )
- + "K " + (*it)->options() + ";";
- }
+ int k4 = (*it)->blockSize()/256;
+ if ( (*it)->isRemovable() ) {
+ s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr
+ + QString::number( (*it)->availBlocks() * k4/4 )
+ + "K " + (*it)->options() + ";";
+ } else if ( homeDir.contains( (*it)->path() ) &&
+ (*it)->path().length() > homeFsPath.length() ) {
+ homeFsPath = (*it)->path();
+ homeFs =
+ (*it)->name() + "=" + homeDir + "/Documents " // No tr
+ + QString::number( (*it)->availBlocks() * k4/4 )
+ + "K " + (*it)->options() + ";";
+ }
}
if ( !homeFs.isEmpty() )
- s += homeFs;
+ s += homeFs;
return s;
}
@@ -586,20 +588,20 @@ QString Server::installLocationsString()
QString homeFs, homeFsPath;
for ( ; it.current(); ++it ) {
- int k4 = (*it)->blockSize()/256;
- if ( (*it)->isRemovable() ) {
- s += (*it)->name() + "=" + (*it)->path() + " " // No tr
- + QString::number( (*it)->availBlocks() * k4/4 )
- + "K " + (*it)->options() + ";";
- } else if ( homeDir.contains( (*it)->path() ) &&
- (*it)->path().length() > homeFsPath.length() ) {
- homeFsPath = (*it)->path();
- homeFs =
- (*it)->name() + "=" + homeDir + " " // No tr
- + QString::number( (*it)->availBlocks() * k4/4 )
- + "K " + (*it)->options() + ";";
- }
+ int k4 = (*it)->blockSize()/256;
+ if ( (*it)->isRemovable() ) {
+ s += (*it)->name() + "=" + (*it)->path() + " " // No tr
+ + QString::number( (*it)->availBlocks() * k4/4 )
+ + "K " + (*it)->options() + ";";
+ } else if ( homeDir.contains( (*it)->path() ) &&
+ (*it)->path().length() > homeFsPath.length() ) {
+ homeFsPath = (*it)->path();
+ homeFs =
+ (*it)->name() + "=" + homeDir + " " // No tr
+ + QString::number( (*it)->availBlocks() * k4/4 )
+ + "K " + (*it)->options() + ";";
+ }
}
if ( !homeFs.isEmpty() )
- s = homeFs + s;
+ s = homeFs + s;
return s;
}
@@ -825,5 +827,5 @@ void Server::prepareDirectAccess()
#ifndef QT_NO_COP
{
- QCopEnvelope e( "QPE/Stabmon", "suspendMonitor()" );
+ QCopEnvelope e( "QPE/Stabmon", "suspendMonitor()" );
}
#endif
@@ -838,8 +840,8 @@ void Server::prepareDirectAccess()
directAccessRun = FALSE;
for ( QMap<int,QString>::ConstIterator it =
- appLauncher->runningApplications().begin();
- it != appLauncher->runningApplications().end();
- ++it ) {
- pendingFlushes++;
+ appLauncher->runningApplications().begin();
+ it != appLauncher->runningApplications().end();
+ ++it ) {
+ pendingFlushes++;
}
#ifndef QT_NO_COP
@@ -859,45 +861,45 @@ void Server::desktopMessage( const QCString &message, const QByteArray &data )
QDataStream stream( data, IO_ReadOnly );
if ( message == "flushDone(QString)" ) {
- QString app;
- stream >> app;
- qDebug( "flushDone from %s", app.latin1() );
- if ( --pendingFlushes == 0 ) {
- qDebug( "pendingFlushes == 0, all the apps responded" );
- runDirectAccess();
- }
+ QString app;
+ stream >> app;
+ qDebug( "flushDone from %s", app.latin1() );
+ if ( --pendingFlushes == 0 ) {
+ qDebug( "pendingFlushes == 0, all the apps responded" );
+ runDirectAccess();
+ }
} else if ( message == "installStarted(QString)" ) {
- QString package;
- stream >> package;
- qDebug( "\tInstall Started for package %s", package.latin1() );
+ QString package;
+ stream >> package;
+ qDebug( "\tInstall Started for package %s", package.latin1() );
} else if ( message == "installStep(QString)" ) {
- QString step;
- stream >> step;
- qDebug( "\tInstall Step %s", step.latin1() );
+ QString step;
+ stream >> step;
+ qDebug( "\tInstall Step %s", step.latin1() );
} else if ( message == "installDone(QString)" ) {
- QString package;
- stream >> package;
- qDebug( "\tInstall Finished for package %s", package.latin1() );
+ QString package;
+ stream >> package;
+ qDebug( "\tInstall Finished for package %s", package.latin1() );
} else if ( message == "installFailed(QString,int,QString)" ) {
- QString package, error;
- int status;
- stream >> package >> status >> error;
- qDebug( "\tInstall Failed for package %s with error code %d and error message %s",
- package.latin1(), status, error.latin1() );
+ QString package, error;
+ int status;
+ stream >> package >> status >> error;
+ qDebug( "\tInstall Failed for package %s with error code %d and error message %s",
+ package.latin1(), status, error.latin1() );
} else if ( message == "removeStarted(QString)" ) {
- QString package;
- stream >> package;
- qDebug( "\tRemove Started for package %s", package.latin1() );
+ QString package;
+ stream >> package;
+ qDebug( "\tRemove Started for package %s", package.latin1() );
} else if ( message == "removeDone(QString)" ) {
- QString package;
- stream >> package;
- qDebug( "\tRemove Finished for package %s", package.latin1() );
+ QString package;
+ stream >> package;
+ qDebug( "\tRemove Finished for package %s", package.latin1() );
} else if ( message == "removeFailed(QString)" ) {
- QString package;
- stream >> package;
- qDebug( "\tRemove Failed for package %s", package.latin1() );
+ QString package;
+ stream >> package;
+ qDebug( "\tRemove Failed for package %s", package.latin1() );
}
if ( qrr && qrr->waitingForMessages )
- qrr->desktopMessage( message, data );
+ qrr->desktopMessage( message, data );
}
@@ -910,5 +912,5 @@ void Server::runDirectAccess()
// with flushDone(). Just ignore it.
if ( directAccessRun )
- return;
+ return;
directAccessRun = TRUE;
@@ -935,5 +937,5 @@ void Server::postDirectAccess()
#ifndef QT_NO_COP
{
- QCopEnvelope e( "QPE/Stabmon", "restartMonitor()" );
+ QCopEnvelope e( "QPE/Stabmon", "restartMonitor()" );
}
#endif
@@ -943,20 +945,20 @@ void Server::postDirectAccess()
QFile *file = new QFile( queueFile );
if ( !file->exists() ) {
- delete file;
- // Get rid of the dialog
- if ( syncDialog ) {
- delete syncDialog;
- syncDialog = 0;
- }
+ delete file;
+ // Get rid of the dialog
+ if ( syncDialog ) {
+ delete syncDialog;
+ syncDialog = 0;
+ }
#warning FIXME support TempScreenSaverMode
#if 0
- QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
+ QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
#endif
} else {
- qrr = new QueuedRequestRunner( file, syncDialog );
- connect( qrr, SIGNAL(finished()),
- this, SLOT(finishedQueuedRequests()) );
- QTimer::singleShot( 100, qrr, SLOT(process()) );
- // qrr will remove the sync dialog later
+ qrr = new QueuedRequestRunner( file, syncDialog );
+ connect( qrr, SIGNAL(finished()),
+ this, SLOT(finishedQueuedRequests()) );
+ QTimer::singleShot( 100, qrr, SLOT(process()) );
+ // qrr will remove the sync dialog later
}
#endif
@@ -966,18 +968,18 @@ void Server::finishedQueuedRequests()
{
if ( qrr->readyToDelete ) {
- delete qrr;
- qrr = 0;
- // Get rid of the dialog
- if ( syncDialog ) {
- delete syncDialog;
- syncDialog = 0;
- }
+ delete qrr;
+ qrr = 0;
+ // Get rid of the dialog
+ if ( syncDialog ) {
+ delete syncDialog;
+ syncDialog = 0;
+ }
#warning FIXME support TempScreenSaverMode
#if 0
- QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
+ QPEApplication::setTempScreenSaverMode(QPEApplication::Enable);
#endif
} else {
- qrr->readyToDelete = TRUE;
- QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) );
+ qrr->readyToDelete = TRUE;
+ QTimer::singleShot( 0, this, SLOT(finishedQueuedRequests()) );
}
}