author | zautrix <zautrix> | 2005-09-25 02:09:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-25 02:09:22 (UTC) |
commit | 3bbc14431e854bc3d8870b5ba12d64f6e1af6eb6 (patch) (unidiff) | |
tree | 0d88d48dc1b9198c9c2deed6b55c70deffcfeadd /korganizer | |
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 |
2 files changed, 16 insertions, 2 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index a96f7c2..9410c6a 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -60,55 +60,58 @@ int main( int argc, char **argv ) | |||
60 | printf(" -newEvent: New Event dialog\n"); | 60 | printf(" -newEvent: New Event dialog\n"); |
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 | ||
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 | |||
@@ -1,77 +1,77 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
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> |
38 | #include <libkcal/phoneformat.h> | 38 | #include <libkcal/phoneformat.h> |
39 | #include <libkdepim/ksyncprofile.h> | 39 | #include <libkdepim/ksyncprofile.h> |
40 | #include <libkdepim/phoneaccess.h> | 40 | #include <libkdepim/phoneaccess.h> |
41 | #include <libkcal/kincidenceformatter.h> | 41 | #include <libkcal/kincidenceformatter.h> |
42 | #include <libkdepim/kpimglobalprefs.h> | 42 | #include <libkdepim/kpimglobalprefs.h> |
43 | 43 | ||
44 | #include "calendarview.h" | 44 | #include "calendarview.h" |
45 | #include "koviewmanager.h" | 45 | #include "koviewmanager.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | #include "koagendaview.h" | 47 | #include "koagendaview.h" |
48 | #include "kojournalview.h" | 48 | #include "kojournalview.h" |
49 | #include "koagenda.h" | 49 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 50 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 51 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 52 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 53 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 54 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 55 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 56 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 57 | #include "koglobals.h" |
58 | #include "kglobal.h" | 58 | #include "kglobal.h" |
59 | #include "ktoolbar.h" | 59 | #include "ktoolbar.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "externalapphandler.h" | 62 | #include "externalapphandler.h" |
63 | #include <kglobalsettings.h> | 63 | #include <kglobalsettings.h> |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | 75 | ||
76 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
77 | { | 77 | { |
@@ -2000,139 +2000,144 @@ void MainWindow::backupAllFiles() | |||
2000 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 2000 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
2001 | // we need the file path, the backup dir and the number of bups as param | 2001 | // we need the file path, the backup dir and the number of bups as param |
2002 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2002 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2003 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2003 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2004 | bupDir = KGlobalSettings::backupDataDir(); | 2004 | bupDir = KGlobalSettings::backupDataDir(); |
2005 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 2005 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
2006 | if ( retval == 0 ) { | 2006 | if ( retval == 0 ) { |
2007 | setCaption(i18n("Backup cancelled" )); | 2007 | setCaption(i18n("Backup cancelled" )); |
2008 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 2008 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
2009 | // retval == 0 : backup skipped for today, try again tomorrow | 2009 | // retval == 0 : backup skipped for today, try again tomorrow |
2010 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 2010 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
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 | } |
2033 | void MainWindow::save() | 2033 | void 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 | |||
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(); |
2067 | } | 2069 | } |
2068 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 2070 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
2069 | } | 2071 | } |
2070 | QTime neededSaveTime; | 2072 | QTime neededSaveTime; |
2071 | neededSaveTime.start(); | 2073 | neededSaveTime.start(); |
2072 | if ( !isMinimized () ) | 2074 | if ( !isMinimized () ) |
2073 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 2075 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
2074 | qDebug("KO: Start saving data to file!"); | 2076 | qDebug("KO: Start saving data to file!"); |
2075 | if ( mView->saveCalendars() ) | 2077 | if ( mView->saveCalendars() ) |
2076 | mCalendarModifiedFlag = false; | 2078 | mCalendarModifiedFlag = false; |
2077 | int msNeeded = neededSaveTime.elapsed(); | 2079 | int msNeeded = neededSaveTime.elapsed(); |
2078 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2080 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
2079 | QString savemes; | 2081 | QString savemes; |
2080 | 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 ); |
2081 | if ( !isMinimized () ) | 2083 | if ( !isMinimized () ) |
2082 | setCaption(savemes); | 2084 | setCaption(savemes); |
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 | } |
2099 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2104 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2100 | { | 2105 | { |
2101 | qApp->processEvents(); | 2106 | qApp->processEvents(); |
2102 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2107 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2103 | e->ignore(); | 2108 | e->ignore(); |
2104 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2109 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2105 | return; | 2110 | return; |
2106 | } | 2111 | } |
2107 | if (! e->isAutoRepeat() ) | 2112 | if (! e->isAutoRepeat() ) |
2108 | mFlagKeyPressed = true; | 2113 | mFlagKeyPressed = true; |
2109 | KOPrefs *p = KOPrefs::instance(); | 2114 | KOPrefs *p = KOPrefs::instance(); |
2110 | bool showSelectedDates = false; | 2115 | bool showSelectedDates = false; |
2111 | int size; | 2116 | int size; |
2112 | int pro = 0; | 2117 | int pro = 0; |
2113 | //qDebug("MainWindow::keyPressEvent "); | 2118 | //qDebug("MainWindow::keyPressEvent "); |
2114 | switch ( e->key() ) { | 2119 | switch ( e->key() ) { |
2115 | case Qt::Key_Right: | 2120 | case Qt::Key_Right: |
2116 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2121 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2117 | mView->goNextMonth(); | 2122 | mView->goNextMonth(); |
2118 | else | 2123 | else |
2119 | mView->goNext(); | 2124 | mView->goNext(); |
2120 | showSelectedDates = true; | 2125 | showSelectedDates = true; |
2121 | break; | 2126 | break; |
2122 | case Qt::Key_Left: | 2127 | case Qt::Key_Left: |
2123 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2128 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2124 | mView->goPreviousMonth(); | 2129 | mView->goPreviousMonth(); |
2125 | else | 2130 | else |
2126 | mView->goPrevious(); | 2131 | mView->goPrevious(); |
2127 | showSelectedDates = true; | 2132 | showSelectedDates = true; |
2128 | break; | 2133 | break; |
2129 | case Qt::Key_Down: | 2134 | case Qt::Key_Down: |
2130 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2135 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2131 | break; | 2136 | break; |
2132 | case Qt::Key_Up: | 2137 | case Qt::Key_Up: |
2133 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2138 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2134 | break; | 2139 | break; |
2135 | case Qt::Key_K: | 2140 | case Qt::Key_K: |
2136 | mView->viewManager()->showMonthViewWeek(); | 2141 | mView->viewManager()->showMonthViewWeek(); |
2137 | break; | 2142 | break; |
2138 | case Qt::Key_I: | 2143 | case Qt::Key_I: |
@@ -2461,98 +2466,104 @@ void MainWindow::setCaptionToDates() | |||
2461 | if ( ! date.isValid() ) { | 2466 | if ( ! date.isValid() ) { |
2462 | setCaption(""); | 2467 | setCaption(""); |
2463 | return; | 2468 | return; |
2464 | } | 2469 | } |
2465 | selDates = KGlobal::locale()->formatDate( date, true); | 2470 | selDates = KGlobal::locale()->formatDate( date, true); |
2466 | if (mView->startDate() < mView->endDate() ) | 2471 | if (mView->startDate() < mView->endDate() ) |
2467 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2472 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2468 | else { | 2473 | else { |
2469 | QString addString; | 2474 | QString addString; |
2470 | if ( date == QDateTime::currentDateTime().date() ) | 2475 | if ( date == QDateTime::currentDateTime().date() ) |
2471 | addString = i18n("Today"); | 2476 | addString = i18n("Today"); |
2472 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2477 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2473 | addString = i18n("Tomorrow"); | 2478 | addString = i18n("Tomorrow"); |
2474 | if ( !addString.isEmpty() ) | 2479 | if ( !addString.isEmpty() ) |
2475 | selDates = addString+", "+selDates ; | 2480 | selDates = addString+", "+selDates ; |
2476 | } | 2481 | } |
2477 | setCaption( i18n("Dates: ") + selDates ); | 2482 | setCaption( i18n("Dates: ") + selDates ); |
2478 | 2483 | ||
2479 | } | 2484 | } |
2480 | void MainWindow::showConfigureAgenda( ) | 2485 | void MainWindow::showConfigureAgenda( ) |
2481 | { | 2486 | { |
2482 | int iii; | 2487 | int iii; |
2483 | for ( iii = 1;iii<= 10 ;++iii ){ | 2488 | for ( iii = 1;iii<= 10 ;++iii ){ |
2484 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2489 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2485 | } | 2490 | } |
2486 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2491 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2487 | } | 2492 | } |
2488 | void MainWindow::configureAgenda( int item ) | 2493 | void MainWindow::configureAgenda( int item ) |
2489 | { | 2494 | { |
2490 | if ( KOPrefs::instance()->mHourSize == item ) | 2495 | if ( KOPrefs::instance()->mHourSize == item ) |
2491 | return; | 2496 | return; |
2492 | KOPrefs::instance()->mHourSize=item; | 2497 | KOPrefs::instance()->mHourSize=item; |
2493 | mView->viewManager()->agendaView()->updateConfig(); | 2498 | mView->viewManager()->agendaView()->updateConfig(); |
2494 | } | 2499 | } |
2495 | 2500 | ||
2496 | void MainWindow::saveCalendar() | 2501 | void MainWindow::saveCalendar() |
2497 | { | 2502 | { |
2498 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 2503 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2499 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 2504 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2500 | bupDir = KGlobalSettings::backupDataDir(); | 2505 | bupDir = KGlobalSettings::backupDataDir(); |
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 ); |
2519 | 2530 | ||
2520 | if ( fn == "" ) | 2531 | if ( fn == "" ) |
2521 | return; | 2532 | return; |
2522 | QFileInfo info; | 2533 | QFileInfo info; |
2523 | info.setFile( fn ); | 2534 | info.setFile( fn ); |
2524 | QString mess; | 2535 | QString mess; |
2525 | bool loadbup = true; | 2536 | bool loadbup = true; |
2526 | if ( info. exists() ) { | 2537 | if ( info. exists() ) { |
2527 | 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 )); |
2528 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2539 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2529 | mess, | 2540 | mess, |
2530 | i18n("Load!"), i18n("Cancel"), 0, | 2541 | i18n("Load!"), i18n("Cancel"), 0, |
2531 | 0, 1 ); | 2542 | 0, 1 ); |
2532 | if ( result != 0 ) { | 2543 | if ( result != 0 ) { |
2533 | loadbup = false; | 2544 | loadbup = false; |
2534 | } | 2545 | } |
2535 | } else { | 2546 | } else { |
2536 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2547 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2537 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2548 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2538 | 0, 1 ); | 2549 | 0, 1 ); |
2539 | 2550 | ||
2540 | return; | 2551 | return; |
2541 | } | 2552 | } |
2542 | if ( loadbup ) { | 2553 | if ( loadbup ) { |
2543 | mView->openCalendar( fn ); | 2554 | mView->openCalendar( fn ); |
2544 | KOPrefs::instance()->mLastLoadFile = fn; | 2555 | KOPrefs::instance()->mLastLoadFile = fn; |
2545 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2556 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2546 | setCaption(mess); | 2557 | setCaption(mess); |
2547 | } | 2558 | } |
2548 | #endif | 2559 | #endif |
2549 | 2560 | ||
2550 | } | 2561 | } |
2551 | void MainWindow::quickImportIcal() | 2562 | void MainWindow::quickImportIcal() |
2552 | { | 2563 | { |
2553 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2564 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2554 | } | 2565 | } |
2555 | void MainWindow::importFile( QString fn, bool quick ) | 2566 | void MainWindow::importFile( QString fn, bool quick ) |
2556 | { | 2567 | { |
2557 | QFileInfo info; | 2568 | QFileInfo info; |
2558 | info.setFile( fn ); | 2569 | info.setFile( fn ); |