-rw-r--r-- | bin/kdepim/SyncHowto.txt | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 6 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 14 | ||||
-rw-r--r-- | version | 2 |
4 files changed, 16 insertions, 8 deletions
diff --git a/bin/kdepim/SyncHowto.txt b/bin/kdepim/SyncHowto.txt index 64f6f14..b0473a1 100644 --- a/bin/kdepim/SyncHowto.txt +++ b/bin/kdepim/SyncHowto.txt | |||
@@ -1,580 +1,580 @@ | |||
1 | WARNING: | 1 | WARNING: |
2 | YOU MAY GET UNEXPECTED (I.E. WRONG) SYNCHRONIZATION RESULTS, | 2 | YOU MAY GET UNEXPECTED (I.E. WRONG) SYNCHRONIZATION RESULTS, |
3 | IF YOU CHANGE AN EVENT ON THE FIRST DEVICE AND SYNC IMMEDIATELY FROM | 3 | IF YOU CHANGE AN EVENT ON THE FIRST DEVICE AND SYNC IMMEDIATELY FROM |
4 | THE OTHER DEVICE WITH THIS DEVICE, IF THE CLOCKS OF THE TWO DEVICES | 4 | THE OTHER DEVICE WITH THIS DEVICE, IF THE CLOCKS OF THE TWO DEVICES |
5 | HAVE TOO MUCH DIFFERENCE. | 5 | HAVE TOO MUCH DIFFERENCE. |
6 | 6 | ||
7 | In other words: Please make sure, that the clocks of the devices | 7 | In other words: Please make sure, that the clocks of the devices |
8 | you want to sync have only a difference of some seconds! | 8 | you want to sync have only a difference of some seconds! |
9 | 9 | ||
10 | 10 | ||
11 | CONTENT: | 11 | CONTENT: |
12 | 12 | ||
13 | 0) How syncing works | 13 | 0) How syncing works |
14 | 1) Qick overview of settings | 14 | 1) Qick overview of settings |
15 | 2) Sync settings in sync dialog | 15 | 2) Sync settings in sync dialog |
16 | 3) Syncing background | 16 | 3) Syncing background |
17 | 4) Sync preferences | 17 | 4) Sync preferences |
18 | 5) How a filter works | 18 | 5) How a filter works |
19 | 6) Details about sync profile kinds | 19 | 6) Details about sync profile kinds |
20 | 20 | ||
21 | ************************************************************************* | 21 | ************************************************************************* |
22 | 0) How syncing works | 22 | 0) How syncing works |
23 | ************************************************************************* | 23 | ************************************************************************* |
24 | 24 | ||
25 | Note: | 25 | Note: |
26 | The recommended and easiest way to syncronize two devices where | 26 | The recommended and easiest way to syncronize two devices where |
27 | KO/Pi, KA/Pi or PWM/Pi is installed, is the profile kind "Pi-Sync". | 27 | KO/Pi, KA/Pi or PWM/Pi is installed, is the profile kind "Pi-Sync". |
28 | Details about that in 6) b). | 28 | Details about that in 6) b). |
29 | 29 | ||
30 | In KDE-Pim/Pi you can synchronize ( sync ) your calendar/addressbook/ | 30 | In KDE-Pim/Pi you can synchronize ( sync ) your calendar/addressbook/ |
31 | passwordfile with another calendar/addressbook/passwordfile, | 31 | passwordfile with another calendar/addressbook/passwordfile, |
32 | by syncing your (local) calendar/addressbook/passwordfile | 32 | by syncing your (local) calendar/addressbook/passwordfile |
33 | with a (remote) file. | 33 | with a (remote) file. |
34 | This remote file may on your local filesystem | 34 | This remote file may on your local filesystem |
35 | or on another (remote) device. | 35 | or on another (remote) device. |
36 | 36 | ||
37 | If you want to sync with another remote device, you have to create | 37 | If you want to sync with another remote device, you have to create |
38 | a sync profile. | 38 | a sync profile. |
39 | You have two choices for choosing the profil kind: | 39 | You have two choices for choosing the profil kind: |
40 | I) You can choose profile kind "Remote file" and specify a | 40 | I) You can choose profile kind "Remote file" and specify a |
41 | command line download/upload command ( like scp, ftp, ...) to | 41 | command line download/upload command ( like scp, ftp, ...) to |
42 | a) download the remote file to your local machine to a temp file | 42 | a) download the remote file to your local machine to a temp file |
43 | b) sync with this temp file | 43 | b) sync with this temp file |
44 | c) upload the synced file to the remote device | 44 | c) upload the synced file to the remote device |
45 | II) If you want to sync with a device, where KO/Pi( or KA/Pi, PWM/Pi) is | 45 | II) If you want to sync with a device, where KO/Pi( or KA/Pi, PWM/Pi) is |
46 | installed, you can easily get the remote file via network | 46 | installed, you can easily get the remote file via network |
47 | with the build in file transfer feature: | 47 | with the build in file transfer feature: |
48 | Choose profile kind "Pi-Sync" and | 48 | Choose profile kind "Pi-Sync" and |
49 | a) Start KO/Pi,KA/Pi or PWM/Pi on remote device and | 49 | a) Start KO/Pi,KA/Pi or PWM/Pi on remote device and |
50 | enable "Pi-Sync" on remote device with password and port. | 50 | enable "Pi-Sync" on remote device with password and port. |
51 | b) Specify password, port and IP address in your profile. | 51 | b) Specify password, port and IP address in your profile. |
52 | 52 | ||
53 | 53 | ||
54 | You can sync with your mobile phone as well. | 54 | You can sync with your mobile phone as well. |
55 | Everything is explained in more details below. | 55 | Everything is explained in more details below. |
56 | 56 | ||
57 | NOTE: | 57 | NOTE: |
58 | If you do not use profile kind "Pi-Sync", | 58 | If you do not use profile kind "Pi-Sync", |
59 | it is recommended to close | 59 | it is recommended to close |
60 | a running KO/Pi (KA/Pi, PWM/Pi) on the remote device. | 60 | a running KO/Pi (KA/Pi, PWM/Pi) on the remote device. |
61 | (Note: KO/Pi(KA/Pi, PWM/Pi) running on Zaurus with | 61 | (Note: KO/Pi(KA/Pi, PWM/Pi) running on Zaurus with |
62 | FastLoad enabled will never be closed!) | 62 | FastLoad enabled will never be closed!) |
63 | After syncing with a running KO/Pi on the remote device, | 63 | After syncing with a running KO/Pi on the remote device, |
64 | a "save" on the remote device will tell you that it needs to merge (sync). | 64 | a "save" on the remote device will tell you that it needs to merge (sync). |
65 | After merging (just a syncing with the changed file) | 65 | After merging (just a syncing with the changed file) |
66 | you will get the new data showing in remote KO/Pi. | 66 | you will get the new data showing in remote KO/Pi. |
67 | 67 | ||
68 | ************************************************************************* | 68 | ************************************************************************* |
69 | 1) Qick overview of settings | 69 | 1) Qick overview of settings |
70 | ************************************************************************* | 70 | ************************************************************************* |
71 | 71 | ||
72 | a) Open sync settings dialog (Menu Synchronize - Configure...) | 72 | a) Open sync settings dialog (Menu Synchronize - Configure...) |
73 | b) Give your device a unique name. | 73 | b) Give your device a unique name. |
74 | (unique in the set of all devices you want to sync with). | 74 | (unique in the set of all devices you want to sync with). |
75 | If you have already configured another devive and created | 75 | If you have already configured another devive and created |
76 | there a sync profile to sync with this device, give your device | 76 | there a sync profile to sync with this device, give your device |
77 | the same name as this sync profile! The same name is important, | 77 | the same name as this sync profile! The same name is important, |
78 | because it makes it possible to sync first A->B | 78 | because it makes it possible to sync first A->B |
79 | (A local device, that performs the sync, B remote device) | 79 | (A local device, that performs the sync, B remote device) |
80 | and then B->A. Such that the B->A sync knows about the | 80 | and then B->A. Such that the B->A sync knows about the |
81 | already performed A->B sync. | 81 | already performed A->B sync. |
82 | That means: It is unimportant if you sync A->B or B->A, | 82 | That means: It is unimportant if you sync A->B or B->A, |
83 | the devices A and B will be synced properly. | 83 | the devices A and B will be synced properly. |
84 | c) Create a new sync profile and give it a unique name. | 84 | c) Create a new sync profile and give it a unique name. |
85 | (unique in the set of all sync profiles on this device). | 85 | (unique in the set of all sync profiles on this device). |
86 | If you want to sync with a device, where KO/Pi is already installed | 86 | If you want to sync with a device, where KO/Pi is already installed |
87 | and which has a given unique device name, use this device name as | 87 | and which has a given unique device name, use this device name as |
88 | your profile name ( refer to b) ). | 88 | your profile name ( refer to b) ). |
89 | d) Coose the profile kind of your syncing method: | 89 | d) Choose the profile kind of your syncing method: |
90 | (i) Local file or | 90 | (i) Local file or |
91 | (ii) Pi-Sync or | 91 | (ii) Pi-Sync or |
92 | (iii) Remote file or | 92 | (iii) Remote file or |
93 | (iiii) Mobile Phone. | 93 | (iiii) Mobile Phone. |
94 | Detailed explanation in 6) | 94 | Detailed explanation in 6) |
95 | e) Choose the other profile options. | 95 | e) Choose the other profile options. |
96 | Detailed explanation in 2) | 96 | Detailed explanation in 2) |
97 | f) Close sync dialog with OK. | 97 | f) Close sync dialog with OK. |
98 | g) Sync. | 98 | g) Sync. |
99 | 99 | ||
100 | NOTE: | 100 | NOTE: |
101 | AFTER SYNCING THERE ARE "SYNC EVENTS" CREATED | 101 | AFTER SYNCING THERE ARE "SYNC EVENTS" CREATED |
102 | (OR UPDATED, IF IT ALREADY EXITS) FOR EACH SYNC PROFILE. | 102 | (OR UPDATED, IF IT ALREADY EXITS) FOR EACH SYNC PROFILE. |
103 | YOU MAY NOT DELETE OR CHANGE THESE EVENTS. | 103 | YOU MAY NOT DELETE OR CHANGE THESE EVENTS. |
104 | 104 | ||
105 | ************************************************************************* | 105 | ************************************************************************* |
106 | 2) Sync settings in sync dialog | 106 | 2) Sync settings in sync dialog |
107 | ************************************************************************* | 107 | ************************************************************************* |
108 | 108 | ||
109 | a) Local device name: | 109 | a) Local device name: |
110 | -> 1) b) | 110 | -> 1) b) |
111 | b) Profile: | 111 | b) Profile: |
112 | -> 1) c) | 112 | -> 1) c) |
113 | c) Multiple Sync options: Include in multiple sync: | 113 | c) Multiple Sync options: Include in multiple sync: |
114 | In the Synchronize menu, there is a multiple sync menu entry. | 114 | In the Synchronize menu, there is a multiple sync menu entry. |
115 | If you choose this menu entry, all user defined profiles with this | 115 | If you choose this menu entry, all user defined profiles with this |
116 | 'Include in multiple sync' option enabled will be synced | 116 | 'Include in multiple sync' option enabled will be synced |
117 | one after another. And this twice. This will take some time. | 117 | one after another. And this twice. This will take some time. |
118 | After that sync, on all devices should be the same data. | 118 | After that sync, on all devices should be the same data. |
119 | 119 | ||
120 | d)- j) Sync algo options: | 120 | d)- j) Sync algo options: |
121 | 121 | ||
122 | d) Ask for preferences before sync: | 122 | d) Ask for preferences before sync: |
123 | Check this to be asked for "Sync preferences" settings before each sync. | 123 | Check this to be asked for "Sync preferences" settings before each sync. |
124 | If the profile kind is "Pi-Sync" you will be asked to confirm | 124 | If the profile kind is "Pi-Sync" you will be asked to confirm |
125 | the "Pi-Sync" specific settings (Password,IP address, port number) | 125 | the "Pi-Sync" specific settings (Password,IP address, port number) |
126 | as well. That makes it possible to use that profile for a | 126 | as well. That makes it possible to use that profile for a |
127 | device that is connected via DHCP to the network and gets different | 127 | device that is connected via DHCP to the network and gets different |
128 | IP addresses when connecting to the network. | 128 | IP addresses when connecting to the network. |
129 | e) Sync preferences: | 129 | e) Sync preferences: |
130 | Choose here your sync preferences. | 130 | Choose here your sync preferences. |
131 | Details -> 4) | 131 | Details -> 4) |
132 | f) Show summary after sync: | 132 | f) Show summary after sync: |
133 | Check this to get a small summary dialog after sync | 133 | Check this to get a small summary dialog after sync |
134 | about number of added/changed/deleted events on local/remote. | 134 | about number of added/changed/deleted events on local/remote. |
135 | g) Apply filter when adding data to local: | 135 | g) Apply filter when adding data to local: |
136 | What is a filter? You can read this in -> 5) | 136 | What is a filter? You can read this in -> 5) |
137 | With this option you can specify a filter for events/contacts, | 137 | With this option you can specify a filter for events/contacts, |
138 | which should be added to the local database, because they are | 138 | which should be added to the local database, because they are |
139 | in the remote database and not in the local database. | 139 | in the remote database and not in the local database. |
140 | (Database = calendar file or addressbook file). | 140 | (Database = calendar file or addressbook file). |
141 | Note that the filter is NOT applied to the remote | 141 | Note that the filter is NOT applied to the remote |
142 | database before syncing. It is only applied to a particular | 142 | database before syncing. It is only applied to a particular |
143 | item which should be added to the local database. | 143 | item which should be added to the local database. |
144 | Well, but what is the difference? | 144 | Well, but what is the difference? |
145 | The differnce is: If the remote database AND the local database contain | 145 | The differnce is: If the remote database AND the local database contain |
146 | an already synced item, which does not match the filter, then this item is synced. | 146 | an already synced item, which does not match the filter, then this item is synced. |
147 | If the remote database contains an item which does not match the filter | 147 | If the remote database contains an item which does not match the filter |
148 | and the local database does not contain this item, then this item is not added | 148 | and the local database does not contain this item, then this item is not added |
149 | to the local database, but it is still in the remote database after syncing. | 149 | to the local database, but it is still in the remote database after syncing. |
150 | g) Write back synced data: | 150 | g) Write back synced data: |
151 | Uncheck this to update the local calendar only. | 151 | Uncheck this to update the local calendar only. |
152 | I.e. your local calendar is synced with the remote calendar | 152 | I.e. your local calendar is synced with the remote calendar |
153 | but nothing on the remote calendar is changed. | 153 | but nothing on the remote calendar is changed. |
154 | If you uncheck "Write back synced data", the settings | 154 | If you uncheck "Write back synced data", the settings |
155 | under h) and i) are ignored, of course. | 155 | under h) and i) are ignored, of course. |
156 | 156 | ||
157 | h) - j) Write back options: | 157 | h) - j) Write back options: |
158 | 158 | ||
159 | h) Write back (on remote) existing entries only: | 159 | h) Write back (on remote) existing entries only: |
160 | Check this to update the remote data only. | 160 | Check this to update the remote data only. |
161 | I.e. no data from yor local calendar/addressbook is added to the | 161 | I.e. no data from yor local calendar/addressbook is added to the |
162 | remote device. You may use this option to | 162 | remote device. You may use this option to |
163 | sync against some kind of "public calendar/addressbook" without | 163 | sync against some kind of "public calendar/addressbook" without |
164 | adding anything of your personal data. | 164 | adding anything of your personal data. |
165 | But in this case, you cannot add an item to the remoet device. | 165 | But in this case, you cannot add an item to the remoet device. |
166 | i) Apply filter when adding data to remote: | 166 | i) Apply filter when adding data to remote: |
167 | What is a filter? You can read this in -> 5) | 167 | What is a filter? You can read this in -> 5) |
168 | With this option you can specify a filter for events/contacts, | 168 | With this option you can specify a filter for events/contacts, |
169 | which should be added to the remote database, because they are | 169 | which should be added to the remote database, because they are |
170 | in the local database and not in the remote database. | 170 | in the local database and not in the remote database. |
171 | (Database = calendar file or addressbook file). | 171 | (Database = calendar file or addressbook file). |
172 | Note that the filter is NOT applied to the local | 172 | Note that the filter is NOT applied to the local |
173 | database before syncing. It is only applied to a particular | 173 | database before syncing. It is only applied to a particular |
174 | item of the local database which should be added to the remote database. | 174 | item of the local database which should be added to the remote database. |
175 | Well, but what is the difference? | 175 | Well, but what is the difference? |
176 | The differnce is: If the local database AND the remote database contain | 176 | The differnce is: If the local database AND the remote database contain |
177 | an already synced item, which does not match the filter, then this item is synced. | 177 | an already synced item, which does not match the filter, then this item is synced. |
178 | If the local database contains an item which does not match the filter | 178 | If the local database contains an item which does not match the filter |
179 | and the remote database does not contain this item, then this item is not added | 179 | and the remote database does not contain this item, then this item is not added |
180 | to the remote database, but it is still in the local database after syncing. | 180 | to the remote database, but it is still in the local database after syncing. |
181 | Example: | 181 | Example: |
182 | You have specified a calendar filter "only public events". | 182 | You have specified a calendar filter "only public events". |
183 | You specify this filter as the outgoing filter for syncing. | 183 | You specify this filter as the outgoing filter for syncing. |
184 | If there is an event in the local database which is not "public", but "private", | 184 | If there is an event in the local database which is not "public", but "private", |
185 | this event is not added to the remote database. | 185 | this event is not added to the remote database. |
186 | If there is an event in the local database and in the remote database which is | 186 | If there is an event in the local database and in the remote database which is |
187 | "private" (maybe added by someone else) then this event is synced and | 187 | "private" (maybe added by someone else) then this event is synced and |
188 | it is in the local database and in the remote database after syncing. | 188 | it is in the local database and in the remote database after syncing. |
189 | That means in particular you cannot remove an event from the remote | 189 | That means in particular you cannot remove an event from the remote |
190 | database but setting it to "private". | 190 | database but setting it to "private". |
191 | If you want to remove the event you can clone it, set it to private and delete the | 191 | If you want to remove the event you can clone it, set it to private and delete the |
192 | original event. Then the original event is deleted in the remote database after sync and | 192 | original event. Then the original event is deleted in the remote database after sync and |
193 | the cloned event is not added to the remote database, because it is private. | 193 | the cloned event is not added to the remote database, because it is private. |
194 | j) Write back (calendar) entries for time period only: | 194 | j) Write back (calendar) entries for time period only: |
195 | Check this to write back only calendar entries for a given time period. | 195 | Check this to write back only calendar entries for a given time period. |
196 | (Useful when syncing with mobile phones.) | 196 | (Useful when syncing with mobile phones.) |
197 | You can specify the date range in weeks for the weeks in the past to the weeks in the future. | 197 | You can specify the date range in weeks for the weeks in the past to the weeks in the future. |
198 | 198 | ||
199 | k) Profile kind: | 199 | k) Profile kind: |
200 | Details -> 6) | 200 | Details -> 6) |
201 | 201 | ||
202 | ************************************************************************* | 202 | ************************************************************************* |
203 | 3) Syncing background | 203 | 3) Syncing background |
204 | ************************************************************************* | 204 | ************************************************************************* |
205 | 205 | ||
206 | The same mentioned for calendars is valid for addressbooks as well. | 206 | The same mentioned for calendars is valid for addressbooks as well. |
207 | 207 | ||
208 | Synchronizing calendars ( i.e. files ) means, | 208 | Synchronizing calendars ( i.e. files ) means, |
209 | to merge two calendars in a useful way. | 209 | to merge two calendars in a useful way. |
210 | If the two calendars are completely different, | 210 | If the two calendars are completely different, |
211 | there is no problem, the resulting calendar contains | 211 | there is no problem, the resulting calendar contains |
212 | all data from the local and from the remote calendar. | 212 | all data from the local and from the remote calendar. |
213 | 213 | ||
214 | Problems will occur, if you have edited items | 214 | Problems will occur, if you have edited items |
215 | from the local calendar on the remote machine. | 215 | from the local calendar on the remote machine. |
216 | Then it could be, that items are in conflict. | 216 | Then it could be, that items are in conflict. |
217 | Two items are "in conflict", if they have the | 217 | Two items are "in conflict", if they have the |
218 | same unique ID (which get an item at time of | 218 | same unique ID (which get an item at time of |
219 | creation and owns it until it is deleted ) | 219 | creation and owns it until it is deleted ) |
220 | and they both are modified after the last | 220 | and they both are modified after the last |
221 | synchronization. | 221 | synchronization. |
222 | 222 | ||
223 | At first sync of two calendars there is no item deleted. | 223 | At first sync of two calendars there is no item deleted. |
224 | If the calendars are synced before and there is an item, | 224 | If the calendars are synced before and there is an item, |
225 | which is not edited after the last sync and is only | 225 | which is not edited after the last sync and is only |
226 | available in one calendar, then this item is deleted | 226 | available in one calendar, then this item is deleted |
227 | in this calendar. | 227 | in this calendar. |
228 | 228 | ||
229 | But when was the last synchronization between two calendars? | 229 | But when was the last synchronization between two calendars? |
230 | 230 | ||
231 | To know that, KO/Pi creates at first syncing | 231 | To know that, KO/Pi creates at first syncing |
232 | of two files an unique event "<profile name> - sync Event" | 232 | of two files an unique event "<profile name> - sync Event" |
233 | on the remote and the local calendar. | 233 | on the remote and the local calendar. |
234 | After syncing, the start time of this event is set | 234 | After syncing, the start time of this event is set |
235 | to the time of syncing. | 235 | to the time of syncing. |
236 | The event is read only and the user may not change it. | 236 | The event is read only and the user may not change it. |
237 | 237 | ||
238 | If two such files are synced, that both have an event | 238 | If two such files are synced, that both have an event |
239 | "<profile name> - sync Event" and the events have | 239 | "<profile name> - sync Event" and the events have |
240 | the same start time, then deleted items on the one calendar | 240 | the same start time, then deleted items on the one calendar |
241 | are deleted on the other as well. | 241 | are deleted on the other as well. |
242 | 242 | ||
243 | 243 | ||
244 | ************************************************************************* | 244 | ************************************************************************* |
245 | 4) Sync preferences | 245 | 4) Sync preferences |
246 | ************************************************************************* | 246 | ************************************************************************* |
247 | 247 | ||
248 | Two items are "in conflict", if they have the same unique ID | 248 | Two items are "in conflict", if they have the same unique ID |
249 | and they both are modified after the last synchronization. | 249 | and they both are modified after the last synchronization. |
250 | (Details -> 3) ). | 250 | (Details -> 3) ). |
251 | 251 | ||
252 | If an item is not modified after the last sync and | 252 | If an item is not modified after the last sync and |
253 | it is not found in the other calendar, it is deleted. | 253 | it is not found in the other calendar, it is deleted. |
254 | 254 | ||
255 | On the first sync, there is no item deleted. | 255 | On the first sync, there is no item deleted. |
256 | 256 | ||
257 | SYNC PREFERENCES: | 257 | SYNC PREFERENCES: |
258 | -Take local entry on conflict: | 258 | -Take local entry on conflict: |
259 | Takes the local entry on conflict. | 259 | Takes the local entry on conflict. |
260 | If it is the first sync, | 260 | If it is the first sync, |
261 | "Ask for every entry" | 261 | "Ask for every entry" |
262 | is chosen automatically, | 262 | is chosen automatically, |
263 | if this is selected. | 263 | if this is selected. |
264 | 264 | ||
265 | -Take remote entry on conflict: | 265 | -Take remote entry on conflict: |
266 | Takes the remote entry on conflict. | 266 | Takes the remote entry on conflict. |
267 | If it is the first sync, | 267 | If it is the first sync, |
268 | "Ask for every entry" | 268 | "Ask for every entry" |
269 | is chosen automatically, | 269 | is chosen automatically, |
270 | if this is selected. | 270 | if this is selected. |
271 | 271 | ||
272 | -Take newest entry on conflict: | 272 | -Take newest entry on conflict: |
273 | This takes the newest entry on conflict. | 273 | This takes the newest entry on conflict. |
274 | May be the most useful syncing mode. | 274 | May be the most useful syncing mode. |
275 | 275 | ||
276 | -Ask for every entry on conflict: | 276 | -Ask for every entry on conflict: |
277 | Pops up an event viewer dialog and | 277 | Pops up an event viewer dialog and |
278 | shows the two conflicting entries there. | 278 | shows the two conflicting entries there. |
279 | The user can chose, which entry he would like to take. | 279 | The user can chose, which entry he would like to take. |
280 | The button for the newest entry | 280 | The button for the newest entry |
281 | is automatically set as default button. | 281 | is automatically set as default button. |
282 | The color for the newest entry is green. | 282 | The color for the newest entry is green. |
283 | 283 | ||
284 | -Force: Take local entry always: | 284 | -Force: Take local entry always: |
285 | Even if the calendars are already synced | 285 | Even if the calendars are already synced |
286 | there is no item deleted on local. | 286 | there is no item deleted on local. |
287 | 287 | ||
288 | -Force: Take remote entry always: | 288 | -Force: Take remote entry always: |
289 | Analogous to | 289 | Analogous to |
290 | "Force: Take local entry always" | 290 | "Force: Take local entry always" |
291 | 291 | ||
292 | ************************************************************************* | 292 | ************************************************************************* |
293 | 5) How a filter works | 293 | 5) How a filter works |
294 | ************************************************************************* | 294 | ************************************************************************* |
295 | 295 | ||
296 | A filter is a rule to decide if a particular item | 296 | A filter is a rule to decide if a particular item |
297 | (calendar iten item or contact item) belongs to a set of items. | 297 | (calendar iten item or contact item) belongs to a set of items. |
298 | For example, you can specify a set as: | 298 | For example, you can specify a set as: |
299 | Only items, that belongs to that category. | 299 | Only items, that belongs to that category. |
300 | Or: Only items, that does not belong to that category. | 300 | Or: Only items, that does not belong to that category. |
301 | Or: Only items, that are public. | 301 | Or: Only items, that are public. |
302 | 302 | ||
303 | If you specify a filter in a syncing profile, you can set the | 303 | If you specify a filter in a syncing profile, you can set the |
304 | rules of adding items to the local or remote database. | 304 | rules of adding items to the local or remote database. |
305 | 305 | ||
306 | Example: | 306 | Example: |
307 | You have a public calendar in your company, which contains all | 307 | You have a public calendar in your company, which contains all |
308 | company relevant data. | 308 | company relevant data. |
309 | 309 | ||
310 | You have different projects in the company and for project specific events | 310 | You have different projects in the company and for project specific events |
311 | is always set the project name as a category: | 311 | is always set the project name as a category: |
312 | E.g. all events of the project PRO_ABC do have set the categorie PRO_ABC. | 312 | E.g. all events of the project PRO_ABC do have set the categorie PRO_ABC. |
313 | But you are not interested in events of PRO_ABC, because you are not working on it. | 313 | But you are not interested in events of PRO_ABC, because you are not working on it. |
314 | Then you can specify a filter: All, but not with categoroy PRO_ABC. | 314 | Then you can specify a filter: All, but not with categoroy PRO_ABC. |
315 | When you specify this filter as an incoming filter for your sync profile, | 315 | When you specify this filter as an incoming filter for your sync profile, |
316 | all events of the company are synced and added to your local calendar, but not | 316 | all events of the company are synced and added to your local calendar, but not |
317 | the evenst of the project PRO_ABC. | 317 | the evenst of the project PRO_ABC. |
318 | 318 | ||
319 | You do not want that your private data can be seen | 319 | You do not want that your private data can be seen |
320 | in the public calendar of your company. | 320 | in the public calendar of your company. |
321 | Well, set the property to "private" for all your private data | 321 | Well, set the property to "private" for all your private data |
322 | and specify an outgoing filter: Only " public" and "confidential". | 322 | and specify an outgoing filter: Only " public" and "confidential". |
323 | Then you can sync your personal calendar with the calendar of the company, | 323 | Then you can sync your personal calendar with the calendar of the company, |
324 | but your private data is not added to the public calendar. | 324 | but your private data is not added to the public calendar. |
325 | 325 | ||
326 | ************************************************************************* | 326 | ************************************************************************* |
327 | 6) Details about sync profile kinds | 327 | 6) Details about sync profile kinds |
328 | ************************************************************************* | 328 | ************************************************************************* |
329 | 329 | ||
330 | a) Local file | 330 | a) Local file |
331 | Please specify a local file you want to sync with. | 331 | Please specify a local file you want to sync with. |
332 | Note: If you are syncing a file, which is used by KA/Pi, please check the | 332 | Note: If you are syncing a file, which is used by KA/Pi, please check the |
333 | "Addressbook file (*.vcf) is used by KA/Pi". | 333 | "Addressbook file (*.vcf) is used by KA/Pi". |
334 | If you are syncing with a file from KAddressbook or another program, | 334 | If you are syncing with a file from KAddressbook or another program, |
335 | please uncheck "Addressbook file (*.vcf) is used by KA/Pi". | 335 | please uncheck "Addressbook file (*.vcf) is used by KA/Pi". |
336 | To set this properly is important! KA/Pi uses a "last modified" property, | 336 | To set this properly is important! KA/Pi uses a "last modified" property, |
337 | which is not supported by KAddressbook. | 337 | which is not supported by KAddressbook. |
338 | 338 | ||
339 | b) Pi-Sync (direct Kx/Pi to Kx/Pi sync) | 339 | b) Pi-Sync (direct Kx/Pi to Kx/Pi sync) |
340 | We mention here only KO/Pi, but the same is valid for KA/Pi. | 340 | We mention here only KO/Pi, but the same is valid for KA/Pi. |
341 | If you want to sync with a device, where KO/Pi is | 341 | If you want to sync with a device, where KO/Pi is |
342 | installed, you can easily get the remote file via network | 342 | installed, you can easily get the remote file via network |
343 | with the build in file transfer feature "Pi-Sync": | 343 | with the build in file transfer feature "Pi-Sync": |
344 | You have first to enable file transfer on the remote device: | 344 | You have first to enable file transfer on the remote device: |
345 | - Start KO/Pi on the remote device. | 345 | - Start KO/Pi on the remote device. |
346 | - Choose Menu Synchronize-Enable Pi-Sync. | 346 | - Choose Menu Synchronize-Enable Pi-Sync. |
347 | - Choose a port number, where KO/Pi should listen for | 347 | - Choose a port number, where KO/Pi should listen for |
348 | file sending requests. Valid port numbers are numbers | 348 | file sending requests. Valid port numbers are numbers |
349 | between 1 and 65565. Do not specify port numbers, that are | 349 | between 1 and 65565. Do not specify port numbers, that are |
350 | used by other applications. A port number between 9000 and 9999 | 350 | used by other applications. A port number between 9000 and 9999 |
351 | is most likely not used by another application. | 351 | is most likely not used by another application. |
352 | The default port number is 9197 for KO/Pi. | 352 | The default port number is 9197 for KO/Pi. |
353 | If you specify a port number, which is already in use, | 353 | If you specify a port number, which is already in use, |
354 | you will get an error message when closing this dialog. | 354 | you will get an error message when closing this dialog. |
355 | - Choose a password. | 355 | - Choose a password. |
356 | - Click OK. | 356 | - Click OK. |
357 | Now KO/Pi will send the calendar data via the network, | 357 | Now KO/Pi will send the calendar data via the network, |
358 | if some other device is sending a "please send calendar" | 358 | if some other device is sending a "please send calendar" |
359 | request on the given port using the given password. | 359 | request on the given port using the given password. |
360 | If you want to be sure, nobody can access your calendar | 360 | If you want to be sure, nobody can access your calendar |
361 | data, simply disable the file transfer feature on the | 361 | data, simply disable the file transfer feature on the |
362 | remote device after the syncing is done by choosing: | 362 | remote device after the syncing is done by choosing: |
363 | Menu Synchronize-Disable Pi-Sync. | 363 | Menu Synchronize-Disable Pi-Sync. |
364 | 364 | ||
365 | Note: If you want to sync with a remote device that gets different | 365 | Note: If you want to sync with a remote device that gets different |
366 | IPaddresses each time connected to the network | 366 | IPaddresses each time connected to the network |
367 | (this may be the case, if you use DHCP for connection | 367 | (this may be the case, if you use DHCP for connection |
368 | of the remote device to the network) simply enable | 368 | of the remote device to the network) simply enable |
369 | "Ask for preferences before sync". | 369 | "Ask for preferences before sync". |
370 | Then you will be asked to confirm the | 370 | Then you will be asked to confirm the |
371 | "Pi-Sync" specific settings | 371 | "Pi-Sync" specific settings |
372 | (Password,IP address, port number) | 372 | (Password,IP address, port number) |
373 | and you can easily change the IP address before each sync. | 373 | and you can easily change the IP address before each sync. |
374 | 374 | ||
375 | On your local device, create a new profile and choose | 375 | On your local device, create a new profile and choose |
376 | profile kind "Pi-Sync". | 376 | profile kind "Pi-Sync". |
377 | Fill in the needed values: | 377 | Fill in the needed values: |
378 | - Password for remote access: | 378 | - Password for remote access: |
379 | The password you specified on the remote device. | 379 | The password you specified on the remote device. |
380 | - Remote IP address: | 380 | - Remote IP address: |
381 | The IP address of the remote device. | 381 | The IP address of the remote device. |
382 | - Remote port number: | 382 | - Remote port number: |
383 | The port number you specified on the remote device. | 383 | The port number you specified on the remote device. |
384 | 384 | ||
385 | Now you can syncronize your local device easily with your | 385 | Now you can syncronize your local device easily with your |
386 | remote device. This works well for all platforms KO/Pi is | 386 | remote device. This works well for all platforms KO/Pi is |
387 | running on, e.g. syncing a KO/Pi on Zaurus with KO/Pi on Windows | 387 | running on, e.g. syncing a KO/Pi on Zaurus with KO/Pi on Windows |
388 | is now very easy. | 388 | is now very easy. |
389 | 389 | ||
390 | c) Remote file | 390 | c) Remote file |
391 | Note: If you are syncing a file, which is used by KA/Pi, please check the | 391 | Note: If you are syncing a file, which is used by KA/Pi, please check the |
392 | "Addressbook file (*.vcf) is used by KA/Pi". | 392 | "Addressbook file (*.vcf) is used by KA/Pi". |
393 | If you are syncing with a file from KAddressbook or another program, | 393 | If you are syncing with a file from KAddressbook or another program, |
394 | please uncheck "Addressbook file (*.vcf) is used by KA/Pi". | 394 | please uncheck "Addressbook file (*.vcf) is used by KA/Pi". |
395 | To set this properly is important! KA/Pi uses a "last modified" property, | 395 | To set this properly is important! KA/Pi uses a "last modified" property, |
396 | which is not supported by KAddressbook. | 396 | which is not supported by KAddressbook. |
397 | 397 | ||
398 | Syncing with the profile kind "Remote file" is performed in three steps: | 398 | Syncing with the profile kind "Remote file" is performed in three steps: |
399 | i) download the remote file to your local machine to a temp file | 399 | i) download the remote file to your local machine to a temp file |
400 | ii) sync with this temp file | 400 | ii) sync with this temp file |
401 | iii) upload the synced file to the remote device | 401 | iii) upload the synced file to the remote device |
402 | 402 | ||
403 | The down-/uploading if i) and iii) is done via a command line command. | 403 | The down-/uploading if i) and iii) is done via a command line command. |
404 | Please specify the download/upload command ( like scp, ftp, ...) and the | 404 | Please specify the download/upload command ( like scp, ftp, ...) and the |
405 | file name of the temp file in the corresponding fields. | 405 | file name of the temp file in the corresponding fields. |
406 | 406 | ||
407 | d) Mobile device (cell phone) | 407 | d) Mobile device (cell phone) |
408 | Note: On the Zaurus you have to install the phoneaccess_xxx_arm.ipk package | 408 | Note: On the Zaurus you have to install the phoneaccess_xxx_arm.ipk package |
409 | to be able to access mobile phones. | 409 | to be able to access mobile phones. |
410 | We mention here only KO/Pi, but the same is valid for KA/Pi. | 410 | We mention here only KO/Pi, but the same is valid for KA/Pi. |
411 | Note: | 411 | Note: |
412 | It is only possible to sync a mobile phone with one particular device | 412 | It is only possible to sync a mobile phone with one particular device |
413 | running KO/Pi. If you want to be able to write data of more than one device | 413 | running KO/Pi. If you want to be able to write data of more than one device |
414 | to the mobile phone (e.g. from your Zaurus and from your Windows Laptop) | 414 | to the mobile phone (e.g. from your Zaurus and from your Windows Laptop) |
415 | do not sync with the mobile phone at all, but use the | 415 | do not sync with the mobile phone at all, but use the |
416 | "Export to phone" functionality from the different devices. | 416 | "Export to phone" functionality from the different devices. |
417 | Using "Export to phone" makes it not possible to get back data from the | 417 | Using "Export to phone" makes it not possible to get back data from the |
418 | phone, if it was changed there, of course. | 418 | phone, if it was changed there, of course. |
419 | If you sync with the phone, do not use "Export to phone" from any device. | 419 | If you sync with the phone, do not use "Export to phone" from any device. |
420 | (And do not sync, as mentioned above, from any other device with that phone). | 420 | (And do not sync, as mentioned above, from any other device with that phone). |
421 | It would delete the needed information for syncing with that phone! | 421 | It would delete the needed information for syncing with that phone! |
422 | 422 | ||
423 | We are using Gammu (Version: 0.98.9) ( http://freshmeat.net/projects/gammu/ ) | 423 | We are using Gammu (Version: 0.98.9) ( http://freshmeat.net/projects/gammu/ ) |
424 | for accessing the phones. | 424 | for accessing the phones. |
425 | Note: You cannot use the original Gammu for syncing KDE-Pim/Pi, because | 425 | Note: You cannot use the original Gammu for syncing KDE-Pim/Pi, because |
426 | we have modified the original version to make it useable for syncing! | 426 | we have modified the original version to make it useable for syncing! |
427 | Gammu allows access to many phones in many ways (Irda, Bluetooth, serial,...). | 427 | Gammu allows access to many phones in many ways (Irda, Bluetooth, serial,...). |
428 | The recommended phone access using Gammu with KDE-Pim/Pi is Irda (infrared). | 428 | The recommended phone access using Gammu with KDE-Pim/Pi is Irda (infrared). |
429 | Bluetooth access is disabled on the Zaurus, but may work on Windows. | 429 | Bluetooth access is disabled on the Zaurus, but may work on Windows. |
430 | Please look at the Gammu homepage and documentation about more details | 430 | Please look at the Gammu homepage and documentation about more details |
431 | configuring Gammu how to access your phone. | 431 | configuring Gammu how to access your phone. |
432 | If you have problems accessing your phone, start KO/Pi from the konsole | 432 | If you have problems accessing your phone, start KO/Pi from the konsole |
433 | and you will get a more detailed output what went wrong. | 433 | and you will get a more detailed output what went wrong. |
434 | About Gammu from the Gammu homepage: | 434 | About Gammu from the Gammu homepage: |
435 | Gammu (formerly known as MyGnokii2) is a cellular | 435 | Gammu (formerly known as MyGnokii2) is a cellular |
436 | manager for various mobile phones/modems. | 436 | manager for various mobile phones/modems. |
437 | It supports the Nokia 2100, 3100, 32xx, 33xx, | 437 | It supports the Nokia 2100, 3100, 32xx, 33xx, |
438 | 3410, 35xx, 51xx, 5210, 5510, 61xx, 62xx, | 438 | 3410, 35xx, 51xx, 5210, 5510, 61xx, 62xx, |
439 | 63xx, 6510, 6610, 6800, 71xx, 7210, 7250, | 439 | 63xx, 6510, 6610, 6800, 71xx, 7210, 7250, |
440 | 7250i, 82xx, 83xx, 8910, 9110, 9210 | 440 | 7250i, 82xx, 83xx, 8910, 9110, 9210 |
441 | and compatible and AT devices (Siemens, Alcatel, | 441 | and compatible and AT devices (Siemens, Alcatel, |
442 | Falcom, WaveCom, IPAQ, Samsung, SE, and others) | 442 | Falcom, WaveCom, IPAQ, Samsung, SE, and others) |
443 | over cables/infrared/BlueTooth. | 443 | over cables/infrared/BlueTooth. |
444 | 444 | ||
445 | Here is an example what to specify to access a Nokia 6310i via infrared: | 445 | Here is an example what to specify to access a Nokia 6310i via infrared: |
446 | On Linux (Zaurus): | 446 | On Linux (Zaurus): |
447 | I/O device: /dev/ircomm | 447 | I/O device: /dev/ircomm |
448 | Connection: irda | 448 | Connection: irda |
449 | Model: <leave empty> | 449 | Model: <leave empty> |
450 | 450 | ||
451 | On Windows: | 451 | On Windows: |
452 | I/O device: <ignored - i.e. leave empty> | 452 | I/O device: <ignored - i.e. leave empty> |
453 | Connection: irda | 453 | Connection: irda |
454 | Model: <leave empty> | 454 | Model: <leave empty> |
455 | 455 | ||
456 | Here is the overview from the Gammu documentation, | 456 | Here is the overview from the Gammu documentation, |
457 | how to specify the connection settings for | 457 | how to specify the connection settings for |
458 | I/O device: | 458 | I/O device: |
459 | Connection: | 459 | Connection: |
460 | Model: | 460 | Model: |
461 | 461 | ||
462 | Note: The documentation uses the term "port", | 462 | Note: The documentation uses the term "port", |
463 | where we use the term "I/O device". | 463 | where we use the term "I/O device". |
464 | Note: You do not have to create/change the gammurc configuration file. | 464 | Note: You do not have to create/change the gammurc configuration file. |
465 | That will do KO/Pi for you. | 465 | That will do KO/Pi for you. |
466 | Note: For a known model, leave "Model:" always empty, | 466 | Note: For a known model, leave "Model:" always empty, |
467 | such that Gammu can auto detect the model. | 467 | such that Gammu can auto detect the model. |
468 | 468 | ||
469 | # This is a sample ~/.gammurc file. | 469 | # This is a sample ~/.gammurc file. |
470 | # In Unix/Linux copy it into your home directory and name it .gammurc | 470 | # In Unix/Linux copy it into your home directory and name it .gammurc |
471 | # or into /etc and name it gammurc | 471 | # or into /etc and name it gammurc |
472 | # In Win32 copy it into directory with Gammu.exe and name gammurc | 472 | # In Win32 copy it into directory with Gammu.exe and name gammurc |
473 | # More about parameters later | 473 | # More about parameters later |
474 | # ----------------------------------------------------------------------------- | 474 | # ----------------------------------------------------------------------------- |
475 | 475 | ||
476 | [gammu] | 476 | [gammu] |
477 | 477 | ||
478 | port = com8: | 478 | port = com8: |
479 | #model = 6110 | 479 | #model = 6110 |
480 | connection = fbusblue | 480 | connection = fbusblue |
481 | #synchronizetime = yes | 481 | #synchronizetime = yes |
482 | #logfile = gammulog | 482 | #logfile = gammulog |
483 | #logformat = textall | 483 | #logformat = textall |
484 | #use_locking = yes | 484 | #use_locking = yes |
485 | #gammuloc = locfile | 485 | #gammuloc = locfile |
486 | #startinfo = yes | 486 | #startinfo = yes |
487 | #gammucoding = utf8 | 487 | #gammucoding = utf8 |
488 | 488 | ||
489 | [gammu1] | 489 | [gammu1] |
490 | 490 | ||
491 | port = com8: | 491 | port = com8: |
492 | #model = 6110 | 492 | #model = 6110 |
493 | connection = fbusblue | 493 | connection = fbusblue |
494 | #synchronizetime = yes | 494 | #synchronizetime = yes |
495 | #logfile = gammulog | 495 | #logfile = gammulog |
496 | #logformat = textall | 496 | #logformat = textall |
497 | #use_locking = yes | 497 | #use_locking = yes |
498 | #gammuloc = locfile | 498 | #gammuloc = locfile |
499 | #startinfo = yes | 499 | #startinfo = yes |
500 | #gammucoding = utf8 | 500 | #gammucoding = utf8 |
501 | 501 | ||
502 | # ----------------------------------------------------------------------------- | 502 | # ----------------------------------------------------------------------------- |
503 | # Now info about "Connection" parameter and connected with it port type | 503 | # Now info about "Connection" parameter and connected with it port type |
504 | # (more about port types later) | 504 | # (more about port types later) |
505 | # ----------------------------------------------------------------------------- | 505 | # ----------------------------------------------------------------------------- |
506 | # "Connection" parameter | Port type | More details | 506 | # "Connection" parameter | Port type | More details |
507 | # -----------------------|-----------|----------------------------------------- | 507 | # -----------------------|-----------|----------------------------------------- |
508 | # "fbus" | serial | Nokia FBUS2 | 508 | # "fbus" | serial | Nokia FBUS2 |
509 | # "fbusirda"/"infrared" | serial | Nokia FBUS2 over direct infrared device | 509 | # "fbusirda"/"infrared" | serial | Nokia FBUS2 over direct infrared device |
510 | # "fbusdlr3"/"dlr3" | serial | Nokia FBUS2 with DLR3 cable | 510 | # "fbusdlr3"/"dlr3" | serial | Nokia FBUS2 with DLR3 cable |
511 | # "fbusdku5" | dku5 | Nokia FBUS2 with DKU5 cable. WIN32 ONLY | 511 | # "fbusdku5" | dku5 | Nokia FBUS2 with DKU5 cable. WIN32 ONLY |
512 | # "fbuspl2303" | usb | Nokia FBUS2 with USB cable based on | 512 | # "fbuspl2303" | usb | Nokia FBUS2 with USB cable based on |
513 | # | | PL2303 chip. | 513 | # | | PL2303 chip. |
514 | # "fbusblue" | serial | Nokia FBUS2 over Bluetooth serial device | 514 | # "fbusblue" | serial | Nokia FBUS2 over Bluetooth serial device |
515 | # "phonetblue" | serial | Nokia PHONET FBUS over Bluetooth serial | 515 | # "phonetblue" | serial | Nokia PHONET FBUS over Bluetooth serial |
516 | # | | device | 516 | # | | device |
517 | # "mrouterblue" | serial | | 517 | # "mrouterblue" | serial | |
518 | # "mbus" | serial | Nokia MBUS2 | 518 | # "mbus" | serial | Nokia MBUS2 |
519 | # "at19200"/"at115200"/..| serial | AT commands.8 bits, None parity, 1 stop | 519 | # "at19200"/"at115200"/..| serial | AT commands.8 bits, None parity, 1 stop |
520 | # | | bit, no flow control | 520 | # | | bit, no flow control |
521 | # -----------------------|-----------|----------------------------------------- | 521 | # -----------------------|-----------|----------------------------------------- |
522 | # "irdaphonet"/"irda" | irda | Nokia PHONET FBUS over socket infrared | 522 | # "irdaphonet"/"irda" | irda | Nokia PHONET FBUS over socket infrared |
523 | # "irdaat" | irda | AT commands with socket infrared | 523 | # "irdaat" | irda | AT commands with socket infrared |
524 | # "irdaobex" | irda | OBEX over socket infrared. MODEL "obex" | 524 | # "irdaobex" | irda | OBEX over socket infrared. MODEL "obex" |
525 | # -----------------------|-----------|----------------------------------------- | 525 | # -----------------------|-----------|----------------------------------------- |
526 | # "bluephonet" | BT | Nokia PHONET FBUS with Bluetooth stack | 526 | # "bluephonet" | BT | Nokia PHONET FBUS with Bluetooth stack |
527 | # "bluefbus"/"dlr3blue" | BT | Nokia FBUS2 with Bluetooth stack | 527 | # "bluefbus"/"dlr3blue" | BT | Nokia FBUS2 with Bluetooth stack |
528 | # "blueat"/"atblue" | BT | AT commands with Bluetooth stack | 528 | # "blueat"/"atblue" | BT | AT commands with Bluetooth stack |
529 | # "blueobex" | BT | OBEX with Bluetooth. MODEL "obex" | 529 | # "blueobex" | BT | OBEX with Bluetooth. MODEL "obex" |
530 | # | 530 | # |
531 | # Now more about port types and connected with it "Port" parameter | 531 | # Now more about port types and connected with it "Port" parameter |
532 | # ----------------------------------------------------------------------------- | 532 | # ----------------------------------------------------------------------------- |
533 | # Port type | "Port" parameter in Windows/DOS | "Port" parameter in Linux/Unix | 533 | # Port type | "Port" parameter in Windows/DOS | "Port" parameter in Linux/Unix |
534 | # ----------|---------------------------------|-------------------------------- | 534 | # ----------|---------------------------------|-------------------------------- |
535 | # serial | "com*:" | "/dev/ttyS*" | 535 | # serial | "com*:" | "/dev/ttyS*" |
536 | # | (example "com1:") | (example "/dev/ttyS1") | 536 | # | (example "com1:") | (example "/dev/ttyS1") |
537 | # | | or "/dev/tts/**" (with DevFS) | 537 | # | | or "/dev/tts/**" (with DevFS) |
538 | # ----------|---------------------------------|-------------------------------- | 538 | # ----------|---------------------------------|-------------------------------- |
539 | # irda | ignored (can be empty) | "/dev/ircomm*" | 539 | # irda | ignored (can be empty) | "/dev/ircomm*" |
540 | # ----------|---------------------------------|-------------------------------- | 540 | # ----------|---------------------------------|-------------------------------- |
541 | # BT | Bluetooth device address | 541 | # BT | Bluetooth device address |
542 | # | (example "") | 542 | # | (example "") |
543 | # ----------|---------------------------------|-------------------------------- | 543 | # ----------|---------------------------------|-------------------------------- |
544 | # dku5 | ignored (can be empty) | connection with it not possible | 544 | # dku5 | ignored (can be empty) | connection with it not possible |
545 | # ----------|---------------------------------|-------------------------------- | 545 | # ----------|---------------------------------|-------------------------------- |
546 | # usb | connection with it not possible | "/dev/ttyUSB*" | 546 | # usb | connection with it not possible | "/dev/ttyUSB*" |
547 | # | 547 | # |
548 | # Other config parameters | 548 | # Other config parameters |
549 | # ----------------------------------------------------------------------------- | 549 | # ----------------------------------------------------------------------------- |
550 | # Parameter name | Description | 550 | # Parameter name | Description |
551 | # ----------------|------------------------------------------------------------ | 551 | # ----------------|------------------------------------------------------------ |
552 | # Model | use only, when Gammu doesn't recognize your phone model. | 552 | # Model | use only, when Gammu doesn't recognize your phone model. |
553 | # | Put it here. Example values: "6110", "6150", "6210", "8210" | 553 | # | Put it here. Example values: "6110", "6150", "6210", "8210" |
554 | # SynchronizeTime | if you want to set time from computer to phone during | 554 | # SynchronizeTime | if you want to set time from computer to phone during |
555 | # | starting connection. Do not rather use this option when | 555 | # | starting connection. Do not rather use this option when |
556 | # | when to reset phone during connection (in some phones need | 556 | # | when to reset phone during connection (in some phones need |
557 | # | to set time again after restart) | 557 | # | to set time again after restart) |
558 | # GammuLoc | name of localisation file | 558 | # GammuLoc | name of localisation file |
559 | # StartInfo | this option allow to set, that you want (setting "yes") | 559 | # StartInfo | this option allow to set, that you want (setting "yes") |
560 | # | to see message on the phone screen or phone should enable | 560 | # | to see message on the phone screen or phone should enable |
561 | # | light for a moment during starting connection. Phone | 561 | # | light for a moment during starting connection. Phone |
562 | # | WON'T beep during starting connection with this option. | 562 | # | WON'T beep during starting connection with this option. |
563 | # GammuCoding | forces using specified codepage (in win32 - for example | 563 | # GammuCoding | forces using specified codepage (in win32 - for example |
564 | # | "1250" will force CP1250) or UTF8 (in Linux - "utf8") | 564 | # | "1250" will force CP1250) or UTF8 (in Linux - "utf8") |
565 | # ----------------|------------------------------------------------------------ | 565 | # ----------------|------------------------------------------------------------ |
566 | # Logfile | Use, when want to have logfile from communication. | 566 | # Logfile | Use, when want to have logfile from communication. |
567 | # Logformat | What debug info and format should be used: | 567 | # Logformat | What debug info and format should be used: |
568 | # | "nothing" - no debug level (default) | 568 | # | "nothing" - no debug level (default) |
569 | # | "text" - transmission dump in text format | 569 | # | "text" - transmission dump in text format |
570 | # | "textall" - all possible info in text format | 570 | # | "textall" - all possible info in text format |
571 | # | "errors" - errors in text format | 571 | # | "errors" - errors in text format |
572 | # | "binary" - transmission dump in binary format | 572 | # | "binary" - transmission dump in binary format |
573 | # ----------------|------------------------------------------------------------ | 573 | # ----------------|------------------------------------------------------------ |
574 | # Use_Locking | under Unix/Linux use "yes", if want to lock used device | 574 | # Use_Locking | under Unix/Linux use "yes", if want to lock used device |
575 | # | to prevent using it by other applications. In win32 ignored | 575 | # | to prevent using it by other applications. In win32 ignored |
576 | 576 | ||
577 | 577 | ||
578 | 578 | ||
579 | 579 | ||
580 | 580 | ||
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 347d982..ead8628 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -1,457 +1,457 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <qapp.h> | 22 | #include <qapp.h> |
23 | 23 | ||
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include "kotodoviewitem.h" | 25 | #include "kotodoviewitem.h" |
26 | #include "kotodoview.h" | 26 | #include "kotodoview.h" |
27 | #include "koprefs.h" | 27 | #include "koprefs.h" |
28 | 28 | ||
29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) |
30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
31 | { | 31 | { |
32 | construct(); | 32 | construct(); |
33 | } | 33 | } |
34 | 34 | ||
35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
37 | { | 37 | { |
38 | construct(); | 38 | construct(); |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KOTodoViewItem::key(int column,bool) const | 41 | QString KOTodoViewItem::key(int column,bool) const |
42 | { | 42 | { |
43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
44 | if (it == mKeyMap.end()) { | 44 | if (it == mKeyMap.end()) { |
45 | return text(column).lower(); | 45 | return text(column).lower(); |
46 | } else { | 46 | } else { |
47 | return *it; | 47 | return *it; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | void KOTodoViewItem:: setup() | 51 | void KOTodoViewItem:: setup() |
52 | { | 52 | { |
53 | 53 | ||
54 | int h = 20; | 54 | int h = 20; |
55 | if ( listView () ) { | 55 | if ( listView () ) { |
56 | QFontMetrics fm ( listView ()->font () ); | 56 | QFontMetrics fm ( listView ()->font () ); |
57 | h = fm.height(); | 57 | h = fm.height(); |
58 | } | 58 | } |
59 | setHeight( h ); | 59 | setHeight( h ); |
60 | 60 | ||
61 | } | 61 | } |
62 | void KOTodoViewItem::setSortKey(int column,const QString &key) | 62 | void KOTodoViewItem::setSortKey(int column,const QString &key) |
63 | { | 63 | { |
64 | mKeyMap.insert(column,key); | 64 | mKeyMap.insert(column,key); |
65 | } | 65 | } |
66 | 66 | ||
67 | #if QT_VERSION >= 300 | 67 | #if QT_VERSION >= 300 |
68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
69 | int y,int h) | 69 | int y,int h) |
70 | { | 70 | { |
71 | QListViewItem::paintBranches(p,cg,w,y,h); | 71 | QListViewItem::paintBranches(p,cg,w,y,h); |
72 | } | 72 | } |
73 | #else | 73 | #else |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | void KOTodoViewItem::construct() | 76 | void KOTodoViewItem::construct() |
77 | { | 77 | { |
78 | // qDebug("KOTodoViewItem::construct() "); | 78 | // qDebug("KOTodoViewItem::construct() "); |
79 | m_init = true; | 79 | m_init = true; |
80 | QString keyd = "=="; | 80 | QString keyd = "=="; |
81 | QString keyt = "=="; | 81 | QString keyt = "=="; |
82 | QString skeyd = "=="; | 82 | QString skeyd = "=="; |
83 | QString skeyt = "=="; | 83 | QString skeyt = "=="; |
84 | 84 | ||
85 | setOn(mTodo->isCompleted()); | 85 | setOn(mTodo->isCompleted()); |
86 | setText(0,mTodo->summary()); | 86 | setText(0,mTodo->summary()); |
87 | setText(1,QString::number(mTodo->priority())); | 87 | setText(1,QString::number(mTodo->priority())); |
88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
89 | if (mTodo->percentComplete()<100) { | 89 | if (mTodo->percentComplete()<100) { |
90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
91 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 91 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
95 | else setSortKey(2,QString::number(99)); | 95 | else setSortKey(2,QString::number(99)); |
96 | } | 96 | } |
97 | if (mTodo->hasDueDate()) { | 97 | if (mTodo->hasDueDate()) { |
98 | setText(3, mTodo->dtDueDateStr()); | 98 | setText(3, mTodo->dtDueDateStr()); |
99 | QDate d = mTodo->dtDue().date(); | 99 | QDate d = mTodo->dtDue().date(); |
100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
101 | // setSortKey(3,keyd); | 101 | // setSortKey(3,keyd); |
102 | if (mTodo->doesFloat()) { | 102 | if (mTodo->doesFloat()) { |
103 | setText(4,""); | 103 | setText(4,""); |
104 | } | 104 | } |
105 | else { | 105 | else { |
106 | setText(4,mTodo->dtDueTimeStr()); | 106 | setText(4,mTodo->dtDueTimeStr()); |
107 | QTime t = mTodo->dtDue().time(); | 107 | QTime t = mTodo->dtDue().time(); |
108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
109 | //setSortKey(4,keyt); | 109 | //setSortKey(4,keyt); |
110 | } | 110 | } |
111 | } else { | 111 | } else { |
112 | setText(3,""); | 112 | setText(3,""); |
113 | setText(4,""); | 113 | setText(4,""); |
114 | } | 114 | } |
115 | setSortKey(3,keyd); | 115 | setSortKey(3,keyd); |
116 | setSortKey(4,keyt); | 116 | setSortKey(4,keyt); |
117 | 117 | ||
118 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); | 118 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); |
119 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 119 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | if (mTodo->hasStartDate()) { | 123 | if (mTodo->hasStartDate()) { |
124 | setText(5, mTodo->dtStartDateStr()); | 124 | setText(5, mTodo->dtStartDateStr()); |
125 | QDate d = mTodo->dtStart().date(); | 125 | QDate d = mTodo->dtStart().date(); |
126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
127 | 127 | ||
128 | if (mTodo->doesFloat()) { | 128 | if (mTodo->doesFloat()) { |
129 | setText(6,""); | 129 | setText(6,""); |
130 | } | 130 | } |
131 | else { | 131 | else { |
132 | setText(6,mTodo->dtStartTimeStr()); | 132 | setText(6,mTodo->dtStartTimeStr()); |
133 | QTime t = mTodo->dtStart().time(); | 133 | QTime t = mTodo->dtStart().time(); |
134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
135 | 135 | ||
136 | } | 136 | } |
137 | } else { | 137 | } else { |
138 | setText(5,""); | 138 | setText(5,""); |
139 | setText(6,""); | 139 | setText(6,""); |
140 | } | 140 | } |
141 | setSortKey(5,skeyd); | 141 | setSortKey(5,skeyd); |
142 | setSortKey(6,skeyt); | 142 | setSortKey(6,skeyt); |
143 | 143 | ||
144 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); | 144 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); |
145 | setText(8,mTodo->categoriesStr()); | 145 | setText(8,mTodo->categoriesStr()); |
146 | 146 | ||
147 | #if 0 | 147 | #if 0 |
148 | // Find sort id in description. It's the text behind the last '#' character | 148 | // Find sort id in description. It's the text behind the last '#' character |
149 | // found in the description. White spaces are removed from beginning and end | 149 | // found in the description. White spaces are removed from beginning and end |
150 | // of sort id. | 150 | // of sort id. |
151 | int pos = mTodo->description().findRev('#'); | 151 | int pos = mTodo->description().findRev('#'); |
152 | if (pos < 0) { | 152 | if (pos < 0) { |
153 | setText(6,""); | 153 | setText(6,""); |
154 | } else { | 154 | } else { |
155 | QString str = mTodo->description().mid(pos+1); | 155 | QString str = mTodo->description().mid(pos+1); |
156 | str.stripWhiteSpace(); | 156 | str.stripWhiteSpace(); |
157 | setText(6,str); | 157 | setText(6,str); |
158 | } | 158 | } |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | m_known = false; | 161 | m_known = false; |
162 | m_init = false; | 162 | m_init = false; |
163 | 163 | ||
164 | setMyPixmap(); | 164 | setMyPixmap(); |
165 | 165 | ||
166 | } | 166 | } |
167 | void KOTodoViewItem::setMyPixmap() | 167 | void KOTodoViewItem::setMyPixmap() |
168 | { | 168 | { |
169 | int size = 5; | 169 | int size = 5; |
170 | QPixmap pixi = QPixmap( 1, 1 ); | 170 | QPixmap pixi = QPixmap( 1, 1 ); |
171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
172 | // pixi = SmallIcon("redcross16"); | 172 | // pixi = SmallIcon("redcross16"); |
173 | // } else { | 173 | // } else { |
174 | QPainter p; | 174 | QPainter p; |
175 | 175 | ||
176 | int pixSize = 0; | 176 | int pixSize = 0; |
177 | QPixmap pPix = QPixmap( size, size ); | 177 | QPixmap pPix = QPixmap( size, size ); |
178 | if ( mTodo->description().length() > 0 ) { | 178 | if ( mTodo->description().length() > 0 ) { |
179 | pixi.resize(size, pixSize+size); | 179 | pixi.resize(size, pixSize+size); |
180 | pPix.fill( Qt::darkGreen ); | 180 | pPix.fill( Qt::darkGreen ); |
181 | p.begin( &pixi ); | 181 | p.begin( &pixi ); |
182 | p. drawPixmap ( 0, pixSize, pPix); | 182 | p. drawPixmap ( 0, pixSize, pPix); |
183 | p.end(); | 183 | p.end(); |
184 | pixSize += size; | 184 | pixSize += size; |
185 | } | 185 | } |
186 | if ( mTodo->isAlarmEnabled() ) { | 186 | if ( mTodo->isAlarmEnabled() ) { |
187 | pixi.resize(size, pixSize+size); | 187 | pixi.resize(size, pixSize+size); |
188 | pPix.fill( Qt::red ); | 188 | pPix.fill( Qt::red ); |
189 | p.begin( &pixi ); | 189 | p.begin( &pixi ); |
190 | p. drawPixmap ( 0, pixSize, pPix); | 190 | p. drawPixmap ( 0, pixSize, pPix); |
191 | p.end(); | 191 | p.end(); |
192 | pixSize += size; | 192 | pixSize += size; |
193 | } | 193 | } |
194 | // } | 194 | // } |
195 | if ( pixi.width() > 1 ) { | 195 | if ( pixi.width() > 1 ) { |
196 | setPixmap ( 0,pixi ) ; | 196 | setPixmap ( 0,pixi ) ; |
197 | } else { | ||
198 | setPixmap ( 0,QPixmap() ) ; | ||
197 | } | 199 | } |
198 | |||
199 | |||
200 | } | 200 | } |
201 | void KOTodoViewItem::stateChange(bool state) | 201 | void KOTodoViewItem::stateChange(bool state) |
202 | { | 202 | { |
203 | // qDebug("KOTodoViewItem::stateChange "); | 203 | // qDebug("KOTodoViewItem::stateChange "); |
204 | // do not change setting on startup | 204 | // do not change setting on startup |
205 | if ( m_init ) return; | 205 | if ( m_init ) return; |
206 | 206 | ||
207 | kdDebug() << "State changed, modified " << state << endl; | 207 | kdDebug() << "State changed, modified " << state << endl; |
208 | QString keyd = "=="; | 208 | QString keyd = "=="; |
209 | QString keyt = "=="; | 209 | QString keyt = "=="; |
210 | 210 | ||
211 | if (state) mTodo->setCompleted(state); | 211 | if (state) mTodo->setCompleted(state); |
212 | else mTodo->setPercentComplete(0); | 212 | else mTodo->setPercentComplete(0); |
213 | if (isOn()!=state) { | 213 | if (isOn()!=state) { |
214 | setOn(state); | 214 | setOn(state); |
215 | } | 215 | } |
216 | 216 | ||
217 | if (mTodo->hasDueDate()) { | 217 | if (mTodo->hasDueDate()) { |
218 | setText(3, mTodo->dtDueDateStr()); | 218 | setText(3, mTodo->dtDueDateStr()); |
219 | QDate d = mTodo->dtDue().date(); | 219 | QDate d = mTodo->dtDue().date(); |
220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
221 | setSortKey(3,keyd); | 221 | setSortKey(3,keyd); |
222 | if (mTodo->doesFloat()) { | 222 | if (mTodo->doesFloat()) { |
223 | setText(4,""); | 223 | setText(4,""); |
224 | } | 224 | } |
225 | else { | 225 | else { |
226 | setText(4,mTodo->dtDueTimeStr()); | 226 | setText(4,mTodo->dtDueTimeStr()); |
227 | QTime t = mTodo->dtDue().time(); | 227 | QTime t = mTodo->dtDue().time(); |
228 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 228 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
229 | setSortKey(4,keyt); | 229 | setSortKey(4,keyt); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
234 | 234 | ||
235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
236 | if (mTodo->percentComplete()<100) { | 236 | if (mTodo->percentComplete()<100) { |
237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
238 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 238 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
239 | } | 239 | } |
240 | else { | 240 | else { |
241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
242 | else setSortKey(2,QString::number(99)); | 242 | else setSortKey(2,QString::number(99)); |
243 | } | 243 | } |
244 | QListViewItem * myChild = firstChild(); | 244 | QListViewItem * myChild = firstChild(); |
245 | KOTodoViewItem *item; | 245 | KOTodoViewItem *item; |
246 | while( myChild ) { | 246 | while( myChild ) { |
247 | item = static_cast<KOTodoViewItem*>(myChild); | 247 | item = static_cast<KOTodoViewItem*>(myChild); |
248 | item->stateChange(state); | 248 | item->stateChange(state); |
249 | myChild = myChild->nextSibling(); | 249 | myChild = myChild->nextSibling(); |
250 | } | 250 | } |
251 | mTodoView->modified(true); | 251 | mTodoView->modified(true); |
252 | mTodoView->setTodoModified( mTodo ); | ||
253 | setMyPixmap(); | 252 | setMyPixmap(); |
253 | mTodoView->setTodoModified( mTodo ); | ||
254 | } | 254 | } |
255 | 255 | ||
256 | bool KOTodoViewItem::isAlternate() | 256 | bool KOTodoViewItem::isAlternate() |
257 | { | 257 | { |
258 | #ifndef KORG_NOLVALTERNATION | 258 | #ifndef KORG_NOLVALTERNATION |
259 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 259 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
260 | if (lv && lv->alternateBackground().isValid()) | 260 | if (lv && lv->alternateBackground().isValid()) |
261 | { | 261 | { |
262 | KOTodoViewItem *above = 0; | 262 | KOTodoViewItem *above = 0; |
263 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); | 263 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); |
264 | m_known = above ? above->m_known : true; | 264 | m_known = above ? above->m_known : true; |
265 | if (m_known) | 265 | if (m_known) |
266 | { | 266 | { |
267 | m_odd = above ? !above->m_odd : false; | 267 | m_odd = above ? !above->m_odd : false; |
268 | } | 268 | } |
269 | else | 269 | else |
270 | { | 270 | { |
271 | KOTodoViewItem *item; | 271 | KOTodoViewItem *item; |
272 | bool previous = true; | 272 | bool previous = true; |
273 | if (QListViewItem::parent()) | 273 | if (QListViewItem::parent()) |
274 | { | 274 | { |
275 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); | 275 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); |
276 | if (item) | 276 | if (item) |
277 | previous = item->m_odd; | 277 | previous = item->m_odd; |
278 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 278 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); | 282 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); |
283 | } | 283 | } |
284 | 284 | ||
285 | while(item) | 285 | while(item) |
286 | { | 286 | { |
287 | item->m_odd = previous = !previous; | 287 | item->m_odd = previous = !previous; |
288 | item->m_known = true; | 288 | item->m_known = true; |
289 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); | 289 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | return m_odd; | 292 | return m_odd; |
293 | } | 293 | } |
294 | return false; | 294 | return false; |
295 | #else | 295 | #else |
296 | return false; | 296 | return false; |
297 | #endif | 297 | #endif |
298 | } | 298 | } |
299 | 299 | ||
300 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 300 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
301 | { | 301 | { |
302 | QColorGroup _cg = cg; | 302 | QColorGroup _cg = cg; |
303 | QColorGroup::ColorRole role; | 303 | QColorGroup::ColorRole role; |
304 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 304 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
305 | role = QColorGroup::Text; | 305 | role = QColorGroup::Text; |
306 | else | 306 | else |
307 | role = QColorGroup::Base; | 307 | role = QColorGroup::Base; |
308 | //#ifndef KORG_NOLVALTERNATION | 308 | //#ifndef KORG_NOLVALTERNATION |
309 | // if (isAlternate()) | 309 | // if (isAlternate()) |
310 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 310 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
311 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 311 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
312 | QColor colorToSet; | 312 | QColor colorToSet; |
313 | if ( setColor ) { | 313 | if ( setColor ) { |
314 | QStringList categories = mTodo->categories(); | 314 | QStringList categories = mTodo->categories(); |
315 | QString cat = categories.first(); | 315 | QString cat = categories.first(); |
316 | if ( !cat.isEmpty()) { | 316 | if ( !cat.isEmpty()) { |
317 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 317 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
318 | } else | 318 | } else |
319 | setColor = false; | 319 | setColor = false; |
320 | } | 320 | } |
321 | if (mTodo->hasDueDate()) { | 321 | if (mTodo->hasDueDate()) { |
322 | if (mTodo->dtDue().date()==QDate::currentDate() && | 322 | if (mTodo->dtDue().date()==QDate::currentDate() && |
323 | !mTodo->isCompleted()) { | 323 | !mTodo->isCompleted()) { |
324 | //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); | 324 | //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); |
325 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 325 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
326 | setColor = true; | 326 | setColor = true; |
327 | } | 327 | } |
328 | if (mTodo->dtDue().date() < QDate::currentDate() && | 328 | if (mTodo->dtDue().date() < QDate::currentDate() && |
329 | !mTodo->isCompleted()) { | 329 | !mTodo->isCompleted()) { |
330 | //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); | 330 | //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); |
331 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 331 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
332 | setColor = true; | 332 | setColor = true; |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | if ( setColor ) { | 336 | if ( setColor ) { |
337 | _cg.setColor(role,colorToSet ); | 337 | _cg.setColor(role,colorToSet ); |
338 | if ( role == QColorGroup::Base) { | 338 | if ( role == QColorGroup::Base) { |
339 | int rgb = colorToSet.red(); | 339 | int rgb = colorToSet.red(); |
340 | rgb += colorToSet.blue()/2; | 340 | rgb += colorToSet.blue()/2; |
341 | rgb += colorToSet.green(); | 341 | rgb += colorToSet.green(); |
342 | if ( rgb < 200 ) | 342 | if ( rgb < 200 ) |
343 | _cg.setColor(QColorGroup::Text,Qt::white ); | 343 | _cg.setColor(QColorGroup::Text,Qt::white ); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | //#endif | 346 | //#endif |
347 | if ( column > 0 ){ | 347 | if ( column > 0 ){ |
348 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 348 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
349 | p->save(); | 349 | p->save(); |
350 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 350 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
351 | 351 | ||
352 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 352 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
353 | // p->setPen(Qt::black ); //border | 353 | // p->setPen(Qt::black ); //border |
354 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 354 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
355 | QColor fc = KOPrefs::instance()->mHighlightColor; | 355 | QColor fc = KOPrefs::instance()->mHighlightColor; |
356 | if ( mTodo->percentComplete() == 100 ) | 356 | if ( mTodo->percentComplete() == 100 ) |
357 | fc = darkGreen; | 357 | fc = darkGreen; |
358 | p->drawRect( 2, 2, width-4, height()-4); | 358 | p->drawRect( 2, 2, width-4, height()-4); |
359 | p->fillRect( 3, 3, progress, height()-6, | 359 | p->fillRect( 3, 3, progress, height()-6, |
360 | fc ); | 360 | fc ); |
361 | p->restore(); | 361 | p->restore(); |
362 | } else { | 362 | } else { |
363 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 363 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
364 | } | 364 | } |
365 | return; | 365 | return; |
366 | } | 366 | } |
367 | 367 | ||
368 | int align = alignment; | 368 | int align = alignment; |
369 | 369 | ||
370 | if ( !p ) | 370 | if ( !p ) |
371 | return; | 371 | return; |
372 | 372 | ||
373 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 373 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
374 | 374 | ||
375 | QListView *lv = listView(); | 375 | QListView *lv = listView(); |
376 | if ( !lv ) | 376 | if ( !lv ) |
377 | return; | 377 | return; |
378 | int marg = 2;//lv->itemMargin(); | 378 | int marg = 2;//lv->itemMargin(); |
379 | int r = 0; | 379 | int r = 0; |
380 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 380 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
381 | int BoxSize = 20; | 381 | int BoxSize = 20; |
382 | int boxOffset = 2; | 382 | int boxOffset = 2; |
383 | int xOffset = 2; | 383 | int xOffset = 2; |
384 | if (qApp->desktop()->width() < 300 ) { | 384 | if (qApp->desktop()->width() < 300 ) { |
385 | BoxSize = 14; | 385 | BoxSize = 14; |
386 | boxOffset = -1; | 386 | boxOffset = -1; |
387 | xOffset = 1; | 387 | xOffset = 1; |
388 | // marg = 0; | 388 | // marg = 0; |
389 | } | 389 | } |
390 | if ( height() < BoxSize ) { | 390 | if ( height() < BoxSize ) { |
391 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 391 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
392 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 392 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
393 | BoxSize = height(); | 393 | BoxSize = height(); |
394 | 394 | ||
395 | } | 395 | } |
396 | //bool winStyle = lv->style() == WindowsStyle; | 396 | //bool winStyle = lv->style() == WindowsStyle; |
397 | 397 | ||
398 | int lineStart = 5; | 398 | int lineStart = 5; |
399 | if ( myType == Controller ) { | 399 | if ( myType == Controller ) { |
400 | if ( !pixmap( 0 ) ) | 400 | if ( !pixmap( 0 ) ) |
401 | r += BoxSize + 4; | 401 | r += BoxSize + 4; |
402 | } else { | 402 | } else { |
403 | ASSERT( lv ); //### | 403 | ASSERT( lv ); //### |
404 | //QFontMetrics fm( lv->font() ); | 404 | //QFontMetrics fm( lv->font() ); |
405 | //int d = fm.height(); | 405 | //int d = fm.height(); |
406 | int x = 0; | 406 | int x = 0; |
407 | int y = (height() - BoxSize) / 2; | 407 | int y = (height() - BoxSize) / 2; |
408 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 408 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
409 | if ( myType == CheckBox ) { | 409 | if ( myType == CheckBox ) { |
410 | if ( isEnabled() ) | 410 | if ( isEnabled() ) |
411 | p->setPen( QPen( _cg.text(), 1 ) ); | 411 | p->setPen( QPen( _cg.text(), 1 ) ); |
412 | else | 412 | else |
413 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 413 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
414 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 414 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
415 | lineStart = x+marg; | 415 | lineStart = x+marg; |
416 | ///////////////////// | 416 | ///////////////////// |
417 | x++; | 417 | x++; |
418 | y++; | 418 | y++; |
419 | if ( isOn() ) { | 419 | if ( isOn() ) { |
420 | QPointArray a( 7*2 ); | 420 | QPointArray a( 7*2 ); |
421 | int i, xx, yy; | 421 | int i, xx, yy; |
422 | xx = x+xOffset+marg+(boxOffset/2); | 422 | xx = x+xOffset+marg+(boxOffset/2); |
423 | yy = y+5+boxOffset; | 423 | yy = y+5+boxOffset; |
424 | for ( i=0; i<3; i++ ) { | 424 | for ( i=0; i<3; i++ ) { |
425 | a.setPoint( 2*i, xx, yy ); | 425 | a.setPoint( 2*i, xx, yy ); |
426 | a.setPoint( 2*i+1, xx, yy+2 ); | 426 | a.setPoint( 2*i+1, xx, yy+2 ); |
427 | // qDebug(" "); | 427 | // qDebug(" "); |
428 | xx++; yy++; | 428 | xx++; yy++; |
429 | } | 429 | } |
430 | yy -= 2; | 430 | yy -= 2; |
431 | for ( i=3; i<7; i++ ) { | 431 | for ( i=3; i<7; i++ ) { |
432 | a.setPoint( 2*i, xx, yy ); | 432 | a.setPoint( 2*i, xx, yy ); |
433 | a.setPoint( 2*i+1, xx, yy+2 ); | 433 | a.setPoint( 2*i+1, xx, yy+2 ); |
434 | xx++; yy--; | 434 | xx++; yy--; |
435 | } | 435 | } |
436 | p->setPen( darkGreen ); | 436 | p->setPen( darkGreen ); |
437 | p->drawLineSegments( a ); | 437 | p->drawLineSegments( a ); |
438 | } | 438 | } |
439 | //////////////////////// | 439 | //////////////////////// |
440 | } | 440 | } |
441 | r += BoxSize + 4; | 441 | r += BoxSize + 4; |
442 | } | 442 | } |
443 | 443 | ||
444 | p->translate( r, 0 ); | 444 | p->translate( r, 0 ); |
445 | p->setPen( QPen( _cg.text() ) ); | 445 | p->setPen( QPen( _cg.text() ) ); |
446 | QListViewItem::paintCell( p, _cg, column, width - r, align ); | 446 | QListViewItem::paintCell( p, _cg, column, width - r, align ); |
447 | if ( mTodo->cancelled () ) { | 447 | if ( mTodo->cancelled () ) { |
448 | p->setPen( black ); | 448 | p->setPen( black ); |
449 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); | 449 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); |
450 | int wid = br.width() +lineStart; | 450 | int wid = br.width() +lineStart; |
451 | if ( wid > width-3 ) | 451 | if ( wid > width-3 ) |
452 | wid = width-3; | 452 | wid = width-3; |
453 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); | 453 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); |
454 | 454 | ||
455 | } | 455 | } |
456 | 456 | ||
457 | } | 457 | } |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 6859d36..154cd02 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -888,1334 +888,1342 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) | |||
888 | { | 888 | { |
889 | //qDebug("KListView::contentsMouseDoubleClickEvent"); | 889 | //qDebug("KListView::contentsMouseDoubleClickEvent"); |
890 | // We don't want to call the parent method because it does setOpen, | 890 | // We don't want to call the parent method because it does setOpen, |
891 | // whereas we don't do it in single click mode... (David) | 891 | // whereas we don't do it in single click mode... (David) |
892 | //QListView::contentsMouseDoubleClickEvent( e ); | 892 | //QListView::contentsMouseDoubleClickEvent( e ); |
893 | 893 | ||
894 | QPoint vp = contentsToViewport(e->pos()); | 894 | QPoint vp = contentsToViewport(e->pos()); |
895 | QListViewItem *item = itemAt( vp ); | 895 | QListViewItem *item = itemAt( vp ); |
896 | emit QListView::doubleClicked( item ); // we do it now | 896 | emit QListView::doubleClicked( item ); // we do it now |
897 | 897 | ||
898 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; | 898 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; |
899 | 899 | ||
900 | if( item ) { | 900 | if( item ) { |
901 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); | 901 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); |
902 | 902 | ||
903 | emit doubleClicked( item, e->globalPos(), col ); | 903 | emit doubleClicked( item, e->globalPos(), col ); |
904 | 904 | ||
905 | if( (e->button() == LeftButton) && !d->bUseSingle ) { | 905 | if( (e->button() == LeftButton) && !d->bUseSingle ) { |
906 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); | 906 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); |
907 | 907 | ||
908 | emitExecute( e->button(), item, e->globalPos(), col); | 908 | emitExecute( e->button(), item, e->globalPos(), col); |
909 | } | 909 | } |
910 | } | 910 | } |
911 | } | 911 | } |
912 | 912 | ||
913 | void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) | 913 | void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) |
914 | { | 914 | { |
915 | //qDebug("KListView::slotMouseButtonClicked"); | 915 | //qDebug("KListView::slotMouseButtonClicked"); |
916 | 916 | ||
917 | if( (btn == LeftButton) && item ) { | 917 | if( (btn == LeftButton) && item ) { |
918 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); | 918 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); |
919 | 919 | ||
920 | emitExecute(btn, item, pos, c); | 920 | emitExecute(btn, item, pos, c); |
921 | } | 921 | } |
922 | } | 922 | } |
923 | 923 | ||
924 | void KListView::contentsDropEvent(QDropEvent* e) | 924 | void KListView::contentsDropEvent(QDropEvent* e) |
925 | { | 925 | { |
926 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | 926 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); |
927 | /*US | 927 | /*US |
928 | cleanDropVisualizer(); | 928 | cleanDropVisualizer(); |
929 | cleanItemHighlighter(); | 929 | cleanItemHighlighter(); |
930 | d->dragExpand.stop(); | 930 | d->dragExpand.stop(); |
931 | 931 | ||
932 | if (acceptDrag (e)) | 932 | if (acceptDrag (e)) |
933 | { | 933 | { |
934 | e->acceptAction(); | 934 | e->acceptAction(); |
935 | QListViewItem *afterme; | 935 | QListViewItem *afterme; |
936 | QListViewItem *parent; | 936 | QListViewItem *parent; |
937 | findDrop(e->pos(), parent, afterme); | 937 | findDrop(e->pos(), parent, afterme); |
938 | 938 | ||
939 | if (e->source() == viewport() && itemsMovable()) | 939 | if (e->source() == viewport() && itemsMovable()) |
940 | movableDropEvent(parent, afterme); | 940 | movableDropEvent(parent, afterme); |
941 | else | 941 | else |
942 | { | 942 | { |
943 | 943 | ||
944 | emit dropped(e, afterme); | 944 | emit dropped(e, afterme); |
945 | emit dropped(this, e, afterme); | 945 | emit dropped(this, e, afterme); |
946 | emit dropped(e, parent, afterme); | 946 | emit dropped(e, parent, afterme); |
947 | emit dropped(this, e, parent, afterme); | 947 | emit dropped(this, e, parent, afterme); |
948 | 948 | ||
949 | } | 949 | } |
950 | } | 950 | } |
951 | */ | 951 | */ |
952 | 952 | ||
953 | } | 953 | } |
954 | 954 | ||
955 | void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) | 955 | void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) |
956 | { | 956 | { |
957 | QPtrList<QListViewItem> items, afterFirsts, afterNows; | 957 | QPtrList<QListViewItem> items, afterFirsts, afterNows; |
958 | QListViewItem *current=currentItem(); | 958 | QListViewItem *current=currentItem(); |
959 | bool hasMoved=false; | 959 | bool hasMoved=false; |
960 | for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) | 960 | for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) |
961 | { | 961 | { |
962 | iNext=i->itemBelow(); | 962 | iNext=i->itemBelow(); |
963 | if (!i->isSelected()) | 963 | if (!i->isSelected()) |
964 | continue; | 964 | continue; |
965 | 965 | ||
966 | // don't drop an item after itself, or else | 966 | // don't drop an item after itself, or else |
967 | // it moves to the top of the list | 967 | // it moves to the top of the list |
968 | if (i==afterme) | 968 | if (i==afterme) |
969 | continue; | 969 | continue; |
970 | 970 | ||
971 | i->setSelected(false); | 971 | i->setSelected(false); |
972 | 972 | ||
973 | QListViewItem *afterFirst = i->itemAbove(); | 973 | QListViewItem *afterFirst = i->itemAbove(); |
974 | 974 | ||
975 | if (!hasMoved) | 975 | if (!hasMoved) |
976 | { | 976 | { |
977 | emit aboutToMove(); | 977 | emit aboutToMove(); |
978 | hasMoved=true; | 978 | hasMoved=true; |
979 | } | 979 | } |
980 | 980 | ||
981 | moveItem(i, parent, afterme); | 981 | moveItem(i, parent, afterme); |
982 | 982 | ||
983 | // ###### This should include the new parent !!! -> KDE 3.0 | 983 | // ###### This should include the new parent !!! -> KDE 3.0 |
984 | // If you need this right now, have a look at keditbookmarks. | 984 | // If you need this right now, have a look at keditbookmarks. |
985 | emit moved(i, afterFirst, afterme); | 985 | emit moved(i, afterFirst, afterme); |
986 | 986 | ||
987 | items.append (i); | 987 | items.append (i); |
988 | afterFirsts.append (afterFirst); | 988 | afterFirsts.append (afterFirst); |
989 | afterNows.append (afterme); | 989 | afterNows.append (afterme); |
990 | 990 | ||
991 | afterme = i; | 991 | afterme = i; |
992 | } | 992 | } |
993 | clearSelection(); | 993 | clearSelection(); |
994 | for (QListViewItem *i=items.first(); i != 0; i=items.next() ) | 994 | for (QListViewItem *i=items.first(); i != 0; i=items.next() ) |
995 | i->setSelected(true); | 995 | i->setSelected(true); |
996 | if (current) | 996 | if (current) |
997 | setCurrentItem(current); | 997 | setCurrentItem(current); |
998 | 998 | ||
999 | emit moved(items,afterFirsts,afterNows); | 999 | emit moved(items,afterFirsts,afterNows); |
1000 | 1000 | ||
1001 | if (firstChild()) | 1001 | if (firstChild()) |
1002 | emit moved(); | 1002 | emit moved(); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | void KListView::contentsDragMoveEvent(QDragMoveEvent *event) | 1005 | void KListView::contentsDragMoveEvent(QDragMoveEvent *event) |
1006 | { | 1006 | { |
1007 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | 1007 | qDebug("KListView::contentsDropEvent drag&drop not supported yet"); |
1008 | /*US | 1008 | /*US |
1009 | if (acceptDrag(event)) | 1009 | if (acceptDrag(event)) |
1010 | { | 1010 | { |
1011 | event->acceptAction(); | 1011 | event->acceptAction(); |
1012 | //Clean up the view | 1012 | //Clean up the view |
1013 | 1013 | ||
1014 | findDrop(event->pos(), d->parentItemDrop, d->afterItemDrop); | 1014 | findDrop(event->pos(), d->parentItemDrop, d->afterItemDrop); |
1015 | QPoint vp = contentsToViewport( event->pos() ); | 1015 | QPoint vp = contentsToViewport( event->pos() ); |
1016 | QListViewItem *item = isExecuteArea( vp ) ? itemAt( vp ) : 0L; | 1016 | QListViewItem *item = isExecuteArea( vp ) ? itemAt( vp ) : 0L; |
1017 | 1017 | ||
1018 | if ( item != d->dragOverItem ) | 1018 | if ( item != d->dragOverItem ) |
1019 | { | 1019 | { |
1020 | d->dragExpand.stop(); | 1020 | d->dragExpand.stop(); |
1021 | d->dragOverItem = item; | 1021 | d->dragOverItem = item; |
1022 | d->dragOverPoint = vp; | 1022 | d->dragOverPoint = vp; |
1023 | if ( d->dragOverItem && d->dragOverItem->isExpandable() && !d->dragOverItem->isOpen() ) | 1023 | if ( d->dragOverItem && d->dragOverItem->isExpandable() && !d->dragOverItem->isOpen() ) |
1024 | d->dragExpand.start( QApplication::startDragTime(), true ); | 1024 | d->dragExpand.start( QApplication::startDragTime(), true ); |
1025 | } | 1025 | } |
1026 | if (dropVisualizer()) | 1026 | if (dropVisualizer()) |
1027 | { | 1027 | { |
1028 | QRect tmpRect = drawDropVisualizer(0, d->parentItemDrop, d->afterItemDrop); | 1028 | QRect tmpRect = drawDropVisualizer(0, d->parentItemDrop, d->afterItemDrop); |
1029 | if (tmpRect != d->mOldDropVisualizer) | 1029 | if (tmpRect != d->mOldDropVisualizer) |
1030 | { | 1030 | { |
1031 | cleanDropVisualizer(); | 1031 | cleanDropVisualizer(); |
1032 | d->mOldDropVisualizer=tmpRect; | 1032 | d->mOldDropVisualizer=tmpRect; |
1033 | viewport()->repaint(tmpRect); | 1033 | viewport()->repaint(tmpRect); |
1034 | } | 1034 | } |
1035 | } | 1035 | } |
1036 | if (dropHighlighter()) | 1036 | if (dropHighlighter()) |
1037 | { | 1037 | { |
1038 | QRect tmpRect = drawItemHighlighter(0, d->afterItemDrop); | 1038 | QRect tmpRect = drawItemHighlighter(0, d->afterItemDrop); |
1039 | if (tmpRect != d->mOldDropHighlighter) | 1039 | if (tmpRect != d->mOldDropHighlighter) |
1040 | { | 1040 | { |
1041 | cleanItemHighlighter(); | 1041 | cleanItemHighlighter(); |
1042 | d->mOldDropHighlighter=tmpRect; | 1042 | d->mOldDropHighlighter=tmpRect; |
1043 | viewport()->repaint(tmpRect); | 1043 | viewport()->repaint(tmpRect); |
1044 | } | 1044 | } |
1045 | } | 1045 | } |
1046 | } | 1046 | } |
1047 | else | 1047 | else |
1048 | event->ignore(); | 1048 | event->ignore(); |
1049 | */ | 1049 | */ |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | void KListView::slotDragExpand() | 1052 | void KListView::slotDragExpand() |
1053 | { | 1053 | { |
1054 | if ( itemAt( d->dragOverPoint ) == d->dragOverItem ) | 1054 | if ( itemAt( d->dragOverPoint ) == d->dragOverItem ) |
1055 | d->dragOverItem->setOpen( true ); | 1055 | d->dragOverItem->setOpen( true ); |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | void KListView::contentsDragLeaveEvent (QDragLeaveEvent*) | 1058 | void KListView::contentsDragLeaveEvent (QDragLeaveEvent*) |
1059 | { | 1059 | { |
1060 | d->dragExpand.stop(); | 1060 | d->dragExpand.stop(); |
1061 | cleanDropVisualizer(); | 1061 | cleanDropVisualizer(); |
1062 | cleanItemHighlighter(); | 1062 | cleanItemHighlighter(); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | void KListView::cleanDropVisualizer() | 1065 | void KListView::cleanDropVisualizer() |
1066 | { | 1066 | { |
1067 | if (d->mOldDropVisualizer.isValid()) | 1067 | if (d->mOldDropVisualizer.isValid()) |
1068 | { | 1068 | { |
1069 | QRect rect=d->mOldDropVisualizer; | 1069 | QRect rect=d->mOldDropVisualizer; |
1070 | d->mOldDropVisualizer = QRect(); | 1070 | d->mOldDropVisualizer = QRect(); |
1071 | viewport()->repaint(rect, true); | 1071 | viewport()->repaint(rect, true); |
1072 | } | 1072 | } |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | int KListView::depthToPixels( int depth ) | 1075 | int KListView::depthToPixels( int depth ) |
1076 | { | 1076 | { |
1077 | return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); | 1077 | return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after) | 1080 | void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after) |
1081 | { | 1081 | { |
1082 | QPoint p (contentsToViewport(pos)); | 1082 | QPoint p (contentsToViewport(pos)); |
1083 | 1083 | ||
1084 | // Get the position to put it in | 1084 | // Get the position to put it in |
1085 | QListViewItem *atpos = itemAt(p); | 1085 | QListViewItem *atpos = itemAt(p); |
1086 | 1086 | ||
1087 | QListViewItem *above; | 1087 | QListViewItem *above; |
1088 | if (!atpos) // put it at the end | 1088 | if (!atpos) // put it at the end |
1089 | above = lastItem(); | 1089 | above = lastItem(); |
1090 | else | 1090 | else |
1091 | { | 1091 | { |
1092 | // Get the closest item before us ('atpos' or the one above, if any) | 1092 | // Get the closest item before us ('atpos' or the one above, if any) |
1093 | if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) | 1093 | if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) |
1094 | above = atpos->itemAbove(); | 1094 | above = atpos->itemAbove(); |
1095 | else | 1095 | else |
1096 | above = atpos; | 1096 | above = atpos; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | if (above) | 1099 | if (above) |
1100 | { | 1100 | { |
1101 | // Now, we know we want to go after "above". But as a child or as a sibling ? | 1101 | // Now, we know we want to go after "above". But as a child or as a sibling ? |
1102 | // We have to ask the "above" item if it accepts children. | 1102 | // We have to ask the "above" item if it accepts children. |
1103 | if (above->isExpandable()) | 1103 | if (above->isExpandable()) |
1104 | { | 1104 | { |
1105 | // The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children | 1105 | // The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children |
1106 | if (p.x() >= depthToPixels( above->depth() + 1 ) || | 1106 | if (p.x() >= depthToPixels( above->depth() + 1 ) || |
1107 | (above->isOpen() && above->childCount() > 0) ) | 1107 | (above->isOpen() && above->childCount() > 0) ) |
1108 | { | 1108 | { |
1109 | parent = above; | 1109 | parent = above; |
1110 | after = 0L; | 1110 | after = 0L; |
1111 | return; | 1111 | return; |
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | // Ok, there's one more level of complexity. We may want to become a new | 1115 | // Ok, there's one more level of complexity. We may want to become a new |
1116 | // sibling, but of an upper-level group, rather than the "above" item | 1116 | // sibling, but of an upper-level group, rather than the "above" item |
1117 | QListViewItem * betterAbove = above->parent(); | 1117 | QListViewItem * betterAbove = above->parent(); |
1118 | QListViewItem * last = above; | 1118 | QListViewItem * last = above; |
1119 | while ( betterAbove ) | 1119 | while ( betterAbove ) |
1120 | { | 1120 | { |
1121 | // We are allowed to become a sibling of "betterAbove" only if we are | 1121 | // We are allowed to become a sibling of "betterAbove" only if we are |
1122 | // after its last child | 1122 | // after its last child |
1123 | if ( last->nextSibling() == 0 ) | 1123 | if ( last->nextSibling() == 0 ) |
1124 | { | 1124 | { |
1125 | if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) | 1125 | if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) |
1126 | above = betterAbove; // store this one, but don't stop yet, there may be a better one | 1126 | above = betterAbove; // store this one, but don't stop yet, there may be a better one |
1127 | else | 1127 | else |
1128 | break; // not enough on the left, so stop | 1128 | break; // not enough on the left, so stop |
1129 | last = betterAbove; | 1129 | last = betterAbove; |
1130 | betterAbove = betterAbove->parent(); // up one level | 1130 | betterAbove = betterAbove->parent(); // up one level |
1131 | } else | 1131 | } else |
1132 | break; // we're among the child of betterAbove, not after the last one | 1132 | break; // we're among the child of betterAbove, not after the last one |
1133 | } | 1133 | } |
1134 | } | 1134 | } |
1135 | // set as sibling | 1135 | // set as sibling |
1136 | after = above; | 1136 | after = above; |
1137 | parent = after ? after->parent() : 0L ; | 1137 | parent = after ? after->parent() : 0L ; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | QListViewItem* KListView::lastChild () const | 1140 | QListViewItem* KListView::lastChild () const |
1141 | { | 1141 | { |
1142 | QListViewItem* lastchild = firstChild(); | 1142 | QListViewItem* lastchild = firstChild(); |
1143 | 1143 | ||
1144 | if (lastchild) | 1144 | if (lastchild) |
1145 | for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); | 1145 | for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); |
1146 | 1146 | ||
1147 | return lastchild; | 1147 | return lastchild; |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | QListViewItem *KListView::lastItem() const | 1150 | QListViewItem *KListView::lastItem() const |
1151 | { | 1151 | { |
1152 | QListViewItem* last = lastChild(); | 1152 | QListViewItem* last = lastChild(); |
1153 | 1153 | ||
1154 | for (QListViewItemIterator it (last); it.current(); ++it) | 1154 | for (QListViewItemIterator it (last); it.current(); ++it) |
1155 | last = it.current(); | 1155 | last = it.current(); |
1156 | 1156 | ||
1157 | return last; | 1157 | return last; |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | KLineEdit *KListView::renameLineEdit() const | 1160 | KLineEdit *KListView::renameLineEdit() const |
1161 | { | 1161 | { |
1162 | //US return d->editor; | 1162 | //US return d->editor; |
1163 | qDebug("KListView::renameLineEdit returns 0. Might crash"); | 1163 | qDebug("KListView::renameLineEdit returns 0. Might crash"); |
1164 | return 0; | 1164 | return 0; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | void KListView::startDrag() | 1167 | void KListView::startDrag() |
1168 | { | 1168 | { |
1169 | qDebug("KListView::startDrag drag&drop not supported yet."); | 1169 | qDebug("KListView::startDrag drag&drop not supported yet."); |
1170 | /*US | 1170 | /*US |
1171 | QDragObject *drag = dragObject(); | 1171 | QDragObject *drag = dragObject(); |
1172 | 1172 | ||
1173 | if (!drag) | 1173 | if (!drag) |
1174 | return; | 1174 | return; |
1175 | 1175 | ||
1176 | if (drag->drag() && drag->target() != viewport()) | 1176 | if (drag->drag() && drag->target() != viewport()) |
1177 | emit moved(); | 1177 | emit moved(); |
1178 | */ | 1178 | */ |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | QDragObject *KListView::dragObject() | 1181 | QDragObject *KListView::dragObject() |
1182 | { | 1182 | { |
1183 | if (!currentItem()) | 1183 | if (!currentItem()) |
1184 | return 0; | 1184 | return 0; |
1185 | 1185 | ||
1186 | return new QStoredDrag("application/x-qlistviewitem", viewport()); | 1186 | return new QStoredDrag("application/x-qlistviewitem", viewport()); |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | void KListView::setItemsMovable(bool b) | 1189 | void KListView::setItemsMovable(bool b) |
1190 | { | 1190 | { |
1191 | d->itemsMovable=b; | 1191 | d->itemsMovable=b; |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | bool KListView::itemsMovable() const | 1194 | bool KListView::itemsMovable() const |
1195 | { | 1195 | { |
1196 | return d->itemsMovable; | 1196 | return d->itemsMovable; |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | void KListView::setItemsRenameable(bool b) | 1199 | void KListView::setItemsRenameable(bool b) |
1200 | { | 1200 | { |
1201 | d->itemsRenameable=b; | 1201 | d->itemsRenameable=b; |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | bool KListView::itemsRenameable() const | 1204 | bool KListView::itemsRenameable() const |
1205 | { | 1205 | { |
1206 | return d->itemsRenameable; | 1206 | return d->itemsRenameable; |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | 1209 | ||
1210 | void KListView::setDragEnabled(bool b) | 1210 | void KListView::setDragEnabled(bool b) |
1211 | { | 1211 | { |
1212 | d->dragEnabled=b; | 1212 | d->dragEnabled=b; |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | bool KListView::dragEnabled() const | 1215 | bool KListView::dragEnabled() const |
1216 | { | 1216 | { |
1217 | return d->dragEnabled; | 1217 | return d->dragEnabled; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | void KListView::setAutoOpen(bool b) | 1220 | void KListView::setAutoOpen(bool b) |
1221 | { | 1221 | { |
1222 | d->autoOpen=b; | 1222 | d->autoOpen=b; |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | bool KListView::autoOpen() const | 1225 | bool KListView::autoOpen() const |
1226 | { | 1226 | { |
1227 | return d->autoOpen; | 1227 | return d->autoOpen; |
1228 | } | 1228 | } |
1229 | 1229 | ||
1230 | bool KListView::dropVisualizer() const | 1230 | bool KListView::dropVisualizer() const |
1231 | { | 1231 | { |
1232 | return d->dropVisualizer; | 1232 | return d->dropVisualizer; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | void KListView::setDropVisualizer(bool b) | 1235 | void KListView::setDropVisualizer(bool b) |
1236 | { | 1236 | { |
1237 | d->dropVisualizer=b; | 1237 | d->dropVisualizer=b; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | QPtrList<QListViewItem> KListView::selectedItems() const | 1240 | QPtrList<QListViewItem> KListView::selectedItems() const |
1241 | { | 1241 | { |
1242 | QPtrList<QListViewItem> list; | 1242 | QPtrList<QListViewItem> list; |
1243 | for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) | 1243 | for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) |
1244 | if (i->isSelected()) list.append(i); | 1244 | if (i->isSelected()) list.append(i); |
1245 | return list; | 1245 | return list; |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | 1248 | ||
1249 | void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) | 1249 | void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) |
1250 | { | 1250 | { |
1251 | // sanity check - don't move a item into it's own child structure | 1251 | // sanity check - don't move a item into it's own child structure |
1252 | QListViewItem *i = parent; | 1252 | QListViewItem *i = parent; |
1253 | while(i) | 1253 | while(i) |
1254 | { | 1254 | { |
1255 | if(i == item) | 1255 | if(i == item) |
1256 | return; | 1256 | return; |
1257 | i = i->parent(); | 1257 | i = i->parent(); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor | 1260 | // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor |
1261 | // in here, without ever deleting the item. | 1261 | // in here, without ever deleting the item. |
1262 | if (item->parent()) | 1262 | if (item->parent()) |
1263 | item->parent()->takeItem(item); | 1263 | item->parent()->takeItem(item); |
1264 | else | 1264 | else |
1265 | takeItem(item); | 1265 | takeItem(item); |
1266 | 1266 | ||
1267 | if (parent) | 1267 | if (parent) |
1268 | parent->insertItem(item); | 1268 | parent->insertItem(item); |
1269 | else | 1269 | else |
1270 | insertItem(item); | 1270 | insertItem(item); |
1271 | 1271 | ||
1272 | if (after) | 1272 | if (after) |
1273 | ;//item->moveToJustAfter(after); | 1273 | ;//item->moveToJustAfter(after); |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | void KListView::contentsDragEnterEvent(QDragEnterEvent *event) | 1276 | void KListView::contentsDragEnterEvent(QDragEnterEvent *event) |
1277 | { | 1277 | { |
1278 | qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); | 1278 | qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); |
1279 | /*US | 1279 | /*US |
1280 | if (acceptDrag (event)) | 1280 | if (acceptDrag (event)) |
1281 | event->accept(); | 1281 | event->accept(); |
1282 | */ | 1282 | */ |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | void KListView::setDropVisualizerWidth (int w) | 1285 | void KListView::setDropVisualizerWidth (int w) |
1286 | { | 1286 | { |
1287 | d->mDropVisualizerWidth = w > 0 ? w : 1; | 1287 | d->mDropVisualizerWidth = w > 0 ? w : 1; |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, | 1290 | QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, |
1291 | QListViewItem *after) | 1291 | QListViewItem *after) |
1292 | { | 1292 | { |
1293 | QRect insertmarker; | 1293 | QRect insertmarker; |
1294 | 1294 | ||
1295 | if (!after && !parent) | 1295 | if (!after && !parent) |
1296 | insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); | 1296 | insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); |
1297 | else | 1297 | else |
1298 | { | 1298 | { |
1299 | int level = 0; | 1299 | int level = 0; |
1300 | if (after) | 1300 | if (after) |
1301 | { | 1301 | { |
1302 | QListViewItem* it = 0L; | 1302 | QListViewItem* it = 0L; |
1303 | if (after->isOpen()) | 1303 | if (after->isOpen()) |
1304 | { | 1304 | { |
1305 | // Look for the last child (recursively) | 1305 | // Look for the last child (recursively) |
1306 | it = after->firstChild(); | 1306 | it = after->firstChild(); |
1307 | if (it) | 1307 | if (it) |
1308 | while (it->nextSibling() || it->firstChild()) | 1308 | while (it->nextSibling() || it->firstChild()) |
1309 | if ( it->nextSibling() ) | 1309 | if ( it->nextSibling() ) |
1310 | it = it->nextSibling(); | 1310 | it = it->nextSibling(); |
1311 | else | 1311 | else |
1312 | it = it->firstChild(); | 1312 | it = it->firstChild(); |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | insertmarker = itemRect (it ? it : after); | 1315 | insertmarker = itemRect (it ? it : after); |
1316 | level = after->depth(); | 1316 | level = after->depth(); |
1317 | } | 1317 | } |
1318 | else if (parent) | 1318 | else if (parent) |
1319 | { | 1319 | { |
1320 | insertmarker = itemRect (parent); | 1320 | insertmarker = itemRect (parent); |
1321 | level = parent->depth() + 1; | 1321 | level = parent->depth() + 1; |
1322 | } | 1322 | } |
1323 | insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() ); | 1323 | insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() ); |
1324 | insertmarker.setRight (viewport()->width()); | 1324 | insertmarker.setRight (viewport()->width()); |
1325 | insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); | 1325 | insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); |
1326 | insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); | 1326 | insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | // This is not used anymore, at least by KListView itself (see viewportPaintEvent) | 1329 | // This is not used anymore, at least by KListView itself (see viewportPaintEvent) |
1330 | // Remove for KDE 3.0. | 1330 | // Remove for KDE 3.0. |
1331 | if (p) | 1331 | if (p) |
1332 | p->fillRect(insertmarker, Dense4Pattern); | 1332 | p->fillRect(insertmarker, Dense4Pattern); |
1333 | 1333 | ||
1334 | return insertmarker; | 1334 | return insertmarker; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) | 1337 | QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) |
1338 | { | 1338 | { |
1339 | QRect r; | 1339 | QRect r; |
1340 | 1340 | ||
1341 | if (item) | 1341 | if (item) |
1342 | { | 1342 | { |
1343 | r = itemRect(item); | 1343 | r = itemRect(item); |
1344 | r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); | 1344 | r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); |
1345 | if (painter) { | 1345 | if (painter) { |
1346 | //US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(), | 1346 | //US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(), |
1347 | //US QStyle::Style_FocusAtBorder, colorGroup().highlight()); | 1347 | //US QStyle::Style_FocusAtBorder, colorGroup().highlight()); |
1348 | const QColor* pHighl = &(colorGroup().highlight()); | 1348 | const QColor* pHighl = &(colorGroup().highlight()); |
1349 | //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true); | 1349 | //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true); |
1350 | 1350 | ||
1351 | qDebug("KListView::drawItemHighlighter has to be verified"); | 1351 | qDebug("KListView::drawItemHighlighter has to be verified"); |
1352 | 1352 | ||
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | return r; | 1357 | return r; |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | void KListView::cleanItemHighlighter () | 1360 | void KListView::cleanItemHighlighter () |
1361 | { | 1361 | { |
1362 | if (d->mOldDropHighlighter.isValid()) | 1362 | if (d->mOldDropHighlighter.isValid()) |
1363 | { | 1363 | { |
1364 | QRect rect=d->mOldDropHighlighter; | 1364 | QRect rect=d->mOldDropHighlighter; |
1365 | d->mOldDropHighlighter = QRect(); | 1365 | d->mOldDropHighlighter = QRect(); |
1366 | viewport()->repaint(rect, true); | 1366 | viewport()->repaint(rect, true); |
1367 | } | 1367 | } |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | void KListView::rename(QListViewItem *item, int c) | 1370 | void KListView::rename(QListViewItem *item, int c) |
1371 | { | 1371 | { |
1372 | if (d->renameable.contains(c)) | 1372 | if (d->renameable.contains(c)) |
1373 | { | 1373 | { |
1374 | ensureItemVisible(item); | 1374 | ensureItemVisible(item); |
1375 | //US d->editor->load(item,c); | 1375 | //US d->editor->load(item,c); |
1376 | qDebug("KListView::rename has to be verified"); | 1376 | qDebug("KListView::rename has to be verified"); |
1377 | 1377 | ||
1378 | } | 1378 | } |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | bool KListView::isRenameable (int col) const | 1381 | bool KListView::isRenameable (int col) const |
1382 | { | 1382 | { |
1383 | return d->renameable.contains(col); | 1383 | return d->renameable.contains(col); |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | void KListView::setRenameable (int col, bool yesno) | 1386 | void KListView::setRenameable (int col, bool yesno) |
1387 | { | 1387 | { |
1388 | if (col>=header()->count()) return; | 1388 | if (col>=header()->count()) return; |
1389 | 1389 | ||
1390 | d->renameable.remove(col); | 1390 | d->renameable.remove(col); |
1391 | if (yesno && d->renameable.find(col)==d->renameable.end()) | 1391 | if (yesno && d->renameable.find(col)==d->renameable.end()) |
1392 | d->renameable+=col; | 1392 | d->renameable+=col; |
1393 | else if (!yesno && d->renameable.find(col)!=d->renameable.end()) | 1393 | else if (!yesno && d->renameable.find(col)!=d->renameable.end()) |
1394 | d->renameable.remove(col); | 1394 | d->renameable.remove(col); |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | void KListView::doneEditing(QListViewItem *item, int row) | 1397 | void KListView::doneEditing(QListViewItem *item, int row) |
1398 | { | 1398 | { |
1399 | emit itemRenamed(item, item->text(row), row); | 1399 | emit itemRenamed(item, item->text(row), row); |
1400 | emit itemRenamed(item); | 1400 | emit itemRenamed(item); |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | bool KListView::acceptDrag(QDropEvent* e) const | 1403 | bool KListView::acceptDrag(QDropEvent* e) const |
1404 | { | 1404 | { |
1405 | qDebug("KListView::acceptDrag drag&drop not supported yet"); | 1405 | qDebug("KListView::acceptDrag drag&drop not supported yet"); |
1406 | //US return acceptDrops() && itemsMovable() && (e->source()==viewport()); | 1406 | //US return acceptDrops() && itemsMovable() && (e->source()==viewport()); |
1407 | return false; | 1407 | return false; |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | void KListView::setCreateChildren(bool b) | 1410 | void KListView::setCreateChildren(bool b) |
1411 | { | 1411 | { |
1412 | d->createChildren=b; | 1412 | d->createChildren=b; |
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | bool KListView::createChildren() const | 1415 | bool KListView::createChildren() const |
1416 | { | 1416 | { |
1417 | return d->createChildren; | 1417 | return d->createChildren; |
1418 | } | 1418 | } |
1419 | 1419 | ||
1420 | 1420 | ||
1421 | int KListView::tooltipColumn() const | 1421 | int KListView::tooltipColumn() const |
1422 | { | 1422 | { |
1423 | return d->tooltipColumn; | 1423 | return d->tooltipColumn; |
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | void KListView::setTooltipColumn(int column) | 1426 | void KListView::setTooltipColumn(int column) |
1427 | { | 1427 | { |
1428 | d->tooltipColumn=column; | 1428 | d->tooltipColumn=column; |
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | void KListView::setDropHighlighter(bool b) | 1431 | void KListView::setDropHighlighter(bool b) |
1432 | { | 1432 | { |
1433 | d->dropHighlighter=b; | 1433 | d->dropHighlighter=b; |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | bool KListView::dropHighlighter() const | 1436 | bool KListView::dropHighlighter() const |
1437 | { | 1437 | { |
1438 | return d->dropHighlighter; | 1438 | return d->dropHighlighter; |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const | 1441 | bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const |
1442 | { | 1442 | { |
1443 | return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); | 1443 | return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | QString KListView::tooltip(QListViewItem *item, int column) const | 1446 | QString KListView::tooltip(QListViewItem *item, int column) const |
1447 | { | 1447 | { |
1448 | return item->text(column); | 1448 | return item->text(column); |
1449 | } | 1449 | } |
1450 | 1450 | ||
1451 | void KListView::setTabOrderedRenaming(bool b) | 1451 | void KListView::setTabOrderedRenaming(bool b) |
1452 | { | 1452 | { |
1453 | d->tabRename = b; | 1453 | d->tabRename = b; |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | bool KListView::tabOrderedRenaming() const | 1456 | bool KListView::tabOrderedRenaming() const |
1457 | { | 1457 | { |
1458 | return d->tabRename; | 1458 | return d->tabRename; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | void KListView::keyPressEvent (QKeyEvent* e) | 1461 | void KListView::keyPressEvent (QKeyEvent* e) |
1462 | { | 1462 | { |
1463 | //don't we need a contextMenuModifier too ? (aleXXX) | 1463 | //don't we need a contextMenuModifier too ? (aleXXX) |
1464 | if (e->key() == d->contextMenuKey) | 1464 | if (e->key() == d->contextMenuKey) |
1465 | { | 1465 | { |
1466 | emit menuShortCutPressed (this, currentItem()); | 1466 | emit menuShortCutPressed (this, currentItem()); |
1467 | return; | 1467 | return; |
1468 | } | 1468 | } |
1469 | if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) | 1469 | if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) |
1470 | { | 1470 | { |
1471 | emit signalDelete ( ); | 1471 | emit signalDelete ( ); |
1472 | return; | 1472 | return; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | if (d->selectionMode != FileManager) | 1475 | if (d->selectionMode != FileManager) |
1476 | QListView::keyPressEvent (e); | 1476 | QListView::keyPressEvent (e); |
1477 | else | 1477 | else |
1478 | fileManagerKeyPressEvent (e); | 1478 | fileManagerKeyPressEvent (e); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | void KListView::activateAutomaticSelection() | 1481 | void KListView::activateAutomaticSelection() |
1482 | { | 1482 | { |
1483 | d->selectedBySimpleMove=true; | 1483 | d->selectedBySimpleMove=true; |
1484 | d->selectedUsingMouse=false; | 1484 | d->selectedUsingMouse=false; |
1485 | if (currentItem()!=0) | 1485 | if (currentItem()!=0) |
1486 | { | 1486 | { |
1487 | selectAll(false); | 1487 | selectAll(false); |
1488 | currentItem()->setSelected(true); | 1488 | currentItem()->setSelected(true); |
1489 | currentItem()->repaint(); | 1489 | currentItem()->repaint(); |
1490 | emit selectionChanged(); | 1490 | emit selectionChanged(); |
1491 | }; | 1491 | }; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | void KListView::deactivateAutomaticSelection() | 1494 | void KListView::deactivateAutomaticSelection() |
1495 | { | 1495 | { |
1496 | d->selectedBySimpleMove=false; | 1496 | d->selectedBySimpleMove=false; |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | bool KListView::automaticSelection() const | 1499 | bool KListView::automaticSelection() const |
1500 | { | 1500 | { |
1501 | return d->selectedBySimpleMove; | 1501 | return d->selectedBySimpleMove; |
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | 1504 | void KListView::fileManagerKeyPressEvent (QKeyEvent* e) |
1505 | { | 1505 | { |
1506 | //don't care whether it's on the keypad or not | 1506 | //don't care whether it's on the keypad or not |
1507 | int e_state=(e->state() & ~Keypad); | 1507 | int e_state=(e->state() & ~Keypad); |
1508 | 1508 | ||
1509 | int oldSelectionDirection(d->selectionDirection); | 1509 | int oldSelectionDirection(d->selectionDirection); |
1510 | 1510 | ||
1511 | if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1511 | if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) |
1512 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) | 1512 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) |
1513 | { | 1513 | { |
1514 | if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) | 1514 | if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) |
1515 | selectAll(FALSE); | 1515 | selectAll(FALSE); |
1516 | d->selectionDirection=0; | 1516 | d->selectionDirection=0; |
1517 | d->wasShiftEvent = (e_state == ShiftButton); | 1517 | d->wasShiftEvent = (e_state == ShiftButton); |
1518 | }; | 1518 | }; |
1519 | 1519 | ||
1520 | //d->wasShiftEvent = (e_state == ShiftButton); | 1520 | //d->wasShiftEvent = (e_state == ShiftButton); |
1521 | 1521 | ||
1522 | 1522 | ||
1523 | QListViewItem* item = currentItem(); | 1523 | QListViewItem* item = currentItem(); |
1524 | if (item==0) return; | 1524 | if (item==0) return; |
1525 | 1525 | ||
1526 | QListViewItem* repaintItem1 = item; | 1526 | QListViewItem* repaintItem1 = item; |
1527 | QListViewItem* repaintItem2 = 0L; | 1527 | QListViewItem* repaintItem2 = 0L; |
1528 | QListViewItem* visItem = 0L; | 1528 | QListViewItem* visItem = 0L; |
1529 | 1529 | ||
1530 | QListViewItem* nextItem = 0L; | 1530 | QListViewItem* nextItem = 0L; |
1531 | int items = 0; | 1531 | int items = 0; |
1532 | 1532 | ||
1533 | bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); | 1533 | bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); |
1534 | int selectedItems(0); | 1534 | int selectedItems(0); |
1535 | for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) | 1535 | for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) |
1536 | if (tmpItem->isSelected()) selectedItems++; | 1536 | if (tmpItem->isSelected()) selectedItems++; |
1537 | 1537 | ||
1538 | if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) | 1538 | if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) |
1539 | && (e_state==NoButton) | 1539 | && (e_state==NoButton) |
1540 | && ((e->key()==Key_Down) | 1540 | && ((e->key()==Key_Down) |
1541 | || (e->key()==Key_Up) | 1541 | || (e->key()==Key_Up) |
1542 | || (e->key()==Key_Next) | 1542 | || (e->key()==Key_Next) |
1543 | || (e->key()==Key_Prior) | 1543 | || (e->key()==Key_Prior) |
1544 | || (e->key()==Key_Home) | 1544 | || (e->key()==Key_Home) |
1545 | || (e->key()==Key_End))) | 1545 | || (e->key()==Key_End))) |
1546 | { | 1546 | { |
1547 | d->selectedBySimpleMove=true; | 1547 | d->selectedBySimpleMove=true; |
1548 | d->selectedUsingMouse=false; | 1548 | d->selectedUsingMouse=false; |
1549 | } | 1549 | } |
1550 | else if (selectedItems>1) | 1550 | else if (selectedItems>1) |
1551 | d->selectedBySimpleMove=false; | 1551 | d->selectedBySimpleMove=false; |
1552 | 1552 | ||
1553 | bool emitSelectionChanged(false); | 1553 | bool emitSelectionChanged(false); |
1554 | 1554 | ||
1555 | switch (e->key()) | 1555 | switch (e->key()) |
1556 | { | 1556 | { |
1557 | case Key_Escape: | 1557 | case Key_Escape: |
1558 | selectAll(FALSE); | 1558 | selectAll(FALSE); |
1559 | emitSelectionChanged=TRUE; | 1559 | emitSelectionChanged=TRUE; |
1560 | break; | 1560 | break; |
1561 | 1561 | ||
1562 | case Key_Space: | 1562 | case Key_Space: |
1563 | //toggle selection of current item | 1563 | //toggle selection of current item |
1564 | if (d->selectedBySimpleMove) | 1564 | if (d->selectedBySimpleMove) |
1565 | d->selectedBySimpleMove=false; | 1565 | d->selectedBySimpleMove=false; |
1566 | item->setSelected(!item->isSelected()); | 1566 | item->setSelected(!item->isSelected()); |
1567 | emitSelectionChanged=TRUE; | 1567 | emitSelectionChanged=TRUE; |
1568 | break; | 1568 | break; |
1569 | 1569 | ||
1570 | case Key_Insert: | 1570 | case Key_Insert: |
1571 | //toggle selection of current item and move to the next item | 1571 | //toggle selection of current item and move to the next item |
1572 | if (d->selectedBySimpleMove) | 1572 | if (d->selectedBySimpleMove) |
1573 | { | 1573 | { |
1574 | d->selectedBySimpleMove=false; | 1574 | d->selectedBySimpleMove=false; |
1575 | if (!item->isSelected()) item->setSelected(TRUE); | 1575 | if (!item->isSelected()) item->setSelected(TRUE); |
1576 | } | 1576 | } |
1577 | else | 1577 | else |
1578 | { | 1578 | { |
1579 | item->setSelected(!item->isSelected()); | 1579 | item->setSelected(!item->isSelected()); |
1580 | }; | 1580 | }; |
1581 | 1581 | ||
1582 | nextItem=item->itemBelow(); | 1582 | nextItem=item->itemBelow(); |
1583 | 1583 | ||
1584 | if (nextItem!=0) | 1584 | if (nextItem!=0) |
1585 | { | 1585 | { |
1586 | repaintItem2=nextItem; | 1586 | repaintItem2=nextItem; |
1587 | visItem=nextItem; | 1587 | visItem=nextItem; |
1588 | setCurrentItem(nextItem); | 1588 | setCurrentItem(nextItem); |
1589 | }; | 1589 | }; |
1590 | d->selectionDirection=1; | 1590 | d->selectionDirection=1; |
1591 | emitSelectionChanged=TRUE; | 1591 | emitSelectionChanged=TRUE; |
1592 | break; | 1592 | break; |
1593 | 1593 | ||
1594 | case Key_Down: | 1594 | case Key_Down: |
1595 | nextItem=item->itemBelow(); | 1595 | nextItem=item->itemBelow(); |
1596 | //toggle selection of current item and move to the next item | 1596 | //toggle selection of current item and move to the next item |
1597 | if (shiftOrCtrl) | 1597 | if (shiftOrCtrl) |
1598 | { | 1598 | { |
1599 | d->selectionDirection=1; | 1599 | d->selectionDirection=1; |
1600 | if (d->selectedBySimpleMove) | 1600 | if (d->selectedBySimpleMove) |
1601 | d->selectedBySimpleMove=false; | 1601 | d->selectedBySimpleMove=false; |
1602 | else | 1602 | else |
1603 | { | 1603 | { |
1604 | if (oldSelectionDirection!=-1) | 1604 | if (oldSelectionDirection!=-1) |
1605 | { | 1605 | { |
1606 | item->setSelected(!item->isSelected()); | 1606 | item->setSelected(!item->isSelected()); |
1607 | emitSelectionChanged=TRUE; | 1607 | emitSelectionChanged=TRUE; |
1608 | }; | 1608 | }; |
1609 | }; | 1609 | }; |
1610 | } | 1610 | } |
1611 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) | 1611 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) |
1612 | { | 1612 | { |
1613 | item->setSelected(false); | 1613 | item->setSelected(false); |
1614 | emitSelectionChanged=TRUE; | 1614 | emitSelectionChanged=TRUE; |
1615 | }; | 1615 | }; |
1616 | 1616 | ||
1617 | if (nextItem!=0) | 1617 | if (nextItem!=0) |
1618 | { | 1618 | { |
1619 | if (d->selectedBySimpleMove) | 1619 | if (d->selectedBySimpleMove) |
1620 | nextItem->setSelected(true); | 1620 | nextItem->setSelected(true); |
1621 | repaintItem2=nextItem; | 1621 | repaintItem2=nextItem; |
1622 | visItem=nextItem; | 1622 | visItem=nextItem; |
1623 | setCurrentItem(nextItem); | 1623 | setCurrentItem(nextItem); |
1624 | }; | 1624 | }; |
1625 | break; | 1625 | break; |
1626 | 1626 | ||
1627 | case Key_Up: | 1627 | case Key_Up: |
1628 | nextItem=item->itemAbove(); | 1628 | nextItem=item->itemAbove(); |
1629 | d->selectionDirection=-1; | 1629 | d->selectionDirection=-1; |
1630 | //move to the prev. item and toggle selection of this one | 1630 | //move to the prev. item and toggle selection of this one |
1631 | // => No, can't select the last item, with this. For symmetry, let's | 1631 | // => No, can't select the last item, with this. For symmetry, let's |
1632 | // toggle selection and THEN move up, just like we do in down (David) | 1632 | // toggle selection and THEN move up, just like we do in down (David) |
1633 | if (shiftOrCtrl) | 1633 | if (shiftOrCtrl) |
1634 | { | 1634 | { |
1635 | if (d->selectedBySimpleMove) | 1635 | if (d->selectedBySimpleMove) |
1636 | d->selectedBySimpleMove=false; | 1636 | d->selectedBySimpleMove=false; |
1637 | else | 1637 | else |
1638 | { | 1638 | { |
1639 | if (oldSelectionDirection!=1) | 1639 | if (oldSelectionDirection!=1) |
1640 | { | 1640 | { |
1641 | item->setSelected(!item->isSelected()); | 1641 | item->setSelected(!item->isSelected()); |
1642 | emitSelectionChanged=TRUE; | 1642 | emitSelectionChanged=TRUE; |
1643 | }; | 1643 | }; |
1644 | } | 1644 | } |
1645 | } | 1645 | } |
1646 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) | 1646 | else if ((d->selectedBySimpleMove) && (nextItem!=0)) |
1647 | { | 1647 | { |
1648 | item->setSelected(false); | 1648 | item->setSelected(false); |
1649 | emitSelectionChanged=TRUE; | 1649 | emitSelectionChanged=TRUE; |
1650 | }; | 1650 | }; |
1651 | 1651 | ||
1652 | if (nextItem!=0) | 1652 | if (nextItem!=0) |
1653 | { | 1653 | { |
1654 | if (d->selectedBySimpleMove) | 1654 | if (d->selectedBySimpleMove) |
1655 | nextItem->setSelected(true); | 1655 | nextItem->setSelected(true); |
1656 | repaintItem2=nextItem; | 1656 | repaintItem2=nextItem; |
1657 | visItem=nextItem; | 1657 | visItem=nextItem; |
1658 | setCurrentItem(nextItem); | 1658 | setCurrentItem(nextItem); |
1659 | }; | 1659 | }; |
1660 | break; | 1660 | break; |
1661 | 1661 | ||
1662 | case Key_End: | 1662 | case Key_End: |
1663 | //move to the last item and toggle selection of all items inbetween | 1663 | //move to the last item and toggle selection of all items inbetween |
1664 | nextItem=item; | 1664 | nextItem=item; |
1665 | if (d->selectedBySimpleMove) | 1665 | if (d->selectedBySimpleMove) |
1666 | item->setSelected(false); | 1666 | item->setSelected(false); |
1667 | if (shiftOrCtrl) | 1667 | if (shiftOrCtrl) |
1668 | d->selectedBySimpleMove=false; | 1668 | d->selectedBySimpleMove=false; |
1669 | 1669 | ||
1670 | while(nextItem!=0) | 1670 | while(nextItem!=0) |
1671 | { | 1671 | { |
1672 | if (shiftOrCtrl) | 1672 | if (shiftOrCtrl) |
1673 | nextItem->setSelected(!nextItem->isSelected()); | 1673 | nextItem->setSelected(!nextItem->isSelected()); |
1674 | if (nextItem->itemBelow()==0) | 1674 | if (nextItem->itemBelow()==0) |
1675 | { | 1675 | { |
1676 | if (d->selectedBySimpleMove) | 1676 | if (d->selectedBySimpleMove) |
1677 | nextItem->setSelected(true); | 1677 | nextItem->setSelected(true); |
1678 | repaintItem2=nextItem; | 1678 | repaintItem2=nextItem; |
1679 | visItem=nextItem; | 1679 | visItem=nextItem; |
1680 | setCurrentItem(nextItem); | 1680 | setCurrentItem(nextItem); |
1681 | } | 1681 | } |
1682 | nextItem=nextItem->itemBelow(); | 1682 | nextItem=nextItem->itemBelow(); |
1683 | } | 1683 | } |
1684 | emitSelectionChanged=TRUE; | 1684 | emitSelectionChanged=TRUE; |
1685 | break; | 1685 | break; |
1686 | 1686 | ||
1687 | case Key_Home: | 1687 | case Key_Home: |
1688 | // move to the first item and toggle selection of all items inbetween | 1688 | // move to the first item and toggle selection of all items inbetween |
1689 | nextItem = firstChild(); | 1689 | nextItem = firstChild(); |
1690 | visItem = nextItem; | 1690 | visItem = nextItem; |
1691 | repaintItem2 = visItem; | 1691 | repaintItem2 = visItem; |
1692 | if (d->selectedBySimpleMove) | 1692 | if (d->selectedBySimpleMove) |
1693 | item->setSelected(false); | 1693 | item->setSelected(false); |
1694 | if (shiftOrCtrl) | 1694 | if (shiftOrCtrl) |
1695 | { | 1695 | { |
1696 | d->selectedBySimpleMove=false; | 1696 | d->selectedBySimpleMove=false; |
1697 | 1697 | ||
1698 | while ( nextItem != item ) | 1698 | while ( nextItem != item ) |
1699 | { | 1699 | { |
1700 | nextItem->setSelected( !nextItem->isSelected() ); | 1700 | nextItem->setSelected( !nextItem->isSelected() ); |
1701 | nextItem = nextItem->itemBelow(); | 1701 | nextItem = nextItem->itemBelow(); |
1702 | } | 1702 | } |
1703 | item->setSelected( !item->isSelected() ); | 1703 | item->setSelected( !item->isSelected() ); |
1704 | } | 1704 | } |
1705 | setCurrentItem( firstChild() ); | 1705 | setCurrentItem( firstChild() ); |
1706 | emitSelectionChanged=TRUE; | 1706 | emitSelectionChanged=TRUE; |
1707 | break; | 1707 | break; |
1708 | 1708 | ||
1709 | case Key_Next: | 1709 | case Key_Next: |
1710 | items=visibleHeight()/item->height(); | 1710 | items=visibleHeight()/item->height(); |
1711 | nextItem=item; | 1711 | nextItem=item; |
1712 | if (d->selectedBySimpleMove) | 1712 | if (d->selectedBySimpleMove) |
1713 | item->setSelected(false); | 1713 | item->setSelected(false); |
1714 | if (shiftOrCtrl) | 1714 | if (shiftOrCtrl) |
1715 | { | 1715 | { |
1716 | d->selectedBySimpleMove=false; | 1716 | d->selectedBySimpleMove=false; |
1717 | d->selectionDirection=1; | 1717 | d->selectionDirection=1; |
1718 | }; | 1718 | }; |
1719 | 1719 | ||
1720 | for (int i=0; i<items; i++) | 1720 | for (int i=0; i<items; i++) |
1721 | { | 1721 | { |
1722 | if (shiftOrCtrl) | 1722 | if (shiftOrCtrl) |
1723 | nextItem->setSelected(!nextItem->isSelected()); | 1723 | nextItem->setSelected(!nextItem->isSelected()); |
1724 | //the end | 1724 | //the end |
1725 | if ((i==items-1) || (nextItem->itemBelow()==0)) | 1725 | if ((i==items-1) || (nextItem->itemBelow()==0)) |
1726 | 1726 | ||
1727 | { | 1727 | { |
1728 | if (shiftOrCtrl) | 1728 | if (shiftOrCtrl) |
1729 | nextItem->setSelected(!nextItem->isSelected()); | 1729 | nextItem->setSelected(!nextItem->isSelected()); |
1730 | if (d->selectedBySimpleMove) | 1730 | if (d->selectedBySimpleMove) |
1731 | nextItem->setSelected(true); | 1731 | nextItem->setSelected(true); |
1732 | ensureItemVisible(nextItem); | 1732 | ensureItemVisible(nextItem); |
1733 | setCurrentItem(nextItem); | 1733 | setCurrentItem(nextItem); |
1734 | update(); | 1734 | update(); |
1735 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1735 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1736 | { | 1736 | { |
1737 | emit selectionChanged(); | 1737 | emit selectionChanged(); |
1738 | } | 1738 | } |
1739 | return; | 1739 | return; |
1740 | } | 1740 | } |
1741 | nextItem=nextItem->itemBelow(); | 1741 | nextItem=nextItem->itemBelow(); |
1742 | } | 1742 | } |
1743 | break; | 1743 | break; |
1744 | 1744 | ||
1745 | case Key_Prior: | 1745 | case Key_Prior: |
1746 | items=visibleHeight()/item->height(); | 1746 | items=visibleHeight()/item->height(); |
1747 | nextItem=item; | 1747 | nextItem=item; |
1748 | if (d->selectedBySimpleMove) | 1748 | if (d->selectedBySimpleMove) |
1749 | item->setSelected(false); | 1749 | item->setSelected(false); |
1750 | if (shiftOrCtrl) | 1750 | if (shiftOrCtrl) |
1751 | { | 1751 | { |
1752 | d->selectionDirection=-1; | 1752 | d->selectionDirection=-1; |
1753 | d->selectedBySimpleMove=false; | 1753 | d->selectedBySimpleMove=false; |
1754 | }; | 1754 | }; |
1755 | 1755 | ||
1756 | for (int i=0; i<items; i++) | 1756 | for (int i=0; i<items; i++) |
1757 | { | 1757 | { |
1758 | if ((nextItem!=item) &&(shiftOrCtrl)) | 1758 | if ((nextItem!=item) &&(shiftOrCtrl)) |
1759 | nextItem->setSelected(!nextItem->isSelected()); | 1759 | nextItem->setSelected(!nextItem->isSelected()); |
1760 | //the end | 1760 | //the end |
1761 | if ((i==items-1) || (nextItem->itemAbove()==0)) | 1761 | if ((i==items-1) || (nextItem->itemAbove()==0)) |
1762 | 1762 | ||
1763 | { | 1763 | { |
1764 | if (d->selectedBySimpleMove) | 1764 | if (d->selectedBySimpleMove) |
1765 | nextItem->setSelected(true); | 1765 | nextItem->setSelected(true); |
1766 | ensureItemVisible(nextItem); | 1766 | ensureItemVisible(nextItem); |
1767 | setCurrentItem(nextItem); | 1767 | setCurrentItem(nextItem); |
1768 | update(); | 1768 | update(); |
1769 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1769 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1770 | { | 1770 | { |
1771 | emit selectionChanged(); | 1771 | emit selectionChanged(); |
1772 | } | 1772 | } |
1773 | return; | 1773 | return; |
1774 | } | 1774 | } |
1775 | nextItem=nextItem->itemAbove(); | 1775 | nextItem=nextItem->itemAbove(); |
1776 | } | 1776 | } |
1777 | break; | 1777 | break; |
1778 | 1778 | ||
1779 | case Key_Minus: | 1779 | case Key_Minus: |
1780 | if ( item->isOpen() ) | 1780 | if ( item->isOpen() ) |
1781 | setOpen( item, FALSE ); | 1781 | setOpen( item, FALSE ); |
1782 | break; | 1782 | break; |
1783 | case Key_Plus: | 1783 | case Key_Plus: |
1784 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) | 1784 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) |
1785 | setOpen( item, TRUE ); | 1785 | setOpen( item, TRUE ); |
1786 | break; | 1786 | break; |
1787 | default: | 1787 | default: |
1788 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1788 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) |
1789 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); | 1789 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); |
1790 | 1790 | ||
1791 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); | 1791 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); |
1792 | if (realKey && selectCurrentItem) | 1792 | if (realKey && selectCurrentItem) |
1793 | item->setSelected(false); | 1793 | item->setSelected(false); |
1794 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) | 1794 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) |
1795 | QListView::SelectionMode oldSelectionMode = selectionMode(); | 1795 | QListView::SelectionMode oldSelectionMode = selectionMode(); |
1796 | setSelectionMode (QListView::Multi); | 1796 | setSelectionMode (QListView::Multi); |
1797 | QListView::keyPressEvent (e); | 1797 | QListView::keyPressEvent (e); |
1798 | setSelectionMode (oldSelectionMode); | 1798 | setSelectionMode (oldSelectionMode); |
1799 | if (realKey && selectCurrentItem) | 1799 | if (realKey && selectCurrentItem) |
1800 | { | 1800 | { |
1801 | currentItem()->setSelected(true); | 1801 | currentItem()->setSelected(true); |
1802 | emitSelectionChanged=TRUE; | 1802 | emitSelectionChanged=TRUE; |
1803 | } | 1803 | } |
1804 | repaintItem2=currentItem(); | 1804 | repaintItem2=currentItem(); |
1805 | if (realKey) | 1805 | if (realKey) |
1806 | visItem=currentItem(); | 1806 | visItem=currentItem(); |
1807 | break; | 1807 | break; |
1808 | } | 1808 | } |
1809 | 1809 | ||
1810 | if (visItem) | 1810 | if (visItem) |
1811 | ensureItemVisible(visItem); | 1811 | ensureItemVisible(visItem); |
1812 | 1812 | ||
1813 | QRect ir; | 1813 | QRect ir; |
1814 | if (repaintItem1) | 1814 | if (repaintItem1) |
1815 | ir = ir.unite( itemRect(repaintItem1) ); | 1815 | ir = ir.unite( itemRect(repaintItem1) ); |
1816 | if (repaintItem2) | 1816 | if (repaintItem2) |
1817 | ir = ir.unite( itemRect(repaintItem2) ); | 1817 | ir = ir.unite( itemRect(repaintItem2) ); |
1818 | 1818 | ||
1819 | if ( !ir.isEmpty() ) | 1819 | if ( !ir.isEmpty() ) |
1820 | { // rectangle to be repainted | 1820 | { // rectangle to be repainted |
1821 | if ( ir.x() < 0 ) | 1821 | if ( ir.x() < 0 ) |
1822 | ir.moveBy( -ir.x(), 0 ); | 1822 | ir.moveBy( -ir.x(), 0 ); |
1823 | viewport()->repaint( ir, FALSE ); | 1823 | viewport()->repaint( ir, FALSE ); |
1824 | } | 1824 | } |
1825 | /*if (repaintItem1) | 1825 | /*if (repaintItem1) |
1826 | repaintItem1->repaint(); | 1826 | repaintItem1->repaint(); |
1827 | if (repaintItem2) | 1827 | if (repaintItem2) |
1828 | repaintItem2->repaint();*/ | 1828 | repaintItem2->repaint();*/ |
1829 | update(); | 1829 | update(); |
1830 | if (emitSelectionChanged) | 1830 | if (emitSelectionChanged) |
1831 | emit selectionChanged(); | 1831 | emit selectionChanged(); |
1832 | } | 1832 | } |
1833 | 1833 | ||
1834 | void KListView::setSelectionModeExt (SelectionModeExt mode) | 1834 | void KListView::setSelectionModeExt (SelectionModeExt mode) |
1835 | { | 1835 | { |
1836 | d->selectionMode = mode; | 1836 | d->selectionMode = mode; |
1837 | 1837 | ||
1838 | switch (mode) | 1838 | switch (mode) |
1839 | { | 1839 | { |
1840 | case Single: | 1840 | case Single: |
1841 | case Multi: | 1841 | case Multi: |
1842 | case Extended: | 1842 | case Extended: |
1843 | case NoSelection: | 1843 | case NoSelection: |
1844 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); | 1844 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); |
1845 | break; | 1845 | break; |
1846 | 1846 | ||
1847 | case FileManager: | 1847 | case FileManager: |
1848 | setSelectionMode (QListView::Extended); | 1848 | setSelectionMode (QListView::Extended); |
1849 | break; | 1849 | break; |
1850 | 1850 | ||
1851 | default: | 1851 | default: |
1852 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; | 1852 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; |
1853 | break; | 1853 | break; |
1854 | } | 1854 | } |
1855 | } | 1855 | } |
1856 | 1856 | ||
1857 | KListView::SelectionModeExt KListView::selectionModeExt () const | 1857 | KListView::SelectionModeExt KListView::selectionModeExt () const |
1858 | { | 1858 | { |
1859 | return d->selectionMode; | 1859 | return d->selectionMode; |
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | int KListView::itemIndex( const QListViewItem *item ) const | 1862 | int KListView::itemIndex( const QListViewItem *item ) const |
1863 | { | 1863 | { |
1864 | if ( !item ) | 1864 | if ( !item ) |
1865 | return -1; | 1865 | return -1; |
1866 | 1866 | ||
1867 | if ( item == firstChild() ) | 1867 | if ( item == firstChild() ) |
1868 | return 0; | 1868 | return 0; |
1869 | else { | 1869 | else { |
1870 | QListViewItemIterator it(firstChild()); | 1870 | QListViewItemIterator it(firstChild()); |
1871 | uint j = 0; | 1871 | uint j = 0; |
1872 | for (; it.current() && it.current() != item; ++it, ++j ); | 1872 | for (; it.current() && it.current() != item; ++it, ++j ); |
1873 | 1873 | ||
1874 | if( !it.current() ) | 1874 | if( !it.current() ) |
1875 | return -1; | 1875 | return -1; |
1876 | 1876 | ||
1877 | return j; | 1877 | return j; |
1878 | } | 1878 | } |
1879 | } | 1879 | } |
1880 | 1880 | ||
1881 | QListViewItem* KListView::itemAtIndex(int index) | 1881 | QListViewItem* KListView::itemAtIndex(int index) |
1882 | { | 1882 | { |
1883 | if (index<0) | 1883 | if (index<0) |
1884 | return 0; | 1884 | return 0; |
1885 | 1885 | ||
1886 | int j(0); | 1886 | int j(0); |
1887 | for (QListViewItemIterator it=firstChild(); it.current(); it++) | 1887 | for (QListViewItemIterator it=firstChild(); it.current(); it++) |
1888 | { | 1888 | { |
1889 | if (j==index) | 1889 | if (j==index) |
1890 | return it.current(); | 1890 | return it.current(); |
1891 | j++; | 1891 | j++; |
1892 | }; | 1892 | }; |
1893 | return 0; | 1893 | return 0; |
1894 | } | 1894 | } |
1895 | 1895 | ||
1896 | 1896 | ||
1897 | void KListView::emitContextMenu (KListView*, QListViewItem* i) | 1897 | void KListView::emitContextMenu (KListView*, QListViewItem* i) |
1898 | { | 1898 | { |
1899 | QPoint p; | 1899 | QPoint p; |
1900 | // qDebug("KListView::emitContextMenu "); | 1900 | // qDebug("KListView::emitContextMenu "); |
1901 | 1901 | ||
1902 | if (i) | 1902 | if (i) |
1903 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1903 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1904 | else | 1904 | else |
1905 | p = mapToGlobal(rect().center()); | 1905 | p = mapToGlobal(rect().center()); |
1906 | 1906 | ||
1907 | emit contextMenu (this, i, p); | 1907 | emit contextMenu (this, i, p); |
1908 | } | 1908 | } |
1909 | 1909 | ||
1910 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) | 1910 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) |
1911 | { | 1911 | { |
1912 | // qDebug("KListView::emitContextMenu col"); | 1912 | QListViewItem* item = i; |
1913 | emit contextRequest( i, p, col ); | 1913 | int c = col; |
1914 | emit contextMenu (this, i, p); | 1914 | // do not trust the values for QListViewItem* i and int col; |
1915 | // qDebug("KListView::emitContextMenu col"); | ||
1916 | if ( col == -1 ) { | ||
1917 | QPoint pp = viewport()->mapFromGlobal(p); | ||
1918 | item = itemAt( pp); | ||
1919 | c = header()->sectionAt(pp.x() ); | ||
1920 | } | ||
1921 | emit contextRequest( item, p, c ); | ||
1922 | emit contextMenu (this, item, p); | ||
1915 | } | 1923 | } |
1916 | 1924 | ||
1917 | void KListView::setAcceptDrops (bool val) | 1925 | void KListView::setAcceptDrops (bool val) |
1918 | { | 1926 | { |
1919 | QListView::setAcceptDrops (val); | 1927 | QListView::setAcceptDrops (val); |
1920 | viewport()->setAcceptDrops (val); | 1928 | viewport()->setAcceptDrops (val); |
1921 | } | 1929 | } |
1922 | 1930 | ||
1923 | int KListView::dropVisualizerWidth () const | 1931 | int KListView::dropVisualizerWidth () const |
1924 | { | 1932 | { |
1925 | return d->mDropVisualizerWidth; | 1933 | return d->mDropVisualizerWidth; |
1926 | } | 1934 | } |
1927 | 1935 | ||
1928 | 1936 | ||
1929 | void KListView::viewportPaintEvent(QPaintEvent *e) | 1937 | void KListView::viewportPaintEvent(QPaintEvent *e) |
1930 | { | 1938 | { |
1931 | QListView::viewportPaintEvent(e); | 1939 | QListView::viewportPaintEvent(e); |
1932 | 1940 | ||
1933 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) | 1941 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) |
1934 | { | 1942 | { |
1935 | QPainter painter(viewport()); | 1943 | QPainter painter(viewport()); |
1936 | 1944 | ||
1937 | // This is where we actually draw the drop-visualizer | 1945 | // This is where we actually draw the drop-visualizer |
1938 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); | 1946 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); |
1939 | } | 1947 | } |
1940 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) | 1948 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) |
1941 | { | 1949 | { |
1942 | QPainter painter(viewport()); | 1950 | QPainter painter(viewport()); |
1943 | 1951 | ||
1944 | qDebug("KListView::viewportPaintEvent has to be verified"); | 1952 | qDebug("KListView::viewportPaintEvent has to be verified"); |
1945 | 1953 | ||
1946 | // This is where we actually draw the drop-highlighter | 1954 | // This is where we actually draw the drop-highlighter |
1947 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), | 1955 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), |
1948 | //US QStyle::Style_FocusAtBorder); | 1956 | //US QStyle::Style_FocusAtBorder); |
1949 | 1957 | ||
1950 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); | 1958 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); |
1951 | 1959 | ||
1952 | 1960 | ||
1953 | } | 1961 | } |
1954 | } | 1962 | } |
1955 | 1963 | ||
1956 | void KListView::setFullWidth() | 1964 | void KListView::setFullWidth() |
1957 | { | 1965 | { |
1958 | setFullWidth(true); | 1966 | setFullWidth(true); |
1959 | } | 1967 | } |
1960 | 1968 | ||
1961 | void KListView::setFullWidth(bool fullWidth) | 1969 | void KListView::setFullWidth(bool fullWidth) |
1962 | { | 1970 | { |
1963 | d->fullWidth = fullWidth; | 1971 | d->fullWidth = fullWidth; |
1964 | //US header()->setStretchEnabled(fullWidth, columns()-1); | 1972 | //US header()->setStretchEnabled(fullWidth, columns()-1); |
1965 | } | 1973 | } |
1966 | 1974 | ||
1967 | bool KListView::fullWidth() const | 1975 | bool KListView::fullWidth() const |
1968 | { | 1976 | { |
1969 | return d->fullWidth; | 1977 | return d->fullWidth; |
1970 | } | 1978 | } |
1971 | 1979 | ||
1972 | int KListView::addColumn(const QString& label, int width) | 1980 | int KListView::addColumn(const QString& label, int width) |
1973 | { | 1981 | { |
1974 | int result = QListView::addColumn(label, width); | 1982 | int result = QListView::addColumn(label, width); |
1975 | if (d->fullWidth) { | 1983 | if (d->fullWidth) { |
1976 | //US header()->setStretchEnabled(false, columns()-2); | 1984 | //US header()->setStretchEnabled(false, columns()-2); |
1977 | //US header()->setStretchEnabled(true, columns()-1); | 1985 | //US header()->setStretchEnabled(true, columns()-1); |
1978 | } | 1986 | } |
1979 | return result; | 1987 | return result; |
1980 | } | 1988 | } |
1981 | 1989 | ||
1982 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) | 1990 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) |
1983 | { | 1991 | { |
1984 | int result = QListView::addColumn(iconset, label, width); | 1992 | int result = QListView::addColumn(iconset, label, width); |
1985 | if (d->fullWidth) { | 1993 | if (d->fullWidth) { |
1986 | //US header()->setStretchEnabled(false, columns()-2); | 1994 | //US header()->setStretchEnabled(false, columns()-2); |
1987 | //US header()->setStretchEnabled(true, columns()-1); | 1995 | //US header()->setStretchEnabled(true, columns()-1); |
1988 | } | 1996 | } |
1989 | return result; | 1997 | return result; |
1990 | } | 1998 | } |
1991 | 1999 | ||
1992 | void KListView::removeColumn(int index) | 2000 | void KListView::removeColumn(int index) |
1993 | { | 2001 | { |
1994 | QListView::removeColumn(index); | 2002 | QListView::removeColumn(index); |
1995 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); | 2003 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); |
1996 | } | 2004 | } |
1997 | 2005 | ||
1998 | void KListView::viewportResizeEvent(QResizeEvent* e) | 2006 | void KListView::viewportResizeEvent(QResizeEvent* e) |
1999 | { | 2007 | { |
2000 | QListView::viewportResizeEvent(e); | 2008 | QListView::viewportResizeEvent(e); |
2001 | } | 2009 | } |
2002 | 2010 | ||
2003 | const QColor &KListView::alternateBackground() const | 2011 | const QColor &KListView::alternateBackground() const |
2004 | { | 2012 | { |
2005 | return d->alternateBackground; | 2013 | return d->alternateBackground; |
2006 | } | 2014 | } |
2007 | 2015 | ||
2008 | void KListView::setAlternateBackground(const QColor &c) | 2016 | void KListView::setAlternateBackground(const QColor &c) |
2009 | { | 2017 | { |
2010 | d->alternateBackground = c; | 2018 | d->alternateBackground = c; |
2011 | repaint(); | 2019 | repaint(); |
2012 | } | 2020 | } |
2013 | 2021 | ||
2014 | void KListView::saveLayout(KConfig *config, const QString &group) const | 2022 | void KListView::saveLayout(KConfig *config, const QString &group) const |
2015 | { | 2023 | { |
2016 | KConfigGroupSaver saver(config, group); | 2024 | KConfigGroupSaver saver(config, group); |
2017 | QStringList widths, order; | 2025 | QStringList widths, order; |
2018 | for (int i = 0; i < columns(); ++i) | 2026 | for (int i = 0; i < columns(); ++i) |
2019 | { | 2027 | { |
2020 | widths << QString::number(columnWidth(i)); | 2028 | widths << QString::number(columnWidth(i)); |
2021 | order << QString::number(header()->mapToIndex(i)); | 2029 | order << QString::number(header()->mapToIndex(i)); |
2022 | } | 2030 | } |
2023 | config->writeEntry("ColumnWidths", widths); | 2031 | config->writeEntry("ColumnWidths", widths); |
2024 | config->writeEntry("ColumnOrder", order); | 2032 | config->writeEntry("ColumnOrder", order); |
2025 | config->writeEntry("SortColumn", d->sortColumn); | 2033 | config->writeEntry("SortColumn", d->sortColumn); |
2026 | config->writeEntry("SortAscending", d->sortAscending); | 2034 | config->writeEntry("SortAscending", d->sortAscending); |
2027 | } | 2035 | } |
2028 | 2036 | ||
2029 | void KListView::restoreLayout(KConfig *config, const QString &group) | 2037 | void KListView::restoreLayout(KConfig *config, const QString &group) |
2030 | { | 2038 | { |
2031 | KConfigGroupSaver saver(config, group); | 2039 | KConfigGroupSaver saver(config, group); |
2032 | QStringList cols = config->readListEntry("ColumnWidths"); | 2040 | QStringList cols = config->readListEntry("ColumnWidths"); |
2033 | int i = 0; | 2041 | int i = 0; |
2034 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2042 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2035 | setColumnWidth(i++, (*it).toInt()); | 2043 | setColumnWidth(i++, (*it).toInt()); |
2036 | 2044 | ||
2037 | cols = config->readListEntry("ColumnOrder"); | 2045 | cols = config->readListEntry("ColumnOrder"); |
2038 | i = 0; | 2046 | i = 0; |
2039 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2047 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2040 | header()->moveSection(i++, (*it).toInt()); | 2048 | header()->moveSection(i++, (*it).toInt()); |
2041 | 2049 | ||
2042 | /*US I changed the following code, because hasKey is not available. | 2050 | /*US I changed the following code, because hasKey is not available. |
2043 | !!! check if my version is correct | 2051 | !!! check if my version is correct |
2044 | if (config->hasKey("SortColumn")) | 2052 | if (config->hasKey("SortColumn")) |
2045 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2053 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2046 | */ | 2054 | */ |
2047 | QStringList langLst = config->readListEntry( "SortColumn" ); | 2055 | QStringList langLst = config->readListEntry( "SortColumn" ); |
2048 | if (!langLst.isEmpty()) | 2056 | if (!langLst.isEmpty()) |
2049 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2057 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2050 | } | 2058 | } |
2051 | 2059 | ||
2052 | void KListView::setSorting(int column, bool ascending) | 2060 | void KListView::setSorting(int column, bool ascending) |
2053 | { | 2061 | { |
2054 | d->sortColumn = column; | 2062 | d->sortColumn = column; |
2055 | d->sortAscending = ascending; | 2063 | d->sortAscending = ascending; |
2056 | QListView::setSorting(column, ascending); | 2064 | QListView::setSorting(column, ascending); |
2057 | } | 2065 | } |
2058 | 2066 | ||
2059 | int KListView::columnSorted(void) const | 2067 | int KListView::columnSorted(void) const |
2060 | { | 2068 | { |
2061 | return d->sortColumn; | 2069 | return d->sortColumn; |
2062 | } | 2070 | } |
2063 | 2071 | ||
2064 | bool KListView::ascendingSort(void) const | 2072 | bool KListView::ascendingSort(void) const |
2065 | { | 2073 | { |
2066 | return d->sortAscending; | 2074 | return d->sortAscending; |
2067 | } | 2075 | } |
2068 | 2076 | ||
2069 | KListViewItem::KListViewItem(QListView *parent) | 2077 | KListViewItem::KListViewItem(QListView *parent) |
2070 | : QListViewItem(parent) | 2078 | : QListViewItem(parent) |
2071 | { | 2079 | { |
2072 | init(); | 2080 | init(); |
2073 | } | 2081 | } |
2074 | 2082 | ||
2075 | KListViewItem::KListViewItem(QListViewItem *parent) | 2083 | KListViewItem::KListViewItem(QListViewItem *parent) |
2076 | : QListViewItem(parent) | 2084 | : QListViewItem(parent) |
2077 | { | 2085 | { |
2078 | init(); | 2086 | init(); |
2079 | } | 2087 | } |
2080 | 2088 | ||
2081 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) | 2089 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) |
2082 | : QListViewItem(parent, after) | 2090 | : QListViewItem(parent, after) |
2083 | { | 2091 | { |
2084 | init(); | 2092 | init(); |
2085 | } | 2093 | } |
2086 | 2094 | ||
2087 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) | 2095 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) |
2088 | : QListViewItem(parent, after) | 2096 | : QListViewItem(parent, after) |
2089 | { | 2097 | { |
2090 | init(); | 2098 | init(); |
2091 | } | 2099 | } |
2092 | 2100 | ||
2093 | KListViewItem::KListViewItem(QListView *parent, | 2101 | KListViewItem::KListViewItem(QListView *parent, |
2094 | QString label1, QString label2, QString label3, QString label4, | 2102 | QString label1, QString label2, QString label3, QString label4, |
2095 | QString label5, QString label6, QString label7, QString label8) | 2103 | QString label5, QString label6, QString label7, QString label8) |
2096 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2104 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2097 | { | 2105 | { |
2098 | init(); | 2106 | init(); |
2099 | } | 2107 | } |
2100 | 2108 | ||
2101 | KListViewItem::KListViewItem(QListViewItem *parent, | 2109 | KListViewItem::KListViewItem(QListViewItem *parent, |
2102 | QString label1, QString label2, QString label3, QString label4, | 2110 | QString label1, QString label2, QString label3, QString label4, |
2103 | QString label5, QString label6, QString label7, QString label8) | 2111 | QString label5, QString label6, QString label7, QString label8) |
2104 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2112 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2105 | { | 2113 | { |
2106 | init(); | 2114 | init(); |
2107 | } | 2115 | } |
2108 | 2116 | ||
2109 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, | 2117 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, |
2110 | QString label1, QString label2, QString label3, QString label4, | 2118 | QString label1, QString label2, QString label3, QString label4, |
2111 | QString label5, QString label6, QString label7, QString label8) | 2119 | QString label5, QString label6, QString label7, QString label8) |
2112 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) | 2120 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) |
2113 | { | 2121 | { |
2114 | init(); | 2122 | init(); |
2115 | } | 2123 | } |
2116 | 2124 | ||
2117 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, | 2125 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, |
2118 | QString label1, QString label2, QString label3, QString label4, | 2126 | QString label1, QString label2, QString label3, QString label4, |
2119 | QString label5, QString label6, QString label7, QString label8) | 2127 | QString label5, QString label6, QString label7, QString label8) |
2120 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) | 2128 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) |
2121 | { | 2129 | { |
2122 | init(); | 2130 | init(); |
2123 | } | 2131 | } |
2124 | 2132 | ||
2125 | KListViewItem::~KListViewItem() | 2133 | KListViewItem::~KListViewItem() |
2126 | { | 2134 | { |
2127 | } | 2135 | } |
2128 | 2136 | ||
2129 | void KListViewItem::init() | 2137 | void KListViewItem::init() |
2130 | { | 2138 | { |
2131 | m_known = false; | 2139 | m_known = false; |
2132 | } | 2140 | } |
2133 | 2141 | ||
2134 | const QColor &KListViewItem::backgroundColor() | 2142 | const QColor &KListViewItem::backgroundColor() |
2135 | { | 2143 | { |
2136 | if (isAlternate()) | 2144 | if (isAlternate()) |
2137 | return static_cast< KListView* >(listView())->alternateBackground(); | 2145 | return static_cast< KListView* >(listView())->alternateBackground(); |
2138 | return listView()->viewport()->colorGroup().base(); | 2146 | return listView()->viewport()->colorGroup().base(); |
2139 | } | 2147 | } |
2140 | 2148 | ||
2141 | bool KListViewItem::isAlternate() | 2149 | bool KListViewItem::isAlternate() |
2142 | { | 2150 | { |
2143 | KListView *lv = static_cast<KListView *>(listView()); | 2151 | KListView *lv = static_cast<KListView *>(listView()); |
2144 | if (lv && lv->alternateBackground().isValid()) | 2152 | if (lv && lv->alternateBackground().isValid()) |
2145 | { | 2153 | { |
2146 | KListViewItem *above = 0; | 2154 | KListViewItem *above = 0; |
2147 | //US above = dynamic_cast<KListViewItem *>(itemAbove()); | 2155 | //US above = dynamic_cast<KListViewItem *>(itemAbove()); |
2148 | above = (KListViewItem *)(itemAbove()); | 2156 | above = (KListViewItem *)(itemAbove()); |
2149 | m_known = above ? above->m_known : true; | 2157 | m_known = above ? above->m_known : true; |
2150 | if (m_known) | 2158 | if (m_known) |
2151 | { | 2159 | { |
2152 | m_odd = above ? !above->m_odd : false; | 2160 | m_odd = above ? !above->m_odd : false; |
2153 | } | 2161 | } |
2154 | else | 2162 | else |
2155 | { | 2163 | { |
2156 | KListViewItem *item; | 2164 | KListViewItem *item; |
2157 | bool previous = true; | 2165 | bool previous = true; |
2158 | if (parent()) | 2166 | if (parent()) |
2159 | { | 2167 | { |
2160 | //US item = dynamic_cast<KListViewItem *>(parent()); | 2168 | //US item = dynamic_cast<KListViewItem *>(parent()); |
2161 | item = (KListViewItem *)(parent()); | 2169 | item = (KListViewItem *)(parent()); |
2162 | if (item) | 2170 | if (item) |
2163 | previous = item->m_odd; | 2171 | previous = item->m_odd; |
2164 | //US item = dynamic_cast<KListViewItem *>(parent()->firstChild()); | 2172 | //US item = dynamic_cast<KListViewItem *>(parent()->firstChild()); |
2165 | item = (KListViewItem *)(parent()->firstChild()); | 2173 | item = (KListViewItem *)(parent()->firstChild()); |
2166 | } | 2174 | } |
2167 | else | 2175 | else |
2168 | { | 2176 | { |
2169 | //US item = dynamic_cast<KListViewItem *>(lv->firstChild()); | 2177 | //US item = dynamic_cast<KListViewItem *>(lv->firstChild()); |
2170 | item = (KListViewItem *)(lv->firstChild()); | 2178 | item = (KListViewItem *)(lv->firstChild()); |
2171 | } | 2179 | } |
2172 | 2180 | ||
2173 | while(item) | 2181 | while(item) |
2174 | { | 2182 | { |
2175 | item->m_odd = previous = !previous; | 2183 | item->m_odd = previous = !previous; |
2176 | item->m_known = true; | 2184 | item->m_known = true; |
2177 | //US item = dynamic_cast<KListViewItem *>(item->nextSibling()); | 2185 | //US item = dynamic_cast<KListViewItem *>(item->nextSibling()); |
2178 | item = (KListViewItem *)(item->nextSibling()); | 2186 | item = (KListViewItem *)(item->nextSibling()); |
2179 | } | 2187 | } |
2180 | } | 2188 | } |
2181 | return m_odd; | 2189 | return m_odd; |
2182 | } | 2190 | } |
2183 | return false; | 2191 | return false; |
2184 | } | 2192 | } |
2185 | 2193 | ||
2186 | void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 2194 | void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
2187 | { | 2195 | { |
2188 | QColorGroup _cg = cg; | 2196 | QColorGroup _cg = cg; |
2189 | const QPixmap *pm = listView()->viewport()->backgroundPixmap(); | 2197 | const QPixmap *pm = listView()->viewport()->backgroundPixmap(); |
2190 | if (pm && !pm->isNull()) | 2198 | if (pm && !pm->isNull()) |
2191 | { | 2199 | { |
2192 | _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); | 2200 | _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); |
2193 | QPoint o = p->brushOrigin(); | 2201 | QPoint o = p->brushOrigin(); |
2194 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); | 2202 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); |
2195 | } | 2203 | } |
2196 | else if (isAlternate()) { | 2204 | else if (isAlternate()) { |
2197 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) | 2205 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) |
2198 | if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) | 2206 | if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) |
2199 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); | 2207 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); |
2200 | else | 2208 | else |
2201 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); | 2209 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); |
2202 | } | 2210 | } |
2203 | QListViewItem::paintCell(p, _cg, column, width, alignment); | 2211 | QListViewItem::paintCell(p, _cg, column, width, alignment); |
2204 | } | 2212 | } |
2205 | 2213 | ||
2206 | //US we do not have a "global KDE" variable to setup singleClick functionality | 2214 | //US we do not have a "global KDE" variable to setup singleClick functionality |
2207 | void KListView::setSingleClick(bool s) | 2215 | void KListView::setSingleClick(bool s) |
2208 | { | 2216 | { |
2209 | d->bUseSingle = s; | 2217 | d->bUseSingle = s; |
2210 | slotSettingsChanged(1); | 2218 | slotSettingsChanged(1); |
2211 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); | 2219 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); |
2212 | } | 2220 | } |
2213 | 2221 | ||
2214 | 2222 | ||
2215 | void KListView::virtual_hook( int, void* ) | 2223 | void KListView::virtual_hook( int, void* ) |
2216 | { /*BASE::virtual_hook( id, data );*/ } | 2224 | { /*BASE::virtual_hook( id, data );*/ } |
2217 | 2225 | ||
2218 | //US #include "klistview.moc" | 2226 | //US #include "klistview.moc" |
2219 | //US #include "klistviewlineedit.moc" | 2227 | //US #include "klistviewlineedit.moc" |
2220 | 2228 | ||
2221 | // vim: ts=2 sw=2 et | 2229 | // vim: ts=2 sw=2 et |
@@ -1 +1 @@ | |||
version = "1.9.19"; | version = "1.9.20"; | ||