-rw-r--r-- | core/launcher/documentlist.cpp | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 440bf1e..fdba687 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -50,32 +50,34 @@ AppLnkSet *DocumentList::appLnkSet = 0; static const int MAX_SEARCH_DEPTH = 10; class DocumentListPrivate : public QObject { Q_OBJECT public: DocumentListPrivate( ServerInterface *gui ); ~DocumentListPrivate(); void initialize(); const QString nextFile(); const DocLnk *iterate(); bool store( DocLnk* dl ); void estimatedPercentScanned(); + void appendDocpath(FileSystem*); + DocLnkSet dls; QDict<void> reference; QDictIterator<void> *dit; enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; QStringList docPaths; unsigned int docPathsSearched; int searchDepth; QDir *listDirs[MAX_SEARCH_DEPTH]; const QFileInfoList *lists[MAX_SEARCH_DEPTH]; unsigned int listPositions[MAX_SEARCH_DEPTH]; StorageInfo *storage; @@ -414,53 +416,80 @@ DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) if ( serverGui ) { sendAppLnks = serverGui->requiresApplications(); sendDocLnks = serverGui->requiresDocuments(); } else { sendAppLnks = false; sendDocLnks = false; } for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) { listDirs[i] = 0; lists[i] = 0; listPositions[i] = 0; } initialize(); tid = 0; } +void DocumentListPrivate::appendDocpath(FileSystem*fs) +{ + QDir defPath(fs->path()+"/Documents"); + QFileInfo f(fs->path()+"/.opiestorage.cf"); + if (!f.exists()) { + if (defPath.exists()) { + docPaths+=defPath.path(); + } + return; + } + Config conf(f.filePath(), Config::File ); + conf.setGroup("subdirs"); + QStringList subDirs = conf.readListEntry("subdirs",':'); + if (subDirs.isEmpty()) { + if (defPath.exists()) { + docPaths+=defPath.path(); + } + return; + } + for (unsigned c = 0; c < subDirs.count();++c) { + QDir docDir(QString(fs->path()+"/"+subDirs[c])); + if (docDir.exists()) { + docPaths+=docDir.path(); + } + } +} void DocumentListPrivate::initialize() { // Reset dls.clear(); docPaths.clear(); 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 ) + for ( ; it.current(); ++it ) { if ( (*it)->isRemovable() ) { - docPaths += (*it)->path(); - i++; + appendDocpath((*it)); + ++i; + } } - for ( int i = 0; i < MAX_SEARCH_DEPTH; 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() |