summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-29 18:10:22 (UTC)
committer zautrix <zautrix>2005-07-29 18:10:22 (UTC)
commit48a8fa71f1985fea9df4981808796ef65f0f974a (patch) (unidiff)
tree960705d669093b067b9ce06456e2aea5aeb92958
parent9553b882522708477d131d0d9a2c581724940ba3 (diff)
downloadkdepimpi-48a8fa71f1985fea9df4981808796ef65f0f974a.zip
kdepimpi-48a8fa71f1985fea9df4981808796ef65f0f974a.tar.gz
kdepimpi-48a8fa71f1985fea9df4981808796ef65f0f974a.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 98a820d..7ce0251 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1000,1540 +1000,1540 @@ void MainWindow::initActions()
1000 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1000 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1001 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1001 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
1002 day7_action->addTo( viewMenu ); 1002 day7_action->addTo( viewMenu );
1003 connect( day7_action, SIGNAL( activated() ), 1003 connect( day7_action, SIGNAL( activated() ),
1004 mView->viewManager(), SLOT( showWeekView() ) ); 1004 mView->viewManager(), SLOT( showWeekView() ) );
1005 1005
1006 icon = loadPixmap( pathString + "workweek2" ); 1006 icon = loadPixmap( pathString + "workweek2" );
1007 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1007 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1008 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1008 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
1009 day6_action->addTo( viewMenu ); 1009 day6_action->addTo( viewMenu );
1010 connect( day6_action, SIGNAL( activated() ), 1010 connect( day6_action, SIGNAL( activated() ),
1011 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1011 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1012 1012
1013 icon = loadPixmap( pathString + "month" ); 1013 icon = loadPixmap( pathString + "month" );
1014 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1014 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1015 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1015 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
1016 month_action->addTo( viewMenu ); 1016 month_action->addTo( viewMenu );
1017 connect( month_action, SIGNAL( activated() ), 1017 connect( month_action, SIGNAL( activated() ),
1018 mView->viewManager(), SLOT( showMonthView() ) ); 1018 mView->viewManager(), SLOT( showMonthView() ) );
1019 1019
1020 icon = loadPixmap( pathString + "list" ); 1020 icon = loadPixmap( pathString + "list" );
1021 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1021 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1022 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1022 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
1023 showlist_action->addTo( viewMenu ); 1023 showlist_action->addTo( viewMenu );
1024 connect( showlist_action, SIGNAL( activated() ), 1024 connect( showlist_action, SIGNAL( activated() ),
1025 mView->viewManager(), SLOT( showListView() ) ); 1025 mView->viewManager(), SLOT( showListView() ) );
1026 1026
1027 icon = loadPixmap( pathString + "todo" ); 1027 icon = loadPixmap( pathString + "todo" );
1028 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1028 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1029 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1029 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1030 todoview_action->addTo( viewMenu ); 1030 todoview_action->addTo( viewMenu );
1031 connect( todoview_action, SIGNAL( activated() ), 1031 connect( todoview_action, SIGNAL( activated() ),
1032 mView->viewManager(), SLOT( showTodoView() ) ); 1032 mView->viewManager(), SLOT( showTodoView() ) );
1033 1033
1034 1034
1035 1035
1036#if 0 1036#if 0
1037 action = new QAction( "view_timespan", "Time Span", 0, this ); 1037 action = new QAction( "view_timespan", "Time Span", 0, this );
1038 action->addTo( viewMenu ); 1038 action->addTo( viewMenu );
1039 connect( action, SIGNAL( activated() ), 1039 connect( action, SIGNAL( activated() ),
1040 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1040 mView->viewManager(), SLOT( showTimeSpanView() ) );
1041#endif 1041#endif
1042 1042
1043 1043
1044 1044
1045 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1045 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1046 this ); 1046 this );
1047 action->addTo( actionMenu ); 1047 action->addTo( actionMenu );
1048 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1048 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1049 1049
1050 1050
1051 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1051 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1052 1052
1053 1053
1054 1054
1055 actionMenu->insertSeparator(); 1055 actionMenu->insertSeparator();
1056 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1056 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1057 this ); 1057 this );
1058 action->addTo( actionMenu ); 1058 action->addTo( actionMenu );
1059 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1059 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1060 1060
1061 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1061 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1062 this ); 1062 this );
1063 action->addTo( actionMenu ); 1063 action->addTo( actionMenu );
1064 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1064 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1065 1065
1066 1066
1067 actionMenu->insertSeparator(); 1067 actionMenu->insertSeparator();
1068 icon = loadPixmap( pathString + "configure" ); 1068 icon = loadPixmap( pathString + "configure" );
1069 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1069 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1070 action->addTo( actionMenu ); 1070 action->addTo( actionMenu );
1071 connect( action, SIGNAL( activated() ), 1071 connect( action, SIGNAL( activated() ),
1072 mView, SLOT( edit_options() ) ); 1072 mView, SLOT( edit_options() ) );
1073 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1073 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1074 action->addTo( actionMenu ); 1074 action->addTo( actionMenu );
1075 connect( action, SIGNAL( activated() ), 1075 connect( action, SIGNAL( activated() ),
1076 this, SLOT( calHint() ) ); 1076 this, SLOT( calHint() ) );
1077 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1077 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1078 action->addTo( actionMenu ); 1078 action->addTo( actionMenu );
1079 connect( action, SIGNAL( activated() ), 1079 connect( action, SIGNAL( activated() ),
1080 mView, SLOT( edit_global_options() ) ); 1080 mView, SLOT( edit_global_options() ) );
1081 if ( KOPrefs::instance()->mShowFullMenu ) { 1081 if ( KOPrefs::instance()->mShowFullMenu ) {
1082 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1082 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1083 1083
1084 } 1084 }
1085 // actionMenu->insertSeparator(); 1085 // actionMenu->insertSeparator();
1086 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1086 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1087 this ); 1087 this );
1088 action->addTo( importMenu_X ); 1088 action->addTo( importMenu_X );
1089 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1089 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1090 action = new QAction( "import_quick", i18n("Import last file"), 0, 1090 action = new QAction( "import_quick", i18n("Import last file"), 0,
1091 this ); 1091 this );
1092 action->addTo( importMenu_X ); 1092 action->addTo( importMenu_X );
1093 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1093 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1094 importMenu_X->insertSeparator(); 1094 importMenu_X->insertSeparator();
1095 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1095 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1096 this ); 1096 this );
1097 action->addTo( importMenu_X ); 1097 action->addTo( importMenu_X );
1098 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1098 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1099 //#ifndef DESKTOP_VERSION 1099 //#ifndef DESKTOP_VERSION
1100 importMenu_X->insertSeparator(); 1100 importMenu_X->insertSeparator();
1101 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1101 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1102 this ); 1102 this );
1103 action->addTo( importMenu_X ); 1103 action->addTo( importMenu_X );
1104 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1104 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1105 //#else 1105 //#else
1106#ifdef _OL_IMPORT_ 1106#ifdef _OL_IMPORT_
1107 importMenu_X->insertSeparator(); 1107 importMenu_X->insertSeparator();
1108 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1108 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1109 this ); 1109 this );
1110 action->addTo( importMenu_X ); 1110 action->addTo( importMenu_X );
1111 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1111 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1112#endif 1112#endif
1113 //#endif 1113 //#endif
1114 1114
1115 //importMenu->insertSeparator(); 1115 //importMenu->insertSeparator();
1116#if 0 1116#if 0
1117 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1117 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1118 this ); 1118 this );
1119 action->addTo( importMenu ); 1119 action->addTo( importMenu );
1120 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1120 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1121#endif 1121#endif
1122 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1122 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1123 this ); 1123 this );
1124 action->addTo( importMenu ); 1124 action->addTo( importMenu );
1125 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1125 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1126 importMenu->insertSeparator(); 1126 importMenu->insertSeparator();
1127 importMenu->insertItem( i18n("Import"), importMenu_X ); 1127 importMenu->insertItem( i18n("Import"), importMenu_X );
1128 //importMenu->insertSeparator(); 1128 //importMenu->insertSeparator();
1129 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1129 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1130 this ); 1130 this );
1131 action->addTo( exportMenu_X ); 1131 action->addTo( exportMenu_X );
1132 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1132 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1133 1133
1134 1134
1135 //LR 1135 //LR
1136 QPopupMenu *ex2phone = new QPopupMenu( this ); 1136 QPopupMenu *ex2phone = new QPopupMenu( this );
1137 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1137 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1138 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1138 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1139 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1139 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1140 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1140 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1141 1141
1142 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1142 importMenu->insertItem( i18n("Export"), exportMenu_X );
1143 mPrintSelAction = 0; 1143 mPrintSelAction = 0;
1144#ifndef DESKTOP_VERSION 1144#ifndef DESKTOP_VERSION
1145 //importMenu->insertSeparator(); 1145 //importMenu->insertSeparator();
1146 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1146 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1147 this ); 1147 this );
1148 brAction->addTo( beamMenu_X ); 1148 brAction->addTo( beamMenu_X );
1149 brAction->setToggleAction (true ) ; 1149 brAction->setToggleAction (true ) ;
1150 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1150 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1151 1151
1152 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1152 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1153 this ); 1153 this );
1154 action->addTo( beamMenu_X ); 1154 action->addTo( beamMenu_X );
1155 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1155 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1156 1156
1157 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1157 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1158 this ); 1158 this );
1159 action->addTo( beamMenu_X ); 1159 action->addTo( beamMenu_X );
1160 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1160 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1161 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1161 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1162#else 1162#else
1163 //importMenu->insertSeparator(); 1163 //importMenu->insertSeparator();
1164 icon = loadPixmap( pathString + "print" ); 1164 icon = loadPixmap( pathString + "print" );
1165 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1165 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1166 action->addTo( beamMenu_X ); 1166 action->addTo( beamMenu_X );
1167 connect( action, SIGNAL( activated() ), 1167 connect( action, SIGNAL( activated() ),
1168 this, SLOT( printCal() ) ); 1168 this, SLOT( printCal() ) );
1169 1169
1170 icon = loadPixmap( pathString + "week" ); 1170 icon = loadPixmap( pathString + "week" );
1171 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1171 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1172 action->addTo( beamMenu_X ); 1172 action->addTo( beamMenu_X );
1173 connect( action, SIGNAL( activated() ), 1173 connect( action, SIGNAL( activated() ),
1174 this, SLOT( printSel() ) ); 1174 this, SLOT( printSel() ) );
1175 icon = loadPixmap( pathString + "whatsnext" ); 1175 icon = loadPixmap( pathString + "whatsnext" );
1176 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1176 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1177 action->addTo( beamMenu_X ); 1177 action->addTo( beamMenu_X );
1178 connect( action, SIGNAL( activated() ), 1178 connect( action, SIGNAL( activated() ),
1179 mView->viewManager(), SLOT( slotprintWNV() ) ); 1179 mView->viewManager(), SLOT( slotprintWNV() ) );
1180 1180
1181 1181
1182 icon = loadPixmap( pathString + "list" ); 1182 icon = loadPixmap( pathString + "list" );
1183 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1183 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1184 action->addTo( beamMenu_X ); 1184 action->addTo( beamMenu_X );
1185 connect( action, SIGNAL( activated() ), 1185 connect( action, SIGNAL( activated() ),
1186 this, SLOT( printListView() ) ); 1186 this, SLOT( printListView() ) );
1187 1187
1188 icon = loadPixmap( pathString + "newevent" ); 1188 icon = loadPixmap( pathString + "newevent" );
1189 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1189 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1190 action->addTo( beamMenu_X ); 1190 action->addTo( beamMenu_X );
1191 connect( action, SIGNAL( activated() ), 1191 connect( action, SIGNAL( activated() ),
1192 mView, SLOT( slotprintSelInc() ) ); 1192 mView, SLOT( slotprintSelInc() ) );
1193 mPrintSelAction = action; 1193 mPrintSelAction = action;
1194 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1194 importMenu->insertItem( i18n("Print"), beamMenu_X );
1195#endif 1195#endif
1196 1196
1197 importMenu->insertSeparator(); 1197 importMenu->insertSeparator();
1198 action = new QAction( "beam all", i18n("Save"), 0, 1198 action = new QAction( "beam all", i18n("Save"), 0,
1199 this ); 1199 this );
1200 action->addTo( importMenu ); 1200 action->addTo( importMenu );
1201 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1201 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1202 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1202 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1203 this ); 1203 this );
1204 action->addTo( importMenu ); 1204 action->addTo( importMenu );
1205 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1205 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1206 1206
1207 //menuBar->insertItem( "Configure",configureMenu ); 1207 //menuBar->insertItem( "Configure",configureMenu );
1208 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1208 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1209 icon = loadPixmap( "korganizer/korganizer" ); 1209 icon = loadPixmap( "korganizer/korganizer" );
1210 1210
1211 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1211 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1212 action->addTo( helpMenu ); 1212 action->addTo( helpMenu );
1213 connect( action, SIGNAL( activated() ), 1213 connect( action, SIGNAL( activated() ),
1214 SLOT( whatsNew() ) ); 1214 SLOT( whatsNew() ) );
1215 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1215 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1216 action->addTo( helpMenu ); 1216 action->addTo( helpMenu );
1217 connect( action, SIGNAL( activated() ), 1217 connect( action, SIGNAL( activated() ),
1218 SLOT( features() ) ); 1218 SLOT( features() ) );
1219 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1219 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1220 action->addTo( helpMenu ); 1220 action->addTo( helpMenu );
1221 connect( action, SIGNAL( activated() ), 1221 connect( action, SIGNAL( activated() ),
1222 SLOT( keyBindings() ) ); 1222 SLOT( keyBindings() ) );
1223 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1223 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1224 action->addTo( helpMenu ); 1224 action->addTo( helpMenu );
1225 connect( action, SIGNAL( activated() ), 1225 connect( action, SIGNAL( activated() ),
1226 SLOT( storagehowto() ) ); 1226 SLOT( storagehowto() ) );
1227 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1227 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1228 action->addTo( helpMenu ); 1228 action->addTo( helpMenu );
1229 connect( action, SIGNAL( activated() ), 1229 connect( action, SIGNAL( activated() ),
1230 SLOT( timetrackinghowto() ) ); 1230 SLOT( timetrackinghowto() ) );
1231 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1231 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1232 action->addTo( helpMenu ); 1232 action->addTo( helpMenu );
1233 connect( action, SIGNAL( activated() ), 1233 connect( action, SIGNAL( activated() ),
1234 SLOT( synchowto() ) ); 1234 SLOT( synchowto() ) );
1235 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1235 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1236 action->addTo( helpMenu ); 1236 action->addTo( helpMenu );
1237 connect( action, SIGNAL( activated() ), 1237 connect( action, SIGNAL( activated() ),
1238 SLOT( kdesynchowto() ) ); 1238 SLOT( kdesynchowto() ) );
1239 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1239 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1240 action->addTo( helpMenu ); 1240 action->addTo( helpMenu );
1241 connect( action, SIGNAL( activated() ), 1241 connect( action, SIGNAL( activated() ),
1242 SLOT( multisynchowto() ) ); 1242 SLOT( multisynchowto() ) );
1243 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1243 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1244 action->addTo( helpMenu ); 1244 action->addTo( helpMenu );
1245 connect( action, SIGNAL( activated() ), 1245 connect( action, SIGNAL( activated() ),
1246 SLOT( aboutAutoSaving() ) ); 1246 SLOT( aboutAutoSaving() ) );
1247 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1247 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1248 action->addTo( helpMenu ); 1248 action->addTo( helpMenu );
1249 connect( action, SIGNAL( activated() ), 1249 connect( action, SIGNAL( activated() ),
1250 SLOT( aboutKnownBugs() ) ); 1250 SLOT( aboutKnownBugs() ) );
1251 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1251 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1252 action->addTo( helpMenu ); 1252 action->addTo( helpMenu );
1253 connect( action, SIGNAL( activated() ), 1253 connect( action, SIGNAL( activated() ),
1254 SLOT( usertrans() ) ); 1254 SLOT( usertrans() ) );
1255 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1255 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1256 action->addTo( helpMenu ); 1256 action->addTo( helpMenu );
1257 connect( action, SIGNAL( activated() ), 1257 connect( action, SIGNAL( activated() ),
1258 SLOT( faq() ) ); 1258 SLOT( faq() ) );
1259 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1259 action = new QAction( "licence", i18n("Licence..."), 0, this );
1260 action->addTo( helpMenu ); 1260 action->addTo( helpMenu );
1261 connect( action, SIGNAL( activated() ), 1261 connect( action, SIGNAL( activated() ),
1262 SLOT( licence() ) ); 1262 SLOT( licence() ) );
1263 action = new QAction( "about", i18n("About..."), 0, this ); 1263 action = new QAction( "about", i18n("About..."), 0, this );
1264 action->addTo( helpMenu ); 1264 action->addTo( helpMenu );
1265 connect( action, SIGNAL( activated() ), 1265 connect( action, SIGNAL( activated() ),
1266 SLOT( about() ) ); 1266 SLOT( about() ) );
1267 //menuBar->insertSeparator(); 1267 //menuBar->insertSeparator();
1268 1268
1269 // ****************************************************** 1269 // ******************************************************
1270 // menubar icons 1270 // menubar icons
1271 1271
1272 1272
1273 1273
1274 //menuBar->insertItem( iconToolBar ); 1274 //menuBar->insertItem( iconToolBar );
1275 //xdays_action 1275 //xdays_action
1276 if (p-> mShowIconNewEvent) 1276 if (p-> mShowIconNewEvent)
1277 ne_action->addTo( iconToolBar ); 1277 ne_action->addTo( iconToolBar );
1278 if (p->mShowIconNewTodo ) 1278 if (p->mShowIconNewTodo )
1279 nt_action->addTo( iconToolBar ); 1279 nt_action->addTo( iconToolBar );
1280 if (p-> mShowIconSearch) 1280 if (p-> mShowIconSearch)
1281 search_action->addTo( iconToolBar ); 1281 search_action->addTo( iconToolBar );
1282 if (p-> mShowIconWhatsThis) 1282 if (p-> mShowIconWhatsThis)
1283 QWhatsThis::whatsThisButton ( iconToolBar ); 1283 QWhatsThis::whatsThisButton ( iconToolBar );
1284 if (p-> mShowIconNext) 1284 if (p-> mShowIconNext)
1285 whatsnext_action->addTo( viewToolBar ); 1285 whatsnext_action->addTo( viewToolBar );
1286 if (p-> mShowIconNextDays) 1286 if (p-> mShowIconNextDays)
1287 xdays_action->addTo( viewToolBar ); 1287 xdays_action->addTo( viewToolBar );
1288 if (p-> mShowIconJournal) 1288 if (p-> mShowIconJournal)
1289 viewjournal_action->addTo( viewToolBar ); 1289 viewjournal_action->addTo( viewToolBar );
1290 if (p-> mShowIconDay1) 1290 if (p-> mShowIconDay1)
1291 day1_action->addTo( viewToolBar ); 1291 day1_action->addTo( viewToolBar );
1292 if (p-> mShowIconDay5) 1292 if (p-> mShowIconDay5)
1293 day5_action->addTo( viewToolBar ); 1293 day5_action->addTo( viewToolBar );
1294 if (p-> mShowIconDay7) 1294 if (p-> mShowIconDay7)
1295 day7_action->addTo( viewToolBar ); 1295 day7_action->addTo( viewToolBar );
1296 if (p-> mShowIconDay6) 1296 if (p-> mShowIconDay6)
1297 day6_action->addTo( viewToolBar ); 1297 day6_action->addTo( viewToolBar );
1298 if (p-> mShowIconMonth) 1298 if (p-> mShowIconMonth)
1299 month_action->addTo( viewToolBar ); 1299 month_action->addTo( viewToolBar );
1300 if (p-> mShowIconList) 1300 if (p-> mShowIconList)
1301 showlist_action->addTo( viewToolBar ); 1301 showlist_action->addTo( viewToolBar );
1302 if (p-> mShowIconTodoview) 1302 if (p-> mShowIconTodoview)
1303 todoview_action->addTo( viewToolBar ); 1303 todoview_action->addTo( viewToolBar );
1304 1304
1305 icon = loadPixmap( pathString + "2leftarrowB" ); 1305 icon = loadPixmap( pathString + "2leftarrowB" );
1306 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1306 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1307 if (p-> mShowIconBackFast) { 1307 if (p-> mShowIconBackFast) {
1308 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1308 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1309 connect( action, SIGNAL( activated() ), 1309 connect( action, SIGNAL( activated() ),
1310 mView, SLOT( goPreviousMonth() ) ); 1310 mView, SLOT( goPreviousMonth() ) );
1311 action->addTo( navigatorToolBar ); 1311 action->addTo( navigatorToolBar );
1312 } 1312 }
1313 icon = loadPixmap( pathString + "1leftarrowB" ); 1313 icon = loadPixmap( pathString + "1leftarrowB" );
1314 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1314 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1315 if (p-> mShowIconBack) { 1315 if (p-> mShowIconBack) {
1316 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1316 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1317 connect( action, SIGNAL( activated() ), 1317 connect( action, SIGNAL( activated() ),
1318 mView, SLOT( goPrevious() ) ); 1318 mView, SLOT( goPrevious() ) );
1319 action->addTo( navigatorToolBar ); 1319 action->addTo( navigatorToolBar );
1320 } 1320 }
1321 icon = loadPixmap( pathString + "today" ); 1321 icon = loadPixmap( pathString + "today" );
1322 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1322 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1323 if (p-> mShowIconToday) 1323 if (p-> mShowIconToday)
1324 today_action->addTo( navigatorToolBar ); 1324 today_action->addTo( navigatorToolBar );
1325 icon = loadPixmap( pathString + "1rightarrowB" ); 1325 icon = loadPixmap( pathString + "1rightarrowB" );
1326 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1326 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1327 if (p-> mShowIconForward) { 1327 if (p-> mShowIconForward) {
1328 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1328 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1329 connect( action, SIGNAL( activated() ), 1329 connect( action, SIGNAL( activated() ),
1330 mView, SLOT( goNext() ) ); 1330 mView, SLOT( goNext() ) );
1331 action->addTo( navigatorToolBar ); 1331 action->addTo( navigatorToolBar );
1332 } 1332 }
1333 icon = loadPixmap( pathString + "2rightarrowB" ); 1333 icon = loadPixmap( pathString + "2rightarrowB" );
1334 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1334 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1335 if (p-> mShowIconForwardFast) { 1335 if (p-> mShowIconForwardFast) {
1336 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1336 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1337 connect( action, SIGNAL( activated() ), 1337 connect( action, SIGNAL( activated() ),
1338 mView, SLOT( goNextMonth() ) ); 1338 mView, SLOT( goNextMonth() ) );
1339 action->addTo( navigatorToolBar ); 1339 action->addTo( navigatorToolBar );
1340 } 1340 }
1341 1341
1342 1342
1343 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1343 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1344 1344
1345 1345
1346 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1346 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1347 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1347 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1348 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1348 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1349 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1349 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1350 1350
1351 if (p-> mShowIconNewEvent) 1351 if (p-> mShowIconNewEvent)
1352 configureToolBarMenu->setItemChecked( 10, true ); 1352 configureToolBarMenu->setItemChecked( 10, true );
1353 if (p->mShowIconNewTodo ) 1353 if (p->mShowIconNewTodo )
1354 configureToolBarMenu->setItemChecked( 20, true ); 1354 configureToolBarMenu->setItemChecked( 20, true );
1355 if (p-> mShowIconSearch) 1355 if (p-> mShowIconSearch)
1356 configureToolBarMenu->setItemChecked( 120, true ); 1356 configureToolBarMenu->setItemChecked( 120, true );
1357 if (p-> mShowIconList) 1357 if (p-> mShowIconList)
1358 configureToolBarMenu->setItemChecked( 30, true ); 1358 configureToolBarMenu->setItemChecked( 30, true );
1359 if (p-> mShowIconDay1) 1359 if (p-> mShowIconDay1)
1360 configureToolBarMenu->setItemChecked( 40, true ); 1360 configureToolBarMenu->setItemChecked( 40, true );
1361 if (p-> mShowIconDay5) 1361 if (p-> mShowIconDay5)
1362 configureToolBarMenu->setItemChecked( 50, true ); 1362 configureToolBarMenu->setItemChecked( 50, true );
1363 if (p-> mShowIconDay6) 1363 if (p-> mShowIconDay6)
1364 configureToolBarMenu->setItemChecked( 75, true ); 1364 configureToolBarMenu->setItemChecked( 75, true );
1365 if (p-> mShowIconDay7) 1365 if (p-> mShowIconDay7)
1366 configureToolBarMenu->setItemChecked( 60, true ); 1366 configureToolBarMenu->setItemChecked( 60, true );
1367 if (p-> mShowIconMonth) 1367 if (p-> mShowIconMonth)
1368 configureToolBarMenu->setItemChecked( 70, true ); 1368 configureToolBarMenu->setItemChecked( 70, true );
1369 if (p-> mShowIconTodoview) 1369 if (p-> mShowIconTodoview)
1370 configureToolBarMenu->setItemChecked( 80, true ); 1370 configureToolBarMenu->setItemChecked( 80, true );
1371 if (p-> mShowIconBackFast) 1371 if (p-> mShowIconBackFast)
1372 configureToolBarMenu->setItemChecked( 200, true ); 1372 configureToolBarMenu->setItemChecked( 200, true );
1373 if (p-> mShowIconBack) 1373 if (p-> mShowIconBack)
1374 configureToolBarMenu->setItemChecked( 210, true ); 1374 configureToolBarMenu->setItemChecked( 210, true );
1375 if (p-> mShowIconToday) 1375 if (p-> mShowIconToday)
1376 configureToolBarMenu->setItemChecked( 130, true ); 1376 configureToolBarMenu->setItemChecked( 130, true );
1377 if (p-> mShowIconForward) 1377 if (p-> mShowIconForward)
1378 configureToolBarMenu->setItemChecked( 220, true ); 1378 configureToolBarMenu->setItemChecked( 220, true );
1379 if (p-> mShowIconForwardFast) 1379 if (p-> mShowIconForwardFast)
1380 configureToolBarMenu->setItemChecked( 230, true ); 1380 configureToolBarMenu->setItemChecked( 230, true );
1381 if (p-> mShowIconNextDays) 1381 if (p-> mShowIconNextDays)
1382 configureToolBarMenu->setItemChecked( 100, true ); 1382 configureToolBarMenu->setItemChecked( 100, true );
1383 if (p-> mShowIconNext) 1383 if (p-> mShowIconNext)
1384 configureToolBarMenu->setItemChecked( 110, true ); 1384 configureToolBarMenu->setItemChecked( 110, true );
1385 if (p-> mShowIconJournal) 1385 if (p-> mShowIconJournal)
1386 configureToolBarMenu->setItemChecked( 90, true ); 1386 configureToolBarMenu->setItemChecked( 90, true );
1387 if (p-> mShowIconWhatsThis) 1387 if (p-> mShowIconWhatsThis)
1388 configureToolBarMenu->setItemChecked( 300, true ); 1388 configureToolBarMenu->setItemChecked( 300, true );
1389 if (p-> mShowIconWeekNum) 1389 if (p-> mShowIconWeekNum)
1390 configureToolBarMenu->setItemChecked( 400, true ); 1390 configureToolBarMenu->setItemChecked( 400, true );
1391 if (!p-> mShowIconStretch) { 1391 if (!p-> mShowIconStretch) {
1392 QLabel* dummy = new QLabel( iconToolBar ); 1392 QLabel* dummy = new QLabel( iconToolBar );
1393 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1393 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1394 dummy->setMinimumWidth( 0 ); 1394 dummy->setMinimumWidth( 0 );
1395 iconToolBar->setStretchableWidget ( dummy ) ; 1395 iconToolBar->setStretchableWidget ( dummy ) ;
1396 } 1396 }
1397 else { 1397 else {
1398 iconToolBar->setHorizontalStretchable (true ); 1398 iconToolBar->setHorizontalStretchable (true );
1399 viewToolBar->setHorizontalStretchable (true ); 1399 viewToolBar->setHorizontalStretchable (true );
1400 navigatorToolBar->setHorizontalStretchable (true ); 1400 navigatorToolBar->setHorizontalStretchable (true );
1401 iconToolBar->setVerticalStretchable (true ); 1401 iconToolBar->setVerticalStretchable (true );
1402 viewToolBar->setVerticalStretchable (true ); 1402 viewToolBar->setVerticalStretchable (true );
1403 navigatorToolBar->setVerticalStretchable (true ); 1403 navigatorToolBar->setVerticalStretchable (true );
1404 configureToolBarMenu->setItemChecked( 5, true ); 1404 configureToolBarMenu->setItemChecked( 5, true );
1405 } 1405 }
1406 if (p-> mShowIconFilter) 1406 if (p-> mShowIconFilter)
1407 configureToolBarMenu->setItemChecked( 7, true ); 1407 configureToolBarMenu->setItemChecked( 7, true );
1408 if (p-> mShowIconOnetoolbar) 1408 if (p-> mShowIconOnetoolbar)
1409 configureToolBarMenu->setItemChecked( 6, true ); 1409 configureToolBarMenu->setItemChecked( 6, true );
1410 1410
1411 1411
1412 if ( filterMenubar ) { 1412 if ( filterMenubar ) {
1413 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1413 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1414 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1414 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1415 } 1415 }
1416 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1416 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1417 configureAgenda( p->mHourSize ); 1417 configureAgenda( p->mHourSize );
1418 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1418 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1419} 1419}
1420void MainWindow::calHint() 1420void MainWindow::calHint()
1421{ 1421{
1422 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>."); 1422 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>.");
1423 1423
1424 KMessageBox::information( this, message); 1424 KMessageBox::information( this, message);
1425} 1425}
1426void MainWindow::exportToPhone( int mode ) 1426void MainWindow::exportToPhone( int mode )
1427{ 1427{
1428 1428
1429 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1429 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1430 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1430 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1431 KOex2phonePrefs ex2phone; 1431 KOex2phonePrefs ex2phone;
1432 1432
1433 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1433 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1434 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1434 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1435 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1435 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1436 if ( mode == 1 ) 1436 if ( mode == 1 )
1437 ex2phone.setCaption(i18n("Export complete calendar")); 1437 ex2phone.setCaption(i18n("Export complete calendar"));
1438 if ( mode == 2 ) 1438 if ( mode == 2 )
1439 ex2phone.setCaption(i18n("Export filtered calendar")); 1439 ex2phone.setCaption(i18n("Export filtered calendar"));
1440 1440
1441 if ( !ex2phone.exec() ) { 1441 if ( !ex2phone.exec() ) {
1442 return; 1442 return;
1443 } 1443 }
1444 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1444 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1445 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1445 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1446 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1446 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1447 1447
1448 int inFuture = 0; 1448 int inFuture = 0;
1449 if ( ex2phone.mWriteBackFuture->isChecked() ) 1449 if ( ex2phone.mWriteBackFuture->isChecked() )
1450 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1450 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1451 QPtrList<Incidence> delSel; 1451 QPtrList<Incidence> delSel;
1452 if ( mode == 1 ) 1452 if ( mode == 1 )
1453 delSel = mCalendar->rawIncidences(); 1453 delSel = mCalendar->rawIncidences();
1454 if ( mode == 2 ) 1454 if ( mode == 2 )
1455 delSel = mCalendar->incidences(); 1455 delSel = mCalendar->incidences();
1456 CalendarLocal* cal = new CalendarLocal(); 1456 CalendarLocal* cal = new CalendarLocal();
1457 cal->setLocalTime(); 1457 cal->setLocalTime();
1458 Incidence *incidence = delSel.first(); 1458 Incidence *incidence = delSel.first();
1459 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1459 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1460 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1460 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1461 while ( incidence ) { 1461 while ( incidence ) {
1462 if ( incidence->typeID() != journalID ) { 1462 if ( incidence->typeID() != journalID ) {
1463 bool add = true; 1463 bool add = true;
1464 if ( inFuture ) { 1464 if ( inFuture ) {
1465 QDateTime dt; 1465 QDateTime dt;
1466 if ( incidence->typeID() == todoID ) { 1466 if ( incidence->typeID() == todoID ) {
1467 Todo * t = (Todo*)incidence; 1467 Todo * t = (Todo*)incidence;
1468 if ( t->hasDueDate() ) 1468 if ( t->hasDueDate() )
1469 dt = t->dtDue(); 1469 dt = t->dtDue();
1470 else 1470 else
1471 dt = cur.addSecs( 62 ); 1471 dt = cur.addSecs( 62 );
1472 } 1472 }
1473 else { 1473 else {
1474 bool ok; 1474 bool ok;
1475 dt = incidence->getNextOccurence( cur, &ok ); 1475 dt = incidence->getNextOccurence( cur, &ok );
1476 if ( !ok ) 1476 if ( !ok )
1477 dt = cur.addSecs( -62 ); 1477 dt = cur.addSecs( -62 );
1478 } 1478 }
1479 if ( dt < cur || dt > end ) { 1479 if ( dt < cur || dt > end ) {
1480 add = false; 1480 add = false;
1481 } 1481 }
1482 } 1482 }
1483 if ( add ) { 1483 if ( add ) {
1484 Incidence *in = incidence->clone(); 1484 Incidence *in = incidence->clone();
1485 cal->addIncidence( in ); 1485 cal->addIncidence( in );
1486 } 1486 }
1487 } 1487 }
1488 incidence = delSel.next(); 1488 incidence = delSel.next();
1489 } 1489 }
1490 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1490 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1491 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1491 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1492 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1492 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1493 1493
1494 setCaption( i18n("Writing to phone...")); 1494 setCaption( i18n("Writing to phone..."));
1495 if ( PhoneFormat::writeToPhone( cal ) ) 1495 if ( PhoneFormat::writeToPhone( cal ) )
1496 setCaption( i18n("Export to phone successful!")); 1496 setCaption( i18n("Export to phone successful!"));
1497 else 1497 else
1498 setCaption( i18n("Error exporting to phone!")); 1498 setCaption( i18n("Error exporting to phone!"));
1499 delete cal; 1499 delete cal;
1500} 1500}
1501 1501
1502 1502
1503void MainWindow::setDefaultPreferences() 1503void MainWindow::setDefaultPreferences()
1504{ 1504{
1505 KOPrefs *p = KOPrefs::instance(); 1505 KOPrefs *p = KOPrefs::instance();
1506 1506
1507 p->mCompactDialogs = true; 1507 p->mCompactDialogs = true;
1508 p->mConfirm = true; 1508 p->mConfirm = true;
1509 // p->mEnableQuickTodo = false; 1509 // p->mEnableQuickTodo = false;
1510 1510
1511} 1511}
1512 1512
1513QString MainWindow::resourcePath() 1513QString MainWindow::resourcePath()
1514{ 1514{
1515 return KGlobal::iconLoader()->iconPath(); 1515 return KGlobal::iconLoader()->iconPath();
1516} 1516}
1517 1517
1518void MainWindow::displayText( QString text ,QString cap ) 1518void MainWindow::displayText( QString text ,QString cap )
1519{ 1519{
1520 QDialog dia( this, "name", true ); ; 1520 QDialog dia( this, "name", true ); ;
1521 dia.setCaption( cap ); 1521 dia.setCaption( cap );
1522 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1522 QVBoxLayout* lay = new QVBoxLayout( &dia );
1523 lay->setSpacing( 3 ); 1523 lay->setSpacing( 3 );
1524 lay->setMargin( 3 ); 1524 lay->setMargin( 3 );
1525 QTextBrowser tb ( &dia ); 1525 QTextBrowser tb ( &dia );
1526 lay->addWidget( &tb ); 1526 lay->addWidget( &tb );
1527 tb.setText( text ); 1527 tb.setText( text );
1528#ifdef DESKTOP_VERSION 1528#ifdef DESKTOP_VERSION
1529 dia.resize( 640, 480); 1529 dia.resize( 640, 480);
1530#else 1530#else
1531 dia.showMaximized(); 1531 dia.showMaximized();
1532#endif 1532#endif
1533 dia.exec(); 1533 dia.exec();
1534} 1534}
1535 1535
1536void MainWindow::features() 1536void MainWindow::features()
1537{ 1537{
1538 1538
1539 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1539 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1540} 1540}
1541 1541
1542void MainWindow::usertrans() 1542void MainWindow::usertrans()
1543{ 1543{
1544 1544
1545 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1545 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1546} 1546}
1547 1547
1548void MainWindow::storagehowto() 1548void MainWindow::storagehowto()
1549{ 1549{
1550 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1550 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1551} 1551}
1552void MainWindow::timetrackinghowto() 1552void MainWindow::timetrackinghowto()
1553{ 1553{
1554 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1554 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1555} 1555}
1556void MainWindow::kdesynchowto() 1556void MainWindow::kdesynchowto()
1557{ 1557{
1558 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1558 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1559} 1559}
1560void MainWindow::multisynchowto() 1560void MainWindow::multisynchowto()
1561{ 1561{
1562 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1562 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1563} 1563}
1564void MainWindow::synchowto() 1564void MainWindow::synchowto()
1565{ 1565{
1566 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1566 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1567} 1567}
1568void MainWindow::faq() 1568void MainWindow::faq()
1569{ 1569{
1570 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1570 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1571 1571
1572} 1572}
1573void MainWindow::whatsNew() 1573void MainWindow::whatsNew()
1574{ 1574{
1575 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1575 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1576 1576
1577} 1577}
1578void MainWindow::licence() 1578void MainWindow::licence()
1579{ 1579{
1580 KApplication::showLicence(); 1580 KApplication::showLicence();
1581 1581
1582} 1582}
1583void MainWindow::about() 1583void MainWindow::about()
1584{ 1584{
1585 QString version; 1585 QString version;
1586#include <../version> 1586#include <../version>
1587 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1587 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1588 i18n("KOrganizer/Platform-independent\n") + 1588 i18n("KOrganizer/Platform-independent\n") +
1589 "(KO/Pi) " + version + " - " + 1589 "(KO/Pi) " + version + " - " +
1590 1590
1591#ifdef DESKTOP_VERSION 1591#ifdef DESKTOP_VERSION
1592 i18n("Desktop Edition\n") + 1592 i18n("Desktop Edition\n") +
1593#else 1593#else
1594 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1594 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1595#endif 1595#endif
1596 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!") ); 1596 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!") );
1597} 1597}
1598void MainWindow::keyBindings() 1598void MainWindow::keyBindings()
1599{ 1599{
1600 QString cap = i18n("KO/Pi Keys + Colors"); 1600 QString cap = i18n("KO/Pi Keys + Colors");
1601 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1601 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1602 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1602 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1603 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1603 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1604 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1604 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1605 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1605 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1606 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1606 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1607 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1607 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1608 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1608 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1609 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1609 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1610 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1610 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1611 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ 1611 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+
1612 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1612 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1613 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1613 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1614 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1614 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1615 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1615 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1616 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1616 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1617 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1617 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1618 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1618 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1619 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1619 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1620 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1620 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1621 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1621 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1622 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1622 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1623 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1623 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1624 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1624 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1625 i18n("<p><h3>In agenda view:</h3></p>\n") + 1625 i18n("<p><h3>In agenda view:</h3></p>\n") +
1626 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1626 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1627 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1627 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1628 i18n("<p><h3>In todo view:</h3></p>\n") + 1628 i18n("<p><h3>In todo view:</h3></p>\n") +
1629 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1629 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1630 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1630 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1631 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1631 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1632 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1632 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1633 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1633 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1634 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1634 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1635 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1635 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1636 i18n("<p><h3>In list view:</h3></p>\n") + 1636 i18n("<p><h3>In list view:</h3></p>\n") +
1637 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1637 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1638 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1638 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1639 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1639 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1640 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1640 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1641 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1641 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1642 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1642 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1643 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1643 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1644 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1644 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1645 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1645 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1646 i18n("<p><b>E</b>: Edit item</p>\n") + 1646 i18n("<p><b>E</b>: Edit item</p>\n") +
1647 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1647 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1648 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1648 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1649 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1649 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1650 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1650 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1651 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1651 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1652 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1652 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1653 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1653 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1654 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1654 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1655 i18n("<p><b>White</b>: Item readonly</p>\n"); 1655 i18n("<p><b>White</b>: Item readonly</p>\n");
1656 displayText( text, cap); 1656 displayText( text, cap);
1657} 1657}
1658void MainWindow::aboutAutoSaving() 1658void MainWindow::aboutAutoSaving()
1659{ 1659{
1660 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"); 1660 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");
1661 1661
1662 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1662 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1663 1663
1664} 1664}
1665void MainWindow::aboutKnownBugs() 1665void MainWindow::aboutKnownBugs()
1666{ 1666{
1667 QMessageBox* msg; 1667 QMessageBox* msg;
1668 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1668 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1669 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")+ 1669 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")+
1670 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1670 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1671 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1671 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1672 i18n("\nor report them in the bugtracker on\n") + 1672 i18n("\nor report them in the bugtracker on\n") +
1673 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1673 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1674 QMessageBox::NoIcon, 1674 QMessageBox::NoIcon,
1675 QMessageBox::Ok, 1675 QMessageBox::Ok,
1676 QMessageBox::NoButton, 1676 QMessageBox::NoButton,
1677 QMessageBox::NoButton); 1677 QMessageBox::NoButton);
1678 msg->exec(); 1678 msg->exec();
1679 delete msg; 1679 delete msg;
1680 1680
1681} 1681}
1682 1682
1683QString MainWindow::defaultFileName() 1683QString MainWindow::defaultFileName()
1684{ 1684{
1685 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1685 return locateLocal( "data", "korganizer/mycalendar.ics" );
1686} 1686}
1687QString MainWindow::syncFileName() 1687QString MainWindow::syncFileName()
1688{ 1688{
1689#ifdef DESKTOP_VERSION 1689#ifdef DESKTOP_VERSION
1690 return locateLocal( "tmp", "synccalendar.ics" ); 1690 return locateLocal( "tmp", "synccalendar.ics" );
1691#else 1691#else
1692 return QString( "/tmp/synccalendar.ics" ); 1692 return QString( "/tmp/synccalendar.ics" );
1693#endif 1693#endif
1694} 1694}
1695#include "koglobals.h" 1695#include "koglobals.h"
1696#include <kcalendarsystem.h> 1696#include <kcalendarsystem.h>
1697void MainWindow::updateWeek(QDate seda) 1697void MainWindow::updateWeek(QDate seda)
1698{ 1698{
1699 int weekNum = KGlobal::locale()->weekNum ( seda ); 1699 int weekNum = KGlobal::locale()->weekNum ( seda );
1700 mWeekPixmap.fill( mWeekBgColor ); 1700 mWeekPixmap.fill( mWeekBgColor );
1701 QPainter p ( &mWeekPixmap ); 1701 QPainter p ( &mWeekPixmap );
1702 p.setFont( mWeekFont ); 1702 p.setFont( mWeekFont );
1703 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1703 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1704 p.end(); 1704 p.end();
1705 QIconSet icon3 ( mWeekPixmap ); 1705 QIconSet icon3 ( mWeekPixmap );
1706 mWeekAction->setIconSet ( icon3 ); 1706 mWeekAction->setIconSet ( icon3 );
1707 1707
1708} 1708}
1709void MainWindow::updateWeekNum(const DateList &selectedDates) 1709void MainWindow::updateWeekNum(const DateList &selectedDates)
1710{ 1710{
1711 updateWeek( selectedDates.first() ); 1711 updateWeek( selectedDates.first() );
1712} 1712}
1713void MainWindow::processIncidenceSelection( Incidence *incidence ) 1713void MainWindow::processIncidenceSelection( Incidence *incidence )
1714{ 1714{
1715 if ( !incidence ) { 1715 if ( !incidence ) {
1716 mShowAction->setMenuText( i18n("Show") ); 1716 mShowAction->setMenuText( i18n("Show") );
1717 enableIncidenceActions( false ); 1717 enableIncidenceActions( false );
1718 mNewSubTodoAction->setEnabled( false ); 1718 mNewSubTodoAction->setEnabled( false );
1719 setCaptionToDates(); 1719 setCaptionToDates();
1720 return; 1720 return;
1721 } 1721 }
1722 QString startString = ""; 1722 QString startString = "";
1723 if ( incidence->typeID() != todoID ) { 1723 if ( incidence->typeID() != todoID ) {
1724 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1724 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1725 if ( incidence->doesFloat() ) { 1725 if ( incidence->doesFloat() ) {
1726 startString += ": "+incidence->dtStartDateStr( true ); 1726 startString += ": "+incidence->dtStartDateStr( true );
1727 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1727 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1728 } else { 1728 } else {
1729 startString = ": "+incidence->dtStartStr(true); 1729 startString = ": "+incidence->dtStartStr(true);
1730 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1730 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1731 } 1731 }
1732 } else { 1732 } else {
1733 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1733 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1734 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1734 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1735 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1735 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1736 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1736 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1737 bool ok; 1737 bool ok;
1738 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1738 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1739 if ( ok ) { 1739 if ( ok ) {
1740 int years = noc.date().year() - incidence->dtStart().date().year(); 1740 int years = noc.date().year() - incidence->dtStart().date().year();
1741 startString += i18n(" (%1 y.)"). arg( years ); 1741 startString += i18n(" (%1 y.)"). arg( years );
1742 } 1742 }
1743 } 1743 }
1744 else 1744 else
1745 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1745 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1746 } 1746 }
1747 } 1747 }
1748 else { 1748 else {
1749 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1749 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1750 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1750 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1751 else 1751 else
1752 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1752 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1753 } 1753 }
1754 if ( !incidence->location().isEmpty() ) 1754 if ( !incidence->location().isEmpty() )
1755 startString += " (" +incidence->location()+")"; 1755 startString += " (" +incidence->location()+")";
1756 setCaption( incidence->summary()+startString); 1756 setCaption( incidence->summary()+startString);
1757 enableIncidenceActions( true ); 1757 enableIncidenceActions( true );
1758 if ( incidence->typeID() == eventID ) { 1758 if ( incidence->typeID() == eventID ) {
1759 mShowAction->setMenuText( i18n("Show Event") ); 1759 mShowAction->setMenuText( i18n("Show Event") );
1760 mNewSubTodoAction->setEnabled( false ); 1760 mNewSubTodoAction->setEnabled( false );
1761 } else if ( incidence->typeID() == todoID ) { 1761 } else if ( incidence->typeID() == todoID ) {
1762 mShowAction->setMenuText( i18n("Show Todo") ); 1762 mShowAction->setMenuText( i18n("Show Todo") );
1763 mNewSubTodoAction->setEnabled( true ); 1763 mNewSubTodoAction->setEnabled( true );
1764 } else { 1764 } else {
1765 mShowAction->setMenuText( i18n("Show") ); 1765 mShowAction->setMenuText( i18n("Show") );
1766 mNewSubTodoAction->setEnabled( false ); 1766 mNewSubTodoAction->setEnabled( false );
1767 } 1767 }
1768#ifdef DESKTOP_VERSION
1768 static QPixmap jP = SmallIcon( "journal" ); 1769 static QPixmap jP = SmallIcon( "journal" );
1769 static QPixmap eP = SmallIcon( "newevent" ); 1770 static QPixmap eP = SmallIcon( "newevent" );
1770 static QPixmap tP = SmallIcon( "newtodo" ); 1771 static QPixmap tP = SmallIcon( "newtodo" );
1771#ifdef DESKTOP_VERSION
1772 QIconSet icon; 1772 QIconSet icon;
1773 if ( incidence->typeID() == todoID ) 1773 if ( incidence->typeID() == todoID )
1774 icon = QIconSet ( tP ); 1774 icon = QIconSet ( tP );
1775 else if ( incidence->typeID() == eventID ) 1775 else if ( incidence->typeID() == eventID )
1776 icon = QIconSet ( eP ); 1776 icon = QIconSet ( eP );
1777 else if ( incidence->typeID() == journalID ) 1777 else if ( incidence->typeID() == journalID )
1778 icon = QIconSet ( jP ); 1778 icon = QIconSet ( jP );
1779 mPrintSelAction->setIconSet ( icon ); 1779 mPrintSelAction->setIconSet ( icon );
1780#endif 1780#endif
1781} 1781}
1782 1782
1783void MainWindow::enableIncidenceActions( bool enabled ) 1783void MainWindow::enableIncidenceActions( bool enabled )
1784{ 1784{
1785 mShowAction->setEnabled( enabled ); 1785 mShowAction->setEnabled( enabled );
1786 mEditAction->setEnabled( enabled ); 1786 mEditAction->setEnabled( enabled );
1787 mDeleteAction->setEnabled( enabled ); 1787 mDeleteAction->setEnabled( enabled );
1788 1788
1789 mCloneAction->setEnabled( enabled ); 1789 mCloneAction->setEnabled( enabled );
1790 mMoveAction->setEnabled( enabled ); 1790 mMoveAction->setEnabled( enabled );
1791#ifndef DESKTOP_VERSION 1791#ifndef DESKTOP_VERSION
1792 mBeamAction->setEnabled( enabled ); 1792 mBeamAction->setEnabled( enabled );
1793#else 1793#else
1794 mPrintSelAction->setEnabled( enabled ); 1794 mPrintSelAction->setEnabled( enabled );
1795#endif 1795#endif
1796 mCancelAction->setEnabled( enabled ); 1796 mCancelAction->setEnabled( enabled );
1797} 1797}
1798 1798
1799void MainWindow::importOL() 1799void MainWindow::importOL()
1800{ 1800{
1801#ifdef _OL_IMPORT_ 1801#ifdef _OL_IMPORT_
1802 mView->clearAllViews(); 1802 mView->clearAllViews();
1803 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1803 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1804 id->exec(); 1804 id->exec();
1805 delete id; 1805 delete id;
1806 mView->calendar()->checkAlarmForIncidence( 0, true ); 1806 mView->calendar()->checkAlarmForIncidence( 0, true );
1807 mView->updateView(); 1807 mView->updateView();
1808#endif 1808#endif
1809} 1809}
1810void MainWindow::importBday() 1810void MainWindow::importBday()
1811{ 1811{
1812 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1812 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1813 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1813 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1814 i18n("Import!"), i18n("Cancel"), 0, 1814 i18n("Import!"), i18n("Cancel"), 0,
1815 0, 1 ); 1815 0, 1 );
1816 if ( result == 0 ) { 1816 if ( result == 0 ) {
1817 mView->importBday(); 1817 mView->importBday();
1818 1818
1819 } 1819 }
1820 1820
1821 1821
1822} 1822}
1823void MainWindow::importQtopia() 1823void MainWindow::importQtopia()
1824{ 1824{
1825 //#ifndef DESKTOP_VERSION 1825 //#ifndef DESKTOP_VERSION
1826 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"); 1826 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");
1827#ifdef DESKTOP_VERSION 1827#ifdef DESKTOP_VERSION
1828 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"); 1828 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");
1829#endif 1829#endif
1830 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1830 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1831 i18n("Import!"), i18n("Cancel"), 0, 1831 i18n("Import!"), i18n("Cancel"), 0,
1832 0, 1 ); 1832 0, 1 );
1833 if ( result == 0 ) { 1833 if ( result == 0 ) {
1834#ifndef DESKTOP_VERSION 1834#ifndef DESKTOP_VERSION
1835 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1835 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1836 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1836 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1837 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1837 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1838#else 1838#else
1839 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1839 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1840 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1840 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1841 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1841 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1842#endif 1842#endif
1843 mView->importQtopia( categories, datebook, todolist ); 1843 mView->importQtopia( categories, datebook, todolist );
1844 } 1844 }
1845 mView->calendar()->reInitAlarmSettings(); 1845 mView->calendar()->reInitAlarmSettings();
1846#if 0 1846#if 0
1847 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1847 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1848 i18n("Not supported \non desktop!\n"), 1848 i18n("Not supported \non desktop!\n"),
1849 i18n("Ok"), i18n("Cancel"), 0, 1849 i18n("Ok"), i18n("Cancel"), 0,
1850 0, 1 ); 1850 0, 1 );
1851 1851
1852#endif 1852#endif
1853} 1853}
1854 1854
1855void MainWindow::saveOnClose() 1855void MainWindow::saveOnClose()
1856{ 1856{
1857 KOPrefs *p = KOPrefs::instance(); 1857 KOPrefs *p = KOPrefs::instance();
1858 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1858 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1859 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1859 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1860 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1860 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1861 if ( filterToolBar ) { 1861 if ( filterToolBar ) {
1862 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1862 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1863 } 1863 }
1864#ifdef DESKTOP_VERSION 1864#ifdef DESKTOP_VERSION
1865 1865
1866 QPoint myP; 1866 QPoint myP;
1867 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1867 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1868 if ( p->mToolBarHor ) 1868 if ( p->mToolBarHor )
1869 p->mToolBarUp = myP.y() > height()/2; 1869 p->mToolBarUp = myP.y() > height()/2;
1870 else 1870 else
1871 p->mToolBarUp = myP.x() > width()/2; 1871 p->mToolBarUp = myP.x() > width()/2;
1872 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1872 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1873 if ( p->mToolBarHorV ) 1873 if ( p->mToolBarHorV )
1874 p->mToolBarUpV = myP.y() > height()/2; 1874 p->mToolBarUpV = myP.y() > height()/2;
1875 else 1875 else
1876 p->mToolBarUpV = myP.x() > width()/2 ; 1876 p->mToolBarUpV = myP.x() > width()/2 ;
1877 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1877 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1878 if ( p->mToolBarHorN ) 1878 if ( p->mToolBarHorN )
1879 p->mToolBarUpN = myP.y() > height()/2; 1879 p->mToolBarUpN = myP.y() > height()/2;
1880 else 1880 else
1881 p->mToolBarUpN = myP.x() > width()/2 ; 1881 p->mToolBarUpN = myP.x() > width()/2 ;
1882 if ( filterToolBar ) { 1882 if ( filterToolBar ) {
1883 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1883 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1884 if ( p->mToolBarHorF ) 1884 if ( p->mToolBarHorF )
1885 p->mToolBarUpF = myP.y() > height()/2; 1885 p->mToolBarUpF = myP.y() > height()/2;
1886 else 1886 else
1887 p->mToolBarUpF = myP.x() > width()/2 ; 1887 p->mToolBarUpF = myP.x() > width()/2 ;
1888 } 1888 }
1889#else 1889#else
1890 if ( p->mToolBarHor ) 1890 if ( p->mToolBarHor )
1891 p->mToolBarUp = iconToolBar->y() > height()/2; 1891 p->mToolBarUp = iconToolBar->y() > height()/2;
1892 else 1892 else
1893 p->mToolBarUp = iconToolBar->x() > width()/2; 1893 p->mToolBarUp = iconToolBar->x() > width()/2;
1894 if ( p->mToolBarHorV ) 1894 if ( p->mToolBarHorV )
1895 p->mToolBarUpV = viewToolBar->y() > height()/2; 1895 p->mToolBarUpV = viewToolBar->y() > height()/2;
1896 else 1896 else
1897 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1897 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1898 1898
1899 if ( p->mToolBarHorN ) 1899 if ( p->mToolBarHorN )
1900 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1900 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1901 else 1901 else
1902 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1902 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1903 if ( filterToolBar ) { 1903 if ( filterToolBar ) {
1904 if ( p->mToolBarHorF ) 1904 if ( p->mToolBarHorF )
1905 p->mToolBarUpF = filterToolBar->y() > height()/2; 1905 p->mToolBarUpF = filterToolBar->y() > height()/2;
1906 else 1906 else
1907 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1907 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1908 } 1908 }
1909#endif 1909#endif
1910 save(); 1910 save();
1911 mView->writeSettings(); 1911 mView->writeSettings();
1912 mView->checkSuspendAlarm(); 1912 mView->checkSuspendAlarm();
1913} 1913}
1914void MainWindow::slotModifiedChanged( bool ) 1914void MainWindow::slotModifiedChanged( bool )
1915{ 1915{
1916 if ( mBlockAtStartup ) 1916 if ( mBlockAtStartup )
1917 return; 1917 return;
1918 1918
1919 int msec; 1919 int msec;
1920 if ( mCalendarModifiedFlag ) { 1920 if ( mCalendarModifiedFlag ) {
1921 //qDebug(" MainWindow timer is running "); 1921 //qDebug(" MainWindow timer is running ");
1922 return; 1922 return;
1923 } 1923 }
1924 // we store the changes after 1 minute, 1924 // we store the changes after 1 minute,
1925 // and for safety reasons after 10 minutes again 1925 // and for safety reasons after 10 minutes again
1926 if ( !mSyncManager->blockSave() ) 1926 if ( !mSyncManager->blockSave() )
1927 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1927 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1928 else 1928 else
1929 msec = 1000 * 600; 1929 msec = 1000 * 600;
1930 mSaveTimer.start( msec, true ); // 1 minute 1930 mSaveTimer.start( msec, true ); // 1 minute
1931 qDebug("KO: Saving File in %d secs!", msec/1000); 1931 qDebug("KO: Saving File in %d secs!", msec/1000);
1932 mCalendarModifiedFlag = true; 1932 mCalendarModifiedFlag = true;
1933} 1933}
1934void MainWindow::saveStopTimer() 1934void MainWindow::saveStopTimer()
1935{ 1935{
1936 mSaveTimer.stop(); 1936 mSaveTimer.stop();
1937} 1937}
1938void MainWindow::backupAllFiles() 1938void MainWindow::backupAllFiles()
1939{ 1939{
1940 QDate reference ( 2000,1,1); 1940 QDate reference ( 2000,1,1);
1941 int daysTo = reference.daysTo ( QDate::currentDate() ); 1941 int daysTo = reference.daysTo ( QDate::currentDate() );
1942 setCaption(i18n("Creating backup ... please wait ..." )); 1942 setCaption(i18n("Creating backup ... please wait ..." ));
1943 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1943 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1944 // we need the file path, the backup dir and the number of bups as param 1944 // we need the file path, the backup dir and the number of bups as param
1945 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1945 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1946 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1946 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1947 bupDir = KGlobalSettings::backupDataDir(); 1947 bupDir = KGlobalSettings::backupDataDir();
1948 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1948 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1949 if ( retval == 0 ) { 1949 if ( retval == 0 ) {
1950 setCaption(i18n("Backup cancelled" )); 1950 setCaption(i18n("Backup cancelled" ));
1951 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1951 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1952 // retval == 0 : backup skipped for today, try again tomorrow 1952 // retval == 0 : backup skipped for today, try again tomorrow
1953 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1953 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1954 } else if ( retval == 1 ){ 1954 } else if ( retval == 1 ){
1955 qDebug("KO: Backup created."); 1955 qDebug("KO: Backup created.");
1956 // backup ok 1956 // backup ok
1957 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1957 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1958 KopiCalendarFile * cal = calendars.first(); 1958 KopiCalendarFile * cal = calendars.first();
1959 cal = calendars.next(); 1959 cal = calendars.next();
1960 while ( cal ) { 1960 while ( cal ) {
1961 if ( !cal->mErrorOnLoad ) { 1961 if ( !cal->mErrorOnLoad ) {
1962 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1962 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1963 } 1963 }
1964 cal = calendars.next(); 1964 cal = calendars.next();
1965 } 1965 }
1966 KOPrefs::instance()->mLastBackupDate = daysTo; 1966 KOPrefs::instance()->mLastBackupDate = daysTo;
1967 setCaption(i18n("Backup succesfully finished" )); 1967 setCaption(i18n("Backup succesfully finished" ));
1968 } else if ( retval == 2 ){ 1968 } else if ( retval == 2 ){
1969 setCaption(i18n("Backup globally disabled" )); 1969 setCaption(i18n("Backup globally disabled" ));
1970 qDebug("KO: Backup globally cancelled."); 1970 qDebug("KO: Backup globally cancelled.");
1971 // backup globally cancelled 1971 // backup globally cancelled
1972 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1972 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1973 } 1973 }
1974 // retval == 3: do nothing, try again later 1974 // retval == 3: do nothing, try again later
1975} 1975}
1976void MainWindow::save() 1976void MainWindow::save()
1977{ 1977{
1978 1978
1979 if ( mView->viewManager()->journalView() ) 1979 if ( mView->viewManager()->journalView() )
1980 mView->viewManager()->journalView()->checkModified(); 1980 mView->viewManager()->journalView()->checkModified();
1981 if ( !mCalendarModifiedFlag ) { 1981 if ( !mCalendarModifiedFlag ) {
1982 qDebug("KO: Calendar not modified. Nothing saved."); 1982 qDebug("KO: Calendar not modified. Nothing saved.");
1983 return; 1983 return;
1984 } 1984 }
1985 if ( mSyncManager->blockSave() ) { 1985 if ( mSyncManager->blockSave() ) {
1986 return; 1986 return;
1987 } 1987 }
1988 mSyncManager->setBlockSave(true); 1988 mSyncManager->setBlockSave(true);
1989 if ( mView->checkAllFileVersions() ) { 1989 if ( mView->checkAllFileVersions() ) {
1990 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1990 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1991 QDate reference ( 2000,1,1); 1991 QDate reference ( 2000,1,1);
1992 int daysTo = reference.daysTo ( QDate::currentDate() ); 1992 int daysTo = reference.daysTo ( QDate::currentDate() );
1993 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1993 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1994 backupAllFiles(); 1994 backupAllFiles();
1995 } 1995 }
1996 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1996 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1997 } 1997 }
1998 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1998 QTime neededSaveTime = QDateTime::currentDateTime().time();
1999 if ( !isMinimized () ) 1999 if ( !isMinimized () )
2000 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 2000 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
2001 qDebug("KO: Start saving data to file!"); 2001 qDebug("KO: Start saving data to file!");
2002 mView->saveCalendars(); 2002 mView->saveCalendars();
2003 mCalendarModifiedFlag = false; 2003 mCalendarModifiedFlag = false;
2004 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 2004 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
2005 qDebug("KO: Needed %d ms for saving.",msNeeded ); 2005 qDebug("KO: Needed %d ms for saving.",msNeeded );
2006 QString savemes; 2006 QString savemes;
2007 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2007 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2008 if ( !isMinimized () ) 2008 if ( !isMinimized () )
2009 setCaption(savemes); 2009 setCaption(savemes);
2010 else 2010 else
2011 qDebug(savemes); 2011 qDebug(savemes);
2012 } else { 2012 } else {
2013 setCaption(i18n("Saving cancelled!")); 2013 setCaption(i18n("Saving cancelled!"));
2014 mCalendarModifiedFlag = false; 2014 mCalendarModifiedFlag = false;
2015 slotModifiedChanged( true ); 2015 slotModifiedChanged( true );
2016 } 2016 }
2017 mSyncManager->setBlockSave( false ); 2017 mSyncManager->setBlockSave( false );
2018} 2018}
2019 2019
2020void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2020void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2021{ 2021{
2022 if ( !e->isAutoRepeat() ) { 2022 if ( !e->isAutoRepeat() ) {
2023 mFlagKeyPressed = false; 2023 mFlagKeyPressed = false;
2024 } 2024 }
2025} 2025}
2026void MainWindow::keyPressEvent ( QKeyEvent * e ) 2026void MainWindow::keyPressEvent ( QKeyEvent * e )
2027{ 2027{
2028 qApp->processEvents(); 2028 qApp->processEvents();
2029 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2029 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2030 e->ignore(); 2030 e->ignore();
2031 // qDebug(" ignore %d",e->isAutoRepeat() ); 2031 // qDebug(" ignore %d",e->isAutoRepeat() );
2032 return; 2032 return;
2033 } 2033 }
2034 if (! e->isAutoRepeat() ) 2034 if (! e->isAutoRepeat() )
2035 mFlagKeyPressed = true; 2035 mFlagKeyPressed = true;
2036 KOPrefs *p = KOPrefs::instance(); 2036 KOPrefs *p = KOPrefs::instance();
2037 bool showSelectedDates = false; 2037 bool showSelectedDates = false;
2038 int size; 2038 int size;
2039 int pro = 0; 2039 int pro = 0;
2040 //qDebug("MainWindow::keyPressEvent "); 2040 //qDebug("MainWindow::keyPressEvent ");
2041 switch ( e->key() ) { 2041 switch ( e->key() ) {
2042 case Qt::Key_Right: 2042 case Qt::Key_Right:
2043 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2043 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2044 mView->goNextMonth(); 2044 mView->goNextMonth();
2045 else 2045 else
2046 mView->goNext(); 2046 mView->goNext();
2047 showSelectedDates = true; 2047 showSelectedDates = true;
2048 break; 2048 break;
2049 case Qt::Key_Left: 2049 case Qt::Key_Left:
2050 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2050 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2051 mView->goPreviousMonth(); 2051 mView->goPreviousMonth();
2052 else 2052 else
2053 mView->goPrevious(); 2053 mView->goPrevious();
2054 showSelectedDates = true; 2054 showSelectedDates = true;
2055 break; 2055 break;
2056 case Qt::Key_Down: 2056 case Qt::Key_Down:
2057 mView->viewManager()->agendaView()->scrollOneHourDown(); 2057 mView->viewManager()->agendaView()->scrollOneHourDown();
2058 break; 2058 break;
2059 case Qt::Key_Up: 2059 case Qt::Key_Up:
2060 mView->viewManager()->agendaView()->scrollOneHourUp(); 2060 mView->viewManager()->agendaView()->scrollOneHourUp();
2061 break; 2061 break;
2062 case Qt::Key_K: 2062 case Qt::Key_K:
2063 mView->viewManager()->showMonthViewWeek(); 2063 mView->viewManager()->showMonthViewWeek();
2064 break; 2064 break;
2065 case Qt::Key_I: 2065 case Qt::Key_I:
2066 mView->showIncidence(); 2066 mView->showIncidence();
2067 break; 2067 break;
2068 case Qt::Key_Delete: 2068 case Qt::Key_Delete:
2069 case Qt::Key_Backspace: 2069 case Qt::Key_Backspace:
2070 mView->deleteIncidence(); 2070 mView->deleteIncidence();
2071 break; 2071 break;
2072 case Qt::Key_D: 2072 case Qt::Key_D:
2073 mView->viewManager()->showDayView(); 2073 mView->viewManager()->showDayView();
2074 showSelectedDates = true; 2074 showSelectedDates = true;
2075 break; 2075 break;
2076 case Qt::Key_O: 2076 case Qt::Key_O:
2077 mView->toggleFilerEnabled( ); 2077 mView->toggleFilerEnabled( );
2078 break; 2078 break;
2079 case Qt::Key_0: 2079 case Qt::Key_0:
2080 case Qt::Key_1: 2080 case Qt::Key_1:
2081 case Qt::Key_2: 2081 case Qt::Key_2:
2082 case Qt::Key_3: 2082 case Qt::Key_3:
2083 case Qt::Key_4: 2083 case Qt::Key_4:
2084 case Qt::Key_5: 2084 case Qt::Key_5:
2085 case Qt::Key_6: 2085 case Qt::Key_6:
2086 case Qt::Key_7: 2086 case Qt::Key_7:
2087 case Qt::Key_8: 2087 case Qt::Key_8:
2088 case Qt::Key_9: 2088 case Qt::Key_9:
2089 pro = e->key()-48; 2089 pro = e->key()-48;
2090 if ( pro == 0 ) 2090 if ( pro == 0 )
2091 pro = 10; 2091 pro = 10;
2092 if ( e->state() == Qt::ControlButton) 2092 if ( e->state() == Qt::ControlButton)
2093 pro += 10; 2093 pro += 10;
2094 break; 2094 break;
2095 case Qt::Key_M: 2095 case Qt::Key_M:
2096 mView->viewManager()->showMonthView(); 2096 mView->viewManager()->showMonthView();
2097 showSelectedDates = true; 2097 showSelectedDates = true;
2098 break; 2098 break;
2099 case Qt::Key_Insert: 2099 case Qt::Key_Insert:
2100 mView->newEvent(); 2100 mView->newEvent();
2101 break; 2101 break;
2102 case Qt::Key_S : 2102 case Qt::Key_S :
2103 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2103 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2104 mView->newSubTodo(); 2104 mView->newSubTodo();
2105 else 2105 else
2106 mView->dialogManager()->showSearchDialog(); 2106 mView->dialogManager()->showSearchDialog();
2107 break; 2107 break;
2108 case Qt::Key_Y : 2108 case Qt::Key_Y :
2109 case Qt::Key_Z : 2109 case Qt::Key_Z :
2110 mView->viewManager()->showWorkWeekView(); 2110 mView->viewManager()->showWorkWeekView();
2111 showSelectedDates = true; 2111 showSelectedDates = true;
2112 break; 2112 break;
2113 case Qt::Key_U : 2113 case Qt::Key_U :
2114 mView->viewManager()->showWeekView(); 2114 mView->viewManager()->showWeekView();
2115 showSelectedDates = true; 2115 showSelectedDates = true;
2116 break; 2116 break;
2117 case Qt::Key_H : 2117 case Qt::Key_H :
2118 keyBindings(); 2118 keyBindings();
2119 break; 2119 break;
2120 case Qt::Key_W: 2120 case Qt::Key_W:
2121 mView->viewManager()->showWhatsNextView(); 2121 mView->viewManager()->showWhatsNextView();
2122 break; 2122 break;
2123 case Qt::Key_L: 2123 case Qt::Key_L:
2124 mView->viewManager()->showListView(); 2124 mView->viewManager()->showListView();
2125 break; 2125 break;
2126 case Qt::Key_N: 2126 case Qt::Key_N:
2127 mView->viewManager()->showNextView(); 2127 mView->viewManager()->showNextView();
2128 break; 2128 break;
2129 case Qt::Key_V: 2129 case Qt::Key_V:
2130 mView->viewManager()->showTodoView(); 2130 mView->viewManager()->showTodoView();
2131 break; 2131 break;
2132 case Qt::Key_C: 2132 case Qt::Key_C:
2133 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2133 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2134 break; 2134 break;
2135 case Qt::Key_P: 2135 case Qt::Key_P:
2136 mView->showDatePicker( ); 2136 mView->showDatePicker( );
2137 break; 2137 break;
2138 case Qt::Key_F: 2138 case Qt::Key_F:
2139 mView->editFilters(); 2139 mView->editFilters();
2140 break; 2140 break;
2141 case Qt::Key_R: 2141 case Qt::Key_R:
2142 mView->toggleFilter(); 2142 mView->toggleFilter();
2143 break; 2143 break;
2144 case Qt::Key_X: 2144 case Qt::Key_X:
2145 if ( e->state() == Qt::ControlButton ) 2145 if ( e->state() == Qt::ControlButton )
2146 mView->toggleDateNavigatorWidget(); 2146 mView->toggleDateNavigatorWidget();
2147 else { 2147 else {
2148 mView->viewManager()->showNextXView(); 2148 mView->viewManager()->showNextXView();
2149 showSelectedDates = true; 2149 showSelectedDates = true;
2150 } 2150 }
2151 break; 2151 break;
2152 case Qt::Key_Space: 2152 case Qt::Key_Space:
2153 mView->toggleExpand(); 2153 mView->toggleExpand();
2154 break; 2154 break;
2155 case Qt::Key_A: 2155 case Qt::Key_A:
2156 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2156 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2157 mView->showNextAlarms(); 2157 mView->showNextAlarms();
2158 else 2158 else
2159 mView->toggleAllDaySize(); 2159 mView->toggleAllDaySize();
2160 break; 2160 break;
2161 case Qt::Key_T: 2161 case Qt::Key_T:
2162 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2162 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2163 mView->newTodo(); 2163 mView->newTodo();
2164 else { 2164 else {
2165 mView->goToday(); 2165 mView->goToday();
2166 showSelectedDates = true; 2166 showSelectedDates = true;
2167 } 2167 }
2168 break; 2168 break;
2169 case Qt::Key_Q: 2169 case Qt::Key_Q:
2170 if ( e->state() == Qt::ControlButton ) 2170 if ( e->state() == Qt::ControlButton )
2171 mView->conflictNotAll(); 2171 mView->conflictNotAll();
2172 else if ( e->state() == Qt::ShiftButton ) 2172 else if ( e->state() == Qt::ShiftButton )
2173 mView->conflictAllday(); 2173 mView->conflictAllday();
2174 else 2174 else
2175 mView->conflictAll(); 2175 mView->conflictAll();
2176 break; 2176 break;
2177 case Qt::Key_J: 2177 case Qt::Key_J:
2178 mView->viewManager()->showJournalView(); 2178 mView->viewManager()->showJournalView();
2179 break; 2179 break;
2180 case Qt::Key_B: 2180 case Qt::Key_B:
2181 mView->editIncidenceDescription();; 2181 mView->editIncidenceDescription();;
2182 break; 2182 break;
2183 // case Qt::Key_Return: 2183 // case Qt::Key_Return:
2184 case Qt::Key_E: 2184 case Qt::Key_E:
2185 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2185 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2186 mView->newEvent(); 2186 mView->newEvent();
2187 else 2187 else
2188 mView->editIncidence(); 2188 mView->editIncidence();
2189 break; 2189 break;
2190 case Qt::Key_Plus: 2190 case Qt::Key_Plus:
2191 size = p->mHourSize +2; 2191 size = p->mHourSize +2;
2192 if ( size <= 22 ) 2192 if ( size <= 22 )
2193 configureAgenda( size ); 2193 configureAgenda( size );
2194 break; 2194 break;
2195 case Qt::Key_Minus: 2195 case Qt::Key_Minus:
2196 size = p->mHourSize - 2; 2196 size = p->mHourSize - 2;
2197 if ( size >= 4 ) 2197 if ( size >= 4 )
2198 configureAgenda( size ); 2198 configureAgenda( size );
2199 break; 2199 break;
2200 2200
2201 2201
2202 default: 2202 default:
2203 e->ignore(); 2203 e->ignore();
2204 } 2204 }
2205 if ( pro > 0 ) { 2205 if ( pro > 0 ) {
2206 selectFilter( pro+1 ); 2206 selectFilter( pro+1 );
2207 } 2207 }
2208 if ( showSelectedDates ) { 2208 if ( showSelectedDates ) {
2209 ;// setCaptionToDates(); 2209 ;// setCaptionToDates();
2210 } 2210 }
2211 2211
2212} 2212}
2213void MainWindow::fillFilterMenuTB() 2213void MainWindow::fillFilterMenuTB()
2214{ 2214{
2215 selectFilterMenuTB->clear(); 2215 selectFilterMenuTB->clear();
2216 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2216 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2217 selectFilterMenuTB->insertSeparator(); 2217 selectFilterMenuTB->insertSeparator();
2218 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2218 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2219 2219
2220 selectFilterMenuTB->insertSeparator(); 2220 selectFilterMenuTB->insertSeparator();
2221 QPtrList<CalFilter> fili = mView->filters(); 2221 QPtrList<CalFilter> fili = mView->filters();
2222 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2222 CalFilter *curfilter = mView->filterView()->selectedFilter();
2223 CalFilter *filter = fili.first(); 2223 CalFilter *filter = fili.first();
2224 int iii = 2; 2224 int iii = 2;
2225 bool checkitem = mView->filterView()->filtersEnabled(); 2225 bool checkitem = mView->filterView()->filtersEnabled();
2226 while(filter) { 2226 while(filter) {
2227 selectFilterMenuTB->insertItem( filter->name(), iii ); 2227 selectFilterMenuTB->insertItem( filter->name(), iii );
2228 if ( filter == curfilter) 2228 if ( filter == curfilter)
2229 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2229 selectFilterMenuTB->setItemChecked( iii, checkitem );
2230 filter = fili.next(); 2230 filter = fili.next();
2231 ++iii; 2231 ++iii;
2232 } 2232 }
2233 if ( !checkitem ) 2233 if ( !checkitem )
2234 selectFilterMenuTB->setItemChecked( 1, true ); 2234 selectFilterMenuTB->setItemChecked( 1, true );
2235 2235
2236 int x = 0; 2236 int x = 0;
2237 int y = iconToolBar->height(); 2237 int y = iconToolBar->height();
2238 int dX = 0; 2238 int dX = 0;
2239 int dY = 0; 2239 int dY = 0;
2240 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2240 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2241 if ( iconToolBar->y() > height()/2 ) { 2241 if ( iconToolBar->y() > height()/2 ) {
2242 dY = selectFilterMenuTB->sizeHint().height()+8; 2242 dY = selectFilterMenuTB->sizeHint().height()+8;
2243 y = 0; 2243 y = 0;
2244 } 2244 }
2245 } else { 2245 } else {
2246 if ( iconToolBar->x() > width()/2 ) { // right side 2246 if ( iconToolBar->x() > width()/2 ) { // right side
2247 x=0; 2247 x=0;
2248 dX= selectFilterMenuTB->sizeHint().width()+8; 2248 dX= selectFilterMenuTB->sizeHint().width()+8;
2249 y = 0; 2249 y = 0;
2250 } else { 2250 } else {
2251 x= iconToolBar->width(); 2251 x= iconToolBar->width();
2252 y = 0; 2252 y = 0;
2253 } 2253 }
2254 } 2254 }
2255 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2255 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2256 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2256 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2257} 2257}
2258void MainWindow::fillFilterMenu() 2258void MainWindow::fillFilterMenu()
2259{ 2259{
2260 selectFilterMenu->clear(); 2260 selectFilterMenu->clear();
2261 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2261 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2262 selectFilterMenu->insertSeparator(); 2262 selectFilterMenu->insertSeparator();
2263 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2263 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2264 2264
2265 selectFilterMenu->insertSeparator(); 2265 selectFilterMenu->insertSeparator();
2266 QPtrList<CalFilter> fili = mView->filters(); 2266 QPtrList<CalFilter> fili = mView->filters();
2267 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2267 CalFilter *curfilter = mView->filterView()->selectedFilter();
2268 CalFilter *filter = fili.first(); 2268 CalFilter *filter = fili.first();
2269 int iii = 2; 2269 int iii = 2;
2270 bool checkitem = mView->filterView()->filtersEnabled(); 2270 bool checkitem = mView->filterView()->filtersEnabled();
2271 while(filter) { 2271 while(filter) {
2272 selectFilterMenu->insertItem( filter->name(), iii ); 2272 selectFilterMenu->insertItem( filter->name(), iii );
2273 if ( filter == curfilter) 2273 if ( filter == curfilter)
2274 selectFilterMenu->setItemChecked( iii, checkitem ); 2274 selectFilterMenu->setItemChecked( iii, checkitem );
2275 filter = fili.next(); 2275 filter = fili.next();
2276 ++iii; 2276 ++iii;
2277 } 2277 }
2278 if ( !checkitem ) 2278 if ( !checkitem )
2279 selectFilterMenu->setItemChecked( 1, true ); 2279 selectFilterMenu->setItemChecked( 1, true );
2280} 2280}
2281void MainWindow::fillFilterMenuPopup() 2281void MainWindow::fillFilterMenuPopup()
2282{ 2282{
2283 filterPopupMenu->clear(); 2283 filterPopupMenu->clear();
2284 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2284 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2285 2285
2286 filterPopupMenu->insertSeparator(); 2286 filterPopupMenu->insertSeparator();
2287 QPtrList<CalFilter> fili = mView->filters(); 2287 QPtrList<CalFilter> fili = mView->filters();
2288 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2288 CalFilter *curfilter = mView->filterView()->selectedFilter();
2289 CalFilter *filter = fili.first(); 2289 CalFilter *filter = fili.first();
2290 int iii = 1; 2290 int iii = 1;
2291 bool checkitem = mView->filterView()->filtersEnabled(); 2291 bool checkitem = mView->filterView()->filtersEnabled();
2292 while(filter) { 2292 while(filter) {
2293 filterPopupMenu->insertItem( filter->name(), iii ); 2293 filterPopupMenu->insertItem( filter->name(), iii );
2294 if ( filter == curfilter) 2294 if ( filter == curfilter)
2295 filterPopupMenu->setItemChecked( iii, checkitem ); 2295 filterPopupMenu->setItemChecked( iii, checkitem );
2296 filter = fili.next(); 2296 filter = fili.next();
2297 ++iii; 2297 ++iii;
2298 } 2298 }
2299 if ( !checkitem ) 2299 if ( !checkitem )
2300 filterPopupMenu->setItemChecked( 0, true ); 2300 filterPopupMenu->setItemChecked( 0, true );
2301} 2301}
2302void MainWindow::selectFilter( int fil ) 2302void MainWindow::selectFilter( int fil )
2303{ 2303{
2304 2304
2305 if ( fil == 0 ) { 2305 if ( fil == 0 ) {
2306 mView->editFilters( ); 2306 mView->editFilters( );
2307 } else if ( fil == 1 ){ 2307 } else if ( fil == 1 ){
2308 if ( mView->filterView()->filtersEnabled() ) 2308 if ( mView->filterView()->filtersEnabled() )
2309 mView->toggleFilerEnabled( ); 2309 mView->toggleFilerEnabled( );
2310 } else { 2310 } else {
2311 if ( !mView->filterView()->filtersEnabled() ) { 2311 if ( !mView->filterView()->filtersEnabled() ) {
2312 mView->filterView()->blockSignals( true ); 2312 mView->filterView()->blockSignals( true );
2313 mView->toggleFilerEnabled( ); 2313 mView->toggleFilerEnabled( );
2314 mView->filterView()->blockSignals( false ); 2314 mView->filterView()->blockSignals( false );
2315 } 2315 }
2316 mView->selectFilter( fil-2 ); 2316 mView->selectFilter( fil-2 );
2317 } 2317 }
2318} 2318}
2319void MainWindow::updateFilterToolbar() 2319void MainWindow::updateFilterToolbar()
2320{ 2320{
2321 if ( filterMenubar ) { 2321 if ( filterMenubar ) {
2322 if ( !mView->filterView()->filtersEnabled() ) { 2322 if ( !mView->filterView()->filtersEnabled() ) {
2323 filterMenubar->changeItem( 0, i18n("No Filter") ); 2323 filterMenubar->changeItem( 0, i18n("No Filter") );
2324 } else { 2324 } else {
2325 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2325 CalFilter *curfilter = mView->filterView()->selectedFilter();
2326 if ( curfilter ) { 2326 if ( curfilter ) {
2327 filterMenubar->changeItem( 0, curfilter->name() ); 2327 filterMenubar->changeItem( 0, curfilter->name() );
2328 } 2328 }
2329 } 2329 }
2330 } 2330 }
2331} 2331}
2332void MainWindow::selectFilterPopup( int fil ) 2332void MainWindow::selectFilterPopup( int fil )
2333{ 2333{
2334 selectFilter( fil + 1 ); 2334 selectFilter( fil + 1 );
2335 2335
2336} 2336}
2337void MainWindow::configureToolBar( int item ) 2337void MainWindow::configureToolBar( int item )
2338{ 2338{
2339 2339
2340 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2340 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2341 KOPrefs *p = KOPrefs::instance(); 2341 KOPrefs *p = KOPrefs::instance();
2342 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2342 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2343 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2343 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2344 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2344 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2345 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2345 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2346 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2346 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2347 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2347 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2348 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2348 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2349 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2349 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2350 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2350 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2351 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2351 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2352 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2352 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2353 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2353 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2354 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2354 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2355 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2355 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2356 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2356 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2357 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2357 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2358 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2358 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2359 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2359 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2360 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2360 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2361 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2361 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2362 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2362 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2363 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2363 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2364 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2364 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2365 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2365 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2366 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2366 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2367 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2367 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2368 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2368 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2369 // initActions(); 2369 // initActions();
2370 setCaption ( i18n("Toolbar changes needs a restart!") ); 2370 setCaption ( i18n("Toolbar changes needs a restart!") );
2371} 2371}
2372void MainWindow::setCaption ( const QString & c ) 2372void MainWindow::setCaption ( const QString & c )
2373{ 2373{
2374 QString cap = c; 2374 QString cap = c;
2375 cap.replace( QRegExp("\n"), " " ); 2375 cap.replace( QRegExp("\n"), " " );
2376 cap = cap.stripWhiteSpace(); 2376 cap = cap.stripWhiteSpace();
2377 if ( cap.isEmpty() ) 2377 if ( cap.isEmpty() )
2378 cap = "KO/Pi"; 2378 cap = "KO/Pi";
2379 QWidget::setCaption( cap ); 2379 QWidget::setCaption( cap );
2380} 2380}
2381void MainWindow::setCaptionToDates() 2381void MainWindow::setCaptionToDates()
2382{ 2382{
2383 QString selDates; 2383 QString selDates;
2384 QDate date = mView->startDate(); 2384 QDate date = mView->startDate();
2385 if ( ! date.isValid() ) { 2385 if ( ! date.isValid() ) {
2386 setCaption(""); 2386 setCaption("");
2387 return; 2387 return;
2388 } 2388 }
2389 selDates = KGlobal::locale()->formatDate( date, true); 2389 selDates = KGlobal::locale()->formatDate( date, true);
2390 if (mView->startDate() < mView->endDate() ) 2390 if (mView->startDate() < mView->endDate() )
2391 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2391 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2392 else { 2392 else {
2393 QString addString; 2393 QString addString;
2394 if ( date == QDateTime::currentDateTime().date() ) 2394 if ( date == QDateTime::currentDateTime().date() )
2395 addString = i18n("Today"); 2395 addString = i18n("Today");
2396 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2396 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2397 addString = i18n("Tomorrow"); 2397 addString = i18n("Tomorrow");
2398 if ( !addString.isEmpty() ) 2398 if ( !addString.isEmpty() )
2399 selDates = addString+", "+selDates ; 2399 selDates = addString+", "+selDates ;
2400 } 2400 }
2401 setCaption( i18n("Dates: ") + selDates ); 2401 setCaption( i18n("Dates: ") + selDates );
2402 2402
2403} 2403}
2404void MainWindow::showConfigureAgenda( ) 2404void MainWindow::showConfigureAgenda( )
2405{ 2405{
2406 int iii; 2406 int iii;
2407 for ( iii = 1;iii<= 10 ;++iii ){ 2407 for ( iii = 1;iii<= 10 ;++iii ){
2408 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2408 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2409 } 2409 }
2410 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2410 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2411} 2411}
2412void MainWindow::configureAgenda( int item ) 2412void MainWindow::configureAgenda( int item )
2413{ 2413{
2414 if ( KOPrefs::instance()->mHourSize == item ) 2414 if ( KOPrefs::instance()->mHourSize == item )
2415 return; 2415 return;
2416 KOPrefs::instance()->mHourSize=item; 2416 KOPrefs::instance()->mHourSize=item;
2417 mView->viewManager()->agendaView()->updateConfig(); 2417 mView->viewManager()->agendaView()->updateConfig();
2418} 2418}
2419 2419
2420void MainWindow::saveCalendar() 2420void MainWindow::saveCalendar()
2421{ 2421{
2422 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2422 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2423 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2423 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2424 bupDir = KGlobalSettings::backupDataDir(); 2424 bupDir = KGlobalSettings::backupDataDir();
2425 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2425 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2426 QString bupHint; 2426 QString bupHint;
2427 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2427 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2428 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2428 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2429 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; 2429 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;
2430 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2430 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2431 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2431 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2432 save(); 2432 save();
2433 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2433 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2434 backupAllFiles(); 2434 backupAllFiles();
2435} 2435}
2436void MainWindow::loadCalendar() 2436void MainWindow::loadCalendar()
2437{ 2437{
2438 2438
2439 2439
2440#if 0 2440#if 0
2441 QString fn = KOPrefs::instance()->mLastLoadFile; 2441 QString fn = KOPrefs::instance()->mLastLoadFile;
2442 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2442 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2443 2443
2444 if ( fn == "" ) 2444 if ( fn == "" )
2445 return; 2445 return;
2446 QFileInfo info; 2446 QFileInfo info;
2447 info.setFile( fn ); 2447 info.setFile( fn );
2448 QString mess; 2448 QString mess;
2449 bool loadbup = true; 2449 bool loadbup = true;
2450 if ( info. exists() ) { 2450 if ( info. exists() ) {
2451 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2451 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2452 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2452 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2453 mess, 2453 mess,
2454 i18n("Load!"), i18n("Cancel"), 0, 2454 i18n("Load!"), i18n("Cancel"), 0,
2455 0, 1 ); 2455 0, 1 );
2456 if ( result != 0 ) { 2456 if ( result != 0 ) {
2457 loadbup = false; 2457 loadbup = false;
2458 } 2458 }
2459 } else { 2459 } else {
2460 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2460 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2461 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2461 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2462 0, 1 ); 2462 0, 1 );
2463 2463
2464 return; 2464 return;
2465 } 2465 }
2466 if ( loadbup ) { 2466 if ( loadbup ) {
2467 mView->openCalendar( fn ); 2467 mView->openCalendar( fn );
2468 KOPrefs::instance()->mLastLoadFile = fn; 2468 KOPrefs::instance()->mLastLoadFile = fn;
2469 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2469 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2470 setCaption(mess); 2470 setCaption(mess);
2471 } 2471 }
2472#endif 2472#endif
2473 2473
2474} 2474}
2475void MainWindow::quickImportIcal() 2475void MainWindow::quickImportIcal()
2476{ 2476{
2477 importFile( KOPrefs::instance()->mLastImportFile, false ); 2477 importFile( KOPrefs::instance()->mLastImportFile, false );
2478} 2478}
2479void MainWindow::importFile( QString fn, bool quick ) 2479void MainWindow::importFile( QString fn, bool quick )
2480{ 2480{
2481 QFileInfo info; 2481 QFileInfo info;
2482 info.setFile( fn ); 2482 info.setFile( fn );
2483 QString mess; 2483 QString mess;
2484 if ( !info. exists() ) { 2484 if ( !info. exists() ) {
2485 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2485 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2486 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2486 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2487 mess ); 2487 mess );
2488 return; 2488 return;
2489 } 2489 }
2490 int result = 0; 2490 int result = 0;
2491 if ( !quick ) { 2491 if ( !quick ) {
2492 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 )); 2492 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 ));
2493 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2493 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2494 mess, 2494 mess,
2495 "Import", "Cancel", 0, 2495 "Import", "Cancel", 0,
2496 0, 1 ); 2496 0, 1 );
2497 } 2497 }
2498 if ( result == 0 ) { 2498 if ( result == 0 ) {
2499 if ( mView->openCalendar( fn, true )) { 2499 if ( mView->openCalendar( fn, true )) {
2500 KOPrefs::instance()->mLastImportFile = fn; 2500 KOPrefs::instance()->mLastImportFile = fn;
2501 setCaption(i18n("Imported file successfully")); 2501 setCaption(i18n("Imported file successfully"));
2502 } else { 2502 } else {
2503 setCaption(i18n("Error importing file")); 2503 setCaption(i18n("Error importing file"));
2504 } 2504 }
2505 } 2505 }
2506} 2506}
2507 2507
2508void MainWindow::importIcal() 2508void MainWindow::importIcal()
2509{ 2509{
2510 2510
2511 QString fn =KOPrefs::instance()->mLastImportFile; 2511 QString fn =KOPrefs::instance()->mLastImportFile;
2512 2512
2513 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2513 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2514 if ( fn == "" ) 2514 if ( fn == "" )
2515 return; 2515 return;
2516 importFile( fn, true ); 2516 importFile( fn, true );
2517 2517
2518} 2518}
2519 2519
2520void MainWindow::exportVCalendar() 2520void MainWindow::exportVCalendar()
2521{ 2521{
2522 QString fn = KOPrefs::instance()->mLastVcalFile; 2522 QString fn = KOPrefs::instance()->mLastVcalFile;
2523 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2523 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2524 if ( fn == "" ) 2524 if ( fn == "" )
2525 return; 2525 return;
2526 QFileInfo info; 2526 QFileInfo info;
2527 info.setFile( fn ); 2527 info.setFile( fn );
2528 QString mes; 2528 QString mes;
2529 bool createbup = true; 2529 bool createbup = true;
2530 if ( info. exists() ) { 2530 if ( info. exists() ) {
2531 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2531 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2532 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2532 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2533 i18n("Overwrite!"), i18n("Cancel"), 0, 2533 i18n("Overwrite!"), i18n("Cancel"), 0,
2534 0, 1 ); 2534 0, 1 );
2535 if ( result != 0 ) { 2535 if ( result != 0 ) {
2536 createbup = false; 2536 createbup = false;
2537 } 2537 }
2538 } 2538 }
2539 if ( createbup ) { 2539 if ( createbup ) {