author | zautrix <zautrix> | 2005-01-21 15:38:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-21 15:38:31 (UTC) |
commit | 4afdcfcac216b428ada79f4750cf7447e3175333 (patch) (unidiff) | |
tree | 8f70936ac23137c3f6fb00fce33edbfe3d821f59 | |
parent | 234b9425bebd41b556277cdd94138fafecc32b45 (diff) | |
download | kdepimpi-4afdcfcac216b428ada79f4750cf7447e3175333.zip kdepimpi-4afdcfcac216b428ada79f4750cf7447e3175333.tar.gz kdepimpi-4afdcfcac216b428ada79f4750cf7447e3175333.tar.bz2 |
some fixes
-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,217 +1,217 @@ | |||
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 |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 347d982..ead8628 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -69,313 +69,313 @@ 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; |
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 | |||
@@ -1784,259 +1784,267 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
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. |
@@ -1 +1 @@ | |||
version = "1.9.19"; | version = "1.9.20"; | ||