-rw-r--r-- | korganizer/calendarview.cpp | 17 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 |
3 files changed, 18 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3635cfa..eaea040 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1325,426 +1325,439 @@ void CalendarView::syncExternal( int mode ) | |||
1325 | } | 1325 | } |
1326 | delete calendar; | 1326 | delete calendar; |
1327 | updateView(); | 1327 | updateView(); |
1328 | return ;//syncOK; | 1328 | return ;//syncOK; |
1329 | 1329 | ||
1330 | } | 1330 | } |
1331 | void CalendarView::syncSharp() | 1331 | void CalendarView::syncSharp() |
1332 | { | 1332 | { |
1333 | syncExternal( 0 ); | 1333 | syncExternal( 0 ); |
1334 | 1334 | ||
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | 1337 | ||
1338 | //#include <kabc/stdaddressbook.h> | 1338 | //#include <kabc/stdaddressbook.h> |
1339 | bool CalendarView::importBday() | 1339 | bool CalendarView::importBday() |
1340 | { | 1340 | { |
1341 | #if 0 | 1341 | #if 0 |
1342 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1342 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1343 | KABC::AddressBook::Iterator it; | 1343 | KABC::AddressBook::Iterator it; |
1344 | int count = 0; | 1344 | int count = 0; |
1345 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1345 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1346 | ++count; | 1346 | ++count; |
1347 | } | 1347 | } |
1348 | QProgressBar bar(count,0 ); | 1348 | QProgressBar bar(count,0 ); |
1349 | int w = 300; | 1349 | int w = 300; |
1350 | if ( QApplication::desktop()->width() < 320 ) | 1350 | if ( QApplication::desktop()->width() < 320 ) |
1351 | w = 220; | 1351 | w = 220; |
1352 | int h = bar.sizeHint().height() ; | 1352 | int h = bar.sizeHint().height() ; |
1353 | int dw = QApplication::desktop()->width(); | 1353 | int dw = QApplication::desktop()->width(); |
1354 | int dh = QApplication::desktop()->height(); | 1354 | int dh = QApplication::desktop()->height(); |
1355 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1355 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1356 | bar.show(); | 1356 | bar.show(); |
1357 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1357 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1358 | qApp->processEvents(); | 1358 | qApp->processEvents(); |
1359 | count = 0; | 1359 | count = 0; |
1360 | int addCount = 0; | 1360 | int addCount = 0; |
1361 | KCal::Attendee* a = 0; | 1361 | KCal::Attendee* a = 0; |
1362 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1362 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1363 | if ( ! bar.isVisible() ) | 1363 | if ( ! bar.isVisible() ) |
1364 | return false; | 1364 | return false; |
1365 | bar.setProgress( count++ ); | 1365 | bar.setProgress( count++ ); |
1366 | qApp->processEvents(); | 1366 | qApp->processEvents(); |
1367 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1367 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1368 | if ( (*it).birthday().date().isValid() ){ | 1368 | if ( (*it).birthday().date().isValid() ){ |
1369 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1369 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1370 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1370 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1371 | ++addCount; | 1371 | ++addCount; |
1372 | } | 1372 | } |
1373 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1373 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1374 | if ( anni.isValid() ){ | 1374 | if ( anni.isValid() ){ |
1375 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1375 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1376 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1376 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1377 | ++addCount; | 1377 | ++addCount; |
1378 | } | 1378 | } |
1379 | } | 1379 | } |
1380 | updateView(); | 1380 | updateView(); |
1381 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1381 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1382 | #endif | 1382 | #endif |
1383 | return true; | 1383 | return true; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1386 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1387 | { | 1387 | { |
1388 | //qDebug("addAnni "); | 1388 | //qDebug("addAnni "); |
1389 | Event * ev = new Event(); | 1389 | Event * ev = new Event(); |
1390 | if ( a ) { | 1390 | if ( a ) { |
1391 | ev->addAttendee( a ); | 1391 | ev->addAttendee( a ); |
1392 | } | 1392 | } |
1393 | QString kind; | 1393 | QString kind; |
1394 | if ( birthday ) | 1394 | if ( birthday ) |
1395 | kind = i18n( "Birthday" ); | 1395 | kind = i18n( "Birthday" ); |
1396 | else | 1396 | else |
1397 | kind = i18n( "Anniversary" ); | 1397 | kind = i18n( "Anniversary" ); |
1398 | ev->setSummary( name + " - " + kind ); | 1398 | ev->setSummary( name + " - " + kind ); |
1399 | ev->setOrganizer( "nobody@nowhere" ); | 1399 | ev->setOrganizer( "nobody@nowhere" ); |
1400 | ev->setCategories( kind ); | 1400 | ev->setCategories( kind ); |
1401 | ev->setDtStart( QDateTime(date) ); | 1401 | ev->setDtStart( QDateTime(date) ); |
1402 | ev->setDtEnd( QDateTime(date) ); | 1402 | ev->setDtEnd( QDateTime(date) ); |
1403 | ev->setFloats( true ); | 1403 | ev->setFloats( true ); |
1404 | Recurrence * rec = ev->recurrence(); | 1404 | Recurrence * rec = ev->recurrence(); |
1405 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1405 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1406 | rec->addYearlyNum( date.month() ); | 1406 | rec->addYearlyNum( date.month() ); |
1407 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1407 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1408 | delete ev; | 1408 | delete ev; |
1409 | return false; | 1409 | return false; |
1410 | } | 1410 | } |
1411 | return true; | 1411 | return true; |
1412 | 1412 | ||
1413 | } | 1413 | } |
1414 | bool CalendarView::importQtopia( const QString &categories, | 1414 | bool CalendarView::importQtopia( const QString &categories, |
1415 | const QString &datebook, | 1415 | const QString &datebook, |
1416 | const QString &todolist ) | 1416 | const QString &todolist ) |
1417 | { | 1417 | { |
1418 | 1418 | ||
1419 | QtopiaFormat qtopiaFormat; | 1419 | QtopiaFormat qtopiaFormat; |
1420 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1420 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1421 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1421 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1422 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1422 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1423 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1423 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1424 | 1424 | ||
1425 | updateView(); | 1425 | updateView(); |
1426 | return true; | 1426 | return true; |
1427 | 1427 | ||
1428 | #if 0 | 1428 | #if 0 |
1429 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1429 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1430 | mCurrentSyncDevice = "qtopia-XML"; | 1430 | mCurrentSyncDevice = "qtopia-XML"; |
1431 | if ( KOPrefs::instance()->mAskForPreferences ) | 1431 | if ( KOPrefs::instance()->mAskForPreferences ) |
1432 | edit_sync_options(); | 1432 | edit_sync_options(); |
1433 | qApp->processEvents(); | 1433 | qApp->processEvents(); |
1434 | CalendarLocal* calendar = new CalendarLocal(); | 1434 | CalendarLocal* calendar = new CalendarLocal(); |
1435 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1435 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1436 | bool syncOK = false; | 1436 | bool syncOK = false; |
1437 | QtopiaFormat qtopiaFormat; | 1437 | QtopiaFormat qtopiaFormat; |
1438 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1438 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1439 | bool loadOk = true; | 1439 | bool loadOk = true; |
1440 | if ( !categories.isEmpty() ) | 1440 | if ( !categories.isEmpty() ) |
1441 | loadOk = qtopiaFormat.load( calendar, categories ); | 1441 | loadOk = qtopiaFormat.load( calendar, categories ); |
1442 | if ( loadOk && !datebook.isEmpty() ) | 1442 | if ( loadOk && !datebook.isEmpty() ) |
1443 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1443 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1444 | if ( loadOk && !todolist.isEmpty() ) | 1444 | if ( loadOk && !todolist.isEmpty() ) |
1445 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1445 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1446 | 1446 | ||
1447 | if ( loadOk ) { | 1447 | if ( loadOk ) { |
1448 | getEventViewerDialog()->setSyncMode( true ); | 1448 | getEventViewerDialog()->setSyncMode( true ); |
1449 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1449 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1450 | getEventViewerDialog()->setSyncMode( false ); | 1450 | getEventViewerDialog()->setSyncMode( false ); |
1451 | qApp->processEvents(); | 1451 | qApp->processEvents(); |
1452 | if ( syncOK ) { | 1452 | if ( syncOK ) { |
1453 | if ( KOPrefs::instance()->mWriteBackFile ) | 1453 | if ( KOPrefs::instance()->mWriteBackFile ) |
1454 | { | 1454 | { |
1455 | // write back XML file | 1455 | // write back XML file |
1456 | 1456 | ||
1457 | } | 1457 | } |
1458 | setModified( true ); | 1458 | setModified( true ); |
1459 | } | 1459 | } |
1460 | } else { | 1460 | } else { |
1461 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1461 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1462 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1462 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1463 | question, i18n("Ok")) ; | 1463 | question, i18n("Ok")) ; |
1464 | } | 1464 | } |
1465 | delete calendar; | 1465 | delete calendar; |
1466 | updateView(); | 1466 | updateView(); |
1467 | return syncOK; | 1467 | return syncOK; |
1468 | 1468 | ||
1469 | 1469 | ||
1470 | #endif | 1470 | #endif |
1471 | 1471 | ||
1472 | } | 1472 | } |
1473 | 1473 | ||
1474 | void CalendarView::setSyncEventsReadOnly() | 1474 | void CalendarView::setSyncEventsReadOnly() |
1475 | { | 1475 | { |
1476 | Event * ev; | 1476 | Event * ev; |
1477 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1477 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1478 | ev = eL.first(); | 1478 | ev = eL.first(); |
1479 | while ( ev ) { | 1479 | while ( ev ) { |
1480 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1480 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1481 | ev->setReadOnly( true ); | 1481 | ev->setReadOnly( true ); |
1482 | ev = eL.next(); | 1482 | ev = eL.next(); |
1483 | } | 1483 | } |
1484 | } | 1484 | } |
1485 | bool CalendarView::openCalendar(QString filename, bool merge) | 1485 | bool CalendarView::openCalendar(QString filename, bool merge) |
1486 | { | 1486 | { |
1487 | 1487 | ||
1488 | if (filename.isEmpty()) { | 1488 | if (filename.isEmpty()) { |
1489 | return false; | 1489 | return false; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | if (!QFile::exists(filename)) { | 1492 | if (!QFile::exists(filename)) { |
1493 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1493 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1494 | return false; | 1494 | return false; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | globalFlagBlockAgenda = 1; | 1497 | globalFlagBlockAgenda = 1; |
1498 | if (!merge) mCalendar->close(); | 1498 | if (!merge) mCalendar->close(); |
1499 | 1499 | ||
1500 | mStorage->setFileName( filename ); | 1500 | mStorage->setFileName( filename ); |
1501 | 1501 | ||
1502 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1502 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1503 | if ( merge ) ;//setModified( true ); | 1503 | if ( merge ) ;//setModified( true ); |
1504 | else { | 1504 | else { |
1505 | //setModified( true ); | 1505 | //setModified( true ); |
1506 | mViewManager->setDocumentId( filename ); | 1506 | mViewManager->setDocumentId( filename ); |
1507 | mDialogManager->setDocumentId( filename ); | 1507 | mDialogManager->setDocumentId( filename ); |
1508 | mTodoList->setDocumentId( filename ); | 1508 | mTodoList->setDocumentId( filename ); |
1509 | } | 1509 | } |
1510 | globalFlagBlockAgenda = 2; | 1510 | globalFlagBlockAgenda = 2; |
1511 | // if ( getLastSyncEvent() ) | 1511 | // if ( getLastSyncEvent() ) |
1512 | // getLastSyncEvent()->setReadOnly( true ); | 1512 | // getLastSyncEvent()->setReadOnly( true ); |
1513 | mCalendar->reInitAlarmSettings(); | 1513 | mCalendar->reInitAlarmSettings(); |
1514 | setSyncEventsReadOnly(); | 1514 | setSyncEventsReadOnly(); |
1515 | updateUnmanagedViews(); | 1515 | updateUnmanagedViews(); |
1516 | updateView(); | 1516 | updateView(); |
1517 | if ( filename != MainWindow::defaultFileName() ) | 1517 | if ( filename != MainWindow::defaultFileName() ) |
1518 | saveCalendar( MainWindow::defaultFileName() ); | 1518 | saveCalendar( MainWindow::defaultFileName() ); |
1519 | loadedFileVersion = QDateTime::currentDateTime(); | 1519 | loadedFileVersion = QDateTime::currentDateTime(); |
1520 | return true; | 1520 | return true; |
1521 | } else { | 1521 | } else { |
1522 | // while failing to load, the calendar object could | 1522 | // while failing to load, the calendar object could |
1523 | // have become partially populated. Clear it out. | 1523 | // have become partially populated. Clear it out. |
1524 | if ( !merge ) mCalendar->close(); | 1524 | if ( !merge ) mCalendar->close(); |
1525 | 1525 | ||
1526 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1526 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1527 | 1527 | ||
1528 | globalFlagBlockAgenda = 2; | 1528 | globalFlagBlockAgenda = 2; |
1529 | updateView(); | 1529 | updateView(); |
1530 | } | 1530 | } |
1531 | return false; | 1531 | return false; |
1532 | } | 1532 | } |
1533 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1533 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1534 | { | 1534 | { |
1535 | loadedFileVersion = dt; | 1535 | loadedFileVersion = dt; |
1536 | } | 1536 | } |
1537 | bool CalendarView::checkFileChanged(QString fn) | 1537 | bool CalendarView::checkFileChanged(QString fn) |
1538 | { | 1538 | { |
1539 | QFileInfo finf ( fn ); | 1539 | QFileInfo finf ( fn ); |
1540 | if ( !finf.exists() ) | 1540 | if ( !finf.exists() ) |
1541 | return true; | 1541 | return true; |
1542 | QDateTime dt = finf.lastModified (); | 1542 | QDateTime dt = finf.lastModified (); |
1543 | if ( dt <= loadedFileVersion ) | 1543 | if ( dt <= loadedFileVersion ) |
1544 | return false; | 1544 | return false; |
1545 | return true; | 1545 | return true; |
1546 | 1546 | ||
1547 | } | 1547 | } |
1548 | void CalendarView::watchSavedFile() | ||
1549 | { | ||
1550 | QFileInfo finf ( MainWindow::defaultFileName()); | ||
1551 | if ( !finf.exists() ) | ||
1552 | return; | ||
1553 | QDateTime dt = finf.lastModified (); | ||
1554 | if ( dt < loadedFileVersion ) { | ||
1555 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | ||
1556 | return; | ||
1557 | } | ||
1558 | loadedFileVersion = dt; | ||
1559 | } | ||
1560 | |||
1548 | bool CalendarView::checkFileVersion(QString fn) | 1561 | bool CalendarView::checkFileVersion(QString fn) |
1549 | { | 1562 | { |
1550 | QFileInfo finf ( fn ); | 1563 | QFileInfo finf ( fn ); |
1551 | if ( !finf.exists() ) | 1564 | if ( !finf.exists() ) |
1552 | return true; | 1565 | return true; |
1553 | QDateTime dt = finf.lastModified (); | 1566 | QDateTime dt = finf.lastModified (); |
1554 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1567 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1555 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1568 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1556 | if ( dt <= loadedFileVersion ) | 1569 | if ( dt <= loadedFileVersion ) |
1557 | return true; | 1570 | return true; |
1558 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , | 1571 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1559 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1572 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1560 | i18n("Sync+save")); | 1573 | i18n("Sync+save")); |
1561 | 1574 | ||
1562 | if ( km == KMessageBox::Cancel ) | 1575 | if ( km == KMessageBox::Cancel ) |
1563 | return false; | 1576 | return false; |
1564 | if ( km == KMessageBox::Yes ) | 1577 | if ( km == KMessageBox::Yes ) |
1565 | return true; | 1578 | return true; |
1566 | 1579 | ||
1567 | setSyncDevice("deleteaftersync" ); | 1580 | setSyncDevice("deleteaftersync" ); |
1568 | KOPrefs::instance()->mAskForPreferences = true; | 1581 | KOPrefs::instance()->mAskForPreferences = true; |
1569 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1582 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1570 | KOPrefs::instance()->mWriteBackFile = false; | 1583 | KOPrefs::instance()->mWriteBackFile = false; |
1571 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1584 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1572 | KOPrefs::instance()->mShowSyncSummary = false; | 1585 | KOPrefs::instance()->mShowSyncSummary = false; |
1573 | syncCalendar( fn, 3 ); | 1586 | syncCalendar( fn, 3 ); |
1574 | Event * e = getLastSyncEvent(); | 1587 | Event * e = getLastSyncEvent(); |
1575 | mCalendar->deleteEvent ( e ); | 1588 | mCalendar->deleteEvent ( e ); |
1576 | updateView(); | 1589 | updateView(); |
1577 | return true; | 1590 | return true; |
1578 | } | 1591 | } |
1579 | 1592 | ||
1580 | bool CalendarView::saveCalendar( QString filename ) | 1593 | bool CalendarView::saveCalendar( QString filename ) |
1581 | { | 1594 | { |
1582 | 1595 | ||
1583 | // Store back all unsaved data into calendar object | 1596 | // Store back all unsaved data into calendar object |
1584 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1597 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1585 | if ( mViewManager->currentView() ) | 1598 | if ( mViewManager->currentView() ) |
1586 | mViewManager->currentView()->flushView(); | 1599 | mViewManager->currentView()->flushView(); |
1587 | 1600 | ||
1588 | //mStorage->setFileName( filename ); | 1601 | //mStorage->setFileName( filename ); |
1589 | 1602 | ||
1590 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1603 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1591 | mStorage->setFileName( filename ); | 1604 | mStorage->setFileName( filename ); |
1592 | bool success; | 1605 | bool success; |
1593 | success = mStorage->save(); | 1606 | success = mStorage->save(); |
1594 | if ( !success ) { | 1607 | if ( !success ) { |
1595 | return false; | 1608 | return false; |
1596 | } | 1609 | } |
1597 | 1610 | ||
1598 | return true; | 1611 | return true; |
1599 | } | 1612 | } |
1600 | 1613 | ||
1601 | void CalendarView::closeCalendar() | 1614 | void CalendarView::closeCalendar() |
1602 | { | 1615 | { |
1603 | 1616 | ||
1604 | // child windows no longer valid | 1617 | // child windows no longer valid |
1605 | emit closingDown(); | 1618 | emit closingDown(); |
1606 | 1619 | ||
1607 | mCalendar->close(); | 1620 | mCalendar->close(); |
1608 | setModified(false); | 1621 | setModified(false); |
1609 | updateView(); | 1622 | updateView(); |
1610 | } | 1623 | } |
1611 | 1624 | ||
1612 | void CalendarView::archiveCalendar() | 1625 | void CalendarView::archiveCalendar() |
1613 | { | 1626 | { |
1614 | mDialogManager->showArchiveDialog(); | 1627 | mDialogManager->showArchiveDialog(); |
1615 | } | 1628 | } |
1616 | 1629 | ||
1617 | 1630 | ||
1618 | void CalendarView::readSettings() | 1631 | void CalendarView::readSettings() |
1619 | { | 1632 | { |
1620 | 1633 | ||
1621 | 1634 | ||
1622 | // mViewManager->showAgendaView(); | 1635 | // mViewManager->showAgendaView(); |
1623 | QString str; | 1636 | QString str; |
1624 | //qDebug("CalendarView::readSettings() "); | 1637 | //qDebug("CalendarView::readSettings() "); |
1625 | // read settings from the KConfig, supplying reasonable | 1638 | // read settings from the KConfig, supplying reasonable |
1626 | // defaults where none are to be found | 1639 | // defaults where none are to be found |
1627 | KConfig *config = KOGlobals::config(); | 1640 | KConfig *config = KOGlobals::config(); |
1628 | #ifndef KORG_NOSPLITTER | 1641 | #ifndef KORG_NOSPLITTER |
1629 | config->setGroup("KOrganizer Geometry"); | 1642 | config->setGroup("KOrganizer Geometry"); |
1630 | 1643 | ||
1631 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1644 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1632 | if (sizes.count() != 2) { | 1645 | if (sizes.count() != 2) { |
1633 | sizes << mDateNavigator->minimumSizeHint().width(); | 1646 | sizes << mDateNavigator->minimumSizeHint().width(); |
1634 | sizes << 300; | 1647 | sizes << 300; |
1635 | } | 1648 | } |
1636 | mPanner->setSizes(sizes); | 1649 | mPanner->setSizes(sizes); |
1637 | 1650 | ||
1638 | sizes = config->readIntListEntry("Separator2"); | 1651 | sizes = config->readIntListEntry("Separator2"); |
1639 | if ( ( mResourceView && sizes.count() == 4 ) || | 1652 | if ( ( mResourceView && sizes.count() == 4 ) || |
1640 | ( !mResourceView && sizes.count() == 3 ) ) { | 1653 | ( !mResourceView && sizes.count() == 3 ) ) { |
1641 | mLeftSplitter->setSizes(sizes); | 1654 | mLeftSplitter->setSizes(sizes); |
1642 | } | 1655 | } |
1643 | #endif | 1656 | #endif |
1644 | globalFlagBlockAgenda = 1; | 1657 | globalFlagBlockAgenda = 1; |
1645 | mViewManager->showAgendaView(); | 1658 | mViewManager->showAgendaView(); |
1646 | //mViewManager->readSettings( config ); | 1659 | //mViewManager->readSettings( config ); |
1647 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1660 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1648 | readFilterSettings(config); | 1661 | readFilterSettings(config); |
1649 | config->setGroup( "Views" ); | 1662 | config->setGroup( "Views" ); |
1650 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1663 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1651 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1664 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1652 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1665 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1653 | else mNavigator->selectDates( dateCount ); | 1666 | else mNavigator->selectDates( dateCount ); |
1654 | // mViewManager->readSettings( config ); | 1667 | // mViewManager->readSettings( config ); |
1655 | updateConfig(); | 1668 | updateConfig(); |
1656 | globalFlagBlockAgenda = 2; | 1669 | globalFlagBlockAgenda = 2; |
1657 | mViewManager->readSettings( config ); | 1670 | mViewManager->readSettings( config ); |
1658 | #ifdef DESKTOP_VERSION | 1671 | #ifdef DESKTOP_VERSION |
1659 | config->setGroup("WidgetLayout"); | 1672 | config->setGroup("WidgetLayout"); |
1660 | QStringList list; | 1673 | QStringList list; |
1661 | list = config->readListEntry("MainLayout"); | 1674 | list = config->readListEntry("MainLayout"); |
1662 | int x,y,w,h; | 1675 | int x,y,w,h; |
1663 | if ( ! list.isEmpty() ) { | 1676 | if ( ! list.isEmpty() ) { |
1664 | x = list[0].toInt(); | 1677 | x = list[0].toInt(); |
1665 | y = list[1].toInt(); | 1678 | y = list[1].toInt(); |
1666 | w = list[2].toInt(); | 1679 | w = list[2].toInt(); |
1667 | h = list[3].toInt(); | 1680 | h = list[3].toInt(); |
1668 | topLevelWidget()->setGeometry(x,y,w,h); | 1681 | topLevelWidget()->setGeometry(x,y,w,h); |
1669 | 1682 | ||
1670 | } else { | 1683 | } else { |
1671 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1684 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1672 | } | 1685 | } |
1673 | list = config->readListEntry("EditEventLayout"); | 1686 | list = config->readListEntry("EditEventLayout"); |
1674 | if ( ! list.isEmpty() ) { | 1687 | if ( ! list.isEmpty() ) { |
1675 | x = list[0].toInt(); | 1688 | x = list[0].toInt(); |
1676 | y = list[1].toInt(); | 1689 | y = list[1].toInt(); |
1677 | w = list[2].toInt(); | 1690 | w = list[2].toInt(); |
1678 | h = list[3].toInt(); | 1691 | h = list[3].toInt(); |
1679 | mEventEditor->setGeometry(x,y,w,h); | 1692 | mEventEditor->setGeometry(x,y,w,h); |
1680 | 1693 | ||
1681 | } | 1694 | } |
1682 | list = config->readListEntry("EditTodoLayout"); | 1695 | list = config->readListEntry("EditTodoLayout"); |
1683 | if ( ! list.isEmpty() ) { | 1696 | if ( ! list.isEmpty() ) { |
1684 | x = list[0].toInt(); | 1697 | x = list[0].toInt(); |
1685 | y = list[1].toInt(); | 1698 | y = list[1].toInt(); |
1686 | w = list[2].toInt(); | 1699 | w = list[2].toInt(); |
1687 | h = list[3].toInt(); | 1700 | h = list[3].toInt(); |
1688 | mTodoEditor->setGeometry(x,y,w,h); | 1701 | mTodoEditor->setGeometry(x,y,w,h); |
1689 | 1702 | ||
1690 | } | 1703 | } |
1691 | list = config->readListEntry("ViewerLayout"); | 1704 | list = config->readListEntry("ViewerLayout"); |
1692 | if ( ! list.isEmpty() ) { | 1705 | if ( ! list.isEmpty() ) { |
1693 | x = list[0].toInt(); | 1706 | x = list[0].toInt(); |
1694 | y = list[1].toInt(); | 1707 | y = list[1].toInt(); |
1695 | w = list[2].toInt(); | 1708 | w = list[2].toInt(); |
1696 | h = list[3].toInt(); | 1709 | h = list[3].toInt(); |
1697 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1710 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1698 | } | 1711 | } |
1699 | #endif | 1712 | #endif |
1700 | 1713 | ||
1701 | } | 1714 | } |
1702 | 1715 | ||
1703 | 1716 | ||
1704 | void CalendarView::writeSettings() | 1717 | void CalendarView::writeSettings() |
1705 | { | 1718 | { |
1706 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1719 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1707 | 1720 | ||
1708 | KConfig *config = KOGlobals::config(); | 1721 | KConfig *config = KOGlobals::config(); |
1709 | 1722 | ||
1710 | #ifndef KORG_NOSPLITTER | 1723 | #ifndef KORG_NOSPLITTER |
1711 | config->setGroup("KOrganizer Geometry"); | 1724 | config->setGroup("KOrganizer Geometry"); |
1712 | 1725 | ||
1713 | QValueList<int> list = mPanner->sizes(); | 1726 | QValueList<int> list = mPanner->sizes(); |
1714 | config->writeEntry("Separator1",list); | 1727 | config->writeEntry("Separator1",list); |
1715 | 1728 | ||
1716 | list = mLeftSplitter->sizes(); | 1729 | list = mLeftSplitter->sizes(); |
1717 | config->writeEntry("Separator2",list); | 1730 | config->writeEntry("Separator2",list); |
1718 | #endif | 1731 | #endif |
1719 | 1732 | ||
1720 | mViewManager->writeSettings( config ); | 1733 | mViewManager->writeSettings( config ); |
1721 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1734 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1722 | mDialogManager->writeSettings( config ); | 1735 | mDialogManager->writeSettings( config ); |
1723 | //KOPrefs::instance()->usrWriteConfig(); | 1736 | //KOPrefs::instance()->usrWriteConfig(); |
1724 | KOPrefs::instance()->writeConfig(); | 1737 | KOPrefs::instance()->writeConfig(); |
1725 | 1738 | ||
1726 | writeFilterSettings(config); | 1739 | writeFilterSettings(config); |
1727 | 1740 | ||
1728 | config->setGroup( "Views" ); | 1741 | config->setGroup( "Views" ); |
1729 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1742 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1730 | 1743 | ||
1731 | #ifdef DESKTOP_VERSION | 1744 | #ifdef DESKTOP_VERSION |
1732 | config->setGroup("WidgetLayout"); | 1745 | config->setGroup("WidgetLayout"); |
1733 | QStringList list ;//= config->readListEntry("MainLayout"); | 1746 | QStringList list ;//= config->readListEntry("MainLayout"); |
1734 | int x,y,w,h; | 1747 | int x,y,w,h; |
1735 | QWidget* wid; | 1748 | QWidget* wid; |
1736 | wid = topLevelWidget(); | 1749 | wid = topLevelWidget(); |
1737 | x = wid->geometry().x(); | 1750 | x = wid->geometry().x(); |
1738 | y = wid->geometry().y(); | 1751 | y = wid->geometry().y(); |
1739 | w = wid->width(); | 1752 | w = wid->width(); |
1740 | h = wid->height(); | 1753 | h = wid->height(); |
1741 | list.clear(); | 1754 | list.clear(); |
1742 | list << QString::number( x ); | 1755 | list << QString::number( x ); |
1743 | list << QString::number( y ); | 1756 | list << QString::number( y ); |
1744 | list << QString::number( w ); | 1757 | list << QString::number( w ); |
1745 | list << QString::number( h ); | 1758 | list << QString::number( h ); |
1746 | config->writeEntry("MainLayout",list ); | 1759 | config->writeEntry("MainLayout",list ); |
1747 | 1760 | ||
1748 | wid = mEventEditor; | 1761 | wid = mEventEditor; |
1749 | x = wid->geometry().x(); | 1762 | x = wid->geometry().x(); |
1750 | y = wid->geometry().y(); | 1763 | y = wid->geometry().y(); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index a3315ad..355bb84 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,366 +1,367 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
34 | #include <qtopia/ir.h> | 34 | #include <qtopia/ir.h> |
35 | #else | 35 | #else |
36 | #define Ir char | 36 | #define Ir char |
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/scheduler.h> | 39 | #include <libkcal/scheduler.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | 42 | ||
43 | #include <korganizer/calendarviewbase.h> | 43 | #include <korganizer/calendarviewbase.h> |
44 | 44 | ||
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | class QSplitter; | 46 | class QSplitter; |
47 | 47 | ||
48 | class CalPrinter; | 48 | class CalPrinter; |
49 | class KOFilterView; | 49 | class KOFilterView; |
50 | class KOViewManager; | 50 | class KOViewManager; |
51 | class KODialogManager; | 51 | class KODialogManager; |
52 | class KOTodoView; | 52 | class KOTodoView; |
53 | class KDateNavigator; | 53 | class KDateNavigator; |
54 | class DateNavigator; | 54 | class DateNavigator; |
55 | class KOIncidenceEditor; | 55 | class KOIncidenceEditor; |
56 | class KDatePicker; | 56 | class KDatePicker; |
57 | class ResourceView; | 57 | class ResourceView; |
58 | class NavigatorBar; | 58 | class NavigatorBar; |
59 | class KOEventEditor; | 59 | class KOEventEditor; |
60 | class KOTodoEditor ; | 60 | class KOTodoEditor ; |
61 | class KOEventViewerDialog; | 61 | class KOEventViewerDialog; |
62 | class KOBeamPrefs; | 62 | class KOBeamPrefs; |
63 | class KSyncProfile; | 63 | class KSyncProfile; |
64 | class AlarmDialog; | 64 | class AlarmDialog; |
65 | class KCal::Attendee; | 65 | class KCal::Attendee; |
66 | 66 | ||
67 | namespace KCal { class FileStorage; } | 67 | namespace KCal { class FileStorage; } |
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | void setupExternSyncProfiles(); | 116 | void setupExternSyncProfiles(); |
117 | 117 | ||
118 | signals: | 118 | signals: |
119 | /** This todo has been modified */ | 119 | /** This todo has been modified */ |
120 | void todoModified(Todo *, int); | 120 | void todoModified(Todo *, int); |
121 | 121 | ||
122 | /** when change is made to options dialog, the topwidget will catch this | 122 | /** when change is made to options dialog, the topwidget will catch this |
123 | * and emit this signal which notifies all widgets which have registered | 123 | * and emit this signal which notifies all widgets which have registered |
124 | * for notification to update their settings. */ | 124 | * for notification to update their settings. */ |
125 | void configChanged(); | 125 | void configChanged(); |
126 | /** emitted when the topwidget is closing down, so that any attached | 126 | /** emitted when the topwidget is closing down, so that any attached |
127 | child windows can also close. */ | 127 | child windows can also close. */ |
128 | void closingDown(); | 128 | void closingDown(); |
129 | /** emitted right before we die */ | 129 | /** emitted right before we die */ |
130 | void closed(QWidget *); | 130 | void closed(QWidget *); |
131 | 131 | ||
132 | /** Emitted when state of modified flag changes */ | 132 | /** Emitted when state of modified flag changes */ |
133 | void modifiedChanged(bool); | 133 | void modifiedChanged(bool); |
134 | void signalmodified(); | 134 | void signalmodified(); |
135 | 135 | ||
136 | /** Emitted when state of read-only flag changes */ | 136 | /** Emitted when state of read-only flag changes */ |
137 | void readOnlyChanged(bool); | 137 | void readOnlyChanged(bool); |
138 | 138 | ||
139 | /** Emitted when the unit of navigation changes */ | 139 | /** Emitted when the unit of navigation changes */ |
140 | void changeNavStringPrev(const QString &); | 140 | void changeNavStringPrev(const QString &); |
141 | void changeNavStringNext(const QString &); | 141 | void changeNavStringNext(const QString &); |
142 | 142 | ||
143 | /** Emitted when state of events selection has changed and user is organizer*/ | 143 | /** Emitted when state of events selection has changed and user is organizer*/ |
144 | void organizerEventsSelected(bool); | 144 | void organizerEventsSelected(bool); |
145 | /** Emitted when state of events selection has changed and user is attendee*/ | 145 | /** Emitted when state of events selection has changed and user is attendee*/ |
146 | void groupEventsSelected(bool); | 146 | void groupEventsSelected(bool); |
147 | /** | 147 | /** |
148 | Emitted when an incidence gets selected. If the selection is cleared the | 148 | Emitted when an incidence gets selected. If the selection is cleared the |
149 | signal is emitted with 0 as argument. | 149 | signal is emitted with 0 as argument. |
150 | */ | 150 | */ |
151 | void incidenceSelected( Incidence * ); | 151 | void incidenceSelected( Incidence * ); |
152 | /** Emitted, when a todoitem is selected or deselected. */ | 152 | /** Emitted, when a todoitem is selected or deselected. */ |
153 | void todoSelected( bool ); | 153 | void todoSelected( bool ); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Emitted, when clipboard content changes. Parameter indicates if paste | 156 | Emitted, when clipboard content changes. Parameter indicates if paste |
157 | is possible or not. | 157 | is possible or not. |
158 | */ | 158 | */ |
159 | void pasteEnabled(bool); | 159 | void pasteEnabled(bool); |
160 | 160 | ||
161 | /** Emitted, when the number of incoming messages has changed. */ | 161 | /** Emitted, when the number of incoming messages has changed. */ |
162 | void numIncomingChanged(int); | 162 | void numIncomingChanged(int); |
163 | 163 | ||
164 | /** Emitted, when the number of outgoing messages has changed. */ | 164 | /** Emitted, when the number of outgoing messages has changed. */ |
165 | void numOutgoingChanged(int); | 165 | void numOutgoingChanged(int); |
166 | 166 | ||
167 | /** Send status message, which can e.g. be displayed in the status bar. */ | 167 | /** Send status message, which can e.g. be displayed in the status bar. */ |
168 | void statusMessage(const QString &); | 168 | void statusMessage(const QString &); |
169 | 169 | ||
170 | void calendarViewExpanded( bool ); | 170 | void calendarViewExpanded( bool ); |
171 | void updateSearchDialog(); | 171 | void updateSearchDialog(); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void watchSavedFile(); | ||
175 | void recheckTimerAlarm(); | 176 | void recheckTimerAlarm(); |
176 | void checkNextTimerAlarm(); | 177 | void checkNextTimerAlarm(); |
177 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 178 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
178 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
179 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 180 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | 181 | ||
181 | /** options dialog made a changed to the configuration. we catch this | 182 | /** options dialog made a changed to the configuration. we catch this |
182 | * and notify all widgets which need to update their configuration. */ | 183 | * and notify all widgets which need to update their configuration. */ |
183 | void updateConfig(); | 184 | void updateConfig(); |
184 | 185 | ||
185 | /** | 186 | /** |
186 | Load calendar from file \a filename. If \a merge is true, load | 187 | Load calendar from file \a filename. If \a merge is true, load |
187 | calendar into existing one, if it is false, clear calendar, before | 188 | calendar into existing one, if it is false, clear calendar, before |
188 | loading. Return true, if calendar could be successfully loaded. | 189 | loading. Return true, if calendar could be successfully loaded. |
189 | */ | 190 | */ |
190 | bool openCalendar(QString filename, bool merge=false); | 191 | bool openCalendar(QString filename, bool merge=false); |
191 | bool syncCalendar(QString filename,int mode = 0 ); | 192 | bool syncCalendar(QString filename,int mode = 0 ); |
192 | 193 | ||
193 | /** | 194 | /** |
194 | Save calendar data to file. Return true if calendar could be | 195 | Save calendar data to file. Return true if calendar could be |
195 | successfully saved. | 196 | successfully saved. |
196 | */ | 197 | */ |
197 | bool saveCalendar(QString filename); | 198 | bool saveCalendar(QString filename); |
198 | 199 | ||
199 | /** | 200 | /** |
200 | Close calendar. Clear calendar data and reset views to display an empty | 201 | Close calendar. Clear calendar data and reset views to display an empty |
201 | calendar. | 202 | calendar. |
202 | */ | 203 | */ |
203 | void closeCalendar(); | 204 | void closeCalendar(); |
204 | 205 | ||
205 | /** Archive old events of calendar */ | 206 | /** Archive old events of calendar */ |
206 | void archiveCalendar(); | 207 | void archiveCalendar(); |
207 | 208 | ||
208 | void showIncidence(); | 209 | void showIncidence(); |
209 | void editIncidence(); | 210 | void editIncidence(); |
210 | void editIncidenceDescription(); | 211 | void editIncidenceDescription(); |
211 | void deleteIncidence(); | 212 | void deleteIncidence(); |
212 | 213 | ||
213 | /** create an editeventwin with supplied date/time, and if bool is true, | 214 | /** create an editeventwin with supplied date/time, and if bool is true, |
214 | * make the event take all day. */ | 215 | * make the event take all day. */ |
215 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 216 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
216 | void newEvent(QDateTime fh); | 217 | void newEvent(QDateTime fh); |
217 | void newEvent(QDate dt); | 218 | void newEvent(QDate dt); |
218 | /** create new event without having a date hint. Takes current date as | 219 | /** create new event without having a date hint. Takes current date as |
219 | default hint. */ | 220 | default hint. */ |
220 | void newEvent(); | 221 | void newEvent(); |
221 | void newFloatingEvent(); | 222 | void newFloatingEvent(); |
222 | 223 | ||
223 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 224 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
224 | void showIncidence(Incidence *); | 225 | void showIncidence(Incidence *); |
225 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 226 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
226 | void editIncidence(Incidence *); | 227 | void editIncidence(Incidence *); |
227 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 228 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
228 | void deleteIncidence(Incidence *); | 229 | void deleteIncidence(Incidence *); |
229 | void cloneIncidence(Incidence *); | 230 | void cloneIncidence(Incidence *); |
230 | void cancelIncidence(Incidence *); | 231 | void cancelIncidence(Incidence *); |
231 | /** Create an editor for the supplied event. */ | 232 | /** Create an editor for the supplied event. */ |
232 | void editEvent(Event *); | 233 | void editEvent(Event *); |
233 | /** Delete the supplied event. */ | 234 | /** Delete the supplied event. */ |
234 | void deleteEvent(Event *); | 235 | void deleteEvent(Event *); |
235 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 236 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
236 | found. */ | 237 | found. */ |
237 | bool deleteEvent(const QString &uid); | 238 | bool deleteEvent(const QString &uid); |
238 | /** Create a read-only viewer dialog for the supplied event. */ | 239 | /** Create a read-only viewer dialog for the supplied event. */ |
239 | void showEvent(Event *); | 240 | void showEvent(Event *); |
240 | 241 | ||
241 | void editJournal(Journal *); | 242 | void editJournal(Journal *); |
242 | void showJournal(Journal *); | 243 | void showJournal(Journal *); |
243 | void deleteJournal(Journal *); | 244 | void deleteJournal(Journal *); |
244 | /** Create an editor dialog for a todo */ | 245 | /** Create an editor dialog for a todo */ |
245 | void editTodo(Todo *); | 246 | void editTodo(Todo *); |
246 | /** Create a read-only viewer dialog for the supplied todo */ | 247 | /** Create a read-only viewer dialog for the supplied todo */ |
247 | void showTodo(Todo *); | 248 | void showTodo(Todo *); |
248 | /** create new todo */ | 249 | /** create new todo */ |
249 | void newTodo(); | 250 | void newTodo(); |
250 | /** create new todo with a parent todo */ | 251 | /** create new todo with a parent todo */ |
251 | void newSubTodo(); | 252 | void newSubTodo(); |
252 | /** create new todo with a parent todo */ | 253 | /** create new todo with a parent todo */ |
253 | void newSubTodo(Todo *); | 254 | void newSubTodo(Todo *); |
254 | /** Delete todo */ | 255 | /** Delete todo */ |
255 | void deleteTodo(Todo *); | 256 | void deleteTodo(Todo *); |
256 | 257 | ||
257 | 258 | ||
258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 259 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
259 | * emitted as result. */ | 260 | * emitted as result. */ |
260 | void checkClipboard(); | 261 | void checkClipboard(); |
261 | 262 | ||
262 | /** using the KConfig associated with the kapp variable, read in the | 263 | /** using the KConfig associated with the kapp variable, read in the |
263 | * settings from the config file. | 264 | * settings from the config file. |
264 | */ | 265 | */ |
265 | void readSettings(); | 266 | void readSettings(); |
266 | 267 | ||
267 | /** write current state to config file. */ | 268 | /** write current state to config file. */ |
268 | void writeSettings(); | 269 | void writeSettings(); |
269 | 270 | ||
270 | /** read settings for calendar filters */ | 271 | /** read settings for calendar filters */ |
271 | void readFilterSettings(KConfig *config); | 272 | void readFilterSettings(KConfig *config); |
272 | 273 | ||
273 | /** write settings for calendar filters */ | 274 | /** write settings for calendar filters */ |
274 | void writeFilterSettings(KConfig *config); | 275 | void writeFilterSettings(KConfig *config); |
275 | 276 | ||
276 | /** passes on the message that an event has changed to the currently | 277 | /** passes on the message that an event has changed to the currently |
277 | * activated view so that it can make appropriate display changes. */ | 278 | * activated view so that it can make appropriate display changes. */ |
278 | void changeEventDisplay(Event *, int); | 279 | void changeEventDisplay(Event *, int); |
279 | void changeIncidenceDisplay(Incidence *, int); | 280 | void changeIncidenceDisplay(Incidence *, int); |
280 | void changeTodoDisplay(Todo *, int); | 281 | void changeTodoDisplay(Todo *, int); |
281 | 282 | ||
282 | void eventAdded(Event *); | 283 | void eventAdded(Event *); |
283 | void eventChanged(Event *); | 284 | void eventChanged(Event *); |
284 | void eventToBeDeleted(Event *); | 285 | void eventToBeDeleted(Event *); |
285 | void eventDeleted(); | 286 | void eventDeleted(); |
286 | 287 | ||
287 | void todoAdded(Todo *); | 288 | void todoAdded(Todo *); |
288 | void todoChanged(Todo *); | 289 | void todoChanged(Todo *); |
289 | void todoToBeDeleted(Todo *); | 290 | void todoToBeDeleted(Todo *); |
290 | void todoDeleted(); | 291 | void todoDeleted(); |
291 | 292 | ||
292 | void updateView(const QDate &start, const QDate &end); | 293 | void updateView(const QDate &start, const QDate &end); |
293 | void updateView(); | 294 | void updateView(); |
294 | 295 | ||
295 | /** Full update of visible todo views */ | 296 | /** Full update of visible todo views */ |
296 | void updateTodoViews(); | 297 | void updateTodoViews(); |
297 | 298 | ||
298 | void updateUnmanagedViews(); | 299 | void updateUnmanagedViews(); |
299 | 300 | ||
300 | /** cut the current appointment to the clipboard */ | 301 | /** cut the current appointment to the clipboard */ |
301 | void edit_cut(); | 302 | void edit_cut(); |
302 | 303 | ||
303 | /** copy the current appointment(s) to the clipboard */ | 304 | /** copy the current appointment(s) to the clipboard */ |
304 | void edit_copy(); | 305 | void edit_copy(); |
305 | 306 | ||
306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 307 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
307 | void edit_paste(); | 308 | void edit_paste(); |
308 | 309 | ||
309 | /** edit viewing and configuration options. */ | 310 | /** edit viewing and configuration options. */ |
310 | void edit_options(); | 311 | void edit_options(); |
311 | void edit_sync_options(); | 312 | void edit_sync_options(); |
312 | /** | 313 | /** |
313 | Functions for printing, previewing a print, and setting up printing | 314 | Functions for printing, previewing a print, and setting up printing |
314 | parameters. | 315 | parameters. |
315 | */ | 316 | */ |
316 | void print(); | 317 | void print(); |
317 | void printSetup(); | 318 | void printSetup(); |
318 | void printPreview(); | 319 | void printPreview(); |
319 | 320 | ||
320 | /** Export as iCalendar file */ | 321 | /** Export as iCalendar file */ |
321 | void exportICalendar(); | 322 | void exportICalendar(); |
322 | 323 | ||
323 | /** Export as vCalendar file */ | 324 | /** Export as vCalendar file */ |
324 | bool exportVCalendar( QString fn); | 325 | bool exportVCalendar( QString fn); |
325 | 326 | ||
326 | /** pop up a dialog to show an existing appointment. */ | 327 | /** pop up a dialog to show an existing appointment. */ |
327 | void appointment_show(); | 328 | void appointment_show(); |
328 | /** | 329 | /** |
329 | * pop up an Appointment Dialog to edit an existing appointment.Get | 330 | * pop up an Appointment Dialog to edit an existing appointment.Get |
330 | * information on the appointment from the list of unique IDs that is | 331 | * information on the appointment from the list of unique IDs that is |
331 | * currently in the View, called currIds. | 332 | * currently in the View, called currIds. |
332 | */ | 333 | */ |
333 | void appointment_edit(); | 334 | void appointment_edit(); |
334 | /** | 335 | /** |
335 | * pop up dialog confirming deletion of currently selected event in the | 336 | * pop up dialog confirming deletion of currently selected event in the |
336 | * View. | 337 | * View. |
337 | */ | 338 | */ |
338 | void appointment_delete(); | 339 | void appointment_delete(); |
339 | 340 | ||
340 | /** mails the currently selected event to a particular user as a vCalendar | 341 | /** mails the currently selected event to a particular user as a vCalendar |
341 | attachment. */ | 342 | attachment. */ |
342 | void action_mail(); | 343 | void action_mail(); |
343 | 344 | ||
344 | /* frees a subtodo from it's relation */ | 345 | /* frees a subtodo from it's relation */ |
345 | void todo_unsub( Todo * ); | 346 | void todo_unsub( Todo * ); |
346 | 347 | ||
347 | /** Take ownership of selected event. */ | 348 | /** Take ownership of selected event. */ |
348 | void takeOverEvent(); | 349 | void takeOverEvent(); |
349 | 350 | ||
350 | /** Take ownership of all events in calendar. */ | 351 | /** Take ownership of all events in calendar. */ |
351 | void takeOverCalendar(); | 352 | void takeOverCalendar(); |
352 | 353 | ||
353 | /** query whether or not the calendar is "dirty". */ | 354 | /** query whether or not the calendar is "dirty". */ |
354 | bool isModified(); | 355 | bool isModified(); |
355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 356 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
356 | void setModified(bool modified=true); | 357 | void setModified(bool modified=true); |
357 | 358 | ||
358 | /** query if the calendar is read-only. */ | 359 | /** query if the calendar is read-only. */ |
359 | bool isReadOnly(); | 360 | bool isReadOnly(); |
360 | /** set state of calendar to read-only */ | 361 | /** set state of calendar to read-only */ |
361 | void setReadOnly(bool readOnly=true); | 362 | void setReadOnly(bool readOnly=true); |
362 | 363 | ||
363 | void eventUpdated(Incidence *); | 364 | void eventUpdated(Incidence *); |
364 | 365 | ||
365 | /* iTIP scheduling actions */ | 366 | /* iTIP scheduling actions */ |
366 | void schedule_publish(Incidence *incidence = 0); | 367 | void schedule_publish(Incidence *incidence = 0); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 1c4a186..6315c64 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1219,388 +1219,389 @@ void MainWindow::keyBindings() | |||
1219 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1219 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1220 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1220 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1221 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1221 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1222 | displayText( text, cap); | 1222 | displayText( text, cap); |
1223 | 1223 | ||
1224 | } | 1224 | } |
1225 | void MainWindow::aboutAutoSaving() | 1225 | void MainWindow::aboutAutoSaving() |
1226 | { | 1226 | { |
1227 | QMessageBox* msg; | 1227 | QMessageBox* msg; |
1228 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1228 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1229 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1229 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1230 | QMessageBox::Ok, | 1230 | QMessageBox::Ok, |
1231 | QMessageBox::NoButton, | 1231 | QMessageBox::NoButton, |
1232 | QMessageBox::NoButton); | 1232 | QMessageBox::NoButton); |
1233 | msg->exec(); | 1233 | msg->exec(); |
1234 | delete msg; | 1234 | delete msg; |
1235 | 1235 | ||
1236 | 1236 | ||
1237 | } | 1237 | } |
1238 | void MainWindow::aboutKnownBugs() | 1238 | void MainWindow::aboutKnownBugs() |
1239 | { | 1239 | { |
1240 | QMessageBox* msg; | 1240 | QMessageBox* msg; |
1241 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1241 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1242 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1242 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1243 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1243 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1244 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1244 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1245 | i18n("\nor report them in the bugtracker on\n") + | 1245 | i18n("\nor report them in the bugtracker on\n") + |
1246 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1246 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1247 | QMessageBox::NoIcon, | 1247 | QMessageBox::NoIcon, |
1248 | QMessageBox::Ok, | 1248 | QMessageBox::Ok, |
1249 | QMessageBox::NoButton, | 1249 | QMessageBox::NoButton, |
1250 | QMessageBox::NoButton); | 1250 | QMessageBox::NoButton); |
1251 | msg->exec(); | 1251 | msg->exec(); |
1252 | delete msg; | 1252 | delete msg; |
1253 | 1253 | ||
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | QString MainWindow::defaultFileName() | 1256 | QString MainWindow::defaultFileName() |
1257 | { | 1257 | { |
1258 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1258 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1261 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1262 | { | 1262 | { |
1263 | if ( !incidence ) { | 1263 | if ( !incidence ) { |
1264 | enableIncidenceActions( false ); | 1264 | enableIncidenceActions( false ); |
1265 | 1265 | ||
1266 | mNewSubTodoAction->setEnabled( false ); | 1266 | mNewSubTodoAction->setEnabled( false ); |
1267 | setCaptionToDates(); | 1267 | setCaptionToDates(); |
1268 | return; | 1268 | return; |
1269 | 1269 | ||
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | //KGlobal::locale()->formatDateTime(nextA, true); | 1272 | //KGlobal::locale()->formatDateTime(nextA, true); |
1273 | QString startString = ""; | 1273 | QString startString = ""; |
1274 | if ( incidence->type() != "Todo" ) { | 1274 | if ( incidence->type() != "Todo" ) { |
1275 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1275 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1276 | if ( incidence->doesFloat() ) { | 1276 | if ( incidence->doesFloat() ) { |
1277 | startString += ": "+incidence->dtStartDateStr( true ); | 1277 | startString += ": "+incidence->dtStartDateStr( true ); |
1278 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1278 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1279 | 1279 | ||
1280 | } else { | 1280 | } else { |
1281 | startString = ": "+incidence->dtStartStr(true); | 1281 | startString = ": "+incidence->dtStartStr(true); |
1282 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1282 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1283 | 1283 | ||
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | } else { | 1286 | } else { |
1287 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1287 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1288 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1288 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1289 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1289 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1290 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1290 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1291 | } | 1291 | } |
1292 | 1292 | ||
1293 | } | 1293 | } |
1294 | else | 1294 | else |
1295 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1295 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1296 | if ( !incidence->location().isEmpty() ) | 1296 | if ( !incidence->location().isEmpty() ) |
1297 | startString += " (" +incidence->location()+")"; | 1297 | startString += " (" +incidence->location()+")"; |
1298 | setCaption( incidence->summary()+startString); | 1298 | setCaption( incidence->summary()+startString); |
1299 | 1299 | ||
1300 | enableIncidenceActions( true ); | 1300 | enableIncidenceActions( true ); |
1301 | 1301 | ||
1302 | if ( incidence->type() == "Event" ) { | 1302 | if ( incidence->type() == "Event" ) { |
1303 | mShowAction->setText( i18n("Show Event...") ); | 1303 | mShowAction->setText( i18n("Show Event...") ); |
1304 | mEditAction->setText( i18n("Edit Event...") ); | 1304 | mEditAction->setText( i18n("Edit Event...") ); |
1305 | mDeleteAction->setText( i18n("Delete Event...") ); | 1305 | mDeleteAction->setText( i18n("Delete Event...") ); |
1306 | 1306 | ||
1307 | mNewSubTodoAction->setEnabled( false ); | 1307 | mNewSubTodoAction->setEnabled( false ); |
1308 | } else if ( incidence->type() == "Todo" ) { | 1308 | } else if ( incidence->type() == "Todo" ) { |
1309 | mShowAction->setText( i18n("Show Todo...") ); | 1309 | mShowAction->setText( i18n("Show Todo...") ); |
1310 | mEditAction->setText( i18n("Edit Todo...") ); | 1310 | mEditAction->setText( i18n("Edit Todo...") ); |
1311 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1311 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1312 | 1312 | ||
1313 | mNewSubTodoAction->setEnabled( true ); | 1313 | mNewSubTodoAction->setEnabled( true ); |
1314 | } else { | 1314 | } else { |
1315 | mShowAction->setText( i18n("Show...") ); | 1315 | mShowAction->setText( i18n("Show...") ); |
1316 | mShowAction->setText( i18n("Edit...") ); | 1316 | mShowAction->setText( i18n("Edit...") ); |
1317 | mShowAction->setText( i18n("Delete...") ); | 1317 | mShowAction->setText( i18n("Delete...") ); |
1318 | 1318 | ||
1319 | mNewSubTodoAction->setEnabled( false ); | 1319 | mNewSubTodoAction->setEnabled( false ); |
1320 | } | 1320 | } |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | void MainWindow::enableIncidenceActions( bool enabled ) | 1323 | void MainWindow::enableIncidenceActions( bool enabled ) |
1324 | { | 1324 | { |
1325 | mShowAction->setEnabled( enabled ); | 1325 | mShowAction->setEnabled( enabled ); |
1326 | mEditAction->setEnabled( enabled ); | 1326 | mEditAction->setEnabled( enabled ); |
1327 | mDeleteAction->setEnabled( enabled ); | 1327 | mDeleteAction->setEnabled( enabled ); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | void MainWindow::importOL() | 1330 | void MainWindow::importOL() |
1331 | { | 1331 | { |
1332 | #ifdef _WIN32_ | 1332 | #ifdef _WIN32_ |
1333 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1333 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1334 | id->exec(); | 1334 | id->exec(); |
1335 | delete id; | 1335 | delete id; |
1336 | mView->updateView(); | 1336 | mView->updateView(); |
1337 | #endif | 1337 | #endif |
1338 | } | 1338 | } |
1339 | void MainWindow::importBday() | 1339 | void MainWindow::importBday() |
1340 | { | 1340 | { |
1341 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1341 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1342 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1342 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1343 | i18n("Import!"), i18n("Cancel"), 0, | 1343 | i18n("Import!"), i18n("Cancel"), 0, |
1344 | 0, 1 ); | 1344 | 0, 1 ); |
1345 | if ( result == 0 ) { | 1345 | if ( result == 0 ) { |
1346 | mView->importBday(); | 1346 | mView->importBday(); |
1347 | 1347 | ||
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | 1350 | ||
1351 | } | 1351 | } |
1352 | void MainWindow::importQtopia() | 1352 | void MainWindow::importQtopia() |
1353 | { | 1353 | { |
1354 | #ifndef DESKTOP_VERSION | 1354 | #ifndef DESKTOP_VERSION |
1355 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1355 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1356 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1356 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1357 | i18n("Import!"), i18n("Cancel"), 0, | 1357 | i18n("Import!"), i18n("Cancel"), 0, |
1358 | 0, 1 ); | 1358 | 0, 1 ); |
1359 | if ( result == 0 ) { | 1359 | if ( result == 0 ) { |
1360 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1360 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1361 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1361 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1362 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1362 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1363 | mView->importQtopia( categories, datebook, todolist ); | 1363 | mView->importQtopia( categories, datebook, todolist ); |
1364 | } | 1364 | } |
1365 | #else | 1365 | #else |
1366 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1366 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1367 | i18n("Not supported \non desktop!\n"), | 1367 | i18n("Not supported \non desktop!\n"), |
1368 | i18n("Ok"), i18n("Cancel"), 0, | 1368 | i18n("Ok"), i18n("Cancel"), 0, |
1369 | 0, 1 ); | 1369 | 0, 1 ); |
1370 | 1370 | ||
1371 | #endif | 1371 | #endif |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | void MainWindow::saveOnClose() | 1374 | void MainWindow::saveOnClose() |
1375 | { | 1375 | { |
1376 | KOPrefs *p = KOPrefs::instance(); | 1376 | KOPrefs *p = KOPrefs::instance(); |
1377 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1377 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1378 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1378 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1379 | iconToolBar->y() > height()/2; | 1379 | iconToolBar->y() > height()/2; |
1380 | mView->writeSettings(); | 1380 | mView->writeSettings(); |
1381 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1381 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1382 | save(); | 1382 | save(); |
1383 | } | 1383 | } |
1384 | void MainWindow::slotModifiedChanged( bool changed ) | 1384 | void MainWindow::slotModifiedChanged( bool changed ) |
1385 | { | 1385 | { |
1386 | if ( mBlockAtStartup ) | 1386 | if ( mBlockAtStartup ) |
1387 | return; | 1387 | return; |
1388 | int msec; | 1388 | int msec; |
1389 | // we store the changes after 1 minute, | 1389 | // we store the changes after 1 minute, |
1390 | // and for safety reasons after 10 minutes again | 1390 | // and for safety reasons after 10 minutes again |
1391 | if ( !mBlockSaveFlag ) | 1391 | if ( !mBlockSaveFlag ) |
1392 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1392 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1393 | else | 1393 | else |
1394 | msec = 1000 * 600; | 1394 | msec = 1000 * 600; |
1395 | mSaveTimer.start( msec, true ); // 1 minute | 1395 | mSaveTimer.start( msec, true ); // 1 minute |
1396 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1396 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1397 | mCalendarModifiedFlag = true; | 1397 | mCalendarModifiedFlag = true; |
1398 | } | 1398 | } |
1399 | #include <qfileinfo.h> | 1399 | #include <qfileinfo.h> |
1400 | void MainWindow::save() | 1400 | void MainWindow::save() |
1401 | { | 1401 | { |
1402 | if ( mBlockSaveFlag ) | 1402 | if ( mBlockSaveFlag ) |
1403 | return; | 1403 | return; |
1404 | bool store = mBlockSaveFlag; | 1404 | bool store = mBlockSaveFlag; |
1405 | mBlockSaveFlag = true; | 1405 | mBlockSaveFlag = true; |
1406 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1406 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1407 | 1407 | ||
1408 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1408 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1409 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1409 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1410 | qDebug("KO: Start saving data to file!"); | 1410 | qDebug("KO: Start saving data to file!"); |
1411 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | ||
1411 | mView->saveCalendar( defaultFileName() ); | 1412 | mView->saveCalendar( defaultFileName() ); |
1412 | 1413 | ||
1413 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1414 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1414 | mView->setLoadedFileVersion(QDateTime::currentDateTime()); | 1415 | mView->watchSavedFile(); |
1415 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1416 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1416 | QString savemes; | 1417 | QString savemes; |
1417 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1418 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1418 | setCaption(savemes); | 1419 | setCaption(savemes); |
1419 | } else | 1420 | } else |
1420 | setCaption(i18n("Saving cancelled!")); | 1421 | setCaption(i18n("Saving cancelled!")); |
1421 | mCalendarModifiedFlag = false; | 1422 | mCalendarModifiedFlag = false; |
1422 | mBlockSaveFlag = store; | 1423 | mBlockSaveFlag = store; |
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1426 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1426 | { | 1427 | { |
1427 | if ( !e->isAutoRepeat() ) { | 1428 | if ( !e->isAutoRepeat() ) { |
1428 | mFlagKeyPressed = false; | 1429 | mFlagKeyPressed = false; |
1429 | } | 1430 | } |
1430 | } | 1431 | } |
1431 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1432 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1432 | { | 1433 | { |
1433 | qApp->processEvents(); | 1434 | qApp->processEvents(); |
1434 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1435 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1435 | e->ignore(); | 1436 | e->ignore(); |
1436 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1437 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1437 | return; | 1438 | return; |
1438 | } | 1439 | } |
1439 | if (! e->isAutoRepeat() ) | 1440 | if (! e->isAutoRepeat() ) |
1440 | mFlagKeyPressed = true; | 1441 | mFlagKeyPressed = true; |
1441 | KOPrefs *p = KOPrefs::instance(); | 1442 | KOPrefs *p = KOPrefs::instance(); |
1442 | bool showSelectedDates = false; | 1443 | bool showSelectedDates = false; |
1443 | int size; | 1444 | int size; |
1444 | int pro = 0; | 1445 | int pro = 0; |
1445 | //qDebug("MainWindow::keyPressEvent "); | 1446 | //qDebug("MainWindow::keyPressEvent "); |
1446 | switch ( e->key() ) { | 1447 | switch ( e->key() ) { |
1447 | case Qt::Key_Right: | 1448 | case Qt::Key_Right: |
1448 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1449 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1449 | mView->goNextMonth(); | 1450 | mView->goNextMonth(); |
1450 | else | 1451 | else |
1451 | mView->goNext(); | 1452 | mView->goNext(); |
1452 | showSelectedDates = true; | 1453 | showSelectedDates = true; |
1453 | break; | 1454 | break; |
1454 | case Qt::Key_Left: | 1455 | case Qt::Key_Left: |
1455 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1456 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1456 | mView->goPreviousMonth(); | 1457 | mView->goPreviousMonth(); |
1457 | else | 1458 | else |
1458 | mView->goPrevious(); | 1459 | mView->goPrevious(); |
1459 | showSelectedDates = true; | 1460 | showSelectedDates = true; |
1460 | break; | 1461 | break; |
1461 | case Qt::Key_Down: | 1462 | case Qt::Key_Down: |
1462 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1463 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1463 | break; | 1464 | break; |
1464 | case Qt::Key_Up: | 1465 | case Qt::Key_Up: |
1465 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1466 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1466 | break; | 1467 | break; |
1467 | case Qt::Key_I: | 1468 | case Qt::Key_I: |
1468 | mView->showIncidence(); | 1469 | mView->showIncidence(); |
1469 | break; | 1470 | break; |
1470 | case Qt::Key_Delete: | 1471 | case Qt::Key_Delete: |
1471 | case Qt::Key_Backspace: | 1472 | case Qt::Key_Backspace: |
1472 | mView->deleteIncidence(); | 1473 | mView->deleteIncidence(); |
1473 | break; | 1474 | break; |
1474 | case Qt::Key_D: | 1475 | case Qt::Key_D: |
1475 | mView->viewManager()->showDayView(); | 1476 | mView->viewManager()->showDayView(); |
1476 | showSelectedDates = true; | 1477 | showSelectedDates = true; |
1477 | break; | 1478 | break; |
1478 | case Qt::Key_O: | 1479 | case Qt::Key_O: |
1479 | mView->toggleFilerEnabled( ); | 1480 | mView->toggleFilerEnabled( ); |
1480 | break; | 1481 | break; |
1481 | case Qt::Key_0: | 1482 | case Qt::Key_0: |
1482 | case Qt::Key_1: | 1483 | case Qt::Key_1: |
1483 | case Qt::Key_2: | 1484 | case Qt::Key_2: |
1484 | case Qt::Key_3: | 1485 | case Qt::Key_3: |
1485 | case Qt::Key_4: | 1486 | case Qt::Key_4: |
1486 | case Qt::Key_5: | 1487 | case Qt::Key_5: |
1487 | case Qt::Key_6: | 1488 | case Qt::Key_6: |
1488 | case Qt::Key_7: | 1489 | case Qt::Key_7: |
1489 | case Qt::Key_8: | 1490 | case Qt::Key_8: |
1490 | case Qt::Key_9: | 1491 | case Qt::Key_9: |
1491 | pro = e->key()-48; | 1492 | pro = e->key()-48; |
1492 | if ( pro == 0 ) | 1493 | if ( pro == 0 ) |
1493 | pro = 10; | 1494 | pro = 10; |
1494 | if ( e->state() == Qt::ControlButton) | 1495 | if ( e->state() == Qt::ControlButton) |
1495 | pro += 10; | 1496 | pro += 10; |
1496 | break; | 1497 | break; |
1497 | case Qt::Key_M: | 1498 | case Qt::Key_M: |
1498 | mView->viewManager()->showMonthView(); | 1499 | mView->viewManager()->showMonthView(); |
1499 | showSelectedDates = true; | 1500 | showSelectedDates = true; |
1500 | break; | 1501 | break; |
1501 | case Qt::Key_Insert: | 1502 | case Qt::Key_Insert: |
1502 | mView->newEvent(); | 1503 | mView->newEvent(); |
1503 | break; | 1504 | break; |
1504 | case Qt::Key_S : | 1505 | case Qt::Key_S : |
1505 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1506 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1506 | mView->newSubTodo(); | 1507 | mView->newSubTodo(); |
1507 | else | 1508 | else |
1508 | mView->dialogManager()->showSearchDialog(); | 1509 | mView->dialogManager()->showSearchDialog(); |
1509 | break; | 1510 | break; |
1510 | case Qt::Key_Y : | 1511 | case Qt::Key_Y : |
1511 | case Qt::Key_Z : | 1512 | case Qt::Key_Z : |
1512 | mView->viewManager()->showWorkWeekView(); | 1513 | mView->viewManager()->showWorkWeekView(); |
1513 | showSelectedDates = true; | 1514 | showSelectedDates = true; |
1514 | break; | 1515 | break; |
1515 | case Qt::Key_U : | 1516 | case Qt::Key_U : |
1516 | mView->viewManager()->showWeekView(); | 1517 | mView->viewManager()->showWeekView(); |
1517 | showSelectedDates = true; | 1518 | showSelectedDates = true; |
1518 | break; | 1519 | break; |
1519 | case Qt::Key_H : | 1520 | case Qt::Key_H : |
1520 | keyBindings(); | 1521 | keyBindings(); |
1521 | break; | 1522 | break; |
1522 | case Qt::Key_W: | 1523 | case Qt::Key_W: |
1523 | mView->viewManager()->showWhatsNextView(); | 1524 | mView->viewManager()->showWhatsNextView(); |
1524 | break; | 1525 | break; |
1525 | case Qt::Key_L: | 1526 | case Qt::Key_L: |
1526 | mView->viewManager()->showListView(); | 1527 | mView->viewManager()->showListView(); |
1527 | break; | 1528 | break; |
1528 | case Qt::Key_N: | 1529 | case Qt::Key_N: |
1529 | mView->viewManager()->showNextXView(); | 1530 | mView->viewManager()->showNextXView(); |
1530 | showSelectedDates = true; | 1531 | showSelectedDates = true; |
1531 | break; | 1532 | break; |
1532 | case Qt::Key_V: | 1533 | case Qt::Key_V: |
1533 | mView->viewManager()->showTodoView(); | 1534 | mView->viewManager()->showTodoView(); |
1534 | break; | 1535 | break; |
1535 | case Qt::Key_C: | 1536 | case Qt::Key_C: |
1536 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1537 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1537 | break; | 1538 | break; |
1538 | case Qt::Key_P: | 1539 | case Qt::Key_P: |
1539 | mView->showDatePicker( ); | 1540 | mView->showDatePicker( ); |
1540 | break; | 1541 | break; |
1541 | case Qt::Key_F: | 1542 | case Qt::Key_F: |
1542 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1543 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1543 | mView->editFilters(); | 1544 | mView->editFilters(); |
1544 | else | 1545 | else |
1545 | mView->toggleFilter(); | 1546 | mView->toggleFilter(); |
1546 | break; | 1547 | break; |
1547 | case Qt::Key_X: | 1548 | case Qt::Key_X: |
1548 | mView->toggleDateNavigatorWidget(); | 1549 | mView->toggleDateNavigatorWidget(); |
1549 | break; | 1550 | break; |
1550 | case Qt::Key_Space: | 1551 | case Qt::Key_Space: |
1551 | mView->toggleExpand(); | 1552 | mView->toggleExpand(); |
1552 | break; | 1553 | break; |
1553 | case Qt::Key_A: | 1554 | case Qt::Key_A: |
1554 | mView->toggleAllDaySize(); | 1555 | mView->toggleAllDaySize(); |
1555 | break; | 1556 | break; |
1556 | case Qt::Key_T: | 1557 | case Qt::Key_T: |
1557 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1558 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1558 | mView->newTodo(); | 1559 | mView->newTodo(); |
1559 | else { | 1560 | else { |
1560 | mView->goToday(); | 1561 | mView->goToday(); |
1561 | showSelectedDates = true; | 1562 | showSelectedDates = true; |
1562 | } | 1563 | } |
1563 | break; | 1564 | break; |
1564 | case Qt::Key_J: | 1565 | case Qt::Key_J: |
1565 | mView->viewManager()->showJournalView(); | 1566 | mView->viewManager()->showJournalView(); |
1566 | break; | 1567 | break; |
1567 | case Qt::Key_B: | 1568 | case Qt::Key_B: |
1568 | mView->editIncidenceDescription();; | 1569 | mView->editIncidenceDescription();; |
1569 | break; | 1570 | break; |
1570 | // case Qt::Key_Return: | 1571 | // case Qt::Key_Return: |
1571 | case Qt::Key_E: | 1572 | case Qt::Key_E: |
1572 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1573 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1573 | mView->newEvent(); | 1574 | mView->newEvent(); |
1574 | else | 1575 | else |
1575 | mView->editIncidence(); | 1576 | mView->editIncidence(); |
1576 | break; | 1577 | break; |
1577 | case Qt::Key_Plus: | 1578 | case Qt::Key_Plus: |
1578 | size = p->mHourSize +2; | 1579 | size = p->mHourSize +2; |
1579 | if ( size <= 18 ) | 1580 | if ( size <= 18 ) |
1580 | configureAgenda( size ); | 1581 | configureAgenda( size ); |
1581 | break; | 1582 | break; |
1582 | case Qt::Key_Minus: | 1583 | case Qt::Key_Minus: |
1583 | size = p->mHourSize - 2; | 1584 | size = p->mHourSize - 2; |
1584 | if ( size >= 4 ) | 1585 | if ( size >= 4 ) |
1585 | configureAgenda( size ); | 1586 | configureAgenda( size ); |
1586 | break; | 1587 | break; |
1587 | 1588 | ||
1588 | 1589 | ||
1589 | default: | 1590 | default: |
1590 | e->ignore(); | 1591 | e->ignore(); |
1591 | } | 1592 | } |
1592 | if ( pro > 0 ) { | 1593 | if ( pro > 0 ) { |
1593 | mView->selectFilter( pro-1 ); | 1594 | mView->selectFilter( pro-1 ); |
1594 | } | 1595 | } |
1595 | if ( showSelectedDates ) { | 1596 | if ( showSelectedDates ) { |
1596 | ;// setCaptionToDates(); | 1597 | ;// setCaptionToDates(); |
1597 | } | 1598 | } |
1598 | 1599 | ||
1599 | } | 1600 | } |
1600 | 1601 | ||
1601 | void MainWindow::fillFilterMenu() | 1602 | void MainWindow::fillFilterMenu() |
1602 | { | 1603 | { |
1603 | selectFilterMenu->clear(); | 1604 | selectFilterMenu->clear(); |
1604 | bool disable = false; | 1605 | bool disable = false; |
1605 | if ( mView->filterView()->filtersEnabled() ) { | 1606 | if ( mView->filterView()->filtersEnabled() ) { |
1606 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | 1607 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); |