From 1a89ecd8e2d11d48a8e80b2fd8b1e95b738a286c Mon Sep 17 00:00:00 2001 From: alwin Date: Sat, 21 Feb 2004 21:43:40 +0000 Subject: on removable medias take a look into .opiestorage.cf and read the list of subdirs of the media where to search for documents. If this value isn't set, it will reduce search to FS+"/Documents" so not the whole media is searched. ToDo: Work on mediummount that users can set this values. Implement same stuff in global.cpp of libqpe. --- (limited to 'core') 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 @@ -63,6 +63,8 @@ public: const DocLnk *iterate(); bool store( DocLnk* dl ); void estimatedPercentScanned(); + void appendDocpath(FileSystem*); + DocLnkSet dls; QDict reference; @@ -427,6 +429,32 @@ DocumentListPrivate::DocumentListPrivate( ServerInterface *gui ) 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() { @@ -441,13 +469,14 @@ void DocumentListPrivate::initialize() int i = 1; const QList &fs = storage->fileSystems(); QListIterator it( fs ); - for ( ; it.current(); ++it ) - if ( (*it)->isRemovable() ) { - docPaths += (*it)->path(); - i++; - } + for ( ; it.current(); ++it ) { + if ( (*it)->isRemovable() ) { + 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; -- cgit v0.9.0.2