summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-05 12:03:42 (UTC)
committer zautrix <zautrix>2005-02-05 12:03:42 (UTC)
commitf5902d0e08e0b10321c555e8846a8a8ce2087d30 (patch) (unidiff)
tree5aeaa9689b3161867fb0c8707adc5908b5072f06
parent86c0d35262454a31ed7d50d3e20cbdace954ebdf (diff)
downloadkdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.zip
kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.tar.gz
kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.tar.bz2
file selector fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/kolistview.cpp2
-rw-r--r--microkde/kfiledialog.cpp2
-rw-r--r--microkde/ofileselector_p.cpp28
-rw-r--r--microkde/ofileselector_p.h1
5 files changed, 35 insertions, 3 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 9ba4f3e..4421e61 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,534 +1,537 @@
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.3 ************ 3********** VERSION 2.0.3 ************
4 4
5KO/Pi: 5KO/Pi:
6Added feature for changing alarm settings for many items at once: 6Added feature for changing alarm settings for many items at once:
7Open list view (or search dialog), select the desired items and choose in 7Open list view (or search dialog), select the desired items and choose in
8the popup menu: Set alarm for selected... 8the popup menu: Set alarm for selected...
9 9
10Added to the event/todo viewer the option to send an email to 10Added to the event/todo viewer the option to send an email to
11all attendees or all selected (with RSVP) attendees. 11all attendees or all selected (with RSVP) attendees.
12 12
13Made the week-month mode changing in month view faster. 13Made the week-month mode changing in month view faster.
14 14
15Made month view better useable with keyboard. 15Made month view better useable with keyboard.
16Now TAB key jumps to next cell with an event/todo. 16Now TAB key jumps to next cell with an event/todo.
17Scroll in cell with coursor keys, scroll in time (next week) with 17Scroll in cell with coursor keys, scroll in time (next week) with
18Shift/Control + coursorkeys. 18Shift/Control + coursorkeys.
19 19
20Fixed bug that the todo view flat mode was reset after first view update. 20Fixed bug that the todo view flat mode was reset after first view update.
21 21
22If a todo is displayed closed in the todo view, it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 22If a todo is displayed closed in the todo view,
23it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
24
25Added info about the numbers of years to the caption (title) information about a birthday event.
23 26
24********** VERSION 2.0.2 ************ 27********** VERSION 2.0.2 ************
25 28
26KO/Pi: 29KO/Pi:
27Fixed the layout problem of the day label buttons 30Fixed the layout problem of the day label buttons
28of the agenda view introduced in version 2.0.1. 31of the agenda view introduced in version 2.0.1.
29 32
30Added WhatsThis support for the todo view and the list view. 33Added WhatsThis support for the todo view and the list view.
31 34
32Added a quite useful feature to the montview. 35Added a quite useful feature to the montview.
33Just click on the week numbers on the left. 36Just click on the week numbers on the left.
34And in the top right corner of month view/agenda view 37And in the top right corner of month view/agenda view
35there is now a "week number quick selector". 38there is now a "week number quick selector".
36(Click on the black triangle). 39(Click on the black triangle).
37 40
38Made the quite difficult timezone change in KO/Pi easy. 41Made the quite difficult timezone change in KO/Pi easy.
39 42
40OM/Pi: 43OM/Pi:
41Fixed too small icons on desktop. 44Fixed too small icons on desktop.
42Fixed non visible icons in mainwindow on Z with fastload enabled. 45Fixed non visible icons in mainwindow on Z with fastload enabled.
43Added signature file setting to smtp account config. 46Added signature file setting to smtp account config.
44And the signature can be edited and saved in the edit mail dialog. 47And the signature can be edited and saved in the edit mail dialog.
45That does mean: 48That does mean:
46Simply edit the signature for the selected smtp account in the 49Simply edit the signature for the selected smtp account in the
47edit new mail dialog and press the "save signature" button there. 50edit new mail dialog and press the "save signature" button there.
48Then the signature is saved to the file specified in the smtp account settings. 51Then the signature is saved to the file specified in the smtp account settings.
49If there is no file specified, it is saved automatically to the file 52If there is no file specified, it is saved automatically to the file
50kdepim/apps/kopiemail/<accountname>.sig. 53kdepim/apps/kopiemail/<accountname>.sig.
51 54
52 55
53 56
54********** VERSION 2.0.1 ************ 57********** VERSION 2.0.1 ************
55 58
56Oooops ... I forgot to test on the Zaurus 5500 ... 59Oooops ... I forgot to test on the Zaurus 5500 ...
57 60
58Fixed many problems of new (english) strings (and german translations) 61Fixed many problems of new (english) strings (and german translations)
59introduced in the latest versions, where the text was not fitting on the 62introduced in the latest versions, where the text was not fitting on the
60240x320 display of the Zaurus 5500. 63240x320 display of the Zaurus 5500.
61 64
62KO/Pi: 65KO/Pi:
63Added a popup menu ( press pen and hold to get popup ) to the agenda view 66Added a popup menu ( press pen and hold to get popup ) to the agenda view
64with many useful items (add event/todo, show next week, two weeks, month, journal). 67with many useful items (add event/todo, show next week, two weeks, month, journal).
65 68
66Added items to the todolist popup menu for: 69Added items to the todolist popup menu for:
67Display all opened, all closed or all todos flat. 70Display all opened, all closed or all todos flat.
68The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 71The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
69Made the reparenting of todos on the desktop possible via Drag&Drop. 72Made the reparenting of todos on the desktop possible via Drag&Drop.
70Fixed several bugs in setting the completed datetime for todos. 73Fixed several bugs in setting the completed datetime for todos.
71Added info about completed datetime of todos to the todo viewer. 74Added info about completed datetime of todos to the todo viewer.
72Now displaying a completed todo (with completed datetime set) in the agenda view 75Now displaying a completed todo (with completed datetime set) in the agenda view
73at the time of the completion. Such that now it is possible to see in the agenda view 76at the time of the completion. Such that now it is possible to see in the agenda view
74when what todo was completed. 77when what todo was completed.
75Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 78Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
76Now the behaviour is: 79Now the behaviour is:
77Setting a parent to complete sets all (sub)childs to complete. 80Setting a parent to complete sets all (sub)childs to complete.
78Setting a parent to uncomplete does not change the childs. 81Setting a parent to uncomplete does not change the childs.
79Setting a child to uncomplete sets all parent to uncomplete. 82Setting a child to uncomplete sets all parent to uncomplete.
80Setting a child to complete does not change the parents. 83Setting a child to complete does not change the parents.
81 84
82Smart updating and double buffering of the daymatrix. 85Smart updating and double buffering of the daymatrix.
83Showing holidays in the day matrix. 86Showing holidays in the day matrix.
84Many other small performance updates. 87Many other small performance updates.
85 88
86Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 89Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
87 90
88Now the translation file usertranslation.txt is supposed to be in utf8 format. 91Now the translation file usertranslation.txt is supposed to be in utf8 format.
89If 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. 92If 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.
90 93
91 94
92********** VERSION 2.0.0 ************ 95********** VERSION 2.0.0 ************
93 96
94Stable release 2.0.0! 97Stable release 2.0.0!
95 98
96KO/Pi: 99KO/Pi:
97Fixed problem in edit dialog recreation at startup. 100Fixed problem in edit dialog recreation at startup.
98Made "toggle view*" menu items enabled context sensitive. 101Made "toggle view*" menu items enabled context sensitive.
99Changed agenda size menu to items 1-10. 102Changed agenda size menu to items 1-10.
100Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. 103Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
101Usebility enhancements in the KO/Pi menus. 104Usebility enhancements in the KO/Pi menus.
102Birthday import now adds year to summary. 105Birthday import now adds year to summary.
103What's Next view shows age in years for birthday. 106What's Next view shows age in years for birthday.
104 107
105OM/Pi: 108OM/Pi:
106Added three info lines to display subject, from and to of selected mails. 109Added three info lines to display subject, from and to of selected mails.
107 110
108KA/Pi: 111KA/Pi:
109Fixed jump bar behaviour on Zaurus. 112Fixed jump bar behaviour on Zaurus.
110Now KA/Pi search field supports searching for a range of starting characters. 113Now KA/Pi search field supports searching for a range of starting characters.
111E.g. to search for all contact beginning with b to n, type 114E.g. to search for all contact beginning with b to n, type
112b-n 115b-n
113in the search field. 116in the search field.
114 117
115********** VERSION 1.9.20 ************ 118********** VERSION 1.9.20 ************
116 119
117KO/Pi: 120KO/Pi:
118Added for the "dislplay one day" agenda mode 121Added for the "dislplay one day" agenda mode
119info in the caption and in the day lables: 122info in the caption and in the day lables:
120Now it is displayed, if the selected day is from "day before yesterday" 123Now it is displayed, if the selected day is from "day before yesterday"
121to "day after tomorrow". 124to "day after tomorrow".
122Made it possible to delete a Todo, which has sub-todos. 125Made it possible to delete a Todo, which has sub-todos.
123Fixed two small problems in the todo view. 126Fixed two small problems in the todo view.
124Added missing German translation for filter edit and print dialog. 127Added missing German translation for filter edit and print dialog.
125Made search dialog closeable by cancel key. 128Made search dialog closeable by cancel key.
126 129
127Made it possible to select in the date picker the (ligt grey ) 130Made it possible to select in the date picker the (ligt grey )
128dates of the prev./next month with the mouse. 131dates of the prev./next month with the mouse.
129 132
130OM/Pi: 133OM/Pi:
131"Delete mail" icon in main window now deletes all selected mails. 134"Delete mail" icon in main window now deletes all selected mails.
132Fixed the problem, that the state flag of imap mails was ignored. 135Fixed the problem, that the state flag of imap mails was ignored.
133Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 136Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
134to indecate that they are already seen. 137to indecate that they are already seen.
135Fixed the problem that the body of some mails was not displayed in the 138Fixed the problem that the body of some mails was not displayed in the
136mail viewer when fetching them from the imap server directly to read them. 139mail viewer when fetching them from the imap server directly to read them.
137Made it (configurable) possible to show the "To:" field in the list view. 140Made it (configurable) possible to show the "To:" field in the list view.
138Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. 141Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
139Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the 142Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
140local storage folder (specified in account settings) of the account of the mail. 143local storage folder (specified in account settings) of the account of the mail.
141Removed some memory leaks in OM/Pi. 144Removed some memory leaks in OM/Pi.
142 145
143 146
144********** VERSION 1.9.19 ************ 147********** VERSION 1.9.19 ************
145 148
146Added a lot of missing translations to KA/Pi, 149Added a lot of missing translations to KA/Pi,
147Added some missing translations to KO/Pi and OM/Pi. 150Added some missing translations to KO/Pi and OM/Pi.
148 151
149Fixed some minor problems in KA/Pi + KO/Pi. 152Fixed some minor problems in KA/Pi + KO/Pi.
150 153
151Fixed a crash when closing PwM/Pi. 154Fixed a crash when closing PwM/Pi.
152Added German translation for PwM/Pi. 155Added German translation for PwM/Pi.
153 156
154Made view change and Month View update faster in KO/Pi. 157Made view change and Month View update faster in KO/Pi.
155 158
156 159
157********** VERSION 1.9.18 ************ 160********** VERSION 1.9.18 ************
158 161
159FYI: The VERSION 1.9.17 was a testing release only. 162FYI: The VERSION 1.9.17 was a testing release only.
160Please read the changelog of VERSION 1.9.17 as well. 163Please read the changelog of VERSION 1.9.17 as well.
161 164
162Cleaned up the syncing config dialog. 165Cleaned up the syncing config dialog.
163Added sync config options for date range for events. 166Added sync config options for date range for events.
164Added sync config options for filters on incoming data. 167Added sync config options for filters on incoming data.
165Added sync config options for filters on outgoing data. 168Added sync config options for filters on outgoing data.
166Please read the updated SyncHowTo about the new filter settings. 169Please read the updated SyncHowTo about the new filter settings.
167These filter settings make it now possible to sync with shared 170These filter settings make it now possible to sync with shared
168calendars without writing back private or confidential data 171calendars without writing back private or confidential data
169(via the outgoing filters). 172(via the outgoing filters).
170To sync only with particular parts of a shared calendar, 173To sync only with particular parts of a shared calendar,
171the incoming filter settings can be used. 174the incoming filter settings can be used.
172An example can be found in the SyncHowTo. 175An example can be found in the SyncHowTo.
173Same for shared addressbooks. 176Same for shared addressbooks.
174 177
175Added a setting for the global kdepim data storage. 178Added a setting for the global kdepim data storage.
176Usually the data is stored in (yourhomedir/kdepim). 179Usually the data is stored in (yourhomedir/kdepim).
177Now you can set in the Global config dialog TAB, subTAB "Data storage path" 180Now you can set in the Global config dialog TAB, subTAB "Data storage path"
178a directory where all the kdepim data is stored. 181a directory where all the kdepim data is stored.
179That makes it easy to save all kdepim data on a SD card on the Z, for example. 182That makes it easy to save all kdepim data on a SD card on the Z, for example.
180 183
181KO/Pi: 184KO/Pi:
182The timeedit input has a pulldown list for times. 185The timeedit input has a pulldown list for times.
183If opened, this pulldown list should now has the right time highlighted. 186If opened, this pulldown list should now has the right time highlighted.
184Added the possibility to exclude events/todos/journals in a filter. 187Added the possibility to exclude events/todos/journals in a filter.
185You should exclude journals, if you do not want them to sync with a public calendar. 188You should exclude journals, if you do not want them to sync with a public calendar.
186 189
187KA/Pi: 190KA/Pi:
188Added the possibility to in/exclude public/private/confidential contacts to a filter. 191Added the possibility to in/exclude public/private/confidential contacts to a filter.
189If 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 ... 192If 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 ...
190Added printing of card view and details view on desktop. 193Added printing of card view and details view on desktop.
191Printing of list view is not working... 194Printing of list view is not working...
192Added button for removing pictures in contact editor. 195Added button for removing pictures in contact editor.
193Parsing data fix of KA/Pi version 1.9.17. 196Parsing data fix of KA/Pi version 1.9.17.
194Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. 197Fixed the "parse name automatically" problem of KA/Pi version 1.9.17.
195Fixed some syncing merging problems. 198Fixed some syncing merging problems.
196 199
197 200
198********** VERSION 1.9.17 ************ 201********** VERSION 1.9.17 ************
199 202
200KO/Pi: 203KO/Pi:
201Fixed that tooltips were not updated after moving an item in agenda view. 204Fixed that tooltips were not updated after moving an item in agenda view.
202Fixed a bug in sorting start date for recurring events in list view. 205Fixed a bug in sorting start date for recurring events in list view.
203Changed the left button in todo viewer from "Agenda" to "Set completed". 206Changed the left button in todo viewer from "Agenda" to "Set completed".
204This 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. 207This 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.
205Added more info in the todo viewer: Startdate, parent/sub todos. 208Added more info in the todo viewer: Startdate, parent/sub todos.
206 209
207 210
208KA/Pi: 211KA/Pi:
209All fields search does now actually search all the (possible) fields, 212All fields search does now actually search all the (possible) fields,
210not only those listed in the contact list. 213not only those listed in the contact list.
211Made is possible to inline a picture in a vcard on the Z. 214Made is possible to inline a picture in a vcard on the Z.
212This was only possible on the desktop, now is it possible on the Z as well. 215This was only possible on the desktop, now is it possible on the Z as well.
213Fixed of missing save settings after filter configuration. 216Fixed of missing save settings after filter configuration.
214Made saving of addressbook much faster. 217Made saving of addressbook much faster.
215Fixed extension widget layout problem. 218Fixed extension widget layout problem.
216Fixed saving of default formatted name settings. 219Fixed saving of default formatted name settings.
217Fixed formatted name handling in edit dialog. 220Fixed formatted name handling in edit dialog.
218Added an option for changing formatted names of many contacts 221Added an option for changing formatted names of many contacts
219(menu: File - Change - Set formatted name). 222(menu: File - Change - Set formatted name).
220 223
221QWhatsThis was not working on the Z ( only black rectangle was shown). 224QWhatsThis was not working on the Z ( only black rectangle was shown).
222This is Fixed. 225This is Fixed.
223 226
224KDE-Sync: 227KDE-Sync:
225Now readonly KDE resources are synced as well. 228Now readonly KDE resources are synced as well.
226(They are not changed in KDE itself, of course). 229(They are not changed in KDE itself, of course).
227 230
228 231
229 232
230********** VERSION 1.9.16 ************ 233********** VERSION 1.9.16 ************
231 234
232KO/Pi: 235KO/Pi:
233Fixed search dialog size on Z 6000 (480x640 display). 236Fixed search dialog size on Z 6000 (480x640 display).
234Added setting to hide/show time in agenda items. 237Added setting to hide/show time in agenda items.
235Added setting to hide not running todos in todo view. 238Added setting to hide not running todos in todo view.
236Added columns for start date/time in todo view. 239Added columns for start date/time in todo view.
237Replaced the solid half-hour lines in agenda view by dot lines. 240Replaced the solid half-hour lines in agenda view by dot lines.
238Added possibility of printing the What's Next View on the desktop 241Added possibility of printing the What's Next View on the desktop
239(i.e. Windows and Linux). 242(i.e. Windows and Linux).
240Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. 243Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
241Added tooltips in month view.(Tooltips only available on desktop) 244Added tooltips in month view.(Tooltips only available on desktop)
242 245
243Fixed a strange problem in KO/Pi alarm applet. 246Fixed a strange problem in KO/Pi alarm applet.
244Did not find the actual problem, 247Did not find the actual problem,
245such that now Qtopia reboots again if deinstalling the alarm applet. 248such that now Qtopia reboots again if deinstalling the alarm applet.
246But the alarm applet should work again. 249But the alarm applet should work again.
247 250
248KA/Pi: 251KA/Pi:
249Fixed the problem, that internal pictures were not saved. 252Fixed the problem, that internal pictures were not saved.
250 253
251Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. 254Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes.
252 255
253Fixed some minor problems. (Like word wrap in help text windows). 256Fixed some minor problems. (Like word wrap in help text windows).
254 257
255Fixed a compiling problem in microkde/kresources. 258Fixed a compiling problem in microkde/kresources.
256 259
257KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. 260KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM.
258This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) 261This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9)
259such that now syncing KO/Pi with Sharp DTM should work on the 262such that now syncing KO/Pi with Sharp DTM should work on the
260Zaurus C 3000 model. 263Zaurus C 3000 model.
261 264
262********** VERSION 1.9.15 ************ 265********** VERSION 1.9.15 ************
263 266
264Usebilty enhancements in KO/Pi: 267Usebilty enhancements in KO/Pi:
265When clicking on the date in a month view cell, the day view is shown. 268When clicking on the date in a month view cell, the day view is shown.
266Old behaviour was, that the "new event" dialog popped up. 269Old behaviour was, that the "new event" dialog popped up.
267 270
268Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 271Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
269That means, you can restore the latest 272That means, you can restore the latest
270event/todo/journal you have deleted. 273event/todo/journal you have deleted.
271A journal is deleted, if you clear all the text of the journal. 274A journal is deleted, if you clear all the text of the journal.
272 275
273Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 276Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
274 277
275KA/Pi starting in 480x640 resolution: 278KA/Pi starting in 480x640 resolution:
276Hide the filter action in toolbar 279Hide the filter action in toolbar
277and added icons for undo/delete/redo in toolbar. 280and added icons for undo/delete/redo in toolbar.
278 281
279Change in OM/Pi ViewMail dialog: 282Change in OM/Pi ViewMail dialog:
280When clicking on the "delete" icon the mail is deleted after confirmation as usual. 283When clicking on the "delete" icon the mail is deleted after confirmation as usual.
281But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 284But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
282 285
283Fixed a crash when deleting mail-accounts in OM/Pi. 286Fixed a crash when deleting mail-accounts in OM/Pi.
284 287
285 288
286********** VERSION 1.9.14 ************ 289********** VERSION 1.9.14 ************
287 290
288Fixed some problems with the dialog sizes when switching 291Fixed some problems with the dialog sizes when switching
289portrait/landscape mode on 640x480 PDA display. 292portrait/landscape mode on 640x480 PDA display.
290 293
291Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 294Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
292 295
293Fixed an ugly bug in KOpieMail: 296Fixed an ugly bug in KOpieMail:
294KOpieMail was not able to write files (mails) to MSDOS file system, 297KOpieMail was not able to write files (mails) to MSDOS file system,
295like on an usual preformatted SD card. That should work now. 298like on an usual preformatted SD card. That should work now.
296To save your mail data on the Sd card do the following: 299To save your mail data on the Sd card do the following:
297Create a dir on the SD card: 300Create a dir on the SD card:
298mkdir /mnt/card/localmail 301mkdir /mnt/card/localmail
299Go to your home dir: 302Go to your home dir:
300cd 303cd
301Go to kopiemail data storage dir: 304Go to kopiemail data storage dir:
302cd kdepim/apps/kopiemail 305cd kdepim/apps/kopiemail
303Create a symlink to the SD card: 306Create a symlink to the SD card:
304ls -s /mnt/card/localmail 307ls -s /mnt/card/localmail
305Now KOpieMail will store all mails on the SD card. 308Now KOpieMail will store all mails on the SD card.
306 309
307KO/Pi Monthview: 310KO/Pi Monthview:
308Now "Go to Today" selects the current month from day 1-end, 311Now "Go to Today" selects the current month from day 1-end,
309not the current date + some days. 312not the current date + some days.
310I.e. "Go to Today" shows now always 313I.e. "Go to Today" shows now always
311the current month with first day of month in the first row. 314the current month with first day of month in the first row.
312 315
313Added missing German translation. 316Added missing German translation.
314 317
315Fixed icons of executeable on Wintendo. 318Fixed icons of executeable on Wintendo.
316 319
317Added a "Show next Mail" button to the OM/Pi 320Added a "Show next Mail" button to the OM/Pi
318mail viewer such that the mail below the current mail 321mail viewer such that the mail below the current mail
319in the mail list view of the current folder 322in the mail list view of the current folder
320can be read with a single click. 323can be read with a single click.
321 324
322 325
323********** VERSION 1.9.13 ************ 326********** VERSION 1.9.13 ************
324 327
325Fixed nasty PwM/Pi file reading bug, when 328Fixed nasty PwM/Pi file reading bug, when
326the used hash algo of file is different then the global 329the used hash algo of file is different then the global
327hash algo. 330hash algo.
328 331
329Added KA/Pi support for opie mailit mailapplication. 332Added KA/Pi support for opie mailit mailapplication.
330 333
331Fixed some bugs in OM/Pi. 334Fixed some bugs in OM/Pi.
332Now character conversion tables are available for the Zaurus 335Now character conversion tables are available for the Zaurus
333to make OM/Pi working properly. 336to make OM/Pi working properly.
334To get the character conversion in OM/Pi working, please download 337To get the character conversion in OM/Pi working, please download
335at the sourceforge project site the package 338at the sourceforge project site the package
336sr-character-conversion_SharpROM_arm.ipk.zip 339sr-character-conversion_SharpROM_arm.ipk.zip
337(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 340(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
338from the section "general files for KDE/Pim" 341from the section "general files for KDE/Pim"
339Instructions how to install this package are in a ReadMe in this file. 342Instructions how to install this package are in a ReadMe in this file.
340 343
341 344
342Fixed the orientation change problem in KA/Pi when switching 345Fixed the orientation change problem in KA/Pi when switching
343portrait/landscape mode. 346portrait/landscape mode.
344 347
345French translation available for KA/Pi and OM/Pi. 348French translation available for KA/Pi and OM/Pi.
346 349
347Fixed some problems with categories in KO/Pi in DTM sync. 350Fixed some problems with categories in KO/Pi in DTM sync.
348 351
349Added selection dialog for export to phone in KA/Pi. 352Added selection dialog for export to phone in KA/Pi.
350 353
351If in KO/Pi is an attendee selected to add to a meeting and this 354If in KO/Pi is an attendee selected to add to a meeting and this
352attendee is already in the list of attendees, this person is not added 355attendee is already in the list of attendees, this person is not added
353again. 356again.
354 357
355Some menu cleanup in KA/Pi. 358Some menu cleanup in KA/Pi.
356 359
357********** VERSION 1.9.12 ************ 360********** VERSION 1.9.12 ************
358 361
359Fix for the bug in KO/Pi What's Next view of version 1.9.11. 362Fix for the bug in KO/Pi What's Next view of version 1.9.11.
360 363
361Bugfix: Licence file is now shown again. 364Bugfix: Licence file is now shown again.
362 365
363OM/Pi now supports Unicode (utf8 charset). 366OM/Pi now supports Unicode (utf8 charset).
364Fixed some bugs in OM/Pi. 367Fixed some bugs in OM/Pi.
365 368
366KA/Pi has more German translation. 369KA/Pi has more German translation.
367 370
368 371
369********** VERSION 1.9.11 ************ 372********** VERSION 1.9.11 ************
370 373
371Fixed several problems in PWM/Pi, like 374Fixed several problems in PWM/Pi, like
372asking the user, if unsaved changed are pending 375asking the user, if unsaved changed are pending
373when closing the app. 376when closing the app.
374And PwM/Pi handles now different texts for the 377And PwM/Pi handles now different texts for the
375fields Description, Username, Password, configurable per category. 378fields Description, Username, Password, configurable per category.
376 379
377Fixed a crash in KO/Pi , when importing/loading vcs files 380Fixed a crash in KO/Pi , when importing/loading vcs files
378which have an entry with an attendee with state: 381which have an entry with an attendee with state:
379NEEDS ACTION 382NEEDS ACTION
380 383
381Fixed some problems in the German translation of OM/Pi, 384Fixed some problems in the German translation of OM/Pi,
382which makes some dialogs not fitting on the screen 385which makes some dialogs not fitting on the screen
383of the Z 5500. 386of the Z 5500.
384 387
385Fixed Qtopia crash, when disabling/deinstalling 388Fixed Qtopia crash, when disabling/deinstalling
386KO/Pi alarm applet. 389KO/Pi alarm applet.
387 390
388Implemented direct KDE<->KA/Pi sync for KA/Pi running 391Implemented direct KDE<->KA/Pi sync for KA/Pi running
389on Linux desktop. 392on Linux desktop.
390 393
391Added feature "remove sync info" to sync menu. 394Added feature "remove sync info" to sync menu.
392 395
393Tweaked the KO/Pi What's next view a bit, added 396Tweaked the KO/Pi What's next view a bit, added
394setting to hide events that are done. 397setting to hide events that are done.
395 398
396Disabled "beam receive enabled" on startup to 399Disabled "beam receive enabled" on startup to
397avoid problems if Fastload is enabled. 400avoid problems if Fastload is enabled.
398Please set "beam receive enabled", 401Please set "beam receive enabled",
399if you want to receive data via IR. 402if you want to receive data via IR.
400 403
401Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 404Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
402on Linux desktop. 405on Linux desktop.
403 406
404Made in KA/Pi scrolling possible, if details view is selected. 407Made in KA/Pi scrolling possible, if details view is selected.
405(The keyboard focus is set automatically to the search line) 408(The keyboard focus is set automatically to the search line)
406 409
407Fixed a bug in DMT sync, that a new entry in DTM was added 410Fixed a bug in DMT sync, that a new entry in DTM was added
408on every sync to Kx/Pi. 411on every sync to Kx/Pi.
409 412
410Fixed missing writing of KA/Pi categories to DMT entries when syncing. 413Fixed missing writing of KA/Pi categories to DMT entries when syncing.
411 414
412Fixed a bug in DMT sync with todos created in KO/Pi containing 415Fixed a bug in DMT sync with todos created in KO/Pi containing
413non-latin1 characters. 416non-latin1 characters.
414 417
415Rearranged package contents of Sharp-ipks and made all 418Rearranged package contents of Sharp-ipks and made all
416packages installable on SD again. 419packages installable on SD again.
417 420
418Fixed the writing of addressbook data in DTM sync. 421Fixed the writing of addressbook data in DTM sync.
419Empty fields in KA/Pi were not removed. 422Empty fields in KA/Pi were not removed.
420 423
421Added better category handling in KA/Pi: 424Added better category handling in KA/Pi:
422Added item 425Added item
423Edit Categories and 426Edit Categories and
424Manage new categories 427Manage new categories
425to the settings menu. 428to the settings menu.
426Possible to configure a view to display categories. 429Possible to configure a view to display categories.
427 430
428Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 431Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
429 432
430Fixed displaying of "free" days and time in KO Monthview and Agendaview. 433Fixed displaying of "free" days and time in KO Monthview and Agendaview.
431 434
432... and many other bugfixes. 435... and many other bugfixes.
433 436
434********** VERSION 1.9.10 ************ 437********** VERSION 1.9.10 ************
435 438
436Many internal small bugfixes. 439Many internal small bugfixes.
437And fix of the "big" bug in KO/Pi, 440And fix of the "big" bug in KO/Pi,
438that after Syncing the appointments had an offset by several hours. 441that after Syncing the appointments had an offset by several hours.
439That was a problem with the internal timezone setting, 442That was a problem with the internal timezone setting,
440introduced by the changed timezone configuration settings. 443introduced by the changed timezone configuration settings.
441 444
442German translation for OM/Pi is now available. 445German translation for OM/Pi is now available.
443 446
444 447
445********** VERSION 1.9.9 ************ 448********** VERSION 1.9.9 ************
446 449
447KDE-Pim/Pi has a new Member! 450KDE-Pim/Pi has a new Member!
448It is called PWM/Pi (Passwordmanager/platform-independent) 451It is called PWM/Pi (Passwordmanager/platform-independent)
449and it is available for the Zaurus. 452and it is available for the Zaurus.
450It is planned, that it will be available later for Windows. 453It is planned, that it will be available later for Windows.
451(And for Linux, of course). 454(And for Linux, of course).
452It is a port of the Passwordmanager of KDE. 455It is a port of the Passwordmanager of KDE.
453It will need the MicroKDElibs to run. 456It will need the MicroKDElibs to run.
454 457
455Made loading of addressbooks in KA/Pi up to 7 times faster! 458Made loading of addressbooks in KA/Pi up to 7 times faster!
456The bigger your addressbook file, the more starting speed 459The bigger your addressbook file, the more starting speed
457will you gain. (relatively) 460will you gain. (relatively)
458 461
459The Qtopia addressbook connector is now platform independend 462The Qtopia addressbook connector is now platform independend
460as well and should work on any platform for importing/exporting 463as well and should work on any platform for importing/exporting
461Qtopia and Opie XML files. 464Qtopia and Opie XML files.
462 465
463Added a +30min feature to the timezone settings to make 466Added a +30min feature to the timezone settings to make
464KDE-Pim/Pi useable in Australia and other parts on the 467KDE-Pim/Pi useable in Australia and other parts on the
465world with strange timezones ;-) 468world with strange timezones ;-)
466 469
467German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 470German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
468 471
469It is now possible to disable the 472It is now possible to disable the
470"receive data via infrared" feature, such that syncing with 473"receive data via infrared" feature, such that syncing with
471Outlook is now possible again with Kx/Pi runing. 474Outlook is now possible again with Kx/Pi runing.
472Please disable it, before syncing Sharp DTM with Outlook. 475Please disable it, before syncing Sharp DTM with Outlook.
473For your convenience, the "receive data via infrared" feature 476For your convenience, the "receive data via infrared" feature
474is disabled automatically, if you sync Kx/Pi with DTM. 477is disabled automatically, if you sync Kx/Pi with DTM.
475You have to enable it again manually after syncing. 478You have to enable it again manually after syncing.
476Enabling this feature makes it impossible to start the 479Enabling this feature makes it impossible to start the
477Sharp DTM apps. If this feature is enabled, you will only get the 480Sharp DTM apps. If this feature is enabled, you will only get the
478alarm notification from KO/Pi and not from the Sharp calendar. 481alarm notification from KO/Pi and not from the Sharp calendar.
479This is very useful if you sync KO/Pi with Sharp DTM, 482This is very useful if you sync KO/Pi with Sharp DTM,
480because after syncing you usually would get notified about 483because after syncing you usually would get notified about
481an alarm by KO/Pi and the Sharp Calendar. 484an alarm by KO/Pi and the Sharp Calendar.
482 485
483Together with the Linux desktop version of KO/Pi 486Together with the Linux desktop version of KO/Pi
484it is now possible to sync KO/Pi on the Zaurus 487it is now possible to sync KO/Pi on the Zaurus
485with the complete KDE-desktop (3.3 or later) 488with the complete KDE-desktop (3.3 or later)
486calendar data easily. 489calendar data easily.
487That makes it possible to sync the Z with one 490That makes it possible to sync the Z with one
488click of a mouse with the KDE-Desktop. 491click of a mouse with the KDE-Desktop.
489This feature it available for all Zaurus platforms KO/Pi 492This feature it available for all Zaurus platforms KO/Pi
490is running on. 493is running on.
491The only thing needed is a running KO/Pi on Linux and 494The only thing needed is a running KO/Pi on Linux and
492a compiled version of the small 495a compiled version of the small
493KDE-Pim/Pi<->KDE-Desktop access command line program, 496KDE-Pim/Pi<->KDE-Desktop access command line program,
494which is in the KDE-Pim/Pi sources available. 497which is in the KDE-Pim/Pi sources available.
495 498
496The "KDE-desktop" syncing feature for KA/Pi will follow 499The "KDE-desktop" syncing feature for KA/Pi will follow
497in the next releases. 500in the next releases.
498 501
499Fixed the vcard export bug, which had the version 1.9.8. 502Fixed the vcard export bug, which had the version 1.9.8.
500 503
501Added missing GERMAN translation to KO/Pi. 504Added missing GERMAN translation to KO/Pi.
502Hi PsionX, could you add the missing french translation?Thx! 505Hi PsionX, could you add the missing french translation?Thx!
503 506
504Translation files for KA/Pi are available as well. 507Translation files for KA/Pi are available as well.
505GERMAN translation will be available in the next release. 508GERMAN translation will be available in the next release.
506PsionX ( yres, you again ;-) ), could you start translating 509PsionX ( yres, you again ;-) ), could you start translating
507KA/Pi? Thx! 510KA/Pi? Thx!
508 511
509You can download the version 1.9.9 at 512You can download the version 1.9.9 at
510 513
511http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 514http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
512 515
513Note: 516Note:
514To run the mail program OM/Pi you need libopenssl. 517To run the mail program OM/Pi you need libopenssl.
515A link to a download loaction is available at 518A link to a download loaction is available at
516ZSI at www.killefiz.de 519ZSI at www.killefiz.de
517 520
518 521
519********** VERSION 1.9.8 ************ 522********** VERSION 1.9.8 ************
520 523
521Fixed character decoding in OM/Pi. 524Fixed character decoding in OM/Pi.
522(e.g. German "Umlaute" were not displayed properly.) 525(e.g. German "Umlaute" were not displayed properly.)
523 526
524Made is possible to reparent todos in KO/Pi. 527Made is possible to reparent todos in KO/Pi.
525Use contextmenu or keys (look at Help-Keys + Colors) for that. 528Use contextmenu or keys (look at Help-Keys + Colors) for that.
526 529
527Added the missing Sync-Howto and WhatsNew to the packages. 530Added the missing Sync-Howto and WhatsNew to the packages.
528 531
529KO/Pi on Linux desktop can now sync with KDE desktop. 532KO/Pi on Linux desktop can now sync with KDE desktop.
530That means: When using KO/Pi on Linux desktop for syncing with 533That means: When using KO/Pi on Linux desktop for syncing with
531KDE desktop and the Zaurus, the Zaurus can be synced now 534KDE desktop and the Zaurus, the Zaurus can be synced now
532with all KDE-Calendar resources, not only with one local file. 535with all KDE-Calendar resources, not only with one local file.
533(That makes it possible to sync the Zaurus with the 536(That makes it possible to sync the Zaurus with the
534calendar data on a Kolab server) 537calendar data on a Kolab server)
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d0dbb47..acd9265 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -11,1025 +11,1025 @@
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 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include <klocale.h> 38#include <klocale.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
45#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
47#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
48#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
49#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
50#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68 68
69 69
70class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
71{ 71{
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 98
99 bool ok = false; 99 bool ok = false;
100 QString start, end; 100 QString start, end;
101 QDate ds, de; 101 QDate ds, de;
102 if ( e->doesRecur() ) { 102 if ( e->doesRecur() ) {
103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 103 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
104 if ( ok ) { 104 if ( ok ) {
105 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 105 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
106 start = KGlobal::locale()->formatDate(ds,true); 106 start = KGlobal::locale()->formatDate(ds,true);
107 de = ds.addDays( days); 107 de = ds.addDays( days);
108 end = KGlobal::locale()->formatDate(de,true); 108 end = KGlobal::locale()->formatDate(de,true);
109 } 109 }
110 110
111 } 111 }
112 if ( ! ok ) { 112 if ( ! ok ) {
113 start =e->dtStartDateStr(); 113 start =e->dtStartDateStr();
114 end = e->dtEndDateStr(); 114 end = e->dtEndDateStr();
115 ds = e->dtStart().date(); 115 ds = e->dtStart().date();
116 de = e->dtEnd().date(); 116 de = e->dtEnd().date();
117 } 117 }
118 mItem->setText(0,e->summary()); 118 mItem->setText(0,e->summary());
119 mItem->setText(1,start); 119 mItem->setText(1,start);
120 mItem->setText(2,e->dtStartTimeStr()); 120 mItem->setText(2,e->dtStartTimeStr());
121 mItem->setText(3,end); 121 mItem->setText(3,end);
122 mItem->setText(4,e->dtEndTimeStr()); 122 mItem->setText(4,e->dtEndTimeStr());
123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 123 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
124 mItem->setText(6, e->recurrence()->recurrenceText()); 124 mItem->setText(6, e->recurrence()->recurrenceText());
125 mItem->setText(7,"---"); 125 mItem->setText(7,"---");
126 mItem->setText(8,"---"); 126 mItem->setText(8,"---");
127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 127 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
128 mItem->setText(10,e->categoriesStr()); 128 mItem->setText(10,e->categoriesStr());
129 129
130 QString key; 130 QString key;
131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 131 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 132 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
133 mItem->setSortKey(1,key); 133 mItem->setSortKey(1,key);
134 134
135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 135 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 136 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
137 mItem->setSortKey(3,key); 137 mItem->setSortKey(3,key);
138 138
139 return true; 139 return true;
140} 140}
141 141
142bool ListItemVisitor::visit(Todo *t) 142bool ListItemVisitor::visit(Todo *t)
143{ 143{
144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 144 mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
145 if (t->hasStartDate()) { 145 if (t->hasStartDate()) {
146 mItem->setText(1,t->dtStartDateStr()); 146 mItem->setText(1,t->dtStartDateStr());
147 if (t->doesFloat()) { 147 if (t->doesFloat()) {
148 mItem->setText(2,"---"); 148 mItem->setText(2,"---");
149 } else { 149 } else {
150 mItem->setText(2,t->dtStartTimeStr()); 150 mItem->setText(2,t->dtStartTimeStr());
151 } 151 }
152 } else { 152 } else {
153 mItem->setText(1,"---"); 153 mItem->setText(1,"---");
154 mItem->setText(2,"---"); 154 mItem->setText(2,"---");
155 } 155 }
156 mItem->setText(3,"---"); 156 mItem->setText(3,"---");
157 mItem->setText(4,"---"); 157 mItem->setText(4,"---");
158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 158 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
159 mItem->setText(6,"---"); 159 mItem->setText(6,"---");
160 if (t->hasDueDate()) { 160 if (t->hasDueDate()) {
161 mItem->setText(7,t->dtDueDateStr()); 161 mItem->setText(7,t->dtDueDateStr());
162 if (t->doesFloat()) { 162 if (t->doesFloat()) {
163 mItem->setText(8,"---"); 163 mItem->setText(8,"---");
164 } else { 164 } else {
165 mItem->setText(8,t->dtDueTimeStr()); 165 mItem->setText(8,t->dtDueTimeStr());
166 } 166 }
167 } else { 167 } else {
168 mItem->setText(7,"---"); 168 mItem->setText(7,"---");
169 mItem->setText(8,"---"); 169 mItem->setText(8,"---");
170 } 170 }
171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 171 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
172 mItem->setText(10,t->categoriesStr()); 172 mItem->setText(10,t->categoriesStr());
173 173
174 QString key; 174 QString key;
175 QDate d; 175 QDate d;
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 d = t->dtDue().date(); 177 d = t->dtDue().date();
178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 178 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 179 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
180 mItem->setSortKey(7,key); 180 mItem->setSortKey(7,key);
181 } 181 }
182 if ( t->hasStartDate() ) { 182 if ( t->hasStartDate() ) {
183 d = t->dtStart().date(); 183 d = t->dtStart().date();
184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 184 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 185 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
186 mItem->setSortKey(1,key); 186 mItem->setSortKey(1,key);
187 } 187 }
188 return true; 188 return true;
189} 189}
190 190
191bool ListItemVisitor::visit(Journal * j) 191bool ListItemVisitor::visit(Journal * j)
192{ 192{
193 QString des = j->description().left(50); 193 QString des = j->description().left(50);
194 des = des.simplifyWhiteSpace (); 194 des = des.simplifyWhiteSpace ();
195 des.replace (QRegExp ("\\n"),"" ); 195 des.replace (QRegExp ("\\n"),"" );
196 des.replace (QRegExp ("\\r"),"" ); 196 des.replace (QRegExp ("\\r"),"" );
197 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 197 mItem->setText(0,i18n("Journal")+": "+des.left(25));
198 mItem->setText(1,j->dtStartDateStr()); 198 mItem->setText(1,j->dtStartDateStr());
199 mItem->setText(2,"---"); 199 mItem->setText(2,"---");
200 mItem->setText(3,"---"); 200 mItem->setText(3,"---");
201 mItem->setText(4,"---"); 201 mItem->setText(4,"---");
202 mItem->setText(5,"---"); 202 mItem->setText(5,"---");
203 mItem->setText(6,"---"); 203 mItem->setText(6,"---");
204 mItem->setText(7,j->dtStartDateStr()); 204 mItem->setText(7,j->dtStartDateStr());
205 mItem->setText(8,"---"); 205 mItem->setText(8,"---");
206 mItem->setText(9,"---"); 206 mItem->setText(9,"---");
207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 207 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
208 208
209 QString key; 209 QString key;
210 QDate d = j->dtStart().date(); 210 QDate d = j->dtStart().date();
211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 211 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
212 mItem->setSortKey(1,key); 212 mItem->setSortKey(1,key);
213 mItem->setSortKey(7,key); 213 mItem->setSortKey(7,key);
214 214
215 return true; 215 return true;
216} 216}
217 217
218KOListView::KOListView(Calendar *calendar, QWidget *parent, 218KOListView::KOListView(Calendar *calendar, QWidget *parent,
219 const char *name) 219 const char *name)
220 : KOEventView(calendar, parent, name) 220 : KOEventView(calendar, parent, name)
221{ 221{
222 mActiveItem = 0; 222 mActiveItem = 0;
223 mListView = new KOListViewListView(this); 223 mListView = new KOListViewListView(this);
224 mListView->addColumn(i18n("Summary")); 224 mListView->addColumn(i18n("Summary"));
225 mListView->addColumn(i18n("Start Date")); 225 mListView->addColumn(i18n("Start Date"));
226 mListView->addColumn(i18n("Start Time")); 226 mListView->addColumn(i18n("Start Time"));
227 mListView->addColumn(i18n("End Date")); 227 mListView->addColumn(i18n("End Date"));
228 mListView->addColumn(i18n("End Time")); 228 mListView->addColumn(i18n("End Time"));
229 mListView->addColumn(i18n("Alarm")); // alarm set? 229 mListView->addColumn(i18n("Alarm")); // alarm set?
230 mListView->addColumn(i18n("Recurs")); // recurs? 230 mListView->addColumn(i18n("Recurs")); // recurs?
231 mListView->addColumn(i18n("Due Date")); 231 mListView->addColumn(i18n("Due Date"));
232 mListView->addColumn(i18n("Due Time")); 232 mListView->addColumn(i18n("Due Time"));
233 mListView->addColumn(i18n("Cancelled")); 233 mListView->addColumn(i18n("Cancelled"));
234 mListView->addColumn(i18n("Categories")); 234 mListView->addColumn(i18n("Categories"));
235 235
236 mListView->setColumnAlignment(0,AlignLeft); 236 mListView->setColumnAlignment(0,AlignLeft);
237 mListView->setColumnAlignment(1,AlignLeft); 237 mListView->setColumnAlignment(1,AlignLeft);
238 mListView->setColumnAlignment(2,AlignHCenter); 238 mListView->setColumnAlignment(2,AlignHCenter);
239 mListView->setColumnAlignment(3,AlignLeft); 239 mListView->setColumnAlignment(3,AlignLeft);
240 mListView->setColumnAlignment(4,AlignHCenter); 240 mListView->setColumnAlignment(4,AlignHCenter);
241 mListView->setColumnAlignment(5,AlignLeft); 241 mListView->setColumnAlignment(5,AlignLeft);
242 mListView->setColumnAlignment(6,AlignLeft); 242 mListView->setColumnAlignment(6,AlignLeft);
243 mListView->setColumnAlignment(7,AlignLeft); 243 mListView->setColumnAlignment(7,AlignLeft);
244 mListView->setColumnAlignment(8,AlignLeft); 244 mListView->setColumnAlignment(8,AlignLeft);
245 mListView->setColumnAlignment(9,AlignLeft); 245 mListView->setColumnAlignment(9,AlignLeft);
246 mListView->setColumnAlignment(10,AlignLeft); 246 mListView->setColumnAlignment(10,AlignLeft);
247 mListView->setColumnWidthMode(10, QListView::Manual); 247 mListView->setColumnWidthMode(10, QListView::Manual);
248 new KOListViewWhatsThis(mListView->viewport(),this); 248 new KOListViewWhatsThis(mListView->viewport(),this);
249 249
250 int iii = 0; 250 int iii = 0;
251 for ( iii = 0; iii< 10 ; ++iii ) 251 for ( iii = 0; iii< 10 ; ++iii )
252 mListView->setColumnWidthMode( iii, QListView::Manual ); 252 mListView->setColumnWidthMode( iii, QListView::Manual );
253 253
254 QBoxLayout *layoutTop = new QVBoxLayout(this); 254 QBoxLayout *layoutTop = new QVBoxLayout(this);
255 layoutTop->addWidget(mListView); 255 layoutTop->addWidget(mListView);
256 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 256 mListView->setFont ( KOPrefs::instance()->mListViewFont );
257 mPopupMenu = eventPopup(); 257 mPopupMenu = eventPopup();
258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 258 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
259 i18n("Select all"),this, 259 i18n("Select all"),this,
260 SLOT(allSelection()),true); 260 SLOT(allSelection()),true);
261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 261 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
262 i18n("Deselect all"),this, 262 i18n("Deselect all"),this,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
265 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
266 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 268 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
269 i18n("Save selected to file..."),this, 269 i18n("Save selected to file..."),this,
270 SLOT(saveToFile()),true); 270 SLOT(saveToFile()),true);
271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 271 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
272 i18n("Save Journal/Description..."),this, 272 i18n("Save Journal/Description..."),this,
273 SLOT(saveDescriptionToFile()),true); 273 SLOT(saveDescriptionToFile()),true);
274 // mPopupMenu->insertSeparator(); 274 // mPopupMenu->insertSeparator();
275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 275 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
276 i18n("Add Categ. to selected..."),this, 276 i18n("Add Categ. to selected..."),this,
277 SLOT(addCat()),true); 277 SLOT(addCat()),true);
278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 278 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
279 i18n("Set Categ. for selected..."),this, 279 i18n("Set Categ. for selected..."),this,
280 SLOT(setCat()),true); 280 SLOT(setCat()),true);
281 //mPopupMenu->insertSeparator(); 281 //mPopupMenu->insertSeparator();
282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 282 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
283 i18n("Set alarm for selected..."),this, 283 i18n("Set alarm for selected..."),this,
284 SLOT(setAlarm()),true); 284 SLOT(setAlarm()),true);
285 285
286 286
287#ifndef DESKTOP_VERSION 287#ifndef DESKTOP_VERSION
288 mPopupMenu->insertSeparator(); 288 mPopupMenu->insertSeparator();
289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 289 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
290 i18n("Beam selected via IR"),this, 290 i18n("Beam selected via IR"),this,
291 SLOT(beamSelected()),true); 291 SLOT(beamSelected()),true);
292#endif 292#endif
293 /* 293 /*
294 mPopupMenu = new QPopupMenu; 294 mPopupMenu = new QPopupMenu;
295 mPopupMenu->insertItem(i18n("Edit Event"), this, 295 mPopupMenu->insertItem(i18n("Edit Event"), this,
296 SLOT (editEvent())); 296 SLOT (editEvent()));
297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 297 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
298 SLOT (deleteEvent())); 298 SLOT (deleteEvent()));
299 mPopupMenu->insertSeparator(); 299 mPopupMenu->insertSeparator();
300 mPopupMenu->insertItem(i18n("Show Dates"), this, 300 mPopupMenu->insertItem(i18n("Show Dates"), this,
301 SLOT(showDates())); 301 SLOT(showDates()));
302 mPopupMenu->insertItem(i18n("Hide Dates"), this, 302 mPopupMenu->insertItem(i18n("Hide Dates"), this,
303 SLOT(hideDates())); 303 SLOT(hideDates()));
304 */ 304 */
305 QObject::connect(mListView,SIGNAL( newEvent()), 305 QObject::connect(mListView,SIGNAL( newEvent()),
306 this,SIGNAL(signalNewEvent())); 306 this,SIGNAL(signalNewEvent()));
307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 307 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
308 this,SLOT(defaultItemAction(QListViewItem *))); 308 this,SLOT(defaultItemAction(QListViewItem *)));
309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 309 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
310 const QPoint &, int )), 310 const QPoint &, int )),
311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 311 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 312 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
313 SLOT(processSelectionChange(QListViewItem *))); 313 SLOT(processSelectionChange(QListViewItem *)));
314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 314 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
315 SIGNAL(showIncidenceSignal(Incidence *)) ); 315 SIGNAL(showIncidenceSignal(Incidence *)) );
316 316
317 readSettings(KOGlobals::config(),"KOListView Layout"); 317 readSettings(KOGlobals::config(),"KOListView Layout");
318} 318}
319 319
320KOListView::~KOListView() 320KOListView::~KOListView()
321{ 321{
322 delete mPopupMenu; 322 delete mPopupMenu;
323} 323}
324QString KOListView::getWhatsThisText(QPoint p) 324QString KOListView::getWhatsThisText(QPoint p)
325{ 325{
326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 326 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
327 if ( item ) 327 if ( item )
328 return KIncidenceFormatter::instance()->getFormattedText( item->data() ); 328 return KIncidenceFormatter::instance()->getFormattedText( item->data() );
329 return i18n("That is the list view" ); 329 return i18n("That is the list view" );
330 330
331} 331}
332 332
333void KOListView::updateList() 333void KOListView::updateList()
334{ 334{
335 // qDebug(" KOListView::updateList() "); 335 // qDebug(" KOListView::updateList() ");
336 336
337} 337}
338 338
339void KOListView::addCat( ) 339void KOListView::addCat( )
340{ 340{
341 setCategories( false ); 341 setCategories( false );
342} 342}
343void KOListView::setCat() 343void KOListView::setCat()
344{ 344{
345 setCategories( true ); 345 setCategories( true );
346} 346}
347void KOListView::setAlarm() 347void KOListView::setAlarm()
348{ 348{
349 KOAlarmPrefs kap( this); 349 KOAlarmPrefs kap( this);
350 if ( !kap.exec() ) 350 if ( !kap.exec() )
351 return; 351 return;
352 352
353 353
354 QStringList itemList; 354 QStringList itemList;
355 QPtrList<KOListViewItem> sel ; 355 QPtrList<KOListViewItem> sel ;
356 QListViewItem *qitem = mListView->firstChild (); 356 QListViewItem *qitem = mListView->firstChild ();
357 while ( qitem ) { 357 while ( qitem ) {
358 if ( qitem->isSelected() ) { 358 if ( qitem->isSelected() ) {
359 Incidence* inc = ((KOListViewItem *) qitem)->data(); 359 Incidence* inc = ((KOListViewItem *) qitem)->data();
360 if ( inc->type() != "Journal" ) { 360 if ( inc->type() != "Journal" ) {
361 if ( inc->type() == "Todo" ) { 361 if ( inc->type() == "Todo" ) {
362 if ( ((Todo*)inc)->hasDueDate() ) 362 if ( ((Todo*)inc)->hasDueDate() )
363 sel.append(((KOListViewItem *)qitem)); 363 sel.append(((KOListViewItem *)qitem));
364 } else 364 } else
365 sel.append(((KOListViewItem *)qitem)); 365 sel.append(((KOListViewItem *)qitem));
366 } 366 }
367 } 367 }
368 qitem = qitem->nextSibling(); 368 qitem = qitem->nextSibling();
369 } 369 }
370 int count = 0; 370 int count = 0;
371 KOListViewItem * item, *temp; 371 KOListViewItem * item, *temp;
372 item = sel.first(); 372 item = sel.first();
373 Incidence* inc; 373 Incidence* inc;
374 while ( item ) { 374 while ( item ) {
375 inc = item->data(); 375 inc = item->data();
376 ++count; 376 ++count;
377 if (kap.mAlarmButton->isChecked()) { 377 if (kap.mAlarmButton->isChecked()) {
378 if (inc->alarms().count() == 0) 378 if (inc->alarms().count() == 0)
379 inc->newAlarm(); 379 inc->newAlarm();
380 QPtrList<Alarm> alarms = inc->alarms(); 380 QPtrList<Alarm> alarms = inc->alarms();
381 Alarm *alarm; 381 Alarm *alarm;
382 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 382 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
383 alarm->setEnabled(true); 383 alarm->setEnabled(true);
384 int j = kap.mAlarmTimeEdit->value()* -60; 384 int j = kap.mAlarmTimeEdit->value()* -60;
385 if (kap.mAlarmIncrCombo->currentItem() == 1) 385 if (kap.mAlarmIncrCombo->currentItem() == 1)
386 j = j * 60; 386 j = j * 60;
387 else if (kap.mAlarmIncrCombo->currentItem() == 2) 387 else if (kap.mAlarmIncrCombo->currentItem() == 2)
388 j = j * (60 * 24); 388 j = j * (60 * 24);
389 alarm->setStartOffset( j ); 389 alarm->setStartOffset( j );
390 390
391 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 391 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
392 alarm->setProcedureAlarm(kap.mAlarmProgram); 392 alarm->setProcedureAlarm(kap.mAlarmProgram);
393 } 393 }
394 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 394 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
395 alarm->setAudioAlarm(kap.mAlarmSound); 395 alarm->setAudioAlarm(kap.mAlarmSound);
396 else 396 else
397 alarm->setType(Alarm::Invalid); 397 alarm->setType(Alarm::Invalid);
398 //alarm->setAudioAlarm("default"); 398 //alarm->setAudioAlarm("default");
399 // TODO: Deal with multiple alarms 399 // TODO: Deal with multiple alarms
400 break; // For now, stop after the first alarm 400 break; // For now, stop after the first alarm
401 } 401 }
402 } else { 402 } else {
403 Alarm* alarm = inc->alarms().first(); 403 Alarm* alarm = inc->alarms().first();
404 if ( alarm ) { 404 if ( alarm ) {
405 alarm->setEnabled(false); 405 alarm->setEnabled(false);
406 alarm->setType(Alarm::Invalid); 406 alarm->setType(Alarm::Invalid);
407 } 407 }
408 } 408 }
409 temp = item; 409 temp = item;
410 item = sel.next(); 410 item = sel.next();
411 mUidDict.remove( inc->uid() ); 411 mUidDict.remove( inc->uid() );
412 delete temp;; 412 delete temp;;
413 addIncidence( inc ); 413 addIncidence( inc );
414 } 414 }
415 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 415 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
416 qDebug("KO: Set alarm for %d items", count); 416 qDebug("KO: Set alarm for %d items", count);
417 calendar()->reInitAlarmSettings(); 417 calendar()->reInitAlarmSettings();
418} 418}
419void KOListView::setCategories( bool removeOld ) 419void KOListView::setCategories( bool removeOld )
420{ 420{
421 421
422 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 422 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
423 if (! csd->exec()) { 423 if (! csd->exec()) {
424 delete csd; 424 delete csd;
425 return; 425 return;
426 } 426 }
427 QStringList catList = csd->selectedCategories(); 427 QStringList catList = csd->selectedCategories();
428 delete csd; 428 delete csd;
429 // if ( catList.count() == 0 ) 429 // if ( catList.count() == 0 )
430 // return; 430 // return;
431 catList.sort(); 431 catList.sort();
432 QString categoriesStr = catList.join(","); 432 QString categoriesStr = catList.join(",");
433 int i; 433 int i;
434 QStringList itemList; 434 QStringList itemList;
435 QPtrList<KOListViewItem> sel ; 435 QPtrList<KOListViewItem> sel ;
436 QListViewItem *qitem = mListView->firstChild (); 436 QListViewItem *qitem = mListView->firstChild ();
437 while ( qitem ) { 437 while ( qitem ) {
438 if ( qitem->isSelected() ) { 438 if ( qitem->isSelected() ) {
439 sel.append(((KOListViewItem *)qitem)); 439 sel.append(((KOListViewItem *)qitem));
440 } 440 }
441 qitem = qitem->nextSibling(); 441 qitem = qitem->nextSibling();
442 } 442 }
443 KOListViewItem * item, *temp; 443 KOListViewItem * item, *temp;
444 item = sel.first(); 444 item = sel.first();
445 Incidence* inc; 445 Incidence* inc;
446 while ( item ) { 446 while ( item ) {
447 inc = item->data(); 447 inc = item->data();
448 if ( removeOld ) { 448 if ( removeOld ) {
449 inc->setCategories( categoriesStr ); 449 inc->setCategories( categoriesStr );
450 } else { 450 } else {
451 itemList = QStringList::split (",", inc->categoriesStr() ); 451 itemList = QStringList::split (",", inc->categoriesStr() );
452 for( i = 0; i< catList.count(); ++i ) { 452 for( i = 0; i< catList.count(); ++i ) {
453 if ( !itemList.contains (catList[i])) 453 if ( !itemList.contains (catList[i]))
454 itemList.append( catList[i] ); 454 itemList.append( catList[i] );
455 } 455 }
456 itemList.sort(); 456 itemList.sort();
457 inc->setCategories( itemList.join(",") ); 457 inc->setCategories( itemList.join(",") );
458 } 458 }
459 temp = item; 459 temp = item;
460 item = sel.next(); 460 item = sel.next();
461 mUidDict.remove( inc->uid() ); 461 mUidDict.remove( inc->uid() );
462 delete temp;; 462 delete temp;;
463 addIncidence( inc ); 463 addIncidence( inc );
464 } 464 }
465} 465}
466 466
467void KOListView::beamSelected() 467void KOListView::beamSelected()
468{ 468{
469 int icount = 0; 469 int icount = 0;
470 QPtrList<Incidence> delSel ; 470 QPtrList<Incidence> delSel ;
471 QListViewItem *item = mListView->firstChild (); 471 QListViewItem *item = mListView->firstChild ();
472 while ( item ) { 472 while ( item ) {
473 if ( item->isSelected() ) { 473 if ( item->isSelected() ) {
474 delSel.append(((KOListViewItem *)item)->data()); 474 delSel.append(((KOListViewItem *)item)->data());
475 ++icount; 475 ++icount;
476 } 476 }
477 477
478 item = item->nextSibling(); 478 item = item->nextSibling();
479 } 479 }
480 if ( icount ) { 480 if ( icount ) {
481 emit beamIncidenceList( delSel ); 481 emit beamIncidenceList( delSel );
482 return; 482 return;
483 QString fn ; 483 QString fn ;
484 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 484 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
485 QString mes; 485 QString mes;
486 bool createbup = true; 486 bool createbup = true;
487 if ( createbup ) { 487 if ( createbup ) {
488 QString description = "\n"; 488 QString description = "\n";
489 CalendarLocal* cal = new CalendarLocal(); 489 CalendarLocal* cal = new CalendarLocal();
490 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 490 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
491 Incidence *incidence = delSel.first(); 491 Incidence *incidence = delSel.first();
492 while ( incidence ) { 492 while ( incidence ) {
493 Incidence *in = incidence->clone(); 493 Incidence *in = incidence->clone();
494 description += in->summary() + "\n"; 494 description += in->summary() + "\n";
495 cal->addIncidence( in ); 495 cal->addIncidence( in );
496 incidence = delSel.next(); 496 incidence = delSel.next();
497 } 497 }
498 FileStorage storage( cal, fn, new VCalFormat ); 498 FileStorage storage( cal, fn, new VCalFormat );
499 storage.save(); 499 storage.save();
500 delete cal; 500 delete cal;
501 mes = i18n("KO/Pi: Ready for beaming"); 501 mes = i18n("KO/Pi: Ready for beaming");
502 topLevelWidget()->setCaption(mes); 502 topLevelWidget()->setCaption(mes);
503 503
504#ifndef DESKTOP_VERSION 504#ifndef DESKTOP_VERSION
505 Ir *ir = new Ir( this ); 505 Ir *ir = new Ir( this );
506 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 506 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
507 ir->send( fn, description, "text/x-vCalendar" ); 507 ir->send( fn, description, "text/x-vCalendar" );
508#endif 508#endif
509 } 509 }
510 } 510 }
511} 511}
512void KOListView::beamDone( Ir *ir ) 512void KOListView::beamDone( Ir *ir )
513{ 513{
514#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
515 delete ir; 515 delete ir;
516#endif 516#endif
517 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 517 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
518} 518}
519 519
520void KOListView::saveDescriptionToFile() 520void KOListView::saveDescriptionToFile()
521{ 521{
522 522
523 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 523 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
524 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 524 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
525 i18n("Continue"), i18n("Cancel"), 0, 525 i18n("Continue"), i18n("Cancel"), 0,
526 0, 1 ); 526 0, 1 );
527 if ( result != 0 ) { 527 if ( result != 0 ) {
528 return; 528 return;
529 } 529 }
530 int icount = 0; 530 int icount = 0;
531 QPtrList<Incidence> delSel ; 531 QPtrList<Incidence> delSel ;
532 QListViewItem *item = mListView->firstChild (); 532 QListViewItem *item = mListView->firstChild ();
533 while ( item ) { 533 while ( item ) {
534 if ( item->isSelected() ) { 534 if ( item->isSelected() ) {
535 delSel.append(((KOListViewItem *)item)->data()); 535 delSel.append(((KOListViewItem *)item)->data());
536 ++icount; 536 ++icount;
537 } 537 }
538 538
539 item = item->nextSibling(); 539 item = item->nextSibling();
540 } 540 }
541 if ( icount ) { 541 if ( icount ) {
542 QString fn = KOPrefs::instance()->mLastSaveFile; 542 QString fn = KOPrefs::instance()->mLastSaveFile;
543 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 543 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
544 544
545 if ( fn == "" ) 545 if ( fn == "" )
546 return; 546 return;
547 QFileInfo info; 547 QFileInfo info;
548 info.setFile( fn ); 548 info.setFile( fn );
549 QString mes; 549 QString mes;
550 bool createbup = true; 550 bool createbup = true;
551 if ( info. exists() ) { 551 if ( info. exists() ) {
552 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 552 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
553 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 553 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
554 i18n("Overwrite!"), i18n("Cancel"), 0, 554 i18n("Overwrite!"), i18n("Cancel"), 0,
555 0, 1 ); 555 0, 1 );
556 if ( result != 0 ) { 556 if ( result != 0 ) {
557 createbup = false; 557 createbup = false;
558 } 558 }
559 } 559 }
560 if ( createbup ) { 560 if ( createbup ) {
561 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 561 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
562 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 562 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
563 Incidence *incidence = delSel.first(); 563 Incidence *incidence = delSel.first();
564 icount = 0; 564 icount = 0;
565 while ( incidence ) { 565 while ( incidence ) {
566 if ( incidence->type() == "Journal" ) { 566 if ( incidence->type() == "Journal" ) {
567 text += "\n************************************\n"; 567 text += "\n************************************\n";
568 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 568 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
569 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 569 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
570 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 570 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
571 ++icount; 571 ++icount;
572 572
573 } else { 573 } else {
574 if ( !incidence->description().isEmpty() ) { 574 if ( !incidence->description().isEmpty() ) {
575 text += "\n************************************\n"; 575 text += "\n************************************\n";
576 if ( incidence->type() == "Todo" ) 576 if ( incidence->type() == "Todo" )
577 text += i18n("To-Do: "); 577 text += i18n("To-Do: ");
578 text += incidence->summary(); 578 text += incidence->summary();
579 if ( incidence->hasStartDate() ) 579 if ( incidence->hasStartDate() )
580 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 580 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
581 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 581 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
582 if ( !incidence->location().isEmpty() ) 582 if ( !incidence->location().isEmpty() )
583 text += "\n" +i18n("Location: ") + incidence->location(); 583 text += "\n" +i18n("Location: ") + incidence->location();
584 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 584 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
585 ++icount; 585 ++icount;
586 586
587 } 587 }
588 } 588 }
589 incidence = delSel.next(); 589 incidence = delSel.next();
590 } 590 }
591 QFile file( fn ); 591 QFile file( fn );
592 if (!file.open( IO_WriteOnly ) ) { 592 if (!file.open( IO_WriteOnly ) ) {
593 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 593 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
594 return; 594 return;
595 } 595 }
596 QTextStream ts( &file ); 596 QTextStream ts( &file );
597 ts << text; 597 ts << text;
598 file.close(); 598 file.close();
599 //qDebug("%s ", text.latin1()); 599 //qDebug("%s ", text.latin1());
600 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 600 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
601 KOPrefs::instance()->mLastSaveFile = fn; 601 KOPrefs::instance()->mLastSaveFile = fn;
602 topLevelWidget()->setCaption(mes); 602 topLevelWidget()->setCaption(mes);
603 } 603 }
604 } 604 }
605} 605}
606void KOListView::saveToFile() 606void KOListView::saveToFile()
607{ 607{
608 608
609 int icount = 0; 609 int icount = 0;
610 QPtrList<Incidence> delSel ; 610 QPtrList<Incidence> delSel ;
611 QListViewItem *item = mListView->firstChild (); 611 QListViewItem *item = mListView->firstChild ();
612 while ( item ) { 612 while ( item ) {
613 if ( item->isSelected() ) { 613 if ( item->isSelected() ) {
614 delSel.append(((KOListViewItem *)item)->data()); 614 delSel.append(((KOListViewItem *)item)->data());
615 ++icount; 615 ++icount;
616 } 616 }
617 617
618 item = item->nextSibling(); 618 item = item->nextSibling();
619 } 619 }
620 if ( icount ) { 620 if ( icount ) {
621 QString fn = KOPrefs::instance()->mLastSaveFile; 621 QString fn = KOPrefs::instance()->mLastSaveFile;
622 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 622 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
623 623
624 if ( fn == "" ) 624 if ( fn == "" )
625 return; 625 return;
626 QFileInfo info; 626 QFileInfo info;
627 info.setFile( fn ); 627 info.setFile( fn );
628 QString mes; 628 QString mes;
629 bool createbup = true; 629 bool createbup = true;
630 if ( info. exists() ) { 630 if ( info. exists() ) {
631 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 631 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
632 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 632 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
633 i18n("Overwrite!"), i18n("Cancel"), 0, 633 i18n("Overwrite!"), i18n("Cancel"), 0,
634 0, 1 ); 634 0, 1 );
635 if ( result != 0 ) { 635 if ( result != 0 ) {
636 createbup = false; 636 createbup = false;
637 } 637 }
638 } 638 }
639 if ( createbup ) { 639 if ( createbup ) {
640 CalendarLocal cal; 640 CalendarLocal cal;
641 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 641 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
642 Incidence *incidence = delSel.first(); 642 Incidence *incidence = delSel.first();
643 while ( incidence ) { 643 while ( incidence ) {
644 cal.addIncidence( incidence->clone() ); 644 cal.addIncidence( incidence->clone() );
645 incidence = delSel.next(); 645 incidence = delSel.next();
646 } 646 }
647 ICalFormat format; 647 ICalFormat format;
648 format.save( &cal, fn ); 648 format.save( &cal, fn );
649 mes = i18n("KO/Pi:Saved %1").arg(fn ); 649 mes = i18n("KO/Pi:Saved %1").arg(fn );
650 KOPrefs::instance()->mLastSaveFile = fn; 650 KOPrefs::instance()->mLastSaveFile = fn;
651 topLevelWidget()->setCaption(mes); 651 topLevelWidget()->setCaption(mes);
652 } 652 }
653 } 653 }
654} 654}
655void KOListView::deleteAll() 655void KOListView::deleteAll()
656{ 656{
657 int icount = 0; 657 int icount = 0;
658 QPtrList<Incidence> delSel ; 658 QPtrList<Incidence> delSel ;
659 QListViewItem *item = mListView->firstChild (); 659 QListViewItem *item = mListView->firstChild ();
660 while ( item ) { 660 while ( item ) {
661 if ( item->isSelected() ) { 661 if ( item->isSelected() ) {
662 delSel.append(((KOListViewItem *)item)->data()); 662 delSel.append(((KOListViewItem *)item)->data());
663 ++icount; 663 ++icount;
664 } 664 }
665 665
666 item = item->nextSibling(); 666 item = item->nextSibling();
667 } 667 }
668 if ( icount ) { 668 if ( icount ) {
669 Incidence *incidence = delSel.first(); 669 Incidence *incidence = delSel.first();
670 Incidence *toDelete; 670 Incidence *toDelete;
671 KOPrefs *p = KOPrefs::instance(); 671 KOPrefs *p = KOPrefs::instance();
672 bool confirm = p->mConfirm; 672 bool confirm = p->mConfirm;
673 QString mess; 673 QString mess;
674 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 674 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
675 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 675 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
676 p->mConfirm = false; 676 p->mConfirm = false;
677 int delCounter = 0; 677 int delCounter = 0;
678 QDialog dia ( this, "p-dialog", true ); 678 QDialog dia ( this, "p-dialog", true );
679 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 679 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
680 QVBoxLayout lay( &dia ); 680 QVBoxLayout lay( &dia );
681 lay.setMargin(7); 681 lay.setMargin(7);
682 lay.setSpacing(7); 682 lay.setSpacing(7);
683 lay.addWidget( &lab); 683 lay.addWidget( &lab);
684 QProgressBar bar( icount, &dia ); 684 QProgressBar bar( icount, &dia );
685 lay.addWidget( &bar); 685 lay.addWidget( &bar);
686 int w = 220; 686 int w = 220;
687 int h = 50; 687 int h = 50;
688 int dw = QApplication::desktop()->width(); 688 int dw = QApplication::desktop()->width();
689 int dh = QApplication::desktop()->height(); 689 int dh = QApplication::desktop()->height();
690 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 690 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
691 //dia.resize( 240,50 ); 691 //dia.resize( 240,50 );
692 dia.show(); 692 dia.show();
693 693
694 while ( incidence ) { 694 while ( incidence ) {
695 bar.setProgress( delCounter ); 695 bar.setProgress( delCounter );
696 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 696 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
697 dia.setCaption( mess ); 697 dia.setCaption( mess );
698 qApp->processEvents(); 698 qApp->processEvents();
699 toDelete = (incidence); 699 toDelete = (incidence);
700 incidence = delSel.next(); 700 incidence = delSel.next();
701 emit deleteIncidenceSignal(toDelete ); 701 emit deleteIncidenceSignal(toDelete );
702 if ( dia.result() != 0 ) 702 if ( dia.result() != 0 )
703 break; 703 break;
704 704
705 } 705 }
706 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 706 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
707 topLevelWidget ()->setCaption( mess ); 707 topLevelWidget ()->setCaption( mess );
708 p->mConfirm = confirm; 708 p->mConfirm = confirm;
709 } 709 }
710 } 710 }
711 711
712 712
713} 713}
714int KOListView::maxDatesHint() 714int KOListView::maxDatesHint()
715{ 715{
716 return 0; 716 return 0;
717} 717}
718 718
719int KOListView::currentDateCount() 719int KOListView::currentDateCount()
720{ 720{
721 return 0; 721 return 0;
722} 722}
723 723
724QPtrList<Incidence> KOListView::selectedIncidences() 724QPtrList<Incidence> KOListView::selectedIncidences()
725{ 725{
726 QPtrList<Incidence> eventList; 726 QPtrList<Incidence> eventList;
727 QListViewItem *item = mListView->firstChild (); 727 QListViewItem *item = mListView->firstChild ();
728 while ( item ) { 728 while ( item ) {
729 if ( item->isSelected() ) { 729 if ( item->isSelected() ) {
730 eventList.append(((KOListViewItem *)item)->data()); 730 eventList.append(((KOListViewItem *)item)->data());
731 } 731 }
732 732
733 item = item->nextSibling(); 733 item = item->nextSibling();
734 } 734 }
735 735
736 // // QListViewItem *item = mListView->selectedItem(); 736 // // QListViewItem *item = mListView->selectedItem();
737 //if (item) eventList.append(((KOListViewItem *)item)->data()); 737 //if (item) eventList.append(((KOListViewItem *)item)->data());
738 738
739 return eventList; 739 return eventList;
740} 740}
741 741
742DateList KOListView::selectedDates() 742DateList KOListView::selectedDates()
743{ 743{
744 DateList eventList; 744 DateList eventList;
745 return eventList; 745 return eventList;
746} 746}
747 747
748void KOListView::showDates(bool show) 748void KOListView::showDates(bool show)
749{ 749{
750 // Shouldn't we set it to a value greater 0? When showDates is called with 750 // Shouldn't we set it to a value greater 0? When showDates is called with
751 // show == true at first, then the columnwidths are set to zero. 751 // show == true at first, then the columnwidths are set to zero.
752 static int oldColWidth1 = 0; 752 static int oldColWidth1 = 0;
753 static int oldColWidth3 = 0; 753 static int oldColWidth3 = 0;
754 754
755 if (!show) { 755 if (!show) {
756 oldColWidth1 = mListView->columnWidth(1); 756 oldColWidth1 = mListView->columnWidth(1);
757 oldColWidth3 = mListView->columnWidth(3); 757 oldColWidth3 = mListView->columnWidth(3);
758 mListView->setColumnWidth(1, 0); 758 mListView->setColumnWidth(1, 0);
759 mListView->setColumnWidth(3, 0); 759 mListView->setColumnWidth(3, 0);
760 } else { 760 } else {
761 mListView->setColumnWidth(1, oldColWidth1); 761 mListView->setColumnWidth(1, oldColWidth1);
762 mListView->setColumnWidth(3, oldColWidth3); 762 mListView->setColumnWidth(3, oldColWidth3);
763 } 763 }
764 mListView->repaint(); 764 mListView->repaint();
765} 765}
766 766
767void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 767void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
768 const QDate &td) 768 const QDate &td)
769{ 769{
770#ifndef KORG_NOPRINTER 770#ifndef KORG_NOPRINTER
771 calPrinter->preview(CalPrinter::Day, fd, td); 771 calPrinter->preview(CalPrinter::Day, fd, td);
772#endif 772#endif
773} 773}
774 774
775void KOListView::showDates() 775void KOListView::showDates()
776{ 776{
777 showDates(true); 777 showDates(true);
778} 778}
779 779
780void KOListView::hideDates() 780void KOListView::hideDates()
781{ 781{
782 showDates(false); 782 showDates(false);
783} 783}
784 784
785void KOListView::updateView() 785void KOListView::updateView()
786{ 786{
787 mListView->setFocus(); 787 mListView->setFocus();
788 if ( mListView->firstChild () ) 788 if ( mListView->firstChild () )
789 mListView->setCurrentItem( mListView->firstChild () ); 789 mListView->setCurrentItem( mListView->firstChild () );
790} 790}
791void KOListView::updateConfig() 791void KOListView::updateConfig()
792{ 792{
793 793
794 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 794 mListView->setFont ( KOPrefs::instance()->mListViewFont );
795 updateView(); 795 updateView();
796 796
797} 797}
798void KOListView::setStartDate(const QDate &start) 798void KOListView::setStartDate(const QDate &start)
799{ 799{
800 mStartDate = start; 800 mStartDate = start;
801} 801}
802 802
803void KOListView::showDates(const QDate &start, const QDate &end) 803void KOListView::showDates(const QDate &start, const QDate &end)
804{ 804{
805 clear(); 805 clear();
806 mStartDate = start; 806 mStartDate = start;
807 QDate date = start; 807 QDate date = start;
808 QPtrList<Journal> j_list; 808 QPtrList<Journal> j_list;
809 while( date <= end ) { 809 while( date <= end ) {
810 addEvents(calendar()->events(date)); 810 addEvents(calendar()->events(date));
811 addTodos(calendar()->todos(date)); 811 addTodos(calendar()->todos(date));
812 Journal* jo = calendar()->journal(date); 812 Journal* jo = calendar()->journal(date);
813 if ( jo ) 813 if ( jo )
814 j_list.append( jo ); 814 j_list.append( jo );
815 date = date.addDays( 1 ); 815 date = date.addDays( 1 );
816 } 816 }
817 addJournals(j_list); 817 addJournals(j_list);
818 emit incidenceSelected( 0 ); 818 emit incidenceSelected( 0 );
819 updateView(); 819 updateView();
820 820
821} 821}
822 822
823void KOListView::addEvents(QPtrList<Event> eventList) 823void KOListView::addEvents(QPtrList<Event> eventList)
824{ 824{
825 Event *ev; 825 Event *ev;
826 for(ev = eventList.first(); ev; ev = eventList.next()) { 826 for(ev = eventList.first(); ev; ev = eventList.next()) {
827 addIncidence(ev); 827 addIncidence(ev);
828 } 828 }
829 if ( !mListView->currentItem() ){ 829 if ( !mListView->currentItem() ){
830 updateView(); 830 updateView();
831 } 831 }
832} 832}
833 833
834void KOListView::addTodos(QPtrList<Todo> eventList) 834void KOListView::addTodos(QPtrList<Todo> eventList)
835{ 835{
836 Todo *ev; 836 Todo *ev;
837 for(ev = eventList.first(); ev; ev = eventList.next()) { 837 for(ev = eventList.first(); ev; ev = eventList.next()) {
838 addIncidence(ev); 838 addIncidence(ev);
839 } 839 }
840 if ( !mListView->currentItem() ){ 840 if ( !mListView->currentItem() ){
841 updateView(); 841 updateView();
842 } 842 }
843} 843}
844void KOListView::addJournals(QPtrList<Journal> eventList) 844void KOListView::addJournals(QPtrList<Journal> eventList)
845{ 845{
846 Journal *ev; 846 Journal *ev;
847 for(ev = eventList.first(); ev; ev = eventList.next()) { 847 for(ev = eventList.first(); ev; ev = eventList.next()) {
848 addIncidence(ev); 848 addIncidence(ev);
849 } 849 }
850 if ( !mListView->currentItem() ){ 850 if ( !mListView->currentItem() ){
851 updateView(); 851 updateView();
852 } 852 }
853} 853}
854 854
855void KOListView::addIncidence(Incidence *incidence) 855void KOListView::addIncidence(Incidence *incidence)
856{ 856{
857 if ( mUidDict.find( incidence->uid() ) ) return; 857 if ( mUidDict.find( incidence->uid() ) ) return;
858 858
859 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 859 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
860 mUidDict.insert( incidence->uid(), incidence ); 860 mUidDict.insert( incidence->uid(), incidence );
861 861
862 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 862 KOListViewItem *item = new KOListViewItem( incidence, mListView );
863 ListItemVisitor v(item, mStartDate ); 863 ListItemVisitor v(item, mStartDate );
864 if (incidence->accept(v)) return; 864 if (incidence->accept(v)) return;
865 else delete item; 865 else delete item;
866 //qDebug("delete item "); 866 //qDebug("delete item ");
867} 867}
868 868
869void KOListView::showEvents(QPtrList<Event> eventList) 869void KOListView::showEvents(QPtrList<Event> eventList)
870{ 870{
871 clear(); 871 clear();
872 872
873 addEvents(eventList); 873 addEvents(eventList);
874 874
875 // After new creation of list view no events are selected. 875 // After new creation of list view no events are selected.
876 emit incidenceSelected( 0 ); 876 emit incidenceSelected( 0 );
877} 877}
878int KOListView::count() 878int KOListView::count()
879{ 879{
880 return mListView->childCount(); 880 return mListView->childCount();
881} 881}
882 882
883void KOListView::changeEventDisplay(Event *event, int action) 883void KOListView::changeEventDisplay(Event *event, int action)
884{ 884{
885 KOListViewItem *item; 885 KOListViewItem *item;
886 886
887 switch(action) { 887 switch(action) {
888 case KOGlobals::EVENTADDED: 888 case KOGlobals::EVENTADDED:
889 addIncidence( event ); 889 addIncidence( event );
890 break; 890 break;
891 case KOGlobals::EVENTEDITED: 891 case KOGlobals::EVENTEDITED:
892 item = getItemForEvent(event); 892 item = getItemForEvent(event);
893 if (item) { 893 if (item) {
894 mUidDict.remove( event->uid() ); 894 mUidDict.remove( event->uid() );
895 delete item; 895 delete item;
896 addIncidence( event ); 896 addIncidence( event );
897 } 897 }
898 break; 898 break;
899 case KOGlobals::EVENTDELETED: 899 case KOGlobals::EVENTDELETED:
900 item = getItemForEvent(event); 900 item = getItemForEvent(event);
901 if (item) { 901 if (item) {
902 mUidDict.remove( event->uid() ); 902 mUidDict.remove( event->uid() );
903 delete item; 903 delete item;
904 } 904 }
905 break; 905 break;
906 default: 906 default:
907 ; 907 ;
908 } 908 }
909} 909}
910 910
911KOListViewItem *KOListView::getItemForEvent(Event *event) 911KOListViewItem *KOListView::getItemForEvent(Event *event)
912{ 912{
913 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 913 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
914 while (item) { 914 while (item) {
915 if (item->data() == event) return item; 915 if (item->data() == event) return item;
916 item = (KOListViewItem *)item->nextSibling(); 916 item = (KOListViewItem *)item->nextSibling();
917 } 917 }
918 return 0; 918 return 0;
919} 919}
920 920
921void KOListView::defaultItemAction(QListViewItem *i) 921void KOListView::defaultItemAction(QListViewItem *i)
922{ 922{
923 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 923 KOListViewItem *item = static_cast<KOListViewItem *>( i );
924 if ( item ) defaultAction( item->data() ); 924 if ( item ) defaultAction( item->data() );
925 925
926} 926}
927 927
928void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 928void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
929{ 929{
930 mActiveItem = (KOListViewItem *)item; 930 mActiveItem = (KOListViewItem *)item;
931 if (mActiveItem) { 931 if (mActiveItem) {
932 Incidence *incidence = mActiveItem->data(); 932 Incidence *incidence = mActiveItem->data();
933 mPopupMenu->showIncidencePopup(incidence); 933 mPopupMenu->showIncidencePopup(incidence);
934 934
935 /* 935 /*
936 if ( incidence && incidence->type() == "Event" ) { 936 if ( incidence && incidence->type() == "Event" ) {
937 Event *event = static_cast<Event *>( incidence ); 937 Event *event = static_cast<Event *>( incidence );
938 mPopupMenu->showEventPopup(event); 938 mPopupMenu->showEventPopup(event);
939 } 939 }
940 */ 940 */
941 } 941 }
942} 942}
943 943
944void KOListView::readSettings(KConfig *config, QString setting) 944void KOListView::readSettings(KConfig *config, QString setting)
945{ 945{
946 // qDebug("KOListView::readSettings "); 946 // qDebug("KOListView::readSettings ");
947 mListView->restoreLayout(config,setting); 947 mListView->restoreLayout(config,setting);
948} 948}
949 949
950void KOListView::writeSettings(KConfig *config, QString setting) 950void KOListView::writeSettings(KConfig *config, QString setting)
951{ 951{
952 // qDebug("KOListView::writeSettings "); 952 // qDebug("KOListView::writeSettings ");
953 mListView->saveLayout(config, setting); 953 mListView->saveLayout(config, setting);
954} 954}
955 955
956void KOListView::processSelectionChange(QListViewItem *) 956void KOListView::processSelectionChange(QListViewItem *)
957{ 957{
958 958
959 KOListViewItem *item = 959 KOListViewItem *item =
960 static_cast<KOListViewItem *>( mListView->currentItem() ); 960 static_cast<KOListViewItem *>( mListView->currentItem() );
961 961
962 if ( !item ) { 962 if ( !item ) {
963 emit incidenceSelected( 0 ); 963 emit incidenceSelected( 0 );
964 } else { 964 } else {
965 emit incidenceSelected( item->data() ); 965 emit incidenceSelected( item->data() );
966 } 966 }
967} 967}
968 968
969void KOListView::clearSelection() 969void KOListView::clearSelection()
970{ 970{
971 mListView->selectAll( false ); 971 mListView->selectAll( false );
972} 972}
973void KOListView::allSelection() 973void KOListView::allSelection()
974{ 974{
975 mListView->selectAll( true ); 975 mListView->selectAll( true );
976} 976}
977 977
978void KOListView::clear() 978void KOListView::clear()
979{ 979{
980 mListView->clear(); 980 mListView->clear();
981 mUidDict.clear(); 981 mUidDict.clear();
982} 982}
983 983
984Incidence* KOListView::currentItem() 984Incidence* KOListView::currentItem()
985{ 985{
986 if ( mListView->currentItem() ) 986 if ( mListView->currentItem() )
987 return ((KOListViewItem*) mListView->currentItem())->data(); 987 return ((KOListViewItem*) mListView->currentItem())->data();
988 return 0; 988 return 0;
989} 989}
990void KOListView::keyPressEvent ( QKeyEvent *e) 990void KOListView::keyPressEvent ( QKeyEvent *e)
991{ 991{
992 992
993 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 993 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
994 deleteAll(); 994 deleteAll();
995 return; 995 return;
996 } 996 }
997 997
998 e->ignore(); 998 e->ignore();
999} 999}
1000void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1000void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1001{ 1001{
1002 1002
1003 switch ( e->key() ) { 1003 switch ( e->key() ) {
1004 case Qt::Key_Down: 1004 case Qt::Key_Down:
1005 if ( e->state() == ShiftButton ) { 1005 if ( e->state() == ShiftButton ) {
1006 QListViewItem* cn = currentItem(); 1006 QListViewItem* cn = currentItem();
1007 if ( !cn ) 1007 if ( !cn )
1008 cn = firstChild(); 1008 cn = firstChild();
1009 if ( !cn ) 1009 if ( !cn )
1010 return; 1010 return;
1011 while ( cn->nextSibling() ) 1011 while ( cn->nextSibling() )
1012 cn = cn->nextSibling(); 1012 cn = cn->nextSibling();
1013 setCurrentItem ( cn ); 1013 setCurrentItem ( cn );
1014 ensureItemVisible ( cn ); 1014 ensureItemVisible ( cn );
1015 1015
1016 e->accept(); 1016 e->accept();
1017 return; 1017 return;
1018 } 1018 }
1019 if ( e->state() == ControlButton ) { 1019 if ( e->state() == ControlButton ) {
1020 int count = childCount (); 1020 int count = childCount ();
1021 int jump = count / 5; 1021 int jump = count / 5;
1022 QListViewItem* cn; 1022 QListViewItem* cn;
1023 cn = currentItem(); 1023 cn = currentItem();
1024 if ( ! cn ) 1024 if ( ! cn )
1025 return; 1025 return;
1026 if ( jump == 0 ) 1026 if ( jump == 0 )
1027 jump = 1; 1027 jump = 1;
1028 while ( jump && cn->nextSibling() ) { 1028 while ( jump && cn->nextSibling() ) {
1029 cn = cn->nextSibling(); 1029 cn = cn->nextSibling();
1030 --jump; 1030 --jump;
1031 } 1031 }
1032 setCurrentItem ( cn ); 1032 setCurrentItem ( cn );
1033 ensureItemVisible ( cn ); 1033 ensureItemVisible ( cn );
1034 1034
1035 } else 1035 } else
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 977499e..309f8dc 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -1,74 +1,76 @@
1#include <kfiledialog.h> 1#include <kfiledialog.h>
2#include <qdialog.h> 2#include <qdialog.h>
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qdir.h> 4#include <qdir.h>
5#include <qfileinfo.h> 5#include <qfileinfo.h>
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8#ifndef DESKTOP_VERSION 8#ifndef DESKTOP_VERSION
9//US orig#include <ofileselector.h> 9//US orig#include <ofileselector.h>
10#include <ofileselector_p.h> 10#include <ofileselector_p.h>
11QString KFileDialog::getSaveFileName( const QString & fn, 11QString KFileDialog::getSaveFileName( const QString & fn,
12 const QString & cap , QWidget * par ) 12 const QString & cap , QWidget * par )
13{ 13{
14 QString retfile = ""; 14 QString retfile = "";
15 QDialog dia ( par, "input-dialog", true ); 15 QDialog dia ( par, "input-dialog", true );
16 QVBoxLayout lay( &dia ); 16 QVBoxLayout lay( &dia );
17 lay.setMargin(7); 17 lay.setMargin(7);
18 lay.setSpacing(7); 18 lay.setSpacing(7);
19 dia.setCaption( cap ); 19 dia.setCaption( cap );
20 QString file = fn; 20 QString file = fn;
21 if ( file.isEmpty() ) 21 if ( file.isEmpty() )
22 file = QDir::homeDirPath()+"/*"; 22 file = QDir::homeDirPath()+"/*";
23 QFileInfo fi ( file ); 23 QFileInfo fi ( file );
24 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); 24 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
25 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
25 lay.addWidget( &o); 26 lay.addWidget( &o);
26 // o.setNewVisible( true ); 27 // o.setNewVisible( true );
27 // o.setNameVisible( true ); 28 // o.setNameVisible( true );
28 dia.showMaximized(); 29 dia.showMaximized();
29 int res = dia.exec(); 30 int res = dia.exec();
30 if ( res ) 31 if ( res )
31 retfile = o.selectedName(); 32 retfile = o.selectedName();
32 return retfile; 33 return retfile;
33} 34}
34 35
35QString KFileDialog::getOpenFileName( const QString & fn, 36QString KFileDialog::getOpenFileName( const QString & fn,
36 const QString & cap, QWidget * par ) 37 const QString & cap, QWidget * par )
37{ 38{
38 QString retfile = ""; 39 QString retfile = "";
39 QDialog dia ( par, "input-dialog", true ); 40 QDialog dia ( par, "input-dialog", true );
40 // QLineEdit lab ( &dia ); 41 // QLineEdit lab ( &dia );
41 QVBoxLayout lay( &dia ); 42 QVBoxLayout lay( &dia );
42 lay.setMargin(7); 43 lay.setMargin(7);
43 lay.setSpacing(7); 44 lay.setSpacing(7);
44 dia.setCaption( cap ); 45 dia.setCaption( cap );
45 QString file = fn; 46 QString file = fn;
46 if ( file.isEmpty() ) 47 if ( file.isEmpty() )
47 file = QDir::homeDirPath()+"/*";; 48 file = QDir::homeDirPath()+"/*";;
48 QFileInfo fi ( file ); 49 QFileInfo fi ( file );
49 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); 50 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
51 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
50 lay.addWidget( &o); 52 lay.addWidget( &o);
51 dia.showMaximized(); 53 dia.showMaximized();
52 int res = dia.exec(); 54 int res = dia.exec();
53 if ( res ) 55 if ( res )
54 retfile = o.selectedName(); 56 retfile = o.selectedName();
55 return retfile; 57 return retfile;
56} 58}
57 59
58#else 60#else
59 61
60#include <qfiledialog.h> 62#include <qfiledialog.h>
61 63
62QString KFileDialog::getSaveFileName( const QString & fn, 64QString KFileDialog::getSaveFileName( const QString & fn,
63 const QString & cap , QWidget * par ) 65 const QString & cap , QWidget * par )
64{ 66{
65 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); 67 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
66} 68}
67QString KFileDialog::getOpenFileName( const QString & fn, 69QString KFileDialog::getOpenFileName( const QString & fn,
68 const QString & cap, QWidget * par ) 70 const QString & cap, QWidget * par )
69{ 71{
70 72
71 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); 73 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
72} 74}
73#endif 75#endif
74 76
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index fd5f965..f85f8f4 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -1,866 +1,892 @@
1#include <qcombobox.h> 1#include <qcombobox.h>
2#include <qdir.h> 2#include <qdir.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qlistview.h> 8#include <qlistview.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qregexp.h> 11#include <qregexp.h>
12#include <qobjectlist.h> 12#include <qobjectlist.h>
13 13
14/* hacky but we need to get FileSelector::filter */ 14/* hacky but we need to get FileSelector::filter */
15#define private public 15#define private public
16#include <qpe/fileselector.h> 16#include <qpe/fileselector.h>
17#undef private 17#undef private
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/mimetype.h> 20#include <qpe/mimetype.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/storage.h> 22#include <qpe/storage.h>
23#include <kglobal.h> 23#include <kglobal.h>
24#include <klocale.h> 24#include <klocale.h>
25 25
26#include "ofileselector_p.h" 26#include "ofileselector_p.h"
27//US#include "ofileselector.h" 27//US#include "ofileselector.h"
28 28
29#include "klocale.h" 29#include "klocale.h"
30 30
31OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 31OFileViewInterface::OFileViewInterface( OFileSelector* selector )
32 : m_selector( selector ) { 32 : m_selector( selector ) {
33} 33}
34OFileViewInterface::~OFileViewInterface() { 34OFileViewInterface::~OFileViewInterface() {
35} 35}
36QString OFileViewInterface::name()const{ 36QString OFileViewInterface::name()const{
37 return m_name; 37 return m_name;
38} 38}
39void OFileViewInterface::setName( const QString& name ) { 39void OFileViewInterface::setName( const QString& name ) {
40 m_name = name; 40 m_name = name;
41} 41}
42OFileSelector* OFileViewInterface::selector()const { 42OFileSelector* OFileViewInterface::selector()const {
43 return m_selector; 43 return m_selector;
44} 44}
45 45
46DocLnk OFileViewInterface::selectedDocument()const { 46DocLnk OFileViewInterface::selectedDocument()const {
47 return DocLnk( selectedName() ); 47 return DocLnk( selectedName() );
48} 48}
49 49
50bool OFileViewInterface::showNew()const { 50bool OFileViewInterface::showNew()const {
51 return selector()->showNew(); 51 return selector()->showNew();
52} 52}
53bool OFileViewInterface::showClose()const { 53bool OFileViewInterface::showClose()const {
54 return selector()->showClose(); 54 return selector()->showClose();
55} 55}
56MimeTypes OFileViewInterface::mimeTypes()const { 56MimeTypes OFileViewInterface::mimeTypes()const {
57 return selector()->mimeTypes(); 57 return selector()->mimeTypes();
58} 58}
59QStringList OFileViewInterface::currentMimeType()const { 59QStringList OFileViewInterface::currentMimeType()const {
60 return selector()->currentMimeType(); 60 return selector()->currentMimeType();
61} 61}
62void OFileViewInterface::activate( const QString& ) { 62void OFileViewInterface::activate( const QString& ) {
63 // not implemented here 63 // not implemented here
64} 64}
65void OFileViewInterface::ok() { 65void OFileViewInterface::ok() {
66 emit selector()->ok(); 66 emit selector()->ok();
67} 67}
68void OFileViewInterface::cancel() { 68void OFileViewInterface::cancel() {
69 emit selector()->cancel(); 69 emit selector()->cancel();
70} 70}
71void OFileViewInterface::closeMe() { 71void OFileViewInterface::closeMe() {
72 emit selector()->closeMe(); 72 emit selector()->closeMe();
73} 73}
74void OFileViewInterface::fileSelected( const QString& str) { 74void OFileViewInterface::fileSelected( const QString& str) {
75 emit selector()->fileSelected( str); 75 emit selector()->fileSelected( str);
76} 76}
77void OFileViewInterface::fileSelected( const DocLnk& lnk) { 77void OFileViewInterface::fileSelected( const DocLnk& lnk) {
78 emit selector()->fileSelected( lnk ); 78 emit selector()->fileSelected( lnk );
79} 79}
80void OFileViewInterface::setCurrentFileName( const QString& str ) { 80void OFileViewInterface::setCurrentFileName( const QString& str ) {
81 selector()->m_lneEdit->setText( str ); 81 selector()->m_lneEdit->setText( str );
82} 82}
83QString OFileViewInterface::currentFileName()const{ 83QString OFileViewInterface::currentFileName()const{
84 return selector()->m_lneEdit->text(); 84 return selector()->m_lneEdit->text();
85} 85}
86QString OFileViewInterface::startDirectory()const{ 86QString OFileViewInterface::startDirectory()const{
87 return selector()->m_startDir; 87 return selector()->m_startDir;
88} 88}
89 89
90 90
91ODocumentFileView::ODocumentFileView( OFileSelector* selector ) 91ODocumentFileView::ODocumentFileView( OFileSelector* selector )
92 : OFileViewInterface( selector ) { 92 : OFileViewInterface( selector ) {
93 m_selector = 0; 93 m_selector = 0;
94 setName( i18n("Documents") ); 94 setName( i18n("Documents") );
95} 95}
96ODocumentFileView::~ODocumentFileView() { 96ODocumentFileView::~ODocumentFileView() {
97 97
98} 98}
99QString ODocumentFileView::selectedName()const { 99QString ODocumentFileView::selectedName()const {
100 if (!m_selector) 100 if (!m_selector)
101 return QString::null; 101 return QString::null;
102 102
103 return m_selector->selected()->file(); 103 return m_selector->selected()->file();
104} 104}
105QString ODocumentFileView::selectedPath()const { 105QString ODocumentFileView::selectedPath()const {
106 return QPEApplication::documentDir(); 106 return QPEApplication::documentDir();
107} 107}
108QString ODocumentFileView::directory()const { 108QString ODocumentFileView::directory()const {
109 return selectedPath(); 109 return selectedPath();
110} 110}
111void ODocumentFileView::reread() { 111void ODocumentFileView::reread() {
112 if (!m_selector) 112 if (!m_selector)
113 return; 113 return;
114 114
115 m_selector->setNewVisible( showNew() ); 115 m_selector->setNewVisible( showNew() );
116 m_selector->setCloseVisible( showClose() ); 116 m_selector->setCloseVisible( showClose() );
117 m_selector->filter = currentMimeType().join(";"); 117 m_selector->filter = currentMimeType().join(";");
118 m_selector->reread(); 118 m_selector->reread();
119} 119}
120int ODocumentFileView::fileCount()const { 120int ODocumentFileView::fileCount()const {
121 if (!m_selector) 121 if (!m_selector)
122 return -1; 122 return -1;
123 123
124 return m_selector->fileCount(); 124 return m_selector->fileCount();
125} 125}
126 126
127DocLnk ODocumentFileView::selectedDocument()const { 127DocLnk ODocumentFileView::selectedDocument()const {
128 if (!m_selector) 128 if (!m_selector)
129 return DocLnk(); 129 return DocLnk();
130 DocLnk lnk = *m_selector->selected(); 130 DocLnk lnk = *m_selector->selected();
131 return lnk; 131 return lnk;
132} 132}
133 133
134QWidget* ODocumentFileView::widget( QWidget* parent ) { 134QWidget* ODocumentFileView::widget( QWidget* parent ) {
135 if (!m_selector ) { 135 if (!m_selector ) {
136 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); 136 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
137 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), 137 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ),
138 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); 138 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
139 QObject::connect(m_selector, SIGNAL(closeMe() ), 139 QObject::connect(m_selector, SIGNAL(closeMe() ),
140 selector(), SIGNAL(closeMe() ) ); 140 selector(), SIGNAL(closeMe() ) );
141 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), 141 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ),
142 selector(), SIGNAL(newSelected(const DocLnk& ) ) ); 142 selector(), SIGNAL(newSelected(const DocLnk& ) ) );
143 } 143 }
144 144
145 return m_selector; 145 return m_selector;
146} 146}
147 147
148/* 148/*
149 * This is the file system view used 149 * This is the file system view used
150 * we use a QListView + QListViewItems for it 150 * we use a QListView + QListViewItems for it
151 */ 151 */
152 152
153OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 153OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
154 const QString& path, const QString& date, 154 const QString& path, const QString& date,
155 const QString& size, const QString& dir, 155 const QString& size, const QString& dir,
156 bool isLocked, bool isDir ) 156 bool isLocked, bool isDir )
157 : QListViewItem( view ) 157 : QListViewItem( view )
158{ 158{
159 setPixmap(0, pixmap ); 159 setPixmap(0, pixmap );
160 setText(1, path ); 160 setText(1, path );
161 setText(2, size ); 161 setText(2, size );
162 setText(3, date ); 162 setText(3, date );
163 m_isDir = isDir; 163 m_isDir = isDir;
164 m_dir = dir; 164 m_dir = dir;
165 m_locked = isLocked; 165 m_locked = isLocked;
166} 166}
167OFileSelectorItem::~OFileSelectorItem() { 167OFileSelectorItem::~OFileSelectorItem() {
168 168
169} 169}
170bool OFileSelectorItem::isLocked()const { 170bool OFileSelectorItem::isLocked()const {
171 return m_locked; 171 return m_locked;
172} 172}
173QString OFileSelectorItem::directory()const { 173QString OFileSelectorItem::directory()const {
174 return m_dir; 174 return m_dir;
175} 175}
176bool OFileSelectorItem::isDir()const { 176bool OFileSelectorItem::isDir()const {
177 return m_isDir; 177 return m_isDir;
178} 178}
179QString OFileSelectorItem::path()const { 179QString OFileSelectorItem::path()const {
180 return text( 1 ); 180 return text( 1 );
181} 181}
182QString OFileSelectorItem::key( int id, bool )const { 182QString OFileSelectorItem::key( int id, bool )const {
183 QString ke; 183 QString ke;
184 if( id == 0 || id == 1 ){ // name 184 if( id == 0 || id == 1 ){ // name
185 if( m_isDir ){ 185 if( m_isDir ){
186 ke.append("0" ); 186 ke.append("0" );
187 ke.append( text(1) ); 187 ke.append( text(1) );
188 }else{ 188 }else{
189 ke.append("1" ); 189 ke.append("1" );
190 ke.append( text(1) ); 190 ke.append( text(1) );
191 } 191 }
192 return ke; 192 return ke;
193 }else 193 }else
194 return text( id ); 194 return text( id );
195 195
196} 196}
197 197
198OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, 198OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir,
199 OFileSelector* sel) 199 OFileSelector* sel)
200 : QWidget( parent ), m_sel( sel ) { 200 : QWidget( parent ), m_sel( sel ) {
201 m_all = false; 201 m_all = false;
202 QVBoxLayout* lay = new QVBoxLayout( this ); 202 QVBoxLayout* lay = new QVBoxLayout( this );
203 m_currentDir = startDir; 203 m_currentDir = startDir;
204 204
205 /* 205 /*
206 * now we add a special bar 206 * now we add a special bar
207 * One Button For Up 207 * One Button For Up
208 * Home 208 * Home
209 * Doc 209 * Doc
210 * And a dropdown menu with FileSystems 210 * And a dropdown menu with FileSystems
211 * FUTURE: one to change dir with lineedit 211 * FUTURE: one to change dir with lineedit
212 * Bookmarks 212 * Bookmarks
213 * Create Dir 213 * Create Dir
214 */ 214 */
215 QHBox* box = new QHBox(this ); 215 QHBox* box = new QHBox(this );
216 box->setBackgroundMode( PaletteButton ); 216 box->setBackgroundMode( PaletteButton );
217 box->setSpacing( 0 ); 217 box->setSpacing( 0 );
218 218
219 QToolButton *btn = new QToolButton( box ); 219 QToolButton *btn = new QToolButton( box );
220 btn->setIconSet( Resource::loadPixmap("up") ); 220 btn->setIconSet( Resource::loadPixmap("up") );
221 connect(btn, SIGNAL(clicked() ), 221 connect(btn, SIGNAL(clicked() ),
222 this, SLOT( cdUP() ) ); 222 this, SLOT( cdUP() ) );
223 223
224 btn = new QToolButton( box ); 224 btn = new QToolButton( box );
225 btn->setIconSet( Resource::loadPixmap("home") ); 225 btn->setIconSet( Resource::loadPixmap("home") );
226 connect(btn, SIGNAL(clicked() ), 226 connect(btn, SIGNAL(clicked() ),
227 this, SLOT( cdHome() ) ); 227 this, SLOT( cdHome() ) );
228 228
229 btn = new QToolButton( box ); 229 btn = new QToolButton( box );
230 btn->setIconSet( Resource::loadPixmap("DocsIcon") ); 230 btn->setIconSet( Resource::loadPixmap("DocsIcon") );
231 connect(btn, SIGNAL(clicked() ), 231 connect(btn, SIGNAL(clicked() ),
232 this, SLOT(cdDoc() ) ); 232 this, SLOT(cdDoc() ) );
233 233
234 m_btnNew = new QToolButton( box ); 234 m_btnNew = new QToolButton( box );
235 m_btnNew->setIconSet( Resource::loadPixmap("new") ); 235 m_btnNew->setIconSet( Resource::loadPixmap("new") );
236 connect(m_btnNew, SIGNAL(clicked() ), 236 connect(m_btnNew, SIGNAL(clicked() ),
237 this, SLOT(slotNew() ) ); 237 this, SLOT(slotNew() ) );
238 238
239 239
240 m_btnClose = new QToolButton( box ); 240 m_btnClose = new QToolButton( box );
241 m_btnClose->setIconSet( Resource::loadPixmap("close") ); 241 m_btnClose->setIconSet( Resource::loadPixmap("close") );
242 connect(m_btnClose, SIGNAL(clicked() ), 242 connect(m_btnClose, SIGNAL(clicked() ),
243 selector(), SIGNAL(closeMe() ) ); 243 selector(), SIGNAL(closeMe() ) );
244 244
245 btn = new QToolButton( box ); 245 btn = new QToolButton( box );
246 btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); 246 btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") );
247 247
248 /* let's fill device parts */ 248 /* let's fill device parts */
249 QPopupMenu* pop = new QPopupMenu(this); 249 QPopupMenu* pop = new QPopupMenu(this);
250 connect(pop, SIGNAL( activated(int) ), 250 connect(pop, SIGNAL( activated(int) ),
251 this, SLOT(slotFSActivated(int) ) ); 251 this, SLOT(slotFSActivated(int) ) );
252 252
253 StorageInfo storage; 253 StorageInfo storage;
254 const QList<FileSystem> &fs = storage.fileSystems(); 254 const QList<FileSystem> &fs = storage.fileSystems();
255 QListIterator<FileSystem> it(fs); 255 QListIterator<FileSystem> it(fs);
256 for ( ; it.current(); ++it ) { 256 for ( ; it.current(); ++it ) {
257 const QString disk = (*it)->name(); 257 const QString disk = (*it)->name();
258 const QString path = (*it)->path(); 258 const QString path = (*it)->path();
259 m_dev.insert( disk, path ); 259 m_dev.insert( disk, path );
260 pop->insertItem( disk ); 260 pop->insertItem( disk );
261 } 261 }
262 m_fsPop = pop; 262 m_fsPop = pop;
263 263
264 264
265 btn->setPopup( pop ); 265 btn->setPopup( pop );
266 btn->setPopupDelay ( 0 ); 266 btn->setPopupDelay ( 0 );
267 lay->addWidget( box ); 267 lay->addWidget( box );
268 268
269 m_view = new QListView( this ); 269 m_view = new QListView( this );
270 270
271 m_view->installEventFilter(this); 271 m_view->installEventFilter(this);
272 272
273 QPEApplication::setStylusOperation( m_view->viewport(), 273 QPEApplication::setStylusOperation( m_view->viewport(),
274 QPEApplication::RightOnHold); 274 QPEApplication::RightOnHold);
275 m_view->addColumn(" " ); 275 m_view->addColumn(" " );
276 m_view->addColumn(i18n("Name"), 135 ); 276 m_view->addColumn(i18n("Name"), 135 );
277 m_view->addColumn(i18n("Size"), -1 ); 277 m_view->addColumn(i18n("Size"), -1 );
278 m_view->addColumn(i18n("Date"), 60 ); 278 m_view->addColumn(i18n("Date"), 60 );
279 m_view->addColumn(i18n("Mime Type"), -1 ); 279 m_view->addColumn(i18n("Mime Type"), -1 );
280 280
281 281
282 m_view->setSorting( 1 ); 282 m_view->setSorting( 1 );
283 m_view->setAllColumnsShowFocus( TRUE ); 283 m_view->setAllColumnsShowFocus( TRUE );
284 284
285 lay->addWidget( m_view, 1000 ); 285 lay->addWidget( m_view, 1000 );
286 connectSlots(); 286 connectSlots();
287} 287}
288OFileViewFileListView::~OFileViewFileListView() { 288OFileViewFileListView::~OFileViewFileListView() {
289} 289}
290void OFileViewFileListView::slotNew() { 290void OFileViewFileListView::slotNew() {
291 DocLnk lnk; 291 DocLnk lnk;
292 emit selector()->newSelected( lnk ); 292 emit selector()->newSelected( lnk );
293} 293}
294OFileSelectorItem* OFileViewFileListView::currentItem()const{ 294OFileSelectorItem* OFileViewFileListView::currentItem()const{
295 QListViewItem* item = m_view->currentItem(); 295 QListViewItem* item = m_view->currentItem();
296 if (!item ) 296 if (!item )
297 return 0l; 297 return 0l;
298 298
299 return static_cast<OFileSelectorItem*>(item); 299 return static_cast<OFileSelectorItem*>(item);
300} 300}
301void OFileViewFileListView::reread( bool all ) { 301void OFileViewFileListView::reread( bool all ) {
302 m_view->clear(); 302 m_view->clear();
303 303
304 if (selector()->showClose() ) 304 if (selector()->showClose() )
305 m_btnClose->show(); 305 m_btnClose->show();
306 else 306 else
307 m_btnClose->hide(); 307 m_btnClose->hide();
308 308
309 if (selector()->showNew() ) 309 if (selector()->showNew() )
310 m_btnNew->show(); 310 m_btnNew->show();
311 else 311 else
312 m_btnNew->hide(); 312 m_btnNew->hide();
313 313
314 m_mimes = selector()->currentMimeType(); 314 m_mimes = selector()->currentMimeType();
315 m_all = all; 315 m_all = all;
316 316
317 QDir dir( m_currentDir ); 317 QDir dir( m_currentDir );
318 if (!dir.exists() ) 318 if (!dir.exists() )
319 return; 319 return;
320 topLevelWidget()->setCaption( dir.path() ); 320 topLevelWidget()->setCaption( dir.path() );
321 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 321 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed );
322 int filter; 322 int filter;
323 if (m_all ) 323 if (m_all )
324 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 324 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
325 else 325 else
326 filter = QDir::Files | QDir::Dirs | QDir::All; 326 filter = QDir::Files | QDir::Dirs | QDir::All;
327 dir.setFilter( filter ); 327 dir.setFilter( filter );
328 328
329 // now go through all files 329 // now go through all files
330 const QFileInfoList *list = dir.entryInfoList(); 330 const QFileInfoList *list = dir.entryInfoList();
331 if (!list) { 331 if (!list) {
332 cdUP(); 332 cdUP();
333 return; 333 return;
334 } 334 }
335 QFileInfoListIterator it( *list ); 335 QFileInfoListIterator it( *list );
336 QFileInfo *fi; 336 QFileInfo *fi;
337 while( (fi=it.current() ) ){ 337 while( (fi=it.current() ) ){
338 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 338 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
339 ++it; 339 ++it;
340 continue; 340 continue;
341 } 341 }
342 342
343 /* 343 /*
344 * It is a symlink we try to resolve it now but don't let us attack by DOS 344 * It is a symlink we try to resolve it now but don't let us attack by DOS
345 * 345 *
346 */ 346 */
347 if( fi->isSymLink() ){ 347 if( fi->isSymLink() ){
348 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 348 QString file = fi->dirPath( true ) + "/" + fi->readLink();
349 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos 349 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
350 QFileInfo info( file ); 350 QFileInfo info( file );
351 if( !info.exists() ){ 351 if( !info.exists() ){
352 addSymlink( fi, TRUE ); 352 addSymlink( fi, TRUE );
353 break; 353 break;
354 }else if( info.isDir() ){ 354 }else if( info.isDir() ){
355 addDir( fi, TRUE ); 355 addDir( fi, TRUE );
356 break; 356 break;
357 }else if( info.isFile() ){ 357 }else if( info.isFile() ){
358 addFile( fi, TRUE ); 358 addFile( fi, TRUE );
359 break; 359 break;
360 }else if( info.isSymLink() ){ 360 }else if( info.isSymLink() ){
361 file = info.dirPath(true ) + "/" + info.readLink() ; 361 file = info.dirPath(true ) + "/" + info.readLink() ;
362 break; 362 break;
363 }else if( i == 4){ // couldn't resolve symlink add it as symlink 363 }else if( i == 4){ // couldn't resolve symlink add it as symlink
364 addSymlink( fi ); 364 addSymlink( fi );
365 } 365 }
366 } // off for loop for symlink resolving 366 } // off for loop for symlink resolving
367 }else if( fi->isDir() ) 367 }else if( fi->isDir() )
368 addDir( fi ); 368 addDir( fi );
369 else if( fi->isFile() ) 369 else if( fi->isFile() )
370 addFile( fi ); 370 addFile( fi );
371 371
372 ++it; 372 ++it;
373 } // of while loop 373 } // of while loop
374 m_view->sort(); 374 m_view->sort();
375 375
376} 376}
377int OFileViewFileListView::fileCount()const{ 377int OFileViewFileListView::fileCount()const{
378 return m_view->childCount(); 378 return m_view->childCount();
379} 379}
380QString OFileViewFileListView::currentDir()const{ 380QString OFileViewFileListView::currentDir()const{
381 return m_currentDir; 381 return m_currentDir;
382} 382}
383OFileSelector* OFileViewFileListView::selector() { 383OFileSelector* OFileViewFileListView::selector() {
384 return m_sel; 384 return m_sel;
385} 385}
386 386
387bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { 387bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
388#if 0
388 if ( e->type() == QEvent::KeyPress ) { 389 if ( e->type() == QEvent::KeyPress ) {
389 QKeyEvent *k = (QKeyEvent *)e; 390 QKeyEvent *k = (QKeyEvent *)e;
390 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 391 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
391 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 392 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
392 return true; 393 return true;
393 } 394 }
394 } 395 }
396#endif
395 return false; 397 return false;
396} 398}
397 399
398 400
399void OFileViewFileListView::connectSlots() { 401void OFileViewFileListView::connectSlots() {
400 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 402 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
401 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 403 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
402 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), 404 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ),
403 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); 405 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) );
406 connect(m_view, SIGNAL(doubleClicked( QListViewItem* )),
407 this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
408 connect(m_view, SIGNAL(returnPressed( QListViewItem* )),
409 this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
404} 410}
405void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { 411void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
406 if (!item) 412 if (!item)
407 return; 413 return;
408#if 0 414#if 0
409 415
410 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 416 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
411 417
412 if (!sel->isDir() ) { 418 if (!sel->isDir() ) {
413 selector()->m_lneEdit->setText( sel->text(1) ); 419 selector()->m_lneEdit->setText( sel->text(1) );
414 // if in fileselector mode we will emit selected 420 // if in fileselector mode we will emit selected
415 if ( selector()->mode() == OFileSelector::FileSelector ) { 421 if ( selector()->mode() == OFileSelector::FileSelector ) {
416 qWarning("slot Current Changed"); 422 qWarning("slot Current Changed");
417 QStringList str = QStringList::split("->", sel->text(1) ); 423 QStringList str = QStringList::split("->", sel->text(1) );
418 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 424 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
419 emit selector()->fileSelected( path ); 425 emit selector()->fileSelected( path );
420 DocLnk lnk( path ); 426 DocLnk lnk( path );
421 emit selector()->fileSelected( lnk ); 427 emit selector()->fileSelected( lnk );
422 } 428 }
423 } 429 }
424#endif 430#endif
425} 431}
432void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) {
433 if (!item ) return;
434 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
435 if (!sel->isLocked() ) {
436 QStringList str = QStringList::split("->", sel->text(1) );
437 if (sel->isDir() ) {
438 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
439 emit selector()->dirSelected( m_currentDir );
440 reread( m_all );
441 }else { // file
442 //qWarning("slot Clicked");
443 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
444 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
445 emit selector()->fileSelected( path );
446 DocLnk lnk( path );
447 emit selector()->fileSelected( lnk );
448 emit selector()->ok();
449 }
450 } // not locked
451}
426void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { 452void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
427 if (!item || ( button != Qt::LeftButton) ) 453 if (!item || ( button != Qt::LeftButton) )
428 return; 454 return;
429 455
430 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 456 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
431 if (!sel->isLocked() ) { 457 if (!sel->isLocked() ) {
432 QStringList str = QStringList::split("->", sel->text(1) ); 458 QStringList str = QStringList::split("->", sel->text(1) );
433 if (sel->isDir() ) { 459 if (sel->isDir() ) {
434 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 460 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
435 emit selector()->dirSelected( m_currentDir ); 461 emit selector()->dirSelected( m_currentDir );
436 reread( m_all ); 462 reread( m_all );
437 }else { // file 463 }else { // file
438 qWarning("slot Clicked"); 464 //qWarning("slot Clicked");
439 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 465 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
440 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 466 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
441 emit selector()->fileSelected( path ); 467 emit selector()->fileSelected( path );
442 DocLnk lnk( path ); 468 DocLnk lnk( path );
443 emit selector()->fileSelected( lnk ); 469 emit selector()->fileSelected( lnk );
444 } 470 }
445 } // not locked 471 } // not locked
446} 472}
447void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { 473void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
448 MimeType type( info->absFilePath() ); 474 MimeType type( info->absFilePath() );
449 if (!compliesMime( type.id() ) ) 475 if (!compliesMime( type.id() ) )
450 return; 476 return;
451 477
452 QPixmap pix = type.pixmap(); 478 QPixmap pix = type.pixmap();
453 QString dir, name; bool locked; 479 QString dir, name; bool locked;
454 if ( pix.isNull() ) { 480 if ( pix.isNull() ) {
455 QWMatrix matrix; 481 QWMatrix matrix;
456 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 482 QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
457 matrix.scale( .4, .4 ); 483 matrix.scale( .4, .4 );
458 pix = pixer.xForm( matrix ); 484 pix = pixer.xForm( matrix );
459 } 485 }
460 dir = info->dirPath( true ); 486 dir = info->dirPath( true );
461 locked = false; 487 locked = false;
462 if ( symlink ) 488 if ( symlink )
463 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 489 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
464 else{ 490 else{
465 name = info->fileName(); 491 name = info->fileName();
466 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 492 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
467 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { 493 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) {
468 locked = true; pix = Resource::loadPixmap("locked"); 494 locked = true; pix = Resource::loadPixmap("locked");
469 } 495 }
470 } 496 }
471 (void)new OFileSelectorItem( m_view, pix, name, 497 (void)new OFileSelectorItem( m_view, pix, name,
472 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), 498 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
473 QString::number( info->size() ), 499 QString::number( info->size() ),
474 dir, locked ); 500 dir, locked );
475} 501}
476void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { 502void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
477 bool locked = false; QString name; QPixmap pix; 503 bool locked = false; QString name; QPixmap pix;
478 504
479 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 505 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
480 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { 506 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) {
481 locked = true; 507 locked = true;
482 if ( symlink ) 508 if ( symlink )
483 pix = Resource::loadPixmap( "symlink" ); 509 pix = Resource::loadPixmap( "symlink" );
484 else 510 else
485 pix = Resource::loadPixmap( "lockedfolder" ); 511 pix = Resource::loadPixmap( "lockedfolder" );
486 }else 512 }else
487 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); 513 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder");
488 514
489 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 515 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() :
490 info->fileName(); 516 info->fileName();
491 517
492 (void)new OFileSelectorItem( m_view, pix, name, 518 (void)new OFileSelectorItem( m_view, pix, name,
493 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), 519 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
494 QString::number( info->size() ), 520 QString::number( info->size() ),
495 info->dirPath( true ), locked, true ); 521 info->dirPath( true ), locked, true );
496 522
497 523
498} 524}
499void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { 525void OFileViewFileListView::addSymlink( QFileInfo* , bool ) {
500 526
501} 527}
502void OFileViewFileListView::cdUP() { 528void OFileViewFileListView::cdUP() {
503 QDir dir( m_currentDir ); 529 QDir dir( m_currentDir );
504 dir.cdUp(); 530 dir.cdUp();
505 531
506 if (!dir.exists() ) 532 if (!dir.exists() )
507 m_currentDir = "/"; 533 m_currentDir = "/";
508 else 534 else
509 m_currentDir = dir.absPath(); 535 m_currentDir = dir.absPath();
510 536
511 emit selector()->dirSelected( m_currentDir ); 537 emit selector()->dirSelected( m_currentDir );
512 reread( m_all ); 538 reread( m_all );
513} 539}
514void OFileViewFileListView::cdHome() { 540void OFileViewFileListView::cdHome() {
515 m_currentDir = QDir::homeDirPath(); 541 m_currentDir = QDir::homeDirPath();
516 emit selector()->dirSelected( m_currentDir ); 542 emit selector()->dirSelected( m_currentDir );
517 reread( m_all ); 543 reread( m_all );
518} 544}
519void OFileViewFileListView::cdDoc() { 545void OFileViewFileListView::cdDoc() {
520 m_currentDir = QPEApplication::documentDir(); 546 m_currentDir = QPEApplication::documentDir();
521 emit selector()->dirSelected( m_currentDir ); 547 emit selector()->dirSelected( m_currentDir );
522 reread( m_all ); 548 reread( m_all );
523} 549}
524void OFileViewFileListView::changeDir( const QString& dir ) { 550void OFileViewFileListView::changeDir( const QString& dir ) {
525 m_currentDir = dir; 551 m_currentDir = dir;
526 emit selector()->dirSelected( m_currentDir ); 552 emit selector()->dirSelected( m_currentDir );
527 reread( m_all ); 553 reread( m_all );
528} 554}
529void OFileViewFileListView::slotFSActivated( int id ) { 555void OFileViewFileListView::slotFSActivated( int id ) {
530 changeDir ( m_dev[m_fsPop->text(id)] ); 556 changeDir ( m_dev[m_fsPop->text(id)] );
531} 557}
532 558
533/* check if the mimetype in mime 559/* check if the mimetype in mime
534 * complies with the one which is current 560 * complies with the one which is current
535 */ 561 */
536/* 562/*
537 * We've the mimetype of the file 563 * We've the mimetype of the file
538 * We need to get the stringlist of the current mimetype 564 * We need to get the stringlist of the current mimetype
539 * 565 *
540 * mime = image@slashjpeg 566 * mime = image@slashjpeg
541 * QStringList = 'image@slash*' 567 * QStringList = 'image@slash*'
542 * or QStringList = image/jpeg;image/png;application/x-ogg 568 * or QStringList = image/jpeg;image/png;application/x-ogg
543 * or QStringList = application/x-ogg;image@slash*; 569 * or QStringList = application/x-ogg;image@slash*;
544 * with all these mime filters it should get acceptes 570 * with all these mime filters it should get acceptes
545 * to do so we need to look if mime is contained inside 571 * to do so we need to look if mime is contained inside
546 * the stringlist 572 * the stringlist
547 * if it's contained return true 573 * if it's contained return true
548 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' 574 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*'
549 * is contained in the mimefilter and then we will 575 * is contained in the mimefilter and then we will
550 * look if both are equal until the '/' 576 * look if both are equal until the '/'
551 */ 577 */
552bool OFileViewFileListView::compliesMime( const QString& str) { 578bool OFileViewFileListView::compliesMime( const QString& str) {
553 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) 579 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() )
554 return true; 580 return true;
555 581
556 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { 582 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) {
557 QRegExp reg( (*it) ); 583 QRegExp reg( (*it) );
558 reg.setWildcard( true ); 584 reg.setWildcard( true );
559 if ( str.find( reg ) != -1 ) 585 if ( str.find( reg ) != -1 )
560 return true; 586 return true;
561 587
562 } 588 }
563 return false; 589 return false;
564} 590}
565/* 591/*
566 * The listView giving access to the file system! 592 * The listView giving access to the file system!
567 */ 593 */
568class OFileViewFileSystem : public OFileViewInterface { 594class OFileViewFileSystem : public OFileViewInterface {
569public: 595public:
570 OFileViewFileSystem( OFileSelector* ); 596 OFileViewFileSystem( OFileSelector* );
571 ~OFileViewFileSystem(); 597 ~OFileViewFileSystem();
572 598
573 QString selectedName() const; 599 QString selectedName() const;
574 QString selectedPath() const; 600 QString selectedPath() const;
575 601
576 QString directory()const; 602 QString directory()const;
577 void reread(); 603 void reread();
578 int fileCount()const; 604 int fileCount()const;
579 605
580 QWidget* widget( QWidget* parent ); 606 QWidget* widget( QWidget* parent );
581 void activate( const QString& ); 607 void activate( const QString& );
582private: 608private:
583 OFileViewFileListView* m_view; 609 OFileViewFileListView* m_view;
584 bool m_all : 1; 610 bool m_all : 1;
585}; 611};
586OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) 612OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel)
587 : OFileViewInterface( sel ) { 613 : OFileViewInterface( sel ) {
588 m_view = 0; 614 m_view = 0;
589 m_all = false; 615 m_all = false;
590} 616}
591OFileViewFileSystem::~OFileViewFileSystem() { 617OFileViewFileSystem::~OFileViewFileSystem() {
592} 618}
593QString OFileViewFileSystem::selectedName()const{ 619QString OFileViewFileSystem::selectedName()const{
594 if (!m_view ) 620 if (!m_view )
595 return QString::null; 621 return QString::null;
596 622
597 QString cFN=currentFileName(); 623 QString cFN=currentFileName();
598 if (cFN.startsWith("/")) return cFN; 624 if (cFN.startsWith("/")) return cFN;
599 return m_view->currentDir() + "/" + cFN; 625 return m_view->currentDir() + "/" + cFN;
600} 626}
601QString OFileViewFileSystem::selectedPath()const{ 627QString OFileViewFileSystem::selectedPath()const{
602 return QString::null; 628 return QString::null;
603} 629}
604QString OFileViewFileSystem::directory()const{ 630QString OFileViewFileSystem::directory()const{
605 if (!m_view) 631 if (!m_view)
606 return QString::null; 632 return QString::null;
607 633
608 OFileSelectorItem* item = m_view->currentItem(); 634 OFileSelectorItem* item = m_view->currentItem();
609 if (!item ) 635 if (!item )
610 return QString::null; 636 return QString::null;
611 637
612 return QDir(item->directory() ).absPath(); 638 return QDir(item->directory() ).absPath();
613} 639}
614void OFileViewFileSystem::reread() { 640void OFileViewFileSystem::reread() {
615 if (!m_view) 641 if (!m_view)
616 return; 642 return;
617 643
618 m_view->reread( m_all ); 644 m_view->reread( m_all );
619} 645}
620int OFileViewFileSystem::fileCount()const{ 646int OFileViewFileSystem::fileCount()const{
621 if (!m_view ) 647 if (!m_view )
622 return -1; 648 return -1;
623 return m_view->fileCount(); 649 return m_view->fileCount();
624} 650}
625QWidget* OFileViewFileSystem::widget( QWidget* parent ) { 651QWidget* OFileViewFileSystem::widget( QWidget* parent ) {
626 if (!m_view ) { 652 if (!m_view ) {
627 m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); 653 m_view = new OFileViewFileListView( parent, startDirectory(), selector() );
628 } 654 }
629 return m_view; 655 return m_view;
630} 656}
631void OFileViewFileSystem::activate( const QString& str) { 657void OFileViewFileSystem::activate( const QString& str) {
632 m_all = (str !=i18n("Files") ); 658 m_all = (str !=i18n("Files") );
633 659
634 660
635} 661}
636 662
637/* Selector */ 663/* Selector */
638OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, 664OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
639 const QString& dirName, const QString& fileName, 665 const QString& dirName, const QString& fileName,
640 const MimeTypes& mimetypes, 666 const MimeTypes& mimetypes,
641 bool showNew, bool showClose) 667 bool showNew, bool showClose)
642 : QWidget( parent, "OFileSelector" ) 668 : QWidget( parent, "OFileSelector" )
643{ 669{
644 m_current = 0; 670 m_current = 0;
645 m_shNew = showNew; 671 m_shNew = showNew;
646 m_shClose = showClose; 672 m_shClose = showClose;
647 m_mimeType = mimetypes; 673 m_mimeType = mimetypes;
648 m_startDir = dirName; 674 m_startDir = dirName;
649 m_mode = mode; 675 m_mode = mode;
650 m_selector = sel; 676 m_selector = sel;
651 677
652 initUI(); 678 initUI();
653 m_lneEdit->setText( fileName ); 679 m_lneEdit->setText( fileName );
654 initMime(); 680 initMime();
655 initViews(); 681 initViews();
656 682
657 QString str; 683 QString str;
658 switch ( m_selector ) { 684 switch ( m_selector ) {
659 default: 685 default:
660 case Normal: 686 case Normal:
661 str = i18n("Documents"); 687 str = i18n("Documents");
662 m_cmbView->setCurrentItem( 0 ); 688 m_cmbView->setCurrentItem( 0 );
663 break; 689 break;
664 case Extended: 690 case Extended:
665 str = i18n("Files"); 691 str = i18n("Files");
666 m_cmbView->setCurrentItem( 1 ); 692 m_cmbView->setCurrentItem( 1 );
667 break; 693 break;
668 case ExtendedAll: 694 case ExtendedAll:
669 str = i18n("All Files"); 695 str = i18n("All Files");
670 m_cmbView->setCurrentItem( 2 ); 696 m_cmbView->setCurrentItem( 2 );
671 break; 697 break;
672 } 698 }
673 slotViewChange( str ); 699 slotViewChange( str );
674 700
675} 701}
676OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, 702OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name,
677 bool showNew, bool showClose ) 703 bool showNew, bool showClose )
678 : QWidget( parent, name ) 704 : QWidget( parent, name )
679{ 705{
680 m_current = 0; 706 m_current = 0;
681 m_shNew = showNew; 707 m_shNew = showNew;
682 m_shClose = showClose; 708 m_shClose = showClose;
683 m_startDir = QPEApplication::documentDir(); 709 m_startDir = QPEApplication::documentDir();
684 710
685 if (!mimeFilter.isEmpty() ) 711 if (!mimeFilter.isEmpty() )
686 m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); 712 m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) );
687 713
688 m_mode = OFileSelector::FileSelector; 714 m_mode = OFileSelector::FileSelector;
689 m_selector = OFileSelector::Normal; 715 m_selector = OFileSelector::Normal;
690 716
691 initUI(); 717 initUI();
692 initMime(); 718 initMime();
693 initViews(); 719 initViews();
694 m_cmbView->setCurrentItem( 0 ); 720 m_cmbView->setCurrentItem( 0 );
695 slotViewChange( i18n("Documents") ); 721 slotViewChange( i18n("Documents") );
696} 722}
697/* 723/*
698 * INIT UI will set up the basic GUI 724 * INIT UI will set up the basic GUI
699 * Layout: Simple VBoxLayout 725 * Layout: Simple VBoxLayout
700 * On top a WidgetStack containing the Views... 726 * On top a WidgetStack containing the Views...
701 * - List View 727 * - List View
702 * - Document View 728 * - Document View
703 * Below we will have a Label + LineEdit 729 * Below we will have a Label + LineEdit
704 * Below we will have two ComoBoxes one for choosing the view one for 730 * Below we will have two ComoBoxes one for choosing the view one for
705 * choosing the mimetype 731 * choosing the mimetype
706 */ 732 */
707void OFileSelector::initUI() { 733void OFileSelector::initUI() {
708 QVBoxLayout* lay = new QVBoxLayout( this ); 734 QVBoxLayout* lay = new QVBoxLayout( this );
709 735
710 m_stack = new QWidgetStack( this ); 736 m_stack = new QWidgetStack( this );
711 lay->addWidget( m_stack, 1000 ); 737 lay->addWidget( m_stack, 1000 );
712 738
713 m_nameBox = new QHBox( this ); 739 m_nameBox = new QHBox( this );
714 (void)new QLabel( i18n("Name:"), m_nameBox ); 740 (void)new QLabel( i18n("Name:"), m_nameBox );
715 m_lneEdit = new QLineEdit( m_nameBox ); 741 m_lneEdit = new QLineEdit( m_nameBox );
716 m_lneEdit ->installEventFilter(this); 742 m_lneEdit ->installEventFilter(this);
717 lay->addWidget( m_nameBox ); 743 lay->addWidget( m_nameBox );
718 744
719 m_cmbBox = new QHBox( this ); 745 m_cmbBox = new QHBox( this );
720 m_cmbView = new QComboBox( m_cmbBox ); 746 m_cmbView = new QComboBox( m_cmbBox );
721 m_cmbMime = new QComboBox( m_cmbBox ); 747 m_cmbMime = new QComboBox( m_cmbBox );
722 lay->addWidget( m_cmbBox ); 748 lay->addWidget( m_cmbBox );
723} 749}
724 750
725/* 751/*
726 * This will make sure that the return key in the name edit causes dialogs to close 752 * This will make sure that the return key in the name edit causes dialogs to close
727 */ 753 */
728 754
729bool OFileSelector::eventFilter (QObject *o, QEvent *e) { 755bool OFileSelector::eventFilter (QObject *o, QEvent *e) {
730 if ( e->type() == QEvent::KeyPress ) { 756 if ( e->type() == QEvent::KeyPress ) {
731 QKeyEvent *k = (QKeyEvent *)e; 757 QKeyEvent *k = (QKeyEvent *)e;
732 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 758 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
733 emit ok(); 759 emit ok();
734 return true; 760 return true;
735 } 761 }
736 } 762 }
737 return false; 763 return false;
738} 764}
739 765
740/* 766/*
741 * This will insert the MimeTypes into the Combo Box 767 * This will insert the MimeTypes into the Combo Box
742 * And also connect the changed signal 768 * And also connect the changed signal
743 * 769 *
744 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes 770 * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes
745 */ 771 */
746void OFileSelector::initMime() { 772void OFileSelector::initMime() {
747 MimeTypes::Iterator it; 773 MimeTypes::Iterator it;
748 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) { 774 for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) {
749 m_cmbMime->insertItem( it.key() ); 775 m_cmbMime->insertItem( it.key() );
750 } 776 }
751 m_cmbMime->setCurrentItem( 0 ); 777 m_cmbMime->setCurrentItem( 0 );
752 778
753 connect( m_cmbMime, SIGNAL(activated(int) ), 779 connect( m_cmbMime, SIGNAL(activated(int) ),
754 this, SLOT(slotMimeTypeChanged() ) ); 780 this, SLOT(slotMimeTypeChanged() ) );
755 781
756} 782}
757void OFileSelector::initViews() { 783void OFileSelector::initViews() {
758 m_cmbView->insertItem( i18n("Documents") ); 784 m_cmbView->insertItem( i18n("Documents") );
759 m_cmbView->insertItem( i18n("Files") ); 785 m_cmbView->insertItem( i18n("Files") );
760 m_cmbView->insertItem( i18n("All Files") ); 786 m_cmbView->insertItem( i18n("All Files") );
761 connect(m_cmbView, SIGNAL(activated( const QString& ) ), 787 connect(m_cmbView, SIGNAL(activated( const QString& ) ),
762 this, SLOT(slotViewChange( const QString& ) ) ); 788 this, SLOT(slotViewChange( const QString& ) ) );
763 789
764 790
765 m_views.insert( i18n("Documents"), new ODocumentFileView(this) ); 791 m_views.insert( i18n("Documents"), new ODocumentFileView(this) );
766 792
767 /* see above why add both */ 793 /* see above why add both */
768 OFileViewInterface* in = new OFileViewFileSystem( this ); 794 OFileViewInterface* in = new OFileViewFileSystem( this );
769 m_views.insert( i18n("Files"), in ); 795 m_views.insert( i18n("Files"), in );
770 m_views.insert( i18n("All Files"), in ); 796 m_views.insert( i18n("All Files"), in );
771} 797}
772OFileSelector::~OFileSelector() { 798OFileSelector::~OFileSelector() {
773 799
774} 800}
775 801
776const DocLnk* OFileSelector::selected() { 802const DocLnk* OFileSelector::selected() {
777 DocLnk* lnk = &currentView()->selectedDocument() ; 803 DocLnk* lnk = &currentView()->selectedDocument() ;
778 return lnk; 804 return lnk;
779} 805}
780 806
781QString OFileSelector::selectedName()const{ 807QString OFileSelector::selectedName()const{
782 return currentView()->selectedName(); 808 return currentView()->selectedName();
783} 809}
784QString OFileSelector::selectedPath()const { 810QString OFileSelector::selectedPath()const {
785 return currentView()->selectedPath(); 811 return currentView()->selectedPath();
786} 812}
787QString OFileSelector::directory()const { 813QString OFileSelector::directory()const {
788 return currentView()->directory(); 814 return currentView()->directory();
789} 815}
790 816
791DocLnk OFileSelector::selectedDocument()const { 817DocLnk OFileSelector::selectedDocument()const {
792 return currentView()->selectedDocument(); 818 return currentView()->selectedDocument();
793} 819}
794 820
795int OFileSelector::fileCount()const { 821int OFileSelector::fileCount()const {
796 return currentView()->fileCount(); 822 return currentView()->fileCount();
797} 823}
798void OFileSelector::reread() { 824void OFileSelector::reread() {
799 return currentView()->reread(); 825 return currentView()->reread();
800} 826}
801OFileViewInterface* OFileSelector::currentView()const{ 827OFileViewInterface* OFileSelector::currentView()const{
802 return m_current; 828 return m_current;
803} 829}
804bool OFileSelector::showNew()const { 830bool OFileSelector::showNew()const {
805 return m_shNew; 831 return m_shNew;
806} 832}
807bool OFileSelector::showClose()const { 833bool OFileSelector::showClose()const {
808 return m_shClose; 834 return m_shClose;
809} 835}
810MimeTypes OFileSelector::mimeTypes()const { 836MimeTypes OFileSelector::mimeTypes()const {
811 return m_mimeType; 837 return m_mimeType;
812} 838}
813int OFileSelector::mode()const{ 839int OFileSelector::mode()const{
814 return m_mode; 840 return m_mode;
815} 841}
816int OFileSelector::selector()const{ 842int OFileSelector::selector()const{
817 return m_selector; 843 return m_selector;
818} 844}
819QStringList OFileSelector::currentMimeType()const { 845QStringList OFileSelector::currentMimeType()const {
820 return m_mimeType[m_cmbMime->currentText()]; 846 return m_mimeType[m_cmbMime->currentText()];
821} 847}
822void OFileSelector::slotMimeTypeChanged() { 848void OFileSelector::slotMimeTypeChanged() {
823 reread(); 849 reread();
824} 850}
825void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) { 851void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) {
826 m_lneEdit->setText( lnk.name() ); 852 m_lneEdit->setText( lnk.name() );
827 emit fileSelected( lnk ); 853 emit fileSelected( lnk );
828 emit fileSelected( lnk.name() ); 854 emit fileSelected( lnk.name() );
829} 855}
830void OFileSelector::slotFileBridge( const QString& str) { 856void OFileSelector::slotFileBridge( const QString& str) {
831 DocLnk lnk( str ); 857 DocLnk lnk( str );
832 emit fileSelected( lnk ); 858 emit fileSelected( lnk );
833} 859}
834void OFileSelector::slotViewChange( const QString& view ) { 860void OFileSelector::slotViewChange( const QString& view ) {
835 OFileViewInterface* interface = m_views[view]; 861 OFileViewInterface* interface = m_views[view];
836 if (!interface) 862 if (!interface)
837 return; 863 return;
838 864
839 interface->activate( view ); 865 interface->activate( view );
840 if (m_current) 866 if (m_current)
841 m_stack->removeWidget( m_current->widget( m_stack ) ); 867 m_stack->removeWidget( m_current->widget( m_stack ) );
842 868
843 static int id = 1; 869 static int id = 1;
844 870
845 m_stack->addWidget( interface->widget(m_stack), id ); 871 m_stack->addWidget( interface->widget(m_stack), id );
846 m_stack->raiseWidget( id ); 872 m_stack->raiseWidget( id );
847 873
848 interface->reread(); 874 interface->reread();
849 m_current = interface; 875 m_current = interface;
850 876
851 id++; 877 id++;
852} 878}
853void OFileSelector::setNewVisible( bool b ) { 879void OFileSelector::setNewVisible( bool b ) {
854 m_shNew = b; 880 m_shNew = b;
855 currentView()->reread(); 881 currentView()->reread();
856} 882}
857void OFileSelector::setCloseVisible( bool b ) { 883void OFileSelector::setCloseVisible( bool b ) {
858 m_shClose = b; 884 m_shClose = b;
859 currentView()->reread(); 885 currentView()->reread();
860} 886}
861void OFileSelector::setNameVisible( bool b ) { 887void OFileSelector::setNameVisible( bool b ) {
862 if ( b ) 888 if ( b )
863 m_nameBox->show(); 889 m_nameBox->show();
864 else 890 else
865 m_nameBox->hide(); 891 m_nameBox->hide();
866} 892}
diff --git a/microkde/ofileselector_p.h b/microkde/ofileselector_p.h
index b371806..834fd70 100644
--- a/microkde/ofileselector_p.h
+++ b/microkde/ofileselector_p.h
@@ -1,258 +1,259 @@
1#ifndef OPIE_OFILE_SELECTOR_PRIVATE_H 1#ifndef OPIE_OFILE_SELECTOR_PRIVATE_H
2#define OPIE_OFILE_SELECTOR_PRIVATE_H 2#define OPIE_OFILE_SELECTOR_PRIVATE_H
3 3
4//US 4//US
5#pragma message("microkde/ofileselector_p.h") 5#pragma message("microkde/ofileselector_p.h")
6 6
7#include <qmap.h> 7#include <qmap.h>
8#include <qstringlist.h> 8#include <qstringlist.h>
9#include <qwidget.h> 9#include <qwidget.h>
10#include <qlistview.h> 10#include <qlistview.h>
11 11
12#include <qpe/applnk.h> 12#include <qpe/applnk.h>
13#include <qpe/fileselector.h> 13#include <qpe/fileselector.h>
14 14
15 15
16/* 16/*
17 * How to avoid having really two different objects 17 * How to avoid having really two different objects
18 * for Extended and ExtendedAll 18 * for Extended and ExtendedAll
19 * The only difference is the Lister... 19 * The only difference is the Lister...
20 * a) static object? 20 * a) static object?
21 * b) leave some object inside the OFileSelector which can be used? 21 * b) leave some object inside the OFileSelector which can be used?
22 * c) when switching views tell which view we want o have.. internally we can switch then 22 * c) when switching views tell which view we want o have.. internally we can switch then
23 * 23 *
24 * I'll take c) -zecke 24 * I'll take c) -zecke
25 */ 25 */
26 26
27 27
28/* the View Interface */ 28/* the View Interface */
29class OFileSelector; 29class OFileSelector;
30typedef QMap<QString, QStringList> MimeTypes; 30typedef QMap<QString, QStringList> MimeTypes;
31class QFileInfo; 31class QFileInfo;
32class QToolButton; 32class QToolButton;
33class OFileViewInterface { 33class OFileViewInterface {
34public: 34public:
35 OFileViewInterface( OFileSelector* selector ); 35 OFileViewInterface( OFileSelector* selector );
36 virtual ~OFileViewInterface(); 36 virtual ~OFileViewInterface();
37 virtual QString selectedName()const = 0; 37 virtual QString selectedName()const = 0;
38 virtual QString selectedPath()const = 0; 38 virtual QString selectedPath()const = 0;
39 virtual QString directory()const = 0; 39 virtual QString directory()const = 0;
40 virtual void reread() = 0; 40 virtual void reread() = 0;
41 virtual int fileCount()const = 0; 41 virtual int fileCount()const = 0;
42 virtual DocLnk selectedDocument()const; 42 virtual DocLnk selectedDocument()const;
43 virtual QWidget* widget( QWidget* parent) = 0; 43 virtual QWidget* widget( QWidget* parent) = 0;
44 virtual void activate( const QString& ); 44 virtual void activate( const QString& );
45 QString name()const; 45 QString name()const;
46protected: 46protected:
47 OFileSelector* selector()const; 47 OFileSelector* selector()const;
48 void setName( const QString& ); 48 void setName( const QString& );
49 bool showNew()const; 49 bool showNew()const;
50 bool showClose()const; 50 bool showClose()const;
51 MimeTypes mimeTypes()const; 51 MimeTypes mimeTypes()const;
52 QStringList currentMimeType()const; 52 QStringList currentMimeType()const;
53 QString startDirectory()const; 53 QString startDirectory()const;
54protected: 54protected:
55 void ok(); 55 void ok();
56 void cancel(); 56 void cancel();
57 void closeMe(); 57 void closeMe();
58 void fileSelected( const QString& ); 58 void fileSelected( const QString& );
59 void fileSelected( const DocLnk& ); 59 void fileSelected( const DocLnk& );
60 void setCurrentFileName( const QString& ); 60 void setCurrentFileName( const QString& );
61 QString currentFileName()const; 61 QString currentFileName()const;
62 62
63private: 63private:
64 QString m_name; 64 QString m_name;
65 OFileSelector* m_selector; 65 OFileSelector* m_selector;
66}; 66};
67 67
68 68
69/* THE Document View hosting a FileSelector*/ 69/* THE Document View hosting a FileSelector*/
70class ODocumentFileView : public OFileViewInterface { 70class ODocumentFileView : public OFileViewInterface {
71public: 71public:
72 ODocumentFileView( OFileSelector* selector ); 72 ODocumentFileView( OFileSelector* selector );
73 ~ODocumentFileView(); 73 ~ODocumentFileView();
74 74
75 QString selectedName() const; 75 QString selectedName() const;
76 QString selectedPath() const; 76 QString selectedPath() const;
77 77
78 QString directory() const; 78 QString directory() const;
79 void reread(); 79 void reread();
80 int fileCount()const; 80 int fileCount()const;
81 DocLnk selectedDocument()const; 81 DocLnk selectedDocument()const;
82 82
83 QWidget* widget( QWidget* parent ); 83 QWidget* widget( QWidget* parent );
84 84
85private: 85private:
86 mutable FileSelector* m_selector; 86 mutable FileSelector* m_selector;
87 87
88}; 88};
89 89
90class OFileSelectorItem : public QListViewItem { 90class OFileSelectorItem : public QListViewItem {
91public: 91public:
92 OFileSelectorItem( QListView* view, const QPixmap& pixmap, 92 OFileSelectorItem( QListView* view, const QPixmap& pixmap,
93 const QString& path, const QString& date, 93 const QString& path, const QString& date,
94 const QString& size, const QString& mDir, 94 const QString& size, const QString& mDir,
95 bool isLocked = false, bool isDir = false ); 95 bool isLocked = false, bool isDir = false );
96 ~OFileSelectorItem(); 96 ~OFileSelectorItem();
97 bool isLocked()const; 97 bool isLocked()const;
98 bool isDir()const; 98 bool isDir()const;
99 QString directory()const; 99 QString directory()const;
100 QString path()const; 100 QString path()const;
101 QString key(int id, bool )const; 101 QString key(int id, bool )const;
102 102
103private: 103private:
104 bool m_locked : 1; 104 bool m_locked : 1;
105 bool m_isDir : 1; 105 bool m_isDir : 1;
106 QString m_dir; 106 QString m_dir;
107}; 107};
108 108
109class OFileViewFileListView : public QWidget { 109class OFileViewFileListView : public QWidget {
110 Q_OBJECT 110 Q_OBJECT
111public: 111public:
112 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); 112 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
113 ~OFileViewFileListView(); 113 ~OFileViewFileListView();
114 114
115 OFileSelectorItem* currentItem()const; 115 OFileSelectorItem* currentItem()const;
116 void reread( bool all = false ); 116 void reread( bool all = false );
117 int fileCount()const; 117 int fileCount()const;
118 QString currentDir()const; 118 QString currentDir()const;
119protected: 119protected:
120 bool eventFilter (QObject *o, QEvent *e); 120 bool eventFilter (QObject *o, QEvent *e);
121private slots: 121private slots:
122 void slotNew(); // will emit newSelected 122 void slotNew(); // will emit newSelected
123 void cdUP(); 123 void cdUP();
124 void cdHome(); 124 void cdHome();
125 void cdDoc(); 125 void cdDoc();
126 void changeDir( const QString& ); 126 void changeDir( const QString& );
127 void slotCurrentChanged( QListViewItem* ); 127 void slotCurrentChanged( QListViewItem* );
128 void slotClicked(int, QListViewItem*, const QPoint&, int ); 128 void slotClicked(int, QListViewItem*, const QPoint&, int );
129 void slotDoubleClicked(QListViewItem*);
129 void slotFSActivated(int); 130 void slotFSActivated(int);
130 131
131protected: 132protected:
132 133
133 OFileSelector* selector(); 134 OFileSelector* selector();
134 135
135private: 136private:
136 QMap<QString, QString> m_dev; 137 QMap<QString, QString> m_dev;
137 bool m_all : 1; 138 bool m_all : 1;
138 OFileSelector* m_sel; 139 OFileSelector* m_sel;
139 QPopupMenu* m_fsPop; 140 QPopupMenu* m_fsPop;
140 bool compliesMime( const QString& ); 141 bool compliesMime( const QString& );
141 QStringList m_mimes; // used in compy mime 142 QStringList m_mimes; // used in compy mime
142 QString m_currentDir; 143 QString m_currentDir;
143 QToolButton *m_btnNew, *m_btnClose; 144 QToolButton *m_btnNew, *m_btnClose;
144 void connectSlots(); 145 void connectSlots();
145 void addFile( QFileInfo* info, bool symlink = FALSE ); 146 void addFile( QFileInfo* info, bool symlink = FALSE );
146 void addDir ( QFileInfo* info, bool symlink = FALSE ); 147 void addDir ( QFileInfo* info, bool symlink = FALSE );
147 void addSymlink( QFileInfo* info, bool = FALSE ); 148 void addSymlink( QFileInfo* info, bool = FALSE );
148 149
149 150
150private: 151private:
151 QListView* m_view; 152 QListView* m_view;
152}; 153};
153 154
154typedef QMap<QString, QStringList> MimeTypes; 155typedef QMap<QString, QStringList> MimeTypes;
155 156
156class OFileViewInterface; 157class OFileViewInterface;
157class OFileViewFileListView; 158class OFileViewFileListView;
158class QLineEdit; 159class QLineEdit;
159class QComboBox; 160class QComboBox;
160class QWidgetStack; 161class QWidgetStack;
161class QHBox; 162class QHBox;
162class OFileSelector : public QWidget { 163class OFileSelector : public QWidget {
163 Q_OBJECT 164 Q_OBJECT
164 friend class OFileViewInterface; 165 friend class OFileViewInterface;
165 friend class OFileViewFileListView; 166 friend class OFileViewFileListView;
166public: 167public:
167 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 168 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
168// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 169// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
169 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; 170 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
170// enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; 171// enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2};
171 172
172 OFileSelector(QWidget* parent, int mode, int selector, 173 OFileSelector(QWidget* parent, int mode, int selector,
173 const QString& dirName, 174 const QString& dirName,
174 const QString& fileName, 175 const QString& fileName,
175 const MimeTypes& mimetypes = MimeTypes(), 176 const MimeTypes& mimetypes = MimeTypes(),
176 bool newVisible = FALSE, bool closeVisible = FALSE ); 177 bool newVisible = FALSE, bool closeVisible = FALSE );
177 178
178 OFileSelector(const QString& mimeFilter, QWidget* parent, 179 OFileSelector(const QString& mimeFilter, QWidget* parent,
179 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); 180 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE );
180 ~OFileSelector(); 181 ~OFileSelector();
181 182
182 const DocLnk* selected(); 183 const DocLnk* selected();
183 184
184 QString selectedName()const; 185 QString selectedName()const;
185 QString selectedPath()const; 186 QString selectedPath()const;
186 QString directory()const; 187 QString directory()const;
187 188
188 DocLnk selectedDocument()const; 189 DocLnk selectedDocument()const;
189 190
190 int fileCount()const; 191 int fileCount()const;
191 void reread(); 192 void reread();
192 193
193 int mode()const; 194 int mode()const;
194 int selector()const; 195 int selector()const;
195 196
196 197
197 void setNewVisible( bool b ); 198 void setNewVisible( bool b );
198 void setCloseVisible( bool b ); 199 void setCloseVisible( bool b );
199 void setNameVisible( bool b ); 200 void setNameVisible( bool b );
200 201
201signals: 202signals:
202 void dirSelected( const QString& ); 203 void dirSelected( const QString& );
203 void fileSelected( const DocLnk& ); 204 void fileSelected( const DocLnk& );
204 void fileSelected( const QString& ); 205 void fileSelected( const QString& );
205 void newSelected( const DocLnk& ); 206 void newSelected( const DocLnk& );
206 void closeMe(); 207 void closeMe();
207 void ok(); 208 void ok();
208 void cancel(); 209 void cancel();
209 210
210/* used by the ViewInterface */ 211/* used by the ViewInterface */
211private: 212private:
212 bool showNew()const; 213 bool showNew()const;
213 bool showClose()const; 214 bool showClose()const;
214 MimeTypes mimeTypes()const; 215 MimeTypes mimeTypes()const;
215 QStringList currentMimeType()const; 216 QStringList currentMimeType()const;
216 217
217private: 218private:
218 /* inits the Widgets */ 219 /* inits the Widgets */
219 void initUI(); 220 void initUI();
220 /* inits the MimeType ComboBox content + connects signals and slots */ 221 /* inits the MimeType ComboBox content + connects signals and slots */
221 void initMime(); 222 void initMime();
222 /* init the Views :) */ 223 /* init the Views :) */
223 void initViews(); 224 void initViews();
224 225
225private: 226private:
226 QLineEdit* m_lneEdit; // the LineEdit for the Name 227 QLineEdit* m_lneEdit; // the LineEdit for the Name
227 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType 228 QComboBox *m_cmbView, *m_cmbMime; // two ComboBoxes to select the View and MimeType
228 QWidgetStack* m_stack; // our widget stack which will contain the views 229 QWidgetStack* m_stack; // our widget stack which will contain the views
229 OFileViewInterface* currentView()const; // returns the currentView 230 OFileViewInterface* currentView()const; // returns the currentView
230 OFileViewInterface* m_current; // here is the view saved 231 OFileViewInterface* m_current; // here is the view saved
231 bool m_shNew : 1; // should we show New? 232 bool m_shNew : 1; // should we show New?
232 bool m_shClose : 1; // should we show Close? 233 bool m_shClose : 1; // should we show Close?
233 MimeTypes m_mimeType; // list of mimetypes 234 MimeTypes m_mimeType; // list of mimetypes
234 235
235 QMap<QString, OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr 236 QMap<QString, OFileViewInterface*> m_views; // QString translated view name + ViewInterface Ptr
236 QHBox* m_nameBox; // the LineEdit + Label is hold here 237 QHBox* m_nameBox; // the LineEdit + Label is hold here
237 QHBox* m_cmbBox; // this holds the two combo boxes 238 QHBox* m_cmbBox; // this holds the two combo boxes
238 239
239 QString m_startDir; 240 QString m_startDir;
240 int m_mode; 241 int m_mode;
241 int m_selector; 242 int m_selector;
242 243
243 struct Data; // used for future versions 244 struct Data; // used for future versions
244 Data *d; 245 Data *d;
245 246
246private slots: 247private slots:
247 void slotMimeTypeChanged(); 248 void slotMimeTypeChanged();
248 249
249 /* will set the text of the lineedit and emit a fileChanged signal */ 250 /* will set the text of the lineedit and emit a fileChanged signal */
250 void slotDocLnkBridge( const DocLnk& ); 251 void slotDocLnkBridge( const DocLnk& );
251 void slotFileBridge( const QString& ); 252 void slotFileBridge( const QString& );
252 void slotViewChange( const QString& ); 253 void slotViewChange( const QString& );
253 254
254 bool eventFilter (QObject *o, QEvent *e); 255 bool eventFilter (QObject *o, QEvent *e);
255 256
256}; 257};
257 258
258#endif 259#endif