-rw-r--r-- | core/tools/quicklauncher/main.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/tools/quicklauncher/main.cpp b/core/tools/quicklauncher/main.cpp index 59dd17e..72f574a 100644 --- a/core/tools/quicklauncher/main.cpp +++ b/core/tools/quicklauncher/main.cpp | |||
@@ -149,141 +149,141 @@ private slots: | |||
149 | doQuickLaunch( argList ); | 149 | doQuickLaunch( argList ); |
150 | delete this; | 150 | delete this; |
151 | } else if ( msg == "execute(QString)" ) { | 151 | } else if ( msg == "execute(QString)" ) { |
152 | delete qlChannel; | 152 | delete qlChannel; |
153 | QDataStream stream( data, IO_ReadOnly ); | 153 | QDataStream stream( data, IO_ReadOnly ); |
154 | QString arg; | 154 | QString arg; |
155 | stream >> arg; | 155 | stream >> arg; |
156 | odebug << "QuickLauncher execute: " << arg << oendl; | 156 | odebug << "QuickLauncher execute: " << arg << oendl; |
157 | QStrList argList; | 157 | QStrList argList; |
158 | argList.append( arg.utf8() ); | 158 | argList.append( arg.utf8() ); |
159 | doQuickLaunch( argList ); | 159 | doQuickLaunch( argList ); |
160 | delete this; | 160 | delete this; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | private: | 164 | private: |
165 | void doQuickLaunch( QStrList &argList ) | 165 | void doQuickLaunch( QStrList &argList ) |
166 | { | 166 | { |
167 | static int myargc = argList.count(); | 167 | static int myargc = argList.count(); |
168 | static char **myargv = new char *[myargc + 1]; | 168 | static char **myargv = new char *[myargc + 1]; |
169 | 169 | ||
170 | for ( int j = 0; j < myargc; j++ ) { | 170 | for ( int j = 0; j < myargc; j++ ) { |
171 | myargv[j] = new char [strlen(argList.at(j))+1]; | 171 | myargv[j] = new char [strlen(argList.at(j))+1]; |
172 | strcpy( myargv[j], argList.at(j) ); | 172 | strcpy( myargv[j], argList.at(j) ); |
173 | } | 173 | } |
174 | 174 | ||
175 | myargv[myargc] = NULL; | 175 | myargv[myargc] = NULL; |
176 | #ifdef _OS_LINUX_ | 176 | #ifdef _OS_LINUX_ |
177 | // Change name of process | 177 | // Change name of process |
178 | setproctitle(myargv[0]); | 178 | setproctitle(myargv[0]); |
179 | prctl( PR_SET_NAME, (unsigned long)myargv[0], 0, 0, 0 ); | 179 | prctl( PR_SET_NAME, (unsigned long)myargv[0], 0, 0, 0 ); |
180 | #endif | 180 | #endif |
181 | 181 | ||
182 | connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); | 182 | connect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); |
183 | app->exit_loop(); | 183 | app->exit_loop(); |
184 | app->initApp( myargc, myargv ); | 184 | app->initApp( myargc, myargv ); |
185 | exec( myargc, myargv ); | 185 | exec( myargc, myargv ); |
186 | } | 186 | } |
187 | 187 | ||
188 | private: | 188 | private: |
189 | QCopChannel *qlChannel; | 189 | QCopChannel *qlChannel; |
190 | }; | 190 | }; |
191 | 191 | ||
192 | int main( int argc, char** argv ) | 192 | int main( int argc, char** argv ) |
193 | { | 193 | { |
194 | app = new Opie::Core::OApplication( argc, argv ); | 194 | app = new Opie::Core::OApplication( argc, argv ); |
195 | 195 | ||
196 | loader = new PluginLoader( "application" ); | 196 | loader = new PluginLoader( "application" ); |
197 | 197 | ||
198 | unsetenv( "LD_BIND_NOW" ); | 198 | unsetenv( "LD_BIND_NOW" ); |
199 | 199 | ||
200 | QCString arg0 = argv[0]; | 200 | QCString arg0 = argv[0]; |
201 | int sep = arg0.findRev( '/' ); | 201 | int sep = arg0.findRev( '/' ); |
202 | 202 | ||
203 | if ( sep > 0 ) | 203 | if ( sep > 0 ) |
204 | arg0 = arg0.mid( sep+1 ); | 204 | arg0 = arg0.mid( sep+1 ); |
205 | 205 | ||
206 | if ( arg0 != "quicklauncher" ) { | 206 | if ( arg0 != "quicklauncher" ) { |
207 | odebug << "QuickLauncher invoked as: " << arg0.data() << oendl; | 207 | odebug << "QuickLauncher invoked as: " << arg0.data() << oendl; |
208 | QuickLauncher::exec( argc, argv ); | 208 | QuickLauncher::exec( argc, argv ); |
209 | } else { | 209 | } else { |
210 | #ifdef _OS_LINUX_ | 210 | #ifdef _OS_LINUX_ |
211 | // Setup to change proc title | 211 | // Setup to change proc title |
212 | int i; | 212 | int i; |
213 | char **envp = environ; | 213 | char **envp = environ; |
214 | /* Move the environment so we can reuse the memory. | 214 | /* Move the environment so we can reuse the memory. |
215 | * (Code borrowed from sendmail.) */ | 215 | * (Code borrowed from sendmail.) */ |
216 | for (i = 0; envp[i] != NULL; i++) | 216 | for (i = 0; envp[i] != NULL; i++) |
217 | continue; | 217 | continue; |
218 | environ = (char **) malloc(sizeof(char *) * (i + 1)); | 218 | environ = (char **) malloc(sizeof(char *) * (i + 1)); |
219 | if (environ == NULL) | 219 | if (environ == NULL) |
220 | return -1; | 220 | return -1; |
221 | for (i = 0; envp[i] != NULL; i++) | 221 | for (i = 0; envp[i] != NULL; i++) |
222 | if ((environ[i] = strdup(envp[i])) == NULL) | 222 | if ((environ[i] = strdup(envp[i])) == NULL) |
223 | return -1; | 223 | return -1; |
224 | environ[i] = NULL; | 224 | environ[i] = NULL; |
225 | 225 | ||
226 | argv0 = argv; | 226 | argv0 = argv; |
227 | if (i > 0) | 227 | if (i > 0) |
228 | argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; | 228 | argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; |
229 | else | 229 | else |
230 | argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; | 230 | argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; |
231 | #endif | 231 | #endif |
232 | (void)new QuickLauncher(); | 232 | (void)new QuickLauncher(); |
233 | odebug << "QuickLauncher running" << oendl; | 233 | odebug << "QuickLauncher running" << oendl; |
234 | // Pre-load default fonts | 234 | // Pre-load default fonts |
235 | QFontMetrics fm( QApplication::font() ); | 235 | QFontMetrics fm( QApplication::font() ); |
236 | fm.ascent(); // causes font load. | 236 | fm.ascent(); // causes font load. |
237 | QFont f( QApplication::font() ); | 237 | QFont f( QApplication::font() ); |
238 | f.setWeight( QFont::Bold ); | 238 | f.setWeight( QFont::Bold ); |
239 | QFontMetrics fmb( f ); | 239 | QFontMetrics fmb( f ); |
240 | fmb.ascent(); // causes font load. | 240 | fmb.ascent(); // causes font load. |
241 | 241 | ||
242 | // Each of the following force internal structures/internal | 242 | // Each of the following force internal structures/internal |
243 | // initialization to be performed. This may mean allocating | 243 | // initialization to be performed. This may mean allocating |
244 | // memory that is not needed by all applications. | 244 | // memory that is not needed by all applications. |
245 | Resource::loadIconSet("new"); // do internal init | 245 | Resource::loadPixmap("new"); // do internal init |
246 | 246 | ||
247 | /* make sure libopie gets lined in */ | 247 | /* make sure libopie gets lined in */ |
248 | { | 248 | { |
249 | Opie::Ui::OWait item; | 249 | Opie::Ui::OWait item; |
250 | } | 250 | } |
251 | 251 | ||
252 | // Create a widget to force initialization of title bar images, etc. | 252 | // Create a widget to force initialization of title bar images, etc. |
253 | QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); | 253 | QObject::disconnect(app, SIGNAL(lastWindowClosed()), app, SLOT(hideOrQuit())); |
254 | QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); | 254 | QWidget *w = new QWidget(0,0,Qt::WDestructiveClose|Qt::WStyle_ContextHelp|Qt::WStyle_Tool); |
255 | w->setGeometry( -100, -100, 10, 10 ); | 255 | w->setGeometry( -100, -100, 10, 10 ); |
256 | w->show(); | 256 | w->show(); |
257 | QTimer::singleShot( 0, w, SLOT(close()) ); | 257 | QTimer::singleShot( 0, w, SLOT(close()) ); |
258 | 258 | ||
259 | app->enter_loop(); | 259 | app->enter_loop(); |
260 | } | 260 | } |
261 | 261 | ||
262 | int rv = app->exec(); | 262 | int rv = app->exec(); |
263 | 263 | ||
264 | if ( mainWindow ) | 264 | if ( mainWindow ) |
265 | delete (QWidget*)mainWindow; | 265 | delete (QWidget*)mainWindow; |
266 | delete app; | 266 | delete app; |
267 | 267 | ||
268 | if ( appIface ) | 268 | if ( appIface ) |
269 | loader->releaseInterface( appIface ); | 269 | loader->releaseInterface( appIface ); |
270 | delete loader; | 270 | delete loader; |
271 | 271 | ||
272 | 272 | ||
273 | // Neither QLibrary nor my Dropin is a QObject and they don't depend | 273 | // Neither QLibrary nor my Dropin is a QObject and they don't depend |
274 | // on a qApp so we destroy QWidget::destroyMapper() without | 274 | // on a qApp so we destroy QWidget::destroyMapper() without |
275 | // crashing the app | 275 | // crashing the app |
276 | // | 276 | // |
277 | // The problem is there are some 'static' resources not freed | 277 | // The problem is there are some 'static' resources not freed |
278 | // in the apps and on destructing these objects are not available | 278 | // in the apps and on destructing these objects are not available |
279 | // anymore. In future fix up the apps but for now | 279 | // anymore. In future fix up the apps but for now |
280 | // we just skip deletion and hope things go well -zecke | 280 | // we just skip deletion and hope things go well -zecke |
281 | // delete app; | 281 | // delete app; |
282 | // hack instead -zecke | 282 | // hack instead -zecke |
283 | // delete app->pidChannel; | 283 | // delete app->pidChannel; |
284 | // app->pidChannel = 0; | 284 | // app->pidChannel = 0; |
285 | 285 | ||
286 | return rv; | 286 | return rv; |
287 | } | 287 | } |
288 | 288 | ||
289 | #include "main.moc" | 289 | #include "main.moc" |