author | zautrix <zautrix> | 2005-09-25 02:09:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-25 02:09:22 (UTC) |
commit | 3bbc14431e854bc3d8870b5ba12d64f6e1af6eb6 (patch) (side-by-side diff) | |
tree | 0d88d48dc1b9198c9c2deed6b55c70deffcfeadd | |
parent | 181bc87d92ecc48cb07c288cb2d135d8fde56716 (diff) | |
download | kdepimpi-3bbc14431e854bc3d8870b5ba12d64f6e1af6eb6.zip kdepimpi-3bbc14431e854bc3d8870b5ba12d64f6e1af6eb6.tar.gz kdepimpi-3bbc14431e854bc3d8870b5ba12d64f6e1af6eb6.tar.bz2 |
todo timer fix
-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 @@ -96,19 +96,22 @@ int main( int argc, char **argv ) m.show(); //m.resize( 800, 600 ); //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif if ( argc > 1 ) { QCString command = argv[1]; if ( argc > 2 ) command += argv[2]; m.recieve(command, QByteArray() ); } +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); +#endif a.exec(); dumpMissing(); KPimGlobalPrefs::instance()->writeConfig(); } qDebug("KO: Bye! "); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d1e369c..05e5087 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -17,25 +17,25 @@ #include <qcheckbox.h> #include <qmap.h> #include <qwmatrix.h> #include <qtextbrowser.h> #include <qtextstream.h> #ifndef DESKTOP_VERSION #include <qpe/global.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <qtopia/alarmserver.h> #include <qtopia/qcopenvelope_qws.h> -#include <unistd.h> // for sleep +//#include <unistd.h> // for sleep #else #include <qtoolbar.h> #include <qapplication.h> //#include <resource.h> #endif #include <libkcal/calendarlocal.h> #include <libkcal/todo.h> #include <libkcal/phoneformat.h> #include <libkdepim/ksyncprofile.h> #include <libkdepim/phoneaccess.h> #include <libkcal/kincidenceformatter.h> @@ -2036,35 +2036,37 @@ void MainWindow::save() int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() ); if ( mSaveDelay < elapsed ) { qDebug("KO: Pending save after wakeup from suspend detected."); qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed ); qDebug("KO: Restarting save timer to save in 10 sec."); int msec = 10000; mSaveTimer.start( msec, true ); mSaveTimerStart = QDateTime::currentDateTime(); mSaveDelay = msec/1000; return; } } - if ( mView->viewManager()->journalView() ) mView->viewManager()->journalView()->checkModified(); if ( !mCalendarModifiedFlag ) { qDebug("KO: Calendar not modified. Nothing saved."); return; } if ( mSyncManager->blockSave() ) { slotModifiedChanged( true ); return; } +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); +#endif mSaveDelay = 0; mSyncManager->setBlockSave(true); if ( mView->checkAllFileVersions() ) { if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ QDate reference ( 2000,1,1); int daysTo = reference.daysTo ( QDate::currentDate() ); if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { backupAllFiles(); } ; // KPimGlobalPrefs::instance()->mLastBackupDate } QTime neededSaveTime; @@ -2079,24 +2081,27 @@ void MainWindow::save() QString savemes; savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); if ( !isMinimized () ) setCaption(savemes); else qDebug(savemes); } else { setCaption(i18n("Saving cancelled!")); mCalendarModifiedFlag = false; slotModifiedChanged( true ); } mSyncManager->setBlockSave( false ); +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); +#endif } void MainWindow::keyReleaseEvent ( QKeyEvent * e) { if ( !e->isAutoRepeat() ) { mFlagKeyPressed = false; } } void MainWindow::keyPressEvent ( QKeyEvent * e ) { qApp->processEvents(); if ( e->isAutoRepeat() && !mFlagKeyPressed ) { @@ -2497,26 +2502,32 @@ void MainWindow::saveCalendar() { QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) bupDir = KGlobalSettings::backupDataDir(); bupDir = KGlobal::formatMessage ( bupDir, 0 ); QString bupHint; if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 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; bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; KPimGlobalPrefs::instance()->mBackupEnabled = false; save(); +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); +#endif KPimGlobalPrefs::instance()->mBackupEnabled = enabled; backupAllFiles(); +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); +#endif } void MainWindow::loadCalendar() { #if 0 QString fn = KOPrefs::instance()->mLastLoadFile; fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); if ( fn == "" ) return; QFileInfo info; diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index f7d40ad..70a7711 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -20,24 +20,28 @@ #include <kglobal.h> #include <kglobalsettings.h> #include <klocale.h> #include <kdebug.h> #include <qregexp.h> #include <qfileinfo.h> #include "calendarlocal.h" #include "icalformat.h" #include "todo.h" +#ifndef DESKTOP_VERSION +#include <qpe/qpeapplication.h> +#endif + #define SAVETIMER_TIMEOUT_SECONDS 300 //#define SAVETIMER_TIMEOUT_SECONDS 8 #define SAVETIMER_TIMEOUT_RETRY_SECONDS 5 using namespace KCal; Todo::Todo(): QObject(), Incidence() { // mStatus = TENTATIVE; mHasDueDate = false; setHasStartDate( false ); @@ -130,36 +134,38 @@ void Todo::timerSlotSaveRunningInfoToFile() return; } int msecs = mRunLastSave.time().msecsTo( mRunEnd.time()); if ( msecs < 0 ) { restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); return; } // qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); if ( msecs > ( ( mCurrentTimerDelay * 1000 ) + 50 )) { qDebug("KO Todo::saveTimerTimeout restarting! millisecs %d", msecs - ( ( mCurrentTimerDelay * 1000 ) + 50 ) ); restartSaveTimer( SAVETIMER_TIMEOUT_RETRY_SECONDS ); return; - } restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); saveRunningInfoToFile( QString::null ); } void Todo::saveRunningInfoToFile() { mRunEnd = QDateTime::currentDateTime(); saveRunningInfoToFile( QString::null ); } void Todo::saveRunningInfoToFile( QString comment ) { +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); +#endif //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); if ( mRunStart.secsTo ( mRunEnd) < 15 ) { qDebug("Running time < 15 seconds. Skipped. "); return; } QString dir = KGlobalSettings::timeTrackerDir(); //qDebug("%s ", dir.latin1()); QString file = "%1%2%3-%4%5%6-"; 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 ); file.replace ( QRegExp (" "), "0" ); file += uid(); //qDebug("File %s ",file.latin1() ); @@ -175,25 +181,27 @@ void Todo::saveRunningInfoToFile( QString comment ) if ( !comment.isEmpty() ) { QString des = to->description(); if ( des.isEmpty () ) to->setDescription( "TT-Note: " + comment ); else to->setDescription( "TT-Note: " + comment +"\n" + des ); } cal.addIncidence( to ); ICalFormat format( false ); file = dir +"/" +file +".ics"; format.save( &cal, file ); saveParents(); - +#ifndef DESKTOP_VERSION + QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); +#endif } void Todo::saveParents() { if (!relatedTo() ) return; Incidence * inc = relatedTo(); if ( inc->typeID() != todoID ) return; Todo* to = (Todo*)inc; bool saveTodo = false; QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; QFileInfo fi ( file ); |