summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-07 05:09:23 (UTC)
committer zautrix <zautrix>2005-06-07 05:09:23 (UTC)
commit0bbef196163a267722978e34db2ba3daaee76f88 (patch) (unidiff)
treefac0b701aea6348490c5e9585820070b32b35e29 /korganizer
parent790b8c38e1305b2f5ee4485e59a3ecd01e5b6f75 (diff)
downloadkdepimpi-0bbef196163a267722978e34db2ba3daaee76f88.zip
kdepimpi-0bbef196163a267722978e34db2ba3daaee76f88.tar.gz
kdepimpi-0bbef196163a267722978e34db2ba3daaee76f88.tar.bz2
clear view fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp19
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/koagendaview.cpp7
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/kojournalview.cpp4
-rw-r--r--korganizer/kojournalview.h1
-rw-r--r--korganizer/kolistview.cpp4
-rw-r--r--korganizer/kolistview.h1
-rw-r--r--korganizer/komonthview.cpp10
-rw-r--r--korganizer/komonthview.h1
-rw-r--r--korganizer/koviewmanager.cpp13
-rw-r--r--korganizer/koviewmanager.h1
-rw-r--r--korganizer/kowhatsnextview.cpp5
-rw-r--r--korganizer/kowhatsnextview.h1
-rw-r--r--korganizer/mainwindow.cpp1
15 files changed, 67 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 608b73b..e13d0be 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1115,64 +1115,65 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
1115 eve->setDescription( des ); 1115 eve->setDescription( des );
1116 //qDebug("setdes %s ", des.latin1()); 1116 //qDebug("setdes %s ", des.latin1());
1117 eve->setReadOnly( true ); 1117 eve->setReadOnly( true );
1118 } 1118 }
1119 eve = lastSync.next(); 1119 eve = lastSync.next();
1120 } 1120 }
1121 1121
1122} 1122}
1123void CalendarView::checkExternalId( Incidence * inc ) 1123void CalendarView::checkExternalId( Incidence * inc )
1124{ 1124{
1125 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1125 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
1126 checkExternSyncEvent( lastSync, inc ); 1126 checkExternSyncEvent( lastSync, inc );
1127 1127
1128} 1128}
1129bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1129bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
1130{ 1130{
1131 bool syncOK = true; 1131 bool syncOK = true;
1132 int addedEvent = 0; 1132 int addedEvent = 0;
1133 int addedEventR = 0; 1133 int addedEventR = 0;
1134 int deletedEventR = 0; 1134 int deletedEventR = 0;
1135 int deletedEventL = 0; 1135 int deletedEventL = 0;
1136 int changedLocal = 0; 1136 int changedLocal = 0;
1137 int changedRemote = 0; 1137 int changedRemote = 0;
1138 int filteredIN = 0; 1138 int filteredIN = 0;
1139 int filteredOUT = 0; 1139 int filteredOUT = 0;
1140 //QPtrList<Event> el = local->rawEvents(); 1140 //QPtrList<Event> el = local->rawEvents();
1141 Event* eventR; 1141 Event* eventR;
1142 QString uid; 1142 QString uid;
1143 int take; 1143 int take;
1144 Event* eventL; 1144 Event* eventL;
1145 Event* eventRSync; 1145 Event* eventRSync;
1146 Event* eventLSync; 1146 Event* eventLSync;
1147 clearAllViews();
1147 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 1148 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
1148 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 1149 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
1149 bool fullDateRange = false; 1150 bool fullDateRange = false;
1150 local->resetTempSyncStat(); 1151 local->resetTempSyncStat();
1151 mLastCalendarSync = QDateTime::currentDateTime(); 1152 mLastCalendarSync = QDateTime::currentDateTime();
1152 if ( mSyncManager->syncWithDesktop() ) { 1153 if ( mSyncManager->syncWithDesktop() ) {
1153 remote->resetPilotStat(1); 1154 remote->resetPilotStat(1);
1154 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1155 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1155 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 1156 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
1156 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 1157 qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
1157 } else { 1158 } else {
1158 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 1159 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
1159 } 1160 }
1160 } 1161 }
1161 QDateTime modifiedCalendar = mLastCalendarSync; 1162 QDateTime modifiedCalendar = mLastCalendarSync;
1162 eventLSync = getLastSyncEvent(); 1163 eventLSync = getLastSyncEvent();
1163 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 1164 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
1164 if ( eventR ) { 1165 if ( eventR ) {
1165 eventRSync = (Event*) eventR->clone(); 1166 eventRSync = (Event*) eventR->clone();
1166 remote->deleteEvent(eventR ); 1167 remote->deleteEvent(eventR );
1167 1168
1168 } else { 1169 } else {
1169 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 1170 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
1170 eventRSync = (Event*)eventLSync->clone(); 1171 eventRSync = (Event*)eventLSync->clone();
1171 } else { 1172 } else {
1172 fullDateRange = true; 1173 fullDateRange = true;
1173 eventRSync = new Event(); 1174 eventRSync = new Event();
1174 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 1175 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
1175 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 1176 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
1176 eventRSync->setDtStart( mLastCalendarSync ); 1177 eventRSync->setDtStart( mLastCalendarSync );
1177 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1178 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1178 eventRSync->setCategories( i18n("SyncEvent") ); 1179 eventRSync->setCategories( i18n("SyncEvent") );
@@ -1807,66 +1808,66 @@ bool CalendarView::importQtopia( const QString &categories,
1807 updateView(); 1808 updateView();
1808 return syncOK; 1809 return syncOK;
1809 1810
1810 1811
1811#endif 1812#endif
1812 1813
1813} 1814}
1814 1815
1815void CalendarView::setSyncEventsReadOnly() 1816void CalendarView::setSyncEventsReadOnly()
1816{ 1817{
1817 Event * ev; 1818 Event * ev;
1818 QPtrList<Event> eL = mCalendar->rawEvents(); 1819 QPtrList<Event> eL = mCalendar->rawEvents();
1819 ev = eL.first(); 1820 ev = eL.first();
1820 while ( ev ) { 1821 while ( ev ) {
1821 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1822 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1822 ev->setReadOnly( true ); 1823 ev->setReadOnly( true );
1823 ev = eL.next(); 1824 ev = eL.next();
1824 } 1825 }
1825} 1826}
1826bool CalendarView::openCalendar(QString filename, bool merge) 1827bool CalendarView::openCalendar(QString filename, bool merge)
1827{ 1828{
1828 1829
1829 if (filename.isEmpty()) { 1830 if (filename.isEmpty()) {
1830 return false; 1831 return false;
1831 } 1832 }
1832 1833
1833 if (!QFile::exists(filename)) { 1834 if (!QFile::exists(filename)) {
1834 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1835 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1835 return false; 1836 return false;
1836 } 1837 }
1837 1838
1838 globalFlagBlockAgenda = 1; 1839 globalFlagBlockAgenda = 1;
1840 clearAllViews();
1839 if (!merge) { 1841 if (!merge) {
1840 mTodoList->clearList();
1841 mViewManager->setDocumentId( filename ); 1842 mViewManager->setDocumentId( filename );
1842 mCalendar->close(); 1843 mCalendar->close();
1843 } 1844 }
1844 mStorage->setFileName( filename ); 1845 mStorage->setFileName( filename );
1845 1846
1846 if ( mStorage->load() ) { 1847 if ( mStorage->load() ) {
1847 if ( merge ) ;//setModified( true ); 1848 if ( merge ) ;//setModified( true );
1848 else { 1849 else {
1849 //setModified( true ); 1850 //setModified( true );
1850 mViewManager->setDocumentId( filename ); 1851 mViewManager->setDocumentId( filename );
1851 mDialogManager->setDocumentId( filename ); 1852 mDialogManager->setDocumentId( filename );
1852 mTodoList->setDocumentId( filename ); 1853 mTodoList->setDocumentId( filename );
1853 } 1854 }
1854 globalFlagBlockAgenda = 2; 1855 globalFlagBlockAgenda = 2;
1855 // if ( getLastSyncEvent() ) 1856 // if ( getLastSyncEvent() )
1856 // getLastSyncEvent()->setReadOnly( true ); 1857 // getLastSyncEvent()->setReadOnly( true );
1857 mCalendar->reInitAlarmSettings(); 1858 mCalendar->reInitAlarmSettings();
1858 setSyncEventsReadOnly(); 1859 setSyncEventsReadOnly();
1859 updateUnmanagedViews(); 1860 updateUnmanagedViews();
1860 updateView(); 1861 updateView();
1861 if ( filename != MainWindow::defaultFileName() ) { 1862 if ( filename != MainWindow::defaultFileName() ) {
1862 saveCalendar( MainWindow::defaultFileName() ); 1863 saveCalendar( MainWindow::defaultFileName() );
1863 } else { 1864 } else {
1864 QFileInfo finf ( MainWindow::defaultFileName()); 1865 QFileInfo finf ( MainWindow::defaultFileName());
1865 if ( finf.exists() ) { 1866 if ( finf.exists() ) {
1866 setLoadedFileVersion( finf.lastModified () ); 1867 setLoadedFileVersion( finf.lastModified () );
1867 } 1868 }
1868 } 1869 }
1869 return true; 1870 return true;
1870 } else { 1871 } else {
1871 // while failing to load, the calendar object could 1872 // while failing to load, the calendar object could
1872 // have become partially populated. Clear it out. 1873 // have become partially populated. Clear it out.
@@ -1919,97 +1920,99 @@ void CalendarView::watchSavedFile()
1919 return; 1920 return;
1920 } 1921 }
1921 loadedFileVersion = dt; 1922 loadedFileVersion = dt;
1922} 1923}
1923 1924
1924bool CalendarView::checkFileVersion(QString fn) 1925bool CalendarView::checkFileVersion(QString fn)
1925{ 1926{
1926 QFileInfo finf ( fn ); 1927 QFileInfo finf ( fn );
1927 if ( !finf.exists() ) 1928 if ( !finf.exists() )
1928 return true; 1929 return true;
1929 QDateTime dt = finf.lastModified (); 1930 QDateTime dt = finf.lastModified ();
1930 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1931 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1931 //qDebug("file on disk version %s",dt.toString().latin1()); 1932 //qDebug("file on disk version %s",dt.toString().latin1());
1932 if ( dt <= loadedFileVersion ) 1933 if ( dt <= loadedFileVersion )
1933 return true; 1934 return true;
1934 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)) , 1935 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)) ,
1935 i18n("KO/Pi Warning"),i18n("Overwrite"), 1936 i18n("KO/Pi Warning"),i18n("Overwrite"),
1936 i18n("Sync+save")); 1937 i18n("Sync+save"));
1937 1938
1938 if ( km == KMessageBox::Cancel ) 1939 if ( km == KMessageBox::Cancel )
1939 return false; 1940 return false;
1940 if ( km == KMessageBox::Yes ) 1941 if ( km == KMessageBox::Yes )
1941 return true; 1942 return true;
1942 1943
1943 setSyncDevice("deleteaftersync" ); 1944 setSyncDevice("deleteaftersync" );
1944 mSyncManager->mAskForPreferences = true; 1945 mSyncManager->mAskForPreferences = true;
1945 mSyncManager->mSyncAlgoPrefs = 3; 1946 mSyncManager->mSyncAlgoPrefs = 3;
1946 mSyncManager->mWriteBackFile = false; 1947 mSyncManager->mWriteBackFile = false;
1947 mSyncManager->mWriteBackExistingOnly = false; 1948 mSyncManager->mWriteBackExistingOnly = false;
1948 mSyncManager->mShowSyncSummary = false; 1949 mSyncManager->mShowSyncSummary = false;
1949 syncCalendar( fn, 3 ); 1950 syncCalendar( fn, 3 );
1950 Event * e = getLastSyncEvent(); 1951 Event * e = getLastSyncEvent();
1951 mCalendar->deleteEvent ( e ); 1952 if ( e )
1953 deleteEvent ( e );
1952 updateView(); 1954 updateView();
1953 return true; 1955 return true;
1954} 1956}
1955 1957
1956bool CalendarView::saveCalendar( QString filename ) 1958bool CalendarView::saveCalendar( QString filename )
1957{ 1959{
1958 1960
1959 // Store back all unsaved data into calendar object 1961 // Store back all unsaved data into calendar object
1960 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1962 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1961 if ( mViewManager->currentView() ) 1963 if ( mViewManager->currentView() )
1962 mViewManager->currentView()->flushView(); 1964 mViewManager->currentView()->flushView();
1963 1965
1964 1966
1965 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1967 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1966 mStorage->setSaveFormat( new ICalFormat() ); 1968 mStorage->setSaveFormat( new ICalFormat() );
1967 mStorage->setFileName( filename ); 1969 mStorage->setFileName( filename );
1968 bool success; 1970 bool success;
1969 success = mStorage->save(); 1971 success = mStorage->save();
1970 if ( !success ) { 1972 if ( !success ) {
1971 return false; 1973 return false;
1972 } 1974 }
1973 if ( filename == MainWindow::defaultFileName() ) { 1975 if ( filename == MainWindow::defaultFileName() ) {
1974 setLoadedFileVersion( lfv ); 1976 setLoadedFileVersion( lfv );
1975 watchSavedFile(); 1977 watchSavedFile();
1976 } 1978 }
1977 return true; 1979 return true;
1978} 1980}
1979 1981
1980void CalendarView::closeCalendar() 1982void CalendarView::closeCalendar()
1981{ 1983{
1982 1984
1983 // child windows no longer valid 1985 // child windows no longer valid
1986 clearAllViews();
1984 emit closingDown(); 1987 emit closingDown();
1985 1988
1986 mCalendar->close(); 1989 mCalendar->close();
1987 setModified(false); 1990 setModified(false);
1988 updateView(); 1991 updateView();
1989} 1992}
1990 1993
1991void CalendarView::archiveCalendar() 1994void CalendarView::archiveCalendar()
1992{ 1995{
1993 mDialogManager->showArchiveDialog(); 1996 mDialogManager->showArchiveDialog();
1994} 1997}
1995 1998
1996 1999
1997void CalendarView::readSettings() 2000void CalendarView::readSettings()
1998{ 2001{
1999 2002
2000 2003
2001 // mViewManager->showAgendaView(); 2004 // mViewManager->showAgendaView();
2002 QString str; 2005 QString str;
2003 //qDebug("CalendarView::readSettings() "); 2006 //qDebug("CalendarView::readSettings() ");
2004 // read settings from the KConfig, supplying reasonable 2007 // read settings from the KConfig, supplying reasonable
2005 // defaults where none are to be found 2008 // defaults where none are to be found
2006 KConfig *config = KOGlobals::config(); 2009 KConfig *config = KOGlobals::config();
2007#ifndef KORG_NOSPLITTER 2010#ifndef KORG_NOSPLITTER
2008 config->setGroup("KOrganizer Geometry"); 2011 config->setGroup("KOrganizer Geometry");
2009 2012
2010 QValueList<int> sizes = config->readIntListEntry("Separator1"); 2013 QValueList<int> sizes = config->readIntListEntry("Separator1");
2011 if (sizes.count() != 2) { 2014 if (sizes.count() != 2) {
2012 sizes << mDateNavigator->minimumSizeHint().width(); 2015 sizes << mDateNavigator->minimumSizeHint().width();
2013 sizes << 300; 2016 sizes << 300;
2014 } 2017 }
2015 mPanner->setSizes(sizes); 2018 mPanner->setSizes(sizes);
@@ -2403,64 +2406,75 @@ void CalendarView::changeEventDisplay(Event *which, int action)
2403 changeIncidenceDisplay((Incidence *)which, action); 2406 changeIncidenceDisplay((Incidence *)which, action);
2404 mDateNavigator->updateView(); 2407 mDateNavigator->updateView();
2405 //mDialogManager->updateSearchDialog(); 2408 //mDialogManager->updateSearchDialog();
2406 2409
2407 if (which) { 2410 if (which) {
2408 // If there is an event view visible update the display 2411 // If there is an event view visible update the display
2409 mViewManager->currentView()->changeEventDisplay(which,action); 2412 mViewManager->currentView()->changeEventDisplay(which,action);
2410 // TODO: check, if update needed 2413 // TODO: check, if update needed
2411 // if (which->getTodoStatus()) { 2414 // if (which->getTodoStatus()) {
2412 mTodoList->updateView(); 2415 mTodoList->updateView();
2413 // } 2416 // }
2414 } else { 2417 } else {
2415 mViewManager->currentView()->updateView(); 2418 mViewManager->currentView()->updateView();
2416 } 2419 }
2417} 2420}
2418 2421
2419 2422
2420void CalendarView::updateTodoViews() 2423void CalendarView::updateTodoViews()
2421{ 2424{
2422 mTodoList->updateView(); 2425 mTodoList->updateView();
2423 mViewManager->currentView()->updateView(); 2426 mViewManager->currentView()->updateView();
2424 2427
2425} 2428}
2426 2429
2427 2430
2428void CalendarView::updateView(const QDate &start, const QDate &end) 2431void CalendarView::updateView(const QDate &start, const QDate &end)
2429{ 2432{
2430 mTodoList->updateView(); 2433 mTodoList->updateView();
2431 mViewManager->updateView(start, end); 2434 mViewManager->updateView(start, end);
2432 //mDateNavigator->updateView(); 2435 //mDateNavigator->updateView();
2433} 2436}
2434 2437
2438void CalendarView::clearAllViews()
2439{
2440 mTodoList->clearList();
2441 mViewManager->clearAllViews();
2442 SearchDialog * sd = mDialogManager->getSearchDialog();
2443 if ( sd ) {
2444 KOListView* kol = sd->listview();
2445 if ( kol )
2446 kol->clearList();
2447 }
2448}
2435void CalendarView::updateView() 2449void CalendarView::updateView()
2436{ 2450{
2437 DateList tmpList = mNavigator->selectedDates(); 2451 DateList tmpList = mNavigator->selectedDates();
2438 2452
2439 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2453 if ( KOPrefs::instance()->mHideNonStartedTodos )
2440 mTodoList->updateView(); 2454 mTodoList->updateView();
2441 // We assume that the navigator only selects consecutive days. 2455 // We assume that the navigator only selects consecutive days.
2442 updateView( tmpList.first(), tmpList.last() ); 2456 updateView( tmpList.first(), tmpList.last() );
2443} 2457}
2444 2458
2445void CalendarView::updateUnmanagedViews() 2459void CalendarView::updateUnmanagedViews()
2446{ 2460{
2447 mDateNavigator->updateDayMatrix(); 2461 mDateNavigator->updateDayMatrix();
2448} 2462}
2449 2463
2450int CalendarView::msgItemDelete(const QString name) 2464int CalendarView::msgItemDelete(const QString name)
2451{ 2465{
2452 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2466 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2453 i18n("This item will be\npermanently deleted."), 2467 i18n("This item will be\npermanently deleted."),
2454 i18n("KO/Pi Confirmation"),i18n("Delete")); 2468 i18n("KO/Pi Confirmation"),i18n("Delete"));
2455} 2469}
2456 2470
2457 2471
2458void CalendarView::edit_cut() 2472void CalendarView::edit_cut()
2459{ 2473{
2460 Event *anEvent=0; 2474 Event *anEvent=0;
2461 2475
2462 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2476 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2463 2477
2464 if (mViewManager->currentView()->isEventView()) { 2478 if (mViewManager->currentView()->isEventView()) {
2465 if ( incidence && incidence->type() == "Event" ) { 2479 if ( incidence && incidence->type() == "Event" ) {
2466 anEvent = static_cast<Event *>(incidence); 2480 anEvent = static_cast<Event *>(incidence);
@@ -3914,64 +3928,65 @@ void CalendarView::updateFilter()
3914 updateView(); 3928 updateView();
3915 if ( !mess.isEmpty() ) 3929 if ( !mess.isEmpty() )
3916 topLevelWidget()->setCaption( mess ); 3930 topLevelWidget()->setCaption( mess );
3917 3931
3918 } 3932 }
3919} 3933}
3920 3934
3921void CalendarView::filterEdited() 3935void CalendarView::filterEdited()
3922{ 3936{
3923 mFilterView->updateFilters(); 3937 mFilterView->updateFilters();
3924 updateFilter(); 3938 updateFilter();
3925 writeSettings(); 3939 writeSettings();
3926} 3940}
3927 3941
3928 3942
3929void CalendarView::takeOverEvent() 3943void CalendarView::takeOverEvent()
3930{ 3944{
3931 Incidence *incidence = currentSelection(); 3945 Incidence *incidence = currentSelection();
3932 3946
3933 if (!incidence) return; 3947 if (!incidence) return;
3934 3948
3935 incidence->setOrganizer(KOPrefs::instance()->email()); 3949 incidence->setOrganizer(KOPrefs::instance()->email());
3936 incidence->recreate(); 3950 incidence->recreate();
3937 incidence->setReadOnly(false); 3951 incidence->setReadOnly(false);
3938 3952
3939 updateView(); 3953 updateView();
3940} 3954}
3941 3955
3942void CalendarView::takeOverCalendar() 3956void CalendarView::takeOverCalendar()
3943{ 3957{
3944 // TODO: Create Calendar::allIncidences() function and use it here 3958 // TODO: Create Calendar::allIncidences() function and use it here
3945 3959
3960 clearAllViews();
3946 QPtrList<Event> events = mCalendar->events(); 3961 QPtrList<Event> events = mCalendar->events();
3947 for(uint i=0; i<events.count(); ++i) { 3962 for(uint i=0; i<events.count(); ++i) {
3948 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3963 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3949 events.at(i)->recreate(); 3964 events.at(i)->recreate();
3950 events.at(i)->setReadOnly(false); 3965 events.at(i)->setReadOnly(false);
3951 } 3966 }
3952 3967
3953 QPtrList<Todo> todos = mCalendar->todos(); 3968 QPtrList<Todo> todos = mCalendar->todos();
3954 for(uint i=0; i<todos.count(); ++i) { 3969 for(uint i=0; i<todos.count(); ++i) {
3955 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3970 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3956 todos.at(i)->recreate(); 3971 todos.at(i)->recreate();
3957 todos.at(i)->setReadOnly(false); 3972 todos.at(i)->setReadOnly(false);
3958 } 3973 }
3959 3974
3960 QPtrList<Journal> journals = mCalendar->journals(); 3975 QPtrList<Journal> journals = mCalendar->journals();
3961 for(uint i=0; i<journals.count(); ++i) { 3976 for(uint i=0; i<journals.count(); ++i) {
3962 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3977 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3963 journals.at(i)->recreate(); 3978 journals.at(i)->recreate();
3964 journals.at(i)->setReadOnly(false); 3979 journals.at(i)->setReadOnly(false);
3965 } 3980 }
3966 3981
3967 updateView(); 3982 updateView();
3968} 3983}
3969 3984
3970void CalendarView::showIntro() 3985void CalendarView::showIntro()
3971{ 3986{
3972 kdDebug() << "To be implemented." << endl; 3987 kdDebug() << "To be implemented." << endl;
3973} 3988}
3974 3989
3975QWidgetStack *CalendarView::viewStack() 3990QWidgetStack *CalendarView::viewStack()
3976{ 3991{
3977 return mRightFrame; 3992 return mRightFrame;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 084b6db..4600090 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -302,64 +302,65 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
302 /** using the KConfig associated with the kapp variable, read in the 302 /** using the KConfig associated with the kapp variable, read in the
303 * settings from the config file. 303 * settings from the config file.
304 */ 304 */
305 void readSettings(); 305 void readSettings();
306 306
307 /** write current state to config file. */ 307 /** write current state to config file. */
308 void writeSettings(); 308 void writeSettings();
309 309
310 /** read settings for calendar filters */ 310 /** read settings for calendar filters */
311 void readFilterSettings(KConfig *config); 311 void readFilterSettings(KConfig *config);
312 312
313 /** write settings for calendar filters */ 313 /** write settings for calendar filters */
314 void writeFilterSettings(KConfig *config); 314 void writeFilterSettings(KConfig *config);
315 315
316 /** passes on the message that an event has changed to the currently 316 /** passes on the message that an event has changed to the currently
317 * activated view so that it can make appropriate display changes. */ 317 * activated view so that it can make appropriate display changes. */
318 void changeEventDisplay(Event *, int); 318 void changeEventDisplay(Event *, int);
319 void changeIncidenceDisplay(Incidence *, int); 319 void changeIncidenceDisplay(Incidence *, int);
320 void changeTodoDisplay(Todo *, int); 320 void changeTodoDisplay(Todo *, int);
321 321
322 void eventAdded(Event *); 322 void eventAdded(Event *);
323 void eventChanged(Event *); 323 void eventChanged(Event *);
324 void eventToBeDeleted(Event *); 324 void eventToBeDeleted(Event *);
325 void eventDeleted(); 325 void eventDeleted();
326 326
327 void todoAdded(Todo *); 327 void todoAdded(Todo *);
328 void todoChanged(Todo *); 328 void todoChanged(Todo *);
329 void todoToBeDeleted(Todo *); 329 void todoToBeDeleted(Todo *);
330 void todoDeleted(); 330 void todoDeleted();
331 331
332 void updateView(const QDate &start, const QDate &end); 332 void updateView(const QDate &start, const QDate &end);
333 void updateView(); 333 void updateView();
334 void clearAllViews();
334 335
335 /** Full update of visible todo views */ 336 /** Full update of visible todo views */
336 void updateTodoViews(); 337 void updateTodoViews();
337 338
338 void updateUnmanagedViews(); 339 void updateUnmanagedViews();
339 340
340 /** cut the current appointment to the clipboard */ 341 /** cut the current appointment to the clipboard */
341 void edit_cut(); 342 void edit_cut();
342 343
343 /** copy the current appointment(s) to the clipboard */ 344 /** copy the current appointment(s) to the clipboard */
344 void edit_copy(); 345 void edit_copy();
345 346
346 /** paste the current vobject(s) in the clipboard buffer into calendar */ 347 /** paste the current vobject(s) in the clipboard buffer into calendar */
347 void edit_paste(); 348 void edit_paste();
348 349
349 /** edit viewing and configuration options. */ 350 /** edit viewing and configuration options. */
350 void edit_options(); 351 void edit_options();
351 /** 352 /**
352 Functions for printing, previewing a print, and setting up printing 353 Functions for printing, previewing a print, and setting up printing
353 parameters. 354 parameters.
354 */ 355 */
355 void print(); 356 void print();
356 void printSetup(); 357 void printSetup();
357 void printPreview(); 358 void printPreview();
358 359
359 /** Export as iCalendar file */ 360 /** Export as iCalendar file */
360 void exportICalendar(); 361 void exportICalendar();
361 362
362 /** Export as vCalendar file */ 363 /** Export as vCalendar file */
363 bool exportVCalendar( QString fn); 364 bool exportVCalendar( QString fn);
364 365
365 /** pop up a dialog to show an existing appointment. */ 366 /** pop up a dialog to show an existing appointment. */
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index fd9bf29..1320a2e 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1302,64 +1302,71 @@ void KOAgendaView::fillAgenda()
1302 repaintAgenda(); 1302 repaintAgenda();
1303 onlyOne = false; 1303 onlyOne = false;
1304 // mAgenda->finishUpdate(); 1304 // mAgenda->finishUpdate();
1305 //mAllDayAgenda->finishUpdate(); 1305 //mAllDayAgenda->finishUpdate();
1306 1306
1307 // repaintAgenda(); 1307 // repaintAgenda();
1308 //qApp->processEvents(); 1308 //qApp->processEvents();
1309 // globalFlagBlockAgenda = 0; 1309 // globalFlagBlockAgenda = 0;
1310} 1310}
1311void KOAgendaView::repaintAgenda() 1311void KOAgendaView::repaintAgenda()
1312{ 1312{
1313 // mAllDayAgenda->drawContentsToPainter(); 1313 // mAllDayAgenda->drawContentsToPainter();
1314// mAllDayAgenda->viewport()->repaint( false ); 1314// mAllDayAgenda->viewport()->repaint( false );
1315// mAgenda->drawContentsToPainter(); 1315// mAgenda->drawContentsToPainter();
1316// mAgenda->viewport()->repaint( false ); 1316// mAgenda->viewport()->repaint( false );
1317// qApp->processEvents(); 1317// qApp->processEvents();
1318 1318
1319 //qDebug("KOAgendaView::repaintAgenda() "); 1319 //qDebug("KOAgendaView::repaintAgenda() ");
1320 //qApp->processEvents(); 1320 //qApp->processEvents();
1321 mAgenda->viewport()->repaint( false ); 1321 mAgenda->viewport()->repaint( false );
1322 mAllDayAgenda->viewport()->repaint( false ); 1322 mAllDayAgenda->viewport()->repaint( false );
1323 mAgenda->finishUpdate(); 1323 mAgenda->finishUpdate();
1324 mAllDayAgenda->finishUpdate(); 1324 mAllDayAgenda->finishUpdate();
1325} 1325}
1326 1326
1327 1327
1328void KOAgendaView::clearView() 1328void KOAgendaView::clearView()
1329{ 1329{
1330 // kdDebug() << "ClearView" << endl; 1330 // kdDebug() << "ClearView" << endl;
1331 mAllDayAgenda->clear(); 1331 mAllDayAgenda->clear();
1332 mAgenda->clear(); 1332 mAgenda->clear();
1333} 1333}
1334void KOAgendaView::clearList()
1335{
1336 // kdDebug() << "ClearView" << endl;
1337 clearView();
1338 mAllDayAgenda->hideUnused();
1339 mAgenda->hideUnused();
1340}
1334 1341
1335void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1342void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1336 const QDate &td) 1343 const QDate &td)
1337{ 1344{
1338#ifndef KORG_NOPRINTER 1345#ifndef KORG_NOPRINTER
1339 if (fd == td) 1346 if (fd == td)
1340 calPrinter->preview(CalPrinter::Day, fd, td); 1347 calPrinter->preview(CalPrinter::Day, fd, td);
1341 else 1348 else
1342 calPrinter->preview(CalPrinter::Week, fd, td); 1349 calPrinter->preview(CalPrinter::Week, fd, td);
1343#endif 1350#endif
1344} 1351}
1345 1352
1346// void KOAgendaView::updateMovedTodo() 1353// void KOAgendaView::updateMovedTodo()
1347// { 1354// {
1348// // updateConfig(); 1355// // updateConfig();
1349// // emit updateTodoViews(); 1356// // emit updateTodoViews();
1350// } 1357// }
1351 1358
1352void KOAgendaView::slotShowDateView( int mode , int d ) 1359void KOAgendaView::slotShowDateView( int mode , int d )
1353{ 1360{
1354 if ( d >= mSelectedDates.count() ) { 1361 if ( d >= mSelectedDates.count() ) {
1355 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); 1362 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
1356 1363
1357 } else { 1364 } else {
1358 QDate day = mSelectedDates[d]; 1365 QDate day = mSelectedDates[d];
1359 emit showDateView(mode , day ); 1366 emit showDateView(mode , day );
1360 } 1367 }
1361 1368
1362} 1369}
1363void KOAgendaView::newEvent(int gx, int gy) 1370void KOAgendaView::newEvent(int gx, int gy)
1364{ 1371{
1365 if (!mSelectedDates.count()) return; 1372 if (!mSelectedDates.count()) return;
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index c6e6602..cc953fc 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -137,64 +137,65 @@ class EventIndicator : public QFrame {
137 Location mLocation; 137 Location mLocation;
138 QPixmap mPixmap; 138 QPixmap mPixmap;
139 QMemArray<bool> mEnabled; 139 QMemArray<bool> mEnabled;
140}; 140};
141 141
142/** 142/**
143 KOAgendaView is the agenda-like view used to display events in an one or 143 KOAgendaView is the agenda-like view used to display events in an one or
144 multi-day view. 144 multi-day view.
145*/ 145*/
146class KOAgendaView : public KOEventView { 146class KOAgendaView : public KOEventView {
147 Q_OBJECT 147 Q_OBJECT
148 public: 148 public:
149 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); 149 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
150 virtual ~KOAgendaView(); 150 virtual ~KOAgendaView();
151 void setStartHour( int ); 151 void setStartHour( int );
152 void toggleAllDay(); 152 void toggleAllDay();
153 153
154 154
155 /** Returns maximum number of days supported by the koagendaview */ 155 /** Returns maximum number of days supported by the koagendaview */
156 virtual int maxDatesHint(); 156 virtual int maxDatesHint();
157 157
158 /** Returns number of currently shown dates. */ 158 /** Returns number of currently shown dates. */
159 virtual int currentDateCount(); 159 virtual int currentDateCount();
160 160
161 /** returns the currently selected events */ 161 /** returns the currently selected events */
162 virtual QPtrList<Incidence> selectedIncidences(); 162 virtual QPtrList<Incidence> selectedIncidences();
163 163
164 /** returns the currently selected events */ 164 /** returns the currently selected events */
165 virtual DateList selectedDates(); 165 virtual DateList selectedDates();
166 166
167 /** Remove all events from view */ 167 /** Remove all events from view */
168 void clearView(); 168 void clearView();
169 void clearList();
169 KOAgenda *agenda() { return mAgenda;} 170 KOAgenda *agenda() { return mAgenda;}
170 virtual void printPreview(CalPrinter *calPrinter, 171 virtual void printPreview(CalPrinter *calPrinter,
171 const QDate &, const QDate &); 172 const QDate &, const QDate &);
172 173
173 /** start-datetime of selection */ 174 /** start-datetime of selection */
174 QDateTime selectionStart() {return mTimeSpanBegin;} 175 QDateTime selectionStart() {return mTimeSpanBegin;}
175 /** end-datetime of selection */ 176 /** end-datetime of selection */
176 QDateTime selectionEnd() {return mTimeSpanEnd;} 177 QDateTime selectionEnd() {return mTimeSpanEnd;}
177 /** returns true if selection is for whole day */ 178 /** returns true if selection is for whole day */
178 bool selectedIsAllDay() {return mTimeSpanInAllDay;} 179 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
179 /** make selected start/end invalid */ 180 /** make selected start/end invalid */
180 void deleteSelectedDateTime(); 181 void deleteSelectedDateTime();
181 void repaintAgenda(); 182 void repaintAgenda();
182 public slots: 183 public slots:
183 void setInitStartHour(); 184 void setInitStartHour();
184 virtual void updateView(); 185 virtual void updateView();
185 virtual void updateConfig(); 186 virtual void updateConfig();
186 virtual void showDates(const QDate &start, const QDate &end); 187 virtual void showDates(const QDate &start, const QDate &end);
187 virtual void showEvents(QPtrList<Event> eventList); 188 virtual void showEvents(QPtrList<Event> eventList);
188 189
189 void updateTodo( Todo *, int ); 190 void updateTodo( Todo *, int );
190 void changeEventDisplay(Event *, int); 191 void changeEventDisplay(Event *, int);
191 192
192 void clearSelection(); 193 void clearSelection();
193 194
194 void newTodo(int gx,int gy); 195 void newTodo(int gx,int gy);
195 void newEvent(int gx,int gy); 196 void newEvent(int gx,int gy);
196 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 197 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
197 void newEventAllDay(int gx, int gy); 198 void newEventAllDay(int gx, int gy);
198 void newTodoAllDay(int gx, int gy); 199 void newTodoAllDay(int gx, int gy);
199 200
200 void startDrag(Event *); 201 void startDrag(Event *);
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 6e6a939..bc16037 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -49,64 +49,68 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
49 connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 49 connect ( mEntry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
50} 50}
51 51
52KOJournalView::~KOJournalView() 52KOJournalView::~KOJournalView()
53{ 53{
54} 54}
55 55
56int KOJournalView::currentDateCount() 56int KOJournalView::currentDateCount()
57{ 57{
58 return 0; 58 return 0;
59} 59}
60 60
61QPtrList<Incidence> KOJournalView::selectedIncidences() 61QPtrList<Incidence> KOJournalView::selectedIncidences()
62{ 62{
63 QPtrList<Incidence> eventList; 63 QPtrList<Incidence> eventList;
64 64
65 return eventList; 65 return eventList;
66} 66}
67void KOJournalView::updateConfig() 67void KOJournalView::updateConfig()
68{ 68{
69 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 69 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
70} 70}
71void KOJournalView::updateView() 71void KOJournalView::updateView()
72{ 72{
73 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 73 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
74} 74}
75 75
76void KOJournalView::flushView() 76void KOJournalView::flushView()
77{ 77{
78 mEntry->flushEntry(); 78 mEntry->flushEntry();
79} 79}
80 80
81void KOJournalView::clearList()
82{
83 mEntry->clear();
84}
81void KOJournalView::showDates(const QDate &start, const QDate &) 85void KOJournalView::showDates(const QDate &start, const QDate &)
82{ 86{
83// kdDebug() << "KOJournalView::selectDates()" << endl; 87// kdDebug() << "KOJournalView::selectDates()" << endl;
84 88
85 mEntry->setDate(start); 89 mEntry->setDate(start);
86 90
87 Journal *j = calendar()->journal(start); 91 Journal *j = calendar()->journal(start);
88 if (j) mEntry->setJournal(j); 92 if (j) mEntry->setJournal(j);
89 else mEntry->clear(); 93 else mEntry->clear();
90 94
91// emit incidenceSelected( 0 ); 95// emit incidenceSelected( 0 );
92} 96}
93 97
94void KOJournalView::showEvents(QPtrList<Event>) 98void KOJournalView::showEvents(QPtrList<Event>)
95{ 99{
96 // After new creation of list view no events are selected. 100 // After new creation of list view no events are selected.
97// emit incidenceSelected( 0 ); 101// emit incidenceSelected( 0 );
98} 102}
99 103
100void KOJournalView::changeEventDisplay(Event *, int /*action*/) 104void KOJournalView::changeEventDisplay(Event *, int /*action*/)
101{ 105{
102 updateView(); 106 updateView();
103} 107}
104 108
105void KOJournalView::keyPressEvent ( QKeyEvent * e ) 109void KOJournalView::keyPressEvent ( QKeyEvent * e )
106{ 110{
107 //qDebug("keyPressEven "); 111 //qDebug("keyPressEven ");
108 if ( e->state() == Qt::ControlButton ) { 112 if ( e->state() == Qt::ControlButton ) {
109 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left ) 113 if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
110 e->ignore(); 114 e->ignore();
111 } 115 }
112} 116}
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index 1c0be82..445f940 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -14,54 +14,55 @@
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KOJOURNALVIEW_H 23#ifndef _KOJOURNALVIEW_H
24#define _KOJOURNALVIEW_H 24#define _KOJOURNALVIEW_H
25 25
26#include <korganizer/baseview.h> 26#include <korganizer/baseview.h>
27 27
28class JournalEntry; 28class JournalEntry;
29 29
30/** 30/**
31 * This class provides a journal view. 31 * This class provides a journal view.
32 32
33 * @short View for Journal components. 33 * @short View for Journal components.
34 * @author Cornelius Schumacher <schumacher@kde.org> 34 * @author Cornelius Schumacher <schumacher@kde.org>
35 * @see KOBaseView 35 * @see KOBaseView
36 */ 36 */
37class KOJournalView : public KOrg::BaseView 37class KOJournalView : public KOrg::BaseView
38{ 38{
39 Q_OBJECT 39 Q_OBJECT
40 public: 40 public:
41 KOJournalView(Calendar *calendar, QWidget *parent = 0, 41 KOJournalView(Calendar *calendar, QWidget *parent = 0,
42 const char *name = 0); 42 const char *name = 0);
43 ~KOJournalView(); 43 ~KOJournalView();
44 44
45 virtual int currentDateCount(); 45 virtual int currentDateCount();
46 void clearList();
46 virtual QPtrList<Incidence> selectedIncidences(); 47 virtual QPtrList<Incidence> selectedIncidences();
47 DateList selectedDates() 48 DateList selectedDates()
48 {DateList q; 49 {DateList q;
49 return q;}; 50 return q;};
50 signals: 51 signals:
51 void deleteJournal(Journal *); 52 void deleteJournal(Journal *);
52 public slots: 53 public slots:
53 void updateView(); 54 void updateView();
54 void flushView(); 55 void flushView();
55 void updateConfig(); 56 void updateConfig();
56 void showDates( const QDate &start, const QDate &end ); 57 void showDates( const QDate &start, const QDate &end );
57 void showEvents(QPtrList<Event> eventList); 58 void showEvents(QPtrList<Event> eventList);
58 59
59 void changeEventDisplay(Event *, int); 60 void changeEventDisplay(Event *, int);
60 61
61 private: 62 private:
62 JournalEntry *mEntry; 63 JournalEntry *mEntry;
63 void keyPressEvent ( QKeyEvent * ) ; 64 void keyPressEvent ( QKeyEvent * ) ;
64 65
65}; 66};
66 67
67#endif 68#endif
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 5f32e79..bc52281 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -334,64 +334,68 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
334 334
335 readSettings(KOGlobals::config(),"KOListView Layout"); 335 readSettings(KOGlobals::config(),"KOListView Layout");
336} 336}
337 337
338KOListView::~KOListView() 338KOListView::~KOListView()
339{ 339{
340 delete mPopupMenu; 340 delete mPopupMenu;
341#if QT_VERSION >= 0x030000 341#if QT_VERSION >= 0x030000
342 342
343#else 343#else
344 delete mKOListViewWhatsThis; 344 delete mKOListViewWhatsThis;
345#endif 345#endif
346} 346}
347 347
348QString KOListView::getWhatsThisText(QPoint p) 348QString KOListView::getWhatsThisText(QPoint p)
349{ 349{
350 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 350 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
351 if ( item ) 351 if ( item )
352 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 352 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
353 KOPrefs::instance()->mWTshowDetails, 353 KOPrefs::instance()->mWTshowDetails,
354 KOPrefs::instance()->mWTshowCreated, 354 KOPrefs::instance()->mWTshowCreated,
355 KOPrefs::instance()->mWTshowChanged); 355 KOPrefs::instance()->mWTshowChanged);
356 return i18n("That is the list view" ); 356 return i18n("That is the list view" );
357 357
358} 358}
359 359
360void KOListView::updateList() 360void KOListView::updateList()
361{ 361{
362 // qDebug(" KOListView::updateList() "); 362 // qDebug(" KOListView::updateList() ");
363 363
364} 364}
365 365
366void KOListView::clearList()
367{
368 clear ();
369}
366void KOListView::addCat( ) 370void KOListView::addCat( )
367{ 371{
368 setCategories( false ); 372 setCategories( false );
369} 373}
370void KOListView::setCat() 374void KOListView::setCat()
371{ 375{
372 setCategories( true ); 376 setCategories( true );
373} 377}
374void KOListView::setAlarm() 378void KOListView::setAlarm()
375{ 379{
376 KOAlarmPrefs kap( this); 380 KOAlarmPrefs kap( this);
377 if ( !kap.exec() ) 381 if ( !kap.exec() )
378 return; 382 return;
379 QStringList itemList; 383 QStringList itemList;
380 QPtrList<KOListViewItem> sel ; 384 QPtrList<KOListViewItem> sel ;
381 QListViewItem *qitem = mListView->firstChild (); 385 QListViewItem *qitem = mListView->firstChild ();
382 while ( qitem ) { 386 while ( qitem ) {
383 if ( qitem->isSelected() ) { 387 if ( qitem->isSelected() ) {
384 Incidence* inc = ((KOListViewItem *) qitem)->data(); 388 Incidence* inc = ((KOListViewItem *) qitem)->data();
385 if ( inc->type() != "Journal" ) { 389 if ( inc->type() != "Journal" ) {
386 if ( inc->type() == "Todo" ) { 390 if ( inc->type() == "Todo" ) {
387 if ( ((Todo*)inc)->hasDueDate() ) 391 if ( ((Todo*)inc)->hasDueDate() )
388 sel.append(((KOListViewItem *)qitem)); 392 sel.append(((KOListViewItem *)qitem));
389 } else 393 } else
390 sel.append(((KOListViewItem *)qitem)); 394 sel.append(((KOListViewItem *)qitem));
391 } 395 }
392 } 396 }
393 qitem = qitem->nextSibling(); 397 qitem = qitem->nextSibling();
394 } 398 }
395 int count = 0; 399 int count = 0;
396 KOListViewItem * item, *temp; 400 KOListViewItem * item, *temp;
397 item = sel.first(); 401 item = sel.first();
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index dee69f6..f4d6879 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -228,64 +228,65 @@ class KOListViewListView : public KListView
228 int mYMousePos; 228 int mYMousePos;
229 void keyPressEvent ( QKeyEvent * ) ; 229 void keyPressEvent ( QKeyEvent * ) ;
230 void contentsMouseDoubleClickEvent(QMouseEvent *e); 230 void contentsMouseDoubleClickEvent(QMouseEvent *e);
231 void contentsMousePressEvent(QMouseEvent *e); 231 void contentsMousePressEvent(QMouseEvent *e);
232 void contentsMouseReleaseEvent(QMouseEvent *e); 232 void contentsMouseReleaseEvent(QMouseEvent *e);
233 void contentsMouseMoveEvent(QMouseEvent *e); 233 void contentsMouseMoveEvent(QMouseEvent *e);
234 bool mMouseDown; 234 bool mMouseDown;
235}; 235};
236 236
237class KOListView : public KOEventView 237class KOListView : public KOEventView
238{ 238{
239 Q_OBJECT 239 Q_OBJECT
240 public: 240 public:
241 KOListView(Calendar *calendar, QWidget *parent = 0, 241 KOListView(Calendar *calendar, QWidget *parent = 0,
242 const char *name = 0); 242 const char *name = 0);
243 ~KOListView(); 243 ~KOListView();
244 244
245 virtual int maxDatesHint(); 245 virtual int maxDatesHint();
246 virtual int currentDateCount(); 246 virtual int currentDateCount();
247 virtual QPtrList<Incidence> selectedIncidences(); 247 virtual QPtrList<Incidence> selectedIncidences();
248 virtual DateList selectedDates(); 248 virtual DateList selectedDates();
249 249
250 void showDates(bool show); 250 void showDates(bool show);
251 Incidence* currentItem(); 251 Incidence* currentItem();
252 void addTodos(QPtrList<Todo> eventList); 252 void addTodos(QPtrList<Todo> eventList);
253 void addJournals(QPtrList<Journal> eventList); 253 void addJournals(QPtrList<Journal> eventList);
254 virtual void printPreview(CalPrinter *calPrinter, 254 virtual void printPreview(CalPrinter *calPrinter,
255 const QDate &, const QDate &); 255 const QDate &, const QDate &);
256 256
257 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 257 void readSettings(KConfig *config, QString setting = "KOListView Layout");
258 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 258 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
259 void updateList(); 259 void updateList();
260 void clearList();
260 void setStartDate(const QDate &start); 261 void setStartDate(const QDate &start);
261 int count(); 262 int count();
262 QString getWhatsThisText(QPoint p); 263 QString getWhatsThisText(QPoint p);
263 signals: 264 signals:
264 void signalNewEvent(); 265 void signalNewEvent();
265 void beamIncidenceList(QPtrList<Incidence>); 266 void beamIncidenceList(QPtrList<Incidence>);
266 267
267 public slots: 268 public slots:
268 void resetFocus(); 269 void resetFocus();
269 virtual void updateView(); 270 virtual void updateView();
270 virtual void showDates(const QDate &start, const QDate &end); 271 virtual void showDates(const QDate &start, const QDate &end);
271 virtual void showEvents(QPtrList<Event> eventList); 272 virtual void showEvents(QPtrList<Event> eventList);
272 void clearSelection(); 273 void clearSelection();
273 void allSelection(); 274 void allSelection();
274 275
275 void clear(); 276 void clear();
276 void beamDone( Ir *ir ); 277 void beamDone( Ir *ir );
277 void showDates(); 278 void showDates();
278 void hideDates(); 279 void hideDates();
279 void deleteAll(); 280 void deleteAll();
280 void saveToFile(); 281 void saveToFile();
281 void saveToFileVCS(); 282 void saveToFileVCS();
282 void saveDescriptionToFile(); 283 void saveDescriptionToFile();
283 void beamSelected(); 284 void beamSelected();
284 void updateConfig(); 285 void updateConfig();
285 void addCat(); 286 void addCat();
286 void setCat(); 287 void setCat();
287 void setAlarm(); 288 void setAlarm();
288 void setCategories( bool removeOld ); 289 void setCategories( bool removeOld );
289 void changeEventDisplay(Event *, int); 290 void changeEventDisplay(Event *, int);
290 291
291 void defaultItemAction(QListViewItem *item); 292 void defaultItemAction(QListViewItem *item);
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 8ee1363..678cab6 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1386,64 +1386,74 @@ void KOMonthView::updateConfig()
1386} 1386}
1387 1387
1388void KOMonthView::updateDayLabels() 1388void KOMonthView::updateDayLabels()
1389{ 1389{
1390 1390
1391 QPtrVector<QLabel> *mDayLabelsT; 1391 QPtrVector<QLabel> *mDayLabelsT;
1392 1392
1393 mDayLabelsT = &mDayLabelsW; 1393 mDayLabelsT = &mDayLabelsW;
1394 for (int i = 0; i < 7; i++) { 1394 for (int i = 0; i < 7; i++) {
1395 { 1395 {
1396 bool show = mShortDayLabelsW; 1396 bool show = mShortDayLabelsW;
1397 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1397 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1398 show = true; 1398 show = true;
1399 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1399 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1400 } 1400 }
1401 } 1401 }
1402 mDayLabelsT = &mDayLabels; 1402 mDayLabelsT = &mDayLabels;
1403 for (int i = 0; i < 7; i++) { 1403 for (int i = 0; i < 7; i++) {
1404 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { 1404 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1405 bool show = mShortDayLabelsM; 1405 bool show = mShortDayLabelsM;
1406 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1406 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1407 show = true; 1407 show = true;
1408 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1408 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1409 } else { 1409 } else {
1410 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1410 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1411 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1411 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1412 1412
1413 } 1413 }
1414 } 1414 }
1415 1415
1416} 1416}
1417 1417
1418void KOMonthView::clearList()
1419{
1420 unsigned int i;
1421 for( i = 0; i < mCells.size(); ++i ) {
1422 mCells[i]->clear();
1423 }
1424 for( i = 0; i < mCellsW.size(); ++i ) {
1425 mCellsW[i]->clear();
1426 }
1427}
1418void KOMonthView::showDates(const QDate &start, const QDate &) 1428void KOMonthView::showDates(const QDate &start, const QDate &)
1419{ 1429{
1420 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1430 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1421 1431
1422 QPtrVector<MonthViewCell> *cells; 1432 QPtrVector<MonthViewCell> *cells;
1423 QPtrVector<QLabel> *dayLabels; 1433 QPtrVector<QLabel> *dayLabels;
1424 QPtrVector<KOWeekButton> *weekLabels; 1434 QPtrVector<KOWeekButton> *weekLabels;
1425 int weekNum = 6; 1435 int weekNum = 6;
1426 mStartDate = start; 1436 mStartDate = start;
1427 if ( mShowWeekView ) { 1437 if ( mShowWeekView ) {
1428 weekNum = 1; 1438 weekNum = 1;
1429 cells = &mCellsW; 1439 cells = &mCellsW;
1430 dayLabels = &mDayLabelsW; 1440 dayLabels = &mDayLabelsW;
1431 weekLabels = &mWeekLabelsW; 1441 weekLabels = &mWeekLabelsW;
1432 if ( !KGlobal::locale()->weekStartsMonday() ) { 1442 if ( !KGlobal::locale()->weekStartsMonday() ) {
1433 mStartDate = mStartDate.addDays( 1 ); 1443 mStartDate = mStartDate.addDays( 1 );
1434 } 1444 }
1435 } else { 1445 } else {
1436 cells = &mCells; 1446 cells = &mCells;
1437 dayLabels = &mDayLabels; 1447 dayLabels = &mDayLabels;
1438 weekLabels = &mWeekLabels; 1448 weekLabels = &mWeekLabels;
1439 } 1449 }
1440 1450
1441 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1451 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1442 1452
1443 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1453 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1444 mWeekStartsMonday = true; 1454 mWeekStartsMonday = true;
1445 } 1455 }
1446 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1456 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1447 1457
1448 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1458 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1449 mStartDate = mStartDate.addDays( -1 ); 1459 mStartDate = mStartDate.addDays( -1 );
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index de5c014..65b5e77 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -227,64 +227,65 @@ public slots:
227 QPalette getPalette (); 227 QPalette getPalette ();
228 228
229}; 229};
230 230
231 231
232class KOMonthView: public KOEventView 232class KOMonthView: public KOEventView
233{ 233{
234 Q_OBJECT 234 Q_OBJECT
235 public: 235 public:
236 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 236 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
237 ~KOMonthView(); 237 ~KOMonthView();
238 238
239 /** Returns maximum number of days supported by the komonthview */ 239 /** Returns maximum number of days supported by the komonthview */
240 virtual int maxDatesHint(); 240 virtual int maxDatesHint();
241 241
242 /** Returns number of currently shown dates. */ 242 /** Returns number of currently shown dates. */
243 virtual int currentDateCount(); 243 virtual int currentDateCount();
244 244
245 /** returns the currently selected events */ 245 /** returns the currently selected events */
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 247
248 /** returns dates of the currently selected events */ 248 /** returns dates of the currently selected events */
249 virtual DateList selectedDates(); 249 virtual DateList selectedDates();
250 250
251 virtual void printPreview(CalPrinter *calPrinter, 251 virtual void printPreview(CalPrinter *calPrinter,
252 const QDate &, const QDate &); 252 const QDate &, const QDate &);
253 bool isMonthView() { return !mShowWeekView; } 253 bool isMonthView() { return !mShowWeekView; }
254 bool isUpdatePossible() { return updatePossible; } 254 bool isUpdatePossible() { return updatePossible; }
255 255
256 MonthViewCell * selectedCell(); 256 MonthViewCell * selectedCell();
257 bool skipResize; 257 bool skipResize;
258 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 258 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
259 void clearList();
259 public slots: 260 public slots:
260 void nextCell(); 261 void nextCell();
261 void prevCell(); 262 void prevCell();
262 virtual void updateView(); 263 virtual void updateView();
263 virtual void updateConfig(); 264 virtual void updateConfig();
264 virtual void showDates(const QDate &start, const QDate &end); 265 virtual void showDates(const QDate &start, const QDate &end);
265 virtual void showEvents(QPtrList<Event> eventList); 266 virtual void showEvents(QPtrList<Event> eventList);
266 267
267 void changeEventDisplay(Event *, int); 268 void changeEventDisplay(Event *, int);
268 269
269 void clearSelection(); 270 void clearSelection();
270 271
271 void showContextMenu( Incidence * ); 272 void showContextMenu( Incidence * );
272 273
273 void setSelectedCell( MonthViewCell * ); 274 void setSelectedCell( MonthViewCell * );
274 void setPopupCell( MonthViewCell * ); 275 void setPopupCell( MonthViewCell * );
275 void switchView(); 276 void switchView();
276 void setKeyBoardFocus(); 277 void setKeyBoardFocus();
277 void setKeyBFocus(); 278 void setKeyBFocus();
278 279
279 protected slots: 280 protected slots:
280 void slotNewTodo(); 281 void slotNewTodo();
281 void slotNewEvent(); 282 void slotNewEvent();
282 void slotEditJournal(); 283 void slotEditJournal();
283 void slotComputeLayout(); 284 void slotComputeLayout();
284 void selectInternalWeekNum ( int ); 285 void selectInternalWeekNum ( int );
285 void processSelectionChange(); 286 void processSelectionChange();
286 signals: 287 signals:
287 void nextMonth(); 288 void nextMonth();
288 void prevMonth(); 289 void prevMonth();
289 void selectWeekNum ( int ); 290 void selectWeekNum ( int );
290 void selectMonth (); 291 void selectMonth ();
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index fb4de37..5d9af6d 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -329,64 +329,76 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
329 mMainView->leftFrame()->show(); 329 mMainView->leftFrame()->show();
330 } 330 }
331 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 331 //if ( mCurrentView == mMonthView ) qApp->processEvents();
332 emit signalFullScreen( !fullScreen ); 332 emit signalFullScreen( !fullScreen );
333 if ( callUpdateView ) 333 if ( callUpdateView )
334 mMainView->updateView(); 334 mMainView->updateView();
335 335
336 if ( globalFlagBlockAgenda == 5 ) { 336 if ( globalFlagBlockAgenda == 5 ) {
337 globalFlagBlockAgenda = 4; 337 globalFlagBlockAgenda = 4;
338 globalFlagBlockAgendaItemPaint = 1; 338 globalFlagBlockAgendaItemPaint = 1;
339 } 339 }
340 mMainView->viewStack()->raiseWidget(mCurrentView); 340 mMainView->viewStack()->raiseWidget(mCurrentView);
341 if ( globalFlagBlockAgenda == 4 ) { 341 if ( globalFlagBlockAgenda == 4 ) {
342 if ( mCurrentView == mAgendaView ) { 342 if ( mCurrentView == mAgendaView ) {
343 //globalFlagBlockAgenda =1 ; 343 //globalFlagBlockAgenda =1 ;
344 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 344 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
345 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 345 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
346 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 346 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
347 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 347 mAgendaView->setStartHour( QTime::currentTime ().hour() );
348 qApp->processEvents(); 348 qApp->processEvents();
349 //qDebug("qApp->processEvents() "); 349 //qDebug("qApp->processEvents() ");
350 globalFlagBlockAgenda = 0; 350 globalFlagBlockAgenda = 0;
351 mAgendaView->repaintAgenda(); 351 mAgendaView->repaintAgenda();
352 352
353 } 353 }
354 globalFlagBlockAgenda = 0; 354 globalFlagBlockAgenda = 0;
355 } 355 }
356 emit signalAgendaView( mCurrentView == mAgendaView ); 356 emit signalAgendaView( mCurrentView == mAgendaView );
357 //qDebug("raiseCurrentView ende "); 357 //qDebug("raiseCurrentView ende ");
358 358
359} 359}
360 360
361void KOViewManager::clearAllViews()
362{
363
364 if ( mTodoView ) mTodoView->clearList();
365 if ( mListView ) mListView->clearList();
366
367 if ( mAgendaView ) mAgendaView->clearList();
368 if ( mMonthView ) mMonthView->clearList();
369 if ( mWhatsNextView ) mWhatsNextView->clearList();
370 if ( mJournalView ) mJournalView->clearList();
371
372}
361void KOViewManager::updateView() 373void KOViewManager::updateView()
362{ 374{
363 // qDebug("KOViewManager::updateView() "); 375 // qDebug("KOViewManager::updateView() ");
364 // if we are updating mTodoView, we get endless recursion 376 // if we are updating mTodoView, we get endless recursion
365 if ( mTodoView == mCurrentView ) 377 if ( mTodoView == mCurrentView )
366 return; 378 return;
367 if ( mCurrentView ) mCurrentView->updateView(); 379 if ( mCurrentView ) mCurrentView->updateView();
368 380
369} 381}
370 382
371void KOViewManager::updateView(const QDate &start, const QDate &end) 383void KOViewManager::updateView(const QDate &start, const QDate &end)
372{ 384{
373 // kdDebug() << "KOViewManager::updateView()" << endl; 385 // kdDebug() << "KOViewManager::updateView()" << endl;
374 386
375 if (mCurrentView) mCurrentView->showDates(start, end); 387 if (mCurrentView) mCurrentView->showDates(start, end);
376 388
377 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 389 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
378} 390}
379 391
380 392
381void KOViewManager::updateWNview() 393void KOViewManager::updateWNview()
382{ 394{
383 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 395 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
384 mWhatsNextView->updateView(); 396 mWhatsNextView->updateView();
385 if ( mCurrentView == mMonthView && mMonthView ) 397 if ( mCurrentView == mMonthView && mMonthView )
386 mMonthView->updateView(); 398 mMonthView->updateView();
387 399
388} 400}
389void KOViewManager::showWhatsNextView() 401void KOViewManager::showWhatsNextView()
390{ 402{
391 if (!mWhatsNextView) { 403 if (!mWhatsNextView) {
392 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 404 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
@@ -803,36 +815,35 @@ void KOViewManager::showTimeSpanView()
803Incidence *KOViewManager::currentSelection() 815Incidence *KOViewManager::currentSelection()
804{ 816{
805 if (!mCurrentView) return 0; 817 if (!mCurrentView) return 0;
806 if ( mCurrentView == mListView ) { 818 if ( mCurrentView == mListView ) {
807 if ( mListView->currentItem() ) 819 if ( mListView->currentItem() )
808 return mListView->currentItem(); 820 return mListView->currentItem();
809 } 821 }
810 return mCurrentView->selectedIncidences().first(); 822 return mCurrentView->selectedIncidences().first();
811} 823}
812 824
813QDate KOViewManager::currentSelectionDate() 825QDate KOViewManager::currentSelectionDate()
814{ 826{
815 QDate qd; 827 QDate qd;
816 if (mCurrentView) { 828 if (mCurrentView) {
817 DateList qvl = mCurrentView->selectedDates(); 829 DateList qvl = mCurrentView->selectedDates();
818 if (!qvl.isEmpty()) qd = qvl.first(); 830 if (!qvl.isEmpty()) qd = qvl.first();
819 } 831 }
820 return qd; 832 return qd;
821} 833}
822 834
823void KOViewManager::addView(KOrg::BaseView *view) 835void KOViewManager::addView(KOrg::BaseView *view)
824{ 836{
825#if QT_VERSION >= 0x030000 837#if QT_VERSION >= 0x030000
826 mMainView->viewStack()->addWidget( view ); 838 mMainView->viewStack()->addWidget( view );
827#else 839#else
828 mMainView->viewStack()->addWidget( view, 1 ); 840 mMainView->viewStack()->addWidget( view, 1 );
829#endif 841#endif
830} 842}
831 843
832void KOViewManager::setDocumentId( const QString &id ) 844void KOViewManager::setDocumentId( const QString &id )
833{ 845{
834 if (mTodoView) { 846 if (mTodoView) {
835 mTodoView->clearList();
836 mTodoView->setDocumentId( id ); 847 mTodoView->setDocumentId( id );
837 } 848 }
838} 849}
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 8dc03e0..838583b 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -38,64 +38,65 @@ class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 void updateWNview(); 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView( const QDate &start, const QDate &end ); 69 void updateView( const QDate &start, const QDate &end );
70 void clearAllViews();
70 71
71 void raiseCurrentView( bool fullScreen = false , bool updateView = false); 72 void raiseCurrentView( bool fullScreen = false , bool updateView = false);
72 73
73 void addView(KOrg::BaseView *); 74 void addView(KOrg::BaseView *);
74 75
75 Incidence *currentSelection(); 76 Incidence *currentSelection();
76 QDate currentSelectionDate(); 77 QDate currentSelectionDate();
77 78
78 KOAgendaView *agendaView() const { return mAgendaView; } 79 KOAgendaView *agendaView() const { return mAgendaView; }
79 80
80 signals: 81 signals:
81 void printWNV(); 82 void printWNV();
82 void signalFullScreen( bool ); 83 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 84 void signalAgendaView( bool );
84 public slots: 85 public slots:
85 void slotprintWNV(); 86 void slotprintWNV();
86 void showNextView(); 87 void showNextView();
87 void showMonth( const QDate & ); 88 void showMonth( const QDate & );
88 void showDateView( int, QDate ); 89 void showDateView( int, QDate );
89 void updateView(); 90 void updateView();
90 void showWhatsNextView(); 91 void showWhatsNextView();
91 void showListView(); 92 void showListView();
92 void showAgendaView( bool fullScreen = false ); 93 void showAgendaView( bool fullScreen = false );
93 void showDayView(); 94 void showDayView();
94 void showWorkWeekView(); 95 void showWorkWeekView();
95 void showWeekView(); 96 void showWeekView();
96 void showNextXView(); 97 void showNextXView();
97 void showMonthView(); 98 void showMonthView();
98 void showMonthViewWeek(); 99 void showMonthViewWeek();
99 void showTodoView(); 100 void showTodoView();
100 void showJournalView(); 101 void showJournalView();
101 void showTimeSpanView(); 102 void showTimeSpanView();
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 65d8ac3..62d7ede 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -110,64 +110,69 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
110 style->setMargin(QStyleSheetItem::MarginAll,0); 110 style->setMargin(QStyleSheetItem::MarginAll,0);
111 } 111 }
112 style = stsh->item ("h3" ); 112 style = stsh->item ("h3" );
113 if ( style ) { 113 if ( style ) {
114 style->setMargin(QStyleSheetItem::MarginAll,0); 114 style->setMargin(QStyleSheetItem::MarginAll,0);
115 } 115 }
116 mEventViewer = 0; 116 mEventViewer = 0;
117 117
118 QBoxLayout *topLayout = new QVBoxLayout(this); 118 QBoxLayout *topLayout = new QVBoxLayout(this);
119 // topLayout->addWidget(mDateLabel); 119 // topLayout->addWidget(mDateLabel);
120 topLayout->addWidget(mView); 120 topLayout->addWidget(mView);
121 mTimer = new QTimer( this ); 121 mTimer = new QTimer( this );
122 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 122 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
123 123
124 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 124 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
125 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 125 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
126} 126}
127 127
128KOWhatsNextView::~KOWhatsNextView() 128KOWhatsNextView::~KOWhatsNextView()
129{ 129{
130} 130}
131 131
132int KOWhatsNextView::maxDatesHint() 132int KOWhatsNextView::maxDatesHint()
133{ 133{
134 return 0; 134 return 0;
135} 135}
136 136
137int KOWhatsNextView::currentDateCount() 137int KOWhatsNextView::currentDateCount()
138{ 138{
139 return 0; 139 return 0;
140} 140}
141 141
142void KOWhatsNextView::clearList()
143{
144 mTimer->stop();
145 mView->setText(" ");
146}
142QPtrList<Incidence> KOWhatsNextView::selectedIncidences() 147QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
143{ 148{
144 QPtrList<Incidence> eventList; 149 QPtrList<Incidence> eventList;
145 150
146 return eventList; 151 return eventList;
147} 152}
148 153
149void KOWhatsNextView::printMe() 154void KOWhatsNextView::printMe()
150{ 155{
151#ifdef DESKTOP_VERSION 156#ifdef DESKTOP_VERSION
152 mView->printMe(); 157 mView->printMe();
153#endif 158#endif
154} 159}
155void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, 160void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
156 const QDate &td) 161 const QDate &td)
157{ 162{
158#ifndef KORG_NOPRINTER 163#ifndef KORG_NOPRINTER
159 calPrinter->preview(CalPrinter::Day, fd, td); 164 calPrinter->preview(CalPrinter::Day, fd, td);
160#endif 165#endif
161} 166}
162void KOWhatsNextView::updateConfig() 167void KOWhatsNextView::updateConfig()
163{ 168{
164 setFont( KOPrefs::instance()->mWhatsNextFont ); 169 setFont( KOPrefs::instance()->mWhatsNextFont );
165 updateView(); 170 updateView();
166 171
167} 172}
168void KOWhatsNextView::showEvent ( QShowEvent * e ) 173void KOWhatsNextView::showEvent ( QShowEvent * e )
169{ 174{
170 //qDebug("KOWhatsNextView::showEvent "); 175 //qDebug("KOWhatsNextView::showEvent ");
171 restartTimer(); 176 restartTimer();
172 QWidget::showEvent ( e ); 177 QWidget::showEvent ( e );
173} 178}
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index d6727ac..93574ef 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -30,64 +30,65 @@ class QLabel;
30class KOEventViewerDialog; 30class KOEventViewerDialog;
31 31
32#include <qpainter.h> 32#include <qpainter.h>
33#include <qwidget.h> 33#include <qwidget.h>
34class WhatsNextTextBrowser : public QTextBrowser { 34class WhatsNextTextBrowser : public QTextBrowser {
35 Q_OBJECT 35 Q_OBJECT
36 public: 36 public:
37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}; 37 WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
38 38
39 void setSource(const QString &); 39 void setSource(const QString &);
40 void printMe(); 40 void printMe();
41 41
42 signals: 42 signals:
43 void showIncidence(const QString &uid); 43 void showIncidence(const QString &uid);
44}; 44};
45 45
46 46
47/** 47/**
48 This class provides a view of the next events and todos 48 This class provides a view of the next events and todos
49*/ 49*/
50class KOWhatsNextView : public KOrg::BaseView 50class KOWhatsNextView : public KOrg::BaseView
51{ 51{
52 Q_OBJECT 52 Q_OBJECT
53 public: 53 public:
54 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, 54 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
55 const char *name = 0); 55 const char *name = 0);
56 ~KOWhatsNextView(); 56 ~KOWhatsNextView();
57 57
58 virtual int maxDatesHint(); 58 virtual int maxDatesHint();
59 virtual int currentDateCount(); 59 virtual int currentDateCount();
60 void setEventViewer(KOEventViewerDialog* v ); 60 void setEventViewer(KOEventViewerDialog* v );
61 virtual QPtrList<Incidence> selectedIncidences(); 61 virtual QPtrList<Incidence> selectedIncidences();
62 void clearList();
62 DateList selectedDates() 63 DateList selectedDates()
63 {DateList q; 64 {DateList q;
64 return q;} 65 return q;}
65 virtual void printPreview(CalPrinter *calPrinter, 66 virtual void printPreview(CalPrinter *calPrinter,
66 const QDate &, const QDate &); 67 const QDate &, const QDate &);
67 68
68 public slots: 69 public slots:
69 virtual void updateView(); 70 virtual void updateView();
70 void printMe(); 71 void printMe();
71 virtual void showDates(const QDate &start, const QDate &end); 72 virtual void showDates(const QDate &start, const QDate &end);
72 virtual void showEvents(QPtrList<Event> eventList); 73 virtual void showEvents(QPtrList<Event> eventList);
73 void updateConfig(); 74 void updateConfig();
74 void changeEventDisplay(Event *, int); 75 void changeEventDisplay(Event *, int);
75 76
76 protected: 77 protected:
77 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); 78 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false);
78 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 79 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
79 void appendDay( int i, QDate date ); 80 void appendDay( int i, QDate date );
80 QDate mEventDate; 81 QDate mEventDate;
81 virtual void showEvent ( QShowEvent * ); 82 virtual void showEvent ( QShowEvent * );
82 virtual void hideEvent ( QHideEvent * ); 83 virtual void hideEvent ( QHideEvent * );
83 84
84 private slots: 85 private slots:
85 void showIncidence(const QString &); 86 void showIncidence(const QString &);
86 void restartTimer(); 87 void restartTimer();
87 88
88 89
89 private: 90 private:
90 int mCurrentMaxPrio; 91 int mCurrentMaxPrio;
91 //void createEventViewer(); 92 //void createEventViewer();
92 QTimer* mTimer; 93 QTimer* mTimer;
93 WhatsNextTextBrowser *mView; 94 WhatsNextTextBrowser *mView;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 63053a5..d959a7a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1641,64 +1641,65 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1641 1641
1642 mNewSubTodoAction->setEnabled( false ); 1642 mNewSubTodoAction->setEnabled( false );
1643 } else if ( incidence->type() == "Todo" ) { 1643 } else if ( incidence->type() == "Todo" ) {
1644 mShowAction->setText( i18n("Show Todo...") ); 1644 mShowAction->setText( i18n("Show Todo...") );
1645 mEditAction->setText( i18n("Edit Todo...") ); 1645 mEditAction->setText( i18n("Edit Todo...") );
1646 mDeleteAction->setText( i18n("Delete Todo...") ); 1646 mDeleteAction->setText( i18n("Delete Todo...") );
1647 1647
1648 mNewSubTodoAction->setEnabled( true ); 1648 mNewSubTodoAction->setEnabled( true );
1649 } else { 1649 } else {
1650 mShowAction->setText( i18n("Show...") ); 1650 mShowAction->setText( i18n("Show...") );
1651 mShowAction->setText( i18n("Edit...") ); 1651 mShowAction->setText( i18n("Edit...") );
1652 mShowAction->setText( i18n("Delete...") ); 1652 mShowAction->setText( i18n("Delete...") );
1653 1653
1654 mNewSubTodoAction->setEnabled( false ); 1654 mNewSubTodoAction->setEnabled( false );
1655 } 1655 }
1656} 1656}
1657 1657
1658void MainWindow::enableIncidenceActions( bool enabled ) 1658void MainWindow::enableIncidenceActions( bool enabled )
1659{ 1659{
1660 mShowAction->setEnabled( enabled ); 1660 mShowAction->setEnabled( enabled );
1661 mEditAction->setEnabled( enabled ); 1661 mEditAction->setEnabled( enabled );
1662 mDeleteAction->setEnabled( enabled ); 1662 mDeleteAction->setEnabled( enabled );
1663 1663
1664 mCloneAction->setEnabled( enabled ); 1664 mCloneAction->setEnabled( enabled );
1665 mMoveAction->setEnabled( enabled ); 1665 mMoveAction->setEnabled( enabled );
1666 mBeamAction->setEnabled( enabled ); 1666 mBeamAction->setEnabled( enabled );
1667 mCancelAction->setEnabled( enabled ); 1667 mCancelAction->setEnabled( enabled );
1668} 1668}
1669 1669
1670void MainWindow::importOL() 1670void MainWindow::importOL()
1671{ 1671{
1672#ifdef _OL_IMPORT_ 1672#ifdef _OL_IMPORT_
1673 mView->clearAllViews();
1673 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1674 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1674 id->exec(); 1675 id->exec();
1675 delete id; 1676 delete id;
1676 mView->updateView(); 1677 mView->updateView();
1677#endif 1678#endif
1678} 1679}
1679void MainWindow::importBday() 1680void MainWindow::importBday()
1680{ 1681{
1681 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1682 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1682 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1683 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1683 i18n("Import!"), i18n("Cancel"), 0, 1684 i18n("Import!"), i18n("Cancel"), 0,
1684 0, 1 ); 1685 0, 1 );
1685 if ( result == 0 ) { 1686 if ( result == 0 ) {
1686 mView->importBday(); 1687 mView->importBday();
1687 1688
1688 } 1689 }
1689 1690
1690 1691
1691} 1692}
1692void MainWindow::importQtopia() 1693void MainWindow::importQtopia()
1693{ 1694{
1694 //#ifndef DESKTOP_VERSION 1695 //#ifndef DESKTOP_VERSION
1695 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1696 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1696#ifdef DESKTOP_VERSION 1697#ifdef DESKTOP_VERSION
1697 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1698 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1698#endif 1699#endif
1699 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1700 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1700 i18n("Import!"), i18n("Cancel"), 0, 1701 i18n("Import!"), i18n("Cancel"), 0,
1701 0, 1 ); 1702 0, 1 );
1702 if ( result == 0 ) { 1703 if ( result == 0 ) {
1703#ifndef DESKTOP_VERSION 1704#ifndef DESKTOP_VERSION
1704 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1705 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");