-rw-r--r-- | bin/kdepim/WhatsNew.txt | 8 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 16 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 88 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 1 |
9 files changed, 122 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index eb232fa..e17297a 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,194 +1,202 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 1.9.8 ************ | ||
4 | |||
5 | Fixed character decoding in OM/Pi. | ||
6 | (e.g. German "Umlaute" were not displayed properly.) | ||
7 | |||
8 | Made is possible to reparent todos in KO/Pi. | ||
9 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | ||
10 | |||
3 | ********** VERSION 1.9.7 ************ | 11 | ********** VERSION 1.9.7 ************ |
4 | 12 | ||
5 | KO/Pi - KA/Pi on Windows: | 13 | KO/Pi - KA/Pi on Windows: |
6 | Now a directory can be defined by the user, where the | 14 | Now a directory can be defined by the user, where the |
7 | application/config data should be saved. | 15 | application/config data should be saved. |
8 | Define your desired path in the evironment variable | 16 | Define your desired path in the evironment variable |
9 | MICROKDEHOME | 17 | MICROKDEHOME |
10 | before starting KO/Pi or KA/Pi. | 18 | before starting KO/Pi or KA/Pi. |
11 | 19 | ||
12 | An easy Kx/Pi to Kx/Pi syncing is now possible | 20 | An easy Kx/Pi to Kx/Pi syncing is now possible |
13 | (it is called Pi-Sync) via network. | 21 | (it is called Pi-Sync) via network. |
14 | Please look at the Sync Howto. | 22 | Please look at the Sync Howto. |
15 | 23 | ||
16 | Exporting of calendar data and contacts to mobile phones is now possible. | 24 | Exporting of calendar data and contacts to mobile phones is now possible. |
17 | The SyncHowto is updated with information howto | 25 | The SyncHowto is updated with information howto |
18 | access/sync mobile phones. | 26 | access/sync mobile phones. |
19 | Please look at the Sync Howto. | 27 | Please look at the Sync Howto. |
20 | 28 | ||
21 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 29 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
22 | Please disable Fastload for the original contact/calendar applications | 30 | Please disable Fastload for the original contact/calendar applications |
23 | and close them. | 31 | and close them. |
24 | KO/Pi and KA/Pi must be running in order to receive the data. | 32 | KO/Pi and KA/Pi must be running in order to receive the data. |
25 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 33 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
26 | 34 | ||
27 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 35 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
28 | of the other data ( emails/tel.numbers/addresses) | 36 | of the other data ( emails/tel.numbers/addresses) |
29 | 37 | ||
30 | Fixed some syncing problems in KA/Pi. | 38 | Fixed some syncing problems in KA/Pi. |
31 | 39 | ||
32 | Added font settings for the KA/Pi details view. | 40 | Added font settings for the KA/Pi details view. |
33 | Added fields "children's name" and "gender" to KA/Pi. | 41 | Added fields "children's name" and "gender" to KA/Pi. |
34 | 42 | ||
35 | Made searching in KA/Pi better: | 43 | Made searching in KA/Pi better: |
36 | Now the first item in a view is selected after a search automatically and | 44 | Now the first item in a view is selected after a search automatically and |
37 | the views can be scrolled up/down when the search input field has the keyboard focus. | 45 | the views can be scrolled up/down when the search input field has the keyboard focus. |
38 | 46 | ||
39 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 47 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
40 | 48 | ||
41 | 49 | ||
42 | ********** VERSION 1.9.6 ************ | 50 | ********** VERSION 1.9.6 ************ |
43 | 51 | ||
44 | Changes in the external application communication on the Zaurus | 52 | Changes in the external application communication on the Zaurus |
45 | in order to use less RAM when the apps are running. | 53 | in order to use less RAM when the apps are running. |
46 | First syncing of addressbooks (KA/Pi) is possible. | 54 | First syncing of addressbooks (KA/Pi) is possible. |
47 | 55 | ||
48 | 56 | ||
49 | ********** VERSION 1.9.5a ************ | 57 | ********** VERSION 1.9.5a ************ |
50 | 58 | ||
51 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 59 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
52 | Fixed some small bugs. | 60 | Fixed some small bugs. |
53 | KA/Pi shows now the birthday in summary view. | 61 | KA/Pi shows now the birthday in summary view. |
54 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 62 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
55 | for displaying dates. | 63 | for displaying dates. |
56 | 64 | ||
57 | 65 | ||
58 | ********** VERSION 1.9.5 ************ | 66 | ********** VERSION 1.9.5 ************ |
59 | 67 | ||
60 | There is still no Addressbook syncing! | 68 | There is still no Addressbook syncing! |
61 | 69 | ||
62 | New in 1.9.5: | 70 | New in 1.9.5: |
63 | 71 | ||
64 | Many bugfixes. | 72 | Many bugfixes. |
65 | Better searching in KA/Pi. | 73 | Better searching in KA/Pi. |
66 | You can configure in KA/Pi if you want to search only after | 74 | You can configure in KA/Pi if you want to search only after |
67 | <return> key pressed. | 75 | <return> key pressed. |
68 | 76 | ||
69 | Better mail downloading in OM/Pi. | 77 | Better mail downloading in OM/Pi. |
70 | 78 | ||
71 | First experimental alpha version of sync of KO/Pi with mobile phones. | 79 | First experimental alpha version of sync of KO/Pi with mobile phones. |
72 | See gammu documentation for supported phones. | 80 | See gammu documentation for supported phones. |
73 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 81 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
74 | Quick hint how to use: | 82 | Quick hint how to use: |
75 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 83 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
76 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 84 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
77 | Create syncprofile - mobile device | 85 | Create syncprofile - mobile device |
78 | Remove entry for model. (Leave empty ). | 86 | Remove entry for model. (Leave empty ). |
79 | Enable infrared on Zaurus and your Phone. | 87 | Enable infrared on Zaurus and your Phone. |
80 | Sync. | 88 | Sync. |
81 | To get a more detailed log, start kopi from konsole. | 89 | To get a more detailed log, start kopi from konsole. |
82 | 90 | ||
83 | ********** VERSION 1.9.4 ************ | 91 | ********** VERSION 1.9.4 ************ |
84 | 92 | ||
85 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 93 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
86 | 94 | ||
87 | WARNING: | 95 | WARNING: |
88 | PLEASE BACKUP ALL YOUR DATA! | 96 | PLEASE BACKUP ALL YOUR DATA! |
89 | We have changed a lot and maybe there are some unknown problems. | 97 | We have changed a lot and maybe there are some unknown problems. |
90 | 98 | ||
91 | SYNC HANDLING HAS CHANGED! | 99 | SYNC HANDLING HAS CHANGED! |
92 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 100 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
93 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 101 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
94 | 102 | ||
95 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 103 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
96 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. | 104 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. |
97 | 105 | ||
98 | As programs are available: | 106 | As programs are available: |
99 | KO/Pi (korganizer ipk) - a calendar program. | 107 | KO/Pi (korganizer ipk) - a calendar program. |
100 | KA/Pi (kaddressbook ipk ) - an addressbook | 108 | KA/Pi (kaddressbook ipk ) - an addressbook |
101 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 109 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
102 | 110 | ||
103 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 111 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
104 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 112 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
105 | 113 | ||
106 | All the applications are installed in a "Pim" TAB. | 114 | All the applications are installed in a "Pim" TAB. |
107 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk | 115 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk |
108 | 116 | ||
109 | All the application are integrated. | 117 | All the application are integrated. |
110 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. | 118 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. |
111 | 119 | ||
112 | HINT: | 120 | HINT: |
113 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 121 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
114 | 122 | ||
115 | What's new? | 123 | What's new? |
116 | 124 | ||
117 | SYNC HANDLING HAS CHANGED! | 125 | SYNC HANDLING HAS CHANGED! |
118 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 126 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
119 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 127 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
120 | 128 | ||
121 | New in OM/Pi: | 129 | New in OM/Pi: |
122 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. | 130 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. |
123 | 131 | ||
124 | New in KO/Pi: | 132 | New in KO/Pi: |
125 | French is now available for KO/Pi. | 133 | French is now available for KO/Pi. |
126 | Choose menu:Actions - Configure:TAB locale | 134 | Choose menu:Actions - Configure:TAB locale |
127 | Syncing has changed. | 135 | Syncing has changed. |
128 | Phone sync available soon. | 136 | Phone sync available soon. |
129 | Not much changes, I cannot remember them ... | 137 | Not much changes, I cannot remember them ... |
130 | 138 | ||
131 | New in KA/Pi: | 139 | New in KA/Pi: |
132 | Beaming possible. | 140 | Beaming possible. |
133 | Sharp DTM readonly access possible( create a new DTM resource ); | 141 | Sharp DTM readonly access possible( create a new DTM resource ); |
134 | Better searching possible. | 142 | Better searching possible. |
135 | Search is performed only after pressing the return key. | 143 | Search is performed only after pressing the return key. |
136 | Use wildcard * to specify parts of a name. | 144 | Use wildcard * to specify parts of a name. |
137 | 145 | ||
138 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . | 146 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . |
139 | 147 | ||
140 | A big improvement is the new management of the contact access. | 148 | A big improvement is the new management of the contact access. |
141 | In version 1.9.3, every application was using their own addressbook access data. | 149 | In version 1.9.3, every application was using their own addressbook access data. |
142 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 150 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
143 | That was wasting of memory, if you had several hundreds of contacts. | 151 | That was wasting of memory, if you had several hundreds of contacts. |
144 | 152 | ||
145 | Now only KA/Pi accesses the addressbook. | 153 | Now only KA/Pi accesses the addressbook. |
146 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. | 154 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. |
147 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 155 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
148 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 156 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
149 | 157 | ||
150 | New in the KO/Pi alarm applet: | 158 | New in the KO/Pi alarm applet: |
151 | Configure your own timer popup menu! | 159 | Configure your own timer popup menu! |
152 | (Text and minutes for timer countdown) | 160 | (Text and minutes for timer countdown) |
153 | Just edit the file | 161 | Just edit the file |
154 | (yourhomedir)/.kopialarmtimerrc | 162 | (yourhomedir)/.kopialarmtimerrc |
155 | and start/stop a timer to get a new menu with the data of this file. | 163 | and start/stop a timer to get a new menu with the data of this file. |
156 | 164 | ||
157 | ********** VERSION 1.9.3 ************ | 165 | ********** VERSION 1.9.3 ************ |
158 | 1) | 166 | 1) |
159 | Now KO/Pi on Windows imports directly the calendar data of | 167 | Now KO/Pi on Windows imports directly the calendar data of |
160 | an installed Outlook. Should work with OL version >= 2000. | 168 | an installed Outlook. Should work with OL version >= 2000. |
161 | 169 | ||
162 | ********** VERSION 1.9.2 ************ | 170 | ********** VERSION 1.9.2 ************ |
163 | 1) | 171 | 1) |
164 | KDE-Pim/Pi has got a new member: | 172 | KDE-Pim/Pi has got a new member: |
165 | KmicroMail (KM/Pi) is a mail program, | 173 | KmicroMail (KM/Pi) is a mail program, |
166 | which can handle IMAP and POP mail access. | 174 | which can handle IMAP and POP mail access. |
167 | It is based on Opie-Mail v3. | 175 | It is based on Opie-Mail v3. |
168 | All dependencies to the Opie libraries ar removed, | 176 | All dependencies to the Opie libraries ar removed, |
169 | such that no additional Opie lib is needed. | 177 | such that no additional Opie lib is needed. |
170 | It is already integrated in KO/Pi and KA/Pi. | 178 | It is already integrated in KO/Pi and KA/Pi. |
171 | It it now available for the Zaurus,probably it | 179 | It it now available for the Zaurus,probably it |
172 | will be available for other platforms later. | 180 | will be available for other platforms later. |
173 | Hint: | 181 | Hint: |
174 | Create your own contact (name + email) | 182 | Create your own contact (name + email) |
175 | in KA/Pi, select this contact and choose menu: | 183 | in KA/Pi, select this contact and choose menu: |
176 | Settings - Set Who Am I. | 184 | Settings - Set Who Am I. |
177 | Now the settings of this contact are used as | 185 | Now the settings of this contact are used as |
178 | the sender data in KM/Pi. | 186 | the sender data in KM/Pi. |
179 | 2) | 187 | 2) |
180 | KDE-Pim/Pi is split up in five different | 188 | KDE-Pim/Pi is split up in five different |
181 | packages now precompiled for Sharp Zaurus: | 189 | packages now precompiled for Sharp Zaurus: |
182 | --kmicrokdelibs_1.9.2_arm.ipk | 190 | --kmicrokdelibs_1.9.2_arm.ipk |
183 | The libs are needed for any | 191 | The libs are needed for any |
184 | of the following programs: | 192 | of the following programs: |
185 | --kaddressbook_1.9.2_arm.ipk | 193 | --kaddressbook_1.9.2_arm.ipk |
186 | --kmicromail_1.9.2_arm.ipk | 194 | --kmicromail_1.9.2_arm.ipk |
187 | --korganizer_1.9.2_arm.ipk | 195 | --korganizer_1.9.2_arm.ipk |
188 | Independ from that, there is the alarm applet | 196 | Independ from that, there is the alarm applet |
189 | available for KO/Pi, which also offers | 197 | available for KO/Pi, which also offers |
190 | quick access for a new mail or | 198 | quick access for a new mail or |
191 | showing the addressbook.: | 199 | showing the addressbook.: |
192 | --korganizer-alarm_1.9.2_arm.ipk | 200 | --korganizer-alarm_1.9.2_arm.ipk |
193 | Independend means, that the alarm applet | 201 | Independend means, that the alarm applet |
194 | does not need any of the libs or programs above to run. | 202 | does not need any of the libs or programs above to run. |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index e4a11f5..1f8ad5b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -230,384 +230,386 @@ CalendarView::CalendarView( Calendar *calendar, | |||
230 | mEventEditor = 0; | 230 | mEventEditor = 0; |
231 | mTodoEditor = 0; | 231 | mTodoEditor = 0; |
232 | init();} | 232 | init();} |
233 | 233 | ||
234 | void CalendarView::init() | 234 | void CalendarView::init() |
235 | { | 235 | { |
236 | beamDialog = new KOBeamPrefs(); | 236 | beamDialog = new KOBeamPrefs(); |
237 | mDatePickerMode = 0; | 237 | mDatePickerMode = 0; |
238 | mCurrentSyncDevice = ""; | 238 | mCurrentSyncDevice = ""; |
239 | writeLocale(); | 239 | writeLocale(); |
240 | mViewManager = new KOViewManager( this ); | 240 | mViewManager = new KOViewManager( this ); |
241 | mDialogManager = new KODialogManager( this ); | 241 | mDialogManager = new KODialogManager( this ); |
242 | mEventViewerDialog = 0; | 242 | mEventViewerDialog = 0; |
243 | mModified = false; | 243 | mModified = false; |
244 | mReadOnly = false; | 244 | mReadOnly = false; |
245 | mSelectedIncidence = 0; | 245 | mSelectedIncidence = 0; |
246 | mCalPrinter = 0; | 246 | mCalPrinter = 0; |
247 | mFilters.setAutoDelete(true); | 247 | mFilters.setAutoDelete(true); |
248 | 248 | ||
249 | mCalendar->registerObserver( this ); | 249 | mCalendar->registerObserver( this ); |
250 | // TODO: Make sure that view is updated, when calendar is changed. | 250 | // TODO: Make sure that view is updated, when calendar is changed. |
251 | 251 | ||
252 | mStorage = new FileStorage( mCalendar ); | 252 | mStorage = new FileStorage( mCalendar ); |
253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
254 | 254 | ||
255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
256 | #ifndef KORG_NOSPLITTER | 256 | #ifndef KORG_NOSPLITTER |
257 | // create the main layout frames. | 257 | // create the main layout frames. |
258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
259 | topLayout->addWidget(mPanner); | 259 | topLayout->addWidget(mPanner); |
260 | 260 | ||
261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
262 | "CalendarView::LeftFrame"); | 262 | "CalendarView::LeftFrame"); |
263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
264 | 264 | ||
265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
266 | "CalendarView::DateNavigator", QDate::currentDate() ); | 266 | "CalendarView::DateNavigator", QDate::currentDate() ); |
267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
270 | 270 | ||
271 | #ifdef KORG_NORESOURCEVIEW | 271 | #ifdef KORG_NORESOURCEVIEW |
272 | mResourceView = 0; | 272 | mResourceView = 0; |
273 | #else | 273 | #else |
274 | if ( mResourceManager ) { | 274 | if ( mResourceManager ) { |
275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
276 | mResourceView->updateView(); | 276 | mResourceView->updateView(); |
277 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 277 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
278 | SLOT( updateView() ) ); | 278 | SLOT( updateView() ) ); |
279 | } else { | 279 | } else { |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | } | 281 | } |
282 | #endif | 282 | #endif |
283 | QWidget *rightBox = new QWidget( mPanner ); | 283 | QWidget *rightBox = new QWidget( mPanner ); |
284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
285 | 285 | ||
286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
287 | rightLayout->addWidget( mNavigatorBar ); | 287 | rightLayout->addWidget( mNavigatorBar ); |
288 | 288 | ||
289 | mRightFrame = new QWidgetStack( rightBox ); | 289 | mRightFrame = new QWidgetStack( rightBox ); |
290 | rightLayout->addWidget( mRightFrame, 1 ); | 290 | rightLayout->addWidget( mRightFrame, 1 ); |
291 | 291 | ||
292 | mLeftFrame = mLeftSplitter; | 292 | mLeftFrame = mLeftSplitter; |
293 | #else | 293 | #else |
294 | QWidget *mainBox = new QWidget( this ); | 294 | QWidget *mainBox = new QWidget( this ); |
295 | QWidget *leftFrame = new QWidget( mainBox ); | 295 | QWidget *leftFrame = new QWidget( mainBox ); |
296 | 296 | ||
297 | QBoxLayout * mainBoxLayout; | 297 | QBoxLayout * mainBoxLayout; |
298 | QBoxLayout * leftFrameLayout; | 298 | QBoxLayout * leftFrameLayout; |
299 | if ( KOPrefs::instance()->mVerticalScreen ) { | 299 | if ( KOPrefs::instance()->mVerticalScreen ) { |
300 | mainBoxLayout = new QVBoxLayout(mainBox); | 300 | mainBoxLayout = new QVBoxLayout(mainBox); |
301 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 301 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
302 | } else { | 302 | } else { |
303 | mainBoxLayout = new QHBoxLayout(mainBox); | 303 | mainBoxLayout = new QHBoxLayout(mainBox); |
304 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 304 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
305 | } | 305 | } |
306 | topLayout->addWidget( mainBox ); | 306 | topLayout->addWidget( mainBox ); |
307 | mainBoxLayout->addWidget (leftFrame); | 307 | mainBoxLayout->addWidget (leftFrame); |
308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
309 | "CalendarView::DateNavigator", QDate::currentDate()); | 309 | "CalendarView::DateNavigator", QDate::currentDate()); |
310 | // mDateNavigator->blockSignals( true ); | 310 | // mDateNavigator->blockSignals( true ); |
311 | leftFrameLayout->addWidget( mDateNavigator ); | 311 | leftFrameLayout->addWidget( mDateNavigator ); |
312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
314 | 314 | ||
315 | if ( QApplication::desktop()->width() < 480 ) { | 315 | if ( QApplication::desktop()->width() < 480 ) { |
316 | leftFrameLayout->addWidget(mFilterView); | 316 | leftFrameLayout->addWidget(mFilterView); |
317 | leftFrameLayout->addWidget(mTodoList, 2 ); | 317 | leftFrameLayout->addWidget(mTodoList, 2 ); |
318 | 318 | ||
319 | } else { | 319 | } else { |
320 | leftFrameLayout->addWidget(mTodoList,2 ); | 320 | leftFrameLayout->addWidget(mTodoList,2 ); |
321 | leftFrameLayout->addWidget(mFilterView ); | 321 | leftFrameLayout->addWidget(mFilterView ); |
322 | } | 322 | } |
323 | mFilterView->hide(); | 323 | mFilterView->hide(); |
324 | QWidget *rightBox = new QWidget( mainBox ); | 324 | QWidget *rightBox = new QWidget( mainBox ); |
325 | mainBoxLayout->addWidget ( rightBox, 10 ); | 325 | mainBoxLayout->addWidget ( rightBox, 10 ); |
326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
328 | mRightFrame = new QWidgetStack( rightBox ); | 328 | mRightFrame = new QWidgetStack( rightBox ); |
329 | rightLayout->addWidget( mNavigatorBar ); | 329 | rightLayout->addWidget( mNavigatorBar ); |
330 | rightLayout->addWidget( mRightFrame, 10 ); | 330 | rightLayout->addWidget( mRightFrame, 10 ); |
331 | 331 | ||
332 | mLeftFrame = leftFrame; | 332 | mLeftFrame = leftFrame; |
333 | if ( KOPrefs::instance()->mVerticalScreen ) { | 333 | if ( KOPrefs::instance()->mVerticalScreen ) { |
334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
336 | } else { | 336 | } else { |
337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
339 | } | 339 | } |
340 | 340 | ||
341 | //qDebug("Calendarview Size %d %d ", width(), height()); | 341 | //qDebug("Calendarview Size %d %d ", width(), height()); |
342 | #endif | 342 | #endif |
343 | 343 | ||
344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
345 | SLOT( showDates( const KCal::DateList & ) ) ); | 345 | SLOT( showDates( const KCal::DateList & ) ) ); |
346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
348 | 348 | ||
349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
350 | mNavigator, SLOT( selectPreviousYear() ) ); | 350 | mNavigator, SLOT( selectPreviousYear() ) ); |
351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
352 | mNavigator, SLOT( selectNextYear() ) ); | 352 | mNavigator, SLOT( selectNextYear() ) ); |
353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
354 | mNavigator, SLOT( selectPreviousMonth() ) ); | 354 | mNavigator, SLOT( selectPreviousMonth() ) ); |
355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
356 | mNavigator, SLOT( selectNextMonth() ) ); | 356 | mNavigator, SLOT( selectNextMonth() ) ); |
357 | 357 | ||
358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
360 | 360 | ||
361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
363 | 363 | ||
364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
365 | mNavigator, SLOT( selectPreviousYear() ) ); | 365 | mNavigator, SLOT( selectPreviousYear() ) ); |
366 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 366 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
367 | mNavigator, SLOT( selectNextYear() ) ); | 367 | mNavigator, SLOT( selectNextYear() ) ); |
368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
369 | mNavigator, SLOT( selectPreviousMonth() ) ); | 369 | mNavigator, SLOT( selectPreviousMonth() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
371 | mNavigator, SLOT( selectNextMonth() ) ); | 371 | mNavigator, SLOT( selectNextMonth() ) ); |
372 | 372 | ||
373 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 373 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
374 | mNavigator, SLOT( selectPrevious() ) ); | 374 | mNavigator, SLOT( selectPrevious() ) ); |
375 | connect( mDateNavigator, SIGNAL( goNext() ), | 375 | connect( mDateNavigator, SIGNAL( goNext() ), |
376 | mNavigator, SLOT( selectNext() ) ); | 376 | mNavigator, SLOT( selectNext() ) ); |
377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
381 | 381 | ||
382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
384 | 384 | ||
385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
386 | SLOT( eventAdded( Event *) ) ); | 386 | SLOT( eventAdded( Event *) ) ); |
387 | 387 | ||
388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
389 | 389 | ||
390 | connect( this, SIGNAL( configChanged() ), | 390 | connect( this, SIGNAL( configChanged() ), |
391 | mDateNavigator, SLOT( updateConfig() ) ); | 391 | mDateNavigator, SLOT( updateConfig() ) ); |
392 | 392 | ||
393 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 393 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
394 | SLOT( newTodo() ) ); | 394 | SLOT( newTodo() ) ); |
395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
396 | SLOT( newSubTodo( Todo * ) ) ); | 396 | SLOT( newSubTodo( Todo * ) ) ); |
397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
398 | SLOT( editTodo( Todo * ) ) ); | 398 | SLOT( editTodo( Todo * ) ) ); |
399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
400 | SLOT( showTodo( Todo *) ) ); | 400 | SLOT( showTodo( Todo *) ) ); |
401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
402 | SLOT( deleteTodo( Todo *) ) ); | 402 | SLOT( deleteTodo( Todo *) ) ); |
403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
405 | SLOT( purgeCompleted() ) ); | 405 | SLOT( purgeCompleted() ) ); |
406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
407 | SIGNAL( todoModified( Todo *, int ) ) ); | 407 | SIGNAL( todoModified( Todo *, int ) ) ); |
408 | 408 | ||
409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
412 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 412 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
413 | 413 | ||
414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
415 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 415 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
417 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 417 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
418 | 418 | ||
419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
420 | this, SLOT ( todo_unsub( Todo * ) ) ); | 420 | this, SLOT ( todo_unsub( Todo * ) ) ); |
421 | 421 | ||
422 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | ||
423 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | ||
422 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 424 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
423 | SLOT( updateTodo( Todo *, int ) ) ); | 425 | SLOT( updateTodo( Todo *, int ) ) ); |
424 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 426 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
425 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 427 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
426 | 428 | ||
427 | 429 | ||
428 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 430 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
429 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 431 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
430 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 432 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
431 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 433 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
432 | 434 | ||
433 | 435 | ||
434 | 436 | ||
435 | 437 | ||
436 | 438 | ||
437 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 439 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
438 | SLOT(checkClipboard())); | 440 | SLOT(checkClipboard())); |
439 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 441 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
440 | SLOT( processTodoListSelection( Incidence * ) ) ); | 442 | SLOT( processTodoListSelection( Incidence * ) ) ); |
441 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 443 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
442 | 444 | ||
443 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 445 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
444 | 446 | ||
445 | mDateFrame = new QVBox(0,0,WType_Popup); | 447 | mDateFrame = new QVBox(0,0,WType_Popup); |
446 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 448 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
447 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 449 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
448 | mDateFrame->setLineWidth(3); | 450 | mDateFrame->setLineWidth(3); |
449 | mDateFrame->hide(); | 451 | mDateFrame->hide(); |
450 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 452 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
451 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 453 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
452 | 454 | ||
453 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 455 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
454 | 456 | ||
455 | mEventEditor = mDialogManager->getEventEditor(); | 457 | mEventEditor = mDialogManager->getEventEditor(); |
456 | mTodoEditor = mDialogManager->getTodoEditor(); | 458 | mTodoEditor = mDialogManager->getTodoEditor(); |
457 | 459 | ||
458 | mFlagEditDescription = false; | 460 | mFlagEditDescription = false; |
459 | 461 | ||
460 | mSuspendTimer = new QTimer( this ); | 462 | mSuspendTimer = new QTimer( this ); |
461 | mAlarmTimer = new QTimer( this ); | 463 | mAlarmTimer = new QTimer( this ); |
462 | mRecheckAlarmTimer = new QTimer( this ); | 464 | mRecheckAlarmTimer = new QTimer( this ); |
463 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 465 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
464 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 466 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
465 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 467 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
466 | mAlarmDialog = new AlarmDialog( this ); | 468 | mAlarmDialog = new AlarmDialog( this ); |
467 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 469 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
468 | mAlarmDialog->setServerNotification( false ); | 470 | mAlarmDialog->setServerNotification( false ); |
469 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 471 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
470 | 472 | ||
471 | 473 | ||
472 | #ifndef DESKTOP_VERSION | 474 | #ifndef DESKTOP_VERSION |
473 | //US listen for arriving address resultsets | 475 | //US listen for arriving address resultsets |
474 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 476 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
475 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 477 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
476 | #endif | 478 | #endif |
477 | 479 | ||
478 | } | 480 | } |
479 | 481 | ||
480 | 482 | ||
481 | CalendarView::~CalendarView() | 483 | CalendarView::~CalendarView() |
482 | { | 484 | { |
483 | // kdDebug() << "~CalendarView()" << endl; | 485 | // kdDebug() << "~CalendarView()" << endl; |
484 | //qDebug("CalendarView::~CalendarView() "); | 486 | //qDebug("CalendarView::~CalendarView() "); |
485 | delete mDialogManager; | 487 | delete mDialogManager; |
486 | delete mViewManager; | 488 | delete mViewManager; |
487 | delete mStorage; | 489 | delete mStorage; |
488 | delete mDateFrame ; | 490 | delete mDateFrame ; |
489 | delete beamDialog; | 491 | delete beamDialog; |
490 | //kdDebug() << "~CalendarView() done" << endl; | 492 | //kdDebug() << "~CalendarView() done" << endl; |
491 | } | 493 | } |
492 | void CalendarView::timerAlarm() | 494 | void CalendarView::timerAlarm() |
493 | { | 495 | { |
494 | //qDebug("CalendarView::timerAlarm() "); | 496 | //qDebug("CalendarView::timerAlarm() "); |
495 | computeAlarm(mAlarmNotification ); | 497 | computeAlarm(mAlarmNotification ); |
496 | } | 498 | } |
497 | 499 | ||
498 | void CalendarView::suspendAlarm() | 500 | void CalendarView::suspendAlarm() |
499 | { | 501 | { |
500 | //qDebug(" CalendarView::suspendAlarm() "); | 502 | //qDebug(" CalendarView::suspendAlarm() "); |
501 | computeAlarm(mSuspendAlarmNotification ); | 503 | computeAlarm(mSuspendAlarmNotification ); |
502 | 504 | ||
503 | } | 505 | } |
504 | 506 | ||
505 | void CalendarView::startAlarm( QString mess , QString filename) | 507 | void CalendarView::startAlarm( QString mess , QString filename) |
506 | { | 508 | { |
507 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 509 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
508 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 510 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
509 | 511 | ||
510 | } | 512 | } |
511 | 513 | ||
512 | void CalendarView::checkNextTimerAlarm() | 514 | void CalendarView::checkNextTimerAlarm() |
513 | { | 515 | { |
514 | mCalendar->checkAlarmForIncidence( 0, true ); | 516 | mCalendar->checkAlarmForIncidence( 0, true ); |
515 | } | 517 | } |
516 | 518 | ||
517 | void CalendarView::computeAlarm( QString msg ) | 519 | void CalendarView::computeAlarm( QString msg ) |
518 | { | 520 | { |
519 | 521 | ||
520 | QString mess = msg; | 522 | QString mess = msg; |
521 | QString mAlarmMessage = mess.mid( 9 ); | 523 | QString mAlarmMessage = mess.mid( 9 ); |
522 | QString filename = MainWindow::resourcePath(); | 524 | QString filename = MainWindow::resourcePath(); |
523 | filename += "koalarm.wav"; | 525 | filename += "koalarm.wav"; |
524 | QString tempfilename; | 526 | QString tempfilename; |
525 | if ( mess.left( 13 ) == "suspend_alarm") { | 527 | if ( mess.left( 13 ) == "suspend_alarm") { |
526 | bool error = false; | 528 | bool error = false; |
527 | int len = mess.mid( 13 ).find("+++"); | 529 | int len = mess.mid( 13 ).find("+++"); |
528 | if ( len < 2 ) | 530 | if ( len < 2 ) |
529 | error = true; | 531 | error = true; |
530 | else { | 532 | else { |
531 | tempfilename = mess.mid( 13, len ); | 533 | tempfilename = mess.mid( 13, len ); |
532 | if ( !QFile::exists( tempfilename ) ) | 534 | if ( !QFile::exists( tempfilename ) ) |
533 | error = true; | 535 | error = true; |
534 | } | 536 | } |
535 | if ( ! error ) { | 537 | if ( ! error ) { |
536 | filename = tempfilename; | 538 | filename = tempfilename; |
537 | } | 539 | } |
538 | mAlarmMessage = mess.mid( 13+len+3 ); | 540 | mAlarmMessage = mess.mid( 13+len+3 ); |
539 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 541 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
540 | startAlarm( mAlarmMessage, filename); | 542 | startAlarm( mAlarmMessage, filename); |
541 | return; | 543 | return; |
542 | } | 544 | } |
543 | if ( mess.left( 11 ) == "timer_alarm") { | 545 | if ( mess.left( 11 ) == "timer_alarm") { |
544 | //mTimerTime = 0; | 546 | //mTimerTime = 0; |
545 | startAlarm( mess.mid( 11 ), filename ); | 547 | startAlarm( mess.mid( 11 ), filename ); |
546 | return; | 548 | return; |
547 | } | 549 | } |
548 | if ( mess.left( 10 ) == "proc_alarm") { | 550 | if ( mess.left( 10 ) == "proc_alarm") { |
549 | bool error = false; | 551 | bool error = false; |
550 | int len = mess.mid( 10 ).find("+++"); | 552 | int len = mess.mid( 10 ).find("+++"); |
551 | if ( len < 2 ) | 553 | if ( len < 2 ) |
552 | error = true; | 554 | error = true; |
553 | else { | 555 | else { |
554 | tempfilename = mess.mid( 10, len ); | 556 | tempfilename = mess.mid( 10, len ); |
555 | if ( !QFile::exists( tempfilename ) ) | 557 | if ( !QFile::exists( tempfilename ) ) |
556 | error = true; | 558 | error = true; |
557 | } | 559 | } |
558 | if ( error ) { | 560 | if ( error ) { |
559 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 561 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
560 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 562 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
561 | } else { | 563 | } else { |
562 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 564 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
563 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 565 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
564 | #ifndef _WIN32_ | 566 | #ifndef _WIN32_ |
565 | if ( vfork () == 0 ) { | 567 | if ( vfork () == 0 ) { |
566 | execl ( tempfilename.latin1(), 0 ); | 568 | execl ( tempfilename.latin1(), 0 ); |
567 | return; | 569 | return; |
568 | } | 570 | } |
569 | #else | 571 | #else |
570 | QProcess* p = new QProcess(); | 572 | QProcess* p = new QProcess(); |
571 | p->addArgument( tempfilename.latin1() ); | 573 | p->addArgument( tempfilename.latin1() ); |
572 | p->start(); | 574 | p->start(); |
573 | return; | 575 | return; |
574 | #endif | 576 | #endif |
575 | 577 | ||
576 | return; | 578 | return; |
577 | } | 579 | } |
578 | 580 | ||
579 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 581 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
580 | } | 582 | } |
581 | if ( mess.left( 11 ) == "audio_alarm") { | 583 | if ( mess.left( 11 ) == "audio_alarm") { |
582 | bool error = false; | 584 | bool error = false; |
583 | int len = mess.mid( 11 ).find("+++"); | 585 | int len = mess.mid( 11 ).find("+++"); |
584 | if ( len < 2 ) | 586 | if ( len < 2 ) |
585 | error = true; | 587 | error = true; |
586 | else { | 588 | else { |
587 | tempfilename = mess.mid( 11, len ); | 589 | tempfilename = mess.mid( 11, len ); |
588 | if ( !QFile::exists( tempfilename ) ) | 590 | if ( !QFile::exists( tempfilename ) ) |
589 | error = true; | 591 | error = true; |
590 | } | 592 | } |
591 | if ( ! error ) { | 593 | if ( ! error ) { |
592 | filename = tempfilename; | 594 | filename = tempfilename; |
593 | } | 595 | } |
594 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 596 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
595 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 597 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
596 | } | 598 | } |
597 | if ( mess.left( 9 ) == "cal_alarm") { | 599 | if ( mess.left( 9 ) == "cal_alarm") { |
598 | mAlarmMessage = mess.mid( 9 ) ; | 600 | mAlarmMessage = mess.mid( 9 ) ; |
599 | } | 601 | } |
600 | 602 | ||
601 | startAlarm( mAlarmMessage, filename ); | 603 | startAlarm( mAlarmMessage, filename ); |
602 | 604 | ||
603 | 605 | ||
604 | } | 606 | } |
605 | 607 | ||
606 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 608 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
607 | { | 609 | { |
608 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 610 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
609 | 611 | ||
610 | mSuspendAlarmNotification = noti; | 612 | mSuspendAlarmNotification = noti; |
611 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 613 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
612 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 614 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
613 | mSuspendTimer->start( ms , true ); | 615 | mSuspendTimer->start( ms , true ); |
@@ -2557,384 +2559,398 @@ void CalendarView::todoAdded(Todo * t) | |||
2557 | } | 2559 | } |
2558 | void CalendarView::todoChanged(Todo * t) | 2560 | void CalendarView::todoChanged(Todo * t) |
2559 | { | 2561 | { |
2560 | emit todoModified( t, 4 ); | 2562 | emit todoModified( t, 4 ); |
2561 | // updateTodoViews(); | 2563 | // updateTodoViews(); |
2562 | } | 2564 | } |
2563 | void CalendarView::todoToBeDeleted(Todo *) | 2565 | void CalendarView::todoToBeDeleted(Todo *) |
2564 | { | 2566 | { |
2565 | //qDebug("todoToBeDeleted(Todo *) "); | 2567 | //qDebug("todoToBeDeleted(Todo *) "); |
2566 | updateTodoViews(); | 2568 | updateTodoViews(); |
2567 | } | 2569 | } |
2568 | void CalendarView::todoDeleted() | 2570 | void CalendarView::todoDeleted() |
2569 | { | 2571 | { |
2570 | //qDebug(" todoDeleted()"); | 2572 | //qDebug(" todoDeleted()"); |
2571 | updateTodoViews(); | 2573 | updateTodoViews(); |
2572 | } | 2574 | } |
2573 | 2575 | ||
2574 | 2576 | ||
2575 | 2577 | ||
2576 | void CalendarView::newTodo() | 2578 | void CalendarView::newTodo() |
2577 | { | 2579 | { |
2578 | 2580 | ||
2579 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); | 2581 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); |
2580 | if ( mFilterView->filtersEnabled() ) { | 2582 | if ( mFilterView->filtersEnabled() ) { |
2581 | CalFilter *filter = mFilterView->selectedFilter(); | 2583 | CalFilter *filter = mFilterView->selectedFilter(); |
2582 | if (filter && filter->showCategories()) { | 2584 | if (filter && filter->showCategories()) { |
2583 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2585 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2584 | } | 2586 | } |
2585 | if ( filter ) | 2587 | if ( filter ) |
2586 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2588 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2587 | } | 2589 | } |
2588 | showTodoEditor(); | 2590 | showTodoEditor(); |
2589 | } | 2591 | } |
2590 | 2592 | ||
2591 | void CalendarView::newSubTodo() | 2593 | void CalendarView::newSubTodo() |
2592 | { | 2594 | { |
2593 | Todo *todo = selectedTodo(); | 2595 | Todo *todo = selectedTodo(); |
2594 | if ( todo ) newSubTodo( todo ); | 2596 | if ( todo ) newSubTodo( todo ); |
2595 | } | 2597 | } |
2596 | 2598 | ||
2597 | void CalendarView::newSubTodo(Todo *parentEvent) | 2599 | void CalendarView::newSubTodo(Todo *parentEvent) |
2598 | { | 2600 | { |
2599 | 2601 | ||
2600 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | 2602 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); |
2601 | showTodoEditor(); | 2603 | showTodoEditor(); |
2602 | } | 2604 | } |
2603 | 2605 | ||
2604 | void CalendarView::newFloatingEvent() | 2606 | void CalendarView::newFloatingEvent() |
2605 | { | 2607 | { |
2606 | DateList tmpList = mNavigator->selectedDates(); | 2608 | DateList tmpList = mNavigator->selectedDates(); |
2607 | QDate date = tmpList.first(); | 2609 | QDate date = tmpList.first(); |
2608 | 2610 | ||
2609 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2611 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2610 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2612 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2611 | } | 2613 | } |
2612 | 2614 | ||
2613 | 2615 | ||
2614 | void CalendarView::editEvent( Event *event ) | 2616 | void CalendarView::editEvent( Event *event ) |
2615 | { | 2617 | { |
2616 | 2618 | ||
2617 | if ( !event ) return; | 2619 | if ( !event ) return; |
2618 | if ( event->isReadOnly() ) { | 2620 | if ( event->isReadOnly() ) { |
2619 | showEvent( event ); | 2621 | showEvent( event ); |
2620 | return; | 2622 | return; |
2621 | } | 2623 | } |
2622 | mEventEditor->editEvent( event , mFlagEditDescription); | 2624 | mEventEditor->editEvent( event , mFlagEditDescription); |
2623 | showEventEditor(); | 2625 | showEventEditor(); |
2624 | } | 2626 | } |
2625 | void CalendarView::editJournal( Journal *jour ) | 2627 | void CalendarView::editJournal( Journal *jour ) |
2626 | { | 2628 | { |
2627 | if ( !jour ) return; | 2629 | if ( !jour ) return; |
2628 | mDialogManager->hideSearchDialog(); | 2630 | mDialogManager->hideSearchDialog(); |
2629 | mViewManager->showJournalView(); | 2631 | mViewManager->showJournalView(); |
2630 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2632 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2631 | } | 2633 | } |
2632 | void CalendarView::editTodo( Todo *todo ) | 2634 | void CalendarView::editTodo( Todo *todo ) |
2633 | { | 2635 | { |
2634 | if ( !todo ) return; | 2636 | if ( !todo ) return; |
2635 | 2637 | ||
2636 | if ( todo->isReadOnly() ) { | 2638 | if ( todo->isReadOnly() ) { |
2637 | showTodo( todo ); | 2639 | showTodo( todo ); |
2638 | return; | 2640 | return; |
2639 | } | 2641 | } |
2640 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2642 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2641 | showTodoEditor(); | 2643 | showTodoEditor(); |
2642 | 2644 | ||
2643 | } | 2645 | } |
2644 | 2646 | ||
2645 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2647 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2646 | { | 2648 | { |
2647 | if ( !mEventViewerDialog ) { | 2649 | if ( !mEventViewerDialog ) { |
2648 | mEventViewerDialog = new KOEventViewerDialog(this); | 2650 | mEventViewerDialog = new KOEventViewerDialog(this); |
2649 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2651 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2650 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2652 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2651 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2653 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2652 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2654 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2653 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2655 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2654 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2656 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2655 | mEventViewerDialog->resize( 640, 480 ); | 2657 | mEventViewerDialog->resize( 640, 480 ); |
2656 | 2658 | ||
2657 | } | 2659 | } |
2658 | return mEventViewerDialog; | 2660 | return mEventViewerDialog; |
2659 | } | 2661 | } |
2660 | void CalendarView::showEvent(Event *event) | 2662 | void CalendarView::showEvent(Event *event) |
2661 | { | 2663 | { |
2662 | getEventViewerDialog()->setEvent(event); | 2664 | getEventViewerDialog()->setEvent(event); |
2663 | getEventViewerDialog()->showMe(); | 2665 | getEventViewerDialog()->showMe(); |
2664 | } | 2666 | } |
2665 | 2667 | ||
2666 | void CalendarView::showTodo(Todo *event) | 2668 | void CalendarView::showTodo(Todo *event) |
2667 | { | 2669 | { |
2668 | getEventViewerDialog()->setTodo(event); | 2670 | getEventViewerDialog()->setTodo(event); |
2669 | getEventViewerDialog()->showMe(); | 2671 | getEventViewerDialog()->showMe(); |
2670 | } | 2672 | } |
2671 | void CalendarView::showJournal( Journal *jour ) | 2673 | void CalendarView::showJournal( Journal *jour ) |
2672 | { | 2674 | { |
2673 | getEventViewerDialog()->setJournal(jour); | 2675 | getEventViewerDialog()->setJournal(jour); |
2674 | getEventViewerDialog()->showMe(); | 2676 | getEventViewerDialog()->showMe(); |
2675 | 2677 | ||
2676 | } | 2678 | } |
2677 | // void CalendarView::todoModified (Todo *event, int changed) | 2679 | // void CalendarView::todoModified (Todo *event, int changed) |
2678 | // { | 2680 | // { |
2679 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2681 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2680 | // // kdDebug() << "Todo modified and open" << endl; | 2682 | // // kdDebug() << "Todo modified and open" << endl; |
2681 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2683 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2682 | // // temp->modified (changed); | 2684 | // // temp->modified (changed); |
2683 | 2685 | ||
2684 | // // } | 2686 | // // } |
2685 | 2687 | ||
2686 | // mViewManager->updateView(); | 2688 | // mViewManager->updateView(); |
2687 | // } | 2689 | // } |
2688 | 2690 | ||
2689 | void CalendarView::appointment_show() | 2691 | void CalendarView::appointment_show() |
2690 | { | 2692 | { |
2691 | Event *anEvent = 0; | 2693 | Event *anEvent = 0; |
2692 | 2694 | ||
2693 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2695 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2694 | 2696 | ||
2695 | if (mViewManager->currentView()->isEventView()) { | 2697 | if (mViewManager->currentView()->isEventView()) { |
2696 | if ( incidence && incidence->type() == "Event" ) { | 2698 | if ( incidence && incidence->type() == "Event" ) { |
2697 | anEvent = static_cast<Event *>(incidence); | 2699 | anEvent = static_cast<Event *>(incidence); |
2698 | } | 2700 | } |
2699 | } | 2701 | } |
2700 | 2702 | ||
2701 | if (!anEvent) { | 2703 | if (!anEvent) { |
2702 | KNotifyClient::beep(); | 2704 | KNotifyClient::beep(); |
2703 | return; | 2705 | return; |
2704 | } | 2706 | } |
2705 | 2707 | ||
2706 | showEvent(anEvent); | 2708 | showEvent(anEvent); |
2707 | } | 2709 | } |
2708 | 2710 | ||
2709 | void CalendarView::appointment_edit() | 2711 | void CalendarView::appointment_edit() |
2710 | { | 2712 | { |
2711 | Event *anEvent = 0; | 2713 | Event *anEvent = 0; |
2712 | 2714 | ||
2713 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2715 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2714 | 2716 | ||
2715 | if (mViewManager->currentView()->isEventView()) { | 2717 | if (mViewManager->currentView()->isEventView()) { |
2716 | if ( incidence && incidence->type() == "Event" ) { | 2718 | if ( incidence && incidence->type() == "Event" ) { |
2717 | anEvent = static_cast<Event *>(incidence); | 2719 | anEvent = static_cast<Event *>(incidence); |
2718 | } | 2720 | } |
2719 | } | 2721 | } |
2720 | 2722 | ||
2721 | if (!anEvent) { | 2723 | if (!anEvent) { |
2722 | KNotifyClient::beep(); | 2724 | KNotifyClient::beep(); |
2723 | return; | 2725 | return; |
2724 | } | 2726 | } |
2725 | 2727 | ||
2726 | editEvent(anEvent); | 2728 | editEvent(anEvent); |
2727 | } | 2729 | } |
2728 | 2730 | ||
2729 | void CalendarView::appointment_delete() | 2731 | void CalendarView::appointment_delete() |
2730 | { | 2732 | { |
2731 | Event *anEvent = 0; | 2733 | Event *anEvent = 0; |
2732 | 2734 | ||
2733 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2735 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2734 | 2736 | ||
2735 | if (mViewManager->currentView()->isEventView()) { | 2737 | if (mViewManager->currentView()->isEventView()) { |
2736 | if ( incidence && incidence->type() == "Event" ) { | 2738 | if ( incidence && incidence->type() == "Event" ) { |
2737 | anEvent = static_cast<Event *>(incidence); | 2739 | anEvent = static_cast<Event *>(incidence); |
2738 | } | 2740 | } |
2739 | } | 2741 | } |
2740 | 2742 | ||
2741 | if (!anEvent) { | 2743 | if (!anEvent) { |
2742 | KNotifyClient::beep(); | 2744 | KNotifyClient::beep(); |
2743 | return; | 2745 | return; |
2744 | } | 2746 | } |
2745 | 2747 | ||
2746 | deleteEvent(anEvent); | 2748 | deleteEvent(anEvent); |
2747 | } | 2749 | } |
2748 | 2750 | ||
2751 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | ||
2752 | { | ||
2753 | if (!sub) return; | ||
2754 | if (!parent) return; | ||
2755 | if ( sub->relatedTo() ) | ||
2756 | sub->relatedTo()->removeRelation(sub); | ||
2757 | sub->setRelatedTo(parent); | ||
2758 | sub->setRelatedToUid(parent->uid()); | ||
2759 | parent->addRelation(sub); | ||
2760 | sub->updated(); | ||
2761 | parent->updated(); | ||
2762 | setModified(true); | ||
2763 | updateView(); | ||
2764 | } | ||
2749 | void CalendarView::todo_unsub(Todo *anTodo ) | 2765 | void CalendarView::todo_unsub(Todo *anTodo ) |
2750 | { | 2766 | { |
2751 | // Todo *anTodo = selectedTodo(); | 2767 | // Todo *anTodo = selectedTodo(); |
2752 | if (!anTodo) return; | 2768 | if (!anTodo) return; |
2753 | if (!anTodo->relatedTo()) return; | 2769 | if (!anTodo->relatedTo()) return; |
2754 | anTodo->relatedTo()->removeRelation(anTodo); | 2770 | anTodo->relatedTo()->removeRelation(anTodo); |
2755 | anTodo->setRelatedTo(0); | 2771 | anTodo->setRelatedTo(0); |
2756 | anTodo->updated(); | 2772 | anTodo->updated(); |
2757 | anTodo->setRelatedToUid(""); | 2773 | anTodo->setRelatedToUid(""); |
2758 | setModified(true); | 2774 | setModified(true); |
2759 | updateView(); | 2775 | updateView(); |
2760 | } | 2776 | } |
2761 | 2777 | ||
2762 | void CalendarView::deleteTodo(Todo *todo) | 2778 | void CalendarView::deleteTodo(Todo *todo) |
2763 | { | 2779 | { |
2764 | if (!todo) { | 2780 | if (!todo) { |
2765 | KNotifyClient::beep(); | 2781 | KNotifyClient::beep(); |
2766 | return; | 2782 | return; |
2767 | } | 2783 | } |
2768 | if (KOPrefs::instance()->mConfirm) { | 2784 | if (KOPrefs::instance()->mConfirm) { |
2769 | switch (msgItemDelete()) { | 2785 | switch (msgItemDelete()) { |
2770 | case KMessageBox::Continue: // OK | 2786 | case KMessageBox::Continue: // OK |
2771 | if (!todo->relations().isEmpty()) { | 2787 | if (!todo->relations().isEmpty()) { |
2772 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2788 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2773 | i18n("Delete To-Do")); | 2789 | i18n("Delete To-Do")); |
2774 | } else { | 2790 | } else { |
2775 | checkExternalId( todo ); | 2791 | checkExternalId( todo ); |
2776 | calendar()->deleteTodo(todo); | 2792 | calendar()->deleteTodo(todo); |
2777 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2793 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2778 | updateView(); | 2794 | updateView(); |
2779 | } | 2795 | } |
2780 | break; | 2796 | break; |
2781 | } // switch | 2797 | } // switch |
2782 | } else { | 2798 | } else { |
2783 | if (!todo->relations().isEmpty()) { | 2799 | if (!todo->relations().isEmpty()) { |
2784 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2800 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2785 | i18n("Delete To-Do")); | 2801 | i18n("Delete To-Do")); |
2786 | } else { | 2802 | } else { |
2787 | checkExternalId( todo ); | 2803 | checkExternalId( todo ); |
2788 | mCalendar->deleteTodo(todo); | 2804 | mCalendar->deleteTodo(todo); |
2789 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2805 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2790 | updateView(); | 2806 | updateView(); |
2791 | } | 2807 | } |
2792 | } | 2808 | } |
2793 | emit updateSearchDialog(); | 2809 | emit updateSearchDialog(); |
2794 | } | 2810 | } |
2795 | void CalendarView::deleteJournal(Journal *jour) | 2811 | void CalendarView::deleteJournal(Journal *jour) |
2796 | { | 2812 | { |
2797 | if (!jour) { | 2813 | if (!jour) { |
2798 | KNotifyClient::beep(); | 2814 | KNotifyClient::beep(); |
2799 | return; | 2815 | return; |
2800 | } | 2816 | } |
2801 | if (KOPrefs::instance()->mConfirm) { | 2817 | if (KOPrefs::instance()->mConfirm) { |
2802 | switch (msgItemDelete()) { | 2818 | switch (msgItemDelete()) { |
2803 | case KMessageBox::Continue: // OK | 2819 | case KMessageBox::Continue: // OK |
2804 | calendar()->deleteJournal(jour); | 2820 | calendar()->deleteJournal(jour); |
2805 | updateView(); | 2821 | updateView(); |
2806 | break; | 2822 | break; |
2807 | } // switch | 2823 | } // switch |
2808 | } else { | 2824 | } else { |
2809 | calendar()->deleteJournal(jour);; | 2825 | calendar()->deleteJournal(jour);; |
2810 | updateView(); | 2826 | updateView(); |
2811 | } | 2827 | } |
2812 | emit updateSearchDialog(); | 2828 | emit updateSearchDialog(); |
2813 | } | 2829 | } |
2814 | 2830 | ||
2815 | void CalendarView::deleteEvent(Event *anEvent) | 2831 | void CalendarView::deleteEvent(Event *anEvent) |
2816 | { | 2832 | { |
2817 | if (!anEvent) { | 2833 | if (!anEvent) { |
2818 | KNotifyClient::beep(); | 2834 | KNotifyClient::beep(); |
2819 | return; | 2835 | return; |
2820 | } | 2836 | } |
2821 | 2837 | ||
2822 | if (anEvent->recurrence()->doesRecur()) { | 2838 | if (anEvent->recurrence()->doesRecur()) { |
2823 | QDate itemDate = mViewManager->currentSelectionDate(); | 2839 | QDate itemDate = mViewManager->currentSelectionDate(); |
2824 | int km; | 2840 | int km; |
2825 | if (!itemDate.isValid()) { | 2841 | if (!itemDate.isValid()) { |
2826 | //kdDebug() << "Date Not Valid" << endl; | 2842 | //kdDebug() << "Date Not Valid" << endl; |
2827 | if (KOPrefs::instance()->mConfirm) { | 2843 | if (KOPrefs::instance()->mConfirm) { |
2828 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2844 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2829 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 2845 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
2830 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 2846 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
2831 | if ( km == KMessageBox::Continue ) | 2847 | if ( km == KMessageBox::Continue ) |
2832 | km = KMessageBox::No; // No = all below | 2848 | km = KMessageBox::No; // No = all below |
2833 | } else | 2849 | } else |
2834 | km = KMessageBox::No; | 2850 | km = KMessageBox::No; |
2835 | } else { | 2851 | } else { |
2836 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + | 2852 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + |
2837 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 2853 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
2838 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 2854 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
2839 | i18n("KO/Pi Confirmation"),i18n("Current"), | 2855 | i18n("KO/Pi Confirmation"),i18n("Current"), |
2840 | i18n("All")); | 2856 | i18n("All")); |
2841 | } | 2857 | } |
2842 | switch(km) { | 2858 | switch(km) { |
2843 | 2859 | ||
2844 | case KMessageBox::No: // Continue // all | 2860 | case KMessageBox::No: // Continue // all |
2845 | //qDebug("KMessageBox::No "); | 2861 | //qDebug("KMessageBox::No "); |
2846 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2862 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2847 | schedule(Scheduler::Cancel,anEvent); | 2863 | schedule(Scheduler::Cancel,anEvent); |
2848 | 2864 | ||
2849 | checkExternalId( anEvent); | 2865 | checkExternalId( anEvent); |
2850 | mCalendar->deleteEvent(anEvent); | 2866 | mCalendar->deleteEvent(anEvent); |
2851 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 2867 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
2852 | break; | 2868 | break; |
2853 | 2869 | ||
2854 | // Disabled because it does not work | 2870 | // Disabled because it does not work |
2855 | //#if 0 | 2871 | //#if 0 |
2856 | case KMessageBox::Yes: // just this one | 2872 | case KMessageBox::Yes: // just this one |
2857 | //QDate qd = mNavigator->selectedDates().first(); | 2873 | //QDate qd = mNavigator->selectedDates().first(); |
2858 | //if (!qd.isValid()) { | 2874 | //if (!qd.isValid()) { |
2859 | // kdDebug() << "no date selected, or invalid date" << endl; | 2875 | // kdDebug() << "no date selected, or invalid date" << endl; |
2860 | // KNotifyClient::beep(); | 2876 | // KNotifyClient::beep(); |
2861 | // return; | 2877 | // return; |
2862 | //} | 2878 | //} |
2863 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 2879 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
2864 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 2880 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
2865 | anEvent->addExDate(itemDate); | 2881 | anEvent->addExDate(itemDate); |
2866 | int duration = anEvent->recurrence()->duration(); | 2882 | int duration = anEvent->recurrence()->duration(); |
2867 | if ( duration > 0 ) { | 2883 | if ( duration > 0 ) { |
2868 | anEvent->recurrence()->setDuration( duration - 1 ); | 2884 | anEvent->recurrence()->setDuration( duration - 1 ); |
2869 | } | 2885 | } |
2870 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 2886 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
2871 | } | 2887 | } |
2872 | break; | 2888 | break; |
2873 | //#endif | 2889 | //#endif |
2874 | } // switch | 2890 | } // switch |
2875 | } else { | 2891 | } else { |
2876 | if (KOPrefs::instance()->mConfirm) { | 2892 | if (KOPrefs::instance()->mConfirm) { |
2877 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2893 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2878 | i18n("\nAre you sure you want\nto delete this event?"), | 2894 | i18n("\nAre you sure you want\nto delete this event?"), |
2879 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 2895 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
2880 | case KMessageBox::Continue: // OK | 2896 | case KMessageBox::Continue: // OK |
2881 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2897 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2882 | schedule(Scheduler::Cancel,anEvent); | 2898 | schedule(Scheduler::Cancel,anEvent); |
2883 | checkExternalId( anEvent); | 2899 | checkExternalId( anEvent); |
2884 | mCalendar->deleteEvent(anEvent); | 2900 | mCalendar->deleteEvent(anEvent); |
2885 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2901 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2886 | break; | 2902 | break; |
2887 | } // switch | 2903 | } // switch |
2888 | } else { | 2904 | } else { |
2889 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2905 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2890 | schedule(Scheduler::Cancel,anEvent); | 2906 | schedule(Scheduler::Cancel,anEvent); |
2891 | checkExternalId( anEvent); | 2907 | checkExternalId( anEvent); |
2892 | mCalendar->deleteEvent(anEvent); | 2908 | mCalendar->deleteEvent(anEvent); |
2893 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2909 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2894 | } | 2910 | } |
2895 | } // if-else | 2911 | } // if-else |
2896 | emit updateSearchDialog(); | 2912 | emit updateSearchDialog(); |
2897 | } | 2913 | } |
2898 | 2914 | ||
2899 | bool CalendarView::deleteEvent(const QString &uid) | 2915 | bool CalendarView::deleteEvent(const QString &uid) |
2900 | { | 2916 | { |
2901 | Event *ev = mCalendar->event(uid); | 2917 | Event *ev = mCalendar->event(uid); |
2902 | if (ev) { | 2918 | if (ev) { |
2903 | deleteEvent(ev); | 2919 | deleteEvent(ev); |
2904 | return true; | 2920 | return true; |
2905 | } else { | 2921 | } else { |
2906 | return false; | 2922 | return false; |
2907 | } | 2923 | } |
2908 | } | 2924 | } |
2909 | 2925 | ||
2910 | /*****************************************************************************/ | 2926 | /*****************************************************************************/ |
2911 | 2927 | ||
2912 | void CalendarView::action_mail() | 2928 | void CalendarView::action_mail() |
2913 | { | 2929 | { |
2914 | #ifndef KORG_NOMAIL | 2930 | #ifndef KORG_NOMAIL |
2915 | KOMailClient mailClient; | 2931 | KOMailClient mailClient; |
2916 | 2932 | ||
2917 | Incidence *incidence = currentSelection(); | 2933 | Incidence *incidence = currentSelection(); |
2918 | 2934 | ||
2919 | if (!incidence) { | 2935 | if (!incidence) { |
2920 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2936 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2921 | return; | 2937 | return; |
2922 | } | 2938 | } |
2923 | if(incidence->attendeeCount() == 0 ) { | 2939 | if(incidence->attendeeCount() == 0 ) { |
2924 | KMessageBox::sorry(this, | 2940 | KMessageBox::sorry(this, |
2925 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2941 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2926 | return; | 2942 | return; |
2927 | } | 2943 | } |
2928 | 2944 | ||
2929 | CalendarLocal cal_tmp; | 2945 | CalendarLocal cal_tmp; |
2930 | Event *event = 0; | 2946 | Event *event = 0; |
2931 | Event *ev = 0; | 2947 | Event *ev = 0; |
2932 | if ( incidence && incidence->type() == "Event" ) { | 2948 | if ( incidence && incidence->type() == "Event" ) { |
2933 | event = static_cast<Event *>(incidence); | 2949 | event = static_cast<Event *>(incidence); |
2934 | ev = new Event(*event); | 2950 | ev = new Event(*event); |
2935 | cal_tmp.addEvent(ev); | 2951 | cal_tmp.addEvent(ev); |
2936 | } | 2952 | } |
2937 | ICalFormat mForm(); | 2953 | ICalFormat mForm(); |
2938 | QString attachment = mForm.toString( &cal_tmp ); | 2954 | QString attachment = mForm.toString( &cal_tmp ); |
2939 | if (ev) delete(ev); | 2955 | if (ev) delete(ev); |
2940 | 2956 | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 660cce7..9f56cc8 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -165,384 +165,385 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
165 | /** Emitted, when the number of outgoing messages has changed. */ | 165 | /** Emitted, when the number of outgoing messages has changed. */ |
166 | void numOutgoingChanged(int); | 166 | void numOutgoingChanged(int); |
167 | 167 | ||
168 | /** Send status message, which can e.g. be displayed in the status bar. */ | 168 | /** Send status message, which can e.g. be displayed in the status bar. */ |
169 | void statusMessage(const QString &); | 169 | void statusMessage(const QString &); |
170 | 170 | ||
171 | void calendarViewExpanded( bool ); | 171 | void calendarViewExpanded( bool ); |
172 | void updateSearchDialog(); | 172 | void updateSearchDialog(); |
173 | 173 | ||
174 | 174 | ||
175 | public slots: | 175 | public slots: |
176 | void showOpenError(); | 176 | void showOpenError(); |
177 | void watchSavedFile(); | 177 | void watchSavedFile(); |
178 | void recheckTimerAlarm(); | 178 | void recheckTimerAlarm(); |
179 | void checkNextTimerAlarm(); | 179 | void checkNextTimerAlarm(); |
180 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 180 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
181 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 181 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
182 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 182 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
183 | 183 | ||
184 | /** options dialog made a changed to the configuration. we catch this | 184 | /** options dialog made a changed to the configuration. we catch this |
185 | * and notify all widgets which need to update their configuration. */ | 185 | * and notify all widgets which need to update their configuration. */ |
186 | void updateConfig(); | 186 | void updateConfig(); |
187 | 187 | ||
188 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 188 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
189 | const QStringList& anniversaryList, const QStringList& realNameList, | 189 | const QStringList& anniversaryList, const QStringList& realNameList, |
190 | const QStringList& emailList, const QStringList& assembledNameList, | 190 | const QStringList& emailList, const QStringList& assembledNameList, |
191 | const QStringList& uidList); | 191 | const QStringList& uidList); |
192 | 192 | ||
193 | /** | 193 | /** |
194 | Load calendar from file \a filename. If \a merge is true, load | 194 | Load calendar from file \a filename. If \a merge is true, load |
195 | calendar into existing one, if it is false, clear calendar, before | 195 | calendar into existing one, if it is false, clear calendar, before |
196 | loading. Return true, if calendar could be successfully loaded. | 196 | loading. Return true, if calendar could be successfully loaded. |
197 | */ | 197 | */ |
198 | bool openCalendar(QString filename, bool merge=false); | 198 | bool openCalendar(QString filename, bool merge=false); |
199 | bool syncCalendar(QString filename,int mode = 0 ); | 199 | bool syncCalendar(QString filename,int mode = 0 ); |
200 | 200 | ||
201 | /** | 201 | /** |
202 | Save calendar data to file. Return true if calendar could be | 202 | Save calendar data to file. Return true if calendar could be |
203 | successfully saved. | 203 | successfully saved. |
204 | */ | 204 | */ |
205 | bool saveCalendar(QString filename); | 205 | bool saveCalendar(QString filename); |
206 | 206 | ||
207 | /** | 207 | /** |
208 | Close calendar. Clear calendar data and reset views to display an empty | 208 | Close calendar. Clear calendar data and reset views to display an empty |
209 | calendar. | 209 | calendar. |
210 | */ | 210 | */ |
211 | void closeCalendar(); | 211 | void closeCalendar(); |
212 | 212 | ||
213 | /** Archive old events of calendar */ | 213 | /** Archive old events of calendar */ |
214 | void archiveCalendar(); | 214 | void archiveCalendar(); |
215 | 215 | ||
216 | void showIncidence(); | 216 | void showIncidence(); |
217 | void editIncidence(); | 217 | void editIncidence(); |
218 | void editIncidenceDescription(); | 218 | void editIncidenceDescription(); |
219 | void deleteIncidence(); | 219 | void deleteIncidence(); |
220 | void cloneIncidence(); | 220 | void cloneIncidence(); |
221 | void moveIncidence(); | 221 | void moveIncidence(); |
222 | void beamIncidence(); | 222 | void beamIncidence(); |
223 | void toggleCancelIncidence(); | 223 | void toggleCancelIncidence(); |
224 | 224 | ||
225 | /** create an editeventwin with supplied date/time, and if bool is true, | 225 | /** create an editeventwin with supplied date/time, and if bool is true, |
226 | * make the event take all day. */ | 226 | * make the event take all day. */ |
227 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 227 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
228 | void newEvent(QDateTime fh); | 228 | void newEvent(QDateTime fh); |
229 | void newEvent(QDate dt); | 229 | void newEvent(QDate dt); |
230 | /** create new event without having a date hint. Takes current date as | 230 | /** create new event without having a date hint. Takes current date as |
231 | default hint. */ | 231 | default hint. */ |
232 | void newEvent(); | 232 | void newEvent(); |
233 | void newFloatingEvent(); | 233 | void newFloatingEvent(); |
234 | 234 | ||
235 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 235 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
236 | void showIncidence(Incidence *); | 236 | void showIncidence(Incidence *); |
237 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 237 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
238 | void editIncidence(Incidence *); | 238 | void editIncidence(Incidence *); |
239 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 239 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
240 | void deleteIncidence(Incidence *); | 240 | void deleteIncidence(Incidence *); |
241 | void cloneIncidence(Incidence *); | 241 | void cloneIncidence(Incidence *); |
242 | void cancelIncidence(Incidence *); | 242 | void cancelIncidence(Incidence *); |
243 | /** Create an editor for the supplied event. */ | 243 | /** Create an editor for the supplied event. */ |
244 | void editEvent(Event *); | 244 | void editEvent(Event *); |
245 | /** Delete the supplied event. */ | 245 | /** Delete the supplied event. */ |
246 | void deleteEvent(Event *); | 246 | void deleteEvent(Event *); |
247 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 247 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
248 | found. */ | 248 | found. */ |
249 | bool deleteEvent(const QString &uid); | 249 | bool deleteEvent(const QString &uid); |
250 | /** Create a read-only viewer dialog for the supplied event. */ | 250 | /** Create a read-only viewer dialog for the supplied event. */ |
251 | void showEvent(Event *); | 251 | void showEvent(Event *); |
252 | 252 | ||
253 | void editJournal(Journal *); | 253 | void editJournal(Journal *); |
254 | void showJournal(Journal *); | 254 | void showJournal(Journal *); |
255 | void deleteJournal(Journal *); | 255 | void deleteJournal(Journal *); |
256 | /** Create an editor dialog for a todo */ | 256 | /** Create an editor dialog for a todo */ |
257 | void editTodo(Todo *); | 257 | void editTodo(Todo *); |
258 | /** Create a read-only viewer dialog for the supplied todo */ | 258 | /** Create a read-only viewer dialog for the supplied todo */ |
259 | void showTodo(Todo *); | 259 | void showTodo(Todo *); |
260 | /** create new todo */ | 260 | /** create new todo */ |
261 | void newTodo(); | 261 | void newTodo(); |
262 | /** create new todo with a parent todo */ | 262 | /** create new todo with a parent todo */ |
263 | void newSubTodo(); | 263 | void newSubTodo(); |
264 | /** create new todo with a parent todo */ | 264 | /** create new todo with a parent todo */ |
265 | void newSubTodo(Todo *); | 265 | void newSubTodo(Todo *); |
266 | /** Delete todo */ | 266 | /** Delete todo */ |
267 | void deleteTodo(Todo *); | 267 | void deleteTodo(Todo *); |
268 | 268 | ||
269 | 269 | ||
270 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 270 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
271 | * emitted as result. */ | 271 | * emitted as result. */ |
272 | void checkClipboard(); | 272 | void checkClipboard(); |
273 | 273 | ||
274 | /** using the KConfig associated with the kapp variable, read in the | 274 | /** using the KConfig associated with the kapp variable, read in the |
275 | * settings from the config file. | 275 | * settings from the config file. |
276 | */ | 276 | */ |
277 | void readSettings(); | 277 | void readSettings(); |
278 | 278 | ||
279 | /** write current state to config file. */ | 279 | /** write current state to config file. */ |
280 | void writeSettings(); | 280 | void writeSettings(); |
281 | 281 | ||
282 | /** read settings for calendar filters */ | 282 | /** read settings for calendar filters */ |
283 | void readFilterSettings(KConfig *config); | 283 | void readFilterSettings(KConfig *config); |
284 | 284 | ||
285 | /** write settings for calendar filters */ | 285 | /** write settings for calendar filters */ |
286 | void writeFilterSettings(KConfig *config); | 286 | void writeFilterSettings(KConfig *config); |
287 | 287 | ||
288 | /** passes on the message that an event has changed to the currently | 288 | /** passes on the message that an event has changed to the currently |
289 | * activated view so that it can make appropriate display changes. */ | 289 | * activated view so that it can make appropriate display changes. */ |
290 | void changeEventDisplay(Event *, int); | 290 | void changeEventDisplay(Event *, int); |
291 | void changeIncidenceDisplay(Incidence *, int); | 291 | void changeIncidenceDisplay(Incidence *, int); |
292 | void changeTodoDisplay(Todo *, int); | 292 | void changeTodoDisplay(Todo *, int); |
293 | 293 | ||
294 | void eventAdded(Event *); | 294 | void eventAdded(Event *); |
295 | void eventChanged(Event *); | 295 | void eventChanged(Event *); |
296 | void eventToBeDeleted(Event *); | 296 | void eventToBeDeleted(Event *); |
297 | void eventDeleted(); | 297 | void eventDeleted(); |
298 | 298 | ||
299 | void todoAdded(Todo *); | 299 | void todoAdded(Todo *); |
300 | void todoChanged(Todo *); | 300 | void todoChanged(Todo *); |
301 | void todoToBeDeleted(Todo *); | 301 | void todoToBeDeleted(Todo *); |
302 | void todoDeleted(); | 302 | void todoDeleted(); |
303 | 303 | ||
304 | void updateView(const QDate &start, const QDate &end); | 304 | void updateView(const QDate &start, const QDate &end); |
305 | void updateView(); | 305 | void updateView(); |
306 | 306 | ||
307 | /** Full update of visible todo views */ | 307 | /** Full update of visible todo views */ |
308 | void updateTodoViews(); | 308 | void updateTodoViews(); |
309 | 309 | ||
310 | void updateUnmanagedViews(); | 310 | void updateUnmanagedViews(); |
311 | 311 | ||
312 | /** cut the current appointment to the clipboard */ | 312 | /** cut the current appointment to the clipboard */ |
313 | void edit_cut(); | 313 | void edit_cut(); |
314 | 314 | ||
315 | /** copy the current appointment(s) to the clipboard */ | 315 | /** copy the current appointment(s) to the clipboard */ |
316 | void edit_copy(); | 316 | void edit_copy(); |
317 | 317 | ||
318 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 318 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
319 | void edit_paste(); | 319 | void edit_paste(); |
320 | 320 | ||
321 | /** edit viewing and configuration options. */ | 321 | /** edit viewing and configuration options. */ |
322 | void edit_options(); | 322 | void edit_options(); |
323 | /** | 323 | /** |
324 | Functions for printing, previewing a print, and setting up printing | 324 | Functions for printing, previewing a print, and setting up printing |
325 | parameters. | 325 | parameters. |
326 | */ | 326 | */ |
327 | void print(); | 327 | void print(); |
328 | void printSetup(); | 328 | void printSetup(); |
329 | void printPreview(); | 329 | void printPreview(); |
330 | 330 | ||
331 | /** Export as iCalendar file */ | 331 | /** Export as iCalendar file */ |
332 | void exportICalendar(); | 332 | void exportICalendar(); |
333 | 333 | ||
334 | /** Export as vCalendar file */ | 334 | /** Export as vCalendar file */ |
335 | bool exportVCalendar( QString fn); | 335 | bool exportVCalendar( QString fn); |
336 | 336 | ||
337 | /** pop up a dialog to show an existing appointment. */ | 337 | /** pop up a dialog to show an existing appointment. */ |
338 | void appointment_show(); | 338 | void appointment_show(); |
339 | /** | 339 | /** |
340 | * pop up an Appointment Dialog to edit an existing appointment.Get | 340 | * pop up an Appointment Dialog to edit an existing appointment.Get |
341 | * information on the appointment from the list of unique IDs that is | 341 | * information on the appointment from the list of unique IDs that is |
342 | * currently in the View, called currIds. | 342 | * currently in the View, called currIds. |
343 | */ | 343 | */ |
344 | void appointment_edit(); | 344 | void appointment_edit(); |
345 | /** | 345 | /** |
346 | * pop up dialog confirming deletion of currently selected event in the | 346 | * pop up dialog confirming deletion of currently selected event in the |
347 | * View. | 347 | * View. |
348 | */ | 348 | */ |
349 | void appointment_delete(); | 349 | void appointment_delete(); |
350 | 350 | ||
351 | /** mails the currently selected event to a particular user as a vCalendar | 351 | /** mails the currently selected event to a particular user as a vCalendar |
352 | attachment. */ | 352 | attachment. */ |
353 | void action_mail(); | 353 | void action_mail(); |
354 | 354 | ||
355 | /* frees a subtodo from it's relation */ | 355 | /* frees a subtodo from it's relation */ |
356 | void todo_unsub( Todo * ); | 356 | void todo_unsub( Todo * ); |
357 | void todo_resub( Todo * parent, Todo * sub ); | ||
357 | 358 | ||
358 | /** Take ownership of selected event. */ | 359 | /** Take ownership of selected event. */ |
359 | void takeOverEvent(); | 360 | void takeOverEvent(); |
360 | 361 | ||
361 | /** Take ownership of all events in calendar. */ | 362 | /** Take ownership of all events in calendar. */ |
362 | void takeOverCalendar(); | 363 | void takeOverCalendar(); |
363 | 364 | ||
364 | /** query whether or not the calendar is "dirty". */ | 365 | /** query whether or not the calendar is "dirty". */ |
365 | bool isModified(); | 366 | bool isModified(); |
366 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 367 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
367 | void setModified(bool modified=true); | 368 | void setModified(bool modified=true); |
368 | 369 | ||
369 | /** query if the calendar is read-only. */ | 370 | /** query if the calendar is read-only. */ |
370 | bool isReadOnly(); | 371 | bool isReadOnly(); |
371 | /** set state of calendar to read-only */ | 372 | /** set state of calendar to read-only */ |
372 | void setReadOnly(bool readOnly=true); | 373 | void setReadOnly(bool readOnly=true); |
373 | 374 | ||
374 | void eventUpdated(Incidence *); | 375 | void eventUpdated(Incidence *); |
375 | 376 | ||
376 | /* iTIP scheduling actions */ | 377 | /* iTIP scheduling actions */ |
377 | void schedule_publish(Incidence *incidence = 0); | 378 | void schedule_publish(Incidence *incidence = 0); |
378 | void schedule_request(Incidence *incidence = 0); | 379 | void schedule_request(Incidence *incidence = 0); |
379 | void schedule_refresh(Incidence *incidence = 0); | 380 | void schedule_refresh(Incidence *incidence = 0); |
380 | void schedule_cancel(Incidence *incidence = 0); | 381 | void schedule_cancel(Incidence *incidence = 0); |
381 | void schedule_add(Incidence *incidence = 0); | 382 | void schedule_add(Incidence *incidence = 0); |
382 | void schedule_reply(Incidence *incidence = 0); | 383 | void schedule_reply(Incidence *incidence = 0); |
383 | void schedule_counter(Incidence *incidence = 0); | 384 | void schedule_counter(Incidence *incidence = 0); |
384 | void schedule_declinecounter(Incidence *incidence = 0); | 385 | void schedule_declinecounter(Incidence *incidence = 0); |
385 | void schedule_publish_freebusy(int daysToPublish = 30); | 386 | void schedule_publish_freebusy(int daysToPublish = 30); |
386 | 387 | ||
387 | void openAddressbook(); | 388 | void openAddressbook(); |
388 | 389 | ||
389 | void editFilters(); | 390 | void editFilters(); |
390 | void toggleFilerEnabled(); | 391 | void toggleFilerEnabled(); |
391 | QPtrList<CalFilter> filters(); | 392 | QPtrList<CalFilter> filters(); |
392 | void toggleFilter(); | 393 | void toggleFilter(); |
393 | void showFilter(bool visible); | 394 | void showFilter(bool visible); |
394 | void updateFilter(); | 395 | void updateFilter(); |
395 | void filterEdited(); | 396 | void filterEdited(); |
396 | void selectFilter( int ); | 397 | void selectFilter( int ); |
397 | KOFilterView *filterView(); | 398 | KOFilterView *filterView(); |
398 | 399 | ||
399 | void showIntro(); | 400 | void showIntro(); |
400 | 401 | ||
401 | /** Move the curdatepient view date to today */ | 402 | /** Move the curdatepient view date to today */ |
402 | void goToday(); | 403 | void goToday(); |
403 | 404 | ||
404 | /** Move to the next date(s) in the current view */ | 405 | /** Move to the next date(s) in the current view */ |
405 | void goNext(); | 406 | void goNext(); |
406 | 407 | ||
407 | /** Move to the previous date(s) in the current view */ | 408 | /** Move to the previous date(s) in the current view */ |
408 | void goPrevious(); | 409 | void goPrevious(); |
409 | /** Move to the next date(s) in the current view */ | 410 | /** Move to the next date(s) in the current view */ |
410 | void goNextMonth(); | 411 | void goNextMonth(); |
411 | 412 | ||
412 | /** Move to the previous date(s) in the current view */ | 413 | /** Move to the previous date(s) in the current view */ |
413 | void goPreviousMonth(); | 414 | void goPreviousMonth(); |
414 | 415 | ||
415 | void toggleExpand(); | 416 | void toggleExpand(); |
416 | void toggleDateNavigatorWidget(); | 417 | void toggleDateNavigatorWidget(); |
417 | void toggleAllDaySize(); | 418 | void toggleAllDaySize(); |
418 | void dialogClosing(Incidence *); | 419 | void dialogClosing(Incidence *); |
419 | 420 | ||
420 | /** Look for new messages in the inbox */ | 421 | /** Look for new messages in the inbox */ |
421 | void lookForIncomingMessages(); | 422 | void lookForIncomingMessages(); |
422 | /** Look for new messages in the outbox */ | 423 | /** Look for new messages in the outbox */ |
423 | void lookForOutgoingMessages(); | 424 | void lookForOutgoingMessages(); |
424 | 425 | ||
425 | void processMainViewSelection( Incidence * ); | 426 | void processMainViewSelection( Incidence * ); |
426 | void processTodoListSelection( Incidence * ); | 427 | void processTodoListSelection( Incidence * ); |
427 | 428 | ||
428 | void processIncidenceSelection( Incidence * ); | 429 | void processIncidenceSelection( Incidence * ); |
429 | 430 | ||
430 | void purgeCompleted(); | 431 | void purgeCompleted(); |
431 | bool removeCompletedSubTodos( Todo* ); | 432 | bool removeCompletedSubTodos( Todo* ); |
432 | void slotCalendarChanged(); | 433 | void slotCalendarChanged(); |
433 | bool importBday(); | 434 | bool importBday(); |
434 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 435 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
435 | bool importQtopia( const QString &categoriesFile, | 436 | bool importQtopia( const QString &categoriesFile, |
436 | const QString &datebookFile, | 437 | const QString &datebookFile, |
437 | const QString &tasklistFile ); | 438 | const QString &tasklistFile ); |
438 | void syncExternal( int mode ); | 439 | void syncExternal( int mode ); |
439 | void slotSelectPickerDate( QDate ) ; | 440 | void slotSelectPickerDate( QDate ) ; |
440 | void showDatePicker( ) ; | 441 | void showDatePicker( ) ; |
441 | void moveIncidence(Incidence *) ; | 442 | void moveIncidence(Incidence *) ; |
442 | void beamIncidence(Incidence *) ; | 443 | void beamIncidence(Incidence *) ; |
443 | void beamCalendar() ; | 444 | void beamCalendar() ; |
444 | void beamFilteredCalendar() ; | 445 | void beamFilteredCalendar() ; |
445 | void beamIncidenceList(QPtrList<Incidence>) ; | 446 | void beamIncidenceList(QPtrList<Incidence>) ; |
446 | void manageCategories(); | 447 | void manageCategories(); |
447 | int addCategories(); | 448 | int addCategories(); |
448 | void removeCategories(); | 449 | void removeCategories(); |
449 | void setSyncDevice( QString ); | 450 | void setSyncDevice( QString ); |
450 | void setSyncName( QString ); | 451 | void setSyncName( QString ); |
451 | protected slots: | 452 | protected slots: |
452 | void timerAlarm(); | 453 | void timerAlarm(); |
453 | void suspendAlarm(); | 454 | void suspendAlarm(); |
454 | void beamDone( Ir *ir ); | 455 | void beamDone( Ir *ir ); |
455 | /** Select a view or adapt the current view to display the specified dates. */ | 456 | /** Select a view or adapt the current view to display the specified dates. */ |
456 | void showDates( const KCal::DateList & ); | 457 | void showDates( const KCal::DateList & ); |
457 | void selectWeekNum ( int ); | 458 | void selectWeekNum ( int ); |
458 | 459 | ||
459 | public: | 460 | public: |
460 | // show a standard warning | 461 | // show a standard warning |
461 | // returns KMsgBox::yesNoCancel() | 462 | // returns KMsgBox::yesNoCancel() |
462 | int msgCalModified(); | 463 | int msgCalModified(); |
463 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 464 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
464 | 465 | ||
465 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 466 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
466 | void setSyncManager(KSyncManager* manager); | 467 | void setSyncManager(KSyncManager* manager); |
467 | void setLoadedFileVersion(QDateTime); | 468 | void setLoadedFileVersion(QDateTime); |
468 | bool checkFileVersion(QString fn); | 469 | bool checkFileVersion(QString fn); |
469 | bool checkFileChanged(QString fn); | 470 | bool checkFileChanged(QString fn); |
470 | Event* getLastSyncEvent(); | 471 | Event* getLastSyncEvent(); |
471 | /** Adapt navigation units correpsonding to step size of navigation of the | 472 | /** Adapt navigation units correpsonding to step size of navigation of the |
472 | * current view. | 473 | * current view. |
473 | */ | 474 | */ |
474 | void adaptNavigationUnits(); | 475 | void adaptNavigationUnits(); |
475 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 476 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
476 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 477 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
477 | //Attendee* getYourAttendee(Event *event); | 478 | //Attendee* getYourAttendee(Event *event); |
478 | protected: | 479 | protected: |
479 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 480 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
480 | 481 | ||
481 | // returns KMsgBox::OKCandel() | 482 | // returns KMsgBox::OKCandel() |
482 | int msgItemDelete(); | 483 | int msgItemDelete(); |
483 | void showEventEditor(); | 484 | void showEventEditor(); |
484 | void showTodoEditor(); | 485 | void showTodoEditor(); |
485 | void writeLocale(); | 486 | void writeLocale(); |
486 | Todo *selectedTodo(); | 487 | Todo *selectedTodo(); |
487 | 488 | ||
488 | private: | 489 | private: |
489 | KSyncManager* mSyncManager; | 490 | KSyncManager* mSyncManager; |
490 | AlarmDialog * mAlarmDialog; | 491 | AlarmDialog * mAlarmDialog; |
491 | QString mAlarmNotification; | 492 | QString mAlarmNotification; |
492 | QString mSuspendAlarmNotification; | 493 | QString mSuspendAlarmNotification; |
493 | QTimer* mSuspendTimer; | 494 | QTimer* mSuspendTimer; |
494 | QTimer* mAlarmTimer; | 495 | QTimer* mAlarmTimer; |
495 | QTimer* mRecheckAlarmTimer; | 496 | QTimer* mRecheckAlarmTimer; |
496 | void computeAlarm( QString ); | 497 | void computeAlarm( QString ); |
497 | void startAlarm( QString, QString ); | 498 | void startAlarm( QString, QString ); |
498 | void setSyncEventsReadOnly(); | 499 | void setSyncEventsReadOnly(); |
499 | 500 | ||
500 | QDateTime loadedFileVersion; | 501 | QDateTime loadedFileVersion; |
501 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 502 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
502 | void checkExternalId( Incidence * inc ); | 503 | void checkExternalId( Incidence * inc ); |
503 | int mGlobalSyncMode; | 504 | int mGlobalSyncMode; |
504 | QString mCurrentSyncDevice; | 505 | QString mCurrentSyncDevice; |
505 | QString mCurrentSyncName; | 506 | QString mCurrentSyncName; |
506 | KOBeamPrefs* beamDialog; | 507 | KOBeamPrefs* beamDialog; |
507 | void init(); | 508 | void init(); |
508 | int mDatePickerMode; | 509 | int mDatePickerMode; |
509 | bool mFlagEditDescription; | 510 | bool mFlagEditDescription; |
510 | QDateTime mLastCalendarSync; | 511 | QDateTime mLastCalendarSync; |
511 | void createPrinter(); | 512 | void createPrinter(); |
512 | 513 | ||
513 | void calendarModified( bool, Calendar * ); | 514 | void calendarModified( bool, Calendar * ); |
514 | 515 | ||
515 | CalPrinter *mCalPrinter; | 516 | CalPrinter *mCalPrinter; |
516 | 517 | ||
517 | QSplitter *mPanner; | 518 | QSplitter *mPanner; |
518 | QSplitter *mLeftSplitter; | 519 | QSplitter *mLeftSplitter; |
519 | QWidget *mLeftFrame; | 520 | QWidget *mLeftFrame; |
520 | QWidgetStack *mRightFrame; | 521 | QWidgetStack *mRightFrame; |
521 | 522 | ||
522 | KDatePicker* mDatePicker; | 523 | KDatePicker* mDatePicker; |
523 | QVBox* mDateFrame; | 524 | QVBox* mDateFrame; |
524 | NavigatorBar *mNavigatorBar; | 525 | NavigatorBar *mNavigatorBar; |
525 | 526 | ||
526 | KDateNavigator *mDateNavigator; // widget showing small month view. | 527 | KDateNavigator *mDateNavigator; // widget showing small month view. |
527 | 528 | ||
528 | KOFilterView *mFilterView; | 529 | KOFilterView *mFilterView; |
529 | 530 | ||
530 | ResourceView *mResourceView; | 531 | ResourceView *mResourceView; |
531 | 532 | ||
532 | // calendar object for this viewing instance | 533 | // calendar object for this viewing instance |
533 | Calendar *mCalendar; | 534 | Calendar *mCalendar; |
534 | 535 | ||
535 | CalendarResourceManager *mResourceManager; | 536 | CalendarResourceManager *mResourceManager; |
536 | 537 | ||
537 | FileStorage *mStorage; | 538 | FileStorage *mStorage; |
538 | 539 | ||
539 | DateNavigator *mNavigator; | 540 | DateNavigator *mNavigator; |
540 | 541 | ||
541 | KOViewManager *mViewManager; | 542 | KOViewManager *mViewManager; |
542 | KODialogManager *mDialogManager; | 543 | KODialogManager *mDialogManager; |
543 | 544 | ||
544 | // Calendar filters | 545 | // Calendar filters |
545 | QPtrList<CalFilter> mFilters; | 546 | QPtrList<CalFilter> mFilters; |
546 | 547 | ||
547 | // various housekeeping variables. | 548 | // various housekeeping variables. |
548 | bool mModified; // flag indicating if calendar is modified | 549 | bool mModified; // flag indicating if calendar is modified |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index ca5eadd..a8143a0 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -22,1015 +22,1095 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | 27 | ||
28 | #include <qvbox.h> | 28 | #include <qvbox.h> |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include "koprefs.h" | 30 | #include "koprefs.h" |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 34 | #include <kmessagebox.h> |
35 | 35 | ||
36 | #include <libkcal/icaldrag.h> | 36 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/vcaldrag.h> | 37 | #include <libkcal/vcaldrag.h> |
38 | #include <libkcal/calfilter.h> | 38 | #include <libkcal/calfilter.h> |
39 | #include <libkcal/dndfactory.h> | 39 | #include <libkcal/dndfactory.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <kresources/resourceselectdialog.h> | 42 | #include <kresources/resourceselectdialog.h> |
43 | #ifndef DESKTOP_VERSION | 43 | #ifndef DESKTOP_VERSION |
44 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
45 | #else | 45 | #else |
46 | #include <qapplication.h> | 46 | #include <qapplication.h> |
47 | #endif | 47 | #endif |
48 | #ifndef KORG_NOPRINTER | 48 | #ifndef KORG_NOPRINTER |
49 | #include "calprinter.h" | 49 | #include "calprinter.h" |
50 | #endif | 50 | #endif |
51 | #include "docprefs.h" | 51 | #include "docprefs.h" |
52 | 52 | ||
53 | #include "kotodoview.h" | 53 | #include "kotodoview.h" |
54 | using namespace KOrg; | 54 | using namespace KOrg; |
55 | 55 | ||
56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
57 | const char *name) : | 57 | const char *name) : |
58 | KListView(parent,name) | 58 | KListView(parent,name) |
59 | { | 59 | { |
60 | mName = QString ( name ); | 60 | mName = QString ( name ); |
61 | mCalendar = calendar; | 61 | mCalendar = calendar; |
62 | #ifndef DESKTOP_VERSION | 62 | #ifndef DESKTOP_VERSION |
63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
64 | #endif | 64 | #endif |
65 | mOldCurrent = 0; | 65 | mOldCurrent = 0; |
66 | mMousePressed = false; | 66 | mMousePressed = false; |
67 | 67 | ||
68 | setAcceptDrops(true); | 68 | setAcceptDrops(true); |
69 | viewport()->setAcceptDrops(true); | 69 | viewport()->setAcceptDrops(true); |
70 | int size = 16; | 70 | int size = 16; |
71 | if (qApp->desktop()->width() < 300 ) | 71 | if (qApp->desktop()->width() < 300 ) |
72 | size = 12; | 72 | size = 12; |
73 | setTreeStepSize( size + 6 ); | 73 | setTreeStepSize( size + 6 ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
78 | { | 78 | { |
79 | #ifndef KORG_NODND | 79 | #ifndef KORG_NODND |
80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
82 | !QTextDrag::canDecode( e ) ) { | 82 | !QTextDrag::canDecode( e ) ) { |
83 | e->ignore(); | 83 | e->ignore(); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | mOldCurrent = currentItem(); | 87 | mOldCurrent = currentItem(); |
88 | #endif | 88 | #endif |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
93 | { | 93 | { |
94 | #ifndef KORG_NODND | 94 | #ifndef KORG_NODND |
95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
96 | 96 | ||
97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
98 | !QTextDrag::canDecode( e ) ) { | 98 | !QTextDrag::canDecode( e ) ) { |
99 | e->ignore(); | 99 | e->ignore(); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | e->accept(); | 103 | e->accept(); |
104 | #endif | 104 | #endif |
105 | } | 105 | } |
106 | 106 | ||
107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
108 | { | 108 | { |
109 | #ifndef KORG_NODND | 109 | #ifndef KORG_NODND |
110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
111 | 111 | ||
112 | setCurrentItem(mOldCurrent); | 112 | setCurrentItem(mOldCurrent); |
113 | setSelected(mOldCurrent,true); | 113 | setSelected(mOldCurrent,true); |
114 | #endif | 114 | #endif |
115 | } | 115 | } |
116 | 116 | ||
117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
118 | { | 118 | { |
119 | #ifndef KORG_NODND | 119 | #ifndef KORG_NODND |
120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
121 | 121 | ||
122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
123 | !QTextDrag::canDecode( e ) ) { | 123 | !QTextDrag::canDecode( e ) ) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | return; | 125 | return; |
126 | } | 126 | } |
127 | 127 | ||
128 | DndFactory factory( mCalendar ); | 128 | DndFactory factory( mCalendar ); |
129 | Todo *todo = factory.createDropTodo(e); | 129 | Todo *todo = factory.createDropTodo(e); |
130 | 130 | ||
131 | if (todo) { | 131 | if (todo) { |
132 | e->acceptAction(); | 132 | e->acceptAction(); |
133 | 133 | ||
134 | KOTodoViewItem *destination = | 134 | KOTodoViewItem *destination = |
135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
136 | Todo *destinationEvent = 0; | 136 | Todo *destinationEvent = 0; |
137 | if (destination) destinationEvent = destination->todo(); | 137 | if (destination) destinationEvent = destination->todo(); |
138 | 138 | ||
139 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 139 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
140 | 140 | ||
141 | if(existingTodo) { | 141 | if(existingTodo) { |
142 | // kdDebug() << "Drop existing Todo" << endl; | 142 | // kdDebug() << "Drop existing Todo" << endl; |
143 | Incidence *to = destinationEvent; | 143 | Incidence *to = destinationEvent; |
144 | while(to) { | 144 | while(to) { |
145 | if (to->uid() == todo->uid()) { | 145 | if (to->uid() == todo->uid()) { |
146 | KMessageBox::sorry(this, | 146 | KMessageBox::sorry(this, |
147 | i18n("Cannot move To-Do to itself or a child of itself"), | 147 | i18n("Cannot move To-Do to itself or a child of itself"), |
148 | i18n("Drop To-Do")); | 148 | i18n("Drop To-Do")); |
149 | delete todo; | 149 | delete todo; |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | to = to->relatedTo(); | 152 | to = to->relatedTo(); |
153 | } | 153 | } |
154 | existingTodo->setRelatedTo(destinationEvent); | 154 | existingTodo->setRelatedTo(destinationEvent); |
155 | emit todoDropped(todo); | 155 | emit todoDropped(todo); |
156 | delete todo; | 156 | delete todo; |
157 | } else { | 157 | } else { |
158 | // kdDebug() << "Drop new Todo" << endl; | 158 | // kdDebug() << "Drop new Todo" << endl; |
159 | todo->setRelatedTo(destinationEvent); | 159 | todo->setRelatedTo(destinationEvent); |
160 | mCalendar->addTodo(todo); | 160 | mCalendar->addTodo(todo); |
161 | 161 | ||
162 | emit todoDropped(todo); | 162 | emit todoDropped(todo); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | else { | 165 | else { |
166 | QString text; | 166 | QString text; |
167 | if (QTextDrag::decode(e,text)) { | 167 | if (QTextDrag::decode(e,text)) { |
168 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 168 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
169 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 169 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
170 | kdDebug() << "Dropped : " << text << endl; | 170 | kdDebug() << "Dropped : " << text << endl; |
171 | QStringList emails = QStringList::split(",",text); | 171 | QStringList emails = QStringList::split(",",text); |
172 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 172 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
173 | kdDebug() << " Email: " << (*it) << endl; | 173 | kdDebug() << " Email: " << (*it) << endl; |
174 | int pos = (*it).find("<"); | 174 | int pos = (*it).find("<"); |
175 | QString name = (*it).left(pos); | 175 | QString name = (*it).left(pos); |
176 | QString email = (*it).mid(pos); | 176 | QString email = (*it).mid(pos); |
177 | if (!email.isEmpty() && todoi) { | 177 | if (!email.isEmpty() && todoi) { |
178 | todoi->todo()->addAttendee(new Attendee(name,email)); | 178 | todoi->todo()->addAttendee(new Attendee(name,email)); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | } | 181 | } |
182 | else { | 182 | else { |
183 | kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; | 183 | kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; |
184 | e->ignore(); | 184 | e->ignore(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | } | 188 | } |
189 | 189 | ||
190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
191 | { | 191 | { |
192 | QListView::contentsMousePressEvent(e); | 192 | QListView::contentsMousePressEvent(e); |
193 | #ifndef KORG_NODND | 193 | #ifndef KORG_NODND |
194 | QPoint p(contentsToViewport(e->pos())); | 194 | QPoint p(contentsToViewport(e->pos())); |
195 | QListViewItem *i = itemAt(p); | 195 | QListViewItem *i = itemAt(p); |
196 | if (i) { | 196 | if (i) { |
197 | // if the user clicked into the root decoration of the item, don't | 197 | // if the user clicked into the root decoration of the item, don't |
198 | // try to start a drag! | 198 | // try to start a drag! |
199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | 199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + |
200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
201 | itemMargin() || | 201 | itemMargin() || |
202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | 202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { |
203 | if (e->button()==Qt::LeftButton) { | 203 | if (e->button()==Qt::LeftButton) { |
204 | mPressPos = e->pos(); | 204 | mPressPos = e->pos(); |
205 | mMousePressed = true; | 205 | mMousePressed = true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | #endif | 209 | #endif |
210 | } | 210 | } |
211 | 211 | ||
212 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 212 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
213 | { | 213 | { |
214 | |||
214 | #ifndef KORG_NODND | 215 | #ifndef KORG_NODND |
215 | // kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; | 216 | // kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; |
216 | QListView::contentsMouseMoveEvent(e); | 217 | QListView::contentsMouseMoveEvent(e); |
217 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
218 | QApplication::startDragDistance()) { | 219 | QApplication::startDragDistance()) { |
219 | mMousePressed = false; | 220 | mMousePressed = false; |
220 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
221 | if (item) { | 222 | if (item) { |
222 | // kdDebug() << "Start Drag for item " << item->text(0) << endl; | 223 | // kdDebug() << "Start Drag for item " << item->text(0) << endl; |
223 | DndFactory factory( mCalendar ); | 224 | DndFactory factory( mCalendar ); |
224 | ICalDrag *vd = factory.createDragTodo( | 225 | ICalDrag *vd = factory.createDragTodo( |
225 | ((KOTodoViewItem *)item)->todo(),viewport()); | 226 | ((KOTodoViewItem *)item)->todo(),viewport()); |
226 | if (vd->drag()) { | 227 | if (vd->drag()) { |
227 | kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; | 228 | kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; |
228 | } | 229 | } |
229 | /* | 230 | /* |
230 | QString source = fullPath(item); | 231 | QString source = fullPath(item); |
231 | if ( QFile::exists(source) ) { | 232 | if ( QFile::exists(source) ) { |
232 | QUriDrag* ud = new QUriDrag(viewport()); | 233 | QUriDrag* ud = new QUriDrag(viewport()); |
233 | ud->setFilenames( source ); | 234 | ud->setFilenames( source ); |
234 | if ( ud->drag() ) | 235 | if ( ud->drag() ) |
235 | QMessageBox::information( this, "Drag source", | 236 | QMessageBox::information( this, "Drag source", |
236 | QString("Delete ")+source, "Not implemented" ); | 237 | QString("Delete ")+source, "Not implemented" ); |
237 | */ | 238 | */ |
238 | } | 239 | } |
239 | } | 240 | } |
240 | #endif | 241 | #endif |
241 | } | 242 | } |
242 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 243 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
243 | { | 244 | { |
244 | 245 | ||
245 | QListViewItem* cn; | 246 | QListViewItem* cn; |
246 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 247 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
247 | cn = currentItem(); | 248 | cn = currentItem(); |
248 | if ( cn ) { | 249 | if ( cn ) { |
249 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 250 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
250 | if ( ci ){ | 251 | if ( ci ){ |
251 | if ( e->state() == ShiftButton ) | 252 | if ( e->state() == ShiftButton ) |
252 | ci->setOn( false ); | 253 | ci->setOn( false ); |
253 | else | 254 | else |
254 | ci->setOn( true ); | 255 | ci->setOn( true ); |
255 | cn = cn->nextSibling(); | 256 | cn = cn->nextSibling(); |
256 | if ( cn ) { | 257 | if ( cn ) { |
257 | setCurrentItem ( cn ); | 258 | setCurrentItem ( cn ); |
258 | ensureItemVisible ( cn ); | 259 | ensureItemVisible ( cn ); |
259 | } | 260 | } |
260 | 261 | ||
261 | } | 262 | } |
262 | } | 263 | } |
263 | 264 | ||
264 | return; | 265 | return; |
265 | } | 266 | } |
266 | 267 | ||
267 | // qDebug("KOTodoListView::keyPressEvent "); | 268 | // qDebug("KOTodoListView::keyPressEvent "); |
268 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 269 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
269 | switch ( e->key() ) { | 270 | switch ( e->key() ) { |
270 | case Qt::Key_Down: | 271 | case Qt::Key_Down: |
271 | case Qt::Key_Up: | 272 | case Qt::Key_Up: |
272 | QListView::keyPressEvent ( e ); | 273 | QListView::keyPressEvent ( e ); |
273 | break; | 274 | break; |
274 | case Qt::Key_Left: | 275 | case Qt::Key_Left: |
275 | case Qt::Key_Right: | 276 | case Qt::Key_Right: |
276 | QListView::keyPressEvent ( e ); | 277 | QListView::keyPressEvent ( e ); |
278 | e->accept(); | ||
279 | return; | ||
277 | break; | 280 | break; |
278 | default: | 281 | default: |
279 | e->ignore(); | 282 | e->ignore(); |
280 | break; | 283 | break; |
281 | } | 284 | } |
282 | return; | 285 | return; |
283 | } | 286 | } |
284 | e->ignore(); | 287 | e->ignore(); |
285 | } | 288 | } |
286 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 289 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
287 | { | 290 | { |
288 | QListView::contentsMouseReleaseEvent(e); | 291 | QListView::contentsMouseReleaseEvent(e); |
289 | mMousePressed = false; | 292 | mMousePressed = false; |
290 | } | 293 | } |
291 | 294 | ||
292 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 295 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
293 | { | 296 | { |
294 | if (!e) return; | 297 | if (!e) return; |
295 | 298 | ||
296 | QPoint vp = contentsToViewport(e->pos()); | 299 | QPoint vp = contentsToViewport(e->pos()); |
297 | 300 | ||
298 | QListViewItem *item = itemAt(vp); | 301 | QListViewItem *item = itemAt(vp); |
299 | 302 | ||
300 | emit double_Clicked(item); | 303 | emit double_Clicked(item); |
301 | if (!item) return; | 304 | if (!item) return; |
302 | 305 | ||
303 | emit doubleClicked(item,vp,0); | 306 | emit doubleClicked(item,vp,0); |
304 | } | 307 | } |
305 | 308 | ||
306 | ///////////////////////////////////////////////////////////////////////////// | 309 | ///////////////////////////////////////////////////////////////////////////// |
307 | 310 | ||
308 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 311 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
309 | QLineEdit(parent) | 312 | QLineEdit(parent) |
310 | { | 313 | { |
311 | setText(i18n("Click to add a new Todo")); | 314 | setText(i18n("Click to add a new Todo")); |
312 | } | 315 | } |
313 | 316 | ||
314 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 317 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
315 | { | 318 | { |
316 | if ( text()==i18n("Click to add a new Todo") ) | 319 | if ( text()==i18n("Click to add a new Todo") ) |
317 | setText(""); | 320 | setText(""); |
318 | QLineEdit::focusInEvent(ev); | 321 | QLineEdit::focusInEvent(ev); |
319 | } | 322 | } |
320 | 323 | ||
321 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 324 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
322 | { | 325 | { |
323 | setText(i18n("Click to add a new Todo")); | 326 | setText(i18n("Click to add a new Todo")); |
324 | QLineEdit::focusOutEvent(ev); | 327 | QLineEdit::focusOutEvent(ev); |
325 | } | 328 | } |
326 | 329 | ||
327 | ///////////////////////////////////////////////////////////////////////////// | 330 | ///////////////////////////////////////////////////////////////////////////// |
328 | 331 | ||
329 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 332 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
330 | KOrg::BaseView(calendar,parent,name) | 333 | KOrg::BaseView(calendar,parent,name) |
331 | { | 334 | { |
332 | QBoxLayout *topLayout = new QVBoxLayout(this); | 335 | QBoxLayout *topLayout = new QVBoxLayout(this); |
333 | mName = QString ( name ); | 336 | mName = QString ( name ); |
334 | mBlockUpdate = false; | 337 | mBlockUpdate = false; |
335 | mQuickAdd = new KOQuickTodo(this); | 338 | mQuickAdd = new KOQuickTodo(this); |
336 | topLayout->addWidget(mQuickAdd); | 339 | topLayout->addWidget(mQuickAdd); |
337 | 340 | ||
338 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 341 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
339 | 342 | ||
340 | mTodoListView = new KOTodoListView(calendar,this, name ); | 343 | mTodoListView = new KOTodoListView(calendar,this, name ); |
341 | topLayout->addWidget(mTodoListView); | 344 | topLayout->addWidget(mTodoListView); |
342 | //mTodoListView->header()->setMaximumHeight(30); | 345 | //mTodoListView->header()->setMaximumHeight(30); |
343 | mTodoListView->setRootIsDecorated(true); | 346 | mTodoListView->setRootIsDecorated(true); |
344 | mTodoListView->setAllColumnsShowFocus(true); | 347 | mTodoListView->setAllColumnsShowFocus(true); |
345 | 348 | ||
346 | mTodoListView->setShowSortIndicator(true); | 349 | mTodoListView->setShowSortIndicator(true); |
347 | 350 | ||
348 | mTodoListView->addColumn(i18n("Todo")); | 351 | mTodoListView->addColumn(i18n("Todo")); |
349 | mTodoListView->addColumn(i18n("Prio")); | 352 | mTodoListView->addColumn(i18n("Prio")); |
350 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 353 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
351 | mTodoListView->addColumn(i18n("Complete")); | 354 | mTodoListView->addColumn(i18n("Complete")); |
352 | mTodoListView->setColumnAlignment(2,AlignHCenter); | 355 | mTodoListView->setColumnAlignment(2,AlignHCenter); |
353 | mTodoListView->addColumn(i18n("Due Date")); | 356 | mTodoListView->addColumn(i18n("Due Date")); |
354 | mTodoListView->setColumnAlignment(3,AlignLeft); | 357 | mTodoListView->setColumnAlignment(3,AlignLeft); |
355 | mTodoListView->addColumn(i18n("Due Time")); | 358 | mTodoListView->addColumn(i18n("Due Time")); |
356 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 359 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
357 | mTodoListView->addColumn(i18n("Cancelled")); | 360 | mTodoListView->addColumn(i18n("Cancelled")); |
358 | mTodoListView->addColumn(i18n("Categories")); | 361 | mTodoListView->addColumn(i18n("Categories")); |
359 | #if 0 | 362 | #if 0 |
360 | mTodoListView->addColumn(i18n("Sort Id")); | 363 | mTodoListView->addColumn(i18n("Sort Id")); |
361 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 364 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
362 | #endif | 365 | #endif |
363 | 366 | ||
364 | mTodoListView->setMinimumHeight( 60 ); | 367 | mTodoListView->setMinimumHeight( 60 ); |
365 | mTodoListView->setItemsRenameable( true ); | 368 | mTodoListView->setItemsRenameable( true ); |
366 | mTodoListView->setRenameable( 0 ); | 369 | mTodoListView->setRenameable( 0 ); |
367 | mTodoListView->setColumnWidth( 0, 120 ); | 370 | mTodoListView->setColumnWidth( 0, 120 ); |
368 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 371 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
369 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 372 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
370 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 373 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
371 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 374 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
372 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 375 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
373 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 376 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
374 | mTodoListView->setColumnAlignment( 2, AlignCenter ); | 377 | mTodoListView->setColumnAlignment( 2, AlignCenter ); |
375 | #if 0 | 378 | #if 0 |
376 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 379 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
377 | #endif | 380 | #endif |
378 | 381 | ||
379 | mPriorityPopupMenu = new QPopupMenu(this); | 382 | mPriorityPopupMenu = new QPopupMenu(this); |
380 | for (int i = 1; i <= 5; i++) { | 383 | for (int i = 1; i <= 5; i++) { |
381 | QString label = QString ("%1").arg (i); | 384 | QString label = QString ("%1").arg (i); |
382 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 385 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
383 | } | 386 | } |
384 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 387 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
385 | 388 | ||
386 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 389 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
387 | for (int i = 0; i <= 100; i+=20) { | 390 | for (int i = 0; i <= 100; i+=20) { |
388 | QString label = QString ("%1 %").arg (i); | 391 | QString label = QString ("%1 %").arg (i); |
389 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 392 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
390 | } | 393 | } |
391 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 394 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
392 | 395 | ||
393 | 396 | ||
394 | 397 | ||
395 | mItemPopupMenu = new QPopupMenu(this); | 398 | mItemPopupMenu = new QPopupMenu(this); |
396 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 399 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
397 | SLOT (showTodo())); | 400 | SLOT (showTodo())); |
398 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 401 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
399 | SLOT (editTodo())); | 402 | SLOT (editTodo())); |
400 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 403 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
401 | SLOT (deleteTodo())); | 404 | SLOT (deleteTodo())); |
402 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 405 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
403 | SLOT (cloneTodo())); | 406 | SLOT (cloneTodo())); |
404 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 407 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
405 | SLOT (moveTodo())); | 408 | SLOT (moveTodo())); |
406 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 409 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
407 | SLOT (beamTodo())); | 410 | SLOT (beamTodo())); |
408 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 411 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
409 | SLOT (cancelTodo())); | 412 | SLOT (cancelTodo())); |
410 | mItemPopupMenu->insertSeparator(); | 413 | mItemPopupMenu->insertSeparator(); |
411 | 414 | ||
412 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 415 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
413 | SLOT (newTodo())); | 416 | SLOT (newTodo())); |
414 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 417 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
415 | SLOT (newSubTodo())); | 418 | SLOT (newSubTodo())); |
416 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 419 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
417 | SLOT (unparentTodo())); | 420 | SLOT (unparentTodo()),0,21); |
421 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | ||
422 | SLOT (reparentTodo()),0,22); | ||
418 | mItemPopupMenu->insertSeparator(); | 423 | mItemPopupMenu->insertSeparator(); |
419 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 424 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
420 | this, SLOT( purgeCompleted() ) ); | 425 | this, SLOT( purgeCompleted() ) ); |
421 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 426 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
422 | this, SLOT( toggleCompleted() ),0, 33 ); | 427 | this, SLOT( toggleCompleted() ),0, 33 ); |
423 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 428 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
424 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 429 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
425 | 430 | ||
426 | mPopupMenu = new QPopupMenu(this); | 431 | mPopupMenu = new QPopupMenu(this); |
427 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 432 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
428 | SLOT (newTodo()),0,1); | 433 | SLOT (newTodo()),0,1); |
429 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 434 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
430 | this, SLOT(purgeCompleted()),0,2); | 435 | this, SLOT(purgeCompleted()),0,2); |
431 | mPopupMenu->insertItem(i18n("Show Completed"), | 436 | mPopupMenu->insertItem(i18n("Show Completed"), |
432 | this, SLOT( toggleCompleted() ),0,3 ); | 437 | this, SLOT( toggleCompleted() ),0,3 ); |
433 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 438 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
434 | this, SLOT( toggleQuickTodo() ),0,4 ); | 439 | this, SLOT( toggleQuickTodo() ),0,4 ); |
435 | mDocPrefs = new DocPrefs( name ); | 440 | mDocPrefs = new DocPrefs( name ); |
436 | 441 | ||
437 | mPopupMenu->setCheckable( true ); | 442 | mPopupMenu->setCheckable( true ); |
438 | mItemPopupMenu->setCheckable( true ); | 443 | mItemPopupMenu->setCheckable( true ); |
439 | // Double clicking conflicts with opening/closing the subtree | 444 | // Double clicking conflicts with opening/closing the subtree |
440 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 445 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
441 | SLOT( editItem( QListViewItem *) ) ); | 446 | SLOT( editItem( QListViewItem *) ) ); |
447 | /* | ||
442 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 448 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
443 | const QPoint &,int ) ), | 449 | const QPoint &,int ) ), |
444 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 450 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
451 | */ | ||
452 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | ||
453 | const QPoint &,int ) ), | ||
454 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | ||
445 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 455 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
446 | SLOT( itemClicked( QListViewItem * ) ) ); | 456 | SLOT( itemClicked( QListViewItem * ) ) ); |
447 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 457 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
448 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 458 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
449 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), | 459 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), |
450 | SLOT( updateView() ) ); | 460 | SLOT( updateView() ) ); |
451 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 461 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
452 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 462 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
453 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 463 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
454 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 464 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
455 | 465 | ||
456 | #if 0 | 466 | #if 0 |
457 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 467 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
458 | SLOT(selectionChanged(QListViewItem *))); | 468 | SLOT(selectionChanged(QListViewItem *))); |
459 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 469 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
460 | SLOT(selectionChanged(QListViewItem *))); | 470 | SLOT(selectionChanged(QListViewItem *))); |
461 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 471 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
462 | SLOT(selectionChanged(QListViewItem *))); | 472 | SLOT(selectionChanged(QListViewItem *))); |
463 | #endif | 473 | #endif |
464 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 474 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
465 | SLOT( processSelectionChange() ) ); | 475 | SLOT( processSelectionChange() ) ); |
466 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 476 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
467 | SLOT( addQuickTodo() ) ); | 477 | SLOT( addQuickTodo() ) ); |
468 | // if ( QApplication::desktop()->width() < 480 ) { | 478 | // if ( QApplication::desktop()->width() < 480 ) { |
469 | // setNarrow(); | 479 | // setNarrow(); |
470 | // mTodoListView->setColumnWidth( 0, 100 ); | 480 | // mTodoListView->setColumnWidth( 0, 100 ); |
471 | 481 | ||
472 | // } | 482 | // } |
473 | 483 | ||
474 | } | 484 | } |
475 | 485 | ||
476 | KOTodoView::~KOTodoView() | 486 | KOTodoView::~KOTodoView() |
477 | { | 487 | { |
478 | delete mDocPrefs; | 488 | delete mDocPrefs; |
479 | } | 489 | } |
480 | 490 | ||
481 | void KOTodoView::jumpToDate () | 491 | void KOTodoView::jumpToDate () |
482 | { | 492 | { |
483 | // if (mActiveItem) { | 493 | // if (mActiveItem) { |
484 | // mActiveItem->todo()); | 494 | // mActiveItem->todo()); |
485 | // if ( mActiveItem->todo()->hasDueDate() ) | 495 | // if ( mActiveItem->todo()->hasDueDate() ) |
486 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 496 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
487 | } | 497 | } |
488 | 498 | ||
489 | void KOTodoView::setNarrow() | 499 | void KOTodoView::setNarrow() |
490 | { | 500 | { |
491 | //mTodoListView->setColumnWidth( 0, 120 ); | 501 | //mTodoListView->setColumnWidth( 0, 120 ); |
492 | mTodoListView->setColumnWidth( 1, 35 ); | 502 | mTodoListView->setColumnWidth( 1, 35 ); |
493 | mTodoListView->setColumnWidth( 2, 40 ); | 503 | mTodoListView->setColumnWidth( 2, 40 ); |
494 | mTodoListView->setColumnWidth( 3, 80 ); | 504 | mTodoListView->setColumnWidth( 3, 80 ); |
495 | mTodoListView->setColumnWidth( 4, 40 ); | 505 | mTodoListView->setColumnWidth( 4, 40 ); |
496 | mTodoListView->setColumnWidth( 5, 90 ); | 506 | mTodoListView->setColumnWidth( 5, 90 ); |
497 | 507 | ||
498 | } | 508 | } |
499 | void KOTodoView::updateView() | 509 | void KOTodoView::updateView() |
500 | { | 510 | { |
501 | 511 | ||
502 | if ( mBlockUpdate ) { | 512 | if ( mBlockUpdate ) { |
503 | //qDebug("blocked "); | 513 | //qDebug("blocked "); |
504 | return; | 514 | return; |
505 | } | 515 | } |
506 | //qDebug("update "); | 516 | //qDebug("update "); |
507 | // kdDebug() << "KOTodoView::updateView()" << endl; | 517 | // kdDebug() << "KOTodoView::updateView()" << endl; |
508 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 518 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
509 | mTodoListView->clear(); | 519 | mTodoListView->clear(); |
510 | if ( mName == "todolistsmall" ) { | 520 | if ( mName == "todolistsmall" ) { |
511 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 521 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
512 | int ps = fo.pointSize() -2; | 522 | int ps = fo.pointSize() -2; |
513 | if ( ps > 12 ) | 523 | if ( ps > 12 ) |
514 | ps -= 2; | 524 | ps -= 2; |
515 | fo.setPointSize( ps ); | 525 | fo.setPointSize( ps ); |
516 | } | 526 | } |
517 | } | 527 | } |
518 | 528 | ||
519 | mTodoListView->setFont( fo ); | 529 | mTodoListView->setFont( fo ); |
520 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 530 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
521 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 531 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
522 | QPtrList<Todo> todoList = calendar()->todos(); | 532 | QPtrList<Todo> todoList = calendar()->todos(); |
523 | 533 | ||
524 | /* | 534 | /* |
525 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 535 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
526 | Event *t; | 536 | Event *t; |
527 | for(t = todoList.first(); t; t = todoList.next()) { | 537 | for(t = todoList.first(); t; t = todoList.next()) { |
528 | kdDebug() << " " << t->getSummary() << endl; | 538 | kdDebug() << " " << t->getSummary() << endl; |
529 | 539 | ||
530 | if (t->getRelatedTo()) { | 540 | if (t->getRelatedTo()) { |
531 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 541 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
532 | } | 542 | } |
533 | 543 | ||
534 | QPtrList<Event> l = t->getRelations(); | 544 | QPtrList<Event> l = t->getRelations(); |
535 | Event *c; | 545 | Event *c; |
536 | for(c=l.first();c;c=l.next()) { | 546 | for(c=l.first();c;c=l.next()) { |
537 | kdDebug() << " - relation: " << c->getSummary() << endl; | 547 | kdDebug() << " - relation: " << c->getSummary() << endl; |
538 | } | 548 | } |
539 | } | 549 | } |
540 | */ | 550 | */ |
541 | 551 | ||
542 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 552 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
543 | // specific order of events. That means that we have to generate parent items | 553 | // specific order of events. That means that we have to generate parent items |
544 | // recursively for proper hierarchical display of Todos. | 554 | // recursively for proper hierarchical display of Todos. |
545 | mTodoMap.clear(); | 555 | mTodoMap.clear(); |
546 | Todo *todo; | 556 | Todo *todo; |
547 | todo = todoList.first();// todo; todo = todoList.next()) { | 557 | todo = todoList.first();// todo; todo = todoList.next()) { |
548 | while ( todo ) { | 558 | while ( todo ) { |
549 | bool next = true; | 559 | bool next = true; |
550 | // qDebug("todo %s ", todo->summary().latin1()); | 560 | // qDebug("todo %s ", todo->summary().latin1()); |
551 | Incidence *incidence = todo->relatedTo(); | 561 | Incidence *incidence = todo->relatedTo(); |
552 | while ( incidence ) { | 562 | while ( incidence ) { |
553 | if ( incidence->type() == "Todo") { | 563 | if ( incidence->type() == "Todo") { |
554 | //qDebug("related %s ",incidence->summary().latin1() ); | 564 | //qDebug("related %s ",incidence->summary().latin1() ); |
555 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 565 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
556 | //qDebug("related not found "); | 566 | //qDebug("related not found "); |
557 | todoList.remove( ); | 567 | todoList.remove( ); |
558 | todo = todoList.current(); | 568 | todo = todoList.current(); |
559 | next = false; | 569 | next = false; |
560 | incidence = 0; | 570 | incidence = 0; |
561 | 571 | ||
562 | } else { | 572 | } else { |
563 | //qDebug("related found "); | 573 | //qDebug("related found "); |
564 | incidence = incidence->relatedTo(); | 574 | incidence = incidence->relatedTo(); |
565 | } | 575 | } |
566 | } else | 576 | } else |
567 | incidence = 0; | 577 | incidence = 0; |
568 | } | 578 | } |
569 | if ( next ) | 579 | if ( next ) |
570 | todo = todoList.next(); | 580 | todo = todoList.next(); |
571 | } | 581 | } |
572 | // qDebug("again .... "); | 582 | // qDebug("again .... "); |
573 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 583 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
574 | 584 | ||
575 | // qDebug("yytodo %s ", todo->summary().latin1()); | 585 | // qDebug("yytodo %s ", todo->summary().latin1()); |
576 | // } | 586 | // } |
577 | //qDebug("for "); | 587 | //qDebug("for "); |
578 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 588 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
579 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) | 589 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) |
580 | { | 590 | { |
581 | insertTodoItem(todo); | 591 | insertTodoItem(todo); |
582 | } | 592 | } |
583 | } | 593 | } |
584 | //qDebug("for end "); | 594 | //qDebug("for end "); |
585 | // Restore opened/closed state | 595 | // Restore opened/closed state |
586 | mTodoListView->blockSignals( true ); | 596 | mTodoListView->blockSignals( true ); |
587 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 597 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
588 | mTodoListView->blockSignals( false ); | 598 | mTodoListView->blockSignals( false ); |
589 | mTodoListView->setFocus(); | 599 | mTodoListView->setFocus(); |
590 | processSelectionChange(); | 600 | processSelectionChange(); |
591 | } | 601 | } |
592 | 602 | ||
593 | void KOTodoView::restoreItemState( QListViewItem *item ) | 603 | void KOTodoView::restoreItemState( QListViewItem *item ) |
594 | { | 604 | { |
595 | while( item ) { | 605 | while( item ) { |
596 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 606 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
597 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 607 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
598 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 608 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
599 | item = item->nextSibling(); | 609 | item = item->nextSibling(); |
600 | } | 610 | } |
601 | } | 611 | } |
602 | 612 | ||
603 | 613 | ||
604 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 614 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
605 | KOTodoView::insertTodoItem(Todo *todo) | 615 | KOTodoView::insertTodoItem(Todo *todo) |
606 | { | 616 | { |
607 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 617 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
608 | // TODO: Check, if dynmaic cast is necessary | 618 | // TODO: Check, if dynmaic cast is necessary |
609 | 619 | ||
610 | 620 | ||
611 | Incidence *incidence = todo->relatedTo(); | 621 | Incidence *incidence = todo->relatedTo(); |
612 | if (incidence && incidence->type() == "Todo") { | 622 | if (incidence && incidence->type() == "Todo") { |
613 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 623 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
614 | 624 | ||
615 | // kdDebug() << " has Related" << endl; | 625 | // kdDebug() << " has Related" << endl; |
616 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 626 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
617 | itemIterator = mTodoMap.find(relatedTodo); | 627 | itemIterator = mTodoMap.find(relatedTodo); |
618 | if (itemIterator == mTodoMap.end()) { | 628 | if (itemIterator == mTodoMap.end()) { |
619 | // kdDebug() << " related not yet in list" << endl; | 629 | // kdDebug() << " related not yet in list" << endl; |
620 | itemIterator = insertTodoItem (relatedTodo); | 630 | itemIterator = insertTodoItem (relatedTodo); |
621 | } | 631 | } |
622 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 632 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
623 | // and one into the map. Sure finding is more easy but why? -zecke | 633 | // and one into the map. Sure finding is more easy but why? -zecke |
624 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 634 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
625 | return mTodoMap.insert(todo,todoItem); | 635 | return mTodoMap.insert(todo,todoItem); |
626 | } else { | 636 | } else { |
627 | // kdDebug() << " no Related" << endl; | 637 | // kdDebug() << " no Related" << endl; |
628 | // see above -zecke | 638 | // see above -zecke |
629 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 639 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
630 | return mTodoMap.insert(todo,todoItem); | 640 | return mTodoMap.insert(todo,todoItem); |
631 | } | 641 | } |
632 | } | 642 | } |
633 | 643 | ||
634 | 644 | ||
635 | void KOTodoView::updateConfig() | 645 | void KOTodoView::updateConfig() |
636 | { | 646 | { |
637 | updateView(); | 647 | updateView(); |
638 | mTodoListView->repaintContents(); | 648 | mTodoListView->repaintContents(); |
639 | } | 649 | } |
640 | 650 | ||
641 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 651 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
642 | { | 652 | { |
643 | QPtrList<Incidence> selected; | 653 | QPtrList<Incidence> selected; |
644 | 654 | ||
645 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 655 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
646 | // if (!item) item = mActiveItem; | 656 | // if (!item) item = mActiveItem; |
647 | if (item) selected.append(item->todo()); | 657 | if (item) selected.append(item->todo()); |
648 | 658 | ||
649 | return selected; | 659 | return selected; |
650 | } | 660 | } |
651 | 661 | ||
652 | QPtrList<Todo> KOTodoView::selectedTodos() | 662 | QPtrList<Todo> KOTodoView::selectedTodos() |
653 | { | 663 | { |
654 | QPtrList<Todo> selected; | 664 | QPtrList<Todo> selected; |
655 | 665 | ||
656 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 666 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
657 | // if (!item) item = mActiveItem; | 667 | // if (!item) item = mActiveItem; |
658 | if (item) selected.append(item->todo()); | 668 | if (item) selected.append(item->todo()); |
659 | 669 | ||
660 | return selected; | 670 | return selected; |
661 | } | 671 | } |
662 | 672 | ||
663 | void KOTodoView::changeEventDisplay(Event *, int) | 673 | void KOTodoView::changeEventDisplay(Event *, int) |
664 | { | 674 | { |
665 | updateView(); | 675 | updateView(); |
666 | } | 676 | } |
667 | 677 | ||
668 | void KOTodoView::showDates(const QDate &, const QDate &) | 678 | void KOTodoView::showDates(const QDate &, const QDate &) |
669 | { | 679 | { |
670 | } | 680 | } |
671 | 681 | ||
672 | void KOTodoView::showEvents(QPtrList<Event>) | 682 | void KOTodoView::showEvents(QPtrList<Event>) |
673 | { | 683 | { |
674 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 684 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
675 | } | 685 | } |
676 | 686 | ||
677 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 687 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
678 | const QDate &td) | 688 | const QDate &td) |
679 | { | 689 | { |
680 | #ifndef KORG_NOPRINTER | 690 | #ifndef KORG_NOPRINTER |
681 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 691 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
682 | #endif | 692 | #endif |
683 | } | 693 | } |
684 | 694 | ||
685 | void KOTodoView::editItem(QListViewItem *item ) | 695 | void KOTodoView::editItem(QListViewItem *item ) |
686 | { | 696 | { |
687 | // qDebug("editItem(QListViewItem *item ) "); | 697 | // qDebug("editItem(QListViewItem *item ) "); |
688 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 698 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
689 | } | 699 | } |
690 | 700 | ||
691 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 701 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
692 | { | 702 | { |
693 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 703 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
694 | } | 704 | } |
695 | 705 | ||
696 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) | 706 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) |
697 | { | 707 | { |
698 | |||
699 | mActiveItem = (KOTodoViewItem *)item; | 708 | mActiveItem = (KOTodoViewItem *)item; |
700 | if (item) { | 709 | if (item) { |
701 | switch (column){ | 710 | switch (column){ |
702 | case 1: | 711 | case 1: |
703 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 712 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
704 | case 2: | 713 | case 2: |
705 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 714 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
706 | case 3: | 715 | case 3: |
707 | moveTodo(); | 716 | moveTodo(); |
708 | break; | 717 | break; |
709 | case 6: | 718 | case 6: |
710 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 719 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
711 | default: | 720 | default: |
712 | mItemPopupMenu->popup(QCursor::pos()); | 721 | mItemPopupMenu->popup(QCursor::pos()); |
713 | } | 722 | } |
714 | } else mPopupMenu->popup(QCursor::pos()); | 723 | } else mPopupMenu->popup(QCursor::pos()); |
715 | } | 724 | } |
716 | void KOTodoView::newTodo() | 725 | void KOTodoView::newTodo() |
717 | { | 726 | { |
718 | emit newTodoSignal(); | 727 | emit newTodoSignal(); |
719 | } | 728 | } |
720 | 729 | ||
721 | void KOTodoView::newSubTodo() | 730 | void KOTodoView::newSubTodo() |
722 | { | 731 | { |
723 | if (mActiveItem) { | 732 | if (mActiveItem) { |
724 | emit newSubTodoSignal(mActiveItem->todo()); | 733 | emit newSubTodoSignal(mActiveItem->todo()); |
725 | } | 734 | } |
726 | } | 735 | } |
727 | void KOTodoView::unparentTodo() | 736 | void KOTodoView::unparentTodo() |
728 | { | 737 | { |
729 | if (mActiveItem) { | 738 | if (mActiveItem) { |
730 | emit unparentTodoSignal(mActiveItem->todo()); | 739 | emit unparentTodoSignal(mActiveItem->todo()); |
731 | } | 740 | } |
732 | } | 741 | } |
742 | |||
743 | void KOTodoView::reparentTodo() | ||
744 | { | ||
745 | if (mActiveItem) { | ||
746 | qDebug("KOTodoView::reparentTodo() "); | ||
747 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | ||
748 | pendingSubtodo = mActiveItem; | ||
749 | } | ||
750 | } | ||
733 | void KOTodoView::editTodo() | 751 | void KOTodoView::editTodo() |
734 | { | 752 | { |
735 | if (mActiveItem) { | 753 | if (mActiveItem) { |
736 | emit editTodoSignal(mActiveItem->todo()); | 754 | emit editTodoSignal(mActiveItem->todo()); |
737 | } | 755 | } |
738 | } | 756 | } |
739 | void KOTodoView::cloneTodo() | 757 | void KOTodoView::cloneTodo() |
740 | { | 758 | { |
741 | if (mActiveItem) { | 759 | if (mActiveItem) { |
742 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 760 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
743 | } | 761 | } |
744 | } | 762 | } |
745 | void KOTodoView::cancelTodo() | 763 | void KOTodoView::cancelTodo() |
746 | { | 764 | { |
747 | if (mActiveItem) { | 765 | if (mActiveItem) { |
748 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 766 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
749 | } | 767 | } |
750 | } | 768 | } |
751 | void KOTodoView::moveTodo() | 769 | void KOTodoView::moveTodo() |
752 | { | 770 | { |
753 | if (mActiveItem) { | 771 | if (mActiveItem) { |
754 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 772 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
755 | } | 773 | } |
756 | } | 774 | } |
757 | void KOTodoView::beamTodo() | 775 | void KOTodoView::beamTodo() |
758 | { | 776 | { |
759 | if (mActiveItem) { | 777 | if (mActiveItem) { |
760 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 778 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
761 | } | 779 | } |
762 | } | 780 | } |
763 | 781 | ||
764 | 782 | ||
765 | void KOTodoView::showTodo() | 783 | void KOTodoView::showTodo() |
766 | { | 784 | { |
767 | if (mActiveItem) { | 785 | if (mActiveItem) { |
768 | emit showTodoSignal(mActiveItem->todo()); | 786 | emit showTodoSignal(mActiveItem->todo()); |
769 | } | 787 | } |
770 | } | 788 | } |
771 | 789 | ||
772 | void KOTodoView::deleteTodo() | 790 | void KOTodoView::deleteTodo() |
773 | { | 791 | { |
774 | if (mActiveItem) { | 792 | if (mActiveItem) { |
775 | if (mActiveItem->childCount()) { | 793 | if (mActiveItem->childCount()) { |
776 | KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), | 794 | KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), |
777 | i18n("Delete To-Do")); | 795 | i18n("Delete To-Do")); |
778 | } else { | 796 | } else { |
779 | emit deleteTodoSignal(mActiveItem->todo()); | 797 | emit deleteTodoSignal(mActiveItem->todo()); |
780 | } | 798 | } |
781 | } | 799 | } |
782 | } | 800 | } |
783 | 801 | ||
784 | void KOTodoView::setNewPriority(int index) | 802 | void KOTodoView::setNewPriority(int index) |
785 | { | 803 | { |
786 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 804 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
787 | mActiveItem->todo()->setPriority(mPriority[index]); | 805 | mActiveItem->todo()->setPriority(mPriority[index]); |
788 | mActiveItem->construct(); | 806 | mActiveItem->construct(); |
789 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 807 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
790 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 808 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
791 | } | 809 | } |
792 | } | 810 | } |
793 | 811 | ||
794 | void KOTodoView::setNewPercentage(int index) | 812 | void KOTodoView::setNewPercentage(int index) |
795 | { | 813 | { |
796 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 814 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
797 | if (mPercentage[index] == 100) { | 815 | if (mPercentage[index] == 100) { |
798 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 816 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
799 | } else { | 817 | } else { |
800 | mActiveItem->todo()->setCompleted(false); | 818 | mActiveItem->todo()->setCompleted(false); |
801 | } | 819 | } |
802 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 820 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
803 | mActiveItem->construct(); | 821 | mActiveItem->construct(); |
804 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 822 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
805 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 823 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
806 | } | 824 | } |
807 | } | 825 | } |
808 | 826 | ||
809 | 827 | ||
810 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 828 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
811 | { | 829 | { |
812 | QPopupMenu* tempMenu = new QPopupMenu (this); | 830 | QPopupMenu* tempMenu = new QPopupMenu (this); |
813 | QStringList checkedCategories = todoItem->todo()->categories (); | 831 | QStringList checkedCategories = todoItem->todo()->categories (); |
814 | 832 | ||
815 | tempMenu->setCheckable (true); | 833 | tempMenu->setCheckable (true); |
816 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 834 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
817 | it != KOPrefs::instance()->mCustomCategories.end (); | 835 | it != KOPrefs::instance()->mCustomCategories.end (); |
818 | ++it) { | 836 | ++it) { |
819 | int index = tempMenu->insertItem (*it); | 837 | int index = tempMenu->insertItem (*it); |
820 | mCategory[index] = *it; | 838 | mCategory[index] = *it; |
821 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 839 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
822 | } | 840 | } |
823 | 841 | ||
824 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 842 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
825 | return tempMenu; | 843 | return tempMenu; |
826 | 844 | ||
827 | 845 | ||
828 | } | 846 | } |
829 | void KOTodoView::changedCategories(int index) | 847 | void KOTodoView::changedCategories(int index) |
830 | { | 848 | { |
831 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 849 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
832 | QStringList categories = mActiveItem->todo()->categories (); | 850 | QStringList categories = mActiveItem->todo()->categories (); |
833 | if (categories.find (mCategory[index]) != categories.end ()) | 851 | if (categories.find (mCategory[index]) != categories.end ()) |
834 | categories.remove (mCategory[index]); | 852 | categories.remove (mCategory[index]); |
835 | else | 853 | else |
836 | categories.insert (categories.end(), mCategory[index]); | 854 | categories.insert (categories.end(), mCategory[index]); |
837 | categories.sort (); | 855 | categories.sort (); |
838 | mActiveItem->todo()->setCategories (categories); | 856 | mActiveItem->todo()->setCategories (categories); |
839 | mActiveItem->construct(); | 857 | mActiveItem->construct(); |
840 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 858 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
841 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 859 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
842 | } | 860 | } |
843 | } | 861 | } |
844 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 862 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
845 | { | 863 | { |
864 | if ( pendingSubtodo != 0 ) { | ||
865 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | ||
866 | } | ||
867 | pendingSubtodo = 0; | ||
846 | if (!item) { | 868 | if (!item) { |
847 | newTodo(); | 869 | newTodo(); |
848 | return; | 870 | return; |
849 | } | 871 | } |
850 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 872 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
851 | editItem( item ); | 873 | editItem( item ); |
852 | else | 874 | else |
853 | showItem( item , QPoint(), 0 ); | 875 | showItem( item , QPoint(), 0 ); |
854 | } | 876 | } |
855 | void KOTodoView::itemClicked(QListViewItem *item) | 877 | void KOTodoView::itemClicked(QListViewItem *item) |
856 | { | 878 | { |
879 | |||
857 | if (!item) { | 880 | if (!item) { |
881 | if ( pendingSubtodo != 0 ) { | ||
882 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | ||
883 | } | ||
884 | pendingSubtodo = 0; | ||
858 | return; | 885 | return; |
859 | } | 886 | } |
860 | |||
861 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 887 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
888 | if ( pendingSubtodo != 0 ) { | ||
889 | bool allowReparent = true; | ||
890 | QListViewItem *par = item; | ||
891 | while ( par ) { | ||
892 | if ( par == pendingSubtodo ) { | ||
893 | allowReparent = false; | ||
894 | break; | ||
895 | } | ||
896 | par = par->parent(); | ||
897 | } | ||
898 | if ( !allowReparent ) { | ||
899 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | ||
900 | qDebug("Recursive reparenting not possible "); | ||
901 | pendingSubtodo = 0; | ||
902 | } else { | ||
903 | Todo* newParent = todoItem->todo(); | ||
904 | Todo* newSub = pendingSubtodo->todo(); | ||
905 | pendingSubtodo = 0; | ||
906 | emit reparentTodoSignal( newParent,newSub ); | ||
907 | return; | ||
908 | } | ||
909 | } | ||
862 | int completed = todoItem->todo()->isCompleted(); // Completed or not? | 910 | int completed = todoItem->todo()->isCompleted(); // Completed or not? |
863 | 911 | ||
864 | if (todoItem->isOn()) { | 912 | if (todoItem->isOn()) { |
865 | if (!completed) { | 913 | if (!completed) { |
866 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 914 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
867 | } | 915 | } |
868 | } else { | 916 | } else { |
869 | if (completed) { | 917 | if (completed) { |
870 | todoItem->todo()->setCompleted(false); | 918 | todoItem->todo()->setCompleted(false); |
871 | } | 919 | } |
872 | } | 920 | } |
873 | } | 921 | } |
874 | 922 | ||
875 | void KOTodoView::setDocumentId( const QString &id ) | 923 | void KOTodoView::setDocumentId( const QString &id ) |
876 | { | 924 | { |
877 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 925 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
878 | 926 | ||
879 | mDocPrefs->setDoc( id ); | 927 | mDocPrefs->setDoc( id ); |
880 | } | 928 | } |
881 | 929 | ||
882 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 930 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
883 | { | 931 | { |
884 | if (!item) return; | 932 | if (!item) return; |
885 | 933 | ||
886 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 934 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
887 | 935 | ||
888 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 936 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
889 | 937 | ||
890 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 938 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
891 | } | 939 | } |
892 | 940 | ||
893 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 941 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
894 | { | 942 | { |
895 | mTodoListView->saveLayout(config,group); | 943 | mTodoListView->saveLayout(config,group); |
896 | } | 944 | } |
897 | 945 | ||
898 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 946 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
899 | { | 947 | { |
900 | mTodoListView->restoreLayout(config,group); | 948 | mTodoListView->restoreLayout(config,group); |
901 | } | 949 | } |
902 | 950 | ||
903 | void KOTodoView::processSelectionChange() | 951 | void KOTodoView::processSelectionChange() |
904 | { | 952 | { |
905 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 953 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
906 | 954 | ||
907 | KOTodoViewItem *item = | 955 | KOTodoViewItem *item = |
908 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 956 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
909 | 957 | ||
910 | if ( !item ) { | 958 | if ( !item ) { |
911 | emit incidenceSelected( 0 ); | 959 | emit incidenceSelected( 0 ); |
912 | } else { | 960 | } else { |
913 | emit incidenceSelected( item->todo() ); | 961 | emit incidenceSelected( item->todo() ); |
914 | } | 962 | } |
915 | } | 963 | } |
916 | 964 | ||
917 | void KOTodoView::modified(bool b) | 965 | void KOTodoView::modified(bool b) |
918 | { | 966 | { |
919 | emit isModified(b); | 967 | emit isModified(b); |
920 | } | 968 | } |
921 | void KOTodoView::setTodoModified( Todo* todo ) | 969 | void KOTodoView::setTodoModified( Todo* todo ) |
922 | { | 970 | { |
923 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 971 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
924 | } | 972 | } |
925 | void KOTodoView::clearSelection() | 973 | void KOTodoView::clearSelection() |
926 | { | 974 | { |
927 | mTodoListView->selectAll( false ); | 975 | mTodoListView->selectAll( false ); |
928 | } | 976 | } |
929 | 977 | ||
930 | void KOTodoView::purgeCompleted() | 978 | void KOTodoView::purgeCompleted() |
931 | { | 979 | { |
932 | emit purgeCompletedSignal(); | 980 | emit purgeCompletedSignal(); |
933 | } | 981 | } |
934 | void KOTodoView::toggleQuickTodo() | 982 | void KOTodoView::toggleQuickTodo() |
935 | { | 983 | { |
936 | if ( mQuickAdd->isVisible() ) { | 984 | if ( mQuickAdd->isVisible() ) { |
937 | mQuickAdd->hide(); | 985 | mQuickAdd->hide(); |
938 | KOPrefs::instance()->mEnableQuickTodo = false; | 986 | KOPrefs::instance()->mEnableQuickTodo = false; |
939 | } | 987 | } |
940 | else { | 988 | else { |
941 | mQuickAdd->show(); | 989 | mQuickAdd->show(); |
942 | KOPrefs::instance()->mEnableQuickTodo = true; | 990 | KOPrefs::instance()->mEnableQuickTodo = true; |
943 | } | 991 | } |
944 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 992 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
945 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 993 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
946 | } | 994 | } |
947 | void KOTodoView::toggleCompleted() | 995 | void KOTodoView::toggleCompleted() |
948 | { | 996 | { |
949 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 997 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
950 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 998 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
951 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 999 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
952 | updateView(); | 1000 | updateView(); |
953 | } | 1001 | } |
954 | 1002 | ||
955 | void KOTodoView::addQuickTodo() | 1003 | void KOTodoView::addQuickTodo() |
956 | { | 1004 | { |
957 | Todo *todo = new Todo(); | 1005 | Todo *todo = new Todo(); |
958 | todo->setSummary(mQuickAdd->text()); | 1006 | todo->setSummary(mQuickAdd->text()); |
959 | todo->setOrganizer(KOPrefs::instance()->email()); | 1007 | todo->setOrganizer(KOPrefs::instance()->email()); |
960 | CalFilter * cf = mCalendar->filter(); | 1008 | CalFilter * cf = mCalendar->filter(); |
961 | if ( cf ) { | 1009 | if ( cf ) { |
962 | if ( cf->isEnabled()&& cf->showCategories()) { | 1010 | if ( cf->isEnabled()&& cf->showCategories()) { |
963 | todo->setCategories(cf->categoryList()); | 1011 | todo->setCategories(cf->categoryList()); |
964 | } | 1012 | } |
965 | if ( cf->isEnabled() ) | 1013 | if ( cf->isEnabled() ) |
966 | todo->setSecrecy( cf->getSecrecy()); | 1014 | todo->setSecrecy( cf->getSecrecy()); |
967 | } | 1015 | } |
968 | mCalendar->addTodo(todo); | 1016 | mCalendar->addTodo(todo); |
969 | mQuickAdd->setText(""); | 1017 | mQuickAdd->setText(""); |
970 | todoModified (todo, KOGlobals::EVENTADDED ); | 1018 | todoModified (todo, KOGlobals::EVENTADDED ); |
971 | updateView(); | 1019 | updateView(); |
972 | } | 1020 | } |
973 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1021 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
974 | { | 1022 | { |
975 | // e->ignore(); | 1023 | // e->ignore(); |
976 | //return; | 1024 | //return; |
1025 | //qDebug("KOTodoView::keyPressEvent "); | ||
977 | switch ( e->key() ) { | 1026 | switch ( e->key() ) { |
978 | case Qt::Key_Down: | 1027 | case Qt::Key_Down: |
979 | case Qt::Key_Up: | 1028 | case Qt::Key_Up: |
980 | QWidget::keyPressEvent ( e ); | 1029 | QWidget::keyPressEvent ( e ); |
981 | break; | 1030 | break; |
982 | 1031 | ||
983 | case Qt::Key_Q: | 1032 | case Qt::Key_Q: |
984 | toggleQuickTodo(); | 1033 | toggleQuickTodo(); |
985 | break; | 1034 | break; |
986 | 1035 | case Qt::Key_U: | |
1036 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | ||
1037 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
1038 | unparentTodo(); | ||
1039 | e->accept(); | ||
1040 | } else | ||
1041 | e->ignore(); | ||
1042 | break; | ||
1043 | case Qt::Key_S: | ||
1044 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | ||
1045 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
1046 | reparentTodo(); | ||
1047 | e->accept(); | ||
1048 | } else | ||
1049 | e->ignore(); | ||
1050 | break; | ||
1051 | case Qt::Key_P: | ||
1052 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | ||
1053 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
1054 | if ( pendingSubtodo ) | ||
1055 | itemClicked(mActiveItem); | ||
1056 | e->accept(); | ||
1057 | } else | ||
1058 | e->ignore(); | ||
1059 | break; | ||
1060 | case Qt::Key_Escape: | ||
1061 | if ( pendingSubtodo ) { | ||
1062 | itemClicked(0); | ||
1063 | e->accept(); | ||
1064 | } else | ||
1065 | e->ignore(); | ||
1066 | break; | ||
987 | default: | 1067 | default: |
988 | e->ignore(); | 1068 | e->ignore(); |
989 | } | 1069 | } |
990 | 1070 | ||
991 | if ( true ) { | 1071 | if ( true ) { |
992 | if ( e->key() == Qt::Key_I ) { | 1072 | if ( e->key() == Qt::Key_I ) { |
993 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1073 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
994 | if ( cn ) { | 1074 | if ( cn ) { |
995 | mActiveItem = cn; | 1075 | mActiveItem = cn; |
996 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1076 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
997 | if ( ci ){ | 1077 | if ( ci ){ |
998 | showTodo(); | 1078 | showTodo(); |
999 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1079 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1000 | if ( cn ) { | 1080 | if ( cn ) { |
1001 | mTodoListView->setCurrentItem ( cn ); | 1081 | mTodoListView->setCurrentItem ( cn ); |
1002 | mTodoListView->ensureItemVisible ( cn ); | 1082 | mTodoListView->ensureItemVisible ( cn ); |
1003 | } | 1083 | } |
1004 | 1084 | ||
1005 | } | 1085 | } |
1006 | } | 1086 | } |
1007 | e->accept(); | 1087 | e->accept(); |
1008 | 1088 | ||
1009 | } | 1089 | } |
1010 | 1090 | ||
1011 | } | 1091 | } |
1012 | 1092 | ||
1013 | } | 1093 | } |
1014 | void KOTodoView::updateTodo( Todo * t, int type ) | 1094 | void KOTodoView::updateTodo( Todo * t, int type ) |
1015 | { | 1095 | { |
1016 | if ( mBlockUpdate) | 1096 | if ( mBlockUpdate) |
1017 | return; | 1097 | return; |
1018 | 1098 | ||
1019 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1099 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1020 | itemIterator = mTodoMap.find(t); | 1100 | itemIterator = mTodoMap.find(t); |
1021 | if (itemIterator != mTodoMap.end()) { | 1101 | if (itemIterator != mTodoMap.end()) { |
1022 | (*itemIterator)->construct(); | 1102 | (*itemIterator)->construct(); |
1023 | } else { | 1103 | } else { |
1024 | if ( type == KOGlobals::EVENTADDED ) { | 1104 | if ( type == KOGlobals::EVENTADDED ) { |
1025 | insertTodoItem( t ); | 1105 | insertTodoItem( t ); |
1026 | } | 1106 | } |
1027 | } | 1107 | } |
1028 | 1108 | ||
1029 | } | 1109 | } |
1030 | 1110 | ||
1031 | void KOTodoView::todoModified(Todo * t , int p ) | 1111 | void KOTodoView::todoModified(Todo * t , int p ) |
1032 | { | 1112 | { |
1033 | mBlockUpdate = true; | 1113 | mBlockUpdate = true; |
1034 | emit todoModifiedSignal ( t, p ); | 1114 | emit todoModifiedSignal ( t, p ); |
1035 | mBlockUpdate = false; | 1115 | mBlockUpdate = false; |
1036 | } | 1116 | } |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 6bf0203..0c08677 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -1,231 +1,234 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | 46 | ||
47 | class QDragEnterEvent; | 47 | class QDragEnterEvent; |
48 | class QDragMoveEvent; | 48 | class QDragMoveEvent; |
49 | class QDragLeaveEvent; | 49 | class QDragLeaveEvent; |
50 | class QDropEvent; | 50 | class QDropEvent; |
51 | 51 | ||
52 | class DocPrefs; | 52 | class DocPrefs; |
53 | 53 | ||
54 | class KOTodoListView : public KListView | 54 | class KOTodoListView : public KListView |
55 | { | 55 | { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 58 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
59 | virtual ~KOTodoListView() {} | 59 | virtual ~KOTodoListView() {} |
60 | 60 | ||
61 | signals: | 61 | signals: |
62 | void todoDropped(Todo *); | 62 | void todoDropped(Todo *); |
63 | void double_Clicked(QListViewItem *item); | 63 | void double_Clicked(QListViewItem *item); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | void contentsDragEnterEvent(QDragEnterEvent *); | 66 | void contentsDragEnterEvent(QDragEnterEvent *); |
67 | void contentsDragMoveEvent(QDragMoveEvent *); | 67 | void contentsDragMoveEvent(QDragMoveEvent *); |
68 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 68 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
69 | void contentsDropEvent(QDropEvent *); | 69 | void contentsDropEvent(QDropEvent *); |
70 | 70 | ||
71 | void contentsMousePressEvent(QMouseEvent *); | 71 | void contentsMousePressEvent(QMouseEvent *); |
72 | void contentsMouseMoveEvent(QMouseEvent *); | 72 | void contentsMouseMoveEvent(QMouseEvent *); |
73 | void contentsMouseReleaseEvent(QMouseEvent *); | 73 | void contentsMouseReleaseEvent(QMouseEvent *); |
74 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 74 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
75 | 75 | ||
76 | private: | 76 | private: |
77 | QString mName; | 77 | QString mName; |
78 | Calendar *mCalendar; | 78 | Calendar *mCalendar; |
79 | QPoint mPressPos; | 79 | QPoint mPressPos; |
80 | bool mMousePressed; | 80 | bool mMousePressed; |
81 | QListViewItem *mOldCurrent; | 81 | QListViewItem *mOldCurrent; |
82 | void keyPressEvent ( QKeyEvent * ) ; | 82 | void keyPressEvent ( QKeyEvent * ) ; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | /** | 86 | /** |
87 | This is the line-edit on top of the todoview for fast addition of new todos | 87 | This is the line-edit on top of the todoview for fast addition of new todos |
88 | */ | 88 | */ |
89 | class KOQuickTodo : public QLineEdit | 89 | class KOQuickTodo : public QLineEdit |
90 | { | 90 | { |
91 | public: | 91 | public: |
92 | KOQuickTodo(QWidget *parent=0); | 92 | KOQuickTodo(QWidget *parent=0); |
93 | protected: | 93 | protected: |
94 | void focusInEvent(QFocusEvent *ev); | 94 | void focusInEvent(QFocusEvent *ev); |
95 | void focusOutEvent(QFocusEvent *ev); | 95 | void focusOutEvent(QFocusEvent *ev); |
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
99 | /** | 99 | /** |
100 | This class provides a multi-column list view of todo events. | 100 | This class provides a multi-column list view of todo events. |
101 | 101 | ||
102 | @short multi-column list view of todo events. | 102 | @short multi-column list view of todo events. |
103 | @author Cornelius Schumacher <schumacher@kde.org> | 103 | @author Cornelius Schumacher <schumacher@kde.org> |
104 | */ | 104 | */ |
105 | class KOTodoView : public KOrg::BaseView | 105 | class KOTodoView : public KOrg::BaseView |
106 | { | 106 | { |
107 | Q_OBJECT | 107 | Q_OBJECT |
108 | public: | 108 | public: |
109 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 109 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
110 | ~KOTodoView(); | 110 | ~KOTodoView(); |
111 | 111 | ||
112 | QPtrList<Incidence> selectedIncidences(); | 112 | QPtrList<Incidence> selectedIncidences(); |
113 | QPtrList<Todo> selectedTodos(); | 113 | QPtrList<Todo> selectedTodos(); |
114 | 114 | ||
115 | DateList selectedDates() | 115 | DateList selectedDates() |
116 | {DateList q; | 116 | {DateList q; |
117 | return q;} | 117 | return q;} |
118 | 118 | ||
119 | /** Return number of shown dates. TodoView does not show dates, */ | 119 | /** Return number of shown dates. TodoView does not show dates, */ |
120 | int currentDateCount() { return 0; } | 120 | int currentDateCount() { return 0; } |
121 | void setNarrow(); | 121 | void setNarrow(); |
122 | 122 | ||
123 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 123 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
124 | 124 | ||
125 | void setDocumentId( const QString & ); | 125 | void setDocumentId( const QString & ); |
126 | 126 | ||
127 | void saveLayout(KConfig *config, const QString &group) const; | 127 | void saveLayout(KConfig *config, const QString &group) const; |
128 | void restoreLayout(KConfig *config, const QString &group); | 128 | void restoreLayout(KConfig *config, const QString &group); |
129 | /** Create a popup menu to set categories */ | 129 | /** Create a popup menu to set categories */ |
130 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 130 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
131 | 131 | ||
132 | public slots: | 132 | public slots: |
133 | void updateView(); | 133 | void updateView(); |
134 | void updateConfig(); | 134 | void updateConfig(); |
135 | 135 | ||
136 | void changeEventDisplay(Event *, int); | 136 | void changeEventDisplay(Event *, int); |
137 | 137 | ||
138 | void showDates(const QDate &start, const QDate &end); | 138 | void showDates(const QDate &start, const QDate &end); |
139 | void showEvents(QPtrList<Event> eventList); | 139 | void showEvents(QPtrList<Event> eventList); |
140 | 140 | ||
141 | void clearSelection(); | 141 | void clearSelection(); |
142 | void jumpToDate (); | 142 | void jumpToDate (); |
143 | 143 | ||
144 | void editItem(QListViewItem *item); | 144 | void editItem(QListViewItem *item); |
145 | void showItem(QListViewItem *item,const QPoint &,int); | 145 | void showItem(QListViewItem *item,const QPoint &,int); |
146 | void popupMenu(QListViewItem *item,const QPoint &,int); | 146 | void popupMenu(QListViewItem *item,const QPoint &,int); |
147 | void newTodo(); | 147 | void newTodo(); |
148 | void newSubTodo(); | 148 | void newSubTodo(); |
149 | void unparentTodo(); | 149 | void unparentTodo(); |
150 | void reparentTodo(); | ||
150 | void showTodo(); | 151 | void showTodo(); |
151 | void editTodo(); | 152 | void editTodo(); |
152 | void cloneTodo(); | 153 | void cloneTodo(); |
153 | void cancelTodo(); | 154 | void cancelTodo(); |
154 | void moveTodo(); | 155 | void moveTodo(); |
155 | void beamTodo(); | 156 | void beamTodo(); |
156 | void deleteTodo(); | 157 | void deleteTodo(); |
157 | 158 | ||
158 | void setNewPriority(int); | 159 | void setNewPriority(int); |
159 | void setNewPercentage(int); | 160 | void setNewPercentage(int); |
160 | void changedCategories(int); | 161 | void changedCategories(int); |
161 | 162 | ||
162 | void purgeCompleted(); | 163 | void purgeCompleted(); |
163 | void toggleCompleted(); | 164 | void toggleCompleted(); |
164 | void toggleQuickTodo(); | 165 | void toggleQuickTodo(); |
165 | void updateTodo( Todo *, int ); | 166 | void updateTodo( Todo *, int ); |
166 | 167 | ||
167 | void itemClicked(QListViewItem *); | 168 | void itemClicked(QListViewItem *); |
168 | void itemStateChanged(QListViewItem *); | 169 | void itemStateChanged(QListViewItem *); |
169 | void modified(bool); | 170 | void modified(bool); |
170 | void itemDoubleClicked(QListViewItem *item); | 171 | void itemDoubleClicked(QListViewItem *item); |
171 | 172 | ||
172 | signals: | 173 | signals: |
173 | void newTodoSignal(); | 174 | void newTodoSignal(); |
174 | void newSubTodoSignal(Todo *); | 175 | void newSubTodoSignal(Todo *); |
175 | void unparentTodoSignal(Todo *); | 176 | void unparentTodoSignal(Todo *); |
177 | void reparentTodoSignal( Todo *,Todo * ); | ||
176 | void showTodoSignal(Todo *); | 178 | void showTodoSignal(Todo *); |
177 | 179 | ||
178 | void editTodoSignal(Todo *); | 180 | void editTodoSignal(Todo *); |
179 | void deleteTodoSignal(Todo *); | 181 | void deleteTodoSignal(Todo *); |
180 | void todoModifiedSignal (Todo *, int); | 182 | void todoModifiedSignal (Todo *, int); |
181 | 183 | ||
182 | void isModified(bool); | 184 | void isModified(bool); |
183 | void cloneTodoSignal( Incidence * ); | 185 | void cloneTodoSignal( Incidence * ); |
184 | void cancelTodoSignal( Incidence * ); | 186 | void cancelTodoSignal( Incidence * ); |
185 | void moveTodoSignal( Incidence * ); | 187 | void moveTodoSignal( Incidence * ); |
186 | void beamTodoSignal( Incidence * ); | 188 | void beamTodoSignal( Incidence * ); |
187 | void purgeCompletedSignal(); | 189 | void purgeCompletedSignal(); |
188 | 190 | ||
189 | protected slots: | 191 | protected slots: |
190 | void processSelectionChange(); | 192 | void processSelectionChange(); |
191 | void addQuickTodo(); | 193 | void addQuickTodo(); |
192 | 194 | ||
193 | private: | 195 | private: |
194 | /* | 196 | /* |
195 | * the TodoEditor approach is rather unscaling in the long | 197 | * the TodoEditor approach is rather unscaling in the long |
196 | * run. | 198 | * run. |
197 | * Korganizer keeps it in memory and we need to update | 199 | * Korganizer keeps it in memory and we need to update |
198 | * 1. make KOTodoViewItem a QObject again? | 200 | * 1. make KOTodoViewItem a QObject again? |
199 | * 2. add a public method for setting one todo modified? | 201 | * 2. add a public method for setting one todo modified? |
200 | * 3. add a private method for setting a todo modified + friend here? | 202 | * 3. add a private method for setting a todo modified + friend here? |
201 | * -- zecke 2002-07-08 | 203 | * -- zecke 2002-07-08 |
202 | */ | 204 | */ |
203 | friend class KOTodoViewItem; | 205 | friend class KOTodoViewItem; |
204 | void setTodoModified( Todo* ); | 206 | void setTodoModified( Todo* ); |
205 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 207 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
206 | void restoreItemState( QListViewItem * ); | 208 | void restoreItemState( QListViewItem * ); |
207 | 209 | ||
208 | KOTodoListView *mTodoListView; | 210 | KOTodoListView *mTodoListView; |
209 | QPopupMenu *mItemPopupMenu; | 211 | QPopupMenu *mItemPopupMenu; |
210 | QPopupMenu *mPopupMenu; | 212 | QPopupMenu *mPopupMenu; |
211 | QPopupMenu *mPriorityPopupMenu; | 213 | QPopupMenu *mPriorityPopupMenu; |
212 | QPopupMenu *mPercentageCompletedPopupMenu; | 214 | QPopupMenu *mPercentageCompletedPopupMenu; |
213 | QPopupMenu *mCategoryPopupMenu; | 215 | QPopupMenu *mCategoryPopupMenu; |
214 | 216 | ||
215 | QMap<int, int> mPercentage; | 217 | QMap<int, int> mPercentage; |
216 | QMap<int, int> mPriority; | 218 | QMap<int, int> mPriority; |
217 | QMap<int, QString> mCategory; | 219 | QMap<int, QString> mCategory; |
218 | KOTodoViewItem *mActiveItem; | 220 | KOTodoViewItem *mActiveItem; |
219 | 221 | ||
220 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 222 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
221 | QString mName; | 223 | QString mName; |
222 | 224 | ||
223 | DocPrefs *mDocPrefs; | 225 | DocPrefs *mDocPrefs; |
224 | QString mCurrentDoc; | 226 | QString mCurrentDoc; |
225 | KOQuickTodo *mQuickAdd; | 227 | KOQuickTodo *mQuickAdd; |
226 | bool mBlockUpdate; | 228 | bool mBlockUpdate; |
227 | void todoModified(Todo *, int ); | 229 | void todoModified(Todo *, int ); |
228 | void keyPressEvent ( QKeyEvent * ) ; | 230 | void keyPressEvent ( QKeyEvent * ) ; |
231 | KOTodoViewItem * pendingSubtodo; | ||
229 | }; | 232 | }; |
230 | 233 | ||
231 | #endif | 234 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 8e6cc53..391f98c 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -309,267 +309,269 @@ void KOViewManager::showAgendaView( bool fullScreen ) | |||
309 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 309 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
310 | mMainView, SLOT(showIncidence(Incidence *))); | 310 | mMainView, SLOT(showIncidence(Incidence *))); |
311 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 311 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
312 | mMainView, SLOT(deleteIncidence(Incidence *))); | 312 | mMainView, SLOT(deleteIncidence(Incidence *))); |
313 | 313 | ||
314 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 314 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
316 | 316 | ||
317 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 317 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
318 | mMainView, SLOT( toggleExpand() ) ); | 318 | mMainView, SLOT( toggleExpand() ) ); |
319 | 319 | ||
320 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 320 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
321 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 321 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
322 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 322 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
323 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 323 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
324 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 324 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
325 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 325 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
326 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 326 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
327 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 327 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
328 | SLOT( updateTodo( Todo *, int ) ) ); | 328 | SLOT( updateTodo( Todo *, int ) ) ); |
329 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 329 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
330 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 330 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
331 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 331 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 332 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
333 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 333 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
335 | mAgendaView->readSettings(); | 335 | mAgendaView->readSettings(); |
336 | mAgendaView->updateConfig(); | 336 | mAgendaView->updateConfig(); |
337 | } | 337 | } |
338 | 338 | ||
339 | showView( mAgendaView, full); | 339 | showView( mAgendaView, full); |
340 | 340 | ||
341 | } | 341 | } |
342 | 342 | ||
343 | void KOViewManager::showDayView() | 343 | void KOViewManager::showDayView() |
344 | { | 344 | { |
345 | mFlagShowNextxDays = false; | 345 | mFlagShowNextxDays = false; |
346 | globalFlagBlockLabel = 1; | 346 | globalFlagBlockLabel = 1; |
347 | globalFlagBlockAgenda = 1; | 347 | globalFlagBlockAgenda = 1; |
348 | if ( mCurrentAgendaView != 1 ) | 348 | if ( mCurrentAgendaView != 1 ) |
349 | mCurrentAgendaView = -1; | 349 | mCurrentAgendaView = -1; |
350 | showAgendaView(); | 350 | showAgendaView(); |
351 | qApp->processEvents(); | 351 | qApp->processEvents(); |
352 | globalFlagBlockAgenda = 2; | 352 | globalFlagBlockAgenda = 2; |
353 | globalFlagBlockLabel = 0; | 353 | globalFlagBlockLabel = 0; |
354 | mMainView->dateNavigator()->selectDates( 1 ); | 354 | mMainView->dateNavigator()->selectDates( 1 ); |
355 | mCurrentAgendaView = 1 ; | 355 | mCurrentAgendaView = 1 ; |
356 | 356 | ||
357 | } | 357 | } |
358 | 358 | ||
359 | void KOViewManager::showWorkWeekView() | 359 | void KOViewManager::showWorkWeekView() |
360 | { | 360 | { |
361 | mFlagShowNextxDays = false; | 361 | mFlagShowNextxDays = false; |
362 | globalFlagBlockAgenda = 1; | 362 | globalFlagBlockAgenda = 1; |
363 | globalFlagBlockLabel = 1; | 363 | globalFlagBlockLabel = 1; |
364 | if ( mCurrentAgendaView != 5 ) | 364 | if ( mCurrentAgendaView != 5 ) |
365 | mCurrentAgendaView = -1; | 365 | mCurrentAgendaView = -1; |
366 | showAgendaView(); | 366 | showAgendaView(); |
367 | qApp->processEvents(); | 367 | qApp->processEvents(); |
368 | globalFlagBlockAgenda = 2; | 368 | globalFlagBlockAgenda = 2; |
369 | globalFlagBlockLabel = 0; | 369 | globalFlagBlockLabel = 0; |
370 | mMainView->dateNavigator()->selectWorkWeek(); | 370 | mMainView->dateNavigator()->selectWorkWeek(); |
371 | mCurrentAgendaView = 5 ; | 371 | mCurrentAgendaView = 5 ; |
372 | 372 | ||
373 | } | 373 | } |
374 | 374 | ||
375 | void KOViewManager::showWeekView() | 375 | void KOViewManager::showWeekView() |
376 | { | 376 | { |
377 | /* | 377 | /* |
378 | globalFlagBlockAgenda = 2; | 378 | globalFlagBlockAgenda = 2; |
379 | qDebug("4globalFlagBlockAgenda = 2; "); | 379 | qDebug("4globalFlagBlockAgenda = 2; "); |
380 | //globalFlagBlockPainting = true; | 380 | //globalFlagBlockPainting = true; |
381 | mMainView->dateNavigator()->selectWeek(); | 381 | mMainView->dateNavigator()->selectWeek(); |
382 | showAgendaView(); | 382 | showAgendaView(); |
383 | */ | 383 | */ |
384 | 384 | ||
385 | 385 | ||
386 | mFlagShowNextxDays = false; | 386 | mFlagShowNextxDays = false; |
387 | globalFlagBlockAgenda = 1; | 387 | globalFlagBlockAgenda = 1; |
388 | globalFlagBlockLabel = 1; | 388 | globalFlagBlockLabel = 1; |
389 | if ( mCurrentAgendaView != 7 ) | 389 | if ( mCurrentAgendaView != 7 ) |
390 | mCurrentAgendaView = -1; | 390 | mCurrentAgendaView = -1; |
391 | showAgendaView(); | 391 | showAgendaView(); |
392 | qApp->processEvents(); | 392 | qApp->processEvents(); |
393 | globalFlagBlockAgenda = 2; | 393 | globalFlagBlockAgenda = 2; |
394 | globalFlagBlockLabel = 0; | 394 | globalFlagBlockLabel = 0; |
395 | mMainView->dateNavigator()->selectWeek(); | 395 | mMainView->dateNavigator()->selectWeek(); |
396 | mCurrentAgendaView = 7 ; | 396 | mCurrentAgendaView = 7 ; |
397 | } | 397 | } |
398 | 398 | ||
399 | void KOViewManager::showNextXView() | 399 | void KOViewManager::showNextXView() |
400 | { | 400 | { |
401 | 401 | ||
402 | globalFlagBlockAgenda = 1; | 402 | globalFlagBlockAgenda = 1; |
403 | if ( mCurrentAgendaView != 3 ) | 403 | if ( mCurrentAgendaView != 3 ) |
404 | mCurrentAgendaView = -1; | 404 | mCurrentAgendaView = -1; |
405 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 405 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
406 | globalFlagBlockAgenda = 2; | 406 | globalFlagBlockAgenda = 2; |
407 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 407 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
408 | KOPrefs::instance()->mNextXDays ); | 408 | KOPrefs::instance()->mNextXDays ); |
409 | mFlagShowNextxDays = true; | 409 | mFlagShowNextxDays = true; |
410 | mCurrentAgendaView = 3 ; | 410 | mCurrentAgendaView = 3 ; |
411 | } | 411 | } |
412 | bool KOViewManager::showsNextDays() | 412 | bool KOViewManager::showsNextDays() |
413 | { | 413 | { |
414 | return mFlagShowNextxDays; | 414 | return mFlagShowNextxDays; |
415 | } | 415 | } |
416 | void KOViewManager::showMonthView() | 416 | void KOViewManager::showMonthView() |
417 | { | 417 | { |
418 | if (!mMonthView) { | 418 | if (!mMonthView) { |
419 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 419 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
420 | 420 | ||
421 | addView(mMonthView); | 421 | addView(mMonthView); |
422 | // mMonthView->show(); | 422 | // mMonthView->show(); |
423 | // SIGNALS/SLOTS FOR MONTH VIEW | 423 | // SIGNALS/SLOTS FOR MONTH VIEW |
424 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 424 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
425 | mMainView, SLOT(newEvent(QDateTime))); | 425 | mMainView, SLOT(newEvent(QDateTime))); |
426 | 426 | ||
427 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 427 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
428 | mMainView, SLOT(showIncidence(Incidence *))); | 428 | mMainView, SLOT(showIncidence(Incidence *))); |
429 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 429 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
430 | mMainView, SLOT(editIncidence(Incidence *))); | 430 | mMainView, SLOT(editIncidence(Incidence *))); |
431 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 431 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
432 | mMainView, SLOT(deleteIncidence(Incidence *))); | 432 | mMainView, SLOT(deleteIncidence(Incidence *))); |
433 | 433 | ||
434 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 434 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
435 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 435 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
436 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 436 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
437 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 437 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
438 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 438 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
439 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 439 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
440 | 440 | ||
441 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 441 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 442 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
443 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 443 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 444 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
445 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 445 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
446 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 446 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
447 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 447 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
448 | mMonthView->updateConfig(); | 448 | mMonthView->updateConfig(); |
449 | } | 449 | } |
450 | 450 | ||
451 | globalFlagBlockAgenda = 1; | 451 | globalFlagBlockAgenda = 1; |
452 | //mFlagShowNextxDays = false; | 452 | //mFlagShowNextxDays = false; |
453 | // if(mMonthView == mCurrentView) return; | 453 | // if(mMonthView == mCurrentView) return; |
454 | mMainView->dateNavigator()->selectMonth(); | 454 | mMainView->dateNavigator()->selectMonth(); |
455 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 455 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
456 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 456 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
457 | 457 | ||
458 | showView(mMonthView, true ); | 458 | showView(mMonthView, true ); |
459 | 459 | ||
460 | } | 460 | } |
461 | 461 | ||
462 | void KOViewManager::showTodoView() | 462 | void KOViewManager::showTodoView() |
463 | { | 463 | { |
464 | //mFlagShowNextxDays = false; | 464 | //mFlagShowNextxDays = false; |
465 | if ( !mTodoView ) { | 465 | if ( !mTodoView ) { |
466 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 466 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
467 | "KOViewManager::TodoView" ); | 467 | "KOViewManager::TodoView" ); |
468 | 468 | ||
469 | addView( mTodoView ); | 469 | addView( mTodoView ); |
470 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 470 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
471 | 471 | ||
472 | // SIGNALS/SLOTS FOR TODO VIEW | 472 | // SIGNALS/SLOTS FOR TODO VIEW |
473 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 473 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
474 | mMainView, SLOT( newTodo() ) ); | 474 | mMainView, SLOT( newTodo() ) ); |
475 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 475 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
476 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 476 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
477 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 477 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
478 | mMainView, SLOT( showTodo( Todo * ) ) ); | 478 | mMainView, SLOT( showTodo( Todo * ) ) ); |
479 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 479 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
480 | mMainView, SLOT( editTodo( Todo * ) ) ); | 480 | mMainView, SLOT( editTodo( Todo * ) ) ); |
481 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 481 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
482 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 482 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
483 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 483 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
484 | mMainView, SLOT( purgeCompleted() ) ); | 484 | mMainView, SLOT( purgeCompleted() ) ); |
485 | 485 | ||
486 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 486 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
487 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 487 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
488 | 488 | ||
489 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 489 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
490 | SLOT( updateConfig() ) ); | 490 | SLOT( updateConfig() ) ); |
491 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 491 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
492 | SLOT( updateTodo( Todo *, int ) ) ); | 492 | SLOT( updateTodo( Todo *, int ) ) ); |
493 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 493 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
494 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 494 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
495 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 495 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
496 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 496 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
497 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 497 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
498 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 498 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
499 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 499 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
500 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 500 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
501 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | ||
502 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | ||
501 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 503 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
502 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 504 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
503 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 505 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
504 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 506 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
505 | KConfig *config = KOGlobals::config(); | 507 | KConfig *config = KOGlobals::config(); |
506 | mTodoView->restoreLayout(config,"Todo View"); | 508 | mTodoView->restoreLayout(config,"Todo View"); |
507 | } | 509 | } |
508 | 510 | ||
509 | globalFlagBlockAgenda = 1; | 511 | globalFlagBlockAgenda = 1; |
510 | showView( mTodoView, true ); | 512 | showView( mTodoView, true ); |
511 | 513 | ||
512 | } | 514 | } |
513 | 515 | ||
514 | void KOViewManager::showJournalView() | 516 | void KOViewManager::showJournalView() |
515 | { | 517 | { |
516 | //mFlagShowNextxDays = false; | 518 | //mFlagShowNextxDays = false; |
517 | if (!mJournalView) { | 519 | if (!mJournalView) { |
518 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 520 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
519 | "KOViewManager::JournalView"); | 521 | "KOViewManager::JournalView"); |
520 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 522 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
521 | SLOT( updateConfig() ) ); | 523 | SLOT( updateConfig() ) ); |
522 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 524 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
523 | addView(mJournalView); | 525 | addView(mJournalView); |
524 | } | 526 | } |
525 | 527 | ||
526 | showView(mJournalView); | 528 | showView(mJournalView); |
527 | } | 529 | } |
528 | 530 | ||
529 | void KOViewManager::showTimeSpanView() | 531 | void KOViewManager::showTimeSpanView() |
530 | { | 532 | { |
531 | //mFlagShowNextxDays = false; | 533 | //mFlagShowNextxDays = false; |
532 | if (!mTimeSpanView) { | 534 | if (!mTimeSpanView) { |
533 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 535 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
534 | "KOViewManager::TimeSpanView"); | 536 | "KOViewManager::TimeSpanView"); |
535 | addView(mTimeSpanView); | 537 | addView(mTimeSpanView); |
536 | 538 | ||
537 | mTimeSpanView->readSettings(); | 539 | mTimeSpanView->readSettings(); |
538 | } | 540 | } |
539 | 541 | ||
540 | showView(mTimeSpanView); | 542 | showView(mTimeSpanView); |
541 | } | 543 | } |
542 | 544 | ||
543 | Incidence *KOViewManager::currentSelection() | 545 | Incidence *KOViewManager::currentSelection() |
544 | { | 546 | { |
545 | if (!mCurrentView) return 0; | 547 | if (!mCurrentView) return 0; |
546 | if ( mCurrentView == mListView ) { | 548 | if ( mCurrentView == mListView ) { |
547 | if ( mListView->currentItem() ) | 549 | if ( mListView->currentItem() ) |
548 | return mListView->currentItem(); | 550 | return mListView->currentItem(); |
549 | } | 551 | } |
550 | return mCurrentView->selectedIncidences().first(); | 552 | return mCurrentView->selectedIncidences().first(); |
551 | } | 553 | } |
552 | 554 | ||
553 | QDate KOViewManager::currentSelectionDate() | 555 | QDate KOViewManager::currentSelectionDate() |
554 | { | 556 | { |
555 | QDate qd; | 557 | QDate qd; |
556 | if (mCurrentView) { | 558 | if (mCurrentView) { |
557 | DateList qvl = mCurrentView->selectedDates(); | 559 | DateList qvl = mCurrentView->selectedDates(); |
558 | if (!qvl.isEmpty()) qd = qvl.first(); | 560 | if (!qvl.isEmpty()) qd = qvl.first(); |
559 | } | 561 | } |
560 | return qd; | 562 | return qd; |
561 | } | 563 | } |
562 | 564 | ||
563 | void KOViewManager::addView(KOrg::BaseView *view) | 565 | void KOViewManager::addView(KOrg::BaseView *view) |
564 | { | 566 | { |
565 | #if QT_VERSION >= 300 | 567 | #if QT_VERSION >= 300 |
566 | mMainView->viewStack()->addWidget( view ); | 568 | mMainView->viewStack()->addWidget( view ); |
567 | #else | 569 | #else |
568 | mMainView->viewStack()->addWidget( view, 1 ); | 570 | mMainView->viewStack()->addWidget( view, 1 ); |
569 | #endif | 571 | #endif |
570 | } | 572 | } |
571 | 573 | ||
572 | void KOViewManager::setDocumentId( const QString &id ) | 574 | void KOViewManager::setDocumentId( const QString &id ) |
573 | { | 575 | { |
574 | if (mTodoView) mTodoView->setDocumentId( id ); | 576 | if (mTodoView) mTodoView->setDocumentId( id ); |
575 | } | 577 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 8daacc7..06470b8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -958,384 +958,387 @@ void MainWindow::exportToPhone( int mode ) | |||
958 | KOex2phonePrefs ex2phone; | 958 | KOex2phonePrefs ex2phone; |
959 | 959 | ||
960 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 960 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
961 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 961 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
962 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 962 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
963 | if ( mode == 1 ) | 963 | if ( mode == 1 ) |
964 | ex2phone.setCaption(i18n("Export complete calendar")); | 964 | ex2phone.setCaption(i18n("Export complete calendar")); |
965 | if ( mode == 2 ) | 965 | if ( mode == 2 ) |
966 | ex2phone.setCaption(i18n("Export filtered calendar")); | 966 | ex2phone.setCaption(i18n("Export filtered calendar")); |
967 | 967 | ||
968 | if ( !ex2phone.exec() ) { | 968 | if ( !ex2phone.exec() ) { |
969 | return; | 969 | return; |
970 | } | 970 | } |
971 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 971 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
972 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 972 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
973 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 973 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
974 | 974 | ||
975 | int inFuture = 0; | 975 | int inFuture = 0; |
976 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 976 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
977 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 977 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
978 | QPtrList<Incidence> delSel; | 978 | QPtrList<Incidence> delSel; |
979 | if ( mode == 1 ) | 979 | if ( mode == 1 ) |
980 | delSel = mCalendar->rawIncidences(); | 980 | delSel = mCalendar->rawIncidences(); |
981 | if ( mode == 2 ) | 981 | if ( mode == 2 ) |
982 | delSel = mCalendar->incidences(); | 982 | delSel = mCalendar->incidences(); |
983 | CalendarLocal* cal = new CalendarLocal(); | 983 | CalendarLocal* cal = new CalendarLocal(); |
984 | cal->setLocalTime(); | 984 | cal->setLocalTime(); |
985 | Incidence *incidence = delSel.first(); | 985 | Incidence *incidence = delSel.first(); |
986 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 986 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
987 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 987 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
988 | while ( incidence ) { | 988 | while ( incidence ) { |
989 | if ( incidence->type() != "Journal" ) { | 989 | if ( incidence->type() != "Journal" ) { |
990 | bool add = true; | 990 | bool add = true; |
991 | if ( inFuture ) { | 991 | if ( inFuture ) { |
992 | QDateTime dt; | 992 | QDateTime dt; |
993 | if ( incidence->type() == "Todo" ) { | 993 | if ( incidence->type() == "Todo" ) { |
994 | Todo * t = (Todo*)incidence; | 994 | Todo * t = (Todo*)incidence; |
995 | if ( t->hasDueDate() ) | 995 | if ( t->hasDueDate() ) |
996 | dt = t->dtDue(); | 996 | dt = t->dtDue(); |
997 | else | 997 | else |
998 | dt = cur.addSecs( 62 ); | 998 | dt = cur.addSecs( 62 ); |
999 | } | 999 | } |
1000 | else { | 1000 | else { |
1001 | bool ok; | 1001 | bool ok; |
1002 | dt = incidence->getNextOccurence( cur, &ok ); | 1002 | dt = incidence->getNextOccurence( cur, &ok ); |
1003 | if ( !ok ) | 1003 | if ( !ok ) |
1004 | dt = cur.addSecs( -62 ); | 1004 | dt = cur.addSecs( -62 ); |
1005 | } | 1005 | } |
1006 | if ( dt < cur || dt > end ) { | 1006 | if ( dt < cur || dt > end ) { |
1007 | add = false; | 1007 | add = false; |
1008 | } | 1008 | } |
1009 | } | 1009 | } |
1010 | if ( add ) { | 1010 | if ( add ) { |
1011 | Incidence *in = incidence->clone(); | 1011 | Incidence *in = incidence->clone(); |
1012 | cal->addIncidence( in ); | 1012 | cal->addIncidence( in ); |
1013 | } | 1013 | } |
1014 | } | 1014 | } |
1015 | incidence = delSel.next(); | 1015 | incidence = delSel.next(); |
1016 | } | 1016 | } |
1017 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1017 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1018 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1018 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1019 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1019 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1020 | 1020 | ||
1021 | setCaption( i18n("Writing to phone...")); | 1021 | setCaption( i18n("Writing to phone...")); |
1022 | if ( PhoneFormat::writeToPhone( cal ) ) | 1022 | if ( PhoneFormat::writeToPhone( cal ) ) |
1023 | setCaption( i18n("Export to phone successful!")); | 1023 | setCaption( i18n("Export to phone successful!")); |
1024 | else | 1024 | else |
1025 | setCaption( i18n("Error exporting to phone!")); | 1025 | setCaption( i18n("Error exporting to phone!")); |
1026 | delete cal; | 1026 | delete cal; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | 1029 | ||
1030 | void MainWindow::setDefaultPreferences() | 1030 | void MainWindow::setDefaultPreferences() |
1031 | { | 1031 | { |
1032 | KOPrefs *p = KOPrefs::instance(); | 1032 | KOPrefs *p = KOPrefs::instance(); |
1033 | 1033 | ||
1034 | p->mCompactDialogs = true; | 1034 | p->mCompactDialogs = true; |
1035 | p->mConfirm = true; | 1035 | p->mConfirm = true; |
1036 | // p->mEnableQuickTodo = false; | 1036 | // p->mEnableQuickTodo = false; |
1037 | 1037 | ||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | QString MainWindow::resourcePath() | 1040 | QString MainWindow::resourcePath() |
1041 | { | 1041 | { |
1042 | return KGlobal::iconLoader()->iconPath(); | 1042 | return KGlobal::iconLoader()->iconPath(); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | void MainWindow::displayText( QString text ,QString cap ) | 1045 | void MainWindow::displayText( QString text ,QString cap ) |
1046 | { | 1046 | { |
1047 | QDialog dia( this, "name", true ); ; | 1047 | QDialog dia( this, "name", true ); ; |
1048 | dia.setCaption( cap ); | 1048 | dia.setCaption( cap ); |
1049 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1049 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1050 | lay->setSpacing( 3 ); | 1050 | lay->setSpacing( 3 ); |
1051 | lay->setMargin( 3 ); | 1051 | lay->setMargin( 3 ); |
1052 | QTextBrowser tb ( &dia ); | 1052 | QTextBrowser tb ( &dia ); |
1053 | lay->addWidget( &tb ); | 1053 | lay->addWidget( &tb ); |
1054 | tb.setText( text ); | 1054 | tb.setText( text ); |
1055 | #ifdef DESKTOP_VERSION | 1055 | #ifdef DESKTOP_VERSION |
1056 | dia.resize( 640, 480); | 1056 | dia.resize( 640, 480); |
1057 | #else | 1057 | #else |
1058 | dia.showMaximized(); | 1058 | dia.showMaximized(); |
1059 | #endif | 1059 | #endif |
1060 | dia.exec(); | 1060 | dia.exec(); |
1061 | } | 1061 | } |
1062 | void MainWindow::displayFile( QString fn, QString cap ) | 1062 | void MainWindow::displayFile( QString fn, QString cap ) |
1063 | { | 1063 | { |
1064 | QString fileName = resourcePath() + fn; | 1064 | QString fileName = resourcePath() + fn; |
1065 | QString text; | 1065 | QString text; |
1066 | QFile file( fileName ); | 1066 | QFile file( fileName ); |
1067 | if (!file.open( IO_ReadOnly ) ) { | 1067 | if (!file.open( IO_ReadOnly ) ) { |
1068 | return ; | 1068 | return ; |
1069 | 1069 | ||
1070 | } | 1070 | } |
1071 | QTextStream ts( &file ); | 1071 | QTextStream ts( &file ); |
1072 | text = ts.read(); | 1072 | text = ts.read(); |
1073 | file.close(); | 1073 | file.close(); |
1074 | displayText( text, cap); | 1074 | displayText( text, cap); |
1075 | } | 1075 | } |
1076 | void MainWindow::features() | 1076 | void MainWindow::features() |
1077 | { | 1077 | { |
1078 | 1078 | ||
1079 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1079 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | void MainWindow::usertrans() | 1082 | void MainWindow::usertrans() |
1083 | { | 1083 | { |
1084 | 1084 | ||
1085 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1085 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | void MainWindow::synchowto() | 1088 | void MainWindow::synchowto() |
1089 | { | 1089 | { |
1090 | 1090 | ||
1091 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1091 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1092 | } | 1092 | } |
1093 | void MainWindow::faq() | 1093 | void MainWindow::faq() |
1094 | { | 1094 | { |
1095 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1095 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1096 | 1096 | ||
1097 | } | 1097 | } |
1098 | void MainWindow::whatsNew() | 1098 | void MainWindow::whatsNew() |
1099 | { | 1099 | { |
1100 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1100 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1101 | 1101 | ||
1102 | } | 1102 | } |
1103 | void MainWindow::licence() | 1103 | void MainWindow::licence() |
1104 | { | 1104 | { |
1105 | KApplication::showLicence(); | 1105 | KApplication::showLicence(); |
1106 | 1106 | ||
1107 | } | 1107 | } |
1108 | void MainWindow::about() | 1108 | void MainWindow::about() |
1109 | { | 1109 | { |
1110 | QString version; | 1110 | QString version; |
1111 | #include <../version> | 1111 | #include <../version> |
1112 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1112 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1113 | i18n("KOrganizer/Platform-independent\n") + | 1113 | i18n("KOrganizer/Platform-independent\n") + |
1114 | "(KO/Pi) " + version + " - " + | 1114 | "(KO/Pi) " + version + " - " + |
1115 | 1115 | ||
1116 | #ifdef DESKTOP_VERSION | 1116 | #ifdef DESKTOP_VERSION |
1117 | i18n("Desktop Edition\n") + | 1117 | i18n("Desktop Edition\n") + |
1118 | #else | 1118 | #else |
1119 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1119 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1120 | #endif | 1120 | #endif |
1121 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1121 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1122 | } | 1122 | } |
1123 | void MainWindow::keyBindings() | 1123 | void MainWindow::keyBindings() |
1124 | { | 1124 | { |
1125 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1125 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1126 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1126 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1127 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1127 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1128 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1128 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1129 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1129 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1130 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1130 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1131 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1131 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1132 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1132 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1133 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1133 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1134 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1134 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1135 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1135 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1136 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1136 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1137 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1137 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1138 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1138 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1139 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1139 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1140 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1140 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1141 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1141 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1142 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1142 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1143 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1143 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1144 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1144 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1145 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1145 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1146 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1146 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1147 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1147 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1148 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1148 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1149 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1149 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1150 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | ||
1151 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | ||
1152 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | ||
1150 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1153 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1151 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1154 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1152 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1155 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1153 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1156 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1154 | i18n("<p><h3>In list view:</h3></p>\n") + | 1157 | i18n("<p><h3>In list view:</h3></p>\n") + |
1155 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1158 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1156 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1159 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1157 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1160 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1158 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1161 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1159 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1162 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1160 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1163 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1161 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1164 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1162 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1165 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1163 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1166 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1164 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1167 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1165 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1168 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1166 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1169 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1167 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1170 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1168 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1171 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1169 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1172 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1170 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1173 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1171 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1174 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1172 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1175 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1173 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1176 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1174 | displayText( text, cap); | 1177 | displayText( text, cap); |
1175 | 1178 | ||
1176 | } | 1179 | } |
1177 | void MainWindow::aboutAutoSaving() | 1180 | void MainWindow::aboutAutoSaving() |
1178 | { | 1181 | { |
1179 | QMessageBox* msg; | 1182 | QMessageBox* msg; |
1180 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1183 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1181 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1184 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1182 | QMessageBox::Ok, | 1185 | QMessageBox::Ok, |
1183 | QMessageBox::NoButton, | 1186 | QMessageBox::NoButton, |
1184 | QMessageBox::NoButton); | 1187 | QMessageBox::NoButton); |
1185 | msg->exec(); | 1188 | msg->exec(); |
1186 | delete msg; | 1189 | delete msg; |
1187 | 1190 | ||
1188 | 1191 | ||
1189 | } | 1192 | } |
1190 | void MainWindow::aboutKnownBugs() | 1193 | void MainWindow::aboutKnownBugs() |
1191 | { | 1194 | { |
1192 | QMessageBox* msg; | 1195 | QMessageBox* msg; |
1193 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1196 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1194 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1197 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1195 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1198 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1196 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1199 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1197 | i18n("\nor report them in the bugtracker on\n") + | 1200 | i18n("\nor report them in the bugtracker on\n") + |
1198 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1201 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1199 | QMessageBox::NoIcon, | 1202 | QMessageBox::NoIcon, |
1200 | QMessageBox::Ok, | 1203 | QMessageBox::Ok, |
1201 | QMessageBox::NoButton, | 1204 | QMessageBox::NoButton, |
1202 | QMessageBox::NoButton); | 1205 | QMessageBox::NoButton); |
1203 | msg->exec(); | 1206 | msg->exec(); |
1204 | delete msg; | 1207 | delete msg; |
1205 | 1208 | ||
1206 | } | 1209 | } |
1207 | 1210 | ||
1208 | QString MainWindow::defaultFileName() | 1211 | QString MainWindow::defaultFileName() |
1209 | { | 1212 | { |
1210 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1213 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1211 | } | 1214 | } |
1212 | QString MainWindow::syncFileName() | 1215 | QString MainWindow::syncFileName() |
1213 | { | 1216 | { |
1214 | #ifdef _WIN32_ | 1217 | #ifdef _WIN32_ |
1215 | return locateLocal( "tmp", "synccalendar.ics" ); | 1218 | return locateLocal( "tmp", "synccalendar.ics" ); |
1216 | #else | 1219 | #else |
1217 | return QString( "/tmp/kopitempfile.ics" ); | 1220 | return QString( "/tmp/kopitempfile.ics" ); |
1218 | #endif | 1221 | #endif |
1219 | } | 1222 | } |
1220 | 1223 | ||
1221 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1224 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1222 | { | 1225 | { |
1223 | if ( !incidence ) { | 1226 | if ( !incidence ) { |
1224 | enableIncidenceActions( false ); | 1227 | enableIncidenceActions( false ); |
1225 | 1228 | ||
1226 | mNewSubTodoAction->setEnabled( false ); | 1229 | mNewSubTodoAction->setEnabled( false ); |
1227 | setCaptionToDates(); | 1230 | setCaptionToDates(); |
1228 | return; | 1231 | return; |
1229 | 1232 | ||
1230 | } | 1233 | } |
1231 | 1234 | ||
1232 | //KGlobal::locale()->formatDateTime(nextA, true); | 1235 | //KGlobal::locale()->formatDateTime(nextA, true); |
1233 | QString startString = ""; | 1236 | QString startString = ""; |
1234 | if ( incidence->type() != "Todo" ) { | 1237 | if ( incidence->type() != "Todo" ) { |
1235 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1238 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1236 | if ( incidence->doesFloat() ) { | 1239 | if ( incidence->doesFloat() ) { |
1237 | startString += ": "+incidence->dtStartDateStr( true ); | 1240 | startString += ": "+incidence->dtStartDateStr( true ); |
1238 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1241 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1239 | 1242 | ||
1240 | } else { | 1243 | } else { |
1241 | startString = ": "+incidence->dtStartStr(true); | 1244 | startString = ": "+incidence->dtStartStr(true); |
1242 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1245 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1243 | 1246 | ||
1244 | } | 1247 | } |
1245 | 1248 | ||
1246 | } else { | 1249 | } else { |
1247 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1250 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1248 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1251 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1249 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1252 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1250 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1253 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1251 | } | 1254 | } |
1252 | 1255 | ||
1253 | } | 1256 | } |
1254 | else | 1257 | else |
1255 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1258 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1256 | if ( !incidence->location().isEmpty() ) | 1259 | if ( !incidence->location().isEmpty() ) |
1257 | startString += " (" +incidence->location()+")"; | 1260 | startString += " (" +incidence->location()+")"; |
1258 | setCaption( incidence->summary()+startString); | 1261 | setCaption( incidence->summary()+startString); |
1259 | 1262 | ||
1260 | enableIncidenceActions( true ); | 1263 | enableIncidenceActions( true ); |
1261 | 1264 | ||
1262 | if ( incidence->type() == "Event" ) { | 1265 | if ( incidence->type() == "Event" ) { |
1263 | mShowAction->setText( i18n("Show Event...") ); | 1266 | mShowAction->setText( i18n("Show Event...") ); |
1264 | mEditAction->setText( i18n("Edit Event...") ); | 1267 | mEditAction->setText( i18n("Edit Event...") ); |
1265 | mDeleteAction->setText( i18n("Delete Event...") ); | 1268 | mDeleteAction->setText( i18n("Delete Event...") ); |
1266 | 1269 | ||
1267 | mNewSubTodoAction->setEnabled( false ); | 1270 | mNewSubTodoAction->setEnabled( false ); |
1268 | } else if ( incidence->type() == "Todo" ) { | 1271 | } else if ( incidence->type() == "Todo" ) { |
1269 | mShowAction->setText( i18n("Show Todo...") ); | 1272 | mShowAction->setText( i18n("Show Todo...") ); |
1270 | mEditAction->setText( i18n("Edit Todo...") ); | 1273 | mEditAction->setText( i18n("Edit Todo...") ); |
1271 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1274 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1272 | 1275 | ||
1273 | mNewSubTodoAction->setEnabled( true ); | 1276 | mNewSubTodoAction->setEnabled( true ); |
1274 | } else { | 1277 | } else { |
1275 | mShowAction->setText( i18n("Show...") ); | 1278 | mShowAction->setText( i18n("Show...") ); |
1276 | mShowAction->setText( i18n("Edit...") ); | 1279 | mShowAction->setText( i18n("Edit...") ); |
1277 | mShowAction->setText( i18n("Delete...") ); | 1280 | mShowAction->setText( i18n("Delete...") ); |
1278 | 1281 | ||
1279 | mNewSubTodoAction->setEnabled( false ); | 1282 | mNewSubTodoAction->setEnabled( false ); |
1280 | } | 1283 | } |
1281 | } | 1284 | } |
1282 | 1285 | ||
1283 | void MainWindow::enableIncidenceActions( bool enabled ) | 1286 | void MainWindow::enableIncidenceActions( bool enabled ) |
1284 | { | 1287 | { |
1285 | mShowAction->setEnabled( enabled ); | 1288 | mShowAction->setEnabled( enabled ); |
1286 | mEditAction->setEnabled( enabled ); | 1289 | mEditAction->setEnabled( enabled ); |
1287 | mDeleteAction->setEnabled( enabled ); | 1290 | mDeleteAction->setEnabled( enabled ); |
1288 | 1291 | ||
1289 | mCloneAction->setEnabled( enabled ); | 1292 | mCloneAction->setEnabled( enabled ); |
1290 | mMoveAction->setEnabled( enabled ); | 1293 | mMoveAction->setEnabled( enabled ); |
1291 | mBeamAction->setEnabled( enabled ); | 1294 | mBeamAction->setEnabled( enabled ); |
1292 | mCancelAction->setEnabled( enabled ); | 1295 | mCancelAction->setEnabled( enabled ); |
1293 | } | 1296 | } |
1294 | 1297 | ||
1295 | void MainWindow::importOL() | 1298 | void MainWindow::importOL() |
1296 | { | 1299 | { |
1297 | #ifdef _WIN32_ | 1300 | #ifdef _WIN32_ |
1298 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1301 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1299 | id->exec(); | 1302 | id->exec(); |
1300 | delete id; | 1303 | delete id; |
1301 | mView->updateView(); | 1304 | mView->updateView(); |
1302 | #endif | 1305 | #endif |
1303 | } | 1306 | } |
1304 | void MainWindow::importBday() | 1307 | void MainWindow::importBday() |
1305 | { | 1308 | { |
1306 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1309 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1307 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1310 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1308 | i18n("Import!"), i18n("Cancel"), 0, | 1311 | i18n("Import!"), i18n("Cancel"), 0, |
1309 | 0, 1 ); | 1312 | 0, 1 ); |
1310 | if ( result == 0 ) { | 1313 | if ( result == 0 ) { |
1311 | mView->importBday(); | 1314 | mView->importBday(); |
1312 | 1315 | ||
1313 | } | 1316 | } |
1314 | 1317 | ||
1315 | 1318 | ||
1316 | } | 1319 | } |
1317 | void MainWindow::importQtopia() | 1320 | void MainWindow::importQtopia() |
1318 | { | 1321 | { |
1319 | #ifndef DESKTOP_VERSION | 1322 | #ifndef DESKTOP_VERSION |
1320 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1323 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1321 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1324 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1322 | i18n("Import!"), i18n("Cancel"), 0, | 1325 | i18n("Import!"), i18n("Cancel"), 0, |
1323 | 0, 1 ); | 1326 | 0, 1 ); |
1324 | if ( result == 0 ) { | 1327 | if ( result == 0 ) { |
1325 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1328 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1326 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1329 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1327 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1330 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1328 | mView->importQtopia( categories, datebook, todolist ); | 1331 | mView->importQtopia( categories, datebook, todolist ); |
1329 | } | 1332 | } |
1330 | #else | 1333 | #else |
1331 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1334 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1332 | i18n("Not supported \non desktop!\n"), | 1335 | i18n("Not supported \non desktop!\n"), |
1333 | i18n("Ok"), i18n("Cancel"), 0, | 1336 | i18n("Ok"), i18n("Cancel"), 0, |
1334 | 0, 1 ); | 1337 | 0, 1 ); |
1335 | 1338 | ||
1336 | #endif | 1339 | #endif |
1337 | } | 1340 | } |
1338 | 1341 | ||
1339 | void MainWindow::saveOnClose() | 1342 | void MainWindow::saveOnClose() |
1340 | { | 1343 | { |
1341 | KOPrefs *p = KOPrefs::instance(); | 1344 | KOPrefs *p = KOPrefs::instance(); |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 2856f2d..6477d11 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -1698,388 +1698,389 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1698 | }; | 1698 | }; |
1699 | 1699 | ||
1700 | for (int i=0; i<items; i++) | 1700 | for (int i=0; i<items; i++) |
1701 | { | 1701 | { |
1702 | if (shiftOrCtrl) | 1702 | if (shiftOrCtrl) |
1703 | nextItem->setSelected(!nextItem->isSelected()); | 1703 | nextItem->setSelected(!nextItem->isSelected()); |
1704 | //the end | 1704 | //the end |
1705 | if ((i==items-1) || (nextItem->itemBelow()==0)) | 1705 | if ((i==items-1) || (nextItem->itemBelow()==0)) |
1706 | 1706 | ||
1707 | { | 1707 | { |
1708 | if (shiftOrCtrl) | 1708 | if (shiftOrCtrl) |
1709 | nextItem->setSelected(!nextItem->isSelected()); | 1709 | nextItem->setSelected(!nextItem->isSelected()); |
1710 | if (d->selectedBySimpleMove) | 1710 | if (d->selectedBySimpleMove) |
1711 | nextItem->setSelected(true); | 1711 | nextItem->setSelected(true); |
1712 | ensureItemVisible(nextItem); | 1712 | ensureItemVisible(nextItem); |
1713 | setCurrentItem(nextItem); | 1713 | setCurrentItem(nextItem); |
1714 | update(); | 1714 | update(); |
1715 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1715 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1716 | { | 1716 | { |
1717 | emit selectionChanged(); | 1717 | emit selectionChanged(); |
1718 | } | 1718 | } |
1719 | return; | 1719 | return; |
1720 | } | 1720 | } |
1721 | nextItem=nextItem->itemBelow(); | 1721 | nextItem=nextItem->itemBelow(); |
1722 | } | 1722 | } |
1723 | break; | 1723 | break; |
1724 | 1724 | ||
1725 | case Key_Prior: | 1725 | case Key_Prior: |
1726 | items=visibleHeight()/item->height(); | 1726 | items=visibleHeight()/item->height(); |
1727 | nextItem=item; | 1727 | nextItem=item; |
1728 | if (d->selectedBySimpleMove) | 1728 | if (d->selectedBySimpleMove) |
1729 | item->setSelected(false); | 1729 | item->setSelected(false); |
1730 | if (shiftOrCtrl) | 1730 | if (shiftOrCtrl) |
1731 | { | 1731 | { |
1732 | d->selectionDirection=-1; | 1732 | d->selectionDirection=-1; |
1733 | d->selectedBySimpleMove=false; | 1733 | d->selectedBySimpleMove=false; |
1734 | }; | 1734 | }; |
1735 | 1735 | ||
1736 | for (int i=0; i<items; i++) | 1736 | for (int i=0; i<items; i++) |
1737 | { | 1737 | { |
1738 | if ((nextItem!=item) &&(shiftOrCtrl)) | 1738 | if ((nextItem!=item) &&(shiftOrCtrl)) |
1739 | nextItem->setSelected(!nextItem->isSelected()); | 1739 | nextItem->setSelected(!nextItem->isSelected()); |
1740 | //the end | 1740 | //the end |
1741 | if ((i==items-1) || (nextItem->itemAbove()==0)) | 1741 | if ((i==items-1) || (nextItem->itemAbove()==0)) |
1742 | 1742 | ||
1743 | { | 1743 | { |
1744 | if (d->selectedBySimpleMove) | 1744 | if (d->selectedBySimpleMove) |
1745 | nextItem->setSelected(true); | 1745 | nextItem->setSelected(true); |
1746 | ensureItemVisible(nextItem); | 1746 | ensureItemVisible(nextItem); |
1747 | setCurrentItem(nextItem); | 1747 | setCurrentItem(nextItem); |
1748 | update(); | 1748 | update(); |
1749 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1749 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1750 | { | 1750 | { |
1751 | emit selectionChanged(); | 1751 | emit selectionChanged(); |
1752 | } | 1752 | } |
1753 | return; | 1753 | return; |
1754 | } | 1754 | } |
1755 | nextItem=nextItem->itemAbove(); | 1755 | nextItem=nextItem->itemAbove(); |
1756 | } | 1756 | } |
1757 | break; | 1757 | break; |
1758 | 1758 | ||
1759 | case Key_Minus: | 1759 | case Key_Minus: |
1760 | if ( item->isOpen() ) | 1760 | if ( item->isOpen() ) |
1761 | setOpen( item, FALSE ); | 1761 | setOpen( item, FALSE ); |
1762 | break; | 1762 | break; |
1763 | case Key_Plus: | 1763 | case Key_Plus: |
1764 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) | 1764 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) |
1765 | setOpen( item, TRUE ); | 1765 | setOpen( item, TRUE ); |
1766 | break; | 1766 | break; |
1767 | default: | 1767 | default: |
1768 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1768 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) |
1769 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); | 1769 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); |
1770 | 1770 | ||
1771 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); | 1771 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); |
1772 | if (realKey && selectCurrentItem) | 1772 | if (realKey && selectCurrentItem) |
1773 | item->setSelected(false); | 1773 | item->setSelected(false); |
1774 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) | 1774 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) |
1775 | QListView::SelectionMode oldSelectionMode = selectionMode(); | 1775 | QListView::SelectionMode oldSelectionMode = selectionMode(); |
1776 | setSelectionMode (QListView::Multi); | 1776 | setSelectionMode (QListView::Multi); |
1777 | QListView::keyPressEvent (e); | 1777 | QListView::keyPressEvent (e); |
1778 | setSelectionMode (oldSelectionMode); | 1778 | setSelectionMode (oldSelectionMode); |
1779 | if (realKey && selectCurrentItem) | 1779 | if (realKey && selectCurrentItem) |
1780 | { | 1780 | { |
1781 | currentItem()->setSelected(true); | 1781 | currentItem()->setSelected(true); |
1782 | emitSelectionChanged=TRUE; | 1782 | emitSelectionChanged=TRUE; |
1783 | } | 1783 | } |
1784 | repaintItem2=currentItem(); | 1784 | repaintItem2=currentItem(); |
1785 | if (realKey) | 1785 | if (realKey) |
1786 | visItem=currentItem(); | 1786 | visItem=currentItem(); |
1787 | break; | 1787 | break; |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | if (visItem) | 1790 | if (visItem) |
1791 | ensureItemVisible(visItem); | 1791 | ensureItemVisible(visItem); |
1792 | 1792 | ||
1793 | QRect ir; | 1793 | QRect ir; |
1794 | if (repaintItem1) | 1794 | if (repaintItem1) |
1795 | ir = ir.unite( itemRect(repaintItem1) ); | 1795 | ir = ir.unite( itemRect(repaintItem1) ); |
1796 | if (repaintItem2) | 1796 | if (repaintItem2) |
1797 | ir = ir.unite( itemRect(repaintItem2) ); | 1797 | ir = ir.unite( itemRect(repaintItem2) ); |
1798 | 1798 | ||
1799 | if ( !ir.isEmpty() ) | 1799 | if ( !ir.isEmpty() ) |
1800 | { // rectangle to be repainted | 1800 | { // rectangle to be repainted |
1801 | if ( ir.x() < 0 ) | 1801 | if ( ir.x() < 0 ) |
1802 | ir.moveBy( -ir.x(), 0 ); | 1802 | ir.moveBy( -ir.x(), 0 ); |
1803 | viewport()->repaint( ir, FALSE ); | 1803 | viewport()->repaint( ir, FALSE ); |
1804 | } | 1804 | } |
1805 | /*if (repaintItem1) | 1805 | /*if (repaintItem1) |
1806 | repaintItem1->repaint(); | 1806 | repaintItem1->repaint(); |
1807 | if (repaintItem2) | 1807 | if (repaintItem2) |
1808 | repaintItem2->repaint();*/ | 1808 | repaintItem2->repaint();*/ |
1809 | update(); | 1809 | update(); |
1810 | if (emitSelectionChanged) | 1810 | if (emitSelectionChanged) |
1811 | emit selectionChanged(); | 1811 | emit selectionChanged(); |
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | void KListView::setSelectionModeExt (SelectionModeExt mode) | 1814 | void KListView::setSelectionModeExt (SelectionModeExt mode) |
1815 | { | 1815 | { |
1816 | d->selectionMode = mode; | 1816 | d->selectionMode = mode; |
1817 | 1817 | ||
1818 | switch (mode) | 1818 | switch (mode) |
1819 | { | 1819 | { |
1820 | case Single: | 1820 | case Single: |
1821 | case Multi: | 1821 | case Multi: |
1822 | case Extended: | 1822 | case Extended: |
1823 | case NoSelection: | 1823 | case NoSelection: |
1824 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); | 1824 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); |
1825 | break; | 1825 | break; |
1826 | 1826 | ||
1827 | case FileManager: | 1827 | case FileManager: |
1828 | setSelectionMode (QListView::Extended); | 1828 | setSelectionMode (QListView::Extended); |
1829 | break; | 1829 | break; |
1830 | 1830 | ||
1831 | default: | 1831 | default: |
1832 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; | 1832 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; |
1833 | break; | 1833 | break; |
1834 | } | 1834 | } |
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | KListView::SelectionModeExt KListView::selectionModeExt () const | 1837 | KListView::SelectionModeExt KListView::selectionModeExt () const |
1838 | { | 1838 | { |
1839 | return d->selectionMode; | 1839 | return d->selectionMode; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | int KListView::itemIndex( const QListViewItem *item ) const | 1842 | int KListView::itemIndex( const QListViewItem *item ) const |
1843 | { | 1843 | { |
1844 | if ( !item ) | 1844 | if ( !item ) |
1845 | return -1; | 1845 | return -1; |
1846 | 1846 | ||
1847 | if ( item == firstChild() ) | 1847 | if ( item == firstChild() ) |
1848 | return 0; | 1848 | return 0; |
1849 | else { | 1849 | else { |
1850 | QListViewItemIterator it(firstChild()); | 1850 | QListViewItemIterator it(firstChild()); |
1851 | uint j = 0; | 1851 | uint j = 0; |
1852 | for (; it.current() && it.current() != item; ++it, ++j ); | 1852 | for (; it.current() && it.current() != item; ++it, ++j ); |
1853 | 1853 | ||
1854 | if( !it.current() ) | 1854 | if( !it.current() ) |
1855 | return -1; | 1855 | return -1; |
1856 | 1856 | ||
1857 | return j; | 1857 | return j; |
1858 | } | 1858 | } |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | QListViewItem* KListView::itemAtIndex(int index) | 1861 | QListViewItem* KListView::itemAtIndex(int index) |
1862 | { | 1862 | { |
1863 | if (index<0) | 1863 | if (index<0) |
1864 | return 0; | 1864 | return 0; |
1865 | 1865 | ||
1866 | int j(0); | 1866 | int j(0); |
1867 | for (QListViewItemIterator it=firstChild(); it.current(); it++) | 1867 | for (QListViewItemIterator it=firstChild(); it.current(); it++) |
1868 | { | 1868 | { |
1869 | if (j==index) | 1869 | if (j==index) |
1870 | return it.current(); | 1870 | return it.current(); |
1871 | j++; | 1871 | j++; |
1872 | }; | 1872 | }; |
1873 | return 0; | 1873 | return 0; |
1874 | } | 1874 | } |
1875 | 1875 | ||
1876 | 1876 | ||
1877 | void KListView::emitContextMenu (KListView*, QListViewItem* i) | 1877 | void KListView::emitContextMenu (KListView*, QListViewItem* i) |
1878 | { | 1878 | { |
1879 | QPoint p; | 1879 | QPoint p; |
1880 | qDebug("KListView::emitContextMenu "); | 1880 | qDebug("KListView::emitContextMenu "); |
1881 | 1881 | ||
1882 | if (i) | 1882 | if (i) |
1883 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1883 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1884 | else | 1884 | else |
1885 | p = mapToGlobal(rect().center()); | 1885 | p = mapToGlobal(rect().center()); |
1886 | 1886 | ||
1887 | emit contextMenu (this, i, p); | 1887 | emit contextMenu (this, i, p); |
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int) | 1890 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) |
1891 | { | 1891 | { |
1892 | qDebug("KListView::emitContextMenu "); | 1892 | qDebug("KListView::emitContextMenu col"); |
1893 | emit contextMenu (this, i, p); | 1893 | emit contextRequest( i, p, col ); |
1894 | emit contextMenu (this, i, p); | ||
1894 | } | 1895 | } |
1895 | 1896 | ||
1896 | void KListView::setAcceptDrops (bool val) | 1897 | void KListView::setAcceptDrops (bool val) |
1897 | { | 1898 | { |
1898 | QListView::setAcceptDrops (val); | 1899 | QListView::setAcceptDrops (val); |
1899 | viewport()->setAcceptDrops (val); | 1900 | viewport()->setAcceptDrops (val); |
1900 | } | 1901 | } |
1901 | 1902 | ||
1902 | int KListView::dropVisualizerWidth () const | 1903 | int KListView::dropVisualizerWidth () const |
1903 | { | 1904 | { |
1904 | return d->mDropVisualizerWidth; | 1905 | return d->mDropVisualizerWidth; |
1905 | } | 1906 | } |
1906 | 1907 | ||
1907 | 1908 | ||
1908 | void KListView::viewportPaintEvent(QPaintEvent *e) | 1909 | void KListView::viewportPaintEvent(QPaintEvent *e) |
1909 | { | 1910 | { |
1910 | QListView::viewportPaintEvent(e); | 1911 | QListView::viewportPaintEvent(e); |
1911 | 1912 | ||
1912 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) | 1913 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) |
1913 | { | 1914 | { |
1914 | QPainter painter(viewport()); | 1915 | QPainter painter(viewport()); |
1915 | 1916 | ||
1916 | // This is where we actually draw the drop-visualizer | 1917 | // This is where we actually draw the drop-visualizer |
1917 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); | 1918 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); |
1918 | } | 1919 | } |
1919 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) | 1920 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) |
1920 | { | 1921 | { |
1921 | QPainter painter(viewport()); | 1922 | QPainter painter(viewport()); |
1922 | 1923 | ||
1923 | qDebug("KListView::viewportPaintEvent has to be verified"); | 1924 | qDebug("KListView::viewportPaintEvent has to be verified"); |
1924 | 1925 | ||
1925 | // This is where we actually draw the drop-highlighter | 1926 | // This is where we actually draw the drop-highlighter |
1926 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), | 1927 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), |
1927 | //US QStyle::Style_FocusAtBorder); | 1928 | //US QStyle::Style_FocusAtBorder); |
1928 | 1929 | ||
1929 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); | 1930 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); |
1930 | 1931 | ||
1931 | 1932 | ||
1932 | } | 1933 | } |
1933 | } | 1934 | } |
1934 | 1935 | ||
1935 | void KListView::setFullWidth() | 1936 | void KListView::setFullWidth() |
1936 | { | 1937 | { |
1937 | setFullWidth(true); | 1938 | setFullWidth(true); |
1938 | } | 1939 | } |
1939 | 1940 | ||
1940 | void KListView::setFullWidth(bool fullWidth) | 1941 | void KListView::setFullWidth(bool fullWidth) |
1941 | { | 1942 | { |
1942 | d->fullWidth = fullWidth; | 1943 | d->fullWidth = fullWidth; |
1943 | //US header()->setStretchEnabled(fullWidth, columns()-1); | 1944 | //US header()->setStretchEnabled(fullWidth, columns()-1); |
1944 | } | 1945 | } |
1945 | 1946 | ||
1946 | bool KListView::fullWidth() const | 1947 | bool KListView::fullWidth() const |
1947 | { | 1948 | { |
1948 | return d->fullWidth; | 1949 | return d->fullWidth; |
1949 | } | 1950 | } |
1950 | 1951 | ||
1951 | int KListView::addColumn(const QString& label, int width) | 1952 | int KListView::addColumn(const QString& label, int width) |
1952 | { | 1953 | { |
1953 | int result = QListView::addColumn(label, width); | 1954 | int result = QListView::addColumn(label, width); |
1954 | if (d->fullWidth) { | 1955 | if (d->fullWidth) { |
1955 | //US header()->setStretchEnabled(false, columns()-2); | 1956 | //US header()->setStretchEnabled(false, columns()-2); |
1956 | //US header()->setStretchEnabled(true, columns()-1); | 1957 | //US header()->setStretchEnabled(true, columns()-1); |
1957 | } | 1958 | } |
1958 | return result; | 1959 | return result; |
1959 | } | 1960 | } |
1960 | 1961 | ||
1961 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) | 1962 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) |
1962 | { | 1963 | { |
1963 | int result = QListView::addColumn(iconset, label, width); | 1964 | int result = QListView::addColumn(iconset, label, width); |
1964 | if (d->fullWidth) { | 1965 | if (d->fullWidth) { |
1965 | //US header()->setStretchEnabled(false, columns()-2); | 1966 | //US header()->setStretchEnabled(false, columns()-2); |
1966 | //US header()->setStretchEnabled(true, columns()-1); | 1967 | //US header()->setStretchEnabled(true, columns()-1); |
1967 | } | 1968 | } |
1968 | return result; | 1969 | return result; |
1969 | } | 1970 | } |
1970 | 1971 | ||
1971 | void KListView::removeColumn(int index) | 1972 | void KListView::removeColumn(int index) |
1972 | { | 1973 | { |
1973 | QListView::removeColumn(index); | 1974 | QListView::removeColumn(index); |
1974 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); | 1975 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); |
1975 | } | 1976 | } |
1976 | 1977 | ||
1977 | void KListView::viewportResizeEvent(QResizeEvent* e) | 1978 | void KListView::viewportResizeEvent(QResizeEvent* e) |
1978 | { | 1979 | { |
1979 | QListView::viewportResizeEvent(e); | 1980 | QListView::viewportResizeEvent(e); |
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | const QColor &KListView::alternateBackground() const | 1983 | const QColor &KListView::alternateBackground() const |
1983 | { | 1984 | { |
1984 | return d->alternateBackground; | 1985 | return d->alternateBackground; |
1985 | } | 1986 | } |
1986 | 1987 | ||
1987 | void KListView::setAlternateBackground(const QColor &c) | 1988 | void KListView::setAlternateBackground(const QColor &c) |
1988 | { | 1989 | { |
1989 | d->alternateBackground = c; | 1990 | d->alternateBackground = c; |
1990 | repaint(); | 1991 | repaint(); |
1991 | } | 1992 | } |
1992 | 1993 | ||
1993 | void KListView::saveLayout(KConfig *config, const QString &group) const | 1994 | void KListView::saveLayout(KConfig *config, const QString &group) const |
1994 | { | 1995 | { |
1995 | KConfigGroupSaver saver(config, group); | 1996 | KConfigGroupSaver saver(config, group); |
1996 | QStringList widths, order; | 1997 | QStringList widths, order; |
1997 | for (int i = 0; i < columns(); ++i) | 1998 | for (int i = 0; i < columns(); ++i) |
1998 | { | 1999 | { |
1999 | widths << QString::number(columnWidth(i)); | 2000 | widths << QString::number(columnWidth(i)); |
2000 | order << QString::number(header()->mapToIndex(i)); | 2001 | order << QString::number(header()->mapToIndex(i)); |
2001 | } | 2002 | } |
2002 | config->writeEntry("ColumnWidths", widths); | 2003 | config->writeEntry("ColumnWidths", widths); |
2003 | config->writeEntry("ColumnOrder", order); | 2004 | config->writeEntry("ColumnOrder", order); |
2004 | config->writeEntry("SortColumn", d->sortColumn); | 2005 | config->writeEntry("SortColumn", d->sortColumn); |
2005 | config->writeEntry("SortAscending", d->sortAscending); | 2006 | config->writeEntry("SortAscending", d->sortAscending); |
2006 | } | 2007 | } |
2007 | 2008 | ||
2008 | void KListView::restoreLayout(KConfig *config, const QString &group) | 2009 | void KListView::restoreLayout(KConfig *config, const QString &group) |
2009 | { | 2010 | { |
2010 | KConfigGroupSaver saver(config, group); | 2011 | KConfigGroupSaver saver(config, group); |
2011 | QStringList cols = config->readListEntry("ColumnWidths"); | 2012 | QStringList cols = config->readListEntry("ColumnWidths"); |
2012 | int i = 0; | 2013 | int i = 0; |
2013 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2014 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2014 | setColumnWidth(i++, (*it).toInt()); | 2015 | setColumnWidth(i++, (*it).toInt()); |
2015 | 2016 | ||
2016 | cols = config->readListEntry("ColumnOrder"); | 2017 | cols = config->readListEntry("ColumnOrder"); |
2017 | i = 0; | 2018 | i = 0; |
2018 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2019 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2019 | header()->moveSection(i++, (*it).toInt()); | 2020 | header()->moveSection(i++, (*it).toInt()); |
2020 | 2021 | ||
2021 | /*US I changed the following code, because hasKey is not available. | 2022 | /*US I changed the following code, because hasKey is not available. |
2022 | !!! check if my version is correct | 2023 | !!! check if my version is correct |
2023 | if (config->hasKey("SortColumn")) | 2024 | if (config->hasKey("SortColumn")) |
2024 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2025 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2025 | */ | 2026 | */ |
2026 | QStringList langLst = config->readListEntry( "SortColumn" ); | 2027 | QStringList langLst = config->readListEntry( "SortColumn" ); |
2027 | if (!langLst.isEmpty()) | 2028 | if (!langLst.isEmpty()) |
2028 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2029 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2029 | } | 2030 | } |
2030 | 2031 | ||
2031 | void KListView::setSorting(int column, bool ascending) | 2032 | void KListView::setSorting(int column, bool ascending) |
2032 | { | 2033 | { |
2033 | d->sortColumn = column; | 2034 | d->sortColumn = column; |
2034 | d->sortAscending = ascending; | 2035 | d->sortAscending = ascending; |
2035 | QListView::setSorting(column, ascending); | 2036 | QListView::setSorting(column, ascending); |
2036 | } | 2037 | } |
2037 | 2038 | ||
2038 | int KListView::columnSorted(void) const | 2039 | int KListView::columnSorted(void) const |
2039 | { | 2040 | { |
2040 | return d->sortColumn; | 2041 | return d->sortColumn; |
2041 | } | 2042 | } |
2042 | 2043 | ||
2043 | bool KListView::ascendingSort(void) const | 2044 | bool KListView::ascendingSort(void) const |
2044 | { | 2045 | { |
2045 | return d->sortAscending; | 2046 | return d->sortAscending; |
2046 | } | 2047 | } |
2047 | 2048 | ||
2048 | KListViewItem::KListViewItem(QListView *parent) | 2049 | KListViewItem::KListViewItem(QListView *parent) |
2049 | : QListViewItem(parent) | 2050 | : QListViewItem(parent) |
2050 | { | 2051 | { |
2051 | init(); | 2052 | init(); |
2052 | } | 2053 | } |
2053 | 2054 | ||
2054 | KListViewItem::KListViewItem(QListViewItem *parent) | 2055 | KListViewItem::KListViewItem(QListViewItem *parent) |
2055 | : QListViewItem(parent) | 2056 | : QListViewItem(parent) |
2056 | { | 2057 | { |
2057 | init(); | 2058 | init(); |
2058 | } | 2059 | } |
2059 | 2060 | ||
2060 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) | 2061 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) |
2061 | : QListViewItem(parent, after) | 2062 | : QListViewItem(parent, after) |
2062 | { | 2063 | { |
2063 | init(); | 2064 | init(); |
2064 | } | 2065 | } |
2065 | 2066 | ||
2066 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) | 2067 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) |
2067 | : QListViewItem(parent, after) | 2068 | : QListViewItem(parent, after) |
2068 | { | 2069 | { |
2069 | init(); | 2070 | init(); |
2070 | } | 2071 | } |
2071 | 2072 | ||
2072 | KListViewItem::KListViewItem(QListView *parent, | 2073 | KListViewItem::KListViewItem(QListView *parent, |
2073 | QString label1, QString label2, QString label3, QString label4, | 2074 | QString label1, QString label2, QString label3, QString label4, |
2074 | QString label5, QString label6, QString label7, QString label8) | 2075 | QString label5, QString label6, QString label7, QString label8) |
2075 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2076 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2076 | { | 2077 | { |
2077 | init(); | 2078 | init(); |
2078 | } | 2079 | } |
2079 | 2080 | ||
2080 | KListViewItem::KListViewItem(QListViewItem *parent, | 2081 | KListViewItem::KListViewItem(QListViewItem *parent, |
2081 | QString label1, QString label2, QString label3, QString label4, | 2082 | QString label1, QString label2, QString label3, QString label4, |
2082 | QString label5, QString label6, QString label7, QString label8) | 2083 | QString label5, QString label6, QString label7, QString label8) |
2083 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2084 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2084 | { | 2085 | { |
2085 | init(); | 2086 | init(); |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index f7d9f85..8d933f6 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -224,384 +224,385 @@ public: | |||
224 | * @see #setRenameable() | 224 | * @see #setRenameable() |
225 | */ | 225 | */ |
226 | bool isRenameable (int column) const; | 226 | bool isRenameable (int column) const; |
227 | 227 | ||
228 | /** | 228 | /** |
229 | * @return true if drawing of the drop-visualizer has been enabled. True by default. | 229 | * @return true if drawing of the drop-visualizer has been enabled. True by default. |
230 | * | 230 | * |
231 | * @see #setDropVisualizer() | 231 | * @see #setDropVisualizer() |
232 | */ | 232 | */ |
233 | bool dropVisualizer() const; | 233 | bool dropVisualizer() const; |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * @return the column for which tooltips are displayed (or -1 if none set). | 236 | * @return the column for which tooltips are displayed (or -1 if none set). |
237 | * | 237 | * |
238 | * @see #setTooltipColumn() | 238 | * @see #setTooltipColumn() |
239 | */ | 239 | */ |
240 | int tooltipColumn() const; | 240 | int tooltipColumn() const; |
241 | 241 | ||
242 | /** | 242 | /** |
243 | * For future expansions. | 243 | * For future expansions. |
244 | * | 244 | * |
245 | * Do not use. | 245 | * Do not use. |
246 | * @deprecated | 246 | * @deprecated |
247 | */ | 247 | */ |
248 | bool createChildren() const; | 248 | bool createChildren() const; |
249 | 249 | ||
250 | /** | 250 | /** |
251 | * @return true if drawing of the drop-highlighter has been enabled. False by default. | 251 | * @return true if drawing of the drop-highlighter has been enabled. False by default. |
252 | * | 252 | * |
253 | * @see #setDropHighlighter() | 253 | * @see #setDropHighlighter() |
254 | */ | 254 | */ |
255 | bool dropHighlighter() const; | 255 | bool dropHighlighter() const; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * The dropVisualizerWidth defaults to 4. | 258 | * The dropVisualizerWidth defaults to 4. |
259 | * | 259 | * |
260 | * @see #setDropVisualizerWidth() | 260 | * @see #setDropVisualizerWidth() |
261 | * @return the current width of the drop-visualizer. | 261 | * @return the current width of the drop-visualizer. |
262 | */ | 262 | */ |
263 | int dropVisualizerWidth () const; | 263 | int dropVisualizerWidth () const; |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * @return the "extended" selection mode of this listview. | 266 | * @return the "extended" selection mode of this listview. |
267 | * | 267 | * |
268 | * @see SelectionModeExt | 268 | * @see SelectionModeExt |
269 | * @see setSelectionModeExt | 269 | * @see setSelectionModeExt |
270 | */ | 270 | */ |
271 | SelectionModeExt selectionModeExt () const; | 271 | SelectionModeExt selectionModeExt () const; |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * Returns the index of @p item within the item tree or -1 if | 274 | * Returns the index of @p item within the item tree or -1 if |
275 | * @p item doesn't exist in this list view. This function takes | 275 | * @p item doesn't exist in this list view. This function takes |
276 | * all items into account not only the visible ones. | 276 | * all items into account not only the visible ones. |
277 | */ | 277 | */ |
278 | int itemIndex( const QListViewItem *item ) const; | 278 | int itemIndex( const QListViewItem *item ) const; |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * Returns the item of @p index within the item tree or 0 if | 281 | * Returns the item of @p index within the item tree or 0 if |
282 | * @p index doesn't exist in this list view. This function takes | 282 | * @p index doesn't exist in this list view. This function takes |
283 | * all items into account not only the visible ones. | 283 | * all items into account not only the visible ones. |
284 | */ | 284 | */ |
285 | QListViewItem* itemAtIndex(int index); | 285 | QListViewItem* itemAtIndex(int index); |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * @deprecated | 288 | * @deprecated |
289 | * @see #setFullWidth() | 289 | * @see #setFullWidth() |
290 | */ | 290 | */ |
291 | void setFullWidth(); | 291 | void setFullWidth(); |
292 | 292 | ||
293 | /** | 293 | /** |
294 | * Let the last column fit exactly all the available width. | 294 | * Let the last column fit exactly all the available width. |
295 | * | 295 | * |
296 | * @see #fullWidth() | 296 | * @see #fullWidth() |
297 | */ | 297 | */ |
298 | void setFullWidth(bool fullWidth); | 298 | void setFullWidth(bool fullWidth); |
299 | 299 | ||
300 | /** | 300 | /** |
301 | * Returns whether the last column is set to fit the available width. | 301 | * Returns whether the last column is set to fit the available width. |
302 | * | 302 | * |
303 | * @see #setFullWidth() | 303 | * @see #setFullWidth() |
304 | */ | 304 | */ |
305 | bool fullWidth() const; | 305 | bool fullWidth() const; |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Reimplemented for full width support | 308 | * Reimplemented for full width support |
309 | * | 309 | * |
310 | * @see #removeColumn() | 310 | * @see #removeColumn() |
311 | */ | 311 | */ |
312 | virtual int addColumn(const QString& label, int width = -1); | 312 | virtual int addColumn(const QString& label, int width = -1); |
313 | /** | 313 | /** |
314 | * Reimplemented for full width support | 314 | * Reimplemented for full width support |
315 | */ | 315 | */ |
316 | virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); | 316 | virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); |
317 | /** | 317 | /** |
318 | * Reimplemented for full width support | 318 | * Reimplemented for full width support |
319 | * | 319 | * |
320 | * @see #addColumn() | 320 | * @see #addColumn() |
321 | */ | 321 | */ |
322 | virtual void removeColumn(int index); | 322 | virtual void removeColumn(int index); |
323 | 323 | ||
324 | /** | 324 | /** |
325 | * sets the alternate background background color. | 325 | * sets the alternate background background color. |
326 | * This only has an effect if the items are KListViewItems | 326 | * This only has an effect if the items are KListViewItems |
327 | * | 327 | * |
328 | * @param c the color to use for every other item. Set to an invalid | 328 | * @param c the color to use for every other item. Set to an invalid |
329 | * colour to disable alternate colours. | 329 | * colour to disable alternate colours. |
330 | * | 330 | * |
331 | * @see #alternateBackground() | 331 | * @see #alternateBackground() |
332 | **/ | 332 | **/ |
333 | void setAlternateBackground(const QColor &c); | 333 | void setAlternateBackground(const QColor &c); |
334 | /** | 334 | /** |
335 | * @return the alternate background color | 335 | * @return the alternate background color |
336 | * | 336 | * |
337 | * @see #setAlternateBackground() | 337 | * @see #setAlternateBackground() |
338 | */ | 338 | */ |
339 | const QColor &alternateBackground() const; | 339 | const QColor &alternateBackground() const; |
340 | 340 | ||
341 | /** | 341 | /** |
342 | * Saves the list view's layout (column widtsh, column order, sort column) | 342 | * Saves the list view's layout (column widtsh, column order, sort column) |
343 | * to a KConfig group | 343 | * to a KConfig group |
344 | * | 344 | * |
345 | * @param config the @ref KConfig object to write to | 345 | * @param config the @ref KConfig object to write to |
346 | * @param group the config group to use | 346 | * @param group the config group to use |
347 | */ | 347 | */ |
348 | void saveLayout(KConfig *config, const QString &group) const; | 348 | void saveLayout(KConfig *config, const QString &group) const; |
349 | /** | 349 | /** |
350 | * Reads the list view's layout from a KConfig group as stored with | 350 | * Reads the list view's layout from a KConfig group as stored with |
351 | * @ref #saveLayout | 351 | * @ref #saveLayout |
352 | * | 352 | * |
353 | * @param config the @ref KConfig object to read from | 353 | * @param config the @ref KConfig object to read from |
354 | * @param group the config group to use | 354 | * @param group the config group to use |
355 | */ | 355 | */ |
356 | void restoreLayout(KConfig *config, const QString &group); | 356 | void restoreLayout(KConfig *config, const QString &group); |
357 | /** | 357 | /** |
358 | * Reimplemented to remember the current sort column and order. | 358 | * Reimplemented to remember the current sort column and order. |
359 | * @param column is the column to be sorted, or -1 to sort in order of | 359 | * @param column is the column to be sorted, or -1 to sort in order of |
360 | * insertion | 360 | * insertion |
361 | * @param whether to sort ascending (or descending) | 361 | * @param whether to sort ascending (or descending) |
362 | */ | 362 | */ |
363 | virtual void setSorting(int column, bool ascending = true); | 363 | virtual void setSorting(int column, bool ascending = true); |
364 | 364 | ||
365 | /** | 365 | /** |
366 | * @return the currently sorted column, or -1 if none is sorted | 366 | * @return the currently sorted column, or -1 if none is sorted |
367 | */ | 367 | */ |
368 | int columnSorted(void) const; | 368 | int columnSorted(void) const; |
369 | 369 | ||
370 | /** | 370 | /** |
371 | * @return whether the current sort is ascending (or descending) | 371 | * @return whether the current sort is ascending (or descending) |
372 | */ | 372 | */ |
373 | bool ascendingSort(void) const; | 373 | bool ascendingSort(void) const; |
374 | 374 | ||
375 | signals: | 375 | signals: |
376 | 376 | ||
377 | /** | 377 | /** |
378 | * This signal is emitted whenever the user executes an listview item. | 378 | * This signal is emitted whenever the user executes an listview item. |
379 | * That means depending on the KDE wide Single Click/Double Click | 379 | * That means depending on the KDE wide Single Click/Double Click |
380 | * setting the user clicked or double clicked on that item. | 380 | * setting the user clicked or double clicked on that item. |
381 | * @param item is the pointer to the executed listview item. | 381 | * @param item is the pointer to the executed listview item. |
382 | * | 382 | * |
383 | * Note that you may not delete any @ref QListViewItem objects in slots | 383 | * Note that you may not delete any @ref QListViewItem objects in slots |
384 | * connected to this signal. | 384 | * connected to this signal. |
385 | */ | 385 | */ |
386 | void executed( QListViewItem *item ); | 386 | void executed( QListViewItem *item ); |
387 | 387 | ||
388 | /** | 388 | /** |
389 | * This signal is emitted whenever the user executes an listview item. | 389 | * This signal is emitted whenever the user executes an listview item. |
390 | * That means depending on the KDE wide Single Click/Double Click | 390 | * That means depending on the KDE wide Single Click/Double Click |
391 | * setting the user clicked or double clicked on that item. | 391 | * setting the user clicked or double clicked on that item. |
392 | * @param item is the pointer to the executed listview item. | 392 | * @param item is the pointer to the executed listview item. |
393 | * @param pos is the position where the user has clicked | 393 | * @param pos is the position where the user has clicked |
394 | * @param c is the column into which the user clicked. | 394 | * @param c is the column into which the user clicked. |
395 | * | 395 | * |
396 | * Note that you may not delete any @ref QListViewItem objects in slots | 396 | * Note that you may not delete any @ref QListViewItem objects in slots |
397 | * connected to this signal. | 397 | * connected to this signal. |
398 | */ | 398 | */ |
399 | void executed( QListViewItem *item, const QPoint &pos, int c ); | 399 | void executed( QListViewItem *item, const QPoint &pos, int c ); |
400 | 400 | ||
401 | /** | 401 | /** |
402 | * This signal gets emitted whenever the user double clicks into the | 402 | * This signal gets emitted whenever the user double clicks into the |
403 | * listview. | 403 | * listview. |
404 | * @param item is the pointer to the clicked listview item. | 404 | * @param item is the pointer to the clicked listview item. |
405 | * @param pos is the position where the user has clicked, and | 405 | * @param pos is the position where the user has clicked, and |
406 | * @param c is the column into which the user clicked. | 406 | * @param c is the column into which the user clicked. |
407 | * | 407 | * |
408 | * Note that you may not delete any @ref QListViewItem objects in slots | 408 | * Note that you may not delete any @ref QListViewItem objects in slots |
409 | * connected to this signal. | 409 | * connected to this signal. |
410 | * | 410 | * |
411 | * This signal is more or less here for the sake of completeness. | 411 | * This signal is more or less here for the sake of completeness. |
412 | * You should normally not need to use this. In most cases its better | 412 | * You should normally not need to use this. In most cases its better |
413 | * to use @ref #executed() instead. | 413 | * to use @ref #executed() instead. |
414 | */ | 414 | */ |
415 | void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); | 415 | void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); |
416 | void contextRequest( QListViewItem *item, const QPoint &pos, int c ); | ||
416 | 417 | ||
417 | /** | 418 | /** |
418 | * This signal gets emitted whenever something acceptable is | 419 | * This signal gets emitted whenever something acceptable is |
419 | * dropped onto the listview. | 420 | * dropped onto the listview. |
420 | * | 421 | * |
421 | * @param e is the drop event itself (it has already been accepted) | 422 | * @param e is the drop event itself (it has already been accepted) |
422 | * @param after is the item after which the drop occured (or 0L, if | 423 | * @param after is the item after which the drop occured (or 0L, if |
423 | * the drop was above all items) | 424 | * the drop was above all items) |
424 | * | 425 | * |
425 | * @see #acceptDrop() | 426 | * @see #acceptDrop() |
426 | */ | 427 | */ |
427 | void dropped (QDropEvent * e, QListViewItem *after); | 428 | void dropped (QDropEvent * e, QListViewItem *after); |
428 | 429 | ||
429 | /** | 430 | /** |
430 | * This signal gets emitted whenever something acceptable is | 431 | * This signal gets emitted whenever something acceptable is |
431 | * dropped onto the listview. | 432 | * dropped onto the listview. |
432 | * | 433 | * |
433 | * This is an overloaded version of the above (provided to simplify | 434 | * This is an overloaded version of the above (provided to simplify |
434 | * processing drops outside of the class). | 435 | * processing drops outside of the class). |
435 | * | 436 | * |
436 | * @param list is the listview | 437 | * @param list is the listview |
437 | * @param e is the drop event itself (it has already been accepted) | 438 | * @param e is the drop event itself (it has already been accepted) |
438 | * @param after is the item after which the drop occured (or 0L, if | 439 | * @param after is the item after which the drop occured (or 0L, if |
439 | * the drop was above all items | 440 | * the drop was above all items |
440 | */ | 441 | */ |
441 | void dropped (KListView* list, QDropEvent* e, QListViewItem* after); | 442 | void dropped (KListView* list, QDropEvent* e, QListViewItem* after); |
442 | 443 | ||
443 | /** | 444 | /** |
444 | * This signal gets emitted whenever something acceptable is | 445 | * This signal gets emitted whenever something acceptable is |
445 | * dropped onto the listview. | 446 | * dropped onto the listview. |
446 | * | 447 | * |
447 | * This function also provides a parent, in the event that your listview | 448 | * This function also provides a parent, in the event that your listview |
448 | * is a tree | 449 | * is a tree |
449 | * @param list is the listview | 450 | * @param list is the listview |
450 | * @param e is the drop event itself (it has already been accepted) | 451 | * @param e is the drop event itself (it has already been accepted) |
451 | * @param parent the item that is to be the parent of the new item | 452 | * @param parent the item that is to be the parent of the new item |
452 | * @param after is the item after which the drop occured (or 0L, if | 453 | * @param after is the item after which the drop occured (or 0L, if |
453 | * the drop was above all items | 454 | * the drop was above all items |
454 | */ | 455 | */ |
455 | void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 456 | void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); |
456 | 457 | ||
457 | /** | 458 | /** |
458 | * This signal gets emitted whenever something acceptable is | 459 | * This signal gets emitted whenever something acceptable is |
459 | * dropped onto the listview. | 460 | * dropped onto the listview. |
460 | * | 461 | * |
461 | * This function also provides a parent, in the event that your listview | 462 | * This function also provides a parent, in the event that your listview |
462 | * is a tree | 463 | * is a tree |
463 | * @param e is the drop event itself (it has already been accepted) | 464 | * @param e is the drop event itself (it has already been accepted) |
464 | * @param parent the item that is to be the parent of the new item | 465 | * @param parent the item that is to be the parent of the new item |
465 | * @param after is the item after which the drop occured (or 0L, if | 466 | * @param after is the item after which the drop occured (or 0L, if |
466 | * the drop was above all items | 467 | * the drop was above all items |
467 | */ | 468 | */ |
468 | void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 469 | void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); |
469 | 470 | ||
470 | /** | 471 | /** |
471 | * This signal is emitted when ever the user moves an item in the list via | 472 | * This signal is emitted when ever the user moves an item in the list via |
472 | * DnD. | 473 | * DnD. |
473 | * If more than one item is moved at the same time, this signal is only emitted | 474 | * If more than one item is moved at the same time, this signal is only emitted |
474 | * once. | 475 | * once. |
475 | */ | 476 | */ |
476 | void moved(); | 477 | void moved(); |
477 | 478 | ||
478 | /** | 479 | /** |
479 | * Connect to this signal if you want to do some preprocessing before | 480 | * Connect to this signal if you want to do some preprocessing before |
480 | * a move is made, for example, to disable sorting | 481 | * a move is made, for example, to disable sorting |
481 | * | 482 | * |
482 | * This is sent only once per each groups of moves. That is, for each | 483 | * This is sent only once per each groups of moves. That is, for each |
483 | * drop that is a move this will be emitted once, before KListView calls | 484 | * drop that is a move this will be emitted once, before KListView calls |
484 | * @see moveItem() | 485 | * @see moveItem() |
485 | */ | 486 | */ |
486 | void aboutToMove(); | 487 | void aboutToMove(); |
487 | 488 | ||
488 | /** | 489 | /** |
489 | * This signal is emitted when ever the user moves an item in the list via | 490 | * This signal is emitted when ever the user moves an item in the list via |
490 | * DnD. | 491 | * DnD. |
491 | * If more than one item is moved at the same time, @p afterFirst and | 492 | * If more than one item is moved at the same time, @p afterFirst and |
492 | * @p afterNow will reflect what was true before the move. | 493 | * @p afterNow will reflect what was true before the move. |
493 | * This differs from @ref moved(), so be careful. All the items will have been | 494 | * This differs from @ref moved(), so be careful. All the items will have been |
494 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME | 495 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME |
495 | * @param item the item that was moved | 496 | * @param item the item that was moved |
496 | * @param afterFirst the item that parameter item was in before the move, in the list | 497 | * @param afterFirst the item that parameter item was in before the move, in the list |
497 | * @param afterNow the item it's currently after. | 498 | * @param afterNow the item it's currently after. |
498 | */ | 499 | */ |
499 | void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); | 500 | void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); |
500 | 501 | ||
501 | 502 | ||
502 | /** | 503 | /** |
503 | * This signal is emitted after all the items have been moved. It reports info for | 504 | * This signal is emitted after all the items have been moved. It reports info for |
504 | * each and every item moved, in order. The first element in @p items associates | 505 | * each and every item moved, in order. The first element in @p items associates |
505 | * with the first of afterFirst and afterNow. | 506 | * with the first of afterFirst and afterNow. |
506 | */ | 507 | */ |
507 | void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); | 508 | void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); |
508 | 509 | ||
509 | /** | 510 | /** |
510 | * This signal gets emitted when an item is renamed via in-place renaming. | 511 | * This signal gets emitted when an item is renamed via in-place renaming. |
511 | * | 512 | * |
512 | * @param item is the renamed item. | 513 | * @param item is the renamed item. |
513 | * @param str is the new value of column @p col. | 514 | * @param str is the new value of column @p col. |
514 | * @param col is the renamed column. | 515 | * @param col is the renamed column. |
515 | */ | 516 | */ |
516 | void itemRenamed(QListViewItem* item, const QString &str, int col); | 517 | void itemRenamed(QListViewItem* item, const QString &str, int col); |
517 | 518 | ||
518 | /** | 519 | /** |
519 | * Same as above, but without the extra information. | 520 | * Same as above, but without the extra information. |
520 | */ | 521 | */ |
521 | void itemRenamed(QListViewItem* item); | 522 | void itemRenamed(QListViewItem* item); |
522 | void signalDelete(); | 523 | void signalDelete(); |
523 | 524 | ||
524 | /** | 525 | /** |
525 | * This signal is emitted when the shortcut key for popup-menus is pressed. | 526 | * This signal is emitted when the shortcut key for popup-menus is pressed. |
526 | * | 527 | * |
527 | * Normally you should not use this, just connect a slot to signal | 528 | * Normally you should not use this, just connect a slot to signal |
528 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly | 529 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly |
529 | * handle showing context menus regardless of settings. | 530 | * handle showing context menus regardless of settings. |
530 | * | 531 | * |
531 | * @param list is this listview. | 532 | * @param list is this listview. |
532 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. | 533 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. |
533 | */ | 534 | */ |
534 | void menuShortCutPressed (KListView* list, QListViewItem* item); | 535 | void menuShortCutPressed (KListView* list, QListViewItem* item); |
535 | 536 | ||
536 | /** | 537 | /** |
537 | * This signal is emitted whenever a context-menu should be shown for item @p i. | 538 | * This signal is emitted whenever a context-menu should be shown for item @p i. |
538 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). | 539 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). |
539 | * | 540 | * |
540 | * @param l is this listview. | 541 | * @param l is this listview. |
541 | * @param i is the item for which the menu should be shown. May be 0L. | 542 | * @param i is the item for which the menu should be shown. May be 0L. |
542 | * @param p is the point at which the menu should be shown. | 543 | * @param p is the point at which the menu should be shown. |
543 | */ | 544 | */ |
544 | void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); | 545 | void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); |
545 | 546 | ||
546 | public slots: | 547 | public slots: |
547 | /** | 548 | /** |
548 | * Rename column @p c of @p item. | 549 | * Rename column @p c of @p item. |
549 | */ | 550 | */ |
550 | virtual void rename(QListViewItem *item, int c); | 551 | virtual void rename(QListViewItem *item, int c); |
551 | 552 | ||
552 | /** | 553 | /** |
553 | * By default, if you called setItemsRenameable(true), | 554 | * By default, if you called setItemsRenameable(true), |
554 | * only the first column is renameable. | 555 | * only the first column is renameable. |
555 | * Use this function to enable the feature on other columns. | 556 | * Use this function to enable the feature on other columns. |
556 | * | 557 | * |
557 | * If you want more intelligent (dynamic) selection, | 558 | * If you want more intelligent (dynamic) selection, |
558 | * you'll have to derive from KListView, | 559 | * you'll have to derive from KListView, |
559 | * and override @ref rename() and call only call it | 560 | * and override @ref rename() and call only call it |
560 | * if you want the item to be renamed. | 561 | * if you want the item to be renamed. |
561 | */ | 562 | */ |
562 | void setRenameable (int column, bool yesno=true); | 563 | void setRenameable (int column, bool yesno=true); |
563 | 564 | ||
564 | /** | 565 | /** |
565 | * Set whether items in the list view can be moved. | 566 | * Set whether items in the list view can be moved. |
566 | * It is enabled by default. | 567 | * It is enabled by default. |
567 | * | 568 | * |
568 | * @see itemsMovable() | 569 | * @see itemsMovable() |
569 | */ | 570 | */ |
570 | virtual void setItemsMovable(bool b); | 571 | virtual void setItemsMovable(bool b); |
571 | 572 | ||
572 | /** | 573 | /** |
573 | * Enables inplace-renaming of items. | 574 | * Enables inplace-renaming of items. |
574 | * It is disabled by default. | 575 | * It is disabled by default. |
575 | * | 576 | * |
576 | * @see itemsRenameable() | 577 | * @see itemsRenameable() |
577 | * @see setRenameable() | 578 | * @see setRenameable() |
578 | */ | 579 | */ |
579 | virtual void setItemsRenameable(bool b); | 580 | virtual void setItemsRenameable(bool b); |
580 | 581 | ||
581 | /** | 582 | /** |
582 | * Enable/Disable the dragging of items. | 583 | * Enable/Disable the dragging of items. |
583 | * It is disabled by default. | 584 | * It is disabled by default. |
584 | */ | 585 | */ |
585 | virtual void setDragEnabled(bool b); | 586 | virtual void setDragEnabled(bool b); |
586 | 587 | ||
587 | /** | 588 | /** |
588 | * Enable/Disable AutoOpen (not implemented currently). | 589 | * Enable/Disable AutoOpen (not implemented currently). |
589 | */ | 590 | */ |
590 | virtual void setAutoOpen(bool b); | 591 | virtual void setAutoOpen(bool b); |
591 | 592 | ||
592 | /** | 593 | /** |
593 | * Enable/Disable the drawing of a drop-visualizer | 594 | * Enable/Disable the drawing of a drop-visualizer |
594 | * (a bar that shows where a dropped item would be inserted). | 595 | * (a bar that shows where a dropped item would be inserted). |
595 | * It is enabled by default, if dragging is enabled | 596 | * It is enabled by default, if dragging is enabled |
596 | */ | 597 | */ |
597 | virtual void setDropVisualizer(bool b); | 598 | virtual void setDropVisualizer(bool b); |
598 | 599 | ||
599 | /** | 600 | /** |
600 | * Set the width of the (default) drop-visualizer. | 601 | * Set the width of the (default) drop-visualizer. |
601 | * If you don't call this method, the width is set to 4. | 602 | * If you don't call this method, the width is set to 4. |
602 | */ | 603 | */ |
603 | void setDropVisualizerWidth (int w); | 604 | void setDropVisualizerWidth (int w); |
604 | 605 | ||
605 | /** | 606 | /** |
606 | * Set which column should be used for automatic tooltips. | 607 | * Set which column should be used for automatic tooltips. |
607 | * | 608 | * |