author | zecke <zecke> | 2002-03-24 19:31:32 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-24 19:31:32 (UTC) |
commit | eb813af4c1e301c8ba015627a1da04f8199a3be2 (patch) (unidiff) | |
tree | 7f23f61c2d8c58655fc98798b7f1b4aec75b5ff3 /library/global.cpp | |
parent | 4802684dd785274be50b472c87e315da0e325449 (diff) | |
download | opie-eb813af4c1e301c8ba015627a1da04f8199a3be2.zip opie-eb813af4c1e301c8ba015627a1da04f8199a3be2.tar.gz opie-eb813af4c1e301c8ba015627a1da04f8199a3be2.tar.bz2 |
Here is the second chunk of bits to make things a bit more fast
-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 | |||
@@ -48,6 +48,28 @@ | |||
48 | #include <qwindowsystem_qws.h> // for qwsServer | 48 | #include <qwindowsystem_qws.h> // for qwsServer |
49 | #include <qdatetime.h> | 49 | #include <qdatetime.h> |
50 | 50 | ||
51 | #include <qfile.h> | ||
52 | |||
53 | namespace { | ||
54 | // checks if the storage should be searched | ||
55 | bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke | ||
56 | QFile file(path ); | ||
57 | if(!file.open(IO_ReadOnly ) ) | ||
58 | return true; | ||
59 | |||
60 | QByteArray array = file.readAll(); | ||
61 | QStringList list = QStringList::split('\n', QString( array ) ); | ||
62 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ | ||
63 | if( (*it).startsWith("autocheck = 0" ) ){ | ||
64 | return true; | ||
65 | }else if( (*it).startsWith("autocheck = 1" ) ){ | ||
66 | return false; | ||
67 | } | ||
68 | } | ||
69 | return true; | ||
70 | } | ||
71 | } | ||
72 | |||
51 | //#include "quickexec_p.h" | 73 | //#include "quickexec_p.h" |
52 | 74 | ||
53 | class Emitter : public QObject { | 75 | class Emitter : public QObject { |
@@ -638,11 +660,14 @@ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) | |||
638 | const QList<FileSystem> &fs = storage.fileSystems(); | 660 | const QList<FileSystem> &fs = storage.fileSystems(); |
639 | QListIterator<FileSystem> it ( fs ); | 661 | QListIterator<FileSystem> it ( fs ); |
640 | for ( ; it.current(); ++it ) { | 662 | for ( ; it.current(); ++it ) { |
641 | if ( (*it)->isRemovable() ) { | 663 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
642 | QString path = (*it)->path(); | 664 | // this is a candidate look at the cf and see if we should search on it |
643 | DocLnkSet ide( path, mimefilter ); | 665 | QString path = (*it)->path(); |
644 | folder->appendFrom(ide); | 666 | if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) ) |
645 | } | 667 | continue; |
668 | DocLnkSet ide( path, mimefilter ); | ||
669 | folder->appendFrom(ide); | ||
670 | } | ||
646 | } | 671 | } |
647 | } | 672 | } |
648 | 673 | ||