summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/calendarview.cpp18
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/mainwindow.cpp19
-rw-r--r--korganizer/mainwindow.h1
5 files changed, 40 insertions, 5 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index ac70a55..3dbbbb6 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,271 +1,274 @@
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********** VERSION 2.0.2 ************ 3********** VERSION 2.0.2 ************
4 4
5KO/Pi: 5KO/Pi:
6Fixed the layout problem of the day label buttons 6Fixed the layout problem of the day label buttons
7of the agenda view introduced in version 2.0.1. 7of the agenda view introduced in version 2.0.1.
8 8
9Added WhatsThis support for the todo view and the list view. 9Added WhatsThis support for the todo view and the list view.
10 10
11Added a quite useful feature to the montview. 11Added a quite useful feature to the montview.
12Just click on the week numbers on the left. 12Just click on the week numbers on the left.
13And on top of the week numbers there is now a "week view quick selector". 13And in the top right corner of month view/agenda view
14there is now a "week number quick selector".
14(Click on the black triangle). 15(Click on the black triangle).
15 16
17Made the quite difficult timezone change in KO/Pi easy.
18
16 19
17********** VERSION 2.0.1 ************ 20********** VERSION 2.0.1 ************
18 21
19Oooops ... I forgot to test on the Zaurus 5500 ... 22Oooops ... I forgot to test on the Zaurus 5500 ...
20 23
21Fixed many problems of new (english) strings (and german translations) 24Fixed many problems of new (english) strings (and german translations)
22introduced in the latest versions, where the text was not fitting on the 25introduced in the latest versions, where the text was not fitting on the
23240x320 display of the Zaurus 5500. 26240x320 display of the Zaurus 5500.
24 27
25KO/Pi: 28KO/Pi:
26Added a popup menu ( press pen and hold to get popup ) to the agenda view 29Added a popup menu ( press pen and hold to get popup ) to the agenda view
27with many useful items (add event/todo, show next week, two weeks, month, journal). 30with many useful items (add event/todo, show next week, two weeks, month, journal).
28 31
29Added items to the todolist popup menu for: 32Added items to the todolist popup menu for:
30Display all opened, all closed or all todos flat. 33Display all opened, all closed or all todos flat.
31The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 34The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
32Made the reparenting of todos on the desktop possible via Drag&Drop. 35Made the reparenting of todos on the desktop possible via Drag&Drop.
33Fixed several bugs in setting the completed datetime for todos. 36Fixed several bugs in setting the completed datetime for todos.
34Added info about completed datetime of todos to the todo viewer. 37Added info about completed datetime of todos to the todo viewer.
35Now displaying a completed todo (with completed datetime set) in the agenda view 38Now displaying a completed todo (with completed datetime set) in the agenda view
36at the time of the completion. Such that now it is possible to see in the agenda view 39at the time of the completion. Such that now it is possible to see in the agenda view
37when what todo was completed. 40when what todo was completed.
38Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 41Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
39Now the behaviour is: 42Now the behaviour is:
40Setting a parent to complete sets all (sub)childs to complete. 43Setting a parent to complete sets all (sub)childs to complete.
41Setting a parent to uncomplete does not change the childs. 44Setting a parent to uncomplete does not change the childs.
42Setting a child to uncomplete sets all parent to uncomplete. 45Setting a child to uncomplete sets all parent to uncomplete.
43Setting a child to complete does not change the parents. 46Setting a child to complete does not change the parents.
44 47
45Smart updating and double buffering of the daymatrix. 48Smart updating and double buffering of the daymatrix.
46Showing holidays in the day matrix. 49Showing holidays in the day matrix.
47Many other small performance updates. 50Many other small performance updates.
48 51
49Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 52Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
50 53
51Now the translation file usertranslation.txt is supposed to be in utf8 format. 54Now the translation file usertranslation.txt is supposed to be in utf8 format.
52If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. 55If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu.
53 56
54 57
55********** VERSION 2.0.0 ************ 58********** VERSION 2.0.0 ************
56 59
57Stable release 2.0.0! 60Stable release 2.0.0!
58 61
59KO/Pi: 62KO/Pi:
60Fixed problem in edit dialog recreation at startup. 63Fixed problem in edit dialog recreation at startup.
61Made "toggle view*" menu items enabled context sensitive. 64Made "toggle view*" menu items enabled context sensitive.
62Changed agenda size menu to items 1-10. 65Changed agenda size menu to items 1-10.
63Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. 66Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
64Usebility enhancements in the KO/Pi menus. 67Usebility enhancements in the KO/Pi menus.
65Birthday import now adds year to summary. 68Birthday import now adds year to summary.
66What's Next view shows age in years for birthday. 69What's Next view shows age in years for birthday.
67 70
68OM/Pi: 71OM/Pi:
69Added three info lines to display subject, from and to of selected mails. 72Added three info lines to display subject, from and to of selected mails.
70 73
71KA/Pi: 74KA/Pi:
72Fixed jump bar behaviour on Zaurus. 75Fixed jump bar behaviour on Zaurus.
73Now KA/Pi search field supports searching for a range of starting characters. 76Now KA/Pi search field supports searching for a range of starting characters.
74E.g. to search for all contact beginning with b to n, type 77E.g. to search for all contact beginning with b to n, type
75b-n 78b-n
76in the search field. 79in the search field.
77 80
78********** VERSION 1.9.20 ************ 81********** VERSION 1.9.20 ************
79 82
80KO/Pi: 83KO/Pi:
81Added for the "dislplay one day" agenda mode 84Added for the "dislplay one day" agenda mode
82info in the caption and in the day lables: 85info in the caption and in the day lables:
83Now it is displayed, if the selected day is from "day before yesterday" 86Now it is displayed, if the selected day is from "day before yesterday"
84to "day after tomorrow". 87to "day after tomorrow".
85Made it possible to delete a Todo, which has sub-todos. 88Made it possible to delete a Todo, which has sub-todos.
86Fixed two small problems in the todo view. 89Fixed two small problems in the todo view.
87Added missing German translation for filter edit and print dialog. 90Added missing German translation for filter edit and print dialog.
88Made search dialog closeable by cancel key. 91Made search dialog closeable by cancel key.
89 92
90Made it possible to select in the date picker the (ligt grey ) 93Made it possible to select in the date picker the (ligt grey )
91dates of the prev./next month with the mouse. 94dates of the prev./next month with the mouse.
92 95
93OM/Pi: 96OM/Pi:
94"Delete mail" icon in main window now deletes all selected mails. 97"Delete mail" icon in main window now deletes all selected mails.
95Fixed the problem, that the state flag of imap mails was ignored. 98Fixed the problem, that the state flag of imap mails was ignored.
96Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 99Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
97to indecate that they are already seen. 100to indecate that they are already seen.
98Fixed the problem that the body of some mails was not displayed in the 101Fixed the problem that the body of some mails was not displayed in the
99mail viewer when fetching them from the imap server directly to read them. 102mail viewer when fetching them from the imap server directly to read them.
100Made it (configurable) possible to show the "To:" field in the list view. 103Made it (configurable) possible to show the "To:" field in the list view.
101Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. 104Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
102Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the 105Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
103local storage folder (specified in account settings) of the account of the mail. 106local storage folder (specified in account settings) of the account of the mail.
104Removed some memory leaks in OM/Pi. 107Removed some memory leaks in OM/Pi.
105 108
106 109
107********** VERSION 1.9.19 ************ 110********** VERSION 1.9.19 ************
108 111
109Added a lot of missing translations to KA/Pi, 112Added a lot of missing translations to KA/Pi,
110Added some missing translations to KO/Pi and OM/Pi. 113Added some missing translations to KO/Pi and OM/Pi.
111 114
112Fixed some minor problems in KA/Pi + KO/Pi. 115Fixed some minor problems in KA/Pi + KO/Pi.
113 116
114Fixed a crash when closing PwM/Pi. 117Fixed a crash when closing PwM/Pi.
115Added German translation for PwM/Pi. 118Added German translation for PwM/Pi.
116 119
117Made view change and Month View update faster in KO/Pi. 120Made view change and Month View update faster in KO/Pi.
118 121
119 122
120********** VERSION 1.9.18 ************ 123********** VERSION 1.9.18 ************
121 124
122FYI: The VERSION 1.9.17 was a testing release only. 125FYI: The VERSION 1.9.17 was a testing release only.
123Please read the changelog of VERSION 1.9.17 as well. 126Please read the changelog of VERSION 1.9.17 as well.
124 127
125Cleaned up the syncing config dialog. 128Cleaned up the syncing config dialog.
126Added sync config options for date range for events. 129Added sync config options for date range for events.
127Added sync config options for filters on incoming data. 130Added sync config options for filters on incoming data.
128Added sync config options for filters on outgoing data. 131Added sync config options for filters on outgoing data.
129Please read the updated SyncHowTo about the new filter settings. 132Please read the updated SyncHowTo about the new filter settings.
130These filter settings make it now possible to sync with shared 133These filter settings make it now possible to sync with shared
131calendars without writing back private or confidential data 134calendars without writing back private or confidential data
132(via the outgoing filters). 135(via the outgoing filters).
133To sync only with particular parts of a shared calendar, 136To sync only with particular parts of a shared calendar,
134the incoming filter settings can be used. 137the incoming filter settings can be used.
135An example can be found in the SyncHowTo. 138An example can be found in the SyncHowTo.
136Same for shared addressbooks. 139Same for shared addressbooks.
137 140
138Added a setting for the global kdepim data storage. 141Added a setting for the global kdepim data storage.
139Usually the data is stored in (yourhomedir/kdepim). 142Usually the data is stored in (yourhomedir/kdepim).
140Now you can set in the Global config dialog TAB, subTAB "Data storage path" 143Now you can set in the Global config dialog TAB, subTAB "Data storage path"
141a directory where all the kdepim data is stored. 144a directory where all the kdepim data is stored.
142That makes it easy to save all kdepim data on a SD card on the Z, for example. 145That makes it easy to save all kdepim data on a SD card on the Z, for example.
143 146
144KO/Pi: 147KO/Pi:
145The timeedit input has a pulldown list for times. 148The timeedit input has a pulldown list for times.
146If opened, this pulldown list should now has the right time highlighted. 149If opened, this pulldown list should now has the right time highlighted.
147Added the possibility to exclude events/todos/journals in a filter. 150Added the possibility to exclude events/todos/journals in a filter.
148You should exclude journals, if you do not want them to sync with a public calendar. 151You should exclude journals, if you do not want them to sync with a public calendar.
149 152
150KA/Pi: 153KA/Pi:
151Added the possibility to in/exclude public/private/confidential contacts to a filter. 154Added the possibility to in/exclude public/private/confidential contacts to a filter.
152If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... 155If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ...
153Added printing of card view and details view on desktop. 156Added printing of card view and details view on desktop.
154Printing of list view is not working... 157Printing of list view is not working...
155Added button for removing pictures in contact editor. 158Added button for removing pictures in contact editor.
156Parsing data fix of KA/Pi version 1.9.17. 159Parsing data fix of KA/Pi version 1.9.17.
157Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. 160Fixed the "parse name automatically" problem of KA/Pi version 1.9.17.
158Fixed some syncing merging problems. 161Fixed some syncing merging problems.
159 162
160 163
161********** VERSION 1.9.17 ************ 164********** VERSION 1.9.17 ************
162 165
163KO/Pi: 166KO/Pi:
164Fixed that tooltips were not updated after moving an item in agenda view. 167Fixed that tooltips were not updated after moving an item in agenda view.
165Fixed a bug in sorting start date for recurring events in list view. 168Fixed a bug in sorting start date for recurring events in list view.
166Changed the left button in todo viewer from "Agenda" to "Set completed". 169Changed the left button in todo viewer from "Agenda" to "Set completed".
167This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. 170This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View.
168Added more info in the todo viewer: Startdate, parent/sub todos. 171Added more info in the todo viewer: Startdate, parent/sub todos.
169 172
170 173
171KA/Pi: 174KA/Pi:
172All fields search does now actually search all the (possible) fields, 175All fields search does now actually search all the (possible) fields,
173not only those listed in the contact list. 176not only those listed in the contact list.
174Made is possible to inline a picture in a vcard on the Z. 177Made is possible to inline a picture in a vcard on the Z.
175This was only possible on the desktop, now is it possible on the Z as well. 178This was only possible on the desktop, now is it possible on the Z as well.
176Fixed of missing save settings after filter configuration. 179Fixed of missing save settings after filter configuration.
177Made saving of addressbook much faster. 180Made saving of addressbook much faster.
178Fixed extension widget layout problem. 181Fixed extension widget layout problem.
179Fixed saving of default formatted name settings. 182Fixed saving of default formatted name settings.
180Fixed formatted name handling in edit dialog. 183Fixed formatted name handling in edit dialog.
181Added an option for changing formatted names of many contacts 184Added an option for changing formatted names of many contacts
182(menu: File - Change - Set formatted name). 185(menu: File - Change - Set formatted name).
183 186
184QWhatsThis was not working on the Z ( only black rectangle was shown). 187QWhatsThis was not working on the Z ( only black rectangle was shown).
185This is Fixed. 188This is Fixed.
186 189
187KDE-Sync: 190KDE-Sync:
188Now readonly KDE resources are synced as well. 191Now readonly KDE resources are synced as well.
189(They are not changed in KDE itself, of course). 192(They are not changed in KDE itself, of course).
190 193
191 194
192 195
193********** VERSION 1.9.16 ************ 196********** VERSION 1.9.16 ************
194 197
195KO/Pi: 198KO/Pi:
196Fixed search dialog size on Z 6000 (480x640 display). 199Fixed search dialog size on Z 6000 (480x640 display).
197Added setting to hide/show time in agenda items. 200Added setting to hide/show time in agenda items.
198Added setting to hide not running todos in todo view. 201Added setting to hide not running todos in todo view.
199Added columns for start date/time in todo view. 202Added columns for start date/time in todo view.
200Replaced the solid half-hour lines in agenda view by dot lines. 203Replaced the solid half-hour lines in agenda view by dot lines.
201Added possibility of printing the What's Next View on the desktop 204Added possibility of printing the What's Next View on the desktop
202(i.e. Windows and Linux). 205(i.e. Windows and Linux).
203Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. 206Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
204Added tooltips in month view.(Tooltips only available on desktop) 207Added tooltips in month view.(Tooltips only available on desktop)
205 208
206Fixed a strange problem in KO/Pi alarm applet. 209Fixed a strange problem in KO/Pi alarm applet.
207Did not find the actual problem, 210Did not find the actual problem,
208such that now Qtopia reboots again if deinstalling the alarm applet. 211such that now Qtopia reboots again if deinstalling the alarm applet.
209But the alarm applet should work again. 212But the alarm applet should work again.
210 213
211KA/Pi: 214KA/Pi:
212Fixed the problem, that internal pictures were not saved. 215Fixed the problem, that internal pictures were not saved.
213 216
214Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. 217Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes.
215 218
216Fixed some minor problems. (Like word wrap in help text windows). 219Fixed some minor problems. (Like word wrap in help text windows).
217 220
218Fixed a compiling problem in microkde/kresources. 221Fixed a compiling problem in microkde/kresources.
219 222
220KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. 223KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM.
221This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) 224This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9)
222such that now syncing KO/Pi with Sharp DTM should work on the 225such that now syncing KO/Pi with Sharp DTM should work on the
223Zaurus C 3000 model. 226Zaurus C 3000 model.
224 227
225********** VERSION 1.9.15 ************ 228********** VERSION 1.9.15 ************
226 229
227Usebilty enhancements in KO/Pi: 230Usebilty enhancements in KO/Pi:
228When clicking on the date in a month view cell, the day view is shown. 231When clicking on the date in a month view cell, the day view is shown.
229Old behaviour was, that the "new event" dialog popped up. 232Old behaviour was, that the "new event" dialog popped up.
230 233
231Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 234Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
232That means, you can restore the latest 235That means, you can restore the latest
233event/todo/journal you have deleted. 236event/todo/journal you have deleted.
234A journal is deleted, if you clear all the text of the journal. 237A journal is deleted, if you clear all the text of the journal.
235 238
236Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 239Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
237 240
238KA/Pi starting in 480x640 resolution: 241KA/Pi starting in 480x640 resolution:
239Hide the filter action in toolbar 242Hide the filter action in toolbar
240and added icons for undo/delete/redo in toolbar. 243and added icons for undo/delete/redo in toolbar.
241 244
242Change in OM/Pi ViewMail dialog: 245Change in OM/Pi ViewMail dialog:
243When clicking on the "delete" icon the mail is deleted after confirmation as usual. 246When clicking on the "delete" icon the mail is deleted after confirmation as usual.
244But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 247But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
245 248
246Fixed a crash when deleting mail-accounts in OM/Pi. 249Fixed a crash when deleting mail-accounts in OM/Pi.
247 250
248 251
249********** VERSION 1.9.14 ************ 252********** VERSION 1.9.14 ************
250 253
251Fixed some problems with the dialog sizes when switching 254Fixed some problems with the dialog sizes when switching
252portrait/landscape mode on 640x480 PDA display. 255portrait/landscape mode on 640x480 PDA display.
253 256
254Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 257Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
255 258
256Fixed an ugly bug in KOpieMail: 259Fixed an ugly bug in KOpieMail:
257KOpieMail was not able to write files (mails) to MSDOS file system, 260KOpieMail was not able to write files (mails) to MSDOS file system,
258like on an usual preformatted SD card. That should work now. 261like on an usual preformatted SD card. That should work now.
259To save your mail data on the Sd card do the following: 262To save your mail data on the Sd card do the following:
260Create a dir on the SD card: 263Create a dir on the SD card:
261mkdir /mnt/card/localmail 264mkdir /mnt/card/localmail
262Go to your home dir: 265Go to your home dir:
263cd 266cd
264Go to kopiemail data storage dir: 267Go to kopiemail data storage dir:
265cd kdepim/apps/kopiemail 268cd kdepim/apps/kopiemail
266Create a symlink to the SD card: 269Create a symlink to the SD card:
267ls -s /mnt/card/localmail 270ls -s /mnt/card/localmail
268Now KOpieMail will store all mails on the SD card. 271Now KOpieMail will store all mails on the SD card.
269 272
270KO/Pi Monthview: 273KO/Pi Monthview:
271Now "Go to Today" selects the current month from day 1-end, 274Now "Go to Today" selects the current month from day 1-end,
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e0380fa..77de94f 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1998,514 +1998,530 @@ void CalendarView::readFilterSettings(KConfig *config)
1998 if (mFilters.count() == 0) { 1998 if (mFilters.count() == 0) {
1999 CalFilter *filter = new CalFilter(i18n("Default")); 1999 CalFilter *filter = new CalFilter(i18n("Default"));
2000 mFilters.append(filter); 2000 mFilters.append(filter);
2001 } 2001 }
2002 mFilterView->updateFilters(); 2002 mFilterView->updateFilters();
2003 config->setGroup("FilterView"); 2003 config->setGroup("FilterView");
2004 2004
2005 mFilterView->blockSignals(true); 2005 mFilterView->blockSignals(true);
2006 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2006 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2007 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2007 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2008 mFilterView->blockSignals(false); 2008 mFilterView->blockSignals(false);
2009 // We do it manually to avoid it being done twice by the above calls 2009 // We do it manually to avoid it being done twice by the above calls
2010 updateFilter(); 2010 updateFilter();
2011} 2011}
2012 2012
2013void CalendarView::writeFilterSettings(KConfig *config) 2013void CalendarView::writeFilterSettings(KConfig *config)
2014{ 2014{
2015 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2015 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2016 2016
2017 QStringList filterList; 2017 QStringList filterList;
2018 2018
2019 CalFilter *filter = mFilters.first(); 2019 CalFilter *filter = mFilters.first();
2020 while(filter) { 2020 while(filter) {
2021 // kdDebug() << " fn: " << filter->name() << endl; 2021 // kdDebug() << " fn: " << filter->name() << endl;
2022 filterList << filter->name(); 2022 filterList << filter->name();
2023 config->setGroup("Filter_" + filter->name()); 2023 config->setGroup("Filter_" + filter->name());
2024 config->writeEntry("Criteria",filter->criteria()); 2024 config->writeEntry("Criteria",filter->criteria());
2025 config->writeEntry("CategoryList",filter->categoryList()); 2025 config->writeEntry("CategoryList",filter->categoryList());
2026 filter = mFilters.next(); 2026 filter = mFilters.next();
2027 } 2027 }
2028 config->setGroup("General"); 2028 config->setGroup("General");
2029 config->writeEntry("CalendarFilters",filterList); 2029 config->writeEntry("CalendarFilters",filterList);
2030 2030
2031 config->setGroup("FilterView"); 2031 config->setGroup("FilterView");
2032 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2032 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2033 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2033 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2034} 2034}
2035 2035
2036 2036
2037void CalendarView::goToday() 2037void CalendarView::goToday()
2038{ 2038{
2039 if ( mViewManager->currentView()->isMonthView() ) 2039 if ( mViewManager->currentView()->isMonthView() )
2040 mNavigator->selectTodayMonth(); 2040 mNavigator->selectTodayMonth();
2041 else 2041 else
2042 mNavigator->selectToday(); 2042 mNavigator->selectToday();
2043} 2043}
2044 2044
2045void CalendarView::goNext() 2045void CalendarView::goNext()
2046{ 2046{
2047 mNavigator->selectNext(); 2047 mNavigator->selectNext();
2048} 2048}
2049 2049
2050void CalendarView::goPrevious() 2050void CalendarView::goPrevious()
2051{ 2051{
2052 mNavigator->selectPrevious(); 2052 mNavigator->selectPrevious();
2053} 2053}
2054void CalendarView::goNextMonth() 2054void CalendarView::goNextMonth()
2055{ 2055{
2056 mNavigator->selectNextMonth(); 2056 mNavigator->selectNextMonth();
2057} 2057}
2058 2058
2059void CalendarView::goPreviousMonth() 2059void CalendarView::goPreviousMonth()
2060{ 2060{
2061 mNavigator->selectPreviousMonth(); 2061 mNavigator->selectPreviousMonth();
2062} 2062}
2063void CalendarView::writeLocale() 2063void CalendarView::writeLocale()
2064{ 2064{
2065 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2065 //KPimGlobalPrefs::instance()->setGlobalConfig();
2066#if 0 2066#if 0
2067 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2067 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2068 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2068 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2069 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2069 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2070 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2070 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2071 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2071 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2072 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2072 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2073 dummy = KOPrefs::instance()->mUserDateFormatShort; 2073 dummy = KOPrefs::instance()->mUserDateFormatShort;
2074 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2074 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2075 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2075 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2076 KOPrefs::instance()->mDaylightsavingStart, 2076 KOPrefs::instance()->mDaylightsavingStart,
2077 KOPrefs::instance()->mDaylightsavingEnd ); 2077 KOPrefs::instance()->mDaylightsavingEnd );
2078 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2078 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2079#endif 2079#endif
2080} 2080}
2081void CalendarView::updateConfig() 2081void CalendarView::updateConfig()
2082{ 2082{
2083 writeLocale(); 2083 writeLocale();
2084 if ( KOPrefs::instance()->mUseAppColors ) 2084 if ( KOPrefs::instance()->mUseAppColors )
2085 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2085 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2086 emit configChanged(); 2086 emit configChanged();
2087 mTodoList->updateConfig(); 2087 mTodoList->updateConfig();
2088 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2088 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2089 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2089 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2090 // To make the "fill window" configurations work 2090 // To make the "fill window" configurations work
2091 //mViewManager->raiseCurrentView(); 2091 //mViewManager->raiseCurrentView();
2092} 2092}
2093 2093
2094 2094
2095void CalendarView::eventChanged(Event *event) 2095void CalendarView::eventChanged(Event *event)
2096{ 2096{
2097 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2097 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2098 //updateUnmanagedViews(); 2098 //updateUnmanagedViews();
2099} 2099}
2100 2100
2101void CalendarView::eventAdded(Event *event) 2101void CalendarView::eventAdded(Event *event)
2102{ 2102{
2103 changeEventDisplay(event,KOGlobals::EVENTADDED); 2103 changeEventDisplay(event,KOGlobals::EVENTADDED);
2104} 2104}
2105 2105
2106void CalendarView::eventToBeDeleted(Event *) 2106void CalendarView::eventToBeDeleted(Event *)
2107{ 2107{
2108 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2108 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2109} 2109}
2110 2110
2111void CalendarView::eventDeleted() 2111void CalendarView::eventDeleted()
2112{ 2112{
2113 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2113 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2114} 2114}
2115void CalendarView::changeTodoDisplay(Todo *which, int action) 2115void CalendarView::changeTodoDisplay(Todo *which, int action)
2116{ 2116{
2117 changeIncidenceDisplay((Incidence *)which, action); 2117 changeIncidenceDisplay((Incidence *)which, action);
2118 mDateNavigator->updateView(); //LR 2118 mDateNavigator->updateView(); //LR
2119 //mDialogManager->updateSearchDialog(); 2119 //mDialogManager->updateSearchDialog();
2120 2120
2121 if (which) { 2121 if (which) {
2122 mViewManager->updateWNview(); 2122 mViewManager->updateWNview();
2123 //mTodoList->updateView(); 2123 //mTodoList->updateView();
2124 } 2124 }
2125 2125
2126} 2126}
2127 2127
2128void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2128void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2129{ 2129{
2130 updateUnmanagedViews(); 2130 updateUnmanagedViews();
2131 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2131 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2132 if ( action == KOGlobals::EVENTDELETED ) { //delete 2132 if ( action == KOGlobals::EVENTDELETED ) { //delete
2133 mCalendar->checkAlarmForIncidence( 0, true ); 2133 mCalendar->checkAlarmForIncidence( 0, true );
2134 if ( mEventViewerDialog ) 2134 if ( mEventViewerDialog )
2135 mEventViewerDialog->hide(); 2135 mEventViewerDialog->hide();
2136 } 2136 }
2137 else 2137 else
2138 mCalendar->checkAlarmForIncidence( which , false ); 2138 mCalendar->checkAlarmForIncidence( which , false );
2139} 2139}
2140 2140
2141// most of the changeEventDisplays() right now just call the view's 2141// most of the changeEventDisplays() right now just call the view's
2142// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2142// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2143void CalendarView::changeEventDisplay(Event *which, int action) 2143void CalendarView::changeEventDisplay(Event *which, int action)
2144{ 2144{
2145 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2145 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2146 changeIncidenceDisplay((Incidence *)which, action); 2146 changeIncidenceDisplay((Incidence *)which, action);
2147 mDateNavigator->updateView(); 2147 mDateNavigator->updateView();
2148 //mDialogManager->updateSearchDialog(); 2148 //mDialogManager->updateSearchDialog();
2149 2149
2150 if (which) { 2150 if (which) {
2151 // If there is an event view visible update the display 2151 // If there is an event view visible update the display
2152 mViewManager->currentView()->changeEventDisplay(which,action); 2152 mViewManager->currentView()->changeEventDisplay(which,action);
2153 // TODO: check, if update needed 2153 // TODO: check, if update needed
2154 // if (which->getTodoStatus()) { 2154 // if (which->getTodoStatus()) {
2155 mTodoList->updateView(); 2155 mTodoList->updateView();
2156 // } 2156 // }
2157 } else { 2157 } else {
2158 mViewManager->currentView()->updateView(); 2158 mViewManager->currentView()->updateView();
2159 } 2159 }
2160} 2160}
2161 2161
2162 2162
2163void CalendarView::updateTodoViews() 2163void CalendarView::updateTodoViews()
2164{ 2164{
2165 mTodoList->updateView(); 2165 mTodoList->updateView();
2166 mViewManager->currentView()->updateView(); 2166 mViewManager->currentView()->updateView();
2167 2167
2168} 2168}
2169 2169
2170 2170
2171void CalendarView::updateView(const QDate &start, const QDate &end) 2171void CalendarView::updateView(const QDate &start, const QDate &end)
2172{ 2172{
2173 mTodoList->updateView(); 2173 mTodoList->updateView();
2174 mViewManager->updateView(start, end); 2174 mViewManager->updateView(start, end);
2175 //mDateNavigator->updateView(); 2175 //mDateNavigator->updateView();
2176} 2176}
2177 2177
2178void CalendarView::updateView() 2178void CalendarView::updateView()
2179{ 2179{
2180 DateList tmpList = mNavigator->selectedDates(); 2180 DateList tmpList = mNavigator->selectedDates();
2181 2181
2182 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2182 if ( KOPrefs::instance()->mHideNonStartedTodos )
2183 mTodoList->updateView(); 2183 mTodoList->updateView();
2184 // We assume that the navigator only selects consecutive days. 2184 // We assume that the navigator only selects consecutive days.
2185 updateView( tmpList.first(), tmpList.last() ); 2185 updateView( tmpList.first(), tmpList.last() );
2186} 2186}
2187 2187
2188void CalendarView::updateUnmanagedViews() 2188void CalendarView::updateUnmanagedViews()
2189{ 2189{
2190 mDateNavigator->updateDayMatrix(); 2190 mDateNavigator->updateDayMatrix();
2191} 2191}
2192 2192
2193int CalendarView::msgItemDelete(const QString name) 2193int CalendarView::msgItemDelete(const QString name)
2194{ 2194{
2195 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2195 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2196 i18n("This item will be\npermanently deleted."), 2196 i18n("This item will be\npermanently deleted."),
2197 i18n("KO/Pi Confirmation"),i18n("Delete")); 2197 i18n("KO/Pi Confirmation"),i18n("Delete"));
2198} 2198}
2199 2199
2200 2200
2201void CalendarView::edit_cut() 2201void CalendarView::edit_cut()
2202{ 2202{
2203 Event *anEvent=0; 2203 Event *anEvent=0;
2204 2204
2205 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2205 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2206 2206
2207 if (mViewManager->currentView()->isEventView()) { 2207 if (mViewManager->currentView()->isEventView()) {
2208 if ( incidence && incidence->type() == "Event" ) { 2208 if ( incidence && incidence->type() == "Event" ) {
2209 anEvent = static_cast<Event *>(incidence); 2209 anEvent = static_cast<Event *>(incidence);
2210 } 2210 }
2211 } 2211 }
2212 2212
2213 if (!anEvent) { 2213 if (!anEvent) {
2214 KNotifyClient::beep(); 2214 KNotifyClient::beep();
2215 return; 2215 return;
2216 } 2216 }
2217 DndFactory factory( mCalendar ); 2217 DndFactory factory( mCalendar );
2218 factory.cutIncidence(anEvent); 2218 factory.cutIncidence(anEvent);
2219 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2219 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2220} 2220}
2221 2221
2222void CalendarView::edit_copy() 2222void CalendarView::edit_copy()
2223{ 2223{
2224 Event *anEvent=0; 2224 Event *anEvent=0;
2225 2225
2226 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2226 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2227 2227
2228 if (mViewManager->currentView()->isEventView()) { 2228 if (mViewManager->currentView()->isEventView()) {
2229 if ( incidence && incidence->type() == "Event" ) { 2229 if ( incidence && incidence->type() == "Event" ) {
2230 anEvent = static_cast<Event *>(incidence); 2230 anEvent = static_cast<Event *>(incidence);
2231 } 2231 }
2232 } 2232 }
2233 2233
2234 if (!anEvent) { 2234 if (!anEvent) {
2235 KNotifyClient::beep(); 2235 KNotifyClient::beep();
2236 return; 2236 return;
2237 } 2237 }
2238 DndFactory factory( mCalendar ); 2238 DndFactory factory( mCalendar );
2239 factory.copyIncidence(anEvent); 2239 factory.copyIncidence(anEvent);
2240} 2240}
2241 2241
2242void CalendarView::edit_paste() 2242void CalendarView::edit_paste()
2243{ 2243{
2244 QDate date = mNavigator->selectedDates().first(); 2244 QDate date = mNavigator->selectedDates().first();
2245 2245
2246 DndFactory factory( mCalendar ); 2246 DndFactory factory( mCalendar );
2247 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2247 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2248 2248
2249 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2249 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2250} 2250}
2251 2251
2252void CalendarView::edit_options() 2252void CalendarView::edit_options()
2253{ 2253{
2254 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2255 emit save();
2256 emit saveStopTimer();
2254 mDialogManager->showOptionsDialog(); 2257 mDialogManager->showOptionsDialog();
2255 //writeSettings(); 2258 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2259 emit saveStopTimer();
2260 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!"),
2261 i18n("Timezone settings"),i18n("Reload"))) {
2262 qDebug("KO: TZ reload cancelled ");
2263 return;
2264 }
2265 qDebug("KO: Timezone change ");
2266 openCalendar( MainWindow::defaultFileName() );
2267 setModified(true);
2268 }
2269 else
2270 qDebug("KO: No tz change ");
2271
2256} 2272}
2257 2273
2258 2274
2259void CalendarView::slotSelectPickerDate( QDate d) 2275void CalendarView::slotSelectPickerDate( QDate d)
2260{ 2276{
2261 mDateFrame->hide(); 2277 mDateFrame->hide();
2262 if ( mDatePickerMode == 1 ) { 2278 if ( mDatePickerMode == 1 ) {
2263 mNavigator->slotDaySelect( d ); 2279 mNavigator->slotDaySelect( d );
2264 } else if ( mDatePickerMode == 2 ) { 2280 } else if ( mDatePickerMode == 2 ) {
2265 if ( mMoveIncidence->type() == "Todo" ) { 2281 if ( mMoveIncidence->type() == "Todo" ) {
2266 Todo * to = (Todo *) mMoveIncidence; 2282 Todo * to = (Todo *) mMoveIncidence;
2267 QTime tim; 2283 QTime tim;
2268 if ( to->hasDueDate() ) 2284 if ( to->hasDueDate() )
2269 tim = to->dtDue().time(); 2285 tim = to->dtDue().time();
2270 else { 2286 else {
2271 tim = QTime ( 0,0,0 ); 2287 tim = QTime ( 0,0,0 );
2272 to->setFloats( true ); 2288 to->setFloats( true );
2273 to->setHasDueDate( true ); 2289 to->setHasDueDate( true );
2274 } 2290 }
2275 QDateTime dt ( d,tim ); 2291 QDateTime dt ( d,tim );
2276 to->setDtDue( dt ); 2292 to->setDtDue( dt );
2277 todoChanged( to ); 2293 todoChanged( to );
2278 } else { 2294 } else {
2279 if ( mMoveIncidence->doesRecur() ) { 2295 if ( mMoveIncidence->doesRecur() ) {
2280#if 0 2296#if 0
2281 // PENDING implement this 2297 // PENDING implement this
2282 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2298 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2283 mCalendar()->addIncidence( newInc ); 2299 mCalendar()->addIncidence( newInc );
2284 if ( mMoveIncidence->type() == "Todo" ) 2300 if ( mMoveIncidence->type() == "Todo" )
2285 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2301 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2286 else 2302 else
2287 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2303 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2288 mMoveIncidence = newInc; 2304 mMoveIncidence = newInc;
2289 2305
2290#endif 2306#endif
2291 } 2307 }
2292 QTime tim = mMoveIncidence->dtStart().time(); 2308 QTime tim = mMoveIncidence->dtStart().time();
2293 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2309 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2294 QDateTime dt ( d,tim ); 2310 QDateTime dt ( d,tim );
2295 mMoveIncidence->setDtStart( dt ); 2311 mMoveIncidence->setDtStart( dt );
2296 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2312 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2297 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2313 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2298 } 2314 }
2299 2315
2300 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2316 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2301 } 2317 }
2302} 2318}
2303 2319
2304void CalendarView::removeCategories() 2320void CalendarView::removeCategories()
2305{ 2321{
2306 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2322 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2307 QStringList catList = KOPrefs::instance()->mCustomCategories; 2323 QStringList catList = KOPrefs::instance()->mCustomCategories;
2308 QStringList catIncList; 2324 QStringList catIncList;
2309 QStringList newCatList; 2325 QStringList newCatList;
2310 Incidence* inc = incList.first(); 2326 Incidence* inc = incList.first();
2311 int i; 2327 int i;
2312 int count = 0; 2328 int count = 0;
2313 while ( inc ) { 2329 while ( inc ) {
2314 newCatList.clear(); 2330 newCatList.clear();
2315 catIncList = inc->categories() ; 2331 catIncList = inc->categories() ;
2316 for( i = 0; i< catIncList.count(); ++i ) { 2332 for( i = 0; i< catIncList.count(); ++i ) {
2317 if ( catList.contains (catIncList[i])) 2333 if ( catList.contains (catIncList[i]))
2318 newCatList.append( catIncList[i] ); 2334 newCatList.append( catIncList[i] );
2319 } 2335 }
2320 newCatList.sort(); 2336 newCatList.sort();
2321 inc->setCategories( newCatList.join(",") ); 2337 inc->setCategories( newCatList.join(",") );
2322 inc = incList.next(); 2338 inc = incList.next();
2323 } 2339 }
2324} 2340}
2325 2341
2326int CalendarView::addCategories() 2342int CalendarView::addCategories()
2327{ 2343{
2328 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2344 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2329 QStringList catList = KOPrefs::instance()->mCustomCategories; 2345 QStringList catList = KOPrefs::instance()->mCustomCategories;
2330 QStringList catIncList; 2346 QStringList catIncList;
2331 Incidence* inc = incList.first(); 2347 Incidence* inc = incList.first();
2332 int i; 2348 int i;
2333 int count = 0; 2349 int count = 0;
2334 while ( inc ) { 2350 while ( inc ) {
2335 catIncList = inc->categories() ; 2351 catIncList = inc->categories() ;
2336 for( i = 0; i< catIncList.count(); ++i ) { 2352 for( i = 0; i< catIncList.count(); ++i ) {
2337 if ( !catList.contains (catIncList[i])) { 2353 if ( !catList.contains (catIncList[i])) {
2338 catList.append( catIncList[i] ); 2354 catList.append( catIncList[i] );
2339 //qDebug("add cat %s ", catIncList[i].latin1()); 2355 //qDebug("add cat %s ", catIncList[i].latin1());
2340 ++count; 2356 ++count;
2341 } 2357 }
2342 } 2358 }
2343 inc = incList.next(); 2359 inc = incList.next();
2344 } 2360 }
2345 catList.sort(); 2361 catList.sort();
2346 KOPrefs::instance()->mCustomCategories = catList; 2362 KOPrefs::instance()->mCustomCategories = catList;
2347 return count; 2363 return count;
2348} 2364}
2349 2365
2350void CalendarView::manageCategories() 2366void CalendarView::manageCategories()
2351{ 2367{
2352 KOCatPrefs* cp = new KOCatPrefs(); 2368 KOCatPrefs* cp = new KOCatPrefs();
2353 cp->show(); 2369 cp->show();
2354 int w =cp->sizeHint().width() ; 2370 int w =cp->sizeHint().width() ;
2355 int h = cp->sizeHint().height() ; 2371 int h = cp->sizeHint().height() ;
2356 int dw = QApplication::desktop()->width(); 2372 int dw = QApplication::desktop()->width();
2357 int dh = QApplication::desktop()->height(); 2373 int dh = QApplication::desktop()->height();
2358 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2374 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2359 if ( !cp->exec() ) { 2375 if ( !cp->exec() ) {
2360 delete cp; 2376 delete cp;
2361 return; 2377 return;
2362 } 2378 }
2363 int count = 0; 2379 int count = 0;
2364 if ( cp->addCat() ) { 2380 if ( cp->addCat() ) {
2365 count = addCategories(); 2381 count = addCategories();
2366 if ( count ) { 2382 if ( count ) {
2367 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2383 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2368 writeSettings(); 2384 writeSettings();
2369 } else 2385 } else
2370 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2386 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2371 } else { 2387 } else {
2372 removeCategories(); 2388 removeCategories();
2373 updateView(); 2389 updateView();
2374 } 2390 }
2375 delete cp; 2391 delete cp;
2376} 2392}
2377 2393
2378void CalendarView::beamIncidence(Incidence * Inc) 2394void CalendarView::beamIncidence(Incidence * Inc)
2379{ 2395{
2380 QPtrList<Incidence> delSel ; 2396 QPtrList<Incidence> delSel ;
2381 delSel.append(Inc); 2397 delSel.append(Inc);
2382 beamIncidenceList( delSel ); 2398 beamIncidenceList( delSel );
2383} 2399}
2384void CalendarView::beamCalendar() 2400void CalendarView::beamCalendar()
2385{ 2401{
2386 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2402 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2387 //qDebug("beamCalendar() "); 2403 //qDebug("beamCalendar() ");
2388 beamIncidenceList( delSel ); 2404 beamIncidenceList( delSel );
2389} 2405}
2390void CalendarView::beamFilteredCalendar() 2406void CalendarView::beamFilteredCalendar()
2391{ 2407{
2392 QPtrList<Incidence> delSel = mCalendar->incidences(); 2408 QPtrList<Incidence> delSel = mCalendar->incidences();
2393 //qDebug("beamFilteredCalendar() "); 2409 //qDebug("beamFilteredCalendar() ");
2394 beamIncidenceList( delSel ); 2410 beamIncidenceList( delSel );
2395} 2411}
2396void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2412void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2397{ 2413{
2398 if ( beamDialog->exec () == QDialog::Rejected ) 2414 if ( beamDialog->exec () == QDialog::Rejected )
2399 return; 2415 return;
2400#ifdef DESKTOP_VERSION 2416#ifdef DESKTOP_VERSION
2401 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2417 QString fn = locateLocal( "tmp", "kopibeamfile" );
2402#else 2418#else
2403 QString fn = "/tmp/kopibeamfile"; 2419 QString fn = "/tmp/kopibeamfile";
2404#endif 2420#endif
2405 QString mes; 2421 QString mes;
2406 bool createbup = true; 2422 bool createbup = true;
2407 if ( createbup ) { 2423 if ( createbup ) {
2408 QString description = "\n"; 2424 QString description = "\n";
2409 CalendarLocal* cal = new CalendarLocal(); 2425 CalendarLocal* cal = new CalendarLocal();
2410 if ( beamDialog->beamLocal() ) 2426 if ( beamDialog->beamLocal() )
2411 cal->setLocalTime(); 2427 cal->setLocalTime();
2412 else 2428 else
2413 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2429 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2414 Incidence *incidence = delSel.first(); 2430 Incidence *incidence = delSel.first();
2415 bool addText = false; 2431 bool addText = false;
2416 if ( delSel.count() < 10 ) 2432 if ( delSel.count() < 10 )
2417 addText = true; 2433 addText = true;
2418 else { 2434 else {
2419 description.sprintf(i18n(" %d items?"),delSel.count() ); 2435 description.sprintf(i18n(" %d items?"),delSel.count() );
2420 } 2436 }
2421 while ( incidence ) { 2437 while ( incidence ) {
2422 Incidence *in = incidence->clone(); 2438 Incidence *in = incidence->clone();
2423 if ( ! in->summary().isEmpty() ) { 2439 if ( ! in->summary().isEmpty() ) {
2424 in->setDescription(""); 2440 in->setDescription("");
2425 } else { 2441 } else {
2426 in->setSummary( in->description().left(20)); 2442 in->setSummary( in->description().left(20));
2427 in->setDescription(""); 2443 in->setDescription("");
2428 } 2444 }
2429 if ( addText ) 2445 if ( addText )
2430 description += in->summary() + "\n"; 2446 description += in->summary() + "\n";
2431 cal->addIncidence( in ); 2447 cal->addIncidence( in );
2432 incidence = delSel.next(); 2448 incidence = delSel.next();
2433 } 2449 }
2434 if ( beamDialog->beamVcal() ) { 2450 if ( beamDialog->beamVcal() ) {
2435 fn += ".vcs"; 2451 fn += ".vcs";
2436 FileStorage storage( cal, fn, new VCalFormat ); 2452 FileStorage storage( cal, fn, new VCalFormat );
2437 storage.save(); 2453 storage.save();
2438 } else { 2454 } else {
2439 fn += ".ics"; 2455 fn += ".ics";
2440 FileStorage storage( cal, fn, new ICalFormat( ) ); 2456 FileStorage storage( cal, fn, new ICalFormat( ) );
2441 storage.save(); 2457 storage.save();
2442 } 2458 }
2443 delete cal; 2459 delete cal;
2444 mes = i18n("KO/Pi: Ready for beaming"); 2460 mes = i18n("KO/Pi: Ready for beaming");
2445 topLevelWidget()->setCaption(mes); 2461 topLevelWidget()->setCaption(mes);
2446 KApplication::convert2latin1( fn ); 2462 KApplication::convert2latin1( fn );
2447#ifndef DESKTOP_VERSION 2463#ifndef DESKTOP_VERSION
2448 Ir *ir = new Ir( this ); 2464 Ir *ir = new Ir( this );
2449 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2465 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2450 ir->send( fn, description, "text/x-vCalendar" ); 2466 ir->send( fn, description, "text/x-vCalendar" );
2451#endif 2467#endif
2452 } 2468 }
2453} 2469}
2454void CalendarView::beamDone( Ir *ir ) 2470void CalendarView::beamDone( Ir *ir )
2455{ 2471{
2456#ifndef DESKTOP_VERSION 2472#ifndef DESKTOP_VERSION
2457 delete ir; 2473 delete ir;
2458#endif 2474#endif
2459 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2475 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2460 topLevelWidget()->raise(); 2476 topLevelWidget()->raise();
2461} 2477}
2462 2478
2463void CalendarView::moveIncidence(Incidence * inc ) 2479void CalendarView::moveIncidence(Incidence * inc )
2464{ 2480{
2465 if ( !inc ) return; 2481 if ( !inc ) return;
2466 // qDebug("showDatePickerForIncidence( ) "); 2482 // qDebug("showDatePickerForIncidence( ) ");
2467 if ( mDateFrame->isVisible() ) 2483 if ( mDateFrame->isVisible() )
2468 mDateFrame->hide(); 2484 mDateFrame->hide();
2469 else { 2485 else {
2470 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2486 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2471 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2487 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2472 int dw = QApplication::desktop()->width(); 2488 int dw = QApplication::desktop()->width();
2473 int dh = QApplication::desktop()->height(); 2489 int dh = QApplication::desktop()->height();
2474 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2490 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2475 mDateFrame->show(); 2491 mDateFrame->show();
2476 } 2492 }
2477 mDatePickerMode = 2; 2493 mDatePickerMode = 2;
2478 mMoveIncidence = inc ; 2494 mMoveIncidence = inc ;
2479 QDate da; 2495 QDate da;
2480 if ( mMoveIncidence->type() == "Todo" ) { 2496 if ( mMoveIncidence->type() == "Todo" ) {
2481 Todo * to = (Todo *) mMoveIncidence; 2497 Todo * to = (Todo *) mMoveIncidence;
2482 if ( to->hasDueDate() ) 2498 if ( to->hasDueDate() )
2483 da = to->dtDue().date(); 2499 da = to->dtDue().date();
2484 else 2500 else
2485 da = QDate::currentDate(); 2501 da = QDate::currentDate();
2486 } else { 2502 } else {
2487 da = mMoveIncidence->dtStart().date(); 2503 da = mMoveIncidence->dtStart().date();
2488 } 2504 }
2489 //PENDING set date for recurring incidence to date of recurrence 2505 //PENDING set date for recurring incidence to date of recurrence
2490 //mMoveIncidenceOldDate; 2506 //mMoveIncidenceOldDate;
2491 mDatePicker->setDate( da ); 2507 mDatePicker->setDate( da );
2492} 2508}
2493void CalendarView::showDatePicker( ) 2509void CalendarView::showDatePicker( )
2494{ 2510{
2495 //qDebug("CalendarView::showDatePicker( ) "); 2511 //qDebug("CalendarView::showDatePicker( ) ");
2496 if ( mDateFrame->isVisible() ) 2512 if ( mDateFrame->isVisible() )
2497 mDateFrame->hide(); 2513 mDateFrame->hide();
2498 else { 2514 else {
2499 int w =mDatePicker->sizeHint().width() ; 2515 int w =mDatePicker->sizeHint().width() ;
2500 int h = mDatePicker->sizeHint().height() ; 2516 int h = mDatePicker->sizeHint().height() ;
2501 int dw = QApplication::desktop()->width(); 2517 int dw = QApplication::desktop()->width();
2502 int dh = QApplication::desktop()->height(); 2518 int dh = QApplication::desktop()->height();
2503 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2519 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2504 mDateFrame->show(); 2520 mDateFrame->show();
2505 } 2521 }
2506 mDatePickerMode = 1; 2522 mDatePickerMode = 1;
2507 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2523 mDatePicker->setDate( mNavigator->selectedDates().first() );
2508} 2524}
2509 2525
2510void CalendarView::showEventEditor() 2526void CalendarView::showEventEditor()
2511{ 2527{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 6ea8287..8d7ff36 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,375 +1,377 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45#include <ksyncmanager.h> 45#include <ksyncmanager.h>
46 46
47class QWidgetStack; 47class QWidgetStack;
48class QSplitter; 48class QSplitter;
49 49
50class CalPrinter; 50class CalPrinter;
51class KOFilterView; 51class KOFilterView;
52class KOViewManager; 52class KOViewManager;
53class KODialogManager; 53class KODialogManager;
54class KOTodoView; 54class KOTodoView;
55class KDateNavigator; 55class KDateNavigator;
56class DateNavigator; 56class DateNavigator;
57class KOIncidenceEditor; 57class KOIncidenceEditor;
58class KDatePicker; 58class KDatePicker;
59class ResourceView; 59class ResourceView;
60class NavigatorBar; 60class NavigatorBar;
61class KOEventEditor; 61class KOEventEditor;
62class KOTodoEditor ; 62class KOTodoEditor ;
63class KOEventViewerDialog; 63class KOEventViewerDialog;
64class KOBeamPrefs; 64class KOBeamPrefs;
65class KSyncProfile; 65class KSyncProfile;
66class AlarmDialog; 66class AlarmDialog;
67class KCal::Attendee; 67class KCal::Attendee;
68 68
69namespace KCal { class FileStorage; } 69namespace KCal { class FileStorage; }
70 70
71using namespace KCal; 71using namespace KCal;
72 72
73/** 73/**
74 This is the main calendar widget. It provides the different vies on t he 74 This is the main calendar widget. It provides the different vies on t he
75 calendar data as well as the date navigator. It also handles synchronisation 75 calendar data as well as the date navigator. It also handles synchronisation
76 of the different views and controls the different dialogs like preferences, 76 of the different views and controls the different dialogs like preferences,
77 event editor, search dialog etc. 77 event editor, search dialog etc.
78 78
79 @short main calendar view widget 79 @short main calendar view widget
80 @author Cornelius Schumacher 80 @author Cornelius Schumacher
81*/ 81*/
82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
83{ 83{
84 Q_OBJECT 84 Q_OBJECT
85 public: 85 public:
86 /** 86 /**
87 Constructs a new calendar view widget. 87 Constructs a new calendar view widget.
88 88
89 @param calendar calendar document 89 @param calendar calendar document
90 @param parent parent window 90 @param parent parent window
91 @param name Qt internal widget object name 91 @param name Qt internal widget object name
92 */ 92 */
93 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 93 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 CalendarView( Calendar *calendar, QWidget *parent = 0, 95 CalendarView( Calendar *calendar, QWidget *parent = 0,
96 const char *name = 0 ); 96 const char *name = 0 );
97 virtual ~CalendarView(); 97 virtual ~CalendarView();
98 98
99 Calendar *calendar() { return mCalendar; } 99 Calendar *calendar() { return mCalendar; }
100 100
101 KOViewManager *viewManager(); 101 KOViewManager *viewManager();
102 KODialogManager *dialogManager(); 102 KODialogManager *dialogManager();
103 103
104 QDate startDate(); 104 QDate startDate();
105 QDate endDate(); 105 QDate endDate();
106 106
107 QWidgetStack *viewStack(); 107 QWidgetStack *viewStack();
108 QWidget *leftFrame(); 108 QWidget *leftFrame();
109 NavigatorBar *navigatorBar(); 109 NavigatorBar *navigatorBar();
110 110
111 DateNavigator *dateNavigator(); 111 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 112 KDateNavigator *dateNavigatorWidget();
113 113
114 void addView(KOrg::BaseView *); 114 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 115 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 116 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 117 Incidence *currentSelection();
118 118
119 signals: 119 signals:
120 void save ();
121 void saveStopTimer ();
120 void tempDisableBR(bool); 122 void tempDisableBR(bool);
121 /** This todo has been modified */ 123 /** This todo has been modified */
122 void todoModified(Todo *, int); 124 void todoModified(Todo *, int);
123 125
124 /** when change is made to options dialog, the topwidget will catch this 126 /** when change is made to options dialog, the topwidget will catch this
125 * and emit this signal which notifies all widgets which have registered 127 * and emit this signal which notifies all widgets which have registered
126 * for notification to update their settings. */ 128 * for notification to update their settings. */
127 void configChanged(); 129 void configChanged();
128 /** emitted when the topwidget is closing down, so that any attached 130 /** emitted when the topwidget is closing down, so that any attached
129 child windows can also close. */ 131 child windows can also close. */
130 void closingDown(); 132 void closingDown();
131 /** emitted right before we die */ 133 /** emitted right before we die */
132 void closed(QWidget *); 134 void closed(QWidget *);
133 135
134 /** Emitted when state of modified flag changes */ 136 /** Emitted when state of modified flag changes */
135 void modifiedChanged(bool); 137 void modifiedChanged(bool);
136 void signalmodified(); 138 void signalmodified();
137 139
138 /** Emitted when state of read-only flag changes */ 140 /** Emitted when state of read-only flag changes */
139 void readOnlyChanged(bool); 141 void readOnlyChanged(bool);
140 142
141 /** Emitted when the unit of navigation changes */ 143 /** Emitted when the unit of navigation changes */
142 void changeNavStringPrev(const QString &); 144 void changeNavStringPrev(const QString &);
143 void changeNavStringNext(const QString &); 145 void changeNavStringNext(const QString &);
144 146
145 /** Emitted when state of events selection has changed and user is organizer*/ 147 /** Emitted when state of events selection has changed and user is organizer*/
146 void organizerEventsSelected(bool); 148 void organizerEventsSelected(bool);
147 /** Emitted when state of events selection has changed and user is attendee*/ 149 /** Emitted when state of events selection has changed and user is attendee*/
148 void groupEventsSelected(bool); 150 void groupEventsSelected(bool);
149 /** 151 /**
150 Emitted when an incidence gets selected. If the selection is cleared the 152 Emitted when an incidence gets selected. If the selection is cleared the
151 signal is emitted with 0 as argument. 153 signal is emitted with 0 as argument.
152 */ 154 */
153 void incidenceSelected( Incidence * ); 155 void incidenceSelected( Incidence * );
154 /** Emitted, when a todoitem is selected or deselected. */ 156 /** Emitted, when a todoitem is selected or deselected. */
155 void todoSelected( bool ); 157 void todoSelected( bool );
156 158
157 /** 159 /**
158 Emitted, when clipboard content changes. Parameter indicates if paste 160 Emitted, when clipboard content changes. Parameter indicates if paste
159 is possible or not. 161 is possible or not.
160 */ 162 */
161 void pasteEnabled(bool); 163 void pasteEnabled(bool);
162 164
163 /** Emitted, when the number of incoming messages has changed. */ 165 /** Emitted, when the number of incoming messages has changed. */
164 void numIncomingChanged(int); 166 void numIncomingChanged(int);
165 167
166 /** Emitted, when the number of outgoing messages has changed. */ 168 /** Emitted, when the number of outgoing messages has changed. */
167 void numOutgoingChanged(int); 169 void numOutgoingChanged(int);
168 170
169 /** Send status message, which can e.g. be displayed in the status bar. */ 171 /** Send status message, which can e.g. be displayed in the status bar. */
170 void statusMessage(const QString &); 172 void statusMessage(const QString &);
171 173
172 void calendarViewExpanded( bool ); 174 void calendarViewExpanded( bool );
173 void updateSearchDialog(); 175 void updateSearchDialog();
174 176
175 177
176 public slots: 178 public slots:
177 void showNavigatorBar(bool); 179 void showNavigatorBar(bool);
178 void showOpenError(); 180 void showOpenError();
179 void watchSavedFile(); 181 void watchSavedFile();
180 void recheckTimerAlarm(); 182 void recheckTimerAlarm();
181 void checkNextTimerAlarm(); 183 void checkNextTimerAlarm();
182 void addAlarm(const QDateTime &qdt, const QString &noti ); 184 void addAlarm(const QDateTime &qdt, const QString &noti );
183 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 185 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
184 void removeAlarm(const QDateTime &qdt, const QString &noti ); 186 void removeAlarm(const QDateTime &qdt, const QString &noti );
185 187
186 /** options dialog made a changed to the configuration. we catch this 188 /** options dialog made a changed to the configuration. we catch this
187 * and notify all widgets which need to update their configuration. */ 189 * and notify all widgets which need to update their configuration. */
188 void updateConfig(); 190 void updateConfig();
189 191
190 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 192 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
191 const QStringList& anniversaryList, const QStringList& realNameList, 193 const QStringList& anniversaryList, const QStringList& realNameList,
192 const QStringList& emailList, const QStringList& assembledNameList, 194 const QStringList& emailList, const QStringList& assembledNameList,
193 const QStringList& uidList); 195 const QStringList& uidList);
194 196
195 /** 197 /**
196 Load calendar from file \a filename. If \a merge is true, load 198 Load calendar from file \a filename. If \a merge is true, load
197 calendar into existing one, if it is false, clear calendar, before 199 calendar into existing one, if it is false, clear calendar, before
198 loading. Return true, if calendar could be successfully loaded. 200 loading. Return true, if calendar could be successfully loaded.
199 */ 201 */
200 bool openCalendar(QString filename, bool merge=false); 202 bool openCalendar(QString filename, bool merge=false);
201 bool syncCalendar(QString filename,int mode = 0 ); 203 bool syncCalendar(QString filename,int mode = 0 );
202 204
203 /** 205 /**
204 Save calendar data to file. Return true if calendar could be 206 Save calendar data to file. Return true if calendar could be
205 successfully saved. 207 successfully saved.
206 */ 208 */
207 bool saveCalendar(QString filename); 209 bool saveCalendar(QString filename);
208 210
209 /** 211 /**
210 Close calendar. Clear calendar data and reset views to display an empty 212 Close calendar. Clear calendar data and reset views to display an empty
211 calendar. 213 calendar.
212 */ 214 */
213 void closeCalendar(); 215 void closeCalendar();
214 216
215 /** Archive old events of calendar */ 217 /** Archive old events of calendar */
216 void archiveCalendar(); 218 void archiveCalendar();
217 219
218 void showIncidence(); 220 void showIncidence();
219 void editIncidence(); 221 void editIncidence();
220 void editIncidenceDescription(); 222 void editIncidenceDescription();
221 void deleteIncidence(); 223 void deleteIncidence();
222 void cloneIncidence(); 224 void cloneIncidence();
223 void moveIncidence(); 225 void moveIncidence();
224 void beamIncidence(); 226 void beamIncidence();
225 void toggleCancelIncidence(); 227 void toggleCancelIncidence();
226 228
227 /** create an editeventwin with supplied date/time, and if bool is true, 229 /** create an editeventwin with supplied date/time, and if bool is true,
228 * make the event take all day. */ 230 * make the event take all day. */
229 void newEvent(QDateTime, QDateTime, bool allDay ); 231 void newEvent(QDateTime, QDateTime, bool allDay );
230 void newEvent(QDateTime, QDateTime); 232 void newEvent(QDateTime, QDateTime);
231 void newEvent(QDateTime fh); 233 void newEvent(QDateTime fh);
232 void newEvent(QDate dt); 234 void newEvent(QDate dt);
233 /** create new event without having a date hint. Takes current date as 235 /** create new event without having a date hint. Takes current date as
234 default hint. */ 236 default hint. */
235 void newEvent(); 237 void newEvent();
236 void newFloatingEvent(); 238 void newFloatingEvent();
237 239
238 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 240 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
239 void showIncidence(Incidence *); 241 void showIncidence(Incidence *);
240 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 242 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
241 void editIncidence(Incidence *); 243 void editIncidence(Incidence *);
242 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 244 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
243 void deleteIncidence(Incidence *); 245 void deleteIncidence(Incidence *);
244 void cloneIncidence(Incidence *); 246 void cloneIncidence(Incidence *);
245 void cancelIncidence(Incidence *); 247 void cancelIncidence(Incidence *);
246 /** Create an editor for the supplied event. */ 248 /** Create an editor for the supplied event. */
247 void editEvent(Event *); 249 void editEvent(Event *);
248 /** Delete the supplied event. */ 250 /** Delete the supplied event. */
249 void deleteEvent(Event *); 251 void deleteEvent(Event *);
250 /** Delete the event with the given unique ID. Returns false, if event wasn't 252 /** Delete the event with the given unique ID. Returns false, if event wasn't
251 found. */ 253 found. */
252 bool deleteEvent(const QString &uid); 254 bool deleteEvent(const QString &uid);
253 /** Create a read-only viewer dialog for the supplied event. */ 255 /** Create a read-only viewer dialog for the supplied event. */
254 void showEvent(Event *); 256 void showEvent(Event *);
255 257
256 void editJournal(Journal *); 258 void editJournal(Journal *);
257 void showJournal(Journal *); 259 void showJournal(Journal *);
258 void deleteJournal(Journal *); 260 void deleteJournal(Journal *);
259 /** Create an editor dialog for a todo */ 261 /** Create an editor dialog for a todo */
260 void editTodo(Todo *); 262 void editTodo(Todo *);
261 /** Create a read-only viewer dialog for the supplied todo */ 263 /** Create a read-only viewer dialog for the supplied todo */
262 void showTodo(Todo *); 264 void showTodo(Todo *);
263 /** create new todo */ 265 /** create new todo */
264 void newTodo(); 266 void newTodo();
265 void newTodoDateTime(QDateTime, bool allday); 267 void newTodoDateTime(QDateTime, bool allday);
266 /** create new todo with a parent todo */ 268 /** create new todo with a parent todo */
267 void newSubTodo(); 269 void newSubTodo();
268 /** create new todo with a parent todo */ 270 /** create new todo with a parent todo */
269 void newSubTodo(Todo *); 271 void newSubTodo(Todo *);
270 /** Delete todo */ 272 /** Delete todo */
271 void deleteTodo(Todo *); 273 void deleteTodo(Todo *);
272 274
273 275
274 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 276 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
275 * emitted as result. */ 277 * emitted as result. */
276 void checkClipboard(); 278 void checkClipboard();
277 279
278 /** using the KConfig associated with the kapp variable, read in the 280 /** using the KConfig associated with the kapp variable, read in the
279 * settings from the config file. 281 * settings from the config file.
280 */ 282 */
281 void readSettings(); 283 void readSettings();
282 284
283 /** write current state to config file. */ 285 /** write current state to config file. */
284 void writeSettings(); 286 void writeSettings();
285 287
286 /** read settings for calendar filters */ 288 /** read settings for calendar filters */
287 void readFilterSettings(KConfig *config); 289 void readFilterSettings(KConfig *config);
288 290
289 /** write settings for calendar filters */ 291 /** write settings for calendar filters */
290 void writeFilterSettings(KConfig *config); 292 void writeFilterSettings(KConfig *config);
291 293
292 /** passes on the message that an event has changed to the currently 294 /** passes on the message that an event has changed to the currently
293 * activated view so that it can make appropriate display changes. */ 295 * activated view so that it can make appropriate display changes. */
294 void changeEventDisplay(Event *, int); 296 void changeEventDisplay(Event *, int);
295 void changeIncidenceDisplay(Incidence *, int); 297 void changeIncidenceDisplay(Incidence *, int);
296 void changeTodoDisplay(Todo *, int); 298 void changeTodoDisplay(Todo *, int);
297 299
298 void eventAdded(Event *); 300 void eventAdded(Event *);
299 void eventChanged(Event *); 301 void eventChanged(Event *);
300 void eventToBeDeleted(Event *); 302 void eventToBeDeleted(Event *);
301 void eventDeleted(); 303 void eventDeleted();
302 304
303 void todoAdded(Todo *); 305 void todoAdded(Todo *);
304 void todoChanged(Todo *); 306 void todoChanged(Todo *);
305 void todoToBeDeleted(Todo *); 307 void todoToBeDeleted(Todo *);
306 void todoDeleted(); 308 void todoDeleted();
307 309
308 void updateView(const QDate &start, const QDate &end); 310 void updateView(const QDate &start, const QDate &end);
309 void updateView(); 311 void updateView();
310 312
311 /** Full update of visible todo views */ 313 /** Full update of visible todo views */
312 void updateTodoViews(); 314 void updateTodoViews();
313 315
314 void updateUnmanagedViews(); 316 void updateUnmanagedViews();
315 317
316 /** cut the current appointment to the clipboard */ 318 /** cut the current appointment to the clipboard */
317 void edit_cut(); 319 void edit_cut();
318 320
319 /** copy the current appointment(s) to the clipboard */ 321 /** copy the current appointment(s) to the clipboard */
320 void edit_copy(); 322 void edit_copy();
321 323
322 /** paste the current vobject(s) in the clipboard buffer into calendar */ 324 /** paste the current vobject(s) in the clipboard buffer into calendar */
323 void edit_paste(); 325 void edit_paste();
324 326
325 /** edit viewing and configuration options. */ 327 /** edit viewing and configuration options. */
326 void edit_options(); 328 void edit_options();
327 /** 329 /**
328 Functions for printing, previewing a print, and setting up printing 330 Functions for printing, previewing a print, and setting up printing
329 parameters. 331 parameters.
330 */ 332 */
331 void print(); 333 void print();
332 void printSetup(); 334 void printSetup();
333 void printPreview(); 335 void printPreview();
334 336
335 /** Export as iCalendar file */ 337 /** Export as iCalendar file */
336 void exportICalendar(); 338 void exportICalendar();
337 339
338 /** Export as vCalendar file */ 340 /** Export as vCalendar file */
339 bool exportVCalendar( QString fn); 341 bool exportVCalendar( QString fn);
340 342
341 /** pop up a dialog to show an existing appointment. */ 343 /** pop up a dialog to show an existing appointment. */
342 void appointment_show(); 344 void appointment_show();
343 /** 345 /**
344 * pop up an Appointment Dialog to edit an existing appointment.Get 346 * pop up an Appointment Dialog to edit an existing appointment.Get
345 * information on the appointment from the list of unique IDs that is 347 * information on the appointment from the list of unique IDs that is
346 * currently in the View, called currIds. 348 * currently in the View, called currIds.
347 */ 349 */
348 void appointment_edit(); 350 void appointment_edit();
349 /** 351 /**
350 * pop up dialog confirming deletion of currently selected event in the 352 * pop up dialog confirming deletion of currently selected event in the
351 * View. 353 * View.
352 */ 354 */
353 void appointment_delete(); 355 void appointment_delete();
354 356
355 /** mails the currently selected event to a particular user as a vCalendar 357 /** mails the currently selected event to a particular user as a vCalendar
356 attachment. */ 358 attachment. */
357 void action_mail(); 359 void action_mail();
358 360
359 /* frees a subtodo from it's relation */ 361 /* frees a subtodo from it's relation */
360 void todo_unsub( Todo * ); 362 void todo_unsub( Todo * );
361 void todo_resub( Todo * parent, Todo * sub ); 363 void todo_resub( Todo * parent, Todo * sub );
362 364
363 /** Take ownership of selected event. */ 365 /** Take ownership of selected event. */
364 void takeOverEvent(); 366 void takeOverEvent();
365 367
366 /** Take ownership of all events in calendar. */ 368 /** Take ownership of all events in calendar. */
367 void takeOverCalendar(); 369 void takeOverCalendar();
368 370
369 /** query whether or not the calendar is "dirty". */ 371 /** query whether or not the calendar is "dirty". */
370 bool isModified(); 372 bool isModified();
371 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 373 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
372 void setModified(bool modified=true); 374 void setModified(bool modified=true);
373 375
374 /** query if the calendar is read-only. */ 376 /** query if the calendar is read-only. */
375 bool isReadOnly(); 377 bool isReadOnly();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 3feb4ab..a2c20a8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -6,512 +6,514 @@
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
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 "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75class KOex2phonePrefs : public QDialog 75class KOex2phonePrefs : public QDialog
76{ 76{
77 public: 77 public:
78 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 78 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
79 QDialog( parent, name, true ) 79 QDialog( parent, name, true )
80 { 80 {
81 setCaption( i18n("Export to phone options") ); 81 setCaption( i18n("Export to phone options") );
82 QVBoxLayout* lay = new QVBoxLayout( this ); 82 QVBoxLayout* lay = new QVBoxLayout( this );
83 lay->setSpacing( 3 ); 83 lay->setSpacing( 3 );
84 lay->setMargin( 3 ); 84 lay->setMargin( 3 );
85 QLabel *lab; 85 QLabel *lab;
86 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 86 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
87 lab->setAlignment (AlignHCenter ); 87 lab->setAlignment (AlignHCenter );
88 QHBox* temphb; 88 QHBox* temphb;
89 temphb = new QHBox( this ); 89 temphb = new QHBox( this );
90 new QLabel( i18n("I/O device: "), temphb ); 90 new QLabel( i18n("I/O device: "), temphb );
91 mPhoneDevice = new QLineEdit( temphb); 91 mPhoneDevice = new QLineEdit( temphb);
92 lay->addWidget( temphb ); 92 lay->addWidget( temphb );
93 temphb = new QHBox( this ); 93 temphb = new QHBox( this );
94 new QLabel( i18n("Connection: "), temphb ); 94 new QLabel( i18n("Connection: "), temphb );
95 mPhoneConnection = new QLineEdit( temphb); 95 mPhoneConnection = new QLineEdit( temphb);
96 lay->addWidget( temphb ); 96 lay->addWidget( temphb );
97 temphb = new QHBox( this ); 97 temphb = new QHBox( this );
98 new QLabel( i18n("Model(opt.): "), temphb ); 98 new QLabel( i18n("Model(opt.): "), temphb );
99 mPhoneModel = new QLineEdit( temphb); 99 mPhoneModel = new QLineEdit( temphb);
100 lay->addWidget( temphb ); 100 lay->addWidget( temphb );
101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
102 mWriteBackFuture->setChecked( true ); 102 mWriteBackFuture->setChecked( true );
103 lay->addWidget( mWriteBackFuture ); 103 lay->addWidget( mWriteBackFuture );
104 temphb = new QHBox( this ); 104 temphb = new QHBox( this );
105 new QLabel( i18n("Max. weeks in future: ") , temphb ); 105 new QLabel( i18n("Max. weeks in future: ") , temphb );
106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
107 mWriteBackFutureWeeks->setValue( 8 ); 107 mWriteBackFutureWeeks->setValue( 8 );
108 lay->addWidget( temphb ); 108 lay->addWidget( temphb );
109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
110 lab->setAlignment (AlignHCenter ); 110 lab->setAlignment (AlignHCenter );
111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
112 lay->addWidget( ok ); 112 lay->addWidget( ok );
113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
114 lay->addWidget( cancel ); 114 lay->addWidget( cancel );
115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
117 resize( 220, 240 ); 117 resize( 220, 240 );
118 qApp->processEvents(); 118 qApp->processEvents();
119 int dw = QApplication::desktop()->width(); 119 int dw = QApplication::desktop()->width();
120 int dh = QApplication::desktop()->height(); 120 int dh = QApplication::desktop()->height();
121 move( (dw-width())/2, (dh - height() )/2 ); 121 move( (dw-width())/2, (dh - height() )/2 );
122 } 122 }
123 123
124public: 124public:
125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
126 QCheckBox* mWriteBackFuture; 126 QCheckBox* mWriteBackFuture;
127 QSpinBox* mWriteBackFutureWeeks; 127 QSpinBox* mWriteBackFutureWeeks;
128}; 128};
129 129
130int globalFlagBlockStartup; 130int globalFlagBlockStartup;
131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
132 QMainWindow( parent, name ) 132 QMainWindow( parent, name )
133{ 133{
134 134
135#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
136 setFont( QFont("Arial"), 14 ); 136 setFont( QFont("Arial"), 14 );
137#endif 137#endif
138 mClosed = false; 138 mClosed = false;
139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
140 QString confFile = locateLocal("config","korganizerrc"); 140 QString confFile = locateLocal("config","korganizerrc");
141 QFileInfo finf ( confFile ); 141 QFileInfo finf ( confFile );
142 bool showWarning = !finf.exists(); 142 bool showWarning = !finf.exists();
143 setIcon(SmallIcon( "ko24" ) ); 143 setIcon(SmallIcon( "ko24" ) );
144 mBlockAtStartup = true; 144 mBlockAtStartup = true;
145 mFlagKeyPressed = false; 145 mFlagKeyPressed = false;
146 setCaption("KOrganizer/Pi"); 146 setCaption("KOrganizer/Pi");
147 KOPrefs *p = KOPrefs::instance(); 147 KOPrefs *p = KOPrefs::instance();
148 KPimGlobalPrefs::instance()->setGlobalConfig(); 148 KPimGlobalPrefs::instance()->setGlobalConfig();
149 if ( p->mHourSize > 18 ) 149 if ( p->mHourSize > 18 )
150 p->mHourSize = 18; 150 p->mHourSize = 18;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 mCalendarModifiedFlag = false; 169 mCalendarModifiedFlag = false;
170 170
171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
172 splash->setAlignment ( AlignCenter ); 172 splash->setAlignment ( AlignCenter );
173 setCentralWidget( splash ); 173 setCentralWidget( splash );
174#ifndef DESKTOP_VERSION 174#ifndef DESKTOP_VERSION
175 showMaximized(); 175 showMaximized();
176#endif 176#endif
177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
178 setDefaultPreferences(); 178 setDefaultPreferences();
179 mCalendar = new CalendarLocal(); 179 mCalendar = new CalendarLocal();
180 mView = new CalendarView( mCalendar, this,"mCalendar " ); 180 mView = new CalendarView( mCalendar, this,"mCalendar " );
181 mView->hide(); 181 mView->hide();
182 //mView->resize(splash->size() ); 182 //mView->resize(splash->size() );
183 initActions(); 183 initActions();
184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
185 mSyncManager->setBlockSave(false); 185 mSyncManager->setBlockSave(false);
186 mView->setSyncManager(mSyncManager); 186 mView->setSyncManager(mSyncManager);
187#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
188 iconToolBar->show(); 188 iconToolBar->show();
189 qApp->processEvents(); 189 qApp->processEvents();
190#endif 190#endif
191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
192 int vh = height() ; 192 int vh = height() ;
193 int vw = width(); 193 int vw = width();
194 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 194 //qDebug("Toolbar hei %d ",iconToolBar->height() );
195 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 195 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
196 vh -= iconToolBar->height(); 196 vh -= iconToolBar->height();
197 } else { 197 } else {
198 vw -= iconToolBar->height(); 198 vw -= iconToolBar->height();
199 } 199 }
200 //mView->setMaximumSize( splash->size() ); 200 //mView->setMaximumSize( splash->size() );
201 //mView->resize( splash->size() ); 201 //mView->resize( splash->size() );
202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
203 mView->readSettings(); 203 mView->readSettings();
204 bool newFile = false; 204 bool newFile = false;
205 if( !QFile::exists( defaultFileName() ) ) { 205 if( !QFile::exists( defaultFileName() ) ) {
206 QFileInfo finfo ( defaultFileName() ); 206 QFileInfo finfo ( defaultFileName() );
207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
208 qDebug("oldfile %s ", oldFile.latin1()); 208 qDebug("oldfile %s ", oldFile.latin1());
209 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"; 209 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";
210 finfo.setFile( oldFile ); 210 finfo.setFile( oldFile );
211 if (finfo.exists() ) { 211 if (finfo.exists() ) {
212 KMessageBox::information( this, message); 212 KMessageBox::information( this, message);
213 mView->openCalendar( oldFile ); 213 mView->openCalendar( oldFile );
214 qApp->processEvents(); 214 qApp->processEvents();
215 } else { 215 } else {
216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
217 finfo.setFile( oldFile ); 217 finfo.setFile( oldFile );
218 if (finfo.exists() ) { 218 if (finfo.exists() ) {
219 KMessageBox::information( this, message); 219 KMessageBox::information( this, message);
220 mView->openCalendar( oldFile ); 220 mView->openCalendar( oldFile );
221 qApp->processEvents(); 221 qApp->processEvents();
222 } 222 }
223 } 223 }
224 mView->saveCalendar( defaultFileName() ); 224 mView->saveCalendar( defaultFileName() );
225 newFile = true; 225 newFile = true;
226 } 226 }
227 227
228 QTime neededSaveTime = QDateTime::currentDateTime().time(); 228 QTime neededSaveTime = QDateTime::currentDateTime().time();
229 mView->openCalendar( defaultFileName() ); 229 mView->openCalendar( defaultFileName() );
230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
231 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 231 qDebug("KO: Calendar loading time: %d ms",msNeeded );
232 232
233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
234 KOPrefs::instance()->setCategoryDefaults(); 234 KOPrefs::instance()->setCategoryDefaults();
235 int count = mView->addCategories(); 235 int count = mView->addCategories();
236 } 236 }
237 processIncidenceSelection( 0 ); 237 processIncidenceSelection( 0 );
238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
239 SLOT( processIncidenceSelection( Incidence * ) ) ); 239 SLOT( processIncidenceSelection( Incidence * ) ) );
240 connect( mView, SIGNAL( modifiedChanged( bool ) ), 240 connect( mView, SIGNAL( modifiedChanged( bool ) ),
241 SLOT( slotModifiedChanged( bool ) ) ); 241 SLOT( slotModifiedChanged( bool ) ) );
242 242
243 243
244 connect( mView, SIGNAL( tempDisableBR(bool) ), 244 connect( mView, SIGNAL( tempDisableBR(bool) ),
245 SLOT( disableBR(bool) ) ); 245 SLOT( disableBR(bool) ) );
246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
247 mView->setModified( false ); 247 mView->setModified( false );
248 mBlockAtStartup = false; 248 mBlockAtStartup = false;
249 mView->setModified( false ); 249 mView->setModified( false );
250 setCentralWidget( mView ); 250 setCentralWidget( mView );
251 globalFlagBlockStartup = 0; 251 globalFlagBlockStartup = 0;
252 mView->show(); 252 mView->show();
253 delete splash; 253 delete splash;
254 if ( newFile ) 254 if ( newFile )
255 mView->updateConfig(); 255 mView->updateConfig();
256 // qApp->processEvents(); 256 // qApp->processEvents();
257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
258 //fillSyncMenu(); 258 //fillSyncMenu();
259 259
260 260
261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( defaultFileName()); 266 mSyncManager->setDefaultFileName( defaultFileName());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 268 mSyncManager->fillSyncMenu();
267 269
268 270
269 271
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 273 if ( showWarning ) {
272 KMessageBox::information( this, 274 KMessageBox::information( this,
273 "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"); 275 "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");
274 qApp->processEvents(); 276 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 277 mView->dialogManager()->showSyncOptions();
276 } 278 }
277 279
278 //US listen for result adressed from Ka/Pi 280 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 281#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 283#endif
282#ifndef DESKTOP_VERSION 284#ifndef DESKTOP_VERSION
283 infrared = 0; 285 infrared = 0;
284#endif 286#endif
285 287
286 mBRdisabled = false; 288 mBRdisabled = false;
287 //toggleBeamReceive(); 289 //toggleBeamReceive();
288} 290}
289MainWindow::~MainWindow() 291MainWindow::~MainWindow()
290{ 292{
291 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
292 //save toolbar location 294 //save toolbar location
293 delete mCalendar; 295 delete mCalendar;
294 delete mSyncManager; 296 delete mSyncManager;
295#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
296 if ( infrared ) 298 if ( infrared )
297 delete infrared; 299 delete infrared;
298#endif 300#endif
299 301
300 302
301} 303}
302 304
303void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
304{ 306{
305#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
306 if ( b ) { 308 if ( b ) {
307 if ( infrared ) { 309 if ( infrared ) {
308 toggleBeamReceive(); 310 toggleBeamReceive();
309 mBRdisabled = true; 311 mBRdisabled = true;
310 } 312 }
311 mBRdisabled = true; 313 mBRdisabled = true;
312 } else { 314 } else {
313 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
314 mBRdisabled = false; 316 mBRdisabled = false;
315 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
316 // toggleBeamReceive(); 318 // toggleBeamReceive();
317 } 319 }
318 } 320 }
319#endif 321#endif
320 322
321} 323}
322bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
323{ 325{
324#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
325 return ( infrared != 0 ); 327 return ( infrared != 0 );
326#endif 328#endif
327 return false; 329 return false;
328} 330}
329 331
330void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
331{ 333{
332 if ( mBRdisabled ) 334 if ( mBRdisabled )
333 return; 335 return;
334#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
335 if ( infrared ) { 337 if ( infrared ) {
336 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
337 delete infrared; 339 delete infrared;
338 infrared = 0; 340 infrared = 0;
339 brAction->setOn(false); 341 brAction->setOn(false);
340 return; 342 return;
341 } 343 }
342 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
343 brAction->setOn(true); 345 brAction->setOn(true);
344 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
345 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
346#endif 348#endif
347} 349}
348void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
349{ 351{
350#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
351 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
352 if ( mClosed ) 354 if ( mClosed )
353 mView->goToday(); 355 mView->goToday();
354#endif 356#endif
355 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
356 mClosed = false; 358 mClosed = false;
357} 359}
358void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
359{ 361{
360 362
361 363
362 364
363 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
364 saveOnClose(); 366 saveOnClose();
365 mClosed = true; 367 mClosed = true;
366 ce->accept(); 368 ce->accept();
367 return; 369 return;
368 370
369 } 371 }
370 372
371 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
372 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
373 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
374 0, 0 ) ) { 376 0, 0 ) ) {
375 case 0: 377 case 0:
376 saveOnClose(); 378 saveOnClose();
377 mClosed = true; 379 mClosed = true;
378 ce->accept(); 380 ce->accept();
379 break; 381 break;
380 case 1: 382 case 1:
381 ce->ignore(); 383 ce->ignore();
382 break; 384 break;
383 case 2: 385 case 2:
384 386
385 default: 387 default:
386 break; 388 break;
387 } 389 }
388 390
389 391
390} 392}
391 393
392void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
393{ 395{
394 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
395 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
396 //QString datamess; 398 //QString datamess;
397 //qDebug("message "); 399 //qDebug("message ");
398 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
399 401
400 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
401 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
402 QString fileName; 404 QString fileName;
403 stream >> fileName; 405 stream >> fileName;
404 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
405 showMaximized(); 407 showMaximized();
406 raise(); 408 raise();
407 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
408 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
409 return; 411 return;
410 } 412 }
411 413
412 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
413 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
414 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
415 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
416 showMaximized(); 418 showMaximized();
417 raise(); 419 raise();
418 return; 420 return;
419 421
420 } 422 }
421 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
422 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
423 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
424 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
425 //showMaximized(); 427 //showMaximized();
426 //raise(); 428 //raise();
427 hide(); 429 hide();
428 return; 430 return;
429 } 431 }
430 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
431 qDebug("newCountdown "); 433 qDebug("newCountdown ");
432 434
433 } 435 }
434 QString msg ; 436 QString msg ;
435 QString allmsg = cmsg; 437 QString allmsg = cmsg;
436 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
437 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
438 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
439 msg = allmsg; 441 msg = allmsg;
440 allmsg = ""; 442 allmsg = "";
441 } else{ 443 } else{
442 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
443 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
444 } 446 }
445 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
446 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
447 mView->newEvent(); 449 mView->newEvent();
448 } 450 }
449 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
450 mView->newTodo(); 452 mView->newTodo();
451 453
452 } 454 }
453 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
454 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
455 } 457 }
456 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
457 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
458 } 460 }
459 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
460 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
461 } 463 }
462 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
463 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
464 } 466 }
465 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
466 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
467 } 469 }
468 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
469 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
470 } 472 }
471 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
472 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
473 } 475 }
474 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
475 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
476 } 478 }
477 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
478 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
479 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
480 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
481 } 483 }
482 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
483 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
484 } 486 }
485 else if ( msg == "-showWNext" || msg == "nextView()" ) { 487 else if ( msg == "-showWNext" || msg == "nextView()" ) {
486 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
487 } 489 }
488 else if ( msg == "-showNextXView" ) { 490 else if ( msg == "-showNextXView" ) {
489 mView->viewManager()->showNextXView(); 491 mView->viewManager()->showNextXView();
490 } 492 }
491 493
492 494
493 } 495 }
494 496
495 showMaximized(); 497 showMaximized();
496 raise(); 498 raise();
497} 499}
498 500
499QPixmap MainWindow::loadPixmap( QString name ) 501QPixmap MainWindow::loadPixmap( QString name )
500{ 502{
501 return SmallIcon( name ); 503 return SmallIcon( name );
502 504
503} 505}
504void MainWindow::initActions() 506void MainWindow::initActions()
505{ 507{
506 //KOPrefs::instance()->mShowFullMenu 508 //KOPrefs::instance()->mShowFullMenu
507 iconToolBar->clear(); 509 iconToolBar->clear();
508 KOPrefs *p = KOPrefs::instance(); 510 KOPrefs *p = KOPrefs::instance();
509 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
510 512
511 QPopupMenu *viewMenu = new QPopupMenu( this ); 513 QPopupMenu *viewMenu = new QPopupMenu( this );
512 QPopupMenu *actionMenu = new QPopupMenu( this ); 514 QPopupMenu *actionMenu = new QPopupMenu( this );
513 QPopupMenu *importMenu = new QPopupMenu( this ); 515 QPopupMenu *importMenu = new QPopupMenu( this );
514 selectFilterMenu = new QPopupMenu( this ); 516 selectFilterMenu = new QPopupMenu( this );
515 selectFilterMenu->setCheckable( true ); 517 selectFilterMenu->setCheckable( true );
516 syncMenu = new QPopupMenu( this ); 518 syncMenu = new QPopupMenu( this );
517 configureAgendaMenu = new QPopupMenu( this ); 519 configureAgendaMenu = new QPopupMenu( this );
@@ -1194,543 +1196,554 @@ void MainWindow::synchowto()
1194void MainWindow::faq() 1196void MainWindow::faq()
1195{ 1197{
1196 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1198 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1197 1199
1198} 1200}
1199void MainWindow::whatsNew() 1201void MainWindow::whatsNew()
1200{ 1202{
1201 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1203 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1202 1204
1203} 1205}
1204void MainWindow::licence() 1206void MainWindow::licence()
1205{ 1207{
1206 KApplication::showLicence(); 1208 KApplication::showLicence();
1207 1209
1208} 1210}
1209void MainWindow::about() 1211void MainWindow::about()
1210{ 1212{
1211 QString version; 1213 QString version;
1212#include <../version> 1214#include <../version>
1213 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1215 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1214 i18n("KOrganizer/Platform-independent\n") + 1216 i18n("KOrganizer/Platform-independent\n") +
1215 "(KO/Pi) " + version + " - " + 1217 "(KO/Pi) " + version + " - " +
1216 1218
1217#ifdef DESKTOP_VERSION 1219#ifdef DESKTOP_VERSION
1218 i18n("Desktop Edition\n") + 1220 i18n("Desktop Edition\n") +
1219#else 1221#else
1220 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1222 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1221#endif 1223#endif
1222 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1224 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1223} 1225}
1224void MainWindow::keyBindings() 1226void MainWindow::keyBindings()
1225{ 1227{
1226 QString cap = i18n("KO/Pi Keys + Colors"); 1228 QString cap = i18n("KO/Pi Keys + Colors");
1227 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1229 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1228 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1230 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1229 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1231 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1230 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1232 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1231 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1233 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1232 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1234 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1233 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1235 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1234 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1236 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1235 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1237 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1236 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1238 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1237 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1239 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1238 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1240 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1239 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1241 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1240 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1242 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1241 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1243 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1242 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1244 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1243 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1245 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1244 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1246 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1245 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1247 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1246 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1248 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1247 i18n("<p><h3>In agenda view:</h3></p>\n") + 1249 i18n("<p><h3>In agenda view:</h3></p>\n") +
1248 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1250 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1249 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1251 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1250 i18n("<p><h3>In todo view:</h3></p>\n") + 1252 i18n("<p><h3>In todo view:</h3></p>\n") +
1251 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1253 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1252 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1254 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1253 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1255 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1254 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1256 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1255 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1257 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1256 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1258 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1257 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1259 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1258 i18n("<p><h3>In list view:</h3></p>\n") + 1260 i18n("<p><h3>In list view:</h3></p>\n") +
1259 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1261 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1260 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1262 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1261 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1263 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1262 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1264 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1263 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1265 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1264 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1266 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1265 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1267 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1266 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1268 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1267 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1269 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1268 i18n("<p><b>E</b>: Edit item</p>\n") + 1270 i18n("<p><b>E</b>: Edit item</p>\n") +
1269 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1271 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1270 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1272 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1271 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1273 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1272 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1274 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1273 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1275 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1274 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1276 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1275 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1277 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1276 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1278 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1277 i18n("<p><b>White</b>: Item readonly</p>\n"); 1279 i18n("<p><b>White</b>: Item readonly</p>\n");
1278 displayText( text, cap); 1280 displayText( text, cap);
1279} 1281}
1280void MainWindow::aboutAutoSaving() 1282void MainWindow::aboutAutoSaving()
1281{ 1283{
1282 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"); 1284 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");
1283 1285
1284 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1285 1287
1286} 1288}
1287void MainWindow::aboutKnownBugs() 1289void MainWindow::aboutKnownBugs()
1288{ 1290{
1289 QMessageBox* msg; 1291 QMessageBox* msg;
1290 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1291 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")+ 1293 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")+
1292 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1293 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1294 i18n("\nor report them in the bugtracker on\n") + 1296 i18n("\nor report them in the bugtracker on\n") +
1295 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1296 QMessageBox::NoIcon, 1298 QMessageBox::NoIcon,
1297 QMessageBox::Ok, 1299 QMessageBox::Ok,
1298 QMessageBox::NoButton, 1300 QMessageBox::NoButton,
1299 QMessageBox::NoButton); 1301 QMessageBox::NoButton);
1300 msg->exec(); 1302 msg->exec();
1301 delete msg; 1303 delete msg;
1302 1304
1303} 1305}
1304 1306
1305QString MainWindow::defaultFileName() 1307QString MainWindow::defaultFileName()
1306{ 1308{
1307 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1309 return locateLocal( "data", "korganizer/mycalendar.ics" );
1308} 1310}
1309QString MainWindow::syncFileName() 1311QString MainWindow::syncFileName()
1310{ 1312{
1311#ifdef DESKTOP_VERSION 1313#ifdef DESKTOP_VERSION
1312 return locateLocal( "tmp", "synccalendar.ics" ); 1314 return locateLocal( "tmp", "synccalendar.ics" );
1313#else 1315#else
1314 return QString( "/tmp/synccalendar.ics" ); 1316 return QString( "/tmp/synccalendar.ics" );
1315#endif 1317#endif
1316} 1318}
1317 1319
1318void MainWindow::processIncidenceSelection( Incidence *incidence ) 1320void MainWindow::processIncidenceSelection( Incidence *incidence )
1319{ 1321{
1320 if ( !incidence ) { 1322 if ( !incidence ) {
1321 enableIncidenceActions( false ); 1323 enableIncidenceActions( false );
1322 1324
1323 mNewSubTodoAction->setEnabled( false ); 1325 mNewSubTodoAction->setEnabled( false );
1324 setCaptionToDates(); 1326 setCaptionToDates();
1325 return; 1327 return;
1326 1328
1327 } 1329 }
1328 1330
1329 //KGlobal::locale()->formatDateTime(nextA, true); 1331 //KGlobal::locale()->formatDateTime(nextA, true);
1330 QString startString = ""; 1332 QString startString = "";
1331 if ( incidence->type() != "Todo" ) { 1333 if ( incidence->type() != "Todo" ) {
1332 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1333 if ( incidence->doesFloat() ) { 1335 if ( incidence->doesFloat() ) {
1334 startString += ": "+incidence->dtStartDateStr( true ); 1336 startString += ": "+incidence->dtStartDateStr( true );
1335 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1336 1338
1337 } else { 1339 } else {
1338 startString = ": "+incidence->dtStartStr(true); 1340 startString = ": "+incidence->dtStartStr(true);
1339 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1341 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1340 1342
1341 } 1343 }
1342 1344
1343 } else { 1345 } else {
1344 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1345 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1346 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1347 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1349 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1348 } 1350 }
1349 1351
1350 } 1352 }
1351 else 1353 else
1352 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1354 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1353 if ( !incidence->location().isEmpty() ) 1355 if ( !incidence->location().isEmpty() )
1354 startString += " (" +incidence->location()+")"; 1356 startString += " (" +incidence->location()+")";
1355 setCaption( incidence->summary()+startString); 1357 setCaption( incidence->summary()+startString);
1356 1358
1357 enableIncidenceActions( true ); 1359 enableIncidenceActions( true );
1358 1360
1359 if ( incidence->type() == "Event" ) { 1361 if ( incidence->type() == "Event" ) {
1360 mShowAction->setText( i18n("Show Event...") ); 1362 mShowAction->setText( i18n("Show Event...") );
1361 mEditAction->setText( i18n("Edit Event...") ); 1363 mEditAction->setText( i18n("Edit Event...") );
1362 mDeleteAction->setText( i18n("Delete Event...") ); 1364 mDeleteAction->setText( i18n("Delete Event...") );
1363 1365
1364 mNewSubTodoAction->setEnabled( false ); 1366 mNewSubTodoAction->setEnabled( false );
1365 } else if ( incidence->type() == "Todo" ) { 1367 } else if ( incidence->type() == "Todo" ) {
1366 mShowAction->setText( i18n("Show Todo...") ); 1368 mShowAction->setText( i18n("Show Todo...") );
1367 mEditAction->setText( i18n("Edit Todo...") ); 1369 mEditAction->setText( i18n("Edit Todo...") );
1368 mDeleteAction->setText( i18n("Delete Todo...") ); 1370 mDeleteAction->setText( i18n("Delete Todo...") );
1369 1371
1370 mNewSubTodoAction->setEnabled( true ); 1372 mNewSubTodoAction->setEnabled( true );
1371 } else { 1373 } else {
1372 mShowAction->setText( i18n("Show...") ); 1374 mShowAction->setText( i18n("Show...") );
1373 mShowAction->setText( i18n("Edit...") ); 1375 mShowAction->setText( i18n("Edit...") );
1374 mShowAction->setText( i18n("Delete...") ); 1376 mShowAction->setText( i18n("Delete...") );
1375 1377
1376 mNewSubTodoAction->setEnabled( false ); 1378 mNewSubTodoAction->setEnabled( false );
1377 } 1379 }
1378} 1380}
1379 1381
1380void MainWindow::enableIncidenceActions( bool enabled ) 1382void MainWindow::enableIncidenceActions( bool enabled )
1381{ 1383{
1382 mShowAction->setEnabled( enabled ); 1384 mShowAction->setEnabled( enabled );
1383 mEditAction->setEnabled( enabled ); 1385 mEditAction->setEnabled( enabled );
1384 mDeleteAction->setEnabled( enabled ); 1386 mDeleteAction->setEnabled( enabled );
1385 1387
1386 mCloneAction->setEnabled( enabled ); 1388 mCloneAction->setEnabled( enabled );
1387 mMoveAction->setEnabled( enabled ); 1389 mMoveAction->setEnabled( enabled );
1388 mBeamAction->setEnabled( enabled ); 1390 mBeamAction->setEnabled( enabled );
1389 mCancelAction->setEnabled( enabled ); 1391 mCancelAction->setEnabled( enabled );
1390} 1392}
1391 1393
1392void MainWindow::importOL() 1394void MainWindow::importOL()
1393{ 1395{
1394#ifdef _OL_IMPORT_ 1396#ifdef _OL_IMPORT_
1395 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1397 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1396 id->exec(); 1398 id->exec();
1397 delete id; 1399 delete id;
1398 mView->updateView(); 1400 mView->updateView();
1399#endif 1401#endif
1400} 1402}
1401void MainWindow::importBday() 1403void MainWindow::importBday()
1402{ 1404{
1403 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1405 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1404 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1406 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1405 i18n("Import!"), i18n("Cancel"), 0, 1407 i18n("Import!"), i18n("Cancel"), 0,
1406 0, 1 ); 1408 0, 1 );
1407 if ( result == 0 ) { 1409 if ( result == 0 ) {
1408 mView->importBday(); 1410 mView->importBday();
1409 1411
1410 } 1412 }
1411 1413
1412 1414
1413} 1415}
1414void MainWindow::importQtopia() 1416void MainWindow::importQtopia()
1415{ 1417{
1416#ifndef DESKTOP_VERSION 1418#ifndef DESKTOP_VERSION
1417 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1419 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1418 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"), 1420 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"),
1419 i18n("Import!"), i18n("Cancel"), 0, 1421 i18n("Import!"), i18n("Cancel"), 0,
1420 0, 1 ); 1422 0, 1 );
1421 if ( result == 0 ) { 1423 if ( result == 0 ) {
1422 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1424 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1423 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1425 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1424 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1426 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1425 mView->importQtopia( categories, datebook, todolist ); 1427 mView->importQtopia( categories, datebook, todolist );
1426 } 1428 }
1427#else 1429#else
1428 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1430 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1429 i18n("Not supported \non desktop!\n"), 1431 i18n("Not supported \non desktop!\n"),
1430 i18n("Ok"), i18n("Cancel"), 0, 1432 i18n("Ok"), i18n("Cancel"), 0,
1431 0, 1 ); 1433 0, 1 );
1432 1434
1433#endif 1435#endif
1434} 1436}
1435 1437
1436void MainWindow::saveOnClose() 1438void MainWindow::saveOnClose()
1437{ 1439{
1438 KOPrefs *p = KOPrefs::instance(); 1440 KOPrefs *p = KOPrefs::instance();
1439 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1441 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1440 p->mToolBarUp = iconToolBar->x() > width()/2 || 1442 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1441 iconToolBar->y() > height()/2; 1443 iconToolBar->y() > height()/2;
1442 mView->writeSettings(); 1444 mView->writeSettings();
1443 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1445 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1444 save(); 1446 save();
1445} 1447}
1446void MainWindow::slotModifiedChanged( bool changed ) 1448void MainWindow::slotModifiedChanged( bool changed )
1447{ 1449{
1448 if ( mBlockAtStartup ) 1450 if ( mBlockAtStartup )
1449 return; 1451 return;
1452
1450 int msec; 1453 int msec;
1451 // we store the changes after 1 minute, 1454 // we store the changes after 1 minute,
1452 // and for safety reasons after 10 minutes again 1455 // and for safety reasons after 10 minutes again
1453 if ( !mSyncManager->blockSave() ) 1456 if ( !mSyncManager->blockSave() )
1454 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1457 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1455 else 1458 else
1456 msec = 1000 * 600; 1459 msec = 1000 * 600;
1457 mSaveTimer.start( msec, true ); // 1 minute 1460 mSaveTimer.start( msec, true ); // 1 minute
1458 qDebug("KO: Saving File in %d secs!", msec/1000); 1461 qDebug("KO: Saving File in %d secs!", msec/1000);
1459 mCalendarModifiedFlag = true; 1462 mCalendarModifiedFlag = true;
1460} 1463}
1464void MainWindow::saveStopTimer()
1465{
1466 mSaveTimer.stop();
1467 if (mSaveTimer.isActive() )
1468 qDebug("ti active ");
1469 else
1470 qDebug("KO: Save timer stopped");
1471}
1461void MainWindow::save() 1472void MainWindow::save()
1462{ 1473{
1474 if ( !mCalendarModifiedFlag ) {
1475 qDebug("KO: Calendar not modified. Nothing saved.");
1476 return;
1477 }
1463 if ( mSyncManager->blockSave() ) 1478 if ( mSyncManager->blockSave() )
1464 return; 1479 return;
1465 mSyncManager->setBlockSave(true); 1480 mSyncManager->setBlockSave(true);
1466 if ( mView->checkFileVersion( defaultFileName()) ) { 1481 if ( mView->checkFileVersion( defaultFileName()) ) {
1467
1468 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1482 QTime neededSaveTime = QDateTime::currentDateTime().time();
1469 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1483 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1470 qDebug("KO: Start saving data to file!"); 1484 qDebug("KO: Start saving data to file!");
1471 mView->saveCalendar( defaultFileName() ); 1485 mView->saveCalendar( defaultFileName() );
1472 1486 mCalendarModifiedFlag = false;
1473 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1487 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1474 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1488 qDebug("KO: Needed %d ms for saving.",msNeeded );
1475 QString savemes; 1489 QString savemes;
1476 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1490 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1477 setCaption(savemes); 1491 setCaption(savemes);
1478 } else 1492 } else
1479 setCaption(i18n("Saving cancelled!")); 1493 setCaption(i18n("Saving cancelled!"));
1480 mCalendarModifiedFlag = false;
1481 mSyncManager->setBlockSave( false ); 1494 mSyncManager->setBlockSave( false );
1482} 1495}
1483 1496
1484void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1497void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1485{ 1498{
1486 if ( !e->isAutoRepeat() ) { 1499 if ( !e->isAutoRepeat() ) {
1487 mFlagKeyPressed = false; 1500 mFlagKeyPressed = false;
1488 } 1501 }
1489} 1502}
1490void MainWindow::keyPressEvent ( QKeyEvent * e ) 1503void MainWindow::keyPressEvent ( QKeyEvent * e )
1491{ 1504{
1492 qApp->processEvents(); 1505 qApp->processEvents();
1493 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1506 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1494 e->ignore(); 1507 e->ignore();
1495 // qDebug(" ignore %d",e->isAutoRepeat() ); 1508 // qDebug(" ignore %d",e->isAutoRepeat() );
1496 return; 1509 return;
1497 } 1510 }
1498 if (! e->isAutoRepeat() ) 1511 if (! e->isAutoRepeat() )
1499 mFlagKeyPressed = true; 1512 mFlagKeyPressed = true;
1500 KOPrefs *p = KOPrefs::instance(); 1513 KOPrefs *p = KOPrefs::instance();
1501 bool showSelectedDates = false; 1514 bool showSelectedDates = false;
1502 int size; 1515 int size;
1503 int pro = 0; 1516 int pro = 0;
1504 //qDebug("MainWindow::keyPressEvent "); 1517 //qDebug("MainWindow::keyPressEvent ");
1505 switch ( e->key() ) { 1518 switch ( e->key() ) {
1506 case Qt::Key_Right: 1519 case Qt::Key_Right:
1507 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1520 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1508 mView->goNextMonth(); 1521 mView->goNextMonth();
1509 else 1522 else
1510 mView->goNext(); 1523 mView->goNext();
1511 showSelectedDates = true; 1524 showSelectedDates = true;
1512 break; 1525 break;
1513 case Qt::Key_Left: 1526 case Qt::Key_Left:
1514 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1527 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1515 mView->goPreviousMonth(); 1528 mView->goPreviousMonth();
1516 else 1529 else
1517 mView->goPrevious(); 1530 mView->goPrevious();
1518 showSelectedDates = true; 1531 showSelectedDates = true;
1519 break; 1532 break;
1520 case Qt::Key_Down: 1533 case Qt::Key_Down:
1521 mView->viewManager()->agendaView()->scrollOneHourDown(); 1534 mView->viewManager()->agendaView()->scrollOneHourDown();
1522 break; 1535 break;
1523 case Qt::Key_Up: 1536 case Qt::Key_Up:
1524 mView->viewManager()->agendaView()->scrollOneHourUp(); 1537 mView->viewManager()->agendaView()->scrollOneHourUp();
1525 break; 1538 break;
1526 case Qt::Key_I: 1539 case Qt::Key_I:
1527 mView->showIncidence(); 1540 mView->showIncidence();
1528 break; 1541 break;
1529 case Qt::Key_Delete: 1542 case Qt::Key_Delete:
1530 case Qt::Key_Backspace: 1543 case Qt::Key_Backspace:
1531 mView->deleteIncidence(); 1544 mView->deleteIncidence();
1532 break; 1545 break;
1533 case Qt::Key_D: 1546 case Qt::Key_D:
1534 mView->viewManager()->showDayView(); 1547 mView->viewManager()->showDayView();
1535 showSelectedDates = true; 1548 showSelectedDates = true;
1536 break; 1549 break;
1537 case Qt::Key_O: 1550 case Qt::Key_O:
1538 mView->toggleFilerEnabled( ); 1551 mView->toggleFilerEnabled( );
1539 break; 1552 break;
1540 case Qt::Key_0: 1553 case Qt::Key_0:
1541 case Qt::Key_1: 1554 case Qt::Key_1:
1542 case Qt::Key_2: 1555 case Qt::Key_2:
1543 case Qt::Key_3: 1556 case Qt::Key_3:
1544 case Qt::Key_4: 1557 case Qt::Key_4:
1545 case Qt::Key_5: 1558 case Qt::Key_5:
1546 case Qt::Key_6: 1559 case Qt::Key_6:
1547 case Qt::Key_7: 1560 case Qt::Key_7:
1548 case Qt::Key_8: 1561 case Qt::Key_8:
1549 case Qt::Key_9: 1562 case Qt::Key_9:
1550 pro = e->key()-48; 1563 pro = e->key()-48;
1551 if ( pro == 0 ) 1564 if ( pro == 0 )
1552 pro = 10; 1565 pro = 10;
1553 if ( e->state() == Qt::ControlButton) 1566 if ( e->state() == Qt::ControlButton)
1554 pro += 10; 1567 pro += 10;
1555 break; 1568 break;
1556 case Qt::Key_M: 1569 case Qt::Key_M:
1557 mView->viewManager()->showMonthView(); 1570 mView->viewManager()->showMonthView();
1558 showSelectedDates = true; 1571 showSelectedDates = true;
1559 break; 1572 break;
1560 case Qt::Key_Insert: 1573 case Qt::Key_Insert:
1561 mView->newEvent(); 1574 mView->newEvent();
1562 break; 1575 break;
1563 case Qt::Key_S : 1576 case Qt::Key_S :
1564 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1577 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1565 mView->newSubTodo(); 1578 mView->newSubTodo();
1566 else 1579 else
1567 mView->dialogManager()->showSearchDialog(); 1580 mView->dialogManager()->showSearchDialog();
1568 break; 1581 break;
1569 case Qt::Key_Y : 1582 case Qt::Key_Y :
1570 case Qt::Key_Z : 1583 case Qt::Key_Z :
1571 mView->viewManager()->showWorkWeekView(); 1584 mView->viewManager()->showWorkWeekView();
1572 showSelectedDates = true; 1585 showSelectedDates = true;
1573 break; 1586 break;
1574 case Qt::Key_U : 1587 case Qt::Key_U :
1575 mView->viewManager()->showWeekView(); 1588 mView->viewManager()->showWeekView();
1576 showSelectedDates = true; 1589 showSelectedDates = true;
1577 break; 1590 break;
1578 case Qt::Key_H : 1591 case Qt::Key_H :
1579 keyBindings(); 1592 keyBindings();
1580 break; 1593 break;
1581 case Qt::Key_W: 1594 case Qt::Key_W:
1582 mView->viewManager()->showWhatsNextView(); 1595 mView->viewManager()->showWhatsNextView();
1583 break; 1596 break;
1584 case Qt::Key_L: 1597 case Qt::Key_L:
1585 mView->viewManager()->showListView(); 1598 mView->viewManager()->showListView();
1586 break; 1599 break;
1587 case Qt::Key_N: 1600 case Qt::Key_N:
1588 mView->viewManager()->showNextXView(); 1601 mView->viewManager()->showNextXView();
1589 showSelectedDates = true; 1602 showSelectedDates = true;
1590 break; 1603 break;
1591 case Qt::Key_V: 1604 case Qt::Key_V:
1592 mView->viewManager()->showTodoView(); 1605 mView->viewManager()->showTodoView();
1593 break; 1606 break;
1594 case Qt::Key_C: 1607 case Qt::Key_C:
1595 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1608 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1596 break; 1609 break;
1597 case Qt::Key_P: 1610 case Qt::Key_P:
1598 mView->showDatePicker( ); 1611 mView->showDatePicker( );
1599 break; 1612 break;
1600 case Qt::Key_F: 1613 case Qt::Key_F:
1601 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1614 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1602 mView->editFilters(); 1615 mView->editFilters();
1603 else 1616 else
1604 mView->toggleFilter(); 1617 mView->toggleFilter();
1605 break; 1618 break;
1606 case Qt::Key_X: 1619 case Qt::Key_X:
1607 mView->toggleDateNavigatorWidget(); 1620 mView->toggleDateNavigatorWidget();
1608 break; 1621 break;
1609 case Qt::Key_Space: 1622 case Qt::Key_Space:
1610 mView->toggleExpand(); 1623 mView->toggleExpand();
1611 break; 1624 break;
1612 case Qt::Key_A: 1625 case Qt::Key_A:
1613 mView->toggleAllDaySize(); 1626 mView->toggleAllDaySize();
1614 break; 1627 break;
1615 case Qt::Key_T: 1628 case Qt::Key_T:
1616 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1629 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1617 mView->newTodo(); 1630 mView->newTodo();
1618 else { 1631 else {
1619 mView->goToday(); 1632 mView->goToday();
1620 showSelectedDates = true; 1633 showSelectedDates = true;
1621 } 1634 }
1622 break; 1635 break;
1623 case Qt::Key_J: 1636 case Qt::Key_J:
1624 mView->viewManager()->showJournalView(); 1637 mView->viewManager()->showJournalView();
1625 break; 1638 break;
1626 case Qt::Key_B: 1639 case Qt::Key_B:
1627 mView->editIncidenceDescription();; 1640 mView->editIncidenceDescription();;
1628 break; 1641 break;
1629 // case Qt::Key_Return: 1642 // case Qt::Key_Return:
1630 case Qt::Key_E: 1643 case Qt::Key_E:
1631 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1644 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1632 mView->newEvent(); 1645 mView->newEvent();
1633 else 1646 else
1634 mView->editIncidence(); 1647 mView->editIncidence();
1635 break; 1648 break;
1636 case Qt::Key_Plus: 1649 case Qt::Key_Plus:
1637 size = p->mHourSize +2; 1650 size = p->mHourSize +2;
1638 if ( size <= 18 ) 1651 if ( size <= 18 )
1639 configureAgenda( size ); 1652 configureAgenda( size );
1640 break; 1653 break;
1641 case Qt::Key_Minus: 1654 case Qt::Key_Minus:
1642 size = p->mHourSize - 2; 1655 size = p->mHourSize - 2;
1643 if ( size >= 4 ) 1656 if ( size >= 4 )
1644 configureAgenda( size ); 1657 configureAgenda( size );
1645 break; 1658 break;
1646 1659
1647 1660
1648 default: 1661 default:
1649 e->ignore(); 1662 e->ignore();
1650 } 1663 }
1651 if ( pro > 0 ) { 1664 if ( pro > 0 ) {
1652 mView->selectFilter( pro-1 ); 1665 mView->selectFilter( pro-1 );
1653 } 1666 }
1654 if ( showSelectedDates ) { 1667 if ( showSelectedDates ) {
1655 ;// setCaptionToDates(); 1668 ;// setCaptionToDates();
1656 } 1669 }
1657 1670
1658} 1671}
1659 1672
1660void MainWindow::fillFilterMenu() 1673void MainWindow::fillFilterMenu()
1661{ 1674{
1662 selectFilterMenu->clear(); 1675 selectFilterMenu->clear();
1663 bool disable = false; 1676 bool disable = false;
1664 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1677 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1665 selectFilterMenu->insertSeparator(); 1678 selectFilterMenu->insertSeparator();
1666 if ( mView->filterView()->filtersEnabled() ) { 1679 if ( mView->filterView()->filtersEnabled() ) {
1667 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1680 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1668 } 1681 }
1669 else { 1682 else {
1670 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1683 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1671 disable = true; 1684 disable = true;
1672 } 1685 }
1673 selectFilterMenu->insertSeparator(); 1686 selectFilterMenu->insertSeparator();
1674 QPtrList<CalFilter> fili = mView->filters(); 1687 QPtrList<CalFilter> fili = mView->filters();
1675 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1688 CalFilter *curfilter = mView->filterView()->selectedFilter();
1676 CalFilter *filter = fili.first(); 1689 CalFilter *filter = fili.first();
1677 int iii = 2; 1690 int iii = 2;
1678 while(filter) { 1691 while(filter) {
1679 selectFilterMenu->insertItem( filter->name(), iii ); 1692 selectFilterMenu->insertItem( filter->name(), iii );
1680 if ( filter == curfilter) 1693 if ( filter == curfilter)
1681 selectFilterMenu->setItemChecked( iii, true ); 1694 selectFilterMenu->setItemChecked( iii, true );
1682 if ( disable ) 1695 if ( disable )
1683 selectFilterMenu->setItemEnabled( iii, false ); 1696 selectFilterMenu->setItemEnabled( iii, false );
1684 filter = fili.next(); 1697 filter = fili.next();
1685 ++iii; 1698 ++iii;
1686 } 1699 }
1687} 1700}
1688void MainWindow::selectFilter( int fil ) 1701void MainWindow::selectFilter( int fil )
1689{ 1702{
1690 if ( fil == 0 ) { 1703 if ( fil == 0 ) {
1691 mView->editFilters( ); 1704 mView->editFilters( );
1692 } else if ( fil == 1 ){ 1705 } else if ( fil == 1 ){
1693 mView->toggleFilerEnabled( ); 1706 mView->toggleFilerEnabled( );
1694 } else { 1707 } else {
1695 mView->selectFilter( fil-2 ); 1708 mView->selectFilter( fil-2 );
1696 } 1709 }
1697} 1710}
1698void MainWindow::configureToolBar( int item ) 1711void MainWindow::configureToolBar( int item )
1699{ 1712{
1700 1713
1701 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1714 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1702 KOPrefs *p = KOPrefs::instance(); 1715 KOPrefs *p = KOPrefs::instance();
1703 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1716 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1704 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1717 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1705 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1718 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1706 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1719 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1707 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1720 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1708 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1721 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1709 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1722 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1710 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1723 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1711 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1724 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1712 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1725 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1713 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1726 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1714 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1727 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1715 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1728 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1716 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1729 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1717 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1730 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1718 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1731 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1719 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1732 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1720 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1733 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1721 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1734 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1722 // initActions(); 1735 // initActions();
1723} 1736}
1724 1737
1725void MainWindow::setCaptionToDates() 1738void MainWindow::setCaptionToDates()
1726{ 1739{
1727 QString selDates; 1740 QString selDates;
1728 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1741 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1729 if (mView->startDate() < mView->endDate() ) 1742 if (mView->startDate() < mView->endDate() )
1730 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1743 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1731 else { 1744 else {
1732 QString addString; 1745 QString addString;
1733 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1746 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1734 addString = i18n("Today"); 1747 addString = i18n("Today");
1735 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1748 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1736 addString = i18n("Tomorrow"); 1749 addString = i18n("Tomorrow");
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 6de0543..8dd55ac 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,141 +1,142 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qtextstream.h> 8#include <qtextstream.h>
9#include <qregexp.h> 9#include <qregexp.h>
10 10
11#include <libkcal/incidence.h> 11#include <libkcal/incidence.h>
12#include "simplealarmclient.h" 12#include "simplealarmclient.h"
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26 26
27 27
28namespace KCal { 28namespace KCal {
29class CalendarLocal; 29class CalendarLocal;
30} 30}
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
39 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled(); 40 bool beamReceiveEnabled();
41 static QString defaultFileName(); 41 static QString defaultFileName();
42 static QString syncFileName(); 42 static QString syncFileName();
43 static QString resourcePath(); 43 static QString resourcePath();
44 public slots: 44 public slots:
45 virtual void showMaximized (); 45 virtual void showMaximized ();
46 void configureAgenda( int ); 46 void configureAgenda( int );
47 void recieve( const QCString& msg, const QByteArray& data ); 47 void recieve( const QCString& msg, const QByteArray& data );
48 protected slots: 48 protected slots:
49 void setCaptionToDates(); 49 void setCaptionToDates();
50 void about(); 50 void about();
51 void licence(); 51 void licence();
52 void faq(); 52 void faq();
53 void usertrans(); 53 void usertrans();
54 void features(); 54 void features();
55 void synchowto(); 55 void synchowto();
56 void kdesynchowto(); 56 void kdesynchowto();
57 void multisynchowto(); 57 void multisynchowto();
58 void whatsNew(); 58 void whatsNew();
59 void keyBindings(); 59 void keyBindings();
60 void aboutAutoSaving();; 60 void aboutAutoSaving();;
61 void aboutKnownBugs(); 61 void aboutKnownBugs();
62 62
63 void processIncidenceSelection( Incidence * ); 63 void processIncidenceSelection( Incidence * );
64 64
65 void importQtopia(); 65 void importQtopia();
66 void importBday(); 66 void importBday();
67 void importOL(); 67 void importOL();
68 void importIcal(); 68 void importIcal();
69 void importFile( QString, bool ); 69 void importFile( QString, bool );
70 void quickImportIcal(); 70 void quickImportIcal();
71 71
72 void slotModifiedChanged( bool ); 72 void slotModifiedChanged( bool );
73 73
74 void save(); 74 void save();
75 void saveStopTimer();
75 void configureToolBar( int ); 76 void configureToolBar( int );
76 void printSel(); 77 void printSel();
77 void printCal(); 78 void printCal();
78 void saveCalendar(); 79 void saveCalendar();
79 void loadCalendar(); 80 void loadCalendar();
80 void exportVCalendar(); 81 void exportVCalendar();
81 void fillFilterMenu(); 82 void fillFilterMenu();
82 void selectFilter( int ); 83 void selectFilter( int );
83 void exportToPhone( int ); 84 void exportToPhone( int );
84 void toggleBeamReceive(); 85 void toggleBeamReceive();
85 void disableBR(bool); 86 void disableBR(bool);
86 87
87 private slots: 88 private slots:
88 void showConfigureAgenda(); 89 void showConfigureAgenda();
89 void getFile( bool ); 90 void getFile( bool );
90 void syncFileRequest(); 91 void syncFileRequest();
91 92
92 protected: 93 protected:
93 void displayText( QString, QString); 94 void displayText( QString, QString);
94 void enableIncidenceActions( bool ); 95 void enableIncidenceActions( bool );
95 96
96 private: 97 private:
97 bool mBRdisabled; 98 bool mBRdisabled;
98#ifndef DESKTOP_VERSION 99#ifndef DESKTOP_VERSION
99 QCopChannel* infrared; 100 QCopChannel* infrared;
100#endif 101#endif
101 QAction* brAction; 102 QAction* brAction;
102 KSyncManager* mSyncManager; 103 KSyncManager* mSyncManager;
103 bool mClosed; 104 bool mClosed;
104 void saveOnClose(); 105 void saveOnClose();
105 bool mFlagKeyPressed; 106 bool mFlagKeyPressed;
106 bool mBlockAtStartup; 107 bool mBlockAtStartup;
107 QPEToolBar *iconToolBar; 108 QPEToolBar *iconToolBar;
108 void initActions(); 109 void initActions();
109 void setDefaultPreferences(); 110 void setDefaultPreferences();
110 void keyPressEvent ( QKeyEvent * ) ; 111 void keyPressEvent ( QKeyEvent * ) ;
111 void keyReleaseEvent ( QKeyEvent * ) ; 112 void keyReleaseEvent ( QKeyEvent * ) ;
112 QPopupMenu *configureToolBarMenu; 113 QPopupMenu *configureToolBarMenu;
113 QPopupMenu *selectFilterMenu; 114 QPopupMenu *selectFilterMenu;
114 QPopupMenu *configureAgendaMenu, *syncMenu; 115 QPopupMenu *configureAgendaMenu, *syncMenu;
115 CalendarLocal *mCalendar; 116 CalendarLocal *mCalendar;
116 CalendarView *mView; 117 CalendarView *mView;
117 QAction *mNewSubTodoAction; 118 QAction *mNewSubTodoAction;
118 119
119 QAction *mShowAction; 120 QAction *mShowAction;
120 QAction *mEditAction; 121 QAction *mEditAction;
121 QAction *mDeleteAction; 122 QAction *mDeleteAction;
122 QAction *mCloneAction; 123 QAction *mCloneAction;
123 QAction *mMoveAction; 124 QAction *mMoveAction;
124 QAction *mBeamAction; 125 QAction *mBeamAction;
125 QAction *mCancelAction; 126 QAction *mCancelAction;
126 127
127 QAction *mToggleNav; 128 QAction *mToggleNav;
128 QAction *mToggleFilter; 129 QAction *mToggleFilter;
129 QAction *mToggleAllday; 130 QAction *mToggleAllday;
130 131
131 132
132 void closeEvent( QCloseEvent* ce ); 133 void closeEvent( QCloseEvent* ce );
133 SimpleAlarmClient mAlarmClient; 134 SimpleAlarmClient mAlarmClient;
134 QTimer mSaveTimer; 135 QTimer mSaveTimer;
135 //bool mBlockSaveFlag; 136 //bool mBlockSaveFlag;
136 bool mCalendarModifiedFlag; 137 bool mCalendarModifiedFlag;
137 QPixmap loadPixmap( QString ); 138 QPixmap loadPixmap( QString );
138}; 139};
139 140
140 141
141#endif 142#endif