summaryrefslogtreecommitdiff
path: root/library/global.cpp
Unidiff
Diffstat (limited to 'library/global.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/library/global.cpp b/library/global.cpp
index a627348..5ac969b 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -1,179 +1,177 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** 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 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <qpe/qpedebug.h> 21#include <qpe/qpedebug.h>
22#include <qpe/global.h> 22#include <qpe/global.h>
23#include <qpe/qdawg.h> 23#include <qpe/qdawg.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
29#include <qpe/config.h> 29#include <qpe/config.h>
30 30
31#include <qfile.h>
32#include <qlabel.h> 31#include <qlabel.h>
33#include <qtimer.h> 32#include <qtimer.h>
34#include <qmap.h> 33#include <qmap.h>
35#include <qdict.h> 34#include <qdict.h>
36#include <qdir.h> 35#include <qdir.h>
37#include <qmessagebox.h> 36#include <qmessagebox.h>
38#include <qregexp.h> 37#include <qregexp.h>
39 38
40#include <stdlib.h> 39#include <stdlib.h>
41#include <sys/stat.h> 40#include <sys/stat.h>
42#include <sys/wait.h> 41#include <sys/wait.h>
43#include <sys/types.h> 42#include <sys/types.h>
44#include <fcntl.h> 43#include <fcntl.h>
45#include <unistd.h> 44#include <unistd.h>
46#include <errno.h> 45#include <errno.h>
47 46
48#include <qwindowsystem_qws.h> // for qwsServer 47#include <qwindowsystem_qws.h> // for qwsServer
49#include <qdatetime.h> 48#include <qdatetime.h>
50 49
51#include <qfile.h>
52 50
53//#include "quickexec_p.h" 51//#include "quickexec_p.h"
54 52
55class Emitter : public QObject { 53class Emitter : public QObject {
56 Q_OBJECT 54 Q_OBJECT
57public: 55public:
58 Emitter( QWidget* receiver, const QString& document ) 56 Emitter( QWidget* receiver, const QString& document )
59 { 57 {
60 connect(this, SIGNAL(setDocument(const QString&)), 58 connect(this, SIGNAL(setDocument(const QString&)),
61 receiver, SLOT(setDocument(const QString&))); 59 receiver, SLOT(setDocument(const QString&)));
62 emit setDocument(document); 60 emit setDocument(document);
63 disconnect(this, SIGNAL(setDocument(const QString&)), 61 disconnect(this, SIGNAL(setDocument(const QString&)),
64 receiver, SLOT(setDocument(const QString&))); 62 receiver, SLOT(setDocument(const QString&)));
65 } 63 }
66 64
67signals: 65signals:
68 void setDocument(const QString&); 66 void setDocument(const QString&);
69}; 67};
70 68
71 69
72class StartingAppList : public QObject { 70class StartingAppList : public QObject {
73 Q_OBJECT 71 Q_OBJECT
74public: 72public:
75 static void add( const QString& name ); 73 static void add( const QString& name );
76 static bool isStarting( const QString name ); 74 static bool isStarting( const QString name );
77private slots: 75private slots:
78 void handleNewChannel( const QString &); 76 void handleNewChannel( const QString &);
79private: 77private:
80 StartingAppList( QObject *parent=0, const char* name=0 ) ; 78 StartingAppList( QObject *parent=0, const char* name=0 ) ;
81 79
82 QDict<QTime> dict; 80 QDict<QTime> dict;
83 static StartingAppList *appl; 81 static StartingAppList *appl;
84}; 82};
85 83
86StartingAppList* StartingAppList::appl = 0; 84StartingAppList* StartingAppList::appl = 0;
87 85
88StartingAppList::StartingAppList( QObject *parent, const char* name ) 86StartingAppList::StartingAppList( QObject *parent, const char* name )
89 :QObject( parent, name ) 87 :QObject( parent, name )
90{ 88{
91#if QT_VERSION >= 232 && defined(QWS) 89#if QT_VERSION >= 232 && defined(QWS)
92 connect( qwsServer, SIGNAL( newChannel(const QString&)), 90 connect( qwsServer, SIGNAL( newChannel(const QString&)),
93 this, SLOT( handleNewChannel(const QString&)) ); 91 this, SLOT( handleNewChannel(const QString&)) );
94#endif 92#endif
95 dict.setAutoDelete( TRUE ); 93 dict.setAutoDelete( TRUE );
96} 94}
97 95
98void StartingAppList::add( const QString& name ) 96void StartingAppList::add( const QString& name )
99{ 97{
100#if QT_VERSION >= 232 && !defined(QT_NO_COP) 98#if QT_VERSION >= 232 && !defined(QT_NO_COP)
101 if ( !appl ) 99 if ( !appl )
102 appl = new StartingAppList; 100 appl = new StartingAppList;
103 QTime *t = new QTime; 101 QTime *t = new QTime;
104 t->start(); 102 t->start();
105 appl->dict.insert( "QPE/Application/" + name, t ); 103 appl->dict.insert( "QPE/Application/" + name, t );
106#endif 104#endif
107} 105}
108 106
109bool StartingAppList::isStarting( const QString name ) 107bool StartingAppList::isStarting( const QString name )
110{ 108{
111#if QT_VERSION >= 232 && !defined(QT_NO_COP) 109#if QT_VERSION >= 232 && !defined(QT_NO_COP)
112 if ( appl ) { 110 if ( appl ) {
113 QTime *t = appl->dict.find( "QPE/Application/" + name ); 111 QTime *t = appl->dict.find( "QPE/Application/" + name );
114 if ( !t ) 112 if ( !t )
115 return FALSE; 113 return FALSE;
116 if ( t->elapsed() > 10000 ) { 114 if ( t->elapsed() > 10000 ) {
117 // timeout in case of crash or something 115 // timeout in case of crash or something
118 appl->dict.remove( "QPE/Application/" + name ); 116 appl->dict.remove( "QPE/Application/" + name );
119 return FALSE; 117 return FALSE;
120 } 118 }
121 return TRUE; 119 return TRUE;
122 } 120 }
123#endif 121#endif
124 return FALSE; 122 return FALSE;
125} 123}
126 124
127void StartingAppList::handleNewChannel( const QString & name ) 125void StartingAppList::handleNewChannel( const QString & name )
128{ 126{
129#if QT_VERSION >= 232 && !defined(QT_NO_COP) 127#if QT_VERSION >= 232 && !defined(QT_NO_COP)
130 dict.remove( name ); 128 dict.remove( name );
131#endif 129#endif
132} 130}
133 131
134static bool docDirCreated = FALSE; 132static bool docDirCreated = FALSE;
135static QDawg* fixed_dawg = 0; 133static QDawg* fixed_dawg = 0;
136static QDict<QDawg> *named_dawg = 0; 134static QDict<QDawg> *named_dawg = 0;
137 135
138static QString qpeDir() 136static QString qpeDir()
139{ 137{
140 QString dir = getenv("OPIEDIR"); 138 QString dir = getenv("OPIEDIR");
141 if ( dir.isEmpty() ) dir = ".."; 139 if ( dir.isEmpty() ) dir = "..";
142 return dir; 140 return dir;
143} 141}
144 142
145static QString dictDir() 143static QString dictDir()
146{ 144{
147 return qpeDir() + "/etc/dict"; 145 return qpeDir() + "/etc/dict";
148} 146}
149 147
150/*! 148/*!
151 \class Global global.h 149 \class Global global.h
152 \brief The Global class provides application-wide global functions. 150 \brief The Global class provides application-wide global functions.
153 151
154 The Global functions are grouped as follows: 152 The Global functions are grouped as follows:
155 \tableofcontents 153 \tableofcontents
156 154
157 \section1 User Interface 155 \section1 User Interface
158 156
159 The statusMessage() function provides short-duration messages to the 157 The statusMessage() function provides short-duration messages to the
160 user. The showInputMethod() function shows the current input method, 158 user. The showInputMethod() function shows the current input method,
161 and hideInputMethod() hides the input method. 159 and hideInputMethod() hides the input method.
162 160
163 \section1 Document related 161 \section1 Document related
164 162
165 The findDocuments() function creates a set of \link doclnk.html 163 The findDocuments() function creates a set of \link doclnk.html
166 DocLnk\endlink objects in a particular folder. 164 DocLnk\endlink objects in a particular folder.
167 165
168 \section1 Filesystem related 166 \section1 Filesystem related
169 167
170 Global provides an applicationFileName() function that returns the 168 Global provides an applicationFileName() function that returns the
171 full path of an application-specific file. 169 full path of an application-specific file.
172 170
173 The execute() function runs an application. 171 The execute() function runs an application.
174 172
175 \section1 Word list related 173 \section1 Word list related
176 174
177 A list of words relevant to the current locale is maintained by the 175 A list of words relevant to the current locale is maintained by the
178 system. The list is held in a \link qdawg.html DAWG\endlink 176 system. The list is held in a \link qdawg.html DAWG\endlink
179 (implemented by the QDawg class). This list is used, for example, by 177 (implemented by the QDawg class). This list is used, for example, by