summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/global.cpp27
-rw-r--r--library/global.h8
-rw-r--r--library/storage.cpp5
3 files changed, 38 insertions, 2 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 @@
39#include <qregexp.h> 39#include <qregexp.h>
40 40
41#include <stdlib.h> 41#include <stdlib.h>
42#include <sys/stat.h> 42#include <sys/stat.h>
43#include <sys/wait.h> 43#include <sys/wait.h>
44#include <sys/types.h> 44#include <sys/types.h>
45#include <fcntl.h> 45#include <fcntl.h>
46#include <unistd.h> 46#include <unistd.h>
47 47
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
53namespace {
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
53class Emitter : public QObject { 75class Emitter : public QObject {
54 Q_OBJECT 76 Q_OBJECT
55public: 77public:
56 Emitter( QWidget* receiver, const QString& document ) 78 Emitter( QWidget* receiver, const QString& document )
57 { 79 {
58 connect(this, SIGNAL(setDocument(const QString&)), 80 connect(this, SIGNAL(setDocument(const QString&)),
59 receiver, SLOT(setDocument(const QString&))); 81 receiver, SLOT(setDocument(const QString&)));
60 emit setDocument(document); 82 emit setDocument(document);
61 disconnect(this, SIGNAL(setDocument(const QString&)), 83 disconnect(this, SIGNAL(setDocument(const QString&)),
62 receiver, SLOT(setDocument(const QString&))); 84 receiver, SLOT(setDocument(const QString&)));
@@ -629,26 +651,29 @@ QString Global::stringQuote(const QString& s)
629 match the filter \a mimefilter, and appends the resulting DocLnk 651 match the filter \a mimefilter, and appends the resulting DocLnk
630 objects to \a folder. 652 objects to \a folder.
631*/ 653*/
632void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) 654void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter)
633{ 655{
634 QString homedocs = QString(getenv("HOME")) + "/Documents"; 656 QString homedocs = QString(getenv("HOME")) + "/Documents";
635 DocLnkSet d(homedocs,mimefilter); 657 DocLnkSet d(homedocs,mimefilter);
636 folder->appendFrom(d); 658 folder->appendFrom(d);
637 StorageInfo storage; 659 StorageInfo storage;
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
664 // this is a candidate look at the cf and see if we should search on it
642 QString path = (*it)->path(); 665 QString path = (*it)->path();
666 if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) )
667 continue;
643 DocLnkSet ide( path, mimefilter ); 668 DocLnkSet ide( path, mimefilter );
644 folder->appendFrom(ide); 669 folder->appendFrom(ide);
645 } 670 }
646 } 671 }
647} 672}
648 673
649QStringList Global::languageList() 674QStringList Global::languageList()
650{ 675{
651 QString lang = getenv("LANG"); 676 QString lang = getenv("LANG");
652 QStringList langs; 677 QStringList langs;
653 langs.append(lang); 678 langs.append(lang);
654 int i = lang.find("."); 679 int 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 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Holger 'zecke' Freyther <freyther@kde.org>
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 3** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 4**
4** This file is part of Qtopia Environment. 5** This file is part of Qtopia Environment.
5** 6**
6** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 10** packaging of this file.
10** 11**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 14**
@@ -36,24 +37,26 @@ public:
36 // Dictionaries 37 // Dictionaries
37 static const QDawg& fixedDawg(); 38 static const QDawg& fixedDawg();
38 static const QDawg& addedDawg(); 39 static const QDawg& addedDawg();
39 static const QDawg& dawg(const QString& name); 40 static const QDawg& dawg(const QString& name);
40 41
41 static void addWords(const QStringList& word); 42 static void addWords(const QStringList& word);
42 static void addWords(const QString& dictname, const QStringList& word); 43 static void addWords(const QString& dictname, const QStringList& word);
43 // static void removeWords(const QStringList& word); -- if someone wants it 44 // static void removeWords(const QStringList& word); -- if someone wants it
44 45
45 static void createDocDir(); 46 static void createDocDir();
46 47
47 static void findDocuments(DocLnkSet* folder, const QString &mimefilter=QString::null); 48 static void findDocuments(DocLnkSet* folder, const QString &mimefilter=QString::null);
49 // we don't need a mimefilter. Same as above but this is fast as light speed or not ;)
50 //static void findNewDocuments( DocLnkSet* folder );
48 51
49 static QString applicationFileName(const QString& appname, const QString& filename); 52 static QString applicationFileName(const QString& appname, const QString& filename);
50 53
51 struct Command { 54 struct Command {
52 const char *file; 55 const char *file;
53 QWidget *(*func)( bool ); 56 QWidget *(*func)( bool );
54 bool maximized; 57 bool maximized;
55 bool documentary; 58 bool documentary;
56 }; 59 };
57 static void setBuiltinCommands( Command* ); 60 static void setBuiltinCommands( Command* );
58 61
59 static void invoke( const QString &exec); 62 static void invoke( const QString &exec);
@@ -68,18 +71,23 @@ public:
68 static void applyStyle(); 71 static void applyStyle();
69 static void statusMessage(const QString&); 72 static void statusMessage(const QString&);
70 static QWidget *shutdown( bool = FALSE ); 73 static QWidget *shutdown( bool = FALSE );
71 static QWidget *restart( bool = FALSE ); 74 static QWidget *restart( bool = FALSE );
72 static void hideInputMethod(); 75 static void hideInputMethod();
73 static void showInputMethod(); 76 static void showInputMethod();
74 77
75 static void writeHWClock(); 78 static void writeHWClock();
76 79
77 static QString shellQuote(const QString& s); 80 static QString shellQuote(const QString& s);
78 static QString stringQuote(const QString& s); 81 static QString stringQuote(const QString& s);
79 82
83#ifdef QTOPIA_INTERNAL_LANGLIST
84 static QStringList languageList();
85 static QStringList helpPath();
86#endif
87
80private: 88private:
81 static Command* builtin; 89 static Command* builtin;
82 static QGuardedPtr<QWidget> *running; 90 static QGuardedPtr<QWidget> *running;
83}; 91};
84 92
85#endif 93#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 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org>
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 3** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 4**
4** This file is part of Qtopia Environment. 5** This file is part of Qtopia Environment.
5** 6**
6** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 10** packaging of this file.
10** 11**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 14**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 15** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 16**
16** Contact info@trolltech.com if any conditions of this licensing are 17** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 18** not clear to you.
18** 19**
19**********************************************************************/ 20**********************************************************************/
20 21
21#include <qpe/storage.h> 22#include <qpe/storage.h>
22#ifdef QT_QWS_CUSTOM 23#ifdef QT_QWS_CUSTOM
23#include <qpe/custom.h> 24#include <qpe/custom.h>
24#endif 25#endif
25 26
27#include <qfile.h>
26#include <qtimer.h> 28#include <qtimer.h>
27#include <qcopchannel_qws.h> 29#include <qcopchannel_qws.h>
28 30
29#include <stdio.h> 31#include <stdio.h>
30 32
31#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 33#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
32#include <sys/vfs.h> 34#include <sys/vfs.h>
33#include <mntent.h> 35#include <mntent.h>
34#endif 36#endif
35 37
36#include <qstringlist.h> 38#include <qstringlist.h>
37 39
@@ -75,25 +77,26 @@ const FileSystem *StorageInfo::fileSystemOf( const QString &filename )
75 if ( filename.startsWith( (*i)->path() ) ) 77 if ( filename.startsWith( (*i)->path() ) )
76 return (*i); 78 return (*i);
77 } 79 }
78 return 0; 80 return 0;
79} 81}
80 82
81 83
82void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) 84void StorageInfo::cardMessage( const QCString& msg, const QByteArray& )
83{ 85{
84 if ( msg == "mtabChanged()" ) 86 if ( msg == "mtabChanged()" )
85 update(); 87 update();
86} 88}
87 89// cause of the lack of a d pointer we need
90// to store informations in a config file :(
88void StorageInfo::update() 91void StorageInfo::update()
89{ 92{
90 //qDebug("StorageInfo::updating"); 93 //qDebug("StorageInfo::updating");
91#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 94#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
92 struct mntent *me; 95 struct mntent *me;
93 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 96 FILE *mntfp = setmntent( "/etc/mtab", "r" );
94 97
95 QStringList curdisks; 98 QStringList curdisks;
96 QStringList curopts; 99 QStringList curopts;
97 QStringList curfs; 100 QStringList curfs;
98 bool rebuild = FALSE; 101 bool rebuild = FALSE;
99 int n=0; 102 int n=0;