author | mickeyl <mickeyl> | 2004-04-07 13:36:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-07 13:36:16 (UTC) |
commit | 4f1d28a25ce6180850c3d26bac9b638f0f25532b (patch) (unidiff) | |
tree | 59b4879b1065086c9a2e28f16f7d48540c8a9456 | |
parent | 8af35b63a277ec14dcc4a0a6ca5bbe228e276b98 (diff) | |
download | opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.zip opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.gz opie-4f1d28a25ce6180850c3d26bac9b638f0f25532b.tar.bz2 |
use Opie debugging framework
-rw-r--r-- | core/launcher/applauncher.cpp | 83 | ||||
-rw-r--r-- | core/launcher/documentlist.cpp | 46 | ||||
-rw-r--r-- | core/launcher/firstuse.cpp | 44 | ||||
-rw-r--r-- | core/launcher/inputmethods.cpp | 34 | ||||
-rw-r--r-- | core/launcher/irserver.cpp | 16 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 37 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 9 | ||||
-rw-r--r-- | core/launcher/main.cpp | 42 | ||||
-rw-r--r-- | core/launcher/packageslave.cpp | 26 | ||||
-rw-r--r-- | core/launcher/qcopbridge.cpp | 23 | ||||
-rw-r--r-- | core/launcher/qprocess.cpp | 14 | ||||
-rw-r--r-- | core/launcher/qprocess_unix.cpp | 93 | ||||
-rw-r--r-- | core/launcher/runningappbar.cpp | 24 | ||||
-rw-r--r-- | core/launcher/screensaver.cpp | 2 | ||||
-rw-r--r-- | core/launcher/server.cpp | 32 | ||||
-rw-r--r-- | core/launcher/serverapp.cpp | 26 | ||||
-rw-r--r-- | core/launcher/suspendmonitor.cpp | 2 | ||||
-rw-r--r-- | core/launcher/systray.cpp | 18 | ||||
-rw-r--r-- | core/launcher/taskbar.cpp | 7 | ||||
-rw-r--r-- | core/launcher/transferserver.cpp | 107 |
20 files changed, 334 insertions, 351 deletions
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp index 5a5517c..7000346 100644 --- a/core/launcher/applauncher.cpp +++ b/core/launcher/applauncher.cpp | |||
@@ -22,48 +22,45 @@ | |||
22 | #define QTOPIA_INTERNAL_PRELOADACCESS | 22 | #define QTOPIA_INTERNAL_PRELOADACCESS |
23 | #endif | 23 | #endif |
24 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS | 24 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS |
25 | #define QTOPIA_INTERNAL_FILEOPERATIONS | 25 | #define QTOPIA_INTERNAL_FILEOPERATIONS |
26 | #endif | 26 | #endif |
27 | #ifndef QTOPIA_PROGRAM_MONITOR | 27 | #ifndef QTOPIA_PROGRAM_MONITOR |
28 | #define QTOPIA_PROGRAM_MONITOR | 28 | #define QTOPIA_PROGRAM_MONITOR |
29 | #endif | 29 | #endif |
30 | |||
31 | #include "applauncher.h" | ||
32 | #include "documentlist.h" | ||
33 | |||
34 | /* OPIE */ | ||
35 | #include <opie2/odebug.h> | ||
30 | #include <opie2/oglobal.h> | 36 | #include <opie2/oglobal.h> |
37 | #include <qtopia/qcopenvelope_qws.h> | ||
38 | #include <qtopia/qpeapplication.h> | ||
39 | using namespace Opie::Core; | ||
31 | 40 | ||
32 | #ifndef Q_OS_WIN32 | 41 | /* QT */ |
42 | #include <qtimer.h> | ||
43 | #include <qwindowsystem_qws.h> | ||
44 | #include <qmessagebox.h> | ||
45 | #include <qfileinfo.h> | ||
46 | |||
47 | /* STD */ | ||
33 | #include <sys/stat.h> | 48 | #include <sys/stat.h> |
34 | #include <sys/wait.h> | 49 | #include <sys/wait.h> |
35 | #include <sys/file.h> | 50 | #include <sys/file.h> |
36 | #include <unistd.h> | 51 | #include <unistd.h> |
37 | #include <sys/time.h> | 52 | #include <sys/time.h> |
38 | #include <sys/resource.h> | 53 | #include <sys/resource.h> |
39 | #include <errno.h> | 54 | #include <errno.h> |
40 | #else | ||
41 | #include <process.h> | ||
42 | #include <windows.h> | ||
43 | #include <winbase.h> | ||
44 | #endif | ||
45 | |||
46 | #include <signal.h> | 55 | #include <signal.h> |
47 | #include <sys/types.h> | 56 | #include <sys/types.h> |
48 | #include <stdlib.h> | 57 | #include <stdlib.h> |
49 | 58 | ||
50 | #include <qtimer.h> | ||
51 | #include <qwindowsystem_qws.h> | ||
52 | #include <qmessagebox.h> | ||
53 | #include <qfileinfo.h> | ||
54 | |||
55 | #include <qtopia/qcopenvelope_qws.h> | ||
56 | #include <qtopia/qpeapplication.h> | ||
57 | |||
58 | #include "applauncher.h" | ||
59 | #include "documentlist.h" | ||
60 | |||
61 | using namespace Opie::Core; | ||
62 | const int AppLauncher::RAISE_TIMEOUT_MS = 5000; | 59 | const int AppLauncher::RAISE_TIMEOUT_MS = 5000; |
63 | 60 | ||
64 | //--------------------------------------------------------------------------- | 61 | //--------------------------------------------------------------------------- |
65 | 62 | ||
66 | static AppLauncher* appLauncherPtr; | 63 | static AppLauncher* appLauncherPtr; |
67 | 64 | ||
68 | const int appStopEventID = 1290; | 65 | const int appStopEventID = 1290; |
69 | 66 | ||
@@ -122,31 +119,31 @@ AppLauncher::~AppLauncher() | |||
122 | waitpid( qlPid, &status, 0 ); | 119 | waitpid( qlPid, &status, 0 ); |
123 | } | 120 | } |
124 | } | 121 | } |
125 | 122 | ||
126 | /* We use the QCopChannel of the app as an indicator of when it has been launched | 123 | /* We use the QCopChannel of the app as an indicator of when it has been launched |
127 | so that we can disable the busy indicators */ | 124 | so that we can disable the busy indicators */ |
128 | void AppLauncher::newQcopChannel(const QString& channelName) | 125 | void AppLauncher::newQcopChannel(const QString& channelName) |
129 | { | 126 | { |
130 | // qDebug("channel %s added", channelName.data() ); | 127 | // odebug << "channel " << channelName.data() << " added" << oendl; |
131 | QString prefix("QPE/Application/"); | 128 | QString prefix("QPE/Application/"); |
132 | if (channelName.startsWith(prefix)) { | 129 | if (channelName.startsWith(prefix)) { |
133 | { | 130 | { |
134 | QCopEnvelope e("QPE/System", "newChannel(QString)"); | 131 | QCopEnvelope e("QPE/System", "newChannel(QString)"); |
135 | e << channelName; | 132 | e << channelName; |
136 | } | 133 | } |
137 | QString appName = channelName.mid(prefix.length()); | 134 | QString appName = channelName.mid(prefix.length()); |
138 | if ( appName != "quicklauncher" ) { | 135 | if ( appName != "quicklauncher" ) { |
139 | emit connected( appName ); | 136 | emit connected( appName ); |
140 | QCopEnvelope e("QPE/System", "notBusy(QString)"); | 137 | QCopEnvelope e("QPE/System", "notBusy(QString)"); |
141 | e << appName; | 138 | e << appName; |
142 | } | 139 | } |
143 | } else if (channelName.startsWith("QPE/QuickLauncher-")) { | 140 | } else if (channelName.startsWith("QPE/QuickLauncher-")) { |
144 | qDebug("Registered %s", channelName.latin1()); | 141 | odebug << "Registered " << channelName << "" << oendl; |
145 | int pid = channelName.mid(18).toInt(); | 142 | int pid = channelName.mid(18).toInt(); |
146 | if (pid == qlPid) | 143 | if (pid == qlPid) |
147 | qlReady = TRUE; | 144 | qlReady = TRUE; |
148 | } | 145 | } |
149 | } | 146 | } |
150 | 147 | ||
151 | void AppLauncher::removedQcopChannel(const QString& channelName) | 148 | void AppLauncher::removedQcopChannel(const QString& channelName) |
152 | { | 149 | { |
@@ -175,17 +172,17 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) | |||
175 | if ( !executeBuiltin( t, QString::null ) ) | 172 | if ( !executeBuiltin( t, QString::null ) ) |
176 | execute( t, QString::null, TRUE); | 173 | execute( t, QString::null, TRUE); |
177 | } else if ( msg == "raise(QString)" ) { | 174 | } else if ( msg == "raise(QString)" ) { |
178 | QString appName; | 175 | QString appName; |
179 | stream >> appName; | 176 | stream >> appName; |
180 | 177 | ||
181 | if ( !executeBuiltin( appName, QString::null ) ) { | 178 | if ( !executeBuiltin( appName, QString::null ) ) { |
182 | if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { | 179 | if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { |
183 | //qDebug( "Raising: %s", appName.latin1() ); | 180 | //odebug << "Raising: " << appName << "" << oendl; |
184 | QCString channel = "QPE/Application/"; | 181 | QCString channel = "QPE/Application/"; |
185 | channel += appName.latin1(); | 182 | channel += appName.latin1(); |
186 | 183 | ||
187 | // Need to lock it to avoid race conditions with QPEApplication::processQCopFile | 184 | // Need to lock it to avoid race conditions with QPEApplication::processQCopFile |
188 | QFile f("/tmp/qcop-msg-" + appName); | 185 | QFile f("/tmp/qcop-msg-" + appName); |
189 | if ( f.open(IO_WriteOnly | IO_Append) ) { | 186 | if ( f.open(IO_WriteOnly | IO_Append) ) { |
190 | #ifndef Q_OS_WIN32 | 187 | #ifndef Q_OS_WIN32 |
191 | flock(f.handle(), LOCK_EX); | 188 | flock(f.handle(), LOCK_EX); |
@@ -212,17 +209,17 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) | |||
212 | QMap<int,QString>::Iterator it; | 209 | QMap<int,QString>::Iterator it; |
213 | for( it = runningApps.begin(); it != runningApps.end(); ++it ) | 210 | for( it = runningApps.begin(); it != runningApps.end(); ++it ) |
214 | apps.append( *it ); | 211 | apps.append( *it ); |
215 | QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" ); | 212 | QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" ); |
216 | e << apps; | 213 | e << apps; |
217 | } else if ( msg == "appRaised(QString)" ) { | 214 | } else if ( msg == "appRaised(QString)" ) { |
218 | QString appName; | 215 | QString appName; |
219 | stream >> appName; | 216 | stream >> appName; |
220 | qDebug("Got a heartbeat from %s", appName.latin1()); | 217 | odebug << "Got a heartbeat from " << appName << "" << oendl; |
221 | QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName); | 218 | QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName); |
222 | if ( it != waitingHeartbeat.end() ) { | 219 | if ( it != waitingHeartbeat.end() ) { |
223 | killTimer( *it ); | 220 | killTimer( *it ); |
224 | waitingHeartbeat.remove(it); | 221 | waitingHeartbeat.remove(it); |
225 | } | 222 | } |
226 | // Check to make sure we're not waiting on user input... | 223 | // Check to make sure we're not waiting on user input... |
227 | if ( appKillerBox && appName == appKillerName ) { | 224 | if ( appKillerBox && appName == appKillerName ) { |
228 | // If we are, we kill the dialog box, and the code waiting on the result | 225 | // If we are, we kill the dialog box, and the code waiting on the result |
@@ -235,22 +232,22 @@ void AppLauncher::received(const QCString& msg, const QByteArray& data) | |||
235 | } | 232 | } |
236 | 233 | ||
237 | void AppLauncher::signalHandler(int) | 234 | void AppLauncher::signalHandler(int) |
238 | { | 235 | { |
239 | #ifndef Q_OS_WIN32 | 236 | #ifndef Q_OS_WIN32 |
240 | int status; | 237 | int status; |
241 | pid_t pid = waitpid(-1, &status, WNOHANG); | 238 | pid_t pid = waitpid(-1, &status, WNOHANG); |
242 | /* if (pid == 0 || &status == 0 ) { | 239 | /* if (pid == 0 || &status == 0 ) { |
243 | qDebug("hmm, could not get return value from signal"); | 240 | odebug << "hmm, could not get return value from signal" << oendl; |
244 | } | 241 | } |
245 | */ | 242 | */ |
246 | QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) ); | 243 | QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) ); |
247 | #else | 244 | #else |
248 | qDebug("Unhandled signal see by AppLauncher::signalHandler(int)"); | 245 | odebug << "Unhandled signal see by AppLauncher::signalHandler(int)" << oendl; |
249 | #endif | 246 | #endif |
250 | } | 247 | } |
251 | 248 | ||
252 | bool AppLauncher::event(QEvent *e) | 249 | bool AppLauncher::event(QEvent *e) |
253 | { | 250 | { |
254 | if ( e->type() == appStopEventID ) { | 251 | if ( e->type() == appStopEventID ) { |
255 | AppStoppedEvent *ae = (AppStoppedEvent *) e; | 252 | AppStoppedEvent *ae = (AppStoppedEvent *) e; |
256 | sigStopped(ae->pid(), ae->status() ); | 253 | sigStopped(ae->pid(), ae->status() ); |
@@ -268,28 +265,28 @@ void AppLauncher::timerEvent( QTimerEvent *e ) | |||
268 | if ( *it == id ) { | 265 | if ( *it == id ) { |
269 | if ( appKillerBox ) // we're already dealing with one | 266 | if ( appKillerBox ) // we're already dealing with one |
270 | return; | 267 | return; |
271 | 268 | ||
272 | appKillerName = it.key(); | 269 | appKillerName = it.key(); |
273 | killTimer( id ); | 270 | killTimer( id ); |
274 | waitingHeartbeat.remove( it ); | 271 | waitingHeartbeat.remove( it ); |
275 | 272 | ||
276 | // qDebug("Checking in on %s", appKillerName.latin1()); | 273 | // odebug << "Checking in on " << appKillerName << "" << oendl; |
277 | 274 | ||
278 | // We store this incase the application responds while we're | 275 | // We store this incase the application responds while we're |
279 | // waiting for user input so we know not to delete ourselves. | 276 | // waiting for user input so we know not to delete ourselves. |
280 | appKillerBox = new QMessageBox(tr("Application Problem"), | 277 | appKillerBox = new QMessageBox(tr("Application Problem"), |
281 | tr("<p>%1 is not responding.</p>").arg(appKillerName) + | 278 | tr("<p>%1 is not responding.</p>").arg(appKillerName) + |
282 | tr("<p>Would you like to force the application to exit?</p>"), | 279 | tr("<p>Would you like to force the application to exit?</p>"), |
283 | QMessageBox::Warning, QMessageBox::Yes, | 280 | QMessageBox::Warning, QMessageBox::Yes, |
284 | QMessageBox::No | QMessageBox::Default, | 281 | QMessageBox::No | QMessageBox::Default, |
285 | QMessageBox::NoButton); | 282 | QMessageBox::NoButton); |
286 | if (appKillerBox->exec() == QMessageBox::Yes) { | 283 | if (appKillerBox->exec() == QMessageBox::Yes) { |
287 | // qDebug("Killing the app!!! Bwuhahahaha!"); | 284 | // odebug << "Killing the app!!! Bwuhahahaha!" << oendl; |
288 | int pid = pidForName(appKillerName); | 285 | int pid = pidForName(appKillerName); |
289 | if ( pid > 0 ) | 286 | if ( pid > 0 ) |
290 | kill( pid ); | 287 | kill( pid ); |
291 | } | 288 | } |
292 | appKillerName = QString::null; | 289 | appKillerName = QString::null; |
293 | delete appKillerBox; | 290 | delete appKillerBox; |
294 | appKillerBox = 0; | 291 | appKillerBox = 0; |
295 | return; | 292 | return; |
@@ -310,27 +307,27 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) | |||
310 | exitStatus = WEXITSTATUS(sigStatus); | 307 | exitStatus = WEXITSTATUS(sigStatus); |
311 | } else { | 308 | } else { |
312 | exitStatus = WTERMSIG(sigStatus); | 309 | exitStatus = WTERMSIG(sigStatus); |
313 | } | 310 | } |
314 | 311 | ||
315 | QMap<int,QString>::Iterator it = runningApps.find( sigPid ); | 312 | QMap<int,QString>::Iterator it = runningApps.find( sigPid ); |
316 | if ( it == runningApps.end() ) { | 313 | if ( it == runningApps.end() ) { |
317 | if ( sigPid == qlPid ) { | 314 | if ( sigPid == qlPid ) { |
318 | qDebug( "quicklauncher stopped" ); | 315 | odebug << "quicklauncher stopped" << oendl; |
319 | qlPid = 0; | 316 | qlPid = 0; |
320 | qlReady = FALSE; | 317 | qlReady = FALSE; |
321 | QFile::remove("/tmp/qcop-msg-quicklauncher" ); | 318 | QFile::remove("/tmp/qcop-msg-quicklauncher" ); |
322 | QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) ); | 319 | QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) ); |
323 | } | 320 | } |
324 | /* | 321 | /* |
325 | if ( sigPid == -1 ) | 322 | if ( sigPid == -1 ) |
326 | qDebug("non-qtopia application exited (disregarded)"); | 323 | odebug << "non-qtopia application exited (disregarded)" << oendl; |
327 | else | 324 | else |
328 | qDebug("==== no pid matching %d in list, definite bug", sigPid); | 325 | odebug << "==== no pid matching " << sigPid << " in list, definite bug" << oendl; |
329 | */ | 326 | */ |
330 | return; | 327 | return; |
331 | } | 328 | } |
332 | QString appName = *it; | 329 | QString appName = *it; |
333 | runningApps.remove(it); | 330 | runningApps.remove(it); |
334 | 331 | ||
335 | QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); | 332 | QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); |
336 | if ( hbit != waitingHeartbeat.end() ) { | 333 | if ( hbit != waitingHeartbeat.end() ) { |
@@ -364,17 +361,17 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) | |||
364 | // clean up | 361 | // clean up |
365 | if ( exitStatus ) { | 362 | if ( exitStatus ) { |
366 | QCopEnvelope e("QPE/System", "notBusy(QString)"); | 363 | QCopEnvelope e("QPE/System", "notBusy(QString)"); |
367 | e << app->exec(); | 364 | e << app->exec(); |
368 | } | 365 | } |
369 | /* | 366 | /* |
370 | // debug info | 367 | // debug info |
371 | for (it = runningApps.begin(); it != runningApps.end(); ++it) { | 368 | for (it = runningApps.begin(); it != runningApps.end(); ++it) { |
372 | qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); | 369 | odebug << "running according to internal list: " << (*it).data() << ", with pid " << it.key() << "" << oendl; |
373 | } | 370 | } |
374 | */ | 371 | */ |
375 | 372 | ||
376 | #ifdef QTOPIA_PROGRAM_MONITOR | 373 | #ifdef QTOPIA_PROGRAM_MONITOR |
377 | if ( crashed ) { | 374 | if ( crashed ) { |
378 | QString sig; | 375 | QString sig; |
379 | switch( exitStatus ) { | 376 | switch( exitStatus ) { |
380 | case SIGABRT: sig = "SIGABRT"; break; | 377 | case SIGABRT: sig = "SIGABRT"; break; |
@@ -398,42 +395,42 @@ void AppLauncher::sigStopped(int sigPid, int sigStatus) | |||
398 | QMessageBox::information(0, tr("Application terminated"), str ); | 395 | QMessageBox::information(0, tr("Application terminated"), str ); |
399 | } else { | 396 | } else { |
400 | if ( exitStatus == 255 ) { //could not find app (because global returns -1) | 397 | if ( exitStatus == 255 ) { //could not find app (because global returns -1) |
401 | QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); | 398 | QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); |
402 | } else { | 399 | } else { |
403 | QFileInfo fi(QString::fromLatin1("/tmp/qcop-msg-") + appName); | 400 | QFileInfo fi(QString::fromLatin1("/tmp/qcop-msg-") + appName); |
404 | if ( fi.exists() && fi.size() ) { | 401 | if ( fi.exists() && fi.size() ) { |
405 | emit terminated(sigPid, appName); | 402 | emit terminated(sigPid, appName); |
406 | qWarning("Re executing obmitted for %s", appName.latin1() ); | 403 | owarn << "Re executing obmitted for " << appName << "" << oendl; |
407 | // execute( appName, QString::null ); | 404 | // execute( appName, QString::null ); |
408 | return; | 405 | return; |
409 | } | 406 | } |
410 | } | 407 | } |
411 | } | 408 | } |
412 | 409 | ||
413 | #endif | 410 | #endif |
414 | 411 | ||
415 | emit terminated(sigPid, appName); | 412 | emit terminated(sigPid, appName); |
416 | } | 413 | } |
417 | #else | 414 | #else |
418 | void AppLauncher::sigStopped(int sigPid, int sigStatus) | 415 | void AppLauncher::sigStopped(int sigPid, int sigStatus) |
419 | { | 416 | { |
420 | qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); | 417 | odebug << "Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)" << oendl; |
421 | } | 418 | } |
422 | #endif // Q_OS_WIN32 | 419 | #endif // Q_OS_WIN32 |
423 | 420 | ||
424 | bool AppLauncher::isRunning(const QString &app) | 421 | bool AppLauncher::isRunning(const QString &app) |
425 | { | 422 | { |
426 | for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) { | 423 | for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) { |
427 | if ( *it == app ) { | 424 | if ( *it == app ) { |
428 | #ifdef Q_OS_UNIX | 425 | #ifdef Q_OS_UNIX |
429 | pid_t t = ::__getpgid( it.key() ); | 426 | pid_t t = ::__getpgid( it.key() ); |
430 | if ( t == -1 ) { | 427 | if ( t == -1 ) { |
431 | qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() ); | 428 | odebug << "appLauncher bug, " << app.data() << " believed running, but pid " << it.key() << " is not existing" << oendl; |
432 | runningApps.remove( it.key() ); | 429 | runningApps.remove( it.key() ); |
433 | return FALSE; | 430 | return FALSE; |
434 | } | 431 | } |
435 | #endif | 432 | #endif |
436 | return TRUE; | 433 | return TRUE; |
437 | } | 434 | } |
438 | } | 435 | } |
439 | 436 | ||
@@ -476,17 +473,17 @@ bool AppLauncher::executeBuiltin(const QString &c, const QString &document) | |||
476 | return TRUE; | 473 | return TRUE; |
477 | } | 474 | } |
478 | 475 | ||
479 | return FALSE; | 476 | return FALSE; |
480 | } | 477 | } |
481 | 478 | ||
482 | bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) | 479 | bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) |
483 | { | 480 | { |
484 | qWarning("AppLauncher::execute '%s' '%s'", (const char*) c, (const char*) docParam ); | 481 | owarn << "AppLauncher::execute '" << c << "' '" << docParam << "'" << oendl; |
485 | // Convert the command line in to a list of arguments | 482 | // Convert the command line in to a list of arguments |
486 | QStringList list = QStringList::split(QRegExp(" *"),c); | 483 | QStringList list = QStringList::split(QRegExp(" *"),c); |
487 | QStringList arglist = QStringList::split(QRegExp(" *"),docParam); | 484 | QStringList arglist = QStringList::split(QRegExp(" *"),docParam); |
488 | for ( QStringList::Iterator it = arglist.begin(); it != arglist.end(); ++it ) | 485 | for ( QStringList::Iterator it = arglist.begin(); it != arglist.end(); ++it ) |
489 | list.append( *it ); | 486 | list.append( *it ); |
490 | 487 | ||
491 | QString appName = list[0]; | 488 | QString appName = list[0]; |
492 | if ( isRunning(appName) ) { | 489 | if ( isRunning(appName) ) { |
@@ -543,17 +540,17 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais | |||
543 | args[j] = NULL; | 540 | args[j] = NULL; |
544 | 541 | ||
545 | #ifndef Q_OS_WIN32 | 542 | #ifndef Q_OS_WIN32 |
546 | #ifdef Q_OS_MACX | 543 | #ifdef Q_OS_MACX |
547 | if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".dylib" ) ) { | 544 | if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".dylib" ) ) { |
548 | #else | 545 | #else |
549 | if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) { | 546 | if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) { |
550 | #endif /* Q_OS_MACX */ | 547 | #endif /* Q_OS_MACX */ |
551 | qDebug( "Quick launching: %s", args[0] ); | 548 | odebug << "Quick launching: " << args[0] << "" << oendl; |
552 | if ( getuid() == 0 ) | 549 | if ( getuid() == 0 ) |
553 | setpriority( PRIO_PROCESS, qlPid, 0 ); | 550 | setpriority( PRIO_PROCESS, qlPid, 0 ); |
554 | QCString qlch("QPE/QuickLauncher-"); | 551 | QCString qlch("QPE/QuickLauncher-"); |
555 | qlch += QString::number(qlPid); | 552 | qlch += QString::number(qlPid); |
556 | QCopEnvelope env( qlch, "execute(QStrList)" ); | 553 | QCopEnvelope env( qlch, "execute(QStrList)" ); |
557 | env << slist; | 554 | env << slist; |
558 | runningApps[qlPid] = QString(args[0]); | 555 | runningApps[qlPid] = QString(args[0]); |
559 | emit launched(qlPid, QString(args[0])); | 556 | emit launched(qlPid, QString(args[0])); |
@@ -579,31 +576,31 @@ bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRais | |||
579 | } | 576 | } |
580 | #else | 577 | #else |
581 | QProcess *proc = new QProcess(this); | 578 | QProcess *proc = new QProcess(this); |
582 | if (proc){ | 579 | if (proc){ |
583 | for (int i=0; i < slist.count(); i++) | 580 | for (int i=0; i < slist.count(); i++) |
584 | proc->addArgument(args[i]); | 581 | proc->addArgument(args[i]); |
585 | connect(proc, SIGNAL(processExited()), this, SLOT(processExited())); | 582 | connect(proc, SIGNAL(processExited()), this, SLOT(processExited())); |
586 | if (!proc->start()){ | 583 | if (!proc->start()){ |
587 | qDebug("Unable to start application %s", args[0]); | 584 | odebug << "Unable to start application " << args[0] << "" << oendl; |
588 | }else{ | 585 | }else{ |
589 | PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); | 586 | PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); |
590 | if (procInfo){ | 587 | if (procInfo){ |
591 | DWORD pid = procInfo->dwProcessId; | 588 | DWORD pid = procInfo->dwProcessId; |
592 | runningApps[pid] = QString(args[0]); | 589 | runningApps[pid] = QString(args[0]); |
593 | runningAppsProc.append(proc); | 590 | runningAppsProc.append(proc); |
594 | emit launched(pid, QString(args[0])); | 591 | emit launched(pid, QString(args[0])); |
595 | QCopEnvelope e("QPE/System", "busy()"); | 592 | QCopEnvelope e("QPE/System", "busy()"); |
596 | }else{ | 593 | }else{ |
597 | qDebug("Unable to read process inforation #1 for %s", args[0]); | 594 | odebug << "Unable to read process inforation #1 for " << args[0] << "" << oendl; |
598 | } | 595 | } |
599 | } | 596 | } |
600 | }else{ | 597 | }else{ |
601 | qDebug("Unable to create process for application %s", args[0]); | 598 | odebug << "Unable to create process for application " << args[0] << "" << oendl; |
602 | return FALSE; | 599 | return FALSE; |
603 | } | 600 | } |
604 | #endif | 601 | #endif |
605 | #endif //QT_NO_QWS_MULTIPROCESS | 602 | #endif //QT_NO_QWS_MULTIPROCESS |
606 | 603 | ||
607 | delete [] args; | 604 | delete [] args; |
608 | return TRUE; | 605 | return TRUE; |
609 | } | 606 | } |
@@ -673,26 +670,26 @@ void AppLauncher::createQuickLauncher() | |||
673 | setpriority( PRIO_PROCESS, qlPid, 19 ); | 670 | setpriority( PRIO_PROCESS, qlPid, 19 ); |
674 | } | 671 | } |
675 | } | 672 | } |
676 | 673 | ||
677 | // Used only by Win32 | 674 | // Used only by Win32 |
678 | void AppLauncher::processExited() | 675 | void AppLauncher::processExited() |
679 | { | 676 | { |
680 | #ifdef Q_OS_WIN32 | 677 | #ifdef Q_OS_WIN32 |
681 | qDebug("AppLauncher::processExited()"); | 678 | odebug << "AppLauncher::processExited()" << oendl; |
682 | bool found = FALSE; | 679 | bool found = FALSE; |
683 | QProcess *proc = (QProcess *) sender(); | 680 | QProcess *proc = (QProcess *) sender(); |
684 | if (!proc){ | 681 | if (!proc){ |
685 | qDebug("Interanl error NULL proc"); | 682 | odebug << "Interanl error NULL proc" << oendl; |
686 | return; | 683 | return; |
687 | } | 684 | } |
688 | 685 | ||
689 | QString appName = proc->arguments()[0]; | 686 | QString appName = proc->arguments()[0]; |
690 | qDebug("Removing application %s", appName.latin1()); | 687 | odebug << "Removing application " << appName << "" << oendl; |
691 | runningAppsProc.remove(proc); | 688 | runningAppsProc.remove(proc); |
692 | 689 | ||
693 | QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); | 690 | QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); |
694 | if ( hbit != waitingHeartbeat.end() ) { | 691 | if ( hbit != waitingHeartbeat.end() ) { |
695 | killTimer( *hbit ); | 692 | killTimer( *hbit ); |
696 | waitingHeartbeat.remove( hbit ); | 693 | waitingHeartbeat.remove( hbit ); |
697 | } | 694 | } |
698 | if ( appName == appKillerName ) { | 695 | if ( appName == appKillerName ) { |
@@ -709,14 +706,14 @@ void AppLauncher::processExited() | |||
709 | break; | 706 | break; |
710 | } | 707 | } |
711 | } | 708 | } |
712 | 709 | ||
713 | if (found){ | 710 | if (found){ |
714 | emit terminated(it.key(), it.data()); | 711 | emit terminated(it.key(), it.data()); |
715 | runningApps.remove(it.key()); | 712 | runningApps.remove(it.key()); |
716 | }else{ | 713 | }else{ |
717 | qDebug("Internal error application %s not listed as running", appName.latin1()); | 714 | odebug << "Internal error application " << appName << " not listed as running" << oendl; |
718 | } | 715 | } |
719 | 716 | ||
720 | #endif | 717 | #endif |
721 | } | 718 | } |
722 | 719 | ||
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 3e0a96c..92b8c25 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -16,43 +16,45 @@ | |||
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 | #include "documentlist.h" | 20 | #include "documentlist.h" |
21 | #include "serverinterface.h" | 21 | #include "serverinterface.h" |
22 | #include "mediadlg.h" | 22 | #include "mediadlg.h" |
23 | 23 | ||
24 | /* OPIE */ | ||
24 | #include <opie2/oglobal.h> | 25 | #include <opie2/oglobal.h> |
25 | 26 | #include <opie2/odebug.h> | |
26 | #include <qtopia/config.h> | 27 | #include <qtopia/config.h> |
27 | #include <qtopia/mimetype.h> | 28 | #include <qtopia/mimetype.h> |
28 | #include <qtopia/resource.h> | 29 | #include <qtopia/resource.h> |
29 | #include <qtopia/private/categories.h> | 30 | #include <qtopia/private/categories.h> |
30 | #include <qtopia/qpeapplication.h> | 31 | #include <qtopia/qpeapplication.h> |
31 | #include <qtopia/applnk.h> | 32 | #include <qtopia/applnk.h> |
32 | #include <qtopia/storage.h> | 33 | #include <qtopia/storage.h> |
33 | #ifdef Q_WS_QWS | 34 | #ifdef Q_WS_QWS |
34 | #include <qtopia/qcopenvelope_qws.h> | 35 | #include <qtopia/qcopenvelope_qws.h> |
35 | #endif | 36 | #endif |
37 | using namespace Opie::Core; | ||
36 | 38 | ||
39 | /* QT */ | ||
37 | #include <qtimer.h> | 40 | #include <qtimer.h> |
38 | #include <qfileinfo.h> | 41 | #include <qfileinfo.h> |
39 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
40 | #include <qfile.h> | 43 | #include <qfile.h> |
41 | #include <qdir.h> | 44 | #include <qdir.h> |
42 | #include <qpainter.h> | 45 | #include <qpainter.h> |
43 | #include <qimage.h> | 46 | #include <qimage.h> |
44 | #include <qcopchannel_qws.h> | 47 | #include <qcopchannel_qws.h> |
45 | #include <qlistview.h> | 48 | #include <qlistview.h> |
46 | #include <qlist.h> | 49 | #include <qlist.h> |
47 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
48 | 51 | ||
49 | 52 | ||
50 | using namespace Opie::Core; | ||
51 | AppLnkSet *DocumentList::appLnkSet = 0; | 53 | AppLnkSet *DocumentList::appLnkSet = 0; |
52 | 54 | ||
53 | static const int MAX_SEARCH_DEPTH = 10; | 55 | static const int MAX_SEARCH_DEPTH = 10; |
54 | 56 | ||
55 | 57 | ||
56 | class DocumentListPrivate : public QObject { | 58 | class DocumentListPrivate : public QObject { |
57 | Q_OBJECT | 59 | Q_OBJECT |
58 | public: | 60 | public: |
@@ -103,17 +105,17 @@ DocumentList::DocumentList( ServerInterface *serverGui, bool /*scanDocs*/, | |||
103 | { | 105 | { |
104 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 106 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
105 | d = new DocumentListPrivate( serverGui ); | 107 | d = new DocumentListPrivate( serverGui ); |
106 | d->needToSendAllDocLinks = false; | 108 | d->needToSendAllDocLinks = false; |
107 | 109 | ||
108 | Config cfg( "Launcher" ); | 110 | Config cfg( "Launcher" ); |
109 | cfg.setGroup( "DocTab" ); | 111 | cfg.setGroup( "DocTab" ); |
110 | d->scanDocs = cfg.readBoolEntry( "Enable", true ); | 112 | d->scanDocs = cfg.readBoolEntry( "Enable", true ); |
111 | qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs ); | 113 | odebug << "DocumentList::DocumentList() : scanDocs = " << d->scanDocs << "" << oendl; |
112 | 114 | ||
113 | QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); | 115 | QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); |
114 | } | 116 | } |
115 | 117 | ||
116 | void DocumentList::startInitialScan() | 118 | void DocumentList::startInitialScan() |
117 | { | 119 | { |
118 | reloadAppLnks(); | 120 | reloadAppLnks(); |
119 | reloadDocLnks(); | 121 | reloadDocLnks(); |
@@ -136,27 +138,27 @@ void DocumentList::add( const DocLnk& doc ) | |||
136 | void DocumentList::start() | 138 | void DocumentList::start() |
137 | { | 139 | { |
138 | resume(); | 140 | resume(); |
139 | } | 141 | } |
140 | 142 | ||
141 | 143 | ||
142 | void DocumentList::pause() | 144 | void DocumentList::pause() |
143 | { | 145 | { |
144 | //qDebug("pause %i", d->tid); | 146 | //odebug << "pause " << d->tid << "" << oendl; |
145 | killTimer( d->tid ); | 147 | killTimer( d->tid ); |
146 | d->tid = 0; | 148 | d->tid = 0; |
147 | } | 149 | } |
148 | 150 | ||
149 | 151 | ||
150 | void DocumentList::resume() | 152 | void DocumentList::resume() |
151 | { | 153 | { |
152 | if ( d->tid == 0 ) { | 154 | if ( d->tid == 0 ) { |
153 | d->tid = startTimer( 20 ); | 155 | d->tid = startTimer( 20 ); |
154 | //qDebug("resumed %i", d->tid); | 156 | //odebug << "resumed " << d->tid << "" << oendl; |
155 | } | 157 | } |
156 | } | 158 | } |
157 | 159 | ||
158 | /* | 160 | /* |
159 | void DocumentList::resend() | 161 | void DocumentList::resend() |
160 | { | 162 | { |
161 | // Re-emits all the added items to the list (firstly letting everyone know to | 163 | // Re-emits all the added items to the list (firstly letting everyone know to |
162 | // clear what they have as it is being sent again) | 164 | // clear what they have as it is being sent again) |
@@ -172,17 +174,17 @@ void DocumentList::resendWorker() | |||
172 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) | 174 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) |
173 | add( *(*it) ); | 175 | add( *(*it) ); |
174 | resume(); | 176 | resume(); |
175 | } | 177 | } |
176 | */ | 178 | */ |
177 | 179 | ||
178 | void DocumentList::rescan() | 180 | void DocumentList::rescan() |
179 | { | 181 | { |
180 | //qDebug("rescan"); | 182 | //odebug << "rescan" << oendl; |
181 | pause(); | 183 | pause(); |
182 | d->initialize(); | 184 | d->initialize(); |
183 | resume(); | 185 | resume(); |
184 | } | 186 | } |
185 | 187 | ||
186 | 188 | ||
187 | void DocumentList::timerEvent( QTimerEvent *te ) | 189 | void DocumentList::timerEvent( QTimerEvent *te ) |
188 | { | 190 | { |
@@ -227,26 +229,26 @@ void DocumentList::reloadAppLnks() | |||
227 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); | 229 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); |
228 | 230 | ||
229 | if (pm.isNull()) { | 231 | if (pm.isNull()) { |
230 | QImage img( Resource::loadImage( "UnknownDocument" ) ); | 232 | QImage img( Resource::loadImage( "UnknownDocument" ) ); |
231 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 233 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
232 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); | 234 | bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); |
233 | } | 235 | } |
234 | 236 | ||
235 | //qDebug("adding type %s", (*ittypes).latin1()); | 237 | //odebug << "adding type " << (*ittypes) << "" << oendl; |
236 | 238 | ||
237 | // ### our current launcher expects docs tab to be last | 239 | // ### our current launcher expects docs tab to be last |
238 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); | 240 | d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); |
239 | } | 241 | } |
240 | prevTypeList.remove(*ittypes); | 242 | prevTypeList.remove(*ittypes); |
241 | } | 243 | } |
242 | } | 244 | } |
243 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { | 245 | for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { |
244 | //qDebug("removing type %s", (*ittypes).latin1()); | 246 | //odebug << "removing type " << (*ittypes) << "" << oendl; |
245 | d->serverGui->typeRemoved(*ittypes); | 247 | d->serverGui->typeRemoved(*ittypes); |
246 | } | 248 | } |
247 | prevTypeList = types; | 249 | prevTypeList = types; |
248 | } | 250 | } |
249 | 251 | ||
250 | QListIterator<AppLnk> itapp( appLnkSet->children() ); | 252 | QListIterator<AppLnk> itapp( appLnkSet->children() ); |
251 | AppLnk* l; | 253 | AppLnk* l; |
252 | while ( (l=itapp.current()) ) { | 254 | while ( (l=itapp.current()) ) { |
@@ -269,57 +271,57 @@ void DocumentList::reloadDocLnks() | |||
269 | d->serverGui->allDocumentsRemoved(); | 271 | d->serverGui->allDocumentsRemoved(); |
270 | } | 272 | } |
271 | 273 | ||
272 | rescan(); | 274 | rescan(); |
273 | } | 275 | } |
274 | 276 | ||
275 | void DocumentList::linkChanged( QString arg ) | 277 | void DocumentList::linkChanged( QString arg ) |
276 | { | 278 | { |
277 | //qDebug( "linkchanged( %s )", arg.latin1() ); | 279 | //odebug << "linkchanged( " << arg << " )" << oendl; |
278 | 280 | ||
279 | if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { | 281 | if ( arg.isNull() || OGlobal::isAppLnkFileName( arg ) ) { |
280 | reloadAppLnks(); | 282 | reloadAppLnks(); |
281 | } else { | 283 | } else { |
282 | 284 | ||
283 | const QList<DocLnk> &list = d->dls.children(); | 285 | const QList<DocLnk> &list = d->dls.children(); |
284 | QListIterator<DocLnk> it( list ); | 286 | QListIterator<DocLnk> it( list ); |
285 | while ( it.current() ) { | 287 | while ( it.current() ) { |
286 | DocLnk *doc = it.current(); | 288 | DocLnk *doc = it.current(); |
287 | ++it; | 289 | ++it; |
288 | if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) | 290 | if ( ( doc->linkFileKnown() && doc->linkFile() == arg ) |
289 | || ( doc->fileKnown() && doc->file() == arg ) ) { | 291 | || ( doc->fileKnown() && doc->file() == arg ) ) { |
290 | //qDebug( "found old link" ); | 292 | //odebug << "found old link" << oendl; |
291 | DocLnk* dl = new DocLnk( arg ); | 293 | DocLnk* dl = new DocLnk( arg ); |
292 | // add new one if it exists and matches the mimetype | 294 | // add new one if it exists and matches the mimetype |
293 | if ( d->store( dl ) ) { | 295 | if ( d->store( dl ) ) { |
294 | // Existing link has been changed, send old link ref and a ref | 296 | // Existing link has been changed, send old link ref and a ref |
295 | // to the new link | 297 | // to the new link |
296 | //qDebug( "change case" ); | 298 | //odebug << "change case" << oendl; |
297 | if ( d->serverGui ) | 299 | if ( d->serverGui ) |
298 | d->serverGui->documentChanged( *doc, *dl ); | 300 | d->serverGui->documentChanged( *doc, *dl ); |
299 | 301 | ||
300 | } else { | 302 | } else { |
301 | // Link has been removed or doesn't match the mimetypes any more | 303 | // Link has been removed or doesn't match the mimetypes any more |
302 | // so we aren't interested in it, so take it away from the list | 304 | // so we aren't interested in it, so take it away from the list |
303 | //qDebug( "removal case" ); | 305 | //odebug << "removal case" << oendl; |
304 | if ( d->serverGui ) | 306 | if ( d->serverGui ) |
305 | d->serverGui->documentRemoved( *doc ); | 307 | d->serverGui->documentRemoved( *doc ); |
306 | 308 | ||
307 | } | 309 | } |
308 | d->dls.remove( doc ); // remove old link from docLnkSet | 310 | d->dls.remove( doc ); // remove old link from docLnkSet |
309 | delete doc; | 311 | delete doc; |
310 | return; | 312 | return; |
311 | } | 313 | } |
312 | } | 314 | } |
313 | // Didn't find existing link, must be new | 315 | // Didn't find existing link, must be new |
314 | DocLnk* dl = new DocLnk( arg ); | 316 | DocLnk* dl = new DocLnk( arg ); |
315 | if ( d->store( dl ) ) { | 317 | if ( d->store( dl ) ) { |
316 | // Add if it's a link we are interested in | 318 | // Add if it's a link we are interested in |
317 | //qDebug( "add case" ); | 319 | //odebug << "add case" << oendl; |
318 | add( *dl ); | 320 | add( *dl ); |
319 | } | 321 | } |
320 | 322 | ||
321 | } | 323 | } |
322 | } | 324 | } |
323 | 325 | ||
324 | void DocumentList::restoreDone() | 326 | void DocumentList::restoreDone() |
325 | { | 327 | { |
@@ -373,22 +375,22 @@ void DocumentList::sendAllDocLinks() | |||
373 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 375 | cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
374 | contents += "Name = "+doc->name()+"\n"; // No tr | 376 | contents += "Name = "+doc->name()+"\n"; // No tr |
375 | contents += "Type = "+doc->type()+"\n"; // No tr | 377 | contents += "Type = "+doc->type()+"\n"; // No tr |
376 | } | 378 | } |
377 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 379 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
378 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 380 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
379 | } | 381 | } |
380 | 382 | ||
381 | //qDebug( "sending length %d", contents.length() ); | 383 | //odebug << "sending length " << contents.length() << "" << oendl; |
382 | #ifndef QT_NO_COP | 384 | #ifndef QT_NO_COP |
383 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); | 385 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); |
384 | e << contents; | 386 | e << contents; |
385 | #endif | 387 | #endif |
386 | //qDebug( "================ \n\n%s\n\n===============", contents.latin1() ); | 388 | //odebug << "================ \n\n" << contents << "\n\n===============" << oendl; |
387 | 389 | ||
388 | d->needToSendAllDocLinks = false; | 390 | d->needToSendAllDocLinks = false; |
389 | } | 391 | } |
390 | 392 | ||
391 | 393 | ||
392 | 394 | ||
393 | 395 | ||
394 | 396 | ||
@@ -531,34 +533,34 @@ void DocumentListPrivate::estimatedPercentScanned() | |||
531 | // Take in to account "." and ".." | 533 | // Take in to account "." and ".." |
532 | overallProgress += (listPositions[d] - 3) * levelWeight; | 534 | overallProgress += (listPositions[d] - 3) * levelWeight; |
533 | } | 535 | } |
534 | } else { | 536 | } else { |
535 | break; | 537 | break; |
536 | } | 538 | } |
537 | } | 539 | } |
538 | 540 | ||
539 | // qDebug( "overallProgress: %f", overallProgress ); | 541 | // odebug << "overallProgress: " << overallProgress << "" << oendl; |
540 | 542 | ||
541 | if ( serverGui ) | 543 | if ( serverGui ) |
542 | serverGui->documentScanningProgress( (int)overallProgress ); | 544 | serverGui->documentScanningProgress( (int)overallProgress ); |
543 | } | 545 | } |
544 | 546 | ||
545 | 547 | ||
546 | const QString DocumentListPrivate::nextFile() | 548 | const QString DocumentListPrivate::nextFile() |
547 | { | 549 | { |
548 | while ( TRUE ) { | 550 | while ( TRUE ) { |
549 | while ( searchDepth < 0 ) { | 551 | while ( searchDepth < 0 ) { |
550 | // go to next base path | 552 | // go to next base path |
551 | if ( docPathsSearched >= docPaths.count() ) { | 553 | if ( docPathsSearched >= docPaths.count() ) { |
552 | // end of base paths | 554 | // end of base paths |
553 | return QString::null; | 555 | return QString::null; |
554 | } else { | 556 | } else { |
555 | QDir dir( docPaths[docPathsSearched] ); | 557 | QDir dir( docPaths[docPathsSearched] ); |
556 | // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() ); | 558 | // odebug << "now using base path: " << docPaths[docPathsSearched] << "" << oendl; |
557 | docPathsSearched++; | 559 | docPathsSearched++; |
558 | if ( !dir.exists( ".Qtopia-ignore" ) ) { | 560 | if ( !dir.exists( ".Qtopia-ignore" ) ) { |
559 | listDirs[0] = new QDir( dir ); | 561 | listDirs[0] = new QDir( dir ); |
560 | lists[0] = listDirs[0]->entryInfoList(); | 562 | lists[0] = listDirs[0]->entryInfoList(); |
561 | listPositions[0] = 0; | 563 | listPositions[0] = 0; |
562 | searchDepth = 0; | 564 | searchDepth = 0; |
563 | } | 565 | } |
564 | } | 566 | } |
@@ -582,17 +584,17 @@ const QString DocumentListPrivate::nextFile() | |||
582 | const QFileInfo *fi = fl->at(pos); | 584 | const QFileInfo *fi = fl->at(pos); |
583 | listPositions[searchDepth]++; | 585 | listPositions[searchDepth]++; |
584 | QString bn = fi->fileName(); | 586 | QString bn = fi->fileName(); |
585 | if ( bn[0] != '.' ) { | 587 | if ( bn[0] != '.' ) { |
586 | if ( fi->isDir() ) { | 588 | if ( fi->isDir() ) { |
587 | if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { | 589 | if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) { |
588 | // go down a depth | 590 | // go down a depth |
589 | QDir dir( fi->filePath() ); | 591 | QDir dir( fi->filePath() ); |
590 | // qDebug("now going in to path: %s", bn.latin1() ); | 592 | // odebug << "now going in to path: " << bn << "" << oendl; |
591 | if ( !dir.exists( ".Qtopia-ignore" ) ) { | 593 | if ( !dir.exists( ".Qtopia-ignore" ) ) { |
592 | if ( searchDepth < MAX_SEARCH_DEPTH - 1) { | 594 | if ( searchDepth < MAX_SEARCH_DEPTH - 1) { |
593 | searchDepth++; | 595 | searchDepth++; |
594 | listDirs[searchDepth] = new QDir( dir ); | 596 | listDirs[searchDepth] = new QDir( dir ); |
595 | lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); | 597 | lists[searchDepth] = listDirs[searchDepth]->entryInfoList(); |
596 | listPositions[searchDepth] = 0; | 598 | listPositions[searchDepth] = 0; |
597 | } | 599 | } |
598 | } | 600 | } |
@@ -623,17 +625,17 @@ bool DocumentListPrivate::store( DocLnk* dl ) | |||
623 | } | 625 | } |
624 | 626 | ||
625 | 627 | ||
626 | #define MAGIC_NUMBER((void*)2) | 628 | #define MAGIC_NUMBER((void*)2) |
627 | 629 | ||
628 | const DocLnk *DocumentListPrivate::iterate() | 630 | const DocLnk *DocumentListPrivate::iterate() |
629 | { | 631 | { |
630 | if ( state == Find ) { | 632 | if ( state == Find ) { |
631 | //qDebug("state Find"); | 633 | //odebug << "state Find" << oendl; |
632 | QString file = nextFile(); | 634 | QString file = nextFile(); |
633 | while ( !file.isNull() ) { | 635 | while ( !file.isNull() ) { |
634 | if ( file.right(8) == ".desktop" ) { // No tr | 636 | if ( file.right(8) == ".desktop" ) { // No tr |
635 | DocLnk* dl = new DocLnk( file ); | 637 | DocLnk* dl = new DocLnk( file ); |
636 | if ( store(dl) ) | 638 | if ( store(dl) ) |
637 | return dl; | 639 | return dl; |
638 | } else { | 640 | } else { |
639 | reference.insert( file, MAGIC_NUMBER ); | 641 | reference.insert( file, MAGIC_NUMBER ); |
@@ -645,31 +647,31 @@ const DocLnk *DocumentListPrivate::iterate() | |||
645 | if ( serverGui ) | 647 | if ( serverGui ) |
646 | serverGui->documentScanningProgress( 75 ); | 648 | serverGui->documentScanningProgress( 75 ); |
647 | } | 649 | } |
648 | 650 | ||
649 | static int iterationI; | 651 | static int iterationI; |
650 | static int iterationCount; | 652 | static int iterationCount; |
651 | 653 | ||
652 | if ( state == RemoveKnownFiles ) { | 654 | if ( state == RemoveKnownFiles ) { |
653 | //qDebug("state RemoveKnownFiles"); | 655 | //odebug << "state RemoveKnownFiles" << oendl; |
654 | const QList<DocLnk> &list = dls.children(); | 656 | const QList<DocLnk> &list = dls.children(); |
655 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { | 657 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) { |
656 | reference.remove( (*it)->file() ); | 658 | reference.remove( (*it)->file() ); |
657 | // ### does this need to be deleted? | 659 | // ### does this need to be deleted? |
658 | } | 660 | } |
659 | dit = new QDictIterator<void>(reference); | 661 | dit = new QDictIterator<void>(reference); |
660 | state = MakeUnknownFiles; | 662 | state = MakeUnknownFiles; |
661 | 663 | ||
662 | iterationI = 0; | 664 | iterationI = 0; |
663 | iterationCount = dit->count(); | 665 | iterationCount = dit->count(); |
664 | } | 666 | } |
665 | 667 | ||
666 | if ( state == MakeUnknownFiles ) { | 668 | if ( state == MakeUnknownFiles ) { |
667 | //qDebug("state MakeUnknownFiles"); | 669 | //odebug << "state MakeUnknownFiles" << oendl; |
668 | for (void* c; (c=dit->current()); ++(*dit) ) { | 670 | for (void* c; (c=dit->current()); ++(*dit) ) { |
669 | if ( c == MAGIC_NUMBER ) { | 671 | if ( c == MAGIC_NUMBER ) { |
670 | DocLnk* dl = new DocLnk; | 672 | DocLnk* dl = new DocLnk; |
671 | QFileInfo fi( dit->currentKey() ); | 673 | QFileInfo fi( dit->currentKey() ); |
672 | dl->setFile( fi.filePath() ); | 674 | dl->setFile( fi.filePath() ); |
673 | dl->setName( fi.baseName() ); | 675 | dl->setName( fi.baseName() ); |
674 | if ( store(dl) ) { | 676 | if ( store(dl) ) { |
675 | ++*dit; | 677 | ++*dit; |
@@ -682,17 +684,17 @@ const DocLnk *DocumentListPrivate::iterate() | |||
682 | iterationI++; | 684 | iterationI++; |
683 | } | 685 | } |
684 | 686 | ||
685 | delete dit; | 687 | delete dit; |
686 | dit = 0; | 688 | dit = 0; |
687 | state = Done; | 689 | state = Done; |
688 | } | 690 | } |
689 | 691 | ||
690 | //qDebug("state Done"); | 692 | //odebug << "state Done" << oendl; |
691 | return NULL; | 693 | return NULL; |
692 | } | 694 | } |
693 | 695 | ||
694 | 696 | ||
695 | #include "documentlist.moc" | 697 | #include "documentlist.moc" |
696 | 698 | ||
697 | 699 | ||
698 | 700 | ||
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp index 4316648..e9e2d83 100644 --- a/core/launcher/firstuse.cpp +++ b/core/launcher/firstuse.cpp | |||
@@ -24,39 +24,41 @@ | |||
24 | //### revise to allow removal of translators under MSVC | 24 | //### revise to allow removal of translators under MSVC |
25 | #define private public | 25 | #define private public |
26 | #define protected public | 26 | #define protected public |
27 | #endif | 27 | #endif |
28 | #include "firstuse.h" | 28 | #include "firstuse.h" |
29 | #include "inputmethods.h" | 29 | #include "inputmethods.h" |
30 | #include "applauncher.h" | 30 | #include "applauncher.h" |
31 | #include "serverapp.h" | 31 | #include "serverapp.h" |
32 | //#include <qtopia/custom.h> | ||
33 | |||
34 | #include "calibrate.h" | 32 | #include "calibrate.h" |
35 | #include "documentlist.h" | 33 | #include "documentlist.h" |
36 | 34 | ||
35 | /* OPIE */ | ||
36 | #include <opie2/odebug.h> | ||
37 | #include <qtopia/resource.h> | 37 | #include <qtopia/resource.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #include <qtopia/config.h> | 39 | #include <qtopia/config.h> |
40 | #include <qtopia/fontmanager.h> | 40 | #include <qtopia/fontmanager.h> |
41 | using namespace Opie::Core; | ||
41 | 42 | ||
43 | /* QT */ | ||
42 | #include <qfile.h> | 44 | #include <qfile.h> |
43 | #include <qpainter.h> | 45 | #include <qpainter.h> |
44 | #include <qsimplerichtext.h> | 46 | #include <qsimplerichtext.h> |
45 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
46 | #include <qlabel.h> | 48 | #include <qlabel.h> |
47 | #include <qtimer.h> | 49 | #include <qtimer.h> |
48 | 50 | ||
49 | #if defined( Q_WS_QWS ) | 51 | #if defined( Q_WS_QWS ) |
50 | #include <qwsdisplay_qws.h> | 52 | #include <qwsdisplay_qws.h> |
51 | #include <qgfx_qws.h> | 53 | #include <qgfx_qws.h> |
52 | #endif | 54 | #endif |
53 | 55 | ||
54 | 56 | /* STD */ | |
55 | #include <stdlib.h> | 57 | #include <stdlib.h> |
56 | #include <sys/types.h> | 58 | #include <sys/types.h> |
57 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) | 59 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) |
58 | #include <unistd.h> | 60 | #include <unistd.h> |
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | 63 | ||
62 | struct { | 64 | struct { |
@@ -150,17 +152,17 @@ FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) : | |||
150 | back->setGeometry(x, 0, buttonWidth, controlHeight); | 152 | back->setGeometry(x, 0, buttonWidth, controlHeight); |
151 | x += buttonWidth; | 153 | x += buttonWidth; |
152 | next->setGeometry(x, 0, buttonWidth, controlHeight); | 154 | next->setGeometry(x, 0, buttonWidth, controlHeight); |
153 | 155 | ||
154 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); | 156 | taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight); |
155 | taskBar->hide(); | 157 | taskBar->hide(); |
156 | 158 | ||
157 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 159 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
158 | qDebug("Setting up QCop to QPE/System"); | 160 | odebug << "Setting up QCop to QPE/System" << oendl; |
159 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 161 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
160 | connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 162 | connect(sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
161 | this, SLOT(message(const QCString&,const QByteArray&)) ); | 163 | this, SLOT(message(const QCString&,const QByteArray&)) ); |
162 | #endif | 164 | #endif |
163 | calcMaxWindowRect(); | 165 | calcMaxWindowRect(); |
164 | 166 | ||
165 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; | 167 | m_calHandler = ( QWSServer::mouseHandler() && QWSServer::mouseHandler()->inherits("QCalibratedMouseHandler") ) ? true : false; |
166 | 168 | ||
@@ -218,28 +220,28 @@ void FirstUse::calcMaxWindowRect() | |||
218 | } | 220 | } |
219 | 221 | ||
220 | /* cancel current dialog, and bring up next */ | 222 | /* cancel current dialog, and bring up next */ |
221 | void FirstUse::nextDialog() | 223 | void FirstUse::nextDialog() |
222 | { | 224 | { |
223 | int prevApp = currApp; | 225 | int prevApp = currApp; |
224 | do { | 226 | do { |
225 | currApp++; | 227 | currApp++; |
226 | qDebug( "currApp = %d", currApp ); | 228 | odebug << "currApp = " << currApp << "" << oendl; |
227 | if ( settingsTable[currApp].app == 0 ) { | 229 | if ( settingsTable[currApp].app == 0 ) { |
228 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 230 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
229 | // The last application is still running. | 231 | // The last application is still running. |
230 | // Tell it to stop, and when its done we'll come back | 232 | // Tell it to stop, and when its done we'll come back |
231 | // to nextDialog and exit. | 233 | // to nextDialog and exit. |
232 | qDebug( "Waiting for %s to exit", settingsTable[prevApp].app ); | 234 | odebug << "Waiting for " << settingsTable[prevApp].app << " to exit" << oendl; |
233 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 235 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
234 | settingsTable[prevApp].stop ); | 236 | settingsTable[prevApp].stop ); |
235 | currApp = prevApp; | 237 | currApp = prevApp; |
236 | } else { | 238 | } else { |
237 | qDebug( "Done!" ); | 239 | odebug << "Done!" << oendl; |
238 | Config config( "qpe" ); | 240 | Config config( "qpe" ); |
239 | config.setGroup( "Startup" ); | 241 | config.setGroup( "Startup" ); |
240 | config.writeEntry( "FirstUse", FALSE ); | 242 | config.writeEntry( "FirstUse", FALSE ); |
241 | QPixmap pix = Resource::loadPixmap("bigwait"); | 243 | QPixmap pix = Resource::loadPixmap("bigwait"); |
242 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr | 244 | QLabel *lblWait = new QLabel(0, "wait hack!", // No tr |
243 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | | 245 | QWidget::WStyle_Customize | QWidget::WDestructiveClose | |
244 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | | 246 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool | |
245 | QWidget::WStyle_StaysOnTop); | 247 | QWidget::WStyle_StaysOnTop); |
@@ -253,22 +255,22 @@ void FirstUse::nextDialog() | |||
253 | close(); | 255 | close(); |
254 | ServerApplication::allowRestart = TRUE; | 256 | ServerApplication::allowRestart = TRUE; |
255 | } | 257 | } |
256 | return; | 258 | return; |
257 | } | 259 | } |
258 | } while ( !settingsTable[currApp].enabled ); | 260 | } while ( !settingsTable[currApp].enabled ); |
259 | 261 | ||
260 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { | 262 | if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) { |
261 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); | 263 | odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; |
262 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 264 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
263 | settingsTable[prevApp].stop ); | 265 | settingsTable[prevApp].stop ); |
264 | waitForExit = prevApp; | 266 | waitForExit = prevApp; |
265 | } else { | 267 | } else { |
266 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 268 | odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; |
267 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 269 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
268 | settingsTable[currApp].start ); | 270 | settingsTable[currApp].start ); |
269 | waitingForLaunch = TRUE; | 271 | waitingForLaunch = TRUE; |
270 | } | 272 | } |
271 | 273 | ||
272 | updateButtons(); | 274 | updateButtons(); |
273 | } | 275 | } |
274 | 276 | ||
@@ -280,26 +282,26 @@ void FirstUse::previousDialog() | |||
280 | currApp--; | 282 | currApp--; |
281 | if ( currApp < 0 ) { | 283 | if ( currApp < 0 ) { |
282 | currApp = prevApp; | 284 | currApp = prevApp; |
283 | return; | 285 | return; |
284 | } | 286 | } |
285 | } while ( !settingsTable[currApp].enabled ); | 287 | } while ( !settingsTable[currApp].enabled ); |
286 | 288 | ||
287 | if ( prevApp >= 0 ) { | 289 | if ( prevApp >= 0 ) { |
288 | qDebug( "Shutdown: %s", settingsTable[prevApp].app ); | 290 | odebug << "Shutdown: " << settingsTable[prevApp].app << "" << oendl; |
289 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, | 291 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app, |
290 | settingsTable[prevApp].stop ); | 292 | settingsTable[prevApp].stop ); |
291 | /* | 293 | /* |
292 | if (settingsTable[prevApp].app == QString("systemtime")) | 294 | if (settingsTable[prevApp].app == QString("systemtime")) |
293 | QCopEnvelope e("QPE/Application/citytime", "close()"); | 295 | QCopEnvelope e("QPE/Application/citytime", "close()"); |
294 | */ | 296 | */ |
295 | waitForExit = prevApp; | 297 | waitForExit = prevApp; |
296 | } else { | 298 | } else { |
297 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 299 | odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; |
298 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, | 300 | QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app, |
299 | settingsTable[currApp].start ); | 301 | settingsTable[currApp].start ); |
300 | waitingForLaunch = TRUE; | 302 | waitingForLaunch = TRUE; |
301 | } | 303 | } |
302 | 304 | ||
303 | updateButtons(); | 305 | updateButtons(); |
304 | } | 306 | } |
305 | 307 | ||
@@ -313,19 +315,19 @@ void FirstUse::message(const QCString &msg, const QByteArray &data) | |||
313 | unsetenv("TZ"); | 315 | unsetenv("TZ"); |
314 | else | 316 | else |
315 | setenv( "TZ", t.latin1(), 1 ); | 317 | setenv( "TZ", t.latin1(), 1 ); |
316 | } | 318 | } |
317 | } | 319 | } |
318 | 320 | ||
319 | void FirstUse::terminated( int, const QString &app ) | 321 | void FirstUse::terminated( int, const QString &app ) |
320 | { | 322 | { |
321 | qDebug( "--- terminated: %s", app.latin1() ); | 323 | odebug << "--- terminated: " << app << "" << oendl; |
322 | if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { | 324 | if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) { |
323 | qDebug( "Startup: %s", settingsTable[currApp].app ); | 325 | odebug << "Startup: " << settingsTable[currApp].app << "" << oendl; |
324 | if ( settingsTable[waitForExit].app == "language" ) { // No tr | 326 | if ( settingsTable[waitForExit].app == "language" ) { // No tr |
325 | Config config("locale"); | 327 | Config config("locale"); |
326 | config.setGroup( "Language"); | 328 | config.setGroup( "Language"); |
327 | QString l = config.readEntry( "Language", "en"); | 329 | QString l = config.readEntry( "Language", "en"); |
328 | if ( l != lang ) { | 330 | if ( l != lang ) { |
329 | reloadLanguages(); | 331 | reloadLanguages(); |
330 | needRestart = TRUE; | 332 | needRestart = TRUE; |
331 | lang = l; | 333 | lang = l; |
@@ -342,22 +344,22 @@ void FirstUse::terminated( int, const QString &app ) | |||
342 | } else { | 344 | } else { |
343 | back->setEnabled(TRUE); | 345 | back->setEnabled(TRUE); |
344 | next->setEnabled(TRUE); | 346 | next->setEnabled(TRUE); |
345 | } | 347 | } |
346 | } | 348 | } |
347 | 349 | ||
348 | void FirstUse::newQcopChannel(const QString& channelName) | 350 | void FirstUse::newQcopChannel(const QString& channelName) |
349 | { | 351 | { |
350 | qDebug("channel %s added", channelName.data() ); | 352 | odebug << "channel " << channelName.data() << " added" << oendl; |
351 | QString prefix("QPE/Application/"); | 353 | QString prefix("QPE/Application/"); |
352 | if (channelName.startsWith(prefix)) { | 354 | if (channelName.startsWith(prefix)) { |
353 | QString appName = channelName.mid(prefix.length()); | 355 | QString appName = channelName.mid(prefix.length()); |
354 | if ( currApp >= 0 && appName == settingsTable[currApp].app ) { | 356 | if ( currApp >= 0 && appName == settingsTable[currApp].app ) { |
355 | qDebug( "Application: %s started", settingsTable[currApp].app ); | 357 | odebug << "Application: " << settingsTable[currApp].app << " started" << oendl; |
356 | waitingForLaunch = FALSE; | 358 | waitingForLaunch = FALSE; |
357 | updateButtons(); | 359 | updateButtons(); |
358 | repaint(); | 360 | repaint(); |
359 | } else if (appName != "quicklauncher") { | 361 | } else if (appName != "quicklauncher") { |
360 | back->setEnabled(FALSE); | 362 | back->setEnabled(FALSE); |
361 | next->setEnabled(FALSE); | 363 | next->setEnabled(FALSE); |
362 | } | 364 | } |
363 | } | 365 | } |
@@ -365,52 +367,52 @@ void FirstUse::newQcopChannel(const QString& channelName) | |||
365 | 367 | ||
366 | void FirstUse::reloadLanguages() | 368 | void FirstUse::reloadLanguages() |
367 | { | 369 | { |
368 | // read language from config file. Waiting on QCop takes too long. | 370 | // read language from config file. Waiting on QCop takes too long. |
369 | Config config("locale"); | 371 | Config config("locale"); |
370 | config.setGroup( "Language"); | 372 | config.setGroup( "Language"); |
371 | QString l = config.readEntry( "Language", "en"); | 373 | QString l = config.readEntry( "Language", "en"); |
372 | QString cl = getenv("LANG"); | 374 | QString cl = getenv("LANG"); |
373 | qWarning("language message - " + l); | 375 | owarn << "language message - " + l << oendl; |
374 | // setting anyway... | 376 | // setting anyway... |
375 | if (l.isNull() ) | 377 | if (l.isNull() ) |
376 | unsetenv( "LANG" ); | 378 | unsetenv( "LANG" ); |
377 | else { | 379 | else { |
378 | qWarning("and its not null"); | 380 | owarn << "and its not null" << oendl; |
379 | setenv( "LANG", l.latin1(), 1 ); | 381 | setenv( "LANG", l.latin1(), 1 ); |
380 | } | 382 | } |
381 | #ifndef QT_NO_TRANSLATION | 383 | #ifndef QT_NO_TRANSLATION |
382 | // clear old translators | 384 | // clear old translators |
383 | #ifndef _MSC_VER | 385 | #ifndef _MSC_VER |
384 | //### revise to allow removal of translators under MSVC | 386 | //### revise to allow removal of translators under MSVC |
385 | if(qApp->translators) { | 387 | if(qApp->translators) { |
386 | qApp->translators->setAutoDelete(TRUE); | 388 | qApp->translators->setAutoDelete(TRUE); |
387 | delete (qApp->translators); | 389 | delete (qApp->translators); |
388 | qApp->translators = 0; | 390 | qApp->translators = 0; |
389 | } | 391 | } |
390 | #endif | 392 | #endif |
391 | 393 | ||
392 | // load translation tables | 394 | // load translation tables |
393 | transApp = new QTranslator(qApp); | 395 | transApp = new QTranslator(qApp); |
394 | QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; | 396 | QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm"; |
395 | qWarning("loading " + tfn); | 397 | owarn << "loading " + tfn << oendl; |
396 | if ( transApp->load(tfn) ) { | 398 | if ( transApp->load(tfn) ) { |
397 | qWarning("installing translator"); | 399 | owarn << "installing translator" << oendl; |
398 | qApp->installTranslator( transApp ); | 400 | qApp->installTranslator( transApp ); |
399 | } else { | 401 | } else { |
400 | delete transApp; | 402 | delete transApp; |
401 | transApp = 0; | 403 | transApp = 0; |
402 | } | 404 | } |
403 | 405 | ||
404 | transLib = new QTranslator(qApp); | 406 | transLib = new QTranslator(qApp); |
405 | tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; | 407 | tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm"; |
406 | qWarning("loading " + tfn); | 408 | owarn << "loading " + tfn << oendl; |
407 | if ( transLib->load(tfn) ) { | 409 | if ( transLib->load(tfn) ) { |
408 | qWarning("installing translator library"); | 410 | owarn << "installing translator library" << oendl; |
409 | qApp->installTranslator( transLib ); | 411 | qApp->installTranslator( transLib ); |
410 | } else { | 412 | } else { |
411 | delete transLib; | 413 | delete transLib; |
412 | transLib = 0; | 414 | transLib = 0; |
413 | } | 415 | } |
414 | loadPixmaps(); | 416 | loadPixmaps(); |
415 | //###language/font hack; should look it up somewhere | 417 | //###language/font hack; should look it up somewhere |
416 | #ifdef Q_WS_QWS | 418 | #ifdef Q_WS_QWS |
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index 19e799a..cef16bf 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -16,41 +16,37 @@ | |||
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 | #define QTOPIA_INTERNAL_LANGLIST | 21 | #define QTOPIA_INTERNAL_LANGLIST |
22 | #include "inputmethods.h" | 22 | #include "inputmethods.h" |
23 | 23 | ||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
24 | #include <qtopia/config.h> | 26 | #include <qtopia/config.h> |
25 | #include <qtopia/qpeapplication.h> | 27 | #include <qtopia/qpeapplication.h> |
28 | using namespace Opie::Core; | ||
26 | 29 | ||
30 | /* QT */ | ||
27 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
28 | #include <qtoolbutton.h> | 32 | #include <qtoolbutton.h> |
29 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
30 | #include <qlayout.h> | 34 | #include <qlayout.h> |
31 | #include <qdir.h> | 35 | #include <qdir.h> |
32 | #include <stdlib.h> | ||
33 | #include <qtl.h> | 36 | #include <qtl.h> |
34 | |||
35 | #ifdef Q_WS_QWS | 37 | #ifdef Q_WS_QWS |
36 | #include <qwindowsystem_qws.h> | 38 | #include <qwindowsystem_qws.h> |
37 | #include <qwsevent_qws.h> | 39 | #include <qwsevent_qws.h> |
38 | #include <qcopchannel_qws.h> | 40 | #include <qcopchannel_qws.h> |
39 | #endif | 41 | #endif |
40 | 42 | ||
41 | /* ### SingleFloppy if someone is interested? */ | 43 | /* STD */ |
42 | #if 0 | 44 | #include <stdlib.h> |
43 | #ifdef QT_NO_COMPONENT | ||
44 | #include "../plugins/inputmethods/handwriting/handwritingimpl.h" | ||
45 | #include "../plugins/inputmethods/keyboard/keyboardimpl.h" | ||
46 | #include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" | ||
47 | #endif | ||
48 | #endif | ||
49 | 45 | ||
50 | /* XPM */ | 46 | /* XPM */ |
51 | static const char * tri_xpm[]={ | 47 | static const char * tri_xpm[]={ |
52 | "9 9 2 1", | 48 | "9 9 2 1", |
53 | "a c #000000", | 49 | "a c #000000", |
54 | ". c None", | 50 | ". c None", |
55 | ".........", | 51 | ".........", |
56 | ".........", | 52 | ".........", |
@@ -257,17 +253,17 @@ void InputMethods::setPreferedHandlers() { | |||
257 | if ( (*it).name() == im ) { | 253 | if ( (*it).name() == im ) { |
258 | imethod = &(*it); break; | 254 | imethod = &(*it); break; |
259 | } | 255 | } |
260 | 256 | ||
261 | } | 257 | } |
262 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { | 258 | if (!inputMethodList.isEmpty() && !current.isEmpty() ) { |
263 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) | 259 | for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) |
264 | if ( (*it).name() == current ) { | 260 | if ( (*it).name() == current ) { |
265 | qWarning("preferred keyboard is %s", current.latin1() ); | 261 | owarn << "preferred keyboard is " << current << "" << oendl; |
266 | mkeyboard = &(*it); | 262 | mkeyboard = &(*it); |
267 | kbdButton->setPixmap( *mkeyboard->icon() ); | 263 | kbdButton->setPixmap( *mkeyboard->icon() ); |
268 | break; | 264 | break; |
269 | } | 265 | } |
270 | } | 266 | } |
271 | 267 | ||
272 | } | 268 | } |
273 | 269 | ||
@@ -300,23 +296,23 @@ void InputMethods::loadInputMethods() | |||
300 | InputMethod input; | 296 | InputMethod input; |
301 | input.newIM = TRUE; | 297 | input.newIM = TRUE; |
302 | input.library = lib; | 298 | input.library = lib; |
303 | input.libName = *it; | 299 | input.libName = *it; |
304 | input.extInterface = eface; | 300 | input.extInterface = eface; |
305 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); | 301 | input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); |
306 | // may be either a simple, or advanced. | 302 | // may be either a simple, or advanced. |
307 | if (input.widget) { | 303 | if (input.widget) { |
308 | //qDebug("its a keyboard"); | 304 | //odebug << "its a keyboard" << oendl; |
309 | inputMethodList.append( input ); | 305 | inputMethodList.append( input ); |
310 | } else { | 306 | } else { |
311 | //qDebug("its a real im"); | 307 | //odebug << "its a real im" << oendl; |
312 | input.widget = input.extInterface->statusWidget( 0, 0 ); | 308 | input.widget = input.extInterface->statusWidget( 0, 0 ); |
313 | if (input.widget) { | 309 | if (input.widget) { |
314 | //qDebug("blah"); | 310 | //odebug << "blah" << oendl; |
315 | inputModifierList.append( input ); | 311 | inputModifierList.append( input ); |
316 | imButton->addWidget(input.widget, inputModifierList.count()); | 312 | imButton->addWidget(input.widget, inputModifierList.count()); |
317 | } | 313 | } |
318 | } | 314 | } |
319 | }else{ | 315 | }else{ |
320 | delete lib; | 316 | delete lib; |
321 | lib = 0l; | 317 | lib = 0l; |
322 | } | 318 | } |
@@ -536,53 +532,53 @@ void InputMethods::showKbd( bool on ) | |||
536 | 532 | ||
537 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); | 533 | int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); |
538 | int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); | 534 | int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); |
539 | int left = 0; | 535 | int left = 0; |
540 | int top = mapToGlobal( QPoint() ).y() - height; | 536 | int top = mapToGlobal( QPoint() ).y() - height; |
541 | 537 | ||
542 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 538 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
543 | { | 539 | { |
544 | qDebug( "InputMethods: reading geometry." ); | 540 | odebug << "InputMethods: reading geometry." << oendl; |
545 | Config cfg( "Launcher" ); | 541 | Config cfg( "Launcher" ); |
546 | cfg.setGroup( "InputMethods" ); | 542 | cfg.setGroup( "InputMethods" ); |
547 | int l = cfg.readNumEntry( "absX", -1 ); | 543 | int l = cfg.readNumEntry( "absX", -1 ); |
548 | int t = cfg.readNumEntry( "absY", -1 ); | 544 | int t = cfg.readNumEntry( "absY", -1 ); |
549 | int w = cfg.readNumEntry( "absWidth", -1 ); | 545 | int w = cfg.readNumEntry( "absWidth", -1 ); |
550 | int h = cfg.readNumEntry( "absHeight", -1 ); | 546 | int h = cfg.readNumEntry( "absHeight", -1 ); |
551 | 547 | ||
552 | if ( l > -1 && t > -1 && w > -1 && h > -1 ) | 548 | if ( l > -1 && t > -1 && w > -1 && h > -1 ) |
553 | { | 549 | { |
554 | qDebug( "InputMethods: config values ( %d, %d, %d, %d ) are ok.", l, t, w, h ); | 550 | odebug << "InputMethods: config values ( " << l << ", " << t << ", " << w << ", " << h << " ) are ok." << oendl; |
555 | left = l; | 551 | left = l; |
556 | top = t; | 552 | top = t; |
557 | width = w; | 553 | width = w; |
558 | height = h; | 554 | height = h; |
559 | } | 555 | } |
560 | else | 556 | else |
561 | { | 557 | { |
562 | qDebug( "InputMethods: config values are new or not ok." ); | 558 | odebug << "InputMethods: config values are new or not ok." << oendl; |
563 | } | 559 | } |
564 | } | 560 | } |
565 | else | 561 | else |
566 | { | 562 | { |
567 | qDebug( "InputMethods: no floating selected." ); | 563 | odebug << "InputMethods: no floating selected." << oendl; |
568 | } | 564 | } |
569 | mkeyboard->widget->resize( width, height ); | 565 | mkeyboard->widget->resize( width, height ); |
570 | mkeyboard->widget->move( left, top ); | 566 | mkeyboard->widget->move( left, top ); |
571 | mkeyboard->widget->show(); | 567 | mkeyboard->widget->show(); |
572 | mkeyboard->widget->installEventFilter( this ); | 568 | mkeyboard->widget->installEventFilter( this ); |
573 | } | 569 | } |
574 | else | 570 | else |
575 | { | 571 | { |
576 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) | 572 | if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) |
577 | { | 573 | { |
578 | QPoint pos = mkeyboard->widget->pos(); | 574 | QPoint pos = mkeyboard->widget->pos(); |
579 | QSize siz = mkeyboard->widget->size(); | 575 | QSize siz = mkeyboard->widget->size(); |
580 | qDebug( "InputMethods: saving geometry." ); | 576 | odebug << "InputMethods: saving geometry." << oendl; |
581 | Config cfg( "Launcher" ); | 577 | Config cfg( "Launcher" ); |
582 | cfg.setGroup( "InputMethods" ); | 578 | cfg.setGroup( "InputMethods" ); |
583 | cfg.writeEntry( "absX", pos.x() ); | 579 | cfg.writeEntry( "absX", pos.x() ); |
584 | cfg.writeEntry( "absY", pos.y() ); | 580 | cfg.writeEntry( "absY", pos.y() ); |
585 | cfg.writeEntry( "absWidth", siz.width() ); | 581 | cfg.writeEntry( "absWidth", siz.width() ); |
586 | cfg.writeEntry( "absHeight", siz.height() ); | 582 | cfg.writeEntry( "absHeight", siz.height() ); |
587 | cfg.write(); | 583 | cfg.write(); |
588 | mkeyboard->widget->removeEventFilter( this ); | 584 | mkeyboard->widget->removeEventFilter( this ); |
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp index a0e9c16..092eb0c 100644 --- a/core/launcher/irserver.cpp +++ b/core/launcher/irserver.cpp | |||
@@ -13,25 +13,25 @@ | |||
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 | |||
22 | #include "irserver.h" | 21 | #include "irserver.h" |
22 | #include "obexinterface.h" | ||
23 | 23 | ||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
24 | #include <qtopia/qlibrary.h> | 26 | #include <qtopia/qlibrary.h> |
25 | #include <qtopia/qpeapplication.h> | 27 | #include <qtopia/qpeapplication.h> |
26 | 28 | ||
27 | 29 | /* QT */ | |
28 | #include "obexinterface.h" | ||
29 | |||
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | 31 | ||
32 | IrServer::IrServer( QObject *parent, const char *name ) | 32 | IrServer::IrServer( QObject *parent, const char *name ) |
33 | : QObject( parent, name ), obexIface(0) | 33 | : QObject( parent, name ), obexIface(0) |
34 | { | 34 | { |
35 | lib = 0; | 35 | lib = 0; |
36 | obexIface = 0; | 36 | obexIface = 0; |
37 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; | 37 | QString path = QPEApplication::qpeDir() + "/plugins/obex/"; |
@@ -39,37 +39,37 @@ IrServer::IrServer( QObject *parent, const char *name ) | |||
39 | QDir dir( path, "lib*.dylib" ); | 39 | QDir dir( path, "lib*.dylib" ); |
40 | #else | 40 | #else |
41 | QDir dir( path, "lib*.so" ); | 41 | QDir dir( path, "lib*.so" ); |
42 | #endif /* Q_OS_MACX */ | 42 | #endif /* Q_OS_MACX */ |
43 | QStringList list = dir.entryList(); | 43 | QStringList list = dir.entryList(); |
44 | QStringList::Iterator it; | 44 | QStringList::Iterator it; |
45 | for ( it = list.begin(); it != list.end(); ++it ) { | 45 | for ( it = list.begin(); it != list.end(); ++it ) { |
46 | QLibrary *trylib = new QLibrary( path + *it ); | 46 | QLibrary *trylib = new QLibrary( path + *it ); |
47 | //qDebug("trying lib %s", (path + (*it)).latin1() ); | 47 | //odebug << "trying lib " << (path + (*it)) << "" << oendl; |
48 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { | 48 | if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { |
49 | lib = trylib; | 49 | lib = trylib; |
50 | //qDebug("found obex lib" ); | 50 | //odebug << "found obex lib" << oendl; |
51 | QString lang = getenv( "LANG" ); | 51 | QString lang = getenv( "LANG" ); |
52 | QTranslator * trans = new QTranslator(qApp); | 52 | QTranslator * trans = new QTranslator(qApp); |
53 | QString type = (*it).left( (*it).find(".") ); | 53 | QString type = (*it).left( (*it).find(".") ); |
54 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | 54 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; |
55 | //qDebug("tr fpr obex: %s", tfn.latin1() ); | 55 | //odebug << "tr fpr obex: " << tfn << "" << oendl; |
56 | if ( trans->load( tfn )) | 56 | if ( trans->load( tfn )) |
57 | qApp->installTranslator( trans ); | 57 | qApp->installTranslator( trans ); |
58 | else | 58 | else |
59 | delete trans; | 59 | delete trans; |
60 | 60 | ||
61 | break; | 61 | break; |
62 | } else { | 62 | } else { |
63 | delete lib; | 63 | delete lib; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | if ( !lib ) | 66 | if ( !lib ) |
67 | qDebug("could not load IR plugin" ); | 67 | odebug << "could not load IR plugin" << oendl; |
68 | } | 68 | } |
69 | 69 | ||
70 | IrServer::~IrServer() | 70 | IrServer::~IrServer() |
71 | { | 71 | { |
72 | if ( obexIface ) | 72 | if ( obexIface ) |
73 | obexIface->release(); | 73 | obexIface->release(); |
74 | delete lib; | 74 | delete lib; |
75 | } | 75 | } |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 5d0c778..bf2287d 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -13,30 +13,42 @@ | |||
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 "startmenu.h" | ||
22 | #include "taskbar.h" | ||
23 | #include "serverinterface.h" | ||
24 | #include "launcherview.h" | ||
25 | #include "launcher.h" | ||
26 | #include "server.h" | ||
27 | |||
28 | /* OPIE */ | ||
29 | #include <opie2/odebug.h> | ||
21 | #include <qtopia/global.h> | 30 | #include <qtopia/global.h> |
22 | #ifdef Q_WS_QWS | 31 | #ifdef Q_WS_QWS |
23 | #include <qtopia/qcopenvelope_qws.h> | 32 | #include <qtopia/qcopenvelope_qws.h> |
24 | #endif | 33 | #endif |
25 | #include <qtopia/resource.h> | 34 | #include <qtopia/resource.h> |
26 | #include <qtopia/applnk.h> | 35 | #include <qtopia/applnk.h> |
27 | #include <qtopia/config.h> | 36 | #include <qtopia/config.h> |
28 | #include <qtopia/qpeapplication.h> | 37 | #include <qtopia/qpeapplication.h> |
29 | #include <qtopia/mimetype.h> | 38 | #include <qtopia/mimetype.h> |
30 | #include <qtopia/private/categories.h> | 39 | #include <qtopia/private/categories.h> |
31 | //#include <qtopia/custom.h> | 40 | #define QTOPIA_INTERNAL_FSLP |
41 | #include <qtopia/lnkproperties.h> | ||
32 | 42 | ||
43 | /* QT */ | ||
33 | #include <qdir.h> | 44 | #include <qdir.h> |
34 | #ifdef Q_WS_QWS | 45 | #ifdef Q_WS_QWS |
46 | #include <qkeyboard_qws.h> | ||
35 | #include <qwindowsystem_qws.h> | 47 | #include <qwindowsystem_qws.h> |
36 | #endif | 48 | #endif |
37 | #include <qtimer.h> | 49 | #include <qtimer.h> |
38 | #include <qcombobox.h> | 50 | #include <qcombobox.h> |
39 | #include <qvbox.h> | 51 | #include <qvbox.h> |
40 | #include <qlayout.h> | 52 | #include <qlayout.h> |
41 | #include <qstyle.h> | 53 | #include <qstyle.h> |
42 | #include <qpushbutton.h> | 54 | #include <qpushbutton.h> |
@@ -45,41 +57,26 @@ | |||
45 | #include <qregexp.h> | 57 | #include <qregexp.h> |
46 | #include <qmessagebox.h> | 58 | #include <qmessagebox.h> |
47 | #include <qframe.h> | 59 | #include <qframe.h> |
48 | #include <qpainter.h> | 60 | #include <qpainter.h> |
49 | #include <qlabel.h> | 61 | #include <qlabel.h> |
50 | #include <qtextstream.h> | 62 | #include <qtextstream.h> |
51 | #include <qpopupmenu.h> | 63 | #include <qpopupmenu.h> |
52 | 64 | ||
53 | #include "startmenu.h" | 65 | /* STD */ |
54 | #include "taskbar.h" | ||
55 | |||
56 | #include "serverinterface.h" | ||
57 | #include "launcherview.h" | ||
58 | #include "launcher.h" | ||
59 | #include "server.h" | ||
60 | |||
61 | #define QTOPIA_INTERNAL_FSLP | ||
62 | #include <qtopia/lnkproperties.h> | ||
63 | #include <stdlib.h> | 66 | #include <stdlib.h> |
64 | #include <assert.h> | 67 | #include <assert.h> |
65 | |||
66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 68 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
67 | #include <unistd.h> | 69 | #include <unistd.h> |
68 | #include <stdio.h> | 70 | #include <stdio.h> |
69 | #include <sys/vfs.h> | 71 | #include <sys/vfs.h> |
70 | #include <mntent.h> | 72 | #include <mntent.h> |
71 | #endif | 73 | #endif |
72 | 74 | ||
73 | #ifdef Q_WS_QWS | ||
74 | #include <qkeyboard_qws.h> | ||
75 | #include <qpe/lnkproperties.h> | ||
76 | #endif | ||
77 | |||
78 | 75 | ||
79 | static bool isVisibleWindow( int ); | 76 | static bool isVisibleWindow( int ); |
80 | //=========================================================================== | 77 | //=========================================================================== |
81 | 78 | ||
82 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 79 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
83 | QVBox( parent ), docview( 0 ) | 80 | QVBox( parent ), docview( 0 ) |
84 | { | 81 | { |
85 | docLoadingWidgetEnabled = false; | 82 | docLoadingWidgetEnabled = false; |
@@ -223,17 +220,17 @@ LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, | |||
223 | stack->addWidget( view, n ); | 220 | stack->addWidget( view, n ); |
224 | 221 | ||
225 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); | 222 | LauncherTab *tab = new LauncherTab( id, view, pm, label ); |
226 | categoryBar->insertTab( tab, n-1 ); | 223 | categoryBar->insertTab( tab, n-1 ); |
227 | 224 | ||
228 | if ( id == "Documents" ) | 225 | if ( id == "Documents" ) |
229 | docview = view; | 226 | docview = view; |
230 | 227 | ||
231 | qDebug("inserting %s at %d", id.latin1(), n-1 ); | 228 | odebug << "inserting " << id << " at " << n-1 << "" << oendl; |
232 | 229 | ||
233 | Config cfg("Launcher"); | 230 | Config cfg("Launcher"); |
234 | setTabAppearance( tab, cfg ); | 231 | setTabAppearance( tab, cfg ); |
235 | 232 | ||
236 | cfg.setGroup( "GUI" ); | 233 | cfg.setGroup( "GUI" ); |
237 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); | 234 | view->setBusyIndicatorType( cfg.readEntry( "BusyType", QString::null ) ); |
238 | 235 | ||
239 | return view; | 236 | return view; |
@@ -408,17 +405,17 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray & | |||
408 | stream >> size; | 405 | stream >> size; |
409 | int weight; | 406 | int weight; |
410 | stream >> weight; | 407 | stream >> weight; |
411 | int italic; | 408 | int italic; |
412 | stream >> italic; | 409 | stream >> italic; |
413 | if ( view(id) ) { | 410 | if ( view(id) ) { |
414 | if ( !fam.isEmpty() ) { | 411 | if ( !fam.isEmpty() ) { |
415 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 412 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
416 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 413 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; |
417 | } else { | 414 | } else { |
418 | view(id)->clearViewFont(); | 415 | view(id)->clearViewFont(); |
419 | } | 416 | } |
420 | } | 417 | } |
421 | }else if ( msg == "setBusyIndicatorType(QString)" ) { | 418 | }else if ( msg == "setBusyIndicatorType(QString)" ) { |
422 | QString type; | 419 | QString type; |
423 | stream >> type; | 420 | stream >> type; |
424 | setBusyIndicatorType( type ); | 421 | setBusyIndicatorType( type ); |
@@ -679,17 +676,17 @@ void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | |||
679 | } | 676 | } |
680 | 677 | ||
681 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 678 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) |
682 | { | 679 | { |
683 | LauncherView *view = tabs->view( type ); | 680 | LauncherView *view = tabs->view( type ); |
684 | if ( view ) | 681 | if ( view ) |
685 | view->removeLink( app.linkFile() ); | 682 | view->removeLink( app.linkFile() ); |
686 | else | 683 | else |
687 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); | 684 | owarn << "removeAppLnk: No view for " << type << "!" << oendl; |
688 | } | 685 | } |
689 | 686 | ||
690 | void Launcher::allApplicationsRemoved() | 687 | void Launcher::allApplicationsRemoved() |
691 | { | 688 | { |
692 | MimeType::clear(); | 689 | MimeType::clear(); |
693 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) | 690 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) |
694 | tabs->view( (*it) )->removeAllItems(); | 691 | tabs->view( (*it) )->removeAllItems(); |
695 | } | 692 | } |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 6c7d487..71e8753 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -15,23 +15,26 @@ | |||
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 "launcherview.h" | 21 | #include "launcherview.h" |
22 | 22 | ||
23 | /* OPIE */ | ||
24 | #include <opie2/odebug.h> | ||
23 | #include <qtopia/qpeapplication.h> | 25 | #include <qtopia/qpeapplication.h> |
24 | #include <qtopia/private/categories.h> | 26 | #include <qtopia/private/categories.h> |
25 | #include <qtopia/categoryselect.h> | 27 | #include <qtopia/categoryselect.h> |
26 | #include <qtopia/mimetype.h> | 28 | #include <qtopia/mimetype.h> |
27 | #include <qtopia/resource.h> | 29 | #include <qtopia/resource.h> |
28 | //#include <qtopia/private/palmtoprecord.h> | 30 | using namespace Opie::Core; |
29 | 31 | ||
32 | /* QT */ | ||
30 | #include <qtimer.h> | 33 | #include <qtimer.h> |
31 | #include <qfileinfo.h> | 34 | #include <qfileinfo.h> |
32 | #include <qiconview.h> | 35 | #include <qiconview.h> |
33 | #include <qobjectlist.h> | 36 | #include <qobjectlist.h> |
34 | 37 | ||
35 | 38 | ||
36 | // These define how the busy icon is animated and highlighted | 39 | // These define how the busy icon is animated and highlighted |
37 | #define BRIGHTEN_BUSY_ICON | 40 | #define BRIGHTEN_BUSY_ICON |
@@ -110,17 +113,17 @@ public: | |||
110 | 113 | ||
111 | ~LauncherIconView() | 114 | ~LauncherIconView() |
112 | { | 115 | { |
113 | #if 0 // debuggery | 116 | #if 0 // debuggery |
114 | QListIterator<AppLnk> it(hidden); | 117 | QListIterator<AppLnk> it(hidden); |
115 | AppLnk* l; | 118 | AppLnk* l; |
116 | while ((l=it.current())) { | 119 | while ((l=it.current())) { |
117 | ++it; | 120 | ++it; |
118 | //qDebug("%p: hidden (should remove)",l); | 121 | //odebug << "" << l << ": hidden (should remove)" << oendl; |
119 | } | 122 | } |
120 | #endif | 123 | #endif |
121 | } | 124 | } |
122 | 125 | ||
123 | QIconViewItem* busyItem() const { return bsy; } | 126 | QIconViewItem* busyItem() const { return bsy; } |
124 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 127 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
125 | QPixmap busyPixmap() const { return busyPix; } | 128 | QPixmap busyPixmap() const { return busyPix; } |
126 | #endif | 129 | #endif |
@@ -1024,17 +1027,17 @@ void LauncherView::paletteChange( const QPalette &p ) | |||
1024 | setBackgroundType( Ruled, QString::null ); | 1027 | setBackgroundType( Ruled, QString::null ); |
1025 | QColorGroup cg = icons->colorGroup(); | 1028 | QColorGroup cg = icons->colorGroup(); |
1026 | cg.setColor( QColorGroup::Text, textCol ); | 1029 | cg.setColor( QColorGroup::Text, textCol ); |
1027 | icons->setPalette( QPalette(cg,cg,cg) ); | 1030 | icons->setPalette( QPalette(cg,cg,cg) ); |
1028 | } | 1031 | } |
1029 | 1032 | ||
1030 | void LauncherView::fontChanged(const QFont&) | 1033 | void LauncherView::fontChanged(const QFont&) |
1031 | { | 1034 | { |
1032 | qDebug("LauncherView::fontChanged()"); | 1035 | odebug << "LauncherView::fontChanged()" << oendl; |
1033 | icons->hideOrShowItems( FALSE ); | 1036 | icons->hideOrShowItems( FALSE ); |
1034 | } | 1037 | } |
1035 | 1038 | ||
1036 | void LauncherView::relayout(void) | 1039 | void LauncherView::relayout(void) |
1037 | { | 1040 | { |
1038 | icons->hideOrShowItems(FALSE); | 1041 | icons->hideOrShowItems(FALSE); |
1039 | } | 1042 | } |
1040 | 1043 | ||
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 3e7e0d2..a86aca6 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -16,60 +16,54 @@ | |||
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 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS | 21 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS |
22 | #define QTOPIA_INTERNAL_FILEOPERATIONS | 22 | #define QTOPIA_INTERNAL_FILEOPERATIONS |
23 | #endif | 23 | #endif |
24 | #ifdef QT_QWS_LOGIN | ||
25 | #include "../login/qdmdialogimpl.h" | ||
26 | #endif | ||
27 | #include "calibrate.h" | ||
24 | #include "server.h" | 28 | #include "server.h" |
25 | #include "serverapp.h" | 29 | #include "serverapp.h" |
26 | #include "stabmon.h" | 30 | #include "stabmon.h" |
27 | #include "firstuse.h" | 31 | #include "firstuse.h" |
28 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/odebug.h> | ||
35 | #include <opie2/odevice.h> | ||
29 | #include <opie2/oglobal.h> | 36 | #include <opie2/oglobal.h> |
30 | |||
31 | #include <qtopia/network.h> | 37 | #include <qtopia/network.h> |
32 | //#include <qtopia/custom.h> | 38 | #include <qtopia/alarmserver.h> |
33 | 39 | using namespace Opie::Core; | |
34 | 40 | ||
41 | /* QT */ | ||
35 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qmessagebox.h> | ||
36 | #ifdef QWS | 44 | #ifdef QWS |
37 | #include <qwindowsystem_qws.h> | 45 | #include <qwindowsystem_qws.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 46 | #include <qtopia/qcopenvelope_qws.h> |
39 | #endif | 47 | #endif |
40 | #include <qtopia/alarmserver.h> | 48 | #ifdef Q_WS_QWS |
49 | #include <qkeyboard_qws.h> | ||
50 | #endif | ||
41 | 51 | ||
52 | /* STD */ | ||
42 | #include <stdlib.h> | 53 | #include <stdlib.h> |
43 | #include <stdio.h> | 54 | #include <stdio.h> |
44 | #include <signal.h> | 55 | #include <signal.h> |
45 | #ifndef Q_OS_WIN32 | 56 | #ifndef Q_OS_WIN32 |
46 | #include <unistd.h> | 57 | #include <unistd.h> |
47 | #else | 58 | #else |
48 | #include <process.h> | 59 | #include <process.h> |
49 | #endif | 60 | #endif |
50 | 61 | ||
51 | #include "calibrate.h" | ||
52 | |||
53 | |||
54 | #ifdef QT_QWS_LOGIN | ||
55 | #include "../login/qdmdialogimpl.h" | ||
56 | #endif | ||
57 | |||
58 | #ifdef Q_WS_QWS | ||
59 | #include <qkeyboard_qws.h> | ||
60 | #endif | ||
61 | |||
62 | #include <qmessagebox.h> | ||
63 | #include <opie2/odevice.h> | ||
64 | |||
65 | using namespace Opie::Core; | ||
66 | |||
67 | |||
68 | static void cleanup() | 62 | static void cleanup() |
69 | { | 63 | { |
70 | QDir dir( "/tmp", "qcop-msg-*" ); | 64 | QDir dir( "/tmp", "qcop-msg-*" ); |
71 | 65 | ||
72 | QStringList stale = dir.entryList(); | 66 | QStringList stale = dir.entryList(); |
73 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
74 | for ( it = stale.begin(); it != stale.end(); ++it ) { | 68 | for ( it = stale.begin(); it != stale.end(); ++it ) { |
75 | dir.remove( *it ); | 69 | dir.remove( *it ); |
@@ -116,17 +110,17 @@ static void refreshTimeZoneConfig() | |||
116 | } | 110 | } |
117 | // We have an existing list of timezones refresh the | 111 | // We have an existing list of timezones refresh the |
118 | // translations of TimeZone name | 112 | // translations of TimeZone name |
119 | zoneIndex = 0; | 113 | zoneIndex = 0; |
120 | while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ | 114 | while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ |
121 | zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); | 115 | zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); |
122 | curZone = TimeZone( zoneID ); | 116 | curZone = TimeZone( zoneID ); |
123 | if ( !curZone.isValid() ){ | 117 | if ( !curZone.isValid() ){ |
124 | qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); | 118 | odebug << "initEnvironment() Invalid TimeZone " << zoneID << "" << oendl; |
125 | break; | 119 | break; |
126 | } | 120 | } |
127 | cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); | 121 | cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); |
128 | zoneIndex++; | 122 | zoneIndex++; |
129 | } | 123 | } |
130 | #endif | 124 | #endif |
131 | } | 125 | } |
132 | 126 | ||
@@ -264,17 +258,17 @@ int initApplication( int argc, char ** argv ) | |||
264 | if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { | 258 | if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { |
265 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 259 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
266 | e << QString ( ); | 260 | e << QString ( ); |
267 | } | 261 | } |
268 | } | 262 | } |
269 | 263 | ||
270 | int rv = a.exec(); | 264 | int rv = a.exec(); |
271 | 265 | ||
272 | qDebug("exiting..."); | 266 | odebug << "exiting..." << oendl; |
273 | delete s; | 267 | delete s; |
274 | 268 | ||
275 | #ifndef Q_OS_MACX | 269 | #ifndef Q_OS_MACX |
276 | ODevice::inst()->setSoftSuspend( false ); | 270 | ODevice::inst()->setSoftSuspend( false ); |
277 | #endif | 271 | #endif |
278 | 272 | ||
279 | return rv; | 273 | return rv; |
280 | } | 274 | } |
@@ -336,17 +330,17 @@ int main( int argc, char ** argv ) | |||
336 | } | 330 | } |
337 | #else | 331 | #else |
338 | 332 | ||
339 | int main( int argc, char ** argv ) | 333 | int main( int argc, char ** argv ) |
340 | { | 334 | { |
341 | int retVal = initApplication( argc, argv ); | 335 | int retVal = initApplication( argc, argv ); |
342 | 336 | ||
343 | if ( DesktopApplication::doRestart ) { | 337 | if ( DesktopApplication::doRestart ) { |
344 | qDebug("Trying to restart"); | 338 | odebug << "Trying to restart" << oendl; |
345 | execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); | 339 | execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); |
346 | } | 340 | } |
347 | 341 | ||
348 | return retVal; | 342 | return retVal; |
349 | } | 343 | } |
350 | 344 | ||
351 | #endif | 345 | #endif |
352 | 346 | ||
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp index 7e61b0e..a11ac86 100644 --- a/core/launcher/packageslave.cpp +++ b/core/launcher/packageslave.cpp | |||
@@ -14,38 +14,38 @@ | |||
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 "packageslave.h" | 21 | #include "packageslave.h" |
22 | #include <qtopia/qprocess.h> | ||
23 | 22 | ||
23 | /* OPIE */ | ||
24 | #include <opie2/odebug.h> | ||
25 | #include <qtopia/qprocess.h> | ||
24 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
25 | #include <qtopia/qcopenvelope_qws.h> | 27 | #include <qtopia/qcopenvelope_qws.h> |
26 | #endif | 28 | #endif |
29 | using namespace Opie::Core; | ||
27 | 30 | ||
31 | /* QT */ | ||
28 | #ifdef Q_WS_QWS | 32 | #ifdef Q_WS_QWS |
29 | #include <qcopchannel_qws.h> | 33 | #include <qcopchannel_qws.h> |
30 | #endif | 34 | #endif |
31 | |||
32 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
33 | 36 | ||
37 | /* STD */ | ||
34 | #include <stdlib.h> | 38 | #include <stdlib.h> |
35 | #include <sys/stat.h> // mkdir() | 39 | #include <sys/stat.h> // mkdir() |
36 | |||
37 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 40 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
38 | #include <unistd.h> | 41 | #include <unistd.h> |
39 | #include <sys/vfs.h> | 42 | #include <sys/vfs.h> |
40 | #include <mntent.h> | 43 | #include <mntent.h> |
41 | #elif defined(Q_OS_WIN32) | ||
42 | #include <windows.h> | ||
43 | #include <winbase.h> | ||
44 | #elif defined(Q_OS_MACX) | 44 | #elif defined(Q_OS_MACX) |
45 | #include <unistd.h> | 45 | #include <unistd.h> |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | 48 | ||
49 | PackageHandler::PackageHandler( QObject *parent, char* name ) | 49 | PackageHandler::PackageHandler( QObject *parent, char* name ) |
50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) | 50 | : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE ) |
51 | { | 51 | { |
@@ -140,45 +140,45 @@ void PackageHandler::addPackageFiles( const QString &location, | |||
140 | QFile f(listfile); | 140 | QFile f(listfile); |
141 | #ifndef Q_OS_WIN32 | 141 | #ifndef Q_OS_WIN32 |
142 | //make a copy so we can remove the symlinks later | 142 | //make a copy so we can remove the symlinks later |
143 | mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); | 143 | mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 ); |
144 | system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); | 144 | system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); |
145 | #else | 145 | #else |
146 | QDir d; | 146 | QDir d; |
147 | //#### revise | 147 | //#### revise |
148 | qDebug("Copy file at %s: %s", __FILE__, __LINE__ ); | 148 | odebug << "Copy file at " << __FILE__ << ": " << __LINE__ << "" << oendl; |
149 | d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); | 149 | d.mkdir(("/usr/lib/ipkg/info/" + location).ascii()); |
150 | system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); | 150 | system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii()); |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | 153 | ||
154 | if ( f.open(IO_ReadOnly) ) { | 154 | if ( f.open(IO_ReadOnly) ) { |
155 | QTextStream ts(&f); | 155 | QTextStream ts(&f); |
156 | 156 | ||
157 | QString s; | 157 | QString s; |
158 | while ( !ts.eof() ) { // until end of file... | 158 | while ( !ts.eof() ) { // until end of file... |
159 | s = ts.readLine(); // line of text excluding '\n' | 159 | s = ts.readLine(); // line of text excluding '\n' |
160 | // for s, do link/mkdir. | 160 | // for s, do link/mkdir. |
161 | if ( s.right(1) == "/" ) { | 161 | if ( s.right(1) == "/" ) { |
162 | qDebug("do mkdir for %s", s.ascii()); | 162 | odebug << "do mkdir for " << s.ascii() << "" << oendl; |
163 | #ifndef Q_OS_WIN32 | 163 | #ifndef Q_OS_WIN32 |
164 | mkdir( s.ascii(), 0777 ); | 164 | mkdir( s.ascii(), 0777 ); |
165 | //possible optimization: symlink directories | 165 | //possible optimization: symlink directories |
166 | //that don't exist already. -- Risky. | 166 | //that don't exist already. -- Risky. |
167 | #else | 167 | #else |
168 | d.mkdir( s.ascii()); | 168 | d.mkdir( s.ascii()); |
169 | #endif | 169 | #endif |
170 | 170 | ||
171 | } else { | 171 | } else { |
172 | #ifndef Q_OS_WIN32 | 172 | #ifndef Q_OS_WIN32 |
173 | qDebug("do symlink for %s", s.ascii()); | 173 | odebug << "do symlink for " << s.ascii() << "" << oendl; |
174 | symlink( (location + s).ascii(), s.ascii() ); | 174 | symlink( (location + s).ascii(), s.ascii() ); |
175 | #else | 175 | #else |
176 | qDebug("Copy file instead of a symlink for WIN32"); | 176 | odebug << "Copy file instead of a symlink for WIN32" << oendl; |
177 | if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) | 177 | if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE)) |
178 | qWarning("Unable to create symlinkfor %s", | 178 | qWarning("Unable to create symlinkfor %s", |
179 | (location + s).ascii()); | 179 | (location + s).ascii()); |
180 | #endif | 180 | #endif |
181 | } | 181 | } |
182 | } | 182 | } |
183 | f.close(); | 183 | f.close(); |
184 | } | 184 | } |
@@ -210,24 +210,24 @@ void PackageHandler::cleanupPackageFiles( const QString &listfile ) | |||
210 | QString s; | 210 | QString s; |
211 | while ( !ts.eof() ) { // until end of file... | 211 | while ( !ts.eof() ) { // until end of file... |
212 | s = ts.readLine(); // line of text excluding '\n' | 212 | s = ts.readLine(); // line of text excluding '\n' |
213 | // for s, do link/mkdir. | 213 | // for s, do link/mkdir. |
214 | if ( s.right(1) == "/" ) { | 214 | if ( s.right(1) == "/" ) { |
215 | //should rmdir if empty, after all files have been removed | 215 | //should rmdir if empty, after all files have been removed |
216 | } else { | 216 | } else { |
217 | #ifndef Q_OS_WIN32 | 217 | #ifndef Q_OS_WIN32 |
218 | qDebug("remove symlink for %s", s.ascii()); | 218 | odebug << "remove symlink for " << s.ascii() << "" << oendl; |
219 | //check if it is a symlink first (don't remove /etc/passwd...) | 219 | //check if it is a symlink first (don't remove /etc/passwd...) |
220 | char buf[10]; //we don't care about the contents | 220 | char buf[10]; //we don't care about the contents |
221 | if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) | 221 | if ( ::readlink( s.ascii(),buf, 10 >= 0 ) ) |
222 | ::unlink( s.ascii() ); | 222 | ::unlink( s.ascii() ); |
223 | #else | 223 | #else |
224 | // ### revise | 224 | // ### revise |
225 | qWarning("Unable to remove symlink %s:%s", __FILE__, __LINE__); | 225 | owarn << "Unable to remove symlink " << __FILE__ << ":" << __LINE__ << "" << oendl; |
226 | #endif | 226 | #endif |
227 | } | 227 | } |
228 | } | 228 | } |
229 | f.close(); | 229 | f.close(); |
230 | 230 | ||
231 | //remove the list file | 231 | //remove the list file |
232 | ::unlink( listfile.ascii() ); | 232 | ::unlink( listfile.ascii() ); |
233 | 233 | ||
@@ -261,17 +261,17 @@ void PackageHandler::prepareInstall( const QString& size, const QString& path ) | |||
261 | if ( !ok ) | 261 | if ( !ok ) |
262 | return; | 262 | return; |
263 | 263 | ||
264 | // Shamelessly stolen from the sysinfo application (Werner) | 264 | // Shamelessly stolen from the sysinfo application (Werner) |
265 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 265 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
266 | struct statfs fs; | 266 | struct statfs fs; |
267 | if ( statfs( path.latin1(), &fs ) == 0 ) | 267 | if ( statfs( path.latin1(), &fs ) == 0 ) |
268 | if ( s > fs.f_bsize * fs.f_bavail ) { | 268 | if ( s > fs.f_bsize * fs.f_bavail ) { |
269 | //qDebug("############### Not enough space left ###############"); | 269 | //odebug << "############### Not enough space left ###############" << oendl; |
270 | mNoSpaceLeft = TRUE; | 270 | mNoSpaceLeft = TRUE; |
271 | } | 271 | } |
272 | #endif | 272 | #endif |
273 | } | 273 | } |
274 | 274 | ||
275 | void PackageHandler::iProcessExited() | 275 | void PackageHandler::iProcessExited() |
276 | { | 276 | { |
277 | if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) | 277 | if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 ) |
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp index 33df6c4..e339dc7 100644 --- a/core/launcher/qcopbridge.cpp +++ b/core/launcher/qcopbridge.cpp | |||
@@ -16,58 +16,57 @@ | |||
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 "qcopbridge.h" | 21 | #include "qcopbridge.h" |
22 | #include "transferserver.h" | 22 | #include "transferserver.h" |
23 | 23 | ||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
24 | #include <opie2/oglobal.h> | 26 | #include <opie2/oglobal.h> |
25 | |||
26 | #ifdef Q_WS_QWS | 27 | #ifdef Q_WS_QWS |
27 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
28 | #endif | 29 | #endif |
29 | #include <qtopia/qpeapplication.h> | 30 | #include <qtopia/qpeapplication.h> |
30 | |||
31 | #include <qtopia/version.h> | 31 | #include <qtopia/version.h> |
32 | using namespace Opie::Core; | ||
32 | 33 | ||
34 | /* QT */ | ||
33 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
34 | #include <qtimer.h> | 36 | #include <qtimer.h> |
35 | #ifdef Q_WS_QWS | 37 | #ifdef Q_WS_QWS |
36 | #include <qcopchannel_qws.h> | 38 | #include <qcopchannel_qws.h> |
37 | #endif | 39 | #endif |
38 | 40 | ||
41 | /* STD */ | ||
39 | #ifndef _XOPEN_SOURCE | 42 | #ifndef _XOPEN_SOURCE |
40 | #define _XOPEN_SOURCE | 43 | #define _XOPEN_SOURCE |
41 | #endif | 44 | #endif |
42 | #ifndef Q_OS_WIN32 | 45 | #ifndef Q_OS_WIN32 |
43 | #include <pwd.h> | 46 | #include <pwd.h> |
44 | #include <unistd.h> | 47 | #include <unistd.h> |
45 | #include <sys/types.h> | 48 | #include <sys/types.h> |
46 | #endif | 49 | #endif |
47 | 50 | ||
48 | #if defined(_OS_LINUX_) | 51 | #if defined(_OS_LINUX_) |
49 | #include <shadow.h> | 52 | #include <shadow.h> |
50 | #endif | 53 | #endif |
51 | 54 | ||
52 | |||
53 | //#define INSECURE | ||
54 | |||
55 | const int block_size = 51200; | 55 | const int block_size = 51200; |
56 | 56 | ||
57 | using namespace Opie::Core; | ||
58 | QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, | 57 | QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent, |
59 | const char* name ) | 58 | const char* name ) |
60 | : QServerSocket( port, 1, parent, name ), | 59 | : QServerSocket( port, 1, parent, name ), |
61 | desktopChannel( 0 ), | 60 | desktopChannel( 0 ), |
62 | cardChannel( 0 ) | 61 | cardChannel( 0 ) |
63 | { | 62 | { |
64 | if ( !ok() ) | 63 | if ( !ok() ) |
65 | qWarning( "Failed to bind to port %d", port ); | 64 | owarn << "Failed to bind to port " << port << "" << oendl; |
66 | else { | 65 | else { |
67 | #ifndef QT_NO_COP | 66 | #ifndef QT_NO_COP |
68 | desktopChannel = new QCopChannel( "QPE/Desktop", this ); | 67 | desktopChannel = new QCopChannel( "QPE/Desktop", this ); |
69 | connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 68 | connect( desktopChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
70 | this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); | 69 | this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); |
71 | cardChannel = new QCopChannel( "QPE/Card", this ); | 70 | cardChannel = new QCopChannel( "QPE/Card", this ); |
72 | connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)), | 71 | connect( cardChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
73 | this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); | 72 | this, SLOT(desktopMessage(const QCString&,const QByteArray&)) ); |
@@ -166,23 +165,23 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &data | |||
166 | /* | 165 | /* |
167 | * Old compat mode | 166 | * Old compat mode |
168 | */ | 167 | */ |
169 | void QCopBridge::sendDesktopMessageOld( const QCString& command, const QByteArray& args) { | 168 | void QCopBridge::sendDesktopMessageOld( const QCString& command, const QByteArray& args) { |
170 | command.stripWhiteSpace(); | 169 | command.stripWhiteSpace(); |
171 | 170 | ||
172 | int paren = command.find( "(" ); | 171 | int paren = command.find( "(" ); |
173 | if ( paren <= 0 ) { | 172 | if ( paren <= 0 ) { |
174 | qDebug("DesktopMessage: bad qcop syntax"); | 173 | odebug << "DesktopMessage: bad qcop syntax" << oendl; |
175 | return; | 174 | return; |
176 | } | 175 | } |
177 | 176 | ||
178 | QString params = command.mid( paren + 1 ); | 177 | QString params = command.mid( paren + 1 ); |
179 | if ( params[params.length()-1] != ')' ) { | 178 | if ( params[params.length()-1] != ')' ) { |
180 | qDebug("DesktopMessage: bad qcop syntax"); | 179 | odebug << "DesktopMessage: bad qcop syntax" << oendl; |
181 | return; | 180 | return; |
182 | } | 181 | } |
183 | 182 | ||
184 | params.truncate( params.length()-1 ); | 183 | params.truncate( params.length()-1 ); |
185 | 184 | ||
186 | QStringList paramList = QStringList::split( ",", params ); | 185 | QStringList paramList = QStringList::split( ",", params ); |
187 | QString data; | 186 | QString data; |
188 | if ( paramList.count() ) { | 187 | if ( paramList.count() ) { |
@@ -199,17 +198,17 @@ void QCopBridge::sendDesktopMessageOld( const QCString& command, const QByteArra | |||
199 | int i; | 198 | int i; |
200 | stream >> i; | 199 | stream >> i; |
201 | str = QString::number( i ); | 200 | str = QString::number( i ); |
202 | } else if ( *it == "bool" ) { | 201 | } else if ( *it == "bool" ) { |
203 | int i; | 202 | int i; |
204 | stream >> i; | 203 | stream >> i; |
205 | str = QString::number( i ); | 204 | str = QString::number( i ); |
206 | } else { | 205 | } else { |
207 | qDebug(" cannot route the argument type %s throught the qcop bridge", (*it).latin1() ); | 206 | odebug << " cannot route the argument type " << (*it) << " throught the qcop bridge" << oendl; |
208 | return; | 207 | return; |
209 | } | 208 | } |
210 | QString estr; | 209 | QString estr; |
211 | for (int i=0; i<(int)str.length(); i++) { | 210 | for (int i=0; i<(int)str.length(); i++) { |
212 | QChar ch = str[i]; | 211 | QChar ch = str[i]; |
213 | if ( ch.row() ) | 212 | if ( ch.row() ) |
214 | goto quick; | 213 | goto quick; |
215 | switch (ch.cell()) { | 214 | switch (ch.cell()) { |
@@ -327,30 +326,30 @@ void QCopBridgePI::sendDesktopMessage( const QCString &msg, const QByteArray& da | |||
327 | 326 | ||
328 | 327 | ||
329 | void QCopBridgePI::send( const QString& msg ) | 328 | void QCopBridgePI::send( const QString& msg ) |
330 | { | 329 | { |
331 | if ( !isOpen() ) // eg. Forbidden | 330 | if ( !isOpen() ) // eg. Forbidden |
332 | return; | 331 | return; |
333 | QTextStream os( this ); | 332 | QTextStream os( this ); |
334 | os << msg << endl; | 333 | os << msg << endl; |
335 | //qDebug( "sending qcop message: %s", msg.latin1() ); | 334 | //odebug << "sending qcop message: " << msg << "" << oendl; |
336 | } | 335 | } |
337 | 336 | ||
338 | void QCopBridgePI::read() | 337 | void QCopBridgePI::read() |
339 | { | 338 | { |
340 | while ( canReadLine() ) { | 339 | while ( canReadLine() ) { |
341 | timer->start( 300000, TRUE ); | 340 | timer->start( 300000, TRUE ); |
342 | process( readLine().stripWhiteSpace() ); | 341 | process( readLine().stripWhiteSpace() ); |
343 | } | 342 | } |
344 | } | 343 | } |
345 | 344 | ||
346 | void QCopBridgePI::process( const QString& message ) | 345 | void QCopBridgePI::process( const QString& message ) |
347 | { | 346 | { |
348 | //qDebug( "Command: %s", message.latin1() ); | 347 | //odebug << "Command: " << message << "" << oendl; |
349 | 348 | ||
350 | // split message using "," as separator | 349 | // split message using "," as separator |
351 | QStringList msg = QStringList::split( " ", message ); | 350 | QStringList msg = QStringList::split( " ", message ); |
352 | if ( msg.isEmpty() ) return; | 351 | if ( msg.isEmpty() ) return; |
353 | 352 | ||
354 | // command token | 353 | // command token |
355 | QString cmd = msg[0].upper(); | 354 | QString cmd = msg[0].upper(); |
356 | 355 | ||
diff --git a/core/launcher/qprocess.cpp b/core/launcher/qprocess.cpp index 97bd539..3fe1238 100644 --- a/core/launcher/qprocess.cpp +++ b/core/launcher/qprocess.cpp | |||
@@ -576,64 +576,64 @@ void QProcess::writeToStdin( const QString& buf ) | |||
576 | * They are needed, if you are interested in the signals. So use | 576 | * They are needed, if you are interested in the signals. So use |
577 | * connectNotify() and disconnectNotify() to keep track of your interest. | 577 | * connectNotify() and disconnectNotify() to keep track of your interest. |
578 | */ | 578 | */ |
579 | /*! \reimp | 579 | /*! \reimp |
580 | */ | 580 | */ |
581 | void QProcess::connectNotify( const char * signal ) | 581 | void QProcess::connectNotify( const char * signal ) |
582 | { | 582 | { |
583 | #if defined(QT_QPROCESS_DEBUG) | 583 | #if defined(QT_QPROCESS_DEBUG) |
584 | qDebug( "QProcess::connectNotify(): signal %s has been connected", signal ); | 584 | odebug << "QProcess::connectNotify(): signal " << signal << " has been connected" << oendl; |
585 | #endif | 585 | #endif |
586 | if ( !ioRedirection ) | 586 | if ( !ioRedirection ) |
587 | if ( qstrcmp( signal, SIGNAL(readyReadStdout()) )==0 || | 587 | if ( qstrcmp( signal, SIGNAL(readyReadStdout()) )==0 || |
588 | qstrcmp( signal, SIGNAL(readyReadStderr()) )==0 | 588 | qstrcmp( signal, SIGNAL(readyReadStderr()) )==0 |
589 | ) { | 589 | ) { |
590 | #if defined(QT_QPROCESS_DEBUG) | 590 | #if defined(QT_QPROCESS_DEBUG) |
591 | qDebug( "QProcess::connectNotify(): set ioRedirection to TRUE" ); | 591 | odebug << "QProcess::connectNotify(): set ioRedirection to TRUE" << oendl; |
592 | #endif | 592 | #endif |
593 | setIoRedirection( TRUE ); | 593 | setIoRedirection( TRUE ); |
594 | return; | 594 | return; |
595 | } | 595 | } |
596 | if ( !notifyOnExit && qstrcmp( signal, SIGNAL(processExited()) )==0 ) { | 596 | if ( !notifyOnExit && qstrcmp( signal, SIGNAL(processExited()) )==0 ) { |
597 | #if defined(QT_QPROCESS_DEBUG) | 597 | #if defined(QT_QPROCESS_DEBUG) |
598 | qDebug( "QProcess::connectNotify(): set notifyOnExit to TRUE" ); | 598 | odebug << "QProcess::connectNotify(): set notifyOnExit to TRUE" << oendl; |
599 | #endif | 599 | #endif |
600 | setNotifyOnExit( TRUE ); | 600 | setNotifyOnExit( TRUE ); |
601 | return; | 601 | return; |
602 | } | 602 | } |
603 | if ( !wroteToStdinConnected && qstrcmp( signal, SIGNAL(wroteToStdin()) )==0 ) { | 603 | if ( !wroteToStdinConnected && qstrcmp( signal, SIGNAL(wroteToStdin()) )==0 ) { |
604 | #if defined(QT_QPROCESS_DEBUG) | 604 | #if defined(QT_QPROCESS_DEBUG) |
605 | qDebug( "QProcess::connectNotify(): set wroteToStdinConnected to TRUE" ); | 605 | odebug << "QProcess::connectNotify(): set wroteToStdinConnected to TRUE" << oendl; |
606 | #endif | 606 | #endif |
607 | setWroteStdinConnected( TRUE ); | 607 | setWroteStdinConnected( TRUE ); |
608 | return; | 608 | return; |
609 | } | 609 | } |
610 | } | 610 | } |
611 | 611 | ||
612 | /*! \reimp | 612 | /*! \reimp |
613 | */ | 613 | */ |
614 | void QProcess::disconnectNotify( const char * ) | 614 | void QProcess::disconnectNotify( const char * ) |
615 | { | 615 | { |
616 | if ( ioRedirection && | 616 | if ( ioRedirection && |
617 | receivers( SIGNAL(readyReadStdout()) ) ==0 && | 617 | receivers( SIGNAL(readyReadStdout()) ) ==0 && |
618 | receivers( SIGNAL(readyReadStderr()) ) ==0 | 618 | receivers( SIGNAL(readyReadStderr()) ) ==0 |
619 | ) { | 619 | ) { |
620 | #if defined(QT_QPROCESS_DEBUG) | 620 | #if defined(QT_QPROCESS_DEBUG) |
621 | qDebug( "QProcess::disconnectNotify(): set ioRedirection to FALSE" ); | 621 | odebug << "QProcess::disconnectNotify(): set ioRedirection to FALSE" << oendl; |
622 | #endif | 622 | #endif |
623 | setIoRedirection( FALSE ); | 623 | setIoRedirection( FALSE ); |
624 | } | 624 | } |
625 | if ( notifyOnExit && receivers( SIGNAL(processExited()) ) == 0 ) { | 625 | if ( notifyOnExit && receivers( SIGNAL(processExited()) ) == 0 ) { |
626 | #if defined(QT_QPROCESS_DEBUG) | 626 | #if defined(QT_QPROCESS_DEBUG) |
627 | qDebug( "QProcess::disconnectNotify(): set notifyOnExit to FALSE" ); | 627 | odebug << "QProcess::disconnectNotify(): set notifyOnExit to FALSE" << oendl; |
628 | #endif | 628 | #endif |
629 | setNotifyOnExit( FALSE ); | 629 | setNotifyOnExit( FALSE ); |
630 | } | 630 | } |
631 | if ( wroteToStdinConnected && receivers( SIGNAL(wroteToStdin()) ) == 0 ) { | 631 | if ( wroteToStdinConnected && receivers( SIGNAL(wroteToStdin()) ) == 0 ) { |
632 | #if defined(QT_QPROCESS_DEBUG) | 632 | #if defined(QT_QPROCESS_DEBUG) |
633 | qDebug( "QProcess::disconnectNotify(): set wroteToStdinConnected to FALSE" ); | 633 | odebug << "QProcess::disconnectNotify(): set wroteToStdinConnected to FALSE" << oendl; |
634 | #endif | 634 | #endif |
635 | setWroteStdinConnected( FALSE ); | 635 | setWroteStdinConnected( FALSE ); |
636 | } | 636 | } |
637 | } | 637 | } |
638 | 638 | ||
639 | #endif // QT_NO_PROCESS | 639 | #endif // QT_NO_PROCESS |
diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp index 19a8c93..d62e4e6 100644 --- a/core/launcher/qprocess_unix.cpp +++ b/core/launcher/qprocess_unix.cpp | |||
@@ -13,52 +13,51 @@ | |||
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 "qplatformdefs.h" | ||
22 | |||
23 | // Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED. | 21 | // Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED. |
24 | #if defined(connect) | 22 | #if defined(connect) |
25 | #undef connect | 23 | #undef connect |
26 | #endif | 24 | #endif |
27 | 25 | ||
28 | #include "qprocess.h" | 26 | #include "qprocess.h" |
29 | 27 | ||
30 | #ifndef QT_NO_PROCESS | 28 | /* OPIE */ |
29 | #include <opie2/odebug.h> | ||
30 | using namespace Opie::Core; | ||
31 | 31 | ||
32 | #include "qapplication.h" | 32 | /* QT */ |
33 | #include "qqueue.h" | 33 | #ifndef QT_NO_PROCESS |
34 | #include "qlist.h" | 34 | #include <qapplication.h> |
35 | #include "qsocketnotifier.h" | 35 | #include <qqueue.h> |
36 | #include "qtimer.h" | 36 | #include <qlist.h> |
37 | #include "qregexp.h" | 37 | #include <qsocketnotifier.h> |
38 | #include <qtimer.h> | ||
39 | #include <qregexp.h> | ||
38 | 40 | ||
39 | #include "qcleanuphandler_p.h" | 41 | #include "qcleanuphandler_p.h" |
40 | 42 | ||
43 | /* STD */ | ||
41 | #include <stdlib.h> | 44 | #include <stdlib.h> |
42 | |||
43 | // ### FOR Qt 2.3 compat | ||
44 | #include <unistd.h> | 45 | #include <unistd.h> |
45 | #include <signal.h> | 46 | #include <signal.h> |
46 | #include <sys/socket.h> | 47 | #include <sys/socket.h> |
47 | #include <sys/ioctl.h> | 48 | #include <sys/ioctl.h> |
48 | #include <sys/wait.h> | 49 | #include <sys/wait.h> |
49 | #include <sys/fcntl.h> | 50 | #include <sys/fcntl.h> |
50 | 51 | #include <sys/resource.h> | |
51 | #include <errno.h> | 52 | #include <errno.h> |
52 | |||
53 | #ifdef Q_OS_MACX | 53 | #ifdef Q_OS_MACX |
54 | #include <sys/time.h> | 54 | #include <sys/time.h> |
55 | #endif | 55 | #endif |
56 | #include <sys/resource.h> | ||
57 | 56 | ||
58 | #ifdef __MIPSEL__ | 57 | #ifdef __MIPSEL__ |
59 | # ifndef SOCK_DGRAM | 58 | # ifndef SOCK_DGRAM |
60 | # define SOCK_DGRAM 1 | 59 | # define SOCK_DGRAM 1 |
61 | # endif | 60 | # endif |
62 | # ifndef SOCK_STREAM | 61 | # ifndef SOCK_STREAM |
63 | # define SOCK_STREAM 2 | 62 | # define SOCK_STREAM 2 |
64 | # endif | 63 | # endif |
@@ -127,26 +126,26 @@ public: | |||
127 | directly to a running child process. | 126 | directly to a running child process. |
128 | */ | 127 | */ |
129 | class QProc | 128 | class QProc |
130 | { | 129 | { |
131 | public: | 130 | public: |
132 | QProc( pid_t p, QProcess *proc=0 ) : pid(p), process(proc) | 131 | QProc( pid_t p, QProcess *proc=0 ) : pid(p), process(proc) |
133 | { | 132 | { |
134 | #if defined(QT_QPROCESS_DEBUG) | 133 | #if defined(QT_QPROCESS_DEBUG) |
135 | qDebug( "QProc: Constructor for pid %d and QProcess %p", pid, process ); | 134 | odebug << "QProc: Constructor for pid " << pid << " and QProcess " << process << "" << oendl; |
136 | #endif | 135 | #endif |
137 | socketStdin = 0; | 136 | socketStdin = 0; |
138 | socketStdout = 0; | 137 | socketStdout = 0; |
139 | socketStderr = 0; | 138 | socketStderr = 0; |
140 | } | 139 | } |
141 | ~QProc() | 140 | ~QProc() |
142 | { | 141 | { |
143 | #if defined(QT_QPROCESS_DEBUG) | 142 | #if defined(QT_QPROCESS_DEBUG) |
144 | qDebug( "QProc: Destructor for pid %d and QProcess %p", pid, process ); | 143 | odebug << "QProc: Destructor for pid " << pid << " and QProcess " << process << "" << oendl; |
145 | #endif | 144 | #endif |
146 | if ( process != 0 ) { | 145 | if ( process != 0 ) { |
147 | if ( process->d->notifierStdin ) | 146 | if ( process->d->notifierStdin ) |
148 | process->d->notifierStdin->setEnabled( FALSE ); | 147 | process->d->notifierStdin->setEnabled( FALSE ); |
149 | if ( process->d->notifierStdout ) | 148 | if ( process->d->notifierStdout ) |
150 | process->d->notifierStdout->setEnabled( FALSE ); | 149 | process->d->notifierStdout->setEnabled( FALSE ); |
151 | if ( process->d->notifierStderr ) | 150 | if ( process->d->notifierStderr ) |
152 | process->d->notifierStderr->setEnabled( FALSE ); | 151 | process->d->notifierStderr->setEnabled( FALSE ); |
@@ -208,94 +207,94 @@ QProcessManager::QProcessManager() | |||
208 | // The SIGCHLD handler writes to a socket to tell the manager that | 207 | // The SIGCHLD handler writes to a socket to tell the manager that |
209 | // something happened. This is done to get the processing in sync with the | 208 | // something happened. This is done to get the processing in sync with the |
210 | // event reporting. | 209 | // event reporting. |
211 | if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, sigchldFd ) ) { | 210 | if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, sigchldFd ) ) { |
212 | sigchldFd[0] = 0; | 211 | sigchldFd[0] = 0; |
213 | sigchldFd[1] = 0; | 212 | sigchldFd[1] = 0; |
214 | } else { | 213 | } else { |
215 | #if defined(QT_QPROCESS_DEBUG) | 214 | #if defined(QT_QPROCESS_DEBUG) |
216 | qDebug( "QProcessManager: install socket notifier (%d)", sigchldFd[1] ); | 215 | odebug << "QProcessManager: install socket notifier (" << sigchldFd[1] << ")" << oendl; |
217 | #endif | 216 | #endif |
218 | QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1], | 217 | QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1], |
219 | QSocketNotifier::Read, this ); | 218 | QSocketNotifier::Read, this ); |
220 | connect( sn, SIGNAL(activated(int)), | 219 | connect( sn, SIGNAL(activated(int)), |
221 | this, SLOT(sigchldHnd(int)) ); | 220 | this, SLOT(sigchldHnd(int)) ); |
222 | sn->setEnabled( TRUE ); | 221 | sn->setEnabled( TRUE ); |
223 | } | 222 | } |
224 | 223 | ||
225 | // install a SIGCHLD handler and ignore SIGPIPE | 224 | // install a SIGCHLD handler and ignore SIGPIPE |
226 | struct sigaction act; | 225 | struct sigaction act; |
227 | 226 | ||
228 | #if defined(QT_QPROCESS_DEBUG) | 227 | #if defined(QT_QPROCESS_DEBUG) |
229 | qDebug( "QProcessManager: install a SIGCHLD handler" ); | 228 | odebug << "QProcessManager: install a SIGCHLD handler" << oendl; |
230 | #endif | 229 | #endif |
231 | act.sa_handler = qt_C_sigchldHnd; | 230 | act.sa_handler = qt_C_sigchldHnd; |
232 | sigemptyset( &(act.sa_mask) ); | 231 | sigemptyset( &(act.sa_mask) ); |
233 | sigaddset( &(act.sa_mask), SIGCHLD ); | 232 | sigaddset( &(act.sa_mask), SIGCHLD ); |
234 | act.sa_flags = SA_NOCLDSTOP; | 233 | act.sa_flags = SA_NOCLDSTOP; |
235 | #if defined(SA_RESTART) | 234 | #if defined(SA_RESTART) |
236 | act.sa_flags |= SA_RESTART; | 235 | act.sa_flags |= SA_RESTART; |
237 | #endif | 236 | #endif |
238 | if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 ) | 237 | if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 ) |
239 | qWarning( "Error installing SIGCHLD handler" ); | 238 | owarn << "Error installing SIGCHLD handler" << oendl; |
240 | 239 | ||
241 | #if defined(QT_QPROCESS_DEBUG) | 240 | #if defined(QT_QPROCESS_DEBUG) |
242 | qDebug( "QProcessManager: install a SIGPIPE handler (SIG_IGN)" ); | 241 | odebug << "QProcessManager: install a SIGPIPE handler (SIG_IGN)" << oendl; |
243 | #endif | 242 | #endif |
244 | /* | 243 | /* |
245 | Using qt_C_sigpipeHnd rather than SIG_IGN is a workaround | 244 | Using qt_C_sigpipeHnd rather than SIG_IGN is a workaround |
246 | for a strange problem where GNU tar (called by backuprestore) | 245 | for a strange problem where GNU tar (called by backuprestore) |
247 | would hang on filesystem-full. Strangely, the qt_C_sigpipeHnd | 246 | would hang on filesystem-full. Strangely, the qt_C_sigpipeHnd |
248 | is never even called, yet this avoids the hang. | 247 | is never even called, yet this avoids the hang. |
249 | */ | 248 | */ |
250 | act.sa_handler = qt_C_sigpipeHnd; | 249 | act.sa_handler = qt_C_sigpipeHnd; |
251 | sigemptyset( &(act.sa_mask) ); | 250 | sigemptyset( &(act.sa_mask) ); |
252 | sigaddset( &(act.sa_mask), SIGPIPE ); | 251 | sigaddset( &(act.sa_mask), SIGPIPE ); |
253 | act.sa_flags = 0; | 252 | act.sa_flags = 0; |
254 | if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 ) | 253 | if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 ) |
255 | qWarning( "Error installing SIGPIPE handler" ); | 254 | owarn << "Error installing SIGPIPE handler" << oendl; |
256 | } | 255 | } |
257 | 256 | ||
258 | QProcessManager::~QProcessManager() | 257 | QProcessManager::~QProcessManager() |
259 | { | 258 | { |
260 | delete procList; | 259 | delete procList; |
261 | 260 | ||
262 | if ( sigchldFd[0] != 0 ) | 261 | if ( sigchldFd[0] != 0 ) |
263 | ::close( sigchldFd[0] ); | 262 | ::close( sigchldFd[0] ); |
264 | if ( sigchldFd[1] != 0 ) | 263 | if ( sigchldFd[1] != 0 ) |
265 | ::close( sigchldFd[1] ); | 264 | ::close( sigchldFd[1] ); |
266 | 265 | ||
267 | // restore SIGCHLD handler | 266 | // restore SIGCHLD handler |
268 | #if defined(QT_QPROCESS_DEBUG) | 267 | #if defined(QT_QPROCESS_DEBUG) |
269 | qDebug( "QProcessManager: restore old sigchild handler" ); | 268 | odebug << "QProcessManager: restore old sigchild handler" << oendl; |
270 | #endif | 269 | #endif |
271 | if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 ) | 270 | if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 ) |
272 | qWarning( "Error restoring SIGCHLD handler" ); | 271 | owarn << "Error restoring SIGCHLD handler" << oendl; |
273 | 272 | ||
274 | #if defined(QT_QPROCESS_DEBUG) | 273 | #if defined(QT_QPROCESS_DEBUG) |
275 | qDebug( "QProcessManager: restore old sigpipe handler" ); | 274 | odebug << "QProcessManager: restore old sigpipe handler" << oendl; |
276 | #endif | 275 | #endif |
277 | if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 ) | 276 | if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 ) |
278 | qWarning( "Error restoring SIGPIPE handler" ); | 277 | owarn << "Error restoring SIGPIPE handler" << oendl; |
279 | } | 278 | } |
280 | 279 | ||
281 | void QProcessManager::append( QProc *p ) | 280 | void QProcessManager::append( QProc *p ) |
282 | { | 281 | { |
283 | procList->append( p ); | 282 | procList->append( p ); |
284 | #if defined(QT_QPROCESS_DEBUG) | 283 | #if defined(QT_QPROCESS_DEBUG) |
285 | qDebug( "QProcessManager: append process (procList.count(): %d)", procList->count() ); | 284 | odebug << "QProcessManager: append process (procList.count(): " << procList->count() << ")" << oendl; |
286 | #endif | 285 | #endif |
287 | } | 286 | } |
288 | 287 | ||
289 | void QProcessManager::remove( QProc *p ) | 288 | void QProcessManager::remove( QProc *p ) |
290 | { | 289 | { |
291 | procList->remove( p ); | 290 | procList->remove( p ); |
292 | #if defined(QT_QPROCESS_DEBUG) | 291 | #if defined(QT_QPROCESS_DEBUG) |
293 | qDebug( "QProcessManager: remove process (procList.count(): %d)", procList->count() ); | 292 | odebug << "QProcessManager: remove process (procList.count(): " << procList->count() << ")" << oendl; |
294 | #endif | 293 | #endif |
295 | cleanup(); | 294 | cleanup(); |
296 | } | 295 | } |
297 | 296 | ||
298 | void QProcessManager::cleanup() | 297 | void QProcessManager::cleanup() |
299 | { | 298 | { |
300 | if ( procList->count() == 0 ) { | 299 | if ( procList->count() == 0 ) { |
301 | QTimer::singleShot( 0, this, SLOT(removeMe()) ); | 300 | QTimer::singleShot( 0, this, SLOT(removeMe()) ); |
@@ -311,57 +310,57 @@ void QProcessManager::removeMe() | |||
311 | } | 310 | } |
312 | } | 311 | } |
313 | 312 | ||
314 | void QProcessManager::sigchldHnd( int fd ) | 313 | void QProcessManager::sigchldHnd( int fd ) |
315 | { | 314 | { |
316 | char tmp; | 315 | char tmp; |
317 | ::read( fd, &tmp, sizeof(tmp) ); | 316 | ::read( fd, &tmp, sizeof(tmp) ); |
318 | #if defined(QT_QPROCESS_DEBUG) | 317 | #if defined(QT_QPROCESS_DEBUG) |
319 | qDebug( "QProcessManager::sigchldHnd()" ); | 318 | odebug << "QProcessManager::sigchldHnd()" << oendl; |
320 | #endif | 319 | #endif |
321 | QProc *proc; | 320 | QProc *proc; |
322 | QProcess *process; | 321 | QProcess *process; |
323 | bool removeProc; | 322 | bool removeProc; |
324 | proc = procList->first(); | 323 | proc = procList->first(); |
325 | while ( proc != 0 ) { | 324 | while ( proc != 0 ) { |
326 | removeProc = FALSE; | 325 | removeProc = FALSE; |
327 | process = proc->process; | 326 | process = proc->process; |
328 | QProcess *process_exit_notify=0; | 327 | QProcess *process_exit_notify=0; |
329 | if ( process != 0 ) { | 328 | if ( process != 0 ) { |
330 | if ( !process->isRunning() ) { | 329 | if ( !process->isRunning() ) { |
331 | #if defined(QT_QPROCESS_DEBUG) | 330 | #if defined(QT_QPROCESS_DEBUG) |
332 | qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess available)", proc->pid ); | 331 | odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess available)" << oendl; |
333 | #endif | 332 | #endif |
334 | // read pending data | 333 | // read pending data |
335 | int nbytes = 0; | 334 | int nbytes = 0; |
336 | if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { | 335 | if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { |
337 | #if defined(QT_QPROCESS_DEBUG) | 336 | #if defined(QT_QPROCESS_DEBUG) |
338 | qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stdout", proc->pid, nbytes ); | 337 | odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stdout" << oendl; |
339 | #endif | 338 | #endif |
340 | process->socketRead( proc->socketStdout ); | 339 | process->socketRead( proc->socketStdout ); |
341 | } | 340 | } |
342 | nbytes = 0; | 341 | nbytes = 0; |
343 | if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { | 342 | if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { |
344 | #if defined(QT_QPROCESS_DEBUG) | 343 | #if defined(QT_QPROCESS_DEBUG) |
345 | qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stderr", proc->pid, nbytes ); | 344 | odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): reading " << nbytes << " bytes of pending data on stderr" << oendl; |
346 | #endif | 345 | #endif |
347 | process->socketRead( proc->socketStderr ); | 346 | process->socketRead( proc->socketStderr ); |
348 | } | 347 | } |
349 | 348 | ||
350 | if ( process->notifyOnExit ) | 349 | if ( process->notifyOnExit ) |
351 | process_exit_notify = process; | 350 | process_exit_notify = process; |
352 | 351 | ||
353 | removeProc = TRUE; | 352 | removeProc = TRUE; |
354 | } | 353 | } |
355 | } else { | 354 | } else { |
356 | int status; | 355 | int status; |
357 | if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) { | 356 | if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) { |
358 | #if defined(QT_QPROCESS_DEBUG) | 357 | #if defined(QT_QPROCESS_DEBUG) |
359 | qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess not available)", proc->pid ); | 358 | odebug << "QProcessManager::sigchldHnd() (PID: " << proc->pid << "): process exited (QProcess not available)" << oendl; |
360 | #endif | 359 | #endif |
361 | removeProc = TRUE; | 360 | removeProc = TRUE; |
362 | } | 361 | } |
363 | } | 362 | } |
364 | if ( removeProc ) { | 363 | if ( removeProc ) { |
365 | QProc *oldproc = proc; | 364 | QProc *oldproc = proc; |
366 | proc = procList->next(); | 365 | proc = procList->next(); |
367 | remove( oldproc ); | 366 | remove( oldproc ); |
@@ -381,34 +380,34 @@ void QProcessManager::sigchldHnd( int fd ) | |||
381 | * QProcessPrivate | 380 | * QProcessPrivate |
382 | * | 381 | * |
383 | **********************************************************************/ | 382 | **********************************************************************/ |
384 | QProcessManager *QProcessPrivate::procManager = 0; | 383 | QProcessManager *QProcessPrivate::procManager = 0; |
385 | 384 | ||
386 | QProcessPrivate::QProcessPrivate() | 385 | QProcessPrivate::QProcessPrivate() |
387 | { | 386 | { |
388 | #if defined(QT_QPROCESS_DEBUG) | 387 | #if defined(QT_QPROCESS_DEBUG) |
389 | qDebug( "QProcessPrivate: Constructor" ); | 388 | odebug << "QProcessPrivate: Constructor" << oendl; |
390 | #endif | 389 | #endif |
391 | stdinBufRead = 0; | 390 | stdinBufRead = 0; |
392 | 391 | ||
393 | notifierStdin = 0; | 392 | notifierStdin = 0; |
394 | notifierStdout = 0; | 393 | notifierStdout = 0; |
395 | notifierStderr = 0; | 394 | notifierStderr = 0; |
396 | 395 | ||
397 | exitValuesCalculated = FALSE; | 396 | exitValuesCalculated = FALSE; |
398 | socketReadCalled = FALSE; | 397 | socketReadCalled = FALSE; |
399 | 398 | ||
400 | proc = 0; | 399 | proc = 0; |
401 | } | 400 | } |
402 | 401 | ||
403 | QProcessPrivate::~QProcessPrivate() | 402 | QProcessPrivate::~QProcessPrivate() |
404 | { | 403 | { |
405 | #if defined(QT_QPROCESS_DEBUG) | 404 | #if defined(QT_QPROCESS_DEBUG) |
406 | qDebug( "QProcessPrivate: Destructor" ); | 405 | odebug << "QProcessPrivate: Destructor" << oendl; |
407 | #endif | 406 | #endif |
408 | 407 | ||
409 | if ( proc != 0 ) { | 408 | if ( proc != 0 ) { |
410 | if ( proc->socketStdin != 0 ) { | 409 | if ( proc->socketStdin != 0 ) { |
411 | ::close( proc->socketStdin ); | 410 | ::close( proc->socketStdin ); |
412 | proc->socketStdin = 0; | 411 | proc->socketStdin = 0; |
413 | } | 412 | } |
414 | proc->process = 0; | 413 | proc->process = 0; |
@@ -594,17 +593,17 @@ QProcess::~QProcess() | |||
594 | also if the process could not be started. (On operating systems that have | 593 | also if the process could not be started. (On operating systems that have |
595 | zombie processes, Qt will also wait() on the old process.) | 594 | zombie processes, Qt will also wait() on the old process.) |
596 | 595 | ||
597 | \sa launch() closeStdin() | 596 | \sa launch() closeStdin() |
598 | */ | 597 | */ |
599 | bool QProcess::start( QStringList *env ) | 598 | bool QProcess::start( QStringList *env ) |
600 | { | 599 | { |
601 | #if defined(QT_QPROCESS_DEBUG) | 600 | #if defined(QT_QPROCESS_DEBUG) |
602 | qDebug( "QProcess::start()" ); | 601 | odebug << "QProcess::start()" << oendl; |
603 | #endif | 602 | #endif |
604 | reset(); | 603 | reset(); |
605 | 604 | ||
606 | int sStdin[2]; | 605 | int sStdin[2]; |
607 | int sStdout[2]; | 606 | int sStdout[2]; |
608 | int sStderr[2]; | 607 | int sStderr[2]; |
609 | 608 | ||
610 | // open sockets for piping | 609 | // open sockets for piping |
@@ -630,17 +629,17 @@ bool QProcess::start( QStringList *env ) | |||
630 | // construct the arguments for exec | 629 | // construct the arguments for exec |
631 | QCString *arglistQ = new QCString[ _arguments.count() + 1 ]; | 630 | QCString *arglistQ = new QCString[ _arguments.count() + 1 ]; |
632 | const char** arglist = new const char*[ _arguments.count() + 1 ]; | 631 | const char** arglist = new const char*[ _arguments.count() + 1 ]; |
633 | int i = 0; | 632 | int i = 0; |
634 | for ( QStringList::Iterator it = _arguments.begin(); it != _arguments.end(); ++it ) { | 633 | for ( QStringList::Iterator it = _arguments.begin(); it != _arguments.end(); ++it ) { |
635 | arglistQ[i] = (*it).local8Bit(); | 634 | arglistQ[i] = (*it).local8Bit(); |
636 | arglist[i] = arglistQ[i]; | 635 | arglist[i] = arglistQ[i]; |
637 | #if defined(QT_QPROCESS_DEBUG) | 636 | #if defined(QT_QPROCESS_DEBUG) |
638 | qDebug( "QProcess::start(): arg %d = %s", i, arglist[i] ); | 637 | odebug << "QProcess::start(): arg " << i << " = " << arglist[i] << "" << oendl; |
639 | #endif | 638 | #endif |
640 | i++; | 639 | i++; |
641 | } | 640 | } |
642 | arglist[i] = 0; | 641 | arglist[i] = 0; |
643 | 642 | ||
644 | // Must make sure signal handlers are installed before exec'ing | 643 | // Must make sure signal handlers are installed before exec'ing |
645 | // in case the process exits quickly. | 644 | // in case the process exits quickly. |
646 | if ( d->procManager == 0 ) { | 645 | if ( d->procManager == 0 ) { |
@@ -794,17 +793,17 @@ bool QProcess::start( QStringList *env ) | |||
794 | 793 | ||
795 | // cleanup and return | 794 | // cleanup and return |
796 | delete[] arglistQ; | 795 | delete[] arglistQ; |
797 | delete[] arglist; | 796 | delete[] arglist; |
798 | return TRUE; | 797 | return TRUE; |
799 | 798 | ||
800 | error: | 799 | error: |
801 | #if defined(QT_QPROCESS_DEBUG) | 800 | #if defined(QT_QPROCESS_DEBUG) |
802 | qDebug( "QProcess::start(): error starting process" ); | 801 | odebug << "QProcess::start(): error starting process" << oendl; |
803 | #endif | 802 | #endif |
804 | if ( d->procManager ) | 803 | if ( d->procManager ) |
805 | d->procManager->cleanup(); | 804 | d->procManager->cleanup(); |
806 | if ( comms & Stdin ) { | 805 | if ( comms & Stdin ) { |
807 | ::close( sStdin[1] ); | 806 | ::close( sStdin[1] ); |
808 | ::close( sStdin[0] ); | 807 | ::close( sStdin[0] ); |
809 | } | 808 | } |
810 | if ( comms & Stdout ) { | 809 | if ( comms & Stdout ) { |
@@ -873,39 +872,39 @@ void QProcess::kill() const | |||
873 | Returns TRUE if the process is running, otherwise FALSE. | 872 | Returns TRUE if the process is running, otherwise FALSE. |
874 | 873 | ||
875 | \sa normalExit() exitStatus() processExited() | 874 | \sa normalExit() exitStatus() processExited() |
876 | */ | 875 | */ |
877 | bool QProcess::isRunning() const | 876 | bool QProcess::isRunning() const |
878 | { | 877 | { |
879 | if ( d->exitValuesCalculated ) { | 878 | if ( d->exitValuesCalculated ) { |
880 | #if defined(QT_QPROCESS_DEBUG) | 879 | #if defined(QT_QPROCESS_DEBUG) |
881 | qDebug( "QProcess::isRunning(): FALSE (already computed)" ); | 880 | odebug << "QProcess::isRunning(): FALSE (already computed)" << oendl; |
882 | #endif | 881 | #endif |
883 | return FALSE; | 882 | return FALSE; |
884 | } | 883 | } |
885 | if ( d->proc == 0 ) | 884 | if ( d->proc == 0 ) |
886 | return FALSE; | 885 | return FALSE; |
887 | int status; | 886 | int status; |
888 | if ( ::waitpid( d->proc->pid, &status, WNOHANG ) == d->proc->pid ) | 887 | if ( ::waitpid( d->proc->pid, &status, WNOHANG ) == d->proc->pid ) |
889 | { | 888 | { |
890 | // compute the exit values | 889 | // compute the exit values |
891 | QProcess *that = (QProcess*)this; // mutable | 890 | QProcess *that = (QProcess*)this; // mutable |
892 | that->exitNormal = WIFEXITED( status ) != 0; | 891 | that->exitNormal = WIFEXITED( status ) != 0; |
893 | if ( exitNormal ) { | 892 | if ( exitNormal ) { |
894 | that->exitStat = (char)WEXITSTATUS( status ); | 893 | that->exitStat = (char)WEXITSTATUS( status ); |
895 | } | 894 | } |
896 | d->exitValuesCalculated = TRUE; | 895 | d->exitValuesCalculated = TRUE; |
897 | #if defined(QT_QPROCESS_DEBUG) | 896 | #if defined(QT_QPROCESS_DEBUG) |
898 | qDebug( "QProcess::isRunning() (PID: %d): FALSE", d->proc->pid ); | 897 | odebug << "QProcess::isRunning() (PID: " << d->proc->pid << "): FALSE" << oendl; |
899 | #endif | 898 | #endif |
900 | return FALSE; | 899 | return FALSE; |
901 | } | 900 | } |
902 | #if defined(QT_QPROCESS_DEBUG) | 901 | #if defined(QT_QPROCESS_DEBUG) |
903 | qDebug( "QProcess::isRunning() (PID: %d): TRUE", d->proc->pid ); | 902 | odebug << "QProcess::isRunning() (PID: " << d->proc->pid << "): TRUE" << oendl; |
904 | #endif | 903 | #endif |
905 | return TRUE; | 904 | return TRUE; |
906 | } | 905 | } |
907 | 906 | ||
908 | /*! | 907 | /*! |
909 | Writes the data \a buf to the standard input of the process. The process may | 908 | Writes the data \a buf to the standard input of the process. The process may |
910 | or may not read this data. | 909 | or may not read this data. |
911 | 910 | ||
@@ -915,17 +914,17 @@ bool QProcess::isRunning() const | |||
915 | not mean that the process really read the data, since this class only detects | 914 | not mean that the process really read the data, since this class only detects |
916 | when it was able to write the data to the operating system. | 915 | when it was able to write the data to the operating system. |
917 | 916 | ||
918 | \sa wroteToStdin() closeStdin() readStdout() readStderr() | 917 | \sa wroteToStdin() closeStdin() readStdout() readStderr() |
919 | */ | 918 | */ |
920 | void QProcess::writeToStdin( const QByteArray& buf ) | 919 | void QProcess::writeToStdin( const QByteArray& buf ) |
921 | { | 920 | { |
922 | #if defined(QT_QPROCESS_DEBUG) | 921 | #if defined(QT_QPROCESS_DEBUG) |
923 | // qDebug( "QProcess::writeToStdin(): write to stdin (%d)", d->socketStdin ); | 922 | // odebug << "QProcess::writeToStdin(): write to stdin (" << d->socketStdin << ")" << oendl; |
924 | #endif | 923 | #endif |
925 | d->stdinBuf.enqueue( new QByteArray(buf) ); | 924 | d->stdinBuf.enqueue( new QByteArray(buf) ); |
926 | if ( d->notifierStdin != 0 ) | 925 | if ( d->notifierStdin != 0 ) |
927 | d->notifierStdin->setEnabled( TRUE ); | 926 | d->notifierStdin->setEnabled( TRUE ); |
928 | } | 927 | } |
929 | 928 | ||
930 | 929 | ||
931 | /*! | 930 | /*! |
@@ -942,20 +941,20 @@ void QProcess::closeStdin() | |||
942 | return; | 941 | return; |
943 | if ( d->proc->socketStdin !=0 ) { | 942 | if ( d->proc->socketStdin !=0 ) { |
944 | while ( !d->stdinBuf.isEmpty() ) { | 943 | while ( !d->stdinBuf.isEmpty() ) { |
945 | delete d->stdinBuf.dequeue(); | 944 | delete d->stdinBuf.dequeue(); |
946 | } | 945 | } |
947 | delete d->notifierStdin; | 946 | delete d->notifierStdin; |
948 | d->notifierStdin = 0; | 947 | d->notifierStdin = 0; |
949 | if ( ::close( d->proc->socketStdin ) != 0 ) { | 948 | if ( ::close( d->proc->socketStdin ) != 0 ) { |
950 | qWarning( "Could not close stdin of child process" ); | 949 | owarn << "Could not close stdin of child process" << oendl; |
951 | } | 950 | } |
952 | #if defined(QT_QPROCESS_DEBUG) | 951 | #if defined(QT_QPROCESS_DEBUG) |
953 | qDebug( "QProcess::closeStdin(): stdin (%d) closed", d->proc->socketStdin ); | 952 | odebug << "QProcess::closeStdin(): stdin (" << d->proc->socketStdin << ") closed" << oendl; |
954 | #endif | 953 | #endif |
955 | d->proc->socketStdin = 0; | 954 | d->proc->socketStdin = 0; |
956 | } | 955 | } |
957 | } | 956 | } |
958 | 957 | ||
959 | 958 | ||
960 | /* | 959 | /* |
961 | This private slot is called when the process has outputted data to either | 960 | This private slot is called when the process has outputted data to either |
@@ -965,17 +964,17 @@ void QProcess::socketRead( int fd ) | |||
965 | { | 964 | { |
966 | if ( d->socketReadCalled ) { | 965 | if ( d->socketReadCalled ) { |
967 | // the slots that are connected to the readyRead...() signals might | 966 | // the slots that are connected to the readyRead...() signals might |
968 | // trigger a recursive call of socketRead(). Avoid this since you get a | 967 | // trigger a recursive call of socketRead(). Avoid this since you get a |
969 | // blocking read otherwise. | 968 | // blocking read otherwise. |
970 | return; | 969 | return; |
971 | } | 970 | } |
972 | #if defined(QT_QPROCESS_DEBUG) | 971 | #if defined(QT_QPROCESS_DEBUG) |
973 | qDebug( "QProcess::socketRead(): %d", fd ); | 972 | odebug << "QProcess::socketRead(): " << fd << "" << oendl; |
974 | #endif | 973 | #endif |
975 | if ( fd == 0 ) | 974 | if ( fd == 0 ) |
976 | return; | 975 | return; |
977 | const int bufsize = 4096; | 976 | const int bufsize = 4096; |
978 | QByteArray *buffer = 0; | 977 | QByteArray *buffer = 0; |
979 | uint oldSize; | 978 | uint oldSize; |
980 | int n; | 979 | int n; |
981 | if ( fd == d->proc->socketStdout ) { | 980 | if ( fd == d->proc->socketStdout ) { |
@@ -994,27 +993,27 @@ void QProcess::socketRead( int fd ) | |||
994 | if ( n > 0 ) | 993 | if ( n > 0 ) |
995 | buffer->resize( oldSize + n ); | 994 | buffer->resize( oldSize + n ); |
996 | else | 995 | else |
997 | buffer->resize( oldSize ); | 996 | buffer->resize( oldSize ); |
998 | // eof or error? | 997 | // eof or error? |
999 | if ( n == 0 || n == -1 ) { | 998 | if ( n == 0 || n == -1 ) { |
1000 | if ( fd == d->proc->socketStdout ) { | 999 | if ( fd == d->proc->socketStdout ) { |
1001 | #if defined(QT_QPROCESS_DEBUG) | 1000 | #if defined(QT_QPROCESS_DEBUG) |
1002 | qDebug( "QProcess::socketRead(): stdout (%d) closed", fd ); | 1001 | odebug << "QProcess::socketRead(): stdout (" << fd << ") closed" << oendl; |
1003 | #endif | 1002 | #endif |
1004 | d->notifierStdout->setEnabled( FALSE ); | 1003 | d->notifierStdout->setEnabled( FALSE ); |
1005 | delete d->notifierStdout; | 1004 | delete d->notifierStdout; |
1006 | d->notifierStdout = 0; | 1005 | d->notifierStdout = 0; |
1007 | ::close( d->proc->socketStdout ); | 1006 | ::close( d->proc->socketStdout ); |
1008 | d->proc->socketStdout = 0; | 1007 | d->proc->socketStdout = 0; |
1009 | return; | 1008 | return; |
1010 | } else if ( fd == d->proc->socketStderr ) { | 1009 | } else if ( fd == d->proc->socketStderr ) { |
1011 | #if defined(QT_QPROCESS_DEBUG) | 1010 | #if defined(QT_QPROCESS_DEBUG) |
1012 | qDebug( "QProcess::socketRead(): stderr (%d) closed", fd ); | 1011 | odebug << "QProcess::socketRead(): stderr (" << fd << ") closed" << oendl; |
1013 | #endif | 1012 | #endif |
1014 | d->notifierStderr->setEnabled( FALSE ); | 1013 | d->notifierStderr->setEnabled( FALSE ); |
1015 | delete d->notifierStderr; | 1014 | delete d->notifierStderr; |
1016 | d->notifierStderr = 0; | 1015 | d->notifierStderr = 0; |
1017 | ::close( d->proc->socketStderr ); | 1016 | ::close( d->proc->socketStderr ); |
1018 | d->proc->socketStderr = 0; | 1017 | d->proc->socketStderr = 0; |
1019 | return; | 1018 | return; |
1020 | } | 1019 | } |
@@ -1056,17 +1055,17 @@ void QProcess::socketWrite( int fd ) | |||
1056 | { | 1055 | { |
1057 | if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 ) | 1056 | if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 ) |
1058 | return; | 1057 | return; |
1059 | if ( d->stdinBuf.isEmpty() ) { | 1058 | if ( d->stdinBuf.isEmpty() ) { |
1060 | d->notifierStdin->setEnabled( FALSE ); | 1059 | d->notifierStdin->setEnabled( FALSE ); |
1061 | return; | 1060 | return; |
1062 | } | 1061 | } |
1063 | #if defined(QT_QPROCESS_DEBUG) | 1062 | #if defined(QT_QPROCESS_DEBUG) |
1064 | qDebug( "QProcess::socketWrite(): write to stdin (%d)", fd ); | 1063 | odebug << "QProcess::socketWrite(): write to stdin (" << fd << ")" << oendl; |
1065 | #endif | 1064 | #endif |
1066 | ssize_t ret = ::write( fd, | 1065 | ssize_t ret = ::write( fd, |
1067 | d->stdinBuf.head()->data() + d->stdinBufRead, | 1066 | d->stdinBuf.head()->data() + d->stdinBufRead, |
1068 | d->stdinBuf.head()->size() - d->stdinBufRead ); | 1067 | d->stdinBuf.head()->size() - d->stdinBufRead ); |
1069 | if ( ret > 0 ) | 1068 | if ( ret > 0 ) |
1070 | d->stdinBufRead += ret; | 1069 | d->stdinBufRead += ret; |
1071 | if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) { | 1070 | if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) { |
1072 | d->stdinBufRead = 0; | 1071 | d->stdinBufRead = 0; |
diff --git a/core/launcher/runningappbar.cpp b/core/launcher/runningappbar.cpp index 2e9d2a9..a25963f 100644 --- a/core/launcher/runningappbar.cpp +++ b/core/launcher/runningappbar.cpp | |||
@@ -15,25 +15,29 @@ | |||
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 | #define QTOPIA_INTERNAL_PRELOADACCESS | 21 | #define QTOPIA_INTERNAL_PRELOADACCESS |
22 | 22 | ||
23 | #include "runningappbar.h" | ||
24 | #include "serverinterface.h" | ||
23 | 25 | ||
24 | #include <stdlib.h> | 26 | /* OPIE */ |
27 | #include <opie2/odebug.h> | ||
28 | #include <qtopia/qcopenvelope_qws.h> | ||
29 | using namespace Opie::Core; | ||
25 | 30 | ||
31 | /* QT */ | ||
26 | #include <qpainter.h> | 32 | #include <qpainter.h> |
27 | 33 | ||
28 | #include <qtopia/qcopenvelope_qws.h> | 34 | /* STD */ |
29 | 35 | #include <stdlib.h> | |
30 | #include "runningappbar.h" | ||
31 | #include "serverinterface.h" | ||
32 | 36 | ||
33 | RunningAppBar::RunningAppBar(QWidget* parent) | 37 | RunningAppBar::RunningAppBar(QWidget* parent) |
34 | : QFrame(parent), selectedAppIndex(-1) | 38 | : QFrame(parent), selectedAppIndex(-1) |
35 | { | 39 | { |
36 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); | 40 | QCopChannel* channel = new QCopChannel( "QPE/System", this ); |
37 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 41 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
38 | this, SLOT(received(const QCString&,const QByteArray&)) ); | 42 | this, SLOT(received(const QCString&,const QByteArray&)) ); |
39 | 43 | ||
@@ -46,41 +50,41 @@ RunningAppBar::~RunningAppBar() | |||
46 | 50 | ||
47 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { | 51 | void RunningAppBar::received(const QCString& msg, const QByteArray& data) { |
48 | // Since fast apps appear and disappear without disconnecting from their | 52 | // Since fast apps appear and disappear without disconnecting from their |
49 | // channel we need to watch for the showing/hiding events and update according. | 53 | // channel we need to watch for the showing/hiding events and update according. |
50 | QDataStream stream( data, IO_ReadOnly ); | 54 | QDataStream stream( data, IO_ReadOnly ); |
51 | if ( msg == "fastAppShowing(QString)") { | 55 | if ( msg == "fastAppShowing(QString)") { |
52 | QString appName; | 56 | QString appName; |
53 | stream >> appName; | 57 | stream >> appName; |
54 | // qDebug("fastAppShowing %s", appName.data() ); | 58 | // odebug << "fastAppShowing " << appName.data() << "" << oendl; |
55 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); | 59 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); |
56 | if ( f ) addTask(*f); | 60 | if ( f ) addTask(*f); |
57 | } else if ( msg == "fastAppHiding(QString)") { | 61 | } else if ( msg == "fastAppHiding(QString)") { |
58 | QString appName; | 62 | QString appName; |
59 | stream >> appName; | 63 | stream >> appName; |
60 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); | 64 | const AppLnk* f = ServerInterface::appLnks().findExec(appName); |
61 | if ( f ) removeTask(*f); | 65 | if ( f ) removeTask(*f); |
62 | } | 66 | } |
63 | } | 67 | } |
64 | 68 | ||
65 | void RunningAppBar::addTask(const AppLnk& appLnk) { | 69 | void RunningAppBar::addTask(const AppLnk& appLnk) { |
66 | qDebug("Added %s to app list.", appLnk.name().latin1()); | 70 | odebug << "Added " << appLnk.name() << " to app list." << oendl; |
67 | AppLnk* newApp = new AppLnk(appLnk); | 71 | AppLnk* newApp = new AppLnk(appLnk); |
68 | newApp->setExec(appLnk.exec()); | 72 | newApp->setExec(appLnk.exec()); |
69 | appList.prepend(newApp); | 73 | appList.prepend(newApp); |
70 | update(); | 74 | update(); |
71 | } | 75 | } |
72 | 76 | ||
73 | void RunningAppBar::removeTask(const AppLnk& appLnk) { | 77 | void RunningAppBar::removeTask(const AppLnk& appLnk) { |
74 | unsigned int i = 0; | 78 | unsigned int i = 0; |
75 | for (; i < appList.count() ; i++) { | 79 | for (; i < appList.count() ; i++) { |
76 | AppLnk* target = appList.at(i); | 80 | AppLnk* target = appList.at(i); |
77 | if (target->exec() == appLnk.exec()) { | 81 | if (target->exec() == appLnk.exec()) { |
78 | qDebug("Removing %s from app list.", appLnk.name().latin1()); | 82 | odebug << "Removing " << appLnk.name() << " from app list." << oendl; |
79 | appList.remove(); | 83 | appList.remove(); |
80 | delete target; | 84 | delete target; |
81 | } | 85 | } |
82 | } | 86 | } |
83 | update(); | 87 | update(); |
84 | } | 88 | } |
85 | 89 | ||
86 | void RunningAppBar::mousePressEvent(QMouseEvent *e) | 90 | void RunningAppBar::mousePressEvent(QMouseEvent *e) |
@@ -130,17 +134,17 @@ void RunningAppBar::paintEvent( QPaintEvent * ) | |||
130 | 134 | ||
131 | p.fillRect( 0, 0, width(), height(), colorGroup().background() ); | 135 | p.fillRect( 0, 0, width(), height(), colorGroup().background() ); |
132 | 136 | ||
133 | QListIterator<AppLnk> it(appList); | 137 | QListIterator<AppLnk> it(appList); |
134 | 138 | ||
135 | for (; it.current(); i++, ++it ) { | 139 | for (; it.current(); i++, ++it ) { |
136 | if ( x + spacing <= width() ) { | 140 | if ( x + spacing <= width() ) { |
137 | curApp = it.current(); | 141 | curApp = it.current(); |
138 | qWarning("Drawing %s", curApp->name().latin1() ); | 142 | owarn << "Drawing " << curApp->name() << "" << oendl; |
139 | if ( (int)i == selectedAppIndex ) | 143 | if ( (int)i == selectedAppIndex ) |
140 | p.fillRect( x, y, spacing, curApp->pixmap().height()+1, colorGroup().highlight() ); | 144 | p.fillRect( x, y, spacing, curApp->pixmap().height()+1, colorGroup().highlight() ); |
141 | else | 145 | else |
142 | p.eraseRect( x, y, spacing, curApp->pixmap().height()+1 ); | 146 | p.eraseRect( x, y, spacing, curApp->pixmap().height()+1 ); |
143 | p.drawPixmap( x, y, curApp->pixmap() ); | 147 | p.drawPixmap( x, y, curApp->pixmap() ); |
144 | x += spacing; | 148 | x += spacing; |
145 | } | 149 | } |
146 | } | 150 | } |
@@ -148,17 +152,17 @@ void RunningAppBar::paintEvent( QPaintEvent * ) | |||
148 | 152 | ||
149 | QSize RunningAppBar::sizeHint() const | 153 | QSize RunningAppBar::sizeHint() const |
150 | { | 154 | { |
151 | return QSize( frameWidth(), AppLnk::smallIconSize()+frameWidth()*2+3 ); | 155 | return QSize( frameWidth(), AppLnk::smallIconSize()+frameWidth()*2+3 ); |
152 | } | 156 | } |
153 | 157 | ||
154 | void RunningAppBar::applicationLaunched(const QString &appName) | 158 | void RunningAppBar::applicationLaunched(const QString &appName) |
155 | { | 159 | { |
156 | qDebug("desktop:: app: %s launched with pid ", appName.data() ); | 160 | odebug << "desktop:: app: " << appName.data() << " launched with pid " << oendl; |
157 | const AppLnk* newGuy = ServerInterface::appLnks().findExec(appName); | 161 | const AppLnk* newGuy = ServerInterface::appLnks().findExec(appName); |
158 | if ( newGuy && !newGuy->isPreloaded() ) { | 162 | if ( newGuy && !newGuy->isPreloaded() ) { |
159 | addTask( *newGuy ); | 163 | addTask( *newGuy ); |
160 | } | 164 | } |
161 | } | 165 | } |
162 | 166 | ||
163 | void RunningAppBar::applicationTerminated(const QString &app) | 167 | void RunningAppBar::applicationTerminated(const QString &app) |
164 | { | 168 | { |
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp index 6aaab3a..a7d23c4 100644 --- a/core/launcher/screensaver.cpp +++ b/core/launcher/screensaver.cpp | |||
@@ -153,17 +153,17 @@ void OpieScreenSaver::setIntervals ( int dim, int lightoff, int suspend ) | |||
153 | } | 153 | } |
154 | else { | 154 | else { |
155 | m_enable_dim = ( dim > 0 ); | 155 | m_enable_dim = ( dim > 0 ); |
156 | m_enable_lightoff = ( lightoff > 0 ); | 156 | m_enable_lightoff = ( lightoff > 0 ); |
157 | m_enable_suspend = ( suspend > 0 ); | 157 | m_enable_suspend = ( suspend > 0 ); |
158 | m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false ); | 158 | m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false ); |
159 | } | 159 | } |
160 | 160 | ||
161 | //qDebug("screen saver intervals: %d %d %d", dim, lightoff, suspend); | 161 | //odebug << "screen saver intervals: " << dim << " " << lightoff << " " << suspend << "" << oendl; |
162 | 162 | ||
163 | v [ 0 ] = QMAX( 1000 * dim, 100 ); | 163 | v [ 0 ] = QMAX( 1000 * dim, 100 ); |
164 | v [ 1 ] = QMAX( 1000 * lightoff, 100 ); | 164 | v [ 1 ] = QMAX( 1000 * lightoff, 100 ); |
165 | v [ 2 ] = QMAX( 1000 * suspend, 100 ); | 165 | v [ 2 ] = QMAX( 1000 * suspend, 100 ); |
166 | v [ 3 ] = 0; | 166 | v [ 3 ] = 0; |
167 | 167 | ||
168 | if ( !dim && !lightoff && !suspend ) | 168 | if ( !dim && !lightoff && !suspend ) |
169 | QWSServer::setScreenSaverInterval( 0 ); | 169 | QWSServer::setScreenSaverInterval( 0 ); |
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp index 9a86a80..b9fa1e5 100644 --- a/core/launcher/server.cpp +++ b/core/launcher/server.cpp | |||
@@ -31,45 +31,45 @@ | |||
31 | #include "syncdialog.h" | 31 | #include "syncdialog.h" |
32 | #include "shutdownimpl.h" | 32 | #include "shutdownimpl.h" |
33 | #include "applauncher.h" | 33 | #include "applauncher.h" |
34 | #if 0 | 34 | #if 0 |
35 | #include "suspendmonitor.h" | 35 | #include "suspendmonitor.h" |
36 | #endif | 36 | #endif |
37 | #include "documentlist.h" | 37 | #include "documentlist.h" |
38 | 38 | ||
39 | /* OPIE */ | ||
40 | #include <opie2/odebug.h> | ||
41 | #include <opie2/odevicebutton.h> | ||
42 | #include <opie2/odevice.h> | ||
39 | #include <qtopia/applnk.h> | 43 | #include <qtopia/applnk.h> |
40 | #include <qtopia/private/categories.h> | 44 | #include <qtopia/private/categories.h> |
41 | #include <qtopia/mimetype.h> | 45 | #include <qtopia/mimetype.h> |
42 | #include <qtopia/config.h> | 46 | #include <qtopia/config.h> |
43 | #include <qtopia/resource.h> | 47 | #include <qtopia/resource.h> |
44 | #include <qtopia/version.h> | 48 | #include <qtopia/version.h> |
45 | #include <qtopia/storage.h> | 49 | #include <qtopia/storage.h> |
46 | |||
47 | #include <qtopia/qcopenvelope_qws.h> | 50 | #include <qtopia/qcopenvelope_qws.h> |
48 | #include <qwindowsystem_qws.h> | ||
49 | #include <qgfx_qws.h> | ||
50 | #include <qtopia/global.h> | 51 | #include <qtopia/global.h> |
51 | //#include <qtopia/custom.h> | 52 | using namespace Opie::Core; |
52 | |||
53 | #include <opie2/odevicebutton.h> | ||
54 | #include <opie2/odevice.h> | ||
55 | 53 | ||
56 | #include <unistd.h> | 54 | /* QT */ |
57 | #include <qmainwindow.h> | 55 | #include <qmainwindow.h> |
58 | #include <qmessagebox.h> | 56 | #include <qmessagebox.h> |
59 | #include <qtimer.h> | 57 | #include <qtimer.h> |
60 | #include <qtextstream.h> | 58 | #include <qtextstream.h> |
59 | #include <qwindowsystem_qws.h> | ||
60 | #include <qgfx_qws.h> | ||
61 | 61 | ||
62 | /* STD */ | ||
63 | #include <unistd.h> | ||
62 | #include <stdlib.h> | 64 | #include <stdlib.h> |
63 | 65 | ||
64 | extern QRect qt_maxWindowRect; | 66 | extern QRect qt_maxWindowRect; |
65 | 67 | ||
66 | |||
67 | using namespace Opie::Core; | ||
68 | static QWidget *calibrate(bool) | 68 | static QWidget *calibrate(bool) |
69 | { | 69 | { |
70 | #ifdef Q_WS_QWS | 70 | #ifdef Q_WS_QWS |
71 | Calibrate *c = new Calibrate; | 71 | Calibrate *c = new Calibrate; |
72 | c->show(); | 72 | c->show(); |
73 | return c; | 73 | return c; |
74 | #else | 74 | #else |
75 | return 0; | 75 | return 0; |
@@ -324,17 +324,17 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
324 | int mode, pid; | 324 | int mode, pid; |
325 | stream >> mode >> pid; | 325 | stream >> mode >> pid; |
326 | tsmMonitor->setTempMode(mode, pid); | 326 | tsmMonitor->setTempMode(mode, pid); |
327 | } | 327 | } |
328 | #endif | 328 | #endif |
329 | else if ( msg == "linkChanged(QString)" ) { | 329 | else if ( msg == "linkChanged(QString)" ) { |
330 | QString link; | 330 | QString link; |
331 | stream >> link; | 331 | stream >> link; |
332 | qDebug( "desktop.cpp systemMsg -> linkchanged( %s )", link.latin1() ); | 332 | odebug << "desktop.cpp systemMsg -> linkchanged( " << link << " )" << oendl; |
333 | docList->linkChanged(link); | 333 | docList->linkChanged(link); |
334 | } else if ( msg == "serviceChanged(QString)" ) { | 334 | } else if ( msg == "serviceChanged(QString)" ) { |
335 | MimeType::updateApplications(); | 335 | MimeType::updateApplications(); |
336 | } else if ( msg == "mkdir(QString)" ) { | 336 | } else if ( msg == "mkdir(QString)" ) { |
337 | QString dir; | 337 | QString dir; |
338 | stream >> dir; | 338 | stream >> dir; |
339 | if ( !dir.isEmpty() ) | 339 | if ( !dir.isEmpty() ) |
340 | mkdir( dir ); | 340 | mkdir( dir ); |
@@ -429,17 +429,17 @@ void Server::systemMsg(const QCString &msg, const QByteArray &data) | |||
429 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 429 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
430 | //cfg.readEntry( app ).latin1() ); | 430 | //cfg.readEntry( app ).latin1() ); |
431 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 431 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
432 | QString app, date; | 432 | QString app, date; |
433 | stream >> app >> date; | 433 | stream >> app >> date; |
434 | Config cfg( "qpe" ); | 434 | Config cfg( "qpe" ); |
435 | cfg.setGroup("SyncDate"); | 435 | cfg.setGroup("SyncDate"); |
436 | cfg.writeEntry( app, date ); | 436 | cfg.writeEntry( app, date ); |
437 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 437 | //odebug << "setSyncDate(QString,QString) " << app << " " << date << "" << oendl; |
438 | } else if ( msg == "startSync(QString)" ) { | 438 | } else if ( msg == "startSync(QString)" ) { |
439 | QString what; | 439 | QString what; |
440 | stream >> what; | 440 | stream >> what; |
441 | delete syncDialog; | 441 | delete syncDialog; |
442 | syncDialog = new SyncDialog( this, what ); | 442 | syncDialog = new SyncDialog( this, what ); |
443 | syncDialog->show(); | 443 | syncDialog->show(); |
444 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); | 444 | connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) ); |
445 | } else if ( msg == "stopSync()") { | 445 | } else if ( msg == "stopSync()") { |
@@ -567,37 +567,37 @@ bool Server::mkdir(const QString &localPath) | |||
567 | // that don't exist; if we can't create the directories, return false | 567 | // that don't exist; if we can't create the directories, return false |
568 | 568 | ||
569 | QString dirSeps = "/"; | 569 | QString dirSeps = "/"; |
570 | int dirIndex = localPath.find(dirSeps); | 570 | int dirIndex = localPath.find(dirSeps); |
571 | QString checkedPath; | 571 | QString checkedPath; |
572 | 572 | ||
573 | // didn't find any seps; weird, use the cur dir instead | 573 | // didn't find any seps; weird, use the cur dir instead |
574 | if (dirIndex == -1) { | 574 | if (dirIndex == -1) { |
575 | //qDebug("No seperators found in path %s", localPath.latin1()); | 575 | //odebug << "No seperators found in path " << localPath << "" << oendl; |
576 | checkedPath = QDir::currentDirPath(); | 576 | checkedPath = QDir::currentDirPath(); |
577 | } | 577 | } |
578 | 578 | ||
579 | while (checkedPath != localPath) { | 579 | while (checkedPath != localPath) { |
580 | // no more seperators found, use the local path | 580 | // no more seperators found, use the local path |
581 | if (dirIndex == -1) | 581 | if (dirIndex == -1) |
582 | checkedPath = localPath; | 582 | checkedPath = localPath; |
583 | else { | 583 | else { |
584 | // the next directory to check | 584 | // the next directory to check |
585 | checkedPath = localPath.left(dirIndex) + "/"; | 585 | checkedPath = localPath.left(dirIndex) + "/"; |
586 | // advance the iterator; the next dir seperator | 586 | // advance the iterator; the next dir seperator |
587 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 587 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
588 | } | 588 | } |
589 | 589 | ||
590 | QDir checkDir(checkedPath); | 590 | QDir checkDir(checkedPath); |
591 | if (!checkDir.exists()) { | 591 | if (!checkDir.exists()) { |
592 | //qDebug("mkdir making dir %s", checkedPath.latin1()); | 592 | //odebug << "mkdir making dir " << checkedPath << "" << oendl; |
593 | 593 | ||
594 | if (!checkDir.mkdir(checkedPath)) { | 594 | if (!checkDir.mkdir(checkedPath)) { |
595 | qDebug("Unable to make directory %s", checkedPath.latin1()); | 595 | odebug << "Unable to make directory " << checkedPath << "" << oendl; |
596 | return FALSE; | 596 | return FALSE; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | } | 600 | } |
601 | return TRUE; | 601 | return TRUE; |
602 | } | 602 | } |
603 | 603 | ||
@@ -665,17 +665,17 @@ void Server::terminateServers() | |||
665 | delete transferServer; | 665 | delete transferServer; |
666 | delete qcopBridge; | 666 | delete qcopBridge; |
667 | transferServer = 0; | 667 | transferServer = 0; |
668 | qcopBridge = 0; | 668 | qcopBridge = 0; |
669 | } | 669 | } |
670 | 670 | ||
671 | void Server::syncConnectionClosed( const QHostAddress & ) | 671 | void Server::syncConnectionClosed( const QHostAddress & ) |
672 | { | 672 | { |
673 | qDebug( "Lost sync connection" ); | 673 | odebug << "Lost sync connection" << oendl; |
674 | delete syncDialog; | 674 | delete syncDialog; |
675 | syncDialog = 0; | 675 | syncDialog = 0; |
676 | } | 676 | } |
677 | 677 | ||
678 | void Server::pokeTimeMonitors() | 678 | void Server::pokeTimeMonitors() |
679 | { | 679 | { |
680 | #if 0 | 680 | #if 0 |
681 | // inform all TimeMonitors | 681 | // inform all TimeMonitors |
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index e4e16f2..cf543ce 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp | |||
@@ -14,53 +14,53 @@ | |||
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 "serverapp.h" | 21 | #include "serverapp.h" |
22 | #include "screensaver.h" | ||
22 | 23 | ||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
23 | #include <opie2/odevice.h> | 26 | #include <opie2/odevice.h> |
24 | |||
25 | #include <qtopia/password.h> | 27 | #include <qtopia/password.h> |
26 | #include <qtopia/config.h> | 28 | #include <qtopia/config.h> |
27 | #include <qtopia/power.h> | 29 | #include <qtopia/power.h> |
28 | 30 | ||
29 | #ifdef Q_WS_QWS | 31 | #ifdef Q_WS_QWS |
30 | #include <qtopia/qcopenvelope_qws.h> | 32 | #include <qtopia/qcopenvelope_qws.h> |
31 | #endif | 33 | #endif |
32 | #include <qtopia/global.h> | 34 | #include <qtopia/global.h> |
33 | //#include <qtopia/custom.h> | 35 | using namespace Opie::Core; |
34 | 36 | ||
37 | /* QT */ | ||
35 | #ifdef Q_WS_QWS | 38 | #ifdef Q_WS_QWS |
36 | #include <qgfx_qws.h> | 39 | #include <qgfx_qws.h> |
37 | #endif | 40 | #endif |
38 | #ifdef Q_OS_WIN32 | ||
39 | #include <io.h> | ||
40 | #include <process.h> | ||
41 | #else | ||
42 | #include <unistd.h> | ||
43 | #endif | ||
44 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
45 | #include <qtimer.h> | 42 | #include <qtimer.h> |
46 | #include <qpainter.h> | 43 | #include <qpainter.h> |
47 | #include <qfile.h> | 44 | #include <qfile.h> |
48 | #include <qpixmapcache.h> | 45 | #include <qpixmapcache.h> |
49 | 46 | ||
47 | /* STD */ | ||
48 | #ifdef Q_OS_WIN32 | ||
49 | #include <io.h> | ||
50 | #include <process.h> | ||
51 | #else | ||
52 | #include <unistd.h> | ||
53 | #endif | ||
50 | #include <stdlib.h> | 54 | #include <stdlib.h> |
51 | #include "screensaver.h" | ||
52 | 55 | ||
53 | static ServerApplication *serverApp = 0; | 56 | static ServerApplication *serverApp = 0; |
54 | static int loggedin=0; | 57 | static int loggedin=0; |
55 | 58 | ||
56 | using namespace Opie; | ||
57 | |||
58 | using namespace Opie::Core; | ||
59 | QCopKeyRegister::QCopKeyRegister() | 59 | QCopKeyRegister::QCopKeyRegister() |
60 | : m_keyCode( 0 ) { | 60 | : m_keyCode( 0 ) { |
61 | } | 61 | } |
62 | 62 | ||
63 | QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) | 63 | QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) |
64 | :m_keyCode( k ), m_channel( c ), m_message( m ) { | 64 | :m_keyCode( k ), m_channel( c ), m_message( m ) { |
65 | } | 65 | } |
66 | 66 | ||
@@ -851,13 +851,13 @@ ServerApplication *ServerApplication::me ( ) | |||
851 | bool ServerApplication::isStarting() | 851 | bool ServerApplication::isStarting() |
852 | { | 852 | { |
853 | return ms_is_starting; | 853 | return ms_is_starting; |
854 | } | 854 | } |
855 | 855 | ||
856 | int ServerApplication::exec() | 856 | int ServerApplication::exec() |
857 | { | 857 | { |
858 | ms_is_starting = true; | 858 | ms_is_starting = true; |
859 | qDebug("Serverapp - exec"); | 859 | odebug << "Serverapp - exec" << oendl; |
860 | return QPEApplication::exec(); | 860 | return QPEApplication::exec(); |
861 | } | 861 | } |
862 | 862 | ||
863 | #include "serverapp.moc" | 863 | #include "serverapp.moc" |
diff --git a/core/launcher/suspendmonitor.cpp b/core/launcher/suspendmonitor.cpp index f555e84..50bc56f 100644 --- a/core/launcher/suspendmonitor.cpp +++ b/core/launcher/suspendmonitor.cpp | |||
@@ -45,17 +45,17 @@ void TempScreenSaverMonitor::setTempMode(int mode, int pid) | |||
45 | sStatus[1].append(pid); | 45 | sStatus[1].append(pid); |
46 | break; | 46 | break; |
47 | case QPEApplication::DisableSuspend: | 47 | case QPEApplication::DisableSuspend: |
48 | sStatus[2].append(pid); | 48 | sStatus[2].append(pid); |
49 | break; | 49 | break; |
50 | case QPEApplication::Enable: | 50 | case QPEApplication::Enable: |
51 | break; | 51 | break; |
52 | default: | 52 | default: |
53 | qWarning("Unrecognized temp power setting. Ignored"); | 53 | owarn << "Unrecognized temp power setting. Ignored" << oendl; |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | updateAll(); | 56 | updateAll(); |
57 | } | 57 | } |
58 | 58 | ||
59 | // Returns true if app had set a temp Mode earlier | 59 | // Returns true if app had set a temp Mode earlier |
60 | bool TempScreenSaverMonitor::removeOld(int pid) | 60 | bool TempScreenSaverMonitor::removeOld(int pid) |
61 | { | 61 | { |
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 6cc1446..3c72d25 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -13,34 +13,32 @@ | |||
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 "systray.h" | ||
22 | |||
23 | /* OPIE */ | ||
24 | #include <opie2/odebug.h> | ||
21 | #include <qtopia/qpeapplication.h> | 25 | #include <qtopia/qpeapplication.h> |
22 | #include <qtopia/qlibrary.h> | 26 | #include <qtopia/qlibrary.h> |
23 | #include <qtopia/config.h> | 27 | #include <qtopia/config.h> |
28 | using namespace Opie::Core; | ||
24 | 29 | ||
30 | /* QT */ | ||
25 | #include <qlayout.h> | 31 | #include <qlayout.h> |
26 | #include <qdir.h> | 32 | #include <qdir.h> |
27 | 33 | ||
28 | #include "systray.h" | 34 | /* STD */ |
29 | |||
30 | #include <stdlib.h> | 35 | #include <stdlib.h> |
31 | 36 | ||
32 | /* ### Single build floppies ### */ | ||
33 | #if 0 | ||
34 | #ifdef QT_NO_COMPONENTS | ||
35 | #include "../plugins/applets/clockapplet/clockappletimpl.h" | ||
36 | #endif | ||
37 | #endif | ||
38 | |||
39 | SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) | 37 | SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) |
40 | { | 38 | { |
41 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 39 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
42 | loadApplets(); | 40 | loadApplets(); |
43 | } | 41 | } |
44 | 42 | ||
45 | SysTray::~SysTray() | 43 | SysTray::~SysTray() |
46 | { | 44 | { |
@@ -107,17 +105,17 @@ void SysTray::addApplets() | |||
107 | #endif /* Q_OS_MACX */ | 105 | #endif /* Q_OS_MACX */ |
108 | QStringList list = dir.entryList(); | 106 | QStringList list = dir.entryList(); |
109 | QStringList::Iterator it; | 107 | QStringList::Iterator it; |
110 | int napplets=0; | 108 | int napplets=0; |
111 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; | 109 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; |
112 | for ( it = list.begin(); it != list.end(); ++it ) { | 110 | for ( it = list.begin(); it != list.end(); ++it ) { |
113 | if ( exclude.find( *it ) != exclude.end() ) | 111 | if ( exclude.find( *it ) != exclude.end() ) |
114 | continue; | 112 | continue; |
115 | qWarning( "Found Applet: %s", (*it).latin1() ); | 113 | owarn << "Found Applet: " << (*it) << "" << oendl; |
116 | TaskbarAppletInterface *iface = 0; | 114 | TaskbarAppletInterface *iface = 0; |
117 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 115 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
118 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { | 116 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { |
119 | TaskbarApplet *applet = new TaskbarApplet; | 117 | TaskbarApplet *applet = new TaskbarApplet; |
120 | applets[napplets++] = applet; | 118 | applets[napplets++] = applet; |
121 | applet->library = lib; | 119 | applet->library = lib; |
122 | applet->iface = iface; | 120 | applet->iface = iface; |
123 | 121 | ||
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp index 91e2f20..86e0d0d 100644 --- a/core/launcher/taskbar.cpp +++ b/core/launcher/taskbar.cpp | |||
@@ -23,24 +23,27 @@ | |||
23 | #include "runningappbar.h" | 23 | #include "runningappbar.h" |
24 | #include "systray.h" | 24 | #include "systray.h" |
25 | #include "wait.h" | 25 | #include "wait.h" |
26 | #include "appicons.h" | 26 | #include "appicons.h" |
27 | 27 | ||
28 | #include "taskbar.h" | 28 | #include "taskbar.h" |
29 | #include "server.h" | 29 | #include "server.h" |
30 | 30 | ||
31 | /* OPIE */ | ||
32 | #include <opie2/odebug.h> | ||
31 | #include <qtopia/config.h> | 33 | #include <qtopia/config.h> |
32 | #include <qtopia/qpeapplication.h> | 34 | #include <qtopia/qpeapplication.h> |
33 | #ifdef QWS | 35 | #ifdef QWS |
34 | #include <qtopia/qcopenvelope_qws.h> | 36 | #include <qtopia/qcopenvelope_qws.h> |
35 | #endif | 37 | #endif |
36 | #include <qtopia/global.h> | 38 | #include <qtopia/global.h> |
37 | //#include <qtopia/custom.h> | 39 | using namespace Opie::Core; |
38 | 40 | ||
41 | /* QT */ | ||
39 | #include <qlabel.h> | 42 | #include <qlabel.h> |
40 | #include <qlayout.h> | 43 | #include <qlayout.h> |
41 | #include <qtimer.h> | 44 | #include <qtimer.h> |
42 | #ifdef QWS | 45 | #ifdef QWS |
43 | #include <qwindowsystem_qws.h> | 46 | #include <qwindowsystem_qws.h> |
44 | #endif | 47 | #endif |
45 | #include <qwidgetstack.h> | 48 | #include <qwidgetstack.h> |
46 | 49 | ||
@@ -280,17 +283,17 @@ void TaskBar::resizeEvent( QResizeEvent *e ) | |||
280 | if ( sysTray ) | 283 | if ( sysTray ) |
281 | sysTray->hide(); | 284 | sysTray->hide(); |
282 | 285 | ||
283 | QHBox::resizeEvent( e ); | 286 | QHBox::resizeEvent( e ); |
284 | 287 | ||
285 | if ( sysTray ) | 288 | if ( sysTray ) |
286 | sysTray->show(); | 289 | sysTray->show(); |
287 | 290 | ||
288 | qWarning("TaskBar::resize event"); | 291 | owarn << "TaskBar::resize event" << oendl; |
289 | } | 292 | } |
290 | 293 | ||
291 | void TaskBar::styleChange( QStyle &s ) | 294 | void TaskBar::styleChange( QStyle &s ) |
292 | { | 295 | { |
293 | QHBox::styleChange( s ); | 296 | QHBox::styleChange( s ); |
294 | calcMaxWindowRect(); | 297 | calcMaxWindowRect(); |
295 | } | 298 | } |
296 | 299 | ||
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp index e32cf41..4b764e3 100644 --- a/core/launcher/transferserver.cpp +++ b/core/launcher/transferserver.cpp | |||
@@ -12,66 +12,55 @@ | |||
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 _XOPEN_SOURCE | 20 | #include "transferserver.h" |
21 | 21 | ||
22 | /* OPIE */ | ||
23 | #include <opie2/odebug.h> | ||
22 | #include <opie2/oglobal.h> | 24 | #include <opie2/oglobal.h> |
25 | #include <qtopia/qprocess.h> | ||
26 | #include <qtopia/process.h> | ||
27 | #include <qtopia/private/contact.h> | ||
28 | #include <qtopia/version.h> | ||
29 | #ifdef Q_WS_QWS | ||
30 | #include <qtopia/qcopenvelope_qws.h> | ||
31 | #endif | ||
32 | using namespace Opie::Core; | ||
23 | 33 | ||
24 | #ifndef Q_OS_WIN32 | 34 | /* QT */ |
35 | #include <qtextstream.h> | ||
36 | #include <qmessagebox.h> | ||
37 | |||
38 | /* STD */ | ||
25 | #include <pwd.h> | 39 | #include <pwd.h> |
26 | #include <sys/types.h> | 40 | #include <sys/types.h> |
27 | #include <unistd.h> | 41 | #include <unistd.h> |
28 | #include <stdlib.h> | 42 | #include <stdlib.h> |
29 | #include <time.h> | 43 | #include <time.h> |
30 | 44 | ||
31 | #ifndef Q_OS_MACX | 45 | #ifndef Q_OS_MACX |
32 | #include <shadow.h> | 46 | #include <shadow.h> |
33 | #include <crypt.h> | 47 | #include <crypt.h> |
34 | #endif /* Q_OS_MACX */ | 48 | #endif /* Q_OS_MACX */ |
35 | 49 | ||
36 | #else | ||
37 | #include <stdlib.h> | ||
38 | #include <time.h> | ||
39 | #endif | ||
40 | |||
41 | |||
42 | #if defined(_OS_LINUX_) | ||
43 | #include <shadow.h> | ||
44 | #endif | ||
45 | |||
46 | #include <qtextstream.h> | ||
47 | #include <qmessagebox.h> | ||
48 | //#include <qtopia/qcopchannel_qws.h> | ||
49 | #include <qtopia/process.h> | ||
50 | #include <qtopia/private/contact.h> | ||
51 | #include <qtopia/version.h> | ||
52 | #ifdef Q_WS_QWS | ||
53 | #include <qtopia/qcopenvelope_qws.h> | ||
54 | #endif | ||
55 | |||
56 | |||
57 | #include "transferserver.h" | ||
58 | #include <qtopia/qprocess.h> | ||
59 | |||
60 | const int block_size = 51200; | 50 | const int block_size = 51200; |
61 | 51 | ||
62 | using namespace Opie::Core; | ||
63 | TransferServer::TransferServer( Q_UINT16 port, QObject *parent, | 52 | TransferServer::TransferServer( Q_UINT16 port, QObject *parent, |
64 | const char* name) | 53 | const char* name) |
65 | : QServerSocket( port, 1, parent, name ) | 54 | : QServerSocket( port, 1, parent, name ) |
66 | { | 55 | { |
67 | connections.setAutoDelete( TRUE ); | 56 | connections.setAutoDelete( TRUE ); |
68 | if ( !ok() ) | 57 | if ( !ok() ) |
69 | qWarning( "Failed to bind to port %d", port ); | 58 | owarn << "Failed to bind to port " << port << "" << oendl; |
70 | } | 59 | } |
71 | 60 | ||
72 | void TransferServer::authorizeConnections() | 61 | void TransferServer::authorizeConnections() |
73 | { | 62 | { |
74 | QListIterator<ServerPI> it(connections); | 63 | QListIterator<ServerPI> it(connections); |
75 | while ( it.current() ) { | 64 | while ( it.current() ) { |
76 | if ( !it.current()->verifyAuthorised() ) { | 65 | if ( !it.current()->verifyAuthorised() ) { |
77 | disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) ); | 66 | disconnect( it.current(), SIGNAL(connectionClosed(ServerPI*)), this, SLOT( closed(ServerPI*)) ); |
@@ -366,25 +355,25 @@ bool ServerPI::verifyAuthorised() | |||
366 | state = Forbidden; | 355 | state = Forbidden; |
367 | return FALSE; | 356 | return FALSE; |
368 | } | 357 | } |
369 | return TRUE; | 358 | return TRUE; |
370 | } | 359 | } |
371 | 360 | ||
372 | void ServerPI::connectionClosed() | 361 | void ServerPI::connectionClosed() |
373 | { | 362 | { |
374 | // qDebug( "Debug: Connection closed" ); | 363 | // odebug << "Debug: Connection closed" << oendl; |
375 | emit connectionClosed(this); | 364 | emit connectionClosed(this); |
376 | } | 365 | } |
377 | 366 | ||
378 | void ServerPI::send( const QString& msg ) | 367 | void ServerPI::send( const QString& msg ) |
379 | { | 368 | { |
380 | QTextStream os( this ); | 369 | QTextStream os( this ); |
381 | os << msg << endl; | 370 | os << msg << endl; |
382 | //qDebug( "Reply: %s", msg.latin1() ); | 371 | //odebug << "Reply: " << msg << "" << oendl; |
383 | } | 372 | } |
384 | 373 | ||
385 | void ServerPI::read() | 374 | void ServerPI::read() |
386 | { | 375 | { |
387 | while ( canReadLine() ) | 376 | while ( canReadLine() ) |
388 | process( readLine().stripWhiteSpace() ); | 377 | process( readLine().stripWhiteSpace() ); |
389 | } | 378 | } |
390 | 379 | ||
@@ -415,17 +404,17 @@ bool ServerPI::checkWriteFile( const QString& file ) | |||
415 | if ( fi.exists() ) | 404 | if ( fi.exists() ) |
416 | if ( !QFile( filename ).remove() ) | 405 | if ( !QFile( filename ).remove() ) |
417 | return FALSE; | 406 | return FALSE; |
418 | return TRUE; | 407 | return TRUE; |
419 | } | 408 | } |
420 | 409 | ||
421 | void ServerPI::process( const QString& message ) | 410 | void ServerPI::process( const QString& message ) |
422 | { | 411 | { |
423 | //qDebug( "Command: %s", message.latin1() ); | 412 | //odebug << "Command: " << message << "" << oendl; |
424 | 413 | ||
425 | // split message using "," as separator | 414 | // split message using "," as separator |
426 | QStringList msg = QStringList::split( " ", message ); | 415 | QStringList msg = QStringList::split( " ", message ); |
427 | if ( msg.isEmpty() ) return; | 416 | if ( msg.isEmpty() ) return; |
428 | 417 | ||
429 | // command token | 418 | // command token |
430 | QString cmd = msg[0].upper(); | 419 | QString cmd = msg[0].upper(); |
431 | 420 | ||
@@ -439,17 +428,17 @@ void ServerPI::process( const QString& message ) | |||
439 | if ( msg.count() >= 2 ) { | 428 | if ( msg.count() >= 2 ) { |
440 | QStringList copy( msg ); | 429 | QStringList copy( msg ); |
441 | // FIXME: for Qt3 | 430 | // FIXME: for Qt3 |
442 | // copy.pop_front() | 431 | // copy.pop_front() |
443 | copy.remove( copy.begin() ); | 432 | copy.remove( copy.begin() ); |
444 | args = copy.join( " " ); | 433 | args = copy.join( " " ); |
445 | } | 434 | } |
446 | 435 | ||
447 | //qDebug( "args: %s", args.latin1() ); | 436 | //odebug << "args: " << args << "" << oendl; |
448 | 437 | ||
449 | // we always respond to QUIT, regardless of state | 438 | // we always respond to QUIT, regardless of state |
450 | if ( cmd == "QUIT" ) { | 439 | if ( cmd == "QUIT" ) { |
451 | send( "211 Good bye!" ); // No tr | 440 | send( "211 Good bye!" ); // No tr |
452 | close(); | 441 | close(); |
453 | return; | 442 | return; |
454 | } | 443 | } |
455 | 444 | ||
@@ -578,17 +567,17 @@ void ServerPI::process( const QString& message ) | |||
578 | // retrieve (RETR) | 567 | // retrieve (RETR) |
579 | else if ( cmd == "RETR" ) | 568 | else if ( cmd == "RETR" ) |
580 | if ( !args.isEmpty() && checkReadFile( absFilePath( args ) ) | 569 | if ( !args.isEmpty() && checkReadFile( absFilePath( args ) ) |
581 | || backupRestoreGzip( absFilePath( args ) ) ) { | 570 | || backupRestoreGzip( absFilePath( args ) ) ) { |
582 | send( "150 File status okay" ); // No tr | 571 | send( "150 File status okay" ); // No tr |
583 | sendFile( absFilePath( args ) ); | 572 | sendFile( absFilePath( args ) ); |
584 | } | 573 | } |
585 | else { | 574 | else { |
586 | qDebug("550 Requested action not taken"); | 575 | odebug << "550 Requested action not taken" << oendl; |
587 | send( "550 Requested action not taken" ); // No tr | 576 | send( "550 Requested action not taken" ); // No tr |
588 | } | 577 | } |
589 | 578 | ||
590 | // store (STOR) | 579 | // store (STOR) |
591 | else if ( cmd == "STOR" ) | 580 | else if ( cmd == "STOR" ) |
592 | if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) { | 581 | if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) { |
593 | send( "150 File status okay" ); // No tr | 582 | send( "150 File status okay" ); // No tr |
594 | retrieveFile( absFilePath( args ) ); | 583 | retrieveFile( absFilePath( args ) ); |
@@ -684,17 +673,17 @@ void ServerPI::process( const QString& message ) | |||
684 | else | 673 | else |
685 | send( "550 Requested action not taken" ); // No tr | 674 | send( "550 Requested action not taken" ); // No tr |
686 | } | 675 | } |
687 | } | 676 | } |
688 | 677 | ||
689 | // make directory (MKD) | 678 | // make directory (MKD) |
690 | else if ( cmd == "MKD" ) { | 679 | else if ( cmd == "MKD" ) { |
691 | if ( args.isEmpty() ) { | 680 | if ( args.isEmpty() ) { |
692 | qDebug(" Error: no arg"); | 681 | odebug << " Error: no arg" << oendl; |
693 | send( "500 Syntax error, command unrecognized" ); // No tr | 682 | send( "500 Syntax error, command unrecognized" ); // No tr |
694 | } | 683 | } |
695 | else { | 684 | else { |
696 | QDir dir; | 685 | QDir dir; |
697 | if ( dir.mkdir( absFilePath( args ), TRUE ) ) | 686 | if ( dir.mkdir( absFilePath( args ), TRUE ) ) |
698 | send( "250 Requested file action okay, completed." ); // No tr | 687 | send( "250 Requested file action okay, completed." ); // No tr |
699 | else | 688 | else |
700 | send( "550 Requested action not taken" ); // No tr | 689 | send( "550 Requested action not taken" ); // No tr |
@@ -724,25 +713,25 @@ void ServerPI::process( const QString& message ) | |||
724 | else { | 713 | else { |
725 | if ( !gzipfile ) | 714 | if ( !gzipfile ) |
726 | send( "213 " + QString::number( fi.size() ) ); | 715 | send( "213 " + QString::number( fi.size() ) ); |
727 | else { | 716 | else { |
728 | Process duproc( QString("du") ); | 717 | Process duproc( QString("du") ); |
729 | duproc.addArgument("-s"); | 718 | duproc.addArgument("-s"); |
730 | QString in, out; | 719 | QString in, out; |
731 | if ( !duproc.exec(in, out) ) { | 720 | if ( !duproc.exec(in, out) ) { |
732 | qDebug("du process failed; just sending back 1K"); | 721 | odebug << "du process failed; just sending back 1K" << oendl; |
733 | send( "213 1024"); | 722 | send( "213 1024"); |
734 | } | 723 | } |
735 | else { | 724 | else { |
736 | QString size = out.left( out.find("\t") ); | 725 | QString size = out.left( out.find("\t") ); |
737 | int guess = size.toInt()/5; | 726 | int guess = size.toInt()/5; |
738 | if ( filePath.contains("doc") ) // No tr | 727 | if ( filePath.contains("doc") ) // No tr |
739 | guess *= 1000; | 728 | guess *= 1000; |
740 | qDebug("sending back gzip guess of %d", guess); | 729 | odebug << "sending back gzip guess of " << guess << "" << oendl; |
741 | send( "213 " + QString::number(guess) ); | 730 | send( "213 " + QString::number(guess) ); |
742 | } | 731 | } |
743 | } | 732 | } |
744 | } | 733 | } |
745 | } | 734 | } |
746 | // name list (NLST) | 735 | // name list (NLST) |
747 | else if ( cmd == "NLST" ) { | 736 | else if ( cmd == "NLST" ) { |
748 | send( "502 Command not implemented" ); // No tr | 737 | send( "502 Command not implemented" ); // No tr |
@@ -1021,42 +1010,42 @@ QString ServerPI::permissionString( QFileInfo *info ) | |||
1021 | if ( info->permission( QFileInfo::ExeOther ) ) s += "x"; | 1010 | if ( info->permission( QFileInfo::ExeOther ) ) s += "x"; |
1022 | else s += "-"; | 1011 | else s += "-"; |
1023 | 1012 | ||
1024 | return s; | 1013 | return s; |
1025 | } | 1014 | } |
1026 | 1015 | ||
1027 | void ServerPI::newConnection( int socket ) | 1016 | void ServerPI::newConnection( int socket ) |
1028 | { | 1017 | { |
1029 | //qDebug( "New incomming connection" ); | 1018 | //odebug << "New incomming connection" << oendl; |
1030 | 1019 | ||
1031 | if ( !passiv ) return; | 1020 | if ( !passiv ) return; |
1032 | 1021 | ||
1033 | if ( wait[SendFile] ) { | 1022 | if ( wait[SendFile] ) { |
1034 | QStringList targets; | 1023 | QStringList targets; |
1035 | if ( backupRestoreGzip( waitfile, targets ) ) | 1024 | if ( backupRestoreGzip( waitfile, targets ) ) |
1036 | dtp->sendGzipFile( waitfile, targets ); | 1025 | dtp->sendGzipFile( waitfile, targets ); |
1037 | else | 1026 | else |
1038 | dtp->sendFile( waitfile ); | 1027 | dtp->sendFile( waitfile ); |
1039 | dtp->setSocket( socket ); | 1028 | dtp->setSocket( socket ); |
1040 | } | 1029 | } |
1041 | else if ( wait[RetrieveFile] ) { | 1030 | else if ( wait[RetrieveFile] ) { |
1042 | qDebug("check retrieve file"); | 1031 | odebug << "check retrieve file" << oendl; |
1043 | if ( backupRestoreGzip( waitfile ) ) | 1032 | if ( backupRestoreGzip( waitfile ) ) |
1044 | dtp->retrieveGzipFile( waitfile ); | 1033 | dtp->retrieveGzipFile( waitfile ); |
1045 | else | 1034 | else |
1046 | dtp->retrieveFile( waitfile, storFileSize ); | 1035 | dtp->retrieveFile( waitfile, storFileSize ); |
1047 | dtp->setSocket( socket ); | 1036 | dtp->setSocket( socket ); |
1048 | } | 1037 | } |
1049 | else if ( wait[SendByteArray] ) { | 1038 | else if ( wait[SendByteArray] ) { |
1050 | dtp->sendByteArray( waitarray ); | 1039 | dtp->sendByteArray( waitarray ); |
1051 | dtp->setSocket( socket ); | 1040 | dtp->setSocket( socket ); |
1052 | } | 1041 | } |
1053 | else if ( wait[RetrieveByteArray] ) { | 1042 | else if ( wait[RetrieveByteArray] ) { |
1054 | qDebug("retrieve byte array"); | 1043 | odebug << "retrieve byte array" << oendl; |
1055 | dtp->retrieveByteArray(); | 1044 | dtp->retrieveByteArray(); |
1056 | dtp->setSocket( socket ); | 1045 | dtp->setSocket( socket ); |
1057 | } | 1046 | } |
1058 | else | 1047 | else |
1059 | waitsocket = socket; | 1048 | waitsocket = socket; |
1060 | 1049 | ||
1061 | for( int i = 0; i < 4; i++ ) | 1050 | for( int i = 0; i < 4; i++ ) |
1062 | wait[i] = FALSE; | 1051 | wait[i] = FALSE; |
@@ -1106,28 +1095,28 @@ ServerDTP::ServerDTP( QObject *parent, const char* name) | |||
1106 | 1095 | ||
1107 | ServerDTP::~ServerDTP() | 1096 | ServerDTP::~ServerDTP() |
1108 | { | 1097 | { |
1109 | buf.close(); | 1098 | buf.close(); |
1110 | if ( RetrieveFile == mode && file.isOpen() ) { | 1099 | if ( RetrieveFile == mode && file.isOpen() ) { |
1111 | // We're being shutdown before the client closed. | 1100 | // We're being shutdown before the client closed. |
1112 | file.close(); | 1101 | file.close(); |
1113 | if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { | 1102 | if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { |
1114 | qDebug( "STOR incomplete" ); | 1103 | odebug << "STOR incomplete" << oendl; |
1115 | file.remove(); | 1104 | file.remove(); |
1116 | } | 1105 | } |
1117 | } else { | 1106 | } else { |
1118 | file.close(); | 1107 | file.close(); |
1119 | } | 1108 | } |
1120 | createTargzProc->kill(); | 1109 | createTargzProc->kill(); |
1121 | } | 1110 | } |
1122 | 1111 | ||
1123 | void ServerDTP::extractTarDone() | 1112 | void ServerDTP::extractTarDone() |
1124 | { | 1113 | { |
1125 | qDebug("extract done"); | 1114 | odebug << "extract done" << oendl; |
1126 | #ifndef QT_NO_COP | 1115 | #ifndef QT_NO_COP |
1127 | QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); | 1116 | QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); |
1128 | e << file.name(); | 1117 | e << file.name(); |
1129 | #endif | 1118 | #endif |
1130 | } | 1119 | } |
1131 | 1120 | ||
1132 | void ServerDTP::connected() | 1121 | void ServerDTP::connected() |
1133 | { | 1122 | { |
@@ -1135,17 +1124,17 @@ void ServerDTP::connected() | |||
1135 | switch ( mode ) { | 1124 | switch ( mode ) { |
1136 | case SendFile : | 1125 | case SendFile : |
1137 | if ( !file.exists() || !file.open( IO_ReadOnly) ) { | 1126 | if ( !file.exists() || !file.open( IO_ReadOnly) ) { |
1138 | emit failed(); | 1127 | emit failed(); |
1139 | mode = Idle; | 1128 | mode = Idle; |
1140 | return; | 1129 | return; |
1141 | } | 1130 | } |
1142 | 1131 | ||
1143 | //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); | 1132 | //odebug << "Debug: Sending file '" << file.name() << "'" << oendl; |
1144 | 1133 | ||
1145 | bytes_written = 0; | 1134 | bytes_written = 0; |
1146 | if ( file.size() == 0 ) { | 1135 | if ( file.size() == 0 ) { |
1147 | //make sure it doesn't hang on empty files | 1136 | //make sure it doesn't hang on empty files |
1148 | file.close(); | 1137 | file.close(); |
1149 | emit completed(); | 1138 | emit completed(); |
1150 | mode = Idle; | 1139 | mode = Idle; |
1151 | } else { | 1140 | } else { |
@@ -1156,34 +1145,34 @@ void ServerDTP::connected() | |||
1156 | int bytes = file.readBlock( s.data(), block_size ); | 1145 | int bytes = file.readBlock( s.data(), block_size ); |
1157 | writeBlock( s.data(), bytes ); | 1146 | writeBlock( s.data(), bytes ); |
1158 | } | 1147 | } |
1159 | } | 1148 | } |
1160 | break; | 1149 | break; |
1161 | case SendGzipFile: | 1150 | case SendGzipFile: |
1162 | if ( createTargzProc->isRunning() ) { | 1151 | if ( createTargzProc->isRunning() ) { |
1163 | // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY | 1152 | // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY |
1164 | qWarning("Previous tar --gzip process is still running; killing it..."); | 1153 | owarn << "Previous tar --gzip process is still running; killing it..." << oendl; |
1165 | createTargzProc->kill(); | 1154 | createTargzProc->kill(); |
1166 | } | 1155 | } |
1167 | 1156 | ||
1168 | bytes_written = 0; | 1157 | bytes_written = 0; |
1169 | qDebug("==>start send tar process"); | 1158 | odebug << "==>start send tar process" << oendl; |
1170 | if ( !createTargzProc->start() ) | 1159 | if ( !createTargzProc->start() ) |
1171 | qWarning("Error starting %s", | 1160 | qWarning("Error starting %s", |
1172 | createTargzProc->arguments().join(" ").latin1()); | 1161 | createTargzProc->arguments().join(" ").latin1()); |
1173 | break; | 1162 | break; |
1174 | case SendBuffer: | 1163 | case SendBuffer: |
1175 | if ( !buf.open( IO_ReadOnly) ) { | 1164 | if ( !buf.open( IO_ReadOnly) ) { |
1176 | emit failed(); | 1165 | emit failed(); |
1177 | mode = Idle; | 1166 | mode = Idle; |
1178 | return; | 1167 | return; |
1179 | } | 1168 | } |
1180 | 1169 | ||
1181 | // qDebug( "Debug: Sending byte array" ); | 1170 | // odebug << "Debug: Sending byte array" << oendl; |
1182 | bytes_written = 0; | 1171 | bytes_written = 0; |
1183 | while( !buf.atEnd() ) | 1172 | while( !buf.atEnd() ) |
1184 | putch( buf.getch() ); | 1173 | putch( buf.getch() ); |
1185 | buf.close(); | 1174 | buf.close(); |
1186 | break; | 1175 | break; |
1187 | case RetrieveFile: | 1176 | case RetrieveFile: |
1188 | // retrieve file mode | 1177 | // retrieve file mode |
1189 | if ( file.exists() && !file.remove() ) { | 1178 | if ( file.exists() && !file.remove() ) { |
@@ -1192,39 +1181,39 @@ void ServerDTP::connected() | |||
1192 | return; | 1181 | return; |
1193 | } | 1182 | } |
1194 | 1183 | ||
1195 | if ( !file.open( IO_WriteOnly) ) { | 1184 | if ( !file.open( IO_WriteOnly) ) { |
1196 | emit failed(); | 1185 | emit failed(); |
1197 | mode = Idle; | 1186 | mode = Idle; |
1198 | return; | 1187 | return; |
1199 | } | 1188 | } |
1200 | // qDebug( "Debug: Retrieving file %s", file.name().latin1() ); | 1189 | // odebug << "Debug: Retrieving file " << file.name() << "" << oendl; |
1201 | break; | 1190 | break; |
1202 | case RetrieveGzipFile: | 1191 | case RetrieveGzipFile: |
1203 | qDebug("=-> starting tar process to receive .tgz file"); | 1192 | odebug << "=-> starting tar process to receive .tgz file" << oendl; |
1204 | break; | 1193 | break; |
1205 | case RetrieveBuffer: | 1194 | case RetrieveBuffer: |
1206 | // retrieve buffer mode | 1195 | // retrieve buffer mode |
1207 | if ( !buf.open( IO_WriteOnly) ) { | 1196 | if ( !buf.open( IO_WriteOnly) ) { |
1208 | emit failed(); | 1197 | emit failed(); |
1209 | mode = Idle; | 1198 | mode = Idle; |
1210 | return; | 1199 | return; |
1211 | } | 1200 | } |
1212 | // qDebug( "Debug: Retrieving byte array" ); | 1201 | // odebug << "Debug: Retrieving byte array" << oendl; |
1213 | break; | 1202 | break; |
1214 | case Idle: | 1203 | case Idle: |
1215 | qDebug("connection established but mode set to Idle; BUG!"); | 1204 | odebug << "connection established but mode set to Idle; BUG!" << oendl; |
1216 | break; | 1205 | break; |
1217 | } | 1206 | } |
1218 | } | 1207 | } |
1219 | 1208 | ||
1220 | void ServerDTP::connectionClosed() | 1209 | void ServerDTP::connectionClosed() |
1221 | { | 1210 | { |
1222 | //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written ); | 1211 | //odebug << "Debug: Data connection closed " << bytes_written << " bytes written" << oendl; |
1223 | 1212 | ||
1224 | // send file mode | 1213 | // send file mode |
1225 | if ( SendFile == mode ) { | 1214 | if ( SendFile == mode ) { |
1226 | if ( bytes_written == file.size() ) | 1215 | if ( bytes_written == file.size() ) |
1227 | emit completed(); | 1216 | emit completed(); |
1228 | else | 1217 | else |
1229 | emit failed(); | 1218 | emit failed(); |
1230 | } | 1219 | } |
@@ -1236,26 +1225,26 @@ void ServerDTP::connectionClosed() | |||
1236 | else | 1225 | else |
1237 | emit failed(); | 1226 | emit failed(); |
1238 | } | 1227 | } |
1239 | 1228 | ||
1240 | // retrieve file mode | 1229 | // retrieve file mode |
1241 | else if ( RetrieveFile == mode ) { | 1230 | else if ( RetrieveFile == mode ) { |
1242 | file.close(); | 1231 | file.close(); |
1243 | if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { | 1232 | if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { |
1244 | qDebug( "STOR incomplete" ); | 1233 | odebug << "STOR incomplete" << oendl; |
1245 | file.remove(); | 1234 | file.remove(); |
1246 | emit failed(); | 1235 | emit failed(); |
1247 | } else { | 1236 | } else { |
1248 | emit completed(); | 1237 | emit completed(); |
1249 | } | 1238 | } |
1250 | } | 1239 | } |
1251 | 1240 | ||
1252 | else if ( RetrieveGzipFile == mode ) { | 1241 | else if ( RetrieveGzipFile == mode ) { |
1253 | qDebug("Done writing ungzip file; closing input"); | 1242 | odebug << "Done writing ungzip file; closing input" << oendl; |
1254 | retrieveTargzProc->flushStdin(); | 1243 | retrieveTargzProc->flushStdin(); |
1255 | retrieveTargzProc->closeStdin(); | 1244 | retrieveTargzProc->closeStdin(); |
1256 | } | 1245 | } |
1257 | 1246 | ||
1258 | // retrieve buffer mode | 1247 | // retrieve buffer mode |
1259 | else if ( RetrieveBuffer == mode ) { | 1248 | else if ( RetrieveBuffer == mode ) { |
1260 | buf.close(); | 1249 | buf.close(); |
1261 | emit completed(); | 1250 | emit completed(); |
@@ -1267,34 +1256,34 @@ void ServerDTP::connectionClosed() | |||
1267 | void ServerDTP::bytesWritten( int bytes ) | 1256 | void ServerDTP::bytesWritten( int bytes ) |
1268 | { | 1257 | { |
1269 | bytes_written += bytes; | 1258 | bytes_written += bytes; |
1270 | 1259 | ||
1271 | // send file mode | 1260 | // send file mode |
1272 | if ( SendFile == mode ) { | 1261 | if ( SendFile == mode ) { |
1273 | 1262 | ||
1274 | if ( bytes_written == file.size() ) { | 1263 | if ( bytes_written == file.size() ) { |
1275 | // qDebug( "Debug: Sending complete: %d bytes", file.size() ); | 1264 | // odebug << "Debug: Sending complete: " << file.size() << " bytes" << oendl; |
1276 | file.close(); | 1265 | file.close(); |
1277 | emit completed(); | 1266 | emit completed(); |
1278 | mode = Idle; | 1267 | mode = Idle; |
1279 | } | 1268 | } |
1280 | else if( !file.atEnd() ) { | 1269 | else if( !file.atEnd() ) { |
1281 | QCString s; | 1270 | QCString s; |
1282 | s.resize( block_size ); | 1271 | s.resize( block_size ); |
1283 | int bytes = file.readBlock( s.data(), block_size ); | 1272 | int bytes = file.readBlock( s.data(), block_size ); |
1284 | writeBlock( s.data(), bytes ); | 1273 | writeBlock( s.data(), bytes ); |
1285 | } | 1274 | } |
1286 | } | 1275 | } |
1287 | 1276 | ||
1288 | // send buffer mode | 1277 | // send buffer mode |
1289 | if ( SendBuffer == mode ) { | 1278 | if ( SendBuffer == mode ) { |
1290 | 1279 | ||
1291 | if ( bytes_written == buf.size() ) { | 1280 | if ( bytes_written == buf.size() ) { |
1292 | // qDebug( "Debug: Sending complete: %d bytes", buf.size() ); | 1281 | // odebug << "Debug: Sending complete: " << buf.size() << " bytes" << oendl; |
1293 | emit completed(); | 1282 | emit completed(); |
1294 | mode = Idle; | 1283 | mode = Idle; |
1295 | } | 1284 | } |
1296 | } | 1285 | } |
1297 | } | 1286 | } |
1298 | 1287 | ||
1299 | void ServerDTP::readyRead() | 1288 | void ServerDTP::readyRead() |
1300 | { | 1289 | { |
@@ -1308,37 +1297,37 @@ void ServerDTP::readyRead() | |||
1308 | else if ( RetrieveGzipFile == mode ) { | 1297 | else if ( RetrieveGzipFile == mode ) { |
1309 | if ( !retrieveTargzProc->isRunning() ) | 1298 | if ( !retrieveTargzProc->isRunning() ) |
1310 | retrieveTargzProc->start(); | 1299 | retrieveTargzProc->start(); |
1311 | 1300 | ||
1312 | QByteArray s; | 1301 | QByteArray s; |
1313 | s.resize( bytesAvailable() ); | 1302 | s.resize( bytesAvailable() ); |
1314 | readBlock( s.data(), bytesAvailable() ); | 1303 | readBlock( s.data(), bytesAvailable() ); |
1315 | retrieveTargzProc->writeToStdin( s ); | 1304 | retrieveTargzProc->writeToStdin( s ); |
1316 | qDebug("wrote %d bytes to ungzip ", s.size() ); | 1305 | odebug << "wrote " << s.size() << " bytes to ungzip " << oendl; |
1317 | } | 1306 | } |
1318 | // retrieve buffer mode | 1307 | // retrieve buffer mode |
1319 | else if ( RetrieveBuffer == mode ) { | 1308 | else if ( RetrieveBuffer == mode ) { |
1320 | QCString s; | 1309 | QCString s; |
1321 | s.resize( bytesAvailable() ); | 1310 | s.resize( bytesAvailable() ); |
1322 | readBlock( s.data(), bytesAvailable() ); | 1311 | readBlock( s.data(), bytesAvailable() ); |
1323 | buf.writeBlock( s.data(), s.size() ); | 1312 | buf.writeBlock( s.data(), s.size() ); |
1324 | } | 1313 | } |
1325 | } | 1314 | } |
1326 | 1315 | ||
1327 | void ServerDTP::writeTargzBlock() | 1316 | void ServerDTP::writeTargzBlock() |
1328 | { | 1317 | { |
1329 | QByteArray block = createTargzProc->readStdout(); | 1318 | QByteArray block = createTargzProc->readStdout(); |
1330 | writeBlock( block.data(), block.size() ); | 1319 | writeBlock( block.data(), block.size() ); |
1331 | qDebug("writeTargzBlock %d", block.size()); | 1320 | odebug << "writeTargzBlock " << block.size() << "" << oendl; |
1332 | } | 1321 | } |
1333 | 1322 | ||
1334 | void ServerDTP::targzDone() | 1323 | void ServerDTP::targzDone() |
1335 | { | 1324 | { |
1336 | qDebug("tar and gzip done"); | 1325 | odebug << "tar and gzip done" << oendl; |
1337 | emit completed(); | 1326 | emit completed(); |
1338 | mode = Idle; | 1327 | mode = Idle; |
1339 | disconnect( createTargzProc, SIGNAL( readyReadStdout() ), | 1328 | disconnect( createTargzProc, SIGNAL( readyReadStdout() ), |
1340 | this, SLOT( writeTargzBlock() ) ); | 1329 | this, SLOT( writeTargzBlock() ) ); |
1341 | } | 1330 | } |
1342 | 1331 | ||
1343 | void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) | 1332 | void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) |
1344 | { | 1333 | { |
@@ -1365,17 +1354,17 @@ void ServerDTP::sendGzipFile( const QString &fn, | |||
1365 | const QStringList &archiveTargets ) | 1354 | const QStringList &archiveTargets ) |
1366 | { | 1355 | { |
1367 | mode = SendGzipFile; | 1356 | mode = SendGzipFile; |
1368 | file.setName( fn ); | 1357 | file.setName( fn ); |
1369 | 1358 | ||
1370 | QStringList args = "targzip"; | 1359 | QStringList args = "targzip"; |
1371 | //args += "-cv"; | 1360 | //args += "-cv"; |
1372 | args += archiveTargets; | 1361 | args += archiveTargets; |
1373 | qDebug("sendGzipFile %s", args.join(" ").latin1() ); | 1362 | odebug << "sendGzipFile " << args.join(" ") << "" << oendl; |
1374 | createTargzProc->setArguments( args ); | 1363 | createTargzProc->setArguments( args ); |
1375 | connect( createTargzProc, | 1364 | connect( createTargzProc, |
1376 | SIGNAL( readyReadStdout() ), SLOT( writeTargzBlock() ) ); | 1365 | SIGNAL( readyReadStdout() ), SLOT( writeTargzBlock() ) ); |
1377 | } | 1366 | } |
1378 | 1367 | ||
1379 | void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port, int fileSize ) | 1368 | void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port, int fileSize ) |
1380 | { | 1369 | { |
1381 | recvFileSize = fileSize; | 1370 | recvFileSize = fileSize; |
@@ -1388,17 +1377,17 @@ void ServerDTP::retrieveFile( const QString fn, int fileSize ) | |||
1388 | { | 1377 | { |
1389 | recvFileSize = fileSize; | 1378 | recvFileSize = fileSize; |
1390 | file.setName( fn ); | 1379 | file.setName( fn ); |
1391 | mode = RetrieveFile; | 1380 | mode = RetrieveFile; |
1392 | } | 1381 | } |
1393 | 1382 | ||
1394 | void ServerDTP::retrieveGzipFile( const QString &fn ) | 1383 | void ServerDTP::retrieveGzipFile( const QString &fn ) |
1395 | { | 1384 | { |
1396 | qDebug("retrieveGzipFile %s", fn.latin1()); | 1385 | odebug << "retrieveGzipFile " << fn << "" << oendl; |
1397 | file.setName( fn ); | 1386 | file.setName( fn ); |
1398 | mode = RetrieveGzipFile; | 1387 | mode = RetrieveGzipFile; |
1399 | 1388 | ||
1400 | retrieveTargzProc->setArguments( "targunzip" ); | 1389 | retrieveTargzProc->setArguments( "targunzip" ); |
1401 | connect( retrieveTargzProc, SIGNAL( processExited() ), | 1390 | connect( retrieveTargzProc, SIGNAL( processExited() ), |
1402 | SLOT( extractTarDone() ) ); | 1391 | SLOT( extractTarDone() ) ); |
1403 | } | 1392 | } |
1404 | 1393 | ||