-rw-r--r-- | library/global.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/global.cpp b/library/global.cpp index d02e711..9b3c51e 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -45,133 +45,133 @@ | |||
45 | 45 | ||
46 | #include <qwindowsystem_qws.h> // for qwsServer | 46 | #include <qwindowsystem_qws.h> // for qwsServer |
47 | #include <qdatetime.h> | 47 | #include <qdatetime.h> |
48 | 48 | ||
49 | #include <qfile.h> | 49 | #include <qfile.h> |
50 | 50 | ||
51 | namespace { | 51 | namespace { |
52 | // checks if the storage should be searched | 52 | // checks if the storage should be searched |
53 | bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke | 53 | bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke |
54 | QFile file(path ); | 54 | QFile file(path ); |
55 | if(!file.open(IO_ReadOnly ) ) | 55 | if(!file.open(IO_ReadOnly ) ) |
56 | return true; | 56 | return true; |
57 | 57 | ||
58 | QByteArray array = file.readAll(); | 58 | QByteArray array = file.readAll(); |
59 | QStringList list = QStringList::split('\n', QString( array ) ); | 59 | QStringList list = QStringList::split('\n', QString( array ) ); |
60 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ | 60 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ |
61 | if( (*it).startsWith("autocheck = 0" ) ){ | 61 | if( (*it).startsWith("autocheck = 0" ) ){ |
62 | return false; | 62 | return false; |
63 | }else if( (*it).startsWith("autocheck = 1" ) ){ | 63 | }else if( (*it).startsWith("autocheck = 1" ) ){ |
64 | return true; | 64 | return true; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | return true; | 67 | return true; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | //#include "quickexec_p.h" | 71 | //#include "quickexec_p.h" |
72 | 72 | ||
73 | class Emitter : public QObject { | 73 | class Emitter : public QObject { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | public: | 75 | public: |
76 | Emitter( QWidget* receiver, const QString& document ) | 76 | Emitter( QWidget* receiver, const QString& document ) |
77 | { | 77 | { |
78 | connect(this, SIGNAL(setDocument(const QString&)), | 78 | connect(this, SIGNAL(setDocument(const QString&)), |
79 | receiver, SLOT(setDocument(const QString&))); | 79 | receiver, SLOT(setDocument(const QString&))); |
80 | emit setDocument(document); | 80 | emit setDocument(document); |
81 | disconnect(this, SIGNAL(setDocument(const QString&)), | 81 | disconnect(this, SIGNAL(setDocument(const QString&)), |
82 | receiver, SLOT(setDocument(const QString&))); | 82 | receiver, SLOT(setDocument(const QString&))); |
83 | } | 83 | } |
84 | 84 | ||
85 | signals: | 85 | signals: |
86 | void setDocument(const QString&); | 86 | void setDocument(const QString&); |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | class StartingAppList : public QObject { | 90 | class StartingAppList : public QObject { |
91 | Q_OBJECT | 91 | Q_OBJECT |
92 | public: | 92 | public: |
93 | static void add( const QString& name ); | 93 | static void add( const QString& name ); |
94 | static bool isStarting( const QString name ); | 94 | static bool isStarting( const QString name ); |
95 | private slots: | 95 | private slots: |
96 | void handleNewChannel( const QString &); | 96 | void handleNewChannel( const QString &); |
97 | private: | 97 | private: |
98 | StartingAppList( QObject *parent=0, const char* name=0 ) ; | 98 | StartingAppList( QObject *parent=0, const char* name=0 ) ; |
99 | 99 | ||
100 | QDict<QTime> dict; | 100 | QDict<QTime> dict; |
101 | static StartingAppList *appl; | 101 | static StartingAppList *appl; |
102 | }; | 102 | }; |
103 | 103 | ||
104 | StartingAppList* StartingAppList::appl = 0; | 104 | StartingAppList* StartingAppList::appl = 0; |
105 | 105 | ||
106 | StartingAppList::StartingAppList( QObject *parent, const char* name ) | 106 | StartingAppList::StartingAppList( QObject *parent, const char* name ) |
107 | :QObject( parent, name ) | 107 | :QObject( parent, name ) |
108 | { | 108 | { |
109 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 109 | #if QT_VERSION >= 232 && defined(QWS) |
110 | connect( qwsServer, SIGNAL( newChannel(const QString&)), | 110 | connect( qwsServer, SIGNAL( newChannel(const QString&)), |
111 | this, SLOT( handleNewChannel(const QString&)) ); | 111 | this, SLOT( handleNewChannel(const QString&)) ); |
112 | #endif | ||
112 | dict.setAutoDelete( TRUE ); | 113 | dict.setAutoDelete( TRUE ); |
113 | #endif | ||
114 | } | 114 | } |
115 | 115 | ||
116 | void StartingAppList::add( const QString& name ) | 116 | void StartingAppList::add( const QString& name ) |
117 | { | 117 | { |
118 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 118 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
119 | if ( !appl ) | 119 | if ( !appl ) |
120 | appl = new StartingAppList; | 120 | appl = new StartingAppList; |
121 | QTime *t = new QTime; | 121 | QTime *t = new QTime; |
122 | t->start(); | 122 | t->start(); |
123 | appl->dict.insert( "QPE/Application/" + name, t ); | 123 | appl->dict.insert( "QPE/Application/" + name, t ); |
124 | #endif | 124 | #endif |
125 | } | 125 | } |
126 | 126 | ||
127 | bool StartingAppList::isStarting( const QString name ) | 127 | bool StartingAppList::isStarting( const QString name ) |
128 | { | 128 | { |
129 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 129 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
130 | if ( appl ) { | 130 | if ( appl ) { |
131 | QTime *t = appl->dict.find( "QPE/Application/" + name ); | 131 | QTime *t = appl->dict.find( "QPE/Application/" + name ); |
132 | if ( !t ) | 132 | if ( !t ) |
133 | return FALSE; | 133 | return FALSE; |
134 | if ( t->elapsed() > 10000 ) { | 134 | if ( t->elapsed() > 10000 ) { |
135 | // timeout in case of crash or something | 135 | // timeout in case of crash or something |
136 | appl->dict.remove( "QPE/Application/" + name ); | 136 | appl->dict.remove( "QPE/Application/" + name ); |
137 | return FALSE; | 137 | return FALSE; |
138 | } | 138 | } |
139 | return TRUE; | 139 | return TRUE; |
140 | } | 140 | } |
141 | #endif | 141 | #endif |
142 | return FALSE; | 142 | return FALSE; |
143 | } | 143 | } |
144 | 144 | ||
145 | void StartingAppList::handleNewChannel( const QString & name ) | 145 | void StartingAppList::handleNewChannel( const QString & name ) |
146 | { | 146 | { |
147 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) | 147 | #if QT_VERSION >= 232 && !defined(QT_NO_COP) |
148 | dict.remove( name ); | 148 | dict.remove( name ); |
149 | #endif | 149 | #endif |
150 | } | 150 | } |
151 | 151 | ||
152 | static bool docDirCreated = FALSE; | 152 | static bool docDirCreated = FALSE; |
153 | static QDawg* fixed_dawg = 0; | 153 | static QDawg* fixed_dawg = 0; |
154 | static QDict<QDawg> *named_dawg = 0; | 154 | static QDict<QDawg> *named_dawg = 0; |
155 | 155 | ||
156 | static QString qpeDir() | 156 | static QString qpeDir() |
157 | { | 157 | { |
158 | QString dir = getenv("OPIEDIR"); | 158 | QString dir = getenv("OPIEDIR"); |
159 | if ( dir.isEmpty() ) dir = ".."; | 159 | if ( dir.isEmpty() ) dir = ".."; |
160 | return dir; | 160 | return dir; |
161 | } | 161 | } |
162 | 162 | ||
163 | static QString dictDir() | 163 | static QString dictDir() |
164 | { | 164 | { |
165 | return qpeDir() + "/etc/dict"; | 165 | return qpeDir() + "/etc/dict"; |
166 | } | 166 | } |
167 | 167 | ||
168 | /*! | 168 | /*! |
169 | \class Global global.h | 169 | \class Global global.h |
170 | \brief The Global class provides application-wide global functions. | 170 | \brief The Global class provides application-wide global functions. |
171 | 171 | ||
172 | The Global functions are grouped as follows: | 172 | The Global functions are grouped as follows: |
173 | \tableofcontents | 173 | \tableofcontents |
174 | 174 | ||
175 | \section1 User Interface | 175 | \section1 User Interface |
176 | 176 | ||
177 | The statusMessage() function provides short-duration messages to the | 177 | The statusMessage() function provides short-duration messages to the |