summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/main.cpp2
-rw-r--r--korganizer/mainwindow.cpp8
-rw-r--r--libkcal/todo.cpp4
3 files changed, 7 insertions, 7 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 9410c6a..4a0e24f 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -61,57 +61,57 @@ int main( int argc, char **argv )
61 printf(" -showList: List view\n"); 61 printf(" -showList: List view\n");
62 printf(" -showDay: Day view\n"); 62 printf(" -showDay: Day view\n");
63 printf(" -showWWeek: Work Week view\n"); 63 printf(" -showWWeek: Work Week view\n");
64 printf(" -showWeek: Week view\n"); 64 printf(" -showWeek: Week view\n");
65 printf(" -showTodo: Todo view\n"); 65 printf(" -showTodo: Todo view\n");
66 printf(" -showJournal: Journal view\n"); 66 printf(" -showJournal: Journal view\n");
67 printf(" -showKO: Next Days view\n"); 67 printf(" -showKO: Next Days view\n");
68 printf(" -showWNext: What's Next view\n"); 68 printf(" -showWNext: What's Next view\n");
69 printf(" -showNextXView: Next X View\n"); 69 printf(" -showNextXView: Next X View\n");
70 printf(" -new[Y] and -show[X] may be used togehther\n"); 70 printf(" -new[Y] and -show[X] may be used togehther\n");
71 printf(" KO/Pi is exiting now. Bye!\n"); 71 printf(" KO/Pi is exiting now. Bye!\n");
72 exitHelp = true; 72 exitHelp = true;
73 } 73 }
74 } 74 }
75 if ( ! exitHelp ) { 75 if ( ! exitHelp ) {
76 KGlobal::setAppName( "korganizer" ); 76 KGlobal::setAppName( "korganizer" );
77 QString fileName ; 77 QString fileName ;
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 fileName = getenv("QPEDIR"); 79 fileName = getenv("QPEDIR");
80 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 80 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
81#else 81#else
82 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 82 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
83 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 83 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
84#endif 84#endif
85 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 85 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
86 86
87 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); 87 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
88 KPimGlobalPrefs::instance()->setGlobalConfig(); 88 KPimGlobalPrefs::instance()->setGlobalConfig();
89 MainWindow m; 89 MainWindow m;
90#ifndef DESKTOP_VERSION 90#ifndef DESKTOP_VERSION
91 91
92 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& ))); 92 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& )));
93 a.showMainWidget(&m ); 93 a.showMainWidget(&m );
94#else 94#else
95 a.setMainWidget(&m ); 95 a.setMainWidget(&m );
96 m.show(); 96 m.show();
97 //m.resize( 800, 600 ); 97 //m.resize( 800, 600 );
98 //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 98 //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
99#endif 99#endif
100 if ( argc > 1 ) { 100 if ( argc > 1 ) {
101 QCString command = argv[1]; 101 QCString command = argv[1];
102 if ( argc > 2 ) 102 if ( argc > 2 )
103 command += argv[2]; 103 command += argv[2];
104 m.recieve(command, QByteArray() ); 104 m.recieve(command, QByteArray() );
105 105
106 } 106 }
107 107
108#ifndef DESKTOP_VERSION 108#ifndef DESKTOP_VERSION
109 QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); 109 // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
110#endif 110#endif
111 a.exec(); 111 a.exec();
112 dumpMissing(); 112 dumpMissing();
113 113
114 KPimGlobalPrefs::instance()->writeConfig(); 114 KPimGlobalPrefs::instance()->writeConfig();
115 } 115 }
116 qDebug("KO: Bye! "); 116 qDebug("KO: Bye! ");
117} 117}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 05e5087..c597138 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -2011,132 +2011,132 @@ void MainWindow::backupAllFiles()
2011 } else if ( retval == 1 ){ 2011 } else if ( retval == 1 ){
2012 qDebug("KO: Backup created."); 2012 qDebug("KO: Backup created.");
2013 // backup ok 2013 // backup ok
2014 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2014 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2015 KopiCalendarFile * cal = calendars.first(); 2015 KopiCalendarFile * cal = calendars.first();
2016 cal = calendars.next(); 2016 cal = calendars.next();
2017 while ( cal ) { 2017 while ( cal ) {
2018 if ( !cal->mErrorOnLoad ) { 2018 if ( !cal->mErrorOnLoad ) {
2019 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 2019 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
2020 } 2020 }
2021 cal = calendars.next(); 2021 cal = calendars.next();
2022 } 2022 }
2023 KOPrefs::instance()->mLastBackupDate = daysTo; 2023 KOPrefs::instance()->mLastBackupDate = daysTo;
2024 setCaption(i18n("Backup succesfully finished" )); 2024 setCaption(i18n("Backup succesfully finished" ));
2025 } else if ( retval == 2 ){ 2025 } else if ( retval == 2 ){
2026 setCaption(i18n("Backup globally disabled" )); 2026 setCaption(i18n("Backup globally disabled" ));
2027 qDebug("KO: Backup globally cancelled."); 2027 qDebug("KO: Backup globally cancelled.");
2028 // backup globally cancelled 2028 // backup globally cancelled
2029 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2029 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2030 } 2030 }
2031 // retval == 3: do nothing, try again later 2031 // retval == 3: do nothing, try again later
2032} 2032}
2033void MainWindow::save() 2033void MainWindow::save()
2034{ 2034{
2035 if ( mSaveDelay ) { 2035 if ( mSaveDelay ) {
2036 int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); 2036 int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() );
2037 if ( mSaveDelay < elapsed ) { 2037 if ( mSaveDelay < elapsed ) {
2038 qDebug("KO: Pending save after wakeup from suspend detected."); 2038 qDebug("KO: Pending save after wakeup from suspend detected.");
2039 qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); 2039 qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed );
2040 qDebug("KO: Restarting save timer to save in 10 sec."); 2040 qDebug("KO: Restarting save timer to save in 10 sec.");
2041 int msec = 10000; 2041 int msec = 10000;
2042 mSaveTimer.start( msec, true ); 2042 mSaveTimer.start( msec, true );
2043 mSaveTimerStart = QDateTime::currentDateTime(); 2043 mSaveTimerStart = QDateTime::currentDateTime();
2044 mSaveDelay = msec/1000; 2044 mSaveDelay = msec/1000;
2045 return; 2045 return;
2046 } 2046 }
2047 } 2047 }
2048 if ( mView->viewManager()->journalView() ) 2048 if ( mView->viewManager()->journalView() )
2049 mView->viewManager()->journalView()->checkModified(); 2049 mView->viewManager()->journalView()->checkModified();
2050 if ( !mCalendarModifiedFlag ) { 2050 if ( !mCalendarModifiedFlag ) {
2051 qDebug("KO: Calendar not modified. Nothing saved."); 2051 qDebug("KO: Calendar not modified. Nothing saved.");
2052 return; 2052 return;
2053 } 2053 }
2054 if ( mSyncManager->blockSave() ) { 2054 if ( mSyncManager->blockSave() ) {
2055 slotModifiedChanged( true ); 2055 slotModifiedChanged( true );
2056 return; 2056 return;
2057 } 2057 }
2058#ifndef DESKTOP_VERSION 2058#ifndef DESKTOP_VERSION
2059 QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); 2059 // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
2060#endif 2060#endif
2061 mSaveDelay = 0; 2061 mSaveDelay = 0;
2062 mSyncManager->setBlockSave(true); 2062 mSyncManager->setBlockSave(true);
2063 if ( mView->checkAllFileVersions() ) { 2063 if ( mView->checkAllFileVersions() ) {
2064 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 2064 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
2065 QDate reference ( 2000,1,1); 2065 QDate reference ( 2000,1,1);
2066 int daysTo = reference.daysTo ( QDate::currentDate() ); 2066 int daysTo = reference.daysTo ( QDate::currentDate() );
2067 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 2067 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
2068 backupAllFiles(); 2068 backupAllFiles();
2069 } 2069 }
2070 ; // KPimGlobalPrefs::instance()->mLastBackupDate 2070 ; // KPimGlobalPrefs::instance()->mLastBackupDate
2071 } 2071 }
2072 QTime neededSaveTime; 2072 QTime neededSaveTime;
2073 neededSaveTime.start(); 2073 neededSaveTime.start();
2074 if ( !isMinimized () ) 2074 if ( !isMinimized () )
2075 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 2075 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
2076 qDebug("KO: Start saving data to file!"); 2076 qDebug("KO: Start saving data to file!");
2077 if ( mView->saveCalendars() ) 2077 if ( mView->saveCalendars() )
2078 mCalendarModifiedFlag = false; 2078 mCalendarModifiedFlag = false;
2079 int msNeeded = neededSaveTime.elapsed(); 2079 int msNeeded = neededSaveTime.elapsed();
2080 qDebug("KO: Needed %d ms for saving.",msNeeded ); 2080 qDebug("KO: Needed %d ms for saving.",msNeeded );
2081 QString savemes; 2081 QString savemes;
2082 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2082 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2083 if ( !isMinimized () ) 2083 if ( !isMinimized () )
2084 setCaption(savemes); 2084 setCaption(savemes);
2085 else 2085 else
2086 qDebug(savemes); 2086 qDebug(savemes);
2087 } else { 2087 } else {
2088 setCaption(i18n("Saving cancelled!")); 2088 setCaption(i18n("Saving cancelled!"));
2089 mCalendarModifiedFlag = false; 2089 mCalendarModifiedFlag = false;
2090 slotModifiedChanged( true ); 2090 slotModifiedChanged( true );
2091 } 2091 }
2092 mSyncManager->setBlockSave( false ); 2092 mSyncManager->setBlockSave( false );
2093#ifndef DESKTOP_VERSION 2093#ifndef DESKTOP_VERSION
2094 QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); 2094 //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable );
2095#endif 2095#endif
2096} 2096}
2097 2097
2098void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2098void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2099{ 2099{
2100 if ( !e->isAutoRepeat() ) { 2100 if ( !e->isAutoRepeat() ) {
2101 mFlagKeyPressed = false; 2101 mFlagKeyPressed = false;
2102 } 2102 }
2103} 2103}
2104void MainWindow::keyPressEvent ( QKeyEvent * e ) 2104void MainWindow::keyPressEvent ( QKeyEvent * e )
2105{ 2105{
2106 qApp->processEvents(); 2106 qApp->processEvents();
2107 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2107 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2108 e->ignore(); 2108 e->ignore();
2109 // qDebug(" ignore %d",e->isAutoRepeat() ); 2109 // qDebug(" ignore %d",e->isAutoRepeat() );
2110 return; 2110 return;
2111 } 2111 }
2112 if (! e->isAutoRepeat() ) 2112 if (! e->isAutoRepeat() )
2113 mFlagKeyPressed = true; 2113 mFlagKeyPressed = true;
2114 KOPrefs *p = KOPrefs::instance(); 2114 KOPrefs *p = KOPrefs::instance();
2115 bool showSelectedDates = false; 2115 bool showSelectedDates = false;
2116 int size; 2116 int size;
2117 int pro = 0; 2117 int pro = 0;
2118 //qDebug("MainWindow::keyPressEvent "); 2118 //qDebug("MainWindow::keyPressEvent ");
2119 switch ( e->key() ) { 2119 switch ( e->key() ) {
2120 case Qt::Key_Right: 2120 case Qt::Key_Right:
2121 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2121 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2122 mView->goNextMonth(); 2122 mView->goNextMonth();
2123 else 2123 else
2124 mView->goNext(); 2124 mView->goNext();
2125 showSelectedDates = true; 2125 showSelectedDates = true;
2126 break; 2126 break;
2127 case Qt::Key_Left: 2127 case Qt::Key_Left:
2128 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2128 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2129 mView->goPreviousMonth(); 2129 mView->goPreviousMonth();
2130 else 2130 else
2131 mView->goPrevious(); 2131 mView->goPrevious();
2132 showSelectedDates = true; 2132 showSelectedDates = true;
2133 break; 2133 break;
2134 case Qt::Key_Down: 2134 case Qt::Key_Down:
2135 mView->viewManager()->agendaView()->scrollOneHourDown(); 2135 mView->viewManager()->agendaView()->scrollOneHourDown();
2136 break; 2136 break;
2137 case Qt::Key_Up: 2137 case Qt::Key_Up:
2138 mView->viewManager()->agendaView()->scrollOneHourUp(); 2138 mView->viewManager()->agendaView()->scrollOneHourUp();
2139 break; 2139 break;
2140 case Qt::Key_K: 2140 case Qt::Key_K:
2141 mView->viewManager()->showMonthViewWeek(); 2141 mView->viewManager()->showMonthViewWeek();
2142 break; 2142 break;
@@ -2467,102 +2467,102 @@ void MainWindow::setCaptionToDates()
2467 setCaption(""); 2467 setCaption("");
2468 return; 2468 return;
2469 } 2469 }
2470 selDates = KGlobal::locale()->formatDate( date, true); 2470 selDates = KGlobal::locale()->formatDate( date, true);
2471 if (mView->startDate() < mView->endDate() ) 2471 if (mView->startDate() < mView->endDate() )
2472 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2472 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2473 else { 2473 else {
2474 QString addString; 2474 QString addString;
2475 if ( date == QDateTime::currentDateTime().date() ) 2475 if ( date == QDateTime::currentDateTime().date() )
2476 addString = i18n("Today"); 2476 addString = i18n("Today");
2477 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2477 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2478 addString = i18n("Tomorrow"); 2478 addString = i18n("Tomorrow");
2479 if ( !addString.isEmpty() ) 2479 if ( !addString.isEmpty() )
2480 selDates = addString+", "+selDates ; 2480 selDates = addString+", "+selDates ;
2481 } 2481 }
2482 setCaption( i18n("Dates: ") + selDates ); 2482 setCaption( i18n("Dates: ") + selDates );
2483 2483
2484} 2484}
2485void MainWindow::showConfigureAgenda( ) 2485void MainWindow::showConfigureAgenda( )
2486{ 2486{
2487 int iii; 2487 int iii;
2488 for ( iii = 1;iii<= 10 ;++iii ){ 2488 for ( iii = 1;iii<= 10 ;++iii ){
2489 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2489 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2490 } 2490 }
2491 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2491 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2492} 2492}
2493void MainWindow::configureAgenda( int item ) 2493void MainWindow::configureAgenda( int item )
2494{ 2494{
2495 if ( KOPrefs::instance()->mHourSize == item ) 2495 if ( KOPrefs::instance()->mHourSize == item )
2496 return; 2496 return;
2497 KOPrefs::instance()->mHourSize=item; 2497 KOPrefs::instance()->mHourSize=item;
2498 mView->viewManager()->agendaView()->updateConfig(); 2498 mView->viewManager()->agendaView()->updateConfig();
2499} 2499}
2500 2500
2501void MainWindow::saveCalendar() 2501void MainWindow::saveCalendar()
2502{ 2502{
2503 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2503 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2504 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2504 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2505 bupDir = KGlobalSettings::backupDataDir(); 2505 bupDir = KGlobalSettings::backupDataDir();
2506 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2506 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2507 QString bupHint; 2507 QString bupHint;
2508 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2508 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2509 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2509 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2510 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2510 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2511 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2511 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2512 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2512 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2513 save(); 2513 save();
2514#ifndef DESKTOP_VERSION 2514#ifndef DESKTOP_VERSION
2515 QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); 2515 //QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
2516#endif 2516#endif
2517 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2517 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2518 backupAllFiles(); 2518 backupAllFiles();
2519#ifndef DESKTOP_VERSION 2519#ifndef DESKTOP_VERSION
2520 QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); 2520 //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable );
2521#endif 2521#endif
2522} 2522}
2523void MainWindow::loadCalendar() 2523void MainWindow::loadCalendar()
2524{ 2524{
2525 2525
2526 2526
2527#if 0 2527#if 0
2528 QString fn = KOPrefs::instance()->mLastLoadFile; 2528 QString fn = KOPrefs::instance()->mLastLoadFile;
2529 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2529 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2530 2530
2531 if ( fn == "" ) 2531 if ( fn == "" )
2532 return; 2532 return;
2533 QFileInfo info; 2533 QFileInfo info;
2534 info.setFile( fn ); 2534 info.setFile( fn );
2535 QString mess; 2535 QString mess;
2536 bool loadbup = true; 2536 bool loadbup = true;
2537 if ( info. exists() ) { 2537 if ( info. exists() ) {
2538 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2538 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2539 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2539 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2540 mess, 2540 mess,
2541 i18n("Load!"), i18n("Cancel"), 0, 2541 i18n("Load!"), i18n("Cancel"), 0,
2542 0, 1 ); 2542 0, 1 );
2543 if ( result != 0 ) { 2543 if ( result != 0 ) {
2544 loadbup = false; 2544 loadbup = false;
2545 } 2545 }
2546 } else { 2546 } else {
2547 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2547 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2548 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2548 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2549 0, 1 ); 2549 0, 1 );
2550 2550
2551 return; 2551 return;
2552 } 2552 }
2553 if ( loadbup ) { 2553 if ( loadbup ) {
2554 mView->openCalendar( fn ); 2554 mView->openCalendar( fn );
2555 KOPrefs::instance()->mLastLoadFile = fn; 2555 KOPrefs::instance()->mLastLoadFile = fn;
2556 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2556 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2557 setCaption(mess); 2557 setCaption(mess);
2558 } 2558 }
2559#endif 2559#endif
2560 2560
2561} 2561}
2562void MainWindow::quickImportIcal() 2562void MainWindow::quickImportIcal()
2563{ 2563{
2564 importFile( KOPrefs::instance()->mLastImportFile, false ); 2564 importFile( KOPrefs::instance()->mLastImportFile, false );
2565} 2565}
2566void MainWindow::importFile( QString fn, bool quick ) 2566void MainWindow::importFile( QString fn, bool quick )
2567{ 2567{
2568 QFileInfo info; 2568 QFileInfo info;
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 70a7711..29f725f 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -110,133 +110,133 @@ void Todo::setRunning( bool run )
110} 110}
111void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) 111void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end )
112{ 112{
113 if ( !mRunning) return; 113 if ( !mRunning) return;
114 mRunning = false; 114 mRunning = false;
115 mRunStart = start; 115 mRunStart = start;
116 mRunEnd = end; 116 mRunEnd = end;
117 saveRunningInfoToFile( comment ); 117 saveRunningInfoToFile( comment );
118} 118}
119void Todo::restartSaveTimer( int secs ) 119void Todo::restartSaveTimer( int secs )
120{ 120{
121 mRunSaveTimer->start( secs * 1000 ); 121 mRunSaveTimer->start( secs * 1000 );
122 mRunLastSave = QDateTime::currentDateTime(); 122 mRunLastSave = QDateTime::currentDateTime();
123 mCurrentTimerDelay = secs; 123 mCurrentTimerDelay = secs;
124} 124}
125void Todo::timerSlotSaveRunningInfoToFile() 125void Todo::timerSlotSaveRunningInfoToFile()
126{ 126{
127 mRunEnd = QDateTime::currentDateTime(); 127 mRunEnd = QDateTime::currentDateTime();
128 int secsTo = mRunLastSave.secsTo( mRunEnd ); 128 int secsTo = mRunLastSave.secsTo( mRunEnd );
129 //if( secsTo == 8 ) ++secsTo; 129 //if( secsTo == 8 ) ++secsTo;
130 qDebug("KO Todo::saveTimerTimeout %d %d", secsTo, mCurrentTimerDelay ); 130 qDebug("KO Todo::saveTimerTimeout %d %d", secsTo, mCurrentTimerDelay );
131 if ( secsTo > mCurrentTimerDelay ) { 131 if ( secsTo > mCurrentTimerDelay ) {
132 qDebug("KO Todo::saveTimerTimeout restart %d ", SAVETIMER_TIMEOUT_RETRY_SECONDS ); 132 qDebug("KO Todo::saveTimerTimeout restart %d ", SAVETIMER_TIMEOUT_RETRY_SECONDS );
133 restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); 133 restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS );
134 return; 134 return;
135 } 135 }
136 int msecs = mRunLastSave.time().msecsTo( mRunEnd.time()); 136 int msecs = mRunLastSave.time().msecsTo( mRunEnd.time());
137 if ( msecs < 0 ) { 137 if ( msecs < 0 ) {
138 restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); 138 restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS );
139 return; 139 return;
140 } 140 }
141 // qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); 141 // qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) );
142 if ( msecs > ( ( mCurrentTimerDelay * 1000 ) + 50 )) { 142 if ( msecs > ( ( mCurrentTimerDelay * 1000 ) + 50 )) {
143 qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); 143 qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) );
144 restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); 144 restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS );
145 return; 145 return;
146 } 146 }
147 restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); 147 restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS );
148 saveRunningInfoToFile( QString::null ); 148 saveRunningInfoToFile( QString::null );
149} 149}
150void Todo::saveRunningInfoToFile() 150void Todo::saveRunningInfoToFile()
151{ 151{
152 mRunEnd = QDateTime::currentDateTime(); 152 mRunEnd = QDateTime::currentDateTime();
153 saveRunningInfoToFile( QString::null ); 153 saveRunningInfoToFile( QString::null );
154} 154}
155void Todo::saveRunningInfoToFile( QString comment ) 155void Todo::saveRunningInfoToFile( QString comment )
156{ 156{
157#ifndef DESKTOP_VERSION 157#ifndef DESKTOP_VERSION
158 QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); 158 //QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
159#endif 159#endif
160 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 160 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
161 if ( mRunStart.secsTo ( mRunEnd) < 15 ) { 161 if ( mRunStart.secsTo ( mRunEnd) < 15 ) {
162 qDebug("Running time < 15 seconds. Skipped. "); 162 qDebug("Running time < 15 seconds. Skipped. ");
163 return; 163 return;
164 } 164 }
165 QString dir = KGlobalSettings::timeTrackerDir(); 165 QString dir = KGlobalSettings::timeTrackerDir();
166 //qDebug("%s ", dir.latin1()); 166 //qDebug("%s ", dir.latin1());
167 QString file = "%1%2%3-%4%5%6-"; 167 QString file = "%1%2%3-%4%5%6-";
168 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 168 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
169 file.replace ( QRegExp (" "), "0" ); 169 file.replace ( QRegExp (" "), "0" );
170 file += uid(); 170 file += uid();
171 //qDebug("File %s ",file.latin1() ); 171 //qDebug("File %s ",file.latin1() );
172 CalendarLocal cal; 172 CalendarLocal cal;
173 cal.setLocalTime(); 173 cal.setLocalTime();
174 Todo * to = (Todo*) clone(); 174 Todo * to = (Todo*) clone();
175 to->setFloats( false ); 175 to->setFloats( false );
176 to->setDtStart( mRunStart ); 176 to->setDtStart( mRunStart );
177 to->setHasStartDate( true ); 177 to->setHasStartDate( true );
178 to->setDtDue( mRunEnd ); 178 to->setDtDue( mRunEnd );
179 to->setHasDueDate( true ); 179 to->setHasDueDate( true );
180 to->setUid( file ); 180 to->setUid( file );
181 if ( !comment.isEmpty() ) { 181 if ( !comment.isEmpty() ) {
182 QString des = to->description(); 182 QString des = to->description();
183 if ( des.isEmpty () ) 183 if ( des.isEmpty () )
184 to->setDescription( "TT-Note: " + comment ); 184 to->setDescription( "TT-Note: " + comment );
185 else 185 else
186 to->setDescription( "TT-Note: " + comment +"\n" + des ); 186 to->setDescription( "TT-Note: " + comment +"\n" + des );
187 } 187 }
188 cal.addIncidence( to ); 188 cal.addIncidence( to );
189 ICalFormat format( false ); 189 ICalFormat format( false );
190 file = dir +"/" +file +".ics"; 190 file = dir +"/" +file +".ics";
191 format.save( &cal, file ); 191 format.save( &cal, file );
192 saveParents(); 192 saveParents();
193#ifndef DESKTOP_VERSION 193#ifndef DESKTOP_VERSION
194 QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); 194 //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable );
195#endif 195#endif
196} 196}
197void Todo::saveParents() 197void Todo::saveParents()
198{ 198{
199 if (!relatedTo() ) 199 if (!relatedTo() )
200 return; 200 return;
201 Incidence * inc = relatedTo(); 201 Incidence * inc = relatedTo();
202 if ( inc->typeID() != todoID ) 202 if ( inc->typeID() != todoID )
203 return; 203 return;
204 Todo* to = (Todo*)inc; 204 Todo* to = (Todo*)inc;
205 bool saveTodo = false; 205 bool saveTodo = false;
206 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 206 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
207 QFileInfo fi ( file ); 207 QFileInfo fi ( file );
208 if ( fi.exists() ) { 208 if ( fi.exists() ) {
209 if ( fi.lastModified () < to->lastModified ()) 209 if ( fi.lastModified () < to->lastModified ())
210 saveTodo = true; 210 saveTodo = true;
211 } else { 211 } else {
212 saveTodo = true; 212 saveTodo = true;
213 } 213 }
214 if ( saveTodo ) { 214 if ( saveTodo ) {
215 CalendarLocal cal; 215 CalendarLocal cal;
216 cal.setLocalTime(); 216 cal.setLocalTime();
217 Todo * par = (Todo *) to->clone(); 217 Todo * par = (Todo *) to->clone();
218 cal.addIncidence( par ); 218 cal.addIncidence( par );
219 ICalFormat format( false ); 219 ICalFormat format( false );
220 format.save( &cal, file ); 220 format.save( &cal, file );
221 } 221 }
222 to->saveParents(); 222 to->saveParents();
223} 223}
224 224
225int Todo::runTime() 225int Todo::runTime()
226{ 226{
227 if ( !mRunning ) 227 if ( !mRunning )
228 return 0; 228 return 0;
229 return mRunStart.secsTo( QDateTime::currentDateTime() ); 229 return mRunStart.secsTo( QDateTime::currentDateTime() );
230} 230}
231bool Todo::hasRunningSub() 231bool Todo::hasRunningSub()
232{ 232{
233 if ( mRunning ) 233 if ( mRunning )
234 return true; 234 return true;
235 Incidence *aTodo; 235 Incidence *aTodo;
236 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 236 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
237 if ( ((Todo*)aTodo)->hasRunningSub() ) 237 if ( ((Todo*)aTodo)->hasRunningSub() )
238 return true; 238 return true;
239 } 239 }
240 return false; 240 return false;
241} 241}
242Incidence *Todo::clone() 242Incidence *Todo::clone()