-rw-r--r-- | library/global.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/library/global.cpp b/library/global.cpp index dd15eb7..5a28595 100644 --- a/library/global.cpp +++ b/library/global.cpp @@ -47,8 +47,30 @@ #include <qwindowsystem_qws.h> // for qwsServer #include <qdatetime.h> +#include <qfile.h> + +namespace { + // checks if the storage should be searched + bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke + QFile file(path ); + if(!file.open(IO_ReadOnly ) ) + return true; + + QByteArray array = file.readAll(); + QStringList list = QStringList::split('\n', QString( array ) ); + for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ + if( (*it).startsWith("autocheck = 0" ) ){ + return true; + }else if( (*it).startsWith("autocheck = 1" ) ){ + return false; + } + } + return true; + } +} + //#include "quickexec_p.h" class Emitter : public QObject { Q_OBJECT @@ -637,13 +659,16 @@ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it ( fs ); for ( ; it.current(); ++it ) { - if ( (*it)->isRemovable() ) { - QString path = (*it)->path(); - DocLnkSet ide( path, mimefilter ); - folder->appendFrom(ide); - } + if ( (*it)->isRemovable() ) { // let's find out if we should search on it + // this is a candidate look at the cf and see if we should search on it + QString path = (*it)->path(); + if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) ) + continue; + DocLnkSet ide( path, mimefilter ); + folder->appendFrom(ide); + } } } QStringList Global::languageList() |