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