author | zautrix <zautrix> | 2005-09-25 02:28:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-25 02:28:24 (UTC) |
commit | fa126dfea03b4ebed9a4eed4f2104f93abb72e22 (patch) (unidiff) | |
tree | dab730835ae807e407b928623a85294558d756cb | |
parent | 3bbc14431e854bc3d8870b5ba12d64f6e1af6eb6 (diff) | |
download | kdepimpi-fa126dfea03b4ebed9a4eed4f2104f93abb72e22.zip kdepimpi-fa126dfea03b4ebed9a4eed4f2104f93abb72e22.tar.gz kdepimpi-fa126dfea03b4ebed9a4eed4f2104f93abb72e22.tar.bz2 |
todo timer fix
-rw-r--r-- | korganizer/main.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 | ||||
-rw-r--r-- | libkcal/todo.cpp | 4 |
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 | |||
@@ -1,117 +1,117 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qcopchannel_qws.h> | 5 | #include <qcopchannel_qws.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #include <stdlib.h> | 14 | #include <stdlib.h> |
15 | #endif | 15 | #endif |
16 | #include <qtextcodec.h> | 16 | #include <qtextcodec.h> |
17 | 17 | ||
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <kstandarddirs.h> | 19 | #include <kstandarddirs.h> |
20 | #include <kglobal.h> | 20 | #include <kglobal.h> |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include "mainwindow.h" | 22 | #include "mainwindow.h" |
23 | #include <libkdepim/kpimglobalprefs.h> | 23 | #include <libkdepim/kpimglobalprefs.h> |
24 | void dumpMissing(); | 24 | void dumpMissing(); |
25 | 25 | ||
26 | 26 | ||
27 | int main( int argc, char **argv ) | 27 | int main( int argc, char **argv ) |
28 | { | 28 | { |
29 | #ifndef DESKTOP_VERSION | 29 | #ifndef DESKTOP_VERSION |
30 | QPEApplication a( argc, argv ); | 30 | QPEApplication a( argc, argv ); |
31 | a.setKeepRunning (); | 31 | a.setKeepRunning (); |
32 | #else | 32 | #else |
33 | QApplication a( argc, argv ); | 33 | QApplication a( argc, argv ); |
34 | QApplication::setStyle( new QPlatinumStyle ()); | 34 | QApplication::setStyle( new QPlatinumStyle ()); |
35 | #ifdef _WIN32_ | 35 | #ifdef _WIN32_ |
36 | QString hdir ( getenv( "HOME") ); | 36 | QString hdir ( getenv( "HOME") ); |
37 | if ( hdir.isEmpty() ) { | 37 | if ( hdir.isEmpty() ) { |
38 | QString hd ("C:/" ); | 38 | QString hd ("C:/" ); |
39 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); | 39 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); |
40 | if ( QDir::homeDirPath().lower() == hd.lower() ) { | 40 | if ( QDir::homeDirPath().lower() == hd.lower() ) { |
41 | _putenv( "HOME=C:"); | 41 | _putenv( "HOME=C:"); |
42 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); | 42 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); |
43 | } | 43 | } |
44 | } else { | 44 | } else { |
45 | QDir app_dir; | 45 | QDir app_dir; |
46 | if ( !app_dir.exists(hdir) ) | 46 | if ( !app_dir.exists(hdir) ) |
47 | app_dir.mkdir (hdir); | 47 | app_dir.mkdir (hdir); |
48 | } | 48 | } |
49 | #endif | 49 | #endif |
50 | #endif | 50 | #endif |
51 | bool exitHelp = false; | 51 | bool exitHelp = false; |
52 | if ( argc > 1 ) { | 52 | if ( argc > 1 ) { |
53 | QString command = argv[1]; | 53 | QString command = argv[1]; |
54 | if ( command == "-help" ){ | 54 | if ( command == "-help" ){ |
55 | printf("KO/Pi command line commands:\n"); | 55 | printf("KO/Pi command line commands:\n"); |
56 | printf(" no command: Start KO/Pi in usual way\n"); | 56 | printf(" no command: Start KO/Pi in usual way\n"); |
57 | printf(" -help: This output\n"); | 57 | printf(" -help: This output\n"); |
58 | printf("Next Option: Open or Show after start:\n"); | 58 | printf("Next Option: Open or Show after start:\n"); |
59 | printf(" -newTodo: New Todo dialog\n"); | 59 | printf(" -newTodo: New Todo dialog\n"); |
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 | 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 | |||
@@ -1035,1744 +1035,1744 @@ void MainWindow::initActions() | |||
1035 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 1035 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
1036 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 1036 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
1037 | day1_action->addTo( viewMenu ); | 1037 | day1_action->addTo( viewMenu ); |
1038 | // action->addTo( toolBar ); | 1038 | // action->addTo( toolBar ); |
1039 | connect( day1_action, SIGNAL( activated() ), | 1039 | connect( day1_action, SIGNAL( activated() ), |
1040 | mView->viewManager(), SLOT( showDayView() ) ); | 1040 | mView->viewManager(), SLOT( showDayView() ) ); |
1041 | 1041 | ||
1042 | icon = loadPixmap( pathString + "workweek" ); | 1042 | icon = loadPixmap( pathString + "workweek" ); |
1043 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 1043 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
1044 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 1044 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
1045 | day5_action->addTo( viewMenu ); | 1045 | day5_action->addTo( viewMenu ); |
1046 | connect( day5_action, SIGNAL( activated() ), | 1046 | connect( day5_action, SIGNAL( activated() ), |
1047 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 1047 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
1048 | 1048 | ||
1049 | icon = loadPixmap( pathString + "week" ); | 1049 | icon = loadPixmap( pathString + "week" ); |
1050 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 1050 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
1051 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 1051 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
1052 | day7_action->addTo( viewMenu ); | 1052 | day7_action->addTo( viewMenu ); |
1053 | connect( day7_action, SIGNAL( activated() ), | 1053 | connect( day7_action, SIGNAL( activated() ), |
1054 | mView->viewManager(), SLOT( showWeekView() ) ); | 1054 | mView->viewManager(), SLOT( showWeekView() ) ); |
1055 | 1055 | ||
1056 | icon = loadPixmap( pathString + "workweek2" ); | 1056 | icon = loadPixmap( pathString + "workweek2" ); |
1057 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 1057 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
1058 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 1058 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
1059 | day6_action->addTo( viewMenu ); | 1059 | day6_action->addTo( viewMenu ); |
1060 | connect( day6_action, SIGNAL( activated() ), | 1060 | connect( day6_action, SIGNAL( activated() ), |
1061 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 1061 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
1062 | 1062 | ||
1063 | icon = loadPixmap( pathString + "month" ); | 1063 | icon = loadPixmap( pathString + "month" ); |
1064 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 1064 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
1065 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 1065 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
1066 | month_action->addTo( viewMenu ); | 1066 | month_action->addTo( viewMenu ); |
1067 | connect( month_action, SIGNAL( activated() ), | 1067 | connect( month_action, SIGNAL( activated() ), |
1068 | mView->viewManager(), SLOT( showMonthView() ) ); | 1068 | mView->viewManager(), SLOT( showMonthView() ) ); |
1069 | 1069 | ||
1070 | icon = loadPixmap( pathString + "list" ); | 1070 | icon = loadPixmap( pathString + "list" ); |
1071 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 1071 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
1072 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 1072 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
1073 | showlist_action->addTo( viewMenu ); | 1073 | showlist_action->addTo( viewMenu ); |
1074 | connect( showlist_action, SIGNAL( activated() ), | 1074 | connect( showlist_action, SIGNAL( activated() ), |
1075 | mView->viewManager(), SLOT( showListView() ) ); | 1075 | mView->viewManager(), SLOT( showListView() ) ); |
1076 | 1076 | ||
1077 | icon = loadPixmap( pathString + "todo" ); | 1077 | icon = loadPixmap( pathString + "todo" ); |
1078 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 1078 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
1079 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 1079 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
1080 | todoview_action->addTo( viewMenu ); | 1080 | todoview_action->addTo( viewMenu ); |
1081 | connect( todoview_action, SIGNAL( activated() ), | 1081 | connect( todoview_action, SIGNAL( activated() ), |
1082 | mView->viewManager(), SLOT( showTodoView() ) ); | 1082 | mView->viewManager(), SLOT( showTodoView() ) ); |
1083 | 1083 | ||
1084 | 1084 | ||
1085 | 1085 | ||
1086 | #if 0 | 1086 | #if 0 |
1087 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 1087 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
1088 | action->addTo( viewMenu ); | 1088 | action->addTo( viewMenu ); |
1089 | connect( action, SIGNAL( activated() ), | 1089 | connect( action, SIGNAL( activated() ), |
1090 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 1090 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
1091 | #endif | 1091 | #endif |
1092 | 1092 | ||
1093 | 1093 | ||
1094 | 1094 | ||
1095 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, | 1095 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, |
1096 | this ); | 1096 | this ); |
1097 | action->addTo( actionMenu ); | 1097 | action->addTo( actionMenu ); |
1098 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 1098 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
1099 | 1099 | ||
1100 | 1100 | ||
1101 | icon = loadPixmap( pathString + "search" ); | 1101 | icon = loadPixmap( pathString + "search" ); |
1102 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 1102 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
1103 | 1103 | ||
1104 | 1104 | ||
1105 | 1105 | ||
1106 | actionMenu->insertSeparator(); | 1106 | actionMenu->insertSeparator(); |
1107 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, | 1107 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, |
1108 | this ); | 1108 | this ); |
1109 | action->addTo( actionMenu ); | 1109 | action->addTo( actionMenu ); |
1110 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); | 1110 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); |
1111 | 1111 | ||
1112 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1112 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1113 | this ); | 1113 | this ); |
1114 | action->addTo( actionMenu ); | 1114 | action->addTo( actionMenu ); |
1115 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1115 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1116 | 1116 | ||
1117 | 1117 | ||
1118 | actionMenu->insertSeparator(); | 1118 | actionMenu->insertSeparator(); |
1119 | icon = loadPixmap( pathString + "configure" ); | 1119 | icon = loadPixmap( pathString + "configure" ); |
1120 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 1120 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
1121 | action->addTo( actionMenu ); | 1121 | action->addTo( actionMenu ); |
1122 | connect( action, SIGNAL( activated() ), | 1122 | connect( action, SIGNAL( activated() ), |
1123 | mView, SLOT( edit_options() ) ); | 1123 | mView, SLOT( edit_options() ) ); |
1124 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); | 1124 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); |
1125 | action->addTo( actionMenu ); | 1125 | action->addTo( actionMenu ); |
1126 | connect( action, SIGNAL( activated() ), | 1126 | connect( action, SIGNAL( activated() ), |
1127 | this, SLOT( calHint() ) ); | 1127 | this, SLOT( calHint() ) ); |
1128 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 1128 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
1129 | action->addTo( actionMenu ); | 1129 | action->addTo( actionMenu ); |
1130 | connect( action, SIGNAL( activated() ), | 1130 | connect( action, SIGNAL( activated() ), |
1131 | mView, SLOT( edit_global_options() ) ); | 1131 | mView, SLOT( edit_global_options() ) ); |
1132 | if ( KOPrefs::instance()->mShowFullMenu ) { | 1132 | if ( KOPrefs::instance()->mShowFullMenu ) { |
1133 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 1133 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
1134 | 1134 | ||
1135 | } | 1135 | } |
1136 | // actionMenu->insertSeparator(); | 1136 | // actionMenu->insertSeparator(); |
1137 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 1137 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
1138 | this ); | 1138 | this ); |
1139 | action->addTo( importMenu_X ); | 1139 | action->addTo( importMenu_X ); |
1140 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 1140 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
1141 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 1141 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
1142 | this ); | 1142 | this ); |
1143 | action->addTo( importMenu_X ); | 1143 | action->addTo( importMenu_X ); |
1144 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 1144 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
1145 | importMenu_X->insertSeparator(); | 1145 | importMenu_X->insertSeparator(); |
1146 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 1146 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
1147 | this ); | 1147 | this ); |
1148 | action->addTo( importMenu_X ); | 1148 | action->addTo( importMenu_X ); |
1149 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 1149 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
1150 | //#ifndef DESKTOP_VERSION | 1150 | //#ifndef DESKTOP_VERSION |
1151 | importMenu_X->insertSeparator(); | 1151 | importMenu_X->insertSeparator(); |
1152 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 1152 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
1153 | this ); | 1153 | this ); |
1154 | action->addTo( importMenu_X ); | 1154 | action->addTo( importMenu_X ); |
1155 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 1155 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
1156 | //#else | 1156 | //#else |
1157 | #ifdef _OL_IMPORT_ | 1157 | #ifdef _OL_IMPORT_ |
1158 | importMenu_X->insertSeparator(); | 1158 | importMenu_X->insertSeparator(); |
1159 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 1159 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
1160 | this ); | 1160 | this ); |
1161 | action->addTo( importMenu_X ); | 1161 | action->addTo( importMenu_X ); |
1162 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1162 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1163 | #endif | 1163 | #endif |
1164 | //#endif | 1164 | //#endif |
1165 | 1165 | ||
1166 | //importMenu->insertSeparator(); | 1166 | //importMenu->insertSeparator(); |
1167 | #if 0 | 1167 | #if 0 |
1168 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1168 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1169 | this ); | 1169 | this ); |
1170 | action->addTo( importMenu ); | 1170 | action->addTo( importMenu ); |
1171 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1171 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1172 | #endif | 1172 | #endif |
1173 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, | 1173 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, |
1174 | this ); | 1174 | this ); |
1175 | action->addTo( importMenu ); | 1175 | action->addTo( importMenu ); |
1176 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1176 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1177 | importMenu->insertSeparator(); | 1177 | importMenu->insertSeparator(); |
1178 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1178 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1179 | //importMenu->insertSeparator(); | 1179 | //importMenu->insertSeparator(); |
1180 | action = new QAction( "export ical", i18n("Export All Data"), 0, | 1180 | action = new QAction( "export ical", i18n("Export All Data"), 0, |
1181 | this ); | 1181 | this ); |
1182 | action->addTo( exportMenu_X ); | 1182 | action->addTo( exportMenu_X ); |
1183 | connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); | 1183 | connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) ); |
1184 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1184 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1185 | this ); | 1185 | this ); |
1186 | action->addTo( exportMenu_X ); | 1186 | action->addTo( exportMenu_X ); |
1187 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1187 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1188 | 1188 | ||
1189 | 1189 | ||
1190 | //LR | 1190 | //LR |
1191 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1191 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1192 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1192 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1193 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1193 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1194 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1194 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1195 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1195 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1196 | 1196 | ||
1197 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1197 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1198 | mPrintSelAction = 0; | 1198 | mPrintSelAction = 0; |
1199 | #ifndef DESKTOP_VERSION | 1199 | #ifndef DESKTOP_VERSION |
1200 | //importMenu->insertSeparator(); | 1200 | //importMenu->insertSeparator(); |
1201 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1201 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1202 | this ); | 1202 | this ); |
1203 | brAction->addTo( beamMenu_X ); | 1203 | brAction->addTo( beamMenu_X ); |
1204 | brAction->setToggleAction (true ) ; | 1204 | brAction->setToggleAction (true ) ; |
1205 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1205 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1206 | 1206 | ||
1207 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1207 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1208 | this ); | 1208 | this ); |
1209 | action->addTo( beamMenu_X ); | 1209 | action->addTo( beamMenu_X ); |
1210 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1210 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1211 | 1211 | ||
1212 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1212 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1213 | this ); | 1213 | this ); |
1214 | action->addTo( beamMenu_X ); | 1214 | action->addTo( beamMenu_X ); |
1215 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1215 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1216 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1216 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1217 | #else | 1217 | #else |
1218 | //importMenu->insertSeparator(); | 1218 | //importMenu->insertSeparator(); |
1219 | icon = loadPixmap( pathString + "print" ); | 1219 | icon = loadPixmap( pathString + "print" ); |
1220 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1220 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1221 | action->addTo( beamMenu_X ); | 1221 | action->addTo( beamMenu_X ); |
1222 | connect( action, SIGNAL( activated() ), | 1222 | connect( action, SIGNAL( activated() ), |
1223 | this, SLOT( printCal() ) ); | 1223 | this, SLOT( printCal() ) ); |
1224 | 1224 | ||
1225 | icon = loadPixmap( pathString + "week" ); | 1225 | icon = loadPixmap( pathString + "week" ); |
1226 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1226 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1227 | action->addTo( beamMenu_X ); | 1227 | action->addTo( beamMenu_X ); |
1228 | connect( action, SIGNAL( activated() ), | 1228 | connect( action, SIGNAL( activated() ), |
1229 | this, SLOT( printSel() ) ); | 1229 | this, SLOT( printSel() ) ); |
1230 | icon = loadPixmap( pathString + "whatsnext" ); | 1230 | icon = loadPixmap( pathString + "whatsnext" ); |
1231 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1231 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1232 | action->addTo( beamMenu_X ); | 1232 | action->addTo( beamMenu_X ); |
1233 | connect( action, SIGNAL( activated() ), | 1233 | connect( action, SIGNAL( activated() ), |
1234 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1234 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1235 | 1235 | ||
1236 | 1236 | ||
1237 | icon = loadPixmap( pathString + "list" ); | 1237 | icon = loadPixmap( pathString + "list" ); |
1238 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1238 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1239 | action->addTo( beamMenu_X ); | 1239 | action->addTo( beamMenu_X ); |
1240 | connect( action, SIGNAL( activated() ), | 1240 | connect( action, SIGNAL( activated() ), |
1241 | this, SLOT( printListView() ) ); | 1241 | this, SLOT( printListView() ) ); |
1242 | 1242 | ||
1243 | icon = loadPixmap( pathString + "newevent" ); | 1243 | icon = loadPixmap( pathString + "newevent" ); |
1244 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1244 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1245 | action->addTo( beamMenu_X ); | 1245 | action->addTo( beamMenu_X ); |
1246 | connect( action, SIGNAL( activated() ), | 1246 | connect( action, SIGNAL( activated() ), |
1247 | mView, SLOT( slotprintSelInc() ) ); | 1247 | mView, SLOT( slotprintSelInc() ) ); |
1248 | mPrintSelAction = action; | 1248 | mPrintSelAction = action; |
1249 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1249 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1250 | #endif | 1250 | #endif |
1251 | 1251 | ||
1252 | importMenu->insertSeparator(); | 1252 | importMenu->insertSeparator(); |
1253 | action = new QAction( "beam all", i18n("Save"), 0, | 1253 | action = new QAction( "beam all", i18n("Save"), 0, |
1254 | this ); | 1254 | this ); |
1255 | action->addTo( importMenu ); | 1255 | action->addTo( importMenu ); |
1256 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1256 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1257 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1257 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1258 | this ); | 1258 | this ); |
1259 | action->addTo( importMenu ); | 1259 | action->addTo( importMenu ); |
1260 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1260 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1261 | 1261 | ||
1262 | //menuBar->insertItem( "Configure",configureMenu ); | 1262 | //menuBar->insertItem( "Configure",configureMenu ); |
1263 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1263 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1264 | icon = loadPixmap( "korganizer/korganizer" ); | 1264 | icon = loadPixmap( "korganizer/korganizer" ); |
1265 | 1265 | ||
1266 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1266 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1267 | action->addTo( helpMenu ); | 1267 | action->addTo( helpMenu ); |
1268 | connect( action, SIGNAL( activated() ), | 1268 | connect( action, SIGNAL( activated() ), |
1269 | SLOT( whatsNew() ) ); | 1269 | SLOT( whatsNew() ) ); |
1270 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1270 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1271 | action->addTo( helpMenu ); | 1271 | action->addTo( helpMenu ); |
1272 | connect( action, SIGNAL( activated() ), | 1272 | connect( action, SIGNAL( activated() ), |
1273 | SLOT( features() ) ); | 1273 | SLOT( features() ) ); |
1274 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1274 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1275 | action->addTo( helpMenu ); | 1275 | action->addTo( helpMenu ); |
1276 | connect( action, SIGNAL( activated() ), | 1276 | connect( action, SIGNAL( activated() ), |
1277 | SLOT( keyBindings() ) ); | 1277 | SLOT( keyBindings() ) ); |
1278 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1278 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1279 | action->addTo( helpMenu ); | 1279 | action->addTo( helpMenu ); |
1280 | connect( action, SIGNAL( activated() ), | 1280 | connect( action, SIGNAL( activated() ), |
1281 | SLOT( storagehowto() ) ); | 1281 | SLOT( storagehowto() ) ); |
1282 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1282 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1283 | action->addTo( helpMenu ); | 1283 | action->addTo( helpMenu ); |
1284 | connect( action, SIGNAL( activated() ), | 1284 | connect( action, SIGNAL( activated() ), |
1285 | SLOT( timetrackinghowto() ) ); | 1285 | SLOT( timetrackinghowto() ) ); |
1286 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1286 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1287 | action->addTo( helpMenu ); | 1287 | action->addTo( helpMenu ); |
1288 | connect( action, SIGNAL( activated() ), | 1288 | connect( action, SIGNAL( activated() ), |
1289 | SLOT( synchowto() ) ); | 1289 | SLOT( synchowto() ) ); |
1290 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1290 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1291 | action->addTo( helpMenu ); | 1291 | action->addTo( helpMenu ); |
1292 | connect( action, SIGNAL( activated() ), | 1292 | connect( action, SIGNAL( activated() ), |
1293 | SLOT( kdesynchowto() ) ); | 1293 | SLOT( kdesynchowto() ) ); |
1294 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1294 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1295 | action->addTo( helpMenu ); | 1295 | action->addTo( helpMenu ); |
1296 | connect( action, SIGNAL( activated() ), | 1296 | connect( action, SIGNAL( activated() ), |
1297 | SLOT( multisynchowto() ) ); | 1297 | SLOT( multisynchowto() ) ); |
1298 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1298 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1299 | action->addTo( helpMenu ); | 1299 | action->addTo( helpMenu ); |
1300 | connect( action, SIGNAL( activated() ), | 1300 | connect( action, SIGNAL( activated() ), |
1301 | SLOT( aboutAutoSaving() ) ); | 1301 | SLOT( aboutAutoSaving() ) ); |
1302 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1302 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1303 | action->addTo( helpMenu ); | 1303 | action->addTo( helpMenu ); |
1304 | connect( action, SIGNAL( activated() ), | 1304 | connect( action, SIGNAL( activated() ), |
1305 | SLOT( aboutKnownBugs() ) ); | 1305 | SLOT( aboutKnownBugs() ) ); |
1306 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1306 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1307 | action->addTo( helpMenu ); | 1307 | action->addTo( helpMenu ); |
1308 | connect( action, SIGNAL( activated() ), | 1308 | connect( action, SIGNAL( activated() ), |
1309 | SLOT( usertrans() ) ); | 1309 | SLOT( usertrans() ) ); |
1310 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1310 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1311 | action->addTo( helpMenu ); | 1311 | action->addTo( helpMenu ); |
1312 | connect( action, SIGNAL( activated() ), | 1312 | connect( action, SIGNAL( activated() ), |
1313 | SLOT( faq() ) ); | 1313 | SLOT( faq() ) ); |
1314 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1314 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1315 | action->addTo( helpMenu ); | 1315 | action->addTo( helpMenu ); |
1316 | connect( action, SIGNAL( activated() ), | 1316 | connect( action, SIGNAL( activated() ), |
1317 | SLOT( licence() ) ); | 1317 | SLOT( licence() ) ); |
1318 | action = new QAction( "about", i18n("About..."), 0, this ); | 1318 | action = new QAction( "about", i18n("About..."), 0, this ); |
1319 | action->addTo( helpMenu ); | 1319 | action->addTo( helpMenu ); |
1320 | connect( action, SIGNAL( activated() ), | 1320 | connect( action, SIGNAL( activated() ), |
1321 | SLOT( about() ) ); | 1321 | SLOT( about() ) ); |
1322 | //menuBar->insertSeparator(); | 1322 | //menuBar->insertSeparator(); |
1323 | 1323 | ||
1324 | // ****************************************************** | 1324 | // ****************************************************** |
1325 | // menubar icons | 1325 | // menubar icons |
1326 | 1326 | ||
1327 | 1327 | ||
1328 | 1328 | ||
1329 | //menuBar->insertItem( iconToolBar ); | 1329 | //menuBar->insertItem( iconToolBar ); |
1330 | //xdays_action | 1330 | //xdays_action |
1331 | if (p-> mShowIconNewEvent) | 1331 | if (p-> mShowIconNewEvent) |
1332 | ne_action->addTo( iconToolBar ); | 1332 | ne_action->addTo( iconToolBar ); |
1333 | if (p->mShowIconNewTodo ) | 1333 | if (p->mShowIconNewTodo ) |
1334 | nt_action->addTo( iconToolBar ); | 1334 | nt_action->addTo( iconToolBar ); |
1335 | if (p-> mShowIconSearch) | 1335 | if (p-> mShowIconSearch) |
1336 | search_action->addTo( iconToolBar ); | 1336 | search_action->addTo( iconToolBar ); |
1337 | if (p-> mShowIconWhatsThis) | 1337 | if (p-> mShowIconWhatsThis) |
1338 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1338 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1339 | if (p-> mShowIconNext) | 1339 | if (p-> mShowIconNext) |
1340 | whatsnext_action->addTo( viewToolBar ); | 1340 | whatsnext_action->addTo( viewToolBar ); |
1341 | if (p-> mShowIconNextDays) | 1341 | if (p-> mShowIconNextDays) |
1342 | xdays_action->addTo( viewToolBar ); | 1342 | xdays_action->addTo( viewToolBar ); |
1343 | if (p-> mShowIconJournal) | 1343 | if (p-> mShowIconJournal) |
1344 | viewjournal_action->addTo( viewToolBar ); | 1344 | viewjournal_action->addTo( viewToolBar ); |
1345 | if (p-> mShowIconDay1) | 1345 | if (p-> mShowIconDay1) |
1346 | day1_action->addTo( viewToolBar ); | 1346 | day1_action->addTo( viewToolBar ); |
1347 | if (p-> mShowIconDay5) | 1347 | if (p-> mShowIconDay5) |
1348 | day5_action->addTo( viewToolBar ); | 1348 | day5_action->addTo( viewToolBar ); |
1349 | if (p-> mShowIconDay7) | 1349 | if (p-> mShowIconDay7) |
1350 | day7_action->addTo( viewToolBar ); | 1350 | day7_action->addTo( viewToolBar ); |
1351 | if (p-> mShowIconDay6) | 1351 | if (p-> mShowIconDay6) |
1352 | day6_action->addTo( viewToolBar ); | 1352 | day6_action->addTo( viewToolBar ); |
1353 | if (p-> mShowIconMonth) | 1353 | if (p-> mShowIconMonth) |
1354 | month_action->addTo( viewToolBar ); | 1354 | month_action->addTo( viewToolBar ); |
1355 | if (p-> mShowIconList) | 1355 | if (p-> mShowIconList) |
1356 | showlist_action->addTo( viewToolBar ); | 1356 | showlist_action->addTo( viewToolBar ); |
1357 | if (p-> mShowIconTodoview) | 1357 | if (p-> mShowIconTodoview) |
1358 | todoview_action->addTo( viewToolBar ); | 1358 | todoview_action->addTo( viewToolBar ); |
1359 | 1359 | ||
1360 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1360 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1361 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1361 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1362 | if (p-> mShowIconBackFast) { | 1362 | if (p-> mShowIconBackFast) { |
1363 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1363 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1364 | connect( action, SIGNAL( activated() ), | 1364 | connect( action, SIGNAL( activated() ), |
1365 | mView, SLOT( goPreviousMonth() ) ); | 1365 | mView, SLOT( goPreviousMonth() ) ); |
1366 | action->addTo( navigatorToolBar ); | 1366 | action->addTo( navigatorToolBar ); |
1367 | } | 1367 | } |
1368 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1368 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1369 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1369 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1370 | if (p-> mShowIconBack) { | 1370 | if (p-> mShowIconBack) { |
1371 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1371 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1372 | connect( action, SIGNAL( activated() ), | 1372 | connect( action, SIGNAL( activated() ), |
1373 | mView, SLOT( goPrevious() ) ); | 1373 | mView, SLOT( goPrevious() ) ); |
1374 | action->addTo( navigatorToolBar ); | 1374 | action->addTo( navigatorToolBar ); |
1375 | } | 1375 | } |
1376 | icon = loadPixmap( pathString + "today" ); | 1376 | icon = loadPixmap( pathString + "today" ); |
1377 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1377 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1378 | if (p-> mShowIconToday) | 1378 | if (p-> mShowIconToday) |
1379 | today_action->addTo( navigatorToolBar ); | 1379 | today_action->addTo( navigatorToolBar ); |
1380 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1380 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1381 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1381 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1382 | if (p-> mShowIconForward) { | 1382 | if (p-> mShowIconForward) { |
1383 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1383 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1384 | connect( action, SIGNAL( activated() ), | 1384 | connect( action, SIGNAL( activated() ), |
1385 | mView, SLOT( goNext() ) ); | 1385 | mView, SLOT( goNext() ) ); |
1386 | action->addTo( navigatorToolBar ); | 1386 | action->addTo( navigatorToolBar ); |
1387 | } | 1387 | } |
1388 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1388 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1389 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1389 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1390 | if (p-> mShowIconForwardFast) { | 1390 | if (p-> mShowIconForwardFast) { |
1391 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1391 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1392 | connect( action, SIGNAL( activated() ), | 1392 | connect( action, SIGNAL( activated() ), |
1393 | mView, SLOT( goNextMonth() ) ); | 1393 | mView, SLOT( goNextMonth() ) ); |
1394 | action->addTo( navigatorToolBar ); | 1394 | action->addTo( navigatorToolBar ); |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | 1397 | ||
1398 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1398 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1399 | 1399 | ||
1400 | 1400 | ||
1401 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1401 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1402 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1402 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1403 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1403 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1404 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1404 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1405 | 1405 | ||
1406 | if (p-> mShowIconNewEvent) | 1406 | if (p-> mShowIconNewEvent) |
1407 | configureToolBarMenu->setItemChecked( 10, true ); | 1407 | configureToolBarMenu->setItemChecked( 10, true ); |
1408 | if (p->mShowIconNewTodo ) | 1408 | if (p->mShowIconNewTodo ) |
1409 | configureToolBarMenu->setItemChecked( 20, true ); | 1409 | configureToolBarMenu->setItemChecked( 20, true ); |
1410 | if (p-> mShowIconSearch) | 1410 | if (p-> mShowIconSearch) |
1411 | configureToolBarMenu->setItemChecked( 120, true ); | 1411 | configureToolBarMenu->setItemChecked( 120, true ); |
1412 | if (p-> mShowIconList) | 1412 | if (p-> mShowIconList) |
1413 | configureToolBarMenu->setItemChecked( 30, true ); | 1413 | configureToolBarMenu->setItemChecked( 30, true ); |
1414 | if (p-> mShowIconDay1) | 1414 | if (p-> mShowIconDay1) |
1415 | configureToolBarMenu->setItemChecked( 40, true ); | 1415 | configureToolBarMenu->setItemChecked( 40, true ); |
1416 | if (p-> mShowIconDay5) | 1416 | if (p-> mShowIconDay5) |
1417 | configureToolBarMenu->setItemChecked( 50, true ); | 1417 | configureToolBarMenu->setItemChecked( 50, true ); |
1418 | if (p-> mShowIconDay6) | 1418 | if (p-> mShowIconDay6) |
1419 | configureToolBarMenu->setItemChecked( 75, true ); | 1419 | configureToolBarMenu->setItemChecked( 75, true ); |
1420 | if (p-> mShowIconDay7) | 1420 | if (p-> mShowIconDay7) |
1421 | configureToolBarMenu->setItemChecked( 60, true ); | 1421 | configureToolBarMenu->setItemChecked( 60, true ); |
1422 | if (p-> mShowIconMonth) | 1422 | if (p-> mShowIconMonth) |
1423 | configureToolBarMenu->setItemChecked( 70, true ); | 1423 | configureToolBarMenu->setItemChecked( 70, true ); |
1424 | if (p-> mShowIconTodoview) | 1424 | if (p-> mShowIconTodoview) |
1425 | configureToolBarMenu->setItemChecked( 80, true ); | 1425 | configureToolBarMenu->setItemChecked( 80, true ); |
1426 | if (p-> mShowIconBackFast) | 1426 | if (p-> mShowIconBackFast) |
1427 | configureToolBarMenu->setItemChecked( 200, true ); | 1427 | configureToolBarMenu->setItemChecked( 200, true ); |
1428 | if (p-> mShowIconBack) | 1428 | if (p-> mShowIconBack) |
1429 | configureToolBarMenu->setItemChecked( 210, true ); | 1429 | configureToolBarMenu->setItemChecked( 210, true ); |
1430 | if (p-> mShowIconToday) | 1430 | if (p-> mShowIconToday) |
1431 | configureToolBarMenu->setItemChecked( 130, true ); | 1431 | configureToolBarMenu->setItemChecked( 130, true ); |
1432 | if (p-> mShowIconForward) | 1432 | if (p-> mShowIconForward) |
1433 | configureToolBarMenu->setItemChecked( 220, true ); | 1433 | configureToolBarMenu->setItemChecked( 220, true ); |
1434 | if (p-> mShowIconForwardFast) | 1434 | if (p-> mShowIconForwardFast) |
1435 | configureToolBarMenu->setItemChecked( 230, true ); | 1435 | configureToolBarMenu->setItemChecked( 230, true ); |
1436 | if (p-> mShowIconNextDays) | 1436 | if (p-> mShowIconNextDays) |
1437 | configureToolBarMenu->setItemChecked( 100, true ); | 1437 | configureToolBarMenu->setItemChecked( 100, true ); |
1438 | if (p-> mShowIconNext) | 1438 | if (p-> mShowIconNext) |
1439 | configureToolBarMenu->setItemChecked( 110, true ); | 1439 | configureToolBarMenu->setItemChecked( 110, true ); |
1440 | if (p-> mShowIconJournal) | 1440 | if (p-> mShowIconJournal) |
1441 | configureToolBarMenu->setItemChecked( 90, true ); | 1441 | configureToolBarMenu->setItemChecked( 90, true ); |
1442 | if (p-> mShowIconWhatsThis) | 1442 | if (p-> mShowIconWhatsThis) |
1443 | configureToolBarMenu->setItemChecked( 300, true ); | 1443 | configureToolBarMenu->setItemChecked( 300, true ); |
1444 | if (p-> mShowIconWeekNum) | 1444 | if (p-> mShowIconWeekNum) |
1445 | configureToolBarMenu->setItemChecked( 400, true ); | 1445 | configureToolBarMenu->setItemChecked( 400, true ); |
1446 | if (!p-> mShowIconStretch) { | 1446 | if (!p-> mShowIconStretch) { |
1447 | QLabel* dummy = new QLabel( iconToolBar ); | 1447 | QLabel* dummy = new QLabel( iconToolBar ); |
1448 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1448 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1449 | dummy->setMinimumWidth( 0 ); | 1449 | dummy->setMinimumWidth( 0 ); |
1450 | iconToolBar->setStretchableWidget ( dummy ) ; | 1450 | iconToolBar->setStretchableWidget ( dummy ) ; |
1451 | } | 1451 | } |
1452 | else { | 1452 | else { |
1453 | iconToolBar->setHorizontalStretchable (true ); | 1453 | iconToolBar->setHorizontalStretchable (true ); |
1454 | viewToolBar->setHorizontalStretchable (true ); | 1454 | viewToolBar->setHorizontalStretchable (true ); |
1455 | navigatorToolBar->setHorizontalStretchable (true ); | 1455 | navigatorToolBar->setHorizontalStretchable (true ); |
1456 | iconToolBar->setVerticalStretchable (true ); | 1456 | iconToolBar->setVerticalStretchable (true ); |
1457 | viewToolBar->setVerticalStretchable (true ); | 1457 | viewToolBar->setVerticalStretchable (true ); |
1458 | navigatorToolBar->setVerticalStretchable (true ); | 1458 | navigatorToolBar->setVerticalStretchable (true ); |
1459 | configureToolBarMenu->setItemChecked( 5, true ); | 1459 | configureToolBarMenu->setItemChecked( 5, true ); |
1460 | } | 1460 | } |
1461 | if (p-> mShowIconFilter) | 1461 | if (p-> mShowIconFilter) |
1462 | configureToolBarMenu->setItemChecked( 7, true ); | 1462 | configureToolBarMenu->setItemChecked( 7, true ); |
1463 | if (p-> mShowIconOnetoolbar) | 1463 | if (p-> mShowIconOnetoolbar) |
1464 | configureToolBarMenu->setItemChecked( 6, true ); | 1464 | configureToolBarMenu->setItemChecked( 6, true ); |
1465 | 1465 | ||
1466 | 1466 | ||
1467 | if ( filterMenubar ) { | 1467 | if ( filterMenubar ) { |
1468 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1468 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1469 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); | 1469 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); |
1470 | } | 1470 | } |
1471 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1471 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1472 | configureAgenda( p->mHourSize ); | 1472 | configureAgenda( p->mHourSize ); |
1473 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1473 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1474 | } | 1474 | } |
1475 | void MainWindow::calHint() | 1475 | void MainWindow::calHint() |
1476 | { | 1476 | { |
1477 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); | 1477 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); |
1478 | 1478 | ||
1479 | KMessageBox::information( this, message); | 1479 | KMessageBox::information( this, message); |
1480 | } | 1480 | } |
1481 | void MainWindow::exportToPhone( int mode ) | 1481 | void MainWindow::exportToPhone( int mode ) |
1482 | { | 1482 | { |
1483 | 1483 | ||
1484 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1484 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1485 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1485 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1486 | KOex2phonePrefs ex2phone; | 1486 | KOex2phonePrefs ex2phone; |
1487 | 1487 | ||
1488 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1488 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1489 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1489 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1490 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1490 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1491 | if ( mode == 1 ) | 1491 | if ( mode == 1 ) |
1492 | ex2phone.setCaption(i18n("Export complete calendar")); | 1492 | ex2phone.setCaption(i18n("Export complete calendar")); |
1493 | if ( mode == 2 ) | 1493 | if ( mode == 2 ) |
1494 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1494 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1495 | 1495 | ||
1496 | if ( !ex2phone.exec() ) { | 1496 | if ( !ex2phone.exec() ) { |
1497 | return; | 1497 | return; |
1498 | } | 1498 | } |
1499 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1499 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1500 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1500 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1501 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1501 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1502 | 1502 | ||
1503 | int inFuture = 0; | 1503 | int inFuture = 0; |
1504 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1504 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1505 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1505 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1506 | QPtrList<Incidence> delSel; | 1506 | QPtrList<Incidence> delSel; |
1507 | if ( mode == 1 ) | 1507 | if ( mode == 1 ) |
1508 | delSel = mCalendar->rawIncidences(); | 1508 | delSel = mCalendar->rawIncidences(); |
1509 | if ( mode == 2 ) | 1509 | if ( mode == 2 ) |
1510 | delSel = mCalendar->incidences(); | 1510 | delSel = mCalendar->incidences(); |
1511 | CalendarLocal* cal = new CalendarLocal(); | 1511 | CalendarLocal* cal = new CalendarLocal(); |
1512 | cal->setLocalTime(); | 1512 | cal->setLocalTime(); |
1513 | Incidence *incidence = delSel.first(); | 1513 | Incidence *incidence = delSel.first(); |
1514 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1514 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1515 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1515 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1516 | while ( incidence ) { | 1516 | while ( incidence ) { |
1517 | if ( incidence->typeID() != journalID ) { | 1517 | if ( incidence->typeID() != journalID ) { |
1518 | bool add = true; | 1518 | bool add = true; |
1519 | if ( inFuture ) { | 1519 | if ( inFuture ) { |
1520 | QDateTime dt; | 1520 | QDateTime dt; |
1521 | if ( incidence->typeID() == todoID ) { | 1521 | if ( incidence->typeID() == todoID ) { |
1522 | Todo * t = (Todo*)incidence; | 1522 | Todo * t = (Todo*)incidence; |
1523 | if ( t->hasDueDate() ) | 1523 | if ( t->hasDueDate() ) |
1524 | dt = t->dtDue(); | 1524 | dt = t->dtDue(); |
1525 | else | 1525 | else |
1526 | dt = cur.addSecs( 62 ); | 1526 | dt = cur.addSecs( 62 ); |
1527 | } | 1527 | } |
1528 | else { | 1528 | else { |
1529 | bool ok; | 1529 | bool ok; |
1530 | dt = incidence->getNextOccurence( cur, &ok ); | 1530 | dt = incidence->getNextOccurence( cur, &ok ); |
1531 | if ( !ok ) | 1531 | if ( !ok ) |
1532 | dt = cur.addSecs( -62 ); | 1532 | dt = cur.addSecs( -62 ); |
1533 | } | 1533 | } |
1534 | if ( dt < cur || dt > end ) { | 1534 | if ( dt < cur || dt > end ) { |
1535 | add = false; | 1535 | add = false; |
1536 | } | 1536 | } |
1537 | } | 1537 | } |
1538 | if ( add ) { | 1538 | if ( add ) { |
1539 | Incidence *in = incidence->clone(); | 1539 | Incidence *in = incidence->clone(); |
1540 | cal->addIncidence( in ); | 1540 | cal->addIncidence( in ); |
1541 | } | 1541 | } |
1542 | } | 1542 | } |
1543 | incidence = delSel.next(); | 1543 | incidence = delSel.next(); |
1544 | } | 1544 | } |
1545 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1545 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1546 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1546 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1547 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1547 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1548 | 1548 | ||
1549 | setCaption( i18n("Writing to phone...")); | 1549 | setCaption( i18n("Writing to phone...")); |
1550 | if ( PhoneFormat::writeToPhone( cal ) ) | 1550 | if ( PhoneFormat::writeToPhone( cal ) ) |
1551 | setCaption( i18n("Export to phone successful!")); | 1551 | setCaption( i18n("Export to phone successful!")); |
1552 | else | 1552 | else |
1553 | setCaption( i18n("Error exporting to phone!")); | 1553 | setCaption( i18n("Error exporting to phone!")); |
1554 | delete cal; | 1554 | delete cal; |
1555 | } | 1555 | } |
1556 | 1556 | ||
1557 | 1557 | ||
1558 | void MainWindow::setDefaultPreferences() | 1558 | void MainWindow::setDefaultPreferences() |
1559 | { | 1559 | { |
1560 | KOPrefs *p = KOPrefs::instance(); | 1560 | KOPrefs *p = KOPrefs::instance(); |
1561 | 1561 | ||
1562 | p->mCompactDialogs = true; | 1562 | p->mCompactDialogs = true; |
1563 | p->mConfirm = true; | 1563 | p->mConfirm = true; |
1564 | // p->mEnableQuickTodo = false; | 1564 | // p->mEnableQuickTodo = false; |
1565 | 1565 | ||
1566 | } | 1566 | } |
1567 | 1567 | ||
1568 | QString MainWindow::resourcePath() | 1568 | QString MainWindow::resourcePath() |
1569 | { | 1569 | { |
1570 | return KGlobal::iconLoader()->iconPath(); | 1570 | return KGlobal::iconLoader()->iconPath(); |
1571 | } | 1571 | } |
1572 | 1572 | ||
1573 | void MainWindow::displayText( QString text ,QString cap ) | 1573 | void MainWindow::displayText( QString text ,QString cap ) |
1574 | { | 1574 | { |
1575 | QDialog dia( this, "name", true ); ; | 1575 | QDialog dia( this, "name", true ); ; |
1576 | dia.setCaption( cap ); | 1576 | dia.setCaption( cap ); |
1577 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1577 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1578 | lay->setSpacing( 3 ); | 1578 | lay->setSpacing( 3 ); |
1579 | lay->setMargin( 3 ); | 1579 | lay->setMargin( 3 ); |
1580 | QTextBrowser tb ( &dia ); | 1580 | QTextBrowser tb ( &dia ); |
1581 | lay->addWidget( &tb ); | 1581 | lay->addWidget( &tb ); |
1582 | tb.setText( text ); | 1582 | tb.setText( text ); |
1583 | #ifdef DESKTOP_VERSION | 1583 | #ifdef DESKTOP_VERSION |
1584 | dia.resize( 640, 480); | 1584 | dia.resize( 640, 480); |
1585 | #else | 1585 | #else |
1586 | dia.showMaximized(); | 1586 | dia.showMaximized(); |
1587 | #endif | 1587 | #endif |
1588 | dia.exec(); | 1588 | dia.exec(); |
1589 | } | 1589 | } |
1590 | 1590 | ||
1591 | void MainWindow::features() | 1591 | void MainWindow::features() |
1592 | { | 1592 | { |
1593 | 1593 | ||
1594 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1594 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1595 | } | 1595 | } |
1596 | 1596 | ||
1597 | void MainWindow::usertrans() | 1597 | void MainWindow::usertrans() |
1598 | { | 1598 | { |
1599 | 1599 | ||
1600 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1600 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1601 | } | 1601 | } |
1602 | 1602 | ||
1603 | void MainWindow::storagehowto() | 1603 | void MainWindow::storagehowto() |
1604 | { | 1604 | { |
1605 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1605 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1606 | } | 1606 | } |
1607 | void MainWindow::timetrackinghowto() | 1607 | void MainWindow::timetrackinghowto() |
1608 | { | 1608 | { |
1609 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1609 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1610 | } | 1610 | } |
1611 | void MainWindow::kdesynchowto() | 1611 | void MainWindow::kdesynchowto() |
1612 | { | 1612 | { |
1613 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1613 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1614 | } | 1614 | } |
1615 | void MainWindow::multisynchowto() | 1615 | void MainWindow::multisynchowto() |
1616 | { | 1616 | { |
1617 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1617 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1618 | } | 1618 | } |
1619 | void MainWindow::synchowto() | 1619 | void MainWindow::synchowto() |
1620 | { | 1620 | { |
1621 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1621 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1622 | } | 1622 | } |
1623 | void MainWindow::faq() | 1623 | void MainWindow::faq() |
1624 | { | 1624 | { |
1625 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1625 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1626 | 1626 | ||
1627 | } | 1627 | } |
1628 | void MainWindow::whatsNew() | 1628 | void MainWindow::whatsNew() |
1629 | { | 1629 | { |
1630 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1630 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1631 | 1631 | ||
1632 | } | 1632 | } |
1633 | void MainWindow::licence() | 1633 | void MainWindow::licence() |
1634 | { | 1634 | { |
1635 | KApplication::showLicence(); | 1635 | KApplication::showLicence(); |
1636 | 1636 | ||
1637 | } | 1637 | } |
1638 | void MainWindow::about() | 1638 | void MainWindow::about() |
1639 | { | 1639 | { |
1640 | QString version; | 1640 | QString version; |
1641 | #include <../version> | 1641 | #include <../version> |
1642 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1642 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1643 | i18n("KOrganizer/Platform-independent\n") + | 1643 | i18n("KOrganizer/Platform-independent\n") + |
1644 | "(KO/Pi) " + version + " - " + | 1644 | "(KO/Pi) " + version + " - " + |
1645 | 1645 | ||
1646 | #ifdef DESKTOP_VERSION | 1646 | #ifdef DESKTOP_VERSION |
1647 | i18n("Desktop Edition\n") + | 1647 | i18n("Desktop Edition\n") + |
1648 | #else | 1648 | #else |
1649 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1649 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1650 | #endif | 1650 | #endif |
1651 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1651 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1652 | } | 1652 | } |
1653 | void MainWindow::keyBindings() | 1653 | void MainWindow::keyBindings() |
1654 | { | 1654 | { |
1655 | QString cap = i18n("KO/Pi Keys + Colors"); | 1655 | QString cap = i18n("KO/Pi Keys + Colors"); |
1656 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1656 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1657 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1657 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1658 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1658 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1659 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1659 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1660 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1660 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1661 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1661 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1662 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1662 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1663 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1663 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1664 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1664 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1665 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1665 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1666 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1666 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1667 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1667 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1668 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1668 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1669 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1669 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1670 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1670 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1671 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1671 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1672 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1672 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1673 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1673 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1674 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1674 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1675 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1675 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1676 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1676 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1677 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1677 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1678 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1678 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1679 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1679 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1680 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1680 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1681 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1681 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1682 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1682 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1683 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1683 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1684 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1684 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1685 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1685 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1686 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1686 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1687 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1687 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1688 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1688 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1689 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1689 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1690 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1690 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1691 | i18n("<p><h3>In list view:</h3></p>\n") + | 1691 | i18n("<p><h3>In list view:</h3></p>\n") + |
1692 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1692 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1693 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1693 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1694 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1694 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1695 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1695 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1696 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1696 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1697 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1697 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1698 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1698 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1699 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1699 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1700 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1700 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1701 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1701 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1702 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1702 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1703 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1703 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1704 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1704 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1705 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1705 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1706 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1706 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1707 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1707 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1708 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1708 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1709 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1709 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1710 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1710 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1711 | displayText( text, cap); | 1711 | displayText( text, cap); |
1712 | } | 1712 | } |
1713 | void MainWindow::aboutAutoSaving() | 1713 | void MainWindow::aboutAutoSaving() |
1714 | { | 1714 | { |
1715 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1715 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1716 | 1716 | ||
1717 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1717 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1718 | 1718 | ||
1719 | } | 1719 | } |
1720 | void MainWindow::aboutKnownBugs() | 1720 | void MainWindow::aboutKnownBugs() |
1721 | { | 1721 | { |
1722 | QMessageBox* msg; | 1722 | QMessageBox* msg; |
1723 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1723 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1724 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1724 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1725 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1725 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1726 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1726 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1727 | i18n("\nor report them in the bugtracker on\n") + | 1727 | i18n("\nor report them in the bugtracker on\n") + |
1728 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1728 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1729 | QMessageBox::NoIcon, | 1729 | QMessageBox::NoIcon, |
1730 | QMessageBox::Ok, | 1730 | QMessageBox::Ok, |
1731 | QMessageBox::NoButton, | 1731 | QMessageBox::NoButton, |
1732 | QMessageBox::NoButton); | 1732 | QMessageBox::NoButton); |
1733 | msg->exec(); | 1733 | msg->exec(); |
1734 | delete msg; | 1734 | delete msg; |
1735 | 1735 | ||
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | QString MainWindow::defaultFileName() | 1738 | QString MainWindow::defaultFileName() |
1739 | { | 1739 | { |
1740 | return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); | 1740 | return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); |
1741 | } | 1741 | } |
1742 | QString MainWindow::syncFileName() | 1742 | QString MainWindow::syncFileName() |
1743 | { | 1743 | { |
1744 | #ifdef DESKTOP_VERSION | 1744 | #ifdef DESKTOP_VERSION |
1745 | return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); | 1745 | return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) ); |
1746 | #else | 1746 | #else |
1747 | return QString( "/tmp/synccalendar.ics" ); | 1747 | return QString( "/tmp/synccalendar.ics" ); |
1748 | #endif | 1748 | #endif |
1749 | } | 1749 | } |
1750 | #include "koglobals.h" | 1750 | #include "koglobals.h" |
1751 | #include <kcalendarsystem.h> | 1751 | #include <kcalendarsystem.h> |
1752 | void MainWindow::updateWeek(QDate seda) | 1752 | void MainWindow::updateWeek(QDate seda) |
1753 | { | 1753 | { |
1754 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1754 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1755 | mWeekPixmap.fill( mWeekBgColor ); | 1755 | mWeekPixmap.fill( mWeekBgColor ); |
1756 | QPainter p ( &mWeekPixmap ); | 1756 | QPainter p ( &mWeekPixmap ); |
1757 | p.setFont( mWeekFont ); | 1757 | p.setFont( mWeekFont ); |
1758 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1758 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1759 | p.end(); | 1759 | p.end(); |
1760 | QIconSet icon3 ( mWeekPixmap ); | 1760 | QIconSet icon3 ( mWeekPixmap ); |
1761 | mWeekAction->setIconSet ( icon3 ); | 1761 | mWeekAction->setIconSet ( icon3 ); |
1762 | 1762 | ||
1763 | } | 1763 | } |
1764 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1764 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1765 | { | 1765 | { |
1766 | updateWeek( selectedDates.first() ); | 1766 | updateWeek( selectedDates.first() ); |
1767 | } | 1767 | } |
1768 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1768 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1769 | { | 1769 | { |
1770 | if ( !incidence ) { | 1770 | if ( !incidence ) { |
1771 | mShowAction->setMenuText( i18n("Show") ); | 1771 | mShowAction->setMenuText( i18n("Show") ); |
1772 | enableIncidenceActions( false ); | 1772 | enableIncidenceActions( false ); |
1773 | mNewSubTodoAction->setEnabled( false ); | 1773 | mNewSubTodoAction->setEnabled( false ); |
1774 | setCaptionToDates(); | 1774 | setCaptionToDates(); |
1775 | return; | 1775 | return; |
1776 | } | 1776 | } |
1777 | QString startString = ""; | 1777 | QString startString = ""; |
1778 | if ( incidence->typeID() != todoID ) { | 1778 | if ( incidence->typeID() != todoID ) { |
1779 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1779 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1780 | if ( incidence->doesFloat() ) { | 1780 | if ( incidence->doesFloat() ) { |
1781 | startString += ": "+incidence->dtStartDateStr( true ); | 1781 | startString += ": "+incidence->dtStartDateStr( true ); |
1782 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1782 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1783 | } else { | 1783 | } else { |
1784 | startString = ": "+incidence->dtStartStr(true); | 1784 | startString = ": "+incidence->dtStartStr(true); |
1785 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1785 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1786 | } | 1786 | } |
1787 | } else { | 1787 | } else { |
1788 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1788 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1789 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1789 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1790 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1790 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1791 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1791 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1792 | bool ok; | 1792 | bool ok; |
1793 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1793 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1794 | if ( ok ) { | 1794 | if ( ok ) { |
1795 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1795 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1796 | startString += i18n(" (%1 y.)"). arg( years ); | 1796 | startString += i18n(" (%1 y.)"). arg( years ); |
1797 | } | 1797 | } |
1798 | } | 1798 | } |
1799 | else | 1799 | else |
1800 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1800 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1801 | } | 1801 | } |
1802 | } | 1802 | } |
1803 | else { | 1803 | else { |
1804 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1804 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1805 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1805 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1806 | else | 1806 | else |
1807 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1807 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1808 | } | 1808 | } |
1809 | if ( !incidence->location().isEmpty() ) | 1809 | if ( !incidence->location().isEmpty() ) |
1810 | startString += " (" +incidence->location()+")"; | 1810 | startString += " (" +incidence->location()+")"; |
1811 | setCaption( incidence->summary()+startString); | 1811 | setCaption( incidence->summary()+startString); |
1812 | enableIncidenceActions( true ); | 1812 | enableIncidenceActions( true ); |
1813 | if ( incidence->typeID() == eventID ) { | 1813 | if ( incidence->typeID() == eventID ) { |
1814 | mShowAction->setMenuText( i18n("Show Event") ); | 1814 | mShowAction->setMenuText( i18n("Show Event") ); |
1815 | mNewSubTodoAction->setEnabled( false ); | 1815 | mNewSubTodoAction->setEnabled( false ); |
1816 | } else if ( incidence->typeID() == todoID ) { | 1816 | } else if ( incidence->typeID() == todoID ) { |
1817 | mShowAction->setMenuText( i18n("Show Todo") ); | 1817 | mShowAction->setMenuText( i18n("Show Todo") ); |
1818 | mNewSubTodoAction->setEnabled( true ); | 1818 | mNewSubTodoAction->setEnabled( true ); |
1819 | } else { | 1819 | } else { |
1820 | mShowAction->setMenuText( i18n("Show") ); | 1820 | mShowAction->setMenuText( i18n("Show") ); |
1821 | mNewSubTodoAction->setEnabled( false ); | 1821 | mNewSubTodoAction->setEnabled( false ); |
1822 | } | 1822 | } |
1823 | #ifdef DESKTOP_VERSION | 1823 | #ifdef DESKTOP_VERSION |
1824 | static QPixmap jP = SmallIcon( "journal" ); | 1824 | static QPixmap jP = SmallIcon( "journal" ); |
1825 | static QPixmap eP = SmallIcon( "newevent" ); | 1825 | static QPixmap eP = SmallIcon( "newevent" ); |
1826 | static QPixmap tP = SmallIcon( "newtodo" ); | 1826 | static QPixmap tP = SmallIcon( "newtodo" ); |
1827 | QIconSet icon; | 1827 | QIconSet icon; |
1828 | if ( incidence->typeID() == todoID ) | 1828 | if ( incidence->typeID() == todoID ) |
1829 | icon = QIconSet ( tP ); | 1829 | icon = QIconSet ( tP ); |
1830 | else if ( incidence->typeID() == eventID ) | 1830 | else if ( incidence->typeID() == eventID ) |
1831 | icon = QIconSet ( eP ); | 1831 | icon = QIconSet ( eP ); |
1832 | else if ( incidence->typeID() == journalID ) | 1832 | else if ( incidence->typeID() == journalID ) |
1833 | icon = QIconSet ( jP ); | 1833 | icon = QIconSet ( jP ); |
1834 | mPrintSelAction->setIconSet ( icon ); | 1834 | mPrintSelAction->setIconSet ( icon ); |
1835 | #endif | 1835 | #endif |
1836 | } | 1836 | } |
1837 | 1837 | ||
1838 | void MainWindow::enableIncidenceActions( bool enabled ) | 1838 | void MainWindow::enableIncidenceActions( bool enabled ) |
1839 | { | 1839 | { |
1840 | mShowAction->setEnabled( enabled ); | 1840 | mShowAction->setEnabled( enabled ); |
1841 | mEditAction->setEnabled( enabled ); | 1841 | mEditAction->setEnabled( enabled ); |
1842 | mDeleteAction->setEnabled( enabled ); | 1842 | mDeleteAction->setEnabled( enabled ); |
1843 | 1843 | ||
1844 | mCloneAction->setEnabled( enabled ); | 1844 | mCloneAction->setEnabled( enabled ); |
1845 | mMoveAction->setEnabled( enabled ); | 1845 | mMoveAction->setEnabled( enabled ); |
1846 | #ifndef DESKTOP_VERSION | 1846 | #ifndef DESKTOP_VERSION |
1847 | mBeamAction->setEnabled( enabled ); | 1847 | mBeamAction->setEnabled( enabled ); |
1848 | #else | 1848 | #else |
1849 | mPrintSelAction->setEnabled( enabled ); | 1849 | mPrintSelAction->setEnabled( enabled ); |
1850 | #endif | 1850 | #endif |
1851 | mCancelAction->setEnabled( enabled ); | 1851 | mCancelAction->setEnabled( enabled ); |
1852 | } | 1852 | } |
1853 | 1853 | ||
1854 | void MainWindow::importOL() | 1854 | void MainWindow::importOL() |
1855 | { | 1855 | { |
1856 | #ifdef _OL_IMPORT_ | 1856 | #ifdef _OL_IMPORT_ |
1857 | mView->clearAllViews(); | 1857 | mView->clearAllViews(); |
1858 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1858 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1859 | id->exec(); | 1859 | id->exec(); |
1860 | delete id; | 1860 | delete id; |
1861 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1861 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1862 | mView->updateView(); | 1862 | mView->updateView(); |
1863 | #endif | 1863 | #endif |
1864 | } | 1864 | } |
1865 | void MainWindow::importBday() | 1865 | void MainWindow::importBday() |
1866 | { | 1866 | { |
1867 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1867 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1868 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1868 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1869 | i18n("Import!"), i18n("Cancel"), 0, | 1869 | i18n("Import!"), i18n("Cancel"), 0, |
1870 | 0, 1 ); | 1870 | 0, 1 ); |
1871 | if ( result == 0 ) { | 1871 | if ( result == 0 ) { |
1872 | mView->importBday(); | 1872 | mView->importBday(); |
1873 | 1873 | ||
1874 | } | 1874 | } |
1875 | 1875 | ||
1876 | 1876 | ||
1877 | } | 1877 | } |
1878 | void MainWindow::importQtopia() | 1878 | void MainWindow::importQtopia() |
1879 | { | 1879 | { |
1880 | //#ifndef DESKTOP_VERSION | 1880 | //#ifndef DESKTOP_VERSION |
1881 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); | 1881 | QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); |
1882 | #ifdef DESKTOP_VERSION | 1882 | #ifdef DESKTOP_VERSION |
1883 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1883 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1884 | #endif | 1884 | #endif |
1885 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1885 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1886 | i18n("Import!"), i18n("Cancel"), 0, | 1886 | i18n("Import!"), i18n("Cancel"), 0, |
1887 | 0, 1 ); | 1887 | 0, 1 ); |
1888 | if ( result == 0 ) { | 1888 | if ( result == 0 ) { |
1889 | #ifndef DESKTOP_VERSION | 1889 | #ifndef DESKTOP_VERSION |
1890 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1890 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1891 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1891 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1892 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1892 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1893 | #else | 1893 | #else |
1894 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1894 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1895 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1895 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1896 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1896 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1897 | #endif | 1897 | #endif |
1898 | mView->importQtopia( categories, datebook, todolist ); | 1898 | mView->importQtopia( categories, datebook, todolist ); |
1899 | } | 1899 | } |
1900 | mView->calendar()->reInitAlarmSettings(); | 1900 | mView->calendar()->reInitAlarmSettings(); |
1901 | #if 0 | 1901 | #if 0 |
1902 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1902 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1903 | i18n("Not supported \non desktop!\n"), | 1903 | i18n("Not supported \non desktop!\n"), |
1904 | i18n("Ok"), i18n("Cancel"), 0, | 1904 | i18n("Ok"), i18n("Cancel"), 0, |
1905 | 0, 1 ); | 1905 | 0, 1 ); |
1906 | 1906 | ||
1907 | #endif | 1907 | #endif |
1908 | } | 1908 | } |
1909 | 1909 | ||
1910 | void MainWindow::saveOnClose() | 1910 | void MainWindow::saveOnClose() |
1911 | { | 1911 | { |
1912 | KOPrefs *p = KOPrefs::instance(); | 1912 | KOPrefs *p = KOPrefs::instance(); |
1913 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1913 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1914 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1914 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1915 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1915 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1916 | if ( filterToolBar ) { | 1916 | if ( filterToolBar ) { |
1917 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1917 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1918 | } | 1918 | } |
1919 | #ifdef DESKTOP_VERSION | 1919 | #ifdef DESKTOP_VERSION |
1920 | 1920 | ||
1921 | QPoint myP; | 1921 | QPoint myP; |
1922 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1922 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1923 | if ( p->mToolBarHor ) | 1923 | if ( p->mToolBarHor ) |
1924 | p->mToolBarUp = myP.y() > height()/2; | 1924 | p->mToolBarUp = myP.y() > height()/2; |
1925 | else | 1925 | else |
1926 | p->mToolBarUp = myP.x() > width()/2; | 1926 | p->mToolBarUp = myP.x() > width()/2; |
1927 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1927 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1928 | if ( p->mToolBarHorV ) | 1928 | if ( p->mToolBarHorV ) |
1929 | p->mToolBarUpV = myP.y() > height()/2; | 1929 | p->mToolBarUpV = myP.y() > height()/2; |
1930 | else | 1930 | else |
1931 | p->mToolBarUpV = myP.x() > width()/2 ; | 1931 | p->mToolBarUpV = myP.x() > width()/2 ; |
1932 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1932 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1933 | if ( p->mToolBarHorN ) | 1933 | if ( p->mToolBarHorN ) |
1934 | p->mToolBarUpN = myP.y() > height()/2; | 1934 | p->mToolBarUpN = myP.y() > height()/2; |
1935 | else | 1935 | else |
1936 | p->mToolBarUpN = myP.x() > width()/2 ; | 1936 | p->mToolBarUpN = myP.x() > width()/2 ; |
1937 | if ( filterToolBar ) { | 1937 | if ( filterToolBar ) { |
1938 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1938 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1939 | if ( p->mToolBarHorF ) | 1939 | if ( p->mToolBarHorF ) |
1940 | p->mToolBarUpF = myP.y() > height()/2; | 1940 | p->mToolBarUpF = myP.y() > height()/2; |
1941 | else | 1941 | else |
1942 | p->mToolBarUpF = myP.x() > width()/2 ; | 1942 | p->mToolBarUpF = myP.x() > width()/2 ; |
1943 | } | 1943 | } |
1944 | #else | 1944 | #else |
1945 | if ( p->mToolBarHor ) | 1945 | if ( p->mToolBarHor ) |
1946 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1946 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1947 | else | 1947 | else |
1948 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1948 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1949 | if ( p->mToolBarHorV ) | 1949 | if ( p->mToolBarHorV ) |
1950 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1950 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1951 | else | 1951 | else |
1952 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1952 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1953 | 1953 | ||
1954 | if ( p->mToolBarHorN ) | 1954 | if ( p->mToolBarHorN ) |
1955 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1955 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1956 | else | 1956 | else |
1957 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1957 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1958 | if ( filterToolBar ) { | 1958 | if ( filterToolBar ) { |
1959 | if ( p->mToolBarHorF ) | 1959 | if ( p->mToolBarHorF ) |
1960 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1960 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1961 | else | 1961 | else |
1962 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1962 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1963 | } | 1963 | } |
1964 | #endif | 1964 | #endif |
1965 | save(); | 1965 | save(); |
1966 | mView->writeSettings(); | 1966 | mView->writeSettings(); |
1967 | mView->checkSuspendAlarm(); | 1967 | mView->checkSuspendAlarm(); |
1968 | } | 1968 | } |
1969 | void MainWindow::slotModifiedChanged( bool ) | 1969 | void MainWindow::slotModifiedChanged( bool ) |
1970 | { | 1970 | { |
1971 | if ( mBlockAtStartup ) | 1971 | if ( mBlockAtStartup ) |
1972 | return; | 1972 | return; |
1973 | 1973 | ||
1974 | int msec; | 1974 | int msec; |
1975 | if ( mCalendarModifiedFlag ) { | 1975 | if ( mCalendarModifiedFlag ) { |
1976 | //qDebug(" MainWindow timer is running "); | 1976 | //qDebug(" MainWindow timer is running "); |
1977 | return; | 1977 | return; |
1978 | } | 1978 | } |
1979 | // we store the changes after 1 minute, | 1979 | // we store the changes after 1 minute, |
1980 | // and for safety reasons after 10 minutes again | 1980 | // and for safety reasons after 10 minutes again |
1981 | if ( !mSyncManager->blockSave() ) | 1981 | if ( !mSyncManager->blockSave() ) |
1982 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1982 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1983 | else | 1983 | else |
1984 | msec = 1000 * 600; | 1984 | msec = 1000 * 600; |
1985 | mSaveTimer.start( msec, true ); // 1 minute | 1985 | mSaveTimer.start( msec, true ); // 1 minute |
1986 | mSaveTimerStart = QDateTime::currentDateTime(); | 1986 | mSaveTimerStart = QDateTime::currentDateTime(); |
1987 | mSaveDelay = msec/1000; | 1987 | mSaveDelay = msec/1000; |
1988 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1988 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1989 | mCalendarModifiedFlag = true; | 1989 | mCalendarModifiedFlag = true; |
1990 | } | 1990 | } |
1991 | void MainWindow::saveStopTimer() | 1991 | void MainWindow::saveStopTimer() |
1992 | { | 1992 | { |
1993 | mSaveTimer.stop(); | 1993 | mSaveTimer.stop(); |
1994 | } | 1994 | } |
1995 | void MainWindow::backupAllFiles() | 1995 | void MainWindow::backupAllFiles() |
1996 | { | 1996 | { |
1997 | QDate reference ( 2000,1,1); | 1997 | QDate reference ( 2000,1,1); |
1998 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1998 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1999 | setCaption(i18n("Creating backup ... please wait ..." )); | 1999 | setCaption(i18n("Creating backup ... please wait ..." )); |
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 | 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 | ||
2098 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2098 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2099 | { | 2099 | { |
2100 | if ( !e->isAutoRepeat() ) { | 2100 | if ( !e->isAutoRepeat() ) { |
2101 | mFlagKeyPressed = false; | 2101 | mFlagKeyPressed = false; |
2102 | } | 2102 | } |
2103 | } | 2103 | } |
2104 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2104 | void 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; |
2143 | case Qt::Key_I: | 2143 | case Qt::Key_I: |
2144 | mView->showIncidence(); | 2144 | mView->showIncidence(); |
2145 | break; | 2145 | break; |
2146 | case Qt::Key_Delete: | 2146 | case Qt::Key_Delete: |
2147 | case Qt::Key_Backspace: | 2147 | case Qt::Key_Backspace: |
2148 | mView->deleteIncidence(); | 2148 | mView->deleteIncidence(); |
2149 | break; | 2149 | break; |
2150 | case Qt::Key_D: | 2150 | case Qt::Key_D: |
2151 | mView->viewManager()->showDayView(); | 2151 | mView->viewManager()->showDayView(); |
2152 | showSelectedDates = true; | 2152 | showSelectedDates = true; |
2153 | break; | 2153 | break; |
2154 | case Qt::Key_O: | 2154 | case Qt::Key_O: |
2155 | mView->toggleFilerEnabled( ); | 2155 | mView->toggleFilerEnabled( ); |
2156 | break; | 2156 | break; |
2157 | case Qt::Key_0: | 2157 | case Qt::Key_0: |
2158 | case Qt::Key_1: | 2158 | case Qt::Key_1: |
2159 | case Qt::Key_2: | 2159 | case Qt::Key_2: |
2160 | case Qt::Key_3: | 2160 | case Qt::Key_3: |
2161 | case Qt::Key_4: | 2161 | case Qt::Key_4: |
2162 | case Qt::Key_5: | 2162 | case Qt::Key_5: |
2163 | case Qt::Key_6: | 2163 | case Qt::Key_6: |
2164 | case Qt::Key_7: | 2164 | case Qt::Key_7: |
2165 | case Qt::Key_8: | 2165 | case Qt::Key_8: |
2166 | case Qt::Key_9: | 2166 | case Qt::Key_9: |
2167 | pro = e->key()-48; | 2167 | pro = e->key()-48; |
2168 | if ( pro == 0 ) | 2168 | if ( pro == 0 ) |
2169 | pro = 10; | 2169 | pro = 10; |
2170 | if ( e->state() == Qt::ControlButton) | 2170 | if ( e->state() == Qt::ControlButton) |
2171 | pro += 10; | 2171 | pro += 10; |
2172 | break; | 2172 | break; |
2173 | case Qt::Key_M: | 2173 | case Qt::Key_M: |
2174 | mView->viewManager()->showMonthView(); | 2174 | mView->viewManager()->showMonthView(); |
2175 | showSelectedDates = true; | 2175 | showSelectedDates = true; |
2176 | break; | 2176 | break; |
2177 | case Qt::Key_Insert: | 2177 | case Qt::Key_Insert: |
2178 | mView->newEvent(); | 2178 | mView->newEvent(); |
2179 | break; | 2179 | break; |
2180 | case Qt::Key_S : | 2180 | case Qt::Key_S : |
2181 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2181 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2182 | mView->newSubTodo(); | 2182 | mView->newSubTodo(); |
2183 | else | 2183 | else |
2184 | mView->dialogManager()->showSearchDialog(); | 2184 | mView->dialogManager()->showSearchDialog(); |
2185 | break; | 2185 | break; |
2186 | case Qt::Key_Y : | 2186 | case Qt::Key_Y : |
2187 | case Qt::Key_Z : | 2187 | case Qt::Key_Z : |
2188 | mView->viewManager()->showWorkWeekView(); | 2188 | mView->viewManager()->showWorkWeekView(); |
2189 | showSelectedDates = true; | 2189 | showSelectedDates = true; |
2190 | break; | 2190 | break; |
2191 | case Qt::Key_U : | 2191 | case Qt::Key_U : |
2192 | mView->viewManager()->showWeekView(); | 2192 | mView->viewManager()->showWeekView(); |
2193 | showSelectedDates = true; | 2193 | showSelectedDates = true; |
2194 | break; | 2194 | break; |
2195 | case Qt::Key_H : | 2195 | case Qt::Key_H : |
2196 | keyBindings(); | 2196 | keyBindings(); |
2197 | break; | 2197 | break; |
2198 | case Qt::Key_W: | 2198 | case Qt::Key_W: |
2199 | mView->viewManager()->showWhatsNextView(); | 2199 | mView->viewManager()->showWhatsNextView(); |
2200 | break; | 2200 | break; |
2201 | case Qt::Key_L: | 2201 | case Qt::Key_L: |
2202 | mView->viewManager()->showListView(); | 2202 | mView->viewManager()->showListView(); |
2203 | break; | 2203 | break; |
2204 | case Qt::Key_N: | 2204 | case Qt::Key_N: |
2205 | mView->viewManager()->showNextView(); | 2205 | mView->viewManager()->showNextView(); |
2206 | break; | 2206 | break; |
2207 | case Qt::Key_V: | 2207 | case Qt::Key_V: |
2208 | mView->viewManager()->showTodoView(); | 2208 | mView->viewManager()->showTodoView(); |
2209 | break; | 2209 | break; |
2210 | case Qt::Key_C: | 2210 | case Qt::Key_C: |
2211 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2211 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2212 | break; | 2212 | break; |
2213 | case Qt::Key_P: | 2213 | case Qt::Key_P: |
2214 | mView->showDatePicker( ); | 2214 | mView->showDatePicker( ); |
2215 | break; | 2215 | break; |
2216 | case Qt::Key_F: | 2216 | case Qt::Key_F: |
2217 | mView->editFilters(); | 2217 | mView->editFilters(); |
2218 | break; | 2218 | break; |
2219 | case Qt::Key_R: | 2219 | case Qt::Key_R: |
2220 | mView->toggleFilter(); | 2220 | mView->toggleFilter(); |
2221 | break; | 2221 | break; |
2222 | case Qt::Key_X: | 2222 | case Qt::Key_X: |
2223 | if ( e->state() == Qt::ControlButton ) | 2223 | if ( e->state() == Qt::ControlButton ) |
2224 | mView->toggleDateNavigatorWidget(); | 2224 | mView->toggleDateNavigatorWidget(); |
2225 | else { | 2225 | else { |
2226 | mView->viewManager()->showNextXView(); | 2226 | mView->viewManager()->showNextXView(); |
2227 | showSelectedDates = true; | 2227 | showSelectedDates = true; |
2228 | } | 2228 | } |
2229 | break; | 2229 | break; |
2230 | case Qt::Key_Space: | 2230 | case Qt::Key_Space: |
2231 | mView->toggleExpand(); | 2231 | mView->toggleExpand(); |
2232 | break; | 2232 | break; |
2233 | case Qt::Key_A: | 2233 | case Qt::Key_A: |
2234 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2234 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2235 | mView->showNextAlarms(); | 2235 | mView->showNextAlarms(); |
2236 | else | 2236 | else |
2237 | mView->toggleAllDaySize(); | 2237 | mView->toggleAllDaySize(); |
2238 | break; | 2238 | break; |
2239 | case Qt::Key_T: | 2239 | case Qt::Key_T: |
2240 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2240 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2241 | mView->newTodo(); | 2241 | mView->newTodo(); |
2242 | else { | 2242 | else { |
2243 | mView->goToday(); | 2243 | mView->goToday(); |
2244 | showSelectedDates = true; | 2244 | showSelectedDates = true; |
2245 | } | 2245 | } |
2246 | break; | 2246 | break; |
2247 | case Qt::Key_Q: | 2247 | case Qt::Key_Q: |
2248 | if ( e->state() == Qt::ControlButton ) | 2248 | if ( e->state() == Qt::ControlButton ) |
2249 | mView->conflictNotAll(); | 2249 | mView->conflictNotAll(); |
2250 | else if ( e->state() == Qt::ShiftButton ) | 2250 | else if ( e->state() == Qt::ShiftButton ) |
2251 | mView->conflictAllday(); | 2251 | mView->conflictAllday(); |
2252 | else | 2252 | else |
2253 | mView->conflictAll(); | 2253 | mView->conflictAll(); |
2254 | break; | 2254 | break; |
2255 | case Qt::Key_J: | 2255 | case Qt::Key_J: |
2256 | mView->viewManager()->showJournalView(); | 2256 | mView->viewManager()->showJournalView(); |
2257 | break; | 2257 | break; |
2258 | case Qt::Key_B: | 2258 | case Qt::Key_B: |
2259 | mView->editIncidenceDescription();; | 2259 | mView->editIncidenceDescription();; |
2260 | break; | 2260 | break; |
2261 | // case Qt::Key_Return: | 2261 | // case Qt::Key_Return: |
2262 | case Qt::Key_E: | 2262 | case Qt::Key_E: |
2263 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2263 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2264 | mView->newEvent(); | 2264 | mView->newEvent(); |
2265 | else | 2265 | else |
2266 | mView->editIncidence(); | 2266 | mView->editIncidence(); |
2267 | break; | 2267 | break; |
2268 | case Qt::Key_Plus: | 2268 | case Qt::Key_Plus: |
2269 | size = p->mHourSize +2; | 2269 | size = p->mHourSize +2; |
2270 | if ( size <= 22 ) | 2270 | if ( size <= 22 ) |
2271 | configureAgenda( size ); | 2271 | configureAgenda( size ); |
2272 | break; | 2272 | break; |
2273 | case Qt::Key_Minus: | 2273 | case Qt::Key_Minus: |
2274 | size = p->mHourSize - 2; | 2274 | size = p->mHourSize - 2; |
2275 | if ( size >= 4 ) | 2275 | if ( size >= 4 ) |
2276 | configureAgenda( size ); | 2276 | configureAgenda( size ); |
2277 | break; | 2277 | break; |
2278 | 2278 | ||
2279 | 2279 | ||
2280 | default: | 2280 | default: |
2281 | e->ignore(); | 2281 | e->ignore(); |
2282 | } | 2282 | } |
2283 | if ( pro > 0 ) { | 2283 | if ( pro > 0 ) { |
2284 | selectFilter( pro+1 ); | 2284 | selectFilter( pro+1 ); |
2285 | } | 2285 | } |
2286 | if ( showSelectedDates ) { | 2286 | if ( showSelectedDates ) { |
2287 | ;// setCaptionToDates(); | 2287 | ;// setCaptionToDates(); |
2288 | } | 2288 | } |
2289 | 2289 | ||
2290 | } | 2290 | } |
2291 | void MainWindow::fillFilterMenuTB() | 2291 | void MainWindow::fillFilterMenuTB() |
2292 | { | 2292 | { |
2293 | selectFilterMenuTB->clear(); | 2293 | selectFilterMenuTB->clear(); |
2294 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2294 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2295 | selectFilterMenuTB->insertSeparator(); | 2295 | selectFilterMenuTB->insertSeparator(); |
2296 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2296 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2297 | 2297 | ||
2298 | selectFilterMenuTB->insertSeparator(); | 2298 | selectFilterMenuTB->insertSeparator(); |
2299 | QPtrList<CalFilter> fili = mView->filters(); | 2299 | QPtrList<CalFilter> fili = mView->filters(); |
2300 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2300 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2301 | CalFilter *filter = fili.first(); | 2301 | CalFilter *filter = fili.first(); |
2302 | int iii = 2; | 2302 | int iii = 2; |
2303 | bool checkitem = mView->filterView()->filtersEnabled(); | 2303 | bool checkitem = mView->filterView()->filtersEnabled(); |
2304 | while(filter) { | 2304 | while(filter) { |
2305 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2305 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2306 | if ( filter == curfilter) | 2306 | if ( filter == curfilter) |
2307 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2307 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2308 | filter = fili.next(); | 2308 | filter = fili.next(); |
2309 | ++iii; | 2309 | ++iii; |
2310 | } | 2310 | } |
2311 | if ( !checkitem ) | 2311 | if ( !checkitem ) |
2312 | selectFilterMenuTB->setItemChecked( 1, true ); | 2312 | selectFilterMenuTB->setItemChecked( 1, true ); |
2313 | 2313 | ||
2314 | int x = 0; | 2314 | int x = 0; |
2315 | int y = iconToolBar->height(); | 2315 | int y = iconToolBar->height(); |
2316 | int dX = 0; | 2316 | int dX = 0; |
2317 | int dY = 0; | 2317 | int dY = 0; |
2318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2319 | if ( iconToolBar->y() > height()/2 ) { | 2319 | if ( iconToolBar->y() > height()/2 ) { |
2320 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2320 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2321 | y = 0; | 2321 | y = 0; |
2322 | } | 2322 | } |
2323 | } else { | 2323 | } else { |
2324 | if ( iconToolBar->x() > width()/2 ) { // right side | 2324 | if ( iconToolBar->x() > width()/2 ) { // right side |
2325 | x=0; | 2325 | x=0; |
2326 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2326 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2327 | y = 0; | 2327 | y = 0; |
2328 | } else { | 2328 | } else { |
2329 | x= iconToolBar->width(); | 2329 | x= iconToolBar->width(); |
2330 | y = 0; | 2330 | y = 0; |
2331 | } | 2331 | } |
2332 | } | 2332 | } |
2333 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2333 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2334 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2334 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2335 | } | 2335 | } |
2336 | void MainWindow::fillFilterMenu() | 2336 | void MainWindow::fillFilterMenu() |
2337 | { | 2337 | { |
2338 | selectFilterMenu->clear(); | 2338 | selectFilterMenu->clear(); |
2339 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2339 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2340 | selectFilterMenu->insertSeparator(); | 2340 | selectFilterMenu->insertSeparator(); |
2341 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2341 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2342 | 2342 | ||
2343 | selectFilterMenu->insertSeparator(); | 2343 | selectFilterMenu->insertSeparator(); |
2344 | QPtrList<CalFilter> fili = mView->filters(); | 2344 | QPtrList<CalFilter> fili = mView->filters(); |
2345 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2345 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2346 | CalFilter *filter = fili.first(); | 2346 | CalFilter *filter = fili.first(); |
2347 | int iii = 2; | 2347 | int iii = 2; |
2348 | bool checkitem = mView->filterView()->filtersEnabled(); | 2348 | bool checkitem = mView->filterView()->filtersEnabled(); |
2349 | while(filter) { | 2349 | while(filter) { |
2350 | selectFilterMenu->insertItem( filter->name(), iii ); | 2350 | selectFilterMenu->insertItem( filter->name(), iii ); |
2351 | if ( filter == curfilter) | 2351 | if ( filter == curfilter) |
2352 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2352 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2353 | filter = fili.next(); | 2353 | filter = fili.next(); |
2354 | ++iii; | 2354 | ++iii; |
2355 | } | 2355 | } |
2356 | if ( !checkitem ) | 2356 | if ( !checkitem ) |
2357 | selectFilterMenu->setItemChecked( 1, true ); | 2357 | selectFilterMenu->setItemChecked( 1, true ); |
2358 | } | 2358 | } |
2359 | void MainWindow::fillFilterMenuPopup() | 2359 | void MainWindow::fillFilterMenuPopup() |
2360 | { | 2360 | { |
2361 | filterPopupMenu->clear(); | 2361 | filterPopupMenu->clear(); |
2362 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2362 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2363 | 2363 | ||
2364 | filterPopupMenu->insertSeparator(); | 2364 | filterPopupMenu->insertSeparator(); |
2365 | QPtrList<CalFilter> fili = mView->filters(); | 2365 | QPtrList<CalFilter> fili = mView->filters(); |
2366 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2366 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2367 | CalFilter *filter = fili.first(); | 2367 | CalFilter *filter = fili.first(); |
2368 | int iii = 1; | 2368 | int iii = 1; |
2369 | bool checkitem = mView->filterView()->filtersEnabled(); | 2369 | bool checkitem = mView->filterView()->filtersEnabled(); |
2370 | while(filter) { | 2370 | while(filter) { |
2371 | filterPopupMenu->insertItem( filter->name(), iii ); | 2371 | filterPopupMenu->insertItem( filter->name(), iii ); |
2372 | if ( filter == curfilter) | 2372 | if ( filter == curfilter) |
2373 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2373 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2374 | filter = fili.next(); | 2374 | filter = fili.next(); |
2375 | ++iii; | 2375 | ++iii; |
2376 | } | 2376 | } |
2377 | if ( !checkitem ) | 2377 | if ( !checkitem ) |
2378 | filterPopupMenu->setItemChecked( 0, true ); | 2378 | filterPopupMenu->setItemChecked( 0, true ); |
2379 | } | 2379 | } |
2380 | void MainWindow::selectFilter( int fil ) | 2380 | void MainWindow::selectFilter( int fil ) |
2381 | { | 2381 | { |
2382 | 2382 | ||
2383 | if ( fil == 0 ) { | 2383 | if ( fil == 0 ) { |
2384 | mView->editFilters( ); | 2384 | mView->editFilters( ); |
2385 | } else if ( fil == 1 ){ | 2385 | } else if ( fil == 1 ){ |
2386 | if ( mView->filterView()->filtersEnabled() ) | 2386 | if ( mView->filterView()->filtersEnabled() ) |
2387 | mView->toggleFilerEnabled( ); | 2387 | mView->toggleFilerEnabled( ); |
2388 | } else { | 2388 | } else { |
2389 | if ( !mView->filterView()->filtersEnabled() ) { | 2389 | if ( !mView->filterView()->filtersEnabled() ) { |
2390 | mView->filterView()->blockSignals( true ); | 2390 | mView->filterView()->blockSignals( true ); |
2391 | mView->toggleFilerEnabled( ); | 2391 | mView->toggleFilerEnabled( ); |
2392 | mView->filterView()->blockSignals( false ); | 2392 | mView->filterView()->blockSignals( false ); |
2393 | } | 2393 | } |
2394 | mView->selectFilter( fil-2 ); | 2394 | mView->selectFilter( fil-2 ); |
2395 | } | 2395 | } |
2396 | } | 2396 | } |
2397 | void MainWindow::updateFilterToolbar() | 2397 | void MainWindow::updateFilterToolbar() |
2398 | { | 2398 | { |
2399 | if ( filterMenubar ) { | 2399 | if ( filterMenubar ) { |
2400 | if ( !mView->filterView()->filtersEnabled() ) { | 2400 | if ( !mView->filterView()->filtersEnabled() ) { |
2401 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2401 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2402 | } else { | 2402 | } else { |
2403 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2403 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2404 | if ( curfilter ) { | 2404 | if ( curfilter ) { |
2405 | QString name = curfilter->name(); | 2405 | QString name = curfilter->name(); |
2406 | if ( name.length() > 12 ) | 2406 | if ( name.length() > 12 ) |
2407 | name = name.left(10)+"..."; | 2407 | name = name.left(10)+"..."; |
2408 | filterMenubar->changeItem( 0, name ); | 2408 | filterMenubar->changeItem( 0, name ); |
2409 | } | 2409 | } |
2410 | } | 2410 | } |
2411 | } | 2411 | } |
2412 | } | 2412 | } |
2413 | void MainWindow::selectFilterPopup( int fil ) | 2413 | void MainWindow::selectFilterPopup( int fil ) |
2414 | { | 2414 | { |
2415 | selectFilter( fil + 1 ); | 2415 | selectFilter( fil + 1 ); |
2416 | 2416 | ||
2417 | } | 2417 | } |
2418 | void MainWindow::configureToolBar( int item ) | 2418 | void MainWindow::configureToolBar( int item ) |
2419 | { | 2419 | { |
2420 | 2420 | ||
2421 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2421 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2422 | KOPrefs *p = KOPrefs::instance(); | 2422 | KOPrefs *p = KOPrefs::instance(); |
2423 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2423 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2424 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2424 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2425 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2425 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2426 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2426 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2427 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2427 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2428 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2428 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2429 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2429 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2430 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2430 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2431 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2431 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2432 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2432 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2433 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2433 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2434 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2434 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2435 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2435 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2436 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2436 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2437 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2437 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2438 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2438 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2439 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2439 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2440 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2440 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2441 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2441 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2442 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2442 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2443 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2443 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2444 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2444 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2445 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2445 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2446 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2446 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2447 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2447 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2448 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2448 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2449 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2449 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2450 | // initActions(); | 2450 | // initActions(); |
2451 | setCaption ( i18n("Toolbar changes needs a restart!") ); | 2451 | setCaption ( i18n("Toolbar changes needs a restart!") ); |
2452 | } | 2452 | } |
2453 | void MainWindow::setCaption ( const QString & c ) | 2453 | void MainWindow::setCaption ( const QString & c ) |
2454 | { | 2454 | { |
2455 | QString cap = c; | 2455 | QString cap = c; |
2456 | cap.replace( QRegExp("\n"), " " ); | 2456 | cap.replace( QRegExp("\n"), " " ); |
2457 | cap = cap.stripWhiteSpace(); | 2457 | cap = cap.stripWhiteSpace(); |
2458 | if ( cap.isEmpty() ) | 2458 | if ( cap.isEmpty() ) |
2459 | cap = "KO/Pi"; | 2459 | cap = "KO/Pi"; |
2460 | QWidget::setCaption( cap ); | 2460 | QWidget::setCaption( cap ); |
2461 | } | 2461 | } |
2462 | void MainWindow::setCaptionToDates() | 2462 | void MainWindow::setCaptionToDates() |
2463 | { | 2463 | { |
2464 | QString selDates; | 2464 | QString selDates; |
2465 | QDate date = mView->startDate(); | 2465 | QDate date = mView->startDate(); |
2466 | if ( ! date.isValid() ) { | 2466 | if ( ! date.isValid() ) { |
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 | } |
2485 | void MainWindow::showConfigureAgenda( ) | 2485 | void 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 | } |
2493 | void MainWindow::configureAgenda( int item ) | 2493 | void 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 | ||
2501 | void MainWindow::saveCalendar() | 2501 | void 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 | } |
2523 | void MainWindow::loadCalendar() | 2523 | void 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 | } |
2562 | void MainWindow::quickImportIcal() | 2562 | void MainWindow::quickImportIcal() |
2563 | { | 2563 | { |
2564 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2564 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2565 | } | 2565 | } |
2566 | void MainWindow::importFile( QString fn, bool quick ) | 2566 | void MainWindow::importFile( QString fn, bool quick ) |
2567 | { | 2567 | { |
2568 | QFileInfo info; | 2568 | QFileInfo info; |
2569 | info.setFile( fn ); | 2569 | info.setFile( fn ); |
2570 | QString mess; | 2570 | QString mess; |
2571 | if ( !info. exists() ) { | 2571 | if ( !info. exists() ) { |
2572 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2572 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2573 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2573 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2574 | mess ); | 2574 | mess ); |
2575 | return; | 2575 | return; |
2576 | } | 2576 | } |
2577 | int result = 0; | 2577 | int result = 0; |
2578 | if ( !quick ) { | 2578 | if ( !quick ) { |
2579 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2579 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2580 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2580 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2581 | mess, | 2581 | mess, |
2582 | "Import", "Cancel", 0, | 2582 | "Import", "Cancel", 0, |
2583 | 0, 1 ); | 2583 | 0, 1 ); |
2584 | } | 2584 | } |
2585 | if ( result == 0 ) { | 2585 | if ( result == 0 ) { |
2586 | if ( mView->openCalendar( fn, true )) { | 2586 | if ( mView->openCalendar( fn, true )) { |
2587 | KOPrefs::instance()->mLastImportFile = fn; | 2587 | KOPrefs::instance()->mLastImportFile = fn; |
2588 | setCaption(i18n("Imported file successfully")); | 2588 | setCaption(i18n("Imported file successfully")); |
2589 | } else { | 2589 | } else { |
2590 | setCaption(i18n("Error importing file")); | 2590 | setCaption(i18n("Error importing file")); |
2591 | } | 2591 | } |
2592 | mView->updateView(); | 2592 | mView->updateView(); |
2593 | } | 2593 | } |
2594 | } | 2594 | } |
2595 | 2595 | ||
2596 | void MainWindow::importIcal() | 2596 | void MainWindow::importIcal() |
2597 | { | 2597 | { |
2598 | 2598 | ||
2599 | QString fn =KOPrefs::instance()->mLastImportFile; | 2599 | QString fn =KOPrefs::instance()->mLastImportFile; |
2600 | 2600 | ||
2601 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2601 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2602 | if ( fn == "" ) | 2602 | if ( fn == "" ) |
2603 | return; | 2603 | return; |
2604 | importFile( fn, true ); | 2604 | importFile( fn, true ); |
2605 | 2605 | ||
2606 | } | 2606 | } |
2607 | void MainWindow::exportCalendar( bool iCalFormat ) | 2607 | void MainWindow::exportCalendar( bool iCalFormat ) |
2608 | { | 2608 | { |
2609 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2609 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2610 | if ( iCalFormat ) { | 2610 | if ( iCalFormat ) { |
2611 | fn = QDir::homeDirPath()+"/kopiexport.ics"; | 2611 | fn = QDir::homeDirPath()+"/kopiexport.ics"; |
2612 | fn = KFileDialog::getSaveFileName( fn, i18n("Export iCal filename(*.ics)"), this ); | 2612 | fn = KFileDialog::getSaveFileName( fn, i18n("Export iCal filename(*.ics)"), this ); |
2613 | } | 2613 | } |
2614 | else | 2614 | else |
2615 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2615 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2616 | if ( fn == "" ) | 2616 | if ( fn == "" ) |
2617 | return; | 2617 | return; |
2618 | QFileInfo info; | 2618 | QFileInfo info; |
2619 | info.setFile( fn ); | 2619 | info.setFile( fn ); |
2620 | QString mes; | 2620 | QString mes; |
2621 | bool createbup = true; | 2621 | bool createbup = true; |
2622 | if ( info. exists() ) { | 2622 | if ( info. exists() ) { |
2623 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2623 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2624 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2624 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2625 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2625 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2626 | 0, 1 ); | 2626 | 0, 1 ); |
2627 | if ( result != 0 ) { | 2627 | if ( result != 0 ) { |
2628 | createbup = false; | 2628 | createbup = false; |
2629 | } | 2629 | } |
2630 | } | 2630 | } |
2631 | if ( createbup ) { | 2631 | if ( createbup ) { |
2632 | bool success = false; | 2632 | bool success = false; |
2633 | if ( iCalFormat ) | 2633 | if ( iCalFormat ) |
2634 | success = mView->exportICalendar( fn ); | 2634 | success = mView->exportICalendar( fn ); |
2635 | else | 2635 | else |
2636 | success = mView->exportVCalendar( fn ); | 2636 | success = mView->exportVCalendar( fn ); |
2637 | if ( success ) { | 2637 | if ( success ) { |
2638 | if ( fn.length() > 20 ) | 2638 | if ( fn.length() > 20 ) |
2639 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2639 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2640 | else | 2640 | else |
2641 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2641 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2642 | setCaption(mes); | 2642 | setCaption(mes); |
2643 | } | 2643 | } |
2644 | } | 2644 | } |
2645 | 2645 | ||
2646 | } | 2646 | } |
2647 | void MainWindow::exportICalendar() | 2647 | void MainWindow::exportICalendar() |
2648 | { | 2648 | { |
2649 | exportCalendar( true ); | 2649 | exportCalendar( true ); |
2650 | } | 2650 | } |
2651 | void MainWindow::exportVCalendar() | 2651 | void MainWindow::exportVCalendar() |
2652 | { | 2652 | { |
2653 | exportCalendar( false ); | 2653 | exportCalendar( false ); |
2654 | } | 2654 | } |
2655 | QString MainWindow::sentSyncFile() | 2655 | QString MainWindow::sentSyncFile() |
2656 | { | 2656 | { |
2657 | #ifdef DESKTOP_VERSION | 2657 | #ifdef DESKTOP_VERSION |
2658 | return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); | 2658 | return QDir::convertSeparators( locateLocal( "tmp", "copysynccal.ics" ) ); |
2659 | #else | 2659 | #else |
2660 | return QString( "/tmp/copysynccal.ics" ); | 2660 | return QString( "/tmp/copysynccal.ics" ); |
2661 | #endif | 2661 | #endif |
2662 | } | 2662 | } |
2663 | 2663 | ||
2664 | void MainWindow::syncFileRequest() | 2664 | void MainWindow::syncFileRequest() |
2665 | { | 2665 | { |
2666 | while ( mSyncManager->blockSave() ) { | 2666 | while ( mSyncManager->blockSave() ) { |
2667 | qApp->processEvents(); | 2667 | qApp->processEvents(); |
2668 | } | 2668 | } |
2669 | mSyncManager->setBlockSave(true); | 2669 | mSyncManager->setBlockSave(true); |
2670 | 2670 | ||
2671 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2671 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2672 | mSyncManager->slotSyncMenu( 999 ); | 2672 | mSyncManager->slotSyncMenu( 999 ); |
2673 | } | 2673 | } |
2674 | 2674 | ||
2675 | setCaption(i18n("Saving Data to temp file ..." )); | 2675 | setCaption(i18n("Saving Data to temp file ..." )); |
2676 | mView->saveCalendar( sentSyncFile() ); | 2676 | mView->saveCalendar( sentSyncFile() ); |
2677 | setCaption(i18n("Data saved to temp file!" )); | 2677 | setCaption(i18n("Data saved to temp file!" )); |
2678 | mSyncManager->setBlockSave( false ); | 2678 | mSyncManager->setBlockSave( false ); |
2679 | 2679 | ||
2680 | } | 2680 | } |
2681 | void MainWindow::getFile( bool success ) | 2681 | void MainWindow::getFile( bool success ) |
2682 | { | 2682 | { |
2683 | if ( ! success ) { | 2683 | if ( ! success ) { |
2684 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2684 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2685 | return; | 2685 | return; |
2686 | } | 2686 | } |
2687 | mView->mergeFile( sentSyncFile() ); | 2687 | mView->mergeFile( sentSyncFile() ); |
2688 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2688 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2689 | mSyncManager->slotSyncMenu( 999 ); | 2689 | mSyncManager->slotSyncMenu( 999 ); |
2690 | } | 2690 | } |
2691 | setCaption( i18n("Pi-Sync successful!") ); | 2691 | setCaption( i18n("Pi-Sync successful!") ); |
2692 | } | 2692 | } |
2693 | void MainWindow::printListView() | 2693 | void MainWindow::printListView() |
2694 | { | 2694 | { |
2695 | 2695 | ||
2696 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); | 2696 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); |
2697 | 2697 | ||
2698 | KMessageBox::information( this, message); | 2698 | KMessageBox::information( this, message); |
2699 | } | 2699 | } |
2700 | void MainWindow::printSel( ) | 2700 | void MainWindow::printSel( ) |
2701 | { | 2701 | { |
2702 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2702 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2703 | } | 2703 | } |
2704 | 2704 | ||
2705 | void MainWindow::printCal() | 2705 | void MainWindow::printCal() |
2706 | { | 2706 | { |
2707 | mView->print();//mCp->showDialog(); | 2707 | mView->print();//mCp->showDialog(); |
2708 | } | 2708 | } |
2709 | 2709 | ||
2710 | 2710 | ||
2711 | #include "libkdepim/kdatepicker.h" | 2711 | #include "libkdepim/kdatepicker.h" |
2712 | #include <kdatetbl.h> | 2712 | #include <kdatetbl.h> |
2713 | 2713 | ||
2714 | void MainWindow::weekAction() | 2714 | void MainWindow::weekAction() |
2715 | { | 2715 | { |
2716 | int month; | 2716 | int month; |
2717 | KPopupFrame* popup = new KPopupFrame(this); | 2717 | KPopupFrame* popup = new KPopupFrame(this); |
2718 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2718 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2719 | // ----- | 2719 | // ----- |
2720 | picker->resize(picker->sizeHint()); | 2720 | picker->resize(picker->sizeHint()); |
2721 | popup->setMainWidget(picker); | 2721 | popup->setMainWidget(picker); |
2722 | picker->setFocus(); | 2722 | picker->setFocus(); |
2723 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2723 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2724 | int x = 0; | 2724 | int x = 0; |
2725 | int y = iconToolBar->height(); | 2725 | int y = iconToolBar->height(); |
2726 | int dX = 0; | 2726 | int dX = 0; |
2727 | int dY = 0; | 2727 | int dY = 0; |
2728 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2728 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2729 | if ( iconToolBar->y() > height()/2 ) { | 2729 | if ( iconToolBar->y() > height()/2 ) { |
2730 | dY = picker->sizeHint().height()+8; | 2730 | dY = picker->sizeHint().height()+8; |
2731 | y = 0; | 2731 | y = 0; |
2732 | } | 2732 | } |
2733 | } else { | 2733 | } else { |
2734 | if ( iconToolBar->x() > width()/2 ) { // right side | 2734 | if ( iconToolBar->x() > width()/2 ) { // right side |
2735 | x=0; | 2735 | x=0; |
2736 | dX= picker->sizeHint().width()+8; | 2736 | dX= picker->sizeHint().width()+8; |
2737 | y = 0; | 2737 | y = 0; |
2738 | } else { | 2738 | } else { |
2739 | x= iconToolBar->width(); | 2739 | x= iconToolBar->width(); |
2740 | y = 0; | 2740 | y = 0; |
2741 | } | 2741 | } |
2742 | } | 2742 | } |
2743 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2743 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2744 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2744 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2745 | { | 2745 | { |
2746 | month = picker->getResult(); | 2746 | month = picker->getResult(); |
2747 | emit selectWeek ( month ); | 2747 | emit selectWeek ( month ); |
2748 | //qDebug("weekSelected %d ", month); | 2748 | //qDebug("weekSelected %d ", month); |
2749 | } | 2749 | } |
2750 | delete popup; | 2750 | delete popup; |
2751 | } | 2751 | } |
2752 | 2752 | ||
2753 | void MainWindow::hideEvent ( QHideEvent * ) | 2753 | void MainWindow::hideEvent ( QHideEvent * ) |
2754 | { | 2754 | { |
2755 | QString message; | 2755 | QString message; |
2756 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2756 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2757 | if ( nextA.isValid() ) { | 2757 | if ( nextA.isValid() ) { |
2758 | QString sum = mCalendar->nextSummary(); | 2758 | QString sum = mCalendar->nextSummary(); |
2759 | 2759 | ||
2760 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2760 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2761 | setCaption( message ); | 2761 | setCaption( message ); |
2762 | } | 2762 | } |
2763 | } | 2763 | } |
2764 | 2764 | ||
2765 | void MainWindow::resizeEvent( QResizeEvent* e) | 2765 | void MainWindow::resizeEvent( QResizeEvent* e) |
2766 | { | 2766 | { |
2767 | #ifndef DESKTOP_VERSION | 2767 | #ifndef DESKTOP_VERSION |
2768 | if ( filterToolBar ) { | 2768 | if ( filterToolBar ) { |
2769 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { | 2769 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2770 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2770 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2771 | filterToolBar->hide(); | 2771 | filterToolBar->hide(); |
2772 | else | 2772 | else |
2773 | filterToolBar->show(); | 2773 | filterToolBar->show(); |
2774 | } | 2774 | } |
2775 | } | 2775 | } |
2776 | #endif | 2776 | #endif |
2777 | QMainWindow::resizeEvent( e); | 2777 | QMainWindow::resizeEvent( e); |
2778 | } | 2778 | } |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 70a7711..29f725f 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,674 +1,674 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <kglobalsettings.h> | 22 | #include <kglobalsettings.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
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 | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #define SAVETIMER_TIMEOUT_SECONDS 300 | 36 | #define SAVETIMER_TIMEOUT_SECONDS 300 |
37 | //#define SAVETIMER_TIMEOUT_SECONDS 8 | 37 | //#define SAVETIMER_TIMEOUT_SECONDS 8 |
38 | #define SAVETIMER_TIMEOUT_RETRY_SECONDS 5 | 38 | #define SAVETIMER_TIMEOUT_RETRY_SECONDS 5 |
39 | 39 | ||
40 | using namespace KCal; | 40 | using namespace KCal; |
41 | 41 | ||
42 | Todo::Todo(): QObject(), Incidence() | 42 | Todo::Todo(): QObject(), Incidence() |
43 | { | 43 | { |
44 | // mStatus = TENTATIVE; | 44 | // mStatus = TENTATIVE; |
45 | 45 | ||
46 | mHasDueDate = false; | 46 | mHasDueDate = false; |
47 | setHasStartDate( false ); | 47 | setHasStartDate( false ); |
48 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 48 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
49 | mHasCompletedDate = false; | 49 | mHasCompletedDate = false; |
50 | mPercentComplete = 0; | 50 | mPercentComplete = 0; |
51 | mRunning = false; | 51 | mRunning = false; |
52 | mRunSaveTimer = 0; | 52 | mRunSaveTimer = 0; |
53 | setFloats( true ); | 53 | setFloats( true ); |
54 | mCurrentTimerDelay = 0; | 54 | mCurrentTimerDelay = 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | Todo::Todo(const Todo &t) : QObject(),Incidence(t) | 57 | Todo::Todo(const Todo &t) : QObject(),Incidence(t) |
58 | { | 58 | { |
59 | mDtDue = t.mDtDue; | 59 | mDtDue = t.mDtDue; |
60 | mHasDueDate = t.mHasDueDate; | 60 | mHasDueDate = t.mHasDueDate; |
61 | mCompleted = t.mCompleted; | 61 | mCompleted = t.mCompleted; |
62 | mHasCompletedDate = t.mHasCompletedDate; | 62 | mHasCompletedDate = t.mHasCompletedDate; |
63 | mPercentComplete = t.mPercentComplete; | 63 | mPercentComplete = t.mPercentComplete; |
64 | mRunning = false; | 64 | mRunning = false; |
65 | mRunSaveTimer = 0; | 65 | mRunSaveTimer = 0; |
66 | mCurrentTimerDelay = 0; | 66 | mCurrentTimerDelay = 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | Todo::~Todo() | 69 | Todo::~Todo() |
70 | { | 70 | { |
71 | setRunning( false ); | 71 | setRunning( false ); |
72 | //qDebug("Todo::~Todo() "); | 72 | //qDebug("Todo::~Todo() "); |
73 | } | 73 | } |
74 | 74 | ||
75 | void Todo::setRunningFalse( QString s ) | 75 | void Todo::setRunningFalse( QString s ) |
76 | { | 76 | { |
77 | if ( ! mRunning ) | 77 | if ( ! mRunning ) |
78 | return; | 78 | return; |
79 | mRunning = false; | 79 | mRunning = false; |
80 | if ( mRunSaveTimer ) | 80 | if ( mRunSaveTimer ) |
81 | mRunSaveTimer->stop(); | 81 | mRunSaveTimer->stop(); |
82 | saveRunningInfoToFile( s ); | 82 | saveRunningInfoToFile( s ); |
83 | } | 83 | } |
84 | void Todo::stopRunning() | 84 | void Todo::stopRunning() |
85 | { | 85 | { |
86 | if ( !mRunning ) | 86 | if ( !mRunning ) |
87 | return; | 87 | return; |
88 | if ( mRunSaveTimer ) | 88 | if ( mRunSaveTimer ) |
89 | mRunSaveTimer->stop(); | 89 | mRunSaveTimer->stop(); |
90 | mRunning = false; | 90 | mRunning = false; |
91 | } | 91 | } |
92 | void Todo::setRunning( bool run ) | 92 | void Todo::setRunning( bool run ) |
93 | { | 93 | { |
94 | if ( run == mRunning ) | 94 | if ( run == mRunning ) |
95 | return; | 95 | return; |
96 | //qDebug("Todo::setRunning %d ", run); | 96 | //qDebug("Todo::setRunning %d ", run); |
97 | if ( !mRunSaveTimer ) { | 97 | if ( !mRunSaveTimer ) { |
98 | mRunSaveTimer = new QTimer ( this ); | 98 | mRunSaveTimer = new QTimer ( this ); |
99 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( timerSlotSaveRunningInfoToFile() ) ); | 99 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( timerSlotSaveRunningInfoToFile() ) ); |
100 | } | 100 | } |
101 | mRunning = run; | 101 | mRunning = run; |
102 | mRunLastSave = QDateTime::currentDateTime(); | 102 | mRunLastSave = QDateTime::currentDateTime(); |
103 | if ( mRunning ) { | 103 | if ( mRunning ) { |
104 | restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); | 104 | restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); |
105 | mRunStart = QDateTime::currentDateTime(); | 105 | mRunStart = QDateTime::currentDateTime(); |
106 | } else { | 106 | } else { |
107 | mRunSaveTimer->stop(); | 107 | mRunSaveTimer->stop(); |
108 | saveRunningInfoToFile(); | 108 | saveRunningInfoToFile(); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) | 111 | void 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 | } |
119 | void Todo::restartSaveTimer( int secs ) | 119 | void 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 | } |
125 | void Todo::timerSlotSaveRunningInfoToFile() | 125 | void 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 | } |
150 | void Todo::saveRunningInfoToFile() | 150 | void Todo::saveRunningInfoToFile() |
151 | { | 151 | { |
152 | mRunEnd = QDateTime::currentDateTime(); | 152 | mRunEnd = QDateTime::currentDateTime(); |
153 | saveRunningInfoToFile( QString::null ); | 153 | saveRunningInfoToFile( QString::null ); |
154 | } | 154 | } |
155 | void Todo::saveRunningInfoToFile( QString comment ) | 155 | void 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 | } |
197 | void Todo::saveParents() | 197 | void 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 | ||
225 | int Todo::runTime() | 225 | int 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 | } |
231 | bool Todo::hasRunningSub() | 231 | bool 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 | } |
242 | Incidence *Todo::clone() | 242 | Incidence *Todo::clone() |
243 | { | 243 | { |
244 | return new Todo(*this); | 244 | return new Todo(*this); |
245 | } | 245 | } |
246 | 246 | ||
247 | bool Todo::contains ( Todo* from ) | 247 | bool Todo::contains ( Todo* from ) |
248 | { | 248 | { |
249 | 249 | ||
250 | if ( !from->summary().isEmpty() ) | 250 | if ( !from->summary().isEmpty() ) |
251 | if ( !summary().startsWith( from->summary() )) | 251 | if ( !summary().startsWith( from->summary() )) |
252 | return false; | 252 | return false; |
253 | if ( from->hasStartDate() ) { | 253 | if ( from->hasStartDate() ) { |
254 | if ( !hasStartDate() ) | 254 | if ( !hasStartDate() ) |
255 | return false; | 255 | return false; |
256 | if ( from->dtStart() != dtStart()) | 256 | if ( from->dtStart() != dtStart()) |
257 | return false; | 257 | return false; |
258 | } | 258 | } |
259 | if ( from->hasDueDate() ){ | 259 | if ( from->hasDueDate() ){ |
260 | if ( !hasDueDate() ) | 260 | if ( !hasDueDate() ) |
261 | return false; | 261 | return false; |
262 | if ( from->dtDue() != dtDue()) | 262 | if ( from->dtDue() != dtDue()) |
263 | return false; | 263 | return false; |
264 | } | 264 | } |
265 | if ( !from->location().isEmpty() ) | 265 | if ( !from->location().isEmpty() ) |
266 | if ( !location().startsWith( from->location() ) ) | 266 | if ( !location().startsWith( from->location() ) ) |
267 | return false; | 267 | return false; |
268 | if ( !from->description().isEmpty() ) | 268 | if ( !from->description().isEmpty() ) |
269 | if ( !description().startsWith( from->description() )) | 269 | if ( !description().startsWith( from->description() )) |
270 | return false; | 270 | return false; |
271 | if ( from->alarms().count() ) { | 271 | if ( from->alarms().count() ) { |
272 | Alarm *a = from->alarms().first(); | 272 | Alarm *a = from->alarms().first(); |
273 | if ( a->enabled() ){ | 273 | if ( a->enabled() ){ |
274 | if ( !alarms().count() ) | 274 | if ( !alarms().count() ) |
275 | return false; | 275 | return false; |
276 | Alarm *b = alarms().first(); | 276 | Alarm *b = alarms().first(); |
277 | if( ! b->enabled() ) | 277 | if( ! b->enabled() ) |
278 | return false; | 278 | return false; |
279 | if ( ! (a->offset() == b->offset() )) | 279 | if ( ! (a->offset() == b->offset() )) |
280 | return false; | 280 | return false; |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | QStringList cat = categories(); | 284 | QStringList cat = categories(); |
285 | QStringList catFrom = from->categories(); | 285 | QStringList catFrom = from->categories(); |
286 | QString nCat; | 286 | QString nCat; |
287 | unsigned int iii; | 287 | unsigned int iii; |
288 | for ( iii = 0; iii < catFrom.count();++iii ) { | 288 | for ( iii = 0; iii < catFrom.count();++iii ) { |
289 | nCat = catFrom[iii]; | 289 | nCat = catFrom[iii]; |
290 | if ( !nCat.isEmpty() ) | 290 | if ( !nCat.isEmpty() ) |
291 | if ( !cat.contains( nCat )) { | 291 | if ( !cat.contains( nCat )) { |
292 | return false; | 292 | return false; |
293 | } | 293 | } |
294 | } | 294 | } |
295 | if ( from->isCompleted() ) { | 295 | if ( from->isCompleted() ) { |
296 | if ( !isCompleted() ) | 296 | if ( !isCompleted() ) |
297 | return false; | 297 | return false; |
298 | } | 298 | } |
299 | if( priority() != from->priority() ) | 299 | if( priority() != from->priority() ) |
300 | return false; | 300 | return false; |
301 | 301 | ||
302 | 302 | ||
303 | return true; | 303 | return true; |
304 | 304 | ||
305 | } | 305 | } |
306 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 306 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
307 | { | 307 | { |
308 | 308 | ||
309 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 309 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
310 | if ( ! ret ) | 310 | if ( ! ret ) |
311 | return false; | 311 | return false; |
312 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 312 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
313 | if ( t1.hasDueDate() ) { | 313 | if ( t1.hasDueDate() ) { |
314 | if ( t1.doesFloat() == t2.doesFloat() ) { | 314 | if ( t1.doesFloat() == t2.doesFloat() ) { |
315 | if ( t1.doesFloat() ) { | 315 | if ( t1.doesFloat() ) { |
316 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 316 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
317 | return false; | 317 | return false; |
318 | } else | 318 | } else |
319 | if ( t1.dtDue() != t2.dtDue() ) | 319 | if ( t1.dtDue() != t2.dtDue() ) |
320 | return false; | 320 | return false; |
321 | } else | 321 | } else |
322 | return false;// float != | 322 | return false;// float != |
323 | } | 323 | } |
324 | 324 | ||
325 | } else | 325 | } else |
326 | return false; | 326 | return false; |
327 | if ( t1.percentComplete() != t2.percentComplete() ) | 327 | if ( t1.percentComplete() != t2.percentComplete() ) |
328 | return false; | 328 | return false; |
329 | if ( t1.isCompleted() ) { | 329 | if ( t1.isCompleted() ) { |
330 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { | 330 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { |
331 | if ( t1.hasCompletedDate() ) { | 331 | if ( t1.hasCompletedDate() ) { |
332 | if ( t1.completed() != t2.completed() ) | 332 | if ( t1.completed() != t2.completed() ) |
333 | return false; | 333 | return false; |
334 | } | 334 | } |
335 | 335 | ||
336 | } else | 336 | } else |
337 | return false; | 337 | return false; |
338 | } | 338 | } |
339 | return true; | 339 | return true; |
340 | 340 | ||
341 | } | 341 | } |
342 | 342 | ||
343 | void Todo::setDtDue(const QDateTime &dtDue) | 343 | void Todo::setDtDue(const QDateTime &dtDue) |
344 | { | 344 | { |
345 | //int diffsecs = mDtDue.secsTo(dtDue); | 345 | //int diffsecs = mDtDue.secsTo(dtDue); |
346 | 346 | ||
347 | /*if (mReadOnly) return; | 347 | /*if (mReadOnly) return; |
348 | const QPtrList<Alarm>& alarms = alarms(); | 348 | const QPtrList<Alarm>& alarms = alarms(); |
349 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { | 349 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { |
350 | if (alarm->enabled()) { | 350 | if (alarm->enabled()) { |
351 | alarm->setTime(alarm->time().addSecs(diffsecs)); | 351 | alarm->setTime(alarm->time().addSecs(diffsecs)); |
352 | } | 352 | } |
353 | }*/ | 353 | }*/ |
354 | mDtDue = getEvenTime(dtDue); | 354 | mDtDue = getEvenTime(dtDue); |
355 | 355 | ||
356 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; | 356 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; |
357 | 357 | ||
358 | /*const QPtrList<Alarm>& alarms = alarms(); | 358 | /*const QPtrList<Alarm>& alarms = alarms(); |
359 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) | 359 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) |
360 | alarm->setAlarmStart(mDtDue);*/ | 360 | alarm->setAlarmStart(mDtDue);*/ |
361 | updated(); | 361 | updated(); |
362 | } | 362 | } |
363 | 363 | ||
364 | QDateTime Todo::dtDue() const | 364 | QDateTime Todo::dtDue() const |
365 | { | 365 | { |
366 | return mDtDue; | 366 | return mDtDue; |
367 | } | 367 | } |
368 | 368 | ||
369 | QString Todo::dtDueTimeStr() const | 369 | QString Todo::dtDueTimeStr() const |
370 | { | 370 | { |
371 | return KGlobal::locale()->formatTime(mDtDue.time()); | 371 | return KGlobal::locale()->formatTime(mDtDue.time()); |
372 | } | 372 | } |
373 | 373 | ||
374 | QString Todo::dtDueDateStr(bool shortfmt) const | 374 | QString Todo::dtDueDateStr(bool shortfmt) const |
375 | { | 375 | { |
376 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 376 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
377 | } | 377 | } |
378 | 378 | ||
379 | QString Todo::dtDueStr(bool shortfmt) const | 379 | QString Todo::dtDueStr(bool shortfmt) const |
380 | { | 380 | { |
381 | if ( doesFloat() ) | 381 | if ( doesFloat() ) |
382 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 382 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
383 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | 383 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); |
384 | } | 384 | } |
385 | // retval 0 : no found | 385 | // retval 0 : no found |
386 | // 1 : due for date found | 386 | // 1 : due for date found |
387 | // 2 : overdue for date found | 387 | // 2 : overdue for date found |
388 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) | 388 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) |
389 | { | 389 | { |
390 | int retval = 0; | 390 | int retval = 0; |
391 | if ( isCompleted() ) | 391 | if ( isCompleted() ) |
392 | return 0; | 392 | return 0; |
393 | if ( hasDueDate() ) { | 393 | if ( hasDueDate() ) { |
394 | if ( dtDue().date() < date ) | 394 | if ( dtDue().date() < date ) |
395 | return 2; | 395 | return 2; |
396 | // we do not return, because we may find an overdue sub todo | 396 | // we do not return, because we may find an overdue sub todo |
397 | if ( dtDue().date() == date ) | 397 | if ( dtDue().date() == date ) |
398 | retval = 1; | 398 | retval = 1; |
399 | } | 399 | } |
400 | if ( checkSubtodos ) { | 400 | if ( checkSubtodos ) { |
401 | Incidence *aTodo; | 401 | Incidence *aTodo; |
402 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 402 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
403 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); | 403 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); |
404 | if ( ret == 2 ) | 404 | if ( ret == 2 ) |
405 | return 2; | 405 | return 2; |
406 | if ( ret == 1) | 406 | if ( ret == 1) |
407 | retval = 1; | 407 | retval = 1; |
408 | } | 408 | } |
409 | } | 409 | } |
410 | return retval; | 410 | return retval; |
411 | } | 411 | } |
412 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true | 412 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true |
413 | { | 413 | { |
414 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); | 414 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); |
415 | } | 415 | } |
416 | bool Todo::hasDueDate() const | 416 | bool Todo::hasDueDate() const |
417 | { | 417 | { |
418 | return mHasDueDate; | 418 | return mHasDueDate; |
419 | } | 419 | } |
420 | 420 | ||
421 | void Todo::setHasDueDate(bool f) | 421 | void Todo::setHasDueDate(bool f) |
422 | { | 422 | { |
423 | if (mReadOnly) return; | 423 | if (mReadOnly) return; |
424 | mHasDueDate = f; | 424 | mHasDueDate = f; |
425 | updated(); | 425 | updated(); |
426 | } | 426 | } |
427 | 427 | ||
428 | 428 | ||
429 | #if 0 | 429 | #if 0 |
430 | void Todo::setStatus(const QString &statStr) | 430 | void Todo::setStatus(const QString &statStr) |
431 | { | 431 | { |
432 | if (mReadOnly) return; | 432 | if (mReadOnly) return; |
433 | QString ss(statStr.upper()); | 433 | QString ss(statStr.upper()); |
434 | 434 | ||
435 | if (ss == "X-ACTION") | 435 | if (ss == "X-ACTION") |
436 | mStatus = NEEDS_ACTION; | 436 | mStatus = NEEDS_ACTION; |
437 | else if (ss == "NEEDS ACTION") | 437 | else if (ss == "NEEDS ACTION") |
438 | mStatus = NEEDS_ACTION; | 438 | mStatus = NEEDS_ACTION; |
439 | else if (ss == "ACCEPTED") | 439 | else if (ss == "ACCEPTED") |
440 | mStatus = ACCEPTED; | 440 | mStatus = ACCEPTED; |
441 | else if (ss == "SENT") | 441 | else if (ss == "SENT") |
442 | mStatus = SENT; | 442 | mStatus = SENT; |
443 | else if (ss == "TENTATIVE") | 443 | else if (ss == "TENTATIVE") |
444 | mStatus = TENTATIVE; | 444 | mStatus = TENTATIVE; |
445 | else if (ss == "CONFIRMED") | 445 | else if (ss == "CONFIRMED") |
446 | mStatus = CONFIRMED; | 446 | mStatus = CONFIRMED; |
447 | else if (ss == "DECLINED") | 447 | else if (ss == "DECLINED") |
448 | mStatus = DECLINED; | 448 | mStatus = DECLINED; |
449 | else if (ss == "COMPLETED") | 449 | else if (ss == "COMPLETED") |
450 | mStatus = COMPLETED; | 450 | mStatus = COMPLETED; |
451 | else if (ss == "DELEGATED") | 451 | else if (ss == "DELEGATED") |
452 | mStatus = DELEGATED; | 452 | mStatus = DELEGATED; |
453 | 453 | ||
454 | updated(); | 454 | updated(); |
455 | } | 455 | } |
456 | 456 | ||
457 | void Todo::setStatus(int status) | 457 | void Todo::setStatus(int status) |
458 | { | 458 | { |
459 | if (mReadOnly) return; | 459 | if (mReadOnly) return; |
460 | mStatus = status; | 460 | mStatus = status; |
461 | updated(); | 461 | updated(); |
462 | } | 462 | } |
463 | 463 | ||
464 | int Todo::status() const | 464 | int Todo::status() const |
465 | { | 465 | { |
466 | return mStatus; | 466 | return mStatus; |
467 | } | 467 | } |
468 | 468 | ||
469 | QString Todo::statusStr() const | 469 | QString Todo::statusStr() const |
470 | { | 470 | { |
471 | switch(mStatus) { | 471 | switch(mStatus) { |
472 | case NEEDS_ACTION: | 472 | case NEEDS_ACTION: |
473 | return QString("NEEDS ACTION"); | 473 | return QString("NEEDS ACTION"); |
474 | break; | 474 | break; |
475 | case ACCEPTED: | 475 | case ACCEPTED: |
476 | return QString("ACCEPTED"); | 476 | return QString("ACCEPTED"); |
477 | break; | 477 | break; |
478 | case SENT: | 478 | case SENT: |
479 | return QString("SENT"); | 479 | return QString("SENT"); |
480 | break; | 480 | break; |
481 | case TENTATIVE: | 481 | case TENTATIVE: |
482 | return QString("TENTATIVE"); | 482 | return QString("TENTATIVE"); |
483 | break; | 483 | break; |
484 | case CONFIRMED: | 484 | case CONFIRMED: |
485 | return QString("CONFIRMED"); | 485 | return QString("CONFIRMED"); |
486 | break; | 486 | break; |
487 | case DECLINED: | 487 | case DECLINED: |
488 | return QString("DECLINED"); | 488 | return QString("DECLINED"); |
489 | break; | 489 | break; |
490 | case COMPLETED: | 490 | case COMPLETED: |
491 | return QString("COMPLETED"); | 491 | return QString("COMPLETED"); |
492 | break; | 492 | break; |
493 | case DELEGATED: | 493 | case DELEGATED: |
494 | return QString("DELEGATED"); | 494 | return QString("DELEGATED"); |
495 | break; | 495 | break; |
496 | } | 496 | } |
497 | return QString(""); | 497 | return QString(""); |
498 | } | 498 | } |
499 | #endif | 499 | #endif |
500 | 500 | ||
501 | bool Todo::isCompleted() const | 501 | bool Todo::isCompleted() const |
502 | { | 502 | { |
503 | if (mPercentComplete == 100) { | 503 | if (mPercentComplete == 100) { |
504 | return true; | 504 | return true; |
505 | } | 505 | } |
506 | else return false; | 506 | else return false; |
507 | } | 507 | } |
508 | 508 | ||
509 | void Todo::setCompleted(bool completed) | 509 | void Todo::setCompleted(bool completed) |
510 | { | 510 | { |
511 | if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) { | 511 | if ( mHasRecurrenceID && completed && mPercentComplete != 100 ) { |
512 | if ( !setRecurDates() ) | 512 | if ( !setRecurDates() ) |
513 | completed = false; | 513 | completed = false; |
514 | } | 514 | } |
515 | if (completed) mPercentComplete = 100; | 515 | if (completed) mPercentComplete = 100; |
516 | else { | 516 | else { |
517 | mPercentComplete = 0; | 517 | mPercentComplete = 0; |
518 | mHasCompletedDate = false; | 518 | mHasCompletedDate = false; |
519 | } | 519 | } |
520 | updated(); | 520 | updated(); |
521 | } | 521 | } |
522 | 522 | ||
523 | QDateTime Todo::completed() const | 523 | QDateTime Todo::completed() const |
524 | { | 524 | { |
525 | return mCompleted; | 525 | return mCompleted; |
526 | } | 526 | } |
527 | 527 | ||
528 | QString Todo::completedStr( bool shortF ) const | 528 | QString Todo::completedStr( bool shortF ) const |
529 | { | 529 | { |
530 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); | 530 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); |
531 | } | 531 | } |
532 | 532 | ||
533 | void Todo::setCompleted(const QDateTime &completed) | 533 | void Todo::setCompleted(const QDateTime &completed) |
534 | { | 534 | { |
535 | //qDebug("Todo::setCompleted "); | 535 | //qDebug("Todo::setCompleted "); |
536 | if ( mHasCompletedDate ) { | 536 | if ( mHasCompletedDate ) { |
537 | // qDebug("has completed data - return "); | 537 | // qDebug("has completed data - return "); |
538 | return; | 538 | return; |
539 | } | 539 | } |
540 | mHasCompletedDate = true; | 540 | mHasCompletedDate = true; |
541 | mPercentComplete = 100; | 541 | mPercentComplete = 100; |
542 | mCompleted = getEvenTime(completed); | 542 | mCompleted = getEvenTime(completed); |
543 | updated(); | 543 | updated(); |
544 | } | 544 | } |
545 | 545 | ||
546 | bool Todo::hasCompletedDate() const | 546 | bool Todo::hasCompletedDate() const |
547 | { | 547 | { |
548 | return mHasCompletedDate; | 548 | return mHasCompletedDate; |
549 | } | 549 | } |
550 | 550 | ||
551 | int Todo::percentComplete() const | 551 | int Todo::percentComplete() const |
552 | { | 552 | { |
553 | return mPercentComplete; | 553 | return mPercentComplete; |
554 | } | 554 | } |
555 | bool Todo::setRecurDates() | 555 | bool Todo::setRecurDates() |
556 | { | 556 | { |
557 | if ( !mHasRecurrenceID ) | 557 | if ( !mHasRecurrenceID ) |
558 | return true; | 558 | return true; |
559 | int secs = mDtStart.secsTo( dtDue() ); | 559 | int secs = mDtStart.secsTo( dtDue() ); |
560 | bool ok; | 560 | bool ok; |
561 | qDebug("T:setRecurDates() "); | 561 | qDebug("T:setRecurDates() "); |
562 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 562 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
563 | QDateTime next = getNextOccurence( mRecurrenceID, &ok ); | 563 | QDateTime next = getNextOccurence( mRecurrenceID, &ok ); |
564 | if ( ok ) { | 564 | if ( ok ) { |
565 | mRecurrenceID = next; | 565 | mRecurrenceID = next; |
566 | mDtStart = next; | 566 | mDtStart = next; |
567 | setDtDue( next.addSecs( secs ) ); | 567 | setDtDue( next.addSecs( secs ) ); |
568 | if ( QDateTime::currentDateTime() > next) | 568 | if ( QDateTime::currentDateTime() > next) |
569 | return false; | 569 | return false; |
570 | } else { | 570 | } else { |
571 | setHasRecurrenceID( false ); | 571 | setHasRecurrenceID( false ); |
572 | recurrence()->unsetRecurs(); | 572 | recurrence()->unsetRecurs(); |
573 | } | 573 | } |
574 | return true; | 574 | return true; |
575 | } | 575 | } |
576 | void Todo::setPercentComplete(int v) | 576 | void Todo::setPercentComplete(int v) |
577 | { | 577 | { |
578 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { | 578 | if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { |
579 | if ( !setRecurDates() ) | 579 | if ( !setRecurDates() ) |
580 | v = 0; | 580 | v = 0; |
581 | } | 581 | } |
582 | mPercentComplete = v; | 582 | mPercentComplete = v; |
583 | if ( v != 100 ) | 583 | if ( v != 100 ) |
584 | mHasCompletedDate = false; | 584 | mHasCompletedDate = false; |
585 | updated(); | 585 | updated(); |
586 | } | 586 | } |
587 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const | 587 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
588 | { | 588 | { |
589 | *ok = false; | 589 | *ok = false; |
590 | if ( ! hasDueDate() || cancelled() || !alarmEnabled() ) { | 590 | if ( ! hasDueDate() || cancelled() || !alarmEnabled() ) { |
591 | return QDateTime (); | 591 | return QDateTime (); |
592 | } | 592 | } |
593 | // if the recurring todo is set to complete and requested time < start time of todo | 593 | // if the recurring todo is set to complete and requested time < start time of todo |
594 | // we want to get the alarm. | 594 | // we want to get the alarm. |
595 | bool iscompleted = isCompleted(); | 595 | bool iscompleted = isCompleted(); |
596 | if ( iscompleted && doesRecur() ) { | 596 | if ( iscompleted && doesRecur() ) { |
597 | Todo * to = (Todo*) this; | 597 | Todo * to = (Todo*) this; |
598 | to->checkSetCompletedFalse(); | 598 | to->checkSetCompletedFalse(); |
599 | iscompleted = isCompleted(); | 599 | iscompleted = isCompleted(); |
600 | if ( hasStartDate() && start_dt < dtStart() ){ | 600 | if ( hasStartDate() && start_dt < dtStart() ){ |
601 | iscompleted = false; | 601 | iscompleted = false; |
602 | } | 602 | } |
603 | } | 603 | } |
604 | if ( iscompleted ) { | 604 | if ( iscompleted ) { |
605 | return QDateTime (); | 605 | return QDateTime (); |
606 | } | 606 | } |
607 | QDateTime incidenceStart; | 607 | QDateTime incidenceStart; |
608 | incidenceStart = dtDue(); | 608 | incidenceStart = dtDue(); |
609 | bool enabled = false; | 609 | bool enabled = false; |
610 | Alarm* alarm; | 610 | Alarm* alarm; |
611 | int off = 0; | 611 | int off = 0; |
612 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 612 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
613 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 613 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
614 | // *ok = false; | 614 | // *ok = false; |
615 | // return incidenceStart; | 615 | // return incidenceStart; |
616 | // } | 616 | // } |
617 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 617 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
618 | if (alarm->enabled()) { | 618 | if (alarm->enabled()) { |
619 | if ( alarm->hasTime () ) { | 619 | if ( alarm->hasTime () ) { |
620 | if ( alarm->time() < alarmStart ) { | 620 | if ( alarm->time() < alarmStart ) { |
621 | alarmStart = alarm->time(); | 621 | alarmStart = alarm->time(); |
622 | enabled = true; | 622 | enabled = true; |
623 | off = alarmStart.secsTo( incidenceStart ); | 623 | off = alarmStart.secsTo( incidenceStart ); |
624 | } | 624 | } |
625 | 625 | ||
626 | } else { | 626 | } else { |
627 | int secs = alarm->startOffset().asSeconds(); | 627 | int secs = alarm->startOffset().asSeconds(); |
628 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 628 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
629 | alarmStart = incidenceStart.addSecs( secs ); | 629 | alarmStart = incidenceStart.addSecs( secs ); |
630 | enabled = true; | 630 | enabled = true; |
631 | off = -secs; | 631 | off = -secs; |
632 | } | 632 | } |
633 | } | 633 | } |
634 | } | 634 | } |
635 | } | 635 | } |
636 | if ( enabled ) { | 636 | if ( enabled ) { |
637 | if ( alarmStart > start_dt ) { | 637 | if ( alarmStart > start_dt ) { |
638 | *ok = true; | 638 | *ok = true; |
639 | * offset = off; | 639 | * offset = off; |
640 | return alarmStart; | 640 | return alarmStart; |
641 | } | 641 | } |
642 | } | 642 | } |
643 | *ok = false; | 643 | *ok = false; |
644 | return QDateTime (); | 644 | return QDateTime (); |
645 | 645 | ||
646 | } | 646 | } |
647 | 647 | ||
648 | void Todo::checkSetCompletedFalse() | 648 | void Todo::checkSetCompletedFalse() |
649 | { | 649 | { |
650 | if ( !mHasRecurrenceID ) { | 650 | if ( !mHasRecurrenceID ) { |
651 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); | 651 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); |
652 | return; | 652 | return; |
653 | } | 653 | } |
654 | // qDebug("Todo::checkSetCompletedFalse()"); | 654 | // qDebug("Todo::checkSetCompletedFalse()"); |
655 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 655 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
656 | if ( mPercentComplete == 100 ) { | 656 | if ( mPercentComplete == 100 ) { |
657 | QDateTime dt = QDateTime::currentDateTime(); | 657 | QDateTime dt = QDateTime::currentDateTime(); |
658 | if ( dt > mDtStart && dt > mRecurrenceID ) { | 658 | if ( dt > mDtStart && dt > mRecurrenceID ) { |
659 | qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 659 | qDebug("start: %s --due: %s --recID: %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
660 | setCompleted( false ); | 660 | setCompleted( false ); |
661 | qDebug("Todo::checkSetCompletedFalse "); | 661 | qDebug("Todo::checkSetCompletedFalse "); |
662 | } | 662 | } |
663 | } | 663 | } |
664 | } | 664 | } |
665 | QString Todo::durationText() | 665 | QString Todo::durationText() |
666 | { | 666 | { |
667 | if ( mHasDueDate && hasStartDate() ) { | 667 | if ( mHasDueDate && hasStartDate() ) { |
668 | int sec = dtStart().secsTo( dtDue() ); | 668 | int sec = dtStart().secsTo( dtDue() ); |
669 | if ( doesFloat() ) | 669 | if ( doesFloat() ) |
670 | sec += 86400; | 670 | sec += 86400; |
671 | return durationText4Time( sec ); | 671 | return durationText4Time( sec ); |
672 | } | 672 | } |
673 | return "---"; | 673 | return "---"; |
674 | } | 674 | } |