-rw-r--r-- | core/tools/quicklauncher/main.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp index b1befce..fb2ca44 100644 --- a/core/tools/quicklauncher/main.cpp +++ b/core/tools/quicklauncher/main.cpp | |||
@@ -76,12 +76,13 @@ void setproctitle (const char *fmt,...) { | |||
76 | 76 | ||
77 | i = strlen (buf); | 77 | i = strlen (buf); |
78 | if (i > argv_lth - 2) { | 78 | if (i > argv_lth - 2) { |
79 | i = argv_lth - 2; | 79 | i = argv_lth - 2; |
80 | buf[i] = '\0'; | 80 | buf[i] = '\0'; |
81 | } | 81 | } |
82 | |||
82 | memset(argv0[0], '\0', argv_lth); /* clear the memory area */ | 83 | memset(argv0[0], '\0', argv_lth); /* clear the memory area */ |
83 | (void) strcpy (argv0[0], buf); | 84 | (void) strcpy (argv0[0], buf); |
84 | 85 | ||
85 | argv0[1] = NULL; | 86 | argv0[1] = NULL; |
86 | } | 87 | } |
87 | #endif | 88 | #endif |
@@ -108,12 +109,13 @@ public: | |||
108 | appName = appName.mid( sep+1 ); | 109 | appName = appName.mid( sep+1 ); |
109 | 110 | ||
110 | appIface = 0; | 111 | appIface = 0; |
111 | if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) { | 112 | if ( loader->queryInterface(appName, IID_QtopiaApplication, (QUnknownInterface**)&appIface) == QS_OK ) { |
112 | mainWindow = appIface->createMainWindow( appName ); | 113 | mainWindow = appIface->createMainWindow( appName ); |
113 | } | 114 | } |
115 | |||
114 | if ( mainWindow ) { | 116 | if ( mainWindow ) { |
115 | if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) { | 117 | if ( mainWindow->metaObject()->slotNames().contains("setDocument(const QString&)") ) { |
116 | app->showMainDocumentWidget( mainWindow ); | 118 | app->showMainDocumentWidget( mainWindow ); |
117 | } else { | 119 | } else { |
118 | app->showMainWidget( mainWindow ); | 120 | app->showMainWidget( mainWindow ); |
119 | } | 121 | } |
@@ -151,16 +153,18 @@ private slots: | |||
151 | 153 | ||
152 | private: | 154 | private: |
153 | void doQuickLaunch( QStrList &argList ) | 155 | void doQuickLaunch( QStrList &argList ) |
154 | { | 156 | { |
155 | static int myargc = argList.count(); | 157 | static int myargc = argList.count(); |
156 | static char **myargv = new char *[myargc + 1]; | 158 | static char **myargv = new char *[myargc + 1]; |
159 | |||
157 | for ( int j = 0; j < myargc; j++ ) { | 160 | for ( int j = 0; j < myargc; j++ ) { |
158 | myargv[j] = new char [strlen(argList.at(j))+1]; | 161 | myargv[j] = new char [strlen(argList.at(j))+1]; |
159 | strcpy( myargv[j], argList.at(j) ); | 162 | strcpy( myargv[j], argList.at(j) ); |
160 | } | 163 | } |
164 | |||
161 | myargv[myargc] = NULL; | 165 | myargv[myargc] = NULL; |
162 | #ifdef _OS_LINUX_ | 166 | #ifdef _OS_LINUX_ |
163 | // Change name of process | 167 | // Change name of process |
164 | setproctitle(myargv[0]); | 168 | setproctitle(myargv[0]); |
165 | #endif | 169 | #endif |
166 | 170 | ||
@@ -181,14 +185,16 @@ int main( int argc, char** argv ) | |||
181 | loader = new PluginLoader( "application" ); | 185 | loader = new PluginLoader( "application" ); |
182 | 186 | ||
183 | unsetenv( "LD_BIND_NOW" ); | 187 | unsetenv( "LD_BIND_NOW" ); |
184 | 188 | ||
185 | QCString arg0 = argv[0]; | 189 | QCString arg0 = argv[0]; |
186 | int sep = arg0.findRev( '/' ); | 190 | int sep = arg0.findRev( '/' ); |
191 | |||
187 | if ( sep > 0 ) | 192 | if ( sep > 0 ) |
188 | arg0 = arg0.mid( sep+1 ); | 193 | arg0 = arg0.mid( sep+1 ); |
194 | |||
189 | if ( arg0 != "quicklauncher" ) { | 195 | if ( arg0 != "quicklauncher" ) { |
190 | odebug << "QuickLauncher invoked as: " << arg0.data() << oendl; | 196 | odebug << "QuickLauncher invoked as: " << arg0.data() << oendl; |
191 | QuickLauncher::exec( argc, argv ); | 197 | QuickLauncher::exec( argc, argv ); |
192 | } else { | 198 | } else { |
193 | #ifdef _OS_LINUX_ | 199 | #ifdef _OS_LINUX_ |
194 | // Setup to change proc title | 200 | // Setup to change proc title |
@@ -222,17 +228,12 @@ int main( int argc, char** argv ) | |||
222 | QFontMetrics fmb( f ); | 228 | QFontMetrics fmb( f ); |
223 | fmb.ascent(); // causes font load. | 229 | fmb.ascent(); // causes font load. |
224 | 230 | ||
225 | // Each of the following force internal structures/internal | 231 | // Each of the following force internal structures/internal |
226 | // initialization to be performed. This may mean allocating | 232 | // initialization to be performed. This may mean allocating |
227 | // memory that is not needed by all applications. | 233 | // memory that is not needed by all applications. |
228 | #if 0 | ||
229 | TimeZone::current().isValid(); // popuplate timezone cache | ||
230 | TimeString::currentDateFormat(); // create internal structures | ||
231 | TimeString::currentAMPM(); | ||
232 | #endif | ||
233 | Resource::loadIconSet("new"); // do internal init | 234 | Resource::loadIconSet("new"); // do internal init |
234 | 235 | ||
235 | /* make sure libopie gets lined in */ | 236 | /* make sure libopie gets lined in */ |
236 | { | 237 | { |
237 | Opie::Ui::OWait item; | 238 | Opie::Ui::OWait item; |
238 | } | 239 | } |
@@ -248,17 +249,19 @@ int main( int argc, char** argv ) | |||
248 | } | 249 | } |
249 | 250 | ||
250 | int rv = app->exec(); | 251 | int rv = app->exec(); |
251 | 252 | ||
252 | if ( mainWindow ) | 253 | if ( mainWindow ) |
253 | delete (QWidget*)mainWindow; | 254 | delete (QWidget*)mainWindow; |
254 | |||
255 | delete app; | 255 | delete app; |
256 | |||
256 | if ( appIface ) | 257 | if ( appIface ) |
257 | loader->releaseInterface( appIface ); | 258 | loader->releaseInterface( appIface ); |
258 | delete loader; | 259 | delete loader; |
260 | |||
261 | |||
259 | // Neither QLibrary nor my Dropin is a QObject and they don't depend | 262 | // Neither QLibrary nor my Dropin is a QObject and they don't depend |
260 | // on a qApp so we destroy QWidget::destroyMapper() without | 263 | // on a qApp so we destroy QWidget::destroyMapper() without |
261 | // crashing the app | 264 | // crashing the app |
262 | // | 265 | // |
263 | // The problem is there are some 'static' resources not freed | 266 | // The problem is there are some 'static' resources not freed |
264 | // in the apps and on destructing these objects are not available | 267 | // in the apps and on destructing these objects are not available |