-rw-r--r-- | korganizer/calendarview.cpp | 17 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 |
3 files changed, 18 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3635cfa..eaea040 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1133,810 +1133,823 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1133 | } else { | 1133 | } else { |
1134 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1134 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1135 | checkExternSyncEvent(eventLSyncSharp, inL); | 1135 | checkExternSyncEvent(eventLSyncSharp, inL); |
1136 | local->deleteIncidence( inL ); | 1136 | local->deleteIncidence( inL ); |
1137 | ++deletedEventL; | 1137 | ++deletedEventL; |
1138 | } else { | 1138 | } else { |
1139 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1139 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1140 | ++addedEventR; | 1140 | ++addedEventR; |
1141 | inL->setLastModified( modifiedCalendar ); | 1141 | inL->setLastModified( modifiedCalendar ); |
1142 | remote->addIncidence( inL->clone() ); | 1142 | remote->addIncidence( inL->clone() ); |
1143 | } | 1143 | } |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | inL = el.next(); | 1148 | inL = el.next(); |
1149 | } | 1149 | } |
1150 | int delFut = 0; | 1150 | int delFut = 0; |
1151 | if ( KOPrefs::instance()->mWriteBackInFuture ) { | 1151 | if ( KOPrefs::instance()->mWriteBackInFuture ) { |
1152 | er = remote->rawIncidences(); | 1152 | er = remote->rawIncidences(); |
1153 | inR = er.first(); | 1153 | inR = er.first(); |
1154 | QDateTime dt; | 1154 | QDateTime dt; |
1155 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1155 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1156 | QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); | 1156 | QDateTime end = cur.addDays( (KOPrefs::instance()->mWriteBackInFuture +1 ) *7 ); |
1157 | while ( inR ) { | 1157 | while ( inR ) { |
1158 | if ( inR->type() == "Todo" ) { | 1158 | if ( inR->type() == "Todo" ) { |
1159 | Todo * t = (Todo*)inR; | 1159 | Todo * t = (Todo*)inR; |
1160 | if ( t->hasDueDate() ) | 1160 | if ( t->hasDueDate() ) |
1161 | dt = t->dtDue(); | 1161 | dt = t->dtDue(); |
1162 | else | 1162 | else |
1163 | dt = cur.addSecs( 62 ); | 1163 | dt = cur.addSecs( 62 ); |
1164 | } | 1164 | } |
1165 | else if (inR->type() == "Event" ) { | 1165 | else if (inR->type() == "Event" ) { |
1166 | bool ok; | 1166 | bool ok; |
1167 | dt = inR->getNextOccurence( cur, &ok ); | 1167 | dt = inR->getNextOccurence( cur, &ok ); |
1168 | if ( !ok ) | 1168 | if ( !ok ) |
1169 | dt = cur.addSecs( -62 ); | 1169 | dt = cur.addSecs( -62 ); |
1170 | } | 1170 | } |
1171 | else | 1171 | else |
1172 | dt = inR->dtStart(); | 1172 | dt = inR->dtStart(); |
1173 | if ( dt < cur || dt > end ) { | 1173 | if ( dt < cur || dt > end ) { |
1174 | remote->deleteIncidence( inR ); | 1174 | remote->deleteIncidence( inR ); |
1175 | ++delFut; | 1175 | ++delFut; |
1176 | } | 1176 | } |
1177 | inR = er.next(); | 1177 | inR = er.next(); |
1178 | } | 1178 | } |
1179 | } | 1179 | } |
1180 | bar.hide(); | 1180 | bar.hide(); |
1181 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1181 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1182 | eventLSync->setReadOnly( false ); | 1182 | eventLSync->setReadOnly( false ); |
1183 | eventLSync->setDtStart( mLastCalendarSync ); | 1183 | eventLSync->setDtStart( mLastCalendarSync ); |
1184 | eventRSync->setDtStart( mLastCalendarSync ); | 1184 | eventRSync->setDtStart( mLastCalendarSync ); |
1185 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1185 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1186 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1186 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1187 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1187 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1188 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1188 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1189 | eventLSync->setReadOnly( true ); | 1189 | eventLSync->setReadOnly( true ); |
1190 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1190 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1191 | remote->addEvent( eventRSync ); | 1191 | remote->addEvent( eventRSync ); |
1192 | QString mes; | 1192 | QString mes; |
1193 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1193 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1194 | QString delmess; | 1194 | QString delmess; |
1195 | if ( delFut ) { | 1195 | if ( delFut ) { |
1196 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); | 1196 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); |
1197 | mes += delmess; | 1197 | mes += delmess; |
1198 | } | 1198 | } |
1199 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1199 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1200 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1200 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1201 | } | 1201 | } |
1202 | qDebug( mes ); | 1202 | qDebug( mes ); |
1203 | mCalendar->checkAlarmForIncidence( 0, true ); | 1203 | mCalendar->checkAlarmForIncidence( 0, true ); |
1204 | return syncOK; | 1204 | return syncOK; |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | void CalendarView::setSyncDevice( QString s ) | 1207 | void CalendarView::setSyncDevice( QString s ) |
1208 | { | 1208 | { |
1209 | mCurrentSyncDevice= s; | 1209 | mCurrentSyncDevice= s; |
1210 | } | 1210 | } |
1211 | void CalendarView::setSyncName( QString s ) | 1211 | void CalendarView::setSyncName( QString s ) |
1212 | { | 1212 | { |
1213 | mCurrentSyncName= s; | 1213 | mCurrentSyncName= s; |
1214 | } | 1214 | } |
1215 | bool CalendarView::syncCalendar(QString filename, int mode) | 1215 | bool CalendarView::syncCalendar(QString filename, int mode) |
1216 | { | 1216 | { |
1217 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1217 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1218 | CalendarLocal* calendar = new CalendarLocal(); | 1218 | CalendarLocal* calendar = new CalendarLocal(); |
1219 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1219 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1220 | FileStorage* storage = new FileStorage( calendar ); | 1220 | FileStorage* storage = new FileStorage( calendar ); |
1221 | bool syncOK = false; | 1221 | bool syncOK = false; |
1222 | storage->setFileName( filename ); | 1222 | storage->setFileName( filename ); |
1223 | // qDebug("loading ... "); | 1223 | // qDebug("loading ... "); |
1224 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1224 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1225 | getEventViewerDialog()->setSyncMode( true ); | 1225 | getEventViewerDialog()->setSyncMode( true ); |
1226 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1226 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1227 | getEventViewerDialog()->setSyncMode( false ); | 1227 | getEventViewerDialog()->setSyncMode( false ); |
1228 | if ( syncOK ) { | 1228 | if ( syncOK ) { |
1229 | if ( KOPrefs::instance()->mWriteBackFile ) | 1229 | if ( KOPrefs::instance()->mWriteBackFile ) |
1230 | { | 1230 | { |
1231 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1231 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1232 | storage->save(); | 1232 | storage->save(); |
1233 | } | 1233 | } |
1234 | } | 1234 | } |
1235 | setModified( true ); | 1235 | setModified( true ); |
1236 | } | 1236 | } |
1237 | delete storage; | 1237 | delete storage; |
1238 | delete calendar; | 1238 | delete calendar; |
1239 | if ( syncOK ) | 1239 | if ( syncOK ) |
1240 | updateView(); | 1240 | updateView(); |
1241 | return syncOK; | 1241 | return syncOK; |
1242 | } | 1242 | } |
1243 | void CalendarView::syncPhone() | 1243 | void CalendarView::syncPhone() |
1244 | { | 1244 | { |
1245 | syncExternal( 1 ); | 1245 | syncExternal( 1 ); |
1246 | } | 1246 | } |
1247 | void CalendarView::syncExternal( int mode ) | 1247 | void CalendarView::syncExternal( int mode ) |
1248 | { | 1248 | { |
1249 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1249 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1250 | //mCurrentSyncDevice = "sharp-DTM"; | 1250 | //mCurrentSyncDevice = "sharp-DTM"; |
1251 | if ( KOPrefs::instance()->mAskForPreferences ) | 1251 | if ( KOPrefs::instance()->mAskForPreferences ) |
1252 | edit_sync_options(); | 1252 | edit_sync_options(); |
1253 | qApp->processEvents(); | 1253 | qApp->processEvents(); |
1254 | CalendarLocal* calendar = new CalendarLocal(); | 1254 | CalendarLocal* calendar = new CalendarLocal(); |
1255 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1255 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1256 | bool syncOK = false; | 1256 | bool syncOK = false; |
1257 | bool loadSuccess = false; | 1257 | bool loadSuccess = false; |
1258 | PhoneFormat* phoneFormat = 0; | 1258 | PhoneFormat* phoneFormat = 0; |
1259 | #ifndef DESKTOP_VERSION | 1259 | #ifndef DESKTOP_VERSION |
1260 | SharpFormat* sharpFormat = 0; | 1260 | SharpFormat* sharpFormat = 0; |
1261 | if ( mode == 0 ) { // sharp | 1261 | if ( mode == 0 ) { // sharp |
1262 | sharpFormat = new SharpFormat () ; | 1262 | sharpFormat = new SharpFormat () ; |
1263 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1263 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1264 | 1264 | ||
1265 | } else | 1265 | } else |
1266 | #endif | 1266 | #endif |
1267 | if ( mode == 1 ) { // phone | 1267 | if ( mode == 1 ) { // phone |
1268 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1268 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1269 | KOPrefs::instance()->mPhoneDevice, | 1269 | KOPrefs::instance()->mPhoneDevice, |
1270 | KOPrefs::instance()->mPhoneConnection, | 1270 | KOPrefs::instance()->mPhoneConnection, |
1271 | KOPrefs::instance()->mPhoneModel); | 1271 | KOPrefs::instance()->mPhoneModel); |
1272 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1272 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1273 | 1273 | ||
1274 | } else | 1274 | } else |
1275 | return; | 1275 | return; |
1276 | if ( loadSuccess ) { | 1276 | if ( loadSuccess ) { |
1277 | getEventViewerDialog()->setSyncMode( true ); | 1277 | getEventViewerDialog()->setSyncMode( true ); |
1278 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1278 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1279 | getEventViewerDialog()->setSyncMode( false ); | 1279 | getEventViewerDialog()->setSyncMode( false ); |
1280 | qApp->processEvents(); | 1280 | qApp->processEvents(); |
1281 | if ( syncOK ) { | 1281 | if ( syncOK ) { |
1282 | if ( KOPrefs::instance()->mWriteBackFile ) | 1282 | if ( KOPrefs::instance()->mWriteBackFile ) |
1283 | { | 1283 | { |
1284 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1284 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1285 | Incidence* inc = iL.first(); | 1285 | Incidence* inc = iL.first(); |
1286 | if ( phoneFormat ) { | 1286 | if ( phoneFormat ) { |
1287 | while ( inc ) { | 1287 | while ( inc ) { |
1288 | inc->removeID(mCurrentSyncDevice); | 1288 | inc->removeID(mCurrentSyncDevice); |
1289 | inc = iL.next(); | 1289 | inc = iL.next(); |
1290 | } | 1290 | } |
1291 | } | 1291 | } |
1292 | #ifndef DESKTOP_VERSION | 1292 | #ifndef DESKTOP_VERSION |
1293 | if ( sharpFormat ) | 1293 | if ( sharpFormat ) |
1294 | sharpFormat->save(calendar); | 1294 | sharpFormat->save(calendar); |
1295 | #endif | 1295 | #endif |
1296 | if ( phoneFormat ) | 1296 | if ( phoneFormat ) |
1297 | phoneFormat->save(calendar); | 1297 | phoneFormat->save(calendar); |
1298 | iL = calendar->rawIncidences(); | 1298 | iL = calendar->rawIncidences(); |
1299 | inc = iL.first(); | 1299 | inc = iL.first(); |
1300 | Incidence* loc; | 1300 | Incidence* loc; |
1301 | while ( inc ) { | 1301 | while ( inc ) { |
1302 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1302 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1303 | loc = mCalendar->incidence(inc->uid() ); | 1303 | loc = mCalendar->incidence(inc->uid() ); |
1304 | if ( loc ) { | 1304 | if ( loc ) { |
1305 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1305 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1306 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1306 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1307 | } | 1307 | } |
1308 | } | 1308 | } |
1309 | inc = iL.next(); | 1309 | inc = iL.next(); |
1310 | } | 1310 | } |
1311 | Incidence* lse = getLastSyncEvent(); | 1311 | Incidence* lse = getLastSyncEvent(); |
1312 | if ( lse ) { | 1312 | if ( lse ) { |
1313 | lse->setReadOnly( false ); | 1313 | lse->setReadOnly( false ); |
1314 | lse->setDescription( "" ); | 1314 | lse->setDescription( "" ); |
1315 | lse->setReadOnly( true ); | 1315 | lse->setReadOnly( true ); |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | setModified( true ); | 1319 | setModified( true ); |
1320 | } else { | 1320 | } else { |
1321 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1321 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1322 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1322 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1323 | question, i18n("Ok")) ; | 1323 | question, i18n("Ok")) ; |
1324 | 1324 | ||
1325 | } | 1325 | } |
1326 | delete calendar; | 1326 | delete calendar; |
1327 | updateView(); | 1327 | updateView(); |
1328 | return ;//syncOK; | 1328 | return ;//syncOK; |
1329 | 1329 | ||
1330 | } | 1330 | } |
1331 | void CalendarView::syncSharp() | 1331 | void CalendarView::syncSharp() |
1332 | { | 1332 | { |
1333 | syncExternal( 0 ); | 1333 | syncExternal( 0 ); |
1334 | 1334 | ||
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | 1337 | ||
1338 | //#include <kabc/stdaddressbook.h> | 1338 | //#include <kabc/stdaddressbook.h> |
1339 | bool CalendarView::importBday() | 1339 | bool CalendarView::importBday() |
1340 | { | 1340 | { |
1341 | #if 0 | 1341 | #if 0 |
1342 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1342 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1343 | KABC::AddressBook::Iterator it; | 1343 | KABC::AddressBook::Iterator it; |
1344 | int count = 0; | 1344 | int count = 0; |
1345 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1345 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1346 | ++count; | 1346 | ++count; |
1347 | } | 1347 | } |
1348 | QProgressBar bar(count,0 ); | 1348 | QProgressBar bar(count,0 ); |
1349 | int w = 300; | 1349 | int w = 300; |
1350 | if ( QApplication::desktop()->width() < 320 ) | 1350 | if ( QApplication::desktop()->width() < 320 ) |
1351 | w = 220; | 1351 | w = 220; |
1352 | int h = bar.sizeHint().height() ; | 1352 | int h = bar.sizeHint().height() ; |
1353 | int dw = QApplication::desktop()->width(); | 1353 | int dw = QApplication::desktop()->width(); |
1354 | int dh = QApplication::desktop()->height(); | 1354 | int dh = QApplication::desktop()->height(); |
1355 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1355 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1356 | bar.show(); | 1356 | bar.show(); |
1357 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1357 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1358 | qApp->processEvents(); | 1358 | qApp->processEvents(); |
1359 | count = 0; | 1359 | count = 0; |
1360 | int addCount = 0; | 1360 | int addCount = 0; |
1361 | KCal::Attendee* a = 0; | 1361 | KCal::Attendee* a = 0; |
1362 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1362 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1363 | if ( ! bar.isVisible() ) | 1363 | if ( ! bar.isVisible() ) |
1364 | return false; | 1364 | return false; |
1365 | bar.setProgress( count++ ); | 1365 | bar.setProgress( count++ ); |
1366 | qApp->processEvents(); | 1366 | qApp->processEvents(); |
1367 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1367 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1368 | if ( (*it).birthday().date().isValid() ){ | 1368 | if ( (*it).birthday().date().isValid() ){ |
1369 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1369 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1370 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1370 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1371 | ++addCount; | 1371 | ++addCount; |
1372 | } | 1372 | } |
1373 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1373 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1374 | if ( anni.isValid() ){ | 1374 | if ( anni.isValid() ){ |
1375 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1375 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1376 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1376 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1377 | ++addCount; | 1377 | ++addCount; |
1378 | } | 1378 | } |
1379 | } | 1379 | } |
1380 | updateView(); | 1380 | updateView(); |
1381 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1381 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1382 | #endif | 1382 | #endif |
1383 | return true; | 1383 | return true; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1386 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1387 | { | 1387 | { |
1388 | //qDebug("addAnni "); | 1388 | //qDebug("addAnni "); |
1389 | Event * ev = new Event(); | 1389 | Event * ev = new Event(); |
1390 | if ( a ) { | 1390 | if ( a ) { |
1391 | ev->addAttendee( a ); | 1391 | ev->addAttendee( a ); |
1392 | } | 1392 | } |
1393 | QString kind; | 1393 | QString kind; |
1394 | if ( birthday ) | 1394 | if ( birthday ) |
1395 | kind = i18n( "Birthday" ); | 1395 | kind = i18n( "Birthday" ); |
1396 | else | 1396 | else |
1397 | kind = i18n( "Anniversary" ); | 1397 | kind = i18n( "Anniversary" ); |
1398 | ev->setSummary( name + " - " + kind ); | 1398 | ev->setSummary( name + " - " + kind ); |
1399 | ev->setOrganizer( "nobody@nowhere" ); | 1399 | ev->setOrganizer( "nobody@nowhere" ); |
1400 | ev->setCategories( kind ); | 1400 | ev->setCategories( kind ); |
1401 | ev->setDtStart( QDateTime(date) ); | 1401 | ev->setDtStart( QDateTime(date) ); |
1402 | ev->setDtEnd( QDateTime(date) ); | 1402 | ev->setDtEnd( QDateTime(date) ); |
1403 | ev->setFloats( true ); | 1403 | ev->setFloats( true ); |
1404 | Recurrence * rec = ev->recurrence(); | 1404 | Recurrence * rec = ev->recurrence(); |
1405 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1405 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1406 | rec->addYearlyNum( date.month() ); | 1406 | rec->addYearlyNum( date.month() ); |
1407 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1407 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1408 | delete ev; | 1408 | delete ev; |
1409 | return false; | 1409 | return false; |
1410 | } | 1410 | } |
1411 | return true; | 1411 | return true; |
1412 | 1412 | ||
1413 | } | 1413 | } |
1414 | bool CalendarView::importQtopia( const QString &categories, | 1414 | bool CalendarView::importQtopia( const QString &categories, |
1415 | const QString &datebook, | 1415 | const QString &datebook, |
1416 | const QString &todolist ) | 1416 | const QString &todolist ) |
1417 | { | 1417 | { |
1418 | 1418 | ||
1419 | QtopiaFormat qtopiaFormat; | 1419 | QtopiaFormat qtopiaFormat; |
1420 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1420 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1421 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1421 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1422 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1422 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1423 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1423 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1424 | 1424 | ||
1425 | updateView(); | 1425 | updateView(); |
1426 | return true; | 1426 | return true; |
1427 | 1427 | ||
1428 | #if 0 | 1428 | #if 0 |
1429 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1429 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1430 | mCurrentSyncDevice = "qtopia-XML"; | 1430 | mCurrentSyncDevice = "qtopia-XML"; |
1431 | if ( KOPrefs::instance()->mAskForPreferences ) | 1431 | if ( KOPrefs::instance()->mAskForPreferences ) |
1432 | edit_sync_options(); | 1432 | edit_sync_options(); |
1433 | qApp->processEvents(); | 1433 | qApp->processEvents(); |
1434 | CalendarLocal* calendar = new CalendarLocal(); | 1434 | CalendarLocal* calendar = new CalendarLocal(); |
1435 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1435 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1436 | bool syncOK = false; | 1436 | bool syncOK = false; |
1437 | QtopiaFormat qtopiaFormat; | 1437 | QtopiaFormat qtopiaFormat; |
1438 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1438 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1439 | bool loadOk = true; | 1439 | bool loadOk = true; |
1440 | if ( !categories.isEmpty() ) | 1440 | if ( !categories.isEmpty() ) |
1441 | loadOk = qtopiaFormat.load( calendar, categories ); | 1441 | loadOk = qtopiaFormat.load( calendar, categories ); |
1442 | if ( loadOk && !datebook.isEmpty() ) | 1442 | if ( loadOk && !datebook.isEmpty() ) |
1443 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1443 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1444 | if ( loadOk && !todolist.isEmpty() ) | 1444 | if ( loadOk && !todolist.isEmpty() ) |
1445 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1445 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1446 | 1446 | ||
1447 | if ( loadOk ) { | 1447 | if ( loadOk ) { |
1448 | getEventViewerDialog()->setSyncMode( true ); | 1448 | getEventViewerDialog()->setSyncMode( true ); |
1449 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1449 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1450 | getEventViewerDialog()->setSyncMode( false ); | 1450 | getEventViewerDialog()->setSyncMode( false ); |
1451 | qApp->processEvents(); | 1451 | qApp->processEvents(); |
1452 | if ( syncOK ) { | 1452 | if ( syncOK ) { |
1453 | if ( KOPrefs::instance()->mWriteBackFile ) | 1453 | if ( KOPrefs::instance()->mWriteBackFile ) |
1454 | { | 1454 | { |
1455 | // write back XML file | 1455 | // write back XML file |
1456 | 1456 | ||
1457 | } | 1457 | } |
1458 | setModified( true ); | 1458 | setModified( true ); |
1459 | } | 1459 | } |
1460 | } else { | 1460 | } else { |
1461 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1461 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1462 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1462 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1463 | question, i18n("Ok")) ; | 1463 | question, i18n("Ok")) ; |
1464 | } | 1464 | } |
1465 | delete calendar; | 1465 | delete calendar; |
1466 | updateView(); | 1466 | updateView(); |
1467 | return syncOK; | 1467 | return syncOK; |
1468 | 1468 | ||
1469 | 1469 | ||
1470 | #endif | 1470 | #endif |
1471 | 1471 | ||
1472 | } | 1472 | } |
1473 | 1473 | ||
1474 | void CalendarView::setSyncEventsReadOnly() | 1474 | void CalendarView::setSyncEventsReadOnly() |
1475 | { | 1475 | { |
1476 | Event * ev; | 1476 | Event * ev; |
1477 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1477 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1478 | ev = eL.first(); | 1478 | ev = eL.first(); |
1479 | while ( ev ) { | 1479 | while ( ev ) { |
1480 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1480 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1481 | ev->setReadOnly( true ); | 1481 | ev->setReadOnly( true ); |
1482 | ev = eL.next(); | 1482 | ev = eL.next(); |
1483 | } | 1483 | } |
1484 | } | 1484 | } |
1485 | bool CalendarView::openCalendar(QString filename, bool merge) | 1485 | bool CalendarView::openCalendar(QString filename, bool merge) |
1486 | { | 1486 | { |
1487 | 1487 | ||
1488 | if (filename.isEmpty()) { | 1488 | if (filename.isEmpty()) { |
1489 | return false; | 1489 | return false; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | if (!QFile::exists(filename)) { | 1492 | if (!QFile::exists(filename)) { |
1493 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1493 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1494 | return false; | 1494 | return false; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | globalFlagBlockAgenda = 1; | 1497 | globalFlagBlockAgenda = 1; |
1498 | if (!merge) mCalendar->close(); | 1498 | if (!merge) mCalendar->close(); |
1499 | 1499 | ||
1500 | mStorage->setFileName( filename ); | 1500 | mStorage->setFileName( filename ); |
1501 | 1501 | ||
1502 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1502 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1503 | if ( merge ) ;//setModified( true ); | 1503 | if ( merge ) ;//setModified( true ); |
1504 | else { | 1504 | else { |
1505 | //setModified( true ); | 1505 | //setModified( true ); |
1506 | mViewManager->setDocumentId( filename ); | 1506 | mViewManager->setDocumentId( filename ); |
1507 | mDialogManager->setDocumentId( filename ); | 1507 | mDialogManager->setDocumentId( filename ); |
1508 | mTodoList->setDocumentId( filename ); | 1508 | mTodoList->setDocumentId( filename ); |
1509 | } | 1509 | } |
1510 | globalFlagBlockAgenda = 2; | 1510 | globalFlagBlockAgenda = 2; |
1511 | // if ( getLastSyncEvent() ) | 1511 | // if ( getLastSyncEvent() ) |
1512 | // getLastSyncEvent()->setReadOnly( true ); | 1512 | // getLastSyncEvent()->setReadOnly( true ); |
1513 | mCalendar->reInitAlarmSettings(); | 1513 | mCalendar->reInitAlarmSettings(); |
1514 | setSyncEventsReadOnly(); | 1514 | setSyncEventsReadOnly(); |
1515 | updateUnmanagedViews(); | 1515 | updateUnmanagedViews(); |
1516 | updateView(); | 1516 | updateView(); |
1517 | if ( filename != MainWindow::defaultFileName() ) | 1517 | if ( filename != MainWindow::defaultFileName() ) |
1518 | saveCalendar( MainWindow::defaultFileName() ); | 1518 | saveCalendar( MainWindow::defaultFileName() ); |
1519 | loadedFileVersion = QDateTime::currentDateTime(); | 1519 | loadedFileVersion = QDateTime::currentDateTime(); |
1520 | return true; | 1520 | return true; |
1521 | } else { | 1521 | } else { |
1522 | // while failing to load, the calendar object could | 1522 | // while failing to load, the calendar object could |
1523 | // have become partially populated. Clear it out. | 1523 | // have become partially populated. Clear it out. |
1524 | if ( !merge ) mCalendar->close(); | 1524 | if ( !merge ) mCalendar->close(); |
1525 | 1525 | ||
1526 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1526 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1527 | 1527 | ||
1528 | globalFlagBlockAgenda = 2; | 1528 | globalFlagBlockAgenda = 2; |
1529 | updateView(); | 1529 | updateView(); |
1530 | } | 1530 | } |
1531 | return false; | 1531 | return false; |
1532 | } | 1532 | } |
1533 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1533 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1534 | { | 1534 | { |
1535 | loadedFileVersion = dt; | 1535 | loadedFileVersion = dt; |
1536 | } | 1536 | } |
1537 | bool CalendarView::checkFileChanged(QString fn) | 1537 | bool CalendarView::checkFileChanged(QString fn) |
1538 | { | 1538 | { |
1539 | QFileInfo finf ( fn ); | 1539 | QFileInfo finf ( fn ); |
1540 | if ( !finf.exists() ) | 1540 | if ( !finf.exists() ) |
1541 | return true; | 1541 | return true; |
1542 | QDateTime dt = finf.lastModified (); | 1542 | QDateTime dt = finf.lastModified (); |
1543 | if ( dt <= loadedFileVersion ) | 1543 | if ( dt <= loadedFileVersion ) |
1544 | return false; | 1544 | return false; |
1545 | return true; | 1545 | return true; |
1546 | 1546 | ||
1547 | } | 1547 | } |
1548 | void CalendarView::watchSavedFile() | ||
1549 | { | ||
1550 | QFileInfo finf ( MainWindow::defaultFileName()); | ||
1551 | if ( !finf.exists() ) | ||
1552 | return; | ||
1553 | QDateTime dt = finf.lastModified (); | ||
1554 | if ( dt < loadedFileVersion ) { | ||
1555 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | ||
1556 | return; | ||
1557 | } | ||
1558 | loadedFileVersion = dt; | ||
1559 | } | ||
1560 | |||
1548 | bool CalendarView::checkFileVersion(QString fn) | 1561 | bool CalendarView::checkFileVersion(QString fn) |
1549 | { | 1562 | { |
1550 | QFileInfo finf ( fn ); | 1563 | QFileInfo finf ( fn ); |
1551 | if ( !finf.exists() ) | 1564 | if ( !finf.exists() ) |
1552 | return true; | 1565 | return true; |
1553 | QDateTime dt = finf.lastModified (); | 1566 | QDateTime dt = finf.lastModified (); |
1554 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1567 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1555 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1568 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1556 | if ( dt <= loadedFileVersion ) | 1569 | if ( dt <= loadedFileVersion ) |
1557 | return true; | 1570 | return true; |
1558 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , | 1571 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1559 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1572 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1560 | i18n("Sync+save")); | 1573 | i18n("Sync+save")); |
1561 | 1574 | ||
1562 | if ( km == KMessageBox::Cancel ) | 1575 | if ( km == KMessageBox::Cancel ) |
1563 | return false; | 1576 | return false; |
1564 | if ( km == KMessageBox::Yes ) | 1577 | if ( km == KMessageBox::Yes ) |
1565 | return true; | 1578 | return true; |
1566 | 1579 | ||
1567 | setSyncDevice("deleteaftersync" ); | 1580 | setSyncDevice("deleteaftersync" ); |
1568 | KOPrefs::instance()->mAskForPreferences = true; | 1581 | KOPrefs::instance()->mAskForPreferences = true; |
1569 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1582 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1570 | KOPrefs::instance()->mWriteBackFile = false; | 1583 | KOPrefs::instance()->mWriteBackFile = false; |
1571 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1584 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1572 | KOPrefs::instance()->mShowSyncSummary = false; | 1585 | KOPrefs::instance()->mShowSyncSummary = false; |
1573 | syncCalendar( fn, 3 ); | 1586 | syncCalendar( fn, 3 ); |
1574 | Event * e = getLastSyncEvent(); | 1587 | Event * e = getLastSyncEvent(); |
1575 | mCalendar->deleteEvent ( e ); | 1588 | mCalendar->deleteEvent ( e ); |
1576 | updateView(); | 1589 | updateView(); |
1577 | return true; | 1590 | return true; |
1578 | } | 1591 | } |
1579 | 1592 | ||
1580 | bool CalendarView::saveCalendar( QString filename ) | 1593 | bool CalendarView::saveCalendar( QString filename ) |
1581 | { | 1594 | { |
1582 | 1595 | ||
1583 | // Store back all unsaved data into calendar object | 1596 | // Store back all unsaved data into calendar object |
1584 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1597 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1585 | if ( mViewManager->currentView() ) | 1598 | if ( mViewManager->currentView() ) |
1586 | mViewManager->currentView()->flushView(); | 1599 | mViewManager->currentView()->flushView(); |
1587 | 1600 | ||
1588 | //mStorage->setFileName( filename ); | 1601 | //mStorage->setFileName( filename ); |
1589 | 1602 | ||
1590 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1603 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1591 | mStorage->setFileName( filename ); | 1604 | mStorage->setFileName( filename ); |
1592 | bool success; | 1605 | bool success; |
1593 | success = mStorage->save(); | 1606 | success = mStorage->save(); |
1594 | if ( !success ) { | 1607 | if ( !success ) { |
1595 | return false; | 1608 | return false; |
1596 | } | 1609 | } |
1597 | 1610 | ||
1598 | return true; | 1611 | return true; |
1599 | } | 1612 | } |
1600 | 1613 | ||
1601 | void CalendarView::closeCalendar() | 1614 | void CalendarView::closeCalendar() |
1602 | { | 1615 | { |
1603 | 1616 | ||
1604 | // child windows no longer valid | 1617 | // child windows no longer valid |
1605 | emit closingDown(); | 1618 | emit closingDown(); |
1606 | 1619 | ||
1607 | mCalendar->close(); | 1620 | mCalendar->close(); |
1608 | setModified(false); | 1621 | setModified(false); |
1609 | updateView(); | 1622 | updateView(); |
1610 | } | 1623 | } |
1611 | 1624 | ||
1612 | void CalendarView::archiveCalendar() | 1625 | void CalendarView::archiveCalendar() |
1613 | { | 1626 | { |
1614 | mDialogManager->showArchiveDialog(); | 1627 | mDialogManager->showArchiveDialog(); |
1615 | } | 1628 | } |
1616 | 1629 | ||
1617 | 1630 | ||
1618 | void CalendarView::readSettings() | 1631 | void CalendarView::readSettings() |
1619 | { | 1632 | { |
1620 | 1633 | ||
1621 | 1634 | ||
1622 | // mViewManager->showAgendaView(); | 1635 | // mViewManager->showAgendaView(); |
1623 | QString str; | 1636 | QString str; |
1624 | //qDebug("CalendarView::readSettings() "); | 1637 | //qDebug("CalendarView::readSettings() "); |
1625 | // read settings from the KConfig, supplying reasonable | 1638 | // read settings from the KConfig, supplying reasonable |
1626 | // defaults where none are to be found | 1639 | // defaults where none are to be found |
1627 | KConfig *config = KOGlobals::config(); | 1640 | KConfig *config = KOGlobals::config(); |
1628 | #ifndef KORG_NOSPLITTER | 1641 | #ifndef KORG_NOSPLITTER |
1629 | config->setGroup("KOrganizer Geometry"); | 1642 | config->setGroup("KOrganizer Geometry"); |
1630 | 1643 | ||
1631 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1644 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1632 | if (sizes.count() != 2) { | 1645 | if (sizes.count() != 2) { |
1633 | sizes << mDateNavigator->minimumSizeHint().width(); | 1646 | sizes << mDateNavigator->minimumSizeHint().width(); |
1634 | sizes << 300; | 1647 | sizes << 300; |
1635 | } | 1648 | } |
1636 | mPanner->setSizes(sizes); | 1649 | mPanner->setSizes(sizes); |
1637 | 1650 | ||
1638 | sizes = config->readIntListEntry("Separator2"); | 1651 | sizes = config->readIntListEntry("Separator2"); |
1639 | if ( ( mResourceView && sizes.count() == 4 ) || | 1652 | if ( ( mResourceView && sizes.count() == 4 ) || |
1640 | ( !mResourceView && sizes.count() == 3 ) ) { | 1653 | ( !mResourceView && sizes.count() == 3 ) ) { |
1641 | mLeftSplitter->setSizes(sizes); | 1654 | mLeftSplitter->setSizes(sizes); |
1642 | } | 1655 | } |
1643 | #endif | 1656 | #endif |
1644 | globalFlagBlockAgenda = 1; | 1657 | globalFlagBlockAgenda = 1; |
1645 | mViewManager->showAgendaView(); | 1658 | mViewManager->showAgendaView(); |
1646 | //mViewManager->readSettings( config ); | 1659 | //mViewManager->readSettings( config ); |
1647 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1660 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1648 | readFilterSettings(config); | 1661 | readFilterSettings(config); |
1649 | config->setGroup( "Views" ); | 1662 | config->setGroup( "Views" ); |
1650 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1663 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1651 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1664 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1652 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1665 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1653 | else mNavigator->selectDates( dateCount ); | 1666 | else mNavigator->selectDates( dateCount ); |
1654 | // mViewManager->readSettings( config ); | 1667 | // mViewManager->readSettings( config ); |
1655 | updateConfig(); | 1668 | updateConfig(); |
1656 | globalFlagBlockAgenda = 2; | 1669 | globalFlagBlockAgenda = 2; |
1657 | mViewManager->readSettings( config ); | 1670 | mViewManager->readSettings( config ); |
1658 | #ifdef DESKTOP_VERSION | 1671 | #ifdef DESKTOP_VERSION |
1659 | config->setGroup("WidgetLayout"); | 1672 | config->setGroup("WidgetLayout"); |
1660 | QStringList list; | 1673 | QStringList list; |
1661 | list = config->readListEntry("MainLayout"); | 1674 | list = config->readListEntry("MainLayout"); |
1662 | int x,y,w,h; | 1675 | int x,y,w,h; |
1663 | if ( ! list.isEmpty() ) { | 1676 | if ( ! list.isEmpty() ) { |
1664 | x = list[0].toInt(); | 1677 | x = list[0].toInt(); |
1665 | y = list[1].toInt(); | 1678 | y = list[1].toInt(); |
1666 | w = list[2].toInt(); | 1679 | w = list[2].toInt(); |
1667 | h = list[3].toInt(); | 1680 | h = list[3].toInt(); |
1668 | topLevelWidget()->setGeometry(x,y,w,h); | 1681 | topLevelWidget()->setGeometry(x,y,w,h); |
1669 | 1682 | ||
1670 | } else { | 1683 | } else { |
1671 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1684 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1672 | } | 1685 | } |
1673 | list = config->readListEntry("EditEventLayout"); | 1686 | list = config->readListEntry("EditEventLayout"); |
1674 | if ( ! list.isEmpty() ) { | 1687 | if ( ! list.isEmpty() ) { |
1675 | x = list[0].toInt(); | 1688 | x = list[0].toInt(); |
1676 | y = list[1].toInt(); | 1689 | y = list[1].toInt(); |
1677 | w = list[2].toInt(); | 1690 | w = list[2].toInt(); |
1678 | h = list[3].toInt(); | 1691 | h = list[3].toInt(); |
1679 | mEventEditor->setGeometry(x,y,w,h); | 1692 | mEventEditor->setGeometry(x,y,w,h); |
1680 | 1693 | ||
1681 | } | 1694 | } |
1682 | list = config->readListEntry("EditTodoLayout"); | 1695 | list = config->readListEntry("EditTodoLayout"); |
1683 | if ( ! list.isEmpty() ) { | 1696 | if ( ! list.isEmpty() ) { |
1684 | x = list[0].toInt(); | 1697 | x = list[0].toInt(); |
1685 | y = list[1].toInt(); | 1698 | y = list[1].toInt(); |
1686 | w = list[2].toInt(); | 1699 | w = list[2].toInt(); |
1687 | h = list[3].toInt(); | 1700 | h = list[3].toInt(); |
1688 | mTodoEditor->setGeometry(x,y,w,h); | 1701 | mTodoEditor->setGeometry(x,y,w,h); |
1689 | 1702 | ||
1690 | } | 1703 | } |
1691 | list = config->readListEntry("ViewerLayout"); | 1704 | list = config->readListEntry("ViewerLayout"); |
1692 | if ( ! list.isEmpty() ) { | 1705 | if ( ! list.isEmpty() ) { |
1693 | x = list[0].toInt(); | 1706 | x = list[0].toInt(); |
1694 | y = list[1].toInt(); | 1707 | y = list[1].toInt(); |
1695 | w = list[2].toInt(); | 1708 | w = list[2].toInt(); |
1696 | h = list[3].toInt(); | 1709 | h = list[3].toInt(); |
1697 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1710 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1698 | } | 1711 | } |
1699 | #endif | 1712 | #endif |
1700 | 1713 | ||
1701 | } | 1714 | } |
1702 | 1715 | ||
1703 | 1716 | ||
1704 | void CalendarView::writeSettings() | 1717 | void CalendarView::writeSettings() |
1705 | { | 1718 | { |
1706 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1719 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1707 | 1720 | ||
1708 | KConfig *config = KOGlobals::config(); | 1721 | KConfig *config = KOGlobals::config(); |
1709 | 1722 | ||
1710 | #ifndef KORG_NOSPLITTER | 1723 | #ifndef KORG_NOSPLITTER |
1711 | config->setGroup("KOrganizer Geometry"); | 1724 | config->setGroup("KOrganizer Geometry"); |
1712 | 1725 | ||
1713 | QValueList<int> list = mPanner->sizes(); | 1726 | QValueList<int> list = mPanner->sizes(); |
1714 | config->writeEntry("Separator1",list); | 1727 | config->writeEntry("Separator1",list); |
1715 | 1728 | ||
1716 | list = mLeftSplitter->sizes(); | 1729 | list = mLeftSplitter->sizes(); |
1717 | config->writeEntry("Separator2",list); | 1730 | config->writeEntry("Separator2",list); |
1718 | #endif | 1731 | #endif |
1719 | 1732 | ||
1720 | mViewManager->writeSettings( config ); | 1733 | mViewManager->writeSettings( config ); |
1721 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1734 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1722 | mDialogManager->writeSettings( config ); | 1735 | mDialogManager->writeSettings( config ); |
1723 | //KOPrefs::instance()->usrWriteConfig(); | 1736 | //KOPrefs::instance()->usrWriteConfig(); |
1724 | KOPrefs::instance()->writeConfig(); | 1737 | KOPrefs::instance()->writeConfig(); |
1725 | 1738 | ||
1726 | writeFilterSettings(config); | 1739 | writeFilterSettings(config); |
1727 | 1740 | ||
1728 | config->setGroup( "Views" ); | 1741 | config->setGroup( "Views" ); |
1729 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1742 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1730 | 1743 | ||
1731 | #ifdef DESKTOP_VERSION | 1744 | #ifdef DESKTOP_VERSION |
1732 | config->setGroup("WidgetLayout"); | 1745 | config->setGroup("WidgetLayout"); |
1733 | QStringList list ;//= config->readListEntry("MainLayout"); | 1746 | QStringList list ;//= config->readListEntry("MainLayout"); |
1734 | int x,y,w,h; | 1747 | int x,y,w,h; |
1735 | QWidget* wid; | 1748 | QWidget* wid; |
1736 | wid = topLevelWidget(); | 1749 | wid = topLevelWidget(); |
1737 | x = wid->geometry().x(); | 1750 | x = wid->geometry().x(); |
1738 | y = wid->geometry().y(); | 1751 | y = wid->geometry().y(); |
1739 | w = wid->width(); | 1752 | w = wid->width(); |
1740 | h = wid->height(); | 1753 | h = wid->height(); |
1741 | list.clear(); | 1754 | list.clear(); |
1742 | list << QString::number( x ); | 1755 | list << QString::number( x ); |
1743 | list << QString::number( y ); | 1756 | list << QString::number( y ); |
1744 | list << QString::number( w ); | 1757 | list << QString::number( w ); |
1745 | list << QString::number( h ); | 1758 | list << QString::number( h ); |
1746 | config->writeEntry("MainLayout",list ); | 1759 | config->writeEntry("MainLayout",list ); |
1747 | 1760 | ||
1748 | wid = mEventEditor; | 1761 | wid = mEventEditor; |
1749 | x = wid->geometry().x(); | 1762 | x = wid->geometry().x(); |
1750 | y = wid->geometry().y(); | 1763 | y = wid->geometry().y(); |
1751 | w = wid->width(); | 1764 | w = wid->width(); |
1752 | h = wid->height(); | 1765 | h = wid->height(); |
1753 | list.clear(); | 1766 | list.clear(); |
1754 | list << QString::number( x ); | 1767 | list << QString::number( x ); |
1755 | list << QString::number( y ); | 1768 | list << QString::number( y ); |
1756 | list << QString::number( w ); | 1769 | list << QString::number( w ); |
1757 | list << QString::number( h ); | 1770 | list << QString::number( h ); |
1758 | config->writeEntry("EditEventLayout",list ); | 1771 | config->writeEntry("EditEventLayout",list ); |
1759 | 1772 | ||
1760 | wid = mTodoEditor; | 1773 | wid = mTodoEditor; |
1761 | x = wid->geometry().x(); | 1774 | x = wid->geometry().x(); |
1762 | y = wid->geometry().y(); | 1775 | y = wid->geometry().y(); |
1763 | w = wid->width(); | 1776 | w = wid->width(); |
1764 | h = wid->height(); | 1777 | h = wid->height(); |
1765 | list.clear(); | 1778 | list.clear(); |
1766 | list << QString::number( x ); | 1779 | list << QString::number( x ); |
1767 | list << QString::number( y ); | 1780 | list << QString::number( y ); |
1768 | list << QString::number( w ); | 1781 | list << QString::number( w ); |
1769 | list << QString::number( h ); | 1782 | list << QString::number( h ); |
1770 | config->writeEntry("EditTodoLayout",list ); | 1783 | config->writeEntry("EditTodoLayout",list ); |
1771 | wid = getEventViewerDialog(); | 1784 | wid = getEventViewerDialog(); |
1772 | x = wid->geometry().x(); | 1785 | x = wid->geometry().x(); |
1773 | y = wid->geometry().y(); | 1786 | y = wid->geometry().y(); |
1774 | w = wid->width(); | 1787 | w = wid->width(); |
1775 | h = wid->height(); | 1788 | h = wid->height(); |
1776 | list.clear(); | 1789 | list.clear(); |
1777 | list << QString::number( x ); | 1790 | list << QString::number( x ); |
1778 | list << QString::number( y ); | 1791 | list << QString::number( y ); |
1779 | list << QString::number( w ); | 1792 | list << QString::number( w ); |
1780 | list << QString::number( h ); | 1793 | list << QString::number( h ); |
1781 | config->writeEntry("ViewerLayout",list ); | 1794 | config->writeEntry("ViewerLayout",list ); |
1782 | wid = mDialogManager->getSearchDialog(); | 1795 | wid = mDialogManager->getSearchDialog(); |
1783 | if ( wid ) { | 1796 | if ( wid ) { |
1784 | x = wid->geometry().x(); | 1797 | x = wid->geometry().x(); |
1785 | y = wid->geometry().y(); | 1798 | y = wid->geometry().y(); |
1786 | w = wid->width(); | 1799 | w = wid->width(); |
1787 | h = wid->height(); | 1800 | h = wid->height(); |
1788 | list.clear(); | 1801 | list.clear(); |
1789 | list << QString::number( x ); | 1802 | list << QString::number( x ); |
1790 | list << QString::number( y ); | 1803 | list << QString::number( y ); |
1791 | list << QString::number( w ); | 1804 | list << QString::number( w ); |
1792 | list << QString::number( h ); | 1805 | list << QString::number( h ); |
1793 | config->writeEntry("SearchLayout",list ); | 1806 | config->writeEntry("SearchLayout",list ); |
1794 | } | 1807 | } |
1795 | #endif | 1808 | #endif |
1796 | 1809 | ||
1797 | 1810 | ||
1798 | config->sync(); | 1811 | config->sync(); |
1799 | } | 1812 | } |
1800 | 1813 | ||
1801 | void CalendarView::readFilterSettings(KConfig *config) | 1814 | void CalendarView::readFilterSettings(KConfig *config) |
1802 | { | 1815 | { |
1803 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1816 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1804 | 1817 | ||
1805 | mFilters.clear(); | 1818 | mFilters.clear(); |
1806 | 1819 | ||
1807 | config->setGroup("General"); | 1820 | config->setGroup("General"); |
1808 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1821 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1809 | 1822 | ||
1810 | QStringList::ConstIterator it = filterList.begin(); | 1823 | QStringList::ConstIterator it = filterList.begin(); |
1811 | QStringList::ConstIterator end = filterList.end(); | 1824 | QStringList::ConstIterator end = filterList.end(); |
1812 | while(it != end) { | 1825 | while(it != end) { |
1813 | // kdDebug() << " filter: " << (*it) << endl; | 1826 | // kdDebug() << " filter: " << (*it) << endl; |
1814 | 1827 | ||
1815 | CalFilter *filter; | 1828 | CalFilter *filter; |
1816 | filter = new CalFilter(*it); | 1829 | filter = new CalFilter(*it); |
1817 | config->setGroup("Filter_" + (*it)); | 1830 | config->setGroup("Filter_" + (*it)); |
1818 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1831 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1819 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1832 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1820 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1833 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1821 | mFilters.append(filter); | 1834 | mFilters.append(filter); |
1822 | 1835 | ||
1823 | ++it; | 1836 | ++it; |
1824 | } | 1837 | } |
1825 | 1838 | ||
1826 | if (mFilters.count() == 0) { | 1839 | if (mFilters.count() == 0) { |
1827 | CalFilter *filter = new CalFilter(i18n("Default")); | 1840 | CalFilter *filter = new CalFilter(i18n("Default")); |
1828 | mFilters.append(filter); | 1841 | mFilters.append(filter); |
1829 | } | 1842 | } |
1830 | mFilterView->updateFilters(); | 1843 | mFilterView->updateFilters(); |
1831 | config->setGroup("FilterView"); | 1844 | config->setGroup("FilterView"); |
1832 | 1845 | ||
1833 | mFilterView->blockSignals(true); | 1846 | mFilterView->blockSignals(true); |
1834 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 1847 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
1835 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 1848 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
1836 | mFilterView->blockSignals(false); | 1849 | mFilterView->blockSignals(false); |
1837 | // We do it manually to avoid it being done twice by the above calls | 1850 | // We do it manually to avoid it being done twice by the above calls |
1838 | updateFilter(); | 1851 | updateFilter(); |
1839 | } | 1852 | } |
1840 | 1853 | ||
1841 | void CalendarView::writeFilterSettings(KConfig *config) | 1854 | void CalendarView::writeFilterSettings(KConfig *config) |
1842 | { | 1855 | { |
1843 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 1856 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
1844 | 1857 | ||
1845 | QStringList filterList; | 1858 | QStringList filterList; |
1846 | 1859 | ||
1847 | CalFilter *filter = mFilters.first(); | 1860 | CalFilter *filter = mFilters.first(); |
1848 | while(filter) { | 1861 | while(filter) { |
1849 | // kdDebug() << " fn: " << filter->name() << endl; | 1862 | // kdDebug() << " fn: " << filter->name() << endl; |
1850 | filterList << filter->name(); | 1863 | filterList << filter->name(); |
1851 | config->setGroup("Filter_" + filter->name()); | 1864 | config->setGroup("Filter_" + filter->name()); |
1852 | config->writeEntry("Criteria",filter->criteria()); | 1865 | config->writeEntry("Criteria",filter->criteria()); |
1853 | config->writeEntry("CategoryList",filter->categoryList()); | 1866 | config->writeEntry("CategoryList",filter->categoryList()); |
1854 | filter = mFilters.next(); | 1867 | filter = mFilters.next(); |
1855 | } | 1868 | } |
1856 | config->setGroup("General"); | 1869 | config->setGroup("General"); |
1857 | config->writeEntry("CalendarFilters",filterList); | 1870 | config->writeEntry("CalendarFilters",filterList); |
1858 | 1871 | ||
1859 | config->setGroup("FilterView"); | 1872 | config->setGroup("FilterView"); |
1860 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1873 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1861 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1874 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1862 | } | 1875 | } |
1863 | 1876 | ||
1864 | 1877 | ||
1865 | void CalendarView::goToday() | 1878 | void CalendarView::goToday() |
1866 | { | 1879 | { |
1867 | mNavigator->selectToday(); | 1880 | mNavigator->selectToday(); |
1868 | } | 1881 | } |
1869 | 1882 | ||
1870 | void CalendarView::goNext() | 1883 | void CalendarView::goNext() |
1871 | { | 1884 | { |
1872 | mNavigator->selectNext(); | 1885 | mNavigator->selectNext(); |
1873 | } | 1886 | } |
1874 | 1887 | ||
1875 | void CalendarView::goPrevious() | 1888 | void CalendarView::goPrevious() |
1876 | { | 1889 | { |
1877 | mNavigator->selectPrevious(); | 1890 | mNavigator->selectPrevious(); |
1878 | } | 1891 | } |
1879 | void CalendarView::goNextMonth() | 1892 | void CalendarView::goNextMonth() |
1880 | { | 1893 | { |
1881 | mNavigator->selectNextMonth(); | 1894 | mNavigator->selectNextMonth(); |
1882 | } | 1895 | } |
1883 | 1896 | ||
1884 | void CalendarView::goPreviousMonth() | 1897 | void CalendarView::goPreviousMonth() |
1885 | { | 1898 | { |
1886 | mNavigator->selectPreviousMonth(); | 1899 | mNavigator->selectPreviousMonth(); |
1887 | } | 1900 | } |
1888 | void CalendarView::writeLocale() | 1901 | void CalendarView::writeLocale() |
1889 | { | 1902 | { |
1890 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 1903 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
1891 | #if 0 | 1904 | #if 0 |
1892 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 1905 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
1893 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 1906 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
1894 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 1907 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
1895 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 1908 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
1896 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1909 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1897 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 1910 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
1898 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 1911 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
1899 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 1912 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
1900 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 1913 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
1901 | KOPrefs::instance()->mDaylightsavingStart, | 1914 | KOPrefs::instance()->mDaylightsavingStart, |
1902 | KOPrefs::instance()->mDaylightsavingEnd ); | 1915 | KOPrefs::instance()->mDaylightsavingEnd ); |
1903 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); | 1916 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); |
1904 | #endif | 1917 | #endif |
1905 | } | 1918 | } |
1906 | void CalendarView::updateConfig() | 1919 | void CalendarView::updateConfig() |
1907 | { | 1920 | { |
1908 | writeLocale(); | 1921 | writeLocale(); |
1909 | if ( KOPrefs::instance()->mUseAppColors ) | 1922 | if ( KOPrefs::instance()->mUseAppColors ) |
1910 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 1923 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
1911 | emit configChanged(); | 1924 | emit configChanged(); |
1912 | mTodoList->updateConfig(); | 1925 | mTodoList->updateConfig(); |
1913 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 1926 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
1914 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1927 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1915 | // To make the "fill window" configurations work | 1928 | // To make the "fill window" configurations work |
1916 | //mViewManager->raiseCurrentView(); | 1929 | //mViewManager->raiseCurrentView(); |
1917 | } | 1930 | } |
1918 | 1931 | ||
1919 | 1932 | ||
1920 | void CalendarView::eventChanged(Event *event) | 1933 | void CalendarView::eventChanged(Event *event) |
1921 | { | 1934 | { |
1922 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1935 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1923 | //updateUnmanagedViews(); | 1936 | //updateUnmanagedViews(); |
1924 | } | 1937 | } |
1925 | 1938 | ||
1926 | void CalendarView::eventAdded(Event *event) | 1939 | void CalendarView::eventAdded(Event *event) |
1927 | { | 1940 | { |
1928 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1941 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1929 | } | 1942 | } |
1930 | 1943 | ||
1931 | void CalendarView::eventToBeDeleted(Event *) | 1944 | void CalendarView::eventToBeDeleted(Event *) |
1932 | { | 1945 | { |
1933 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 1946 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
1934 | } | 1947 | } |
1935 | 1948 | ||
1936 | void CalendarView::eventDeleted() | 1949 | void CalendarView::eventDeleted() |
1937 | { | 1950 | { |
1938 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1951 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1939 | } | 1952 | } |
1940 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1953 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
1941 | { | 1954 | { |
1942 | changeIncidenceDisplay((Incidence *)which, action); | 1955 | changeIncidenceDisplay((Incidence *)which, action); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index a3315ad..355bb84 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,558 +1,559 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | class QSplitter; | 46 | class QSplitter; |
47 | 47 | ||
48 | class CalPrinter; | 48 | class CalPrinter; |
49 | class KOFilterView; | 49 | class KOFilterView; |
50 | class KOViewManager; | 50 | class KOViewManager; |
51 | class KODialogManager; | 51 | class KODialogManager; |
52 | class KOTodoView; | 52 | class KOTodoView; |
53 | class KDateNavigator; | 53 | class KDateNavigator; |
54 | class DateNavigator; | 54 | class DateNavigator; |
55 | class KOIncidenceEditor; | 55 | class KOIncidenceEditor; |
56 | class KDatePicker; | 56 | class KDatePicker; |
57 | class ResourceView; | 57 | class ResourceView; |
58 | class NavigatorBar; | 58 | class NavigatorBar; |
59 | class KOEventEditor; | 59 | class KOEventEditor; |
60 | class KOTodoEditor ; | 60 | class KOTodoEditor ; |
61 | class KOEventViewerDialog; | 61 | class KOEventViewerDialog; |
62 | class KOBeamPrefs; | 62 | class KOBeamPrefs; |
63 | class KSyncProfile; | 63 | class KSyncProfile; |
64 | class AlarmDialog; | 64 | class AlarmDialog; |
65 | class KCal::Attendee; | 65 | class KCal::Attendee; |
66 | 66 | ||
67 | namespace KCal { class FileStorage; } | 67 | namespace KCal { class FileStorage; } |
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | void setupExternSyncProfiles(); | 116 | void setupExternSyncProfiles(); |
117 | 117 | ||
118 | signals: | 118 | signals: |
119 | /** This todo has been modified */ | 119 | /** This todo has been modified */ |
120 | void todoModified(Todo *, int); | 120 | void todoModified(Todo *, int); |
121 | 121 | ||
122 | /** when change is made to options dialog, the topwidget will catch this | 122 | /** when change is made to options dialog, the topwidget will catch this |
123 | * and emit this signal which notifies all widgets which have registered | 123 | * and emit this signal which notifies all widgets which have registered |
124 | * for notification to update their settings. */ | 124 | * for notification to update their settings. */ |
125 | void configChanged(); | 125 | void configChanged(); |
126 | /** emitted when the topwidget is closing down, so that any attached | 126 | /** emitted when the topwidget is closing down, so that any attached |
127 | child windows can also close. */ | 127 | child windows can also close. */ |
128 | void closingDown(); | 128 | void closingDown(); |
129 | /** emitted right before we die */ | 129 | /** emitted right before we die */ |
130 | void closed(QWidget *); | 130 | void closed(QWidget *); |
131 | 131 | ||
132 | /** Emitted when state of modified flag changes */ | 132 | /** Emitted when state of modified flag changes */ |
133 | void modifiedChanged(bool); | 133 | void modifiedChanged(bool); |
134 | void signalmodified(); | 134 | void signalmodified(); |
135 | 135 | ||
136 | /** Emitted when state of read-only flag changes */ | 136 | /** Emitted when state of read-only flag changes */ |
137 | void readOnlyChanged(bool); | 137 | void readOnlyChanged(bool); |
138 | 138 | ||
139 | /** Emitted when the unit of navigation changes */ | 139 | /** Emitted when the unit of navigation changes */ |
140 | void changeNavStringPrev(const QString &); | 140 | void changeNavStringPrev(const QString &); |
141 | void changeNavStringNext(const QString &); | 141 | void changeNavStringNext(const QString &); |
142 | 142 | ||
143 | /** Emitted when state of events selection has changed and user is organizer*/ | 143 | /** Emitted when state of events selection has changed and user is organizer*/ |
144 | void organizerEventsSelected(bool); | 144 | void organizerEventsSelected(bool); |
145 | /** Emitted when state of events selection has changed and user is attendee*/ | 145 | /** Emitted when state of events selection has changed and user is attendee*/ |
146 | void groupEventsSelected(bool); | 146 | void groupEventsSelected(bool); |
147 | /** | 147 | /** |
148 | Emitted when an incidence gets selected. If the selection is cleared the | 148 | Emitted when an incidence gets selected. If the selection is cleared the |
149 | signal is emitted with 0 as argument. | 149 | signal is emitted with 0 as argument. |
150 | */ | 150 | */ |
151 | void incidenceSelected( Incidence * ); | 151 | void incidenceSelected( Incidence * ); |
152 | /** Emitted, when a todoitem is selected or deselected. */ | 152 | /** Emitted, when a todoitem is selected or deselected. */ |
153 | void todoSelected( bool ); | 153 | void todoSelected( bool ); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Emitted, when clipboard content changes. Parameter indicates if paste | 156 | Emitted, when clipboard content changes. Parameter indicates if paste |
157 | is possible or not. | 157 | is possible or not. |
158 | */ | 158 | */ |
159 | void pasteEnabled(bool); | 159 | void pasteEnabled(bool); |
160 | 160 | ||
161 | /** Emitted, when the number of incoming messages has changed. */ | 161 | /** Emitted, when the number of incoming messages has changed. */ |
162 | void numIncomingChanged(int); | 162 | void numIncomingChanged(int); |
163 | 163 | ||
164 | /** Emitted, when the number of outgoing messages has changed. */ | 164 | /** Emitted, when the number of outgoing messages has changed. */ |
165 | void numOutgoingChanged(int); | 165 | void numOutgoingChanged(int); |
166 | 166 | ||
167 | /** Send status message, which can e.g. be displayed in the status bar. */ | 167 | /** Send status message, which can e.g. be displayed in the status bar. */ |
168 | void statusMessage(const QString &); | 168 | void statusMessage(const QString &); |
169 | 169 | ||
170 | void calendarViewExpanded( bool ); | 170 | void calendarViewExpanded( bool ); |
171 | void updateSearchDialog(); | 171 | void updateSearchDialog(); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void watchSavedFile(); | ||
175 | void recheckTimerAlarm(); | 176 | void recheckTimerAlarm(); |
176 | void checkNextTimerAlarm(); | 177 | void checkNextTimerAlarm(); |
177 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 178 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
178 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
179 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 180 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | 181 | ||
181 | /** options dialog made a changed to the configuration. we catch this | 182 | /** options dialog made a changed to the configuration. we catch this |
182 | * and notify all widgets which need to update their configuration. */ | 183 | * and notify all widgets which need to update their configuration. */ |
183 | void updateConfig(); | 184 | void updateConfig(); |
184 | 185 | ||
185 | /** | 186 | /** |
186 | Load calendar from file \a filename. If \a merge is true, load | 187 | Load calendar from file \a filename. If \a merge is true, load |
187 | calendar into existing one, if it is false, clear calendar, before | 188 | calendar into existing one, if it is false, clear calendar, before |
188 | loading. Return true, if calendar could be successfully loaded. | 189 | loading. Return true, if calendar could be successfully loaded. |
189 | */ | 190 | */ |
190 | bool openCalendar(QString filename, bool merge=false); | 191 | bool openCalendar(QString filename, bool merge=false); |
191 | bool syncCalendar(QString filename,int mode = 0 ); | 192 | bool syncCalendar(QString filename,int mode = 0 ); |
192 | 193 | ||
193 | /** | 194 | /** |
194 | Save calendar data to file. Return true if calendar could be | 195 | Save calendar data to file. Return true if calendar could be |
195 | successfully saved. | 196 | successfully saved. |
196 | */ | 197 | */ |
197 | bool saveCalendar(QString filename); | 198 | bool saveCalendar(QString filename); |
198 | 199 | ||
199 | /** | 200 | /** |
200 | Close calendar. Clear calendar data and reset views to display an empty | 201 | Close calendar. Clear calendar data and reset views to display an empty |
201 | calendar. | 202 | calendar. |
202 | */ | 203 | */ |
203 | void closeCalendar(); | 204 | void closeCalendar(); |
204 | 205 | ||
205 | /** Archive old events of calendar */ | 206 | /** Archive old events of calendar */ |
206 | void archiveCalendar(); | 207 | void archiveCalendar(); |
207 | 208 | ||
208 | void showIncidence(); | 209 | void showIncidence(); |
209 | void editIncidence(); | 210 | void editIncidence(); |
210 | void editIncidenceDescription(); | 211 | void editIncidenceDescription(); |
211 | void deleteIncidence(); | 212 | void deleteIncidence(); |
212 | 213 | ||
213 | /** create an editeventwin with supplied date/time, and if bool is true, | 214 | /** create an editeventwin with supplied date/time, and if bool is true, |
214 | * make the event take all day. */ | 215 | * make the event take all day. */ |
215 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 216 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
216 | void newEvent(QDateTime fh); | 217 | void newEvent(QDateTime fh); |
217 | void newEvent(QDate dt); | 218 | void newEvent(QDate dt); |
218 | /** create new event without having a date hint. Takes current date as | 219 | /** create new event without having a date hint. Takes current date as |
219 | default hint. */ | 220 | default hint. */ |
220 | void newEvent(); | 221 | void newEvent(); |
221 | void newFloatingEvent(); | 222 | void newFloatingEvent(); |
222 | 223 | ||
223 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 224 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
224 | void showIncidence(Incidence *); | 225 | void showIncidence(Incidence *); |
225 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 226 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
226 | void editIncidence(Incidence *); | 227 | void editIncidence(Incidence *); |
227 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 228 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
228 | void deleteIncidence(Incidence *); | 229 | void deleteIncidence(Incidence *); |
229 | void cloneIncidence(Incidence *); | 230 | void cloneIncidence(Incidence *); |
230 | void cancelIncidence(Incidence *); | 231 | void cancelIncidence(Incidence *); |
231 | /** Create an editor for the supplied event. */ | 232 | /** Create an editor for the supplied event. */ |
232 | void editEvent(Event *); | 233 | void editEvent(Event *); |
233 | /** Delete the supplied event. */ | 234 | /** Delete the supplied event. */ |
234 | void deleteEvent(Event *); | 235 | void deleteEvent(Event *); |
235 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 236 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
236 | found. */ | 237 | found. */ |
237 | bool deleteEvent(const QString &uid); | 238 | bool deleteEvent(const QString &uid); |
238 | /** Create a read-only viewer dialog for the supplied event. */ | 239 | /** Create a read-only viewer dialog for the supplied event. */ |
239 | void showEvent(Event *); | 240 | void showEvent(Event *); |
240 | 241 | ||
241 | void editJournal(Journal *); | 242 | void editJournal(Journal *); |
242 | void showJournal(Journal *); | 243 | void showJournal(Journal *); |
243 | void deleteJournal(Journal *); | 244 | void deleteJournal(Journal *); |
244 | /** Create an editor dialog for a todo */ | 245 | /** Create an editor dialog for a todo */ |
245 | void editTodo(Todo *); | 246 | void editTodo(Todo *); |
246 | /** Create a read-only viewer dialog for the supplied todo */ | 247 | /** Create a read-only viewer dialog for the supplied todo */ |
247 | void showTodo(Todo *); | 248 | void showTodo(Todo *); |
248 | /** create new todo */ | 249 | /** create new todo */ |
249 | void newTodo(); | 250 | void newTodo(); |
250 | /** create new todo with a parent todo */ | 251 | /** create new todo with a parent todo */ |
251 | void newSubTodo(); | 252 | void newSubTodo(); |
252 | /** create new todo with a parent todo */ | 253 | /** create new todo with a parent todo */ |
253 | void newSubTodo(Todo *); | 254 | void newSubTodo(Todo *); |
254 | /** Delete todo */ | 255 | /** Delete todo */ |
255 | void deleteTodo(Todo *); | 256 | void deleteTodo(Todo *); |
256 | 257 | ||
257 | 258 | ||
258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 259 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
259 | * emitted as result. */ | 260 | * emitted as result. */ |
260 | void checkClipboard(); | 261 | void checkClipboard(); |
261 | 262 | ||
262 | /** using the KConfig associated with the kapp variable, read in the | 263 | /** using the KConfig associated with the kapp variable, read in the |
263 | * settings from the config file. | 264 | * settings from the config file. |
264 | */ | 265 | */ |
265 | void readSettings(); | 266 | void readSettings(); |
266 | 267 | ||
267 | /** write current state to config file. */ | 268 | /** write current state to config file. */ |
268 | void writeSettings(); | 269 | void writeSettings(); |
269 | 270 | ||
270 | /** read settings for calendar filters */ | 271 | /** read settings for calendar filters */ |
271 | void readFilterSettings(KConfig *config); | 272 | void readFilterSettings(KConfig *config); |
272 | 273 | ||
273 | /** write settings for calendar filters */ | 274 | /** write settings for calendar filters */ |
274 | void writeFilterSettings(KConfig *config); | 275 | void writeFilterSettings(KConfig *config); |
275 | 276 | ||
276 | /** passes on the message that an event has changed to the currently | 277 | /** passes on the message that an event has changed to the currently |
277 | * activated view so that it can make appropriate display changes. */ | 278 | * activated view so that it can make appropriate display changes. */ |
278 | void changeEventDisplay(Event *, int); | 279 | void changeEventDisplay(Event *, int); |
279 | void changeIncidenceDisplay(Incidence *, int); | 280 | void changeIncidenceDisplay(Incidence *, int); |
280 | void changeTodoDisplay(Todo *, int); | 281 | void changeTodoDisplay(Todo *, int); |
281 | 282 | ||
282 | void eventAdded(Event *); | 283 | void eventAdded(Event *); |
283 | void eventChanged(Event *); | 284 | void eventChanged(Event *); |
284 | void eventToBeDeleted(Event *); | 285 | void eventToBeDeleted(Event *); |
285 | void eventDeleted(); | 286 | void eventDeleted(); |
286 | 287 | ||
287 | void todoAdded(Todo *); | 288 | void todoAdded(Todo *); |
288 | void todoChanged(Todo *); | 289 | void todoChanged(Todo *); |
289 | void todoToBeDeleted(Todo *); | 290 | void todoToBeDeleted(Todo *); |
290 | void todoDeleted(); | 291 | void todoDeleted(); |
291 | 292 | ||
292 | void updateView(const QDate &start, const QDate &end); | 293 | void updateView(const QDate &start, const QDate &end); |
293 | void updateView(); | 294 | void updateView(); |
294 | 295 | ||
295 | /** Full update of visible todo views */ | 296 | /** Full update of visible todo views */ |
296 | void updateTodoViews(); | 297 | void updateTodoViews(); |
297 | 298 | ||
298 | void updateUnmanagedViews(); | 299 | void updateUnmanagedViews(); |
299 | 300 | ||
300 | /** cut the current appointment to the clipboard */ | 301 | /** cut the current appointment to the clipboard */ |
301 | void edit_cut(); | 302 | void edit_cut(); |
302 | 303 | ||
303 | /** copy the current appointment(s) to the clipboard */ | 304 | /** copy the current appointment(s) to the clipboard */ |
304 | void edit_copy(); | 305 | void edit_copy(); |
305 | 306 | ||
306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 307 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
307 | void edit_paste(); | 308 | void edit_paste(); |
308 | 309 | ||
309 | /** edit viewing and configuration options. */ | 310 | /** edit viewing and configuration options. */ |
310 | void edit_options(); | 311 | void edit_options(); |
311 | void edit_sync_options(); | 312 | void edit_sync_options(); |
312 | /** | 313 | /** |
313 | Functions for printing, previewing a print, and setting up printing | 314 | Functions for printing, previewing a print, and setting up printing |
314 | parameters. | 315 | parameters. |
315 | */ | 316 | */ |
316 | void print(); | 317 | void print(); |
317 | void printSetup(); | 318 | void printSetup(); |
318 | void printPreview(); | 319 | void printPreview(); |
319 | 320 | ||
320 | /** Export as iCalendar file */ | 321 | /** Export as iCalendar file */ |
321 | void exportICalendar(); | 322 | void exportICalendar(); |
322 | 323 | ||
323 | /** Export as vCalendar file */ | 324 | /** Export as vCalendar file */ |
324 | bool exportVCalendar( QString fn); | 325 | bool exportVCalendar( QString fn); |
325 | 326 | ||
326 | /** pop up a dialog to show an existing appointment. */ | 327 | /** pop up a dialog to show an existing appointment. */ |
327 | void appointment_show(); | 328 | void appointment_show(); |
328 | /** | 329 | /** |
329 | * pop up an Appointment Dialog to edit an existing appointment.Get | 330 | * pop up an Appointment Dialog to edit an existing appointment.Get |
330 | * information on the appointment from the list of unique IDs that is | 331 | * information on the appointment from the list of unique IDs that is |
331 | * currently in the View, called currIds. | 332 | * currently in the View, called currIds. |
332 | */ | 333 | */ |
333 | void appointment_edit(); | 334 | void appointment_edit(); |
334 | /** | 335 | /** |
335 | * pop up dialog confirming deletion of currently selected event in the | 336 | * pop up dialog confirming deletion of currently selected event in the |
336 | * View. | 337 | * View. |
337 | */ | 338 | */ |
338 | void appointment_delete(); | 339 | void appointment_delete(); |
339 | 340 | ||
340 | /** mails the currently selected event to a particular user as a vCalendar | 341 | /** mails the currently selected event to a particular user as a vCalendar |
341 | attachment. */ | 342 | attachment. */ |
342 | void action_mail(); | 343 | void action_mail(); |
343 | 344 | ||
344 | /* frees a subtodo from it's relation */ | 345 | /* frees a subtodo from it's relation */ |
345 | void todo_unsub( Todo * ); | 346 | void todo_unsub( Todo * ); |
346 | 347 | ||
347 | /** Take ownership of selected event. */ | 348 | /** Take ownership of selected event. */ |
348 | void takeOverEvent(); | 349 | void takeOverEvent(); |
349 | 350 | ||
350 | /** Take ownership of all events in calendar. */ | 351 | /** Take ownership of all events in calendar. */ |
351 | void takeOverCalendar(); | 352 | void takeOverCalendar(); |
352 | 353 | ||
353 | /** query whether or not the calendar is "dirty". */ | 354 | /** query whether or not the calendar is "dirty". */ |
354 | bool isModified(); | 355 | bool isModified(); |
355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 356 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
356 | void setModified(bool modified=true); | 357 | void setModified(bool modified=true); |
357 | 358 | ||
358 | /** query if the calendar is read-only. */ | 359 | /** query if the calendar is read-only. */ |
359 | bool isReadOnly(); | 360 | bool isReadOnly(); |
360 | /** set state of calendar to read-only */ | 361 | /** set state of calendar to read-only */ |
361 | void setReadOnly(bool readOnly=true); | 362 | void setReadOnly(bool readOnly=true); |
362 | 363 | ||
363 | void eventUpdated(Incidence *); | 364 | void eventUpdated(Incidence *); |
364 | 365 | ||
365 | /* iTIP scheduling actions */ | 366 | /* iTIP scheduling actions */ |
366 | void schedule_publish(Incidence *incidence = 0); | 367 | void schedule_publish(Incidence *incidence = 0); |
367 | void schedule_request(Incidence *incidence = 0); | 368 | void schedule_request(Incidence *incidence = 0); |
368 | void schedule_refresh(Incidence *incidence = 0); | 369 | void schedule_refresh(Incidence *incidence = 0); |
369 | void schedule_cancel(Incidence *incidence = 0); | 370 | void schedule_cancel(Incidence *incidence = 0); |
370 | void schedule_add(Incidence *incidence = 0); | 371 | void schedule_add(Incidence *incidence = 0); |
371 | void schedule_reply(Incidence *incidence = 0); | 372 | void schedule_reply(Incidence *incidence = 0); |
372 | void schedule_counter(Incidence *incidence = 0); | 373 | void schedule_counter(Incidence *incidence = 0); |
373 | void schedule_declinecounter(Incidence *incidence = 0); | 374 | void schedule_declinecounter(Incidence *incidence = 0); |
374 | void schedule_publish_freebusy(int daysToPublish = 30); | 375 | void schedule_publish_freebusy(int daysToPublish = 30); |
375 | 376 | ||
376 | void openAddressbook(); | 377 | void openAddressbook(); |
377 | 378 | ||
378 | void editFilters(); | 379 | void editFilters(); |
379 | void toggleFilerEnabled(); | 380 | void toggleFilerEnabled(); |
380 | QPtrList<CalFilter> filters(); | 381 | QPtrList<CalFilter> filters(); |
381 | void toggleFilter(); | 382 | void toggleFilter(); |
382 | void showFilter(bool visible); | 383 | void showFilter(bool visible); |
383 | void updateFilter(); | 384 | void updateFilter(); |
384 | void filterEdited(); | 385 | void filterEdited(); |
385 | void selectFilter( int ); | 386 | void selectFilter( int ); |
386 | KOFilterView *filterView(); | 387 | KOFilterView *filterView(); |
387 | 388 | ||
388 | void showIntro(); | 389 | void showIntro(); |
389 | 390 | ||
390 | /** Move the curdatepient view date to today */ | 391 | /** Move the curdatepient view date to today */ |
391 | void goToday(); | 392 | void goToday(); |
392 | 393 | ||
393 | /** Move to the next date(s) in the current view */ | 394 | /** Move to the next date(s) in the current view */ |
394 | void goNext(); | 395 | void goNext(); |
395 | 396 | ||
396 | /** Move to the previous date(s) in the current view */ | 397 | /** Move to the previous date(s) in the current view */ |
397 | void goPrevious(); | 398 | void goPrevious(); |
398 | /** Move to the next date(s) in the current view */ | 399 | /** Move to the next date(s) in the current view */ |
399 | void goNextMonth(); | 400 | void goNextMonth(); |
400 | 401 | ||
401 | /** Move to the previous date(s) in the current view */ | 402 | /** Move to the previous date(s) in the current view */ |
402 | void goPreviousMonth(); | 403 | void goPreviousMonth(); |
403 | 404 | ||
404 | void toggleExpand(); | 405 | void toggleExpand(); |
405 | void toggleDateNavigatorWidget(); | 406 | void toggleDateNavigatorWidget(); |
406 | void toggleAllDaySize(); | 407 | void toggleAllDaySize(); |
407 | void dialogClosing(Incidence *); | 408 | void dialogClosing(Incidence *); |
408 | 409 | ||
409 | /** Look for new messages in the inbox */ | 410 | /** Look for new messages in the inbox */ |
410 | void lookForIncomingMessages(); | 411 | void lookForIncomingMessages(); |
411 | /** Look for new messages in the outbox */ | 412 | /** Look for new messages in the outbox */ |
412 | void lookForOutgoingMessages(); | 413 | void lookForOutgoingMessages(); |
413 | 414 | ||
414 | void processMainViewSelection( Incidence * ); | 415 | void processMainViewSelection( Incidence * ); |
415 | void processTodoListSelection( Incidence * ); | 416 | void processTodoListSelection( Incidence * ); |
416 | 417 | ||
417 | void processIncidenceSelection( Incidence * ); | 418 | void processIncidenceSelection( Incidence * ); |
418 | 419 | ||
419 | void purgeCompleted(); | 420 | void purgeCompleted(); |
420 | bool removeCompletedSubTodos( Todo* ); | 421 | bool removeCompletedSubTodos( Todo* ); |
421 | void slotCalendarChanged(); | 422 | void slotCalendarChanged(); |
422 | bool importBday(); | 423 | bool importBday(); |
423 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 424 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
424 | bool importQtopia( const QString &categoriesFile, | 425 | bool importQtopia( const QString &categoriesFile, |
425 | const QString &datebookFile, | 426 | const QString &datebookFile, |
426 | const QString &tasklistFile ); | 427 | const QString &tasklistFile ); |
427 | void syncSharp( ); | 428 | void syncSharp( ); |
428 | void syncPhone( ); | 429 | void syncPhone( ); |
429 | void syncExternal( int mode ); | 430 | void syncExternal( int mode ); |
430 | void slotSelectPickerDate( QDate ) ; | 431 | void slotSelectPickerDate( QDate ) ; |
431 | void showDatePicker( ) ; | 432 | void showDatePicker( ) ; |
432 | void moveIncidence(Incidence *) ; | 433 | void moveIncidence(Incidence *) ; |
433 | void beamIncidence(Incidence *) ; | 434 | void beamIncidence(Incidence *) ; |
434 | void beamCalendar() ; | 435 | void beamCalendar() ; |
435 | void beamFilteredCalendar() ; | 436 | void beamFilteredCalendar() ; |
436 | void beamIncidenceList(QPtrList<Incidence>) ; | 437 | void beamIncidenceList(QPtrList<Incidence>) ; |
437 | void manageCategories(); | 438 | void manageCategories(); |
438 | int addCategories(); | 439 | int addCategories(); |
439 | void removeCategories(); | 440 | void removeCategories(); |
440 | void setSyncDevice( QString ); | 441 | void setSyncDevice( QString ); |
441 | void setSyncName( QString ); | 442 | void setSyncName( QString ); |
442 | protected slots: | 443 | protected slots: |
443 | void timerAlarm(); | 444 | void timerAlarm(); |
444 | void suspendAlarm(); | 445 | void suspendAlarm(); |
445 | void beamDone( Ir *ir ); | 446 | void beamDone( Ir *ir ); |
446 | /** Select a view or adapt the current view to display the specified dates. */ | 447 | /** Select a view or adapt the current view to display the specified dates. */ |
447 | void showDates( const KCal::DateList & ); | 448 | void showDates( const KCal::DateList & ); |
448 | void selectWeekNum ( int ); | 449 | void selectWeekNum ( int ); |
449 | 450 | ||
450 | public: | 451 | public: |
451 | // show a standard warning | 452 | // show a standard warning |
452 | // returns KMsgBox::yesNoCancel() | 453 | // returns KMsgBox::yesNoCancel() |
453 | int msgCalModified(); | 454 | int msgCalModified(); |
454 | void confSync(); | 455 | void confSync(); |
455 | void setLoadedFileVersion(QDateTime); | 456 | void setLoadedFileVersion(QDateTime); |
456 | bool checkFileVersion(QString fn); | 457 | bool checkFileVersion(QString fn); |
457 | bool checkFileChanged(QString fn); | 458 | bool checkFileChanged(QString fn); |
458 | Event* getLastSyncEvent(); | 459 | Event* getLastSyncEvent(); |
459 | /** Adapt navigation units correpsonding to step size of navigation of the | 460 | /** Adapt navigation units correpsonding to step size of navigation of the |
460 | * current view. | 461 | * current view. |
461 | */ | 462 | */ |
462 | void adaptNavigationUnits(); | 463 | void adaptNavigationUnits(); |
463 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 464 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
464 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 465 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
465 | //Attendee* getYourAttendee(Event *event); | 466 | //Attendee* getYourAttendee(Event *event); |
466 | protected: | 467 | protected: |
467 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 468 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
468 | 469 | ||
469 | // returns KMsgBox::OKCandel() | 470 | // returns KMsgBox::OKCandel() |
470 | int msgItemDelete(); | 471 | int msgItemDelete(); |
471 | void showEventEditor(); | 472 | void showEventEditor(); |
472 | void showTodoEditor(); | 473 | void showTodoEditor(); |
473 | void writeLocale(); | 474 | void writeLocale(); |
474 | Todo *selectedTodo(); | 475 | Todo *selectedTodo(); |
475 | 476 | ||
476 | private: | 477 | private: |
477 | AlarmDialog * mAlarmDialog; | 478 | AlarmDialog * mAlarmDialog; |
478 | QString mAlarmNotification; | 479 | QString mAlarmNotification; |
479 | QString mSuspendAlarmNotification; | 480 | QString mSuspendAlarmNotification; |
480 | QTimer* mSuspendTimer; | 481 | QTimer* mSuspendTimer; |
481 | QTimer* mAlarmTimer; | 482 | QTimer* mAlarmTimer; |
482 | QTimer* mRecheckAlarmTimer; | 483 | QTimer* mRecheckAlarmTimer; |
483 | void computeAlarm( QString ); | 484 | void computeAlarm( QString ); |
484 | void startAlarm( QString, QString ); | 485 | void startAlarm( QString, QString ); |
485 | void setSyncEventsReadOnly(); | 486 | void setSyncEventsReadOnly(); |
486 | 487 | ||
487 | QDateTime loadedFileVersion; | 488 | QDateTime loadedFileVersion; |
488 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 489 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
489 | void checkExternalId( Incidence * inc ); | 490 | void checkExternalId( Incidence * inc ); |
490 | int mGlobalSyncMode; | 491 | int mGlobalSyncMode; |
491 | QString mCurrentSyncDevice; | 492 | QString mCurrentSyncDevice; |
492 | QString mCurrentSyncName; | 493 | QString mCurrentSyncName; |
493 | KOBeamPrefs* beamDialog; | 494 | KOBeamPrefs* beamDialog; |
494 | void init(); | 495 | void init(); |
495 | int mDatePickerMode; | 496 | int mDatePickerMode; |
496 | bool mFlagEditDescription; | 497 | bool mFlagEditDescription; |
497 | QDateTime mLastCalendarSync; | 498 | QDateTime mLastCalendarSync; |
498 | void createPrinter(); | 499 | void createPrinter(); |
499 | 500 | ||
500 | void calendarModified( bool, Calendar * ); | 501 | void calendarModified( bool, Calendar * ); |
501 | 502 | ||
502 | CalPrinter *mCalPrinter; | 503 | CalPrinter *mCalPrinter; |
503 | 504 | ||
504 | QSplitter *mPanner; | 505 | QSplitter *mPanner; |
505 | QSplitter *mLeftSplitter; | 506 | QSplitter *mLeftSplitter; |
506 | QWidget *mLeftFrame; | 507 | QWidget *mLeftFrame; |
507 | QWidgetStack *mRightFrame; | 508 | QWidgetStack *mRightFrame; |
508 | 509 | ||
509 | KDatePicker* mDatePicker; | 510 | KDatePicker* mDatePicker; |
510 | QVBox* mDateFrame; | 511 | QVBox* mDateFrame; |
511 | NavigatorBar *mNavigatorBar; | 512 | NavigatorBar *mNavigatorBar; |
512 | 513 | ||
513 | KDateNavigator *mDateNavigator; // widget showing small month view. | 514 | KDateNavigator *mDateNavigator; // widget showing small month view. |
514 | 515 | ||
515 | KOFilterView *mFilterView; | 516 | KOFilterView *mFilterView; |
516 | 517 | ||
517 | ResourceView *mResourceView; | 518 | ResourceView *mResourceView; |
518 | 519 | ||
519 | // calendar object for this viewing instance | 520 | // calendar object for this viewing instance |
520 | Calendar *mCalendar; | 521 | Calendar *mCalendar; |
521 | 522 | ||
522 | CalendarResourceManager *mResourceManager; | 523 | CalendarResourceManager *mResourceManager; |
523 | 524 | ||
524 | FileStorage *mStorage; | 525 | FileStorage *mStorage; |
525 | 526 | ||
526 | DateNavigator *mNavigator; | 527 | DateNavigator *mNavigator; |
527 | 528 | ||
528 | KOViewManager *mViewManager; | 529 | KOViewManager *mViewManager; |
529 | KODialogManager *mDialogManager; | 530 | KODialogManager *mDialogManager; |
530 | 531 | ||
531 | // Calendar filters | 532 | // Calendar filters |
532 | QPtrList<CalFilter> mFilters; | 533 | QPtrList<CalFilter> mFilters; |
533 | 534 | ||
534 | // various housekeeping variables. | 535 | // various housekeeping variables. |
535 | bool mModified; // flag indicating if calendar is modified | 536 | bool mModified; // flag indicating if calendar is modified |
536 | bool mReadOnly; // flag indicating if calendar is read-only | 537 | bool mReadOnly; // flag indicating if calendar is read-only |
537 | QDate mSaveSingleDate; | 538 | QDate mSaveSingleDate; |
538 | 539 | ||
539 | Incidence *mSelectedIncidence; | 540 | Incidence *mSelectedIncidence; |
540 | Incidence *mMoveIncidence; | 541 | Incidence *mMoveIncidence; |
541 | QPtrList<Event> mExternLastSyncEvent; | 542 | QPtrList<Event> mExternLastSyncEvent; |
542 | KOTodoView *mTodoList; | 543 | KOTodoView *mTodoList; |
543 | KOEventEditor * mEventEditor; | 544 | KOEventEditor * mEventEditor; |
544 | KOTodoEditor * mTodoEditor; | 545 | KOTodoEditor * mTodoEditor; |
545 | KOEventViewerDialog * mEventViewerDialog; | 546 | KOEventViewerDialog * mEventViewerDialog; |
546 | void keyPressEvent ( QKeyEvent *e) ; | 547 | void keyPressEvent ( QKeyEvent *e) ; |
547 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 548 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
548 | }; | 549 | }; |
549 | 550 | ||
550 | 551 | ||
551 | class CalendarViewVisitor : public Incidence::Visitor | 552 | class CalendarViewVisitor : public Incidence::Visitor |
552 | { | 553 | { |
553 | public: | 554 | public: |
554 | CalendarViewVisitor() : mView( 0 ) {} | 555 | CalendarViewVisitor() : mView( 0 ) {} |
555 | 556 | ||
556 | bool act( Incidence *incidence, CalendarView *view ) | 557 | bool act( Incidence *incidence, CalendarView *view ) |
557 | { | 558 | { |
558 | mView = view; | 559 | mView = view; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 1c4a186..6315c64 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1027,772 +1027,773 @@ void MainWindow::slotSyncMenu( int action ) | |||
1027 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 1027 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
1028 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 1028 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
1029 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 1029 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
1030 | KOPrefs::instance()->mWriteBackInFuture = 0; | 1030 | KOPrefs::instance()->mWriteBackInFuture = 0; |
1031 | if ( temp->getWriteBackFuture() ) | 1031 | if ( temp->getWriteBackFuture() ) |
1032 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 1032 | KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
1033 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 1033 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
1034 | if ( action == 1000 ) { | 1034 | if ( action == 1000 ) { |
1035 | syncSharp(); | 1035 | syncSharp(); |
1036 | 1036 | ||
1037 | } else if ( action == 1001 ) { | 1037 | } else if ( action == 1001 ) { |
1038 | syncLocalFile(); | 1038 | syncLocalFile(); |
1039 | 1039 | ||
1040 | } else if ( action == 1002 ) { | 1040 | } else if ( action == 1002 ) { |
1041 | quickSyncLocalFile(); | 1041 | quickSyncLocalFile(); |
1042 | 1042 | ||
1043 | } else if ( action >= 1003 ) { | 1043 | } else if ( action >= 1003 ) { |
1044 | if ( temp->getIsLocalFileSync() ) { | 1044 | if ( temp->getIsLocalFileSync() ) { |
1045 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 1045 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
1046 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1046 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
1047 | } else { | 1047 | } else { |
1048 | if ( temp->getIsPhoneSync() ) { | 1048 | if ( temp->getIsPhoneSync() ) { |
1049 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | 1049 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; |
1050 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | 1050 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); |
1051 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | 1051 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); |
1052 | syncPhone(); | 1052 | syncPhone(); |
1053 | } else | 1053 | } else |
1054 | syncRemote( temp ); | 1054 | syncRemote( temp ); |
1055 | 1055 | ||
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | delete temp; | 1058 | delete temp; |
1059 | mBlockSaveFlag = false; | 1059 | mBlockSaveFlag = false; |
1060 | } | 1060 | } |
1061 | void MainWindow::setDefaultPreferences() | 1061 | void MainWindow::setDefaultPreferences() |
1062 | { | 1062 | { |
1063 | KOPrefs *p = KOPrefs::instance(); | 1063 | KOPrefs *p = KOPrefs::instance(); |
1064 | 1064 | ||
1065 | p->mCompactDialogs = true; | 1065 | p->mCompactDialogs = true; |
1066 | p->mConfirm = true; | 1066 | p->mConfirm = true; |
1067 | // p->mEnableQuickTodo = false; | 1067 | // p->mEnableQuickTodo = false; |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | QString MainWindow::resourcePath() | 1070 | QString MainWindow::resourcePath() |
1071 | { | 1071 | { |
1072 | return KGlobal::iconLoader()->iconPath(); | 1072 | return KGlobal::iconLoader()->iconPath(); |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | void MainWindow::displayText( QString text ,QString cap ) | 1075 | void MainWindow::displayText( QString text ,QString cap ) |
1076 | { | 1076 | { |
1077 | QDialog dia( this, "name", true ); ; | 1077 | QDialog dia( this, "name", true ); ; |
1078 | dia.setCaption( cap ); | 1078 | dia.setCaption( cap ); |
1079 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1079 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1080 | lay->setSpacing( 3 ); | 1080 | lay->setSpacing( 3 ); |
1081 | lay->setMargin( 3 ); | 1081 | lay->setMargin( 3 ); |
1082 | QTextBrowser tb ( &dia ); | 1082 | QTextBrowser tb ( &dia ); |
1083 | lay->addWidget( &tb ); | 1083 | lay->addWidget( &tb ); |
1084 | tb.setText( text ); | 1084 | tb.setText( text ); |
1085 | #ifdef DESKTOP_VERSION | 1085 | #ifdef DESKTOP_VERSION |
1086 | dia.resize( 640, 480); | 1086 | dia.resize( 640, 480); |
1087 | #else | 1087 | #else |
1088 | dia.showMaximized(); | 1088 | dia.showMaximized(); |
1089 | #endif | 1089 | #endif |
1090 | dia.exec(); | 1090 | dia.exec(); |
1091 | } | 1091 | } |
1092 | void MainWindow::displayFile( QString fn, QString cap ) | 1092 | void MainWindow::displayFile( QString fn, QString cap ) |
1093 | { | 1093 | { |
1094 | QString fileName = resourcePath() + fn; | 1094 | QString fileName = resourcePath() + fn; |
1095 | QString text; | 1095 | QString text; |
1096 | QFile file( fileName ); | 1096 | QFile file( fileName ); |
1097 | if (!file.open( IO_ReadOnly ) ) { | 1097 | if (!file.open( IO_ReadOnly ) ) { |
1098 | return ; | 1098 | return ; |
1099 | 1099 | ||
1100 | } | 1100 | } |
1101 | QTextStream ts( &file ); | 1101 | QTextStream ts( &file ); |
1102 | text = ts.read(); | 1102 | text = ts.read(); |
1103 | file.close(); | 1103 | file.close(); |
1104 | displayText( text, cap); | 1104 | displayText( text, cap); |
1105 | } | 1105 | } |
1106 | void MainWindow::features() | 1106 | void MainWindow::features() |
1107 | { | 1107 | { |
1108 | 1108 | ||
1109 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1109 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | void MainWindow::usertrans() | 1112 | void MainWindow::usertrans() |
1113 | { | 1113 | { |
1114 | 1114 | ||
1115 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1115 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1116 | } | 1116 | } |
1117 | #if 0 | 1117 | #if 0 |
1118 | #include <libkcal/vcalformat.h> | 1118 | #include <libkcal/vcalformat.h> |
1119 | #include <libkcal/event.h> | 1119 | #include <libkcal/event.h> |
1120 | #include <libkcal/todo.h> | 1120 | #include <libkcal/todo.h> |
1121 | #include <libkcal/incidence.h> | 1121 | #include <libkcal/incidence.h> |
1122 | #endif | 1122 | #endif |
1123 | void MainWindow::synchowto() | 1123 | void MainWindow::synchowto() |
1124 | { | 1124 | { |
1125 | #if 0 | 1125 | #if 0 |
1126 | QPtrList<Incidence> er = mCalendar->rawIncidences(); | 1126 | QPtrList<Incidence> er = mCalendar->rawIncidences(); |
1127 | Incidence* inR = er.first(); | 1127 | Incidence* inR = er.first(); |
1128 | VCalFormat vf; | 1128 | VCalFormat vf; |
1129 | QString strout; | 1129 | QString strout; |
1130 | while ( inR ) { | 1130 | while ( inR ) { |
1131 | if ( inR->type() == "Todo" ) | 1131 | if ( inR->type() == "Todo" ) |
1132 | strout = vf.todoToString( (Todo *) inR ); | 1132 | strout = vf.todoToString( (Todo *) inR ); |
1133 | if ( inR->type() == "Event" ) | 1133 | if ( inR->type() == "Event" ) |
1134 | strout = vf.eventToString( (Event *) inR ); | 1134 | strout = vf.eventToString( (Event *) inR ); |
1135 | qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); | 1135 | qDebug("incidence: \n%s\n ente\n\n",strout.latin1() ); |
1136 | inR = er.next(); | 1136 | inR = er.next(); |
1137 | } | 1137 | } |
1138 | #endif | 1138 | #endif |
1139 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1139 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1140 | } | 1140 | } |
1141 | void MainWindow::faq() | 1141 | void MainWindow::faq() |
1142 | { | 1142 | { |
1143 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1143 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1144 | 1144 | ||
1145 | } | 1145 | } |
1146 | void MainWindow::whatsNew() | 1146 | void MainWindow::whatsNew() |
1147 | { | 1147 | { |
1148 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1148 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1149 | 1149 | ||
1150 | } | 1150 | } |
1151 | void MainWindow::licence() | 1151 | void MainWindow::licence() |
1152 | { | 1152 | { |
1153 | KApplication::showLicence(); | 1153 | KApplication::showLicence(); |
1154 | 1154 | ||
1155 | } | 1155 | } |
1156 | void MainWindow::about() | 1156 | void MainWindow::about() |
1157 | { | 1157 | { |
1158 | QString version; | 1158 | QString version; |
1159 | #include <../version> | 1159 | #include <../version> |
1160 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1160 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1161 | i18n("KOrganizer/Platform-independent\n") + | 1161 | i18n("KOrganizer/Platform-independent\n") + |
1162 | "(KO/Pi) " + version + " - " + | 1162 | "(KO/Pi) " + version + " - " + |
1163 | 1163 | ||
1164 | #ifdef DESKTOP_VERSION | 1164 | #ifdef DESKTOP_VERSION |
1165 | i18n("Desktop Edition\n") + | 1165 | i18n("Desktop Edition\n") + |
1166 | #else | 1166 | #else |
1167 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1167 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1168 | #endif | 1168 | #endif |
1169 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1169 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1170 | } | 1170 | } |
1171 | void MainWindow::keyBindings() | 1171 | void MainWindow::keyBindings() |
1172 | { | 1172 | { |
1173 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1173 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1174 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1174 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1175 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1175 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1176 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1176 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1177 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1177 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1178 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1178 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1179 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1179 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1180 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1180 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1181 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1181 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1182 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1182 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1183 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1183 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1184 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1184 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1185 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1185 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1186 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1186 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1187 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1187 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1188 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1188 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1189 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1189 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1190 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1190 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1191 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1191 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1192 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1192 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1193 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1193 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1194 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1194 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1195 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1195 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1196 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1196 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1197 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1197 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1198 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1198 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1199 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1199 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1200 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1200 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1201 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1201 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1202 | i18n("<p><h3>In list view:</h3></p>\n") + | 1202 | i18n("<p><h3>In list view:</h3></p>\n") + |
1203 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1203 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1204 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1204 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1205 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1205 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1206 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1206 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1207 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1207 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1208 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1208 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1209 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1209 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1210 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1210 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1211 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1211 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1212 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1212 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1213 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1213 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1214 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1214 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1215 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1215 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1216 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1216 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1217 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1217 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1218 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1218 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1219 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1219 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1220 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1220 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1221 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1221 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1222 | displayText( text, cap); | 1222 | displayText( text, cap); |
1223 | 1223 | ||
1224 | } | 1224 | } |
1225 | void MainWindow::aboutAutoSaving() | 1225 | void MainWindow::aboutAutoSaving() |
1226 | { | 1226 | { |
1227 | QMessageBox* msg; | 1227 | QMessageBox* msg; |
1228 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1228 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1229 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon, | 1229 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon, |
1230 | QMessageBox::Ok, | 1230 | QMessageBox::Ok, |
1231 | QMessageBox::NoButton, | 1231 | QMessageBox::NoButton, |
1232 | QMessageBox::NoButton); | 1232 | QMessageBox::NoButton); |
1233 | msg->exec(); | 1233 | msg->exec(); |
1234 | delete msg; | 1234 | delete msg; |
1235 | 1235 | ||
1236 | 1236 | ||
1237 | } | 1237 | } |
1238 | void MainWindow::aboutKnownBugs() | 1238 | void MainWindow::aboutKnownBugs() |
1239 | { | 1239 | { |
1240 | QMessageBox* msg; | 1240 | QMessageBox* msg; |
1241 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1241 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1242 | 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")+ | 1242 | 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")+ |
1243 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1243 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1244 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1244 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1245 | i18n("\nor report them in the bugtracker on\n") + | 1245 | i18n("\nor report them in the bugtracker on\n") + |
1246 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1246 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1247 | QMessageBox::NoIcon, | 1247 | QMessageBox::NoIcon, |
1248 | QMessageBox::Ok, | 1248 | QMessageBox::Ok, |
1249 | QMessageBox::NoButton, | 1249 | QMessageBox::NoButton, |
1250 | QMessageBox::NoButton); | 1250 | QMessageBox::NoButton); |
1251 | msg->exec(); | 1251 | msg->exec(); |
1252 | delete msg; | 1252 | delete msg; |
1253 | 1253 | ||
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | QString MainWindow::defaultFileName() | 1256 | QString MainWindow::defaultFileName() |
1257 | { | 1257 | { |
1258 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1258 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1261 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1262 | { | 1262 | { |
1263 | if ( !incidence ) { | 1263 | if ( !incidence ) { |
1264 | enableIncidenceActions( false ); | 1264 | enableIncidenceActions( false ); |
1265 | 1265 | ||
1266 | mNewSubTodoAction->setEnabled( false ); | 1266 | mNewSubTodoAction->setEnabled( false ); |
1267 | setCaptionToDates(); | 1267 | setCaptionToDates(); |
1268 | return; | 1268 | return; |
1269 | 1269 | ||
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | //KGlobal::locale()->formatDateTime(nextA, true); | 1272 | //KGlobal::locale()->formatDateTime(nextA, true); |
1273 | QString startString = ""; | 1273 | QString startString = ""; |
1274 | if ( incidence->type() != "Todo" ) { | 1274 | if ( incidence->type() != "Todo" ) { |
1275 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1275 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1276 | if ( incidence->doesFloat() ) { | 1276 | if ( incidence->doesFloat() ) { |
1277 | startString += ": "+incidence->dtStartDateStr( true ); | 1277 | startString += ": "+incidence->dtStartDateStr( true ); |
1278 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1278 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1279 | 1279 | ||
1280 | } else { | 1280 | } else { |
1281 | startString = ": "+incidence->dtStartStr(true); | 1281 | startString = ": "+incidence->dtStartStr(true); |
1282 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1282 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1283 | 1283 | ||
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | } else { | 1286 | } else { |
1287 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1287 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1288 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1288 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1289 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1289 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1290 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1290 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | } | 1293 | } |
1294 | else | 1294 | else |
1295 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1295 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1296 | if ( !incidence->location().isEmpty() ) | 1296 | if ( !incidence->location().isEmpty() ) |
1297 | startString += " (" +incidence->location()+")"; | 1297 | startString += " (" +incidence->location()+")"; |
1298 | setCaption( incidence->summary()+startString); | 1298 | setCaption( incidence->summary()+startString); |
1299 | 1299 | ||
1300 | enableIncidenceActions( true ); | 1300 | enableIncidenceActions( true ); |
1301 | 1301 | ||
1302 | if ( incidence->type() == "Event" ) { | 1302 | if ( incidence->type() == "Event" ) { |
1303 | mShowAction->setText( i18n("Show Event...") ); | 1303 | mShowAction->setText( i18n("Show Event...") ); |
1304 | mEditAction->setText( i18n("Edit Event...") ); | 1304 | mEditAction->setText( i18n("Edit Event...") ); |
1305 | mDeleteAction->setText( i18n("Delete Event...") ); | 1305 | mDeleteAction->setText( i18n("Delete Event...") ); |
1306 | 1306 | ||
1307 | mNewSubTodoAction->setEnabled( false ); | 1307 | mNewSubTodoAction->setEnabled( false ); |
1308 | } else if ( incidence->type() == "Todo" ) { | 1308 | } else if ( incidence->type() == "Todo" ) { |
1309 | mShowAction->setText( i18n("Show Todo...") ); | 1309 | mShowAction->setText( i18n("Show Todo...") ); |
1310 | mEditAction->setText( i18n("Edit Todo...") ); | 1310 | mEditAction->setText( i18n("Edit Todo...") ); |
1311 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1311 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1312 | 1312 | ||
1313 | mNewSubTodoAction->setEnabled( true ); | 1313 | mNewSubTodoAction->setEnabled( true ); |
1314 | } else { | 1314 | } else { |
1315 | mShowAction->setText( i18n("Show...") ); | 1315 | mShowAction->setText( i18n("Show...") ); |
1316 | mShowAction->setText( i18n("Edit...") ); | 1316 | mShowAction->setText( i18n("Edit...") ); |
1317 | mShowAction->setText( i18n("Delete...") ); | 1317 | mShowAction->setText( i18n("Delete...") ); |
1318 | 1318 | ||
1319 | mNewSubTodoAction->setEnabled( false ); | 1319 | mNewSubTodoAction->setEnabled( false ); |
1320 | } | 1320 | } |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | void MainWindow::enableIncidenceActions( bool enabled ) | 1323 | void MainWindow::enableIncidenceActions( bool enabled ) |
1324 | { | 1324 | { |
1325 | mShowAction->setEnabled( enabled ); | 1325 | mShowAction->setEnabled( enabled ); |
1326 | mEditAction->setEnabled( enabled ); | 1326 | mEditAction->setEnabled( enabled ); |
1327 | mDeleteAction->setEnabled( enabled ); | 1327 | mDeleteAction->setEnabled( enabled ); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | void MainWindow::importOL() | 1330 | void MainWindow::importOL() |
1331 | { | 1331 | { |
1332 | #ifdef _WIN32_ | 1332 | #ifdef _WIN32_ |
1333 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1333 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1334 | id->exec(); | 1334 | id->exec(); |
1335 | delete id; | 1335 | delete id; |
1336 | mView->updateView(); | 1336 | mView->updateView(); |
1337 | #endif | 1337 | #endif |
1338 | } | 1338 | } |
1339 | void MainWindow::importBday() | 1339 | void MainWindow::importBday() |
1340 | { | 1340 | { |
1341 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1341 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1342 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1342 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1343 | i18n("Import!"), i18n("Cancel"), 0, | 1343 | i18n("Import!"), i18n("Cancel"), 0, |
1344 | 0, 1 ); | 1344 | 0, 1 ); |
1345 | if ( result == 0 ) { | 1345 | if ( result == 0 ) { |
1346 | mView->importBday(); | 1346 | mView->importBday(); |
1347 | 1347 | ||
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | 1350 | ||
1351 | } | 1351 | } |
1352 | void MainWindow::importQtopia() | 1352 | void MainWindow::importQtopia() |
1353 | { | 1353 | { |
1354 | #ifndef DESKTOP_VERSION | 1354 | #ifndef DESKTOP_VERSION |
1355 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1355 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1356 | 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"), | 1356 | 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"), |
1357 | i18n("Import!"), i18n("Cancel"), 0, | 1357 | i18n("Import!"), i18n("Cancel"), 0, |
1358 | 0, 1 ); | 1358 | 0, 1 ); |
1359 | if ( result == 0 ) { | 1359 | if ( result == 0 ) { |
1360 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1360 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1361 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1361 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1362 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1362 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1363 | mView->importQtopia( categories, datebook, todolist ); | 1363 | mView->importQtopia( categories, datebook, todolist ); |
1364 | } | 1364 | } |
1365 | #else | 1365 | #else |
1366 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1366 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1367 | i18n("Not supported \non desktop!\n"), | 1367 | i18n("Not supported \non desktop!\n"), |
1368 | i18n("Ok"), i18n("Cancel"), 0, | 1368 | i18n("Ok"), i18n("Cancel"), 0, |
1369 | 0, 1 ); | 1369 | 0, 1 ); |
1370 | 1370 | ||
1371 | #endif | 1371 | #endif |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | void MainWindow::saveOnClose() | 1374 | void MainWindow::saveOnClose() |
1375 | { | 1375 | { |
1376 | KOPrefs *p = KOPrefs::instance(); | 1376 | KOPrefs *p = KOPrefs::instance(); |
1377 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1377 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1378 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1378 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1379 | iconToolBar->y() > height()/2; | 1379 | iconToolBar->y() > height()/2; |
1380 | mView->writeSettings(); | 1380 | mView->writeSettings(); |
1381 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1381 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1382 | save(); | 1382 | save(); |
1383 | } | 1383 | } |
1384 | void MainWindow::slotModifiedChanged( bool changed ) | 1384 | void MainWindow::slotModifiedChanged( bool changed ) |
1385 | { | 1385 | { |
1386 | if ( mBlockAtStartup ) | 1386 | if ( mBlockAtStartup ) |
1387 | return; | 1387 | return; |
1388 | int msec; | 1388 | int msec; |
1389 | // we store the changes after 1 minute, | 1389 | // we store the changes after 1 minute, |
1390 | // and for safety reasons after 10 minutes again | 1390 | // and for safety reasons after 10 minutes again |
1391 | if ( !mBlockSaveFlag ) | 1391 | if ( !mBlockSaveFlag ) |
1392 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1392 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1393 | else | 1393 | else |
1394 | msec = 1000 * 600; | 1394 | msec = 1000 * 600; |
1395 | mSaveTimer.start( msec, true ); // 1 minute | 1395 | mSaveTimer.start( msec, true ); // 1 minute |
1396 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1396 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1397 | mCalendarModifiedFlag = true; | 1397 | mCalendarModifiedFlag = true; |
1398 | } | 1398 | } |
1399 | #include <qfileinfo.h> | 1399 | #include <qfileinfo.h> |
1400 | void MainWindow::save() | 1400 | void MainWindow::save() |
1401 | { | 1401 | { |
1402 | if ( mBlockSaveFlag ) | 1402 | if ( mBlockSaveFlag ) |
1403 | return; | 1403 | return; |
1404 | bool store = mBlockSaveFlag; | 1404 | bool store = mBlockSaveFlag; |
1405 | mBlockSaveFlag = true; | 1405 | mBlockSaveFlag = true; |
1406 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1406 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1407 | 1407 | ||
1408 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1408 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1409 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1409 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1410 | qDebug("KO: Start saving data to file!"); | 1410 | qDebug("KO: Start saving data to file!"); |
1411 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | ||
1411 | mView->saveCalendar( defaultFileName() ); | 1412 | mView->saveCalendar( defaultFileName() ); |
1412 | 1413 | ||
1413 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1414 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1414 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); | 1415 | mView->watchSavedFile(); |
1415 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1416 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1416 | QString savemes; | 1417 | QString savemes; |
1417 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1418 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1418 | setCaption(savemes); | 1419 | setCaption(savemes); |
1419 | } else | 1420 | } else |
1420 | setCaption(i18n("Saving cancelled!")); | 1421 | setCaption(i18n("Saving cancelled!")); |
1421 | mCalendarModifiedFlag = false; | 1422 | mCalendarModifiedFlag = false; |
1422 | mBlockSaveFlag = store; | 1423 | mBlockSaveFlag = store; |
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1426 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1426 | { | 1427 | { |
1427 | if ( !e->isAutoRepeat() ) { | 1428 | if ( !e->isAutoRepeat() ) { |
1428 | mFlagKeyPressed = false; | 1429 | mFlagKeyPressed = false; |
1429 | } | 1430 | } |
1430 | } | 1431 | } |
1431 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1432 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1432 | { | 1433 | { |
1433 | qApp->processEvents(); | 1434 | qApp->processEvents(); |
1434 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1435 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1435 | e->ignore(); | 1436 | e->ignore(); |
1436 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1437 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1437 | return; | 1438 | return; |
1438 | } | 1439 | } |
1439 | if (! e->isAutoRepeat() ) | 1440 | if (! e->isAutoRepeat() ) |
1440 | mFlagKeyPressed = true; | 1441 | mFlagKeyPressed = true; |
1441 | KOPrefs *p = KOPrefs::instance(); | 1442 | KOPrefs *p = KOPrefs::instance(); |
1442 | bool showSelectedDates = false; | 1443 | bool showSelectedDates = false; |
1443 | int size; | 1444 | int size; |
1444 | int pro = 0; | 1445 | int pro = 0; |
1445 | //qDebug("MainWindow::keyPressEvent "); | 1446 | //qDebug("MainWindow::keyPressEvent "); |
1446 | switch ( e->key() ) { | 1447 | switch ( e->key() ) { |
1447 | case Qt::Key_Right: | 1448 | case Qt::Key_Right: |
1448 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1449 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1449 | mView->goNextMonth(); | 1450 | mView->goNextMonth(); |
1450 | else | 1451 | else |
1451 | mView->goNext(); | 1452 | mView->goNext(); |
1452 | showSelectedDates = true; | 1453 | showSelectedDates = true; |
1453 | break; | 1454 | break; |
1454 | case Qt::Key_Left: | 1455 | case Qt::Key_Left: |
1455 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1456 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1456 | mView->goPreviousMonth(); | 1457 | mView->goPreviousMonth(); |
1457 | else | 1458 | else |
1458 | mView->goPrevious(); | 1459 | mView->goPrevious(); |
1459 | showSelectedDates = true; | 1460 | showSelectedDates = true; |
1460 | break; | 1461 | break; |
1461 | case Qt::Key_Down: | 1462 | case Qt::Key_Down: |
1462 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1463 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1463 | break; | 1464 | break; |
1464 | case Qt::Key_Up: | 1465 | case Qt::Key_Up: |
1465 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1466 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1466 | break; | 1467 | break; |
1467 | case Qt::Key_I: | 1468 | case Qt::Key_I: |
1468 | mView->showIncidence(); | 1469 | mView->showIncidence(); |
1469 | break; | 1470 | break; |
1470 | case Qt::Key_Delete: | 1471 | case Qt::Key_Delete: |
1471 | case Qt::Key_Backspace: | 1472 | case Qt::Key_Backspace: |
1472 | mView->deleteIncidence(); | 1473 | mView->deleteIncidence(); |
1473 | break; | 1474 | break; |
1474 | case Qt::Key_D: | 1475 | case Qt::Key_D: |
1475 | mView->viewManager()->showDayView(); | 1476 | mView->viewManager()->showDayView(); |
1476 | showSelectedDates = true; | 1477 | showSelectedDates = true; |
1477 | break; | 1478 | break; |
1478 | case Qt::Key_O: | 1479 | case Qt::Key_O: |
1479 | mView->toggleFilerEnabled( ); | 1480 | mView->toggleFilerEnabled( ); |
1480 | break; | 1481 | break; |
1481 | case Qt::Key_0: | 1482 | case Qt::Key_0: |
1482 | case Qt::Key_1: | 1483 | case Qt::Key_1: |
1483 | case Qt::Key_2: | 1484 | case Qt::Key_2: |
1484 | case Qt::Key_3: | 1485 | case Qt::Key_3: |
1485 | case Qt::Key_4: | 1486 | case Qt::Key_4: |
1486 | case Qt::Key_5: | 1487 | case Qt::Key_5: |
1487 | case Qt::Key_6: | 1488 | case Qt::Key_6: |
1488 | case Qt::Key_7: | 1489 | case Qt::Key_7: |
1489 | case Qt::Key_8: | 1490 | case Qt::Key_8: |
1490 | case Qt::Key_9: | 1491 | case Qt::Key_9: |
1491 | pro = e->key()-48; | 1492 | pro = e->key()-48; |
1492 | if ( pro == 0 ) | 1493 | if ( pro == 0 ) |
1493 | pro = 10; | 1494 | pro = 10; |
1494 | if ( e->state() == Qt::ControlButton) | 1495 | if ( e->state() == Qt::ControlButton) |
1495 | pro += 10; | 1496 | pro += 10; |
1496 | break; | 1497 | break; |
1497 | case Qt::Key_M: | 1498 | case Qt::Key_M: |
1498 | mView->viewManager()->showMonthView(); | 1499 | mView->viewManager()->showMonthView(); |
1499 | showSelectedDates = true; | 1500 | showSelectedDates = true; |
1500 | break; | 1501 | break; |
1501 | case Qt::Key_Insert: | 1502 | case Qt::Key_Insert: |
1502 | mView->newEvent(); | 1503 | mView->newEvent(); |
1503 | break; | 1504 | break; |
1504 | case Qt::Key_S : | 1505 | case Qt::Key_S : |
1505 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1506 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1506 | mView->newSubTodo(); | 1507 | mView->newSubTodo(); |
1507 | else | 1508 | else |
1508 | mView->dialogManager()->showSearchDialog(); | 1509 | mView->dialogManager()->showSearchDialog(); |
1509 | break; | 1510 | break; |
1510 | case Qt::Key_Y : | 1511 | case Qt::Key_Y : |
1511 | case Qt::Key_Z : | 1512 | case Qt::Key_Z : |
1512 | mView->viewManager()->showWorkWeekView(); | 1513 | mView->viewManager()->showWorkWeekView(); |
1513 | showSelectedDates = true; | 1514 | showSelectedDates = true; |
1514 | break; | 1515 | break; |
1515 | case Qt::Key_U : | 1516 | case Qt::Key_U : |
1516 | mView->viewManager()->showWeekView(); | 1517 | mView->viewManager()->showWeekView(); |
1517 | showSelectedDates = true; | 1518 | showSelectedDates = true; |
1518 | break; | 1519 | break; |
1519 | case Qt::Key_H : | 1520 | case Qt::Key_H : |
1520 | keyBindings(); | 1521 | keyBindings(); |
1521 | break; | 1522 | break; |
1522 | case Qt::Key_W: | 1523 | case Qt::Key_W: |
1523 | mView->viewManager()->showWhatsNextView(); | 1524 | mView->viewManager()->showWhatsNextView(); |
1524 | break; | 1525 | break; |
1525 | case Qt::Key_L: | 1526 | case Qt::Key_L: |
1526 | mView->viewManager()->showListView(); | 1527 | mView->viewManager()->showListView(); |
1527 | break; | 1528 | break; |
1528 | case Qt::Key_N: | 1529 | case Qt::Key_N: |
1529 | mView->viewManager()->showNextXView(); | 1530 | mView->viewManager()->showNextXView(); |
1530 | showSelectedDates = true; | 1531 | showSelectedDates = true; |
1531 | break; | 1532 | break; |
1532 | case Qt::Key_V: | 1533 | case Qt::Key_V: |
1533 | mView->viewManager()->showTodoView(); | 1534 | mView->viewManager()->showTodoView(); |
1534 | break; | 1535 | break; |
1535 | case Qt::Key_C: | 1536 | case Qt::Key_C: |
1536 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1537 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1537 | break; | 1538 | break; |
1538 | case Qt::Key_P: | 1539 | case Qt::Key_P: |
1539 | mView->showDatePicker( ); | 1540 | mView->showDatePicker( ); |
1540 | break; | 1541 | break; |
1541 | case Qt::Key_F: | 1542 | case Qt::Key_F: |
1542 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1543 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1543 | mView->editFilters(); | 1544 | mView->editFilters(); |
1544 | else | 1545 | else |
1545 | mView->toggleFilter(); | 1546 | mView->toggleFilter(); |
1546 | break; | 1547 | break; |
1547 | case Qt::Key_X: | 1548 | case Qt::Key_X: |
1548 | mView->toggleDateNavigatorWidget(); | 1549 | mView->toggleDateNavigatorWidget(); |
1549 | break; | 1550 | break; |
1550 | case Qt::Key_Space: | 1551 | case Qt::Key_Space: |
1551 | mView->toggleExpand(); | 1552 | mView->toggleExpand(); |
1552 | break; | 1553 | break; |
1553 | case Qt::Key_A: | 1554 | case Qt::Key_A: |
1554 | mView->toggleAllDaySize(); | 1555 | mView->toggleAllDaySize(); |
1555 | break; | 1556 | break; |
1556 | case Qt::Key_T: | 1557 | case Qt::Key_T: |
1557 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1558 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1558 | mView->newTodo(); | 1559 | mView->newTodo(); |
1559 | else { | 1560 | else { |
1560 | mView->goToday(); | 1561 | mView->goToday(); |
1561 | showSelectedDates = true; | 1562 | showSelectedDates = true; |
1562 | } | 1563 | } |
1563 | break; | 1564 | break; |
1564 | case Qt::Key_J: | 1565 | case Qt::Key_J: |
1565 | mView->viewManager()->showJournalView(); | 1566 | mView->viewManager()->showJournalView(); |
1566 | break; | 1567 | break; |
1567 | case Qt::Key_B: | 1568 | case Qt::Key_B: |
1568 | mView->editIncidenceDescription();; | 1569 | mView->editIncidenceDescription();; |
1569 | break; | 1570 | break; |
1570 | // case Qt::Key_Return: | 1571 | // case Qt::Key_Return: |
1571 | case Qt::Key_E: | 1572 | case Qt::Key_E: |
1572 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1573 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1573 | mView->newEvent(); | 1574 | mView->newEvent(); |
1574 | else | 1575 | else |
1575 | mView->editIncidence(); | 1576 | mView->editIncidence(); |
1576 | break; | 1577 | break; |
1577 | case Qt::Key_Plus: | 1578 | case Qt::Key_Plus: |
1578 | size = p->mHourSize +2; | 1579 | size = p->mHourSize +2; |
1579 | if ( size <= 18 ) | 1580 | if ( size <= 18 ) |
1580 | configureAgenda( size ); | 1581 | configureAgenda( size ); |
1581 | break; | 1582 | break; |
1582 | case Qt::Key_Minus: | 1583 | case Qt::Key_Minus: |
1583 | size = p->mHourSize - 2; | 1584 | size = p->mHourSize - 2; |
1584 | if ( size >= 4 ) | 1585 | if ( size >= 4 ) |
1585 | configureAgenda( size ); | 1586 | configureAgenda( size ); |
1586 | break; | 1587 | break; |
1587 | 1588 | ||
1588 | 1589 | ||
1589 | default: | 1590 | default: |
1590 | e->ignore(); | 1591 | e->ignore(); |
1591 | } | 1592 | } |
1592 | if ( pro > 0 ) { | 1593 | if ( pro > 0 ) { |
1593 | mView->selectFilter( pro-1 ); | 1594 | mView->selectFilter( pro-1 ); |
1594 | } | 1595 | } |
1595 | if ( showSelectedDates ) { | 1596 | if ( showSelectedDates ) { |
1596 | ;// setCaptionToDates(); | 1597 | ;// setCaptionToDates(); |
1597 | } | 1598 | } |
1598 | 1599 | ||
1599 | } | 1600 | } |
1600 | 1601 | ||
1601 | void MainWindow::fillFilterMenu() | 1602 | void MainWindow::fillFilterMenu() |
1602 | { | 1603 | { |
1603 | selectFilterMenu->clear(); | 1604 | selectFilterMenu->clear(); |
1604 | bool disable = false; | 1605 | bool disable = false; |
1605 | if ( mView->filterView()->filtersEnabled() ) { | 1606 | if ( mView->filterView()->filtersEnabled() ) { |
1606 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | 1607 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); |
1607 | } | 1608 | } |
1608 | else { | 1609 | else { |
1609 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | 1610 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); |
1610 | disable = true; | 1611 | disable = true; |
1611 | } | 1612 | } |
1612 | selectFilterMenu->insertSeparator(); | 1613 | selectFilterMenu->insertSeparator(); |
1613 | QPtrList<CalFilter> fili = mView->filters(); | 1614 | QPtrList<CalFilter> fili = mView->filters(); |
1614 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1615 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1615 | CalFilter *filter = fili.first(); | 1616 | CalFilter *filter = fili.first(); |
1616 | int iii = 1; | 1617 | int iii = 1; |
1617 | while(filter) { | 1618 | while(filter) { |
1618 | selectFilterMenu->insertItem( filter->name(), iii ); | 1619 | selectFilterMenu->insertItem( filter->name(), iii ); |
1619 | if ( filter == curfilter) | 1620 | if ( filter == curfilter) |
1620 | selectFilterMenu->setItemChecked( iii, true ); | 1621 | selectFilterMenu->setItemChecked( iii, true ); |
1621 | if ( disable ) | 1622 | if ( disable ) |
1622 | selectFilterMenu->setItemEnabled( iii, false ); | 1623 | selectFilterMenu->setItemEnabled( iii, false ); |
1623 | filter = fili.next(); | 1624 | filter = fili.next(); |
1624 | ++iii; | 1625 | ++iii; |
1625 | } | 1626 | } |
1626 | } | 1627 | } |
1627 | void MainWindow::selectFilter( int fil ) | 1628 | void MainWindow::selectFilter( int fil ) |
1628 | { | 1629 | { |
1629 | if ( fil == 0 ) { | 1630 | if ( fil == 0 ) { |
1630 | mView->toggleFilerEnabled( ); | 1631 | mView->toggleFilerEnabled( ); |
1631 | } else { | 1632 | } else { |
1632 | mView->selectFilter( fil-1 ); | 1633 | mView->selectFilter( fil-1 ); |
1633 | } | 1634 | } |
1634 | } | 1635 | } |
1635 | void MainWindow::configureToolBar( int item ) | 1636 | void MainWindow::configureToolBar( int item ) |
1636 | { | 1637 | { |
1637 | 1638 | ||
1638 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1639 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1639 | KOPrefs *p = KOPrefs::instance(); | 1640 | KOPrefs *p = KOPrefs::instance(); |
1640 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1641 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1641 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1642 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1642 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1643 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1643 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1644 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1644 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1645 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1645 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1646 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1646 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1647 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1647 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1648 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1648 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1649 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1649 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1650 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1650 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1651 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1651 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1652 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1652 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1653 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1653 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1654 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1654 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1655 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1655 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1656 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1656 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1657 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1657 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1658 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1658 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1659 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1659 | // initActions(); | 1660 | // initActions(); |
1660 | } | 1661 | } |
1661 | 1662 | ||
1662 | void MainWindow::setCaptionToDates() | 1663 | void MainWindow::setCaptionToDates() |
1663 | { | 1664 | { |
1664 | QString selDates; | 1665 | QString selDates; |
1665 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1666 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1666 | if (mView->startDate() < mView->endDate() ) | 1667 | if (mView->startDate() < mView->endDate() ) |
1667 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1668 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1668 | setCaption( i18n("Dates: ") + selDates ); | 1669 | setCaption( i18n("Dates: ") + selDates ); |
1669 | 1670 | ||
1670 | } | 1671 | } |
1671 | // parameter item == 0: reinit | 1672 | // parameter item == 0: reinit |
1672 | void MainWindow::configureAgenda( int item ) | 1673 | void MainWindow::configureAgenda( int item ) |
1673 | { | 1674 | { |
1674 | 1675 | ||
1675 | KOPrefs *p = KOPrefs::instance(); | 1676 | KOPrefs *p = KOPrefs::instance(); |
1676 | 1677 | ||
1677 | int i; | 1678 | int i; |
1678 | if ( item == 1 ) { | 1679 | if ( item == 1 ) { |
1679 | mView->toggleAllDaySize(); | 1680 | mView->toggleAllDaySize(); |
1680 | return; | 1681 | return; |
1681 | } | 1682 | } |
1682 | // do not allow 4 for widgets higher than 480 | 1683 | // do not allow 4 for widgets higher than 480 |
1683 | // if ( QApplication::desktop()->height() > 480 ) { | 1684 | // if ( QApplication::desktop()->height() > 480 ) { |
1684 | // if ( item == 4 ) | 1685 | // if ( item == 4 ) |
1685 | // item = 6; | 1686 | // item = 6; |
1686 | // } | 1687 | // } |
1687 | for ( i = 4; i <= 18; i= i+2 ) | 1688 | for ( i = 4; i <= 18; i= i+2 ) |
1688 | configureAgendaMenu->setItemChecked( i, false ); | 1689 | configureAgendaMenu->setItemChecked( i, false ); |
1689 | configureAgendaMenu->setItemChecked( item, true ); | 1690 | configureAgendaMenu->setItemChecked( item, true ); |
1690 | if ( p->mHourSize == item ) | 1691 | if ( p->mHourSize == item ) |
1691 | return; | 1692 | return; |
1692 | p->mHourSize=item; | 1693 | p->mHourSize=item; |
1693 | mView->viewManager()->agendaView()->updateConfig(); | 1694 | mView->viewManager()->agendaView()->updateConfig(); |
1694 | } | 1695 | } |
1695 | 1696 | ||
1696 | void MainWindow::saveCalendar() | 1697 | void MainWindow::saveCalendar() |
1697 | { | 1698 | { |
1698 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1699 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1699 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1700 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1700 | 1701 | ||
1701 | if ( fn == "" ) | 1702 | if ( fn == "" ) |
1702 | return; | 1703 | return; |
1703 | QFileInfo info; | 1704 | QFileInfo info; |
1704 | info.setFile( fn ); | 1705 | info.setFile( fn ); |
1705 | QString mes; | 1706 | QString mes; |
1706 | bool createbup = true; | 1707 | bool createbup = true; |
1707 | if ( info. exists() ) { | 1708 | if ( info. exists() ) { |
1708 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1709 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1709 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1710 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1710 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1711 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1711 | 0, 1 ); | 1712 | 0, 1 ); |
1712 | if ( result != 0 ) { | 1713 | if ( result != 0 ) { |
1713 | createbup = false; | 1714 | createbup = false; |
1714 | } | 1715 | } |
1715 | } | 1716 | } |
1716 | if ( createbup ) { | 1717 | if ( createbup ) { |
1717 | mView->saveCalendar( fn ); | 1718 | mView->saveCalendar( fn ); |
1718 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1719 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1719 | KOPrefs::instance()->mLastSaveFile = fn; | 1720 | KOPrefs::instance()->mLastSaveFile = fn; |
1720 | setCaption(mes); | 1721 | setCaption(mes); |
1721 | } | 1722 | } |
1722 | } | 1723 | } |
1723 | void MainWindow::loadCalendar() | 1724 | void MainWindow::loadCalendar() |
1724 | { | 1725 | { |
1725 | 1726 | ||
1726 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1727 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1727 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1728 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1728 | 1729 | ||
1729 | if ( fn == "" ) | 1730 | if ( fn == "" ) |
1730 | return; | 1731 | return; |
1731 | QFileInfo info; | 1732 | QFileInfo info; |
1732 | info.setFile( fn ); | 1733 | info.setFile( fn ); |
1733 | QString mess; | 1734 | QString mess; |
1734 | bool loadbup = true; | 1735 | bool loadbup = true; |
1735 | if ( info. exists() ) { | 1736 | if ( info. exists() ) { |
1736 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1737 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1737 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1738 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1738 | mess, | 1739 | mess, |
1739 | i18n("Load!"), i18n("Cancel"), 0, | 1740 | i18n("Load!"), i18n("Cancel"), 0, |
1740 | 0, 1 ); | 1741 | 0, 1 ); |
1741 | if ( result != 0 ) { | 1742 | if ( result != 0 ) { |
1742 | loadbup = false; | 1743 | loadbup = false; |
1743 | } | 1744 | } |
1744 | } else { | 1745 | } else { |
1745 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1746 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1746 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1747 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1747 | 0, 1 ); | 1748 | 0, 1 ); |
1748 | 1749 | ||
1749 | return; | 1750 | return; |
1750 | } | 1751 | } |
1751 | if ( loadbup ) { | 1752 | if ( loadbup ) { |
1752 | mView->openCalendar( fn ); | 1753 | mView->openCalendar( fn ); |
1753 | KOPrefs::instance()->mLastLoadFile = fn; | 1754 | KOPrefs::instance()->mLastLoadFile = fn; |
1754 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1755 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1755 | setCaption(mess); | 1756 | setCaption(mess); |
1756 | } | 1757 | } |
1757 | 1758 | ||
1758 | } | 1759 | } |
1759 | void MainWindow::quickImportIcal() | 1760 | void MainWindow::quickImportIcal() |
1760 | { | 1761 | { |
1761 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1762 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1762 | } | 1763 | } |
1763 | void MainWindow::importFile( QString fn, bool quick ) | 1764 | void MainWindow::importFile( QString fn, bool quick ) |
1764 | { | 1765 | { |
1765 | QFileInfo info; | 1766 | QFileInfo info; |
1766 | info.setFile( fn ); | 1767 | info.setFile( fn ); |
1767 | QString mess; | 1768 | QString mess; |
1768 | bool loadbup = true; | 1769 | bool loadbup = true; |
1769 | if ( !info. exists() ) { | 1770 | if ( !info. exists() ) { |
1770 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1771 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1771 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1772 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1772 | mess ); | 1773 | mess ); |
1773 | return; | 1774 | return; |
1774 | } | 1775 | } |
1775 | int result = 0; | 1776 | int result = 0; |
1776 | if ( !quick ) { | 1777 | if ( !quick ) { |
1777 | 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 )); | 1778 | 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 )); |
1778 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1779 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1779 | mess, | 1780 | mess, |
1780 | "Import", "Cancel", 0, | 1781 | "Import", "Cancel", 0, |
1781 | 0, 1 ); | 1782 | 0, 1 ); |
1782 | } | 1783 | } |
1783 | if ( result == 0 ) { | 1784 | if ( result == 0 ) { |
1784 | if ( mView->openCalendar( fn, true )) { | 1785 | if ( mView->openCalendar( fn, true )) { |
1785 | KOPrefs::instance()->mLastImportFile = fn; | 1786 | KOPrefs::instance()->mLastImportFile = fn; |
1786 | setCaption(i18n("Imported file successfully")); | 1787 | setCaption(i18n("Imported file successfully")); |
1787 | } else { | 1788 | } else { |
1788 | setCaption(i18n("Error importing file")); | 1789 | setCaption(i18n("Error importing file")); |
1789 | } | 1790 | } |
1790 | } | 1791 | } |
1791 | } | 1792 | } |
1792 | 1793 | ||
1793 | void MainWindow::importIcal() | 1794 | void MainWindow::importIcal() |
1794 | { | 1795 | { |
1795 | 1796 | ||
1796 | QString fn =KOPrefs::instance()->mLastImportFile; | 1797 | QString fn =KOPrefs::instance()->mLastImportFile; |
1797 | 1798 | ||
1798 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1799 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |