-rw-r--r-- | korganizer/calendarview.cpp | 20 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 115 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkcal/calstorage.h | 2 | ||||
-rw-r--r-- | libkcal/filestorage.cpp | 4 | ||||
-rw-r--r-- | libkcal/filestorage.h | 2 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 24 | ||||
-rw-r--r-- | libkcal/icalformat.h | 3 |
10 files changed, 20 insertions, 154 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index eaea040..fecc7e2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1176,104 +1176,104 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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() ) { |
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() ); |
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 ); |
@@ -1454,198 +1454,200 @@ bool CalendarView::importQtopia( const QString &categories, | |||
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() ) { |
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() ) | ||
1518 | saveCalendar( MainWindow::defaultFileName() ); | ||
1519 | loadedFileVersion = QDateTime::currentDateTime(); | 1517 | loadedFileVersion = QDateTime::currentDateTime(); |
1518 | if ( filename != MainWindow::defaultFileName() ) { | ||
1519 | saveCalendar( MainWindow::defaultFileName() ); | ||
1520 | watchSavedFile(); | ||
1521 | } | ||
1520 | return true; | 1522 | return true; |
1521 | } else { | 1523 | } else { |
1522 | // while failing to load, the calendar object could | 1524 | // while failing to load, the calendar object could |
1523 | // have become partially populated. Clear it out. | 1525 | // have become partially populated. Clear it out. |
1524 | if ( !merge ) mCalendar->close(); | 1526 | if ( !merge ) mCalendar->close(); |
1525 | 1527 | ||
1526 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1528 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1527 | 1529 | ||
1528 | globalFlagBlockAgenda = 2; | 1530 | globalFlagBlockAgenda = 2; |
1529 | updateView(); | 1531 | updateView(); |
1530 | } | 1532 | } |
1531 | return false; | 1533 | return false; |
1532 | } | 1534 | } |
1533 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1535 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1534 | { | 1536 | { |
1535 | loadedFileVersion = dt; | 1537 | loadedFileVersion = dt; |
1536 | } | 1538 | } |
1537 | bool CalendarView::checkFileChanged(QString fn) | 1539 | bool CalendarView::checkFileChanged(QString fn) |
1538 | { | 1540 | { |
1539 | QFileInfo finf ( fn ); | 1541 | QFileInfo finf ( fn ); |
1540 | if ( !finf.exists() ) | 1542 | if ( !finf.exists() ) |
1541 | return true; | 1543 | return true; |
1542 | QDateTime dt = finf.lastModified (); | 1544 | QDateTime dt = finf.lastModified (); |
1543 | if ( dt <= loadedFileVersion ) | 1545 | if ( dt <= loadedFileVersion ) |
1544 | return false; | 1546 | return false; |
1545 | return true; | 1547 | return true; |
1546 | 1548 | ||
1547 | } | 1549 | } |
1548 | void CalendarView::watchSavedFile() | 1550 | void CalendarView::watchSavedFile() |
1549 | { | 1551 | { |
1550 | QFileInfo finf ( MainWindow::defaultFileName()); | 1552 | QFileInfo finf ( MainWindow::defaultFileName()); |
1551 | if ( !finf.exists() ) | 1553 | if ( !finf.exists() ) |
1552 | return; | 1554 | return; |
1553 | QDateTime dt = finf.lastModified (); | 1555 | QDateTime dt = finf.lastModified (); |
1554 | if ( dt < loadedFileVersion ) { | 1556 | if ( dt < loadedFileVersion ) { |
1555 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1557 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1556 | return; | 1558 | return; |
1557 | } | 1559 | } |
1558 | loadedFileVersion = dt; | 1560 | loadedFileVersion = dt; |
1559 | } | 1561 | } |
1560 | 1562 | ||
1561 | bool CalendarView::checkFileVersion(QString fn) | 1563 | bool CalendarView::checkFileVersion(QString fn) |
1562 | { | 1564 | { |
1563 | QFileInfo finf ( fn ); | 1565 | QFileInfo finf ( fn ); |
1564 | if ( !finf.exists() ) | 1566 | if ( !finf.exists() ) |
1565 | return true; | 1567 | return true; |
1566 | QDateTime dt = finf.lastModified (); | 1568 | QDateTime dt = finf.lastModified (); |
1567 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1569 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1568 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1570 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1569 | if ( dt <= loadedFileVersion ) | 1571 | if ( dt <= loadedFileVersion ) |
1570 | return true; | 1572 | return true; |
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)) , | 1573 | 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)) , |
1572 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1574 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1573 | i18n("Sync+save")); | 1575 | i18n("Sync+save")); |
1574 | 1576 | ||
1575 | if ( km == KMessageBox::Cancel ) | 1577 | if ( km == KMessageBox::Cancel ) |
1576 | return false; | 1578 | return false; |
1577 | if ( km == KMessageBox::Yes ) | 1579 | if ( km == KMessageBox::Yes ) |
1578 | return true; | 1580 | return true; |
1579 | 1581 | ||
1580 | setSyncDevice("deleteaftersync" ); | 1582 | setSyncDevice("deleteaftersync" ); |
1581 | KOPrefs::instance()->mAskForPreferences = true; | 1583 | KOPrefs::instance()->mAskForPreferences = true; |
1582 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1584 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1583 | KOPrefs::instance()->mWriteBackFile = false; | 1585 | KOPrefs::instance()->mWriteBackFile = false; |
1584 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1586 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1585 | KOPrefs::instance()->mShowSyncSummary = false; | 1587 | KOPrefs::instance()->mShowSyncSummary = false; |
1586 | syncCalendar( fn, 3 ); | 1588 | syncCalendar( fn, 3 ); |
1587 | Event * e = getLastSyncEvent(); | 1589 | Event * e = getLastSyncEvent(); |
1588 | mCalendar->deleteEvent ( e ); | 1590 | mCalendar->deleteEvent ( e ); |
1589 | updateView(); | 1591 | updateView(); |
1590 | return true; | 1592 | return true; |
1591 | } | 1593 | } |
1592 | 1594 | ||
1593 | bool CalendarView::saveCalendar( QString filename ) | 1595 | bool CalendarView::saveCalendar( QString filename ) |
1594 | { | 1596 | { |
1595 | 1597 | ||
1596 | // Store back all unsaved data into calendar object | 1598 | // Store back all unsaved data into calendar object |
1597 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1599 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1598 | if ( mViewManager->currentView() ) | 1600 | if ( mViewManager->currentView() ) |
1599 | mViewManager->currentView()->flushView(); | 1601 | mViewManager->currentView()->flushView(); |
1600 | 1602 | ||
1601 | //mStorage->setFileName( filename ); | 1603 | //mStorage->setFileName( filename ); |
1602 | 1604 | ||
1603 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1605 | mStorage->setSaveFormat( new ICalFormat() ); |
1604 | mStorage->setFileName( filename ); | 1606 | mStorage->setFileName( filename ); |
1605 | bool success; | 1607 | bool success; |
1606 | success = mStorage->save(); | 1608 | success = mStorage->save(); |
1607 | if ( !success ) { | 1609 | if ( !success ) { |
1608 | return false; | 1610 | return false; |
1609 | } | 1611 | } |
1610 | 1612 | ||
1611 | return true; | 1613 | return true; |
1612 | } | 1614 | } |
1613 | 1615 | ||
1614 | void CalendarView::closeCalendar() | 1616 | void CalendarView::closeCalendar() |
1615 | { | 1617 | { |
1616 | 1618 | ||
1617 | // child windows no longer valid | 1619 | // child windows no longer valid |
1618 | emit closingDown(); | 1620 | emit closingDown(); |
1619 | 1621 | ||
1620 | mCalendar->close(); | 1622 | mCalendar->close(); |
1621 | setModified(false); | 1623 | setModified(false); |
1622 | updateView(); | 1624 | updateView(); |
1623 | } | 1625 | } |
1624 | 1626 | ||
1625 | void CalendarView::archiveCalendar() | 1627 | void CalendarView::archiveCalendar() |
1626 | { | 1628 | { |
1627 | mDialogManager->showArchiveDialog(); | 1629 | mDialogManager->showArchiveDialog(); |
1628 | } | 1630 | } |
1629 | 1631 | ||
1630 | 1632 | ||
1631 | void CalendarView::readSettings() | 1633 | void CalendarView::readSettings() |
1632 | { | 1634 | { |
1633 | 1635 | ||
1634 | 1636 | ||
1635 | // mViewManager->showAgendaView(); | 1637 | // mViewManager->showAgendaView(); |
1636 | QString str; | 1638 | QString str; |
1637 | //qDebug("CalendarView::readSettings() "); | 1639 | //qDebug("CalendarView::readSettings() "); |
1638 | // read settings from the KConfig, supplying reasonable | 1640 | // read settings from the KConfig, supplying reasonable |
1639 | // defaults where none are to be found | 1641 | // defaults where none are to be found |
1640 | KConfig *config = KOGlobals::config(); | 1642 | KConfig *config = KOGlobals::config(); |
1641 | #ifndef KORG_NOSPLITTER | 1643 | #ifndef KORG_NOSPLITTER |
1642 | config->setGroup("KOrganizer Geometry"); | 1644 | config->setGroup("KOrganizer Geometry"); |
1643 | 1645 | ||
1644 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1646 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1645 | if (sizes.count() != 2) { | 1647 | if (sizes.count() != 2) { |
1646 | sizes << mDateNavigator->minimumSizeHint().width(); | 1648 | sizes << mDateNavigator->minimumSizeHint().width(); |
1647 | sizes << 300; | 1649 | sizes << 300; |
1648 | } | 1650 | } |
1649 | mPanner->setSizes(sizes); | 1651 | mPanner->setSizes(sizes); |
1650 | 1652 | ||
1651 | sizes = config->readIntListEntry("Separator2"); | 1653 | sizes = config->readIntListEntry("Separator2"); |
@@ -2256,97 +2258,97 @@ void CalendarView::beamIncidence(Incidence * Inc) | |||
2256 | } | 2258 | } |
2257 | void CalendarView::beamCalendar() | 2259 | void CalendarView::beamCalendar() |
2258 | { | 2260 | { |
2259 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2261 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2260 | //qDebug("beamCalendar() "); | 2262 | //qDebug("beamCalendar() "); |
2261 | beamIncidenceList( delSel ); | 2263 | beamIncidenceList( delSel ); |
2262 | } | 2264 | } |
2263 | void CalendarView::beamFilteredCalendar() | 2265 | void CalendarView::beamFilteredCalendar() |
2264 | { | 2266 | { |
2265 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2267 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2266 | //qDebug("beamFilteredCalendar() "); | 2268 | //qDebug("beamFilteredCalendar() "); |
2267 | beamIncidenceList( delSel ); | 2269 | beamIncidenceList( delSel ); |
2268 | } | 2270 | } |
2269 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2271 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2270 | { | 2272 | { |
2271 | if ( beamDialog->exec () == QDialog::Rejected ) | 2273 | if ( beamDialog->exec () == QDialog::Rejected ) |
2272 | return; | 2274 | return; |
2273 | 2275 | ||
2274 | QString fn = "/tmp/kopibeamfile"; | 2276 | QString fn = "/tmp/kopibeamfile"; |
2275 | QString mes; | 2277 | QString mes; |
2276 | bool createbup = true; | 2278 | bool createbup = true; |
2277 | if ( createbup ) { | 2279 | if ( createbup ) { |
2278 | QString description = "\n"; | 2280 | QString description = "\n"; |
2279 | CalendarLocal* cal = new CalendarLocal(); | 2281 | CalendarLocal* cal = new CalendarLocal(); |
2280 | if ( beamDialog->beamLocal() ) | 2282 | if ( beamDialog->beamLocal() ) |
2281 | cal->setLocalTime(); | 2283 | cal->setLocalTime(); |
2282 | else | 2284 | else |
2283 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 2285 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
2284 | Incidence *incidence = delSel.first(); | 2286 | Incidence *incidence = delSel.first(); |
2285 | bool addText = false; | 2287 | bool addText = false; |
2286 | if ( delSel.count() < 10 ) | 2288 | if ( delSel.count() < 10 ) |
2287 | addText = true; | 2289 | addText = true; |
2288 | else { | 2290 | else { |
2289 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2291 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2290 | } | 2292 | } |
2291 | while ( incidence ) { | 2293 | while ( incidence ) { |
2292 | Incidence *in = incidence->clone(); | 2294 | Incidence *in = incidence->clone(); |
2293 | if ( addText ) | 2295 | if ( addText ) |
2294 | description += in->summary() + "\n"; | 2296 | description += in->summary() + "\n"; |
2295 | cal->addIncidence( in ); | 2297 | cal->addIncidence( in ); |
2296 | incidence = delSel.next(); | 2298 | incidence = delSel.next(); |
2297 | } | 2299 | } |
2298 | if ( beamDialog->beamVcal() ) { | 2300 | if ( beamDialog->beamVcal() ) { |
2299 | fn += ".vcs"; | 2301 | fn += ".vcs"; |
2300 | FileStorage storage( cal, fn, new VCalFormat ); | 2302 | FileStorage storage( cal, fn, new VCalFormat ); |
2301 | storage.save(); | 2303 | storage.save(); |
2302 | } else { | 2304 | } else { |
2303 | fn += ".ics"; | 2305 | fn += ".ics"; |
2304 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2306 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2305 | storage.save(); | 2307 | storage.save(); |
2306 | } | 2308 | } |
2307 | delete cal; | 2309 | delete cal; |
2308 | mes = i18n("KO/Pi: Ready for beaming"); | 2310 | mes = i18n("KO/Pi: Ready for beaming"); |
2309 | setCaption(mes); | 2311 | setCaption(mes); |
2310 | 2312 | ||
2311 | #ifndef DESKTOP_VERSION | 2313 | #ifndef DESKTOP_VERSION |
2312 | Ir *ir = new Ir( this ); | 2314 | Ir *ir = new Ir( this ); |
2313 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2315 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2314 | ir->send( fn, description, "text/x-vCalendar" ); | 2316 | ir->send( fn, description, "text/x-vCalendar" ); |
2315 | #endif | 2317 | #endif |
2316 | } | 2318 | } |
2317 | } | 2319 | } |
2318 | void CalendarView::beamDone( Ir *ir ) | 2320 | void CalendarView::beamDone( Ir *ir ) |
2319 | { | 2321 | { |
2320 | #ifndef DESKTOP_VERSION | 2322 | #ifndef DESKTOP_VERSION |
2321 | delete ir; | 2323 | delete ir; |
2322 | #endif | 2324 | #endif |
2323 | } | 2325 | } |
2324 | 2326 | ||
2325 | void CalendarView::moveIncidence(Incidence * inc ) | 2327 | void CalendarView::moveIncidence(Incidence * inc ) |
2326 | { | 2328 | { |
2327 | if ( !inc ) return; | 2329 | if ( !inc ) return; |
2328 | // qDebug("showDatePickerForIncidence( ) "); | 2330 | // qDebug("showDatePickerForIncidence( ) "); |
2329 | if ( mDateFrame->isVisible() ) | 2331 | if ( mDateFrame->isVisible() ) |
2330 | mDateFrame->hide(); | 2332 | mDateFrame->hide(); |
2331 | else { | 2333 | else { |
2332 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2334 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2333 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2335 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2334 | int dw = QApplication::desktop()->width(); | 2336 | int dw = QApplication::desktop()->width(); |
2335 | int dh = QApplication::desktop()->height(); | 2337 | int dh = QApplication::desktop()->height(); |
2336 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2338 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2337 | mDateFrame->show(); | 2339 | mDateFrame->show(); |
2338 | } | 2340 | } |
2339 | mDatePickerMode = 2; | 2341 | mDatePickerMode = 2; |
2340 | mMoveIncidence = inc ; | 2342 | mMoveIncidence = inc ; |
2341 | QDate da; | 2343 | QDate da; |
2342 | if ( mMoveIncidence->type() == "Todo" ) { | 2344 | if ( mMoveIncidence->type() == "Todo" ) { |
2343 | Todo * to = (Todo *) mMoveIncidence; | 2345 | Todo * to = (Todo *) mMoveIncidence; |
2344 | if ( to->hasDueDate() ) | 2346 | if ( to->hasDueDate() ) |
2345 | da = to->dtDue().date(); | 2347 | da = to->dtDue().date(); |
2346 | else | 2348 | else |
2347 | da = QDate::currentDate(); | 2349 | da = QDate::currentDate(); |
2348 | } else { | 2350 | } else { |
2349 | da = mMoveIncidence->dtStart().date(); | 2351 | da = mMoveIncidence->dtStart().date(); |
2350 | } | 2352 | } |
2351 | mDatePicker->setDate( da ); | 2353 | mDatePicker->setDate( da ); |
2352 | } | 2354 | } |
@@ -2811,97 +2813,97 @@ void CalendarView::deleteEvent(Event *anEvent) | |||
2811 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2813 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2812 | schedule(Scheduler::Cancel,anEvent); | 2814 | schedule(Scheduler::Cancel,anEvent); |
2813 | checkExternalId( anEvent); | 2815 | checkExternalId( anEvent); |
2814 | mCalendar->deleteEvent(anEvent); | 2816 | mCalendar->deleteEvent(anEvent); |
2815 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2817 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2816 | } | 2818 | } |
2817 | } // if-else | 2819 | } // if-else |
2818 | emit updateSearchDialog(); | 2820 | emit updateSearchDialog(); |
2819 | } | 2821 | } |
2820 | 2822 | ||
2821 | bool CalendarView::deleteEvent(const QString &uid) | 2823 | bool CalendarView::deleteEvent(const QString &uid) |
2822 | { | 2824 | { |
2823 | Event *ev = mCalendar->event(uid); | 2825 | Event *ev = mCalendar->event(uid); |
2824 | if (ev) { | 2826 | if (ev) { |
2825 | deleteEvent(ev); | 2827 | deleteEvent(ev); |
2826 | return true; | 2828 | return true; |
2827 | } else { | 2829 | } else { |
2828 | return false; | 2830 | return false; |
2829 | } | 2831 | } |
2830 | } | 2832 | } |
2831 | 2833 | ||
2832 | /*****************************************************************************/ | 2834 | /*****************************************************************************/ |
2833 | 2835 | ||
2834 | void CalendarView::action_mail() | 2836 | void CalendarView::action_mail() |
2835 | { | 2837 | { |
2836 | #ifndef KORG_NOMAIL | 2838 | #ifndef KORG_NOMAIL |
2837 | KOMailClient mailClient; | 2839 | KOMailClient mailClient; |
2838 | 2840 | ||
2839 | Incidence *incidence = currentSelection(); | 2841 | Incidence *incidence = currentSelection(); |
2840 | 2842 | ||
2841 | if (!incidence) { | 2843 | if (!incidence) { |
2842 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2844 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2843 | return; | 2845 | return; |
2844 | } | 2846 | } |
2845 | if(incidence->attendeeCount() == 0 ) { | 2847 | if(incidence->attendeeCount() == 0 ) { |
2846 | KMessageBox::sorry(this, | 2848 | KMessageBox::sorry(this, |
2847 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2849 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2848 | return; | 2850 | return; |
2849 | } | 2851 | } |
2850 | 2852 | ||
2851 | CalendarLocal cal_tmp; | 2853 | CalendarLocal cal_tmp; |
2852 | Event *event = 0; | 2854 | Event *event = 0; |
2853 | Event *ev = 0; | 2855 | Event *ev = 0; |
2854 | if ( incidence && incidence->type() == "Event" ) { | 2856 | if ( incidence && incidence->type() == "Event" ) { |
2855 | event = static_cast<Event *>(incidence); | 2857 | event = static_cast<Event *>(incidence); |
2856 | ev = new Event(*event); | 2858 | ev = new Event(*event); |
2857 | cal_tmp.addEvent(ev); | 2859 | cal_tmp.addEvent(ev); |
2858 | } | 2860 | } |
2859 | ICalFormat mForm( KOPrefs::instance()->mUseQuicksave); | 2861 | ICalFormat mForm(); |
2860 | QString attachment = mForm.toString( &cal_tmp ); | 2862 | QString attachment = mForm.toString( &cal_tmp ); |
2861 | if (ev) delete(ev); | 2863 | if (ev) delete(ev); |
2862 | 2864 | ||
2863 | mailClient.mailAttendees(currentSelection(), attachment); | 2865 | mailClient.mailAttendees(currentSelection(), attachment); |
2864 | 2866 | ||
2865 | #endif | 2867 | #endif |
2866 | 2868 | ||
2867 | #if 0 | 2869 | #if 0 |
2868 | Event *anEvent = 0; | 2870 | Event *anEvent = 0; |
2869 | if (mViewManager->currentView()->isEventView()) { | 2871 | if (mViewManager->currentView()->isEventView()) { |
2870 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 2872 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
2871 | } | 2873 | } |
2872 | 2874 | ||
2873 | if (!anEvent) { | 2875 | if (!anEvent) { |
2874 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2876 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2875 | return; | 2877 | return; |
2876 | } | 2878 | } |
2877 | if(anEvent->attendeeCount() == 0 ) { | 2879 | if(anEvent->attendeeCount() == 0 ) { |
2878 | KMessageBox::sorry(this, | 2880 | KMessageBox::sorry(this, |
2879 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2881 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2880 | return; | 2882 | return; |
2881 | } | 2883 | } |
2882 | 2884 | ||
2883 | mailobject.emailEvent(anEvent); | 2885 | mailobject.emailEvent(anEvent); |
2884 | #endif | 2886 | #endif |
2885 | } | 2887 | } |
2886 | 2888 | ||
2887 | 2889 | ||
2888 | void CalendarView::schedule_publish(Incidence *incidence) | 2890 | void CalendarView::schedule_publish(Incidence *incidence) |
2889 | { | 2891 | { |
2890 | Event *event = 0; | 2892 | Event *event = 0; |
2891 | Todo *todo = 0; | 2893 | Todo *todo = 0; |
2892 | 2894 | ||
2893 | if (incidence == 0) { | 2895 | if (incidence == 0) { |
2894 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 2896 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
2895 | if (incidence == 0) { | 2897 | if (incidence == 0) { |
2896 | incidence = mTodoList->selectedIncidences().first(); | 2898 | incidence = mTodoList->selectedIncidences().first(); |
2897 | } | 2899 | } |
2898 | } | 2900 | } |
2899 | if ( incidence && incidence->type() == "Event" ) { | 2901 | if ( incidence && incidence->type() == "Event" ) { |
2900 | event = static_cast<Event *>(incidence); | 2902 | event = static_cast<Event *>(incidence); |
2901 | } else { | 2903 | } else { |
2902 | if ( incidence && incidence->type() == "Todo" ) { | 2904 | if ( incidence && incidence->type() == "Todo" ) { |
2903 | todo = static_cast<Todo *>(incidence); | 2905 | todo = static_cast<Todo *>(incidence); |
2904 | } | 2906 | } |
2905 | } | 2907 | } |
2906 | 2908 | ||
2907 | if (!event && !todo) { | 2909 | if (!event && !todo) { |
@@ -3096,97 +3098,97 @@ void CalendarView::setReadOnly(bool readOnly) | |||
3096 | } | 3098 | } |
3097 | 3099 | ||
3098 | bool CalendarView::isModified() | 3100 | bool CalendarView::isModified() |
3099 | { | 3101 | { |
3100 | return mModified; | 3102 | return mModified; |
3101 | } | 3103 | } |
3102 | 3104 | ||
3103 | void CalendarView::printSetup() | 3105 | void CalendarView::printSetup() |
3104 | { | 3106 | { |
3105 | #ifndef KORG_NOPRINTER | 3107 | #ifndef KORG_NOPRINTER |
3106 | createPrinter(); | 3108 | createPrinter(); |
3107 | 3109 | ||
3108 | mCalPrinter->setupPrinter(); | 3110 | mCalPrinter->setupPrinter(); |
3109 | #endif | 3111 | #endif |
3110 | } | 3112 | } |
3111 | 3113 | ||
3112 | void CalendarView::print() | 3114 | void CalendarView::print() |
3113 | { | 3115 | { |
3114 | #ifndef KORG_NOPRINTER | 3116 | #ifndef KORG_NOPRINTER |
3115 | createPrinter(); | 3117 | createPrinter(); |
3116 | 3118 | ||
3117 | DateList tmpDateList = mNavigator->selectedDates(); | 3119 | DateList tmpDateList = mNavigator->selectedDates(); |
3118 | mCalPrinter->print(CalPrinter::Month, | 3120 | mCalPrinter->print(CalPrinter::Month, |
3119 | tmpDateList.first(), tmpDateList.last()); | 3121 | tmpDateList.first(), tmpDateList.last()); |
3120 | #endif | 3122 | #endif |
3121 | } | 3123 | } |
3122 | 3124 | ||
3123 | void CalendarView::printPreview() | 3125 | void CalendarView::printPreview() |
3124 | { | 3126 | { |
3125 | #ifndef KORG_NOPRINTER | 3127 | #ifndef KORG_NOPRINTER |
3126 | kdDebug() << "CalendarView::printPreview()" << endl; | 3128 | kdDebug() << "CalendarView::printPreview()" << endl; |
3127 | 3129 | ||
3128 | createPrinter(); | 3130 | createPrinter(); |
3129 | 3131 | ||
3130 | DateList tmpDateList = mNavigator->selectedDates(); | 3132 | DateList tmpDateList = mNavigator->selectedDates(); |
3131 | 3133 | ||
3132 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3134 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3133 | tmpDateList.last()); | 3135 | tmpDateList.last()); |
3134 | #endif | 3136 | #endif |
3135 | } | 3137 | } |
3136 | 3138 | ||
3137 | void CalendarView::exportICalendar() | 3139 | void CalendarView::exportICalendar() |
3138 | { | 3140 | { |
3139 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3141 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3140 | 3142 | ||
3141 | // Force correct extension | 3143 | // Force correct extension |
3142 | if (filename.right(4) != ".ics") filename += ".ics"; | 3144 | if (filename.right(4) != ".ics") filename += ".ics"; |
3143 | 3145 | ||
3144 | FileStorage storage( mCalendar, filename, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 3146 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3145 | storage.save(); | 3147 | storage.save(); |
3146 | } | 3148 | } |
3147 | 3149 | ||
3148 | bool CalendarView::exportVCalendar( QString filename ) | 3150 | bool CalendarView::exportVCalendar( QString filename ) |
3149 | { | 3151 | { |
3150 | if (mCalendar->journals().count() > 0) { | 3152 | if (mCalendar->journals().count() > 0) { |
3151 | int result = KMessageBox::warningContinueCancel(this, | 3153 | int result = KMessageBox::warningContinueCancel(this, |
3152 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3154 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3153 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3155 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3154 | true); | 3156 | true); |
3155 | if (result != KMessageBox::Continue) return false; | 3157 | if (result != KMessageBox::Continue) return false; |
3156 | } | 3158 | } |
3157 | 3159 | ||
3158 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3160 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3159 | 3161 | ||
3160 | // Force correct extension | 3162 | // Force correct extension |
3161 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3163 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3162 | 3164 | ||
3163 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3165 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3164 | return storage.save(); | 3166 | return storage.save(); |
3165 | 3167 | ||
3166 | } | 3168 | } |
3167 | 3169 | ||
3168 | void CalendarView::eventUpdated(Incidence *) | 3170 | void CalendarView::eventUpdated(Incidence *) |
3169 | { | 3171 | { |
3170 | setModified(); | 3172 | setModified(); |
3171 | // Don't call updateView here. The code, which has caused the update of the | 3173 | // Don't call updateView here. The code, which has caused the update of the |
3172 | // event is responsible for updating the view. | 3174 | // event is responsible for updating the view. |
3173 | // updateView(); | 3175 | // updateView(); |
3174 | } | 3176 | } |
3175 | 3177 | ||
3176 | void CalendarView::adaptNavigationUnits() | 3178 | void CalendarView::adaptNavigationUnits() |
3177 | { | 3179 | { |
3178 | if (mViewManager->currentView()->isEventView()) { | 3180 | if (mViewManager->currentView()->isEventView()) { |
3179 | int days = mViewManager->currentView()->currentDateCount(); | 3181 | int days = mViewManager->currentView()->currentDateCount(); |
3180 | if (days == 1) { | 3182 | if (days == 1) { |
3181 | emit changeNavStringPrev(i18n("&Previous Day")); | 3183 | emit changeNavStringPrev(i18n("&Previous Day")); |
3182 | emit changeNavStringNext(i18n("&Next Day")); | 3184 | emit changeNavStringNext(i18n("&Next Day")); |
3183 | } else { | 3185 | } else { |
3184 | emit changeNavStringPrev(i18n("&Previous Week")); | 3186 | emit changeNavStringPrev(i18n("&Previous Week")); |
3185 | emit changeNavStringNext(i18n("&Next Week")); | 3187 | emit changeNavStringNext(i18n("&Next Week")); |
3186 | } | 3188 | } |
3187 | } | 3189 | } |
3188 | } | 3190 | } |
3189 | 3191 | ||
3190 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3192 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3191 | { | 3193 | { |
3192 | if ( incidence ) mTodoList->clearSelection(); | 3194 | if ( incidence ) mTodoList->clearSelection(); |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 0034715..e0623d5 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -179,97 +179,96 @@ KOPrefs::KOPrefs() : | |||
179 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 179 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
180 | addItemFont("EventView Font",&mEventViewFont); | 180 | addItemFont("EventView Font",&mEventViewFont); |
181 | 181 | ||
182 | // KPrefs::setCurrentGroup("SyncProfiles"); | 182 | // KPrefs::setCurrentGroup("SyncProfiles"); |
183 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | 183 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); |
184 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | 184 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); |
185 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | 185 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); |
186 | 186 | ||
187 | KPrefs::setCurrentGroup("RemoteSyncing"); | 187 | KPrefs::setCurrentGroup("RemoteSyncing"); |
188 | // addItemBool("UsePasswd",&mUsePassWd,false); | 188 | // addItemBool("UsePasswd",&mUsePassWd,false); |
189 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | 189 | // addItemBool("WriteBackFile",&mWriteBackFile,true); |
190 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | 190 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); |
191 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | 191 | // addItemBool("AskForPreferences",&mAskForPreferences,true); |
192 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 192 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
193 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 193 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
194 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 194 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
195 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 195 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
196 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 196 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
197 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 197 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
198 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | 198 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); |
199 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 199 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
200 | 200 | ||
201 | #ifdef _WIN32_ | 201 | #ifdef _WIN32_ |
202 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 202 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
203 | #else | 203 | #else |
204 | QString hdp= locateLocal("data","korganizer")+"/"; | 204 | QString hdp= locateLocal("data","korganizer")+"/"; |
205 | #endif | 205 | #endif |
206 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | 206 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); |
207 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); | 207 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); |
208 | // addItemString("RemotePassWd",&mRemotePassWd, ""); | 208 | // addItemString("RemotePassWd",&mRemotePassWd, ""); |
209 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | 209 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); |
210 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | 210 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); |
211 | 211 | ||
212 | 212 | ||
213 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 213 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
214 | 214 | ||
215 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 215 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
216 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 216 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
217 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 217 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
218 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 218 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
219 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 219 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
220 | 220 | ||
221 | 221 | ||
222 | KPrefs::setCurrentGroup("Locale"); | 222 | KPrefs::setCurrentGroup("Locale"); |
223 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 223 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
224 | addItemInt("PreferredTime",&mPreferredTime,0); | 224 | addItemInt("PreferredTime",&mPreferredTime,0); |
225 | addItemInt("PreferredDate",&mPreferredDate,0); | 225 | addItemInt("PreferredDate",&mPreferredDate,0); |
226 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 226 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
227 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | ||
228 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 227 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
229 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 228 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
230 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 229 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
231 | 230 | ||
232 | 231 | ||
233 | KPrefs::setCurrentGroup("Colors"); | 232 | KPrefs::setCurrentGroup("Colors"); |
234 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 233 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
235 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 234 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
236 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 235 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
237 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 236 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
238 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 237 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
239 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 238 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
240 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 239 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
241 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 240 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
242 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 241 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
243 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 242 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
244 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 243 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
245 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 244 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
246 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 245 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
247 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 246 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
248 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 247 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
249 | addItemBool("UseAppColors",&mUseAppColors,false); | 248 | addItemBool("UseAppColors",&mUseAppColors,false); |
250 | 249 | ||
251 | 250 | ||
252 | 251 | ||
253 | KPrefs::setCurrentGroup("Views"); | 252 | KPrefs::setCurrentGroup("Views"); |
254 | addItemInt("Hour Size",&mHourSize,8); | 253 | addItemInt("Hour Size",&mHourSize,8); |
255 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 254 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
256 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 255 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
257 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 256 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
258 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 257 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
259 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 258 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
260 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 259 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
261 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 260 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
262 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 261 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
263 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 262 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
264 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 263 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
265 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 264 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
266 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | 265 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); |
267 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 266 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
268 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 267 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
269 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 268 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
270 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 269 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
271 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | 270 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); |
272 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 271 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
273 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 272 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
274 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 273 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
275 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 274 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 696433e..7abd741 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -221,93 +221,92 @@ class KOPrefs : public KPimPrefs | |||
221 | QColor *categoryColor(QString cat); | 221 | QColor *categoryColor(QString cat); |
222 | 222 | ||
223 | QString mArchiveFile; | 223 | QString mArchiveFile; |
224 | QString mHtmlExportFile; | 224 | QString mHtmlExportFile; |
225 | bool mHtmlWithSave; | 225 | bool mHtmlWithSave; |
226 | 226 | ||
227 | QStringList mSelectedPlugins; | 227 | QStringList mSelectedPlugins; |
228 | 228 | ||
229 | QString mLastImportFile; | 229 | QString mLastImportFile; |
230 | QString mLastVcalFile; | 230 | QString mLastVcalFile; |
231 | QString mLastSaveFile; | 231 | QString mLastSaveFile; |
232 | QString mLastLoadFile; | 232 | QString mLastLoadFile; |
233 | QString mLastSyncedLocalFile; | 233 | QString mLastSyncedLocalFile; |
234 | 234 | ||
235 | 235 | ||
236 | QString mDefaultAlarmFile; | 236 | QString mDefaultAlarmFile; |
237 | int mIMIPScheduler; | 237 | int mIMIPScheduler; |
238 | int mIMIPSend; | 238 | int mIMIPSend; |
239 | QStringList mAdditionalMails; | 239 | QStringList mAdditionalMails; |
240 | int mIMIPAutoRefresh; | 240 | int mIMIPAutoRefresh; |
241 | int mIMIPAutoInsertReply; | 241 | int mIMIPAutoInsertReply; |
242 | int mIMIPAutoInsertRequest; | 242 | int mIMIPAutoInsertRequest; |
243 | int mIMIPAutoFreeBusy; | 243 | int mIMIPAutoFreeBusy; |
244 | int mIMIPAutoFreeBusyReply; | 244 | int mIMIPAutoFreeBusyReply; |
245 | 245 | ||
246 | QStringList mTodoTemplates; | 246 | QStringList mTodoTemplates; |
247 | QStringList mEventTemplates; | 247 | QStringList mEventTemplates; |
248 | 248 | ||
249 | int mDestination; | 249 | int mDestination; |
250 | 250 | ||
251 | 251 | ||
252 | bool mEditOnDoubleClick; | 252 | bool mEditOnDoubleClick; |
253 | bool mViewChangeHoldFullscreen; | 253 | bool mViewChangeHoldFullscreen; |
254 | bool mViewChangeHoldNonFullscreen; | 254 | bool mViewChangeHoldNonFullscreen; |
255 | bool mCenterOnCurrentTime; | 255 | bool mCenterOnCurrentTime; |
256 | bool mSetTimeToDayStartAt; | 256 | bool mSetTimeToDayStartAt; |
257 | bool mHighlightCurrentDay; | 257 | bool mHighlightCurrentDay; |
258 | bool mUseHighlightLightColor; | 258 | bool mUseHighlightLightColor; |
259 | bool mListViewMonthTimespan; | 259 | bool mListViewMonthTimespan; |
260 | bool mWNViewShowsParents; | 260 | bool mWNViewShowsParents; |
261 | bool mWNViewShowLocation; | 261 | bool mWNViewShowLocation; |
262 | bool mTodoViewShowsPercentage; | 262 | bool mTodoViewShowsPercentage; |
263 | bool mTodoViewUsesCatColors; | 263 | bool mTodoViewUsesCatColors; |
264 | bool mTodoViewUsesSmallFont; | 264 | bool mTodoViewUsesSmallFont; |
265 | bool mTodoViewUsesForegroundColor; | 265 | bool mTodoViewUsesForegroundColor; |
266 | bool mMonthViewUsesForegroundColor; | 266 | bool mMonthViewUsesForegroundColor; |
267 | 267 | ||
268 | bool mHightlightDateTimeEdit; | 268 | bool mHightlightDateTimeEdit; |
269 | bool mUseQuicksave; | ||
270 | bool mShortDateInViewer; | 269 | bool mShortDateInViewer; |
271 | 270 | ||
272 | QStringList mLocationDefaults; | 271 | QStringList mLocationDefaults; |
273 | QStringList mEventSummaryUser; | 272 | QStringList mEventSummaryUser; |
274 | QStringList mTodoSummaryUser; | 273 | QStringList mTodoSummaryUser; |
275 | 274 | ||
276 | bool mUseInternalAlarmNotification; | 275 | bool mUseInternalAlarmNotification; |
277 | int mAlarmPlayBeeps; | 276 | int mAlarmPlayBeeps; |
278 | int mAlarmSuspendTime; | 277 | int mAlarmSuspendTime; |
279 | int mAlarmSuspendCount; | 278 | int mAlarmSuspendCount; |
280 | int mAlarmBeepInterval; | 279 | int mAlarmBeepInterval; |
281 | 280 | ||
282 | QString mPassiveSyncPort; | 281 | QString mPassiveSyncPort; |
283 | QString mActiveSyncPort; | 282 | QString mActiveSyncPort; |
284 | QString mActiveSyncIP; | 283 | QString mActiveSyncIP; |
285 | 284 | ||
286 | 285 | ||
287 | //US I copied the following settings into KPimGlobalPrefs | 286 | //US I copied the following settings into KPimGlobalPrefs |
288 | // that allows us later to easily remove the settings from here. | 287 | // that allows us later to easily remove the settings from here. |
289 | int mPreferredDate; | 288 | int mPreferredDate; |
290 | QString mUserDateFormatLong; | 289 | QString mUserDateFormatLong; |
291 | QString mUserDateFormatShort; | 290 | QString mUserDateFormatShort; |
292 | int mPreferredLanguage; | 291 | int mPreferredLanguage; |
293 | int mPreferredTime; | 292 | int mPreferredTime; |
294 | bool mWeekStartsOnSunday; | 293 | bool mWeekStartsOnSunday; |
295 | QString mTimeZoneId; | 294 | QString mTimeZoneId; |
296 | bool mUseDaylightsaving; | 295 | bool mUseDaylightsaving; |
297 | int mDaylightsavingStart; | 296 | int mDaylightsavingStart; |
298 | int mDaylightsavingEnd; | 297 | int mDaylightsavingEnd; |
299 | 298 | ||
300 | 299 | ||
301 | private: | 300 | private: |
302 | QDict<QColor> mCategoryColors; | 301 | QDict<QColor> mCategoryColors; |
303 | QColor mDefaultCategoryColor; | 302 | QColor mDefaultCategoryColor; |
304 | 303 | ||
305 | QFont mDefaultTimeBarFont; | 304 | QFont mDefaultTimeBarFont; |
306 | QFont mDefaultViewFont; | 305 | QFont mDefaultViewFont; |
307 | QFont mDefaultMonthViewFont; | 306 | QFont mDefaultMonthViewFont; |
308 | 307 | ||
309 | QString mName; | 308 | QString mName; |
310 | QString mEmail; | 309 | QString mEmail; |
311 | }; | 310 | }; |
312 | 311 | ||
313 | #endif | 312 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5aa75f5..43ee2d7 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1907,123 +1907,118 @@ void MainWindow::enableQuick() | |||
1907 | lay.addWidget( &lab); | 1907 | lay.addWidget( &lab); |
1908 | 1908 | ||
1909 | QLineEdit lepw ( &dia ); | 1909 | QLineEdit lepw ( &dia ); |
1910 | lepw.setText( "abc" ); | 1910 | lepw.setText( "abc" ); |
1911 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 1911 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
1912 | lay.addWidget( &label2); | 1912 | lay.addWidget( &label2); |
1913 | lay.addWidget( &lepw); | 1913 | lay.addWidget( &lepw); |
1914 | dia.setFixedSize( 230,80 ); | 1914 | dia.setFixedSize( 230,80 ); |
1915 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 1915 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
1916 | QPushButton pb ( "OK", &dia); | 1916 | QPushButton pb ( "OK", &dia); |
1917 | lay.addWidget( &pb ); | 1917 | lay.addWidget( &pb ); |
1918 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1918 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1919 | dia.show(); | 1919 | dia.show(); |
1920 | int res = dia.exec(); | 1920 | int res = dia.exec(); |
1921 | if ( res ) | 1921 | if ( res ) |
1922 | retfile = lab.text(); | 1922 | retfile = lab.text(); |
1923 | else | 1923 | else |
1924 | return; | 1924 | return; |
1925 | dia.hide(); | 1925 | dia.hide(); |
1926 | passWordPiSync = lepw.text(); | 1926 | passWordPiSync = lepw.text(); |
1927 | qApp->processEvents(); | 1927 | qApp->processEvents(); |
1928 | KOPrefs::instance()->mPassiveSyncPort = retfile; | 1928 | KOPrefs::instance()->mPassiveSyncPort = retfile; |
1929 | bool ok; | 1929 | bool ok; |
1930 | Q_UINT16 port = retfile.toUInt(&ok); | 1930 | Q_UINT16 port = retfile.toUInt(&ok); |
1931 | if ( ! ok ) { | 1931 | if ( ! ok ) { |
1932 | KMessageBox::information( this, i18n("No valid port")); | 1932 | KMessageBox::information( this, i18n("No valid port")); |
1933 | return; | 1933 | return; |
1934 | } | 1934 | } |
1935 | //qDebug("port %d ", port); | 1935 | //qDebug("port %d ", port); |
1936 | mServerSocket = new KServerSocket ( passWordPiSync, port ,1 ); | 1936 | mServerSocket = new KServerSocket ( passWordPiSync, port ,1 ); |
1937 | mServerSocket->setFileName( defaultFileName() ); | 1937 | mServerSocket->setFileName( defaultFileName() ); |
1938 | //qDebug("connected "); | 1938 | //qDebug("connected "); |
1939 | if ( !mServerSocket->ok() ) { | 1939 | if ( !mServerSocket->ok() ) { |
1940 | qWarning("Failed to bind to port %d", port); | 1940 | qWarning("Failed to bind to port %d", port); |
1941 | delete mServerSocket; | 1941 | delete mServerSocket; |
1942 | mServerSocket = 0; | 1942 | mServerSocket = 0; |
1943 | return; | 1943 | return; |
1944 | } | 1944 | } |
1945 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); | 1945 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); |
1946 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); | 1946 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | void MainWindow::getFile( bool success ) | 1949 | void MainWindow::getFile( bool success ) |
1950 | { | 1950 | { |
1951 | if ( ! success ) { | 1951 | if ( ! success ) { |
1952 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1952 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1953 | return; | 1953 | return; |
1954 | } | 1954 | } |
1955 | // pending adjust time for watchSavedFile() | 1955 | mView->watchSavedFile(); |
1956 | //mView->watchSavedFile(); | ||
1957 | mView->openCalendar( defaultFileName() ); | 1956 | mView->openCalendar( defaultFileName() ); |
1958 | setCaption( i18n("Pi-Sync successful!") ); | 1957 | setCaption( i18n("Pi-Sync successful!") ); |
1959 | 1958 | ||
1960 | } | 1959 | } |
1961 | 1960 | ||
1962 | 1961 | ||
1963 | void MainWindow::syncPi() | 1962 | void MainWindow::syncPi() |
1964 | { | 1963 | { |
1965 | qApp->processEvents(); | 1964 | qApp->processEvents(); |
1966 | performQuickQuick(); | ||
1967 | } | ||
1968 | |||
1969 | void MainWindow::performQuickQuick() | ||
1970 | { | ||
1971 | bool ok; | 1965 | bool ok; |
1972 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); | 1966 | Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); |
1973 | if ( ! ok ) { | 1967 | if ( ! ok ) { |
1974 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1968 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1975 | return; | 1969 | return; |
1976 | } | 1970 | } |
1977 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); | 1971 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this ); |
1978 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1972 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1979 | setCaption( i18n("Sending request for remote file ...") ); | 1973 | setCaption( i18n("Sending request for remote file ...") ); |
1980 | commandSocket->readFile( syncFileName() ); | 1974 | commandSocket->readFile( syncFileName() ); |
1981 | } | 1975 | } |
1976 | |||
1982 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) | 1977 | void MainWindow::deleteCommandSocket(KCommandSocket*s, int state) |
1983 | { | 1978 | { |
1984 | qDebug("MainWindow::deleteCommandSocket %d", state); | 1979 | qDebug("MainWindow::deleteCommandSocket %d", state); |
1985 | 1980 | ||
1986 | //enum { success, errorW, errorR, quiet }; | 1981 | //enum { success, errorW, errorR, quiet }; |
1987 | if ( state == KCommandSocket::errorR ) { | 1982 | if ( state == KCommandSocket::errorR ) { |
1988 | setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1983 | setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1989 | delete s; | 1984 | delete s; |
1990 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); | 1985 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); |
1991 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1986 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1992 | commandSocket->sendStop(); | 1987 | commandSocket->sendStop(); |
1993 | return; | 1988 | return; |
1994 | 1989 | ||
1995 | } else if ( state == KCommandSocket::errorW ) { | 1990 | } else if ( state == KCommandSocket::errorW ) { |
1996 | setCaption( i18n("ERROR:Writing back file failed.") ); | 1991 | setCaption( i18n("ERROR:Writing back file failed.") ); |
1997 | 1992 | ||
1998 | } else if ( state == KCommandSocket::successR ) { | 1993 | } else if ( state == KCommandSocket::successR ) { |
1999 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1994 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
2000 | 1995 | ||
2001 | } else if ( state == KCommandSocket::successW ) { | 1996 | } else if ( state == KCommandSocket::successW ) { |
2002 | setCaption( i18n("Pi-Sync succesful!") ); | 1997 | setCaption( i18n("Pi-Sync succesful!") ); |
2003 | } | 1998 | } |
2004 | 1999 | ||
2005 | delete s; | 2000 | delete s; |
2006 | } | 2001 | } |
2007 | 2002 | ||
2008 | void MainWindow::readFileFromSocket() | 2003 | void MainWindow::readFileFromSocket() |
2009 | { | 2004 | { |
2010 | QString fileName = syncFileName(); | 2005 | QString fileName = syncFileName(); |
2011 | setCaption( i18n("Remote file saved to temp file.") ); | 2006 | setCaption( i18n("Remote file saved to temp file.") ); |
2012 | if ( ! syncWithFile( fileName , true ) ) { | 2007 | if ( ! syncWithFile( fileName , true ) ) { |
2013 | setCaption( i18n("Syncing failed.") ); | 2008 | setCaption( i18n("Syncing failed.") ); |
2014 | qDebug("Syncing failed "); | 2009 | qDebug("Syncing failed "); |
2015 | return; | 2010 | return; |
2016 | } | 2011 | } |
2017 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); | 2012 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, KOPrefs::instance()->mActiveSyncPort.toUInt(), KOPrefs::instance()->mActiveSyncIP, this ); |
2018 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 2013 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
2019 | if ( KOPrefs::instance()->mWriteBackFile ) | 2014 | if ( KOPrefs::instance()->mWriteBackFile ) |
2020 | commandSocket->writeFile( fileName ); | 2015 | commandSocket->writeFile( fileName ); |
2021 | else { | 2016 | else { |
2022 | commandSocket->sendStop(); | 2017 | commandSocket->sendStop(); |
2023 | setCaption( i18n("Pi-Sync succesful!") ); | 2018 | setCaption( i18n("Pi-Sync succesful!") ); |
2024 | } | 2019 | } |
2025 | } | 2020 | } |
2026 | 2021 | ||
2027 | void MainWindow::syncLocalFile() | 2022 | void MainWindow::syncLocalFile() |
2028 | { | 2023 | { |
2029 | 2024 | ||
@@ -2121,202 +2116,96 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | |||
2121 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 2116 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
2122 | int fileSize = 0; | 2117 | int fileSize = 0; |
2123 | int result = system ( command ); | 2118 | int result = system ( command ); |
2124 | // 0 : okay | 2119 | // 0 : okay |
2125 | // 256: no such file or dir | 2120 | // 256: no such file or dir |
2126 | // | 2121 | // |
2127 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 2122 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
2128 | if ( result != 0 ) { | 2123 | if ( result != 0 ) { |
2129 | int len = maxlen; | 2124 | int len = maxlen; |
2130 | while ( len < command.length() ) { | 2125 | while ( len < command.length() ) { |
2131 | command.insert( len , "\n" ); | 2126 | command.insert( len , "\n" ); |
2132 | len += maxlen +2; | 2127 | len += maxlen +2; |
2133 | } | 2128 | } |
2134 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 2129 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
2135 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 2130 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
2136 | question, | 2131 | question, |
2137 | i18n("Okay!")) ; | 2132 | i18n("Okay!")) ; |
2138 | setCaption ("KO/Pi"); | 2133 | setCaption ("KO/Pi"); |
2139 | return; | 2134 | return; |
2140 | } | 2135 | } |
2141 | setCaption ( i18n( "Copying succeed." ) ); | 2136 | setCaption ( i18n( "Copying succeed." ) ); |
2142 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 2137 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
2143 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | 2138 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { |
2144 | // Event* e = mView->getLastSyncEvent(); | 2139 | // Event* e = mView->getLastSyncEvent(); |
2145 | // e->setReadOnly( false ); | 2140 | // e->setReadOnly( false ); |
2146 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 2141 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
2147 | // e->setReadOnly( true ); | 2142 | // e->setReadOnly( true ); |
2148 | if ( KOPrefs::instance()->mWriteBackFile ) { | 2143 | if ( KOPrefs::instance()->mWriteBackFile ) { |
2149 | command = prof->getPostSyncCommand(); | 2144 | command = prof->getPostSyncCommand(); |
2150 | int fi; | 2145 | int fi; |
2151 | if ( (fi = command.find("$PWD$")) > 0 ) { | 2146 | if ( (fi = command.find("$PWD$")) > 0 ) { |
2152 | QString pwd = getPassword(); | 2147 | QString pwd = getPassword(); |
2153 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 2148 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
2154 | 2149 | ||
2155 | } | 2150 | } |
2156 | setCaption ( i18n( "Writing back file ..." ) ); | 2151 | setCaption ( i18n( "Writing back file ..." ) ); |
2157 | result = system ( command ); | 2152 | result = system ( command ); |
2158 | qDebug("KO: Writing back file result: %d ", result); | 2153 | qDebug("KO: Writing back file result: %d ", result); |
2159 | if ( result != 0 ) { | 2154 | if ( result != 0 ) { |
2160 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 2155 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
2161 | return; | 2156 | return; |
2162 | } else { | 2157 | } else { |
2163 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 2158 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
2164 | } | 2159 | } |
2165 | } | 2160 | } |
2166 | } | 2161 | } |
2167 | return; | 2162 | return; |
2168 | } | 2163 | } |
2169 | void MainWindow::syncSSH() | ||
2170 | { | ||
2171 | // not used anymore | ||
2172 | QTime timer; | ||
2173 | timer.start(); | ||
2174 | //qDebug("MainWindow::syncssh() "); | ||
2175 | KOPrefs *p = KOPrefs::instance(); | ||
2176 | QString localFile = p->mLocalTempFile; | ||
2177 | QString remoteIP = p->mRemoteIP; | ||
2178 | QString remoteUser = p->mRemoteUser; | ||
2179 | QString remoteFile = p->mRemoteFile; | ||
2180 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) | ||
2181 | remoteUser += ":" + p->mRemotePassWd; | ||
2182 | |||
2183 | QString question = i18n("Do you really want\nto remote sync?\n \n") + | ||
2184 | i18n("IP: " ) +remoteIP +"\n" + | ||
2185 | i18n("User: " ) + remoteUser +"\n" ; | ||
2186 | int maxlen = 30; | ||
2187 | if ( QApplication::desktop()->width() > 320 ) | ||
2188 | maxlen += 25; | ||
2189 | if ( remoteFile.length() > maxlen ) | ||
2190 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; | ||
2191 | else | ||
2192 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; | ||
2193 | if ( localFile.length() > maxlen ) | ||
2194 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; | ||
2195 | else | ||
2196 | question += i18n("Local temp file:\n " ) + localFile +"\n"; | ||
2197 | |||
2198 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | ||
2199 | question, | ||
2200 | i18n("Yes"), i18n("No"), | ||
2201 | 0, 0 ) != 0 ) | ||
2202 | return; | ||
2203 | // if ( !p->mUsePassWd ) { | ||
2204 | // QString pass = getPassword(); | ||
2205 | // if ( pass.length() > 0 ) | ||
2206 | // remoteUser += ":" + pass; | ||
2207 | // } | ||
2208 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; | ||
2209 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | ||
2210 | int fileSize = 0; | ||
2211 | int result = system ( command ); | ||
2212 | // 0 : okay | ||
2213 | // 256: no such file or dir | ||
2214 | // | ||
2215 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | ||
2216 | if ( result != 0 ) { | ||
2217 | int len = maxlen; | ||
2218 | while ( len < command.length() ) { | ||
2219 | command.insert( len , "\n" ); | ||
2220 | len += maxlen +2; | ||
2221 | } | ||
2222 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | ||
2223 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | ||
2224 | question, | ||
2225 | i18n("Okay!")) ; | ||
2226 | setCaption ("KO/Pi"); | ||
2227 | return; | ||
2228 | } | ||
2229 | |||
2230 | |||
2231 | setCaption ( i18n( "Copying succeed." ) ); | ||
2232 | //mView->setSyncDevice("ssh-scp" ); | ||
2233 | if ( syncWithFile(localFile , true ) ) { | ||
2234 | // Event* e = mView->getLastSyncEvent(); | ||
2235 | // e->setReadOnly( false ); | ||
2236 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | ||
2237 | // e->setReadOnly( true ); | ||
2238 | if ( KOPrefs::instance()->mWriteBackFile ) { | ||
2239 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; | ||
2240 | setCaption ( i18n( "Writing back file ..." ) ); | ||
2241 | result = system ( command ); | ||
2242 | if ( result != 0 ) { | ||
2243 | int len = maxlen; | ||
2244 | while ( len < command.length() ) { | ||
2245 | command.insert( len , "\n" ); | ||
2246 | len += maxlen +2; | ||
2247 | } | ||
2248 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | ||
2249 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | ||
2250 | question, | ||
2251 | i18n("Okay!")) ; | ||
2252 | setCaption ("KO/Pi"); | ||
2253 | return; | ||
2254 | } else { | ||
2255 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | ||
2256 | } | ||
2257 | } | ||
2258 | } | ||
2259 | return; | ||
2260 | #if 0 | ||
2261 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); | ||
2262 | while ( timer.elapsed() < 5000 ) | ||
2263 | qApp->processEvents(); | ||
2264 | |||
2265 | qDebug("MainWindow::merging) "); | ||
2266 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); | ||
2267 | while ( mBlockSaveFlag ) | ||
2268 | qApp->processEvents(); | ||
2269 | save(); | ||
2270 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); | ||
2271 | #endif | ||
2272 | |||
2273 | } | ||
2274 | |||
2275 | 2164 | ||
2276 | void MainWindow::syncSharp() | 2165 | void MainWindow::syncSharp() |
2277 | { | 2166 | { |
2278 | if ( mCalendarModifiedFlag ) | 2167 | if ( mCalendarModifiedFlag ) |
2279 | save(); | 2168 | save(); |
2280 | mView->syncSharp(); | 2169 | mView->syncSharp(); |
2281 | slotModifiedChanged( true ); | 2170 | slotModifiedChanged( true ); |
2282 | 2171 | ||
2283 | } | 2172 | } |
2284 | void MainWindow::syncPhone() | 2173 | void MainWindow::syncPhone() |
2285 | { | 2174 | { |
2286 | if ( mCalendarModifiedFlag ) | 2175 | if ( mCalendarModifiedFlag ) |
2287 | save(); | 2176 | save(); |
2288 | mView->syncPhone(); | 2177 | mView->syncPhone(); |
2289 | slotModifiedChanged( true ); | 2178 | slotModifiedChanged( true ); |
2290 | 2179 | ||
2291 | } | 2180 | } |
2292 | 2181 | ||
2293 | void MainWindow::printSel( ) | 2182 | void MainWindow::printSel( ) |
2294 | { | 2183 | { |
2295 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2184 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2296 | } | 2185 | } |
2297 | 2186 | ||
2298 | void MainWindow::printCal() | 2187 | void MainWindow::printCal() |
2299 | { | 2188 | { |
2300 | mView->print();//mCp->showDialog(); | 2189 | mView->print();//mCp->showDialog(); |
2301 | } | 2190 | } |
2302 | 2191 | ||
2303 | 2192 | ||
2304 | 2193 | ||
2305 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 2194 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
2306 | { | 2195 | { |
2307 | mPassWord = pw; | 2196 | mPassWord = pw; |
2308 | mSocket = 0; | 2197 | mSocket = 0; |
2309 | mSyncActionDialog = 0; | 2198 | mSyncActionDialog = 0; |
2310 | }; | 2199 | }; |
2311 | 2200 | ||
2312 | void KServerSocket::newConnection ( int socket ) | 2201 | void KServerSocket::newConnection ( int socket ) |
2313 | { | 2202 | { |
2314 | // qDebug("KServerSocket:New connection %d ", socket); | 2203 | // qDebug("KServerSocket:New connection %d ", socket); |
2315 | if ( mSocket ) { | 2204 | if ( mSocket ) { |
2316 | qDebug("KServerSocket::newConnection Socket deleted! "); | 2205 | qDebug("KServerSocket::newConnection Socket deleted! "); |
2317 | delete mSocket; | 2206 | delete mSocket; |
2318 | mSocket = 0; | 2207 | mSocket = 0; |
2319 | } | 2208 | } |
2320 | mSocket = new QSocket( this ); | 2209 | mSocket = new QSocket( this ); |
2321 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 2210 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
2322 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 2211 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 4da371e..ba627b9 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -100,111 +100,109 @@ class MainWindow : public QMainWindow | |||
100 | Q_OBJECT | 100 | Q_OBJECT |
101 | public: | 101 | public: |
102 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 102 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
103 | ~MainWindow(); | 103 | ~MainWindow(); |
104 | public slots: | 104 | public slots: |
105 | virtual void showMaximized (); | 105 | virtual void showMaximized (); |
106 | void configureAgenda( int ); | 106 | void configureAgenda( int ); |
107 | void recieve( const QCString& msg, const QByteArray& data ); | 107 | void recieve( const QCString& msg, const QByteArray& data ); |
108 | static QString defaultFileName(); | 108 | static QString defaultFileName(); |
109 | static QString syncFileName(); | 109 | static QString syncFileName(); |
110 | static QString resourcePath(); | 110 | static QString resourcePath(); |
111 | protected slots: | 111 | protected slots: |
112 | void setCaptionToDates(); | 112 | void setCaptionToDates(); |
113 | int ringSync(); | 113 | int ringSync(); |
114 | void multiSync( bool askforPrefs = false ); | 114 | void multiSync( bool askforPrefs = false ); |
115 | void about(); | 115 | void about(); |
116 | void licence(); | 116 | void licence(); |
117 | void faq(); | 117 | void faq(); |
118 | void usertrans(); | 118 | void usertrans(); |
119 | void features(); | 119 | void features(); |
120 | void synchowto(); | 120 | void synchowto(); |
121 | void whatsNew(); | 121 | void whatsNew(); |
122 | void keyBindings(); | 122 | void keyBindings(); |
123 | void aboutAutoSaving();; | 123 | void aboutAutoSaving();; |
124 | void aboutKnownBugs(); | 124 | void aboutKnownBugs(); |
125 | 125 | ||
126 | void processIncidenceSelection( Incidence * ); | 126 | void processIncidenceSelection( Incidence * ); |
127 | 127 | ||
128 | void importQtopia(); | 128 | void importQtopia(); |
129 | void importBday(); | 129 | void importBday(); |
130 | void importOL(); | 130 | void importOL(); |
131 | void importIcal(); | 131 | void importIcal(); |
132 | void importFile( QString, bool ); | 132 | void importFile( QString, bool ); |
133 | void quickImportIcal(); | 133 | void quickImportIcal(); |
134 | 134 | ||
135 | void slotModifiedChanged( bool ); | 135 | void slotModifiedChanged( bool ); |
136 | 136 | ||
137 | void save(); | 137 | void save(); |
138 | void configureToolBar( int ); | 138 | void configureToolBar( int ); |
139 | void printSel(); | 139 | void printSel(); |
140 | void printCal(); | 140 | void printCal(); |
141 | void saveCalendar(); | 141 | void saveCalendar(); |
142 | void loadCalendar(); | 142 | void loadCalendar(); |
143 | void exportVCalendar(); | 143 | void exportVCalendar(); |
144 | void fillFilterMenu(); | 144 | void fillFilterMenu(); |
145 | void selectFilter( int ); | 145 | void selectFilter( int ); |
146 | 146 | ||
147 | void slotSyncMenu( int ); | 147 | void slotSyncMenu( int ); |
148 | void syncSSH(); | ||
149 | void confSync(); | 148 | void confSync(); |
150 | void syncSharp(); | 149 | void syncSharp(); |
151 | void syncPhone(); | 150 | void syncPhone(); |
152 | void syncPi(); | 151 | void syncPi(); |
153 | void syncLocalFile(); | 152 | void syncLocalFile(); |
154 | bool syncWithFile( QString, bool ); | 153 | bool syncWithFile( QString, bool ); |
155 | void quickSyncLocalFile(); | 154 | void quickSyncLocalFile(); |
156 | 155 | ||
157 | 156 | ||
158 | protected: | 157 | protected: |
159 | void displayText( QString, QString); | 158 | void displayText( QString, QString); |
160 | void displayFile( QString, QString); | 159 | void displayFile( QString, QString); |
161 | 160 | ||
162 | void enableIncidenceActions( bool ); | 161 | void enableIncidenceActions( bool ); |
163 | 162 | ||
164 | private slots: | 163 | private slots: |
165 | QSocket* piSocket; | 164 | QSocket* piSocket; |
166 | QString piFileString; | 165 | QString piFileString; |
167 | QTime piTime; | 166 | QTime piTime; |
168 | void deleteCommandSocket(KCommandSocket* s, int state ); | 167 | void deleteCommandSocket(KCommandSocket* s, int state ); |
169 | void fillSyncMenu(); | 168 | void fillSyncMenu(); |
170 | void getFile( bool ); | 169 | void getFile( bool ); |
171 | void readFileFromSocket(); | 170 | void readFileFromSocket(); |
172 | private: | 171 | private: |
173 | //QTimer* mTimerCommandSocket; | 172 | //QTimer* mTimerCommandSocket; |
174 | QString mPassWordPiSync; | 173 | QString mPassWordPiSync; |
175 | KServerSocket * mServerSocket; | 174 | KServerSocket * mServerSocket; |
176 | bool mClosed; | 175 | bool mClosed; |
177 | void saveOnClose(); | 176 | void saveOnClose(); |
178 | int mCurrentSyncProfile; | 177 | int mCurrentSyncProfile; |
179 | void enableQuick(); | 178 | void enableQuick(); |
180 | void performQuickQuick(); | ||
181 | void syncRemote( KSyncProfile* , bool ask = true); | 179 | void syncRemote( KSyncProfile* , bool ask = true); |
182 | bool mFlagKeyPressed; | 180 | bool mFlagKeyPressed; |
183 | bool mBlockAtStartup; | 181 | bool mBlockAtStartup; |
184 | QPEToolBar *iconToolBar; | 182 | QPEToolBar *iconToolBar; |
185 | void initActions(); | 183 | void initActions(); |
186 | void setDefaultPreferences(); | 184 | void setDefaultPreferences(); |
187 | void keyPressEvent ( QKeyEvent * ) ; | 185 | void keyPressEvent ( QKeyEvent * ) ; |
188 | void keyReleaseEvent ( QKeyEvent * ) ; | 186 | void keyReleaseEvent ( QKeyEvent * ) ; |
189 | QPopupMenu *configureToolBarMenu; | 187 | QPopupMenu *configureToolBarMenu; |
190 | QPopupMenu *selectFilterMenu; | 188 | QPopupMenu *selectFilterMenu; |
191 | QPopupMenu *configureAgendaMenu, *syncMenu; | 189 | QPopupMenu *configureAgendaMenu, *syncMenu; |
192 | CalendarLocal *mCalendar; | 190 | CalendarLocal *mCalendar; |
193 | CalendarView *mView; | 191 | CalendarView *mView; |
194 | QString getPassword(); | 192 | QString getPassword(); |
195 | QAction *mNewSubTodoAction; | 193 | QAction *mNewSubTodoAction; |
196 | 194 | ||
197 | QAction *mShowAction; | 195 | QAction *mShowAction; |
198 | QAction *mEditAction; | 196 | QAction *mEditAction; |
199 | QAction *mDeleteAction; | 197 | QAction *mDeleteAction; |
200 | void closeEvent( QCloseEvent* ce ); | 198 | void closeEvent( QCloseEvent* ce ); |
201 | SimpleAlarmClient mAlarmClient; | 199 | SimpleAlarmClient mAlarmClient; |
202 | QTimer mSaveTimer; | 200 | QTimer mSaveTimer; |
203 | bool mBlockSaveFlag; | 201 | bool mBlockSaveFlag; |
204 | bool mCalendarModifiedFlag; | 202 | bool mCalendarModifiedFlag; |
205 | QPixmap loadPixmap( QString ); | 203 | QPixmap loadPixmap( QString ); |
206 | QDialog * mSyncActionDialog; | 204 | QDialog * mSyncActionDialog; |
207 | }; | 205 | }; |
208 | 206 | ||
209 | 207 | ||
210 | #endif | 208 | #endif |
diff --git a/libkcal/calstorage.h b/libkcal/calstorage.h index 72972ea..82c8682 100644 --- a/libkcal/calstorage.h +++ b/libkcal/calstorage.h | |||
@@ -1,52 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef KCAL_CALSTORAGE_H | 20 | #ifndef KCAL_CALSTORAGE_H |
21 | #define KCAL_CALSTORAGE_H | 21 | #define KCAL_CALSTORAGE_H |
22 | 22 | ||
23 | namespace KCal { | 23 | namespace KCal { |
24 | 24 | ||
25 | class Calendar; | 25 | class Calendar; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | This class provides the interface to the storage of a calendar. | 28 | This class provides the interface to the storage of a calendar. |
29 | */ | 29 | */ |
30 | class CalStorage | 30 | class CalStorage |
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | CalStorage( Calendar *calendar ) | 33 | CalStorage( Calendar *calendar ) |
34 | { | 34 | { |
35 | mCalendar = calendar; | 35 | mCalendar = calendar; |
36 | } | 36 | } |
37 | virtual ~CalStorage() {} | 37 | virtual ~CalStorage() {} |
38 | 38 | ||
39 | Calendar *calendar() const { return mCalendar; } | 39 | Calendar *calendar() const { return mCalendar; } |
40 | 40 | ||
41 | virtual bool open() = 0; | 41 | virtual bool open() = 0; |
42 | virtual bool load(bool = false ) = 0; | 42 | virtual bool load( ) = 0; |
43 | virtual bool save() = 0; | 43 | virtual bool save() = 0; |
44 | virtual bool close() = 0; | 44 | virtual bool close() = 0; |
45 | 45 | ||
46 | private: | 46 | private: |
47 | Calendar *mCalendar; | 47 | Calendar *mCalendar; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | } | 50 | } |
51 | 51 | ||
52 | #endif | 52 | #endif |
diff --git a/libkcal/filestorage.cpp b/libkcal/filestorage.cpp index 00c15d9..a139124 100644 --- a/libkcal/filestorage.cpp +++ b/libkcal/filestorage.cpp | |||
@@ -31,107 +31,107 @@ | |||
31 | #include "vcalformat.h" | 31 | #include "vcalformat.h" |
32 | #include "icalformat.h" | 32 | #include "icalformat.h" |
33 | 33 | ||
34 | #include "filestorage.h" | 34 | #include "filestorage.h" |
35 | 35 | ||
36 | using namespace KCal; | 36 | using namespace KCal; |
37 | 37 | ||
38 | FileStorage::FileStorage( Calendar *cal, const QString &fileName, | 38 | FileStorage::FileStorage( Calendar *cal, const QString &fileName, |
39 | CalFormat *format ) | 39 | CalFormat *format ) |
40 | : CalStorage( cal ), | 40 | : CalStorage( cal ), |
41 | mFileName( fileName ), | 41 | mFileName( fileName ), |
42 | mSaveFormat( format ) | 42 | mSaveFormat( format ) |
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | FileStorage::~FileStorage() | 46 | FileStorage::~FileStorage() |
47 | { | 47 | { |
48 | delete mSaveFormat; | 48 | delete mSaveFormat; |
49 | } | 49 | } |
50 | 50 | ||
51 | void FileStorage::setFileName( const QString &fileName ) | 51 | void FileStorage::setFileName( const QString &fileName ) |
52 | { | 52 | { |
53 | mFileName = fileName; | 53 | mFileName = fileName; |
54 | } | 54 | } |
55 | 55 | ||
56 | QString FileStorage::fileName()const | 56 | QString FileStorage::fileName()const |
57 | { | 57 | { |
58 | return mFileName; | 58 | return mFileName; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void FileStorage::setSaveFormat( CalFormat *format ) | 62 | void FileStorage::setSaveFormat( CalFormat *format ) |
63 | { | 63 | { |
64 | delete mSaveFormat; | 64 | delete mSaveFormat; |
65 | mSaveFormat = format; | 65 | mSaveFormat = format; |
66 | } | 66 | } |
67 | 67 | ||
68 | CalFormat *FileStorage::saveFormat()const | 68 | CalFormat *FileStorage::saveFormat()const |
69 | { | 69 | { |
70 | return mSaveFormat; | 70 | return mSaveFormat; |
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | bool FileStorage::open() | 74 | bool FileStorage::open() |
75 | { | 75 | { |
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | bool FileStorage::load( bool quick ) | 79 | bool FileStorage::load( ) |
80 | { | 80 | { |
81 | kdDebug(5800) << "FileStorage::load(): '" << mFileName << "'" << endl; | 81 | kdDebug(5800) << "FileStorage::load(): '" << mFileName << "'" << endl; |
82 | 82 | ||
83 | // do we want to silently accept this, or make some noise? Dunno... | 83 | // do we want to silently accept this, or make some noise? Dunno... |
84 | // it is a semantical thing vs. a practical thing. | 84 | // it is a semantical thing vs. a practical thing. |
85 | if (mFileName.isEmpty()) return false; | 85 | if (mFileName.isEmpty()) return false; |
86 | 86 | ||
87 | // Always try to load with iCalendar. It will detect, if it is actually a | 87 | // Always try to load with iCalendar. It will detect, if it is actually a |
88 | // vCalendar file. | 88 | // vCalendar file. |
89 | ICalFormat iCal (quick ); | 89 | ICalFormat iCal; |
90 | 90 | ||
91 | bool success = iCal.load( calendar(), mFileName); | 91 | bool success = iCal.load( calendar(), mFileName); |
92 | 92 | ||
93 | if ( !success ) { | 93 | if ( !success ) { |
94 | if ( iCal.exception() ) { | 94 | if ( iCal.exception() ) { |
95 | // kdDebug(5800) << "---Error: " << mFormat->exception()->errorCode() << endl; | 95 | // kdDebug(5800) << "---Error: " << mFormat->exception()->errorCode() << endl; |
96 | if ( iCal.exception()->errorCode() == ErrorFormat::CalVersion1 ) { | 96 | if ( iCal.exception()->errorCode() == ErrorFormat::CalVersion1 ) { |
97 | // Expected non vCalendar file, but detected vCalendar | 97 | // Expected non vCalendar file, but detected vCalendar |
98 | kdDebug(5800) << "FileStorage::load() Fallback to VCalFormat" << endl; | 98 | kdDebug(5800) << "FileStorage::load() Fallback to VCalFormat" << endl; |
99 | VCalFormat vCal; | 99 | VCalFormat vCal; |
100 | success = vCal.load( calendar(), mFileName ); | 100 | success = vCal.load( calendar(), mFileName ); |
101 | calendar()->setLoadedProductId( vCal.productId() ); | 101 | calendar()->setLoadedProductId( vCal.productId() ); |
102 | } else { | 102 | } else { |
103 | return false; | 103 | return false; |
104 | } | 104 | } |
105 | } else { | 105 | } else { |
106 | kdDebug(5800) << "Warning! There should be set an exception." << endl; | 106 | kdDebug(5800) << "Warning! There should be set an exception." << endl; |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | } else { | 109 | } else { |
110 | // kdDebug(5800) << "---Success" << endl; | 110 | // kdDebug(5800) << "---Success" << endl; |
111 | calendar()->setLoadedProductId( iCal.loadedProductId() ); | 111 | calendar()->setLoadedProductId( iCal.loadedProductId() ); |
112 | } | 112 | } |
113 | 113 | ||
114 | calendar()->setModified( false ); | 114 | calendar()->setModified( false ); |
115 | 115 | ||
116 | return true; | 116 | return true; |
117 | } | 117 | } |
118 | 118 | ||
119 | bool FileStorage::save() | 119 | bool FileStorage::save() |
120 | { | 120 | { |
121 | if ( mFileName.isEmpty() ) return false; | 121 | if ( mFileName.isEmpty() ) return false; |
122 | 122 | ||
123 | bool success; | 123 | bool success; |
124 | 124 | ||
125 | if ( mSaveFormat ) { | 125 | if ( mSaveFormat ) { |
126 | success = mSaveFormat->save( calendar(), mFileName); | 126 | success = mSaveFormat->save( calendar(), mFileName); |
127 | } else { | 127 | } else { |
128 | ICalFormat iCal; | 128 | ICalFormat iCal; |
129 | success = iCal.save( calendar(), mFileName); | 129 | success = iCal.save( calendar(), mFileName); |
130 | } | 130 | } |
131 | 131 | ||
132 | if ( success ) calendar()->setModified( false ); | 132 | if ( success ) calendar()->setModified( false ); |
133 | 133 | ||
134 | return success; | 134 | return success; |
135 | } | 135 | } |
136 | 136 | ||
137 | bool FileStorage::close() | 137 | bool FileStorage::close() |
diff --git a/libkcal/filestorage.h b/libkcal/filestorage.h index e9dc15e..17010ac 100644 --- a/libkcal/filestorage.h +++ b/libkcal/filestorage.h | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef KCAL_FILESTORAGE_H | 20 | #ifndef KCAL_FILESTORAGE_H |
21 | #define KCAL_FILESTORAGE_H | 21 | #define KCAL_FILESTORAGE_H |
22 | 22 | ||
23 | #include "calstorage.h" | 23 | #include "calstorage.h" |
24 | 24 | ||
25 | namespace KCal { | 25 | namespace KCal { |
26 | 26 | ||
27 | /** | 27 | /** |
28 | This class provides a calendar storage as a local file. | 28 | This class provides a calendar storage as a local file. |
29 | */ | 29 | */ |
30 | class FileStorage : public CalStorage | 30 | class FileStorage : public CalStorage |
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | FileStorage( Calendar *, const QString &fileName = QString::null, | 33 | FileStorage( Calendar *, const QString &fileName = QString::null, |
34 | CalFormat *format = 0 ); | 34 | CalFormat *format = 0 ); |
35 | virtual ~FileStorage(); | 35 | virtual ~FileStorage(); |
36 | 36 | ||
37 | void setFileName( const QString &mFileName ); | 37 | void setFileName( const QString &mFileName ); |
38 | QString fileName()const; | 38 | QString fileName()const; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | FileStorage takes ownership of format object. | 41 | FileStorage takes ownership of format object. |
42 | */ | 42 | */ |
43 | void setSaveFormat( CalFormat * ); | 43 | void setSaveFormat( CalFormat * ); |
44 | CalFormat *saveFormat()const; | 44 | CalFormat *saveFormat()const; |
45 | 45 | ||
46 | bool open(); | 46 | bool open(); |
47 | bool load(bool quick = false ); | 47 | bool load( ); |
48 | bool save(); | 48 | bool save(); |
49 | bool close(); | 49 | bool close(); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | QString mFileName; | 52 | QString mFileName; |
53 | CalFormat *mSaveFormat; | 53 | CalFormat *mSaveFormat; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index f2e7dfc..3a2aac6 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp | |||
@@ -5,170 +5,150 @@ | |||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qdatetime.h> | 21 | #include <qdatetime.h> |
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qptrlist.h> | 23 | #include <qptrlist.h> |
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | #include <qclipboard.h> | 25 | #include <qclipboard.h> |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #include <qtextstream.h> | 27 | #include <qtextstream.h> |
28 | #include <qtextcodec.h> | 28 | #include <qtextcodec.h> |
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | 30 | ||
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | extern "C" { | 35 | extern "C" { |
36 | #include <ical.h> | 36 | #include <ical.h> |
37 | #include <icalss.h> | 37 | #include <icalss.h> |
38 | #include <icalparser.h> | 38 | #include <icalparser.h> |
39 | #include <icalrestriction.h> | 39 | #include <icalrestriction.h> |
40 | } | 40 | } |
41 | 41 | ||
42 | #include "calendar.h" | 42 | #include "calendar.h" |
43 | #include "calendarlocal.h" | 43 | #include "calendarlocal.h" |
44 | #include "journal.h" | 44 | #include "journal.h" |
45 | 45 | ||
46 | #include "icalformat.h" | 46 | #include "icalformat.h" |
47 | #include "icalformatimpl.h" | 47 | #include "icalformatimpl.h" |
48 | 48 | ||
49 | #define _ICAL_VERSION "2.0" | 49 | #define _ICAL_VERSION "2.0" |
50 | 50 | ||
51 | using namespace KCal; | 51 | using namespace KCal; |
52 | 52 | ||
53 | ICalFormat::ICalFormat(bool quick ) | 53 | ICalFormat::ICalFormat( ) |
54 | { | 54 | { |
55 | mQuicksave = false; //quick; | ||
56 | mImpl = new ICalFormatImpl( this ); | 55 | mImpl = new ICalFormatImpl( this ); |
57 | tzOffsetMin = 0; | 56 | tzOffsetMin = 0; |
58 | //qDebug("new ICalFormat() "); | 57 | //qDebug("new ICalFormat() "); |
59 | } | 58 | } |
60 | 59 | ||
61 | ICalFormat::~ICalFormat() | 60 | ICalFormat::~ICalFormat() |
62 | { | 61 | { |
63 | delete mImpl; | 62 | delete mImpl; |
64 | //qDebug("delete ICalFormat "); | 63 | //qDebug("delete ICalFormat "); |
65 | } | 64 | } |
66 | 65 | ||
67 | bool ICalFormat::load( Calendar *calendar, const QString &fileName) | 66 | bool ICalFormat::load( Calendar *calendar, const QString &fileName) |
68 | { | 67 | { |
69 | 68 | ||
70 | clearException(); | 69 | clearException(); |
71 | 70 | ||
72 | QFile file( fileName ); | 71 | QFile file( fileName ); |
73 | if (!file.open( IO_ReadOnly ) ) { | 72 | if (!file.open( IO_ReadOnly ) ) { |
74 | setException(new ErrorFormat(ErrorFormat::LoadError)); | 73 | setException(new ErrorFormat(ErrorFormat::LoadError)); |
75 | return false; | 74 | return false; |
76 | } | 75 | } |
77 | QTextStream ts( &file ); | 76 | QTextStream ts( &file ); |
78 | QString text; | 77 | QString text; |
79 | #if 0 | 78 | |
80 | if ( !mQuicksave ) { | ||
81 | qDebug("KO: No quickload!"); | ||
82 | ts.setEncoding( QTextStream::Latin1 ); | ||
83 | text = ts.read(); | ||
84 | } else { | ||
85 | ts.setCodec( QTextCodec::codecForName("utf8") ); | ||
86 | text = ts.read(); | ||
87 | } | ||
88 | #endif | ||
89 | ts.setEncoding( QTextStream::Latin1 ); | 79 | ts.setEncoding( QTextStream::Latin1 ); |
90 | text = ts.read(); | 80 | text = ts.read(); |
91 | file.close(); | 81 | file.close(); |
92 | 82 | ||
93 | return fromString( calendar, text ); | 83 | return fromString( calendar, text ); |
94 | } | 84 | } |
95 | 85 | ||
96 | //#include <qdatetime.h> | 86 | //#include <qdatetime.h> |
97 | bool ICalFormat::save( Calendar *calendar, const QString &fileName ) | 87 | bool ICalFormat::save( Calendar *calendar, const QString &fileName ) |
98 | { | 88 | { |
99 | //kdDebug(5800) << "ICalFormat::save(): " << fileName << endl; | 89 | //kdDebug(5800) << "ICalFormat::save(): " << fileName << endl; |
100 | //qDebug("ICalFormat::save "); | 90 | //qDebug("ICalFormat::save "); |
101 | clearException(); | 91 | clearException(); |
102 | QString text = toString( calendar ); | 92 | QString text = toString( calendar ); |
103 | //return false; | 93 | //return false; |
104 | // qDebug("to string takes ms: %d ",is.elapsed() ); | 94 | // qDebug("to string takes ms: %d ",is.elapsed() ); |
105 | if ( text.isNull() ) return false; | 95 | if ( text.isNull() ) return false; |
106 | 96 | ||
107 | // TODO: write backup file | 97 | // TODO: write backup file |
108 | //is.restart(); | 98 | //is.restart(); |
109 | QFile file( fileName ); | 99 | QFile file( fileName ); |
110 | if (!file.open( IO_WriteOnly ) ) { | 100 | if (!file.open( IO_WriteOnly ) ) { |
111 | setException(new ErrorFormat(ErrorFormat::SaveError, | 101 | setException(new ErrorFormat(ErrorFormat::SaveError, |
112 | i18n("Could not open file '%1'").arg(fileName))); | 102 | i18n("Could not open file '%1'").arg(fileName))); |
113 | return false; | 103 | return false; |
114 | } | 104 | } |
115 | QTextStream ts( &file ); | 105 | QTextStream ts( &file ); |
116 | 106 | ||
117 | // #ifdef DESKTOP_VERSION | ||
118 | // mQuicksave = false; | ||
119 | // #endif | ||
120 | // if ( mQuicksave ) { | ||
121 | // ts << text.utf8(); | ||
122 | // } else { | ||
123 | // ts.setEncoding( QTextStream::Latin1 ); | ||
124 | // ts << text; | ||
125 | // //ts << text.latin1(); | ||
126 | // } | ||
127 | ts.setEncoding( QTextStream::Latin1 ); | 107 | ts.setEncoding( QTextStream::Latin1 ); |
128 | ts << text; | 108 | ts << text; |
129 | file.close(); | 109 | file.close(); |
130 | //qDebug("saving file takes ms: %d ", is.elapsed() ); | 110 | //qDebug("saving file takes ms: %d ", is.elapsed() ); |
131 | return true; | 111 | return true; |
132 | } | 112 | } |
133 | 113 | ||
134 | bool ICalFormat::fromString( Calendar *cal, const QString &text ) | 114 | bool ICalFormat::fromString( Calendar *cal, const QString &text ) |
135 | { | 115 | { |
136 | setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); | 116 | setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); |
137 | // qDebug("ICalFormat::fromString tz: %s ", cal->timeZoneId().latin1()); | 117 | // qDebug("ICalFormat::fromString tz: %s ", cal->timeZoneId().latin1()); |
138 | // Get first VCALENDAR component. | 118 | // Get first VCALENDAR component. |
139 | // TODO: Handle more than one VCALENDAR or non-VCALENDAR top components | 119 | // TODO: Handle more than one VCALENDAR or non-VCALENDAR top components |
140 | icalcomponent *calendar; | 120 | icalcomponent *calendar; |
141 | 121 | ||
142 | //calendar = icalcomponent_new_from_string( text.local8Bit().data()); | 122 | //calendar = icalcomponent_new_from_string( text.local8Bit().data()); |
143 | // good calendar = icalcomponent_new_from_string( text.utf8().data()); | 123 | // good calendar = icalcomponent_new_from_string( text.utf8().data()); |
144 | calendar = icalcomponent_new_from_string( (char*)text.latin1()); | 124 | calendar = icalcomponent_new_from_string( (char*)text.latin1()); |
145 | if (!calendar) { | 125 | if (!calendar) { |
146 | setException(new ErrorFormat(ErrorFormat::ParseErrorIcal)); | 126 | setException(new ErrorFormat(ErrorFormat::ParseErrorIcal)); |
147 | return false; | 127 | return false; |
148 | } | 128 | } |
149 | 129 | ||
150 | bool success = true; | 130 | bool success = true; |
151 | 131 | ||
152 | if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) { | 132 | if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) { |
153 | setException(new ErrorFormat(ErrorFormat::NoCalendar)); | 133 | setException(new ErrorFormat(ErrorFormat::NoCalendar)); |
154 | success = false; | 134 | success = false; |
155 | } else { | 135 | } else { |
156 | // put all objects into their proper places | 136 | // put all objects into their proper places |
157 | if ( !mImpl->populate( cal, calendar ) ) { | 137 | if ( !mImpl->populate( cal, calendar ) ) { |
158 | if ( !exception() ) { | 138 | if ( !exception() ) { |
159 | setException(new ErrorFormat(ErrorFormat::ParseErrorKcal)); | 139 | setException(new ErrorFormat(ErrorFormat::ParseErrorKcal)); |
160 | } | 140 | } |
161 | success = false; | 141 | success = false; |
162 | } else | 142 | } else |
163 | mLoadedProductId = mImpl->loadedProductId(); | 143 | mLoadedProductId = mImpl->loadedProductId(); |
164 | } | 144 | } |
165 | 145 | ||
166 | icalcomponent_free( calendar ); | 146 | icalcomponent_free( calendar ); |
167 | 147 | ||
168 | return success; | 148 | return success; |
169 | } | 149 | } |
170 | 150 | ||
171 | Incidence *ICalFormat::fromString( const QString &text ) | 151 | Incidence *ICalFormat::fromString( const QString &text ) |
172 | { | 152 | { |
173 | CalendarLocal cal( mTimeZoneId ); | 153 | CalendarLocal cal( mTimeZoneId ); |
174 | fromString(&cal, text); | 154 | fromString(&cal, text); |
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h index 236efbf..485ab6e 100644 --- a/libkcal/icalformat.h +++ b/libkcal/icalformat.h | |||
@@ -1,116 +1,115 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef ICALFORMAT_H | 20 | #ifndef ICALFORMAT_H |
21 | #define ICALFORMAT_H | 21 | #define ICALFORMAT_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | 24 | ||
25 | #include "scheduler.h" | 25 | #include "scheduler.h" |
26 | 26 | ||
27 | #include "calformat.h" | 27 | #include "calformat.h" |
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | 30 | ||
31 | class ICalFormatImpl; | 31 | class ICalFormatImpl; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | This class implements the iCalendar format. It provides methods for | 34 | This class implements the iCalendar format. It provides methods for |
35 | loading/saving/converting iCalendar format data into the internal KOrganizer | 35 | loading/saving/converting iCalendar format data into the internal KOrganizer |
36 | representation as Calendar and Events. | 36 | representation as Calendar and Events. |
37 | 37 | ||
38 | @short iCalendar format implementation | 38 | @short iCalendar format implementation |
39 | */ | 39 | */ |
40 | class ICalFormat : public CalFormat { | 40 | class ICalFormat : public CalFormat { |
41 | public: | 41 | public: |
42 | /** Create new iCalendar format. */ | 42 | /** Create new iCalendar format. */ |
43 | ICalFormat( bool quick = false ); | 43 | ICalFormat( ); |
44 | virtual ~ICalFormat(); | 44 | virtual ~ICalFormat(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | Loads a calendar on disk in iCalendar format into calendar. | 47 | Loads a calendar on disk in iCalendar format into calendar. |
48 | Returns true if successful, else returns false. Provides more error | 48 | Returns true if successful, else returns false. Provides more error |
49 | information by exception(). | 49 | information by exception(). |
50 | @param calendar Calendar object to be filled. | 50 | @param calendar Calendar object to be filled. |
51 | @param fileName The name of the calendar file on disk. | 51 | @param fileName The name of the calendar file on disk. |
52 | */ | 52 | */ |
53 | bool load( Calendar *, const QString &fileName ); | 53 | bool load( Calendar *, const QString &fileName ); |
54 | /** | 54 | /** |
55 | Writes out the calendar to disk in iCalendar format. Returns true if | 55 | Writes out the calendar to disk in iCalendar format. Returns true if |
56 | successful and false on error. | 56 | successful and false on error. |
57 | 57 | ||
58 | @param calendar The Calendar object to be written. | 58 | @param calendar The Calendar object to be written. |
59 | @param fileName The name of the calendar file on disk. | 59 | @param fileName The name of the calendar file on disk. |
60 | */ | 60 | */ |
61 | bool save( Calendar *, const QString &fileName ); | 61 | bool save( Calendar *, const QString &fileName ); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Parse string and populate calendar with that information. | 64 | Parse string and populate calendar with that information. |
65 | */ | 65 | */ |
66 | bool fromString( Calendar *, const QString & ); | 66 | bool fromString( Calendar *, const QString & ); |
67 | /** | 67 | /** |
68 | Parse string and return first ical component. | 68 | Parse string and return first ical component. |
69 | */ | 69 | */ |
70 | Incidence *fromString( const QString & ); | 70 | Incidence *fromString( const QString & ); |
71 | /** | 71 | /** |
72 | Return calendar information as string. | 72 | Return calendar information as string. |
73 | */ | 73 | */ |
74 | QString toString( Calendar * ); | 74 | QString toString( Calendar * ); |
75 | /** | 75 | /** |
76 | Return incidence as full iCalendar formatted text. | 76 | Return incidence as full iCalendar formatted text. |
77 | */ | 77 | */ |
78 | QString toICalString( Incidence * ); | 78 | QString toICalString( Incidence * ); |
79 | /** | 79 | /** |
80 | Return incidence as iCalendar formatted text. | 80 | Return incidence as iCalendar formatted text. |
81 | */ | 81 | */ |
82 | QString toString( Incidence * ); | 82 | QString toString( Incidence * ); |
83 | /** | 83 | /** |
84 | Return recurrence as iCalendar formatted text. | 84 | Return recurrence as iCalendar formatted text. |
85 | */ | 85 | */ |
86 | QString toString( Recurrence * ); | 86 | QString toString( Recurrence * ); |
87 | /** | 87 | /** |
88 | Parse string and fill recurrence object with | 88 | Parse string and fill recurrence object with |
89 | that information | 89 | that information |
90 | */ | 90 | */ |
91 | //bool fromString ( Recurrence *, const QString& ); | 91 | //bool fromString ( Recurrence *, const QString& ); |
92 | 92 | ||
93 | /** Create a scheduling message for event \a e using method \m */ | 93 | /** Create a scheduling message for event \a e using method \m */ |
94 | QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m); | 94 | QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m); |
95 | /** Parse scheduling message provided as string \s */ | 95 | /** Parse scheduling message provided as string \s */ |
96 | ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s); | 96 | ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s); |
97 | 97 | ||
98 | /** Set id of used time zone and whether this time zone is UTC or not. */ | 98 | /** Set id of used time zone and whether this time zone is UTC or not. */ |
99 | void setTimeZone( const QString &id, bool utc ); | 99 | void setTimeZone( const QString &id, bool utc ); |
100 | QString timeZoneId() const; | 100 | QString timeZoneId() const; |
101 | int timeOffset(); | 101 | int timeOffset(); |
102 | const char * tzString(); | 102 | const char * tzString(); |
103 | bool utc() const; | 103 | bool utc() const; |
104 | 104 | ||
105 | private: | 105 | private: |
106 | ICalFormatImpl *mImpl; | 106 | ICalFormatImpl *mImpl; |
107 | bool mQuicksave; | ||
108 | QString mTimeZoneId; | 107 | QString mTimeZoneId; |
109 | QCString mTzString; | 108 | QCString mTzString; |
110 | int tzOffsetMin; | 109 | int tzOffsetMin; |
111 | bool mUtc; | 110 | bool mUtc; |
112 | }; | 111 | }; |
113 | 112 | ||
114 | } | 113 | } |
115 | 114 | ||
116 | #endif | 115 | #endif |