-rw-r--r-- | korganizer/calendarview.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ab59d00..96ced08 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1480,872 +1480,872 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd | |||
1480 | { | 1480 | { |
1481 | if ( ! bar.isVisible() ) | 1481 | if ( ! bar.isVisible() ) |
1482 | return; | 1482 | return; |
1483 | bar.setProgress( i ); | 1483 | bar.setProgress( i ); |
1484 | qApp->processEvents(); | 1484 | qApp->processEvents(); |
1485 | 1485 | ||
1486 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1486 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1487 | if (!ok) { | 1487 | if (!ok) { |
1488 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1488 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1491 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1492 | if (!ok) { | 1492 | if (!ok) { |
1493 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1493 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1494 | } | 1494 | } |
1495 | realName = realNameList[i]; | 1495 | realName = realNameList[i]; |
1496 | email = emailList[i]; | 1496 | email = emailList[i]; |
1497 | assembledName = assembledNameList[i]; | 1497 | assembledName = assembledNameList[i]; |
1498 | uid = uidList[i]; | 1498 | uid = uidList[i]; |
1499 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1499 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1500 | 1500 | ||
1501 | if ( birthday.isValid() ){ | 1501 | if ( birthday.isValid() ){ |
1502 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1502 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1503 | KCal::Attendee::ReqParticipant,uid) ; | 1503 | KCal::Attendee::ReqParticipant,uid) ; |
1504 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1504 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1505 | ++addCount; | 1505 | ++addCount; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | if ( anniversary.isValid() ){ | 1508 | if ( anniversary.isValid() ){ |
1509 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1509 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1510 | KCal::Attendee::ReqParticipant,uid) ; | 1510 | KCal::Attendee::ReqParticipant,uid) ; |
1511 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1511 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1512 | ++addCount; | 1512 | ++addCount; |
1513 | } | 1513 | } |
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | updateView(); | 1516 | updateView(); |
1517 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1517 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1518 | 1518 | ||
1519 | } | 1519 | } |
1520 | 1520 | ||
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | 1523 | ||
1524 | 1524 | ||
1525 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1525 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1526 | { | 1526 | { |
1527 | //qDebug("addAnni "); | 1527 | //qDebug("addAnni "); |
1528 | Event * ev = new Event(); | 1528 | Event * ev = new Event(); |
1529 | ev->setOrganizer(KOPrefs::instance()->email()); | 1529 | ev->setOrganizer(KOPrefs::instance()->email()); |
1530 | if ( a ) { | 1530 | if ( a ) { |
1531 | ev->addAttendee( a ); | 1531 | ev->addAttendee( a ); |
1532 | } | 1532 | } |
1533 | QString kind; | 1533 | QString kind; |
1534 | if ( birthday ) { | 1534 | if ( birthday ) { |
1535 | kind = i18n( "Birthday" ); | 1535 | kind = i18n( "Birthday" ); |
1536 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1536 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1537 | } | 1537 | } |
1538 | else { | 1538 | else { |
1539 | kind = i18n( "Anniversary" ); | 1539 | kind = i18n( "Anniversary" ); |
1540 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1540 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1541 | } | 1541 | } |
1542 | ev->setCategories( kind ); | 1542 | ev->setCategories( kind ); |
1543 | ev->setDtStart( QDateTime(date) ); | 1543 | ev->setDtStart( QDateTime(date) ); |
1544 | ev->setDtEnd( QDateTime(date) ); | 1544 | ev->setDtEnd( QDateTime(date) ); |
1545 | ev->setFloats( true ); | 1545 | ev->setFloats( true ); |
1546 | Recurrence * rec = ev->recurrence(); | 1546 | Recurrence * rec = ev->recurrence(); |
1547 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1547 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1548 | rec->addYearlyNum( date.month() ); | 1548 | rec->addYearlyNum( date.month() ); |
1549 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1549 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1550 | delete ev; | 1550 | delete ev; |
1551 | return false; | 1551 | return false; |
1552 | } | 1552 | } |
1553 | return true; | 1553 | return true; |
1554 | 1554 | ||
1555 | } | 1555 | } |
1556 | bool CalendarView::importQtopia( const QString &categories, | 1556 | bool CalendarView::importQtopia( const QString &categories, |
1557 | const QString &datebook, | 1557 | const QString &datebook, |
1558 | const QString &todolist ) | 1558 | const QString &todolist ) |
1559 | { | 1559 | { |
1560 | 1560 | ||
1561 | QtopiaFormat qtopiaFormat; | 1561 | QtopiaFormat qtopiaFormat; |
1562 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1562 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1563 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1563 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1564 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1564 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1565 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1565 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1566 | 1566 | ||
1567 | updateView(); | 1567 | updateView(); |
1568 | return true; | 1568 | return true; |
1569 | 1569 | ||
1570 | #if 0 | 1570 | #if 0 |
1571 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1571 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1572 | mCurrentSyncDevice = "qtopia-XML"; | 1572 | mCurrentSyncDevice = "qtopia-XML"; |
1573 | if ( mSyncManager->mAskForPreferences ) | 1573 | if ( mSyncManager->mAskForPreferences ) |
1574 | edit_sync_options(); | 1574 | edit_sync_options(); |
1575 | qApp->processEvents(); | 1575 | qApp->processEvents(); |
1576 | CalendarLocal* calendar = new CalendarLocal(); | 1576 | CalendarLocal* calendar = new CalendarLocal(); |
1577 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1577 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1578 | bool syncOK = false; | 1578 | bool syncOK = false; |
1579 | QtopiaFormat qtopiaFormat; | 1579 | QtopiaFormat qtopiaFormat; |
1580 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1580 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1581 | bool loadOk = true; | 1581 | bool loadOk = true; |
1582 | if ( !categories.isEmpty() ) | 1582 | if ( !categories.isEmpty() ) |
1583 | loadOk = qtopiaFormat.load( calendar, categories ); | 1583 | loadOk = qtopiaFormat.load( calendar, categories ); |
1584 | if ( loadOk && !datebook.isEmpty() ) | 1584 | if ( loadOk && !datebook.isEmpty() ) |
1585 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1585 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1586 | if ( loadOk && !todolist.isEmpty() ) | 1586 | if ( loadOk && !todolist.isEmpty() ) |
1587 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1587 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1588 | 1588 | ||
1589 | if ( loadOk ) { | 1589 | if ( loadOk ) { |
1590 | getEventViewerDialog()->setSyncMode( true ); | 1590 | getEventViewerDialog()->setSyncMode( true ); |
1591 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1591 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1592 | getEventViewerDialog()->setSyncMode( false ); | 1592 | getEventViewerDialog()->setSyncMode( false ); |
1593 | qApp->processEvents(); | 1593 | qApp->processEvents(); |
1594 | if ( syncOK ) { | 1594 | if ( syncOK ) { |
1595 | if ( mSyncManager->mWriteBackFile ) | 1595 | if ( mSyncManager->mWriteBackFile ) |
1596 | { | 1596 | { |
1597 | // write back XML file | 1597 | // write back XML file |
1598 | 1598 | ||
1599 | } | 1599 | } |
1600 | setModified( true ); | 1600 | setModified( true ); |
1601 | } | 1601 | } |
1602 | } else { | 1602 | } else { |
1603 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1603 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1604 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1604 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1605 | question, i18n("Ok")) ; | 1605 | question, i18n("Ok")) ; |
1606 | } | 1606 | } |
1607 | delete calendar; | 1607 | delete calendar; |
1608 | updateView(); | 1608 | updateView(); |
1609 | return syncOK; | 1609 | return syncOK; |
1610 | 1610 | ||
1611 | 1611 | ||
1612 | #endif | 1612 | #endif |
1613 | 1613 | ||
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | void CalendarView::setSyncEventsReadOnly() | 1616 | void CalendarView::setSyncEventsReadOnly() |
1617 | { | 1617 | { |
1618 | Event * ev; | 1618 | Event * ev; |
1619 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1619 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1620 | ev = eL.first(); | 1620 | ev = eL.first(); |
1621 | while ( ev ) { | 1621 | while ( ev ) { |
1622 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1622 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1623 | ev->setReadOnly( true ); | 1623 | ev->setReadOnly( true ); |
1624 | ev = eL.next(); | 1624 | ev = eL.next(); |
1625 | } | 1625 | } |
1626 | } | 1626 | } |
1627 | bool CalendarView::openCalendar(QString filename, bool merge) | 1627 | bool CalendarView::openCalendar(QString filename, bool merge) |
1628 | { | 1628 | { |
1629 | 1629 | ||
1630 | if (filename.isEmpty()) { | 1630 | if (filename.isEmpty()) { |
1631 | return false; | 1631 | return false; |
1632 | } | 1632 | } |
1633 | 1633 | ||
1634 | if (!QFile::exists(filename)) { | 1634 | if (!QFile::exists(filename)) { |
1635 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1635 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1636 | return false; | 1636 | return false; |
1637 | } | 1637 | } |
1638 | 1638 | ||
1639 | globalFlagBlockAgenda = 1; | 1639 | globalFlagBlockAgenda = 1; |
1640 | if (!merge) mCalendar->close(); | 1640 | if (!merge) mCalendar->close(); |
1641 | 1641 | ||
1642 | mStorage->setFileName( filename ); | 1642 | mStorage->setFileName( filename ); |
1643 | 1643 | ||
1644 | if ( mStorage->load() ) { | 1644 | if ( mStorage->load() ) { |
1645 | if ( merge ) ;//setModified( true ); | 1645 | if ( merge ) ;//setModified( true ); |
1646 | else { | 1646 | else { |
1647 | //setModified( true ); | 1647 | //setModified( true ); |
1648 | mViewManager->setDocumentId( filename ); | 1648 | mViewManager->setDocumentId( filename ); |
1649 | mDialogManager->setDocumentId( filename ); | 1649 | mDialogManager->setDocumentId( filename ); |
1650 | mTodoList->setDocumentId( filename ); | 1650 | mTodoList->setDocumentId( filename ); |
1651 | } | 1651 | } |
1652 | globalFlagBlockAgenda = 2; | 1652 | globalFlagBlockAgenda = 2; |
1653 | // if ( getLastSyncEvent() ) | 1653 | // if ( getLastSyncEvent() ) |
1654 | // getLastSyncEvent()->setReadOnly( true ); | 1654 | // getLastSyncEvent()->setReadOnly( true ); |
1655 | mCalendar->reInitAlarmSettings(); | 1655 | mCalendar->reInitAlarmSettings(); |
1656 | setSyncEventsReadOnly(); | 1656 | setSyncEventsReadOnly(); |
1657 | updateUnmanagedViews(); | 1657 | updateUnmanagedViews(); |
1658 | updateView(); | 1658 | updateView(); |
1659 | if ( filename != MainWindow::defaultFileName() ) { | 1659 | if ( filename != MainWindow::defaultFileName() ) { |
1660 | saveCalendar( MainWindow::defaultFileName() ); | 1660 | saveCalendar( MainWindow::defaultFileName() ); |
1661 | } else { | 1661 | } else { |
1662 | QFileInfo finf ( MainWindow::defaultFileName()); | 1662 | QFileInfo finf ( MainWindow::defaultFileName()); |
1663 | if ( finf.exists() ) { | 1663 | if ( finf.exists() ) { |
1664 | setLoadedFileVersion( finf.lastModified () ); | 1664 | setLoadedFileVersion( finf.lastModified () ); |
1665 | } | 1665 | } |
1666 | } | 1666 | } |
1667 | return true; | 1667 | return true; |
1668 | } else { | 1668 | } else { |
1669 | // while failing to load, the calendar object could | 1669 | // while failing to load, the calendar object could |
1670 | // have become partially populated. Clear it out. | 1670 | // have become partially populated. Clear it out. |
1671 | if ( !merge ) { | 1671 | if ( !merge ) { |
1672 | mCalendar->close(); | 1672 | mCalendar->close(); |
1673 | mViewManager->setDocumentId( filename ); | 1673 | mViewManager->setDocumentId( filename ); |
1674 | mDialogManager->setDocumentId( filename ); | 1674 | mDialogManager->setDocumentId( filename ); |
1675 | mTodoList->setDocumentId( filename ); | 1675 | mTodoList->setDocumentId( filename ); |
1676 | } | 1676 | } |
1677 | 1677 | ||
1678 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1678 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1679 | 1679 | ||
1680 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1680 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1681 | globalFlagBlockAgenda = 2; | 1681 | globalFlagBlockAgenda = 2; |
1682 | mCalendar->reInitAlarmSettings(); | 1682 | mCalendar->reInitAlarmSettings(); |
1683 | setSyncEventsReadOnly(); | 1683 | setSyncEventsReadOnly(); |
1684 | updateUnmanagedViews(); | 1684 | updateUnmanagedViews(); |
1685 | updateView(); | 1685 | updateView(); |
1686 | } | 1686 | } |
1687 | return false; | 1687 | return false; |
1688 | } | 1688 | } |
1689 | void CalendarView::showOpenError() | 1689 | void CalendarView::showOpenError() |
1690 | { | 1690 | { |
1691 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1691 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1692 | } | 1692 | } |
1693 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1693 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1694 | { | 1694 | { |
1695 | loadedFileVersion = dt; | 1695 | loadedFileVersion = dt; |
1696 | } | 1696 | } |
1697 | bool CalendarView::checkFileChanged(QString fn) | 1697 | bool CalendarView::checkFileChanged(QString fn) |
1698 | { | 1698 | { |
1699 | QFileInfo finf ( fn ); | 1699 | QFileInfo finf ( fn ); |
1700 | if ( !finf.exists() ) | 1700 | if ( !finf.exists() ) |
1701 | return true; | 1701 | return true; |
1702 | QDateTime dt = finf.lastModified (); | 1702 | QDateTime dt = finf.lastModified (); |
1703 | if ( dt <= loadedFileVersion ) | 1703 | if ( dt <= loadedFileVersion ) |
1704 | return false; | 1704 | return false; |
1705 | return true; | 1705 | return true; |
1706 | 1706 | ||
1707 | } | 1707 | } |
1708 | void CalendarView::watchSavedFile() | 1708 | void CalendarView::watchSavedFile() |
1709 | { | 1709 | { |
1710 | QFileInfo finf ( MainWindow::defaultFileName()); | 1710 | QFileInfo finf ( MainWindow::defaultFileName()); |
1711 | if ( !finf.exists() ) | 1711 | if ( !finf.exists() ) |
1712 | return; | 1712 | return; |
1713 | QDateTime dt = finf.lastModified (); | 1713 | QDateTime dt = finf.lastModified (); |
1714 | if ( dt < loadedFileVersion ) { | 1714 | if ( dt < loadedFileVersion ) { |
1715 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1715 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1716 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1716 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1717 | return; | 1717 | return; |
1718 | } | 1718 | } |
1719 | loadedFileVersion = dt; | 1719 | loadedFileVersion = dt; |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | bool CalendarView::checkFileVersion(QString fn) | 1722 | bool CalendarView::checkFileVersion(QString fn) |
1723 | { | 1723 | { |
1724 | QFileInfo finf ( fn ); | 1724 | QFileInfo finf ( fn ); |
1725 | if ( !finf.exists() ) | 1725 | if ( !finf.exists() ) |
1726 | return true; | 1726 | return true; |
1727 | QDateTime dt = finf.lastModified (); | 1727 | QDateTime dt = finf.lastModified (); |
1728 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1728 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1729 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1729 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1730 | if ( dt <= loadedFileVersion ) | 1730 | if ( dt <= loadedFileVersion ) |
1731 | return true; | 1731 | return true; |
1732 | 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)) , | 1732 | 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)) , |
1733 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1733 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1734 | i18n("Sync+save")); | 1734 | i18n("Sync+save")); |
1735 | 1735 | ||
1736 | if ( km == KMessageBox::Cancel ) | 1736 | if ( km == KMessageBox::Cancel ) |
1737 | return false; | 1737 | return false; |
1738 | if ( km == KMessageBox::Yes ) | 1738 | if ( km == KMessageBox::Yes ) |
1739 | return true; | 1739 | return true; |
1740 | 1740 | ||
1741 | setSyncDevice("deleteaftersync" ); | 1741 | setSyncDevice("deleteaftersync" ); |
1742 | mSyncManager->mAskForPreferences = true; | 1742 | mSyncManager->mAskForPreferences = true; |
1743 | mSyncManager->mSyncAlgoPrefs = 3; | 1743 | mSyncManager->mSyncAlgoPrefs = 3; |
1744 | mSyncManager->mWriteBackFile = false; | 1744 | mSyncManager->mWriteBackFile = false; |
1745 | mSyncManager->mWriteBackExistingOnly = false; | 1745 | mSyncManager->mWriteBackExistingOnly = false; |
1746 | mSyncManager->mShowSyncSummary = false; | 1746 | mSyncManager->mShowSyncSummary = false; |
1747 | syncCalendar( fn, 3 ); | 1747 | syncCalendar( fn, 3 ); |
1748 | Event * e = getLastSyncEvent(); | 1748 | Event * e = getLastSyncEvent(); |
1749 | mCalendar->deleteEvent ( e ); | 1749 | mCalendar->deleteEvent ( e ); |
1750 | updateView(); | 1750 | updateView(); |
1751 | return true; | 1751 | return true; |
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | bool CalendarView::saveCalendar( QString filename ) | 1754 | bool CalendarView::saveCalendar( QString filename ) |
1755 | { | 1755 | { |
1756 | 1756 | ||
1757 | // Store back all unsaved data into calendar object | 1757 | // Store back all unsaved data into calendar object |
1758 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1758 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1759 | if ( mViewManager->currentView() ) | 1759 | if ( mViewManager->currentView() ) |
1760 | mViewManager->currentView()->flushView(); | 1760 | mViewManager->currentView()->flushView(); |
1761 | 1761 | ||
1762 | 1762 | ||
1763 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1763 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1764 | mStorage->setSaveFormat( new ICalFormat() ); | 1764 | mStorage->setSaveFormat( new ICalFormat() ); |
1765 | mStorage->setFileName( filename ); | 1765 | mStorage->setFileName( filename ); |
1766 | bool success; | 1766 | bool success; |
1767 | success = mStorage->save(); | 1767 | success = mStorage->save(); |
1768 | if ( !success ) { | 1768 | if ( !success ) { |
1769 | return false; | 1769 | return false; |
1770 | } | 1770 | } |
1771 | if ( filename == MainWindow::defaultFileName() ) { | 1771 | if ( filename == MainWindow::defaultFileName() ) { |
1772 | setLoadedFileVersion( lfv ); | 1772 | setLoadedFileVersion( lfv ); |
1773 | watchSavedFile(); | 1773 | watchSavedFile(); |
1774 | } | 1774 | } |
1775 | return true; | 1775 | return true; |
1776 | } | 1776 | } |
1777 | 1777 | ||
1778 | void CalendarView::closeCalendar() | 1778 | void CalendarView::closeCalendar() |
1779 | { | 1779 | { |
1780 | 1780 | ||
1781 | // child windows no longer valid | 1781 | // child windows no longer valid |
1782 | emit closingDown(); | 1782 | emit closingDown(); |
1783 | 1783 | ||
1784 | mCalendar->close(); | 1784 | mCalendar->close(); |
1785 | setModified(false); | 1785 | setModified(false); |
1786 | updateView(); | 1786 | updateView(); |
1787 | } | 1787 | } |
1788 | 1788 | ||
1789 | void CalendarView::archiveCalendar() | 1789 | void CalendarView::archiveCalendar() |
1790 | { | 1790 | { |
1791 | mDialogManager->showArchiveDialog(); | 1791 | mDialogManager->showArchiveDialog(); |
1792 | } | 1792 | } |
1793 | 1793 | ||
1794 | 1794 | ||
1795 | void CalendarView::readSettings() | 1795 | void CalendarView::readSettings() |
1796 | { | 1796 | { |
1797 | 1797 | ||
1798 | 1798 | ||
1799 | // mViewManager->showAgendaView(); | 1799 | // mViewManager->showAgendaView(); |
1800 | QString str; | 1800 | QString str; |
1801 | //qDebug("CalendarView::readSettings() "); | 1801 | //qDebug("CalendarView::readSettings() "); |
1802 | // read settings from the KConfig, supplying reasonable | 1802 | // read settings from the KConfig, supplying reasonable |
1803 | // defaults where none are to be found | 1803 | // defaults where none are to be found |
1804 | KConfig *config = KOGlobals::config(); | 1804 | KConfig *config = KOGlobals::config(); |
1805 | #ifndef KORG_NOSPLITTER | 1805 | #ifndef KORG_NOSPLITTER |
1806 | config->setGroup("KOrganizer Geometry"); | 1806 | config->setGroup("KOrganizer Geometry"); |
1807 | 1807 | ||
1808 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1808 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1809 | if (sizes.count() != 2) { | 1809 | if (sizes.count() != 2) { |
1810 | sizes << mDateNavigator->minimumSizeHint().width(); | 1810 | sizes << mDateNavigator->minimumSizeHint().width(); |
1811 | sizes << 300; | 1811 | sizes << 300; |
1812 | } | 1812 | } |
1813 | mPanner->setSizes(sizes); | 1813 | mPanner->setSizes(sizes); |
1814 | 1814 | ||
1815 | sizes = config->readIntListEntry("Separator2"); | 1815 | sizes = config->readIntListEntry("Separator2"); |
1816 | if ( ( mResourceView && sizes.count() == 4 ) || | 1816 | if ( ( mResourceView && sizes.count() == 4 ) || |
1817 | ( !mResourceView && sizes.count() == 3 ) ) { | 1817 | ( !mResourceView && sizes.count() == 3 ) ) { |
1818 | mLeftSplitter->setSizes(sizes); | 1818 | mLeftSplitter->setSizes(sizes); |
1819 | } | 1819 | } |
1820 | #endif | 1820 | #endif |
1821 | globalFlagBlockAgenda = 1; | 1821 | globalFlagBlockAgenda = 1; |
1822 | mViewManager->showAgendaView(); | 1822 | mViewManager->showAgendaView(); |
1823 | //mViewManager->readSettings( config ); | 1823 | //mViewManager->readSettings( config ); |
1824 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1824 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1825 | readFilterSettings(config); | 1825 | readFilterSettings(config); |
1826 | config->setGroup( "Views" ); | 1826 | config->setGroup( "Views" ); |
1827 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1827 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1828 | 1828 | ||
1829 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 1829 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
1830 | 1830 | ||
1831 | int resetval = 0; | 1831 | int resetval = 0; |
1832 | int maxVal = 0; | 1832 | int maxVal = 0; |
1833 | if (sizes.count() != 3) { | 1833 | if (sizes.count() != 3) { |
1834 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1834 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1835 | resetval = mDateNavigator->sizeHint().width()+2; | 1835 | resetval = mDateNavigator->sizeHint().width()+2; |
1836 | } else { | 1836 | } else { |
1837 | resetval = mDateNavigator->sizeHint().height()+2; | 1837 | resetval = mDateNavigator->sizeHint().height()+2; |
1838 | } | 1838 | } |
1839 | } | 1839 | } |
1840 | if ( !resetval ){// i.e. sizes.count() == 3 | 1840 | if ( !resetval ){// i.e. sizes.count() == 3 |
1841 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1841 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1842 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | 1842 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) |
1843 | resetval = mDateNavigator->sizeHint().width()+2; | 1843 | resetval = mDateNavigator->sizeHint().width()+2; |
1844 | } else { | 1844 | } else { |
1845 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | 1845 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) |
1846 | resetval = mDateNavigator->sizeHint().height()+2; | 1846 | resetval = mDateNavigator->sizeHint().height()+2; |
1847 | } | 1847 | } |
1848 | } | 1848 | } |
1849 | if ( resetval ) { | 1849 | if ( resetval ) { |
1850 | sizes.clear(); | 1850 | sizes.clear(); |
1851 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1851 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1852 | maxVal = QApplication::desktop()->width() -10; | 1852 | maxVal = QApplication::desktop()->width() -10; |
1853 | } else { | 1853 | } else { |
1854 | maxVal = QApplication::desktop()->height()-10; | 1854 | maxVal = QApplication::desktop()->height()-10; |
1855 | } | 1855 | } |
1856 | sizes << resetval; | 1856 | sizes << resetval; |
1857 | if ( maxVal < resetval + resetval) | 1857 | if ( maxVal < resetval + resetval) |
1858 | resetval = maxVal - resetval; | 1858 | resetval = maxVal - resetval; |
1859 | sizes << resetval; | 1859 | sizes << resetval; |
1860 | sizes << 100; | 1860 | sizes << 100; |
1861 | } | 1861 | } |
1862 | mLeftFrame->setSizes(sizes); | 1862 | mLeftFrame->setSizes(sizes); |
1863 | sizes = config->readIntListEntry("Main Splitter Frame"); | 1863 | sizes = config->readIntListEntry("Main Splitter Frame"); |
1864 | if (sizes.count() != 3) { | 1864 | if (sizes.count() != 2) { |
1865 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1865 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1866 | resetval = mDateNavigator->sizeHint().width()+2; | 1866 | resetval = mDateNavigator->sizeHint().width()+2; |
1867 | } else { | 1867 | } else { |
1868 | resetval = mDateNavigator->sizeHint().height()+2; | 1868 | resetval = mDateNavigator->sizeHint().height()+2; |
1869 | } | 1869 | } |
1870 | } | 1870 | } |
1871 | if ( !resetval ){// i.e. sizes.count() == 3 | 1871 | if ( !resetval ){// i.e. sizes.count() == 3 |
1872 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1872 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1873 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) | 1873 | if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) |
1874 | resetval = mDateNavigator->sizeHint().width()+2; | 1874 | resetval = mDateNavigator->sizeHint().width()+2; |
1875 | } else { | 1875 | } else { |
1876 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) | 1876 | if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) |
1877 | resetval = mDateNavigator->sizeHint().height()+2; | 1877 | resetval = mDateNavigator->sizeHint().height()+2; |
1878 | } | 1878 | } |
1879 | } | 1879 | } |
1880 | if ( resetval ) { | 1880 | if ( resetval ) { |
1881 | sizes.clear(); | 1881 | sizes.clear(); |
1882 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 1882 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
1883 | maxVal = QApplication::desktop()->width() -10; | 1883 | maxVal = QApplication::desktop()->width() -10; |
1884 | } else { | 1884 | } else { |
1885 | maxVal = QApplication::desktop()->height()-10; | 1885 | maxVal = QApplication::desktop()->height()-10; |
1886 | } | 1886 | } |
1887 | sizes << resetval; | 1887 | sizes << resetval; |
1888 | if ( maxVal < resetval + resetval) | 1888 | if ( maxVal < resetval + resetval) |
1889 | resetval = maxVal - resetval; | 1889 | resetval = maxVal - resetval; |
1890 | sizes << resetval; | 1890 | sizes << resetval; |
1891 | } | 1891 | } |
1892 | mMainFrame->setSizes(sizes); | 1892 | mMainFrame->setSizes(sizes); |
1893 | 1893 | ||
1894 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1894 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1895 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1895 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1896 | else mNavigator->selectDates( dateCount ); | 1896 | else mNavigator->selectDates( dateCount ); |
1897 | // mViewManager->readSettings( config ); | 1897 | // mViewManager->readSettings( config ); |
1898 | updateConfig(); | 1898 | updateConfig(); |
1899 | globalFlagBlockAgenda = 2; | 1899 | globalFlagBlockAgenda = 2; |
1900 | mViewManager->readSettings( config ); | 1900 | mViewManager->readSettings( config ); |
1901 | #ifdef DESKTOP_VERSION | 1901 | #ifdef DESKTOP_VERSION |
1902 | config->setGroup("WidgetLayout"); | 1902 | config->setGroup("WidgetLayout"); |
1903 | QStringList list; | 1903 | QStringList list; |
1904 | list = config->readListEntry("MainLayout"); | 1904 | list = config->readListEntry("MainLayout"); |
1905 | int x,y,w,h; | 1905 | int x,y,w,h; |
1906 | if ( ! list.isEmpty() ) { | 1906 | if ( ! list.isEmpty() ) { |
1907 | x = list[0].toInt(); | 1907 | x = list[0].toInt(); |
1908 | y = list[1].toInt(); | 1908 | y = list[1].toInt(); |
1909 | w = list[2].toInt(); | 1909 | w = list[2].toInt(); |
1910 | h = list[3].toInt(); | 1910 | h = list[3].toInt(); |
1911 | topLevelWidget()->setGeometry(x,y,w,h); | 1911 | topLevelWidget()->setGeometry(x,y,w,h); |
1912 | 1912 | ||
1913 | } else { | 1913 | } else { |
1914 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1914 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1915 | } | 1915 | } |
1916 | list = config->readListEntry("EditEventLayout"); | 1916 | list = config->readListEntry("EditEventLayout"); |
1917 | if ( ! list.isEmpty() ) { | 1917 | if ( ! list.isEmpty() ) { |
1918 | x = list[0].toInt(); | 1918 | x = list[0].toInt(); |
1919 | y = list[1].toInt(); | 1919 | y = list[1].toInt(); |
1920 | w = list[2].toInt(); | 1920 | w = list[2].toInt(); |
1921 | h = list[3].toInt(); | 1921 | h = list[3].toInt(); |
1922 | mEventEditor->setGeometry(x,y,w,h); | 1922 | mEventEditor->setGeometry(x,y,w,h); |
1923 | 1923 | ||
1924 | } | 1924 | } |
1925 | list = config->readListEntry("EditTodoLayout"); | 1925 | list = config->readListEntry("EditTodoLayout"); |
1926 | if ( ! list.isEmpty() ) { | 1926 | if ( ! list.isEmpty() ) { |
1927 | x = list[0].toInt(); | 1927 | x = list[0].toInt(); |
1928 | y = list[1].toInt(); | 1928 | y = list[1].toInt(); |
1929 | w = list[2].toInt(); | 1929 | w = list[2].toInt(); |
1930 | h = list[3].toInt(); | 1930 | h = list[3].toInt(); |
1931 | mTodoEditor->setGeometry(x,y,w,h); | 1931 | mTodoEditor->setGeometry(x,y,w,h); |
1932 | 1932 | ||
1933 | } | 1933 | } |
1934 | list = config->readListEntry("ViewerLayout"); | 1934 | list = config->readListEntry("ViewerLayout"); |
1935 | if ( ! list.isEmpty() ) { | 1935 | if ( ! list.isEmpty() ) { |
1936 | x = list[0].toInt(); | 1936 | x = list[0].toInt(); |
1937 | y = list[1].toInt(); | 1937 | y = list[1].toInt(); |
1938 | w = list[2].toInt(); | 1938 | w = list[2].toInt(); |
1939 | h = list[3].toInt(); | 1939 | h = list[3].toInt(); |
1940 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1940 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1941 | } | 1941 | } |
1942 | #endif | 1942 | #endif |
1943 | 1943 | ||
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | 1946 | ||
1947 | void CalendarView::writeSettings() | 1947 | void CalendarView::writeSettings() |
1948 | { | 1948 | { |
1949 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1949 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1950 | 1950 | ||
1951 | KConfig *config = KOGlobals::config(); | 1951 | KConfig *config = KOGlobals::config(); |
1952 | 1952 | ||
1953 | mViewManager->writeSettings( config ); | 1953 | mViewManager->writeSettings( config ); |
1954 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1954 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1955 | mDialogManager->writeSettings( config ); | 1955 | mDialogManager->writeSettings( config ); |
1956 | //KOPrefs::instance()->usrWriteConfig(); | 1956 | //KOPrefs::instance()->usrWriteConfig(); |
1957 | KOPrefs::instance()->writeConfig(); | 1957 | KOPrefs::instance()->writeConfig(); |
1958 | 1958 | ||
1959 | writeFilterSettings(config); | 1959 | writeFilterSettings(config); |
1960 | 1960 | ||
1961 | config->setGroup( "Views" ); | 1961 | config->setGroup( "Views" ); |
1962 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1962 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1963 | 1963 | ||
1964 | QValueList<int> listINT = mLeftFrame->sizes(); | 1964 | QValueList<int> listINT = mLeftFrame->sizes(); |
1965 | config->writeEntry("Left Splitter Frame",listINT); | 1965 | config->writeEntry("Left Splitter Frame",listINT); |
1966 | listINT = mMainFrame->sizes(); | 1966 | QValueList<int> listINT2 = mMainFrame->sizes(); |
1967 | config->writeEntry("Main Splitter Frame",listINT); | 1967 | config->writeEntry("Main Splitter Frame",listINT2); |
1968 | #ifdef DESKTOP_VERSION | 1968 | #ifdef DESKTOP_VERSION |
1969 | config->setGroup("WidgetLayout"); | 1969 | config->setGroup("WidgetLayout"); |
1970 | QStringList list ;//= config->readListEntry("MainLayout"); | 1970 | QStringList list ;//= config->readListEntry("MainLayout"); |
1971 | int x,y,w,h; | 1971 | int x,y,w,h; |
1972 | QWidget* wid; | 1972 | QWidget* wid; |
1973 | wid = topLevelWidget(); | 1973 | wid = topLevelWidget(); |
1974 | x = wid->geometry().x(); | 1974 | x = wid->geometry().x(); |
1975 | y = wid->geometry().y(); | 1975 | y = wid->geometry().y(); |
1976 | w = wid->width(); | 1976 | w = wid->width(); |
1977 | h = wid->height(); | 1977 | h = wid->height(); |
1978 | list.clear(); | 1978 | list.clear(); |
1979 | list << QString::number( x ); | 1979 | list << QString::number( x ); |
1980 | list << QString::number( y ); | 1980 | list << QString::number( y ); |
1981 | list << QString::number( w ); | 1981 | list << QString::number( w ); |
1982 | list << QString::number( h ); | 1982 | list << QString::number( h ); |
1983 | config->writeEntry("MainLayout",list ); | 1983 | config->writeEntry("MainLayout",list ); |
1984 | 1984 | ||
1985 | wid = mEventEditor; | 1985 | wid = mEventEditor; |
1986 | x = wid->geometry().x(); | 1986 | x = wid->geometry().x(); |
1987 | y = wid->geometry().y(); | 1987 | y = wid->geometry().y(); |
1988 | w = wid->width(); | 1988 | w = wid->width(); |
1989 | h = wid->height(); | 1989 | h = wid->height(); |
1990 | list.clear(); | 1990 | list.clear(); |
1991 | list << QString::number( x ); | 1991 | list << QString::number( x ); |
1992 | list << QString::number( y ); | 1992 | list << QString::number( y ); |
1993 | list << QString::number( w ); | 1993 | list << QString::number( w ); |
1994 | list << QString::number( h ); | 1994 | list << QString::number( h ); |
1995 | config->writeEntry("EditEventLayout",list ); | 1995 | config->writeEntry("EditEventLayout",list ); |
1996 | 1996 | ||
1997 | wid = mTodoEditor; | 1997 | wid = mTodoEditor; |
1998 | x = wid->geometry().x(); | 1998 | x = wid->geometry().x(); |
1999 | y = wid->geometry().y(); | 1999 | y = wid->geometry().y(); |
2000 | w = wid->width(); | 2000 | w = wid->width(); |
2001 | h = wid->height(); | 2001 | h = wid->height(); |
2002 | list.clear(); | 2002 | list.clear(); |
2003 | list << QString::number( x ); | 2003 | list << QString::number( x ); |
2004 | list << QString::number( y ); | 2004 | list << QString::number( y ); |
2005 | list << QString::number( w ); | 2005 | list << QString::number( w ); |
2006 | list << QString::number( h ); | 2006 | list << QString::number( h ); |
2007 | config->writeEntry("EditTodoLayout",list ); | 2007 | config->writeEntry("EditTodoLayout",list ); |
2008 | wid = getEventViewerDialog(); | 2008 | wid = getEventViewerDialog(); |
2009 | x = wid->geometry().x(); | 2009 | x = wid->geometry().x(); |
2010 | y = wid->geometry().y(); | 2010 | y = wid->geometry().y(); |
2011 | w = wid->width(); | 2011 | w = wid->width(); |
2012 | h = wid->height(); | 2012 | h = wid->height(); |
2013 | list.clear(); | 2013 | list.clear(); |
2014 | list << QString::number( x ); | 2014 | list << QString::number( x ); |
2015 | list << QString::number( y ); | 2015 | list << QString::number( y ); |
2016 | list << QString::number( w ); | 2016 | list << QString::number( w ); |
2017 | list << QString::number( h ); | 2017 | list << QString::number( h ); |
2018 | config->writeEntry("ViewerLayout",list ); | 2018 | config->writeEntry("ViewerLayout",list ); |
2019 | wid = mDialogManager->getSearchDialog(); | 2019 | wid = mDialogManager->getSearchDialog(); |
2020 | if ( wid ) { | 2020 | if ( wid ) { |
2021 | x = wid->geometry().x(); | 2021 | x = wid->geometry().x(); |
2022 | y = wid->geometry().y(); | 2022 | y = wid->geometry().y(); |
2023 | w = wid->width(); | 2023 | w = wid->width(); |
2024 | h = wid->height(); | 2024 | h = wid->height(); |
2025 | list.clear(); | 2025 | list.clear(); |
2026 | list << QString::number( x ); | 2026 | list << QString::number( x ); |
2027 | list << QString::number( y ); | 2027 | list << QString::number( y ); |
2028 | list << QString::number( w ); | 2028 | list << QString::number( w ); |
2029 | list << QString::number( h ); | 2029 | list << QString::number( h ); |
2030 | config->writeEntry("SearchLayout",list ); | 2030 | config->writeEntry("SearchLayout",list ); |
2031 | } | 2031 | } |
2032 | #endif | 2032 | #endif |
2033 | 2033 | ||
2034 | 2034 | ||
2035 | config->sync(); | 2035 | config->sync(); |
2036 | } | 2036 | } |
2037 | 2037 | ||
2038 | void CalendarView::readFilterSettings(KConfig *config) | 2038 | void CalendarView::readFilterSettings(KConfig *config) |
2039 | { | 2039 | { |
2040 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2040 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2041 | 2041 | ||
2042 | mFilters.clear(); | 2042 | mFilters.clear(); |
2043 | 2043 | ||
2044 | config->setGroup("General"); | 2044 | config->setGroup("General"); |
2045 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2045 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2046 | 2046 | ||
2047 | QStringList::ConstIterator it = filterList.begin(); | 2047 | QStringList::ConstIterator it = filterList.begin(); |
2048 | QStringList::ConstIterator end = filterList.end(); | 2048 | QStringList::ConstIterator end = filterList.end(); |
2049 | while(it != end) { | 2049 | while(it != end) { |
2050 | // kdDebug() << " filter: " << (*it) << endl; | 2050 | // kdDebug() << " filter: " << (*it) << endl; |
2051 | 2051 | ||
2052 | CalFilter *filter; | 2052 | CalFilter *filter; |
2053 | filter = new CalFilter(*it); | 2053 | filter = new CalFilter(*it); |
2054 | config->setGroup("Filter_" + (*it)); | 2054 | config->setGroup("Filter_" + (*it)); |
2055 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2055 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2056 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2056 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2057 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2057 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2058 | mFilters.append(filter); | 2058 | mFilters.append(filter); |
2059 | 2059 | ||
2060 | ++it; | 2060 | ++it; |
2061 | } | 2061 | } |
2062 | 2062 | ||
2063 | if (mFilters.count() == 0) { | 2063 | if (mFilters.count() == 0) { |
2064 | CalFilter *filter = new CalFilter(i18n("Default")); | 2064 | CalFilter *filter = new CalFilter(i18n("Default")); |
2065 | mFilters.append(filter); | 2065 | mFilters.append(filter); |
2066 | } | 2066 | } |
2067 | mFilterView->updateFilters(); | 2067 | mFilterView->updateFilters(); |
2068 | config->setGroup("FilterView"); | 2068 | config->setGroup("FilterView"); |
2069 | 2069 | ||
2070 | mFilterView->blockSignals(true); | 2070 | mFilterView->blockSignals(true); |
2071 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2071 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2072 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2072 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2073 | mFilterView->blockSignals(false); | 2073 | mFilterView->blockSignals(false); |
2074 | // We do it manually to avoid it being done twice by the above calls | 2074 | // We do it manually to avoid it being done twice by the above calls |
2075 | updateFilter(); | 2075 | updateFilter(); |
2076 | } | 2076 | } |
2077 | 2077 | ||
2078 | void CalendarView::writeFilterSettings(KConfig *config) | 2078 | void CalendarView::writeFilterSettings(KConfig *config) |
2079 | { | 2079 | { |
2080 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2080 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2081 | 2081 | ||
2082 | QStringList filterList; | 2082 | QStringList filterList; |
2083 | 2083 | ||
2084 | CalFilter *filter = mFilters.first(); | 2084 | CalFilter *filter = mFilters.first(); |
2085 | while(filter) { | 2085 | while(filter) { |
2086 | // kdDebug() << " fn: " << filter->name() << endl; | 2086 | // kdDebug() << " fn: " << filter->name() << endl; |
2087 | filterList << filter->name(); | 2087 | filterList << filter->name(); |
2088 | config->setGroup("Filter_" + filter->name()); | 2088 | config->setGroup("Filter_" + filter->name()); |
2089 | config->writeEntry("Criteria",filter->criteria()); | 2089 | config->writeEntry("Criteria",filter->criteria()); |
2090 | config->writeEntry("CategoryList",filter->categoryList()); | 2090 | config->writeEntry("CategoryList",filter->categoryList()); |
2091 | filter = mFilters.next(); | 2091 | filter = mFilters.next(); |
2092 | } | 2092 | } |
2093 | config->setGroup("General"); | 2093 | config->setGroup("General"); |
2094 | config->writeEntry("CalendarFilters",filterList); | 2094 | config->writeEntry("CalendarFilters",filterList); |
2095 | 2095 | ||
2096 | config->setGroup("FilterView"); | 2096 | config->setGroup("FilterView"); |
2097 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2097 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2098 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2098 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2099 | } | 2099 | } |
2100 | 2100 | ||
2101 | 2101 | ||
2102 | void CalendarView::goToday() | 2102 | void CalendarView::goToday() |
2103 | { | 2103 | { |
2104 | if ( mViewManager->currentView()->isMonthView() ) | 2104 | if ( mViewManager->currentView()->isMonthView() ) |
2105 | mNavigator->selectTodayMonth(); | 2105 | mNavigator->selectTodayMonth(); |
2106 | else | 2106 | else |
2107 | mNavigator->selectToday(); | 2107 | mNavigator->selectToday(); |
2108 | } | 2108 | } |
2109 | 2109 | ||
2110 | void CalendarView::goNext() | 2110 | void CalendarView::goNext() |
2111 | { | 2111 | { |
2112 | mNavigator->selectNext(); | 2112 | mNavigator->selectNext(); |
2113 | } | 2113 | } |
2114 | 2114 | ||
2115 | void CalendarView::goPrevious() | 2115 | void CalendarView::goPrevious() |
2116 | { | 2116 | { |
2117 | mNavigator->selectPrevious(); | 2117 | mNavigator->selectPrevious(); |
2118 | } | 2118 | } |
2119 | void CalendarView::goNextMonth() | 2119 | void CalendarView::goNextMonth() |
2120 | { | 2120 | { |
2121 | mNavigator->selectNextMonth(); | 2121 | mNavigator->selectNextMonth(); |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | void CalendarView::goPreviousMonth() | 2124 | void CalendarView::goPreviousMonth() |
2125 | { | 2125 | { |
2126 | mNavigator->selectPreviousMonth(); | 2126 | mNavigator->selectPreviousMonth(); |
2127 | } | 2127 | } |
2128 | void CalendarView::writeLocale() | 2128 | void CalendarView::writeLocale() |
2129 | { | 2129 | { |
2130 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2130 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2131 | #if 0 | 2131 | #if 0 |
2132 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2132 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2133 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2133 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2134 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2134 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2135 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2135 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2136 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2136 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2137 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2137 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2138 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2138 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2139 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2139 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2140 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2140 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2141 | KOPrefs::instance()->mDaylightsavingStart, | 2141 | KOPrefs::instance()->mDaylightsavingStart, |
2142 | KOPrefs::instance()->mDaylightsavingEnd ); | 2142 | KOPrefs::instance()->mDaylightsavingEnd ); |
2143 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2143 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2144 | #endif | 2144 | #endif |
2145 | } | 2145 | } |
2146 | void CalendarView::updateConfig() | 2146 | void CalendarView::updateConfig() |
2147 | { | 2147 | { |
2148 | writeLocale(); | 2148 | writeLocale(); |
2149 | if ( KOPrefs::instance()->mUseAppColors ) | 2149 | if ( KOPrefs::instance()->mUseAppColors ) |
2150 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2150 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2151 | emit configChanged(); | 2151 | emit configChanged(); |
2152 | mTodoList->updateConfig(); | 2152 | mTodoList->updateConfig(); |
2153 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2153 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2154 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2154 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2155 | // To make the "fill window" configurations work | 2155 | // To make the "fill window" configurations work |
2156 | //mViewManager->raiseCurrentView(); | 2156 | //mViewManager->raiseCurrentView(); |
2157 | } | 2157 | } |
2158 | 2158 | ||
2159 | 2159 | ||
2160 | void CalendarView::eventChanged(Event *event) | 2160 | void CalendarView::eventChanged(Event *event) |
2161 | { | 2161 | { |
2162 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2162 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2163 | //updateUnmanagedViews(); | 2163 | //updateUnmanagedViews(); |
2164 | } | 2164 | } |
2165 | 2165 | ||
2166 | void CalendarView::eventAdded(Event *event) | 2166 | void CalendarView::eventAdded(Event *event) |
2167 | { | 2167 | { |
2168 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2168 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2169 | } | 2169 | } |
2170 | 2170 | ||
2171 | void CalendarView::eventToBeDeleted(Event *) | 2171 | void CalendarView::eventToBeDeleted(Event *) |
2172 | { | 2172 | { |
2173 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2173 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2174 | } | 2174 | } |
2175 | 2175 | ||
2176 | void CalendarView::eventDeleted() | 2176 | void CalendarView::eventDeleted() |
2177 | { | 2177 | { |
2178 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2178 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2179 | } | 2179 | } |
2180 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2180 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2181 | { | 2181 | { |
2182 | changeIncidenceDisplay((Incidence *)which, action); | 2182 | changeIncidenceDisplay((Incidence *)which, action); |
2183 | mDateNavigator->updateView(); //LR | 2183 | mDateNavigator->updateView(); //LR |
2184 | //mDialogManager->updateSearchDialog(); | 2184 | //mDialogManager->updateSearchDialog(); |
2185 | 2185 | ||
2186 | if (which) { | 2186 | if (which) { |
2187 | mViewManager->updateWNview(); | 2187 | mViewManager->updateWNview(); |
2188 | //mTodoList->updateView(); | 2188 | //mTodoList->updateView(); |
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | } | 2191 | } |
2192 | 2192 | ||
2193 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2193 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2194 | { | 2194 | { |
2195 | updateUnmanagedViews(); | 2195 | updateUnmanagedViews(); |
2196 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2196 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2197 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2197 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2198 | mCalendar->checkAlarmForIncidence( 0, true ); | 2198 | mCalendar->checkAlarmForIncidence( 0, true ); |
2199 | if ( mEventViewerDialog ) | 2199 | if ( mEventViewerDialog ) |
2200 | mEventViewerDialog->hide(); | 2200 | mEventViewerDialog->hide(); |
2201 | } | 2201 | } |
2202 | else | 2202 | else |
2203 | mCalendar->checkAlarmForIncidence( which , false ); | 2203 | mCalendar->checkAlarmForIncidence( which , false ); |
2204 | } | 2204 | } |
2205 | 2205 | ||
2206 | // most of the changeEventDisplays() right now just call the view's | 2206 | // most of the changeEventDisplays() right now just call the view's |
2207 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2207 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2208 | void CalendarView::changeEventDisplay(Event *which, int action) | 2208 | void CalendarView::changeEventDisplay(Event *which, int action) |
2209 | { | 2209 | { |
2210 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2210 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2211 | changeIncidenceDisplay((Incidence *)which, action); | 2211 | changeIncidenceDisplay((Incidence *)which, action); |
2212 | mDateNavigator->updateView(); | 2212 | mDateNavigator->updateView(); |
2213 | //mDialogManager->updateSearchDialog(); | 2213 | //mDialogManager->updateSearchDialog(); |
2214 | 2214 | ||
2215 | if (which) { | 2215 | if (which) { |
2216 | // If there is an event view visible update the display | 2216 | // If there is an event view visible update the display |
2217 | mViewManager->currentView()->changeEventDisplay(which,action); | 2217 | mViewManager->currentView()->changeEventDisplay(which,action); |
2218 | // TODO: check, if update needed | 2218 | // TODO: check, if update needed |
2219 | // if (which->getTodoStatus()) { | 2219 | // if (which->getTodoStatus()) { |
2220 | mTodoList->updateView(); | 2220 | mTodoList->updateView(); |
2221 | // } | 2221 | // } |
2222 | } else { | 2222 | } else { |
2223 | mViewManager->currentView()->updateView(); | 2223 | mViewManager->currentView()->updateView(); |
2224 | } | 2224 | } |
2225 | } | 2225 | } |
2226 | 2226 | ||
2227 | 2227 | ||
2228 | void CalendarView::updateTodoViews() | 2228 | void CalendarView::updateTodoViews() |
2229 | { | 2229 | { |
2230 | mTodoList->updateView(); | 2230 | mTodoList->updateView(); |
2231 | mViewManager->currentView()->updateView(); | 2231 | mViewManager->currentView()->updateView(); |
2232 | 2232 | ||
2233 | } | 2233 | } |
2234 | 2234 | ||
2235 | 2235 | ||
2236 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2236 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2237 | { | 2237 | { |
2238 | mTodoList->updateView(); | 2238 | mTodoList->updateView(); |
2239 | mViewManager->updateView(start, end); | 2239 | mViewManager->updateView(start, end); |
2240 | //mDateNavigator->updateView(); | 2240 | //mDateNavigator->updateView(); |
2241 | } | 2241 | } |
2242 | 2242 | ||
2243 | void CalendarView::updateView() | 2243 | void CalendarView::updateView() |
2244 | { | 2244 | { |
2245 | DateList tmpList = mNavigator->selectedDates(); | 2245 | DateList tmpList = mNavigator->selectedDates(); |
2246 | 2246 | ||
2247 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2247 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2248 | mTodoList->updateView(); | 2248 | mTodoList->updateView(); |
2249 | // We assume that the navigator only selects consecutive days. | 2249 | // We assume that the navigator only selects consecutive days. |
2250 | updateView( tmpList.first(), tmpList.last() ); | 2250 | updateView( tmpList.first(), tmpList.last() ); |
2251 | } | 2251 | } |
2252 | 2252 | ||
2253 | void CalendarView::updateUnmanagedViews() | 2253 | void CalendarView::updateUnmanagedViews() |
2254 | { | 2254 | { |
2255 | mDateNavigator->updateDayMatrix(); | 2255 | mDateNavigator->updateDayMatrix(); |
2256 | } | 2256 | } |
2257 | 2257 | ||
2258 | int CalendarView::msgItemDelete(const QString name) | 2258 | int CalendarView::msgItemDelete(const QString name) |
2259 | { | 2259 | { |
2260 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2260 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2261 | i18n("This item will be\npermanently deleted."), | 2261 | i18n("This item will be\npermanently deleted."), |
2262 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2262 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2263 | } | 2263 | } |
2264 | 2264 | ||
2265 | 2265 | ||
2266 | void CalendarView::edit_cut() | 2266 | void CalendarView::edit_cut() |
2267 | { | 2267 | { |
2268 | Event *anEvent=0; | 2268 | Event *anEvent=0; |
2269 | 2269 | ||
2270 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2270 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2271 | 2271 | ||
2272 | if (mViewManager->currentView()->isEventView()) { | 2272 | if (mViewManager->currentView()->isEventView()) { |
2273 | if ( incidence && incidence->type() == "Event" ) { | 2273 | if ( incidence && incidence->type() == "Event" ) { |
2274 | anEvent = static_cast<Event *>(incidence); | 2274 | anEvent = static_cast<Event *>(incidence); |
2275 | } | 2275 | } |
2276 | } | 2276 | } |
2277 | 2277 | ||
2278 | if (!anEvent) { | 2278 | if (!anEvent) { |
2279 | KNotifyClient::beep(); | 2279 | KNotifyClient::beep(); |
2280 | return; | 2280 | return; |
2281 | } | 2281 | } |
2282 | DndFactory factory( mCalendar ); | 2282 | DndFactory factory( mCalendar ); |
2283 | factory.cutIncidence(anEvent); | 2283 | factory.cutIncidence(anEvent); |
2284 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2284 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2285 | } | 2285 | } |
2286 | 2286 | ||
2287 | void CalendarView::edit_copy() | 2287 | void CalendarView::edit_copy() |
2288 | { | 2288 | { |
2289 | Event *anEvent=0; | 2289 | Event *anEvent=0; |
2290 | 2290 | ||
2291 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2291 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2292 | 2292 | ||
2293 | if (mViewManager->currentView()->isEventView()) { | 2293 | if (mViewManager->currentView()->isEventView()) { |
2294 | if ( incidence && incidence->type() == "Event" ) { | 2294 | if ( incidence && incidence->type() == "Event" ) { |
2295 | anEvent = static_cast<Event *>(incidence); | 2295 | anEvent = static_cast<Event *>(incidence); |
2296 | } | 2296 | } |
2297 | } | 2297 | } |
2298 | 2298 | ||
2299 | if (!anEvent) { | 2299 | if (!anEvent) { |
2300 | KNotifyClient::beep(); | 2300 | KNotifyClient::beep(); |
2301 | return; | 2301 | return; |
2302 | } | 2302 | } |
2303 | DndFactory factory( mCalendar ); | 2303 | DndFactory factory( mCalendar ); |
2304 | factory.copyIncidence(anEvent); | 2304 | factory.copyIncidence(anEvent); |
2305 | } | 2305 | } |
2306 | 2306 | ||
2307 | void CalendarView::edit_paste() | 2307 | void CalendarView::edit_paste() |
2308 | { | 2308 | { |
2309 | QDate date = mNavigator->selectedDates().first(); | 2309 | QDate date = mNavigator->selectedDates().first(); |
2310 | 2310 | ||
2311 | DndFactory factory( mCalendar ); | 2311 | DndFactory factory( mCalendar ); |
2312 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2312 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2313 | 2313 | ||
2314 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2314 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2315 | } | 2315 | } |
2316 | 2316 | ||
2317 | void CalendarView::edit_options() | 2317 | void CalendarView::edit_options() |
2318 | { | 2318 | { |
2319 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2319 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2320 | emit save(); | 2320 | emit save(); |
2321 | emit saveStopTimer(); | 2321 | emit saveStopTimer(); |
2322 | mDialogManager->showOptionsDialog(); | 2322 | mDialogManager->showOptionsDialog(); |
2323 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2323 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2324 | emit saveStopTimer(); | 2324 | emit saveStopTimer(); |
2325 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2325 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2326 | i18n("Timezone settings"),i18n("Reload"))) { | 2326 | i18n("Timezone settings"),i18n("Reload"))) { |
2327 | qDebug("KO: TZ reload cancelled "); | 2327 | qDebug("KO: TZ reload cancelled "); |
2328 | return; | 2328 | return; |
2329 | } | 2329 | } |
2330 | qDebug("KO: Timezone change "); | 2330 | qDebug("KO: Timezone change "); |
2331 | openCalendar( MainWindow::defaultFileName() ); | 2331 | openCalendar( MainWindow::defaultFileName() ); |
2332 | setModified(true); | 2332 | setModified(true); |
2333 | } | 2333 | } |
2334 | else | 2334 | else |
2335 | qDebug("KO: No tz change "); | 2335 | qDebug("KO: No tz change "); |
2336 | 2336 | ||
2337 | } | 2337 | } |
2338 | 2338 | ||
2339 | 2339 | ||
2340 | void CalendarView::slotSelectPickerDate( QDate d) | 2340 | void CalendarView::slotSelectPickerDate( QDate d) |
2341 | { | 2341 | { |
2342 | mDateFrame->hide(); | 2342 | mDateFrame->hide(); |
2343 | if ( mDatePickerMode == 1 ) { | 2343 | if ( mDatePickerMode == 1 ) { |
2344 | mNavigator->slotDaySelect( d ); | 2344 | mNavigator->slotDaySelect( d ); |
2345 | } else if ( mDatePickerMode == 2 ) { | 2345 | } else if ( mDatePickerMode == 2 ) { |
2346 | if ( mMoveIncidence->type() == "Todo" ) { | 2346 | if ( mMoveIncidence->type() == "Todo" ) { |
2347 | Todo * to = (Todo *) mMoveIncidence; | 2347 | Todo * to = (Todo *) mMoveIncidence; |
2348 | QTime tim; | 2348 | QTime tim; |
2349 | int len = 0; | 2349 | int len = 0; |
2350 | if ( to->hasStartDate() && to->hasDueDate() ) | 2350 | if ( to->hasStartDate() && to->hasDueDate() ) |
2351 | len = to->dtStart().secsTo( to->dtDue()); | 2351 | len = to->dtStart().secsTo( to->dtDue()); |