summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/calendarview.cpp3
-rw-r--r--korganizer/mainwindow.cpp2
3 files changed, 6 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 322c0e6..0ebd853 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,139 +1,140 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3 3
4********** VERSION 2.1.8 ************ 4********** VERSION 2.1.8 ************
5 5
6KO/Pi: 6KO/Pi:
7Added info about the completion sate of a todo in the ListView/Searchdialog. 7Added info about the completion state of a todo in the ListView/Searchdialog.
8If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. 8If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well.
9Fixed some updating problems when changing the filter.
9 10
10KA/Pi: 11KA/Pi:
11In the addressee selection dialog now the formatted name is shown, if not empty. 12In the addressee selection dialog now the formatted name is shown, if not empty.
12 13
13Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. 14Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
14Fixed the sorting for size in the file selector on the Z. 15Fixed the sorting for size in the file selector on the Z.
15 16
16Changed the color selection dialog on the Zaurus to a more user friendly version. 17Changed the color selection dialog on the Zaurus to a more user friendly version.
17 18
18********** VERSION 2.1.7 ************ 19********** VERSION 2.1.7 ************
19 20
20KO/Pi: 21KO/Pi:
21Fixed several problems in the new Resource handling. 22Fixed several problems in the new Resource handling.
22Added more options to the search dialog. 23Added more options to the search dialog.
23Fixed a problem in the Month view. 24Fixed a problem in the Month view.
24Added more options to the dialog when setting a todo to stopped. 25Added more options to the dialog when setting a todo to stopped.
25 26
26Fixed two small problems in KO/PiAlarm applet. 27Fixed two small problems in KO/Pi Alarm applet.
27 28
28********** VERSION 2.1.6 ************ 29********** VERSION 2.1.6 ************
29 30
30This release is for testing only. 31This release is for testing only.
31 32
32KO/Pi: 33KO/Pi:
33Added to the list view (the list view is used in search dialog as well) the possibility to print it. 34Added to the list view (the list view is used in search dialog as well) the possibility to print it.
34Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. 35Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
35Added to the list view the possibility to add all subtodos of selected todos to an export/beam. 36Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
36Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. 37Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
37Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. 38Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
38Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. 39Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
39 40
40Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. 41Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars.
41In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. 42In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later.
42Now on every sync the set of calendars is synced which are enabled in the resource view. 43Now on every sync the set of calendars is synced which are enabled in the resource view.
43 44
44A calendar is enabled in the resource view if the "eye" column is checked. 45A calendar is enabled in the resource view if the "eye" column is checked.
45You can set a calendar to be the default for new items( "+" column ). 46You can set a calendar to be the default for new items( "+" column ).
46You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. 47You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly.
47To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... 48To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ...
48 49
49 50
50********** VERSION 2.1.5 ************ 51********** VERSION 2.1.5 ************
51 52
52This is the new stable version. 53This is the new stable version.
53Bugfix: 54Bugfix:
54Fixed a problem with agenda popup on the desktop in KO/Pi. 55Fixed a problem with agenda popup on the desktop in KO/Pi.
55Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. 56Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization.
56Added config option to not display completed todos in agenda view. 57Added config option to not display completed todos in agenda view.
57Addressee view is now using the formatted name, if defined. 58Addressee view is now using the formatted name, if defined.
58That makes it possible to display "lastname, firstname" in that view now. 59That makes it possible to display "lastname, firstname" in that view now.
59To set the formatted name for all contacts, please use menu: 60To set the formatted name for all contacts, please use menu:
60Edit->Change->Set formatted name. 61Edit->Change->Set formatted name.
61Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. 62Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows.
62 63
63********** VERSION 2.1.4 ************ 64********** VERSION 2.1.4 ************
64 65
65Fixed two more bugs in the KA/Pi CSV import dialog: 66Fixed two more bugs in the KA/Pi CSV import dialog:
66Made it possible to read multi-line fields and import it to the "Note" field. 67Made it possible to read multi-line fields and import it to the "Note" field.
67Fixed a problem in mapping custom fields, whatever a custem field is... 68Fixed a problem in mapping custom fields, whatever a custem field is...
68 69
69********** VERSION 2.1.3 ************ 70********** VERSION 2.1.3 ************
70 71
71Changed the menu structure of the alarm applet: 72Changed the menu structure of the alarm applet:
72Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". 73Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
73 74
74Fixed several problems in the KA/Pi CSV import dialog: 75Fixed several problems in the KA/Pi CSV import dialog:
75Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. 76Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
76 77
77 78
78********** VERSION 2.1.2 ************ 79********** VERSION 2.1.2 ************
79 80
80Fixed a problem closing the alarm dialog on Zaurus with "OK" button. 81Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
81 82
82Fixed a problem when importing data from Outlook with mutiple categories set. 83Fixed a problem when importing data from Outlook with mutiple categories set.
83 84
84Changed display of days in datenavigator: 85Changed display of days in datenavigator:
85Birthdays are now blue, not dark green. 86Birthdays are now blue, not dark green.
86When todo view is shown, no birtdays are shown and days with due todos are shown blue. 87When todo view is shown, no birtdays are shown and days with due todos are shown blue.
87When journal view is shown, only holidays are shown and days with journals are blue. 88When journal view is shown, only holidays are shown and days with journals are blue.
88 89
89Added Backup options to global config: 90Added Backup options to global config:
90You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). 91You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ).
91It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. 92It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again.
92The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. 93The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups.
93 94
94********** VERSION 2.1.1 ************ 95********** VERSION 2.1.1 ************
95 96
96Stable release 2.1.1! 97Stable release 2.1.1!
97 98
98KO/Pi: 99KO/Pi:
99Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. 100Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display.
100 101
101********** VERSION 2.1.0 ************ 102********** VERSION 2.1.0 ************
102 103
103Stable release 2.1.0! 104Stable release 2.1.0!
104 105
105Summary of changes/fixes compared to version 2.0.6: 106Summary of changes/fixes compared to version 2.0.6:
106 107
107Many bugs of version 2.0.6 fixed. 108Many bugs of version 2.0.6 fixed.
108Most of them were small bugs, but some of them were important. 109Most of them were small bugs, but some of them were important.
109It is recommended to use version 2.1.0 and not version 2.0.6. 110It is recommended to use version 2.1.0 and not version 2.0.6.
110 111
111Important changes: 112Important changes:
112 113
113Added recurring todos to KO/Pi. 114Added recurring todos to KO/Pi.
114 115
115Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. 116Added global application font settings (for all KDE-Pim/Pi apps) to the general settings.
116 117
117Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 118Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
118 119
119Datenavigator can now display many months. Very useful on the desktop. 120Datenavigator can now display many months. Very useful on the desktop.
120 121
121KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. 122KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements.
122 123
123Made alarm sound working on Linux desktop. 124Made alarm sound working on Linux desktop.
124 125
125Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. 126Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details.
126 127
127Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. 128Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details.
128 129
129Many other usebility enhancements. 130Many other usebility enhancements.
130Special thanks to Ben for his suggestions! 131Special thanks to Ben for his suggestions!
131 132
132You can find the complete changelog 133You can find the complete changelog
133from version 1.7.7 to 2.1.0 134from version 1.7.7 to 2.1.0
134in the source package or on 135in the source package or on
135 136
136http://www.pi-sync.net/html/changelog.html 137http://www.pi-sync.net/html/changelog.html
137 138
138 139
139 140
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index d25f632..08909ed 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1972,2552 +1972,2553 @@ bool CalendarView::checkFileChanged(QString fn)
1972void CalendarView::watchSavedFile() 1972void CalendarView::watchSavedFile()
1973{ 1973{
1974 QFileInfo finf ( MainWindow::defaultFileName()); 1974 QFileInfo finf ( MainWindow::defaultFileName());
1975 if ( !finf.exists() ) 1975 if ( !finf.exists() )
1976 return; 1976 return;
1977 QDateTime dt = finf.lastModified (); 1977 QDateTime dt = finf.lastModified ();
1978 if ( dt < loadedFileVersion ) { 1978 if ( dt < loadedFileVersion ) {
1979 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1979 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1980 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1980 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1981 return; 1981 return;
1982 } 1982 }
1983 loadedFileVersion = dt; 1983 loadedFileVersion = dt;
1984} 1984}
1985bool CalendarView::checkAllFileVersions() 1985bool CalendarView::checkAllFileVersions()
1986{ 1986{
1987 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1987 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1988 KopiCalendarFile * cal = calendars.first(); 1988 KopiCalendarFile * cal = calendars.first();
1989 mCalendar->setDefaultCalendar( 1 ); 1989 mCalendar->setDefaultCalendar( 1 );
1990 mCalendar->setDefaultCalendarEnabledOnly(); 1990 mCalendar->setDefaultCalendarEnabledOnly();
1991 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 1991 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
1992 if ( !checkFileVersion(MainWindow::defaultFileName())) { 1992 if ( !checkFileVersion(MainWindow::defaultFileName())) {
1993 restoreCalendarSettings(); 1993 restoreCalendarSettings();
1994 return false; 1994 return false;
1995 } 1995 }
1996 } 1996 }
1997 cal = calendars.next(); 1997 cal = calendars.next();
1998 QDateTime storeTemp = loadedFileVersion; 1998 QDateTime storeTemp = loadedFileVersion;
1999 while ( cal ) { 1999 while ( cal ) {
2000 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2000 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2001 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2001 mCalendar->setDefaultCalendar( cal->mCalNumber );
2002 mCalendar->setDefaultCalendarEnabledOnly(); 2002 mCalendar->setDefaultCalendarEnabledOnly();
2003 loadedFileVersion = cal->mLoadDt.addSecs( 15 ); 2003 loadedFileVersion = cal->mLoadDt.addSecs( 15 );
2004 if ( !checkFileVersion(cal->mFileName )) { 2004 if ( !checkFileVersion(cal->mFileName )) {
2005 loadedFileVersion = storeTemp; 2005 loadedFileVersion = storeTemp;
2006 restoreCalendarSettings(); 2006 restoreCalendarSettings();
2007 return false; 2007 return false;
2008 } 2008 }
2009 } 2009 }
2010 cal = calendars.next(); 2010 cal = calendars.next();
2011 } 2011 }
2012 loadedFileVersion = storeTemp; 2012 loadedFileVersion = storeTemp;
2013 return true; 2013 return true;
2014} 2014}
2015bool CalendarView::checkFileVersion(QString fn) 2015bool CalendarView::checkFileVersion(QString fn)
2016{ 2016{
2017 QFileInfo finf ( fn ); 2017 QFileInfo finf ( fn );
2018 if ( !finf.exists() ) 2018 if ( !finf.exists() )
2019 return true; 2019 return true;
2020 QDateTime dt = finf.lastModified (); 2020 QDateTime dt = finf.lastModified ();
2021 qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1()); 2021 qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
2022 qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1()); 2022 qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
2023 if ( dt <= loadedFileVersion ) 2023 if ( dt <= loadedFileVersion )
2024 return true; 2024 return true;
2025 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 2025 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
2026 i18n("KO/Pi Warning"),i18n("Overwrite"), 2026 i18n("KO/Pi Warning"),i18n("Overwrite"),
2027 i18n("Sync+save")); 2027 i18n("Sync+save"));
2028 2028
2029 if ( km == KMessageBox::Cancel ) 2029 if ( km == KMessageBox::Cancel )
2030 return false; 2030 return false;
2031 if ( km == KMessageBox::Yes ) 2031 if ( km == KMessageBox::Yes )
2032 return true; 2032 return true;
2033 2033
2034 setSyncDevice("deleteaftersync" ); 2034 setSyncDevice("deleteaftersync" );
2035 mSyncManager->mAskForPreferences = true; 2035 mSyncManager->mAskForPreferences = true;
2036 mSyncManager->mSyncAlgoPrefs = 3; 2036 mSyncManager->mSyncAlgoPrefs = 3;
2037 mSyncManager->mWriteBackFile = false; 2037 mSyncManager->mWriteBackFile = false;
2038 mSyncManager->mWriteBackExistingOnly = false; 2038 mSyncManager->mWriteBackExistingOnly = false;
2039 mSyncManager->mShowSyncSummary = false; 2039 mSyncManager->mShowSyncSummary = false;
2040 syncCalendar( fn, 3 ); 2040 syncCalendar( fn, 3 );
2041 Event * e = getLastSyncEvent(); 2041 Event * e = getLastSyncEvent();
2042 if ( e ) 2042 if ( e )
2043 mCalendar->deleteEvent( e ); 2043 mCalendar->deleteEvent( e );
2044 return true; 2044 return true;
2045} 2045}
2046bool CalendarView::saveCalendars() 2046bool CalendarView::saveCalendars()
2047{ 2047{
2048 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2048 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2049 KopiCalendarFile * cal = calendars.first(); 2049 KopiCalendarFile * cal = calendars.first();
2050 mCalendar->setDefaultCalendar( 1 ); 2050 mCalendar->setDefaultCalendar( 1 );
2051 mCalendar->setDefaultCalendarEnabledOnly(); 2051 mCalendar->setDefaultCalendarEnabledOnly();
2052 saveCalendar( MainWindow::defaultFileName() ); 2052 saveCalendar( MainWindow::defaultFileName() );
2053 cal = calendars.next(); 2053 cal = calendars.next();
2054 while ( cal ) { 2054 while ( cal ) {
2055 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2055 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2056 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2056 mCalendar->setDefaultCalendar( cal->mCalNumber );
2057 mCalendar->setDefaultCalendarEnabledOnly(); 2057 mCalendar->setDefaultCalendarEnabledOnly();
2058 if ( saveCalendar( cal->mFileName ) ) 2058 if ( saveCalendar( cal->mFileName ) )
2059 cal->mLoadDt = QDateTime::currentDateTime(); 2059 cal->mLoadDt = QDateTime::currentDateTime();
2060 } 2060 }
2061 cal = calendars.next(); 2061 cal = calendars.next();
2062 } 2062 }
2063 restoreCalendarSettings(); 2063 restoreCalendarSettings();
2064 return true; 2064 return true;
2065} 2065}
2066bool CalendarView::saveCalendar( QString filename ) 2066bool CalendarView::saveCalendar( QString filename )
2067{ 2067{
2068 2068
2069 // Store back all unsaved data into calendar object 2069 // Store back all unsaved data into calendar object
2070 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 2070 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
2071 if ( mViewManager->currentView() ) 2071 if ( mViewManager->currentView() )
2072 mViewManager->currentView()->flushView(); 2072 mViewManager->currentView()->flushView();
2073 2073
2074 2074
2075 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 2075 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
2076 mStorage->setSaveFormat( new ICalFormat() ); 2076 mStorage->setSaveFormat( new ICalFormat() );
2077 mStorage->setFileName( filename ); 2077 mStorage->setFileName( filename );
2078 bool success; 2078 bool success;
2079 success = mStorage->save(); 2079 success = mStorage->save();
2080 if ( !success ) { 2080 if ( !success ) {
2081 return false; 2081 return false;
2082 } 2082 }
2083 if ( filename == MainWindow::defaultFileName() ) { 2083 if ( filename == MainWindow::defaultFileName() ) {
2084 setLoadedFileVersion( lfv ); 2084 setLoadedFileVersion( lfv );
2085 watchSavedFile(); 2085 watchSavedFile();
2086 } 2086 }
2087 return true; 2087 return true;
2088} 2088}
2089 2089
2090void CalendarView::closeCalendar() 2090void CalendarView::closeCalendar()
2091{ 2091{
2092 2092
2093 // child windows no longer valid 2093 // child windows no longer valid
2094 clearAllViews(); 2094 clearAllViews();
2095 emit closingDown(); 2095 emit closingDown();
2096 2096
2097 mCalendar->close(); 2097 mCalendar->close();
2098 setModified(false); 2098 setModified(false);
2099 updateView(); 2099 updateView();
2100} 2100}
2101 2101
2102void CalendarView::archiveCalendar() 2102void CalendarView::archiveCalendar()
2103{ 2103{
2104 mDialogManager->showArchiveDialog(); 2104 mDialogManager->showArchiveDialog();
2105} 2105}
2106 2106
2107 2107
2108void CalendarView::readSettings() 2108void CalendarView::readSettings()
2109{ 2109{
2110 2110
2111 2111
2112 // mViewManager->showAgendaView(); 2112 // mViewManager->showAgendaView();
2113 QString str; 2113 QString str;
2114 //qDebug("CalendarView::readSettings() "); 2114 //qDebug("CalendarView::readSettings() ");
2115 // read settings from the KConfig, supplying reasonable 2115 // read settings from the KConfig, supplying reasonable
2116 // defaults where none are to be found 2116 // defaults where none are to be found
2117 KConfig *config = KOGlobals::config(); 2117 KConfig *config = KOGlobals::config();
2118#ifndef KORG_NOSPLITTER 2118#ifndef KORG_NOSPLITTER
2119 config->setGroup("KOrganizer Geometry"); 2119 config->setGroup("KOrganizer Geometry");
2120 2120
2121 QValueList<int> sizes = config->readIntListEntry("Separator1"); 2121 QValueList<int> sizes = config->readIntListEntry("Separator1");
2122 if (sizes.count() != 2) { 2122 if (sizes.count() != 2) {
2123 sizes << mDateNavigator->minimumSizeHint().width(); 2123 sizes << mDateNavigator->minimumSizeHint().width();
2124 sizes << 300; 2124 sizes << 300;
2125 } 2125 }
2126 mPanner->setSizes(sizes); 2126 mPanner->setSizes(sizes);
2127 2127
2128 sizes = config->readIntListEntry("Separator2"); 2128 sizes = config->readIntListEntry("Separator2");
2129 if ( ( mResourceView && sizes.count() == 4 ) || 2129 if ( ( mResourceView && sizes.count() == 4 ) ||
2130 ( !mResourceView && sizes.count() == 3 ) ) { 2130 ( !mResourceView && sizes.count() == 3 ) ) {
2131 mLeftSplitter->setSizes(sizes); 2131 mLeftSplitter->setSizes(sizes);
2132 } 2132 }
2133#endif 2133#endif
2134 globalFlagBlockAgenda = 1; 2134 globalFlagBlockAgenda = 1;
2135 mViewManager->showAgendaView(); 2135 mViewManager->showAgendaView();
2136 //mViewManager->readSettings( config ); 2136 //mViewManager->readSettings( config );
2137 mTodoList->restoreLayout(config,QString("Todo Layout")); 2137 mTodoList->restoreLayout(config,QString("Todo Layout"));
2138 readFilterSettings(config); 2138 readFilterSettings(config);
2139 2139
2140#ifdef DESKTOP_VERSION 2140#ifdef DESKTOP_VERSION
2141 config->setGroup("WidgetLayout"); 2141 config->setGroup("WidgetLayout");
2142 QStringList list; 2142 QStringList list;
2143 list = config->readListEntry("MainLayout"); 2143 list = config->readListEntry("MainLayout");
2144 int x,y,w,h; 2144 int x,y,w,h;
2145 if ( ! list.isEmpty() ) { 2145 if ( ! list.isEmpty() ) {
2146 x = list[0].toInt(); 2146 x = list[0].toInt();
2147 y = list[1].toInt(); 2147 y = list[1].toInt();
2148 w = list[2].toInt(); 2148 w = list[2].toInt();
2149 h = list[3].toInt(); 2149 h = list[3].toInt();
2150 KApplication::testCoords( &x,&y,&w,&h ); 2150 KApplication::testCoords( &x,&y,&w,&h );
2151 topLevelWidget()->setGeometry(x,y,w,h); 2151 topLevelWidget()->setGeometry(x,y,w,h);
2152 2152
2153 } else { 2153 } else {
2154 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 2154 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
2155 } 2155 }
2156 list = config->readListEntry("EditEventLayout"); 2156 list = config->readListEntry("EditEventLayout");
2157 if ( ! list.isEmpty() ) { 2157 if ( ! list.isEmpty() ) {
2158 x = list[0].toInt(); 2158 x = list[0].toInt();
2159 y = list[1].toInt(); 2159 y = list[1].toInt();
2160 w = list[2].toInt(); 2160 w = list[2].toInt();
2161 h = list[3].toInt(); 2161 h = list[3].toInt();
2162 KApplication::testCoords( &x,&y,&w,&h ); 2162 KApplication::testCoords( &x,&y,&w,&h );
2163 mEventEditor->setGeometry(x,y,w,h); 2163 mEventEditor->setGeometry(x,y,w,h);
2164 2164
2165 } 2165 }
2166 list = config->readListEntry("EditTodoLayout"); 2166 list = config->readListEntry("EditTodoLayout");
2167 if ( ! list.isEmpty() ) { 2167 if ( ! list.isEmpty() ) {
2168 x = list[0].toInt(); 2168 x = list[0].toInt();
2169 y = list[1].toInt(); 2169 y = list[1].toInt();
2170 w = list[2].toInt(); 2170 w = list[2].toInt();
2171 h = list[3].toInt(); 2171 h = list[3].toInt();
2172 KApplication::testCoords( &x,&y,&w,&h ); 2172 KApplication::testCoords( &x,&y,&w,&h );
2173 mTodoEditor->setGeometry(x,y,w,h); 2173 mTodoEditor->setGeometry(x,y,w,h);
2174 2174
2175 } 2175 }
2176 list = config->readListEntry("ViewerLayout"); 2176 list = config->readListEntry("ViewerLayout");
2177 if ( ! list.isEmpty() ) { 2177 if ( ! list.isEmpty() ) {
2178 x = list[0].toInt(); 2178 x = list[0].toInt();
2179 y = list[1].toInt(); 2179 y = list[1].toInt();
2180 w = list[2].toInt(); 2180 w = list[2].toInt();
2181 h = list[3].toInt(); 2181 h = list[3].toInt();
2182 KApplication::testCoords( &x,&y,&w,&h ); 2182 KApplication::testCoords( &x,&y,&w,&h );
2183 getEventViewerDialog()->setGeometry(x,y,w,h); 2183 getEventViewerDialog()->setGeometry(x,y,w,h);
2184 } 2184 }
2185#endif 2185#endif
2186 config->setGroup( "Views" ); 2186 config->setGroup( "Views" );
2187 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 2187 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
2188 2188
2189 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 2189 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
2190 2190
2191 int resetval = 0; 2191 int resetval = 0;
2192 int maxVal = 0; 2192 int maxVal = 0;
2193 if (sizes.count() != 3) { 2193 if (sizes.count() != 3) {
2194 if ( KOPrefs::instance()->mVerticalScreen ) { 2194 if ( KOPrefs::instance()->mVerticalScreen ) {
2195 resetval = mDateNavigator->sizeHint().width()+2; 2195 resetval = mDateNavigator->sizeHint().width()+2;
2196 } else { 2196 } else {
2197 resetval = mDateNavigator->sizeHint().height()+2; 2197 resetval = mDateNavigator->sizeHint().height()+2;
2198 } 2198 }
2199 } 2199 }
2200 if ( resetval ) { 2200 if ( resetval ) {
2201 sizes.clear(); 2201 sizes.clear();
2202 if ( KOPrefs::instance()->mVerticalScreen ) { 2202 if ( KOPrefs::instance()->mVerticalScreen ) {
2203 maxVal = QApplication::desktop()->width() -10; 2203 maxVal = QApplication::desktop()->width() -10;
2204 } else { 2204 } else {
2205 maxVal = QApplication::desktop()->height()-10; 2205 maxVal = QApplication::desktop()->height()-10;
2206 } 2206 }
2207 sizes << resetval; 2207 sizes << resetval;
2208 if ( maxVal < resetval + resetval) 2208 if ( maxVal < resetval + resetval)
2209 resetval = maxVal - resetval; 2209 resetval = maxVal - resetval;
2210 sizes << resetval; 2210 sizes << resetval;
2211 sizes << 100; 2211 sizes << 100;
2212 } 2212 }
2213 mLeftFrame->setSizes(sizes); 2213 mLeftFrame->setSizes(sizes);
2214 sizes = config->readIntListEntry("Main Splitter Frame"); 2214 sizes = config->readIntListEntry("Main Splitter Frame");
2215 resetval = 0; 2215 resetval = 0;
2216 maxVal = 0; 2216 maxVal = 0;
2217 if (sizes.count() != 2) { 2217 if (sizes.count() != 2) {
2218 if ( !KOPrefs::instance()->mVerticalScreen ) { 2218 if ( !KOPrefs::instance()->mVerticalScreen ) {
2219 resetval = mDateNavigator->sizeHint().width()+2; 2219 resetval = mDateNavigator->sizeHint().width()+2;
2220 } else { 2220 } else {
2221 resetval = mDateNavigator->sizeHint().height()+2; 2221 resetval = mDateNavigator->sizeHint().height()+2;
2222 } 2222 }
2223 } 2223 }
2224 if ( resetval ) { 2224 if ( resetval ) {
2225 sizes.clear(); 2225 sizes.clear();
2226 if ( !KOPrefs::instance()->mVerticalScreen ) { 2226 if ( !KOPrefs::instance()->mVerticalScreen ) {
2227 maxVal = QApplication::desktop()->width() -10; 2227 maxVal = QApplication::desktop()->width() -10;
2228 } else { 2228 } else {
2229 maxVal = QApplication::desktop()->height()-10; 2229 maxVal = QApplication::desktop()->height()-10;
2230 } 2230 }
2231 sizes << resetval; 2231 sizes << resetval;
2232 if ( maxVal < resetval + resetval) 2232 if ( maxVal < resetval + resetval)
2233 resetval = maxVal - resetval; 2233 resetval = maxVal - resetval;
2234 sizes << resetval; 2234 sizes << resetval;
2235 } 2235 }
2236 mMainFrame->setSizes(sizes); 2236 mMainFrame->setSizes(sizes);
2237 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 2237 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
2238 else if ( dateCount == 7 ) mNavigator->selectWeek(); 2238 else if ( dateCount == 7 ) mNavigator->selectWeek();
2239 else mNavigator->selectDates( dateCount ); 2239 else mNavigator->selectDates( dateCount );
2240 // mViewManager->readSettings( config ); 2240 // mViewManager->readSettings( config );
2241 updateConfig(); 2241 updateConfig();
2242 globalFlagBlockAgenda = 2; 2242 globalFlagBlockAgenda = 2;
2243 mViewManager->readSettings( config ); 2243 mViewManager->readSettings( config );
2244 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 2244 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
2245} 2245}
2246 2246
2247 2247
2248void CalendarView::writeSettings() 2248void CalendarView::writeSettings()
2249{ 2249{
2250 // kdDebug() << "CalendarView::writeSettings" << endl; 2250 // kdDebug() << "CalendarView::writeSettings" << endl;
2251 2251
2252 KConfig *config = KOGlobals::config(); 2252 KConfig *config = KOGlobals::config();
2253 2253
2254 mViewManager->writeSettings( config ); 2254 mViewManager->writeSettings( config );
2255 mTodoList->saveLayout(config,QString("Todo Layout")); 2255 mTodoList->saveLayout(config,QString("Todo Layout"));
2256 mDialogManager->writeSettings( config ); 2256 mDialogManager->writeSettings( config );
2257 //KOPrefs::instance()->usrWriteConfig(); 2257 //KOPrefs::instance()->usrWriteConfig();
2258 KOPrefs::instance()->writeConfig(); 2258 KOPrefs::instance()->writeConfig();
2259 2259
2260 writeFilterSettings(config); 2260 writeFilterSettings(config);
2261 config->setGroup( "AppRun" ); 2261 config->setGroup( "AppRun" );
2262 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 2262 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2263 int days = dt.daysTo( QDate::currentDate() ); 2263 int days = dt.daysTo( QDate::currentDate() );
2264 dt = dt.addDays( days ); 2264 dt = dt.addDays( days );
2265 int secs = dt.secsTo( QDateTime::currentDateTime() ); 2265 int secs = dt.secsTo( QDateTime::currentDateTime() );
2266 config->writeEntry( "LatestProgramStopDays", days ); 2266 config->writeEntry( "LatestProgramStopDays", days );
2267 config->writeEntry( "LatestProgramStopSecs", secs ); 2267 config->writeEntry( "LatestProgramStopSecs", secs );
2268 //qDebug("KO: Writing stop time: %d ", secs); 2268 //qDebug("KO: Writing stop time: %d ", secs);
2269 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 2269 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
2270 //QDateTime latest = dt.addSecs ( secs ); 2270 //QDateTime latest = dt.addSecs ( secs );
2271 //qDebug("KO: Termination on %s ", latest.toString().latin1()); 2271 //qDebug("KO: Termination on %s ", latest.toString().latin1());
2272 config->setGroup( "Views" ); 2272 config->setGroup( "Views" );
2273 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2273 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
2274 2274
2275#if 0 2275#if 0
2276 qDebug("********************* "); 2276 qDebug("********************* ");
2277 qDebug("Testcode secsto "); 2277 qDebug("Testcode secsto ");
2278 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); 2278 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
2279 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); 2279 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
2280 int secsto = dt_nodaylight.secsTo( dt_daylight ); 2280 int secsto = dt_nodaylight.secsTo( dt_daylight );
2281 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); 2281 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
2282 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); 2282 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
2283 qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); 2283 qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
2284 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); 2284 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
2285 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); 2285 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
2286 qDebug("********************* testcode end"); 2286 qDebug("********************* testcode end");
2287 2287
2288#endif 2288#endif
2289 2289
2290 QValueList<int> listINT = mLeftFrame->sizes(); 2290 QValueList<int> listINT = mLeftFrame->sizes();
2291 config->writeEntry("Left Splitter Frame",listINT); 2291 config->writeEntry("Left Splitter Frame",listINT);
2292 QValueList<int> listINT2 = mMainFrame->sizes(); 2292 QValueList<int> listINT2 = mMainFrame->sizes();
2293 config->writeEntry("Main Splitter Frame",listINT2); 2293 config->writeEntry("Main Splitter Frame",listINT2);
2294#ifdef DESKTOP_VERSION 2294#ifdef DESKTOP_VERSION
2295 config->setGroup("WidgetLayout"); 2295 config->setGroup("WidgetLayout");
2296 QStringList list ;//= config->readListEntry("MainLayout"); 2296 QStringList list ;//= config->readListEntry("MainLayout");
2297 int x,y,w,h; 2297 int x,y,w,h;
2298 QWidget* wid; 2298 QWidget* wid;
2299 wid = topLevelWidget(); 2299 wid = topLevelWidget();
2300 x = wid->geometry().x(); 2300 x = wid->geometry().x();
2301 y = wid->geometry().y(); 2301 y = wid->geometry().y();
2302 w = wid->width(); 2302 w = wid->width();
2303 h = wid->height(); 2303 h = wid->height();
2304 list.clear(); 2304 list.clear();
2305 list << QString::number( x ); 2305 list << QString::number( x );
2306 list << QString::number( y ); 2306 list << QString::number( y );
2307 list << QString::number( w ); 2307 list << QString::number( w );
2308 list << QString::number( h ); 2308 list << QString::number( h );
2309 config->writeEntry("MainLayout",list ); 2309 config->writeEntry("MainLayout",list );
2310 2310
2311 wid = mEventEditor; 2311 wid = mEventEditor;
2312 x = wid->geometry().x(); 2312 x = wid->geometry().x();
2313 y = wid->geometry().y(); 2313 y = wid->geometry().y();
2314 w = wid->width(); 2314 w = wid->width();
2315 h = wid->height(); 2315 h = wid->height();
2316 list.clear(); 2316 list.clear();
2317 list << QString::number( x ); 2317 list << QString::number( x );
2318 list << QString::number( y ); 2318 list << QString::number( y );
2319 list << QString::number( w ); 2319 list << QString::number( w );
2320 list << QString::number( h ); 2320 list << QString::number( h );
2321 config->writeEntry("EditEventLayout",list ); 2321 config->writeEntry("EditEventLayout",list );
2322 2322
2323 wid = mTodoEditor; 2323 wid = mTodoEditor;
2324 x = wid->geometry().x(); 2324 x = wid->geometry().x();
2325 y = wid->geometry().y(); 2325 y = wid->geometry().y();
2326 w = wid->width(); 2326 w = wid->width();
2327 h = wid->height(); 2327 h = wid->height();
2328 list.clear(); 2328 list.clear();
2329 list << QString::number( x ); 2329 list << QString::number( x );
2330 list << QString::number( y ); 2330 list << QString::number( y );
2331 list << QString::number( w ); 2331 list << QString::number( w );
2332 list << QString::number( h ); 2332 list << QString::number( h );
2333 config->writeEntry("EditTodoLayout",list ); 2333 config->writeEntry("EditTodoLayout",list );
2334 wid = getEventViewerDialog(); 2334 wid = getEventViewerDialog();
2335 x = wid->geometry().x(); 2335 x = wid->geometry().x();
2336 y = wid->geometry().y(); 2336 y = wid->geometry().y();
2337 w = wid->width(); 2337 w = wid->width();
2338 h = wid->height(); 2338 h = wid->height();
2339 list.clear(); 2339 list.clear();
2340 list << QString::number( x ); 2340 list << QString::number( x );
2341 list << QString::number( y ); 2341 list << QString::number( y );
2342 list << QString::number( w ); 2342 list << QString::number( w );
2343 list << QString::number( h ); 2343 list << QString::number( h );
2344 config->writeEntry("ViewerLayout",list ); 2344 config->writeEntry("ViewerLayout",list );
2345 wid = mDialogManager->getSearchDialog(); 2345 wid = mDialogManager->getSearchDialog();
2346 if ( wid ) { 2346 if ( wid ) {
2347 x = wid->geometry().x(); 2347 x = wid->geometry().x();
2348 y = wid->geometry().y(); 2348 y = wid->geometry().y();
2349 w = wid->width(); 2349 w = wid->width();
2350 h = wid->height(); 2350 h = wid->height();
2351 list.clear(); 2351 list.clear();
2352 list << QString::number( x ); 2352 list << QString::number( x );
2353 list << QString::number( y ); 2353 list << QString::number( y );
2354 list << QString::number( w ); 2354 list << QString::number( w );
2355 list << QString::number( h ); 2355 list << QString::number( h );
2356 config->writeEntry("SearchLayout",list ); 2356 config->writeEntry("SearchLayout",list );
2357 } 2357 }
2358#endif 2358#endif
2359 2359
2360 2360
2361 config->sync(); 2361 config->sync();
2362} 2362}
2363 2363
2364void CalendarView::readFilterSettings(KConfig *config) 2364void CalendarView::readFilterSettings(KConfig *config)
2365{ 2365{
2366 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2366 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2367 2367
2368 mFilters.clear(); 2368 mFilters.clear();
2369 2369
2370 config->setGroup("General"); 2370 config->setGroup("General");
2371 QStringList filterList = config->readListEntry("CalendarFilters"); 2371 QStringList filterList = config->readListEntry("CalendarFilters");
2372 2372
2373 QStringList::ConstIterator it = filterList.begin(); 2373 QStringList::ConstIterator it = filterList.begin();
2374 QStringList::ConstIterator end = filterList.end(); 2374 QStringList::ConstIterator end = filterList.end();
2375 while(it != end) { 2375 while(it != end) {
2376 // kdDebug() << " filter: " << (*it) << endl; 2376 // kdDebug() << " filter: " << (*it) << endl;
2377 2377
2378 CalFilter *filter; 2378 CalFilter *filter;
2379 filter = new CalFilter(*it); 2379 filter = new CalFilter(*it);
2380 config->setGroup("Filter_" + (*it).utf8()); 2380 config->setGroup("Filter_" + (*it).utf8());
2381 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2381 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2382 filter->setCriteria(config->readNumEntry("Criteria",0)); 2382 filter->setCriteria(config->readNumEntry("Criteria",0));
2383 filter->setCategoryList(config->readListEntry("CategoryList")); 2383 filter->setCategoryList(config->readListEntry("CategoryList"));
2384 mFilters.append(filter); 2384 mFilters.append(filter);
2385 2385
2386 ++it; 2386 ++it;
2387 } 2387 }
2388 2388
2389 if (mFilters.count() == 0) { 2389 if (mFilters.count() == 0) {
2390 CalFilter *filter = new CalFilter(i18n("Default")); 2390 CalFilter *filter = new CalFilter(i18n("Default"));
2391 mFilters.append(filter); 2391 mFilters.append(filter);
2392 } 2392 }
2393 mFilterView->updateFilters(); 2393 mFilterView->updateFilters();
2394 config->setGroup("FilterView"); 2394 config->setGroup("FilterView");
2395 2395
2396 mFilterView->blockSignals(true); 2396 mFilterView->blockSignals(true);
2397 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2397 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2398 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2398 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2399 mFilterView->blockSignals(false); 2399 mFilterView->blockSignals(false);
2400 // We do it manually to avoid it being done twice by the above calls 2400 // We do it manually to avoid it being done twice by the above calls
2401 updateFilter(); 2401 updateFilter();
2402} 2402}
2403 2403
2404void CalendarView::writeFilterSettings(KConfig *config) 2404void CalendarView::writeFilterSettings(KConfig *config)
2405{ 2405{
2406 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2406 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2407 2407
2408 QStringList filterList; 2408 QStringList filterList;
2409 2409
2410 CalFilter *filter = mFilters.first(); 2410 CalFilter *filter = mFilters.first();
2411 while(filter) { 2411 while(filter) {
2412 // kdDebug() << " fn: " << filter->name() << endl; 2412 // kdDebug() << " fn: " << filter->name() << endl;
2413 filterList << filter->name(); 2413 filterList << filter->name();
2414 config->setGroup("Filter_" + filter->name().utf8()); 2414 config->setGroup("Filter_" + filter->name().utf8());
2415 config->writeEntry("Criteria",filter->criteria()); 2415 config->writeEntry("Criteria",filter->criteria());
2416 config->writeEntry("CategoryList",filter->categoryList()); 2416 config->writeEntry("CategoryList",filter->categoryList());
2417 filter = mFilters.next(); 2417 filter = mFilters.next();
2418 } 2418 }
2419 config->setGroup("General"); 2419 config->setGroup("General");
2420 config->writeEntry("CalendarFilters",filterList); 2420 config->writeEntry("CalendarFilters",filterList);
2421 2421
2422 config->setGroup("FilterView"); 2422 config->setGroup("FilterView");
2423 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2423 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2424 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2424 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2425} 2425}
2426 2426
2427 2427
2428void CalendarView::goToday() 2428void CalendarView::goToday()
2429{ 2429{
2430 if ( mViewManager->currentView()->isMonthView() ) 2430 if ( mViewManager->currentView()->isMonthView() )
2431 mNavigator->selectTodayMonth(); 2431 mNavigator->selectTodayMonth();
2432 else 2432 else
2433 mNavigator->selectToday(); 2433 mNavigator->selectToday();
2434} 2434}
2435 2435
2436void CalendarView::goNext() 2436void CalendarView::goNext()
2437{ 2437{
2438 mNavigator->selectNext(); 2438 mNavigator->selectNext();
2439} 2439}
2440 2440
2441void CalendarView::goPrevious() 2441void CalendarView::goPrevious()
2442{ 2442{
2443 mNavigator->selectPrevious(); 2443 mNavigator->selectPrevious();
2444} 2444}
2445void CalendarView::goNextMonth() 2445void CalendarView::goNextMonth()
2446{ 2446{
2447 mNavigator->selectNextMonth(); 2447 mNavigator->selectNextMonth();
2448} 2448}
2449 2449
2450void CalendarView::goPreviousMonth() 2450void CalendarView::goPreviousMonth()
2451{ 2451{
2452 mNavigator->selectPreviousMonth(); 2452 mNavigator->selectPreviousMonth();
2453} 2453}
2454void CalendarView::writeLocale() 2454void CalendarView::writeLocale()
2455{ 2455{
2456 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2456 //KPimGlobalPrefs::instance()->setGlobalConfig();
2457#if 0 2457#if 0
2458 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2458 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2459 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2459 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2460 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2460 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2461 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2461 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2462 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2462 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2463 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2463 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2464 dummy = KOPrefs::instance()->mUserDateFormatShort; 2464 dummy = KOPrefs::instance()->mUserDateFormatShort;
2465 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2465 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2466 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2466 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2467 KOPrefs::instance()->mDaylightsavingStart, 2467 KOPrefs::instance()->mDaylightsavingStart,
2468 KOPrefs::instance()->mDaylightsavingEnd ); 2468 KOPrefs::instance()->mDaylightsavingEnd );
2469 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2469 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2470#endif 2470#endif
2471} 2471}
2472void CalendarView::updateConfig() 2472void CalendarView::updateConfig()
2473{ 2473{
2474 writeLocale(); 2474 writeLocale();
2475 if ( KOPrefs::instance()->mUseAppColors ) 2475 if ( KOPrefs::instance()->mUseAppColors )
2476 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2476 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2477 emit configChanged(); 2477 emit configChanged();
2478 mTodoList->updateConfig(); 2478 mTodoList->updateConfig();
2479 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2479 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2480 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2480 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2481 // To make the "fill window" configurations work 2481 // To make the "fill window" configurations work
2482 //mViewManager->raiseCurrentView(); 2482 //mViewManager->raiseCurrentView();
2483} 2483}
2484 2484
2485 2485
2486void CalendarView::eventChanged(Event *event) 2486void CalendarView::eventChanged(Event *event)
2487{ 2487{
2488 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2488 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2489 //updateUnmanagedViews(); 2489 //updateUnmanagedViews();
2490} 2490}
2491 2491
2492void CalendarView::eventAdded(Event *event) 2492void CalendarView::eventAdded(Event *event)
2493{ 2493{
2494 changeEventDisplay(event,KOGlobals::EVENTADDED); 2494 changeEventDisplay(event,KOGlobals::EVENTADDED);
2495} 2495}
2496 2496
2497void CalendarView::eventToBeDeleted(Event *) 2497void CalendarView::eventToBeDeleted(Event *)
2498{ 2498{
2499 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2499 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2500} 2500}
2501 2501
2502void CalendarView::eventDeleted() 2502void CalendarView::eventDeleted()
2503{ 2503{
2504 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2504 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2505} 2505}
2506void CalendarView::changeTodoDisplay(Todo *which, int action) 2506void CalendarView::changeTodoDisplay(Todo *which, int action)
2507{ 2507{
2508 changeIncidenceDisplay((Incidence *)which, action); 2508 changeIncidenceDisplay((Incidence *)which, action);
2509 mDateNavigator->updateView(); //LR 2509 mDateNavigator->updateView(); //LR
2510 //mDialogManager->updateSearchDialog(); 2510 //mDialogManager->updateSearchDialog();
2511 2511
2512 if (which) { 2512 if (which) {
2513 mViewManager->updateWNview(); 2513 mViewManager->updateWNview();
2514 //mTodoList->updateView(); 2514 //mTodoList->updateView();
2515 } 2515 }
2516 2516
2517} 2517}
2518 2518
2519void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2519void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2520{ 2520{
2521 updateUnmanagedViews(); 2521 updateUnmanagedViews();
2522 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2522 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2523 if ( action == KOGlobals::EVENTDELETED ) { //delete 2523 if ( action == KOGlobals::EVENTDELETED ) { //delete
2524 mCalendar->checkAlarmForIncidence( 0, true ); 2524 mCalendar->checkAlarmForIncidence( 0, true );
2525 if ( mEventViewerDialog ) 2525 if ( mEventViewerDialog )
2526 mEventViewerDialog->hide(); 2526 mEventViewerDialog->hide();
2527 } 2527 }
2528 else 2528 else
2529 mCalendar->checkAlarmForIncidence( which , false ); 2529 mCalendar->checkAlarmForIncidence( which , false );
2530} 2530}
2531 2531
2532// most of the changeEventDisplays() right now just call the view's 2532// most of the changeEventDisplays() right now just call the view's
2533// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2533// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2534void CalendarView::changeEventDisplay(Event *which, int action) 2534void CalendarView::changeEventDisplay(Event *which, int action)
2535{ 2535{
2536 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2536 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2537 changeIncidenceDisplay((Incidence *)which, action); 2537 changeIncidenceDisplay((Incidence *)which, action);
2538 mDateNavigator->updateView(); 2538 mDateNavigator->updateView();
2539 //mDialogManager->updateSearchDialog(); 2539 //mDialogManager->updateSearchDialog();
2540 2540
2541 if (which) { 2541 if (which) {
2542 // If there is an event view visible update the display 2542 // If there is an event view visible update the display
2543 mViewManager->currentView()->changeEventDisplay(which,action); 2543 mViewManager->currentView()->changeEventDisplay(which,action);
2544 // TODO: check, if update needed 2544 // TODO: check, if update needed
2545 // if (which->getTodoStatus()) { 2545 // if (which->getTodoStatus()) {
2546 mTodoList->updateView(); 2546 mTodoList->updateView();
2547 // } 2547 // }
2548 } else { 2548 } else {
2549 mViewManager->currentView()->updateView(); 2549 mViewManager->currentView()->updateView();
2550 } 2550 }
2551} 2551}
2552 2552
2553 2553
2554void CalendarView::updateTodoViews() 2554void CalendarView::updateTodoViews()
2555{ 2555{
2556 mTodoList->updateView(); 2556 mTodoList->updateView();
2557 mViewManager->currentView()->updateView(); 2557 mViewManager->currentView()->updateView();
2558 2558
2559} 2559}
2560 2560
2561 2561
2562void CalendarView::updateView(const QDate &start, const QDate &end) 2562void CalendarView::updateView(const QDate &start, const QDate &end)
2563{ 2563{
2564 mTodoList->updateView(); 2564 mTodoList->updateView();
2565 mViewManager->updateView(start, end); 2565 mViewManager->updateView(start, end);
2566 //mDateNavigator->updateView(); 2566 //mDateNavigator->updateView();
2567} 2567}
2568 2568
2569void CalendarView::clearAllViews() 2569void CalendarView::clearAllViews()
2570{ 2570{
2571 mTodoList->clearList(); 2571 mTodoList->clearList();
2572 mViewManager->clearAllViews(); 2572 mViewManager->clearAllViews();
2573 SearchDialog * sd = mDialogManager->getSearchDialog(); 2573 SearchDialog * sd = mDialogManager->getSearchDialog();
2574 if ( sd ) { 2574 if ( sd ) {
2575 KOListView* kol = sd->listview(); 2575 KOListView* kol = sd->listview();
2576 if ( kol ) 2576 if ( kol )
2577 kol->clearList(); 2577 kol->clearList();
2578 } 2578 }
2579} 2579}
2580void CalendarView::updateView() 2580void CalendarView::updateView()
2581{ 2581{
2582 DateList tmpList = mNavigator->selectedDates(); 2582 DateList tmpList = mNavigator->selectedDates();
2583 2583
2584 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2584 if ( KOPrefs::instance()->mHideNonStartedTodos )
2585 mTodoList->updateView(); 2585 mTodoList->updateView();
2586 // We assume that the navigator only selects consecutive days. 2586 // We assume that the navigator only selects consecutive days.
2587 updateView( tmpList.first(), tmpList.last() ); 2587 updateView( tmpList.first(), tmpList.last() );
2588} 2588}
2589 2589
2590void CalendarView::updateUnmanagedViews() 2590void CalendarView::updateUnmanagedViews()
2591{ 2591{
2592 mDateNavigator->updateDayMatrix(); 2592 mDateNavigator->updateDayMatrix();
2593} 2593}
2594 2594
2595int CalendarView::msgItemDelete(const QString name) 2595int CalendarView::msgItemDelete(const QString name)
2596{ 2596{
2597 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2597 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2598 i18n("This item will be\npermanently deleted."), 2598 i18n("This item will be\npermanently deleted."),
2599 i18n("KO/Pi Confirmation"),i18n("Delete")); 2599 i18n("KO/Pi Confirmation"),i18n("Delete"));
2600} 2600}
2601 2601
2602 2602
2603void CalendarView::edit_cut() 2603void CalendarView::edit_cut()
2604{ 2604{
2605 Event *anEvent=0; 2605 Event *anEvent=0;
2606 2606
2607 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2607 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2608 2608
2609 if (mViewManager->currentView()->isEventView()) { 2609 if (mViewManager->currentView()->isEventView()) {
2610 if ( incidence && incidence->typeID() == eventID ) { 2610 if ( incidence && incidence->typeID() == eventID ) {
2611 anEvent = static_cast<Event *>(incidence); 2611 anEvent = static_cast<Event *>(incidence);
2612 } 2612 }
2613 } 2613 }
2614 2614
2615 if (!anEvent) { 2615 if (!anEvent) {
2616 KNotifyClient::beep(); 2616 KNotifyClient::beep();
2617 return; 2617 return;
2618 } 2618 }
2619 DndFactory factory( mCalendar ); 2619 DndFactory factory( mCalendar );
2620 factory.cutIncidence(anEvent); 2620 factory.cutIncidence(anEvent);
2621 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2621 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2622} 2622}
2623 2623
2624void CalendarView::edit_copy() 2624void CalendarView::edit_copy()
2625{ 2625{
2626 Event *anEvent=0; 2626 Event *anEvent=0;
2627 2627
2628 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2628 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2629 2629
2630 if (mViewManager->currentView()->isEventView()) { 2630 if (mViewManager->currentView()->isEventView()) {
2631 if ( incidence && incidence->typeID() == eventID ) { 2631 if ( incidence && incidence->typeID() == eventID ) {
2632 anEvent = static_cast<Event *>(incidence); 2632 anEvent = static_cast<Event *>(incidence);
2633 } 2633 }
2634 } 2634 }
2635 2635
2636 if (!anEvent) { 2636 if (!anEvent) {
2637 KNotifyClient::beep(); 2637 KNotifyClient::beep();
2638 return; 2638 return;
2639 } 2639 }
2640 DndFactory factory( mCalendar ); 2640 DndFactory factory( mCalendar );
2641 factory.copyIncidence(anEvent); 2641 factory.copyIncidence(anEvent);
2642} 2642}
2643 2643
2644void CalendarView::edit_paste() 2644void CalendarView::edit_paste()
2645{ 2645{
2646 QDate date = mNavigator->selectedDates().first(); 2646 QDate date = mNavigator->selectedDates().first();
2647 2647
2648 DndFactory factory( mCalendar ); 2648 DndFactory factory( mCalendar );
2649 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2649 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2650 2650
2651 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2651 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2652} 2652}
2653void CalendarView::edit_global_options() 2653void CalendarView::edit_global_options()
2654{ 2654{
2655 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2655 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2656 emit save(); 2656 emit save();
2657 emit saveStopTimer(); 2657 emit saveStopTimer();
2658 mDialogManager->showGlobalOptionsDialog(); 2658 mDialogManager->showGlobalOptionsDialog();
2659 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2659 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2660 emit saveStopTimer(); 2660 emit saveStopTimer();
2661 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!"), 2661 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!"),
2662 i18n("Timezone settings"),i18n("Reload"))) { 2662 i18n("Timezone settings"),i18n("Reload"))) {
2663 qDebug("KO: TZ reload cancelled "); 2663 qDebug("KO: TZ reload cancelled ");
2664 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2664 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2665 return; 2665 return;
2666 } 2666 }
2667 qDebug("KO: Timezone change "); 2667 qDebug("KO: Timezone change ");
2668 openCalendar( MainWindow::defaultFileName() ); 2668 openCalendar( MainWindow::defaultFileName() );
2669 setModified(true); 2669 setModified(true);
2670 } 2670 }
2671 else 2671 else
2672 qDebug("KO: No tz change "); 2672 qDebug("KO: No tz change ");
2673} 2673}
2674void CalendarView::edit_options() 2674void CalendarView::edit_options()
2675{ 2675{
2676 mDialogManager->showOptionsDialog(); 2676 mDialogManager->showOptionsDialog();
2677} 2677}
2678 2678
2679 2679
2680void CalendarView::slotSelectPickerDate( QDate d) 2680void CalendarView::slotSelectPickerDate( QDate d)
2681{ 2681{
2682 mDateFrame->hide(); 2682 mDateFrame->hide();
2683 if ( mDatePickerMode == 1 ) { 2683 if ( mDatePickerMode == 1 ) {
2684 mNavigator->slotDaySelect( d ); 2684 mNavigator->slotDaySelect( d );
2685 } else if ( mDatePickerMode == 2 ) { 2685 } else if ( mDatePickerMode == 2 ) {
2686 if ( mMoveIncidence->typeID() == todoID ) { 2686 if ( mMoveIncidence->typeID() == todoID ) {
2687 Todo * to = (Todo *) mMoveIncidence; 2687 Todo * to = (Todo *) mMoveIncidence;
2688 QTime tim; 2688 QTime tim;
2689 int len = 0; 2689 int len = 0;
2690 if ( to->hasStartDate() && to->hasDueDate() ) 2690 if ( to->hasStartDate() && to->hasDueDate() )
2691 len = to->dtStart().secsTo( to->dtDue()); 2691 len = to->dtStart().secsTo( to->dtDue());
2692 if ( to->hasDueDate() ) 2692 if ( to->hasDueDate() )
2693 tim = to->dtDue().time(); 2693 tim = to->dtDue().time();
2694 else { 2694 else {
2695 tim = QTime ( 0,0,0 ); 2695 tim = QTime ( 0,0,0 );
2696 to->setFloats( true ); 2696 to->setFloats( true );
2697 to->setHasDueDate( true ); 2697 to->setHasDueDate( true );
2698 } 2698 }
2699 QDateTime dt ( d,tim ); 2699 QDateTime dt ( d,tim );
2700 to->setDtDue( dt ); 2700 to->setDtDue( dt );
2701 2701
2702 if ( to->hasStartDate() ) { 2702 if ( to->hasStartDate() ) {
2703 if ( len>0 ) 2703 if ( len>0 )
2704 to->setDtStart(to->dtDue().addSecs( -len )); 2704 to->setDtStart(to->dtDue().addSecs( -len ));
2705 else 2705 else
2706 if (to->dtStart() > to->dtDue() ) 2706 if (to->dtStart() > to->dtDue() )
2707 to->setDtStart(to->dtDue().addDays( -3 )); 2707 to->setDtStart(to->dtDue().addDays( -3 ));
2708 } 2708 }
2709 2709
2710 todoChanged( to ); 2710 todoChanged( to );
2711 } else { 2711 } else {
2712 if ( mMoveIncidence->doesRecur() ) { 2712 if ( mMoveIncidence->doesRecur() ) {
2713#if 0 2713#if 0
2714 // PENDING implement this 2714 // PENDING implement this
2715 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2715 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2716 mCalendar()->addIncidence( newInc ); 2716 mCalendar()->addIncidence( newInc );
2717 if ( mMoveIncidence->typeID() == todoID ) 2717 if ( mMoveIncidence->typeID() == todoID )
2718 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2718 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2719 else 2719 else
2720 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2720 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2721 mMoveIncidence = newInc; 2721 mMoveIncidence = newInc;
2722 2722
2723#endif 2723#endif
2724 } 2724 }
2725 QTime tim = mMoveIncidence->dtStart().time(); 2725 QTime tim = mMoveIncidence->dtStart().time();
2726 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2726 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2727 QDateTime dt ( d,tim ); 2727 QDateTime dt ( d,tim );
2728 mMoveIncidence->setDtStart( dt ); 2728 mMoveIncidence->setDtStart( dt );
2729 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2729 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2730 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2730 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2731 } 2731 }
2732 2732
2733 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2733 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2734 } 2734 }
2735} 2735}
2736 2736
2737void CalendarView::removeCategories() 2737void CalendarView::removeCategories()
2738{ 2738{
2739 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2739 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2740 QStringList catList = KOPrefs::instance()->mCustomCategories; 2740 QStringList catList = KOPrefs::instance()->mCustomCategories;
2741 QStringList catIncList; 2741 QStringList catIncList;
2742 QStringList newCatList; 2742 QStringList newCatList;
2743 Incidence* inc = incList.first(); 2743 Incidence* inc = incList.first();
2744 int i; 2744 int i;
2745 int count = 0; 2745 int count = 0;
2746 while ( inc ) { 2746 while ( inc ) {
2747 newCatList.clear(); 2747 newCatList.clear();
2748 catIncList = inc->categories() ; 2748 catIncList = inc->categories() ;
2749 for( i = 0; i< catIncList.count(); ++i ) { 2749 for( i = 0; i< catIncList.count(); ++i ) {
2750 if ( catList.contains (catIncList[i])) 2750 if ( catList.contains (catIncList[i]))
2751 newCatList.append( catIncList[i] ); 2751 newCatList.append( catIncList[i] );
2752 } 2752 }
2753 newCatList.sort(); 2753 newCatList.sort();
2754 inc->setCategories( newCatList.join(",") ); 2754 inc->setCategories( newCatList.join(",") );
2755 inc = incList.next(); 2755 inc = incList.next();
2756 } 2756 }
2757} 2757}
2758 2758
2759int CalendarView::addCategories() 2759int CalendarView::addCategories()
2760{ 2760{
2761 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2761 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2762 QStringList catList = KOPrefs::instance()->mCustomCategories; 2762 QStringList catList = KOPrefs::instance()->mCustomCategories;
2763 QStringList catIncList; 2763 QStringList catIncList;
2764 Incidence* inc = incList.first(); 2764 Incidence* inc = incList.first();
2765 int i; 2765 int i;
2766 int count = 0; 2766 int count = 0;
2767 while ( inc ) { 2767 while ( inc ) {
2768 catIncList = inc->categories() ; 2768 catIncList = inc->categories() ;
2769 for( i = 0; i< catIncList.count(); ++i ) { 2769 for( i = 0; i< catIncList.count(); ++i ) {
2770 if ( !catList.contains (catIncList[i])) { 2770 if ( !catList.contains (catIncList[i])) {
2771 catList.append( catIncList[i] ); 2771 catList.append( catIncList[i] );
2772 //qDebug("add cat %s ", catIncList[i].latin1()); 2772 //qDebug("add cat %s ", catIncList[i].latin1());
2773 ++count; 2773 ++count;
2774 } 2774 }
2775 } 2775 }
2776 inc = incList.next(); 2776 inc = incList.next();
2777 } 2777 }
2778 catList.sort(); 2778 catList.sort();
2779 KOPrefs::instance()->mCustomCategories = catList; 2779 KOPrefs::instance()->mCustomCategories = catList;
2780 return count; 2780 return count;
2781} 2781}
2782 2782
2783void CalendarView::manageCategories() 2783void CalendarView::manageCategories()
2784{ 2784{
2785 KOCatPrefs* cp = new KOCatPrefs(); 2785 KOCatPrefs* cp = new KOCatPrefs();
2786 cp->show(); 2786 cp->show();
2787 int w =cp->sizeHint().width() ; 2787 int w =cp->sizeHint().width() ;
2788 int h = cp->sizeHint().height() ; 2788 int h = cp->sizeHint().height() ;
2789 int dw = QApplication::desktop()->width(); 2789 int dw = QApplication::desktop()->width();
2790 int dh = QApplication::desktop()->height(); 2790 int dh = QApplication::desktop()->height();
2791 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2791 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2792 if ( !cp->exec() ) { 2792 if ( !cp->exec() ) {
2793 delete cp; 2793 delete cp;
2794 return; 2794 return;
2795 } 2795 }
2796 int count = 0; 2796 int count = 0;
2797 if ( cp->addCat() ) { 2797 if ( cp->addCat() ) {
2798 count = addCategories(); 2798 count = addCategories();
2799 if ( count ) { 2799 if ( count ) {
2800 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2800 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2801 writeSettings(); 2801 writeSettings();
2802 } else 2802 } else
2803 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2803 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2804 } else { 2804 } else {
2805 removeCategories(); 2805 removeCategories();
2806 updateView(); 2806 updateView();
2807 } 2807 }
2808 delete cp; 2808 delete cp;
2809} 2809}
2810 2810
2811void CalendarView::beamIncidence(Incidence * Inc) 2811void CalendarView::beamIncidence(Incidence * Inc)
2812{ 2812{
2813 QPtrList<Incidence> delSel ; 2813 QPtrList<Incidence> delSel ;
2814 delSel.append(Inc); 2814 delSel.append(Inc);
2815 beamIncidenceList( delSel ); 2815 beamIncidenceList( delSel );
2816} 2816}
2817void CalendarView::beamCalendar() 2817void CalendarView::beamCalendar()
2818{ 2818{
2819 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2819 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2820 //qDebug("beamCalendar() "); 2820 //qDebug("beamCalendar() ");
2821 beamIncidenceList( delSel ); 2821 beamIncidenceList( delSel );
2822} 2822}
2823void CalendarView::beamFilteredCalendar() 2823void CalendarView::beamFilteredCalendar()
2824{ 2824{
2825 QPtrList<Incidence> delSel = mCalendar->incidences(); 2825 QPtrList<Incidence> delSel = mCalendar->incidences();
2826 //qDebug("beamFilteredCalendar() "); 2826 //qDebug("beamFilteredCalendar() ");
2827 beamIncidenceList( delSel ); 2827 beamIncidenceList( delSel );
2828} 2828}
2829void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2829void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2830{ 2830{
2831 if ( beamDialog->exec () == QDialog::Rejected ) 2831 if ( beamDialog->exec () == QDialog::Rejected )
2832 return; 2832 return;
2833#ifdef DESKTOP_VERSION 2833#ifdef DESKTOP_VERSION
2834 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2834 QString fn = locateLocal( "tmp", "kopibeamfile" );
2835#else 2835#else
2836 QString fn = "/tmp/kopibeamfile"; 2836 QString fn = "/tmp/kopibeamfile";
2837#endif 2837#endif
2838 QString mes; 2838 QString mes;
2839 bool createbup = true; 2839 bool createbup = true;
2840 if ( createbup ) { 2840 if ( createbup ) {
2841 QString description = "\n"; 2841 QString description = "\n";
2842 CalendarLocal* cal = new CalendarLocal(); 2842 CalendarLocal* cal = new CalendarLocal();
2843 if ( beamDialog->beamLocal() ) 2843 if ( beamDialog->beamLocal() )
2844 cal->setLocalTime(); 2844 cal->setLocalTime();
2845 else 2845 else
2846 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2846 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2847 Incidence *incidence = delSel.first(); 2847 Incidence *incidence = delSel.first();
2848 bool addText = false; 2848 bool addText = false;
2849 if ( delSel.count() < 10 ) 2849 if ( delSel.count() < 10 )
2850 addText = true; 2850 addText = true;
2851 else { 2851 else {
2852 description.sprintf(i18n(" %d items?"),delSel.count() ); 2852 description.sprintf(i18n(" %d items?"),delSel.count() );
2853 } 2853 }
2854 while ( incidence ) { 2854 while ( incidence ) {
2855 Incidence *in = incidence->clone(); 2855 Incidence *in = incidence->clone();
2856 if ( ! in->summary().isEmpty() ) { 2856 if ( ! in->summary().isEmpty() ) {
2857 in->setDescription(""); 2857 in->setDescription("");
2858 } else { 2858 } else {
2859 in->setSummary( in->description().left(20)); 2859 in->setSummary( in->description().left(20));
2860 in->setDescription(""); 2860 in->setDescription("");
2861 } 2861 }
2862 if ( addText ) 2862 if ( addText )
2863 description += in->summary() + "\n"; 2863 description += in->summary() + "\n";
2864 cal->addIncidence( in ); 2864 cal->addIncidence( in );
2865 incidence = delSel.next(); 2865 incidence = delSel.next();
2866 } 2866 }
2867 if ( beamDialog->beamVcal() ) { 2867 if ( beamDialog->beamVcal() ) {
2868 fn += ".vcs"; 2868 fn += ".vcs";
2869 FileStorage storage( cal, fn, new VCalFormat ); 2869 FileStorage storage( cal, fn, new VCalFormat );
2870 storage.save(); 2870 storage.save();
2871 } else { 2871 } else {
2872 fn += ".ics"; 2872 fn += ".ics";
2873 FileStorage storage( cal, fn, new ICalFormat( ) ); 2873 FileStorage storage( cal, fn, new ICalFormat( ) );
2874 storage.save(); 2874 storage.save();
2875 } 2875 }
2876 delete cal; 2876 delete cal;
2877 mes = i18n("KO/Pi: Ready for beaming"); 2877 mes = i18n("KO/Pi: Ready for beaming");
2878 topLevelWidget()->setCaption(mes); 2878 topLevelWidget()->setCaption(mes);
2879 KApplication::convert2latin1( fn ); 2879 KApplication::convert2latin1( fn );
2880#ifndef DESKTOP_VERSION 2880#ifndef DESKTOP_VERSION
2881 Ir *ir = new Ir( this ); 2881 Ir *ir = new Ir( this );
2882 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2882 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2883 ir->send( fn, description, "text/x-vCalendar" ); 2883 ir->send( fn, description, "text/x-vCalendar" );
2884#endif 2884#endif
2885 } 2885 }
2886} 2886}
2887void CalendarView::beamDone( Ir *ir ) 2887void CalendarView::beamDone( Ir *ir )
2888{ 2888{
2889#ifndef DESKTOP_VERSION 2889#ifndef DESKTOP_VERSION
2890 delete ir; 2890 delete ir;
2891#endif 2891#endif
2892 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2892 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2893 topLevelWidget()->raise(); 2893 topLevelWidget()->raise();
2894} 2894}
2895 2895
2896void CalendarView::moveIncidence(Incidence * inc ) 2896void CalendarView::moveIncidence(Incidence * inc )
2897{ 2897{
2898 if ( !inc ) return; 2898 if ( !inc ) return;
2899 showDatePickerPopup(); 2899 showDatePickerPopup();
2900 mDatePickerMode = 2; 2900 mDatePickerMode = 2;
2901 mMoveIncidence = inc ; 2901 mMoveIncidence = inc ;
2902 QDate da; 2902 QDate da;
2903 if ( mMoveIncidence->typeID() == todoID ) { 2903 if ( mMoveIncidence->typeID() == todoID ) {
2904 Todo * to = (Todo *) mMoveIncidence; 2904 Todo * to = (Todo *) mMoveIncidence;
2905 if ( to->hasDueDate() ) 2905 if ( to->hasDueDate() )
2906 da = to->dtDue().date(); 2906 da = to->dtDue().date();
2907 else 2907 else
2908 da = QDate::currentDate(); 2908 da = QDate::currentDate();
2909 } else { 2909 } else {
2910 da = mMoveIncidence->dtStart().date(); 2910 da = mMoveIncidence->dtStart().date();
2911 } 2911 }
2912 //PENDING set date for recurring incidence to date of recurrence 2912 //PENDING set date for recurring incidence to date of recurrence
2913 //mMoveIncidenceOldDate; 2913 //mMoveIncidenceOldDate;
2914 mDatePicker->setDate( da ); 2914 mDatePicker->setDate( da );
2915} 2915}
2916void CalendarView::showDatePickerPopup() 2916void CalendarView::showDatePickerPopup()
2917{ 2917{
2918 if ( mDateFrame->isVisible() ) 2918 if ( mDateFrame->isVisible() )
2919 mDateFrame->hide(); 2919 mDateFrame->hide();
2920 else { 2920 else {
2921 int offX = 0, offY = 0; 2921 int offX = 0, offY = 0;
2922#ifdef DESKTOP_VERSION 2922#ifdef DESKTOP_VERSION
2923 int w =mDatePicker->sizeHint().width() ; 2923 int w =mDatePicker->sizeHint().width() ;
2924 int h = mDatePicker->sizeHint().height() ; 2924 int h = mDatePicker->sizeHint().height() ;
2925 int dw = topLevelWidget()->width(); 2925 int dw = topLevelWidget()->width();
2926 int dh = topLevelWidget()->height(); 2926 int dh = topLevelWidget()->height();
2927 offX = topLevelWidget()->x(); 2927 offX = topLevelWidget()->x();
2928 offY = topLevelWidget()->y(); 2928 offY = topLevelWidget()->y();
2929#else 2929#else
2930 int w =mDatePicker->sizeHint().width() ; 2930 int w =mDatePicker->sizeHint().width() ;
2931 int h = mDatePicker->sizeHint().height() ; 2931 int h = mDatePicker->sizeHint().height() ;
2932 int dw = QApplication::desktop()->width(); 2932 int dw = QApplication::desktop()->width();
2933 int dh = QApplication::desktop()->height(); 2933 int dh = QApplication::desktop()->height();
2934#endif 2934#endif
2935 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2935 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2936 mDateFrame->show(); 2936 mDateFrame->show();
2937 } 2937 }
2938} 2938}
2939void CalendarView::showDatePicker( ) 2939void CalendarView::showDatePicker( )
2940{ 2940{
2941 showDatePickerPopup(); 2941 showDatePickerPopup();
2942 mDatePickerMode = 1; 2942 mDatePickerMode = 1;
2943 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2943 mDatePicker->setDate( mNavigator->selectedDates().first() );
2944} 2944}
2945 2945
2946void CalendarView::showEventEditor() 2946void CalendarView::showEventEditor()
2947{ 2947{
2948#ifdef DESKTOP_VERSION 2948#ifdef DESKTOP_VERSION
2949 int x,y,w,h; 2949 int x,y,w,h;
2950 x = mEventEditor->geometry().x(); 2950 x = mEventEditor->geometry().x();
2951 y = mEventEditor->geometry().y(); 2951 y = mEventEditor->geometry().y();
2952 w = mEventEditor->width(); 2952 w = mEventEditor->width();
2953 h = mEventEditor->height(); 2953 h = mEventEditor->height();
2954 mEventEditor->show(); 2954 mEventEditor->show();
2955 mEventEditor->setGeometry(x,y,w,h); 2955 mEventEditor->setGeometry(x,y,w,h);
2956#else 2956#else
2957 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2957 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2958 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2958 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2959 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2959 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2960 qApp->processEvents(); 2960 qApp->processEvents();
2961 delete mEventEditor; 2961 delete mEventEditor;
2962 mEventEditor = mDialogManager->getEventEditor(); 2962 mEventEditor = mDialogManager->getEventEditor();
2963 topLevelWidget()->setCaption( i18n("") ); 2963 topLevelWidget()->setCaption( i18n("") );
2964 } 2964 }
2965 mEventEditor->showMaximized(); 2965 mEventEditor->showMaximized();
2966#endif 2966#endif
2967} 2967}
2968void CalendarView::showTodoEditor() 2968void CalendarView::showTodoEditor()
2969{ 2969{
2970#ifdef DESKTOP_VERSION 2970#ifdef DESKTOP_VERSION
2971 int x,y,w,h; 2971 int x,y,w,h;
2972 x = mTodoEditor->geometry().x(); 2972 x = mTodoEditor->geometry().x();
2973 y = mTodoEditor->geometry().y(); 2973 y = mTodoEditor->geometry().y();
2974 w = mTodoEditor->width(); 2974 w = mTodoEditor->width();
2975 h = mTodoEditor->height(); 2975 h = mTodoEditor->height();
2976 mTodoEditor->show(); 2976 mTodoEditor->show();
2977 mTodoEditor->setGeometry(x,y,w,h); 2977 mTodoEditor->setGeometry(x,y,w,h);
2978#else 2978#else
2979 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2979 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2980 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2980 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2981 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2981 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2982 qApp->processEvents(); 2982 qApp->processEvents();
2983 delete mTodoEditor; 2983 delete mTodoEditor;
2984 mTodoEditor = mDialogManager->getTodoEditor(); 2984 mTodoEditor = mDialogManager->getTodoEditor();
2985 topLevelWidget()->setCaption( i18n("") ); 2985 topLevelWidget()->setCaption( i18n("") );
2986 } 2986 }
2987 mTodoEditor->showMaximized(); 2987 mTodoEditor->showMaximized();
2988#endif 2988#endif
2989} 2989}
2990 2990
2991void CalendarView::cloneIncidence() 2991void CalendarView::cloneIncidence()
2992{ 2992{
2993 Incidence *incidence = currentSelection(); 2993 Incidence *incidence = currentSelection();
2994 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2994 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2995 if ( incidence ) { 2995 if ( incidence ) {
2996 cloneIncidence(incidence); 2996 cloneIncidence(incidence);
2997 } 2997 }
2998} 2998}
2999void CalendarView::moveIncidence() 2999void CalendarView::moveIncidence()
3000{ 3000{
3001 Incidence *incidence = currentSelection(); 3001 Incidence *incidence = currentSelection();
3002 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3002 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3003 if ( incidence ) { 3003 if ( incidence ) {
3004 moveIncidence(incidence); 3004 moveIncidence(incidence);
3005 } 3005 }
3006} 3006}
3007void CalendarView::beamIncidence() 3007void CalendarView::beamIncidence()
3008{ 3008{
3009 Incidence *incidence = currentSelection(); 3009 Incidence *incidence = currentSelection();
3010 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3010 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3011 if ( incidence ) { 3011 if ( incidence ) {
3012 beamIncidence(incidence); 3012 beamIncidence(incidence);
3013 } 3013 }
3014} 3014}
3015void CalendarView::toggleCancelIncidence() 3015void CalendarView::toggleCancelIncidence()
3016{ 3016{
3017 Incidence *incidence = currentSelection(); 3017 Incidence *incidence = currentSelection();
3018 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3018 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3019 if ( incidence ) { 3019 if ( incidence ) {
3020 cancelIncidence(incidence); 3020 cancelIncidence(incidence);
3021 } 3021 }
3022} 3022}
3023 3023
3024 3024
3025void CalendarView::cancelIncidence(Incidence * inc ) 3025void CalendarView::cancelIncidence(Incidence * inc )
3026{ 3026{
3027 inc->setCancelled( ! inc->cancelled() ); 3027 inc->setCancelled( ! inc->cancelled() );
3028 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 3028 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
3029 updateView(); 3029 updateView();
3030} 3030}
3031void CalendarView::cloneIncidence(Incidence * orgInc ) 3031void CalendarView::cloneIncidence(Incidence * orgInc )
3032{ 3032{
3033 Incidence * newInc = orgInc->clone(); 3033 Incidence * newInc = orgInc->clone();
3034 newInc->recreate(); 3034 newInc->recreate();
3035 3035
3036 if ( newInc->typeID() == todoID ) { 3036 if ( newInc->typeID() == todoID ) {
3037 Todo* t = (Todo*) newInc; 3037 Todo* t = (Todo*) newInc;
3038 bool cloneSub = false; 3038 bool cloneSub = false;
3039 if ( orgInc->relations().count() ) { 3039 if ( orgInc->relations().count() ) {
3040 int result = KMessageBox::warningYesNoCancel(this, 3040 int result = KMessageBox::warningYesNoCancel(this,
3041 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), 3041 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
3042 i18n("Todo has subtodos"), 3042 i18n("Todo has subtodos"),
3043 i18n("Yes"), 3043 i18n("Yes"),
3044 i18n("No")); 3044 i18n("No"));
3045 3045
3046 if ( result == KMessageBox::Cancel ) { 3046 if ( result == KMessageBox::Cancel ) {
3047 delete t; 3047 delete t;
3048 return; 3048 return;
3049 } 3049 }
3050 if (result == KMessageBox::Yes) cloneSub = true; 3050 if (result == KMessageBox::Yes) cloneSub = true;
3051 } 3051 }
3052 showTodoEditor(); 3052 showTodoEditor();
3053 mTodoEditor->editTodo( t ); 3053 mTodoEditor->editTodo( t );
3054 if ( mTodoEditor->exec() ) { 3054 if ( mTodoEditor->exec() ) {
3055 if ( cloneSub ) { 3055 if ( cloneSub ) {
3056 orgInc->cloneRelations( t ); 3056 orgInc->cloneRelations( t );
3057 mCalendar->addIncidenceBranch( t ); 3057 mCalendar->addIncidenceBranch( t );
3058 updateView(); 3058 updateView();
3059 3059
3060 } else { 3060 } else {
3061 mCalendar->addTodo( t ); 3061 mCalendar->addTodo( t );
3062 updateView(); 3062 updateView();
3063 } 3063 }
3064 } else { 3064 } else {
3065 delete t; 3065 delete t;
3066 } 3066 }
3067 } 3067 }
3068 else { 3068 else {
3069 Event* e = (Event*) newInc; 3069 Event* e = (Event*) newInc;
3070 showEventEditor(); 3070 showEventEditor();
3071 mEventEditor->editEvent( e ); 3071 mEventEditor->editEvent( e );
3072 if ( mEventEditor->exec() ) { 3072 if ( mEventEditor->exec() ) {
3073 mCalendar->addEvent( e ); 3073 mCalendar->addEvent( e );
3074 updateView(); 3074 updateView();
3075 } else { 3075 } else {
3076 delete e; 3076 delete e;
3077 } 3077 }
3078 } 3078 }
3079 setActiveWindow(); 3079 setActiveWindow();
3080} 3080}
3081 3081
3082void CalendarView::newEvent() 3082void CalendarView::newEvent()
3083{ 3083{
3084 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 3084 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
3085 KOAgendaView *aView = mViewManager->agendaView(); 3085 KOAgendaView *aView = mViewManager->agendaView();
3086 if (aView) { 3086 if (aView) {
3087 if (aView->selectionStart().isValid()) { 3087 if (aView->selectionStart().isValid()) {
3088 if (aView->selectedIsAllDay()) { 3088 if (aView->selectedIsAllDay()) {
3089 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 3089 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
3090 } else { 3090 } else {
3091 newEvent(aView->selectionStart(),aView->selectionEnd()); 3091 newEvent(aView->selectionStart(),aView->selectionEnd());
3092 } 3092 }
3093 return; 3093 return;
3094 } 3094 }
3095 } 3095 }
3096 3096
3097 QDate date = mNavigator->selectedDates().first(); 3097 QDate date = mNavigator->selectedDates().first();
3098 QDateTime current = QDateTime::currentDateTime(); 3098 QDateTime current = QDateTime::currentDateTime();
3099 if ( date <= current.date() ) { 3099 if ( date <= current.date() ) {
3100 int hour = current.time().hour() +1; 3100 int hour = current.time().hour() +1;
3101 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 3101 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
3102 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 3102 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
3103 } else 3103 } else
3104 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 3104 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
3105 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 3105 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
3106 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 3106 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
3107} 3107}
3108 3108
3109void CalendarView::newEvent(QDateTime fh) 3109void CalendarView::newEvent(QDateTime fh)
3110{ 3110{
3111 newEvent(fh, 3111 newEvent(fh,
3112 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 3112 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
3113} 3113}
3114 3114
3115void CalendarView::newEvent(QDate dt) 3115void CalendarView::newEvent(QDate dt)
3116{ 3116{
3117 newEvent(QDateTime(dt, QTime(0,0,0)), 3117 newEvent(QDateTime(dt, QTime(0,0,0)),
3118 QDateTime(dt, QTime(0,0,0)), true); 3118 QDateTime(dt, QTime(0,0,0)), true);
3119} 3119}
3120void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) 3120void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint)
3121{ 3121{
3122 newEvent(fromHint, toHint, false); 3122 newEvent(fromHint, toHint, false);
3123} 3123}
3124void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 3124void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
3125{ 3125{
3126 3126
3127 showEventEditor(); 3127 showEventEditor();
3128 mEventEditor->newEvent(fromHint,toHint,allDay); 3128 mEventEditor->newEvent(fromHint,toHint,allDay);
3129 if ( mFilterView->filtersEnabled() ) { 3129 if ( mFilterView->filtersEnabled() ) {
3130 CalFilter *filter = mFilterView->selectedFilter(); 3130 CalFilter *filter = mFilterView->selectedFilter();
3131 if (filter && filter->showCategories()) { 3131 if (filter && filter->showCategories()) {
3132 mEventEditor->setCategories(filter->categoryList().join(",") ); 3132 mEventEditor->setCategories(filter->categoryList().join(",") );
3133 } 3133 }
3134 if ( filter ) 3134 if ( filter )
3135 mEventEditor->setSecrecy( filter->getSecrecy() ); 3135 mEventEditor->setSecrecy( filter->getSecrecy() );
3136 } 3136 }
3137 mEventEditor->exec(); 3137 mEventEditor->exec();
3138 setActiveWindow(); 3138 setActiveWindow();
3139} 3139}
3140void CalendarView::todoAdded(Todo * t) 3140void CalendarView::todoAdded(Todo * t)
3141{ 3141{
3142 3142
3143 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 3143 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
3144 updateTodoViews(); 3144 updateTodoViews();
3145} 3145}
3146void CalendarView::todoChanged(Todo * t) 3146void CalendarView::todoChanged(Todo * t)
3147{ 3147{
3148 emit todoModified( t, 4 ); 3148 emit todoModified( t, 4 );
3149 // updateTodoViews(); 3149 // updateTodoViews();
3150} 3150}
3151void CalendarView::todoToBeDeleted(Todo *) 3151void CalendarView::todoToBeDeleted(Todo *)
3152{ 3152{
3153 //qDebug("todoToBeDeleted(Todo *) "); 3153 //qDebug("todoToBeDeleted(Todo *) ");
3154 updateTodoViews(); 3154 updateTodoViews();
3155} 3155}
3156void CalendarView::todoDeleted() 3156void CalendarView::todoDeleted()
3157{ 3157{
3158 //qDebug(" todoDeleted()"); 3158 //qDebug(" todoDeleted()");
3159 updateTodoViews(); 3159 updateTodoViews();
3160} 3160}
3161 3161
3162 3162
3163void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) 3163void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
3164{ 3164{
3165 showTodoEditor(); 3165 showTodoEditor();
3166 mTodoEditor->newTodo(dt,0,allday); 3166 mTodoEditor->newTodo(dt,0,allday);
3167 if ( mFilterView->filtersEnabled() ) { 3167 if ( mFilterView->filtersEnabled() ) {
3168 CalFilter *filter = mFilterView->selectedFilter(); 3168 CalFilter *filter = mFilterView->selectedFilter();
3169 if (filter && filter->showCategories()) { 3169 if (filter && filter->showCategories()) {
3170 mTodoEditor->setCategories(filter->categoryList().join(",") ); 3170 mTodoEditor->setCategories(filter->categoryList().join(",") );
3171 } 3171 }
3172 if ( filter ) 3172 if ( filter )
3173 mTodoEditor->setSecrecy( filter->getSecrecy() ); 3173 mTodoEditor->setSecrecy( filter->getSecrecy() );
3174 } 3174 }
3175 mTodoEditor->exec(); 3175 mTodoEditor->exec();
3176 setActiveWindow(); 3176 setActiveWindow();
3177} 3177}
3178 3178
3179void CalendarView::newTodo() 3179void CalendarView::newTodo()
3180{ 3180{
3181 newTodoDateTime( QDateTime(),true ); 3181 newTodoDateTime( QDateTime(),true );
3182} 3182}
3183 3183
3184void CalendarView::newSubTodo() 3184void CalendarView::newSubTodo()
3185{ 3185{
3186 Todo *todo = selectedTodo(); 3186 Todo *todo = selectedTodo();
3187 if ( todo ) newSubTodo( todo ); 3187 if ( todo ) newSubTodo( todo );
3188} 3188}
3189 3189
3190void CalendarView::newSubTodo(Todo *parentEvent) 3190void CalendarView::newSubTodo(Todo *parentEvent)
3191{ 3191{
3192 3192
3193 showTodoEditor(); 3193 showTodoEditor();
3194 mTodoEditor->newTodo(QDateTime(),parentEvent,true); 3194 mTodoEditor->newTodo(QDateTime(),parentEvent,true);
3195 mTodoEditor->exec(); 3195 mTodoEditor->exec();
3196 setActiveWindow(); 3196 setActiveWindow();
3197} 3197}
3198 3198
3199void CalendarView::newFloatingEvent() 3199void CalendarView::newFloatingEvent()
3200{ 3200{
3201 DateList tmpList = mNavigator->selectedDates(); 3201 DateList tmpList = mNavigator->selectedDates();
3202 QDate date = tmpList.first(); 3202 QDate date = tmpList.first();
3203 3203
3204 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 3204 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
3205 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 3205 QDateTime( date, QTime( 12, 0, 0 ) ), true );
3206} 3206}
3207 3207
3208 3208
3209void CalendarView::editEvent( Event *event ) 3209void CalendarView::editEvent( Event *event )
3210{ 3210{
3211 3211
3212 if ( !event ) return; 3212 if ( !event ) return;
3213 if ( event->isReadOnly() ) { 3213 if ( event->isReadOnly() ) {
3214 showEvent( event ); 3214 showEvent( event );
3215 return; 3215 return;
3216 } 3216 }
3217 showEventEditor(); 3217 showEventEditor();
3218 mEventEditor->editEvent( event , mFlagEditDescription); 3218 mEventEditor->editEvent( event , mFlagEditDescription);
3219 mEventEditor->exec(); 3219 mEventEditor->exec();
3220 setActiveWindow(); 3220 setActiveWindow();
3221 3221
3222} 3222}
3223void CalendarView::editJournal( Journal *jour ) 3223void CalendarView::editJournal( Journal *jour )
3224{ 3224{
3225 if ( !jour ) return; 3225 if ( !jour ) return;
3226 mDialogManager->hideSearchDialog(); 3226 mDialogManager->hideSearchDialog();
3227 mViewManager->showJournalView(); 3227 mViewManager->showJournalView();
3228 mNavigator->slotDaySelect( jour->dtStart().date() ); 3228 mNavigator->slotDaySelect( jour->dtStart().date() );
3229} 3229}
3230void CalendarView::editTodo( Todo *todo ) 3230void CalendarView::editTodo( Todo *todo )
3231{ 3231{
3232 if ( !todo ) return; 3232 if ( !todo ) return;
3233 3233
3234 if ( todo->isReadOnly() ) { 3234 if ( todo->isReadOnly() ) {
3235 showTodo( todo ); 3235 showTodo( todo );
3236 return; 3236 return;
3237 } 3237 }
3238 showTodoEditor(); 3238 showTodoEditor();
3239 mTodoEditor->editTodo( todo ,mFlagEditDescription); 3239 mTodoEditor->editTodo( todo ,mFlagEditDescription);
3240 mTodoEditor->exec(); 3240 mTodoEditor->exec();
3241 setActiveWindow(); 3241 setActiveWindow();
3242 3242
3243} 3243}
3244 3244
3245KOEventViewerDialog* CalendarView::getEventViewerDialog() 3245KOEventViewerDialog* CalendarView::getEventViewerDialog()
3246{ 3246{
3247 if ( !mEventViewerDialog ) { 3247 if ( !mEventViewerDialog ) {
3248 mEventViewerDialog = new KOEventViewerDialog(0); 3248 mEventViewerDialog = new KOEventViewerDialog(0);
3249 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 3249 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
3250 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 3250 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
3251 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 3251 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
3252 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 3252 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
3253 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 3253 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
3254 viewManager(), SLOT( showAgendaView( bool ) ) ); 3254 viewManager(), SLOT( showAgendaView( bool ) ) );
3255 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), 3255 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()),
3256 this, SLOT( slotViewerClosed() ) ); 3256 this, SLOT( slotViewerClosed() ) );
3257 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 3257 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
3258 this, SLOT( todoChanged(Todo *) ) ); 3258 this, SLOT( todoChanged(Todo *) ) );
3259 mEventViewerDialog->resize( 640, 480 ); 3259 mEventViewerDialog->resize( 640, 480 );
3260 3260
3261 } 3261 }
3262 return mEventViewerDialog; 3262 return mEventViewerDialog;
3263} 3263}
3264void CalendarView::showEvent(Event *event) 3264void CalendarView::showEvent(Event *event)
3265{ 3265{
3266 getEventViewerDialog()->setEvent(event); 3266 getEventViewerDialog()->setEvent(event);
3267 getEventViewerDialog()->showMe(); 3267 getEventViewerDialog()->showMe();
3268} 3268}
3269 3269
3270void CalendarView::showTodo(Todo *event) 3270void CalendarView::showTodo(Todo *event)
3271{ 3271{
3272 getEventViewerDialog()->setTodo(event); 3272 getEventViewerDialog()->setTodo(event);
3273 getEventViewerDialog()->showMe(); 3273 getEventViewerDialog()->showMe();
3274} 3274}
3275void CalendarView::showJournal( Journal *jour ) 3275void CalendarView::showJournal( Journal *jour )
3276{ 3276{
3277 getEventViewerDialog()->setJournal(jour); 3277 getEventViewerDialog()->setJournal(jour);
3278 getEventViewerDialog()->showMe(); 3278 getEventViewerDialog()->showMe();
3279 3279
3280} 3280}
3281// void CalendarView::todoModified (Todo *event, int changed) 3281// void CalendarView::todoModified (Todo *event, int changed)
3282// { 3282// {
3283// // if (mDialogList.find (event) != mDialogList.end ()) { 3283// // if (mDialogList.find (event) != mDialogList.end ()) {
3284// // kdDebug() << "Todo modified and open" << endl; 3284// // kdDebug() << "Todo modified and open" << endl;
3285// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 3285// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
3286// // temp->modified (changed); 3286// // temp->modified (changed);
3287 3287
3288// // } 3288// // }
3289 3289
3290// mViewManager->updateView(); 3290// mViewManager->updateView();
3291// } 3291// }
3292 3292
3293void CalendarView::appointment_show() 3293void CalendarView::appointment_show()
3294{ 3294{
3295 Event *anEvent = 0; 3295 Event *anEvent = 0;
3296 3296
3297 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3297 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3298 3298
3299 if (mViewManager->currentView()->isEventView()) { 3299 if (mViewManager->currentView()->isEventView()) {
3300 if ( incidence && incidence->typeID() == eventID ) { 3300 if ( incidence && incidence->typeID() == eventID ) {
3301 anEvent = static_cast<Event *>(incidence); 3301 anEvent = static_cast<Event *>(incidence);
3302 } 3302 }
3303 } 3303 }
3304 3304
3305 if (!anEvent) { 3305 if (!anEvent) {
3306 KNotifyClient::beep(); 3306 KNotifyClient::beep();
3307 return; 3307 return;
3308 } 3308 }
3309 3309
3310 showEvent(anEvent); 3310 showEvent(anEvent);
3311} 3311}
3312 3312
3313void CalendarView::appointment_edit() 3313void CalendarView::appointment_edit()
3314{ 3314{
3315 Event *anEvent = 0; 3315 Event *anEvent = 0;
3316 3316
3317 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3317 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3318 3318
3319 if (mViewManager->currentView()->isEventView()) { 3319 if (mViewManager->currentView()->isEventView()) {
3320 if ( incidence && incidence->typeID() == eventID ) { 3320 if ( incidence && incidence->typeID() == eventID ) {
3321 anEvent = static_cast<Event *>(incidence); 3321 anEvent = static_cast<Event *>(incidence);
3322 } 3322 }
3323 } 3323 }
3324 3324
3325 if (!anEvent) { 3325 if (!anEvent) {
3326 KNotifyClient::beep(); 3326 KNotifyClient::beep();
3327 return; 3327 return;
3328 } 3328 }
3329 3329
3330 editEvent(anEvent); 3330 editEvent(anEvent);
3331} 3331}
3332 3332
3333void CalendarView::appointment_delete() 3333void CalendarView::appointment_delete()
3334{ 3334{
3335 Event *anEvent = 0; 3335 Event *anEvent = 0;
3336 3336
3337 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3337 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3338 3338
3339 if (mViewManager->currentView()->isEventView()) { 3339 if (mViewManager->currentView()->isEventView()) {
3340 if ( incidence && incidence->typeID() == eventID ) { 3340 if ( incidence && incidence->typeID() == eventID ) {
3341 anEvent = static_cast<Event *>(incidence); 3341 anEvent = static_cast<Event *>(incidence);
3342 } 3342 }
3343 } 3343 }
3344 3344
3345 if (!anEvent) { 3345 if (!anEvent) {
3346 KNotifyClient::beep(); 3346 KNotifyClient::beep();
3347 return; 3347 return;
3348 } 3348 }
3349 3349
3350 deleteEvent(anEvent); 3350 deleteEvent(anEvent);
3351} 3351}
3352 3352
3353void CalendarView::todo_resub( Todo * parent, Todo * sub ) 3353void CalendarView::todo_resub( Todo * parent, Todo * sub )
3354{ 3354{
3355 if (!sub) return; 3355 if (!sub) return;
3356 if ( sub->relatedTo() == parent ) 3356 if ( sub->relatedTo() == parent )
3357 return; 3357 return;
3358 sub->setRelatedTo(parent); 3358 sub->setRelatedTo(parent);
3359 sub->updated(); 3359 sub->updated();
3360 setModified(true); 3360 setModified(true);
3361 updateView(); 3361 updateView();
3362} 3362}
3363void CalendarView::todo_unsub(Todo *anTodo ) 3363void CalendarView::todo_unsub(Todo *anTodo )
3364{ 3364{
3365 todo_resub( 0, anTodo ); 3365 todo_resub( 0, anTodo );
3366} 3366}
3367 3367
3368void CalendarView::deleteTodo(Todo *todo) 3368void CalendarView::deleteTodo(Todo *todo)
3369{ 3369{
3370 if (!todo) { 3370 if (!todo) {
3371 KNotifyClient::beep(); 3371 KNotifyClient::beep();
3372 return; 3372 return;
3373 } 3373 }
3374 if (KOPrefs::instance()->mConfirm) { 3374 if (KOPrefs::instance()->mConfirm) {
3375 QString text = todo->summary().left(20); 3375 QString text = todo->summary().left(20);
3376 if (!todo->relations().isEmpty()) { 3376 if (!todo->relations().isEmpty()) {
3377 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); 3377 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
3378 3378
3379 } 3379 }
3380 switch (msgItemDelete(text)) { 3380 switch (msgItemDelete(text)) {
3381 case KMessageBox::Continue: // OK 3381 case KMessageBox::Continue: // OK
3382 bool deleteT = false; 3382 bool deleteT = false;
3383 if (!todo->relations().isEmpty()) { 3383 if (!todo->relations().isEmpty()) {
3384 deleteT = removeCompletedSubTodos( todo ); 3384 deleteT = removeCompletedSubTodos( todo );
3385 } 3385 }
3386 // deleteT == true: todo already deleted in removeCompletedSubTodos 3386 // deleteT == true: todo already deleted in removeCompletedSubTodos
3387 if ( !deleteT ) { 3387 if ( !deleteT ) {
3388 checkExternalId( todo ); 3388 checkExternalId( todo );
3389 calendar()->deleteTodo(todo); 3389 calendar()->deleteTodo(todo);
3390 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3390 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3391 updateView(); 3391 updateView();
3392 } 3392 }
3393 break; 3393 break;
3394 } // switch 3394 } // switch
3395 } else { 3395 } else {
3396 checkExternalId( todo ); 3396 checkExternalId( todo );
3397 mCalendar->deleteTodo(todo); 3397 mCalendar->deleteTodo(todo);
3398 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 3398 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
3399 updateView(); 3399 updateView();
3400 } 3400 }
3401 3401
3402 emit updateSearchDialog(); 3402 emit updateSearchDialog();
3403} 3403}
3404void CalendarView::deleteJournal(Journal *jour) 3404void CalendarView::deleteJournal(Journal *jour)
3405{ 3405{
3406 if (!jour) { 3406 if (!jour) {
3407 KNotifyClient::beep(); 3407 KNotifyClient::beep();
3408 return; 3408 return;
3409 } 3409 }
3410 if (KOPrefs::instance()->mConfirm) { 3410 if (KOPrefs::instance()->mConfirm) {
3411 switch (msgItemDelete( jour->description().left(20))) { 3411 switch (msgItemDelete( jour->description().left(20))) {
3412 case KMessageBox::Continue: // OK 3412 case KMessageBox::Continue: // OK
3413 calendar()->deleteJournal(jour); 3413 calendar()->deleteJournal(jour);
3414 updateView(); 3414 updateView();
3415 break; 3415 break;
3416 } // switch 3416 } // switch
3417 } else { 3417 } else {
3418 calendar()->deleteJournal(jour);; 3418 calendar()->deleteJournal(jour);;
3419 updateView(); 3419 updateView();
3420 } 3420 }
3421 emit updateSearchDialog(); 3421 emit updateSearchDialog();
3422} 3422}
3423 3423
3424void CalendarView::deleteEvent(Event *anEvent) 3424void CalendarView::deleteEvent(Event *anEvent)
3425{ 3425{
3426 if (!anEvent) { 3426 if (!anEvent) {
3427 KNotifyClient::beep(); 3427 KNotifyClient::beep();
3428 return; 3428 return;
3429 } 3429 }
3430 3430
3431 if (anEvent->recurrence()->doesRecur()) { 3431 if (anEvent->recurrence()->doesRecur()) {
3432 QDate itemDate = mViewManager->currentSelectionDate(); 3432 QDate itemDate = mViewManager->currentSelectionDate();
3433 int km; 3433 int km;
3434 if (!itemDate.isValid()) { 3434 if (!itemDate.isValid()) {
3435 //kdDebug() << "Date Not Valid" << endl; 3435 //kdDebug() << "Date Not Valid" << endl;
3436 if (KOPrefs::instance()->mConfirm) { 3436 if (KOPrefs::instance()->mConfirm) {
3437 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3437 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3438 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 3438 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
3439 i18n("KO/Pi Confirmation"),i18n("Delete All")); 3439 i18n("KO/Pi Confirmation"),i18n("Delete All"));
3440 if ( km == KMessageBox::Continue ) 3440 if ( km == KMessageBox::Continue )
3441 km = KMessageBox::No; // No = all below 3441 km = KMessageBox::No; // No = all below
3442 } else 3442 } else
3443 km = KMessageBox::No; 3443 km = KMessageBox::No;
3444 } else { 3444 } else {
3445 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 3445 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
3446 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 3446 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
3447 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 3447 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
3448 i18n("KO/Pi Confirmation"),i18n("Current"), 3448 i18n("KO/Pi Confirmation"),i18n("Current"),
3449 i18n("All")); 3449 i18n("All"));
3450 } 3450 }
3451 switch(km) { 3451 switch(km) {
3452 3452
3453 case KMessageBox::No: // Continue // all 3453 case KMessageBox::No: // Continue // all
3454 //qDebug("KMessageBox::No "); 3454 //qDebug("KMessageBox::No ");
3455 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3455 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3456 schedule(Scheduler::Cancel,anEvent); 3456 schedule(Scheduler::Cancel,anEvent);
3457 3457
3458 checkExternalId( anEvent); 3458 checkExternalId( anEvent);
3459 mCalendar->deleteEvent(anEvent); 3459 mCalendar->deleteEvent(anEvent);
3460 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 3460 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
3461 break; 3461 break;
3462 3462
3463 // Disabled because it does not work 3463 // Disabled because it does not work
3464 //#if 0 3464 //#if 0
3465 case KMessageBox::Yes: // just this one 3465 case KMessageBox::Yes: // just this one
3466 //QDate qd = mNavigator->selectedDates().first(); 3466 //QDate qd = mNavigator->selectedDates().first();
3467 //if (!qd.isValid()) { 3467 //if (!qd.isValid()) {
3468 // kdDebug() << "no date selected, or invalid date" << endl; 3468 // kdDebug() << "no date selected, or invalid date" << endl;
3469 // KNotifyClient::beep(); 3469 // KNotifyClient::beep();
3470 // return; 3470 // return;
3471 //} 3471 //}
3472 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 3472 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
3473 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 3473 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
3474 anEvent->addExDate(itemDate); 3474 anEvent->addExDate(itemDate);
3475 int duration = anEvent->recurrence()->duration(); 3475 int duration = anEvent->recurrence()->duration();
3476 if ( duration > 0 ) { 3476 if ( duration > 0 ) {
3477 anEvent->recurrence()->setDuration( duration - 1 ); 3477 anEvent->recurrence()->setDuration( duration - 1 );
3478 } 3478 }
3479 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 3479 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
3480 } 3480 }
3481 break; 3481 break;
3482 //#endif 3482 //#endif
3483 } // switch 3483 } // switch
3484 } else { 3484 } else {
3485 if (KOPrefs::instance()->mConfirm) { 3485 if (KOPrefs::instance()->mConfirm) {
3486 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 3486 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
3487 i18n("\nAre you sure you want\nto delete this event?"), 3487 i18n("\nAre you sure you want\nto delete this event?"),
3488 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 3488 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
3489 case KMessageBox::Continue: // OK 3489 case KMessageBox::Continue: // OK
3490 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3490 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3491 schedule(Scheduler::Cancel,anEvent); 3491 schedule(Scheduler::Cancel,anEvent);
3492 checkExternalId( anEvent); 3492 checkExternalId( anEvent);
3493 mCalendar->deleteEvent(anEvent); 3493 mCalendar->deleteEvent(anEvent);
3494 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3494 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3495 break; 3495 break;
3496 } // switch 3496 } // switch
3497 } else { 3497 } else {
3498 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 3498 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
3499 schedule(Scheduler::Cancel,anEvent); 3499 schedule(Scheduler::Cancel,anEvent);
3500 checkExternalId( anEvent); 3500 checkExternalId( anEvent);
3501 mCalendar->deleteEvent(anEvent); 3501 mCalendar->deleteEvent(anEvent);
3502 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 3502 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
3503 } 3503 }
3504 } // if-else 3504 } // if-else
3505 emit updateSearchDialog(); 3505 emit updateSearchDialog();
3506} 3506}
3507 3507
3508bool CalendarView::deleteEvent(const QString &uid) 3508bool CalendarView::deleteEvent(const QString &uid)
3509{ 3509{
3510 Event *ev = mCalendar->event(uid); 3510 Event *ev = mCalendar->event(uid);
3511 if (ev) { 3511 if (ev) {
3512 deleteEvent(ev); 3512 deleteEvent(ev);
3513 return true; 3513 return true;
3514 } else { 3514 } else {
3515 return false; 3515 return false;
3516 } 3516 }
3517} 3517}
3518 3518
3519/*****************************************************************************/ 3519/*****************************************************************************/
3520 3520
3521void CalendarView::action_mail() 3521void CalendarView::action_mail()
3522{ 3522{
3523#ifndef KORG_NOMAIL 3523#ifndef KORG_NOMAIL
3524 KOMailClient mailClient; 3524 KOMailClient mailClient;
3525 3525
3526 Incidence *incidence = currentSelection(); 3526 Incidence *incidence = currentSelection();
3527 3527
3528 if (!incidence) { 3528 if (!incidence) {
3529 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3529 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3530 return; 3530 return;
3531 } 3531 }
3532 if(incidence->attendeeCount() == 0 ) { 3532 if(incidence->attendeeCount() == 0 ) {
3533 KMessageBox::sorry(this, 3533 KMessageBox::sorry(this,
3534 i18n("Can't generate mail:\nNo attendees defined.\n")); 3534 i18n("Can't generate mail:\nNo attendees defined.\n"));
3535 return; 3535 return;
3536 } 3536 }
3537 3537
3538 CalendarLocal cal_tmp; 3538 CalendarLocal cal_tmp;
3539 Event *event = 0; 3539 Event *event = 0;
3540 Event *ev = 0; 3540 Event *ev = 0;
3541 if ( incidence && incidence->typeID() == eventID ) { 3541 if ( incidence && incidence->typeID() == eventID ) {
3542 event = static_cast<Event *>(incidence); 3542 event = static_cast<Event *>(incidence);
3543 ev = new Event(*event); 3543 ev = new Event(*event);
3544 cal_tmp.addEvent(ev); 3544 cal_tmp.addEvent(ev);
3545 } 3545 }
3546 ICalFormat mForm(); 3546 ICalFormat mForm();
3547 QString attachment = mForm.toString( &cal_tmp ); 3547 QString attachment = mForm.toString( &cal_tmp );
3548 if (ev) delete(ev); 3548 if (ev) delete(ev);
3549 3549
3550 mailClient.mailAttendees(currentSelection(), attachment); 3550 mailClient.mailAttendees(currentSelection(), attachment);
3551 3551
3552#endif 3552#endif
3553 3553
3554#if 0 3554#if 0
3555 Event *anEvent = 0; 3555 Event *anEvent = 0;
3556 if (mViewManager->currentView()->isEventView()) { 3556 if (mViewManager->currentView()->isEventView()) {
3557 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3557 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3558 } 3558 }
3559 3559
3560 if (!anEvent) { 3560 if (!anEvent) {
3561 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3561 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3562 return; 3562 return;
3563 } 3563 }
3564 if(anEvent->attendeeCount() == 0 ) { 3564 if(anEvent->attendeeCount() == 0 ) {
3565 KMessageBox::sorry(this, 3565 KMessageBox::sorry(this,
3566 i18n("Can't generate mail:\nNo attendees defined.\n")); 3566 i18n("Can't generate mail:\nNo attendees defined.\n"));
3567 return; 3567 return;
3568 } 3568 }
3569 3569
3570 mailobject.emailEvent(anEvent); 3570 mailobject.emailEvent(anEvent);
3571#endif 3571#endif
3572} 3572}
3573 3573
3574 3574
3575void CalendarView::schedule_publish(Incidence *incidence) 3575void CalendarView::schedule_publish(Incidence *incidence)
3576{ 3576{
3577 Event *event = 0; 3577 Event *event = 0;
3578 Todo *todo = 0; 3578 Todo *todo = 0;
3579 3579
3580 if (incidence == 0) { 3580 if (incidence == 0) {
3581 incidence = mViewManager->currentView()->selectedIncidences().first(); 3581 incidence = mViewManager->currentView()->selectedIncidences().first();
3582 if (incidence == 0) { 3582 if (incidence == 0) {
3583 incidence = mTodoList->selectedIncidences().first(); 3583 incidence = mTodoList->selectedIncidences().first();
3584 } 3584 }
3585 } 3585 }
3586 if ( incidence && incidence->typeID() == eventID ) { 3586 if ( incidence && incidence->typeID() == eventID ) {
3587 event = static_cast<Event *>(incidence); 3587 event = static_cast<Event *>(incidence);
3588 } else { 3588 } else {
3589 if ( incidence && incidence->typeID() == todoID ) { 3589 if ( incidence && incidence->typeID() == todoID ) {
3590 todo = static_cast<Todo *>(incidence); 3590 todo = static_cast<Todo *>(incidence);
3591 } 3591 }
3592 } 3592 }
3593 3593
3594 if (!event && !todo) { 3594 if (!event && !todo) {
3595 KMessageBox::sorry(this,i18n("No event selected.")); 3595 KMessageBox::sorry(this,i18n("No event selected."));
3596 return; 3596 return;
3597 } 3597 }
3598 3598
3599 PublishDialog *publishdlg = new PublishDialog(); 3599 PublishDialog *publishdlg = new PublishDialog();
3600 if (incidence->attendeeCount()>0) { 3600 if (incidence->attendeeCount()>0) {
3601 QPtrList<Attendee> attendees = incidence->attendees(); 3601 QPtrList<Attendee> attendees = incidence->attendees();
3602 attendees.first(); 3602 attendees.first();
3603 while ( attendees.current()!=0 ) { 3603 while ( attendees.current()!=0 ) {
3604 publishdlg->addAttendee(attendees.current()); 3604 publishdlg->addAttendee(attendees.current());
3605 attendees.next(); 3605 attendees.next();
3606 } 3606 }
3607 } 3607 }
3608 bool send = true; 3608 bool send = true;
3609 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3609 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3610 if ( publishdlg->exec() != QDialog::Accepted ) 3610 if ( publishdlg->exec() != QDialog::Accepted )
3611 send = false; 3611 send = false;
3612 } 3612 }
3613 if ( send ) { 3613 if ( send ) {
3614 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3614 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3615 if ( event ) { 3615 if ( event ) {
3616 Event *ev = new Event(*event); 3616 Event *ev = new Event(*event);
3617 ev->registerObserver(0); 3617 ev->registerObserver(0);
3618 ev->clearAttendees(); 3618 ev->clearAttendees();
3619 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3619 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3620 delete(ev); 3620 delete(ev);
3621 } 3621 }
3622 } else { 3622 } else {
3623 if ( todo ) { 3623 if ( todo ) {
3624 Todo *ev = new Todo(*todo); 3624 Todo *ev = new Todo(*todo);
3625 ev->registerObserver(0); 3625 ev->registerObserver(0);
3626 ev->clearAttendees(); 3626 ev->clearAttendees();
3627 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3627 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3628 delete(ev); 3628 delete(ev);
3629 } 3629 }
3630 } 3630 }
3631 } 3631 }
3632 } 3632 }
3633 delete publishdlg; 3633 delete publishdlg;
3634} 3634}
3635 3635
3636void CalendarView::schedule_request(Incidence *incidence) 3636void CalendarView::schedule_request(Incidence *incidence)
3637{ 3637{
3638 schedule(Scheduler::Request,incidence); 3638 schedule(Scheduler::Request,incidence);
3639} 3639}
3640 3640
3641void CalendarView::schedule_refresh(Incidence *incidence) 3641void CalendarView::schedule_refresh(Incidence *incidence)
3642{ 3642{
3643 schedule(Scheduler::Refresh,incidence); 3643 schedule(Scheduler::Refresh,incidence);
3644} 3644}
3645 3645
3646void CalendarView::schedule_cancel(Incidence *incidence) 3646void CalendarView::schedule_cancel(Incidence *incidence)
3647{ 3647{
3648 schedule(Scheduler::Cancel,incidence); 3648 schedule(Scheduler::Cancel,incidence);
3649} 3649}
3650 3650
3651void CalendarView::schedule_add(Incidence *incidence) 3651void CalendarView::schedule_add(Incidence *incidence)
3652{ 3652{
3653 schedule(Scheduler::Add,incidence); 3653 schedule(Scheduler::Add,incidence);
3654} 3654}
3655 3655
3656void CalendarView::schedule_reply(Incidence *incidence) 3656void CalendarView::schedule_reply(Incidence *incidence)
3657{ 3657{
3658 schedule(Scheduler::Reply,incidence); 3658 schedule(Scheduler::Reply,incidence);
3659} 3659}
3660 3660
3661void CalendarView::schedule_counter(Incidence *incidence) 3661void CalendarView::schedule_counter(Incidence *incidence)
3662{ 3662{
3663 schedule(Scheduler::Counter,incidence); 3663 schedule(Scheduler::Counter,incidence);
3664} 3664}
3665 3665
3666void CalendarView::schedule_declinecounter(Incidence *incidence) 3666void CalendarView::schedule_declinecounter(Incidence *incidence)
3667{ 3667{
3668 schedule(Scheduler::Declinecounter,incidence); 3668 schedule(Scheduler::Declinecounter,incidence);
3669} 3669}
3670 3670
3671void CalendarView::schedule_publish_freebusy(int daysToPublish) 3671void CalendarView::schedule_publish_freebusy(int daysToPublish)
3672{ 3672{
3673 QDateTime start = QDateTime::currentDateTime(); 3673 QDateTime start = QDateTime::currentDateTime();
3674 QDateTime end = start.addDays(daysToPublish); 3674 QDateTime end = start.addDays(daysToPublish);
3675 3675
3676 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3676 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3677 freebusy->setOrganizer(KOPrefs::instance()->email()); 3677 freebusy->setOrganizer(KOPrefs::instance()->email());
3678 3678
3679 3679
3680 PublishDialog *publishdlg = new PublishDialog(); 3680 PublishDialog *publishdlg = new PublishDialog();
3681 if ( publishdlg->exec() == QDialog::Accepted ) { 3681 if ( publishdlg->exec() == QDialog::Accepted ) {
3682 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3682 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3683 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3683 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3684 delete(freebusy); 3684 delete(freebusy);
3685 } 3685 }
3686 } 3686 }
3687 delete publishdlg; 3687 delete publishdlg;
3688} 3688}
3689 3689
3690void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3690void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3691{ 3691{
3692 Event *event = 0; 3692 Event *event = 0;
3693 Todo *todo = 0; 3693 Todo *todo = 0;
3694 3694
3695 if (incidence == 0) { 3695 if (incidence == 0) {
3696 incidence = mViewManager->currentView()->selectedIncidences().first(); 3696 incidence = mViewManager->currentView()->selectedIncidences().first();
3697 if (incidence == 0) { 3697 if (incidence == 0) {
3698 incidence = mTodoList->selectedIncidences().first(); 3698 incidence = mTodoList->selectedIncidences().first();
3699 } 3699 }
3700 } 3700 }
3701 if ( incidence && incidence->typeID() == eventID ) { 3701 if ( incidence && incidence->typeID() == eventID ) {
3702 event = static_cast<Event *>(incidence); 3702 event = static_cast<Event *>(incidence);
3703 } 3703 }
3704 if ( incidence && incidence->typeID() == todoID ) { 3704 if ( incidence && incidence->typeID() == todoID ) {
3705 todo = static_cast<Todo *>(incidence); 3705 todo = static_cast<Todo *>(incidence);
3706 } 3706 }
3707 3707
3708 if (!event && !todo) { 3708 if (!event && !todo) {
3709 KMessageBox::sorry(this,i18n("No event selected.")); 3709 KMessageBox::sorry(this,i18n("No event selected."));
3710 return; 3710 return;
3711 } 3711 }
3712 3712
3713 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3713 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3714 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3714 KMessageBox::sorry(this,i18n("The event has no attendees."));
3715 return; 3715 return;
3716 } 3716 }
3717 3717
3718 Event *ev = 0; 3718 Event *ev = 0;
3719 if (event) ev = new Event(*event); 3719 if (event) ev = new Event(*event);
3720 Todo *to = 0; 3720 Todo *to = 0;
3721 if (todo) to = new Todo(*todo); 3721 if (todo) to = new Todo(*todo);
3722 3722
3723 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3723 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3724 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3724 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3725 if (!me) { 3725 if (!me) {
3726 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3726 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3727 return; 3727 return;
3728 } 3728 }
3729 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3729 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3730 StatusDialog *statdlg = new StatusDialog(this); 3730 StatusDialog *statdlg = new StatusDialog(this);
3731 if (!statdlg->exec()==QDialog::Accepted) return; 3731 if (!statdlg->exec()==QDialog::Accepted) return;
3732 me->setStatus( statdlg->status() ); 3732 me->setStatus( statdlg->status() );
3733 delete(statdlg); 3733 delete(statdlg);
3734 } 3734 }
3735 Attendee *menew = new Attendee(*me); 3735 Attendee *menew = new Attendee(*me);
3736 if (ev) { 3736 if (ev) {
3737 ev->clearAttendees(); 3737 ev->clearAttendees();
3738 ev->addAttendee(menew,false); 3738 ev->addAttendee(menew,false);
3739 } else { 3739 } else {
3740 if (to) { 3740 if (to) {
3741 todo->clearAttendees(); 3741 todo->clearAttendees();
3742 todo->addAttendee(menew,false); 3742 todo->addAttendee(menew,false);
3743 } 3743 }
3744 } 3744 }
3745 } 3745 }
3746 3746
3747 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3747 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3748 if (ev) { 3748 if (ev) {
3749 if ( !dlg->addMessage(ev,method) ) delete(ev); 3749 if ( !dlg->addMessage(ev,method) ) delete(ev);
3750 } else { 3750 } else {
3751 if (to) { 3751 if (to) {
3752 if ( !dlg->addMessage(to,method) ) delete(to); 3752 if ( !dlg->addMessage(to,method) ) delete(to);
3753 } 3753 }
3754 } 3754 }
3755} 3755}
3756 3756
3757void CalendarView::openAddressbook() 3757void CalendarView::openAddressbook()
3758{ 3758{
3759 KRun::runCommand("kaddressbook"); 3759 KRun::runCommand("kaddressbook");
3760} 3760}
3761 3761
3762void CalendarView::setModified(bool modified) 3762void CalendarView::setModified(bool modified)
3763{ 3763{
3764 if ( modified ) 3764 if ( modified )
3765 emit signalmodified(); 3765 emit signalmodified();
3766 if (mModified != modified) { 3766 if (mModified != modified) {
3767 mModified = modified; 3767 mModified = modified;
3768 emit modifiedChanged(mModified); 3768 emit modifiedChanged(mModified);
3769 } 3769 }
3770} 3770}
3771 3771
3772bool CalendarView::isReadOnly() 3772bool CalendarView::isReadOnly()
3773{ 3773{
3774 return mReadOnly; 3774 return mReadOnly;
3775} 3775}
3776 3776
3777void CalendarView::setReadOnly(bool readOnly) 3777void CalendarView::setReadOnly(bool readOnly)
3778{ 3778{
3779 if (mReadOnly != readOnly) { 3779 if (mReadOnly != readOnly) {
3780 mReadOnly = readOnly; 3780 mReadOnly = readOnly;
3781 emit readOnlyChanged(mReadOnly); 3781 emit readOnlyChanged(mReadOnly);
3782 } 3782 }
3783} 3783}
3784 3784
3785bool CalendarView::isModified() 3785bool CalendarView::isModified()
3786{ 3786{
3787 return mModified; 3787 return mModified;
3788} 3788}
3789void CalendarView::slotprintSelInc() 3789void CalendarView::slotprintSelInc()
3790{ 3790{
3791 if ( currentSelection() == 0 ) { 3791 if ( currentSelection() == 0 ) {
3792 KMessageBox::sorry(this,i18n("There is nothing selected!")); 3792 KMessageBox::sorry(this,i18n("There is nothing selected!"));
3793 return; 3793 return;
3794 } 3794 }
3795 showIncidence(); 3795 showIncidence();
3796 getEventViewerDialog()->print(); 3796 getEventViewerDialog()->print();
3797 3797
3798} 3798}
3799void CalendarView::printSetup() 3799void CalendarView::printSetup()
3800{ 3800{
3801#ifndef KORG_NOPRINTER 3801#ifndef KORG_NOPRINTER
3802 createPrinter(); 3802 createPrinter();
3803 3803
3804 mCalPrinter->setupPrinter(); 3804 mCalPrinter->setupPrinter();
3805#endif 3805#endif
3806} 3806}
3807 3807
3808void CalendarView::print() 3808void CalendarView::print()
3809{ 3809{
3810#ifndef KORG_NOPRINTER 3810#ifndef KORG_NOPRINTER
3811 createPrinter(); 3811 createPrinter();
3812 3812
3813 DateList tmpDateList = mNavigator->selectedDates(); 3813 DateList tmpDateList = mNavigator->selectedDates();
3814 mCalPrinter->print(CalPrinter::Month, 3814 mCalPrinter->print(CalPrinter::Month,
3815 tmpDateList.first(), tmpDateList.last()); 3815 tmpDateList.first(), tmpDateList.last());
3816#endif 3816#endif
3817} 3817}
3818 3818
3819void CalendarView::printPreview() 3819void CalendarView::printPreview()
3820{ 3820{
3821#ifndef KORG_NOPRINTER 3821#ifndef KORG_NOPRINTER
3822 kdDebug() << "CalendarView::printPreview()" << endl; 3822 kdDebug() << "CalendarView::printPreview()" << endl;
3823 3823
3824 createPrinter(); 3824 createPrinter();
3825 3825
3826 DateList tmpDateList = mNavigator->selectedDates(); 3826 DateList tmpDateList = mNavigator->selectedDates();
3827 3827
3828 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3828 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3829 tmpDateList.last()); 3829 tmpDateList.last());
3830#endif 3830#endif
3831} 3831}
3832 3832
3833void CalendarView::exportICalendar() 3833void CalendarView::exportICalendar()
3834{ 3834{
3835 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3835 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3836 3836
3837 // Force correct extension 3837 // Force correct extension
3838 if (filename.right(4) != ".ics") filename += ".ics"; 3838 if (filename.right(4) != ".ics") filename += ".ics";
3839 3839
3840 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3840 FileStorage storage( mCalendar, filename, new ICalFormat() );
3841 storage.save(); 3841 storage.save();
3842} 3842}
3843 3843
3844bool CalendarView::exportVCalendar( QString filename ) 3844bool CalendarView::exportVCalendar( QString filename )
3845{ 3845{
3846 if (mCalendar->journals().count() > 0) { 3846 if (mCalendar->journals().count() > 0) {
3847 int result = KMessageBox::warningContinueCancel(this, 3847 int result = KMessageBox::warningContinueCancel(this,
3848 i18n("The journal entries can not be\nexported to a vCalendar file."), 3848 i18n("The journal entries can not be\nexported to a vCalendar file."),
3849 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3849 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3850 true); 3850 true);
3851 if (result != KMessageBox::Continue) return false; 3851 if (result != KMessageBox::Continue) return false;
3852 } 3852 }
3853 3853
3854 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3854 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3855 3855
3856 // Force correct extension 3856 // Force correct extension
3857 if (filename.right(4) != ".vcs") filename += ".vcs"; 3857 if (filename.right(4) != ".vcs") filename += ".vcs";
3858 3858
3859 FileStorage storage( mCalendar, filename, new VCalFormat ); 3859 FileStorage storage( mCalendar, filename, new VCalFormat );
3860 return storage.save(); 3860 return storage.save();
3861 3861
3862} 3862}
3863 3863
3864void CalendarView::eventUpdated(Incidence *) 3864void CalendarView::eventUpdated(Incidence *)
3865{ 3865{
3866 setModified(); 3866 setModified();
3867 // Don't call updateView here. The code, which has caused the update of the 3867 // Don't call updateView here. The code, which has caused the update of the
3868 // event is responsible for updating the view. 3868 // event is responsible for updating the view.
3869 // updateView(); 3869 // updateView();
3870} 3870}
3871 3871
3872void CalendarView::adaptNavigationUnits() 3872void CalendarView::adaptNavigationUnits()
3873{ 3873{
3874 if (mViewManager->currentView()->isEventView()) { 3874 if (mViewManager->currentView()->isEventView()) {
3875 int days = mViewManager->currentView()->currentDateCount(); 3875 int days = mViewManager->currentView()->currentDateCount();
3876 if (days == 1) { 3876 if (days == 1) {
3877 emit changeNavStringPrev(i18n("&Previous Day")); 3877 emit changeNavStringPrev(i18n("&Previous Day"));
3878 emit changeNavStringNext(i18n("&Next Day")); 3878 emit changeNavStringNext(i18n("&Next Day"));
3879 } else { 3879 } else {
3880 emit changeNavStringPrev(i18n("&Previous Week")); 3880 emit changeNavStringPrev(i18n("&Previous Week"));
3881 emit changeNavStringNext(i18n("&Next Week")); 3881 emit changeNavStringNext(i18n("&Next Week"));
3882 } 3882 }
3883 } 3883 }
3884} 3884}
3885 3885
3886void CalendarView::processMainViewSelection( Incidence *incidence ) 3886void CalendarView::processMainViewSelection( Incidence *incidence )
3887{ 3887{
3888 if ( incidence ) mTodoList->clearSelection(); 3888 if ( incidence ) mTodoList->clearSelection();
3889 processIncidenceSelection( incidence ); 3889 processIncidenceSelection( incidence );
3890} 3890}
3891 3891
3892void CalendarView::processTodoListSelection( Incidence *incidence ) 3892void CalendarView::processTodoListSelection( Incidence *incidence )
3893{ 3893{
3894 if ( incidence && mViewManager->currentView() ) { 3894 if ( incidence && mViewManager->currentView() ) {
3895 mViewManager->currentView()->clearSelection(); 3895 mViewManager->currentView()->clearSelection();
3896 } 3896 }
3897 processIncidenceSelection( incidence ); 3897 processIncidenceSelection( incidence );
3898} 3898}
3899 3899
3900void CalendarView::processIncidenceSelection( Incidence *incidence ) 3900void CalendarView::processIncidenceSelection( Incidence *incidence )
3901{ 3901{
3902 if ( incidence == mSelectedIncidence ) return; 3902 if ( incidence == mSelectedIncidence ) return;
3903 3903
3904 mSelectedIncidence = incidence; 3904 mSelectedIncidence = incidence;
3905 3905
3906 emit incidenceSelected( mSelectedIncidence ); 3906 emit incidenceSelected( mSelectedIncidence );
3907 3907
3908 if ( incidence && incidence->typeID() == eventID ) { 3908 if ( incidence && incidence->typeID() == eventID ) {
3909 Event *event = static_cast<Event *>( incidence ); 3909 Event *event = static_cast<Event *>( incidence );
3910 if ( event->organizer() == KOPrefs::instance()->email() ) { 3910 if ( event->organizer() == KOPrefs::instance()->email() ) {
3911 emit organizerEventsSelected( true ); 3911 emit organizerEventsSelected( true );
3912 } else { 3912 } else {
3913 emit organizerEventsSelected(false); 3913 emit organizerEventsSelected(false);
3914 } 3914 }
3915 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3915 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3916 KOPrefs::instance()->email() ) ) { 3916 KOPrefs::instance()->email() ) ) {
3917 emit groupEventsSelected( true ); 3917 emit groupEventsSelected( true );
3918 } else { 3918 } else {
3919 emit groupEventsSelected(false); 3919 emit groupEventsSelected(false);
3920 } 3920 }
3921 return; 3921 return;
3922 } else { 3922 } else {
3923 if ( incidence && incidence->typeID() == todoID ) { 3923 if ( incidence && incidence->typeID() == todoID ) {
3924 emit todoSelected( true ); 3924 emit todoSelected( true );
3925 Todo *event = static_cast<Todo *>( incidence ); 3925 Todo *event = static_cast<Todo *>( incidence );
3926 if ( event->organizer() == KOPrefs::instance()->email() ) { 3926 if ( event->organizer() == KOPrefs::instance()->email() ) {
3927 emit organizerEventsSelected( true ); 3927 emit organizerEventsSelected( true );
3928 } else { 3928 } else {
3929 emit organizerEventsSelected(false); 3929 emit organizerEventsSelected(false);
3930 } 3930 }
3931 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3931 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3932 KOPrefs::instance()->email() ) ) { 3932 KOPrefs::instance()->email() ) ) {
3933 emit groupEventsSelected( true ); 3933 emit groupEventsSelected( true );
3934 } else { 3934 } else {
3935 emit groupEventsSelected(false); 3935 emit groupEventsSelected(false);
3936 } 3936 }
3937 return; 3937 return;
3938 } else { 3938 } else {
3939 emit todoSelected( false ); 3939 emit todoSelected( false );
3940 emit organizerEventsSelected(false); 3940 emit organizerEventsSelected(false);
3941 emit groupEventsSelected(false); 3941 emit groupEventsSelected(false);
3942 } 3942 }
3943 return; 3943 return;
3944 } 3944 }
3945 3945
3946 /* if ( incidence && incidence->typeID() == todoID ) { 3946 /* if ( incidence && incidence->typeID() == todoID ) {
3947 emit todoSelected( true ); 3947 emit todoSelected( true );
3948 } else { 3948 } else {
3949 emit todoSelected( false ); 3949 emit todoSelected( false );
3950 }*/ 3950 }*/
3951} 3951}
3952 3952
3953 3953
3954void CalendarView::checkClipboard() 3954void CalendarView::checkClipboard()
3955{ 3955{
3956#ifndef KORG_NODND 3956#ifndef KORG_NODND
3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3958 emit pasteEnabled(true); 3958 emit pasteEnabled(true);
3959 } else { 3959 } else {
3960 emit pasteEnabled(false); 3960 emit pasteEnabled(false);
3961 } 3961 }
3962#endif 3962#endif
3963} 3963}
3964 3964
3965void CalendarView::showDates(const DateList &selectedDates) 3965void CalendarView::showDates(const DateList &selectedDates)
3966{ 3966{
3967 // kdDebug() << "CalendarView::selectDates()" << endl; 3967 // kdDebug() << "CalendarView::selectDates()" << endl;
3968 3968
3969 3969
3970 if ( !mBlockShowDates ) { 3970 if ( !mBlockShowDates ) {
3971 if ( mViewManager->currentView() ) { 3971 if ( mViewManager->currentView() ) {
3972 updateView( selectedDates.first(), selectedDates.last() ); 3972 updateView( selectedDates.first(), selectedDates.last() );
3973 } else { 3973 } else {
3974 mViewManager->showAgendaView(); 3974 mViewManager->showAgendaView();
3975 } 3975 }
3976 } 3976 }
3977 3977
3978 QDate date = selectedDates.first(); 3978 QDate date = selectedDates.first();
3979 if ( ! date.isValid() ) { 3979 if ( ! date.isValid() ) {
3980 topLevelWidget()->setCaption(""); 3980 topLevelWidget()->setCaption("");
3981 return; 3981 return;
3982 } 3982 }
3983 3983
3984 QString selDates; 3984 QString selDates;
3985 selDates = KGlobal::locale()->formatDate( date, true); 3985 selDates = KGlobal::locale()->formatDate( date, true);
3986 if (selectedDates.first() < selectedDates.last() ) 3986 if (selectedDates.first() < selectedDates.last() )
3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3988 else { 3988 else {
3989 QString addString; 3989 QString addString;
3990 if ( date == QDateTime::currentDateTime().date() ) 3990 if ( date == QDateTime::currentDateTime().date() )
3991 addString = i18n("Today"); 3991 addString = i18n("Today");
3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3993 addString = i18n("Tomorrow"); 3993 addString = i18n("Tomorrow");
3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3995 addString = i18n("Yesterday"); 3995 addString = i18n("Yesterday");
3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3997 addString = i18n("Day before yesterday"); 3997 addString = i18n("Day before yesterday");
3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3999 addString = i18n("Day after tomorrow"); 3999 addString = i18n("Day after tomorrow");
4000 if ( !addString.isEmpty() ) { 4000 if ( !addString.isEmpty() ) {
4001 topLevelWidget()->setCaption( addString+", " + selDates ); 4001 topLevelWidget()->setCaption( addString+", " + selDates );
4002 return; 4002 return;
4003 } 4003 }
4004 } 4004 }
4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
4006 4006
4007} 4007}
4008 4008
4009QPtrList<CalFilter> CalendarView::filters() 4009QPtrList<CalFilter> CalendarView::filters()
4010{ 4010{
4011 return mFilters; 4011 return mFilters;
4012 4012
4013} 4013}
4014void CalendarView::editFilters() 4014void CalendarView::editFilters()
4015{ 4015{
4016 // kdDebug() << "CalendarView::editFilters()" << endl; 4016 // kdDebug() << "CalendarView::editFilters()" << endl;
4017 4017
4018 CalFilter *filter = mFilters.first(); 4018 CalFilter *filter = mFilters.first();
4019 while(filter) { 4019 while(filter) {
4020 kdDebug() << " Filter: " << filter->name() << endl;
4021 filter = mFilters.next(); 4020 filter = mFilters.next();
4022 } 4021 }
4023 4022
4024 mDialogManager->showFilterEditDialog(&mFilters); 4023 mDialogManager->showFilterEditDialog(&mFilters);
4025 updateFilter(); 4024 updateFilter();
4026} 4025}
4027void CalendarView::toggleFilter() 4026void CalendarView::toggleFilter()
4028{ 4027{
4029 if ( mLeftFrame->isHidden() ) { 4028 if ( mLeftFrame->isHidden() ) {
4030 toggleExpand(); 4029 toggleExpand();
4031 showFilter( true ); 4030 showFilter( true );
4032 } else 4031 } else
4033 showFilter(! mCalEditView->isVisible()); 4032 showFilter(! mCalEditView->isVisible());
4034} 4033}
4035 4034
4036KOFilterView *CalendarView::filterView() 4035KOFilterView *CalendarView::filterView()
4037{ 4036{
4038 return mFilterView; 4037 return mFilterView;
4039} 4038}
4040void CalendarView::selectFilter( int fil ) 4039void CalendarView::selectFilter( int fil )
4041{ 4040{
4042 mFilterView->setSelectedFilter( fil ); 4041 mFilterView->setSelectedFilter( fil );
4042 updateUnmanagedViews();
4043} 4043}
4044void CalendarView::showFilter(bool visible) 4044void CalendarView::showFilter(bool visible)
4045{ 4045{
4046#if 1 4046#if 1
4047 if (visible) { 4047 if (visible) {
4048 mCalEditView->readConfig(); 4048 mCalEditView->readConfig();
4049 mCalEditView->show(); 4049 mCalEditView->show();
4050 QValueList<int> sizes; 4050 QValueList<int> sizes;
4051 sizes = mLeftFrame->sizes(); 4051 sizes = mLeftFrame->sizes();
4052 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4052 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4053 sizes.clear(); 4053 sizes.clear();
4054 sizes << 100; 4054 sizes << 100;
4055 sizes << 0; 4055 sizes << 0;
4056 sizes << 0; 4056 sizes << 0;
4057 sizes << 100; 4057 sizes << 100;
4058 mLeftFrame->setSizes(sizes); 4058 mLeftFrame->setSizes(sizes);
4059 } 4059 }
4060#if 0 4060#if 0
4061 sizes = mLeftFrame->sizes(); 4061 sizes = mLeftFrame->sizes();
4062 int ccc = 0; 4062 int ccc = 0;
4063 while ( ccc < sizes.count()) { 4063 while ( ccc < sizes.count()) {
4064 qDebug("size %d %d ", ccc, sizes[ccc]); 4064 qDebug("size %d %d ", ccc, sizes[ccc]);
4065 ++ccc; 4065 ++ccc;
4066 } 4066 }
4067#endif 4067#endif
4068 4068
4069 } 4069 }
4070 else { 4070 else {
4071 mCalEditView->hide(); 4071 mCalEditView->hide();
4072 } 4072 }
4073#else 4073#else
4074 if (visible) mFilterView->show(); 4074 if (visible) mFilterView->show();
4075 else mFilterView->hide(); 4075 else mFilterView->hide();
4076#endif 4076#endif
4077} 4077}
4078void CalendarView::toggleFilerEnabled( ) 4078void CalendarView::toggleFilerEnabled( )
4079{ 4079{
4080 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 4080 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
4081 if ( !mFilterView->filtersEnabled() ) 4081 if ( !mFilterView->filtersEnabled() )
4082 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 4082 topLevelWidget()->setCaption( i18n("Filter disabled ") );
4083 updateUnmanagedViews();
4083 4084
4084} 4085}
4085void CalendarView::updateFilter() 4086void CalendarView::updateFilter()
4086{ 4087{
4087 CalFilter *filter = mFilterView->selectedFilter(); 4088 CalFilter *filter = mFilterView->selectedFilter();
4088 if (filter) { 4089 if (filter) {
4089 QString mess; 4090 QString mess;
4090 if (mFilterView->filtersEnabled()) { 4091 if (mFilterView->filtersEnabled()) {
4091 mess = i18n("Filter selected: ")+filter->name(); 4092 mess = i18n("Filter selected: ")+filter->name();
4092 filter->setEnabled(true); 4093 filter->setEnabled(true);
4093 } 4094 }
4094 else filter->setEnabled(false); 4095 else filter->setEnabled(false);
4095 mCalendar->setFilter(filter); 4096 mCalendar->setFilter(filter);
4096 updateView(); 4097 updateView();
4097 if ( !mess.isEmpty() ) 4098 if ( !mess.isEmpty() )
4098 topLevelWidget()->setCaption( mess ); 4099 topLevelWidget()->setCaption( mess );
4099 4100
4100 } 4101 }
4101 emit filtersUpdated(); 4102 emit filtersUpdated();
4102} 4103}
4103 4104
4104void CalendarView::filterEdited() 4105void CalendarView::filterEdited()
4105{ 4106{
4106 mFilterView->updateFilters(); 4107 mFilterView->updateFilters();
4107 updateFilter(); 4108 updateFilter();
4108 writeSettings(); 4109 writeSettings();
4109} 4110}
4110 4111
4111 4112
4112void CalendarView::takeOverEvent() 4113void CalendarView::takeOverEvent()
4113{ 4114{
4114 Incidence *incidence = currentSelection(); 4115 Incidence *incidence = currentSelection();
4115 4116
4116 if (!incidence) return; 4117 if (!incidence) return;
4117 4118
4118 incidence->setOrganizer(KOPrefs::instance()->email()); 4119 incidence->setOrganizer(KOPrefs::instance()->email());
4119 incidence->recreate(); 4120 incidence->recreate();
4120 incidence->setReadOnly(false); 4121 incidence->setReadOnly(false);
4121 4122
4122 updateView(); 4123 updateView();
4123} 4124}
4124 4125
4125void CalendarView::takeOverCalendar() 4126void CalendarView::takeOverCalendar()
4126{ 4127{
4127 // TODO: Create Calendar::allIncidences() function and use it here 4128 // TODO: Create Calendar::allIncidences() function and use it here
4128 4129
4129 clearAllViews(); 4130 clearAllViews();
4130 QPtrList<Event> events = mCalendar->events(); 4131 QPtrList<Event> events = mCalendar->events();
4131 for(uint i=0; i<events.count(); ++i) { 4132 for(uint i=0; i<events.count(); ++i) {
4132 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 4133 events.at(i)->setOrganizer(KOPrefs::instance()->email());
4133 events.at(i)->recreate(); 4134 events.at(i)->recreate();
4134 events.at(i)->setReadOnly(false); 4135 events.at(i)->setReadOnly(false);
4135 } 4136 }
4136 4137
4137 QPtrList<Todo> todos = mCalendar->todos(); 4138 QPtrList<Todo> todos = mCalendar->todos();
4138 for(uint i=0; i<todos.count(); ++i) { 4139 for(uint i=0; i<todos.count(); ++i) {
4139 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 4140 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
4140 todos.at(i)->recreate(); 4141 todos.at(i)->recreate();
4141 todos.at(i)->setReadOnly(false); 4142 todos.at(i)->setReadOnly(false);
4142 } 4143 }
4143 4144
4144 QPtrList<Journal> journals = mCalendar->journals(); 4145 QPtrList<Journal> journals = mCalendar->journals();
4145 for(uint i=0; i<journals.count(); ++i) { 4146 for(uint i=0; i<journals.count(); ++i) {
4146 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 4147 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
4147 journals.at(i)->recreate(); 4148 journals.at(i)->recreate();
4148 journals.at(i)->setReadOnly(false); 4149 journals.at(i)->setReadOnly(false);
4149 } 4150 }
4150 4151
4151 updateView(); 4152 updateView();
4152} 4153}
4153 4154
4154void CalendarView::showIntro() 4155void CalendarView::showIntro()
4155{ 4156{
4156 kdDebug() << "To be implemented." << endl; 4157 kdDebug() << "To be implemented." << endl;
4157} 4158}
4158 4159
4159QWidgetStack *CalendarView::viewStack() 4160QWidgetStack *CalendarView::viewStack()
4160{ 4161{
4161 return mRightFrame; 4162 return mRightFrame;
4162} 4163}
4163 4164
4164QWidget *CalendarView::leftFrame() 4165QWidget *CalendarView::leftFrame()
4165{ 4166{
4166 return ( QWidget *)mLeftFrame; 4167 return ( QWidget *)mLeftFrame;
4167} 4168}
4168 4169
4169DateNavigator *CalendarView::dateNavigator() 4170DateNavigator *CalendarView::dateNavigator()
4170{ 4171{
4171 return mNavigator; 4172 return mNavigator;
4172} 4173}
4173 4174
4174KDateNavigator* CalendarView::dateNavigatorWidget() 4175KDateNavigator* CalendarView::dateNavigatorWidget()
4175{ 4176{
4176 return mDateNavigator->navigatorView(); 4177 return mDateNavigator->navigatorView();
4177} 4178}
4178void CalendarView::toggleDateNavigatorWidget() 4179void CalendarView::toggleDateNavigatorWidget()
4179{ 4180{
4180 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 4181 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
4181 4182
4182 if (!KOPrefs::instance()->mShowDateNavigator ) 4183 if (!KOPrefs::instance()->mShowDateNavigator )
4183 mDateNavigator->hide(); 4184 mDateNavigator->hide();
4184 else 4185 else
4185 mDateNavigator->show(); 4186 mDateNavigator->show();
4186} 4187}
4187void CalendarView::addView(KOrg::BaseView *view) 4188void CalendarView::addView(KOrg::BaseView *view)
4188{ 4189{
4189 mViewManager->addView(view); 4190 mViewManager->addView(view);
4190} 4191}
4191 4192
4192void CalendarView::showView(KOrg::BaseView *view) 4193void CalendarView::showView(KOrg::BaseView *view)
4193{ 4194{
4194 mViewManager->showView(view, mLeftFrame->isVisible()); 4195 mViewManager->showView(view, mLeftFrame->isVisible());
4195} 4196}
4196 4197
4197Incidence *CalendarView::currentSelection() 4198Incidence *CalendarView::currentSelection()
4198{ 4199{
4199 return mViewManager->currentSelection(); 4200 return mViewManager->currentSelection();
4200} 4201}
4201void CalendarView::toggleAllDaySize() 4202void CalendarView::toggleAllDaySize()
4202{ 4203{
4203 /* 4204 /*
4204 if ( KOPrefs::instance()->mAllDaySize > 47 ) 4205 if ( KOPrefs::instance()->mAllDaySize > 47 )
4205 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 4206 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
4206 else 4207 else
4207 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 4208 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
4208 */ 4209 */
4209 viewManager()->agendaView()->toggleAllDay(); 4210 viewManager()->agendaView()->toggleAllDay();
4210} 4211}
4211void CalendarView::toggleExpand() 4212void CalendarView::toggleExpand()
4212{ 4213{
4213 // if ( mLeftFrame->isHidden() ) { 4214 // if ( mLeftFrame->isHidden() ) {
4214 // mLeftFrame->show(); 4215 // mLeftFrame->show();
4215 // emit calendarViewExpanded( false ); 4216 // emit calendarViewExpanded( false );
4216 // } else { 4217 // } else {
4217 // mLeftFrame->hide(); 4218 // mLeftFrame->hide();
4218 // emit calendarViewExpanded( true ); 4219 // emit calendarViewExpanded( true );
4219 // } 4220 // }
4220 //qDebug(" CalendarView::toggleExpand()"); 4221 //qDebug(" CalendarView::toggleExpand()");
4221 globalFlagBlockAgenda = 1; 4222 globalFlagBlockAgenda = 1;
4222 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 4223 emit calendarViewExpanded( !mLeftFrame->isHidden() );
4223 globalFlagBlockAgenda = 5; 4224 globalFlagBlockAgenda = 5;
4224 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 4225 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
4225 //mViewManager->showView( 0, true ); 4226 //mViewManager->showView( 0, true );
4226} 4227}
4227 4228
4228void CalendarView::calendarModified( bool modified, Calendar * ) 4229void CalendarView::calendarModified( bool modified, Calendar * )
4229{ 4230{
4230 setModified( modified ); 4231 setModified( modified );
4231} 4232}
4232 4233
4233Todo *CalendarView::selectedTodo() 4234Todo *CalendarView::selectedTodo()
4234{ 4235{
4235 Incidence *incidence = currentSelection(); 4236 Incidence *incidence = currentSelection();
4236 if ( incidence && incidence->typeID() == todoID ) { 4237 if ( incidence && incidence->typeID() == todoID ) {
4237 return static_cast<Todo *>( incidence ); 4238 return static_cast<Todo *>( incidence );
4238 } 4239 }
4239 4240
4240 incidence = mTodoList->selectedIncidences().first(); 4241 incidence = mTodoList->selectedIncidences().first();
4241 if ( incidence && incidence->typeID() == todoID ) { 4242 if ( incidence && incidence->typeID() == todoID ) {
4242 return static_cast<Todo *>( incidence ); 4243 return static_cast<Todo *>( incidence );
4243 } 4244 }
4244 4245
4245 return 0; 4246 return 0;
4246} 4247}
4247 4248
4248void CalendarView::dialogClosing(Incidence *in) 4249void CalendarView::dialogClosing(Incidence *in)
4249{ 4250{
4250 // mDialogList.remove(in); 4251 // mDialogList.remove(in);
4251} 4252}
4252 4253
4253void CalendarView::showIncidence() 4254void CalendarView::showIncidence()
4254{ 4255{
4255 mViewerCallerIsSearchDialog = false; 4256 mViewerCallerIsSearchDialog = false;
4256 Incidence *incidence = currentSelection(); 4257 Incidence *incidence = currentSelection();
4257 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4258 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4258 if ( incidence ) { 4259 if ( incidence ) {
4259 ShowIncidenceVisitor v; 4260 ShowIncidenceVisitor v;
4260 v.act( incidence, this ); 4261 v.act( incidence, this );
4261 } 4262 }
4262} 4263}
4263void CalendarView::editIncidenceDescription() 4264void CalendarView::editIncidenceDescription()
4264{ 4265{
4265 mFlagEditDescription = true; 4266 mFlagEditDescription = true;
4266 editIncidence(); 4267 editIncidence();
4267 mFlagEditDescription = false; 4268 mFlagEditDescription = false;
4268} 4269}
4269void CalendarView::editIncidence() 4270void CalendarView::editIncidence()
4270{ 4271{
4271 // qDebug("editIncidence() "); 4272 // qDebug("editIncidence() ");
4272 Incidence *incidence = currentSelection(); 4273 Incidence *incidence = currentSelection();
4273 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4274 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4274 if ( incidence ) { 4275 if ( incidence ) {
4275 EditIncidenceVisitor v; 4276 EditIncidenceVisitor v;
4276 v.act( incidence, this ); 4277 v.act( incidence, this );
4277 } 4278 }
4278} 4279}
4279 4280
4280void CalendarView::deleteIncidence() 4281void CalendarView::deleteIncidence()
4281{ 4282{
4282 Incidence *incidence = currentSelection(); 4283 Incidence *incidence = currentSelection();
4283 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 4284 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
4284 if ( incidence ) { 4285 if ( incidence ) {
4285 deleteIncidence(incidence); 4286 deleteIncidence(incidence);
4286 } 4287 }
4287} 4288}
4288void CalendarView::showIncidence(QString uid) 4289void CalendarView::showIncidence(QString uid)
4289{ 4290{
4290 Incidence *inc = mCalendar->incidence( uid ); 4291 Incidence *inc = mCalendar->incidence( uid );
4291 if ( inc ) 4292 if ( inc )
4292 showIncidence( inc ); 4293 showIncidence( inc );
4293} 4294}
4294void CalendarView::showIncidence(Incidence *incidence) 4295void CalendarView::showIncidence(Incidence *incidence)
4295{ 4296{
4296 mViewerCallerIsSearchDialog = false; 4297 mViewerCallerIsSearchDialog = false;
4297 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); 4298 //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
4298 if ( sender() && mDialogManager->getSearchDialog() ) { 4299 if ( sender() && mDialogManager->getSearchDialog() ) {
4299 if ( sender () == mDialogManager->getSearchDialog()->listview() ) { 4300 if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
4300 mViewerCallerIsSearchDialog = true; 4301 mViewerCallerIsSearchDialog = true;
4301 } 4302 }
4302 } 4303 }
4303 if ( incidence ) { 4304 if ( incidence ) {
4304 ShowIncidenceVisitor v; 4305 ShowIncidenceVisitor v;
4305 v.act( incidence, this ); 4306 v.act( incidence, this );
4306 } 4307 }
4307} 4308}
4308 4309
4309void CalendarView::editIncidence(Incidence *incidence) 4310void CalendarView::editIncidence(Incidence *incidence)
4310{ 4311{
4311 if ( incidence ) { 4312 if ( incidence ) {
4312 4313
4313 EditIncidenceVisitor v; 4314 EditIncidenceVisitor v;
4314 v.act( incidence, this ); 4315 v.act( incidence, this );
4315 4316
4316 } 4317 }
4317} 4318}
4318 4319
4319void CalendarView::deleteIncidence(Incidence *incidence) 4320void CalendarView::deleteIncidence(Incidence *incidence)
4320{ 4321{
4321 //qDebug(" CalendarView::deleteIncidence "); 4322 //qDebug(" CalendarView::deleteIncidence ");
4322 if ( incidence ) { 4323 if ( incidence ) {
4323 DeleteIncidenceVisitor v; 4324 DeleteIncidenceVisitor v;
4324 v.act( incidence, this ); 4325 v.act( incidence, this );
4325 } 4326 }
4326} 4327}
4327 4328
4328 4329
4329void CalendarView::lookForOutgoingMessages() 4330void CalendarView::lookForOutgoingMessages()
4330{ 4331{
4331 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4332 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4332 ogd->loadMessages(); 4333 ogd->loadMessages();
4333} 4334}
4334 4335
4335void CalendarView::lookForIncomingMessages() 4336void CalendarView::lookForIncomingMessages()
4336{ 4337{
4337 IncomingDialog *icd = mDialogManager->incomingDialog(); 4338 IncomingDialog *icd = mDialogManager->incomingDialog();
4338 icd->retrieve(); 4339 icd->retrieve();
4339} 4340}
4340 4341
4341bool CalendarView::removeCompletedSubTodos( Todo* t ) 4342bool CalendarView::removeCompletedSubTodos( Todo* t )
4342{ 4343{
4343 bool deleteTodo = true; 4344 bool deleteTodo = true;
4344 QPtrList<Incidence> subTodos; 4345 QPtrList<Incidence> subTodos;
4345 Incidence *aTodo; 4346 Incidence *aTodo;
4346 subTodos = t->relations(); 4347 subTodos = t->relations();
4347 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4348 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4348 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4349 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4349 deleteTodo = false; 4350 deleteTodo = false;
4350 } 4351 }
4351 if ( deleteTodo ) { 4352 if ( deleteTodo ) {
4352 if ( t->isCompleted() && !t->doesRecur()) { 4353 if ( t->isCompleted() && !t->doesRecur()) {
4353 checkExternalId( t ); 4354 checkExternalId( t );
4354 mCalendar->deleteTodo( t ); 4355 mCalendar->deleteTodo( t );
4355 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4356 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4356 } 4357 }
4357 else 4358 else
4358 deleteTodo = false; 4359 deleteTodo = false;
4359 } 4360 }
4360 return deleteTodo; 4361 return deleteTodo;
4361 4362
4362} 4363}
4363void CalendarView::purgeCompleted() 4364void CalendarView::purgeCompleted()
4364{ 4365{
4365 int result = KMessageBox::warningContinueCancel(this, 4366 int result = KMessageBox::warningContinueCancel(this,
4366 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4367 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4367 4368
4368 if (result == KMessageBox::Continue) { 4369 if (result == KMessageBox::Continue) {
4369 4370
4370 QPtrList<Todo> todoCal; 4371 QPtrList<Todo> todoCal;
4371 QPtrList<Todo> rootTodos; 4372 QPtrList<Todo> rootTodos;
4372 //QPtrList<Incidence> rel; 4373 //QPtrList<Incidence> rel;
4373 Todo *aTodo;//, *rTodo; 4374 Todo *aTodo;//, *rTodo;
4374 Incidence *rIncidence; 4375 Incidence *rIncidence;
4375 bool childDelete = false; 4376 bool childDelete = false;
4376 bool deletedOne = true; 4377 bool deletedOne = true;
4377 todoCal = calendar()->todos(); 4378 todoCal = calendar()->todos();
4378 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4379 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4379 if ( !aTodo->relatedTo() ) 4380 if ( !aTodo->relatedTo() )
4380 rootTodos.append( aTodo ); 4381 rootTodos.append( aTodo );
4381 } 4382 }
4382 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4383 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4383 removeCompletedSubTodos( aTodo ); 4384 removeCompletedSubTodos( aTodo );
4384 } 4385 }
4385 4386
4386 updateView(); 4387 updateView();
4387 } 4388 }
4388} 4389}
4389 4390
4390void CalendarView::slotCalendarChanged() 4391void CalendarView::slotCalendarChanged()
4391{ 4392{
4392 ; 4393 ;
4393} 4394}
4394 4395
4395void CalendarView::keyPressEvent ( QKeyEvent *e) 4396void CalendarView::keyPressEvent ( QKeyEvent *e)
4396{ 4397{
4397 //qDebug(" alendarView::keyPressEvent "); 4398 //qDebug(" alendarView::keyPressEvent ");
4398 e->ignore(); 4399 e->ignore();
4399} 4400}
4400 4401
4401 4402
4402bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4403bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4403{ 4404{
4404 // mSyncManager = manager; 4405 // mSyncManager = manager;
4405 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4406 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4406 qDebug("KO: SyncKDE request detected!"); 4407 qDebug("KO: SyncKDE request detected!");
4407 } 4408 }
4408 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4409 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4409 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4410 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4410 return syncCalendar( filename, mode ); 4411 return syncCalendar( filename, mode );
4411} 4412}
4412bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4413bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4413{ 4414{
4414 //mSyncManager = manager; 4415 //mSyncManager = manager;
4415 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4416 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4416 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4417 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4417 if ( resource == "sharp" ) 4418 if ( resource == "sharp" )
4418 syncExternal( 0 ); 4419 syncExternal( 0 );
4419 if ( resource == "phone" ) 4420 if ( resource == "phone" )
4420 syncExternal( 1 ); 4421 syncExternal( 1 );
4421 // pending setmodified 4422 // pending setmodified
4422 return true; 4423 return true;
4423} 4424}
4424void CalendarView::setSyncManager(KSyncManager* manager) 4425void CalendarView::setSyncManager(KSyncManager* manager)
4425{ 4426{
4426 mSyncManager = manager; 4427 mSyncManager = manager;
4427} 4428}
4428 4429
4429void CalendarView::removeSyncInfo( QString syncProfile) 4430void CalendarView::removeSyncInfo( QString syncProfile)
4430{ 4431{
4431 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4432 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4432 mCalendar->removeSyncInfo( syncProfile ); 4433 mCalendar->removeSyncInfo( syncProfile );
4433 4434
4434} 4435}
4435 4436
4436void CalendarView::undo_delete() 4437void CalendarView::undo_delete()
4437{ 4438{
4438 //qDebug("undo_delete() "); 4439 //qDebug("undo_delete() ");
4439 Incidence* undo = mCalendar->undoIncidence(); 4440 Incidence* undo = mCalendar->undoIncidence();
4440 if ( !undo ) { 4441 if ( !undo ) {
4441 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4442 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4442 i18n("KO/Pi")); 4443 i18n("KO/Pi"));
4443 return; 4444 return;
4444 } 4445 }
4445 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4446 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4446 i18n("\nAre you sure you want\nto restore this?"), 4447 i18n("\nAre you sure you want\nto restore this?"),
4447 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4448 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4448 mCalendar->undoDeleteIncidence(); 4449 mCalendar->undoDeleteIncidence();
4449 updateView(); 4450 updateView();
4450 } 4451 }
4451} 4452}
4452 4453
4453void CalendarView::slotViewerClosed() 4454void CalendarView::slotViewerClosed()
4454{ 4455{
4455 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4456 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4456} 4457}
4457 4458
4458void CalendarView::resetFocus() 4459void CalendarView::resetFocus()
4459{ 4460{
4460 if ( mViewerCallerIsSearchDialog ) { 4461 if ( mViewerCallerIsSearchDialog ) {
4461 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4462 if ( mDialogManager->getSearchDialog()->isVisible() ){
4462 mDialogManager->getSearchDialog()->raise(); 4463 mDialogManager->getSearchDialog()->raise();
4463 mDialogManager->getSearchDialog()->setActiveWindow(); 4464 mDialogManager->getSearchDialog()->setActiveWindow();
4464 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4465 mDialogManager->getSearchDialog()->listview()->resetFocus();
4465 } else 4466 } else
4466 mViewerCallerIsSearchDialog = false; 4467 mViewerCallerIsSearchDialog = false;
4467 } 4468 }
4468 if ( !mViewerCallerIsSearchDialog ) { 4469 if ( !mViewerCallerIsSearchDialog ) {
4469 //mViewManager->currentView()->setFocus(); 4470 //mViewManager->currentView()->setFocus();
4470 //qDebug("sssssssssssssssset focus "); 4471 //qDebug("sssssssssssssssset focus ");
4471 topLevelWidget()->raise(); 4472 topLevelWidget()->raise();
4472 setActiveWindow(); 4473 setActiveWindow();
4473 //setFocus(); 4474 //setFocus();
4474 } 4475 }
4475 mViewerCallerIsSearchDialog = false; 4476 mViewerCallerIsSearchDialog = false;
4476} 4477}
4477 4478
4478void CalendarView::showNextAlarms() 4479void CalendarView::showNextAlarms()
4479{ 4480{
4480 QString message; 4481 QString message;
4481 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4482 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4482 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4483 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4483 QString sum = mCalendar->nextSummary(); 4484 QString sum = mCalendar->nextSummary();
4484 QDateTime nextA = mNextAlarmDateTime; 4485 QDateTime nextA = mNextAlarmDateTime;
4485 QDateTime cur = QDateTime::currentDateTime(); 4486 QDateTime cur = QDateTime::currentDateTime();
4486 int secs = cur.secsTo( nextA ); 4487 int secs = cur.secsTo( nextA );
4487 int min = secs /60; 4488 int min = secs /60;
4488 int hours = min /60; 4489 int hours = min /60;
4489 min = min % 60; 4490 min = min % 60;
4490 int days = hours /24; 4491 int days = hours /24;
4491 hours = hours % 24; 4492 hours = hours % 24;
4492 4493
4493 //message = i18n("The next alarm is in:\n"); 4494 //message = i18n("The next alarm is in:\n");
4494 if ( days > 1 ) 4495 if ( days > 1 )
4495 message += i18n("%1 days\n").arg( days ); 4496 message += i18n("%1 days\n").arg( days );
4496 else if ( days == 1 ) 4497 else if ( days == 1 )
4497 message += i18n("1 day\n"); 4498 message += i18n("1 day\n");
4498 if ( hours > 1 ) 4499 if ( hours > 1 )
4499 message += i18n("%1 hours\n").arg( hours ); 4500 message += i18n("%1 hours\n").arg( hours );
4500 else if ( hours == 1 ) 4501 else if ( hours == 1 )
4501 message += i18n("1 hour\n"); 4502 message += i18n("1 hour\n");
4502 if ( min > 1 ) 4503 if ( min > 1 )
4503 message += i18n("%1 minutes\n").arg( min ); 4504 message += i18n("%1 minutes\n").arg( min );
4504 else if ( min == 1 ) 4505 else if ( min == 1 )
4505 message += i18n("1 minute\n"); 4506 message += i18n("1 minute\n");
4506 if ( message.isEmpty() ) 4507 if ( message.isEmpty() )
4507 message = i18n("The next alarm is in\nless than one minute!"); 4508 message = i18n("The next alarm is in\nless than one minute!");
4508 else 4509 else
4509 message = i18n("The next alarm is in:\n") + message; 4510 message = i18n("The next alarm is in:\n") + message;
4510 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4511 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4511 } else { 4512 } else {
4512 message = i18n("There is no next alarm."); 4513 message = i18n("There is no next alarm.");
4513 4514
4514 } 4515 }
4515#ifdef DESKTOP_VERSION 4516#ifdef DESKTOP_VERSION
4516 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 4517 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
4517 message += i18n("\nThe internal alarm notification is disabled!\n"); 4518 message += i18n("\nThe internal alarm notification is disabled!\n");
4518 message += i18n("Enable it in the settings menu, TAB alarm."); 4519 message += i18n("Enable it in the settings menu, TAB alarm.");
4519 } 4520 }
4520 4521
4521#endif 4522#endif
4522 KMessageBox::information( this, message); 4523 KMessageBox::information( this, message);
4523} 4524}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 0367bea..48320a5 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -40,2517 +40,2517 @@
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64#include <kglobalsettings.h> 64#include <kglobalsettings.h>
65 65
66using namespace KCal; 66using namespace KCal;
67#ifndef _WIN32_ 67#ifndef _WIN32_
68#include <unistd.h> 68#include <unistd.h>
69#else 69#else
70#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 71#include "koimportoldialog.h"
72#endif 72#endif
73#endif 73#endif
74#include "mainwindow.h" 74#include "mainwindow.h"
75 75
76 76
77class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
78{ 78{
79 public: 79 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
82 { 82 {
83 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
87 QLabel *lab; 87 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 90 QHBox* temphb;
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132QPixmap* sgListViewCompletedPix[6]; 132QPixmap* sgListViewCompletedPix[6];
133 133
134 134
135int globalFlagBlockStartup; 135int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 136MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
137 QMainWindow( parent, name ) 137 QMainWindow( parent, name )
138{ 138{
139 sgListViewCompletedPix[5] = &listviewPix; 139 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 140 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 141 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 142 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 143 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 144 sgListViewCompletedPix[4] = &listviewPix80;
145 if ( sgListViewCompletedPix[5]->height() < 5 ) { 145 if ( sgListViewCompletedPix[5]->height() < 5 ) {
146 int size = 12; 146 int size = 12;
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 147 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 148 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
151 int half = size/2; 151 int half = size/2;
152 int heihei = size/2; 152 int heihei = size/2;
153 int x = 1; 153 int x = 1;
154 p.drawLine ( 2, 5, 4 , 7 ) ; 154 p.drawLine ( 2, 5, 4 , 7 ) ;
155 p.drawLine ( 4 , 7 , 8, 3) ; 155 p.drawLine ( 4 , 7 , 8, 3) ;
156 int iii = 0; 156 int iii = 0;
157 for ( iii = 0; iii < 5; ++iii ) { 157 for ( iii = 0; iii < 5; ++iii ) {
158 sgListViewCompletedPix[iii]->resize( 11, 11 ); 158 sgListViewCompletedPix[iii]->resize( 11, 11 );
159 sgListViewCompletedPix[iii]->fill( Qt::white ); 159 sgListViewCompletedPix[iii]->fill( Qt::white );
160 QPainter p ( sgListViewCompletedPix[iii] ); 160 QPainter p ( sgListViewCompletedPix[iii] );
161 p.drawRect( 0,0,11,11); 161 p.drawRect( 0,0,11,11);
162 if ( iii ) 162 if ( iii )
163 p.fillRect( 1,1,iii*2,9,Qt::gray ); 163 p.fillRect( 1,1,iii*2,9,Qt::gray );
164 } 164 }
165 } 165 }
166 mClosed = false; 166 mClosed = false;
167 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 167 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
168 QString confFile = locateLocal("config","korganizerrc"); 168 QString confFile = locateLocal("config","korganizerrc");
169 QFileInfo finf ( confFile ); 169 QFileInfo finf ( confFile );
170 bool showWarning = !finf.exists(); 170 bool showWarning = !finf.exists();
171 setIcon(SmallIcon( "ko24" ) ); 171 setIcon(SmallIcon( "ko24" ) );
172 mBlockAtStartup = true; 172 mBlockAtStartup = true;
173 mFlagKeyPressed = false; 173 mFlagKeyPressed = false;
174 setCaption("KO/Pi"); 174 setCaption("KO/Pi");
175 KOPrefs *p = KOPrefs::instance(); 175 KOPrefs *p = KOPrefs::instance();
176 KPimGlobalPrefs::instance()->setGlobalConfig(); 176 KPimGlobalPrefs::instance()->setGlobalConfig();
177 p->mCurrentDisplayedView = 0; 177 p->mCurrentDisplayedView = 0;
178 if ( p->mHourSize > 22 ) 178 if ( p->mHourSize > 22 )
179 p->mHourSize = 22; 179 p->mHourSize = 22;
180 QMainWindow::ToolBarDock tbd; 180 QMainWindow::ToolBarDock tbd;
181 if ( p->mToolBarHor ) { 181 if ( p->mToolBarHor ) {
182 if ( p->mToolBarUp ) 182 if ( p->mToolBarUp )
183 tbd = Bottom; 183 tbd = Bottom;
184 else 184 else
185 tbd = Top; 185 tbd = Top;
186 } 186 }
187 else { 187 else {
188 if ( p->mToolBarUp ) 188 if ( p->mToolBarUp )
189 tbd = Right; 189 tbd = Right;
190 else 190 else
191 tbd = Left; 191 tbd = Left;
192 } 192 }
193 if ( KOPrefs::instance()->mUseAppColors ) 193 if ( KOPrefs::instance()->mUseAppColors )
194 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 194 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
195 globalFlagBlockStartup = 1; 195 globalFlagBlockStartup = 1;
196 iconToolBar = new QPEToolBar( this ); 196 iconToolBar = new QPEToolBar( this );
197 addToolBar (iconToolBar , tbd ); 197 addToolBar (iconToolBar , tbd );
198 198
199#ifdef DESKTOP_VERSION 199#ifdef DESKTOP_VERSION
200 if ( KOPrefs::instance()->mShowIconFilter ) 200 if ( KOPrefs::instance()->mShowIconFilter )
201#else 201#else
202 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 202 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
203#endif 203#endif
204 204
205{ 205{
206 if ( p->mToolBarHorF ) { 206 if ( p->mToolBarHorF ) {
207 if ( p->mToolBarUpF ) 207 if ( p->mToolBarUpF )
208 tbd = Bottom; 208 tbd = Bottom;
209 else 209 else
210 tbd = Top; 210 tbd = Top;
211 } 211 }
212 else { 212 else {
213 if ( p->mToolBarUpF ) 213 if ( p->mToolBarUpF )
214 tbd = Right; 214 tbd = Right;
215 else 215 else
216 tbd = Left; 216 tbd = Left;
217 } 217 }
218 filterToolBar = new QPEToolBar ( this ); 218 filterToolBar = new QPEToolBar ( this );
219 filterMenubar = new QMenuBar( 0 ); 219 filterMenubar = new QMenuBar( 0 );
220 QFontMetrics fm ( filterMenubar->font() ); 220 QFontMetrics fm ( filterMenubar->font() );
221 221
222 filterPopupMenu = new QPopupMenu( this ); 222 filterPopupMenu = new QPopupMenu( this );
223 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 223 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
224 QString addTest = "A"; 224 QString addTest = "A";
225 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 225 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
226#ifdef DESKTOP_VERSION 226#ifdef DESKTOP_VERSION
227 addTest = "AAABBBCCCx"; 227 addTest = "AAABBBCCCx";
228#else 228#else
229 addTest = "AAx"; 229 addTest = "AAx";
230#endif 230#endif
231 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 231 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
232 addToolBar (filterToolBar , tbd ); 232 addToolBar (filterToolBar , tbd );
233 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 233 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
234 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 234 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
235 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 235 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
236 filterToolBar->hide(); 236 filterToolBar->hide();
237 } else { 237 } else {
238 filterToolBar = 0; 238 filterToolBar = 0;
239 filterMenubar = 0; 239 filterMenubar = 0;
240 filterPopupMenu = 0; 240 filterPopupMenu = 0;
241 } 241 }
242 if ( p->mShowIconOnetoolbar ) { 242 if ( p->mShowIconOnetoolbar ) {
243 viewToolBar = iconToolBar ; 243 viewToolBar = iconToolBar ;
244 navigatorToolBar = iconToolBar ; 244 navigatorToolBar = iconToolBar ;
245 } else { 245 } else {
246#ifndef DESKTOP_VERSION 246#ifndef DESKTOP_VERSION
247 setToolBarsMovable( false ); 247 setToolBarsMovable( false );
248#endif 248#endif
249 if ( p->mToolBarHorV ) { 249 if ( p->mToolBarHorV ) {
250 if ( p->mToolBarUpV ) 250 if ( p->mToolBarUpV )
251 tbd = Bottom; 251 tbd = Bottom;
252 else 252 else
253 tbd = Top; 253 tbd = Top;
254 } 254 }
255 else { 255 else {
256 if ( p->mToolBarUpV ) 256 if ( p->mToolBarUpV )
257 tbd = Right; 257 tbd = Right;
258 else 258 else
259 tbd = Left; 259 tbd = Left;
260 } 260 }
261 viewToolBar = new QPEToolBar( this ); 261 viewToolBar = new QPEToolBar( this );
262 addToolBar (viewToolBar , tbd ); 262 addToolBar (viewToolBar , tbd );
263 if ( p->mToolBarHorN ) { 263 if ( p->mToolBarHorN ) {
264 if ( p->mToolBarUpN ) 264 if ( p->mToolBarUpN )
265 tbd = Bottom; 265 tbd = Bottom;
266 else 266 else
267 tbd = Top; 267 tbd = Top;
268 } 268 }
269 else { 269 else {
270 if ( p->mToolBarUpN ) 270 if ( p->mToolBarUpN )
271 tbd = Right; 271 tbd = Right;
272 else 272 else
273 tbd = Left; 273 tbd = Left;
274 } 274 }
275 navigatorToolBar = new QPEToolBar( this ); 275 navigatorToolBar = new QPEToolBar( this );
276 addToolBar (navigatorToolBar , tbd ); 276 addToolBar (navigatorToolBar , tbd );
277 } 277 }
278 278
279 279
280 280
281 mCalendarModifiedFlag = false; 281 mCalendarModifiedFlag = false;
282 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 282 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
283 splash->setAlignment ( AlignCenter ); 283 splash->setAlignment ( AlignCenter );
284 setCentralWidget( splash ); 284 setCentralWidget( splash );
285#ifndef DESKTOP_VERSION 285#ifndef DESKTOP_VERSION
286 showMaximized(); 286 showMaximized();
287#endif 287#endif
288 288
289 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 289 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
290 setDefaultPreferences(); 290 setDefaultPreferences();
291 mCalendar = new CalendarLocal(); 291 mCalendar = new CalendarLocal();
292 mView = new CalendarView( mCalendar, this,"mCalendar " ); 292 mView = new CalendarView( mCalendar, this,"mCalendar " );
293 mView->hide(); 293 mView->hide();
294 //mView->resize(splash->size() ); 294 //mView->resize(splash->size() );
295 initActions(); 295 initActions();
296 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 296 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
297 mSyncManager->setBlockSave(false); 297 mSyncManager->setBlockSave(false);
298 mView->setSyncManager(mSyncManager); 298 mView->setSyncManager(mSyncManager);
299#ifndef DESKTOP_VERSION 299#ifndef DESKTOP_VERSION
300 iconToolBar->show(); 300 iconToolBar->show();
301 qApp->processEvents(); 301 qApp->processEvents();
302#endif 302#endif
303 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 303 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
304 int vh = height() ; 304 int vh = height() ;
305 int vw = width(); 305 int vw = width();
306 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 306 //qDebug("Toolbar hei %d ",iconToolBar->height() );
307 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 307 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
308 vh -= iconToolBar->height(); 308 vh -= iconToolBar->height();
309 } else { 309 } else {
310 vw -= iconToolBar->height(); 310 vw -= iconToolBar->height();
311 } 311 }
312 //mView->setMaximumSize( splash->size() ); 312 //mView->setMaximumSize( splash->size() );
313 //mView->resize( splash->size() ); 313 //mView->resize( splash->size() );
314 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 314 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
315 mView->readSettings(); 315 mView->readSettings();
316 bool newFile = false; 316 bool newFile = false;
317 if( !QFile::exists( defaultFileName() ) ) { 317 if( !QFile::exists( defaultFileName() ) ) {
318 QFileInfo finfo ( defaultFileName() ); 318 QFileInfo finfo ( defaultFileName() );
319 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 319 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
320 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 320 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
321 finfo.setFile( oldFile ); 321 finfo.setFile( oldFile );
322 if (finfo.exists() ) { 322 if (finfo.exists() ) {
323 KMessageBox::information( this, message); 323 KMessageBox::information( this, message);
324 mView->openCalendar( oldFile ); 324 mView->openCalendar( oldFile );
325 qApp->processEvents(); 325 qApp->processEvents();
326 } else { 326 } else {
327 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 327 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
328 finfo.setFile( oldFile ); 328 finfo.setFile( oldFile );
329 if (finfo.exists() ) { 329 if (finfo.exists() ) {
330 KMessageBox::information( this, message); 330 KMessageBox::information( this, message);
331 mView->openCalendar( oldFile ); 331 mView->openCalendar( oldFile );
332 qApp->processEvents(); 332 qApp->processEvents();
333 } 333 }
334 } 334 }
335 mView->saveCalendar( defaultFileName() ); 335 mView->saveCalendar( defaultFileName() );
336 newFile = true; 336 newFile = true;
337 } 337 }
338 338
339 QTime neededSaveTime = QDateTime::currentDateTime().time(); 339 QTime neededSaveTime = QDateTime::currentDateTime().time();
340 mView->loadCalendars(); 340 mView->loadCalendars();
341 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 341 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
342 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 342 qDebug("KO: Calendar loading time: %d ms",msNeeded );
343 343
344 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 344 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
345 KOPrefs::instance()->setAllDefaults(); 345 KOPrefs::instance()->setAllDefaults();
346 int count = mView->addCategories(); 346 int count = mView->addCategories();
347 } 347 }
348 processIncidenceSelection( 0 ); 348 processIncidenceSelection( 0 );
349 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 349 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
350 SLOT( processIncidenceSelection( Incidence * ) ) ); 350 SLOT( processIncidenceSelection( Incidence * ) ) );
351 connect( mView, SIGNAL( modifiedChanged( bool ) ), 351 connect( mView, SIGNAL( modifiedChanged( bool ) ),
352 SLOT( slotModifiedChanged( bool ) ) ); 352 SLOT( slotModifiedChanged( bool ) ) );
353 353
354 354
355 connect( mView, SIGNAL( tempDisableBR(bool) ), 355 connect( mView, SIGNAL( tempDisableBR(bool) ),
356 SLOT( disableBR(bool) ) ); 356 SLOT( disableBR(bool) ) );
357 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 357 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
358 mView->setModified( false ); 358 mView->setModified( false );
359 mBlockAtStartup = false; 359 mBlockAtStartup = false;
360 mView->setModified( false ); 360 mView->setModified( false );
361 setCentralWidget( mView ); 361 setCentralWidget( mView );
362 globalFlagBlockStartup = 0; 362 globalFlagBlockStartup = 0;
363 mView->show(); 363 mView->show();
364 delete splash; 364 delete splash;
365 if ( newFile ) 365 if ( newFile )
366 mView->updateConfig(); 366 mView->updateConfig();
367 // qApp->processEvents(); 367 // qApp->processEvents();
368 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 368 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
369 //fillSyncMenu(); 369 //fillSyncMenu();
370 370
371 371
372 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 372 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
373 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 373 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
374 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 374 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
375 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 375 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
376 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 376 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
377 mSyncManager->setDefaultFileName( sentSyncFile()); 377 mSyncManager->setDefaultFileName( sentSyncFile());
378 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 378 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
379 mSyncManager->fillSyncMenu(); 379 mSyncManager->fillSyncMenu();
380 380
381 381
382 382
383 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 383 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
384 if ( showWarning ) { 384 if ( showWarning ) {
385 KMessageBox::information( this, 385 KMessageBox::information( this,
386 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 386 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
387 qApp->processEvents(); 387 qApp->processEvents();
388 mView->dialogManager()->showSyncOptions(); 388 mView->dialogManager()->showSyncOptions();
389 } 389 }
390 390
391 //US listen for result adressed from Ka/Pi 391 //US listen for result adressed from Ka/Pi
392#ifndef DESKTOP_VERSION 392#ifndef DESKTOP_VERSION
393 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 393 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
394#endif 394#endif
395#ifndef DESKTOP_VERSION 395#ifndef DESKTOP_VERSION
396 infrared = 0; 396 infrared = 0;
397#endif 397#endif
398 updateFilterToolbar(); 398 updateFilterToolbar();
399 updateWeek( mView->startDate() ); 399 updateWeek( mView->startDate() );
400 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 400 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
401 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 401 SLOT( updateWeekNum( const KCal::DateList & ) ) );
402 mBRdisabled = false; 402 mBRdisabled = false;
403 //toggleBeamReceive(); 403 //toggleBeamReceive();
404 int tiint= 3000; 404 int tiint= 3000;
405#ifndef DESKTOP_VERSION 405#ifndef DESKTOP_VERSION
406 tiint = 5000; 406 tiint = 5000;
407#endif 407#endif
408 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() )); 408 QTimer::singleShot( tiint, mView, SLOT ( checkAlarms() ));
409} 409}
410MainWindow::~MainWindow() 410MainWindow::~MainWindow()
411{ 411{
412 //qDebug("MainWindow::~MainWindow() "); 412 //qDebug("MainWindow::~MainWindow() ");
413 //save toolbar location 413 //save toolbar location
414 delete mCalendar; 414 delete mCalendar;
415 delete mSyncManager; 415 delete mSyncManager;
416#ifndef DESKTOP_VERSION 416#ifndef DESKTOP_VERSION
417 if ( infrared ) 417 if ( infrared )
418 delete infrared; 418 delete infrared;
419#endif 419#endif
420 420
421 421
422} 422}
423 423
424void MainWindow::disableBR(bool b) 424void MainWindow::disableBR(bool b)
425{ 425{
426#ifndef DESKTOP_VERSION 426#ifndef DESKTOP_VERSION
427 if ( b ) { 427 if ( b ) {
428 if ( infrared ) { 428 if ( infrared ) {
429 toggleBeamReceive(); 429 toggleBeamReceive();
430 mBRdisabled = true; 430 mBRdisabled = true;
431 } 431 }
432 mBRdisabled = true; 432 mBRdisabled = true;
433 } else { 433 } else {
434 if ( mBRdisabled ) { 434 if ( mBRdisabled ) {
435 mBRdisabled = false; 435 mBRdisabled = false;
436 //makes no sense,because other cal ap is probably running 436 //makes no sense,because other cal ap is probably running
437 // toggleBeamReceive(); 437 // toggleBeamReceive();
438 } 438 }
439 } 439 }
440#endif 440#endif
441 441
442} 442}
443bool MainWindow::beamReceiveEnabled() 443bool MainWindow::beamReceiveEnabled()
444{ 444{
445#ifndef DESKTOP_VERSION 445#ifndef DESKTOP_VERSION
446 return ( infrared != 0 ); 446 return ( infrared != 0 );
447#endif 447#endif
448 return false; 448 return false;
449} 449}
450 450
451void MainWindow::toggleBeamReceive() 451void MainWindow::toggleBeamReceive()
452{ 452{
453 if ( mBRdisabled ) 453 if ( mBRdisabled )
454 return; 454 return;
455#ifndef DESKTOP_VERSION 455#ifndef DESKTOP_VERSION
456 if ( infrared ) { 456 if ( infrared ) {
457 qDebug("KO: Disable BeamReceive "); 457 qDebug("KO: Disable BeamReceive ");
458 delete infrared; 458 delete infrared;
459 infrared = 0; 459 infrared = 0;
460 brAction->setOn(false); 460 brAction->setOn(false);
461 return; 461 return;
462 } 462 }
463 qDebug("KO: Enable BeamReceive "); 463 qDebug("KO: Enable BeamReceive ");
464 brAction->setOn(true); 464 brAction->setOn(true);
465 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 465 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
466 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 466 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
467#endif 467#endif
468} 468}
469void MainWindow::showMaximized () 469void MainWindow::showMaximized ()
470{ 470{
471#ifndef DESKTOP_VERSION 471#ifndef DESKTOP_VERSION
472 if ( ! globalFlagBlockStartup ) 472 if ( ! globalFlagBlockStartup )
473 if ( mClosed ) 473 if ( mClosed )
474 mView->goToday(); 474 mView->goToday();
475#endif 475#endif
476 QWidget::showMaximized () ; 476 QWidget::showMaximized () ;
477 mClosed = false; 477 mClosed = false;
478} 478}
479void MainWindow::closeEvent( QCloseEvent* ce ) 479void MainWindow::closeEvent( QCloseEvent* ce )
480{ 480{
481 481
482 482
483 483
484 if ( ! KOPrefs::instance()->mAskForQuit ) { 484 if ( ! KOPrefs::instance()->mAskForQuit ) {
485 saveOnClose(); 485 saveOnClose();
486 mClosed = true; 486 mClosed = true;
487 ce->accept(); 487 ce->accept();
488 return; 488 return;
489 489
490 } 490 }
491 491
492 switch( QMessageBox::information( this, "KO/Pi", 492 switch( QMessageBox::information( this, "KO/Pi",
493 i18n("Do you really want\nto close KO/Pi?"), 493 i18n("Do you really want\nto close KO/Pi?"),
494 i18n("Close"), i18n("No"), 494 i18n("Close"), i18n("No"),
495 0, 0 ) ) { 495 0, 0 ) ) {
496 case 0: 496 case 0:
497 saveOnClose(); 497 saveOnClose();
498 mClosed = true; 498 mClosed = true;
499 ce->accept(); 499 ce->accept();
500 break; 500 break;
501 case 1: 501 case 1:
502 ce->ignore(); 502 ce->ignore();
503 break; 503 break;
504 case 2: 504 case 2:
505 505
506 default: 506 default:
507 break; 507 break;
508 } 508 }
509 509
510 510
511} 511}
512 512
513void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 513void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
514{ 514{
515 QDataStream stream( data, IO_ReadOnly ); 515 QDataStream stream( data, IO_ReadOnly );
516 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 516 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
517 //QString datamess; 517 //QString datamess;
518 //qDebug("message "); 518 //qDebug("message ");
519 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 519 qDebug("KO: QCOP message received: %s ", cmsg.data() );
520 520
521 if ( cmsg == "setDocument(QString)" ) { 521 if ( cmsg == "setDocument(QString)" ) {
522 QDataStream stream( data, IO_ReadOnly ); 522 QDataStream stream( data, IO_ReadOnly );
523 QString fileName; 523 QString fileName;
524 stream >> fileName; 524 stream >> fileName;
525 //qDebug("filename %s ", fileName.latin1()); 525 //qDebug("filename %s ", fileName.latin1());
526 showMaximized(); 526 showMaximized();
527 raise(); 527 raise();
528 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 528 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
529 mSyncManager->slotSyncMenu( 1002 ); 529 mSyncManager->slotSyncMenu( 1002 );
530 return; 530 return;
531 } 531 }
532 532
533 if ( cmsg == "-writeFile" ) { 533 if ( cmsg == "-writeFile" ) {
534 // I made from the "-writeFile" an "-writeAlarm" 534 // I made from the "-writeFile" an "-writeAlarm"
535 mView->viewManager()->showWhatsNextView(); 535 mView->viewManager()->showWhatsNextView();
536 mCalendar->checkAlarmForIncidence( 0, true); 536 mCalendar->checkAlarmForIncidence( 0, true);
537 showMaximized(); 537 showMaximized();
538 raise(); 538 raise();
539 return; 539 return;
540 540
541 } 541 }
542 if ( cmsg == "-writeFileSilent" ) { 542 if ( cmsg == "-writeFileSilent" ) {
543 // I made from the "-writeFile" an "-writeAlarm" 543 // I made from the "-writeFile" an "-writeAlarm"
544 // mView->viewManager()->showWhatsNextView(); 544 // mView->viewManager()->showWhatsNextView();
545 mCalendar->checkAlarmForIncidence( 0, true); 545 mCalendar->checkAlarmForIncidence( 0, true);
546 //showMaximized(); 546 //showMaximized();
547 //raise(); 547 //raise();
548 hide(); 548 hide();
549 return; 549 return;
550 } 550 }
551 if ( cmsg == "-newCountdown" ) { 551 if ( cmsg == "-newCountdown" ) {
552 qDebug("newCountdown "); 552 qDebug("newCountdown ");
553 553
554 } 554 }
555 QString msg ; 555 QString msg ;
556 QString allmsg = cmsg; 556 QString allmsg = cmsg;
557 while ( allmsg.length() > 0 ) { 557 while ( allmsg.length() > 0 ) {
558 int nextC = allmsg.find( "-", 1 ); 558 int nextC = allmsg.find( "-", 1 );
559 if ( nextC == -1 ) { 559 if ( nextC == -1 ) {
560 msg = allmsg; 560 msg = allmsg;
561 allmsg = ""; 561 allmsg = "";
562 } else{ 562 } else{
563 msg = allmsg.left( nextC ); 563 msg = allmsg.left( nextC );
564 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 564 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
565 } 565 }
566 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 566 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
567 if ( msg == "-newEvent" ) { 567 if ( msg == "-newEvent" ) {
568 mView->newEvent(); 568 mView->newEvent();
569 } 569 }
570 if ( msg == "-newTodo" ) { 570 if ( msg == "-newTodo" ) {
571 mView->newTodo(); 571 mView->newTodo();
572 572
573 } 573 }
574 if ( msg == "-showWN" ) { 574 if ( msg == "-showWN" ) {
575 mView->viewManager()->showWhatsNextView(); 575 mView->viewManager()->showWhatsNextView();
576 } 576 }
577 if ( msg == "-showTodo" ) { 577 if ( msg == "-showTodo" ) {
578 mView->viewManager()->showTodoView(); 578 mView->viewManager()->showTodoView();
579 } 579 }
580 if ( msg == "-showList" ) { 580 if ( msg == "-showList" ) {
581 mView->viewManager()->showListView(); 581 mView->viewManager()->showListView();
582 } 582 }
583 else if ( msg == "-showDay" ) { 583 else if ( msg == "-showDay" ) {
584 mView->viewManager()->showDayView(); 584 mView->viewManager()->showDayView();
585 } 585 }
586 else if ( msg == "-showWWeek" ) { 586 else if ( msg == "-showWWeek" ) {
587 mView->viewManager()->showWorkWeekView(); 587 mView->viewManager()->showWorkWeekView();
588 } 588 }
589 else if ( msg == "-ringSync" ) { 589 else if ( msg == "-ringSync" ) {
590 mSyncManager->multiSync( false ); 590 mSyncManager->multiSync( false );
591 } 591 }
592 else if ( msg == "-showWeek" ) { 592 else if ( msg == "-showWeek" ) {
593 mView->viewManager()->showWeekView(); 593 mView->viewManager()->showWeekView();
594 } 594 }
595 else if ( msg == "-showTodo" ) { 595 else if ( msg == "-showTodo" ) {
596 mView->viewManager()->showTodoView(); 596 mView->viewManager()->showTodoView();
597 } 597 }
598 else if ( msg == "-showJournal" ) { 598 else if ( msg == "-showJournal" ) {
599 mView->dateNavigator()->selectDates( 1 ); 599 mView->dateNavigator()->selectDates( 1 );
600 mView->dateNavigator()->selectToday(); 600 mView->dateNavigator()->selectToday();
601 mView->viewManager()->showJournalView(); 601 mView->viewManager()->showJournalView();
602 } 602 }
603 else if ( msg == "-showKO" ) { 603 else if ( msg == "-showKO" ) {
604 mView->viewManager()->showNextXView(); 604 mView->viewManager()->showNextXView();
605 } 605 }
606 else if ( msg == "-showWNext" ) { 606 else if ( msg == "-showWNext" ) {
607 mView->viewManager()->showWhatsNextView(); 607 mView->viewManager()->showWhatsNextView();
608 } 608 }
609 else if ( msg == "nextView()" ) { 609 else if ( msg == "nextView()" ) {
610 mView->viewManager()->showNextView(); 610 mView->viewManager()->showNextView();
611 } 611 }
612 else if ( msg == "-showNextXView" ) { 612 else if ( msg == "-showNextXView" ) {
613 mView->viewManager()->showNextXView(); 613 mView->viewManager()->showNextXView();
614 } 614 }
615 615
616 616
617 } 617 }
618 618
619 showMaximized(); 619 showMaximized();
620 raise(); 620 raise();
621} 621}
622 622
623QPixmap MainWindow::loadPixmap( QString name ) 623QPixmap MainWindow::loadPixmap( QString name )
624{ 624{
625 return SmallIcon( name ); 625 return SmallIcon( name );
626 626
627} 627}
628void MainWindow::setUsesBigPixmaps ( bool b ) 628void MainWindow::setUsesBigPixmaps ( bool b )
629{ 629{
630 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 630 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
631 if ( b ) 631 if ( b )
632 qDebug("KO: BigPixmaps are not supported "); 632 qDebug("KO: BigPixmaps are not supported ");
633} 633}
634void MainWindow::initActions() 634void MainWindow::initActions()
635{ 635{
636 //KOPrefs::instance()->mShowFullMenu 636 //KOPrefs::instance()->mShowFullMenu
637 iconToolBar->clear(); 637 iconToolBar->clear();
638 KOPrefs *p = KOPrefs::instance(); 638 KOPrefs *p = KOPrefs::instance();
639 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 639 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
640 640
641 QPopupMenu *viewMenu = new QPopupMenu( this ); 641 QPopupMenu *viewMenu = new QPopupMenu( this );
642 QPopupMenu *actionMenu = new QPopupMenu( this ); 642 QPopupMenu *actionMenu = new QPopupMenu( this );
643 QPopupMenu *importMenu = new QPopupMenu( this ); 643 QPopupMenu *importMenu = new QPopupMenu( this );
644 QPopupMenu *importMenu_X = new QPopupMenu( this ); 644 QPopupMenu *importMenu_X = new QPopupMenu( this );
645 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 645 QPopupMenu *exportMenu_X = new QPopupMenu( this );
646 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 646 QPopupMenu *beamMenu_X = new QPopupMenu( this );
647 selectFilterMenu = new QPopupMenu( this ); 647 selectFilterMenu = new QPopupMenu( this );
648 selectFilterMenu->setCheckable( true ); 648 selectFilterMenu->setCheckable( true );
649 syncMenu = new QPopupMenu( this ); 649 syncMenu = new QPopupMenu( this );
650 configureAgendaMenu = new QPopupMenu( this ); 650 configureAgendaMenu = new QPopupMenu( this );
651 configureToolBarMenu = new QPopupMenu( this ); 651 configureToolBarMenu = new QPopupMenu( this );
652 QPopupMenu *helpMenu = new QPopupMenu( this ); 652 QPopupMenu *helpMenu = new QPopupMenu( this );
653 QIconSet icon; 653 QIconSet icon;
654 int pixWid = 22, pixHei = 22; 654 int pixWid = 22, pixHei = 22;
655 QString pathString = ""; 655 QString pathString = "";
656 if ( !p->mToolBarMiniIcons ) { 656 if ( !p->mToolBarMiniIcons ) {
657 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 657 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
658 pathString += "icons16/"; 658 pathString += "icons16/";
659 pixWid = 18; pixHei = 16; 659 pixWid = 18; pixHei = 16;
660 } 660 }
661 } else { 661 } else {
662 pathString += "iconsmini/"; 662 pathString += "iconsmini/";
663 pixWid = 18; pixHei = 16; 663 pixWid = 18; pixHei = 16;
664 } 664 }
665 if ( KOPrefs::instance()->mShowFullMenu ) { 665 if ( KOPrefs::instance()->mShowFullMenu ) {
666 QMenuBar *menuBar1; 666 QMenuBar *menuBar1;
667 menuBar1 = menuBar(); 667 menuBar1 = menuBar();
668 menuBar1->insertItem( i18n("File"), importMenu ); 668 menuBar1->insertItem( i18n("File"), importMenu );
669 menuBar1->insertItem( i18n("View"), viewMenu ); 669 menuBar1->insertItem( i18n("View"), viewMenu );
670 menuBar1->insertItem( i18n("Actions"), actionMenu ); 670 menuBar1->insertItem( i18n("Actions"), actionMenu );
671#ifdef DESKTOP_VERSION 671#ifdef DESKTOP_VERSION
672 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 672 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
673 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 673 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
674#else 674#else
675 menuBar1->insertItem( i18n("Sync"), syncMenu ); 675 menuBar1->insertItem( i18n("Sync"), syncMenu );
676 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 676 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
677#endif 677#endif
678 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 678 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
679 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 679 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
680 menuBar1->insertItem( i18n("Help"), helpMenu ); 680 menuBar1->insertItem( i18n("Help"), helpMenu );
681 } else { 681 } else {
682 QPEMenuBar *menuBar1; 682 QPEMenuBar *menuBar1;
683 menuBar1 = new QPEMenuBar( iconToolBar ); 683 menuBar1 = new QPEMenuBar( iconToolBar );
684 QPopupMenu *menuBar = new QPopupMenu( this ); 684 QPopupMenu *menuBar = new QPopupMenu( this );
685 icon = loadPixmap( pathString + "z_menu" ); 685 icon = loadPixmap( pathString + "z_menu" );
686 menuBar1->insertItem( icon.pixmap(), menuBar); 686 menuBar1->insertItem( icon.pixmap(), menuBar);
687 //menuBar1->insertItem( i18n("ME"), menuBar); 687 //menuBar1->insertItem( i18n("ME"), menuBar);
688 menuBar->insertItem( i18n("File"), importMenu ); 688 menuBar->insertItem( i18n("File"), importMenu );
689 menuBar->insertItem( i18n("View"), viewMenu ); 689 menuBar->insertItem( i18n("View"), viewMenu );
690 menuBar->insertItem( i18n("Actions"), actionMenu ); 690 menuBar->insertItem( i18n("Actions"), actionMenu );
691 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 691 menuBar->insertItem( i18n("Synchronize"), syncMenu );
692 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 692 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
693 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 693 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
694 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 694 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
695 menuBar->insertItem( i18n("Help"), helpMenu ); 695 menuBar->insertItem( i18n("Help"), helpMenu );
696 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 696 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
697 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 697 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
698 } 698 }
699 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 699 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
700 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 700 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
701 701
702 702
703 mWeekBgColor = iconToolBar->backgroundColor(); 703 mWeekBgColor = iconToolBar->backgroundColor();
704 mWeekPixmap.resize( pixWid , pixHei ); 704 mWeekPixmap.resize( pixWid , pixHei );
705 mWeekPixmap.fill( mWeekBgColor ); 705 mWeekPixmap.fill( mWeekBgColor );
706 icon = mWeekPixmap; 706 icon = mWeekPixmap;
707 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 707 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
708 if ( p-> mShowIconWeekNum ) 708 if ( p-> mShowIconWeekNum )
709 mWeekAction->addTo( iconToolBar ); 709 mWeekAction->addTo( iconToolBar );
710 mWeekFont = font(); 710 mWeekFont = font();
711 711
712 int fontPoint = mWeekFont.pointSize(); 712 int fontPoint = mWeekFont.pointSize();
713 QFontMetrics f( mWeekFont ); 713 QFontMetrics f( mWeekFont );
714 int fontWid = f.width( "30" ); 714 int fontWid = f.width( "30" );
715 while ( fontWid > pixWid ) { 715 while ( fontWid > pixWid ) {
716 --fontPoint; 716 --fontPoint;
717 mWeekFont.setPointSize( fontPoint ); 717 mWeekFont.setPointSize( fontPoint );
718 QFontMetrics f( mWeekFont ); 718 QFontMetrics f( mWeekFont );
719 fontWid = f.width( "30" ); 719 fontWid = f.width( "30" );
720 //qDebug("dec-- "); 720 //qDebug("dec-- ");
721 } 721 }
722 722
723 connect( mWeekAction, SIGNAL( activated() ), 723 connect( mWeekAction, SIGNAL( activated() ),
724 this, SLOT( weekAction() ) ); 724 this, SLOT( weekAction() ) );
725 725
726 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 726 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
727 if ( p->mShowIconFilterview ) { 727 if ( p->mShowIconFilterview ) {
728 icon = loadPixmap( pathString + "filter" ); 728 icon = loadPixmap( pathString + "filter" );
729 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 729 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
730 connect( actionFilterMenuTB, SIGNAL( activated() ), 730 connect( actionFilterMenuTB, SIGNAL( activated() ),
731 this, SLOT( fillFilterMenuTB() ) ); 731 this, SLOT( fillFilterMenuTB() ) );
732 actionFilterMenuTB->addTo( iconToolBar ); 732 actionFilterMenuTB->addTo( iconToolBar );
733 selectFilterMenuTB = new QPopupMenu( this ); 733 selectFilterMenuTB = new QPopupMenu( this );
734 selectFilterMenuTB->setCheckable( true ); 734 selectFilterMenuTB->setCheckable( true );
735 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 735 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
736 } 736 }
737 737
738 //#endif 738 //#endif
739 // ****************** 739 // ******************
740 QAction *action; 740 QAction *action;
741 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 741 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
742 configureToolBarMenu->setCheckable( true ); 742 configureToolBarMenu->setCheckable( true );
743 743
744 744
745 configureAgendaMenu->setCheckable( true ); 745 configureAgendaMenu->setCheckable( true );
746 int iii ; 746 int iii ;
747 for ( iii = 1;iii<= 10 ;++iii ){ 747 for ( iii = 1;iii<= 10 ;++iii ){
748 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 748 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
749 } 749 }
750 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 750 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
751 751
752 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 752 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
753 this, SLOT( showConfigureAgenda( ) ) ); 753 this, SLOT( showConfigureAgenda( ) ) );
754 754
755 icon = loadPixmap( pathString + "configure" ); 755 icon = loadPixmap( pathString + "configure" );
756 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 756 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
757 action->addTo( actionMenu ); 757 action->addTo( actionMenu );
758 connect( action, SIGNAL( activated() ), 758 connect( action, SIGNAL( activated() ),
759 mView, SLOT( edit_options() ) ); 759 mView, SLOT( edit_options() ) );
760 icon = loadPixmap( pathString + "configure" ); 760 icon = loadPixmap( pathString + "configure" );
761 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 761 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
762 action->addTo( actionMenu ); 762 action->addTo( actionMenu );
763 connect( action, SIGNAL( activated() ), 763 connect( action, SIGNAL( activated() ),
764 mView, SLOT( edit_global_options() ) ); 764 mView, SLOT( edit_global_options() ) );
765 actionMenu->insertSeparator(); 765 actionMenu->insertSeparator();
766 766
767 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 767 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
768 action->addTo( actionMenu ); 768 action->addTo( actionMenu );
769 connect( action, SIGNAL( activated() ), 769 connect( action, SIGNAL( activated() ),
770 mView, SLOT( undo_delete() ) ); 770 mView, SLOT( undo_delete() ) );
771 actionMenu->insertSeparator(); 771 actionMenu->insertSeparator();
772 772
773 icon = loadPixmap( pathString + "newevent" ); 773 icon = loadPixmap( pathString + "newevent" );
774 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 774 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
775 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 775 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
776 configureToolBarMenu->insertSeparator(); 776 configureToolBarMenu->insertSeparator();
777 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 777 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
778 configureToolBarMenu->insertSeparator(); 778 configureToolBarMenu->insertSeparator();
779 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 779 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
780 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 780 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
781 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 781 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
782 ne_action->addTo( actionMenu ); 782 ne_action->addTo( actionMenu );
783 connect( ne_action, SIGNAL( activated() ), 783 connect( ne_action, SIGNAL( activated() ),
784 mView, SLOT( newEvent() ) ); 784 mView, SLOT( newEvent() ) );
785 icon = loadPixmap( pathString + "newtodo" ); 785 icon = loadPixmap( pathString + "newtodo" );
786 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 786 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
787 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 787 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
788 nt_action->addTo( actionMenu ); 788 nt_action->addTo( actionMenu );
789 connect( nt_action, SIGNAL( activated() ), 789 connect( nt_action, SIGNAL( activated() ),
790 mView, SLOT( newTodo() ) ); 790 mView, SLOT( newTodo() ) );
791 791
792 icon = loadPixmap( pathString + "today" ); 792 icon = loadPixmap( pathString + "today" );
793 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 793 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
794 today_action->addTo( viewMenu ); 794 today_action->addTo( viewMenu );
795 connect( today_action, SIGNAL( activated() ), 795 connect( today_action, SIGNAL( activated() ),
796 mView, SLOT( goToday() ) ); 796 mView, SLOT( goToday() ) );
797 viewMenu->insertSeparator(); 797 viewMenu->insertSeparator();
798 798
799 // *********************** 799 // ***********************
800 if ( KOPrefs::instance()->mVerticalScreen ) { 800 if ( KOPrefs::instance()->mVerticalScreen ) {
801 icon = SmallIcon( "1updownarrow" ); 801 icon = SmallIcon( "1updownarrow" );
802 } else { 802 } else {
803 icon = SmallIcon("1leftrightarrow" ); 803 icon = SmallIcon("1leftrightarrow" );
804 } 804 }
805 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 805 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
806 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 806 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
807 FSaction->addTo( viewMenu ); 807 FSaction->addTo( viewMenu );
808 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 808 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
809 809
810 810
811 icon = loadPixmap( pathString + "filter" ); 811 icon = loadPixmap( pathString + "filter" );
812 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 812 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
813 icon = loadPixmap( pathString + "configure" ); 813 icon = loadPixmap( pathString + "configure" );
814 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 814 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
815 action->addTo( viewMenu ); 815 action->addTo( viewMenu );
816 connect( action, SIGNAL( activated() ), 816 connect( action, SIGNAL( activated() ),
817 mView, SLOT( toggleFilter() ) ); 817 mView, SLOT( toggleFilter() ) );
818 mToggleFilter = action; 818 mToggleFilter = action;
819 icon = loadPixmap( pathString + "navi" ); 819 icon = loadPixmap( pathString + "navi" );
820 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 820 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
821 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 821 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
822 action->addTo( viewMenu ); 822 action->addTo( viewMenu );
823 connect( action, SIGNAL( activated() ), 823 connect( action, SIGNAL( activated() ),
824 mView, SLOT( toggleDateNavigatorWidget() ) ); 824 mView, SLOT( toggleDateNavigatorWidget() ) );
825 mToggleNav = action ; 825 mToggleNav = action ;
826 icon = loadPixmap( pathString + "allday" ); 826 icon = loadPixmap( pathString + "allday" );
827 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 827 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
828 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 828 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
829 action->addTo( viewMenu ); 829 action->addTo( viewMenu );
830 connect( action, SIGNAL( activated() ), 830 connect( action, SIGNAL( activated() ),
831 mView, SLOT( toggleAllDaySize() ) ); 831 mView, SLOT( toggleAllDaySize() ) );
832 mToggleAllday = action; 832 mToggleAllday = action;
833 833
834 834
835 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 835 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
836 mToggleNav, SLOT( setEnabled ( bool ) ) ); 836 mToggleNav, SLOT( setEnabled ( bool ) ) );
837 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 837 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
838 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 838 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
839 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 839 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
840 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 840 mToggleAllday, SLOT( setEnabled ( bool ) ) );
841 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 841 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
842 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 842 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
843 843
844 viewMenu->insertSeparator(); 844 viewMenu->insertSeparator();
845 icon = loadPixmap( pathString + "picker" ); 845 icon = loadPixmap( pathString + "picker" );
846 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 846 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
847 action->addTo( viewMenu ); 847 action->addTo( viewMenu );
848 connect( action, SIGNAL( activated() ), 848 connect( action, SIGNAL( activated() ),
849 mView, SLOT( showDatePicker() ) ); 849 mView, SLOT( showDatePicker() ) );
850 action->addTo( iconToolBar ); 850 action->addTo( iconToolBar );
851 viewMenu->insertSeparator(); 851 viewMenu->insertSeparator();
852 852
853 if ( p-> mShowIconToggleFull ) 853 if ( p-> mShowIconToggleFull )
854 FSaction->addTo( iconToolBar ); 854 FSaction->addTo( iconToolBar );
855 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 855 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
856 856
857 //******************** 857 //********************
858 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 858 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
859 859
860 860
861 icon = loadPixmap( pathString + "whatsnext" ); 861 icon = loadPixmap( pathString + "whatsnext" );
862 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 862 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
863 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 863 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
864 whatsnext_action->addTo( viewMenu ); 864 whatsnext_action->addTo( viewMenu );
865 connect( whatsnext_action, SIGNAL( activated() ), 865 connect( whatsnext_action, SIGNAL( activated() ),
866 mView->viewManager(), SLOT( showWhatsNextView() ) ); 866 mView->viewManager(), SLOT( showWhatsNextView() ) );
867 867
868 icon = loadPixmap( pathString + "xdays" ); 868 icon = loadPixmap( pathString + "xdays" );
869 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 869 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
870 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 870 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
871 xdays_action->addTo( viewMenu ); 871 xdays_action->addTo( viewMenu );
872 connect( xdays_action, SIGNAL( activated() ), 872 connect( xdays_action, SIGNAL( activated() ),
873 mView->viewManager(), SLOT( showNextXView() ) ); 873 mView->viewManager(), SLOT( showNextXView() ) );
874 874
875 875
876 icon = loadPixmap( pathString + "journal" ); 876 icon = loadPixmap( pathString + "journal" );
877 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 877 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
878 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 878 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
879 viewjournal_action->addTo( viewMenu ); 879 viewjournal_action->addTo( viewMenu );
880 connect( viewjournal_action, SIGNAL( activated() ), 880 connect( viewjournal_action, SIGNAL( activated() ),
881 mView->viewManager(), SLOT( showJournalView() ) ); 881 mView->viewManager(), SLOT( showJournalView() ) );
882 882
883 883
884 icon = loadPixmap( pathString + "day" ); 884 icon = loadPixmap( pathString + "day" );
885 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 885 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
886 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 886 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
887 day1_action->addTo( viewMenu ); 887 day1_action->addTo( viewMenu );
888 // action->addTo( toolBar ); 888 // action->addTo( toolBar );
889 connect( day1_action, SIGNAL( activated() ), 889 connect( day1_action, SIGNAL( activated() ),
890 mView->viewManager(), SLOT( showDayView() ) ); 890 mView->viewManager(), SLOT( showDayView() ) );
891 891
892 icon = loadPixmap( pathString + "workweek" ); 892 icon = loadPixmap( pathString + "workweek" );
893 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 893 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
894 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 894 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
895 day5_action->addTo( viewMenu ); 895 day5_action->addTo( viewMenu );
896 connect( day5_action, SIGNAL( activated() ), 896 connect( day5_action, SIGNAL( activated() ),
897 mView->viewManager(), SLOT( showWorkWeekView() ) ); 897 mView->viewManager(), SLOT( showWorkWeekView() ) );
898 898
899 icon = loadPixmap( pathString + "week" ); 899 icon = loadPixmap( pathString + "week" );
900 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 900 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
901 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 901 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
902 day7_action->addTo( viewMenu ); 902 day7_action->addTo( viewMenu );
903 connect( day7_action, SIGNAL( activated() ), 903 connect( day7_action, SIGNAL( activated() ),
904 mView->viewManager(), SLOT( showWeekView() ) ); 904 mView->viewManager(), SLOT( showWeekView() ) );
905 905
906 icon = loadPixmap( pathString + "workweek2" ); 906 icon = loadPixmap( pathString + "workweek2" );
907 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 907 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
908 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 908 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
909 day6_action->addTo( viewMenu ); 909 day6_action->addTo( viewMenu );
910 connect( day6_action, SIGNAL( activated() ), 910 connect( day6_action, SIGNAL( activated() ),
911 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 911 mView->viewManager(), SLOT( showMonthViewWeek() ) );
912 912
913 icon = loadPixmap( pathString + "month" ); 913 icon = loadPixmap( pathString + "month" );
914 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 914 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
915 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 915 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
916 month_action->addTo( viewMenu ); 916 month_action->addTo( viewMenu );
917 connect( month_action, SIGNAL( activated() ), 917 connect( month_action, SIGNAL( activated() ),
918 mView->viewManager(), SLOT( showMonthView() ) ); 918 mView->viewManager(), SLOT( showMonthView() ) );
919 919
920 icon = loadPixmap( pathString + "list" ); 920 icon = loadPixmap( pathString + "list" );
921 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 921 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
922 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 922 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
923 showlist_action->addTo( viewMenu ); 923 showlist_action->addTo( viewMenu );
924 connect( showlist_action, SIGNAL( activated() ), 924 connect( showlist_action, SIGNAL( activated() ),
925 mView->viewManager(), SLOT( showListView() ) ); 925 mView->viewManager(), SLOT( showListView() ) );
926 926
927 icon = loadPixmap( pathString + "todo" ); 927 icon = loadPixmap( pathString + "todo" );
928 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 928 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
929 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 929 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
930 todoview_action->addTo( viewMenu ); 930 todoview_action->addTo( viewMenu );
931 connect( todoview_action, SIGNAL( activated() ), 931 connect( todoview_action, SIGNAL( activated() ),
932 mView->viewManager(), SLOT( showTodoView() ) ); 932 mView->viewManager(), SLOT( showTodoView() ) );
933 933
934 934
935 935
936#if 0 936#if 0
937 action = new QAction( "view_timespan", "Time Span", 0, this ); 937 action = new QAction( "view_timespan", "Time Span", 0, this );
938 action->addTo( viewMenu ); 938 action->addTo( viewMenu );
939 connect( action, SIGNAL( activated() ), 939 connect( action, SIGNAL( activated() ),
940 mView->viewManager(), SLOT( showTimeSpanView() ) ); 940 mView->viewManager(), SLOT( showTimeSpanView() ) );
941#endif 941#endif
942 942
943 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 943 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
944 this ); 944 this );
945 mNewSubTodoAction->addTo( actionMenu ); 945 mNewSubTodoAction->addTo( actionMenu );
946 connect( mNewSubTodoAction, SIGNAL( activated() ), 946 connect( mNewSubTodoAction, SIGNAL( activated() ),
947 mView, SLOT( newSubTodo() ) ); 947 mView, SLOT( newSubTodo() ) );
948 948
949 actionMenu->insertSeparator(); 949 actionMenu->insertSeparator();
950 950
951 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 951 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
952 mShowAction->addTo( actionMenu ); 952 mShowAction->addTo( actionMenu );
953 connect( mShowAction, SIGNAL( activated() ), 953 connect( mShowAction, SIGNAL( activated() ),
954 mView, SLOT( showIncidence() ) ); 954 mView, SLOT( showIncidence() ) );
955 955
956 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 956 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
957 mEditAction->addTo( actionMenu ); 957 mEditAction->addTo( actionMenu );
958 connect( mEditAction, SIGNAL( activated() ), 958 connect( mEditAction, SIGNAL( activated() ),
959 mView, SLOT( editIncidence() ) ); 959 mView, SLOT( editIncidence() ) );
960 960
961 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 961 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
962 mDeleteAction->addTo( actionMenu ); 962 mDeleteAction->addTo( actionMenu );
963 connect( mDeleteAction, SIGNAL( activated() ), 963 connect( mDeleteAction, SIGNAL( activated() ),
964 mView, SLOT( deleteIncidence() ) ); 964 mView, SLOT( deleteIncidence() ) );
965 965
966 966
967 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 967 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
968 mCloneAction->addTo( actionMenu ); 968 mCloneAction->addTo( actionMenu );
969 connect( mCloneAction, SIGNAL( activated() ), 969 connect( mCloneAction, SIGNAL( activated() ),
970 mView, SLOT( cloneIncidence() ) ); 970 mView, SLOT( cloneIncidence() ) );
971 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 971 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
972 mMoveAction->addTo( actionMenu ); 972 mMoveAction->addTo( actionMenu );
973 connect( mMoveAction, SIGNAL( activated() ), 973 connect( mMoveAction, SIGNAL( activated() ),
974 mView, SLOT( moveIncidence() ) ); 974 mView, SLOT( moveIncidence() ) );
975 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 975 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
976 mBeamAction->addTo( actionMenu ); 976 mBeamAction->addTo( actionMenu );
977 connect( mBeamAction, SIGNAL( activated() ), 977 connect( mBeamAction, SIGNAL( activated() ),
978 mView, SLOT( beamIncidence() ) ); 978 mView, SLOT( beamIncidence() ) );
979 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 979 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
980 mCancelAction->addTo( actionMenu ); 980 mCancelAction->addTo( actionMenu );
981 connect( mCancelAction, SIGNAL( activated() ), 981 connect( mCancelAction, SIGNAL( activated() ),
982 mView, SLOT( toggleCancelIncidence() ) ); 982 mView, SLOT( toggleCancelIncidence() ) );
983 983
984 actionMenu->insertSeparator(); 984 actionMenu->insertSeparator();
985 985
986 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 986 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
987 this ); 987 this );
988 action->addTo( actionMenu ); 988 action->addTo( actionMenu );
989 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 989 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
990 990
991 icon = loadPixmap( pathString + "search" ); 991 icon = loadPixmap( pathString + "search" );
992 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 992 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
993 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 993 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
994 search_action->addTo( actionMenu ); 994 search_action->addTo( actionMenu );
995 connect( search_action, SIGNAL( activated() ), 995 connect( search_action, SIGNAL( activated() ),
996 mView->dialogManager(), SLOT( showSearchDialog() ) ); 996 mView->dialogManager(), SLOT( showSearchDialog() ) );
997 997
998 998
999 999
1000 if ( KOPrefs::instance()->mShowFullMenu ) { 1000 if ( KOPrefs::instance()->mShowFullMenu ) {
1001 actionMenu->insertSeparator(); 1001 actionMenu->insertSeparator();
1002 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1002 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1003 1003
1004 } 1004 }
1005 // actionMenu->insertSeparator(); 1005 // actionMenu->insertSeparator();
1006 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1006 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1007 this ); 1007 this );
1008 action->addTo( importMenu_X ); 1008 action->addTo( importMenu_X );
1009 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1009 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1010 action = new QAction( "import_quick", i18n("Import last file"), 0, 1010 action = new QAction( "import_quick", i18n("Import last file"), 0,
1011 this ); 1011 this );
1012 action->addTo( importMenu_X ); 1012 action->addTo( importMenu_X );
1013 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1013 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1014 importMenu_X->insertSeparator(); 1014 importMenu_X->insertSeparator();
1015 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1015 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1016 this ); 1016 this );
1017 action->addTo( importMenu_X ); 1017 action->addTo( importMenu_X );
1018 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1018 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1019 //#ifndef DESKTOP_VERSION 1019 //#ifndef DESKTOP_VERSION
1020 importMenu_X->insertSeparator(); 1020 importMenu_X->insertSeparator();
1021 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1021 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1022 this ); 1022 this );
1023 action->addTo( importMenu_X ); 1023 action->addTo( importMenu_X );
1024 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1024 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1025 //#else 1025 //#else
1026#ifdef _OL_IMPORT_ 1026#ifdef _OL_IMPORT_
1027 importMenu_X->insertSeparator(); 1027 importMenu_X->insertSeparator();
1028 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1028 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1029 this ); 1029 this );
1030 action->addTo( importMenu_X ); 1030 action->addTo( importMenu_X );
1031 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1031 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1032#endif 1032#endif
1033 //#endif 1033 //#endif
1034 1034
1035 //importMenu->insertSeparator(); 1035 //importMenu->insertSeparator();
1036 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1036 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1037 this ); 1037 this );
1038 action->addTo( importMenu ); 1038 action->addTo( importMenu );
1039 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1039 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1040 1040
1041 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 1041 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
1042 this ); 1042 this );
1043 action->addTo( importMenu ); 1043 action->addTo( importMenu );
1044 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1044 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1045 importMenu->insertSeparator(); 1045 importMenu->insertSeparator();
1046 importMenu->insertItem( i18n("Import"), importMenu_X ); 1046 importMenu->insertItem( i18n("Import"), importMenu_X );
1047 //importMenu->insertSeparator(); 1047 //importMenu->insertSeparator();
1048 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1048 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1049 this ); 1049 this );
1050 action->addTo( exportMenu_X ); 1050 action->addTo( exportMenu_X );
1051 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1051 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1052 1052
1053 1053
1054 //LR 1054 //LR
1055 QPopupMenu *ex2phone = new QPopupMenu( this ); 1055 QPopupMenu *ex2phone = new QPopupMenu( this );
1056 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1056 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1057 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1057 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1058 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1058 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1059 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1059 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1060 1060
1061 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1061 importMenu->insertItem( i18n("Export"), exportMenu_X );
1062#ifndef DESKTOP_VERSION 1062#ifndef DESKTOP_VERSION
1063 //importMenu->insertSeparator(); 1063 //importMenu->insertSeparator();
1064 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1064 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1065 this ); 1065 this );
1066 brAction->addTo( beamMenu_X ); 1066 brAction->addTo( beamMenu_X );
1067 brAction->setToggleAction (true ) ; 1067 brAction->setToggleAction (true ) ;
1068 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1068 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1069 1069
1070 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1070 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1071 this ); 1071 this );
1072 action->addTo( beamMenu_X ); 1072 action->addTo( beamMenu_X );
1073 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1073 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1074 1074
1075 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1075 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1076 this ); 1076 this );
1077 action->addTo( beamMenu_X ); 1077 action->addTo( beamMenu_X );
1078 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1078 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1079 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1079 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1080#else 1080#else
1081 //importMenu->insertSeparator(); 1081 //importMenu->insertSeparator();
1082 icon = loadPixmap( pathString + "print" ); 1082 icon = loadPixmap( pathString + "print" );
1083 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1083 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1084 action->addTo( beamMenu_X ); 1084 action->addTo( beamMenu_X );
1085 connect( action, SIGNAL( activated() ), 1085 connect( action, SIGNAL( activated() ),
1086 this, SLOT( printCal() ) ); 1086 this, SLOT( printCal() ) );
1087 1087
1088 icon = loadPixmap( pathString + "print" ); 1088 icon = loadPixmap( pathString + "print" );
1089 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1089 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1090 action->addTo( beamMenu_X ); 1090 action->addTo( beamMenu_X );
1091 connect( action, SIGNAL( activated() ), 1091 connect( action, SIGNAL( activated() ),
1092 this, SLOT( printSel() ) ); 1092 this, SLOT( printSel() ) );
1093 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1093 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1094 action->addTo( beamMenu_X ); 1094 action->addTo( beamMenu_X );
1095 connect( action, SIGNAL( activated() ), 1095 connect( action, SIGNAL( activated() ),
1096 mView->viewManager(), SLOT( slotprintWNV() ) ); 1096 mView->viewManager(), SLOT( slotprintWNV() ) );
1097 1097
1098 1098
1099 icon = loadPixmap( pathString + "print" ); 1099 icon = loadPixmap( pathString + "print" );
1100 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1100 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1101 action->addTo( beamMenu_X ); 1101 action->addTo( beamMenu_X );
1102 connect( action, SIGNAL( activated() ), 1102 connect( action, SIGNAL( activated() ),
1103 this, SLOT( printListView() ) ); 1103 this, SLOT( printListView() ) );
1104 1104
1105 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1105 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1106 action->addTo( beamMenu_X ); 1106 action->addTo( beamMenu_X );
1107 connect( action, SIGNAL( activated() ), 1107 connect( action, SIGNAL( activated() ),
1108 mView, SLOT( slotprintSelInc() ) ); 1108 mView, SLOT( slotprintSelInc() ) );
1109 1109
1110 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1110 importMenu->insertItem( i18n("Print"), beamMenu_X );
1111#endif 1111#endif
1112 importMenu->insertSeparator(); 1112 importMenu->insertSeparator();
1113 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1113 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1114 this ); 1114 this );
1115 action->addTo( importMenu ); 1115 action->addTo( importMenu );
1116 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1116 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1117 importMenu->insertSeparator(); 1117 importMenu->insertSeparator();
1118 action = new QAction( "beam all", i18n("Save"), 0, 1118 action = new QAction( "beam all", i18n("Save"), 0,
1119 this ); 1119 this );
1120 action->addTo( importMenu ); 1120 action->addTo( importMenu );
1121 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1121 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1122 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1122 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1123 this ); 1123 this );
1124 action->addTo( importMenu ); 1124 action->addTo( importMenu );
1125 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1125 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1126 1126
1127 //menuBar->insertItem( "Configure",configureMenu ); 1127 //menuBar->insertItem( "Configure",configureMenu );
1128 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1128 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1129 icon = loadPixmap( "korganizer/korganizer" ); 1129 icon = loadPixmap( "korganizer/korganizer" );
1130 1130
1131 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1131 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1132 action->addTo( helpMenu ); 1132 action->addTo( helpMenu );
1133 connect( action, SIGNAL( activated() ), 1133 connect( action, SIGNAL( activated() ),
1134 SLOT( whatsNew() ) ); 1134 SLOT( whatsNew() ) );
1135 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1135 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1136 action->addTo( helpMenu ); 1136 action->addTo( helpMenu );
1137 connect( action, SIGNAL( activated() ), 1137 connect( action, SIGNAL( activated() ),
1138 SLOT( features() ) ); 1138 SLOT( features() ) );
1139 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1139 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1140 action->addTo( helpMenu ); 1140 action->addTo( helpMenu );
1141 connect( action, SIGNAL( activated() ), 1141 connect( action, SIGNAL( activated() ),
1142 SLOT( keyBindings() ) ); 1142 SLOT( keyBindings() ) );
1143 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1143 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1144 action->addTo( helpMenu ); 1144 action->addTo( helpMenu );
1145 connect( action, SIGNAL( activated() ), 1145 connect( action, SIGNAL( activated() ),
1146 SLOT( storagehowto() ) ); 1146 SLOT( storagehowto() ) );
1147 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1147 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1148 action->addTo( helpMenu ); 1148 action->addTo( helpMenu );
1149 connect( action, SIGNAL( activated() ), 1149 connect( action, SIGNAL( activated() ),
1150 SLOT( timetrackinghowto() ) ); 1150 SLOT( timetrackinghowto() ) );
1151 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1151 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1152 action->addTo( helpMenu ); 1152 action->addTo( helpMenu );
1153 connect( action, SIGNAL( activated() ), 1153 connect( action, SIGNAL( activated() ),
1154 SLOT( synchowto() ) ); 1154 SLOT( synchowto() ) );
1155 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1155 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1156 action->addTo( helpMenu ); 1156 action->addTo( helpMenu );
1157 connect( action, SIGNAL( activated() ), 1157 connect( action, SIGNAL( activated() ),
1158 SLOT( kdesynchowto() ) ); 1158 SLOT( kdesynchowto() ) );
1159 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1159 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1160 action->addTo( helpMenu ); 1160 action->addTo( helpMenu );
1161 connect( action, SIGNAL( activated() ), 1161 connect( action, SIGNAL( activated() ),
1162 SLOT( multisynchowto() ) ); 1162 SLOT( multisynchowto() ) );
1163 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1163 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1164 action->addTo( helpMenu ); 1164 action->addTo( helpMenu );
1165 connect( action, SIGNAL( activated() ), 1165 connect( action, SIGNAL( activated() ),
1166 SLOT( aboutAutoSaving() ) ); 1166 SLOT( aboutAutoSaving() ) );
1167 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1167 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1168 action->addTo( helpMenu ); 1168 action->addTo( helpMenu );
1169 connect( action, SIGNAL( activated() ), 1169 connect( action, SIGNAL( activated() ),
1170 SLOT( aboutKnownBugs() ) ); 1170 SLOT( aboutKnownBugs() ) );
1171 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1171 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1172 action->addTo( helpMenu ); 1172 action->addTo( helpMenu );
1173 connect( action, SIGNAL( activated() ), 1173 connect( action, SIGNAL( activated() ),
1174 SLOT( usertrans() ) ); 1174 SLOT( usertrans() ) );
1175 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1175 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1176 action->addTo( helpMenu ); 1176 action->addTo( helpMenu );
1177 connect( action, SIGNAL( activated() ), 1177 connect( action, SIGNAL( activated() ),
1178 SLOT( faq() ) ); 1178 SLOT( faq() ) );
1179 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1179 action = new QAction( "licence", i18n("Licence..."), 0, this );
1180 action->addTo( helpMenu ); 1180 action->addTo( helpMenu );
1181 connect( action, SIGNAL( activated() ), 1181 connect( action, SIGNAL( activated() ),
1182 SLOT( licence() ) ); 1182 SLOT( licence() ) );
1183 action = new QAction( "about", i18n("About..."), 0, this ); 1183 action = new QAction( "about", i18n("About..."), 0, this );
1184 action->addTo( helpMenu ); 1184 action->addTo( helpMenu );
1185 connect( action, SIGNAL( activated() ), 1185 connect( action, SIGNAL( activated() ),
1186 SLOT( about() ) ); 1186 SLOT( about() ) );
1187 //menuBar->insertSeparator(); 1187 //menuBar->insertSeparator();
1188 1188
1189 // ****************************************************** 1189 // ******************************************************
1190 // menubar icons 1190 // menubar icons
1191 1191
1192 1192
1193 1193
1194 //menuBar->insertItem( iconToolBar ); 1194 //menuBar->insertItem( iconToolBar );
1195 //xdays_action 1195 //xdays_action
1196 if (p-> mShowIconNewEvent) 1196 if (p-> mShowIconNewEvent)
1197 ne_action->addTo( iconToolBar ); 1197 ne_action->addTo( iconToolBar );
1198 if (p->mShowIconNewTodo ) 1198 if (p->mShowIconNewTodo )
1199 nt_action->addTo( iconToolBar ); 1199 nt_action->addTo( iconToolBar );
1200 if (p-> mShowIconSearch) 1200 if (p-> mShowIconSearch)
1201 search_action->addTo( iconToolBar ); 1201 search_action->addTo( iconToolBar );
1202 if (p-> mShowIconWhatsThis) 1202 if (p-> mShowIconWhatsThis)
1203 QWhatsThis::whatsThisButton ( iconToolBar ); 1203 QWhatsThis::whatsThisButton ( iconToolBar );
1204 if (p-> mShowIconNext) 1204 if (p-> mShowIconNext)
1205 whatsnext_action->addTo( viewToolBar ); 1205 whatsnext_action->addTo( viewToolBar );
1206 if (p-> mShowIconNextDays) 1206 if (p-> mShowIconNextDays)
1207 xdays_action->addTo( viewToolBar ); 1207 xdays_action->addTo( viewToolBar );
1208 if (p-> mShowIconJournal) 1208 if (p-> mShowIconJournal)
1209 viewjournal_action->addTo( viewToolBar ); 1209 viewjournal_action->addTo( viewToolBar );
1210 if (p-> mShowIconDay1) 1210 if (p-> mShowIconDay1)
1211 day1_action->addTo( viewToolBar ); 1211 day1_action->addTo( viewToolBar );
1212 if (p-> mShowIconDay5) 1212 if (p-> mShowIconDay5)
1213 day5_action->addTo( viewToolBar ); 1213 day5_action->addTo( viewToolBar );
1214 if (p-> mShowIconDay7) 1214 if (p-> mShowIconDay7)
1215 day7_action->addTo( viewToolBar ); 1215 day7_action->addTo( viewToolBar );
1216 if (p-> mShowIconDay6) 1216 if (p-> mShowIconDay6)
1217 day6_action->addTo( viewToolBar ); 1217 day6_action->addTo( viewToolBar );
1218 if (p-> mShowIconMonth) 1218 if (p-> mShowIconMonth)
1219 month_action->addTo( viewToolBar ); 1219 month_action->addTo( viewToolBar );
1220 if (p-> mShowIconList) 1220 if (p-> mShowIconList)
1221 showlist_action->addTo( viewToolBar ); 1221 showlist_action->addTo( viewToolBar );
1222 if (p-> mShowIconTodoview) 1222 if (p-> mShowIconTodoview)
1223 todoview_action->addTo( viewToolBar ); 1223 todoview_action->addTo( viewToolBar );
1224 1224
1225 icon = loadPixmap( pathString + "2leftarrowB" ); 1225 icon = loadPixmap( pathString + "2leftarrowB" );
1226 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1226 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1227 if (p-> mShowIconBackFast) { 1227 if (p-> mShowIconBackFast) {
1228 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1228 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1229 connect( action, SIGNAL( activated() ), 1229 connect( action, SIGNAL( activated() ),
1230 mView, SLOT( goPreviousMonth() ) ); 1230 mView, SLOT( goPreviousMonth() ) );
1231 action->addTo( navigatorToolBar ); 1231 action->addTo( navigatorToolBar );
1232 } 1232 }
1233 icon = loadPixmap( pathString + "1leftarrowB" ); 1233 icon = loadPixmap( pathString + "1leftarrowB" );
1234 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1234 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1235 if (p-> mShowIconBack) { 1235 if (p-> mShowIconBack) {
1236 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1236 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1237 connect( action, SIGNAL( activated() ), 1237 connect( action, SIGNAL( activated() ),
1238 mView, SLOT( goPrevious() ) ); 1238 mView, SLOT( goPrevious() ) );
1239 action->addTo( navigatorToolBar ); 1239 action->addTo( navigatorToolBar );
1240 } 1240 }
1241 icon = loadPixmap( pathString + "today" ); 1241 icon = loadPixmap( pathString + "today" );
1242 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1242 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1243 if (p-> mShowIconToday) 1243 if (p-> mShowIconToday)
1244 today_action->addTo( navigatorToolBar ); 1244 today_action->addTo( navigatorToolBar );
1245 icon = loadPixmap( pathString + "1rightarrowB" ); 1245 icon = loadPixmap( pathString + "1rightarrowB" );
1246 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1246 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1247 if (p-> mShowIconForward) { 1247 if (p-> mShowIconForward) {
1248 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1248 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1249 connect( action, SIGNAL( activated() ), 1249 connect( action, SIGNAL( activated() ),
1250 mView, SLOT( goNext() ) ); 1250 mView, SLOT( goNext() ) );
1251 action->addTo( navigatorToolBar ); 1251 action->addTo( navigatorToolBar );
1252 } 1252 }
1253 icon = loadPixmap( pathString + "2rightarrowB" ); 1253 icon = loadPixmap( pathString + "2rightarrowB" );
1254 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1254 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1255 if (p-> mShowIconForwardFast) { 1255 if (p-> mShowIconForwardFast) {
1256 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1256 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1257 connect( action, SIGNAL( activated() ), 1257 connect( action, SIGNAL( activated() ),
1258 mView, SLOT( goNextMonth() ) ); 1258 mView, SLOT( goNextMonth() ) );
1259 action->addTo( navigatorToolBar ); 1259 action->addTo( navigatorToolBar );
1260 } 1260 }
1261 1261
1262 1262
1263 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1263 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1264 1264
1265 1265
1266 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1266 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1267 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1267 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1268 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1268 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1269 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1269 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1270 1270
1271 if (p-> mShowIconNewEvent) 1271 if (p-> mShowIconNewEvent)
1272 configureToolBarMenu->setItemChecked( 10, true ); 1272 configureToolBarMenu->setItemChecked( 10, true );
1273 if (p->mShowIconNewTodo ) 1273 if (p->mShowIconNewTodo )
1274 configureToolBarMenu->setItemChecked( 20, true ); 1274 configureToolBarMenu->setItemChecked( 20, true );
1275 if (p-> mShowIconSearch) 1275 if (p-> mShowIconSearch)
1276 configureToolBarMenu->setItemChecked( 120, true ); 1276 configureToolBarMenu->setItemChecked( 120, true );
1277 if (p-> mShowIconList) 1277 if (p-> mShowIconList)
1278 configureToolBarMenu->setItemChecked( 30, true ); 1278 configureToolBarMenu->setItemChecked( 30, true );
1279 if (p-> mShowIconDay1) 1279 if (p-> mShowIconDay1)
1280 configureToolBarMenu->setItemChecked( 40, true ); 1280 configureToolBarMenu->setItemChecked( 40, true );
1281 if (p-> mShowIconDay5) 1281 if (p-> mShowIconDay5)
1282 configureToolBarMenu->setItemChecked( 50, true ); 1282 configureToolBarMenu->setItemChecked( 50, true );
1283 if (p-> mShowIconDay6) 1283 if (p-> mShowIconDay6)
1284 configureToolBarMenu->setItemChecked( 75, true ); 1284 configureToolBarMenu->setItemChecked( 75, true );
1285 if (p-> mShowIconDay7) 1285 if (p-> mShowIconDay7)
1286 configureToolBarMenu->setItemChecked( 60, true ); 1286 configureToolBarMenu->setItemChecked( 60, true );
1287 if (p-> mShowIconMonth) 1287 if (p-> mShowIconMonth)
1288 configureToolBarMenu->setItemChecked( 70, true ); 1288 configureToolBarMenu->setItemChecked( 70, true );
1289 if (p-> mShowIconTodoview) 1289 if (p-> mShowIconTodoview)
1290 configureToolBarMenu->setItemChecked( 80, true ); 1290 configureToolBarMenu->setItemChecked( 80, true );
1291 if (p-> mShowIconBackFast) 1291 if (p-> mShowIconBackFast)
1292 configureToolBarMenu->setItemChecked( 200, true ); 1292 configureToolBarMenu->setItemChecked( 200, true );
1293 if (p-> mShowIconBack) 1293 if (p-> mShowIconBack)
1294 configureToolBarMenu->setItemChecked( 210, true ); 1294 configureToolBarMenu->setItemChecked( 210, true );
1295 if (p-> mShowIconToday) 1295 if (p-> mShowIconToday)
1296 configureToolBarMenu->setItemChecked( 130, true ); 1296 configureToolBarMenu->setItemChecked( 130, true );
1297 if (p-> mShowIconForward) 1297 if (p-> mShowIconForward)
1298 configureToolBarMenu->setItemChecked( 220, true ); 1298 configureToolBarMenu->setItemChecked( 220, true );
1299 if (p-> mShowIconForwardFast) 1299 if (p-> mShowIconForwardFast)
1300 configureToolBarMenu->setItemChecked( 230, true ); 1300 configureToolBarMenu->setItemChecked( 230, true );
1301 if (p-> mShowIconNextDays) 1301 if (p-> mShowIconNextDays)
1302 configureToolBarMenu->setItemChecked( 100, true ); 1302 configureToolBarMenu->setItemChecked( 100, true );
1303 if (p-> mShowIconNext) 1303 if (p-> mShowIconNext)
1304 configureToolBarMenu->setItemChecked( 110, true ); 1304 configureToolBarMenu->setItemChecked( 110, true );
1305 if (p-> mShowIconJournal) 1305 if (p-> mShowIconJournal)
1306 configureToolBarMenu->setItemChecked( 90, true ); 1306 configureToolBarMenu->setItemChecked( 90, true );
1307 if (p-> mShowIconWhatsThis) 1307 if (p-> mShowIconWhatsThis)
1308 configureToolBarMenu->setItemChecked( 300, true ); 1308 configureToolBarMenu->setItemChecked( 300, true );
1309 if (p-> mShowIconWeekNum) 1309 if (p-> mShowIconWeekNum)
1310 configureToolBarMenu->setItemChecked( 400, true ); 1310 configureToolBarMenu->setItemChecked( 400, true );
1311 if (!p-> mShowIconStretch) { 1311 if (!p-> mShowIconStretch) {
1312 QLabel* dummy = new QLabel( iconToolBar ); 1312 QLabel* dummy = new QLabel( iconToolBar );
1313 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1313 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1314 dummy->setMinimumWidth( 0 ); 1314 dummy->setMinimumWidth( 0 );
1315 iconToolBar->setStretchableWidget ( dummy ) ; 1315 iconToolBar->setStretchableWidget ( dummy ) ;
1316 } 1316 }
1317 else { 1317 else {
1318 iconToolBar->setHorizontalStretchable (true ); 1318 iconToolBar->setHorizontalStretchable (true );
1319 viewToolBar->setHorizontalStretchable (true ); 1319 viewToolBar->setHorizontalStretchable (true );
1320 navigatorToolBar->setHorizontalStretchable (true ); 1320 navigatorToolBar->setHorizontalStretchable (true );
1321 iconToolBar->setVerticalStretchable (true ); 1321 iconToolBar->setVerticalStretchable (true );
1322 viewToolBar->setVerticalStretchable (true ); 1322 viewToolBar->setVerticalStretchable (true );
1323 navigatorToolBar->setVerticalStretchable (true ); 1323 navigatorToolBar->setVerticalStretchable (true );
1324 configureToolBarMenu->setItemChecked( 5, true ); 1324 configureToolBarMenu->setItemChecked( 5, true );
1325 } 1325 }
1326 if (p-> mShowIconFilter) 1326 if (p-> mShowIconFilter)
1327 configureToolBarMenu->setItemChecked( 7, true ); 1327 configureToolBarMenu->setItemChecked( 7, true );
1328 if (p-> mShowIconOnetoolbar) 1328 if (p-> mShowIconOnetoolbar)
1329 configureToolBarMenu->setItemChecked( 6, true ); 1329 configureToolBarMenu->setItemChecked( 6, true );
1330 1330
1331 1331
1332 if ( filterMenubar ) { 1332 if ( filterMenubar ) {
1333 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1333 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1334 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1334 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1335 } 1335 }
1336 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1336 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1337 configureAgenda( p->mHourSize ); 1337 configureAgenda( p->mHourSize );
1338 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1338 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1339} 1339}
1340 1340
1341void MainWindow::exportToPhone( int mode ) 1341void MainWindow::exportToPhone( int mode )
1342{ 1342{
1343 1343
1344 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1344 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1345 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1345 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1346 KOex2phonePrefs ex2phone; 1346 KOex2phonePrefs ex2phone;
1347 1347
1348 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1348 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1349 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1349 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1350 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1350 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1351 if ( mode == 1 ) 1351 if ( mode == 1 )
1352 ex2phone.setCaption(i18n("Export complete calendar")); 1352 ex2phone.setCaption(i18n("Export complete calendar"));
1353 if ( mode == 2 ) 1353 if ( mode == 2 )
1354 ex2phone.setCaption(i18n("Export filtered calendar")); 1354 ex2phone.setCaption(i18n("Export filtered calendar"));
1355 1355
1356 if ( !ex2phone.exec() ) { 1356 if ( !ex2phone.exec() ) {
1357 return; 1357 return;
1358 } 1358 }
1359 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1359 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1360 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1360 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1361 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1361 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1362 1362
1363 int inFuture = 0; 1363 int inFuture = 0;
1364 if ( ex2phone.mWriteBackFuture->isChecked() ) 1364 if ( ex2phone.mWriteBackFuture->isChecked() )
1365 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1365 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1366 QPtrList<Incidence> delSel; 1366 QPtrList<Incidence> delSel;
1367 if ( mode == 1 ) 1367 if ( mode == 1 )
1368 delSel = mCalendar->rawIncidences(); 1368 delSel = mCalendar->rawIncidences();
1369 if ( mode == 2 ) 1369 if ( mode == 2 )
1370 delSel = mCalendar->incidences(); 1370 delSel = mCalendar->incidences();
1371 CalendarLocal* cal = new CalendarLocal(); 1371 CalendarLocal* cal = new CalendarLocal();
1372 cal->setLocalTime(); 1372 cal->setLocalTime();
1373 Incidence *incidence = delSel.first(); 1373 Incidence *incidence = delSel.first();
1374 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1374 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1375 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1375 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1376 while ( incidence ) { 1376 while ( incidence ) {
1377 if ( incidence->typeID() != journalID ) { 1377 if ( incidence->typeID() != journalID ) {
1378 bool add = true; 1378 bool add = true;
1379 if ( inFuture ) { 1379 if ( inFuture ) {
1380 QDateTime dt; 1380 QDateTime dt;
1381 if ( incidence->typeID() == todoID ) { 1381 if ( incidence->typeID() == todoID ) {
1382 Todo * t = (Todo*)incidence; 1382 Todo * t = (Todo*)incidence;
1383 if ( t->hasDueDate() ) 1383 if ( t->hasDueDate() )
1384 dt = t->dtDue(); 1384 dt = t->dtDue();
1385 else 1385 else
1386 dt = cur.addSecs( 62 ); 1386 dt = cur.addSecs( 62 );
1387 } 1387 }
1388 else { 1388 else {
1389 bool ok; 1389 bool ok;
1390 dt = incidence->getNextOccurence( cur, &ok ); 1390 dt = incidence->getNextOccurence( cur, &ok );
1391 if ( !ok ) 1391 if ( !ok )
1392 dt = cur.addSecs( -62 ); 1392 dt = cur.addSecs( -62 );
1393 } 1393 }
1394 if ( dt < cur || dt > end ) { 1394 if ( dt < cur || dt > end ) {
1395 add = false; 1395 add = false;
1396 } 1396 }
1397 } 1397 }
1398 if ( add ) { 1398 if ( add ) {
1399 Incidence *in = incidence->clone(); 1399 Incidence *in = incidence->clone();
1400 cal->addIncidence( in ); 1400 cal->addIncidence( in );
1401 } 1401 }
1402 } 1402 }
1403 incidence = delSel.next(); 1403 incidence = delSel.next();
1404 } 1404 }
1405 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1405 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1406 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1406 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1407 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1407 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1408 1408
1409 setCaption( i18n("Writing to phone...")); 1409 setCaption( i18n("Writing to phone..."));
1410 if ( PhoneFormat::writeToPhone( cal ) ) 1410 if ( PhoneFormat::writeToPhone( cal ) )
1411 setCaption( i18n("Export to phone successful!")); 1411 setCaption( i18n("Export to phone successful!"));
1412 else 1412 else
1413 setCaption( i18n("Error exporting to phone!")); 1413 setCaption( i18n("Error exporting to phone!"));
1414 delete cal; 1414 delete cal;
1415} 1415}
1416 1416
1417 1417
1418void MainWindow::setDefaultPreferences() 1418void MainWindow::setDefaultPreferences()
1419{ 1419{
1420 KOPrefs *p = KOPrefs::instance(); 1420 KOPrefs *p = KOPrefs::instance();
1421 1421
1422 p->mCompactDialogs = true; 1422 p->mCompactDialogs = true;
1423 p->mConfirm = true; 1423 p->mConfirm = true;
1424 // p->mEnableQuickTodo = false; 1424 // p->mEnableQuickTodo = false;
1425 1425
1426} 1426}
1427 1427
1428QString MainWindow::resourcePath() 1428QString MainWindow::resourcePath()
1429{ 1429{
1430 return KGlobal::iconLoader()->iconPath(); 1430 return KGlobal::iconLoader()->iconPath();
1431} 1431}
1432 1432
1433void MainWindow::displayText( QString text ,QString cap ) 1433void MainWindow::displayText( QString text ,QString cap )
1434{ 1434{
1435 QDialog dia( this, "name", true ); ; 1435 QDialog dia( this, "name", true ); ;
1436 dia.setCaption( cap ); 1436 dia.setCaption( cap );
1437 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1437 QVBoxLayout* lay = new QVBoxLayout( &dia );
1438 lay->setSpacing( 3 ); 1438 lay->setSpacing( 3 );
1439 lay->setMargin( 3 ); 1439 lay->setMargin( 3 );
1440 QTextBrowser tb ( &dia ); 1440 QTextBrowser tb ( &dia );
1441 lay->addWidget( &tb ); 1441 lay->addWidget( &tb );
1442 tb.setText( text ); 1442 tb.setText( text );
1443#ifdef DESKTOP_VERSION 1443#ifdef DESKTOP_VERSION
1444 dia.resize( 640, 480); 1444 dia.resize( 640, 480);
1445#else 1445#else
1446 dia.showMaximized(); 1446 dia.showMaximized();
1447#endif 1447#endif
1448 dia.exec(); 1448 dia.exec();
1449} 1449}
1450 1450
1451void MainWindow::features() 1451void MainWindow::features()
1452{ 1452{
1453 1453
1454 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1454 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1455} 1455}
1456 1456
1457void MainWindow::usertrans() 1457void MainWindow::usertrans()
1458{ 1458{
1459 1459
1460 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1460 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1461} 1461}
1462 1462
1463void MainWindow::storagehowto() 1463void MainWindow::storagehowto()
1464{ 1464{
1465 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1465 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1466} 1466}
1467void MainWindow::timetrackinghowto() 1467void MainWindow::timetrackinghowto()
1468{ 1468{
1469 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1469 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1470} 1470}
1471void MainWindow::kdesynchowto() 1471void MainWindow::kdesynchowto()
1472{ 1472{
1473 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1473 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1474} 1474}
1475void MainWindow::multisynchowto() 1475void MainWindow::multisynchowto()
1476{ 1476{
1477 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1477 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1478} 1478}
1479void MainWindow::synchowto() 1479void MainWindow::synchowto()
1480{ 1480{
1481 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1481 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1482} 1482}
1483void MainWindow::faq() 1483void MainWindow::faq()
1484{ 1484{
1485 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1485 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1486 1486
1487} 1487}
1488void MainWindow::whatsNew() 1488void MainWindow::whatsNew()
1489{ 1489{
1490 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1490 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1491 1491
1492} 1492}
1493void MainWindow::licence() 1493void MainWindow::licence()
1494{ 1494{
1495 KApplication::showLicence(); 1495 KApplication::showLicence();
1496 1496
1497} 1497}
1498void MainWindow::about() 1498void MainWindow::about()
1499{ 1499{
1500 QString version; 1500 QString version;
1501#include <../version> 1501#include <../version>
1502 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1502 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1503 i18n("KOrganizer/Platform-independent\n") + 1503 i18n("KOrganizer/Platform-independent\n") +
1504 "(KO/Pi) " + version + " - " + 1504 "(KO/Pi) " + version + " - " +
1505 1505
1506#ifdef DESKTOP_VERSION 1506#ifdef DESKTOP_VERSION
1507 i18n("Desktop Edition\n") + 1507 i18n("Desktop Edition\n") +
1508#else 1508#else
1509 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1509 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1510#endif 1510#endif
1511 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1511 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1512} 1512}
1513void MainWindow::keyBindings() 1513void MainWindow::keyBindings()
1514{ 1514{
1515 QString cap = i18n("KO/Pi Keys + Colors"); 1515 QString cap = i18n("KO/Pi Keys + Colors");
1516 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1516 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1517 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1517 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1518 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1518 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1519 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1519 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1520 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1520 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1521 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1521 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1522 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1522 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1523 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1523 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1524 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1524 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1525 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1525 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1526 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1526 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1527 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1527 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1528 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1528 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1529 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1529 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1530 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1530 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1531 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1531 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1532 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1532 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1533 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1533 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1534 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1534 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1535 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1535 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1536 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1536 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1537 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1537 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1538 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1538 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1539 i18n("<p><h3>In agenda view:</h3></p>\n") + 1539 i18n("<p><h3>In agenda view:</h3></p>\n") +
1540 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1540 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1541 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1541 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1542 i18n("<p><h3>In todo view:</h3></p>\n") + 1542 i18n("<p><h3>In todo view:</h3></p>\n") +
1543 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1543 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1544 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1544 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1545 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1545 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1546 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1546 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1547 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1547 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1548 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1548 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1549 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1549 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1550 i18n("<p><h3>In list view:</h3></p>\n") + 1550 i18n("<p><h3>In list view:</h3></p>\n") +
1551 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1551 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1552 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1552 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1553 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1553 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1554 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1554 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1555 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1555 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1556 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1556 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1557 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1557 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1558 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1558 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1559 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1559 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1560 i18n("<p><b>E</b>: Edit item</p>\n") + 1560 i18n("<p><b>E</b>: Edit item</p>\n") +
1561 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1561 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1562 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1562 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1563 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1563 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1564 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1564 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1565 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1565 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1566 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1566 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1567 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1567 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1568 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1568 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1569 i18n("<p><b>White</b>: Item readonly</p>\n"); 1569 i18n("<p><b>White</b>: Item readonly</p>\n");
1570 displayText( text, cap); 1570 displayText( text, cap);
1571} 1571}
1572void MainWindow::aboutAutoSaving() 1572void MainWindow::aboutAutoSaving()
1573{ 1573{
1574 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1574 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1575 1575
1576 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1576 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1577 1577
1578} 1578}
1579void MainWindow::aboutKnownBugs() 1579void MainWindow::aboutKnownBugs()
1580{ 1580{
1581 QMessageBox* msg; 1581 QMessageBox* msg;
1582 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1582 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1583 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1583 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1584 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1584 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1585 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1585 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1586 i18n("\nor report them in the bugtracker on\n") + 1586 i18n("\nor report them in the bugtracker on\n") +
1587 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1587 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1588 QMessageBox::NoIcon, 1588 QMessageBox::NoIcon,
1589 QMessageBox::Ok, 1589 QMessageBox::Ok,
1590 QMessageBox::NoButton, 1590 QMessageBox::NoButton,
1591 QMessageBox::NoButton); 1591 QMessageBox::NoButton);
1592 msg->exec(); 1592 msg->exec();
1593 delete msg; 1593 delete msg;
1594 1594
1595} 1595}
1596 1596
1597QString MainWindow::defaultFileName() 1597QString MainWindow::defaultFileName()
1598{ 1598{
1599 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1599 return locateLocal( "data", "korganizer/mycalendar.ics" );
1600} 1600}
1601QString MainWindow::syncFileName() 1601QString MainWindow::syncFileName()
1602{ 1602{
1603#ifdef DESKTOP_VERSION 1603#ifdef DESKTOP_VERSION
1604 return locateLocal( "tmp", "synccalendar.ics" ); 1604 return locateLocal( "tmp", "synccalendar.ics" );
1605#else 1605#else
1606 return QString( "/tmp/synccalendar.ics" ); 1606 return QString( "/tmp/synccalendar.ics" );
1607#endif 1607#endif
1608} 1608}
1609#include "koglobals.h" 1609#include "koglobals.h"
1610#include <kcalendarsystem.h> 1610#include <kcalendarsystem.h>
1611void MainWindow::updateWeek(QDate seda) 1611void MainWindow::updateWeek(QDate seda)
1612{ 1612{
1613 int weekNum = KGlobal::locale()->weekNum ( seda ); 1613 int weekNum = KGlobal::locale()->weekNum ( seda );
1614 mWeekPixmap.fill( mWeekBgColor ); 1614 mWeekPixmap.fill( mWeekBgColor );
1615 QPainter p ( &mWeekPixmap ); 1615 QPainter p ( &mWeekPixmap );
1616 p.setFont( mWeekFont ); 1616 p.setFont( mWeekFont );
1617 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1617 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1618 p.end(); 1618 p.end();
1619 QIconSet icon3 ( mWeekPixmap ); 1619 QIconSet icon3 ( mWeekPixmap );
1620 mWeekAction->setIconSet ( icon3 ); 1620 mWeekAction->setIconSet ( icon3 );
1621 1621
1622} 1622}
1623void MainWindow::updateWeekNum(const DateList &selectedDates) 1623void MainWindow::updateWeekNum(const DateList &selectedDates)
1624{ 1624{
1625 updateWeek( selectedDates.first() ); 1625 updateWeek( selectedDates.first() );
1626} 1626}
1627void MainWindow::processIncidenceSelection( Incidence *incidence ) 1627void MainWindow::processIncidenceSelection( Incidence *incidence )
1628{ 1628{
1629 1629
1630 if ( !incidence ) { 1630 if ( !incidence ) {
1631 enableIncidenceActions( false ); 1631 enableIncidenceActions( false );
1632 1632
1633 mNewSubTodoAction->setEnabled( false ); 1633 mNewSubTodoAction->setEnabled( false );
1634 setCaptionToDates(); 1634 setCaptionToDates();
1635 return; 1635 return;
1636 1636
1637 } 1637 }
1638 1638
1639 //KGlobal::locale()->formatDateTime(nextA, true); 1639 //KGlobal::locale()->formatDateTime(nextA, true);
1640 QString startString = ""; 1640 QString startString = "";
1641 if ( incidence->typeID() != todoID ) { 1641 if ( incidence->typeID() != todoID ) {
1642 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1642 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1643 if ( incidence->doesFloat() ) { 1643 if ( incidence->doesFloat() ) {
1644 startString += ": "+incidence->dtStartDateStr( true ); 1644 startString += ": "+incidence->dtStartDateStr( true );
1645 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1645 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1646 1646
1647 } else { 1647 } else {
1648 startString = ": "+incidence->dtStartStr(true); 1648 startString = ": "+incidence->dtStartStr(true);
1649 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1649 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1650 1650
1651 } 1651 }
1652 1652
1653 } else { 1653 } else {
1654 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1654 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1655 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1655 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1656 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1656 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1657 1657
1658 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1658 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1659 bool ok; 1659 bool ok;
1660 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1660 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1661 if ( ok ) { 1661 if ( ok ) {
1662 int years = noc.date().year() - incidence->dtStart().date().year(); 1662 int years = noc.date().year() - incidence->dtStart().date().year();
1663 startString += i18n(" (%1 y.)"). arg( years ); 1663 startString += i18n(" (%1 y.)"). arg( years );
1664 } 1664 }
1665 } 1665 }
1666 else 1666 else
1667 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1667 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1668 } 1668 }
1669 1669
1670 } 1670 }
1671 else 1671 else
1672 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1672 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1673 if ( !incidence->location().isEmpty() ) 1673 if ( !incidence->location().isEmpty() )
1674 startString += " (" +incidence->location()+")"; 1674 startString += " (" +incidence->location()+")";
1675 setCaption( incidence->summary()+startString); 1675 setCaption( incidence->summary()+startString);
1676 1676
1677 enableIncidenceActions( true ); 1677 enableIncidenceActions( true );
1678 1678
1679 if ( incidence->typeID() == eventID ) { 1679 if ( incidence->typeID() == eventID ) {
1680 mShowAction->setText( i18n("Show Event...") ); 1680 mShowAction->setText( i18n("Show Event...") );
1681 mEditAction->setText( i18n("Edit Event...") ); 1681 mEditAction->setText( i18n("Edit Event...") );
1682 mDeleteAction->setText( i18n("Delete Event...") ); 1682 mDeleteAction->setText( i18n("Delete Event...") );
1683 1683
1684 mNewSubTodoAction->setEnabled( false ); 1684 mNewSubTodoAction->setEnabled( false );
1685 } else if ( incidence->typeID() == todoID ) { 1685 } else if ( incidence->typeID() == todoID ) {
1686 mShowAction->setText( i18n("Show Todo...") ); 1686 mShowAction->setText( i18n("Show Todo...") );
1687 mEditAction->setText( i18n("Edit Todo...") ); 1687 mEditAction->setText( i18n("Edit Todo...") );
1688 mDeleteAction->setText( i18n("Delete Todo...") ); 1688 mDeleteAction->setText( i18n("Delete Todo...") );
1689 1689
1690 mNewSubTodoAction->setEnabled( true ); 1690 mNewSubTodoAction->setEnabled( true );
1691 } else { 1691 } else {
1692 mShowAction->setText( i18n("Show...") ); 1692 mShowAction->setText( i18n("Show...") );
1693 mShowAction->setText( i18n("Edit...") ); 1693 mShowAction->setText( i18n("Edit...") );
1694 mShowAction->setText( i18n("Delete...") ); 1694 mShowAction->setText( i18n("Delete...") );
1695 1695
1696 mNewSubTodoAction->setEnabled( false ); 1696 mNewSubTodoAction->setEnabled( false );
1697 } 1697 }
1698} 1698}
1699 1699
1700void MainWindow::enableIncidenceActions( bool enabled ) 1700void MainWindow::enableIncidenceActions( bool enabled )
1701{ 1701{
1702 mShowAction->setEnabled( enabled ); 1702 mShowAction->setEnabled( enabled );
1703 mEditAction->setEnabled( enabled ); 1703 mEditAction->setEnabled( enabled );
1704 mDeleteAction->setEnabled( enabled ); 1704 mDeleteAction->setEnabled( enabled );
1705 1705
1706 mCloneAction->setEnabled( enabled ); 1706 mCloneAction->setEnabled( enabled );
1707 mMoveAction->setEnabled( enabled ); 1707 mMoveAction->setEnabled( enabled );
1708 mBeamAction->setEnabled( enabled ); 1708 mBeamAction->setEnabled( enabled );
1709 mCancelAction->setEnabled( enabled ); 1709 mCancelAction->setEnabled( enabled );
1710} 1710}
1711 1711
1712void MainWindow::importOL() 1712void MainWindow::importOL()
1713{ 1713{
1714#ifdef _OL_IMPORT_ 1714#ifdef _OL_IMPORT_
1715 mView->clearAllViews(); 1715 mView->clearAllViews();
1716 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1716 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1717 id->exec(); 1717 id->exec();
1718 delete id; 1718 delete id;
1719 mView->calendar()->checkAlarmForIncidence( 0, true ); 1719 mView->calendar()->checkAlarmForIncidence( 0, true );
1720 mView->updateView(); 1720 mView->updateView();
1721#endif 1721#endif
1722} 1722}
1723void MainWindow::importBday() 1723void MainWindow::importBday()
1724{ 1724{
1725 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1725 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1726 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1726 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1727 i18n("Import!"), i18n("Cancel"), 0, 1727 i18n("Import!"), i18n("Cancel"), 0,
1728 0, 1 ); 1728 0, 1 );
1729 if ( result == 0 ) { 1729 if ( result == 0 ) {
1730 mView->importBday(); 1730 mView->importBday();
1731 1731
1732 } 1732 }
1733 1733
1734 1734
1735} 1735}
1736void MainWindow::importQtopia() 1736void MainWindow::importQtopia()
1737{ 1737{
1738 //#ifndef DESKTOP_VERSION 1738 //#ifndef DESKTOP_VERSION
1739 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"); 1739 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");
1740#ifdef DESKTOP_VERSION 1740#ifdef DESKTOP_VERSION
1741 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"); 1741 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");
1742#endif 1742#endif
1743 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1743 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1744 i18n("Import!"), i18n("Cancel"), 0, 1744 i18n("Import!"), i18n("Cancel"), 0,
1745 0, 1 ); 1745 0, 1 );
1746 if ( result == 0 ) { 1746 if ( result == 0 ) {
1747#ifndef DESKTOP_VERSION 1747#ifndef DESKTOP_VERSION
1748 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1748 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1749 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1749 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1750 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1750 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1751#else 1751#else
1752 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1752 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1753 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1753 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1754 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1754 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1755#endif 1755#endif
1756 mView->importQtopia( categories, datebook, todolist ); 1756 mView->importQtopia( categories, datebook, todolist );
1757 } 1757 }
1758 mView->calendar()->reInitAlarmSettings(); 1758 mView->calendar()->reInitAlarmSettings();
1759#if 0 1759#if 0
1760 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1760 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1761 i18n("Not supported \non desktop!\n"), 1761 i18n("Not supported \non desktop!\n"),
1762 i18n("Ok"), i18n("Cancel"), 0, 1762 i18n("Ok"), i18n("Cancel"), 0,
1763 0, 1 ); 1763 0, 1 );
1764 1764
1765#endif 1765#endif
1766} 1766}
1767 1767
1768void MainWindow::saveOnClose() 1768void MainWindow::saveOnClose()
1769{ 1769{
1770 KOPrefs *p = KOPrefs::instance(); 1770 KOPrefs *p = KOPrefs::instance();
1771 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1771 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1772 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1772 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1773 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1773 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1774 if ( filterToolBar ) { 1774 if ( filterToolBar ) {
1775 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1775 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1776 } 1776 }
1777#ifdef DESKTOP_VERSION 1777#ifdef DESKTOP_VERSION
1778 1778
1779 QPoint myP; 1779 QPoint myP;
1780 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1780 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1781 if ( p->mToolBarHor ) 1781 if ( p->mToolBarHor )
1782 p->mToolBarUp = myP.y() > height()/2; 1782 p->mToolBarUp = myP.y() > height()/2;
1783 else 1783 else
1784 p->mToolBarUp = myP.x() > width()/2; 1784 p->mToolBarUp = myP.x() > width()/2;
1785 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1785 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1786 if ( p->mToolBarHorV ) 1786 if ( p->mToolBarHorV )
1787 p->mToolBarUpV = myP.y() > height()/2; 1787 p->mToolBarUpV = myP.y() > height()/2;
1788 else 1788 else
1789 p->mToolBarUpV = myP.x() > width()/2 ; 1789 p->mToolBarUpV = myP.x() > width()/2 ;
1790 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1790 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1791 if ( p->mToolBarHorN ) 1791 if ( p->mToolBarHorN )
1792 p->mToolBarUpN = myP.y() > height()/2; 1792 p->mToolBarUpN = myP.y() > height()/2;
1793 else 1793 else
1794 p->mToolBarUpN = myP.x() > width()/2 ; 1794 p->mToolBarUpN = myP.x() > width()/2 ;
1795 if ( filterToolBar ) { 1795 if ( filterToolBar ) {
1796 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1796 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1797 if ( p->mToolBarHorF ) 1797 if ( p->mToolBarHorF )
1798 p->mToolBarUpF = myP.y() > height()/2; 1798 p->mToolBarUpF = myP.y() > height()/2;
1799 else 1799 else
1800 p->mToolBarUpF = myP.x() > width()/2 ; 1800 p->mToolBarUpF = myP.x() > width()/2 ;
1801 } 1801 }
1802#else 1802#else
1803 if ( p->mToolBarHor ) 1803 if ( p->mToolBarHor )
1804 p->mToolBarUp = iconToolBar->y() > height()/2; 1804 p->mToolBarUp = iconToolBar->y() > height()/2;
1805 else 1805 else
1806 p->mToolBarUp = iconToolBar->x() > width()/2; 1806 p->mToolBarUp = iconToolBar->x() > width()/2;
1807 if ( p->mToolBarHorV ) 1807 if ( p->mToolBarHorV )
1808 p->mToolBarUpV = viewToolBar->y() > height()/2; 1808 p->mToolBarUpV = viewToolBar->y() > height()/2;
1809 else 1809 else
1810 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1810 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1811 1811
1812 if ( p->mToolBarHorN ) 1812 if ( p->mToolBarHorN )
1813 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1813 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1814 else 1814 else
1815 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1815 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1816 if ( filterToolBar ) { 1816 if ( filterToolBar ) {
1817 if ( p->mToolBarHorF ) 1817 if ( p->mToolBarHorF )
1818 p->mToolBarUpF = filterToolBar->y() > height()/2; 1818 p->mToolBarUpF = filterToolBar->y() > height()/2;
1819 else 1819 else
1820 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1820 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1821 } 1821 }
1822#endif 1822#endif
1823 1823
1824 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1824 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1825 save(); 1825 save();
1826 mView->writeSettings(); 1826 mView->writeSettings();
1827} 1827}
1828void MainWindow::slotModifiedChanged( bool changed ) 1828void MainWindow::slotModifiedChanged( bool changed )
1829{ 1829{
1830 if ( mBlockAtStartup ) 1830 if ( mBlockAtStartup )
1831 return; 1831 return;
1832 1832
1833 int msec; 1833 int msec;
1834 // we store the changes after 1 minute, 1834 // we store the changes after 1 minute,
1835 // and for safety reasons after 10 minutes again 1835 // and for safety reasons after 10 minutes again
1836 if ( !mSyncManager->blockSave() ) 1836 if ( !mSyncManager->blockSave() )
1837 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1837 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1838 else 1838 else
1839 msec = 1000 * 600; 1839 msec = 1000 * 600;
1840 mSaveTimer.start( msec, true ); // 1 minute 1840 mSaveTimer.start( msec, true ); // 1 minute
1841 qDebug("KO: Saving File in %d secs!", msec/1000); 1841 qDebug("KO: Saving File in %d secs!", msec/1000);
1842 mCalendarModifiedFlag = true; 1842 mCalendarModifiedFlag = true;
1843} 1843}
1844void MainWindow::saveStopTimer() 1844void MainWindow::saveStopTimer()
1845{ 1845{
1846 mSaveTimer.stop(); 1846 mSaveTimer.stop();
1847} 1847}
1848void MainWindow::save() 1848void MainWindow::save()
1849{ 1849{
1850 if ( !mCalendarModifiedFlag ) { 1850 if ( !mCalendarModifiedFlag ) {
1851 qDebug("KO: Calendar not modified. Nothing saved."); 1851 qDebug("KO: Calendar not modified. Nothing saved.");
1852 return; 1852 return;
1853 } 1853 }
1854 if ( mSyncManager->blockSave() ) 1854 if ( mSyncManager->blockSave() )
1855 return; 1855 return;
1856 mSyncManager->setBlockSave(true); 1856 mSyncManager->setBlockSave(true);
1857 if ( mView->checkAllFileVersions() ) { 1857 if ( mView->checkAllFileVersions() ) {
1858 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1858 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1859 QDate reference ( 2000,1,1); 1859 QDate reference ( 2000,1,1);
1860 int daysTo = reference.daysTo ( QDate::currentDate() ); 1860 int daysTo = reference.daysTo ( QDate::currentDate() );
1861 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1861 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1862 setCaption(i18n("Creating backup ... please wait ..." )); 1862 setCaption(i18n("Creating backup ... please wait ..." ));
1863 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1863 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1864 // we need the file path, the backup dir and the number of bups as param 1864 // we need the file path, the backup dir and the number of bups as param
1865 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1865 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1866 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1866 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1867 bupDir = KGlobalSettings::backupDataDir(); 1867 bupDir = KGlobalSettings::backupDataDir();
1868 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1868 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1869 if ( retval == 0 ) { 1869 if ( retval == 0 ) {
1870 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1870 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1871 // retval == 0 : backup skipped for today, try again tomorrow 1871 // retval == 0 : backup skipped for today, try again tomorrow
1872 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1872 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1873 } else if ( retval == 1 ){ 1873 } else if ( retval == 1 ){
1874 qDebug("KO: Backup created."); 1874 qDebug("KO: Backup created.");
1875 // backup ok 1875 // backup ok
1876 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1876 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1877 KopiCalendarFile * cal = calendars.first(); 1877 KopiCalendarFile * cal = calendars.first();
1878 cal = calendars.next(); 1878 cal = calendars.next();
1879 while ( cal ) { 1879 while ( cal ) {
1880 if ( !cal->mErrorOnLoad ) { 1880 if ( !cal->mErrorOnLoad ) {
1881 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1881 int retval = KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1882 } 1882 }
1883 cal = calendars.next(); 1883 cal = calendars.next();
1884 } 1884 }
1885 KOPrefs::instance()->mLastBackupDate = daysTo; 1885 KOPrefs::instance()->mLastBackupDate = daysTo;
1886 } else if ( retval == 2 ){ 1886 } else if ( retval == 2 ){
1887 qDebug("KO: Backup globally cancelled."); 1887 qDebug("KO: Backup globally cancelled.");
1888 // backup globally cancelled 1888 // backup globally cancelled
1889 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1889 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1890 } 1890 }
1891 // retval == 3: do nothing, try again later 1891 // retval == 3: do nothing, try again later
1892 } 1892 }
1893 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1893 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1894 } 1894 }
1895 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1895 QTime neededSaveTime = QDateTime::currentDateTime().time();
1896 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1896 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1897 qDebug("KO: Start saving data to file!"); 1897 qDebug("KO: Start saving data to file!");
1898 mView->saveCalendars(); 1898 mView->saveCalendars();
1899 mCalendarModifiedFlag = false; 1899 mCalendarModifiedFlag = false;
1900 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1900 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1901 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1901 qDebug("KO: Needed %d ms for saving.",msNeeded );
1902 QString savemes; 1902 QString savemes;
1903 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1903 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1904 setCaption(savemes); 1904 setCaption(savemes);
1905 } else 1905 } else
1906 setCaption(i18n("Saving cancelled!")); 1906 setCaption(i18n("Saving cancelled!"));
1907 mSyncManager->setBlockSave( false ); 1907 mSyncManager->setBlockSave( false );
1908} 1908}
1909 1909
1910void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1910void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1911{ 1911{
1912 if ( !e->isAutoRepeat() ) { 1912 if ( !e->isAutoRepeat() ) {
1913 mFlagKeyPressed = false; 1913 mFlagKeyPressed = false;
1914 } 1914 }
1915} 1915}
1916void MainWindow::keyPressEvent ( QKeyEvent * e ) 1916void MainWindow::keyPressEvent ( QKeyEvent * e )
1917{ 1917{
1918 qApp->processEvents(); 1918 qApp->processEvents();
1919 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1919 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1920 e->ignore(); 1920 e->ignore();
1921 // qDebug(" ignore %d",e->isAutoRepeat() ); 1921 // qDebug(" ignore %d",e->isAutoRepeat() );
1922 return; 1922 return;
1923 } 1923 }
1924 if (! e->isAutoRepeat() ) 1924 if (! e->isAutoRepeat() )
1925 mFlagKeyPressed = true; 1925 mFlagKeyPressed = true;
1926 KOPrefs *p = KOPrefs::instance(); 1926 KOPrefs *p = KOPrefs::instance();
1927 bool showSelectedDates = false; 1927 bool showSelectedDates = false;
1928 int size; 1928 int size;
1929 int pro = 0; 1929 int pro = 0;
1930 //qDebug("MainWindow::keyPressEvent "); 1930 //qDebug("MainWindow::keyPressEvent ");
1931 switch ( e->key() ) { 1931 switch ( e->key() ) {
1932 case Qt::Key_Right: 1932 case Qt::Key_Right:
1933 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1933 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1934 mView->goNextMonth(); 1934 mView->goNextMonth();
1935 else 1935 else
1936 mView->goNext(); 1936 mView->goNext();
1937 showSelectedDates = true; 1937 showSelectedDates = true;
1938 break; 1938 break;
1939 case Qt::Key_Left: 1939 case Qt::Key_Left:
1940 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1940 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1941 mView->goPreviousMonth(); 1941 mView->goPreviousMonth();
1942 else 1942 else
1943 mView->goPrevious(); 1943 mView->goPrevious();
1944 showSelectedDates = true; 1944 showSelectedDates = true;
1945 break; 1945 break;
1946 case Qt::Key_Down: 1946 case Qt::Key_Down:
1947 mView->viewManager()->agendaView()->scrollOneHourDown(); 1947 mView->viewManager()->agendaView()->scrollOneHourDown();
1948 break; 1948 break;
1949 case Qt::Key_Up: 1949 case Qt::Key_Up:
1950 mView->viewManager()->agendaView()->scrollOneHourUp(); 1950 mView->viewManager()->agendaView()->scrollOneHourUp();
1951 break; 1951 break;
1952 case Qt::Key_K: 1952 case Qt::Key_K:
1953 mView->viewManager()->showMonthViewWeek(); 1953 mView->viewManager()->showMonthViewWeek();
1954 break; 1954 break;
1955 case Qt::Key_I: 1955 case Qt::Key_I:
1956 mView->showIncidence(); 1956 mView->showIncidence();
1957 break; 1957 break;
1958 case Qt::Key_Delete: 1958 case Qt::Key_Delete:
1959 case Qt::Key_Backspace: 1959 case Qt::Key_Backspace:
1960 mView->deleteIncidence(); 1960 mView->deleteIncidence();
1961 break; 1961 break;
1962 case Qt::Key_D: 1962 case Qt::Key_D:
1963 mView->viewManager()->showDayView(); 1963 mView->viewManager()->showDayView();
1964 showSelectedDates = true; 1964 showSelectedDates = true;
1965 break; 1965 break;
1966 case Qt::Key_O: 1966 case Qt::Key_O:
1967 mView->toggleFilerEnabled( ); 1967 mView->toggleFilerEnabled( );
1968 break; 1968 break;
1969 case Qt::Key_0: 1969 case Qt::Key_0:
1970 case Qt::Key_1: 1970 case Qt::Key_1:
1971 case Qt::Key_2: 1971 case Qt::Key_2:
1972 case Qt::Key_3: 1972 case Qt::Key_3:
1973 case Qt::Key_4: 1973 case Qt::Key_4:
1974 case Qt::Key_5: 1974 case Qt::Key_5:
1975 case Qt::Key_6: 1975 case Qt::Key_6:
1976 case Qt::Key_7: 1976 case Qt::Key_7:
1977 case Qt::Key_8: 1977 case Qt::Key_8:
1978 case Qt::Key_9: 1978 case Qt::Key_9:
1979 pro = e->key()-48; 1979 pro = e->key()-48;
1980 if ( pro == 0 ) 1980 if ( pro == 0 )
1981 pro = 10; 1981 pro = 10;
1982 if ( e->state() == Qt::ControlButton) 1982 if ( e->state() == Qt::ControlButton)
1983 pro += 10; 1983 pro += 10;
1984 break; 1984 break;
1985 case Qt::Key_M: 1985 case Qt::Key_M:
1986 mView->viewManager()->showMonthView(); 1986 mView->viewManager()->showMonthView();
1987 showSelectedDates = true; 1987 showSelectedDates = true;
1988 break; 1988 break;
1989 case Qt::Key_Insert: 1989 case Qt::Key_Insert:
1990 mView->newEvent(); 1990 mView->newEvent();
1991 break; 1991 break;
1992 case Qt::Key_S : 1992 case Qt::Key_S :
1993 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1993 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1994 mView->newSubTodo(); 1994 mView->newSubTodo();
1995 else 1995 else
1996 mView->dialogManager()->showSearchDialog(); 1996 mView->dialogManager()->showSearchDialog();
1997 break; 1997 break;
1998 case Qt::Key_Y : 1998 case Qt::Key_Y :
1999 case Qt::Key_Z : 1999 case Qt::Key_Z :
2000 mView->viewManager()->showWorkWeekView(); 2000 mView->viewManager()->showWorkWeekView();
2001 showSelectedDates = true; 2001 showSelectedDates = true;
2002 break; 2002 break;
2003 case Qt::Key_U : 2003 case Qt::Key_U :
2004 mView->viewManager()->showWeekView(); 2004 mView->viewManager()->showWeekView();
2005 showSelectedDates = true; 2005 showSelectedDates = true;
2006 break; 2006 break;
2007 case Qt::Key_H : 2007 case Qt::Key_H :
2008 keyBindings(); 2008 keyBindings();
2009 break; 2009 break;
2010 case Qt::Key_W: 2010 case Qt::Key_W:
2011 mView->viewManager()->showWhatsNextView(); 2011 mView->viewManager()->showWhatsNextView();
2012 break; 2012 break;
2013 case Qt::Key_L: 2013 case Qt::Key_L:
2014 mView->viewManager()->showListView(); 2014 mView->viewManager()->showListView();
2015 break; 2015 break;
2016 case Qt::Key_N: 2016 case Qt::Key_N:
2017 mView->viewManager()->showNextView(); 2017 mView->viewManager()->showNextView();
2018 break; 2018 break;
2019 case Qt::Key_V: 2019 case Qt::Key_V:
2020 mView->viewManager()->showTodoView(); 2020 mView->viewManager()->showTodoView();
2021 break; 2021 break;
2022 case Qt::Key_C: 2022 case Qt::Key_C:
2023 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2023 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2024 break; 2024 break;
2025 case Qt::Key_P: 2025 case Qt::Key_P:
2026 mView->showDatePicker( ); 2026 mView->showDatePicker( );
2027 break; 2027 break;
2028 case Qt::Key_F: 2028 case Qt::Key_F:
2029 mView->editFilters(); 2029 mView->editFilters();
2030 break; 2030 break;
2031 case Qt::Key_R: 2031 case Qt::Key_R:
2032 mView->toggleFilter(); 2032 mView->toggleFilter();
2033 break; 2033 break;
2034 case Qt::Key_X: 2034 case Qt::Key_X:
2035 if ( e->state() == Qt::ControlButton ) 2035 if ( e->state() == Qt::ControlButton )
2036 mView->toggleDateNavigatorWidget(); 2036 mView->toggleDateNavigatorWidget();
2037 else { 2037 else {
2038 mView->viewManager()->showNextXView(); 2038 mView->viewManager()->showNextXView();
2039 showSelectedDates = true; 2039 showSelectedDates = true;
2040 } 2040 }
2041 break; 2041 break;
2042 case Qt::Key_Space: 2042 case Qt::Key_Space:
2043 mView->toggleExpand(); 2043 mView->toggleExpand();
2044 break; 2044 break;
2045 case Qt::Key_A: 2045 case Qt::Key_A:
2046 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2046 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2047 mView->showNextAlarms(); 2047 mView->showNextAlarms();
2048 else 2048 else
2049 mView->toggleAllDaySize(); 2049 mView->toggleAllDaySize();
2050 break; 2050 break;
2051 case Qt::Key_T: 2051 case Qt::Key_T:
2052 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2052 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2053 mView->newTodo(); 2053 mView->newTodo();
2054 else { 2054 else {
2055 mView->goToday(); 2055 mView->goToday();
2056 showSelectedDates = true; 2056 showSelectedDates = true;
2057 } 2057 }
2058 break; 2058 break;
2059 case Qt::Key_J: 2059 case Qt::Key_J:
2060 mView->viewManager()->showJournalView(); 2060 mView->viewManager()->showJournalView();
2061 break; 2061 break;
2062 case Qt::Key_B: 2062 case Qt::Key_B:
2063 mView->editIncidenceDescription();; 2063 mView->editIncidenceDescription();;
2064 break; 2064 break;
2065 // case Qt::Key_Return: 2065 // case Qt::Key_Return:
2066 case Qt::Key_E: 2066 case Qt::Key_E:
2067 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2067 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2068 mView->newEvent(); 2068 mView->newEvent();
2069 else 2069 else
2070 mView->editIncidence(); 2070 mView->editIncidence();
2071 break; 2071 break;
2072 case Qt::Key_Plus: 2072 case Qt::Key_Plus:
2073 size = p->mHourSize +2; 2073 size = p->mHourSize +2;
2074 if ( size <= 22 ) 2074 if ( size <= 22 )
2075 configureAgenda( size ); 2075 configureAgenda( size );
2076 break; 2076 break;
2077 case Qt::Key_Minus: 2077 case Qt::Key_Minus:
2078 size = p->mHourSize - 2; 2078 size = p->mHourSize - 2;
2079 if ( size >= 4 ) 2079 if ( size >= 4 )
2080 configureAgenda( size ); 2080 configureAgenda( size );
2081 break; 2081 break;
2082 2082
2083 2083
2084 default: 2084 default:
2085 e->ignore(); 2085 e->ignore();
2086 } 2086 }
2087 if ( pro > 0 ) { 2087 if ( pro > 0 ) {
2088 mView->selectFilter( pro-1 ); 2088 selectFilter( pro+1 );
2089 } 2089 }
2090 if ( showSelectedDates ) { 2090 if ( showSelectedDates ) {
2091 ;// setCaptionToDates(); 2091 ;// setCaptionToDates();
2092 } 2092 }
2093 2093
2094} 2094}
2095void MainWindow::fillFilterMenuTB() 2095void MainWindow::fillFilterMenuTB()
2096{ 2096{
2097 selectFilterMenuTB->clear(); 2097 selectFilterMenuTB->clear();
2098 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2098 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2099 selectFilterMenuTB->insertSeparator(); 2099 selectFilterMenuTB->insertSeparator();
2100 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2100 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2101 2101
2102 selectFilterMenuTB->insertSeparator(); 2102 selectFilterMenuTB->insertSeparator();
2103 QPtrList<CalFilter> fili = mView->filters(); 2103 QPtrList<CalFilter> fili = mView->filters();
2104 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2104 CalFilter *curfilter = mView->filterView()->selectedFilter();
2105 CalFilter *filter = fili.first(); 2105 CalFilter *filter = fili.first();
2106 int iii = 2; 2106 int iii = 2;
2107 bool checkitem = mView->filterView()->filtersEnabled(); 2107 bool checkitem = mView->filterView()->filtersEnabled();
2108 while(filter) { 2108 while(filter) {
2109 selectFilterMenuTB->insertItem( filter->name(), iii ); 2109 selectFilterMenuTB->insertItem( filter->name(), iii );
2110 if ( filter == curfilter) 2110 if ( filter == curfilter)
2111 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2111 selectFilterMenuTB->setItemChecked( iii, checkitem );
2112 filter = fili.next(); 2112 filter = fili.next();
2113 ++iii; 2113 ++iii;
2114 } 2114 }
2115 if ( !checkitem ) 2115 if ( !checkitem )
2116 selectFilterMenuTB->setItemChecked( 1, true ); 2116 selectFilterMenuTB->setItemChecked( 1, true );
2117 2117
2118 int x = 0; 2118 int x = 0;
2119 int y = iconToolBar->height(); 2119 int y = iconToolBar->height();
2120 int dX = 0; 2120 int dX = 0;
2121 int dY = 0; 2121 int dY = 0;
2122 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2122 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2123 if ( iconToolBar->y() > height()/2 ) { 2123 if ( iconToolBar->y() > height()/2 ) {
2124 dY = selectFilterMenuTB->sizeHint().height()+8; 2124 dY = selectFilterMenuTB->sizeHint().height()+8;
2125 y = 0; 2125 y = 0;
2126 } 2126 }
2127 } else { 2127 } else {
2128 if ( iconToolBar->x() > width()/2 ) { // right side 2128 if ( iconToolBar->x() > width()/2 ) { // right side
2129 x=0; 2129 x=0;
2130 dX= selectFilterMenuTB->sizeHint().width()+8; 2130 dX= selectFilterMenuTB->sizeHint().width()+8;
2131 y = 0; 2131 y = 0;
2132 } else { 2132 } else {
2133 x= iconToolBar->width(); 2133 x= iconToolBar->width();
2134 y = 0; 2134 y = 0;
2135 } 2135 }
2136 } 2136 }
2137 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2137 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2138 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2138 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2139} 2139}
2140void MainWindow::fillFilterMenu() 2140void MainWindow::fillFilterMenu()
2141{ 2141{
2142 selectFilterMenu->clear(); 2142 selectFilterMenu->clear();
2143 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2143 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2144 selectFilterMenu->insertSeparator(); 2144 selectFilterMenu->insertSeparator();
2145 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2145 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2146 2146
2147 selectFilterMenu->insertSeparator(); 2147 selectFilterMenu->insertSeparator();
2148 QPtrList<CalFilter> fili = mView->filters(); 2148 QPtrList<CalFilter> fili = mView->filters();
2149 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2149 CalFilter *curfilter = mView->filterView()->selectedFilter();
2150 CalFilter *filter = fili.first(); 2150 CalFilter *filter = fili.first();
2151 int iii = 2; 2151 int iii = 2;
2152 bool checkitem = mView->filterView()->filtersEnabled(); 2152 bool checkitem = mView->filterView()->filtersEnabled();
2153 while(filter) { 2153 while(filter) {
2154 selectFilterMenu->insertItem( filter->name(), iii ); 2154 selectFilterMenu->insertItem( filter->name(), iii );
2155 if ( filter == curfilter) 2155 if ( filter == curfilter)
2156 selectFilterMenu->setItemChecked( iii, checkitem ); 2156 selectFilterMenu->setItemChecked( iii, checkitem );
2157 filter = fili.next(); 2157 filter = fili.next();
2158 ++iii; 2158 ++iii;
2159 } 2159 }
2160 if ( !checkitem ) 2160 if ( !checkitem )
2161 selectFilterMenu->setItemChecked( 1, true ); 2161 selectFilterMenu->setItemChecked( 1, true );
2162} 2162}
2163void MainWindow::fillFilterMenuPopup() 2163void MainWindow::fillFilterMenuPopup()
2164{ 2164{
2165 filterPopupMenu->clear(); 2165 filterPopupMenu->clear();
2166 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2166 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2167 2167
2168 filterPopupMenu->insertSeparator(); 2168 filterPopupMenu->insertSeparator();
2169 QPtrList<CalFilter> fili = mView->filters(); 2169 QPtrList<CalFilter> fili = mView->filters();
2170 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2170 CalFilter *curfilter = mView->filterView()->selectedFilter();
2171 CalFilter *filter = fili.first(); 2171 CalFilter *filter = fili.first();
2172 int iii = 1; 2172 int iii = 1;
2173 bool checkitem = mView->filterView()->filtersEnabled(); 2173 bool checkitem = mView->filterView()->filtersEnabled();
2174 while(filter) { 2174 while(filter) {
2175 filterPopupMenu->insertItem( filter->name(), iii ); 2175 filterPopupMenu->insertItem( filter->name(), iii );
2176 if ( filter == curfilter) 2176 if ( filter == curfilter)
2177 filterPopupMenu->setItemChecked( iii, checkitem ); 2177 filterPopupMenu->setItemChecked( iii, checkitem );
2178 filter = fili.next(); 2178 filter = fili.next();
2179 ++iii; 2179 ++iii;
2180 } 2180 }
2181 if ( !checkitem ) 2181 if ( !checkitem )
2182 filterPopupMenu->setItemChecked( 0, true ); 2182 filterPopupMenu->setItemChecked( 0, true );
2183} 2183}
2184void MainWindow::selectFilter( int fil ) 2184void MainWindow::selectFilter( int fil )
2185{ 2185{
2186 2186
2187 if ( fil == 0 ) { 2187 if ( fil == 0 ) {
2188 mView->editFilters( ); 2188 mView->editFilters( );
2189 } else if ( fil == 1 ){ 2189 } else if ( fil == 1 ){
2190 if ( mView->filterView()->filtersEnabled() ) 2190 if ( mView->filterView()->filtersEnabled() )
2191 mView->toggleFilerEnabled( ); 2191 mView->toggleFilerEnabled( );
2192 } else { 2192 } else {
2193 if ( !mView->filterView()->filtersEnabled() ) { 2193 if ( !mView->filterView()->filtersEnabled() ) {
2194 mView->filterView()->blockSignals( true ); 2194 mView->filterView()->blockSignals( true );
2195 mView->toggleFilerEnabled( ); 2195 mView->toggleFilerEnabled( );
2196 mView->filterView()->blockSignals( false ); 2196 mView->filterView()->blockSignals( false );
2197 } 2197 }
2198 mView->selectFilter( fil-2 ); 2198 mView->selectFilter( fil-2 );
2199 } 2199 }
2200} 2200}
2201void MainWindow::updateFilterToolbar() 2201void MainWindow::updateFilterToolbar()
2202{ 2202{
2203 if ( filterMenubar ) { 2203 if ( filterMenubar ) {
2204 if ( !mView->filterView()->filtersEnabled() ) { 2204 if ( !mView->filterView()->filtersEnabled() ) {
2205 filterMenubar->changeItem( 0, i18n("No Filter") ); 2205 filterMenubar->changeItem( 0, i18n("No Filter") );
2206 } else { 2206 } else {
2207 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2207 CalFilter *curfilter = mView->filterView()->selectedFilter();
2208 if ( curfilter ) { 2208 if ( curfilter ) {
2209 filterMenubar->changeItem( 0, curfilter->name() ); 2209 filterMenubar->changeItem( 0, curfilter->name() );
2210 } 2210 }
2211 } 2211 }
2212 } 2212 }
2213} 2213}
2214void MainWindow::selectFilterPopup( int fil ) 2214void MainWindow::selectFilterPopup( int fil )
2215{ 2215{
2216 selectFilter( fil + 1 ); 2216 selectFilter( fil + 1 );
2217 2217
2218} 2218}
2219void MainWindow::configureToolBar( int item ) 2219void MainWindow::configureToolBar( int item )
2220{ 2220{
2221 2221
2222 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2222 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2223 KOPrefs *p = KOPrefs::instance(); 2223 KOPrefs *p = KOPrefs::instance();
2224 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2224 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2225 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2225 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2226 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2226 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2227 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2227 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2228 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2228 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2229 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2229 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2230 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2230 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2231 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2231 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2232 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2232 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2233 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2233 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2234 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2234 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2235 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2235 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2236 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2236 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2237 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2237 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2238 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2238 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2239 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2239 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2240 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2240 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2241 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2241 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2242 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2242 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2243 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2243 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2244 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2244 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2245 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2245 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2246 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2246 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2247 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2247 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2248 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2248 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2249 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2249 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2250 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2250 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2251 // initActions(); 2251 // initActions();
2252} 2252}
2253void MainWindow::setCaption ( const QString & c ) 2253void MainWindow::setCaption ( const QString & c )
2254{ 2254{
2255 QString cap = c; 2255 QString cap = c;
2256 cap.replace( QRegExp("\n"), " " ); 2256 cap.replace( QRegExp("\n"), " " );
2257 cap = cap.stripWhiteSpace(); 2257 cap = cap.stripWhiteSpace();
2258 if ( cap.isEmpty() ) 2258 if ( cap.isEmpty() )
2259 cap = "KO/Pi"; 2259 cap = "KO/Pi";
2260 QWidget::setCaption( cap ); 2260 QWidget::setCaption( cap );
2261} 2261}
2262void MainWindow::setCaptionToDates() 2262void MainWindow::setCaptionToDates()
2263{ 2263{
2264 QString selDates; 2264 QString selDates;
2265 QDate date = mView->startDate(); 2265 QDate date = mView->startDate();
2266 if ( ! date.isValid() ) { 2266 if ( ! date.isValid() ) {
2267 setCaption(""); 2267 setCaption("");
2268 return; 2268 return;
2269 } 2269 }
2270 selDates = KGlobal::locale()->formatDate( date, true); 2270 selDates = KGlobal::locale()->formatDate( date, true);
2271 if (mView->startDate() < mView->endDate() ) 2271 if (mView->startDate() < mView->endDate() )
2272 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2272 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2273 else { 2273 else {
2274 QString addString; 2274 QString addString;
2275 if ( date == QDateTime::currentDateTime().date() ) 2275 if ( date == QDateTime::currentDateTime().date() )
2276 addString = i18n("Today"); 2276 addString = i18n("Today");
2277 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2277 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2278 addString = i18n("Tomorrow"); 2278 addString = i18n("Tomorrow");
2279 if ( !addString.isEmpty() ) 2279 if ( !addString.isEmpty() )
2280 selDates = addString+", "+selDates ; 2280 selDates = addString+", "+selDates ;
2281 } 2281 }
2282 setCaption( i18n("Dates: ") + selDates ); 2282 setCaption( i18n("Dates: ") + selDates );
2283 2283
2284} 2284}
2285void MainWindow::showConfigureAgenda( ) 2285void MainWindow::showConfigureAgenda( )
2286{ 2286{
2287 int iii; 2287 int iii;
2288 for ( iii = 1;iii<= 10 ;++iii ){ 2288 for ( iii = 1;iii<= 10 ;++iii ){
2289 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2289 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2290 } 2290 }
2291 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2291 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2292} 2292}
2293void MainWindow::configureAgenda( int item ) 2293void MainWindow::configureAgenda( int item )
2294{ 2294{
2295 if ( KOPrefs::instance()->mHourSize == item ) 2295 if ( KOPrefs::instance()->mHourSize == item )
2296 return; 2296 return;
2297 KOPrefs::instance()->mHourSize=item; 2297 KOPrefs::instance()->mHourSize=item;
2298 mView->viewManager()->agendaView()->updateConfig(); 2298 mView->viewManager()->agendaView()->updateConfig();
2299} 2299}
2300 2300
2301void MainWindow::saveCalendar() 2301void MainWindow::saveCalendar()
2302{ 2302{
2303 QString fn = KOPrefs::instance()->mLastSaveFile; 2303 QString fn = KOPrefs::instance()->mLastSaveFile;
2304 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2304 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2305 2305
2306 if ( fn == "" ) 2306 if ( fn == "" )
2307 return; 2307 return;
2308 QFileInfo info; 2308 QFileInfo info;
2309 info.setFile( fn ); 2309 info.setFile( fn );
2310 QString mes; 2310 QString mes;
2311 bool createbup = true; 2311 bool createbup = true;
2312 if ( info. exists() ) { 2312 if ( info. exists() ) {
2313 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2313 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2314 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2314 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2315 i18n("Overwrite!"), i18n("Cancel"), 0, 2315 i18n("Overwrite!"), i18n("Cancel"), 0,
2316 0, 1 ); 2316 0, 1 );
2317 if ( result != 0 ) { 2317 if ( result != 0 ) {
2318 createbup = false; 2318 createbup = false;
2319 } 2319 }
2320 } 2320 }
2321 if ( createbup ) { 2321 if ( createbup ) {
2322 mView->saveCalendar( fn ); 2322 mView->saveCalendar( fn );
2323 mes = i18n("KO/Pi:Saved %1").arg(fn); 2323 mes = i18n("KO/Pi:Saved %1").arg(fn);
2324 KOPrefs::instance()->mLastSaveFile = fn; 2324 KOPrefs::instance()->mLastSaveFile = fn;
2325 setCaption(mes); 2325 setCaption(mes);
2326 } 2326 }
2327} 2327}
2328void MainWindow::loadCalendar() 2328void MainWindow::loadCalendar()
2329{ 2329{
2330 2330
2331 QString fn = KOPrefs::instance()->mLastLoadFile; 2331 QString fn = KOPrefs::instance()->mLastLoadFile;
2332 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2332 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2333 2333
2334 if ( fn == "" ) 2334 if ( fn == "" )
2335 return; 2335 return;
2336 QFileInfo info; 2336 QFileInfo info;
2337 info.setFile( fn ); 2337 info.setFile( fn );
2338 QString mess; 2338 QString mess;
2339 bool loadbup = true; 2339 bool loadbup = true;
2340 if ( info. exists() ) { 2340 if ( info. exists() ) {
2341 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2341 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2342 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2342 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2343 mess, 2343 mess,
2344 i18n("Load!"), i18n("Cancel"), 0, 2344 i18n("Load!"), i18n("Cancel"), 0,
2345 0, 1 ); 2345 0, 1 );
2346 if ( result != 0 ) { 2346 if ( result != 0 ) {
2347 loadbup = false; 2347 loadbup = false;
2348 } 2348 }
2349 } else { 2349 } else {
2350 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2350 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2351 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2351 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2352 0, 1 ); 2352 0, 1 );
2353 2353
2354 return; 2354 return;
2355 } 2355 }
2356 if ( loadbup ) { 2356 if ( loadbup ) {
2357 mView->openCalendar( fn ); 2357 mView->openCalendar( fn );
2358 KOPrefs::instance()->mLastLoadFile = fn; 2358 KOPrefs::instance()->mLastLoadFile = fn;
2359 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2359 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2360 setCaption(mess); 2360 setCaption(mess);
2361 } 2361 }
2362 2362
2363} 2363}
2364void MainWindow::quickImportIcal() 2364void MainWindow::quickImportIcal()
2365{ 2365{
2366 importFile( KOPrefs::instance()->mLastImportFile, false ); 2366 importFile( KOPrefs::instance()->mLastImportFile, false );
2367} 2367}
2368void MainWindow::importFile( QString fn, bool quick ) 2368void MainWindow::importFile( QString fn, bool quick )
2369{ 2369{
2370 QFileInfo info; 2370 QFileInfo info;
2371 info.setFile( fn ); 2371 info.setFile( fn );
2372 QString mess; 2372 QString mess;
2373 bool loadbup = true; 2373 bool loadbup = true;
2374 if ( !info. exists() ) { 2374 if ( !info. exists() ) {
2375 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2375 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2376 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2376 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2377 mess ); 2377 mess );
2378 return; 2378 return;
2379 } 2379 }
2380 int result = 0; 2380 int result = 0;
2381 if ( !quick ) { 2381 if ( !quick ) {
2382 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2382 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2383 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2383 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2384 mess, 2384 mess,
2385 "Import", "Cancel", 0, 2385 "Import", "Cancel", 0,
2386 0, 1 ); 2386 0, 1 );
2387 } 2387 }
2388 if ( result == 0 ) { 2388 if ( result == 0 ) {
2389 if ( mView->openCalendar( fn, true )) { 2389 if ( mView->openCalendar( fn, true )) {
2390 KOPrefs::instance()->mLastImportFile = fn; 2390 KOPrefs::instance()->mLastImportFile = fn;
2391 setCaption(i18n("Imported file successfully")); 2391 setCaption(i18n("Imported file successfully"));
2392 } else { 2392 } else {
2393 setCaption(i18n("Error importing file")); 2393 setCaption(i18n("Error importing file"));
2394 } 2394 }
2395 } 2395 }
2396} 2396}
2397 2397
2398void MainWindow::importIcal() 2398void MainWindow::importIcal()
2399{ 2399{
2400 2400
2401 QString fn =KOPrefs::instance()->mLastImportFile; 2401 QString fn =KOPrefs::instance()->mLastImportFile;
2402 2402
2403 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2403 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2404 if ( fn == "" ) 2404 if ( fn == "" )
2405 return; 2405 return;
2406 importFile( fn, true ); 2406 importFile( fn, true );
2407 2407
2408} 2408}
2409 2409
2410void MainWindow::exportVCalendar() 2410void MainWindow::exportVCalendar()
2411{ 2411{
2412 QString fn = KOPrefs::instance()->mLastVcalFile; 2412 QString fn = KOPrefs::instance()->mLastVcalFile;
2413 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2413 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2414 if ( fn == "" ) 2414 if ( fn == "" )
2415 return; 2415 return;
2416 QFileInfo info; 2416 QFileInfo info;
2417 info.setFile( fn ); 2417 info.setFile( fn );
2418 QString mes; 2418 QString mes;
2419 bool createbup = true; 2419 bool createbup = true;
2420 if ( info. exists() ) { 2420 if ( info. exists() ) {
2421 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2421 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2422 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2422 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2423 i18n("Overwrite!"), i18n("Cancel"), 0, 2423 i18n("Overwrite!"), i18n("Cancel"), 0,
2424 0, 1 ); 2424 0, 1 );
2425 if ( result != 0 ) { 2425 if ( result != 0 ) {
2426 createbup = false; 2426 createbup = false;
2427 } 2427 }
2428 } 2428 }
2429 if ( createbup ) { 2429 if ( createbup ) {
2430 if ( mView->exportVCalendar( fn ) ) { 2430 if ( mView->exportVCalendar( fn ) ) {
2431 KOPrefs::instance()->mLastVcalFile = fn; 2431 KOPrefs::instance()->mLastVcalFile = fn;
2432 if ( fn.length() > 20 ) 2432 if ( fn.length() > 20 )
2433 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2433 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2434 else 2434 else
2435 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2435 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2436 setCaption(mes); 2436 setCaption(mes);
2437 } 2437 }
2438 } 2438 }
2439 2439
2440} 2440}
2441QString MainWindow::sentSyncFile() 2441QString MainWindow::sentSyncFile()
2442{ 2442{
2443#ifdef DESKTOP_VERSION 2443#ifdef DESKTOP_VERSION
2444 return locateLocal( "tmp", "copysynccal.ics" ); 2444 return locateLocal( "tmp", "copysynccal.ics" );
2445#else 2445#else
2446 return QString( "/tmp/copysynccal.ics" ); 2446 return QString( "/tmp/copysynccal.ics" );
2447#endif 2447#endif
2448} 2448}
2449 2449
2450void MainWindow::syncFileRequest() 2450void MainWindow::syncFileRequest()
2451{ 2451{
2452 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2452 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2453 mSyncManager->slotSyncMenu( 999 ); 2453 mSyncManager->slotSyncMenu( 999 );
2454 } 2454 }
2455 2455
2456 setCaption(i18n("Saving Data to temp file ..." )); 2456 setCaption(i18n("Saving Data to temp file ..." ));
2457 mView->saveCalendar( sentSyncFile() ); 2457 mView->saveCalendar( sentSyncFile() );
2458 setCaption(i18n("Data saved to temp file!" )); 2458 setCaption(i18n("Data saved to temp file!" ));
2459 2459
2460} 2460}
2461void MainWindow::getFile( bool success ) 2461void MainWindow::getFile( bool success )
2462{ 2462{
2463 if ( ! success ) { 2463 if ( ! success ) {
2464 setCaption( i18n("Error receiving file. Nothing changed!") ); 2464 setCaption( i18n("Error receiving file. Nothing changed!") );
2465 return; 2465 return;
2466 } 2466 }
2467 mView->openCalendar( sentSyncFile() ); 2467 mView->openCalendar( sentSyncFile() );
2468 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2468 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2469 mSyncManager->slotSyncMenu( 999 ); 2469 mSyncManager->slotSyncMenu( 999 );
2470 } 2470 }
2471 setCaption( i18n("Pi-Sync successful!") ); 2471 setCaption( i18n("Pi-Sync successful!") );
2472} 2472}
2473void MainWindow::printListView() 2473void MainWindow::printListView()
2474{ 2474{
2475 2475
2476 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2476 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2477 2477
2478 KMessageBox::information( this, message); 2478 KMessageBox::information( this, message);
2479} 2479}
2480void MainWindow::printSel( ) 2480void MainWindow::printSel( )
2481{ 2481{
2482 mView->viewManager()->agendaView()->agenda()->printSelection(); 2482 mView->viewManager()->agendaView()->agenda()->printSelection();
2483} 2483}
2484 2484
2485void MainWindow::printCal() 2485void MainWindow::printCal()
2486{ 2486{
2487 mView->print();//mCp->showDialog(); 2487 mView->print();//mCp->showDialog();
2488} 2488}
2489 2489
2490 2490
2491#include "libkdepim/kdatepicker.h" 2491#include "libkdepim/kdatepicker.h"
2492#include <kdatetbl.h> 2492#include <kdatetbl.h>
2493 2493
2494void MainWindow::weekAction() 2494void MainWindow::weekAction()
2495{ 2495{
2496 int month; 2496 int month;
2497 KPopupFrame* popup = new KPopupFrame(this); 2497 KPopupFrame* popup = new KPopupFrame(this);
2498 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2498 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2499 // ----- 2499 // -----
2500 picker->resize(picker->sizeHint()); 2500 picker->resize(picker->sizeHint());
2501 popup->setMainWidget(picker); 2501 popup->setMainWidget(picker);
2502 picker->setFocus(); 2502 picker->setFocus();
2503 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2503 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2504 int x = 0; 2504 int x = 0;
2505 int y = iconToolBar->height(); 2505 int y = iconToolBar->height();
2506 int dX = 0; 2506 int dX = 0;
2507 int dY = 0; 2507 int dY = 0;
2508 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2508 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2509 if ( iconToolBar->y() > height()/2 ) { 2509 if ( iconToolBar->y() > height()/2 ) {
2510 dY = picker->sizeHint().height()+8; 2510 dY = picker->sizeHint().height()+8;
2511 y = 0; 2511 y = 0;
2512 } 2512 }
2513 } else { 2513 } else {
2514 if ( iconToolBar->x() > width()/2 ) { // right side 2514 if ( iconToolBar->x() > width()/2 ) { // right side
2515 x=0; 2515 x=0;
2516 dX= picker->sizeHint().width()+8; 2516 dX= picker->sizeHint().width()+8;
2517 y = 0; 2517 y = 0;
2518 } else { 2518 } else {
2519 x= iconToolBar->width(); 2519 x= iconToolBar->width();
2520 y = 0; 2520 y = 0;
2521 } 2521 }
2522 } 2522 }
2523 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2523 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2524 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2524 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2525 { 2525 {
2526 month = picker->getResult(); 2526 month = picker->getResult();
2527 emit selectWeek ( month ); 2527 emit selectWeek ( month );
2528 //qDebug("weekSelected %d ", month); 2528 //qDebug("weekSelected %d ", month);
2529 } 2529 }
2530 delete popup; 2530 delete popup;
2531} 2531}
2532 2532
2533void MainWindow::hideEvent ( QHideEvent * ) 2533void MainWindow::hideEvent ( QHideEvent * )
2534{ 2534{
2535 QString message; 2535 QString message;
2536 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2536 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2537 if ( nextA.isValid() ) { 2537 if ( nextA.isValid() ) {
2538 QString sum = mCalendar->nextSummary(); 2538 QString sum = mCalendar->nextSummary();
2539 2539
2540 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2540 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2541 setCaption( message ); 2541 setCaption( message );
2542 } 2542 }
2543} 2543}
2544 2544
2545void MainWindow::resizeEvent( QResizeEvent* e) 2545void MainWindow::resizeEvent( QResizeEvent* e)
2546{ 2546{
2547#ifndef DESKTOP_VERSION 2547#ifndef DESKTOP_VERSION
2548 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2548 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2549 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2549 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2550 filterToolBar->hide(); 2550 filterToolBar->hide();
2551 else 2551 else
2552 filterToolBar->show(); 2552 filterToolBar->show();
2553 } 2553 }
2554#endif 2554#endif
2555 QMainWindow::resizeEvent( e); 2555 QMainWindow::resizeEvent( e);
2556} 2556}