-rw-r--r-- | korganizer/mainwindow.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index fb0b4ad..1776dcc 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -328,214 +328,211 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
328 | if( !QFile::exists( defaultFileName() ) ) { | 328 | if( !QFile::exists( defaultFileName() ) ) { |
329 | QFileInfo finfo ( defaultFileName() ); | 329 | QFileInfo finfo ( defaultFileName() ); |
330 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 330 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
331 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 331 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
332 | finfo.setFile( oldFile ); | 332 | finfo.setFile( oldFile ); |
333 | if (finfo.exists() ) { | 333 | if (finfo.exists() ) { |
334 | KMessageBox::information( this, message); | 334 | KMessageBox::information( this, message); |
335 | mView->openCalendar( oldFile ); | 335 | mView->openCalendar( oldFile ); |
336 | qApp->processEvents(); | 336 | qApp->processEvents(); |
337 | } else { | 337 | } else { |
338 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 338 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
339 | finfo.setFile( oldFile ); | 339 | finfo.setFile( oldFile ); |
340 | if (finfo.exists() ) { | 340 | if (finfo.exists() ) { |
341 | KMessageBox::information( this, message); | 341 | KMessageBox::information( this, message); |
342 | mView->openCalendar( oldFile ); | 342 | mView->openCalendar( oldFile ); |
343 | qApp->processEvents(); | 343 | qApp->processEvents(); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | mView->saveCalendar( defaultFileName() ); | 346 | mView->saveCalendar( defaultFileName() ); |
347 | newFile = true; | 347 | newFile = true; |
348 | } | 348 | } |
349 | 349 | ||
350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); | 350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); |
351 | //mView->loadCalendars(); | 351 | //mView->loadCalendars(); |
352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
354 | 354 | ||
355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
356 | KOPrefs::instance()->setAllDefaults(); | 356 | KOPrefs::instance()->setAllDefaults(); |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 360 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
361 | SLOT( disableBR(bool) ) ); | 361 | SLOT( disableBR(bool) ) ); |
362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
363 | setCentralWidget( mView ); | 363 | setCentralWidget( mView ); |
364 | globalFlagBlockStartup = 0; | 364 | globalFlagBlockStartup = 0; |
365 | //mView->show(); | 365 | //mView->show(); |
366 | //delete splash; | 366 | //delete splash; |
367 | if ( newFile ) | 367 | if ( newFile ) |
368 | mView->updateConfig(); | 368 | mView->updateConfig(); |
369 | // qApp->processEvents(); | 369 | // qApp->processEvents(); |
370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
371 | //fillSyncMenu(); | 371 | //fillSyncMenu(); |
372 | 372 | ||
373 | 373 | ||
374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
378 | mSyncManager->setDefaultFileName( sentSyncFile()); | 378 | mSyncManager->setDefaultFileName( sentSyncFile()); |
379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
380 | mSyncManager->fillSyncMenu(); | 380 | mSyncManager->fillSyncMenu(); |
381 | 381 | ||
382 | 382 | ||
383 | 383 | ||
384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
385 | if ( showWarning ) { | 385 | if ( showWarning ) { |
386 | KMessageBox::information( this, | 386 | KMessageBox::information( this, |
387 | "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"); | 387 | "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"); |
388 | //qApp->processEvents(); | 388 | //qApp->processEvents(); |
389 | mView->dialogManager()->showSyncOptions(); | 389 | mView->dialogManager()->showSyncOptions(); |
390 | } | 390 | } |
391 | 391 | ||
392 | //US listen for result adressed from Ka/Pi | 392 | //US listen for result adressed from Ka/Pi |
393 | 393 | ||
394 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
395 | infrared = 0; | 395 | infrared = 0; |
396 | #endif | 396 | #endif |
397 | updateFilterToolbar(); | 397 | updateFilterToolbar(); |
398 | updateWeek( mView->startDate() ); | 398 | updateWeek( mView->startDate() ); |
399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
401 | mBRdisabled = false; | 401 | mBRdisabled = false; |
402 | //toggleBeamReceive(); | 402 | //toggleBeamReceive(); |
403 | 403 | ||
404 | setCaption(i18n("Loading calendar files ... please wait" )); | 404 | setCaption(i18n("Loading calendar files ... please wait" )); |
405 | mSaveDelay = 0; | 405 | mSaveDelay = 0; |
406 | QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); | 406 | QTimer::singleShot( 1, this, SLOT ( loadDataAfterStart() )); |
407 | } | 407 | } |
408 | MainWindow::~MainWindow() | 408 | MainWindow::~MainWindow() |
409 | { | 409 | { |
410 | //qDebug("MainWindow::~MainWindow() "); | 410 | //qDebug("MainWindow::~MainWindow() "); |
411 | //save toolbar location | 411 | //save toolbar location |
412 | delete mCalendar; | 412 | delete mCalendar; |
413 | delete mSyncManager; | 413 | delete mSyncManager; |
414 | #ifndef DESKTOP_VERSION | 414 | #ifndef DESKTOP_VERSION |
415 | if ( infrared ) | 415 | if ( infrared ) |
416 | delete infrared; | 416 | delete infrared; |
417 | #endif | 417 | #endif |
418 | 418 | ||
419 | 419 | ||
420 | } | 420 | } |
421 | 421 | ||
422 | void MainWindow::loadDataAfterStart() | 422 | void MainWindow::loadDataAfterStart() |
423 | { | 423 | { |
424 | |||
425 | qDebug("KO: Start loading files..." ); | 424 | qDebug("KO: Start loading files..." ); |
426 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 425 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
427 | mView->loadCalendars(); | 426 | mView->loadCalendars(); |
428 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 427 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
429 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 428 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
430 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 429 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
431 | mView->setModified( false ); | 430 | mView->setModified( false ); |
432 | mBlockAtStartup = false; | 431 | mBlockAtStartup = false; |
433 | mView->setModified( false ); | 432 | mView->setModified( false ); |
434 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 433 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
435 | processIncidenceSelection( 0 ); | 434 | processIncidenceSelection( 0 ); |
436 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 435 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
437 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 436 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
438 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 437 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
439 | SLOT( slotModifiedChanged( bool ) ) ); | 438 | SLOT( slotModifiedChanged( bool ) ) ); |
440 | |||
441 | #ifndef DESKTOP_VERSION | 439 | #ifndef DESKTOP_VERSION |
442 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 440 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
443 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); | 441 | connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& ))); |
444 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); | 442 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
445 | ((QPEApplication*) qApp)->showMainWidget( this ); | ||
446 | if ( !mCStringMess.isEmpty() ) | 443 | if ( !mCStringMess.isEmpty() ) |
447 | recieve( mCStringMess, mByteData ); | 444 | recieve( mCStringMess, mByteData ); |
448 | #endif | 445 | #endif |
449 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 446 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
450 | } | 447 | } |
451 | 448 | ||
452 | void MainWindow::slotResetFocus() | 449 | void MainWindow::slotResetFocus() |
453 | { | 450 | { |
454 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 451 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
455 | mFocusLoop = 3; | 452 | mFocusLoop = 3; |
456 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 453 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
457 | } | 454 | } |
458 | void MainWindow::slotResetFocusLoop() | 455 | void MainWindow::slotResetFocusLoop() |
459 | { | 456 | { |
460 | --mFocusLoop; | 457 | --mFocusLoop; |
461 | QWidget* fw = mView->viewManager()->currentView(); | 458 | QWidget* fw = mView->viewManager()->currentView(); |
462 | if ( fw ) { | 459 | if ( fw ) { |
463 | //qDebug("loop "); | 460 | //qDebug("loop "); |
464 | fw->setFocus(); | 461 | fw->setFocus(); |
465 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 462 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
466 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 463 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
467 | } | 464 | } |
468 | 465 | ||
469 | } | 466 | } |
470 | void MainWindow::disableBR(bool b) | 467 | void MainWindow::disableBR(bool b) |
471 | { | 468 | { |
472 | #ifndef DESKTOP_VERSION | 469 | #ifndef DESKTOP_VERSION |
473 | if ( b ) { | 470 | if ( b ) { |
474 | if ( infrared ) { | 471 | if ( infrared ) { |
475 | toggleBeamReceive(); | 472 | toggleBeamReceive(); |
476 | mBRdisabled = true; | 473 | mBRdisabled = true; |
477 | } | 474 | } |
478 | mBRdisabled = true; | 475 | mBRdisabled = true; |
479 | } else { | 476 | } else { |
480 | if ( mBRdisabled ) { | 477 | if ( mBRdisabled ) { |
481 | mBRdisabled = false; | 478 | mBRdisabled = false; |
482 | //makes no sense,because other cal ap is probably running | 479 | //makes no sense,because other cal ap is probably running |
483 | // toggleBeamReceive(); | 480 | // toggleBeamReceive(); |
484 | } | 481 | } |
485 | } | 482 | } |
486 | #endif | 483 | #endif |
487 | 484 | ||
488 | } | 485 | } |
489 | bool MainWindow::beamReceiveEnabled() | 486 | bool MainWindow::beamReceiveEnabled() |
490 | { | 487 | { |
491 | #ifndef DESKTOP_VERSION | 488 | #ifndef DESKTOP_VERSION |
492 | return ( infrared != 0 ); | 489 | return ( infrared != 0 ); |
493 | #endif | 490 | #endif |
494 | return false; | 491 | return false; |
495 | } | 492 | } |
496 | 493 | ||
497 | void MainWindow::toggleBeamReceive() | 494 | void MainWindow::toggleBeamReceive() |
498 | { | 495 | { |
499 | if ( mBRdisabled ) | 496 | if ( mBRdisabled ) |
500 | return; | 497 | return; |
501 | #ifndef DESKTOP_VERSION | 498 | #ifndef DESKTOP_VERSION |
502 | if ( infrared ) { | 499 | if ( infrared ) { |
503 | qDebug("KO: Disable BeamReceive "); | 500 | qDebug("KO: Disable BeamReceive "); |
504 | delete infrared; | 501 | delete infrared; |
505 | infrared = 0; | 502 | infrared = 0; |
506 | brAction->setOn(false); | 503 | brAction->setOn(false); |
507 | return; | 504 | return; |
508 | } | 505 | } |
509 | qDebug("KO: Enable BeamReceive "); | 506 | qDebug("KO: Enable BeamReceive "); |
510 | brAction->setOn(true); | 507 | brAction->setOn(true); |
511 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 508 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
512 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 509 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
513 | #endif | 510 | #endif |
514 | } | 511 | } |
515 | void MainWindow::showMaximized () | 512 | void MainWindow::showMaximized () |
516 | { | 513 | { |
517 | #ifndef DESKTOP_VERSION | 514 | #ifndef DESKTOP_VERSION |
518 | if ( ! globalFlagBlockStartup ) | 515 | if ( ! globalFlagBlockStartup ) |
519 | if ( mClosed ) | 516 | if ( mClosed ) |
520 | mView->goToday(); | 517 | mView->goToday(); |
521 | #endif | 518 | #endif |
522 | QWidget::showMaximized () ; | 519 | QWidget::showMaximized () ; |
523 | mClosed = false; | 520 | mClosed = false; |
524 | } | 521 | } |
525 | 522 | ||
526 | bool MainWindow::askForQuitOnSaveError() | 523 | bool MainWindow::askForQuitOnSaveError() |
527 | { | 524 | { |
528 | bool retval = false; | 525 | bool retval = false; |
529 | switch( QMessageBox::information( this, "KO/Pi", | 526 | switch( QMessageBox::information( this, "KO/Pi", |
530 | i18n("Error saving data") + "!\n" + | 527 | i18n("Error saving data") + "!\n" + |
531 | i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + | 528 | i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" + |
532 | i18n("Do you really want\nto close KO/Pi?"), | 529 | i18n("Do you really want\nto close KO/Pi?"), |
533 | i18n(" Yes, close "), i18n("No"), | 530 | i18n(" Yes, close "), i18n("No"), |
534 | 0, 1 ) ) { | 531 | 0, 1 ) ) { |
535 | case 0: | 532 | case 0: |
536 | retval = true; | 533 | retval = true; |
537 | break; | 534 | break; |
538 | default: | 535 | default: |
539 | break; | 536 | break; |
540 | } | 537 | } |
541 | return retval; | 538 | return retval; |