-rw-r--r-- | core/tools/quicklauncher/config.in | 4 | ||||
-rw-r--r-- | core/tools/quicklauncher/main.cpp | 22 | ||||
-rw-r--r-- | core/tools/quicklauncher/opie-quicklauncher.control | 10 |
3 files changed, 34 insertions, 2 deletions
diff --git a/core/tools/quicklauncher/config.in b/core/tools/quicklauncher/config.in new file mode 100644 index 0000000..c105e94 --- a/dev/null +++ b/core/tools/quicklauncher/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config QUICKLAUNCHER | ||
2 | boolean "The Quick Launcher Loader" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | ||
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp index 7d368ab..cc411fd 100644 --- a/core/tools/quicklauncher/main.cpp +++ b/core/tools/quicklauncher/main.cpp | |||
@@ -1,75 +1,81 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2003 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2003 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 | 20 | ||
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | #include <qstrlist.h> | 22 | #include <qstrlist.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qguardedptr.h> | 24 | #include <qguardedptr.h> |
25 | #include <qcopchannel_qws.h> | 25 | #include <qcopchannel_qws.h> |
26 | #define QTOPIA_INTERNAL_INITAPP | 26 | #define QTOPIA_INTERNAL_INITAPP |
27 | |||
28 | #ifdef private | ||
29 | # undef private | ||
30 | #endif | ||
31 | #define private public | ||
27 | #include <qtopia/qpeapplication.h> | 32 | #include <qtopia/qpeapplication.h> |
33 | #undef private | ||
28 | #include <stdio.h> | 34 | #include <stdio.h> |
29 | #include <stdlib.h> | 35 | #include <stdlib.h> |
30 | #include <sys/types.h> | 36 | #include <sys/types.h> |
31 | #include <sys/stat.h> | 37 | #include <sys/stat.h> |
32 | #include <unistd.h> | 38 | #include <unistd.h> |
33 | 39 | ||
34 | #include "dropins.h" | 40 | #include "dropins.h" |
35 | 41 | ||
36 | static QPEApplication *app = 0; | 42 | static QPEApplication *app = 0; |
37 | static PluginLoader *loader = 0; | 43 | static PluginLoader *loader = 0; |
38 | static ApplicationInterface *appIface = 0; | 44 | static ApplicationInterface *appIface = 0; |
39 | static QGuardedPtr<QWidget> mainWindow; | 45 | static QGuardedPtr<QWidget> mainWindow; |
40 | 46 | ||
41 | #ifdef _OS_LINUX_ | 47 | #ifdef _OS_LINUX_ |
42 | static char **argv0 = 0; | 48 | static char **argv0 = 0; |
43 | static int argv_lth; | 49 | static int argv_lth; |
44 | extern char **environ; | 50 | extern char **environ; |
45 | #ifndef SPT_BUFSIZE | 51 | #ifndef SPT_BUFSIZE |
46 | #define SPT_BUFSIZE 2048 | 52 | #define SPT_BUFSIZE 2048 |
47 | #endif | 53 | #endif |
48 | #include <stdarg.h> | 54 | #include <stdarg.h> |
49 | void setproctitle (const char *fmt,...) { | 55 | void setproctitle (const char *fmt,...) { |
50 | int i; | 56 | int i; |
51 | char buf[SPT_BUFSIZE]; | 57 | char buf[SPT_BUFSIZE]; |
52 | va_list ap; | 58 | va_list ap; |
53 | 59 | ||
54 | if (!argv0) | 60 | if (!argv0) |
55 | return; | 61 | return; |
56 | 62 | ||
57 | va_start(ap, fmt); | 63 | va_start(ap, fmt); |
58 | (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); | 64 | (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); |
59 | va_end(ap); | 65 | va_end(ap); |
60 | 66 | ||
61 | i = strlen (buf); | 67 | i = strlen (buf); |
62 | if (i > argv_lth - 2) { | 68 | if (i > argv_lth - 2) { |
63 | i = argv_lth - 2; | 69 | i = argv_lth - 2; |
64 | buf[i] = '\0'; | 70 | buf[i] = '\0'; |
65 | } | 71 | } |
66 | memset(argv0[0], '\0', argv_lth); /* clear the memory area */ | 72 | memset(argv0[0], '\0', argv_lth); /* clear the memory area */ |
67 | (void) strcpy (argv0[0], buf); | 73 | (void) strcpy (argv0[0], buf); |
68 | 74 | ||
69 | argv0[1] = NULL; | 75 | argv0[1] = NULL; |
70 | } | 76 | } |
71 | #endif | 77 | #endif |
72 | 78 | ||
73 | 79 | ||
74 | class QuickLauncher : public QObject | 80 | class QuickLauncher : public QObject |
75 | { | 81 | { |
@@ -190,58 +196,70 @@ int main( int argc, char** argv ) | |||
190 | return -1; | 196 | return -1; |
191 | environ[i] = NULL; | 197 | environ[i] = NULL; |
192 | 198 | ||
193 | argv0 = argv; | 199 | argv0 = argv; |
194 | if (i > 0) | 200 | if (i > 0) |
195 | argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; | 201 | argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; |
196 | else | 202 | else |
197 | argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; | 203 | argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; |
198 | #endif | 204 | #endif |
199 | (void)new QuickLauncher(); | 205 | (void)new QuickLauncher(); |
200 | qDebug( "QuickLauncher running" ); | 206 | qDebug( "QuickLauncher running" ); |
201 | // Pre-load default fonts | 207 | // Pre-load default fonts |
202 | QFontMetrics fm( QApplication::font() ); | 208 | QFontMetrics fm( QApplication::font() ); |
203 | fm.ascent(); // causes font load. | 209 | fm.ascent(); // causes font load. |
204 | QFont f( QApplication::font() ); | 210 | QFont f( QApplication::font() ); |
205 | f.setWeight( QFont::Bold ); | 211 | f.setWeight( QFont::Bold ); |
206 | QFontMetrics fmb( f ); | 212 | QFontMetrics fmb( f ); |
207 | fmb.ascent(); // causes font load. | 213 | fmb.ascent(); // causes font load. |
208 | 214 | ||
209 | // Each of the following force internal structures/internal | 215 | // Each of the following force internal structures/internal |
210 | // initialization to be performed. This may mean allocating | 216 | // initialization to be performed. This may mean allocating |
211 | // memory that is not needed by all applications. | 217 | // memory that is not needed by all applications. |
212 | #if 0 | 218 | #if 0 |
213 | TimeZone::current().isValid(); // popuplate timezone cache | 219 | TimeZone::current().isValid(); // popuplate timezone cache |
214 | TimeString::currentDateFormat(); // create internal structures | 220 | TimeString::currentDateFormat(); // create internal structures |
215 | TimeString::currentAMPM(); | 221 | TimeString::currentAMPM(); |
216 | #endif | 222 | #endif |
217 | Resource::loadIconSet("new"); // do internal init | 223 | Resource::loadIconSet("new"); // do internal init |
218 | 224 | ||
219 | /* make sure libopie gets lined in */ | 225 | /* make sure libopie gets lined in */ |
220 | { | 226 | { |
221 | OWait item; | 227 | OWait item; |
222 | } | 228 | } |
223 | 229 | ||
224 | // Create a widget to force initialization of title bar images, etc. | 230 | // Create a widget to force initialization of title bar images, etc. |
225 | QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); | 231 | QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); |
226 | QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); | 232 | QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); |
227 | w->setGeometry( -100, -100, 10, 10 ); | 233 | w->setGeometry( -100, -100, 10, 10 ); |
228 | w->show(); | 234 | w->show(); |
229 | QTimer::singleShot( 0, w, SLOT(close()) ); | 235 | QTimer::singleShot( 0, w, SLOT(close()) ); |
230 | 236 | ||
231 | app->enter_loop(); | 237 | app->enter_loop(); |
232 | } | 238 | } |
233 | 239 | ||
234 | int rv = app->exec(); | 240 | int rv = app->exec(); |
235 | 241 | ||
236 | if ( mainWindow ) | 242 | if ( mainWindow ) |
237 | delete (QWidget*)mainWindow; | 243 | delete (QWidget*)mainWindow; |
244 | |||
245 | delete app; | ||
238 | if ( appIface ) | 246 | if ( appIface ) |
239 | loader->releaseInterface( appIface ); | 247 | loader->releaseInterface( appIface ); |
240 | delete loader; | 248 | delete loader; |
241 | 249 | // Neither QLibrary nor my Dropin is a QObject and they don't depend | |
242 | delete app; | 250 | // on a qApp so we destroy QWidget::destroyMapper() without |
251 | // crashing the app | ||
252 | // | ||
253 | // The problem is there are some 'static' resources not freed | ||
254 | // in the apps and on destructing these objects are not available | ||
255 | // anymore. In future fix up the apps but for now | ||
256 | // we just skip deletion and hope things go well -zecke | ||
257 | // delete app; | ||
258 | // hack instead -zecke | ||
259 | // delete app->pidChannel; | ||
260 | // app->pidChannel = 0; | ||
243 | 261 | ||
244 | return rv; | 262 | return rv; |
245 | } | 263 | } |
246 | 264 | ||
247 | #include "main.moc" | 265 | #include "main.moc" |
diff --git a/core/tools/quicklauncher/opie-quicklauncher.control b/core/tools/quicklauncher/opie-quicklauncher.control new file mode 100644 index 0000000..79b9493 --- a/dev/null +++ b/core/tools/quicklauncher/opie-quicklauncher.control | |||
@@ -0,0 +1,10 @@ | |||
1 | Package: opie-quicklauncher | ||
2 | Files: bin/quicklauncher | ||
3 | Priority: required | ||
4 | Section: opie/system | ||
5 | Maintainer: Trolltech (www.trolltech.com) | ||
6 | Architecture: arm | ||
7 | Version: $QPE_VERSION$EXTRAVERSION | ||
8 | Depends: | ||
9 | Description: Quick launcher stub | ||
10 | Launcher stub for quick launch enabled applications. | ||