author | zautrix <zautrix> | 2005-09-18 23:40:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-18 23:40:38 (UTC) |
commit | 2d346e4052fd726e657daee4ac3f2bcc7103f5fb (patch) (unidiff) | |
tree | 9952b888e0790bc032ba4e0c3c4165ec283a4139 /korganizer | |
parent | 06ebec95579816144ee65981835e6e3482e20a28 (diff) | |
download | kdepimpi-2d346e4052fd726e657daee4ac3f2bcc7103f5fb.zip kdepimpi-2d346e4052fd726e657daee4ac3f2bcc7103f5fb.tar.gz kdepimpi-2d346e4052fd726e657daee4ac3f2bcc7103f5fb.tar.bz2 |
wn
-rw-r--r-- | korganizer/mainwindow.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 98d3e35..fb0b4ad 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -287,50 +287,50 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | 290 | ||
291 | mCalendarModifiedFlag = false; | 291 | mCalendarModifiedFlag = false; |
292 | // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 292 | // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
293 | //splash->setAlignment ( AlignCenter ); | 293 | //splash->setAlignment ( AlignCenter ); |
294 | //setCentralWidget( splash ); | 294 | //setCentralWidget( splash ); |
295 | #ifndef DESKTOP_VERSION | 295 | #ifndef DESKTOP_VERSION |
296 | //showMaximized(); | 296 | //showMaximized(); |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
300 | setDefaultPreferences(); | 300 | setDefaultPreferences(); |
301 | mCalendar = new CalendarLocal(); | 301 | mCalendar = new CalendarLocal(); |
302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
303 | setCentralWidget( mView ); | 303 | setCentralWidget( mView ); |
304 | //mView->hide(); | 304 | //mView->hide(); |
305 | //mView->resize(splash->size() ); | 305 | //mView->resize(splash->size() ); |
306 | initActions(); | 306 | initActions(); |
307 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 307 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
308 | mSyncManager->setBlockSave(false); | 308 | mSyncManager->setBlockSave(false); |
309 | mView->setSyncManager(mSyncManager); | 309 | mView->setSyncManager(mSyncManager); |
310 | #ifndef DESKTOP_VERSION | 310 | #ifndef DESKTOP_VERSION |
311 | iconToolBar->show(); | 311 | //iconToolBar->show(); |
312 | qApp->processEvents(); | 312 | //qApp->processEvents(); |
313 | #endif | 313 | #endif |
314 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 314 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
315 | int vh = height() ; | 315 | int vh = height() ; |
316 | int vw = width(); | 316 | int vw = width(); |
317 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 317 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
319 | vh -= iconToolBar->height(); | 319 | vh -= iconToolBar->height(); |
320 | } else { | 320 | } else { |
321 | vw -= iconToolBar->height(); | 321 | vw -= iconToolBar->height(); |
322 | } | 322 | } |
323 | //mView->setMaximumSize( splash->size() ); | 323 | //mView->setMaximumSize( splash->size() ); |
324 | //mView->resize( splash->size() ); | 324 | //mView->resize( splash->size() ); |
325 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 325 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
326 | mView->readSettings(); | 326 | mView->readSettings(); |
327 | bool newFile = false; | 327 | bool newFile = false; |
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(); |
@@ -364,49 +364,49 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
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; |
@@ -421,53 +421,52 @@ MainWindow::~MainWindow() | |||
421 | 421 | ||
422 | void MainWindow::loadDataAfterStart() | 422 | void MainWindow::loadDataAfterStart() |
423 | { | 423 | { |
424 | 424 | ||
425 | qDebug("KO: Start loading files..." ); | 425 | qDebug("KO: Start loading files..." ); |
426 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 426 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
427 | mView->loadCalendars(); | 427 | mView->loadCalendars(); |
428 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 428 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
429 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 429 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
430 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 430 | //QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
431 | mView->setModified( false ); | 431 | mView->setModified( false ); |
432 | mBlockAtStartup = false; | 432 | mBlockAtStartup = false; |
433 | mView->setModified( false ); | 433 | mView->setModified( false ); |
434 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 434 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
435 | processIncidenceSelection( 0 ); | 435 | processIncidenceSelection( 0 ); |
436 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 436 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
437 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 437 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
438 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 438 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
439 | SLOT( slotModifiedChanged( bool ) ) ); | 439 | SLOT( slotModifiedChanged( bool ) ) ); |
440 | 440 | ||
441 | #ifndef DESKTOP_VERSION | 441 | #ifndef DESKTOP_VERSION |
442 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 442 | 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& ))); | 443 | 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& ))); | 444 | disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& ))); |
445 | ((QPEApplication*) qApp)->showMainWidget( this ); | ||
445 | if ( !mCStringMess.isEmpty() ) | 446 | if ( !mCStringMess.isEmpty() ) |
446 | recieve( mCStringMess, mByteData ); | 447 | recieve( mCStringMess, mByteData ); |
447 | #endif | 448 | #endif |
448 | |||
449 | |||
450 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 449 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
451 | } | 450 | } |
452 | 451 | ||
453 | void MainWindow::slotResetFocus() | 452 | void MainWindow::slotResetFocus() |
454 | { | 453 | { |
455 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); | 454 | //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); |
456 | mFocusLoop = 3; | 455 | mFocusLoop = 3; |
457 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 456 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
458 | } | 457 | } |
459 | void MainWindow::slotResetFocusLoop() | 458 | void MainWindow::slotResetFocusLoop() |
460 | { | 459 | { |
461 | --mFocusLoop; | 460 | --mFocusLoop; |
462 | QWidget* fw = mView->viewManager()->currentView(); | 461 | QWidget* fw = mView->viewManager()->currentView(); |
463 | if ( fw ) { | 462 | if ( fw ) { |
464 | //qDebug("loop "); | 463 | //qDebug("loop "); |
465 | fw->setFocus(); | 464 | fw->setFocus(); |
466 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) | 465 | if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) |
467 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); | 466 | QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); |
468 | } | 467 | } |
469 | 468 | ||
470 | } | 469 | } |
471 | void MainWindow::disableBR(bool b) | 470 | void MainWindow::disableBR(bool b) |
472 | { | 471 | { |
473 | #ifndef DESKTOP_VERSION | 472 | #ifndef DESKTOP_VERSION |
@@ -2023,50 +2022,50 @@ void MainWindow::backupAllFiles() | |||
2023 | cal = calendars.next(); | 2022 | cal = calendars.next(); |
2024 | while ( cal ) { | 2023 | while ( cal ) { |
2025 | if ( !cal->mErrorOnLoad ) { | 2024 | if ( !cal->mErrorOnLoad ) { |
2026 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 2025 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
2027 | } | 2026 | } |
2028 | cal = calendars.next(); | 2027 | cal = calendars.next(); |
2029 | } | 2028 | } |
2030 | KOPrefs::instance()->mLastBackupDate = daysTo; | 2029 | KOPrefs::instance()->mLastBackupDate = daysTo; |
2031 | setCaption(i18n("Backup succesfully finished" )); | 2030 | setCaption(i18n("Backup succesfully finished" )); |
2032 | } else if ( retval == 2 ){ | 2031 | } else if ( retval == 2 ){ |
2033 | setCaption(i18n("Backup globally disabled" )); | 2032 | setCaption(i18n("Backup globally disabled" )); |
2034 | qDebug("KO: Backup globally cancelled."); | 2033 | qDebug("KO: Backup globally cancelled."); |
2035 | // backup globally cancelled | 2034 | // backup globally cancelled |
2036 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2035 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2037 | } | 2036 | } |
2038 | // retval == 3: do nothing, try again later | 2037 | // retval == 3: do nothing, try again later |
2039 | } | 2038 | } |
2040 | void MainWindow::save() | 2039 | void MainWindow::save() |
2041 | { | 2040 | { |
2042 | if ( mSaveDelay ) { | 2041 | if ( mSaveDelay ) { |
2043 | int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); | 2042 | int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); |
2044 | if ( mSaveDelay < elapsed ) { | 2043 | if ( mSaveDelay < elapsed ) { |
2045 | qDebug("KO: Pending save after wakeup from suspend detected."); | 2044 | qDebug("KO: Pending save after wakeup from suspend detected."); |
2046 | qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); | 2045 | qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); |
2047 | qDebug("KO: Restarting save timer to save in 15 sec."); | 2046 | qDebug("KO: Restarting save timer to save in 10 sec."); |
2048 | int msec = 15000; | 2047 | int msec = 10000; |
2049 | mSaveTimer.start( msec, true ); | 2048 | mSaveTimer.start( msec, true ); |
2050 | mSaveTimerStart = QDateTime::currentDateTime(); | 2049 | mSaveTimerStart = QDateTime::currentDateTime(); |
2051 | mSaveDelay = msec/1000; | 2050 | mSaveDelay = msec/1000; |
2052 | return; | 2051 | return; |
2053 | } | 2052 | } |
2054 | } | 2053 | } |
2055 | 2054 | ||
2056 | if ( mView->viewManager()->journalView() ) | 2055 | if ( mView->viewManager()->journalView() ) |
2057 | mView->viewManager()->journalView()->checkModified(); | 2056 | mView->viewManager()->journalView()->checkModified(); |
2058 | if ( !mCalendarModifiedFlag ) { | 2057 | if ( !mCalendarModifiedFlag ) { |
2059 | qDebug("KO: Calendar not modified. Nothing saved."); | 2058 | qDebug("KO: Calendar not modified. Nothing saved."); |
2060 | return; | 2059 | return; |
2061 | } | 2060 | } |
2062 | if ( mSyncManager->blockSave() ) { | 2061 | if ( mSyncManager->blockSave() ) { |
2063 | slotModifiedChanged( true ); | 2062 | slotModifiedChanged( true ); |
2064 | return; | 2063 | return; |
2065 | } | 2064 | } |
2066 | mSaveDelay = 0; | 2065 | mSaveDelay = 0; |
2067 | mSyncManager->setBlockSave(true); | 2066 | mSyncManager->setBlockSave(true); |
2068 | if ( mView->checkAllFileVersions() ) { | 2067 | if ( mView->checkAllFileVersions() ) { |
2069 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 2068 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
2070 | QDate reference ( 2000,1,1); | 2069 | QDate reference ( 2000,1,1); |
2071 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 2070 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
2072 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 2071 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |