-rw-r--r-- | library/global.cpp | 35 | ||||
-rw-r--r-- | library/global.h | 8 | ||||
-rw-r--r-- | library/storage.cpp | 5 |
3 files changed, 42 insertions, 6 deletions
diff --git a/library/global.cpp b/library/global.cpp index dd15eb7..5a28595 100644 --- a/library/global.cpp +++ b/library/global.cpp @@ -39,24 +39,46 @@ #include <qregexp.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/wait.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #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 public: Emitter( QWidget* receiver, const QString& document ) { connect(this, SIGNAL(setDocument(const QString&)), receiver, SLOT(setDocument(const QString&))); emit setDocument(document); disconnect(this, SIGNAL(setDocument(const QString&)), receiver, SLOT(setDocument(const QString&))); @@ -629,29 +651,32 @@ QString Global::stringQuote(const QString& s) match the filter \a mimefilter, and appends the resulting DocLnk objects to \a folder. */ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) { QString homedocs = QString(getenv("HOME")) + "/Documents"; DocLnkSet d(homedocs,mimefilter); folder->appendFrom(d); 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() { QString lang = getenv("LANG"); QStringList langs; langs.append(lang); int i = lang.find("."); if ( i > 0 ) lang = lang.left( i ); i = lang.find( "_" ); diff --git a/library/global.h b/library/global.h index d9ff8f8..fdf8754 100644 --- a/library/global.h +++ b/library/global.h @@ -1,13 +1,14 @@ /********************************************************************** +** Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org> ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** @@ -36,24 +37,26 @@ public: // Dictionaries static const QDawg& fixedDawg(); static const QDawg& addedDawg(); static const QDawg& dawg(const QString& name); static void addWords(const QStringList& word); static void addWords(const QString& dictname, const QStringList& word); // static void removeWords(const QStringList& word); -- if someone wants it static void createDocDir(); static void findDocuments(DocLnkSet* folder, const QString &mimefilter=QString::null); + // we don't need a mimefilter. Same as above but this is fast as light speed or not ;) + //static void findNewDocuments( DocLnkSet* folder ); static QString applicationFileName(const QString& appname, const QString& filename); struct Command { const char *file; QWidget *(*func)( bool ); bool maximized; bool documentary; }; static void setBuiltinCommands( Command* ); static void invoke( const QString &exec); @@ -68,18 +71,23 @@ public: static void applyStyle(); static void statusMessage(const QString&); static QWidget *shutdown( bool = FALSE ); static QWidget *restart( bool = FALSE ); static void hideInputMethod(); static void showInputMethod(); static void writeHWClock(); static QString shellQuote(const QString& s); static QString stringQuote(const QString& s); +#ifdef QTOPIA_INTERNAL_LANGLIST + static QStringList languageList(); + static QStringList helpPath(); +#endif + private: static Command* builtin; static QGuardedPtr<QWidget> *running; }; #endif diff --git a/library/storage.cpp b/library/storage.cpp index bd34a5f..a4c96be 100644 --- a/library/storage.cpp +++ b/library/storage.cpp @@ -1,37 +1,39 @@ /********************************************************************** +** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qpe/storage.h> #ifdef QT_QWS_CUSTOM #include <qpe/custom.h> #endif +#include <qfile.h> #include <qtimer.h> #include <qcopchannel_qws.h> #include <stdio.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <sys/vfs.h> #include <mntent.h> #endif #include <qstringlist.h> @@ -75,25 +77,26 @@ const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) if ( filename.startsWith( (*i)->path() ) ) return (*i); } return 0; } void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) { if ( msg == "mtabChanged()" ) update(); } - +// cause of the lack of a d pointer we need +// to store informations in a config file :( void StorageInfo::update() { //qDebug("StorageInfo::updating"); #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) struct mntent *me; FILE *mntfp = setmntent( "/etc/mtab", "r" ); QStringList curdisks; QStringList curopts; QStringList curfs; bool rebuild = FALSE; int n=0; |