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