-rw-r--r-- | korganizer/main.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 15 | ||||
-rw-r--r-- | libkcal/todo.cpp | 12 |
3 files changed, 26 insertions, 4 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index a96f7c2..9410c6a 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -100,15 +100,18 @@ int main( int argc, char **argv ) | |||
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 | ||
109 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | ||
110 | #endif | ||
108 | a.exec(); | 111 | a.exec(); |
109 | dumpMissing(); | 112 | dumpMissing(); |
110 | 113 | ||
111 | KPimGlobalPrefs::instance()->writeConfig(); | 114 | KPimGlobalPrefs::instance()->writeConfig(); |
112 | } | 115 | } |
113 | qDebug("KO: Bye! "); | 116 | qDebug("KO: Bye! "); |
114 | } | 117 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d1e369c..05e5087 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -21,17 +21,17 @@ | |||
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qtopia/alarmserver.h> | 27 | #include <qtopia/alarmserver.h> |
28 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
29 | #include <unistd.h> // for sleep | 29 | //#include <unistd.h> // for sleep |
30 | #else | 30 | #else |
31 | #include <qtoolbar.h> | 31 | #include <qtoolbar.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <resource.h> | 33 | //#include <resource.h> |
34 | 34 | ||
35 | #endif | 35 | #endif |
36 | #include <libkcal/calendarlocal.h> | 36 | #include <libkcal/calendarlocal.h> |
37 | #include <libkcal/todo.h> | 37 | #include <libkcal/todo.h> |
@@ -2040,27 +2040,29 @@ void MainWindow::save() | |||
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 | |||
2049 | if ( mView->viewManager()->journalView() ) | 2048 | if ( mView->viewManager()->journalView() ) |
2050 | mView->viewManager()->journalView()->checkModified(); | 2049 | mView->viewManager()->journalView()->checkModified(); |
2051 | if ( !mCalendarModifiedFlag ) { | 2050 | if ( !mCalendarModifiedFlag ) { |
2052 | qDebug("KO: Calendar not modified. Nothing saved."); | 2051 | qDebug("KO: Calendar not modified. Nothing saved."); |
2053 | return; | 2052 | return; |
2054 | } | 2053 | } |
2055 | if ( mSyncManager->blockSave() ) { | 2054 | if ( mSyncManager->blockSave() ) { |
2056 | slotModifiedChanged( true ); | 2055 | slotModifiedChanged( true ); |
2057 | return; | 2056 | return; |
2058 | } | 2057 | } |
2058 | #ifndef DESKTOP_VERSION | ||
2059 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | ||
2060 | #endif | ||
2059 | mSaveDelay = 0; | 2061 | mSaveDelay = 0; |
2060 | mSyncManager->setBlockSave(true); | 2062 | mSyncManager->setBlockSave(true); |
2061 | if ( mView->checkAllFileVersions() ) { | 2063 | if ( mView->checkAllFileVersions() ) { |
2062 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 2064 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
2063 | QDate reference ( 2000,1,1); | 2065 | QDate reference ( 2000,1,1); |
2064 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 2066 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
2065 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 2067 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
2066 | backupAllFiles(); | 2068 | backupAllFiles(); |
@@ -2083,16 +2085,19 @@ void MainWindow::save() | |||
2083 | else | 2085 | else |
2084 | qDebug(savemes); | 2086 | qDebug(savemes); |
2085 | } else { | 2087 | } else { |
2086 | setCaption(i18n("Saving cancelled!")); | 2088 | setCaption(i18n("Saving cancelled!")); |
2087 | mCalendarModifiedFlag = false; | 2089 | mCalendarModifiedFlag = false; |
2088 | slotModifiedChanged( true ); | 2090 | slotModifiedChanged( true ); |
2089 | } | 2091 | } |
2090 | mSyncManager->setBlockSave( false ); | 2092 | mSyncManager->setBlockSave( false ); |
2093 | #ifndef DESKTOP_VERSION | ||
2094 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); | ||
2095 | #endif | ||
2091 | } | 2096 | } |
2092 | 2097 | ||
2093 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2098 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2094 | { | 2099 | { |
2095 | if ( !e->isAutoRepeat() ) { | 2100 | if ( !e->isAutoRepeat() ) { |
2096 | mFlagKeyPressed = false; | 2101 | mFlagKeyPressed = false; |
2097 | } | 2102 | } |
2098 | } | 2103 | } |
@@ -2501,18 +2506,24 @@ void MainWindow::saveCalendar() | |||
2501 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); | 2506 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); |
2502 | QString bupHint; | 2507 | QString bupHint; |
2503 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) | 2508 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) |
2504 | 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!)"); |
2505 | 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; |
2506 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; | 2511 | bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; |
2507 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 2512 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
2508 | save(); | 2513 | save(); |
2514 | #ifndef DESKTOP_VERSION | ||
2515 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | ||
2516 | #endif | ||
2509 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; | 2517 | KPimGlobalPrefs::instance()->mBackupEnabled = enabled; |
2510 | backupAllFiles(); | 2518 | backupAllFiles(); |
2519 | #ifndef DESKTOP_VERSION | ||
2520 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); | ||
2521 | #endif | ||
2511 | } | 2522 | } |
2512 | void MainWindow::loadCalendar() | 2523 | void MainWindow::loadCalendar() |
2513 | { | 2524 | { |
2514 | 2525 | ||
2515 | 2526 | ||
2516 | #if 0 | 2527 | #if 0 |
2517 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2528 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2518 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2529 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index f7d40ad..70a7711 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -24,16 +24,20 @@ | |||
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
27 | 27 | ||
28 | #include "calendarlocal.h" | 28 | #include "calendarlocal.h" |
29 | #include "icalformat.h" | 29 | #include "icalformat.h" |
30 | #include "todo.h" | 30 | #include "todo.h" |
31 | 31 | ||
32 | #ifndef DESKTOP_VERSION | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | #endif | ||
35 | |||
32 | #define SAVETIMER_TIMEOUT_SECONDS 300 | 36 | #define SAVETIMER_TIMEOUT_SECONDS 300 |
33 | //#define SAVETIMER_TIMEOUT_SECONDS 8 | 37 | //#define SAVETIMER_TIMEOUT_SECONDS 8 |
34 | #define SAVETIMER_TIMEOUT_RETRY_SECONDS 5 | 38 | #define SAVETIMER_TIMEOUT_RETRY_SECONDS 5 |
35 | 39 | ||
36 | using namespace KCal; | 40 | using namespace KCal; |
37 | 41 | ||
38 | Todo::Todo(): QObject(), Incidence() | 42 | Todo::Todo(): QObject(), Incidence() |
39 | { | 43 | { |
@@ -134,28 +138,30 @@ void Todo::timerSlotSaveRunningInfoToFile() | |||
134 | restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); | 138 | restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); |
135 | return; | 139 | return; |
136 | } | 140 | } |
137 | // qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); | 141 | // qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); |
138 | if ( msecs > ( ( mCurrentTimerDelay * 1000 ) + 50 )) { | 142 | if ( msecs > ( ( mCurrentTimerDelay * 1000 ) + 50 )) { |
139 | qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); | 143 | qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); |
140 | restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); | 144 | restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); |
141 | return; | 145 | return; |
142 | |||
143 | } | 146 | } |
144 | restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); | 147 | restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); |
145 | saveRunningInfoToFile( QString::null ); | 148 | saveRunningInfoToFile( QString::null ); |
146 | } | 149 | } |
147 | void Todo::saveRunningInfoToFile() | 150 | void Todo::saveRunningInfoToFile() |
148 | { | 151 | { |
149 | mRunEnd = QDateTime::currentDateTime(); | 152 | mRunEnd = QDateTime::currentDateTime(); |
150 | saveRunningInfoToFile( QString::null ); | 153 | saveRunningInfoToFile( QString::null ); |
151 | } | 154 | } |
152 | void Todo::saveRunningInfoToFile( QString comment ) | 155 | void Todo::saveRunningInfoToFile( QString comment ) |
153 | { | 156 | { |
157 | #ifndef DESKTOP_VERSION | ||
158 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | ||
159 | #endif | ||
154 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 160 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
155 | if ( mRunStart.secsTo ( mRunEnd) < 15 ) { | 161 | if ( mRunStart.secsTo ( mRunEnd) < 15 ) { |
156 | qDebug("Running time < 15 seconds. Skipped. "); | 162 | qDebug("Running time < 15 seconds. Skipped. "); |
157 | return; | 163 | return; |
158 | } | 164 | } |
159 | QString dir = KGlobalSettings::timeTrackerDir(); | 165 | QString dir = KGlobalSettings::timeTrackerDir(); |
160 | //qDebug("%s ", dir.latin1()); | 166 | //qDebug("%s ", dir.latin1()); |
161 | QString file = "%1%2%3-%4%5%6-"; | 167 | QString file = "%1%2%3-%4%5%6-"; |
@@ -179,17 +185,19 @@ void Todo::saveRunningInfoToFile( QString comment ) | |||
179 | else | 185 | else |
180 | to->setDescription( "TT-Note: " + comment +"\n" + des ); | 186 | to->setDescription( "TT-Note: " + comment +"\n" + des ); |
181 | } | 187 | } |
182 | cal.addIncidence( to ); | 188 | cal.addIncidence( to ); |
183 | ICalFormat format( false ); | 189 | ICalFormat format( false ); |
184 | file = dir +"/" +file +".ics"; | 190 | file = dir +"/" +file +".ics"; |
185 | format.save( &cal, file ); | 191 | format.save( &cal, file ); |
186 | saveParents(); | 192 | saveParents(); |
187 | 193 | #ifndef DESKTOP_VERSION | |
194 | QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); | ||
195 | #endif | ||
188 | } | 196 | } |
189 | void Todo::saveParents() | 197 | void Todo::saveParents() |
190 | { | 198 | { |
191 | if (!relatedTo() ) | 199 | if (!relatedTo() ) |
192 | return; | 200 | return; |
193 | Incidence * inc = relatedTo(); | 201 | Incidence * inc = relatedTo(); |
194 | if ( inc->typeID() != todoID ) | 202 | if ( inc->typeID() != todoID ) |
195 | return; | 203 | return; |