-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 58d8d34..30c0d2f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -246,193 +246,195 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
246 | mView->show(); | 246 | mView->show(); |
247 | delete splash; | 247 | delete splash; |
248 | if ( newFile ) | 248 | if ( newFile ) |
249 | mView->updateConfig(); | 249 | mView->updateConfig(); |
250 | // qApp->processEvents(); | 250 | // qApp->processEvents(); |
251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 251 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
252 | //fillSyncMenu(); | 252 | //fillSyncMenu(); |
253 | 253 | ||
254 | 254 | ||
255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 255 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 256 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 257 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
258 | mSyncManager->setDefaultFileName( defaultFileName()); | 258 | mSyncManager->setDefaultFileName( defaultFileName()); |
259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 259 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
260 | mSyncManager->fillSyncMenu(); | 260 | mSyncManager->fillSyncMenu(); |
261 | 261 | ||
262 | 262 | ||
263 | 263 | ||
264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 264 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
265 | if ( showWarning ) { | 265 | if ( showWarning ) { |
266 | KMessageBox::information( this, | 266 | KMessageBox::information( this, |
267 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 267 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
268 | qApp->processEvents(); | 268 | qApp->processEvents(); |
269 | mView->dialogManager()->showSyncOptions(); | 269 | mView->dialogManager()->showSyncOptions(); |
270 | } | 270 | } |
271 | 271 | ||
272 | //US listen for result adressed from Ka/Pi | 272 | //US listen for result adressed from Ka/Pi |
273 | #ifndef DESKTOP_VERSION | 273 | #ifndef DESKTOP_VERSION |
274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 274 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
275 | #endif | 275 | #endif |
276 | } | 276 | } |
277 | MainWindow::~MainWindow() | 277 | MainWindow::~MainWindow() |
278 | { | 278 | { |
279 | //qDebug("MainWindow::~MainWindow() "); | 279 | //qDebug("MainWindow::~MainWindow() "); |
280 | //save toolbar location | 280 | //save toolbar location |
281 | delete mCalendar; | 281 | delete mCalendar; |
282 | delete mSyncManager; | 282 | delete mSyncManager; |
283 | 283 | ||
284 | 284 | ||
285 | } | 285 | } |
286 | void MainWindow::showMaximized () | 286 | void MainWindow::showMaximized () |
287 | { | 287 | { |
288 | #ifndef DESKTOP_VERSION | 288 | #ifndef DESKTOP_VERSION |
289 | if ( ! globalFlagBlockStartup ) | 289 | if ( ! globalFlagBlockStartup ) |
290 | if ( mClosed ) | 290 | if ( mClosed ) |
291 | mView->goToday(); | 291 | mView->goToday(); |
292 | #endif | 292 | #endif |
293 | QWidget::showMaximized () ; | 293 | QWidget::showMaximized () ; |
294 | mClosed = false; | 294 | mClosed = false; |
295 | } | 295 | } |
296 | void MainWindow::closeEvent( QCloseEvent* ce ) | 296 | void MainWindow::closeEvent( QCloseEvent* ce ) |
297 | { | 297 | { |
298 | 298 | ||
299 | 299 | ||
300 | 300 | ||
301 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 301 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
302 | saveOnClose(); | 302 | saveOnClose(); |
303 | mClosed = true; | 303 | mClosed = true; |
304 | ce->accept(); | 304 | ce->accept(); |
305 | return; | 305 | return; |
306 | 306 | ||
307 | } | 307 | } |
308 | 308 | ||
309 | switch( QMessageBox::information( this, "KO/Pi", | 309 | switch( QMessageBox::information( this, "KO/Pi", |
310 | i18n("Do you really want\nto close KO/Pi?"), | 310 | i18n("Do you really want\nto close KO/Pi?"), |
311 | i18n("Close"), i18n("No"), | 311 | i18n("Close"), i18n("No"), |
312 | 0, 0 ) ) { | 312 | 0, 0 ) ) { |
313 | case 0: | 313 | case 0: |
314 | saveOnClose(); | 314 | saveOnClose(); |
315 | mClosed = true; | 315 | mClosed = true; |
316 | ce->accept(); | 316 | ce->accept(); |
317 | break; | 317 | break; |
318 | case 1: | 318 | case 1: |
319 | ce->ignore(); | 319 | ce->ignore(); |
320 | break; | 320 | break; |
321 | case 2: | 321 | case 2: |
322 | 322 | ||
323 | default: | 323 | default: |
324 | break; | 324 | break; |
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | ||
328 | } | 328 | } |
329 | 329 | ||
330 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 330 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
331 | { | 331 | { |
332 | QDataStream stream( data, IO_ReadOnly ); | 332 | QDataStream stream( data, IO_ReadOnly ); |
333 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 333 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
334 | //QString datamess; | 334 | //QString datamess; |
335 | //qDebug("message "); | 335 | //qDebug("message "); |
336 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 336 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
337 | 337 | ||
338 | if ( cmsg == "setDocument(QString)" ) { | 338 | if ( cmsg == "setDocument(QString)" ) { |
339 | QDataStream stream( data, IO_ReadOnly ); | 339 | QDataStream stream( data, IO_ReadOnly ); |
340 | QString fileName; | 340 | QString fileName; |
341 | stream >> fileName; | 341 | stream >> fileName; |
342 | qDebug("filename %s ", fileName.latin1()); | 342 | //qDebug("filename %s ", fileName.latin1()); |
343 | showMaximized(); | ||
344 | raise(); | ||
343 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 345 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
344 | mSyncManager->slotSyncMenu( 1002 ); | 346 | mSyncManager->slotSyncMenu( 1002 ); |
345 | return; | 347 | return; |
346 | } | 348 | } |
347 | 349 | ||
348 | if ( cmsg == "-writeFile" ) { | 350 | if ( cmsg == "-writeFile" ) { |
349 | // I made from the "-writeFile" an "-writeAlarm" | 351 | // I made from the "-writeFile" an "-writeAlarm" |
350 | mView->viewManager()->showWhatsNextView(); | 352 | mView->viewManager()->showWhatsNextView(); |
351 | mCalendar->checkAlarmForIncidence( 0, true); | 353 | mCalendar->checkAlarmForIncidence( 0, true); |
352 | showMaximized(); | 354 | showMaximized(); |
353 | raise(); | 355 | raise(); |
354 | return; | 356 | return; |
355 | 357 | ||
356 | } | 358 | } |
357 | if ( cmsg == "-writeFileSilent" ) { | 359 | if ( cmsg == "-writeFileSilent" ) { |
358 | // I made from the "-writeFile" an "-writeAlarm" | 360 | // I made from the "-writeFile" an "-writeAlarm" |
359 | // mView->viewManager()->showWhatsNextView(); | 361 | // mView->viewManager()->showWhatsNextView(); |
360 | mCalendar->checkAlarmForIncidence( 0, true); | 362 | mCalendar->checkAlarmForIncidence( 0, true); |
361 | //showMaximized(); | 363 | //showMaximized(); |
362 | //raise(); | 364 | //raise(); |
363 | hide(); | 365 | hide(); |
364 | return; | 366 | return; |
365 | } | 367 | } |
366 | if ( cmsg == "-newCountdown" ) { | 368 | if ( cmsg == "-newCountdown" ) { |
367 | qDebug("newCountdown "); | 369 | qDebug("newCountdown "); |
368 | 370 | ||
369 | } | 371 | } |
370 | QString msg ; | 372 | QString msg ; |
371 | QString allmsg = cmsg; | 373 | QString allmsg = cmsg; |
372 | while ( allmsg.length() > 0 ) { | 374 | while ( allmsg.length() > 0 ) { |
373 | int nextC = allmsg.find( "-", 1 ); | 375 | int nextC = allmsg.find( "-", 1 ); |
374 | if ( nextC == -1 ) { | 376 | if ( nextC == -1 ) { |
375 | msg = allmsg; | 377 | msg = allmsg; |
376 | allmsg = ""; | 378 | allmsg = ""; |
377 | } else{ | 379 | } else{ |
378 | msg = allmsg.left( nextC ); | 380 | msg = allmsg.left( nextC ); |
379 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 381 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
380 | } | 382 | } |
381 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 383 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
382 | if ( msg == "-newEvent" ) { | 384 | if ( msg == "-newEvent" ) { |
383 | mView->newEvent(); | 385 | mView->newEvent(); |
384 | } | 386 | } |
385 | if ( msg == "-newTodo" ) { | 387 | if ( msg == "-newTodo" ) { |
386 | mView->newTodo(); | 388 | mView->newTodo(); |
387 | 389 | ||
388 | } | 390 | } |
389 | if ( msg == "-showWN" ) { | 391 | if ( msg == "-showWN" ) { |
390 | mView->viewManager()->showWhatsNextView(); | 392 | mView->viewManager()->showWhatsNextView(); |
391 | } | 393 | } |
392 | if ( msg == "-showTodo" ) { | 394 | if ( msg == "-showTodo" ) { |
393 | mView->viewManager()->showTodoView(); | 395 | mView->viewManager()->showTodoView(); |
394 | } | 396 | } |
395 | if ( msg == "-showList" ) { | 397 | if ( msg == "-showList" ) { |
396 | mView->viewManager()->showListView(); | 398 | mView->viewManager()->showListView(); |
397 | } | 399 | } |
398 | else if ( msg == "-showDay" ) { | 400 | else if ( msg == "-showDay" ) { |
399 | mView->viewManager()->showDayView(); | 401 | mView->viewManager()->showDayView(); |
400 | } | 402 | } |
401 | else if ( msg == "-showWWeek" ) { | 403 | else if ( msg == "-showWWeek" ) { |
402 | mView->viewManager()->showWorkWeekView(); | 404 | mView->viewManager()->showWorkWeekView(); |
403 | } | 405 | } |
404 | else if ( msg == "-ringSync" ) { | 406 | else if ( msg == "-ringSync" ) { |
405 | mSyncManager->multiSync( false ); | 407 | mSyncManager->multiSync( false ); |
406 | } | 408 | } |
407 | else if ( msg == "-showWeek" ) { | 409 | else if ( msg == "-showWeek" ) { |
408 | mView->viewManager()->showWeekView(); | 410 | mView->viewManager()->showWeekView(); |
409 | } | 411 | } |
410 | else if ( msg == "-showTodo" ) { | 412 | else if ( msg == "-showTodo" ) { |
411 | mView->viewManager()->showTodoView(); | 413 | mView->viewManager()->showTodoView(); |
412 | } | 414 | } |
413 | else if ( msg == "-showJournal" ) { | 415 | else if ( msg == "-showJournal" ) { |
414 | mView->dateNavigator()->selectDates( 1 ); | 416 | mView->dateNavigator()->selectDates( 1 ); |
415 | mView->dateNavigator()->selectToday(); | 417 | mView->dateNavigator()->selectToday(); |
416 | mView->viewManager()->showJournalView(); | 418 | mView->viewManager()->showJournalView(); |
417 | } | 419 | } |
418 | else if ( msg == "-showKO" ) { | 420 | else if ( msg == "-showKO" ) { |
419 | mView->viewManager()->showNextXView(); | 421 | mView->viewManager()->showNextXView(); |
420 | } | 422 | } |
421 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 423 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
422 | mView->viewManager()->showWhatsNextView(); | 424 | mView->viewManager()->showWhatsNextView(); |
423 | } | 425 | } |
424 | else if ( msg == "-showNextXView" ) { | 426 | else if ( msg == "-showNextXView" ) { |
425 | mView->viewManager()->showNextXView(); | 427 | mView->viewManager()->showNextXView(); |
426 | } | 428 | } |
427 | 429 | ||
428 | 430 | ||
429 | } | 431 | } |
430 | 432 | ||
431 | showMaximized(); | 433 | showMaximized(); |
432 | raise(); | 434 | raise(); |
433 | } | 435 | } |
434 | 436 | ||
435 | QPixmap MainWindow::loadPixmap( QString name ) | 437 | QPixmap MainWindow::loadPixmap( QString name ) |
436 | { | 438 | { |
437 | return SmallIcon( name ); | 439 | return SmallIcon( name ); |
438 | 440 | ||