summaryrefslogtreecommitdiffabout
Unidiff
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,278 +1,281 @@
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
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d0dbb47..acd9265 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -267,513 +267,513 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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
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
@@ -132,563 +132,589 @@ DocLnk ODocumentFileView::selectedDocument()const {
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 );
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