Diffstat (limited to 'x11/libqpe-x11/qpe/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp index 3cb8faf..73e7ce4 100644 --- a/x11/libqpe-x11/qpe/qpeapplication.cpp +++ b/x11/libqpe-x11/qpe/qpeapplication.cpp | |||
@@ -1,356 +1,356 @@ | |||
1 | #define QTOPIA_INTERNAL_LANGLIST | 1 | #define QTOPIA_INTERNAL_LANGLIST |
2 | 2 | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include <sys/file.h> | 6 | #include <sys/file.h> |
7 | 7 | ||
8 | 8 | ||
9 | #include <qdir.h> | 9 | #include <qdir.h> |
10 | #include <qdialog.h> | 10 | #include <qdialog.h> |
11 | #include <qdragobject.h> | 11 | #include <qdragobject.h> |
12 | #include <qevent.h> | 12 | #include <qevent.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qlist.h> | 14 | #include <qlist.h> |
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <qtextcodec.h> | 16 | #include <qtextcodec.h> |
17 | #include <qpalette.h> | 17 | #include <qpalette.h> |
18 | #include <qptrdict.h> | 18 | #include <qptrdict.h> |
19 | #include <qregexp.h> | 19 | #include <qregexp.h> |
20 | #include <qtimer.h> | 20 | #include <qtimer.h> |
21 | 21 | ||
22 | #include <qpe/custom.h> | 22 | #include <qpe/custom.h> |
23 | #include <qpe/alarmserver.h> | 23 | #include <qpe/alarmserver.h> |
24 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
25 | #include <qpe/qpemenubar.h> | 25 | #include <qpe/qpemenubar.h> |
26 | #include <qpe/textcodecinterface.h> | 26 | #include <qpe/textcodecinterface.h> |
27 | #include <qpe/imagecodecinterface.h> | 27 | #include <qpe/imagecodecinterface.h> |
28 | #include <qpe/qlibrary.h> | 28 | #include <qpe/qlibrary.h> |
29 | #include <qpe/qpestyle.h> | 29 | #include <qpe/qpestyle.h> |
30 | #include <qpe/styleinterface.h> | 30 | #include <qpe/styleinterface.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/network.h> | 34 | #include <qpe/network.h> |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/timestring.h> | 37 | #include <qpe/timestring.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | 39 | ||
40 | 40 | ||
41 | #include <X11/Xlib.h> | 41 | #include <X11/Xlib.h> |
42 | #include <X11/Xutil.h> | 42 | #include <X11/Xutil.h> |
43 | 43 | ||
44 | const int XKeyPress = KeyPress; | 44 | const int XKeyPress = KeyPress; |
45 | const int XKeyRelease = KeyRelease; | 45 | const int XKeyRelease = KeyRelease; |
46 | #undef KeyPress | 46 | #undef KeyPress |
47 | #undef KeyRelease | 47 | #undef KeyRelease |
48 | 48 | ||
49 | namespace { | 49 | namespace { |
50 | struct QCopRec{ | 50 | struct QCopRec{ |
51 | QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar ) | 51 | QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar ) |
52 | : channel(ch), message(msg), data(ar) { | 52 | : channel(ch), message(msg), data(ar) { |
53 | 53 | ||
54 | } | 54 | } |
55 | QCString channel; | 55 | QCString channel; |
56 | QCString message; | 56 | QCString message; |
57 | QByteArray data; | 57 | QByteArray data; |
58 | }; | 58 | }; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | class QPEApplication::Private { | 62 | class QPEApplication::Private { |
63 | public: | 63 | public: |
64 | Private(); | 64 | Private(); |
65 | ~Private(); | 65 | ~Private(); |
66 | void enqueueQCop( const QCString& ch, const QCString& msg, | 66 | void enqueueQCop( const QCString& ch, const QCString& msg, |
67 | const QByteArray& ); | 67 | const QByteArray& ); |
68 | void sendQCopQ(); | 68 | void sendQCopQ(); |
69 | static void show_mx(QWidget* mw, bool nomaximize ); | 69 | static void show_mx(QWidget* mw, bool nomaximize ); |
70 | void show( QWidget* mw, bool nomax ); | 70 | void show( QWidget* mw, bool nomax ); |
71 | void loadTextCodecs(); | 71 | void loadTextCodecs(); |
72 | void loadImageCodecs(); | 72 | void loadImageCodecs(); |
73 | 73 | ||
74 | int kbgrabber; | 74 | int kbgrabber; |
75 | int presstimer; | 75 | int presstimer; |
76 | 76 | ||
77 | bool rightpressed : 1; | 77 | bool rightpressed : 1; |
78 | bool kbregrab : 1; | 78 | bool kbregrab : 1; |
79 | bool notbusysent : 1; | 79 | bool notbusysent : 1; |
80 | bool preloaded : 1; | 80 | bool preloaded : 1; |
81 | bool forceshow : 1; | 81 | bool forceshow : 1; |
82 | bool nomaximize : 1; | 82 | bool nomaximize : 1; |
83 | bool keep_running : 1; | 83 | bool keep_running : 1; |
84 | 84 | ||
85 | QWidget* presswidget; | 85 | QWidget* presswidget; |
86 | QPoint presspos; | 86 | QPoint presspos; |
87 | QWidget* qpe_main_widget; | 87 | QWidget* qpe_main_widget; |
88 | QString appName; | 88 | QString appName; |
89 | QString styleName; | 89 | QString styleName; |
90 | QString decorationName; | 90 | QString decorationName; |
91 | Atom wm_delete_window; | 91 | Atom wm_delete_window; |
92 | Atom wm_take_focus; | 92 | Atom wm_take_focus; |
93 | Atom wm_context_help; | 93 | Atom wm_context_help; |
94 | Atom wm_context_accept; | 94 | Atom wm_context_accept; |
95 | Atom wm_protocols; | 95 | Atom wm_protocols; |
96 | 96 | ||
97 | private: | 97 | private: |
98 | QList<QCopRec> qcopq; | 98 | QList<QCopRec> qcopq; |
99 | }; | 99 | }; |
100 | QPEApplication::Private::~Private() { | 100 | QPEApplication::Private::~Private() { |
101 | } | 101 | } |
102 | QPEApplication::Private::Private() | 102 | QPEApplication::Private::Private() |
103 | : kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), | 103 | : kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ), |
104 | preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), | 104 | preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ), |
105 | presswidget( 0 ), qpe_main_widget(0 ) { | 105 | presswidget( 0 ), qpe_main_widget(0 ) { |
106 | 106 | ||
107 | qcopq.setAutoDelete( TRUE ); | 107 | qcopq.setAutoDelete( TRUE ); |
108 | } | 108 | } |
109 | void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg, | 109 | void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg, |
110 | const QByteArray& ar ) { | 110 | const QByteArray& ar ) { |
111 | qcopq.append( new QCopRec(chan, msg, ar ) ); | 111 | qcopq.append( new QCopRec(chan, msg, ar ) ); |
112 | } | 112 | } |
113 | void QPEApplication::Private::sendQCopQ() { | 113 | void QPEApplication::Private::sendQCopQ() { |
114 | QCopRec* r; | 114 | QCopRec* r; |
115 | for ( r = qcopq.first(); r; r = qcopq.next() ) { | 115 | for ( r = qcopq.first(); r; r = qcopq.next() ) { |
116 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 116 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
117 | } | 117 | } |
118 | qcopq.clear(); | 118 | qcopq.clear(); |
119 | } | 119 | } |
120 | void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) { | 120 | void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) { |
121 | if (mw->layout() && mw->inherits("QDialog") ) { | 121 | if (mw->layout() && mw->inherits("QDialog") ) { |
122 | QPEApplication::showDialog( (QDialog*)mw, nomaximize ); | 122 | QPEApplication::showDialog( (QDialog*)mw, nomaximize ); |
123 | }else { | 123 | }else { |
124 | if (!nomaximize ) | 124 | if (!nomaximize ) |
125 | mw->showMaximized(); | 125 | mw->showMaximized(); |
126 | else | 126 | else |
127 | mw->show(); | 127 | mw->show(); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | void QPEApplication::Private::show( QWidget* mw, bool nomax ) { | 130 | void QPEApplication::Private::show( QWidget* mw, bool nomax ) { |
131 | nomaximize = nomax; | 131 | nomaximize = nomax; |
132 | qpe_main_widget = mw; | 132 | qpe_main_widget = mw; |
133 | 133 | ||
134 | sendQCopQ(); | 134 | sendQCopQ(); |
135 | 135 | ||
136 | if ( preloaded ) { | 136 | if ( preloaded ) { |
137 | if (forceshow ) | 137 | if (forceshow ) |
138 | show_mx(mw, nomax ); | 138 | show_mx(mw, nomax ); |
139 | }else if ( keep_running ) | 139 | }else if ( keep_running ) |
140 | show_mx( mw, nomax ); | 140 | show_mx( mw, nomax ); |
141 | } | 141 | } |
142 | void QPEApplication::Private::loadTextCodecs() { | 142 | void QPEApplication::Private::loadTextCodecs() { |
143 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 143 | QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; |
144 | QDir dir( path, "lib*.so" ); | 144 | QDir dir( path, "lib*.so" ); |
145 | QStringList list = dir.entryList(); | 145 | QStringList list = dir.entryList(); |
146 | QStringList::Iterator it; | 146 | QStringList::Iterator it; |
147 | for ( it = list.begin(); it != list.end(); ++it ) { | 147 | for ( it = list.begin(); it != list.end(); ++it ) { |
148 | TextCodecInterface *iface = 0; | 148 | TextCodecInterface *iface = 0; |
149 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 149 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
150 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 150 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
151 | QValueList<int> mibs = iface->mibEnums(); | 151 | QValueList<int> mibs = iface->mibEnums(); |
152 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 152 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
153 | (void)iface->createForMib(*i); | 153 | (void)iface->createForMib(*i); |
154 | // ### it exists now; need to remember if we can delete it | 154 | // ### it exists now; need to remember if we can delete it |
155 | } | 155 | } |
156 | } | 156 | } |
157 | else { | 157 | else { |
158 | lib->unload(); | 158 | lib->unload(); |
159 | delete lib; | 159 | delete lib; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | void QPEApplication::Private::loadImageCodecs() { | 163 | void QPEApplication::Private::loadImageCodecs() { |
164 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 164 | QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; |
165 | QDir dir( path, "lib*.so" ); | 165 | QDir dir( path, "lib*.so" ); |
166 | QStringList list = dir.entryList(); | 166 | QStringList list = dir.entryList(); |
167 | QStringList::Iterator it; | 167 | QStringList::Iterator it; |
168 | for ( it = list.begin(); it != list.end(); ++it ) { | 168 | for ( it = list.begin(); it != list.end(); ++it ) { |
169 | ImageCodecInterface *iface = 0; | 169 | ImageCodecInterface *iface = 0; |
170 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 170 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
171 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 171 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
172 | QStringList formats = iface->keys(); | 172 | QStringList formats = iface->keys(); |
173 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 173 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
174 | (void)iface->installIOHandler(*i); | 174 | (void)iface->installIOHandler(*i); |
175 | // ### it exists now; need to remember if we can delete it | 175 | // ### it exists now; need to remember if we can delete it |
176 | } | 176 | } |
177 | } | 177 | } |
178 | else { | 178 | else { |
179 | lib->unload(); | 179 | lib->unload(); |
180 | delete lib; | 180 | delete lib; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | // The Help System hook | 185 | // The Help System hook |
186 | namespace { | 186 | namespace { |
187 | class ResourceMimeFactory : public QMimeSourceFactory | 187 | class ResourceMimeFactory : public QMimeSourceFactory |
188 | { | 188 | { |
189 | public: | 189 | public: |
190 | ResourceMimeFactory(); | 190 | ResourceMimeFactory(); |
191 | ~ResourceMimeFactory(); | 191 | ~ResourceMimeFactory(); |
192 | const QMimeSource* data( const QString& abs_name )const; | 192 | const QMimeSource* data( const QString& abs_name )const; |
193 | }; | 193 | }; |
194 | ResourceMimeFactory::ResourceMimeFactory() | 194 | ResourceMimeFactory::ResourceMimeFactory() |
195 | { | 195 | { |
196 | setFilePath( Global::helpPath() ); | 196 | setFilePath( Global::helpPath() ); |
197 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 197 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
198 | } | 198 | } |
199 | ResourceMimeFactory::~ResourceMimeFactory() { | 199 | ResourceMimeFactory::~ResourceMimeFactory() { |
200 | } | 200 | } |
201 | 201 | ||
202 | const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const | 202 | const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const |
203 | { | 203 | { |
204 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 204 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
205 | if ( !r ) { | 205 | if ( !r ) { |
206 | int sl = abs_name.length(); | 206 | int sl = abs_name.length(); |
207 | do { | 207 | do { |
208 | sl = abs_name.findRev( '/', sl - 1 ); | 208 | sl = abs_name.findRev( '/', sl - 1 ); |
209 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 209 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
210 | int dot = name.findRev( '.' ); | 210 | int dot = name.findRev( '.' ); |
211 | if ( dot >= 0 ) | 211 | if ( dot >= 0 ) |
212 | name = name.left( dot ); | 212 | name = name.left( dot ); |
213 | QImage img = Resource::loadImage( name ); | 213 | QImage img = Resource::loadImage( name ); |
214 | if ( !img.isNull() ) | 214 | if ( !img.isNull() ) |
215 | r = new QImageDrag( img ); | 215 | r = new QImageDrag( img ); |
216 | } | 216 | } |
217 | while ( !r && sl > 0 ); | 217 | while ( !r && sl > 0 ); |
218 | } | 218 | } |
219 | return r; | 219 | return r; |
220 | }; | 220 | }; |
221 | }; | 221 | }; |
222 | // QPEApplication | 222 | // QPEApplication |
223 | QPEApplication::~QPEApplication() { | 223 | QPEApplication::~QPEApplication() { |
224 | qWarning("~QPEApplication"); | 224 | qWarning("~QPEApplication"); |
225 | ungrabKeyboard(); | 225 | ungrabKeyboard(); |
226 | qWarning("UngrabKeyboard"); | 226 | qWarning("UngrabKeyboard"); |
227 | 227 | ||
228 | // delete m_sys; | 228 | // delete m_sys; |
229 | // delete m_pid; | 229 | // delete m_pid; |
230 | 230 | ||
231 | delete d; | 231 | delete d; |
232 | } | 232 | } |
233 | QPEApplication::QPEApplication(int &arg, char** argv, Type t) | 233 | QPEApplication::QPEApplication(int &arg, char** argv, Type t) |
234 | : QApplication( arg, argv, t ) { | 234 | : QApplication( arg, argv, t ) { |
235 | d = new Private; | 235 | d = new Private; |
236 | d->loadTextCodecs(); | 236 | d->loadTextCodecs(); |
237 | d->loadImageCodecs(); | 237 | d->loadImageCodecs(); |
238 | 238 | ||
239 | // Init X-Atom | 239 | // Init X-Atom |
240 | Atom *atoms[5]; | 240 | Atom *atoms[5]; |
241 | Atom atoms_re[5]; | 241 | Atom atoms_re[5]; |
242 | char* names[5]; | 242 | char* names[5]; |
243 | int n = 0; | 243 | int n = 0; |
244 | atoms[n] = &d->wm_delete_window; | 244 | atoms[n] = &d->wm_delete_window; |
245 | names[n++] = "WM_DELETE_WINDOW"; | 245 | names[n++] = "WM_DELETE_WINDOW"; |
246 | 246 | ||
247 | atoms[n] = &d->wm_take_focus; | 247 | atoms[n] = &d->wm_take_focus; |
248 | names[n++] = "WM_TAKE_FOCUS"; | 248 | names[n++] = "WM_TAKE_FOCUS"; |
249 | 249 | ||
250 | atoms[n] = &d->wm_context_help; | 250 | atoms[n] = &d->wm_context_help; |
251 | names[n++] = "_NET_WM_CONTEXT_HELP"; | 251 | names[n++] = "_NET_WM_CONTEXT_HELP"; |
252 | 252 | ||
253 | atoms[n] = &d->wm_context_accept; | 253 | atoms[n] = &d->wm_context_accept; |
254 | names[n++] = "_NET_WM_CONTEXT_ACCEPT"; | 254 | names[n++] = "_NET_WM_CONTEXT_ACCEPT"; |
255 | 255 | ||
256 | atoms[n] = &d->wm_protocols; | 256 | atoms[n] = &d->wm_protocols; |
257 | names[n++] = "WM_PROTOCOLS"; | 257 | names[n++] = "WM_PROTOCOLS"; |
258 | 258 | ||
259 | XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); | 259 | XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re); |
260 | // now copy the values over to the properties | 260 | // now copy the values over to the properties |
261 | for (int i = 0; i < n; i++ ) | 261 | for (int i = 0; i < n; i++ ) |
262 | *atoms[i] = atoms_re[i]; | 262 | *atoms[i] = atoms_re[i]; |
263 | // done with X11 Stuff | 263 | // done with X11 Stuff |
264 | 264 | ||
265 | int dw = desktop()->width(); | 265 | int dw = desktop()->width(); |
266 | if ( dw < 200 ) { | 266 | if ( dw < 200 ) { |
267 | setFont( QFont( "helvetica", 8 ) ); | 267 | setFont( QFont( "helvetica", 8 ) ); |
268 | AppLnk::setSmallIconSize( 10 ); | 268 | AppLnk::setSmallIconSize( 10 ); |
269 | AppLnk::setBigIconSize( 28 ); | 269 | AppLnk::setBigIconSize( 28 ); |
270 | }else if ( dw > 600 ) { | 270 | }else if ( dw > 600 ) { |
271 | setFont( QFont( "helvetica", 12 ) ); | 271 | setFont( QFont( "helvetica", 12 ) ); |
272 | AppLnk::setSmallIconSize( 24 ); | 272 | AppLnk::setSmallIconSize( 24 ); |
273 | AppLnk::setBigIconSize( 48 ); | 273 | AppLnk::setBigIconSize( 48 ); |
274 | }else if ( dw > 200 ) { | 274 | }else if ( dw > 200 ) { |
275 | setFont( QFont( "helvetica", 10 ) ); | 275 | setFont( QFont( "helvetica", 10 ) ); |
276 | AppLnk::setSmallIconSize( 16 ); | 276 | AppLnk::setSmallIconSize( 16 ); |
277 | AppLnk::setBigIconSize( 32 ); | 277 | AppLnk::setBigIconSize( 32 ); |
278 | } | 278 | } |
279 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 279 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
280 | 280 | ||
281 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); | 281 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT(hideOrQuit() ) ); |
282 | 282 | ||
283 | QString qcopfn( "/tmp/qcop-msg-" ); | 283 | QString qcopfn( "/tmp/qcop-msg-" ); |
284 | qcopfn += QString( argv[0] ); // append command name to the QCOP name | 284 | qcopfn += QString( argv[0] ); // append command name to the QCOP name |
285 | QFile file( qcopfn ); | 285 | QFile file( qcopfn ); |
286 | if (file.open(IO_ReadOnly ) ) { | 286 | if (file.open(IO_ReadOnly ) ) { |
287 | flock( file.handle(), LOCK_EX ); | 287 | flock( file.handle(), LOCK_EX ); |
288 | } | 288 | } |
289 | 289 | ||
290 | /* Hmmm damn we need to make the parent 0l otherwise it get's deleted | 290 | /* Hmmm damn we need to make the parent 0l otherwise it get's deleted |
291 | * past the QApplication | 291 | * past the QApplication |
292 | */ | 292 | */ |
293 | m_sys = new QCopChannel( "QPE/System", 0l); | 293 | m_sys = new QCopChannel( "QPE/System", 0l); |
294 | connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ), | 294 | connect(m_sys, SIGNAL( received(const QCString&,const QByteArray&) ), |
295 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); | 295 | this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); |
296 | 296 | ||
297 | // private channel QPE/Application/appname | 297 | // private channel QPE/Application/appname |
298 | QCString channel = QCString( argv[0] ); | 298 | QCString channel = QCString( argv[0] ); |
299 | channel.replace( QRegExp( ".*/"), "" ); | 299 | channel.replace( QRegExp( ".*/"), "" ); |
300 | d->appName = channel; | 300 | d->appName = channel; |
301 | channel = "QPE/Application/"+ channel; | 301 | channel = "QPE/Application/"+ channel; |
302 | m_pid = new QCopChannel( channel, 0l ); | 302 | m_pid = new QCopChannel( channel, 0l ); |
303 | connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ), | 303 | connect(m_pid, SIGNAL( received(const QCString&,const QByteArray&) ), |
304 | this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); | 304 | this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); |
305 | 305 | ||
306 | // read the Pre QCOP Stuff from the file | 306 | // read the Pre QCOP Stuff from the file |
307 | if ( file.isOpen() ) { | 307 | if ( file.isOpen() ) { |
308 | d->keep_running = FALSE; | 308 | d->keep_running = FALSE; |
309 | QDataStream ds( &file ); | 309 | QDataStream ds( &file ); |
310 | QCString chanel, message; | 310 | QCString chanel, message; |
311 | QByteArray data; | 311 | QByteArray data; |
312 | while (!ds.atEnd() ) { | 312 | while (!ds.atEnd() ) { |
313 | ds >> chanel >> message >> data; | 313 | ds >> chanel >> message >> data; |
314 | d->enqueueQCop( chanel, message, data ); | 314 | d->enqueueQCop( chanel, message, data ); |
315 | } | 315 | } |
316 | flock( file.handle(), LOCK_UN ); | 316 | flock( file.handle(), LOCK_UN ); |
317 | file.close(); | 317 | file.close(); |
318 | file.remove(); | 318 | file.remove(); |
319 | } | 319 | } |
320 | 320 | ||
321 | // read in some stuff from the command line | 321 | // read in some stuff from the command line |
322 | // we do not have setArgs so we need to take | 322 | // we do not have setArgs so we need to take |
323 | // care of that | 323 | // care of that |
324 | for ( int a = 0; a < arg; a++ ) { | 324 | for ( int a = 0; a < arg; a++ ) { |
325 | if ( qstrcmp( argv[a], "-preload" ) == 0 ) { | 325 | if ( qstrcmp( argv[a], "-preload" ) == 0 ) { |
326 | d->preloaded = TRUE; | 326 | d->preloaded = TRUE; |
327 | }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { | 327 | }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { |
328 | d->preloaded = TRUE; | 328 | d->preloaded = TRUE; |
329 | d->forceshow = TRUE; | 329 | d->forceshow = TRUE; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | initTranslations(); | 332 | initTranslations(); |
333 | applyStyle(); | 333 | applyStyle(); |
334 | 334 | ||
335 | if ( type() == GuiServer ) | 335 | if ( type() == GuiServer ) |
336 | ; | 336 | ; |
337 | 337 | ||
338 | installEventFilter( this ); | 338 | installEventFilter( this ); |
339 | QPEMenuToolFocusManager::initialize(); | 339 | QPEMenuToolFocusManager::initialize(); |
340 | } | 340 | } |
341 | void QPEApplication::initTranslations() { | 341 | void QPEApplication::initTranslations() { |
342 | // Translations add it | 342 | // Translations add it |
343 | QStringList langs = Global::languageList(); | 343 | QStringList langs = Global::languageList(); |
344 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 344 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
345 | QString lang = *it; | 345 | QString lang = *it; |
346 | 346 | ||
347 | QTranslator * trans; | 347 | QTranslator * trans; |
348 | QString tfn; | 348 | QString tfn; |
349 | 349 | ||
350 | trans = new QTranslator( this ); | 350 | trans = new QTranslator( this ); |
351 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; | 351 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; |
352 | if ( trans->load( tfn ) ) | 352 | if ( trans->load( tfn ) ) |
353 | installTranslator( trans ); | 353 | installTranslator( trans ); |
354 | else | 354 | else |
355 | delete trans; | 355 | delete trans; |
356 | 356 | ||