author | zautrix <zautrix> | 2005-07-26 15:43:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-26 15:43:00 (UTC) |
commit | d0fe94073aa3209532952c944b41bccfb4341a8d (patch) (unidiff) | |
tree | abab8e118a2661847c65715b9c68e5d3b9ac97e6 /korganizer | |
parent | e1d72bb77c51ff7313b390f263bc1f10d20123b0 (diff) | |
download | kdepimpi-d0fe94073aa3209532952c944b41bccfb4341a8d.zip kdepimpi-d0fe94073aa3209532952c944b41bccfb4341a8d.tar.gz kdepimpi-d0fe94073aa3209532952c944b41bccfb4341a8d.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 21 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 |
2 files changed, 21 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3ab4bb4..a76f2ed 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,757 +1,757 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Requires the Qt and KDE widget libraries, available at no cost at | 4 | Requires the Qt and KDE widget libraries, available at no cost at |
5 | http://www.troll.no and http://www.kde.org respectively | 5 | http://www.troll.no and http://www.kde.org respectively |
6 | 6 | ||
7 | Copyright (c) 1997, 1998, 1999 | 7 | Copyright (c) 1997, 1998, 1999 |
8 | Preston Brown (preton.brown@yale.edu) | 8 | Preston Brown (preton.brown@yale.edu) |
9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) | 9 | Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) |
10 | Ian Dawes (iadawes@globalserve.net) | 10 | Ian Dawes (iadawes@globalserve.net) |
11 | Laszlo Boloni (boloni@cs.purdue.edu) | 11 | Laszlo Boloni (boloni@cs.purdue.edu) |
12 | 12 | ||
13 | Copyright (c) 2000, 2001, 2002 | 13 | Copyright (c) 2000, 2001, 2002 |
14 | Cornelius Schumacher <schumacher@kde.org> | 14 | Cornelius Schumacher <schumacher@kde.org> |
15 | 15 | ||
16 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
17 | it under the terms of the GNU General Public License as published by | 17 | it under the terms of the GNU General Public License as published by |
18 | the Free Software Foundation; either version 2 of the License, or | 18 | the Free Software Foundation; either version 2 of the License, or |
19 | (at your option) any later version. | 19 | (at your option) any later version. |
20 | 20 | ||
21 | This program is distributed in the hope that it will be useful, | 21 | This program is distributed in the hope that it will be useful, |
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
24 | GNU General Public License for more details. | 24 | GNU General Public License for more details. |
25 | 25 | ||
26 | You should have received a copy of the GNU General Public License | 26 | You should have received a copy of the GNU General Public License |
27 | along with this program; if not, write to the Free Software | 27 | along with this program; if not, write to the Free Software |
28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 28 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qclipboard.h> | 37 | #include <qclipboard.h> |
38 | #include <qcursor.h> | 38 | #include <qcursor.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qprogressbar.h> | 40 | #include <qprogressbar.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
44 | #include <qptrlist.h> | 44 | #include <qptrlist.h> |
45 | #include <qregexp.h> | 45 | #include <qregexp.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qfile.h> | 47 | #include <qfile.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #ifndef KORG_NOSPLITTER | 49 | #ifndef KORG_NOSPLITTER |
50 | #include <qsplitter.h> | 50 | #include <qsplitter.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <kglobal.h> | 53 | #include <kglobal.h> |
54 | #include <kdebug.h> | 54 | #include <kdebug.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kfiledialog.h> | 56 | #include <kfiledialog.h> |
57 | #include <kmessagebox.h> | 57 | #include <kmessagebox.h> |
58 | #include <knotifyclient.h> | 58 | #include <knotifyclient.h> |
59 | #include <kconfig.h> | 59 | #include <kconfig.h> |
60 | 60 | ||
61 | #include <libkdepim/ksyncprefsdialog.h> | 61 | #include <libkdepim/ksyncprefsdialog.h> |
62 | #include <krun.h> | 62 | #include <krun.h> |
63 | #include <kdirwatch.h> | 63 | #include <kdirwatch.h> |
64 | #include <libkdepim/kdatepicker.h> | 64 | #include <libkdepim/kdatepicker.h> |
65 | #include <libkdepim/ksyncprofile.h> | 65 | #include <libkdepim/ksyncprofile.h> |
66 | #include <libkdepim/kpimglobalprefs.h> | 66 | #include <libkdepim/kpimglobalprefs.h> |
67 | 67 | ||
68 | #include <libkcal/vcaldrag.h> | 68 | #include <libkcal/vcaldrag.h> |
69 | #include <libkcal/icaldrag.h> | 69 | #include <libkcal/icaldrag.h> |
70 | #include <libkcal/icalformat.h> | 70 | #include <libkcal/icalformat.h> |
71 | #include <libkcal/vcalformat.h> | 71 | #include <libkcal/vcalformat.h> |
72 | #include <libkcal/scheduler.h> | 72 | #include <libkcal/scheduler.h> |
73 | #include <libkcal/calendarlocal.h> | 73 | #include <libkcal/calendarlocal.h> |
74 | #include <libkcal/journal.h> | 74 | #include <libkcal/journal.h> |
75 | #include <libkcal/calfilter.h> | 75 | #include <libkcal/calfilter.h> |
76 | #include <libkcal/attendee.h> | 76 | #include <libkcal/attendee.h> |
77 | #include <libkcal/dndfactory.h> | 77 | #include <libkcal/dndfactory.h> |
78 | #include <libkcal/freebusy.h> | 78 | #include <libkcal/freebusy.h> |
79 | #include <libkcal/filestorage.h> | 79 | #include <libkcal/filestorage.h> |
80 | #include <libkcal/calendarresources.h> | 80 | #include <libkcal/calendarresources.h> |
81 | #include <libkcal/qtopiaformat.h> | 81 | #include <libkcal/qtopiaformat.h> |
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "koagenda.h" | 107 | #include "koagenda.h" |
108 | #include "kodialogmanager.h" | 108 | #include "kodialogmanager.h" |
109 | #include "outgoingdialog.h" | 109 | #include "outgoingdialog.h" |
110 | #include "incomingdialog.h" | 110 | #include "incomingdialog.h" |
111 | #include "datenavigatorcontainer.h" | 111 | #include "datenavigatorcontainer.h" |
112 | #include "statusdialog.h" | 112 | #include "statusdialog.h" |
113 | #include "kdatenavigator.h" | 113 | #include "kdatenavigator.h" |
114 | #include "kotodoview.h" | 114 | #include "kotodoview.h" |
115 | #include "datenavigator.h" | 115 | #include "datenavigator.h" |
116 | #include "resourceview.h" | 116 | #include "resourceview.h" |
117 | #include "navigatorbar.h" | 117 | #include "navigatorbar.h" |
118 | #include "searchdialog.h" | 118 | #include "searchdialog.h" |
119 | #include "mainwindow.h" | 119 | #include "mainwindow.h" |
120 | #include "categoryeditdialog.h" | 120 | #include "categoryeditdialog.h" |
121 | 121 | ||
122 | #include "calendarview.h" | 122 | #include "calendarview.h" |
123 | #ifndef DESKTOP_VERSION | 123 | #ifndef DESKTOP_VERSION |
124 | #include <qtopia/alarmserver.h> | 124 | #include <qtopia/alarmserver.h> |
125 | #endif | 125 | #endif |
126 | #ifndef _WIN32_ | 126 | #ifndef _WIN32_ |
127 | #include <stdlib.h> | 127 | #include <stdlib.h> |
128 | #include <stdio.h> | 128 | #include <stdio.h> |
129 | #include <unistd.h> | 129 | #include <unistd.h> |
130 | #else | 130 | #else |
131 | #include <qprocess.h> | 131 | #include <qprocess.h> |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | #ifdef DESKTOP_VERSION | 134 | #ifdef DESKTOP_VERSION |
135 | #include <kabc/stdaddressbook.h> | 135 | #include <kabc/stdaddressbook.h> |
136 | #endif | 136 | #endif |
137 | using namespace KOrg; | 137 | using namespace KOrg; |
138 | using namespace KCal; | 138 | using namespace KCal; |
139 | extern int globalFlagBlockAgenda; | 139 | extern int globalFlagBlockAgenda; |
140 | extern int globalFlagBlockStartup; | 140 | extern int globalFlagBlockStartup; |
141 | 141 | ||
142 | 142 | ||
143 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) | 143 | MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) |
144 | 144 | ||
145 | { | 145 | { |
146 | mAlarms = alarms; | 146 | mAlarms = alarms; |
147 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); | 147 | viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); |
148 | QString mText = "<table width=\"100%\">\n"; | 148 | QString mText = "<table width=\"100%\">\n"; |
149 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 149 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
150 | #ifdef DESKTOP_VERSION | 150 | #ifdef DESKTOP_VERSION |
151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 151 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
152 | #else | 152 | #else |
153 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; | 153 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; |
154 | #endif | 154 | #endif |
155 | // mText += "<img src=\""; | 155 | // mText += "<img src=\""; |
156 | // mText += ipath; | 156 | // mText += ipath; |
157 | // mText += "\">"; | 157 | // mText += "\">"; |
158 | //mEventDate = QDate::currentDate(); | 158 | //mEventDate = QDate::currentDate(); |
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; | 160 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; |
161 | #else | 161 | #else |
162 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; | 162 | mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; |
163 | #endif | 163 | #endif |
164 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 164 | //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
165 | 165 | ||
166 | Incidence * inc = getNextInc( start ); | 166 | Incidence * inc = getNextInc( start ); |
167 | int time = 0; | 167 | int time = 0; |
168 | //mText += "<table>"; | 168 | //mText += "<table>"; |
169 | while ( inc ) { | 169 | while ( inc ) { |
170 | QDateTime dt ; | 170 | QDateTime dt ; |
171 | QString tempText = "<a "; | 171 | QString tempText = "<a "; |
172 | bool ok; | 172 | bool ok; |
173 | dt = inc->getNextOccurence( start, &ok ); | 173 | dt = inc->getNextOccurence( start, &ok ); |
174 | if ( !ok ) continue; | 174 | if ( !ok ) continue; |
175 | if ( inc->typeID() == eventID ) { | 175 | if ( inc->typeID() == eventID ) { |
176 | tempText += "href=\"event:"; | 176 | tempText += "href=\"event:"; |
177 | } else if ( inc->typeID() == todoID ) { | 177 | } else if ( inc->typeID() == todoID ) { |
178 | tempText += "href=\"todo:"; | 178 | tempText += "href=\"todo:"; |
179 | } | 179 | } |
180 | tempText += inc->uid() + "\">"; | 180 | tempText += inc->uid() + "\">"; |
181 | if ( inc->typeID() == todoID ) | 181 | if ( inc->typeID() == todoID ) |
182 | tempText += i18n("Todo: "); | 182 | tempText += i18n("Todo: "); |
183 | if ( inc->summary().length() > 0 ) | 183 | if ( inc->summary().length() > 0 ) |
184 | tempText += inc->summary(); | 184 | tempText += inc->summary(); |
185 | else | 185 | else |
186 | tempText += i18n("-no summary-"); | 186 | tempText += i18n("-no summary-"); |
187 | QString timestr; | 187 | QString timestr; |
188 | if (!inc->doesFloat()) | 188 | if (!inc->doesFloat()) |
189 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; | 189 | timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; |
190 | else | 190 | else |
191 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 191 | timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
192 | if ( dt.date() < QDate::currentDate() && time == 0 ) { | 192 | if ( dt.date() < QDate::currentDate() && time == 0 ) { |
193 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; | 193 | mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; |
194 | mText += "<table>"; | 194 | mText += "<table>"; |
195 | time = 1; | 195 | time = 1; |
196 | } | 196 | } |
197 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { | 197 | if ( dt.date() == QDate::currentDate() && time <= 1 ) { |
198 | if ( time > 0 ) | 198 | if ( time > 0 ) |
199 | mText +="</table>"; | 199 | mText +="</table>"; |
200 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; | 200 | mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; |
201 | mText += "<table>"; | 201 | mText += "<table>"; |
202 | time = 2; | 202 | time = 2; |
203 | 203 | ||
204 | } | 204 | } |
205 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { | 205 | if ( dt.date() > QDate::currentDate() && time <= 2 ) { |
206 | if ( time > 0 ) | 206 | if ( time > 0 ) |
207 | mText +="</table>"; | 207 | mText +="</table>"; |
208 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; | 208 | mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; |
209 | mText += "<table>"; | 209 | mText += "<table>"; |
210 | time = 3; | 210 | time = 3; |
211 | } | 211 | } |
212 | mText +="<tr><td><b>"; | 212 | mText +="<tr><td><b>"; |
213 | mText += timestr; | 213 | mText += timestr; |
214 | mText += "</b></td><td>"; | 214 | mText += "</b></td><td>"; |
215 | mText += tempText; | 215 | mText += tempText; |
216 | mText += "</td></tr>\n"; | 216 | mText += "</td></tr>\n"; |
217 | inc = getNextInc( start ); | 217 | inc = getNextInc( start ); |
218 | } | 218 | } |
219 | mText +="</table>"; | 219 | mText +="</table>"; |
220 | setText( mText ); | 220 | setText( mText ); |
221 | } | 221 | } |
222 | 222 | ||
223 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() | 223 | MissedAlarmTextBrowser::~MissedAlarmTextBrowser() |
224 | { | 224 | { |
225 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); | 225 | //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); |
226 | } | 226 | } |
227 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) | 227 | Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) |
228 | { | 228 | { |
229 | QDateTime dt ; | 229 | QDateTime dt ; |
230 | Incidence * retInc; | 230 | Incidence * retInc; |
231 | Incidence * inc = mAlarms.first(); | 231 | Incidence * inc = mAlarms.first(); |
232 | if ( inc == 0 ) | 232 | if ( inc == 0 ) |
233 | return 0; | 233 | return 0; |
234 | bool ok; | 234 | bool ok; |
235 | dt = inc->getNextOccurence( start, &ok ); | 235 | dt = inc->getNextOccurence( start, &ok ); |
236 | if ( ! ok ) return 0; | 236 | if ( ! ok ) return 0; |
237 | QDateTime dtn ; | 237 | QDateTime dtn ; |
238 | retInc = inc; | 238 | retInc = inc; |
239 | inc = mAlarms.next(); | 239 | inc = mAlarms.next(); |
240 | while ( inc ) { | 240 | while ( inc ) { |
241 | dtn = inc->getNextOccurence( start, &ok ); | 241 | dtn = inc->getNextOccurence( start, &ok ); |
242 | if ( ! ok ) return 0; | 242 | if ( ! ok ) return 0; |
243 | if ( dtn < dt ) { | 243 | if ( dtn < dt ) { |
244 | dt = dtn; | 244 | dt = dtn; |
245 | retInc = inc; | 245 | retInc = inc; |
246 | } | 246 | } |
247 | inc = mAlarms.next(); | 247 | inc = mAlarms.next(); |
248 | } | 248 | } |
249 | mAlarms.remove( retInc ); | 249 | mAlarms.remove( retInc ); |
250 | return retInc; | 250 | return retInc; |
251 | 251 | ||
252 | } | 252 | } |
253 | void MissedAlarmTextBrowser::setSource(const QString & n) | 253 | void MissedAlarmTextBrowser::setSource(const QString & n) |
254 | { | 254 | { |
255 | if (n.startsWith("event:")) { | 255 | if (n.startsWith("event:")) { |
256 | #ifdef DESKTOP_VERSION | 256 | #ifdef DESKTOP_VERSION |
257 | emit showIncidence(n.mid(8)); | 257 | emit showIncidence(n.mid(8)); |
258 | #else | 258 | #else |
259 | emit showIncidence(n.mid(6)); | 259 | emit showIncidence(n.mid(6)); |
260 | #endif | 260 | #endif |
261 | return; | 261 | return; |
262 | } else if (n.startsWith("todo:")) { | 262 | } else if (n.startsWith("todo:")) { |
263 | #ifdef DESKTOP_VERSION | 263 | #ifdef DESKTOP_VERSION |
264 | emit showIncidence(n.mid(7)); | 264 | emit showIncidence(n.mid(7)); |
265 | #else | 265 | #else |
266 | emit showIncidence(n.mid(5)); | 266 | emit showIncidence(n.mid(5)); |
267 | #endif | 267 | #endif |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | 272 | ||
273 | class KOBeamPrefs : public QDialog | 273 | class KOBeamPrefs : public QDialog |
274 | { | 274 | { |
275 | public: | 275 | public: |
276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 276 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
277 | QDialog( parent, name, true ) | 277 | QDialog( parent, name, true ) |
278 | { | 278 | { |
279 | setCaption( i18n("Beam Options") ); | 279 | setCaption( i18n("Beam Options") ); |
280 | QVBoxLayout* lay = new QVBoxLayout( this ); | 280 | QVBoxLayout* lay = new QVBoxLayout( this ); |
281 | lay->setSpacing( 3 ); | 281 | lay->setSpacing( 3 ); |
282 | lay->setMargin( 3 ); | 282 | lay->setMargin( 3 ); |
283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 283 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
284 | lay->addWidget( format ); | 284 | lay->addWidget( format ); |
285 | format->setExclusive ( true ) ; | 285 | format->setExclusive ( true ) ; |
286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 286 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
287 | lay->addWidget( time ); time->setExclusive ( true ) ; | 287 | lay->addWidget( time ); time->setExclusive ( true ) ; |
288 | vcal = new QRadioButton(" vCalendar ", format ); | 288 | vcal = new QRadioButton(" vCalendar ", format ); |
289 | ical = new QRadioButton(" iCalendar ", format ); | 289 | ical = new QRadioButton(" iCalendar ", format ); |
290 | vcal->setChecked( true ); | 290 | vcal->setChecked( true ); |
291 | tz = new QRadioButton(i18n(" With timezone "), time ); | 291 | tz = new QRadioButton(i18n(" With timezone "), time ); |
292 | local = new QRadioButton(i18n(" Local time "), time ); | 292 | local = new QRadioButton(i18n(" Local time "), time ); |
293 | tz->setChecked( true ); | 293 | tz->setChecked( true ); |
294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 294 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
295 | lay->addWidget( ok ); | 295 | lay->addWidget( ok ); |
296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 296 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
297 | lay->addWidget( cancel ); | 297 | lay->addWidget( cancel ); |
298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 298 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 299 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
300 | resize( 200, 200 ); | 300 | resize( 200, 200 ); |
301 | } | 301 | } |
302 | 302 | ||
303 | bool beamVcal() { return vcal->isChecked(); } | 303 | bool beamVcal() { return vcal->isChecked(); } |
304 | bool beamLocal() { return local->isChecked(); } | 304 | bool beamLocal() { return local->isChecked(); } |
305 | private: | 305 | private: |
306 | QRadioButton* vcal, *ical, *local, *tz; | 306 | QRadioButton* vcal, *ical, *local, *tz; |
307 | }; | 307 | }; |
308 | class KOCatPrefs : public QDialog | 308 | class KOCatPrefs : public QDialog |
309 | { | 309 | { |
310 | public: | 310 | public: |
311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
312 | QDialog( parent, name, true ) | 312 | QDialog( parent, name, true ) |
313 | { | 313 | { |
314 | setCaption( i18n("Manage new Categories") ); | 314 | setCaption( i18n("Manage new Categories") ); |
315 | QVBoxLayout* lay = new QVBoxLayout( this ); | 315 | QVBoxLayout* lay = new QVBoxLayout( this ); |
316 | lay->setSpacing( 3 ); | 316 | lay->setSpacing( 3 ); |
317 | lay->setMargin( 3 ); | 317 | lay->setMargin( 3 ); |
318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); | 318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); |
319 | lay->addWidget( lab ); | 319 | lay->addWidget( lab ); |
320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
321 | lay->addWidget( format ); | 321 | lay->addWidget( format ); |
322 | format->setExclusive ( true ) ; | 322 | format->setExclusive ( true ) ; |
323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
325 | addCatBut->setChecked( true ); | 325 | addCatBut->setChecked( true ); |
326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
327 | lay->addWidget( ok ); | 327 | lay->addWidget( ok ); |
328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
329 | lay->addWidget( cancel ); | 329 | lay->addWidget( cancel ); |
330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
332 | resize( 200, 200 ); | 332 | resize( 200, 200 ); |
333 | } | 333 | } |
334 | 334 | ||
335 | bool addCat() { return addCatBut->isChecked(); } | 335 | bool addCat() { return addCatBut->isChecked(); } |
336 | private: | 336 | private: |
337 | QRadioButton* addCatBut; | 337 | QRadioButton* addCatBut; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | CalendarView::CalendarView( CalendarResources *calendar, | 342 | CalendarView::CalendarView( CalendarResources *calendar, |
343 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
344 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
345 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
346 | mResourceManager( calendar->resourceManager() ) | 346 | mResourceManager( calendar->resourceManager() ) |
347 | { | 347 | { |
348 | 348 | ||
349 | mEventEditor = 0; | 349 | mEventEditor = 0; |
350 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
351 | 351 | ||
352 | init(); | 352 | init(); |
353 | } | 353 | } |
354 | 354 | ||
355 | CalendarView::CalendarView( Calendar *calendar, | 355 | CalendarView::CalendarView( Calendar *calendar, |
356 | QWidget *parent, const char *name ) | 356 | QWidget *parent, const char *name ) |
357 | : CalendarViewBase( parent, name ), | 357 | : CalendarViewBase( parent, name ), |
358 | mCalendar( calendar ), | 358 | mCalendar( calendar ), |
359 | mResourceManager( 0 ) | 359 | mResourceManager( 0 ) |
360 | { | 360 | { |
361 | 361 | ||
362 | mEventEditor = 0; | 362 | mEventEditor = 0; |
363 | mTodoEditor = 0; | 363 | mTodoEditor = 0; |
364 | init(); | 364 | init(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void CalendarView::init() | 367 | void CalendarView::init() |
368 | { | 368 | { |
369 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 369 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
370 | setFocusPolicy (NoFocus ); | 370 | setFocusPolicy (NoFocus ); |
371 | mViewerCallerIsSearchDialog = false; | 371 | mViewerCallerIsSearchDialog = false; |
372 | mBlockShowDates = false; | 372 | mBlockShowDates = false; |
373 | 373 | mConflictingEvent = 0; | |
374 | mDatePickerMode = 0; | 374 | mDatePickerMode = 0; |
375 | mCurrentSyncDevice = ""; | 375 | mCurrentSyncDevice = ""; |
376 | mViewManager = new KOViewManager( this ); | 376 | mViewManager = new KOViewManager( this ); |
377 | mDialogManager = new KODialogManager( this ); | 377 | mDialogManager = new KODialogManager( this ); |
378 | mEventViewerDialog = 0; | 378 | mEventViewerDialog = 0; |
379 | mModified = false; | 379 | mModified = false; |
380 | mReadOnly = false; | 380 | mReadOnly = false; |
381 | mSelectedIncidence = 0; | 381 | mSelectedIncidence = 0; |
382 | mCalPrinter = 0; | 382 | mCalPrinter = 0; |
383 | mFilters.setAutoDelete(true); | 383 | mFilters.setAutoDelete(true); |
384 | 384 | ||
385 | mCalendar->registerObserver( this ); | 385 | mCalendar->registerObserver( this ); |
386 | // TODO: Make sure that view is updated, when calendar is changed. | 386 | // TODO: Make sure that view is updated, when calendar is changed. |
387 | 387 | ||
388 | mStorage = new FileStorage( mCalendar ); | 388 | mStorage = new FileStorage( mCalendar ); |
389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
390 | 390 | ||
391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
392 | #ifndef KORG_NOSPLITTER | 392 | #ifndef KORG_NOSPLITTER |
393 | // create the main layout frames. | 393 | // create the main layout frames. |
394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
395 | topLayout->addWidget(mPanner); | 395 | topLayout->addWidget(mPanner); |
396 | 396 | ||
397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
398 | "CalendarView::LeftFrame"); | 398 | "CalendarView::LeftFrame"); |
399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
400 | 400 | ||
401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
402 | "CalendarView::DateNavigator" ); | 402 | "CalendarView::DateNavigator" ); |
403 | 403 | ||
404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
406 | mTodoList->setNavigator( mNavigator ); | 406 | mTodoList->setNavigator( mNavigator ); |
407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
408 | 408 | ||
409 | #ifdef KORG_NORESOURCEVIEW | 409 | #ifdef KORG_NORESOURCEVIEW |
410 | mResourceView = 0; | 410 | mResourceView = 0; |
411 | #else | 411 | #else |
412 | if ( mResourceManager ) { | 412 | if ( mResourceManager ) { |
413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
414 | mResourceView->updateView(); | 414 | mResourceView->updateView(); |
415 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 415 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
416 | SLOT( updateView() ) ); | 416 | SLOT( updateView() ) ); |
417 | } else { | 417 | } else { |
418 | mResourceView = 0; | 418 | mResourceView = 0; |
419 | } | 419 | } |
420 | #endif | 420 | #endif |
421 | QWidget *rightBox = new QWidget( mPanner ); | 421 | QWidget *rightBox = new QWidget( mPanner ); |
422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
423 | 423 | ||
424 | mRightFrame = new QWidgetStack( rightBox ); | 424 | mRightFrame = new QWidgetStack( rightBox ); |
425 | rightLayout->addWidget( mRightFrame, 1 ); | 425 | rightLayout->addWidget( mRightFrame, 1 ); |
426 | 426 | ||
427 | mLeftFrame = mLeftSplitter; | 427 | mLeftFrame = mLeftSplitter; |
428 | #else | 428 | #else |
429 | //QWidget *mainBox = new QWidget( this ); | 429 | //QWidget *mainBox = new QWidget( this ); |
430 | //QWidget *leftFrame = new QWidget( mainBox ); | 430 | //QWidget *leftFrame = new QWidget( mainBox ); |
431 | //QBoxLayout * mainBoxLayout; | 431 | //QBoxLayout * mainBoxLayout; |
432 | if ( KOPrefs::instance()->mVerticalScreen ) { | 432 | if ( KOPrefs::instance()->mVerticalScreen ) { |
433 | //mainBoxLayout = new QVBoxLayout(mainBox); | 433 | //mainBoxLayout = new QVBoxLayout(mainBox); |
434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 435 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 436 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 437 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 438 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
439 | } else { | 439 | } else { |
440 | //mainBoxLayout = new QHBoxLayout(mainBox); | 440 | //mainBoxLayout = new QHBoxLayout(mainBox); |
441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 441 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 442 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 443 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 444 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 445 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
446 | } | 446 | } |
447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 447 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
448 | //QBoxLayout * leftFrameLayout; | 448 | //QBoxLayout * leftFrameLayout; |
449 | topLayout->addWidget( mMainFrame ); | 449 | topLayout->addWidget( mMainFrame ); |
450 | #ifdef DESKTOP_VERSION | 450 | #ifdef DESKTOP_VERSION |
451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); | 451 | mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); |
452 | topLayout->addWidget( mDateScrollBar ); | 452 | topLayout->addWidget( mDateScrollBar ); |
453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 453 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); |
454 | if ( QApplication::desktop()->width() < 800 ) | 454 | if ( QApplication::desktop()->width() < 800 ) |
455 | mDateScrollBar->hide(); | 455 | mDateScrollBar->hide(); |
456 | #endif | 456 | #endif |
457 | //mainBoxLayout->addWidget (mLeftFrame); | 457 | //mainBoxLayout->addWidget (mLeftFrame); |
458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 458 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
459 | "CalendarView::DateNavigator" ); | 459 | "CalendarView::DateNavigator" ); |
460 | #if 0 | 460 | #if 0 |
461 | // FIXME | 461 | // FIXME |
462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 462 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
463 | "CalendarView::DateNavigator", QDate::currentDate()); | 463 | "CalendarView::DateNavigator", QDate::currentDate()); |
464 | #endif | 464 | #endif |
465 | // mDateNavigator->blockSignals( true ); | 465 | // mDateNavigator->blockSignals( true ); |
466 | //leftFrameLayout->addWidget( mDateNavigator ); | 466 | //leftFrameLayout->addWidget( mDateNavigator ); |
467 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 467 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
468 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 468 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
469 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 469 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
470 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 470 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
471 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 471 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
472 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); | 472 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); |
473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
474 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | 474 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); |
475 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 475 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
476 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 476 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 477 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
478 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); | 478 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); |
479 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 479 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
480 | 480 | ||
481 | mTodoList->setNavigator( mNavigator ); | 481 | mTodoList->setNavigator( mNavigator ); |
482 | #if 0 | 482 | #if 0 |
483 | if ( QApplication::desktop()->width() < 480 ) { | 483 | if ( QApplication::desktop()->width() < 480 ) { |
484 | leftFrameLayout->addWidget(mFilterView); | 484 | leftFrameLayout->addWidget(mFilterView); |
485 | leftFrameLayout->addWidget(mTodoList, 2 ); | 485 | leftFrameLayout->addWidget(mTodoList, 2 ); |
486 | 486 | ||
487 | } else { | 487 | } else { |
488 | leftFrameLayout->addWidget(mTodoList,2 ); | 488 | leftFrameLayout->addWidget(mTodoList,2 ); |
489 | leftFrameLayout->addWidget(mFilterView ); | 489 | leftFrameLayout->addWidget(mFilterView ); |
490 | } | 490 | } |
491 | #endif | 491 | #endif |
492 | mFilterView->hide(); | 492 | mFilterView->hide(); |
493 | mCalEditView->hide(); | 493 | mCalEditView->hide(); |
494 | QWidget *rightBox = new QWidget( mMainFrame ); | 494 | QWidget *rightBox = new QWidget( mMainFrame ); |
495 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 495 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
496 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 496 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
497 | mRightFrame = new QWidgetStack( rightBox ); | 497 | mRightFrame = new QWidgetStack( rightBox ); |
498 | rightLayout->addWidget( mRightFrame, 10 ); | 498 | rightLayout->addWidget( mRightFrame, 10 ); |
499 | 499 | ||
500 | //mLeftFrame = (QWidget *)leftFrame; | 500 | //mLeftFrame = (QWidget *)leftFrame; |
501 | if ( KOPrefs::instance()->mVerticalScreen ) { | 501 | if ( KOPrefs::instance()->mVerticalScreen ) { |
502 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 502 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
503 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 503 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
504 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 504 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
505 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 505 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
506 | } else { | 506 | } else { |
507 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 507 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
508 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 508 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
509 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 509 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
510 | } | 510 | } |
511 | if ( !KOPrefs::instance()->mShowDateNavigator) | 511 | if ( !KOPrefs::instance()->mShowDateNavigator) |
512 | mDateNavigator->hide(); | 512 | mDateNavigator->hide(); |
513 | //qDebug("Calendarview Size %d %d ", width(), height()); | 513 | //qDebug("Calendarview Size %d %d ", width(), height()); |
514 | #endif | 514 | #endif |
515 | 515 | ||
516 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 516 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
517 | SLOT( showDates( const KCal::DateList & ) ) ); | 517 | SLOT( showDates( const KCal::DateList & ) ) ); |
518 | 518 | ||
519 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 519 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
520 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 520 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
521 | 521 | ||
522 | 522 | ||
523 | 523 | ||
524 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 524 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
525 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 525 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 527 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
528 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 528 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
529 | 529 | ||
530 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 530 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
531 | mNavigator, SLOT( selectPreviousYear() ) ); | 531 | mNavigator, SLOT( selectPreviousYear() ) ); |
532 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 532 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
533 | mNavigator, SLOT( selectNextYear() ) ); | 533 | mNavigator, SLOT( selectNextYear() ) ); |
534 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 534 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
535 | mNavigator, SLOT( selectPreviousMonth() ) ); | 535 | mNavigator, SLOT( selectPreviousMonth() ) ); |
536 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 536 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
537 | mNavigator, SLOT( selectNextMonth() ) ); | 537 | mNavigator, SLOT( selectNextMonth() ) ); |
538 | 538 | ||
539 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 539 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
540 | mNavigator, SLOT( selectPrevious() ) ); | 540 | mNavigator, SLOT( selectPrevious() ) ); |
541 | connect( mDateNavigator, SIGNAL( goNext() ), | 541 | connect( mDateNavigator, SIGNAL( goNext() ), |
542 | mNavigator, SLOT( selectNext() ) ); | 542 | mNavigator, SLOT( selectNext() ) ); |
543 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 543 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
544 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 544 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
545 | 545 | ||
546 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 546 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
547 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 547 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
548 | #if 0 | 548 | #if 0 |
549 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 549 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
550 | SLOT( incidenceAdded( Incidence *) ) ); | 550 | SLOT( incidenceAdded( Incidence *) ) ); |
551 | #endif | 551 | #endif |
552 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 552 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
553 | 553 | ||
554 | connect( this, SIGNAL( configChanged() ), | 554 | connect( this, SIGNAL( configChanged() ), |
555 | mDateNavigator, SLOT( updateConfig() ) ); | 555 | mDateNavigator, SLOT( updateConfig() ) ); |
556 | 556 | ||
557 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 557 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
558 | SLOT( newTodo() ) ); | 558 | SLOT( newTodo() ) ); |
559 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 559 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
560 | SLOT( newSubTodo( Todo * ) ) ); | 560 | SLOT( newSubTodo( Todo * ) ) ); |
561 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 561 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
562 | SLOT( editTodo( Todo * ) ) ); | 562 | SLOT( editTodo( Todo * ) ) ); |
563 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 563 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
564 | SLOT( showTodo( Todo *) ) ); | 564 | SLOT( showTodo( Todo *) ) ); |
565 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 565 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
566 | SLOT( deleteTodo( Todo *) ) ); | 566 | SLOT( deleteTodo( Todo *) ) ); |
567 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 567 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
568 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 568 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
569 | SLOT( purgeCompleted() ) ); | 569 | SLOT( purgeCompleted() ) ); |
570 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 570 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
571 | SIGNAL( todoModified( Todo *, int ) ) ); | 571 | SIGNAL( todoModified( Todo *, int ) ) ); |
572 | 572 | ||
573 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 573 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
574 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 574 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
575 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 575 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
576 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 576 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
577 | 577 | ||
578 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 578 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
579 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 579 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
580 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 580 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
581 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 581 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
582 | 582 | ||
583 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 583 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
584 | this, SLOT ( todo_unsub( Todo * ) ) ); | 584 | this, SLOT ( todo_unsub( Todo * ) ) ); |
585 | 585 | ||
586 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 586 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
587 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 587 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
588 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 588 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
589 | SLOT( updateTodo( Todo *, int ) ) ); | 589 | SLOT( updateTodo( Todo *, int ) ) ); |
590 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 590 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
591 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 591 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
592 | 592 | ||
593 | 593 | ||
594 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 594 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
595 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 595 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
596 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 596 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
597 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 597 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
598 | 598 | ||
599 | 599 | ||
600 | 600 | ||
601 | 601 | ||
602 | 602 | ||
603 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 603 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
604 | SLOT(checkClipboard())); | 604 | SLOT(checkClipboard())); |
605 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 605 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
606 | SLOT( processTodoListSelection( Incidence * ) ) ); | 606 | SLOT( processTodoListSelection( Incidence * ) ) ); |
607 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 607 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
608 | 608 | ||
609 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 609 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
610 | 610 | ||
611 | mDateFrame = new QVBox(0,0,WType_Popup); | 611 | mDateFrame = new QVBox(0,0,WType_Popup); |
612 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 612 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
613 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 613 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
614 | mDateFrame->setLineWidth(3); | 614 | mDateFrame->setLineWidth(3); |
615 | mDateFrame->hide(); | 615 | mDateFrame->hide(); |
616 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 616 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
617 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 617 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
618 | 618 | ||
619 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 619 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
620 | 620 | ||
621 | mEventEditor = mDialogManager->getEventEditor(); | 621 | mEventEditor = mDialogManager->getEventEditor(); |
622 | mTodoEditor = mDialogManager->getTodoEditor(); | 622 | mTodoEditor = mDialogManager->getTodoEditor(); |
623 | 623 | ||
624 | mFlagEditDescription = false; | 624 | mFlagEditDescription = false; |
625 | 625 | ||
626 | mSuspendTimer = new QTimer( this ); | 626 | mSuspendTimer = new QTimer( this ); |
627 | mAlarmTimer = new QTimer( this ); | 627 | mAlarmTimer = new QTimer( this ); |
628 | mRecheckAlarmTimer = new QTimer( this ); | 628 | mRecheckAlarmTimer = new QTimer( this ); |
629 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 629 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
630 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 630 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
631 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 631 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
632 | mAlarmDialog = new AlarmDialog( this ); | 632 | mAlarmDialog = new AlarmDialog( this ); |
633 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 633 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
634 | mAlarmDialog->setServerNotification( false ); | 634 | mAlarmDialog->setServerNotification( false ); |
635 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 635 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
636 | 636 | ||
637 | 637 | ||
638 | #ifndef DESKTOP_VERSION | 638 | #ifndef DESKTOP_VERSION |
639 | //US listen for arriving address resultsets | 639 | //US listen for arriving address resultsets |
640 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 640 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
641 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 641 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
642 | #endif | 642 | #endif |
643 | mDateNavigator->setCalendar( mCalendar ); | 643 | mDateNavigator->setCalendar( mCalendar ); |
644 | } | 644 | } |
645 | 645 | ||
646 | 646 | ||
647 | CalendarView::~CalendarView() | 647 | CalendarView::~CalendarView() |
648 | { | 648 | { |
649 | // kdDebug() << "~CalendarView()" << endl; | 649 | // kdDebug() << "~CalendarView()" << endl; |
650 | //qDebug("CalendarView::~CalendarView() "); | 650 | //qDebug("CalendarView::~CalendarView() "); |
651 | delete mDialogManager; | 651 | delete mDialogManager; |
652 | delete mViewManager; | 652 | delete mViewManager; |
653 | delete mStorage; | 653 | delete mStorage; |
654 | delete mDateFrame ; | 654 | delete mDateFrame ; |
655 | delete mEventViewerDialog; | 655 | delete mEventViewerDialog; |
656 | //kdDebug() << "~CalendarView() done" << endl; | 656 | //kdDebug() << "~CalendarView() done" << endl; |
657 | } | 657 | } |
658 | 658 | ||
659 | 659 | ||
660 | void CalendarView::nextConflict( bool all, bool allday ) | 660 | void CalendarView::nextConflict( bool all, bool allday ) |
661 | { | 661 | { |
662 | static bool block = false; | 662 | static bool block = false; |
663 | if ( block ) return; | 663 | if ( block ) return; |
664 | block = true; | 664 | block = true; |
665 | QPtrList<Event> testlist = mCalendar->events(); | 665 | QPtrList<Event> testlist = mCalendar->events(); |
666 | Event * test = testlist.first(); | 666 | Event * test = testlist.first(); |
667 | while ( test ) { | 667 | while ( test ) { |
668 | test->setTagged( false ); | 668 | test->setTagged( false ); |
669 | test = testlist.next(); | 669 | test = testlist.next(); |
670 | } | 670 | } |
671 | QTime st ( 0,0,0); | 671 | QTime st ( 0,0,0); |
672 | if ( mViewManager->currentView() == mViewManager->agendaView() ) | 672 | if ( mViewManager->currentView() == mViewManager->agendaView() ) |
673 | st = mViewManager->agendaView()->agenda()->getEndTime(); | 673 | st = mViewManager->agendaView()->agenda()->getEndTime(); |
674 | //qDebug("time %s ", st.toString().latin1()); | 674 | //qDebug("time %s ", st.toString().latin1()); |
675 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); | 675 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); |
676 | QDateTime conflict; | 676 | QDateTime conflict; |
677 | QDateTime retVal; | 677 | QDateTime retVal; |
678 | bool found = false; | 678 | bool found = false; |
679 | Event * cE = 0; | 679 | Event * cE = 0; |
680 | Event * cE2 = 0; | 680 | Event * cE2 = 0; |
681 | QPtrList<Event> testlist2 = testlist; | 681 | QPtrList<Event> testlist2 = testlist; |
682 | test = testlist.first(); | 682 | test = testlist.first(); |
683 | bool skip = false; | 683 | bool skip = false; |
684 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 684 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
685 | //QTime tm; | 685 | //QTime tm; |
686 | //tm.start(); | 686 | //tm.start(); |
687 | while ( test ) { | 687 | while ( test ) { |
688 | qApp->processEvents(); | 688 | qApp->processEvents(); |
689 | skip = false; | 689 | skip = false; |
690 | if ( !all ) skip = ( allday != test->doesFloat() ); | 690 | if ( !all ) skip = ( allday != test->doesFloat() ); |
691 | if ( !skip ) { | 691 | if ( !skip ) { |
692 | if ( found ) | 692 | if ( found ) |
693 | skip = !test->matchTime( &startDT, &conflict ); | 693 | skip = !test->matchTime( &startDT, &conflict ); |
694 | else | 694 | else |
695 | skip = !test->matchTime( &startDT, 0 ); | 695 | skip = !test->matchTime( &startDT, 0 ); |
696 | } | 696 | } |
697 | if ( !skip ) { | 697 | if ( !skip ) { |
698 | Event * test2 = testlist2.first(); | 698 | Event * test2 = testlist2.first(); |
699 | while ( test2 ) { | 699 | while ( test2 ) { |
700 | skip = test2->isTagged(); | 700 | skip = test2->isTagged(); |
701 | if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); | 701 | if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); |
702 | if ( !skip ) { | 702 | if ( !skip ) { |
703 | if ( found ) | 703 | if ( found ) |
704 | skip = !test2->matchTime( &startDT, &conflict ); | 704 | skip = !test2->matchTime( &startDT, &conflict ); |
705 | else | 705 | else |
706 | skip = !test2->matchTime( &startDT, 0 ); | 706 | skip = !test2->matchTime( &startDT, 0 ); |
707 | } | 707 | } |
708 | if ( !skip ) { | 708 | if ( !skip ) { |
709 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { | 709 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { |
710 | //qDebug("overlap "); | 710 | //qDebug("overlap "); |
711 | if ( ! found ) { | 711 | if ( ! found ) { |
712 | if ( retVal >= startDT ) { | 712 | if ( retVal >= startDT ) { |
713 | conflict = retVal; | 713 | conflict = retVal; |
714 | cE = test; | 714 | cE = test; |
715 | cE2 = test2; | 715 | cE2 = test2; |
716 | found = true; | 716 | found = true; |
717 | } | 717 | } |
718 | } else { | 718 | } else { |
719 | if ( retVal >= startDT && retVal < conflict ) { | 719 | if ( retVal >= startDT && retVal < conflict ) { |
720 | conflict = retVal; | 720 | conflict = retVal; |
721 | cE = test; | 721 | cE = test; |
722 | cE2 = test2; | 722 | cE2 = test2; |
723 | } | 723 | } |
724 | } | 724 | } |
725 | } | 725 | } |
726 | } | 726 | } |
727 | test2 = testlist2.next(); | 727 | test2 = testlist2.next(); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | test->setTagged( true ); | 730 | test->setTagged( true ); |
731 | test = testlist.next(); | 731 | test = testlist.next(); |
732 | } | 732 | } |
733 | //qDebug("Search time : %d", tm.elapsed()); | 733 | //qDebug("Search time : %d", tm.elapsed()); |
734 | if ( found ) { | 734 | if ( found ) { |
735 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 735 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
736 | mViewManager->showDayView(); | 736 | mViewManager->showDayView(); |
737 | mNavigator->slotDaySelect( conflict.date() ); | 737 | mNavigator->slotDaySelect( conflict.date() ); |
738 | int hour = conflict.time().hour(); | 738 | int hour = conflict.time().hour(); |
739 | mViewManager->agendaView()->setStartHour( hour ); | 739 | mViewManager->agendaView()->setStartHour( hour ); |
740 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); | 740 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
741 | block = false; | 741 | block = false; |
742 | return; | 742 | return; |
743 | } | 743 | } |
744 | 744 | ||
745 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 745 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
746 | //qDebug("No conflict found "); | 746 | //qDebug("No conflict found "); |
747 | block = false; | 747 | block = false; |
748 | return; | 748 | return; |
749 | } | 749 | } |
750 | 750 | ||
751 | void CalendarView::conflictAll() | 751 | void CalendarView::conflictAll() |
752 | { | 752 | { |
753 | nextConflict ( true, true ); | 753 | nextConflict ( true, true ); |
754 | } | 754 | } |
755 | void CalendarView::conflictAllday() | 755 | void CalendarView::conflictAllday() |
756 | { | 756 | { |
757 | nextConflict ( false, true ); | 757 | nextConflict ( false, true ); |
@@ -2412,821 +2412,821 @@ void CalendarView::readSettings() | |||
2412 | if ( ! list.isEmpty() ) { | 2412 | if ( ! list.isEmpty() ) { |
2413 | x = list[0].toInt(); | 2413 | x = list[0].toInt(); |
2414 | y = list[1].toInt(); | 2414 | y = list[1].toInt(); |
2415 | w = list[2].toInt(); | 2415 | w = list[2].toInt(); |
2416 | h = list[3].toInt(); | 2416 | h = list[3].toInt(); |
2417 | KApplication::testCoords( &x,&y,&w,&h ); | 2417 | KApplication::testCoords( &x,&y,&w,&h ); |
2418 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2418 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2419 | } | 2419 | } |
2420 | #endif | 2420 | #endif |
2421 | config->setGroup( "Views" ); | 2421 | config->setGroup( "Views" ); |
2422 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2422 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2423 | 2423 | ||
2424 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2424 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2425 | 2425 | ||
2426 | int resetval = 0; | 2426 | int resetval = 0; |
2427 | int maxVal = 0; | 2427 | int maxVal = 0; |
2428 | if (sizes.count() != 3) { | 2428 | if (sizes.count() != 3) { |
2429 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2429 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2430 | resetval = mDateNavigator->sizeHint().width()+2; | 2430 | resetval = mDateNavigator->sizeHint().width()+2; |
2431 | } else { | 2431 | } else { |
2432 | resetval = mDateNavigator->sizeHint().height()+2; | 2432 | resetval = mDateNavigator->sizeHint().height()+2; |
2433 | } | 2433 | } |
2434 | } | 2434 | } |
2435 | if ( resetval ) { | 2435 | if ( resetval ) { |
2436 | sizes.clear(); | 2436 | sizes.clear(); |
2437 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2437 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2438 | maxVal = QApplication::desktop()->width() -10; | 2438 | maxVal = QApplication::desktop()->width() -10; |
2439 | } else { | 2439 | } else { |
2440 | maxVal = QApplication::desktop()->height()-10; | 2440 | maxVal = QApplication::desktop()->height()-10; |
2441 | } | 2441 | } |
2442 | sizes << resetval; | 2442 | sizes << resetval; |
2443 | if ( maxVal < resetval + resetval) | 2443 | if ( maxVal < resetval + resetval) |
2444 | resetval = maxVal - resetval; | 2444 | resetval = maxVal - resetval; |
2445 | sizes << resetval; | 2445 | sizes << resetval; |
2446 | sizes << 100; | 2446 | sizes << 100; |
2447 | } | 2447 | } |
2448 | mLeftFrame->setSizes(sizes); | 2448 | mLeftFrame->setSizes(sizes); |
2449 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2449 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2450 | resetval = 0; | 2450 | resetval = 0; |
2451 | maxVal = 0; | 2451 | maxVal = 0; |
2452 | if (sizes.count() != 2) { | 2452 | if (sizes.count() != 2) { |
2453 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2453 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2454 | resetval = mDateNavigator->sizeHint().width()+2; | 2454 | resetval = mDateNavigator->sizeHint().width()+2; |
2455 | } else { | 2455 | } else { |
2456 | resetval = mDateNavigator->sizeHint().height()+2; | 2456 | resetval = mDateNavigator->sizeHint().height()+2; |
2457 | } | 2457 | } |
2458 | } | 2458 | } |
2459 | if ( resetval ) { | 2459 | if ( resetval ) { |
2460 | sizes.clear(); | 2460 | sizes.clear(); |
2461 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2461 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2462 | maxVal = QApplication::desktop()->width() -10; | 2462 | maxVal = QApplication::desktop()->width() -10; |
2463 | } else { | 2463 | } else { |
2464 | maxVal = QApplication::desktop()->height()-10; | 2464 | maxVal = QApplication::desktop()->height()-10; |
2465 | } | 2465 | } |
2466 | sizes << resetval; | 2466 | sizes << resetval; |
2467 | if ( maxVal < resetval + resetval) | 2467 | if ( maxVal < resetval + resetval) |
2468 | resetval = maxVal - resetval; | 2468 | resetval = maxVal - resetval; |
2469 | sizes << resetval; | 2469 | sizes << resetval; |
2470 | } | 2470 | } |
2471 | mMainFrame->setSizes(sizes); | 2471 | mMainFrame->setSizes(sizes); |
2472 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2472 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2473 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2473 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2474 | else mNavigator->selectDates( dateCount ); | 2474 | else mNavigator->selectDates( dateCount ); |
2475 | // mViewManager->readSettings( config ); | 2475 | // mViewManager->readSettings( config ); |
2476 | updateConfig(); | 2476 | updateConfig(); |
2477 | globalFlagBlockAgenda = 2; | 2477 | globalFlagBlockAgenda = 2; |
2478 | mViewManager->readSettings( config ); | 2478 | mViewManager->readSettings( config ); |
2479 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2479 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2480 | } | 2480 | } |
2481 | 2481 | ||
2482 | void CalendarView::checkSuspendAlarm() | 2482 | void CalendarView::checkSuspendAlarm() |
2483 | { | 2483 | { |
2484 | if ( mSuspendTimer->isActive() ) { | 2484 | if ( mSuspendTimer->isActive() ) { |
2485 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); | 2485 | KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm")); |
2486 | } | 2486 | } |
2487 | } | 2487 | } |
2488 | void CalendarView::writeSettings() | 2488 | void CalendarView::writeSettings() |
2489 | { | 2489 | { |
2490 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2490 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2491 | 2491 | ||
2492 | KConfig *config = KOGlobals::config(); | 2492 | KConfig *config = KOGlobals::config(); |
2493 | 2493 | ||
2494 | mViewManager->writeSettings( config ); | 2494 | mViewManager->writeSettings( config ); |
2495 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2495 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2496 | mDialogManager->writeSettings( config ); | 2496 | mDialogManager->writeSettings( config ); |
2497 | //KOPrefs::instance()->usrWriteConfig(); | 2497 | //KOPrefs::instance()->usrWriteConfig(); |
2498 | KOPrefs::instance()->writeConfig(); | 2498 | KOPrefs::instance()->writeConfig(); |
2499 | 2499 | ||
2500 | writeFilterSettings(config); | 2500 | writeFilterSettings(config); |
2501 | config->setGroup( "AppRun" ); | 2501 | config->setGroup( "AppRun" ); |
2502 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2502 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2503 | int days = dt.daysTo( QDate::currentDate() ); | 2503 | int days = dt.daysTo( QDate::currentDate() ); |
2504 | dt = dt.addDays( days ); | 2504 | dt = dt.addDays( days ); |
2505 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2505 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2506 | config->writeEntry( "LatestProgramStopDays", days ); | 2506 | config->writeEntry( "LatestProgramStopDays", days ); |
2507 | config->writeEntry( "LatestProgramStopSecs", secs ); | 2507 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2508 | //qDebug("KO: Writing stop time: %d ", secs); | 2508 | //qDebug("KO: Writing stop time: %d ", secs); |
2509 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2509 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2510 | //QDateTime latest = dt.addSecs ( secs ); | 2510 | //QDateTime latest = dt.addSecs ( secs ); |
2511 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | 2511 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); |
2512 | config->setGroup( "Views" ); | 2512 | config->setGroup( "Views" ); |
2513 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2513 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2514 | 2514 | ||
2515 | #if 0 | 2515 | #if 0 |
2516 | qDebug("********************* "); | 2516 | qDebug("********************* "); |
2517 | qDebug("Testcode secsto "); | 2517 | qDebug("Testcode secsto "); |
2518 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | 2518 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); |
2519 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | 2519 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); |
2520 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | 2520 | int secsto = dt_nodaylight.secsTo( dt_daylight ); |
2521 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | 2521 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); |
2522 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | 2522 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); |
2523 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | 2523 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); |
2524 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | 2524 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); |
2525 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | 2525 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); |
2526 | qDebug("********************* testcode end"); | 2526 | qDebug("********************* testcode end"); |
2527 | 2527 | ||
2528 | #endif | 2528 | #endif |
2529 | 2529 | ||
2530 | QValueList<int> listINT = mLeftFrame->sizes(); | 2530 | QValueList<int> listINT = mLeftFrame->sizes(); |
2531 | config->writeEntry("Left Splitter Frame",listINT); | 2531 | config->writeEntry("Left Splitter Frame",listINT); |
2532 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2532 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2533 | config->writeEntry("Main Splitter Frame",listINT2); | 2533 | config->writeEntry("Main Splitter Frame",listINT2); |
2534 | #ifdef DESKTOP_VERSION | 2534 | #ifdef DESKTOP_VERSION |
2535 | config->setGroup("WidgetLayout"); | 2535 | config->setGroup("WidgetLayout"); |
2536 | QStringList list ;//= config->readListEntry("MainLayout"); | 2536 | QStringList list ;//= config->readListEntry("MainLayout"); |
2537 | int x,y,w,h; | 2537 | int x,y,w,h; |
2538 | QWidget* wid; | 2538 | QWidget* wid; |
2539 | wid = topLevelWidget(); | 2539 | wid = topLevelWidget(); |
2540 | x = wid->geometry().x(); | 2540 | x = wid->geometry().x(); |
2541 | y = wid->geometry().y(); | 2541 | y = wid->geometry().y(); |
2542 | w = wid->width(); | 2542 | w = wid->width(); |
2543 | h = wid->height(); | 2543 | h = wid->height(); |
2544 | list.clear(); | 2544 | list.clear(); |
2545 | list << QString::number( x ); | 2545 | list << QString::number( x ); |
2546 | list << QString::number( y ); | 2546 | list << QString::number( y ); |
2547 | list << QString::number( w ); | 2547 | list << QString::number( w ); |
2548 | list << QString::number( h ); | 2548 | list << QString::number( h ); |
2549 | config->writeEntry("MainLayout",list ); | 2549 | config->writeEntry("MainLayout",list ); |
2550 | 2550 | ||
2551 | wid = mEventEditor; | 2551 | wid = mEventEditor; |
2552 | x = wid->geometry().x(); | 2552 | x = wid->geometry().x(); |
2553 | y = wid->geometry().y(); | 2553 | y = wid->geometry().y(); |
2554 | w = wid->width(); | 2554 | w = wid->width(); |
2555 | h = wid->height(); | 2555 | h = wid->height(); |
2556 | list.clear(); | 2556 | list.clear(); |
2557 | list << QString::number( x ); | 2557 | list << QString::number( x ); |
2558 | list << QString::number( y ); | 2558 | list << QString::number( y ); |
2559 | list << QString::number( w ); | 2559 | list << QString::number( w ); |
2560 | list << QString::number( h ); | 2560 | list << QString::number( h ); |
2561 | config->writeEntry("EditEventLayout",list ); | 2561 | config->writeEntry("EditEventLayout",list ); |
2562 | 2562 | ||
2563 | wid = mTodoEditor; | 2563 | wid = mTodoEditor; |
2564 | x = wid->geometry().x(); | 2564 | x = wid->geometry().x(); |
2565 | y = wid->geometry().y(); | 2565 | y = wid->geometry().y(); |
2566 | w = wid->width(); | 2566 | w = wid->width(); |
2567 | h = wid->height(); | 2567 | h = wid->height(); |
2568 | list.clear(); | 2568 | list.clear(); |
2569 | list << QString::number( x ); | 2569 | list << QString::number( x ); |
2570 | list << QString::number( y ); | 2570 | list << QString::number( y ); |
2571 | list << QString::number( w ); | 2571 | list << QString::number( w ); |
2572 | list << QString::number( h ); | 2572 | list << QString::number( h ); |
2573 | config->writeEntry("EditTodoLayout",list ); | 2573 | config->writeEntry("EditTodoLayout",list ); |
2574 | wid = getEventViewerDialog(); | 2574 | wid = getEventViewerDialog(); |
2575 | x = wid->geometry().x(); | 2575 | x = wid->geometry().x(); |
2576 | y = wid->geometry().y(); | 2576 | y = wid->geometry().y(); |
2577 | w = wid->width(); | 2577 | w = wid->width(); |
2578 | h = wid->height(); | 2578 | h = wid->height(); |
2579 | list.clear(); | 2579 | list.clear(); |
2580 | list << QString::number( x ); | 2580 | list << QString::number( x ); |
2581 | list << QString::number( y ); | 2581 | list << QString::number( y ); |
2582 | list << QString::number( w ); | 2582 | list << QString::number( w ); |
2583 | list << QString::number( h ); | 2583 | list << QString::number( h ); |
2584 | config->writeEntry("ViewerLayout",list ); | 2584 | config->writeEntry("ViewerLayout",list ); |
2585 | wid = mDialogManager->getSearchDialog(); | 2585 | wid = mDialogManager->getSearchDialog(); |
2586 | if ( wid ) { | 2586 | if ( wid ) { |
2587 | x = wid->geometry().x(); | 2587 | x = wid->geometry().x(); |
2588 | y = wid->geometry().y(); | 2588 | y = wid->geometry().y(); |
2589 | w = wid->width(); | 2589 | w = wid->width(); |
2590 | h = wid->height(); | 2590 | h = wid->height(); |
2591 | list.clear(); | 2591 | list.clear(); |
2592 | list << QString::number( x ); | 2592 | list << QString::number( x ); |
2593 | list << QString::number( y ); | 2593 | list << QString::number( y ); |
2594 | list << QString::number( w ); | 2594 | list << QString::number( w ); |
2595 | list << QString::number( h ); | 2595 | list << QString::number( h ); |
2596 | config->writeEntry("SearchLayout",list ); | 2596 | config->writeEntry("SearchLayout",list ); |
2597 | } | 2597 | } |
2598 | #endif | 2598 | #endif |
2599 | 2599 | ||
2600 | 2600 | ||
2601 | config->sync(); | 2601 | config->sync(); |
2602 | } | 2602 | } |
2603 | 2603 | ||
2604 | void CalendarView::readFilterSettings(KConfig *config) | 2604 | void CalendarView::readFilterSettings(KConfig *config) |
2605 | { | 2605 | { |
2606 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2606 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2607 | 2607 | ||
2608 | mFilters.clear(); | 2608 | mFilters.clear(); |
2609 | 2609 | ||
2610 | config->setGroup("General"); | 2610 | config->setGroup("General"); |
2611 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2611 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2612 | 2612 | ||
2613 | QStringList::ConstIterator it = filterList.begin(); | 2613 | QStringList::ConstIterator it = filterList.begin(); |
2614 | QStringList::ConstIterator end = filterList.end(); | 2614 | QStringList::ConstIterator end = filterList.end(); |
2615 | while(it != end) { | 2615 | while(it != end) { |
2616 | // kdDebug() << " filter: " << (*it) << endl; | 2616 | // kdDebug() << " filter: " << (*it) << endl; |
2617 | 2617 | ||
2618 | CalFilter *filter; | 2618 | CalFilter *filter; |
2619 | filter = new CalFilter(*it); | 2619 | filter = new CalFilter(*it); |
2620 | config->setGroup("Filter_" + (*it).utf8()); | 2620 | config->setGroup("Filter_" + (*it).utf8()); |
2621 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2621 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2622 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2622 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2623 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2623 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2624 | mFilters.append(filter); | 2624 | mFilters.append(filter); |
2625 | 2625 | ||
2626 | ++it; | 2626 | ++it; |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | if (mFilters.count() == 0) { | 2629 | if (mFilters.count() == 0) { |
2630 | CalFilter *filter = new CalFilter(i18n("Default")); | 2630 | CalFilter *filter = new CalFilter(i18n("Default")); |
2631 | mFilters.append(filter); | 2631 | mFilters.append(filter); |
2632 | } | 2632 | } |
2633 | mFilterView->updateFilters(); | 2633 | mFilterView->updateFilters(); |
2634 | config->setGroup("FilterView"); | 2634 | config->setGroup("FilterView"); |
2635 | 2635 | ||
2636 | mFilterView->blockSignals(true); | 2636 | mFilterView->blockSignals(true); |
2637 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2637 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2638 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2638 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2639 | mFilterView->blockSignals(false); | 2639 | mFilterView->blockSignals(false); |
2640 | // We do it manually to avoid it being done twice by the above calls | 2640 | // We do it manually to avoid it being done twice by the above calls |
2641 | updateFilter(); | 2641 | updateFilter(); |
2642 | } | 2642 | } |
2643 | 2643 | ||
2644 | void CalendarView::writeFilterSettings(KConfig *config) | 2644 | void CalendarView::writeFilterSettings(KConfig *config) |
2645 | { | 2645 | { |
2646 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2646 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2647 | 2647 | ||
2648 | QStringList filterList; | 2648 | QStringList filterList; |
2649 | 2649 | ||
2650 | CalFilter *filter = mFilters.first(); | 2650 | CalFilter *filter = mFilters.first(); |
2651 | while(filter) { | 2651 | while(filter) { |
2652 | // kdDebug() << " fn: " << filter->name() << endl; | 2652 | // kdDebug() << " fn: " << filter->name() << endl; |
2653 | filterList << filter->name(); | 2653 | filterList << filter->name(); |
2654 | config->setGroup("Filter_" + filter->name().utf8()); | 2654 | config->setGroup("Filter_" + filter->name().utf8()); |
2655 | config->writeEntry("Criteria",filter->criteria()); | 2655 | config->writeEntry("Criteria",filter->criteria()); |
2656 | config->writeEntry("CategoryList",filter->categoryList()); | 2656 | config->writeEntry("CategoryList",filter->categoryList()); |
2657 | filter = mFilters.next(); | 2657 | filter = mFilters.next(); |
2658 | } | 2658 | } |
2659 | config->setGroup("General"); | 2659 | config->setGroup("General"); |
2660 | config->writeEntry("CalendarFilters",filterList); | 2660 | config->writeEntry("CalendarFilters",filterList); |
2661 | 2661 | ||
2662 | config->setGroup("FilterView"); | 2662 | config->setGroup("FilterView"); |
2663 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2663 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2664 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2664 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2665 | } | 2665 | } |
2666 | 2666 | ||
2667 | 2667 | ||
2668 | void CalendarView::goToday() | 2668 | void CalendarView::goToday() |
2669 | { | 2669 | { |
2670 | if ( mViewManager->currentView()->isMonthView() ) | 2670 | if ( mViewManager->currentView()->isMonthView() ) |
2671 | mNavigator->selectTodayMonth(); | 2671 | mNavigator->selectTodayMonth(); |
2672 | else | 2672 | else |
2673 | mNavigator->selectToday(); | 2673 | mNavigator->selectToday(); |
2674 | } | 2674 | } |
2675 | 2675 | ||
2676 | void CalendarView::goNext() | 2676 | void CalendarView::goNext() |
2677 | { | 2677 | { |
2678 | mNavigator->selectNext(); | 2678 | mNavigator->selectNext(); |
2679 | } | 2679 | } |
2680 | 2680 | ||
2681 | void CalendarView::goPrevious() | 2681 | void CalendarView::goPrevious() |
2682 | { | 2682 | { |
2683 | mNavigator->selectPrevious(); | 2683 | mNavigator->selectPrevious(); |
2684 | } | 2684 | } |
2685 | void CalendarView::goNextMonth() | 2685 | void CalendarView::goNextMonth() |
2686 | { | 2686 | { |
2687 | mNavigator->selectNextMonth(); | 2687 | mNavigator->selectNextMonth(); |
2688 | } | 2688 | } |
2689 | 2689 | ||
2690 | void CalendarView::goPreviousMonth() | 2690 | void CalendarView::goPreviousMonth() |
2691 | { | 2691 | { |
2692 | mNavigator->selectPreviousMonth(); | 2692 | mNavigator->selectPreviousMonth(); |
2693 | } | 2693 | } |
2694 | 2694 | ||
2695 | void CalendarView::updateConfig() | 2695 | void CalendarView::updateConfig() |
2696 | { | 2696 | { |
2697 | if ( KOPrefs::instance()->mUseAppColors ) | 2697 | if ( KOPrefs::instance()->mUseAppColors ) |
2698 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2698 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2699 | emit configChanged(); | 2699 | emit configChanged(); |
2700 | mTodoList->updateConfig(); | 2700 | mTodoList->updateConfig(); |
2701 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2701 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2702 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2703 | // To make the "fill window" configurations work | 2703 | // To make the "fill window" configurations work |
2704 | //mViewManager->raiseCurrentView(); | 2704 | //mViewManager->raiseCurrentView(); |
2705 | } | 2705 | } |
2706 | 2706 | ||
2707 | 2707 | ||
2708 | void CalendarView::eventChanged(Event *event) | 2708 | void CalendarView::eventChanged(Event *event) |
2709 | { | 2709 | { |
2710 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2710 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2711 | //updateUnmanagedViews(); | 2711 | //updateUnmanagedViews(); |
2712 | } | 2712 | } |
2713 | 2713 | ||
2714 | void CalendarView::eventAdded(Event *event) | 2714 | void CalendarView::eventAdded(Event *event) |
2715 | { | 2715 | { |
2716 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2716 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2717 | } | 2717 | } |
2718 | 2718 | ||
2719 | void CalendarView::eventToBeDeleted(Event *) | 2719 | void CalendarView::eventToBeDeleted(Event *) |
2720 | { | 2720 | { |
2721 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2721 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | void CalendarView::eventDeleted() | 2724 | void CalendarView::eventDeleted() |
2725 | { | 2725 | { |
2726 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2726 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2727 | } | 2727 | } |
2728 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2728 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2729 | { | 2729 | { |
2730 | changeIncidenceDisplay((Incidence *)which, action); | 2730 | changeIncidenceDisplay((Incidence *)which, action); |
2731 | mDateNavigator->updateView(); //LR | 2731 | mDateNavigator->updateView(); //LR |
2732 | //mDialogManager->updateSearchDialog(); | 2732 | //mDialogManager->updateSearchDialog(); |
2733 | 2733 | ||
2734 | if (which) { | 2734 | if (which) { |
2735 | mViewManager->updateWNview(); | 2735 | mViewManager->updateWNview(); |
2736 | //mTodoList->updateView(); | 2736 | //mTodoList->updateView(); |
2737 | } | 2737 | } |
2738 | 2738 | ||
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2741 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2742 | { | 2742 | { |
2743 | updateUnmanagedViews(); | 2743 | updateUnmanagedViews(); |
2744 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2744 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2745 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2745 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2746 | mCalendar->checkAlarmForIncidence( 0, true ); | 2746 | mCalendar->checkAlarmForIncidence( 0, true ); |
2747 | if ( mEventViewerDialog ) | 2747 | if ( mEventViewerDialog ) |
2748 | mEventViewerDialog->hide(); | 2748 | mEventViewerDialog->hide(); |
2749 | } | 2749 | } |
2750 | else | 2750 | else |
2751 | mCalendar->checkAlarmForIncidence( which , false ); | 2751 | mCalendar->checkAlarmForIncidence( which , false ); |
2752 | } | 2752 | } |
2753 | 2753 | ||
2754 | // most of the changeEventDisplays() right now just call the view's | 2754 | // most of the changeEventDisplays() right now just call the view's |
2755 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2755 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2756 | void CalendarView::changeEventDisplay(Event *which, int action) | 2756 | void CalendarView::changeEventDisplay(Event *which, int action) |
2757 | { | 2757 | { |
2758 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2758 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2759 | changeIncidenceDisplay((Incidence *)which, action); | 2759 | changeIncidenceDisplay((Incidence *)which, action); |
2760 | static bool clearallviews = false; | 2760 | static bool clearallviews = false; |
2761 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2761 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2762 | if ( clearallviews ) { | 2762 | if ( clearallviews ) { |
2763 | clearAllViews(); | 2763 | clearAllViews(); |
2764 | clearallviews = false; | 2764 | clearallviews = false; |
2765 | } | 2765 | } |
2766 | return; | 2766 | return; |
2767 | } | 2767 | } |
2768 | clearallviews = true; | 2768 | clearallviews = true; |
2769 | mDateNavigator->updateView(); | 2769 | mDateNavigator->updateView(); |
2770 | //mDialogManager->updateSearchDialog(); | 2770 | //mDialogManager->updateSearchDialog(); |
2771 | if (which) { | 2771 | if (which) { |
2772 | // If there is an event view visible update the display | 2772 | // If there is an event view visible update the display |
2773 | mViewManager->currentView()->changeEventDisplay(which,action); | 2773 | mViewManager->currentView()->changeEventDisplay(which,action); |
2774 | // TODO: check, if update needed | 2774 | // TODO: check, if update needed |
2775 | // if (which->getTodoStatus()) { | 2775 | // if (which->getTodoStatus()) { |
2776 | mTodoList->updateView(); | 2776 | mTodoList->updateView(); |
2777 | if ( action != KOGlobals::EVENTDELETED ) { | 2777 | if ( action != KOGlobals::EVENTDELETED ) { |
2778 | mConflictingEvent = which ; | 2778 | mConflictingEvent = which ; |
2779 | int time = 1000; | 2779 | int time = 1000; |
2780 | #ifdef DESKTOP_VERSION | 2780 | #ifdef DESKTOP_VERSION |
2781 | time = 500; | 2781 | time = 500; |
2782 | #endif | 2782 | #endif |
2783 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 2783 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
2784 | } | 2784 | } |
2785 | // } | 2785 | // } |
2786 | } else { | 2786 | } else { |
2787 | mViewManager->currentView()->updateView(); | 2787 | mViewManager->currentView()->updateView(); |
2788 | } | 2788 | } |
2789 | } | 2789 | } |
2790 | void CalendarView::checkConflictForEvent() | 2790 | void CalendarView::checkConflictForEvent() |
2791 | { | 2791 | { |
2792 | 2792 | ||
2793 | if (!KOPrefs::instance()->mConfirm) | 2793 | if (!KOPrefs::instance()->mConfirm) |
2794 | return; | 2794 | return; |
2795 | if ( ! mConflictingEvent ) return; | 2795 | if ( ! mConflictingEvent ) return; |
2796 | Event * conflictingEvent = mConflictingEvent; | ||
2797 | mConflictingEvent = 0; | ||
2796 | QDateTime current = QDateTime::currentDateTime(); | 2798 | QDateTime current = QDateTime::currentDateTime(); |
2797 | if ( ! mConflictingEvent->matchTime( ¤t, 0 ) ) { | 2799 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
2798 | mConflictingEvent = 0; | ||
2799 | return; | 2800 | return; |
2800 | } | 2801 | } |
2801 | QPtrList<Event> testlist = mCalendar->events(); | 2802 | QPtrList<Event> testlist = mCalendar->events(); |
2802 | Event * test = testlist.first(); | 2803 | Event * test = testlist.first(); |
2803 | QDateTime conflict; | 2804 | QDateTime conflict; |
2804 | QDateTime retVal; | 2805 | QDateTime retVal; |
2805 | bool found = false; | 2806 | bool found = false; |
2806 | Event * cE = 0; | 2807 | Event * cE = 0; |
2807 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 2808 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
2808 | while ( test ) { | 2809 | while ( test ) { |
2809 | qApp->processEvents(); | 2810 | qApp->processEvents(); |
2810 | bool skip = false; | 2811 | bool skip = false; |
2811 | if ( found ) | 2812 | if ( found ) |
2812 | skip = !test->matchTime( ¤t, &conflict ); | 2813 | skip = !test->matchTime( ¤t, &conflict ); |
2813 | else | 2814 | else |
2814 | skip = !test->matchTime( ¤t, 0 ); | 2815 | skip = !test->matchTime( ¤t, 0 ); |
2815 | if ( !skip && !test->doesFloat() ) { | 2816 | if ( !skip && !test->doesFloat() ) { |
2816 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 2817 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2817 | if ( ! found ) { | 2818 | if ( ! found ) { |
2818 | conflict = retVal; | 2819 | conflict = retVal; |
2819 | cE = test; | 2820 | cE = test; |
2820 | } else { | 2821 | } else { |
2821 | if ( retVal < conflict ) { | 2822 | if ( retVal < conflict ) { |
2822 | conflict = retVal; | 2823 | conflict = retVal; |
2823 | cE = test; | 2824 | cE = test; |
2824 | } | 2825 | } |
2825 | } | 2826 | } |
2826 | found = true; | 2827 | found = true; |
2827 | } | 2828 | } |
2828 | } | 2829 | } |
2829 | test = testlist.next(); | 2830 | test = testlist.next(); |
2830 | } | 2831 | } |
2831 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 2832 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
2832 | if ( found ) { | 2833 | if ( found ) { |
2833 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2834 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2834 | qApp->processEvents(); | 2835 | qApp->processEvents(); |
2835 | int km = KMessageBox::warningContinueCancel(this,mess, | 2836 | int km = KMessageBox::warningContinueCancel(this,mess, |
2836 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2837 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2837 | if ( km != KMessageBox::Continue ) { | 2838 | if ( km != KMessageBox::Continue ) { |
2838 | return; | 2839 | return; |
2839 | } | 2840 | } |
2840 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2841 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2841 | mViewManager->showDayView(); | 2842 | mViewManager->showDayView(); |
2842 | mNavigator->slotDaySelect( conflict.date() ); | 2843 | mNavigator->slotDaySelect( conflict.date() ); |
2843 | int hour = conflict.time().hour(); | 2844 | int hour = conflict.time().hour(); |
2844 | mViewManager->agendaView()->setStartHour( hour ); | 2845 | mViewManager->agendaView()->setStartHour( hour ); |
2845 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2846 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2846 | } else | 2847 | } else |
2847 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 2848 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
2848 | mConflictingEvent = 0; | ||
2849 | return; | 2849 | return; |
2850 | 2850 | ||
2851 | } | 2851 | } |
2852 | 2852 | ||
2853 | void CalendarView::updateTodoViews() | 2853 | void CalendarView::updateTodoViews() |
2854 | { | 2854 | { |
2855 | mTodoList->updateView(); | 2855 | mTodoList->updateView(); |
2856 | mViewManager->currentView()->updateView(); | 2856 | mViewManager->currentView()->updateView(); |
2857 | 2857 | ||
2858 | } | 2858 | } |
2859 | 2859 | ||
2860 | 2860 | ||
2861 | 2861 | ||
2862 | void CalendarView::clearAllViews() | 2862 | void CalendarView::clearAllViews() |
2863 | { | 2863 | { |
2864 | mTodoList->clearList(); | 2864 | mTodoList->clearList(); |
2865 | mViewManager->clearAllViews(); | 2865 | mViewManager->clearAllViews(); |
2866 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2866 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2867 | if ( sd ) { | 2867 | if ( sd ) { |
2868 | KOListView* kol = sd->listview(); | 2868 | KOListView* kol = sd->listview(); |
2869 | if ( kol ) | 2869 | if ( kol ) |
2870 | kol->clearList(); | 2870 | kol->clearList(); |
2871 | } | 2871 | } |
2872 | } | 2872 | } |
2873 | void CalendarView::updateView() | 2873 | void CalendarView::updateView() |
2874 | { | 2874 | { |
2875 | static bool clearallviews = false; | 2875 | static bool clearallviews = false; |
2876 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2876 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2877 | if ( clearallviews ) { | 2877 | if ( clearallviews ) { |
2878 | clearAllViews(); | 2878 | clearAllViews(); |
2879 | clearallviews = false; | 2879 | clearallviews = false; |
2880 | } | 2880 | } |
2881 | return; | 2881 | return; |
2882 | } | 2882 | } |
2883 | clearallviews = true; | 2883 | clearallviews = true; |
2884 | DateList tmpList = mNavigator->selectedDates(); | 2884 | DateList tmpList = mNavigator->selectedDates(); |
2885 | 2885 | ||
2886 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2886 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2887 | mTodoList->updateView(); | 2887 | mTodoList->updateView(); |
2888 | // We assume that the navigator only selects consecutive days. | 2888 | // We assume that the navigator only selects consecutive days. |
2889 | updateView( tmpList.first(), tmpList.last() ); | 2889 | updateView( tmpList.first(), tmpList.last() ); |
2890 | } | 2890 | } |
2891 | 2891 | ||
2892 | void CalendarView::updateUnmanagedViews() | 2892 | void CalendarView::updateUnmanagedViews() |
2893 | { | 2893 | { |
2894 | mDateNavigator->updateDayMatrix(); | 2894 | mDateNavigator->updateDayMatrix(); |
2895 | } | 2895 | } |
2896 | 2896 | ||
2897 | int CalendarView::msgItemDelete(const QString name) | 2897 | int CalendarView::msgItemDelete(const QString name) |
2898 | { | 2898 | { |
2899 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2899 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2900 | i18n("This item will be\npermanently deleted."), | 2900 | i18n("This item will be\npermanently deleted."), |
2901 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2901 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2902 | } | 2902 | } |
2903 | 2903 | ||
2904 | 2904 | ||
2905 | void CalendarView::edit_cut() | 2905 | void CalendarView::edit_cut() |
2906 | { | 2906 | { |
2907 | Event *anEvent=0; | 2907 | Event *anEvent=0; |
2908 | 2908 | ||
2909 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2909 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2910 | 2910 | ||
2911 | if (mViewManager->currentView()->isEventView()) { | 2911 | if (mViewManager->currentView()->isEventView()) { |
2912 | if ( incidence && incidence->typeID() == eventID ) { | 2912 | if ( incidence && incidence->typeID() == eventID ) { |
2913 | anEvent = static_cast<Event *>(incidence); | 2913 | anEvent = static_cast<Event *>(incidence); |
2914 | } | 2914 | } |
2915 | } | 2915 | } |
2916 | 2916 | ||
2917 | if (!anEvent) { | 2917 | if (!anEvent) { |
2918 | KNotifyClient::beep(); | 2918 | KNotifyClient::beep(); |
2919 | return; | 2919 | return; |
2920 | } | 2920 | } |
2921 | DndFactory factory( mCalendar ); | 2921 | DndFactory factory( mCalendar ); |
2922 | factory.cutIncidence(anEvent); | 2922 | factory.cutIncidence(anEvent); |
2923 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2923 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2924 | } | 2924 | } |
2925 | 2925 | ||
2926 | void CalendarView::edit_copy() | 2926 | void CalendarView::edit_copy() |
2927 | { | 2927 | { |
2928 | Event *anEvent=0; | 2928 | Event *anEvent=0; |
2929 | 2929 | ||
2930 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2930 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2931 | 2931 | ||
2932 | if (mViewManager->currentView()->isEventView()) { | 2932 | if (mViewManager->currentView()->isEventView()) { |
2933 | if ( incidence && incidence->typeID() == eventID ) { | 2933 | if ( incidence && incidence->typeID() == eventID ) { |
2934 | anEvent = static_cast<Event *>(incidence); | 2934 | anEvent = static_cast<Event *>(incidence); |
2935 | } | 2935 | } |
2936 | } | 2936 | } |
2937 | 2937 | ||
2938 | if (!anEvent) { | 2938 | if (!anEvent) { |
2939 | KNotifyClient::beep(); | 2939 | KNotifyClient::beep(); |
2940 | return; | 2940 | return; |
2941 | } | 2941 | } |
2942 | DndFactory factory( mCalendar ); | 2942 | DndFactory factory( mCalendar ); |
2943 | factory.copyIncidence(anEvent); | 2943 | factory.copyIncidence(anEvent); |
2944 | } | 2944 | } |
2945 | 2945 | ||
2946 | void CalendarView::edit_paste() | 2946 | void CalendarView::edit_paste() |
2947 | { | 2947 | { |
2948 | QDate date = mNavigator->selectedDates().first(); | 2948 | QDate date = mNavigator->selectedDates().first(); |
2949 | 2949 | ||
2950 | DndFactory factory( mCalendar ); | 2950 | DndFactory factory( mCalendar ); |
2951 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2951 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2952 | 2952 | ||
2953 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2953 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2954 | } | 2954 | } |
2955 | void CalendarView::edit_global_options() | 2955 | void CalendarView::edit_global_options() |
2956 | { | 2956 | { |
2957 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2957 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2958 | emit save(); | 2958 | emit save(); |
2959 | emit saveStopTimer(); | 2959 | emit saveStopTimer(); |
2960 | mDialogManager->showGlobalOptionsDialog(); | 2960 | mDialogManager->showGlobalOptionsDialog(); |
2961 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2961 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2962 | emit saveStopTimer(); | 2962 | emit saveStopTimer(); |
2963 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2963 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2964 | i18n("Timezone settings"),i18n("Reload"))) { | 2964 | i18n("Timezone settings"),i18n("Reload"))) { |
2965 | qDebug("KO: TZ reload cancelled "); | 2965 | qDebug("KO: TZ reload cancelled "); |
2966 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2966 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2967 | return; | 2967 | return; |
2968 | } | 2968 | } |
2969 | qDebug("KO: Timezone change "); | 2969 | qDebug("KO: Timezone change "); |
2970 | loadCalendars(); | 2970 | loadCalendars(); |
2971 | setModified(true); | 2971 | setModified(true); |
2972 | } | 2972 | } |
2973 | else | 2973 | else |
2974 | qDebug("KO: No tz change "); | 2974 | qDebug("KO: No tz change "); |
2975 | } | 2975 | } |
2976 | void CalendarView::edit_options() | 2976 | void CalendarView::edit_options() |
2977 | { | 2977 | { |
2978 | mDialogManager->showOptionsDialog(); | 2978 | mDialogManager->showOptionsDialog(); |
2979 | } | 2979 | } |
2980 | 2980 | ||
2981 | 2981 | ||
2982 | void CalendarView::slotSelectPickerDate( QDate d) | 2982 | void CalendarView::slotSelectPickerDate( QDate d) |
2983 | { | 2983 | { |
2984 | mDateFrame->hide(); | 2984 | mDateFrame->hide(); |
2985 | if ( mDatePickerMode == 1 ) { | 2985 | if ( mDatePickerMode == 1 ) { |
2986 | mNavigator->slotDaySelect( d ); | 2986 | mNavigator->slotDaySelect( d ); |
2987 | } else if ( mDatePickerMode == 2 ) { | 2987 | } else if ( mDatePickerMode == 2 ) { |
2988 | if ( mMoveIncidence->typeID() == todoID ) { | 2988 | if ( mMoveIncidence->typeID() == todoID ) { |
2989 | Todo * to = (Todo *) mMoveIncidence; | 2989 | Todo * to = (Todo *) mMoveIncidence; |
2990 | QTime tim; | 2990 | QTime tim; |
2991 | int len = 0; | 2991 | int len = 0; |
2992 | if ( to->hasStartDate() && to->hasDueDate() ) | 2992 | if ( to->hasStartDate() && to->hasDueDate() ) |
2993 | len = to->dtStart().secsTo( to->dtDue()); | 2993 | len = to->dtStart().secsTo( to->dtDue()); |
2994 | if ( to->hasDueDate() ) | 2994 | if ( to->hasDueDate() ) |
2995 | tim = to->dtDue().time(); | 2995 | tim = to->dtDue().time(); |
2996 | else { | 2996 | else { |
2997 | tim = QTime ( 0,0,0 ); | 2997 | tim = QTime ( 0,0,0 ); |
2998 | to->setFloats( true ); | 2998 | to->setFloats( true ); |
2999 | to->setHasDueDate( true ); | 2999 | to->setHasDueDate( true ); |
3000 | } | 3000 | } |
3001 | QDateTime dt ( d,tim ); | 3001 | QDateTime dt ( d,tim ); |
3002 | to->setDtDue( dt ); | 3002 | to->setDtDue( dt ); |
3003 | 3003 | ||
3004 | if ( to->hasStartDate() ) { | 3004 | if ( to->hasStartDate() ) { |
3005 | if ( len>0 ) | 3005 | if ( len>0 ) |
3006 | to->setDtStart(to->dtDue().addSecs( -len )); | 3006 | to->setDtStart(to->dtDue().addSecs( -len )); |
3007 | else | 3007 | else |
3008 | if (to->dtStart() > to->dtDue() ) | 3008 | if (to->dtStart() > to->dtDue() ) |
3009 | to->setDtStart(to->dtDue().addDays( -3 )); | 3009 | to->setDtStart(to->dtDue().addDays( -3 )); |
3010 | } | 3010 | } |
3011 | 3011 | ||
3012 | todoChanged( to ); | 3012 | todoChanged( to ); |
3013 | } else if ( mMoveIncidence->typeID() == eventID ) { | 3013 | } else if ( mMoveIncidence->typeID() == eventID ) { |
3014 | if ( mMoveIncidence->doesRecur() ) { | 3014 | if ( mMoveIncidence->doesRecur() ) { |
3015 | #if 0 | 3015 | #if 0 |
3016 | // PENDING implement this | 3016 | // PENDING implement this |
3017 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 3017 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
3018 | mCalendar()->addIncidence( newInc ); | 3018 | mCalendar()->addIncidence( newInc ); |
3019 | if ( mMoveIncidence->typeID() == todoID ) | 3019 | if ( mMoveIncidence->typeID() == todoID ) |
3020 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 3020 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
3021 | else | 3021 | else |
3022 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 3022 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
3023 | mMoveIncidence = newInc; | 3023 | mMoveIncidence = newInc; |
3024 | 3024 | ||
3025 | #endif | 3025 | #endif |
3026 | } | 3026 | } |
3027 | QTime tim = mMoveIncidence->dtStart().time(); | 3027 | QTime tim = mMoveIncidence->dtStart().time(); |
3028 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 3028 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
3029 | QDateTime dt ( d,tim ); | 3029 | QDateTime dt ( d,tim ); |
3030 | mMoveIncidence->setDtStart( dt ); | 3030 | mMoveIncidence->setDtStart( dt ); |
3031 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 3031 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
3032 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 3032 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
3033 | } else if ( mMoveIncidence->typeID() == journalID ) { | 3033 | } else if ( mMoveIncidence->typeID() == journalID ) { |
3034 | QTime tim = mMoveIncidence->dtStart().time(); | 3034 | QTime tim = mMoveIncidence->dtStart().time(); |
3035 | QDateTime dt ( d,tim ); | 3035 | QDateTime dt ( d,tim ); |
3036 | mMoveIncidence->setDtStart( dt ); | 3036 | mMoveIncidence->setDtStart( dt ); |
3037 | updateView(); | 3037 | updateView(); |
3038 | } | 3038 | } |
3039 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 3039 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
3040 | } | 3040 | } |
3041 | } | 3041 | } |
3042 | 3042 | ||
3043 | void CalendarView::removeCategories() | 3043 | void CalendarView::removeCategories() |
3044 | { | 3044 | { |
3045 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3045 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3046 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3046 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3047 | QStringList catIncList; | 3047 | QStringList catIncList; |
3048 | QStringList newCatList; | 3048 | QStringList newCatList; |
3049 | Incidence* inc = incList.first(); | 3049 | Incidence* inc = incList.first(); |
3050 | uint i; | 3050 | uint i; |
3051 | while ( inc ) { | 3051 | while ( inc ) { |
3052 | newCatList.clear(); | 3052 | newCatList.clear(); |
3053 | catIncList = inc->categories() ; | 3053 | catIncList = inc->categories() ; |
3054 | for( i = 0; i< catIncList.count(); ++i ) { | 3054 | for( i = 0; i< catIncList.count(); ++i ) { |
3055 | if ( catList.contains (catIncList[i])) | 3055 | if ( catList.contains (catIncList[i])) |
3056 | newCatList.append( catIncList[i] ); | 3056 | newCatList.append( catIncList[i] ); |
3057 | } | 3057 | } |
3058 | newCatList.sort(); | 3058 | newCatList.sort(); |
3059 | inc->setCategories( newCatList.join(",") ); | 3059 | inc->setCategories( newCatList.join(",") ); |
3060 | inc = incList.next(); | 3060 | inc = incList.next(); |
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | int CalendarView::addCategories() | 3064 | int CalendarView::addCategories() |
3065 | { | 3065 | { |
3066 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3066 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3067 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3067 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3068 | QStringList catIncList; | 3068 | QStringList catIncList; |
3069 | Incidence* inc = incList.first(); | 3069 | Incidence* inc = incList.first(); |
3070 | uint i; | 3070 | uint i; |
3071 | int count = 0; | 3071 | int count = 0; |
3072 | while ( inc ) { | 3072 | while ( inc ) { |
3073 | catIncList = inc->categories() ; | 3073 | catIncList = inc->categories() ; |
3074 | for( i = 0; i< catIncList.count(); ++i ) { | 3074 | for( i = 0; i< catIncList.count(); ++i ) { |
3075 | if ( !catList.contains (catIncList[i])) { | 3075 | if ( !catList.contains (catIncList[i])) { |
3076 | catList.append( catIncList[i] ); | 3076 | catList.append( catIncList[i] ); |
3077 | //qDebug("add cat %s ", catIncList[i].latin1()); | 3077 | //qDebug("add cat %s ", catIncList[i].latin1()); |
3078 | ++count; | 3078 | ++count; |
3079 | } | 3079 | } |
3080 | } | 3080 | } |
3081 | inc = incList.next(); | 3081 | inc = incList.next(); |
3082 | } | 3082 | } |
3083 | catList.sort(); | 3083 | catList.sort(); |
3084 | KOPrefs::instance()->mCustomCategories = catList; | 3084 | KOPrefs::instance()->mCustomCategories = catList; |
3085 | return count; | 3085 | return count; |
3086 | } | 3086 | } |
3087 | 3087 | ||
3088 | void CalendarView::editCategories() | 3088 | void CalendarView::editCategories() |
3089 | { | 3089 | { |
3090 | qDebug("CalendarView::editCategories() "); | 3090 | qDebug("CalendarView::editCategories() "); |
3091 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); | 3091 | KPIM::CategoryEditDialog ced (KOPrefs::instance(),this ); |
3092 | ced.exec(); | 3092 | ced.exec(); |
3093 | } | 3093 | } |
3094 | void CalendarView::manageCategories() | 3094 | void CalendarView::manageCategories() |
3095 | { | 3095 | { |
3096 | KOCatPrefs* cp = new KOCatPrefs(); | 3096 | KOCatPrefs* cp = new KOCatPrefs(); |
3097 | cp->show(); | 3097 | cp->show(); |
3098 | int w =cp->sizeHint().width() ; | 3098 | int w =cp->sizeHint().width() ; |
3099 | int h = cp->sizeHint().height() ; | 3099 | int h = cp->sizeHint().height() ; |
3100 | int dw = QApplication::desktop()->width(); | 3100 | int dw = QApplication::desktop()->width(); |
3101 | int dh = QApplication::desktop()->height(); | 3101 | int dh = QApplication::desktop()->height(); |
3102 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 3102 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
3103 | if ( !cp->exec() ) { | 3103 | if ( !cp->exec() ) { |
3104 | delete cp; | 3104 | delete cp; |
3105 | return; | 3105 | return; |
3106 | } | 3106 | } |
3107 | int count = 0; | 3107 | int count = 0; |
3108 | if ( cp->addCat() ) { | 3108 | if ( cp->addCat() ) { |
3109 | count = addCategories(); | 3109 | count = addCategories(); |
3110 | if ( count ) { | 3110 | if ( count ) { |
3111 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 3111 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
3112 | writeSettings(); | 3112 | writeSettings(); |
3113 | } else | 3113 | } else |
3114 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 3114 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
3115 | } else { | 3115 | } else { |
3116 | removeCategories(); | 3116 | removeCategories(); |
3117 | updateView(); | 3117 | updateView(); |
3118 | } | 3118 | } |
3119 | delete cp; | 3119 | delete cp; |
3120 | } | 3120 | } |
3121 | 3121 | ||
3122 | void CalendarView::beamIncidence(Incidence * Inc) | 3122 | void CalendarView::beamIncidence(Incidence * Inc) |
3123 | { | 3123 | { |
3124 | QPtrList<Incidence> delSel ; | 3124 | QPtrList<Incidence> delSel ; |
3125 | delSel.append(Inc); | 3125 | delSel.append(Inc); |
3126 | beamIncidenceList( delSel ); | 3126 | beamIncidenceList( delSel ); |
3127 | } | 3127 | } |
3128 | void CalendarView::beamCalendar() | 3128 | void CalendarView::beamCalendar() |
3129 | { | 3129 | { |
3130 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 3130 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
3131 | //qDebug("beamCalendar() "); | 3131 | //qDebug("beamCalendar() "); |
3132 | beamIncidenceList( delSel ); | 3132 | beamIncidenceList( delSel ); |
3133 | } | 3133 | } |
3134 | void CalendarView::beamFilteredCalendar() | 3134 | void CalendarView::beamFilteredCalendar() |
3135 | { | 3135 | { |
3136 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 3136 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
3137 | //qDebug("beamFilteredCalendar() "); | 3137 | //qDebug("beamFilteredCalendar() "); |
3138 | beamIncidenceList( delSel ); | 3138 | beamIncidenceList( delSel ); |
3139 | } | 3139 | } |
3140 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 3140 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
3141 | { | 3141 | { |
3142 | 3142 | ||
3143 | KOBeamPrefs beamDialog; | 3143 | KOBeamPrefs beamDialog; |
3144 | if ( beamDialog.exec () == QDialog::Rejected ) | 3144 | if ( beamDialog.exec () == QDialog::Rejected ) |
3145 | return; | 3145 | return; |
3146 | #ifdef DESKTOP_VERSION | 3146 | #ifdef DESKTOP_VERSION |
3147 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 3147 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
3148 | #else | 3148 | #else |
3149 | QString fn = "/tmp/kopibeamfile"; | 3149 | QString fn = "/tmp/kopibeamfile"; |
3150 | #endif | 3150 | #endif |
3151 | QString mes; | 3151 | QString mes; |
3152 | bool createbup = true; | 3152 | bool createbup = true; |
3153 | if ( createbup ) { | 3153 | if ( createbup ) { |
3154 | QString description = "\n"; | 3154 | QString description = "\n"; |
3155 | CalendarLocal* cal = new CalendarLocal(); | 3155 | CalendarLocal* cal = new CalendarLocal(); |
3156 | if ( beamDialog.beamLocal() ) | 3156 | if ( beamDialog.beamLocal() ) |
3157 | cal->setLocalTime(); | 3157 | cal->setLocalTime(); |
3158 | else | 3158 | else |
3159 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 3159 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
3160 | Incidence *incidence = delSel.first(); | 3160 | Incidence *incidence = delSel.first(); |
3161 | bool addText = false; | 3161 | bool addText = false; |
3162 | if ( delSel.count() < 10 ) | 3162 | if ( delSel.count() < 10 ) |
3163 | addText = true; | 3163 | addText = true; |
3164 | else { | 3164 | else { |
3165 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 3165 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
3166 | } | 3166 | } |
3167 | while ( incidence ) { | 3167 | while ( incidence ) { |
3168 | Incidence *in = incidence->clone(); | 3168 | Incidence *in = incidence->clone(); |
3169 | if ( ! in->summary().isEmpty() ) { | 3169 | if ( ! in->summary().isEmpty() ) { |
3170 | in->setDescription(""); | 3170 | in->setDescription(""); |
3171 | } else { | 3171 | } else { |
3172 | in->setSummary( in->description().left(20)); | 3172 | in->setSummary( in->description().left(20)); |
3173 | in->setDescription(""); | 3173 | in->setDescription(""); |
3174 | } | 3174 | } |
3175 | if ( addText ) | 3175 | if ( addText ) |
3176 | description += in->summary() + "\n"; | 3176 | description += in->summary() + "\n"; |
3177 | cal->addIncidence( in ); | 3177 | cal->addIncidence( in ); |
3178 | incidence = delSel.next(); | 3178 | incidence = delSel.next(); |
3179 | } | 3179 | } |
3180 | if ( beamDialog.beamVcal() ) { | 3180 | if ( beamDialog.beamVcal() ) { |
3181 | fn += ".vcs"; | 3181 | fn += ".vcs"; |
3182 | FileStorage storage( cal, fn, new VCalFormat ); | 3182 | FileStorage storage( cal, fn, new VCalFormat ); |
3183 | storage.save(); | 3183 | storage.save(); |
3184 | } else { | 3184 | } else { |
3185 | fn += ".ics"; | 3185 | fn += ".ics"; |
3186 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 3186 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
3187 | storage.save(); | 3187 | storage.save(); |
3188 | } | 3188 | } |
3189 | delete cal; | 3189 | delete cal; |
3190 | mes = i18n("KO/Pi: Ready for beaming"); | 3190 | mes = i18n("KO/Pi: Ready for beaming"); |
3191 | topLevelWidget()->setCaption(mes); | 3191 | topLevelWidget()->setCaption(mes); |
3192 | KApplication::convert2latin1( fn ); | 3192 | KApplication::convert2latin1( fn ); |
3193 | #ifndef DESKTOP_VERSION | 3193 | #ifndef DESKTOP_VERSION |
3194 | Ir *ir = new Ir( this ); | 3194 | Ir *ir = new Ir( this ); |
3195 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 3195 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
3196 | ir->send( fn, description, "text/x-vCalendar" ); | 3196 | ir->send( fn, description, "text/x-vCalendar" ); |
3197 | #endif | 3197 | #endif |
3198 | } | 3198 | } |
3199 | } | 3199 | } |
3200 | 3200 | ||
3201 | #ifndef DESKTOP_VERSION | 3201 | #ifndef DESKTOP_VERSION |
3202 | void CalendarView::beamDone( Ir *ir ) | 3202 | void CalendarView::beamDone( Ir *ir ) |
3203 | { | 3203 | { |
3204 | delete ir; | 3204 | delete ir; |
3205 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 3205 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
3206 | topLevelWidget()->raise(); | 3206 | topLevelWidget()->raise(); |
3207 | } | 3207 | } |
3208 | #else | 3208 | #else |
3209 | void CalendarView::beamDone( Ir *){;} | 3209 | void CalendarView::beamDone( Ir *){;} |
3210 | #endif | 3210 | #endif |
3211 | void CalendarView::moveIncidence(Incidence * inc ) | 3211 | void CalendarView::moveIncidence(Incidence * inc ) |
3212 | { | 3212 | { |
3213 | if ( !inc ) return; | 3213 | if ( !inc ) return; |
3214 | showDatePickerPopup(); | 3214 | showDatePickerPopup(); |
3215 | mDatePickerMode = 2; | 3215 | mDatePickerMode = 2; |
3216 | mMoveIncidence = inc ; | 3216 | mMoveIncidence = inc ; |
3217 | QDate da; | 3217 | QDate da; |
3218 | if ( mMoveIncidence->typeID() == todoID ) { | 3218 | if ( mMoveIncidence->typeID() == todoID ) { |
3219 | Todo * to = (Todo *) mMoveIncidence; | 3219 | Todo * to = (Todo *) mMoveIncidence; |
3220 | if ( to->hasDueDate() ) | 3220 | if ( to->hasDueDate() ) |
3221 | da = to->dtDue().date(); | 3221 | da = to->dtDue().date(); |
3222 | else | 3222 | else |
3223 | da = QDate::currentDate(); | 3223 | da = QDate::currentDate(); |
3224 | } else { | 3224 | } else { |
3225 | da = mMoveIncidence->dtStart().date(); | 3225 | da = mMoveIncidence->dtStart().date(); |
3226 | } | 3226 | } |
3227 | //PENDING set date for recurring incidence to date of recurrence | 3227 | //PENDING set date for recurring incidence to date of recurrence |
3228 | //mMoveIncidenceOldDate; | 3228 | //mMoveIncidenceOldDate; |
3229 | mDatePicker->setDate( da ); | 3229 | mDatePicker->setDate( da ); |
3230 | } | 3230 | } |
3231 | void CalendarView::showDatePickerPopup() | 3231 | void CalendarView::showDatePickerPopup() |
3232 | { | 3232 | { |
@@ -3711,774 +3711,775 @@ void CalendarView::deleteTodo(Todo *todo) | |||
3711 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3711 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3712 | updateView(); | 3712 | updateView(); |
3713 | } | 3713 | } |
3714 | break; | 3714 | break; |
3715 | } // switch | 3715 | } // switch |
3716 | } else { | 3716 | } else { |
3717 | checkExternalId( todo ); | 3717 | checkExternalId( todo ); |
3718 | mCalendar->deleteTodo(todo); | 3718 | mCalendar->deleteTodo(todo); |
3719 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3719 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3720 | updateView(); | 3720 | updateView(); |
3721 | } | 3721 | } |
3722 | 3722 | ||
3723 | emit updateSearchDialog(); | 3723 | emit updateSearchDialog(); |
3724 | } | 3724 | } |
3725 | void CalendarView::deleteJournal(Journal *jour) | 3725 | void CalendarView::deleteJournal(Journal *jour) |
3726 | { | 3726 | { |
3727 | if (!jour) { | 3727 | if (!jour) { |
3728 | KNotifyClient::beep(); | 3728 | KNotifyClient::beep(); |
3729 | return; | 3729 | return; |
3730 | } | 3730 | } |
3731 | if (KOPrefs::instance()->mConfirm) { | 3731 | if (KOPrefs::instance()->mConfirm) { |
3732 | 3732 | ||
3733 | QString des; | 3733 | QString des; |
3734 | if ( !jour->summary().isEmpty() ) { | 3734 | if ( !jour->summary().isEmpty() ) { |
3735 | des = jour->summary(); | 3735 | des = jour->summary(); |
3736 | } else { | 3736 | } else { |
3737 | des = jour->description().left(30); | 3737 | des = jour->description().left(30); |
3738 | des = des.simplifyWhiteSpace (); | 3738 | des = des.simplifyWhiteSpace (); |
3739 | des.replace (QRegExp ("\\n"),"" ); | 3739 | des.replace (QRegExp ("\\n"),"" ); |
3740 | des.replace (QRegExp ("\\r"),"" ); | 3740 | des.replace (QRegExp ("\\r"),"" ); |
3741 | } | 3741 | } |
3742 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { | 3742 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { |
3743 | case KMessageBox::Continue: // OK | 3743 | case KMessageBox::Continue: // OK |
3744 | calendar()->deleteJournal(jour); | 3744 | calendar()->deleteJournal(jour); |
3745 | updateView(); | 3745 | updateView(); |
3746 | break; | 3746 | break; |
3747 | } // switch | 3747 | } // switch |
3748 | } else { | 3748 | } else { |
3749 | calendar()->deleteJournal(jour);; | 3749 | calendar()->deleteJournal(jour);; |
3750 | updateView(); | 3750 | updateView(); |
3751 | } | 3751 | } |
3752 | emit updateSearchDialog(); | 3752 | emit updateSearchDialog(); |
3753 | } | 3753 | } |
3754 | 3754 | ||
3755 | void CalendarView::deleteEvent(Event *anEvent) | 3755 | void CalendarView::deleteEvent(Event *anEvent) |
3756 | { | 3756 | { |
3757 | if (!anEvent) { | 3757 | if (!anEvent) { |
3758 | KNotifyClient::beep(); | 3758 | KNotifyClient::beep(); |
3759 | return; | 3759 | return; |
3760 | } | 3760 | } |
3761 | 3761 | ||
3762 | if (anEvent->recurrence()->doesRecur()) { | 3762 | if (anEvent->recurrence()->doesRecur()) { |
3763 | QDate itemDate = mViewManager->currentSelectionDate(); | 3763 | QDate itemDate = mViewManager->currentSelectionDate(); |
3764 | int km; | 3764 | int km; |
3765 | if (!itemDate.isValid()) { | 3765 | if (!itemDate.isValid()) { |
3766 | //kdDebug() << "Date Not Valid" << endl; | 3766 | //kdDebug() << "Date Not Valid" << endl; |
3767 | if (KOPrefs::instance()->mConfirm) { | 3767 | if (KOPrefs::instance()->mConfirm) { |
3768 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3768 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3769 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3769 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3770 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3770 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3771 | if ( km == KMessageBox::Continue ) | 3771 | if ( km == KMessageBox::Continue ) |
3772 | km = KMessageBox::No; // No = all below | 3772 | km = KMessageBox::No; // No = all below |
3773 | } else | 3773 | } else |
3774 | km = KMessageBox::No; | 3774 | km = KMessageBox::No; |
3775 | } else { | 3775 | } else { |
3776 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3776 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3777 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3777 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3778 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3778 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3779 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3779 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3780 | i18n("All")); | 3780 | i18n("All")); |
3781 | } | 3781 | } |
3782 | switch(km) { | 3782 | switch(km) { |
3783 | 3783 | ||
3784 | case KMessageBox::No: // Continue // all | 3784 | case KMessageBox::No: // Continue // all |
3785 | //qDebug("KMessageBox::No "); | 3785 | //qDebug("KMessageBox::No "); |
3786 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3786 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3787 | schedule(Scheduler::Cancel,anEvent); | 3787 | schedule(Scheduler::Cancel,anEvent); |
3788 | 3788 | ||
3789 | checkExternalId( anEvent); | 3789 | checkExternalId( anEvent); |
3790 | mCalendar->deleteEvent(anEvent); | 3790 | mCalendar->deleteEvent(anEvent); |
3791 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3791 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3792 | break; | 3792 | break; |
3793 | 3793 | ||
3794 | // Disabled because it does not work | 3794 | // Disabled because it does not work |
3795 | //#if 0 | 3795 | //#if 0 |
3796 | case KMessageBox::Yes: // just this one | 3796 | case KMessageBox::Yes: // just this one |
3797 | //QDate qd = mNavigator->selectedDates().first(); | 3797 | //QDate qd = mNavigator->selectedDates().first(); |
3798 | //if (!qd.isValid()) { | 3798 | //if (!qd.isValid()) { |
3799 | // kdDebug() << "no date selected, or invalid date" << endl; | 3799 | // kdDebug() << "no date selected, or invalid date" << endl; |
3800 | // KNotifyClient::beep(); | 3800 | // KNotifyClient::beep(); |
3801 | // return; | 3801 | // return; |
3802 | //} | 3802 | //} |
3803 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3803 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3804 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3804 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3805 | anEvent->addExDate(itemDate); | 3805 | anEvent->addExDate(itemDate); |
3806 | int duration = anEvent->recurrence()->duration(); | 3806 | int duration = anEvent->recurrence()->duration(); |
3807 | if ( duration > 0 ) { | 3807 | if ( duration > 0 ) { |
3808 | anEvent->recurrence()->setDuration( duration - 1 ); | 3808 | anEvent->recurrence()->setDuration( duration - 1 ); |
3809 | } | 3809 | } |
3810 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3810 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3811 | } | 3811 | } |
3812 | break; | 3812 | break; |
3813 | //#endif | 3813 | //#endif |
3814 | } // switch | 3814 | } // switch |
3815 | } else { | 3815 | } else { |
3816 | if (KOPrefs::instance()->mConfirm) { | 3816 | if (KOPrefs::instance()->mConfirm) { |
3817 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3817 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3818 | i18n("\nAre you sure you want\nto delete this event?"), | 3818 | i18n("\nAre you sure you want\nto delete this event?"), |
3819 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3819 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3820 | case KMessageBox::Continue: // OK | 3820 | case KMessageBox::Continue: // OK |
3821 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3821 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3822 | schedule(Scheduler::Cancel,anEvent); | 3822 | schedule(Scheduler::Cancel,anEvent); |
3823 | checkExternalId( anEvent); | 3823 | checkExternalId( anEvent); |
3824 | mCalendar->deleteEvent(anEvent); | 3824 | mCalendar->deleteEvent(anEvent); |
3825 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3825 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3826 | break; | 3826 | break; |
3827 | } // switch | 3827 | } // switch |
3828 | } else { | 3828 | } else { |
3829 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3829 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3830 | schedule(Scheduler::Cancel,anEvent); | 3830 | schedule(Scheduler::Cancel,anEvent); |
3831 | checkExternalId( anEvent); | 3831 | checkExternalId( anEvent); |
3832 | mCalendar->deleteEvent(anEvent); | 3832 | mCalendar->deleteEvent(anEvent); |
3833 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3833 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3834 | } | 3834 | } |
3835 | } // if-else | 3835 | } // if-else |
3836 | emit updateSearchDialog(); | 3836 | emit updateSearchDialog(); |
3837 | } | 3837 | } |
3838 | 3838 | ||
3839 | bool CalendarView::deleteEvent(const QString &uid) | 3839 | bool CalendarView::deleteEvent(const QString &uid) |
3840 | { | 3840 | { |
3841 | Event *ev = mCalendar->event(uid); | 3841 | Event *ev = mCalendar->event(uid); |
3842 | if (ev) { | 3842 | if (ev) { |
3843 | deleteEvent(ev); | 3843 | deleteEvent(ev); |
3844 | return true; | 3844 | return true; |
3845 | } else { | 3845 | } else { |
3846 | return false; | 3846 | return false; |
3847 | } | 3847 | } |
3848 | } | 3848 | } |
3849 | 3849 | ||
3850 | /*****************************************************************************/ | 3850 | /*****************************************************************************/ |
3851 | 3851 | ||
3852 | void CalendarView::action_mail() | 3852 | void CalendarView::action_mail() |
3853 | { | 3853 | { |
3854 | #ifndef KORG_NOMAIL | 3854 | #ifndef KORG_NOMAIL |
3855 | KOMailClient mailClient; | 3855 | KOMailClient mailClient; |
3856 | 3856 | ||
3857 | Incidence *incidence = currentSelection(); | 3857 | Incidence *incidence = currentSelection(); |
3858 | 3858 | ||
3859 | if (!incidence) { | 3859 | if (!incidence) { |
3860 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3860 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3861 | return; | 3861 | return; |
3862 | } | 3862 | } |
3863 | if(incidence->attendeeCount() == 0 ) { | 3863 | if(incidence->attendeeCount() == 0 ) { |
3864 | KMessageBox::sorry(this, | 3864 | KMessageBox::sorry(this, |
3865 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3865 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3866 | return; | 3866 | return; |
3867 | } | 3867 | } |
3868 | 3868 | ||
3869 | CalendarLocal cal_tmp; | 3869 | CalendarLocal cal_tmp; |
3870 | Event *event = 0; | 3870 | Event *event = 0; |
3871 | Event *ev = 0; | 3871 | Event *ev = 0; |
3872 | if ( incidence && incidence->typeID() == eventID ) { | 3872 | if ( incidence && incidence->typeID() == eventID ) { |
3873 | event = static_cast<Event *>(incidence); | 3873 | event = static_cast<Event *>(incidence); |
3874 | ev = new Event(*event); | 3874 | ev = new Event(*event); |
3875 | cal_tmp.addEvent(ev); | 3875 | cal_tmp.addEvent(ev); |
3876 | } | 3876 | } |
3877 | ICalFormat mForm(); | 3877 | ICalFormat mForm(); |
3878 | QString attachment = mForm.toString( &cal_tmp ); | 3878 | QString attachment = mForm.toString( &cal_tmp ); |
3879 | if (ev) delete(ev); | 3879 | if (ev) delete(ev); |
3880 | 3880 | ||
3881 | mailClient.mailAttendees(currentSelection(), attachment); | 3881 | mailClient.mailAttendees(currentSelection(), attachment); |
3882 | 3882 | ||
3883 | #endif | 3883 | #endif |
3884 | 3884 | ||
3885 | #if 0 | 3885 | #if 0 |
3886 | Event *anEvent = 0; | 3886 | Event *anEvent = 0; |
3887 | if (mViewManager->currentView()->isEventView()) { | 3887 | if (mViewManager->currentView()->isEventView()) { |
3888 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3888 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3889 | } | 3889 | } |
3890 | 3890 | ||
3891 | if (!anEvent) { | 3891 | if (!anEvent) { |
3892 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3892 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3893 | return; | 3893 | return; |
3894 | } | 3894 | } |
3895 | if(anEvent->attendeeCount() == 0 ) { | 3895 | if(anEvent->attendeeCount() == 0 ) { |
3896 | KMessageBox::sorry(this, | 3896 | KMessageBox::sorry(this, |
3897 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3897 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3898 | return; | 3898 | return; |
3899 | } | 3899 | } |
3900 | 3900 | ||
3901 | mailobject.emailEvent(anEvent); | 3901 | mailobject.emailEvent(anEvent); |
3902 | #endif | 3902 | #endif |
3903 | } | 3903 | } |
3904 | 3904 | ||
3905 | 3905 | ||
3906 | void CalendarView::schedule_publish(Incidence *incidence) | 3906 | void CalendarView::schedule_publish(Incidence *incidence) |
3907 | { | 3907 | { |
3908 | Event *event = 0; | 3908 | Event *event = 0; |
3909 | Todo *todo = 0; | 3909 | Todo *todo = 0; |
3910 | 3910 | ||
3911 | if (incidence == 0) { | 3911 | if (incidence == 0) { |
3912 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3912 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3913 | if (incidence == 0) { | 3913 | if (incidence == 0) { |
3914 | incidence = mTodoList->selectedIncidences().first(); | 3914 | incidence = mTodoList->selectedIncidences().first(); |
3915 | } | 3915 | } |
3916 | } | 3916 | } |
3917 | if ( incidence && incidence->typeID() == eventID ) { | 3917 | if ( incidence && incidence->typeID() == eventID ) { |
3918 | event = static_cast<Event *>(incidence); | 3918 | event = static_cast<Event *>(incidence); |
3919 | } else { | 3919 | } else { |
3920 | if ( incidence && incidence->typeID() == todoID ) { | 3920 | if ( incidence && incidence->typeID() == todoID ) { |
3921 | todo = static_cast<Todo *>(incidence); | 3921 | todo = static_cast<Todo *>(incidence); |
3922 | } | 3922 | } |
3923 | } | 3923 | } |
3924 | 3924 | ||
3925 | if (!event && !todo) { | 3925 | if (!event && !todo) { |
3926 | KMessageBox::sorry(this,i18n("No event selected.")); | 3926 | KMessageBox::sorry(this,i18n("No event selected.")); |
3927 | return; | 3927 | return; |
3928 | } | 3928 | } |
3929 | 3929 | ||
3930 | PublishDialog *publishdlg = new PublishDialog(); | 3930 | PublishDialog *publishdlg = new PublishDialog(); |
3931 | if (incidence->attendeeCount()>0) { | 3931 | if (incidence->attendeeCount()>0) { |
3932 | QPtrList<Attendee> attendees = incidence->attendees(); | 3932 | QPtrList<Attendee> attendees = incidence->attendees(); |
3933 | attendees.first(); | 3933 | attendees.first(); |
3934 | while ( attendees.current()!=0 ) { | 3934 | while ( attendees.current()!=0 ) { |
3935 | publishdlg->addAttendee(attendees.current()); | 3935 | publishdlg->addAttendee(attendees.current()); |
3936 | attendees.next(); | 3936 | attendees.next(); |
3937 | } | 3937 | } |
3938 | } | 3938 | } |
3939 | bool send = true; | 3939 | bool send = true; |
3940 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3940 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3941 | if ( publishdlg->exec() != QDialog::Accepted ) | 3941 | if ( publishdlg->exec() != QDialog::Accepted ) |
3942 | send = false; | 3942 | send = false; |
3943 | } | 3943 | } |
3944 | if ( send ) { | 3944 | if ( send ) { |
3945 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3945 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3946 | if ( event ) { | 3946 | if ( event ) { |
3947 | Event *ev = new Event(*event); | 3947 | Event *ev = new Event(*event); |
3948 | ev->registerObserver(0); | 3948 | ev->registerObserver(0); |
3949 | ev->clearAttendees(); | 3949 | ev->clearAttendees(); |
3950 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3950 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3951 | delete(ev); | 3951 | delete(ev); |
3952 | } | 3952 | } |
3953 | } else { | 3953 | } else { |
3954 | if ( todo ) { | 3954 | if ( todo ) { |
3955 | Todo *ev = new Todo(*todo); | 3955 | Todo *ev = new Todo(*todo); |
3956 | ev->registerObserver(0); | 3956 | ev->registerObserver(0); |
3957 | ev->clearAttendees(); | 3957 | ev->clearAttendees(); |
3958 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3958 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3959 | delete(ev); | 3959 | delete(ev); |
3960 | } | 3960 | } |
3961 | } | 3961 | } |
3962 | } | 3962 | } |
3963 | } | 3963 | } |
3964 | delete publishdlg; | 3964 | delete publishdlg; |
3965 | } | 3965 | } |
3966 | 3966 | ||
3967 | void CalendarView::schedule_request(Incidence *incidence) | 3967 | void CalendarView::schedule_request(Incidence *incidence) |
3968 | { | 3968 | { |
3969 | schedule(Scheduler::Request,incidence); | 3969 | schedule(Scheduler::Request,incidence); |
3970 | } | 3970 | } |
3971 | 3971 | ||
3972 | void CalendarView::schedule_refresh(Incidence *incidence) | 3972 | void CalendarView::schedule_refresh(Incidence *incidence) |
3973 | { | 3973 | { |
3974 | schedule(Scheduler::Refresh,incidence); | 3974 | schedule(Scheduler::Refresh,incidence); |
3975 | } | 3975 | } |
3976 | 3976 | ||
3977 | void CalendarView::schedule_cancel(Incidence *incidence) | 3977 | void CalendarView::schedule_cancel(Incidence *incidence) |
3978 | { | 3978 | { |
3979 | schedule(Scheduler::Cancel,incidence); | 3979 | schedule(Scheduler::Cancel,incidence); |
3980 | } | 3980 | } |
3981 | 3981 | ||
3982 | void CalendarView::schedule_add(Incidence *incidence) | 3982 | void CalendarView::schedule_add(Incidence *incidence) |
3983 | { | 3983 | { |
3984 | schedule(Scheduler::Add,incidence); | 3984 | schedule(Scheduler::Add,incidence); |
3985 | } | 3985 | } |
3986 | 3986 | ||
3987 | void CalendarView::schedule_reply(Incidence *incidence) | 3987 | void CalendarView::schedule_reply(Incidence *incidence) |
3988 | { | 3988 | { |
3989 | schedule(Scheduler::Reply,incidence); | 3989 | schedule(Scheduler::Reply,incidence); |
3990 | } | 3990 | } |
3991 | 3991 | ||
3992 | void CalendarView::schedule_counter(Incidence *incidence) | 3992 | void CalendarView::schedule_counter(Incidence *incidence) |
3993 | { | 3993 | { |
3994 | schedule(Scheduler::Counter,incidence); | 3994 | schedule(Scheduler::Counter,incidence); |
3995 | } | 3995 | } |
3996 | 3996 | ||
3997 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3997 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3998 | { | 3998 | { |
3999 | schedule(Scheduler::Declinecounter,incidence); | 3999 | schedule(Scheduler::Declinecounter,incidence); |
4000 | } | 4000 | } |
4001 | 4001 | ||
4002 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 4002 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
4003 | { | 4003 | { |
4004 | QDateTime start = QDateTime::currentDateTime(); | 4004 | QDateTime start = QDateTime::currentDateTime(); |
4005 | QDateTime end = start.addDays(daysToPublish); | 4005 | QDateTime end = start.addDays(daysToPublish); |
4006 | 4006 | ||
4007 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 4007 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
4008 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 4008 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
4009 | 4009 | ||
4010 | 4010 | ||
4011 | PublishDialog *publishdlg = new PublishDialog(); | 4011 | PublishDialog *publishdlg = new PublishDialog(); |
4012 | if ( publishdlg->exec() == QDialog::Accepted ) { | 4012 | if ( publishdlg->exec() == QDialog::Accepted ) { |
4013 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 4013 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
4014 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 4014 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
4015 | delete(freebusy); | 4015 | delete(freebusy); |
4016 | } | 4016 | } |
4017 | } | 4017 | } |
4018 | delete publishdlg; | 4018 | delete publishdlg; |
4019 | } | 4019 | } |
4020 | 4020 | ||
4021 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 4021 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
4022 | { | 4022 | { |
4023 | Event *event = 0; | 4023 | Event *event = 0; |
4024 | Todo *todo = 0; | 4024 | Todo *todo = 0; |
4025 | 4025 | ||
4026 | if (incidence == 0) { | 4026 | if (incidence == 0) { |
4027 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 4027 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
4028 | if (incidence == 0) { | 4028 | if (incidence == 0) { |
4029 | incidence = mTodoList->selectedIncidences().first(); | 4029 | incidence = mTodoList->selectedIncidences().first(); |
4030 | } | 4030 | } |
4031 | } | 4031 | } |
4032 | if ( incidence && incidence->typeID() == eventID ) { | 4032 | if ( incidence && incidence->typeID() == eventID ) { |
4033 | event = static_cast<Event *>(incidence); | 4033 | event = static_cast<Event *>(incidence); |
4034 | } | 4034 | } |
4035 | if ( incidence && incidence->typeID() == todoID ) { | 4035 | if ( incidence && incidence->typeID() == todoID ) { |
4036 | todo = static_cast<Todo *>(incidence); | 4036 | todo = static_cast<Todo *>(incidence); |
4037 | } | 4037 | } |
4038 | 4038 | ||
4039 | if (!event && !todo) { | 4039 | if (!event && !todo) { |
4040 | KMessageBox::sorry(this,i18n("No event selected.")); | 4040 | KMessageBox::sorry(this,i18n("No event selected.")); |
4041 | return; | 4041 | return; |
4042 | } | 4042 | } |
4043 | 4043 | ||
4044 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 4044 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
4045 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 4045 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
4046 | return; | 4046 | return; |
4047 | } | 4047 | } |
4048 | 4048 | ||
4049 | Event *ev = 0; | 4049 | Event *ev = 0; |
4050 | if (event) ev = new Event(*event); | 4050 | if (event) ev = new Event(*event); |
4051 | Todo *to = 0; | 4051 | Todo *to = 0; |
4052 | if (todo) to = new Todo(*todo); | 4052 | if (todo) to = new Todo(*todo); |
4053 | 4053 | ||
4054 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 4054 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
4055 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 4055 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
4056 | if (!me) { | 4056 | if (!me) { |
4057 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 4057 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
4058 | return; | 4058 | return; |
4059 | } | 4059 | } |
4060 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 4060 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
4061 | StatusDialog *statdlg = new StatusDialog(this); | 4061 | StatusDialog *statdlg = new StatusDialog(this); |
4062 | if (!statdlg->exec()==QDialog::Accepted) return; | 4062 | if (!statdlg->exec()==QDialog::Accepted) return; |
4063 | me->setStatus( statdlg->status() ); | 4063 | me->setStatus( statdlg->status() ); |
4064 | delete(statdlg); | 4064 | delete(statdlg); |
4065 | } | 4065 | } |
4066 | Attendee *menew = new Attendee(*me); | 4066 | Attendee *menew = new Attendee(*me); |
4067 | if (ev) { | 4067 | if (ev) { |
4068 | ev->clearAttendees(); | 4068 | ev->clearAttendees(); |
4069 | ev->addAttendee(menew,false); | 4069 | ev->addAttendee(menew,false); |
4070 | } else { | 4070 | } else { |
4071 | if (to) { | 4071 | if (to) { |
4072 | todo->clearAttendees(); | 4072 | todo->clearAttendees(); |
4073 | todo->addAttendee(menew,false); | 4073 | todo->addAttendee(menew,false); |
4074 | } | 4074 | } |
4075 | } | 4075 | } |
4076 | } | 4076 | } |
4077 | 4077 | ||
4078 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 4078 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
4079 | if (ev) { | 4079 | if (ev) { |
4080 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 4080 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
4081 | } else { | 4081 | } else { |
4082 | if (to) { | 4082 | if (to) { |
4083 | if ( !dlg->addMessage(to,method) ) delete(to); | 4083 | if ( !dlg->addMessage(to,method) ) delete(to); |
4084 | } | 4084 | } |
4085 | } | 4085 | } |
4086 | } | 4086 | } |
4087 | 4087 | ||
4088 | void CalendarView::openAddressbook() | 4088 | void CalendarView::openAddressbook() |
4089 | { | 4089 | { |
4090 | KRun::runCommand("kaddressbook"); | 4090 | KRun::runCommand("kaddressbook"); |
4091 | } | 4091 | } |
4092 | 4092 | ||
4093 | void CalendarView::setModified(bool modified) | 4093 | void CalendarView::setModified(bool modified) |
4094 | { | 4094 | { |
4095 | //qDebug("CalendarView::setModified %d ", modified); | ||
4095 | if ( modified ) | 4096 | if ( modified ) |
4096 | emit signalmodified(); | 4097 | emit signalmodified(); |
4097 | if (mModified != modified) { | 4098 | mModified = modified; |
4098 | mModified = modified; | 4099 | if ( mModified ) |
4099 | emit modifiedChanged(mModified); | 4100 | emit modifiedChanged(mModified); |
4100 | } | 4101 | |
4101 | } | 4102 | } |
4102 | 4103 | ||
4103 | bool CalendarView::isReadOnly() | 4104 | bool CalendarView::isReadOnly() |
4104 | { | 4105 | { |
4105 | return mReadOnly; | 4106 | return mReadOnly; |
4106 | } | 4107 | } |
4107 | 4108 | ||
4108 | void CalendarView::setReadOnly(bool readOnly) | 4109 | void CalendarView::setReadOnly(bool readOnly) |
4109 | { | 4110 | { |
4110 | if (mReadOnly != readOnly) { | 4111 | if (mReadOnly != readOnly) { |
4111 | mReadOnly = readOnly; | 4112 | mReadOnly = readOnly; |
4112 | emit readOnlyChanged(mReadOnly); | 4113 | emit readOnlyChanged(mReadOnly); |
4113 | } | 4114 | } |
4114 | } | 4115 | } |
4115 | 4116 | ||
4116 | bool CalendarView::isModified() | 4117 | bool CalendarView::isModified() |
4117 | { | 4118 | { |
4118 | return mModified; | 4119 | return mModified; |
4119 | } | 4120 | } |
4120 | void CalendarView::slotprintSelInc() | 4121 | void CalendarView::slotprintSelInc() |
4121 | { | 4122 | { |
4122 | if ( currentSelection() == 0 ) { | 4123 | if ( currentSelection() == 0 ) { |
4123 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 4124 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
4124 | return; | 4125 | return; |
4125 | } | 4126 | } |
4126 | showIncidence(); | 4127 | showIncidence(); |
4127 | getEventViewerDialog()->print(); | 4128 | getEventViewerDialog()->print(); |
4128 | 4129 | ||
4129 | } | 4130 | } |
4130 | void CalendarView::printSetup() | 4131 | void CalendarView::printSetup() |
4131 | { | 4132 | { |
4132 | #ifndef KORG_NOPRINTER | 4133 | #ifndef KORG_NOPRINTER |
4133 | createPrinter(); | 4134 | createPrinter(); |
4134 | 4135 | ||
4135 | mCalPrinter->setupPrinter(); | 4136 | mCalPrinter->setupPrinter(); |
4136 | #endif | 4137 | #endif |
4137 | } | 4138 | } |
4138 | 4139 | ||
4139 | void CalendarView::print() | 4140 | void CalendarView::print() |
4140 | { | 4141 | { |
4141 | #ifndef KORG_NOPRINTER | 4142 | #ifndef KORG_NOPRINTER |
4142 | createPrinter(); | 4143 | createPrinter(); |
4143 | 4144 | ||
4144 | DateList tmpDateList = mNavigator->selectedDates(); | 4145 | DateList tmpDateList = mNavigator->selectedDates(); |
4145 | mCalPrinter->print(CalPrinter::Month, | 4146 | mCalPrinter->print(CalPrinter::Month, |
4146 | tmpDateList.first(), tmpDateList.last()); | 4147 | tmpDateList.first(), tmpDateList.last()); |
4147 | #endif | 4148 | #endif |
4148 | } | 4149 | } |
4149 | 4150 | ||
4150 | void CalendarView::printPreview() | 4151 | void CalendarView::printPreview() |
4151 | { | 4152 | { |
4152 | #ifndef KORG_NOPRINTER | 4153 | #ifndef KORG_NOPRINTER |
4153 | kdDebug() << "CalendarView::printPreview()" << endl; | 4154 | kdDebug() << "CalendarView::printPreview()" << endl; |
4154 | 4155 | ||
4155 | createPrinter(); | 4156 | createPrinter(); |
4156 | 4157 | ||
4157 | DateList tmpDateList = mNavigator->selectedDates(); | 4158 | DateList tmpDateList = mNavigator->selectedDates(); |
4158 | 4159 | ||
4159 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 4160 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
4160 | tmpDateList.last()); | 4161 | tmpDateList.last()); |
4161 | #endif | 4162 | #endif |
4162 | } | 4163 | } |
4163 | 4164 | ||
4164 | void CalendarView::exportICalendar() | 4165 | void CalendarView::exportICalendar() |
4165 | { | 4166 | { |
4166 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 4167 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
4167 | 4168 | ||
4168 | // Force correct extension | 4169 | // Force correct extension |
4169 | if (filename.right(4) != ".ics") filename += ".ics"; | 4170 | if (filename.right(4) != ".ics") filename += ".ics"; |
4170 | 4171 | ||
4171 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 4172 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
4172 | storage.save(); | 4173 | storage.save(); |
4173 | } | 4174 | } |
4174 | 4175 | ||
4175 | bool CalendarView::exportVCalendar( QString filename ) | 4176 | bool CalendarView::exportVCalendar( QString filename ) |
4176 | { | 4177 | { |
4177 | if (mCalendar->journals().count() > 0) { | 4178 | if (mCalendar->journals().count() > 0) { |
4178 | int result = KMessageBox::warningContinueCancel(this, | 4179 | int result = KMessageBox::warningContinueCancel(this, |
4179 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 4180 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
4180 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 4181 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
4181 | true); | 4182 | true); |
4182 | if (result != KMessageBox::Continue) return false; | 4183 | if (result != KMessageBox::Continue) return false; |
4183 | } | 4184 | } |
4184 | 4185 | ||
4185 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 4186 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
4186 | 4187 | ||
4187 | // Force correct extension | 4188 | // Force correct extension |
4188 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 4189 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
4189 | 4190 | ||
4190 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 4191 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
4191 | return storage.save(); | 4192 | return storage.save(); |
4192 | 4193 | ||
4193 | } | 4194 | } |
4194 | 4195 | ||
4195 | void CalendarView::eventUpdated(Incidence *) | 4196 | void CalendarView::eventUpdated(Incidence *) |
4196 | { | 4197 | { |
4197 | setModified(); | 4198 | setModified(); |
4198 | // Don't call updateView here. The code, which has caused the update of the | 4199 | // Don't call updateView here. The code, which has caused the update of the |
4199 | // event is responsible for updating the view. | 4200 | // event is responsible for updating the view. |
4200 | // updateView(); | 4201 | // updateView(); |
4201 | } | 4202 | } |
4202 | 4203 | ||
4203 | void CalendarView::adaptNavigationUnits() | 4204 | void CalendarView::adaptNavigationUnits() |
4204 | { | 4205 | { |
4205 | if (mViewManager->currentView()->isEventView()) { | 4206 | if (mViewManager->currentView()->isEventView()) { |
4206 | int days = mViewManager->currentView()->currentDateCount(); | 4207 | int days = mViewManager->currentView()->currentDateCount(); |
4207 | if (days == 1) { | 4208 | if (days == 1) { |
4208 | emit changeNavStringPrev(i18n("&Previous Day")); | 4209 | emit changeNavStringPrev(i18n("&Previous Day")); |
4209 | emit changeNavStringNext(i18n("&Next Day")); | 4210 | emit changeNavStringNext(i18n("&Next Day")); |
4210 | } else { | 4211 | } else { |
4211 | emit changeNavStringPrev(i18n("&Previous Week")); | 4212 | emit changeNavStringPrev(i18n("&Previous Week")); |
4212 | emit changeNavStringNext(i18n("&Next Week")); | 4213 | emit changeNavStringNext(i18n("&Next Week")); |
4213 | } | 4214 | } |
4214 | } | 4215 | } |
4215 | } | 4216 | } |
4216 | 4217 | ||
4217 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 4218 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
4218 | { | 4219 | { |
4219 | if ( incidence ) mTodoList->clearSelection(); | 4220 | if ( incidence ) mTodoList->clearSelection(); |
4220 | processIncidenceSelection( incidence ); | 4221 | processIncidenceSelection( incidence ); |
4221 | } | 4222 | } |
4222 | 4223 | ||
4223 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 4224 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
4224 | { | 4225 | { |
4225 | if ( incidence && mViewManager->currentView() ) { | 4226 | if ( incidence && mViewManager->currentView() ) { |
4226 | mViewManager->currentView()->clearSelection(); | 4227 | mViewManager->currentView()->clearSelection(); |
4227 | } | 4228 | } |
4228 | processIncidenceSelection( incidence ); | 4229 | processIncidenceSelection( incidence ); |
4229 | } | 4230 | } |
4230 | 4231 | ||
4231 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 4232 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
4232 | { | 4233 | { |
4233 | emit incidenceSelected( incidence ); | 4234 | emit incidenceSelected( incidence ); |
4234 | if ( incidence == mSelectedIncidence ) return; | 4235 | if ( incidence == mSelectedIncidence ) return; |
4235 | mSelectedIncidence = incidence; | 4236 | mSelectedIncidence = incidence; |
4236 | 4237 | ||
4237 | if ( incidence && incidence->typeID() == eventID ) { | 4238 | if ( incidence && incidence->typeID() == eventID ) { |
4238 | Event *event = static_cast<Event *>( incidence ); | 4239 | Event *event = static_cast<Event *>( incidence ); |
4239 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4240 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4240 | emit organizerEventsSelected( true ); | 4241 | emit organizerEventsSelected( true ); |
4241 | } else { | 4242 | } else { |
4242 | emit organizerEventsSelected(false); | 4243 | emit organizerEventsSelected(false); |
4243 | } | 4244 | } |
4244 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4245 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4245 | KOPrefs::instance()->email() ) ) { | 4246 | KOPrefs::instance()->email() ) ) { |
4246 | emit groupEventsSelected( true ); | 4247 | emit groupEventsSelected( true ); |
4247 | } else { | 4248 | } else { |
4248 | emit groupEventsSelected(false); | 4249 | emit groupEventsSelected(false); |
4249 | } | 4250 | } |
4250 | return; | 4251 | return; |
4251 | } else { | 4252 | } else { |
4252 | if ( incidence && incidence->typeID() == todoID ) { | 4253 | if ( incidence && incidence->typeID() == todoID ) { |
4253 | emit todoSelected( true ); | 4254 | emit todoSelected( true ); |
4254 | Todo *event = static_cast<Todo *>( incidence ); | 4255 | Todo *event = static_cast<Todo *>( incidence ); |
4255 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 4256 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
4256 | emit organizerEventsSelected( true ); | 4257 | emit organizerEventsSelected( true ); |
4257 | } else { | 4258 | } else { |
4258 | emit organizerEventsSelected(false); | 4259 | emit organizerEventsSelected(false); |
4259 | } | 4260 | } |
4260 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 4261 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
4261 | KOPrefs::instance()->email() ) ) { | 4262 | KOPrefs::instance()->email() ) ) { |
4262 | emit groupEventsSelected( true ); | 4263 | emit groupEventsSelected( true ); |
4263 | } else { | 4264 | } else { |
4264 | emit groupEventsSelected(false); | 4265 | emit groupEventsSelected(false); |
4265 | } | 4266 | } |
4266 | return; | 4267 | return; |
4267 | } else { | 4268 | } else { |
4268 | emit todoSelected( false ); | 4269 | emit todoSelected( false ); |
4269 | emit organizerEventsSelected(false); | 4270 | emit organizerEventsSelected(false); |
4270 | emit groupEventsSelected(false); | 4271 | emit groupEventsSelected(false); |
4271 | } | 4272 | } |
4272 | return; | 4273 | return; |
4273 | } | 4274 | } |
4274 | 4275 | ||
4275 | /* if ( incidence && incidence->typeID() == todoID ) { | 4276 | /* if ( incidence && incidence->typeID() == todoID ) { |
4276 | emit todoSelected( true ); | 4277 | emit todoSelected( true ); |
4277 | } else { | 4278 | } else { |
4278 | emit todoSelected( false ); | 4279 | emit todoSelected( false ); |
4279 | }*/ | 4280 | }*/ |
4280 | } | 4281 | } |
4281 | 4282 | ||
4282 | 4283 | ||
4283 | void CalendarView::checkClipboard() | 4284 | void CalendarView::checkClipboard() |
4284 | { | 4285 | { |
4285 | #ifndef KORG_NODND | 4286 | #ifndef KORG_NODND |
4286 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 4287 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
4287 | emit pasteEnabled(true); | 4288 | emit pasteEnabled(true); |
4288 | } else { | 4289 | } else { |
4289 | emit pasteEnabled(false); | 4290 | emit pasteEnabled(false); |
4290 | } | 4291 | } |
4291 | #endif | 4292 | #endif |
4292 | } | 4293 | } |
4293 | 4294 | ||
4294 | void CalendarView::showDates(const DateList &selectedDates) | 4295 | void CalendarView::showDates(const DateList &selectedDates) |
4295 | { | 4296 | { |
4296 | // kdDebug() << "CalendarView::selectDates()" << endl; | 4297 | // kdDebug() << "CalendarView::selectDates()" << endl; |
4297 | 4298 | ||
4298 | 4299 | ||
4299 | if ( !mBlockShowDates ) { | 4300 | if ( !mBlockShowDates ) { |
4300 | if ( mViewManager->currentView() ) { | 4301 | if ( mViewManager->currentView() ) { |
4301 | updateView( selectedDates.first(), selectedDates.last() ); | 4302 | updateView( selectedDates.first(), selectedDates.last() ); |
4302 | } else { | 4303 | } else { |
4303 | mViewManager->showAgendaView(); | 4304 | mViewManager->showAgendaView(); |
4304 | } | 4305 | } |
4305 | } | 4306 | } |
4306 | 4307 | ||
4307 | QDate date = selectedDates.first(); | 4308 | QDate date = selectedDates.first(); |
4308 | if ( ! date.isValid() ) { | 4309 | if ( ! date.isValid() ) { |
4309 | topLevelWidget()->setCaption(""); | 4310 | topLevelWidget()->setCaption(""); |
4310 | return; | 4311 | return; |
4311 | } | 4312 | } |
4312 | 4313 | ||
4313 | QString selDates; | 4314 | QString selDates; |
4314 | selDates = KGlobal::locale()->formatDate( date, true); | 4315 | selDates = KGlobal::locale()->formatDate( date, true); |
4315 | if (selectedDates.first() < selectedDates.last() ) | 4316 | if (selectedDates.first() < selectedDates.last() ) |
4316 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 4317 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
4317 | else { | 4318 | else { |
4318 | QString addString; | 4319 | QString addString; |
4319 | if ( date == QDateTime::currentDateTime().date() ) | 4320 | if ( date == QDateTime::currentDateTime().date() ) |
4320 | addString = i18n("Today"); | 4321 | addString = i18n("Today"); |
4321 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 4322 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
4322 | addString = i18n("Tomorrow"); | 4323 | addString = i18n("Tomorrow"); |
4323 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 4324 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
4324 | addString = i18n("Yesterday"); | 4325 | addString = i18n("Yesterday"); |
4325 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 4326 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
4326 | addString = i18n("Day before yesterday"); | 4327 | addString = i18n("Day before yesterday"); |
4327 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 4328 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
4328 | addString = i18n("Day after tomorrow"); | 4329 | addString = i18n("Day after tomorrow"); |
4329 | if ( !addString.isEmpty() ) { | 4330 | if ( !addString.isEmpty() ) { |
4330 | topLevelWidget()->setCaption( addString+", " + selDates ); | 4331 | topLevelWidget()->setCaption( addString+", " + selDates ); |
4331 | return; | 4332 | return; |
4332 | } | 4333 | } |
4333 | } | 4334 | } |
4334 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 4335 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
4335 | 4336 | ||
4336 | } | 4337 | } |
4337 | 4338 | ||
4338 | QPtrList<CalFilter> CalendarView::filters() | 4339 | QPtrList<CalFilter> CalendarView::filters() |
4339 | { | 4340 | { |
4340 | return mFilters; | 4341 | return mFilters; |
4341 | 4342 | ||
4342 | } | 4343 | } |
4343 | void CalendarView::editFilters() | 4344 | void CalendarView::editFilters() |
4344 | { | 4345 | { |
4345 | // kdDebug() << "CalendarView::editFilters()" << endl; | 4346 | // kdDebug() << "CalendarView::editFilters()" << endl; |
4346 | 4347 | ||
4347 | CalFilter *filter = mFilters.first(); | 4348 | CalFilter *filter = mFilters.first(); |
4348 | while(filter) { | 4349 | while(filter) { |
4349 | filter = mFilters.next(); | 4350 | filter = mFilters.next(); |
4350 | } | 4351 | } |
4351 | 4352 | ||
4352 | mDialogManager->showFilterEditDialog(&mFilters); | 4353 | mDialogManager->showFilterEditDialog(&mFilters); |
4353 | updateFilter(); | 4354 | updateFilter(); |
4354 | } | 4355 | } |
4355 | void CalendarView::toggleFilter() | 4356 | void CalendarView::toggleFilter() |
4356 | { | 4357 | { |
4357 | if ( mLeftFrame->isHidden() ) { | 4358 | if ( mLeftFrame->isHidden() ) { |
4358 | toggleExpand(); | 4359 | toggleExpand(); |
4359 | showFilter( true ); | 4360 | showFilter( true ); |
4360 | } else | 4361 | } else |
4361 | showFilter(! mCalEditView->isVisible()); | 4362 | showFilter(! mCalEditView->isVisible()); |
4362 | } | 4363 | } |
4363 | 4364 | ||
4364 | KOFilterView *CalendarView::filterView() | 4365 | KOFilterView *CalendarView::filterView() |
4365 | { | 4366 | { |
4366 | return mFilterView; | 4367 | return mFilterView; |
4367 | } | 4368 | } |
4368 | void CalendarView::selectFilter( int fil ) | 4369 | void CalendarView::selectFilter( int fil ) |
4369 | { | 4370 | { |
4370 | mFilterView->setSelectedFilter( fil ); | 4371 | mFilterView->setSelectedFilter( fil ); |
4371 | updateUnmanagedViews(); | 4372 | updateUnmanagedViews(); |
4372 | } | 4373 | } |
4373 | void CalendarView::showFilter(bool visible) | 4374 | void CalendarView::showFilter(bool visible) |
4374 | { | 4375 | { |
4375 | #if 1 | 4376 | #if 1 |
4376 | if (visible) { | 4377 | if (visible) { |
4377 | mCalEditView->readConfig(); | 4378 | mCalEditView->readConfig(); |
4378 | mCalEditView->show(); | 4379 | mCalEditView->show(); |
4379 | QValueList<int> sizes; | 4380 | QValueList<int> sizes; |
4380 | sizes = mLeftFrame->sizes(); | 4381 | sizes = mLeftFrame->sizes(); |
4381 | if ( sizes.count() == 4 && sizes[3] < 20 ) { | 4382 | if ( sizes.count() == 4 && sizes[3] < 20 ) { |
4382 | sizes.clear(); | 4383 | sizes.clear(); |
4383 | sizes << 100; | 4384 | sizes << 100; |
4384 | sizes << 0; | 4385 | sizes << 0; |
4385 | sizes << 0; | 4386 | sizes << 0; |
4386 | sizes << 100; | 4387 | sizes << 100; |
4387 | mLeftFrame->setSizes(sizes); | 4388 | mLeftFrame->setSizes(sizes); |
4388 | } | 4389 | } |
4389 | #if 0 | 4390 | #if 0 |
4390 | sizes = mLeftFrame->sizes(); | 4391 | sizes = mLeftFrame->sizes(); |
4391 | int ccc = 0; | 4392 | int ccc = 0; |
4392 | while ( ccc < sizes.count()) { | 4393 | while ( ccc < sizes.count()) { |
4393 | qDebug("size %d %d ", ccc, sizes[ccc]); | 4394 | qDebug("size %d %d ", ccc, sizes[ccc]); |
4394 | ++ccc; | 4395 | ++ccc; |
4395 | } | 4396 | } |
4396 | #endif | 4397 | #endif |
4397 | 4398 | ||
4398 | } | 4399 | } |
4399 | else { | 4400 | else { |
4400 | mCalEditView->hide(); | 4401 | mCalEditView->hide(); |
4401 | } | 4402 | } |
4402 | #else | 4403 | #else |
4403 | if (visible) mFilterView->show(); | 4404 | if (visible) mFilterView->show(); |
4404 | else mFilterView->hide(); | 4405 | else mFilterView->hide(); |
4405 | #endif | 4406 | #endif |
4406 | } | 4407 | } |
4407 | void CalendarView::toggleFilerEnabled( ) | 4408 | void CalendarView::toggleFilerEnabled( ) |
4408 | { | 4409 | { |
4409 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 4410 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
4410 | if ( !mFilterView->filtersEnabled() ) | 4411 | if ( !mFilterView->filtersEnabled() ) |
4411 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 4412 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
4412 | updateUnmanagedViews(); | 4413 | updateUnmanagedViews(); |
4413 | 4414 | ||
4414 | } | 4415 | } |
4415 | void CalendarView::updateFilter() | 4416 | void CalendarView::updateFilter() |
4416 | { | 4417 | { |
4417 | CalFilter *filter = mFilterView->selectedFilter(); | 4418 | CalFilter *filter = mFilterView->selectedFilter(); |
4418 | if (filter) { | 4419 | if (filter) { |
4419 | QString mess; | 4420 | QString mess; |
4420 | if (mFilterView->filtersEnabled()) { | 4421 | if (mFilterView->filtersEnabled()) { |
4421 | mess = i18n("Filter selected: ")+filter->name(); | 4422 | mess = i18n("Filter selected: ")+filter->name(); |
4422 | filter->setEnabled(true); | 4423 | filter->setEnabled(true); |
4423 | } | 4424 | } |
4424 | else filter->setEnabled(false); | 4425 | else filter->setEnabled(false); |
4425 | mCalendar->setFilter(filter); | 4426 | mCalendar->setFilter(filter); |
4426 | updateView(); | 4427 | updateView(); |
4427 | if ( !mess.isEmpty() ) | 4428 | if ( !mess.isEmpty() ) |
4428 | topLevelWidget()->setCaption( mess ); | 4429 | topLevelWidget()->setCaption( mess ); |
4429 | 4430 | ||
4430 | } | 4431 | } |
4431 | emit filtersUpdated(); | 4432 | emit filtersUpdated(); |
4432 | } | 4433 | } |
4433 | 4434 | ||
4434 | void CalendarView::filterEdited() | 4435 | void CalendarView::filterEdited() |
4435 | { | 4436 | { |
4436 | mFilterView->updateFilters(); | 4437 | mFilterView->updateFilters(); |
4437 | updateFilter(); | 4438 | updateFilter(); |
4438 | writeSettings(); | 4439 | writeSettings(); |
4439 | } | 4440 | } |
4440 | 4441 | ||
4441 | 4442 | ||
4442 | void CalendarView::takeOverEvent() | 4443 | void CalendarView::takeOverEvent() |
4443 | { | 4444 | { |
4444 | Incidence *incidence = currentSelection(); | 4445 | Incidence *incidence = currentSelection(); |
4445 | 4446 | ||
4446 | if (!incidence) return; | 4447 | if (!incidence) return; |
4447 | 4448 | ||
4448 | incidence->setOrganizer(KOPrefs::instance()->email()); | 4449 | incidence->setOrganizer(KOPrefs::instance()->email()); |
4449 | incidence->recreate(); | 4450 | incidence->recreate(); |
4450 | incidence->setReadOnly(false); | 4451 | incidence->setReadOnly(false); |
4451 | 4452 | ||
4452 | updateView(); | 4453 | updateView(); |
4453 | } | 4454 | } |
4454 | 4455 | ||
4455 | void CalendarView::takeOverCalendar() | 4456 | void CalendarView::takeOverCalendar() |
4456 | { | 4457 | { |
4457 | // TODO: Create Calendar::allIncidences() function and use it here | 4458 | // TODO: Create Calendar::allIncidences() function and use it here |
4458 | 4459 | ||
4459 | clearAllViews(); | 4460 | clearAllViews(); |
4460 | QPtrList<Event> events = mCalendar->events(); | 4461 | QPtrList<Event> events = mCalendar->events(); |
4461 | for(uint i=0; i<events.count(); ++i) { | 4462 | for(uint i=0; i<events.count(); ++i) { |
4462 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4463 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4463 | events.at(i)->recreate(); | 4464 | events.at(i)->recreate(); |
4464 | events.at(i)->setReadOnly(false); | 4465 | events.at(i)->setReadOnly(false); |
4465 | } | 4466 | } |
4466 | 4467 | ||
4467 | QPtrList<Todo> todos = mCalendar->todos(); | 4468 | QPtrList<Todo> todos = mCalendar->todos(); |
4468 | for(uint i=0; i<todos.count(); ++i) { | 4469 | for(uint i=0; i<todos.count(); ++i) { |
4469 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4470 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4470 | todos.at(i)->recreate(); | 4471 | todos.at(i)->recreate(); |
4471 | todos.at(i)->setReadOnly(false); | 4472 | todos.at(i)->setReadOnly(false); |
4472 | } | 4473 | } |
4473 | 4474 | ||
4474 | QPtrList<Journal> journals = mCalendar->journals(); | 4475 | QPtrList<Journal> journals = mCalendar->journals(); |
4475 | for(uint i=0; i<journals.count(); ++i) { | 4476 | for(uint i=0; i<journals.count(); ++i) { |
4476 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 4477 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
4477 | journals.at(i)->recreate(); | 4478 | journals.at(i)->recreate(); |
4478 | journals.at(i)->setReadOnly(false); | 4479 | journals.at(i)->setReadOnly(false); |
4479 | } | 4480 | } |
4480 | 4481 | ||
4481 | updateView(); | 4482 | updateView(); |
4482 | } | 4483 | } |
4483 | 4484 | ||
4484 | void CalendarView::showIntro() | 4485 | void CalendarView::showIntro() |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 279955f..77d0ac8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1533,857 +1533,865 @@ void MainWindow::displayText( QString text ,QString cap ) | |||
1533 | void MainWindow::features() | 1533 | void MainWindow::features() |
1534 | { | 1534 | { |
1535 | 1535 | ||
1536 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1536 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1537 | } | 1537 | } |
1538 | 1538 | ||
1539 | void MainWindow::usertrans() | 1539 | void MainWindow::usertrans() |
1540 | { | 1540 | { |
1541 | 1541 | ||
1542 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1542 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | void MainWindow::storagehowto() | 1545 | void MainWindow::storagehowto() |
1546 | { | 1546 | { |
1547 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1547 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1548 | } | 1548 | } |
1549 | void MainWindow::timetrackinghowto() | 1549 | void MainWindow::timetrackinghowto() |
1550 | { | 1550 | { |
1551 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1551 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1552 | } | 1552 | } |
1553 | void MainWindow::kdesynchowto() | 1553 | void MainWindow::kdesynchowto() |
1554 | { | 1554 | { |
1555 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1555 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1556 | } | 1556 | } |
1557 | void MainWindow::multisynchowto() | 1557 | void MainWindow::multisynchowto() |
1558 | { | 1558 | { |
1559 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1559 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1560 | } | 1560 | } |
1561 | void MainWindow::synchowto() | 1561 | void MainWindow::synchowto() |
1562 | { | 1562 | { |
1563 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1563 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1564 | } | 1564 | } |
1565 | void MainWindow::faq() | 1565 | void MainWindow::faq() |
1566 | { | 1566 | { |
1567 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1567 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1568 | 1568 | ||
1569 | } | 1569 | } |
1570 | void MainWindow::whatsNew() | 1570 | void MainWindow::whatsNew() |
1571 | { | 1571 | { |
1572 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1572 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1573 | 1573 | ||
1574 | } | 1574 | } |
1575 | void MainWindow::licence() | 1575 | void MainWindow::licence() |
1576 | { | 1576 | { |
1577 | KApplication::showLicence(); | 1577 | KApplication::showLicence(); |
1578 | 1578 | ||
1579 | } | 1579 | } |
1580 | void MainWindow::about() | 1580 | void MainWindow::about() |
1581 | { | 1581 | { |
1582 | QString version; | 1582 | QString version; |
1583 | #include <../version> | 1583 | #include <../version> |
1584 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1584 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1585 | i18n("KOrganizer/Platform-independent\n") + | 1585 | i18n("KOrganizer/Platform-independent\n") + |
1586 | "(KO/Pi) " + version + " - " + | 1586 | "(KO/Pi) " + version + " - " + |
1587 | 1587 | ||
1588 | #ifdef DESKTOP_VERSION | 1588 | #ifdef DESKTOP_VERSION |
1589 | i18n("Desktop Edition\n") + | 1589 | i18n("Desktop Edition\n") + |
1590 | #else | 1590 | #else |
1591 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1591 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1592 | #endif | 1592 | #endif |
1593 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1593 | i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1594 | } | 1594 | } |
1595 | void MainWindow::keyBindings() | 1595 | void MainWindow::keyBindings() |
1596 | { | 1596 | { |
1597 | QString cap = i18n("KO/Pi Keys + Colors"); | 1597 | QString cap = i18n("KO/Pi Keys + Colors"); |
1598 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1598 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1599 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1599 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1600 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1600 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1601 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1601 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1602 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1602 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1603 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1603 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1604 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1604 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1605 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1605 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1606 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1606 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1607 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1607 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1608 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1608 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1609 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1609 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1610 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1610 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1611 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1611 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1612 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1612 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1613 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1613 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1614 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1614 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1615 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1615 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1616 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1616 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1617 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1617 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1618 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1618 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1619 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1619 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1620 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1620 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1621 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1621 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1622 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1622 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1623 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1623 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1624 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1624 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1625 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1625 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1626 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1626 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1627 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1627 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1628 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1628 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1629 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1629 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1630 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1630 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1631 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1631 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1632 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1632 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1633 | i18n("<p><h3>In list view:</h3></p>\n") + | 1633 | i18n("<p><h3>In list view:</h3></p>\n") + |
1634 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1634 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1635 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1635 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1636 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1636 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1637 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1637 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1638 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1638 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1639 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1639 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1640 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1640 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1641 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1641 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1642 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1642 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1643 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1643 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1644 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1644 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1645 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1645 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1646 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1646 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1647 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1647 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1648 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1648 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1649 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1649 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1650 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1650 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1651 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1651 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1652 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1652 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1653 | displayText( text, cap); | 1653 | displayText( text, cap); |
1654 | } | 1654 | } |
1655 | void MainWindow::aboutAutoSaving() | 1655 | void MainWindow::aboutAutoSaving() |
1656 | { | 1656 | { |
1657 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) 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"); | 1657 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) 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"); |
1658 | 1658 | ||
1659 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1659 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1660 | 1660 | ||
1661 | } | 1661 | } |
1662 | void MainWindow::aboutKnownBugs() | 1662 | void MainWindow::aboutKnownBugs() |
1663 | { | 1663 | { |
1664 | QMessageBox* msg; | 1664 | QMessageBox* msg; |
1665 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1665 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1666 | 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")+ | 1666 | 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")+ |
1667 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1667 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1668 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1668 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1669 | i18n("\nor report them in the bugtracker on\n") + | 1669 | i18n("\nor report them in the bugtracker on\n") + |
1670 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1670 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1671 | QMessageBox::NoIcon, | 1671 | QMessageBox::NoIcon, |
1672 | QMessageBox::Ok, | 1672 | QMessageBox::Ok, |
1673 | QMessageBox::NoButton, | 1673 | QMessageBox::NoButton, |
1674 | QMessageBox::NoButton); | 1674 | QMessageBox::NoButton); |
1675 | msg->exec(); | 1675 | msg->exec(); |
1676 | delete msg; | 1676 | delete msg; |
1677 | 1677 | ||
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | QString MainWindow::defaultFileName() | 1680 | QString MainWindow::defaultFileName() |
1681 | { | 1681 | { |
1682 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1682 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1683 | } | 1683 | } |
1684 | QString MainWindow::syncFileName() | 1684 | QString MainWindow::syncFileName() |
1685 | { | 1685 | { |
1686 | #ifdef DESKTOP_VERSION | 1686 | #ifdef DESKTOP_VERSION |
1687 | return locateLocal( "tmp", "synccalendar.ics" ); | 1687 | return locateLocal( "tmp", "synccalendar.ics" ); |
1688 | #else | 1688 | #else |
1689 | return QString( "/tmp/synccalendar.ics" ); | 1689 | return QString( "/tmp/synccalendar.ics" ); |
1690 | #endif | 1690 | #endif |
1691 | } | 1691 | } |
1692 | #include "koglobals.h" | 1692 | #include "koglobals.h" |
1693 | #include <kcalendarsystem.h> | 1693 | #include <kcalendarsystem.h> |
1694 | void MainWindow::updateWeek(QDate seda) | 1694 | void MainWindow::updateWeek(QDate seda) |
1695 | { | 1695 | { |
1696 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1696 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1697 | mWeekPixmap.fill( mWeekBgColor ); | 1697 | mWeekPixmap.fill( mWeekBgColor ); |
1698 | QPainter p ( &mWeekPixmap ); | 1698 | QPainter p ( &mWeekPixmap ); |
1699 | p.setFont( mWeekFont ); | 1699 | p.setFont( mWeekFont ); |
1700 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1700 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1701 | p.end(); | 1701 | p.end(); |
1702 | QIconSet icon3 ( mWeekPixmap ); | 1702 | QIconSet icon3 ( mWeekPixmap ); |
1703 | mWeekAction->setIconSet ( icon3 ); | 1703 | mWeekAction->setIconSet ( icon3 ); |
1704 | 1704 | ||
1705 | } | 1705 | } |
1706 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1706 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1707 | { | 1707 | { |
1708 | updateWeek( selectedDates.first() ); | 1708 | updateWeek( selectedDates.first() ); |
1709 | } | 1709 | } |
1710 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1710 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1711 | { | 1711 | { |
1712 | if ( !incidence ) { | 1712 | if ( !incidence ) { |
1713 | mShowAction->setMenuText( i18n("Show") ); | 1713 | mShowAction->setMenuText( i18n("Show") ); |
1714 | enableIncidenceActions( false ); | 1714 | enableIncidenceActions( false ); |
1715 | mNewSubTodoAction->setEnabled( false ); | 1715 | mNewSubTodoAction->setEnabled( false ); |
1716 | setCaptionToDates(); | 1716 | setCaptionToDates(); |
1717 | return; | 1717 | return; |
1718 | } | 1718 | } |
1719 | QString startString = ""; | 1719 | QString startString = ""; |
1720 | if ( incidence->typeID() != todoID ) { | 1720 | if ( incidence->typeID() != todoID ) { |
1721 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1721 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1722 | if ( incidence->doesFloat() ) { | 1722 | if ( incidence->doesFloat() ) { |
1723 | startString += ": "+incidence->dtStartDateStr( true ); | 1723 | startString += ": "+incidence->dtStartDateStr( true ); |
1724 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1724 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1725 | } else { | 1725 | } else { |
1726 | startString = ": "+incidence->dtStartStr(true); | 1726 | startString = ": "+incidence->dtStartStr(true); |
1727 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1727 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1728 | } | 1728 | } |
1729 | } else { | 1729 | } else { |
1730 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1730 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1731 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1731 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1732 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1732 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1733 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1733 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1734 | bool ok; | 1734 | bool ok; |
1735 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1735 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1736 | if ( ok ) { | 1736 | if ( ok ) { |
1737 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1737 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1738 | startString += i18n(" (%1 y.)"). arg( years ); | 1738 | startString += i18n(" (%1 y.)"). arg( years ); |
1739 | } | 1739 | } |
1740 | } | 1740 | } |
1741 | else | 1741 | else |
1742 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1742 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1743 | } | 1743 | } |
1744 | } | 1744 | } |
1745 | else { | 1745 | else { |
1746 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1746 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1747 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1747 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1748 | else | 1748 | else |
1749 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1749 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1750 | } | 1750 | } |
1751 | if ( !incidence->location().isEmpty() ) | 1751 | if ( !incidence->location().isEmpty() ) |
1752 | startString += " (" +incidence->location()+")"; | 1752 | startString += " (" +incidence->location()+")"; |
1753 | setCaption( incidence->summary()+startString); | 1753 | setCaption( incidence->summary()+startString); |
1754 | enableIncidenceActions( true ); | 1754 | enableIncidenceActions( true ); |
1755 | if ( incidence->typeID() == eventID ) { | 1755 | if ( incidence->typeID() == eventID ) { |
1756 | mShowAction->setMenuText( i18n("Show Event") ); | 1756 | mShowAction->setMenuText( i18n("Show Event") ); |
1757 | mNewSubTodoAction->setEnabled( false ); | 1757 | mNewSubTodoAction->setEnabled( false ); |
1758 | } else if ( incidence->typeID() == todoID ) { | 1758 | } else if ( incidence->typeID() == todoID ) { |
1759 | mShowAction->setMenuText( i18n("Show Todo") ); | 1759 | mShowAction->setMenuText( i18n("Show Todo") ); |
1760 | mNewSubTodoAction->setEnabled( true ); | 1760 | mNewSubTodoAction->setEnabled( true ); |
1761 | } else { | 1761 | } else { |
1762 | mShowAction->setMenuText( i18n("Show") ); | 1762 | mShowAction->setMenuText( i18n("Show") ); |
1763 | mNewSubTodoAction->setEnabled( false ); | 1763 | mNewSubTodoAction->setEnabled( false ); |
1764 | } | 1764 | } |
1765 | static QPixmap jP = SmallIcon( "journal" ); | 1765 | static QPixmap jP = SmallIcon( "journal" ); |
1766 | static QPixmap eP = SmallIcon( "newevent" ); | 1766 | static QPixmap eP = SmallIcon( "newevent" ); |
1767 | static QPixmap tP = SmallIcon( "newtodo" ); | 1767 | static QPixmap tP = SmallIcon( "newtodo" ); |
1768 | #ifdef DESKTOP_VERSION | 1768 | #ifdef DESKTOP_VERSION |
1769 | QIconSet icon; | 1769 | QIconSet icon; |
1770 | if ( incidence->typeID() == todoID ) | 1770 | if ( incidence->typeID() == todoID ) |
1771 | icon = QIconSet ( tP ); | 1771 | icon = QIconSet ( tP ); |
1772 | else if ( incidence->typeID() == eventID ) | 1772 | else if ( incidence->typeID() == eventID ) |
1773 | icon = QIconSet ( eP ); | 1773 | icon = QIconSet ( eP ); |
1774 | else if ( incidence->typeID() == journalID ) | 1774 | else if ( incidence->typeID() == journalID ) |
1775 | icon = QIconSet ( jP ); | 1775 | icon = QIconSet ( jP ); |
1776 | mPrintSelAction->setIconSet ( icon ); | 1776 | mPrintSelAction->setIconSet ( icon ); |
1777 | #endif | 1777 | #endif |
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | void MainWindow::enableIncidenceActions( bool enabled ) | 1780 | void MainWindow::enableIncidenceActions( bool enabled ) |
1781 | { | 1781 | { |
1782 | mShowAction->setEnabled( enabled ); | 1782 | mShowAction->setEnabled( enabled ); |
1783 | mEditAction->setEnabled( enabled ); | 1783 | mEditAction->setEnabled( enabled ); |
1784 | mDeleteAction->setEnabled( enabled ); | 1784 | mDeleteAction->setEnabled( enabled ); |
1785 | 1785 | ||
1786 | mCloneAction->setEnabled( enabled ); | 1786 | mCloneAction->setEnabled( enabled ); |
1787 | mMoveAction->setEnabled( enabled ); | 1787 | mMoveAction->setEnabled( enabled ); |
1788 | #ifndef DESKTOP_VERSION | 1788 | #ifndef DESKTOP_VERSION |
1789 | mBeamAction->setEnabled( enabled ); | 1789 | mBeamAction->setEnabled( enabled ); |
1790 | #else | 1790 | #else |
1791 | mPrintSelAction->setEnabled( enabled ); | 1791 | mPrintSelAction->setEnabled( enabled ); |
1792 | #endif | 1792 | #endif |
1793 | mCancelAction->setEnabled( enabled ); | 1793 | mCancelAction->setEnabled( enabled ); |
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | void MainWindow::importOL() | 1796 | void MainWindow::importOL() |
1797 | { | 1797 | { |
1798 | #ifdef _OL_IMPORT_ | 1798 | #ifdef _OL_IMPORT_ |
1799 | mView->clearAllViews(); | 1799 | mView->clearAllViews(); |
1800 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1800 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1801 | id->exec(); | 1801 | id->exec(); |
1802 | delete id; | 1802 | delete id; |
1803 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1803 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1804 | mView->updateView(); | 1804 | mView->updateView(); |
1805 | #endif | 1805 | #endif |
1806 | } | 1806 | } |
1807 | void MainWindow::importBday() | 1807 | void MainWindow::importBday() |
1808 | { | 1808 | { |
1809 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1809 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1810 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1810 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1811 | i18n("Import!"), i18n("Cancel"), 0, | 1811 | i18n("Import!"), i18n("Cancel"), 0, |
1812 | 0, 1 ); | 1812 | 0, 1 ); |
1813 | if ( result == 0 ) { | 1813 | if ( result == 0 ) { |
1814 | mView->importBday(); | 1814 | mView->importBday(); |
1815 | 1815 | ||
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | 1818 | ||
1819 | } | 1819 | } |
1820 | void MainWindow::importQtopia() | 1820 | void MainWindow::importQtopia() |
1821 | { | 1821 | { |
1822 | //#ifndef DESKTOP_VERSION | 1822 | //#ifndef DESKTOP_VERSION |
1823 | QString mess = 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"); | 1823 | QString mess = 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"); |
1824 | #ifdef DESKTOP_VERSION | 1824 | #ifdef DESKTOP_VERSION |
1825 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1825 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1826 | #endif | 1826 | #endif |
1827 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1827 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1828 | i18n("Import!"), i18n("Cancel"), 0, | 1828 | i18n("Import!"), i18n("Cancel"), 0, |
1829 | 0, 1 ); | 1829 | 0, 1 ); |
1830 | if ( result == 0 ) { | 1830 | if ( result == 0 ) { |
1831 | #ifndef DESKTOP_VERSION | 1831 | #ifndef DESKTOP_VERSION |
1832 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1832 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1833 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1833 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1834 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1834 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1835 | #else | 1835 | #else |
1836 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1836 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1837 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1837 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1838 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1838 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1839 | #endif | 1839 | #endif |
1840 | mView->importQtopia( categories, datebook, todolist ); | 1840 | mView->importQtopia( categories, datebook, todolist ); |
1841 | } | 1841 | } |
1842 | mView->calendar()->reInitAlarmSettings(); | 1842 | mView->calendar()->reInitAlarmSettings(); |
1843 | #if 0 | 1843 | #if 0 |
1844 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1844 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1845 | i18n("Not supported \non desktop!\n"), | 1845 | i18n("Not supported \non desktop!\n"), |
1846 | i18n("Ok"), i18n("Cancel"), 0, | 1846 | i18n("Ok"), i18n("Cancel"), 0, |
1847 | 0, 1 ); | 1847 | 0, 1 ); |
1848 | 1848 | ||
1849 | #endif | 1849 | #endif |
1850 | } | 1850 | } |
1851 | 1851 | ||
1852 | void MainWindow::saveOnClose() | 1852 | void MainWindow::saveOnClose() |
1853 | { | 1853 | { |
1854 | KOPrefs *p = KOPrefs::instance(); | 1854 | KOPrefs *p = KOPrefs::instance(); |
1855 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1855 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1856 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1856 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1857 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1857 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1858 | if ( filterToolBar ) { | 1858 | if ( filterToolBar ) { |
1859 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1859 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1860 | } | 1860 | } |
1861 | #ifdef DESKTOP_VERSION | 1861 | #ifdef DESKTOP_VERSION |
1862 | 1862 | ||
1863 | QPoint myP; | 1863 | QPoint myP; |
1864 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1864 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1865 | if ( p->mToolBarHor ) | 1865 | if ( p->mToolBarHor ) |
1866 | p->mToolBarUp = myP.y() > height()/2; | 1866 | p->mToolBarUp = myP.y() > height()/2; |
1867 | else | 1867 | else |
1868 | p->mToolBarUp = myP.x() > width()/2; | 1868 | p->mToolBarUp = myP.x() > width()/2; |
1869 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1869 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1870 | if ( p->mToolBarHorV ) | 1870 | if ( p->mToolBarHorV ) |
1871 | p->mToolBarUpV = myP.y() > height()/2; | 1871 | p->mToolBarUpV = myP.y() > height()/2; |
1872 | else | 1872 | else |
1873 | p->mToolBarUpV = myP.x() > width()/2 ; | 1873 | p->mToolBarUpV = myP.x() > width()/2 ; |
1874 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1874 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1875 | if ( p->mToolBarHorN ) | 1875 | if ( p->mToolBarHorN ) |
1876 | p->mToolBarUpN = myP.y() > height()/2; | 1876 | p->mToolBarUpN = myP.y() > height()/2; |
1877 | else | 1877 | else |
1878 | p->mToolBarUpN = myP.x() > width()/2 ; | 1878 | p->mToolBarUpN = myP.x() > width()/2 ; |
1879 | if ( filterToolBar ) { | 1879 | if ( filterToolBar ) { |
1880 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1880 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1881 | if ( p->mToolBarHorF ) | 1881 | if ( p->mToolBarHorF ) |
1882 | p->mToolBarUpF = myP.y() > height()/2; | 1882 | p->mToolBarUpF = myP.y() > height()/2; |
1883 | else | 1883 | else |
1884 | p->mToolBarUpF = myP.x() > width()/2 ; | 1884 | p->mToolBarUpF = myP.x() > width()/2 ; |
1885 | } | 1885 | } |
1886 | #else | 1886 | #else |
1887 | if ( p->mToolBarHor ) | 1887 | if ( p->mToolBarHor ) |
1888 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1888 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1889 | else | 1889 | else |
1890 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1890 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1891 | if ( p->mToolBarHorV ) | 1891 | if ( p->mToolBarHorV ) |
1892 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1892 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1893 | else | 1893 | else |
1894 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1894 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1895 | 1895 | ||
1896 | if ( p->mToolBarHorN ) | 1896 | if ( p->mToolBarHorN ) |
1897 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1897 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1898 | else | 1898 | else |
1899 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1899 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1900 | if ( filterToolBar ) { | 1900 | if ( filterToolBar ) { |
1901 | if ( p->mToolBarHorF ) | 1901 | if ( p->mToolBarHorF ) |
1902 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1902 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1903 | else | 1903 | else |
1904 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1904 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1905 | } | 1905 | } |
1906 | #endif | 1906 | #endif |
1907 | save(); | 1907 | save(); |
1908 | mView->writeSettings(); | 1908 | mView->writeSettings(); |
1909 | mView->checkSuspendAlarm(); | 1909 | mView->checkSuspendAlarm(); |
1910 | } | 1910 | } |
1911 | void MainWindow::slotModifiedChanged( bool ) | 1911 | void MainWindow::slotModifiedChanged( bool ) |
1912 | { | 1912 | { |
1913 | if ( mBlockAtStartup ) | 1913 | if ( mBlockAtStartup ) |
1914 | return; | 1914 | return; |
1915 | 1915 | ||
1916 | int msec; | 1916 | int msec; |
1917 | if ( mCalendarModifiedFlag ) { | ||
1918 | //qDebug(" MainWindow timer is running "); | ||
1919 | return; | ||
1920 | } | ||
1917 | // we store the changes after 1 minute, | 1921 | // we store the changes after 1 minute, |
1918 | // and for safety reasons after 10 minutes again | 1922 | // and for safety reasons after 10 minutes again |
1919 | if ( !mSyncManager->blockSave() ) | 1923 | if ( !mSyncManager->blockSave() ) |
1920 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1924 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1921 | else | 1925 | else |
1922 | msec = 1000 * 600; | 1926 | msec = 1000 * 600; |
1923 | mSaveTimer.start( msec, true ); // 1 minute | 1927 | mSaveTimer.start( msec, true ); // 1 minute |
1924 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1928 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1925 | mCalendarModifiedFlag = true; | 1929 | mCalendarModifiedFlag = true; |
1926 | } | 1930 | } |
1927 | void MainWindow::saveStopTimer() | 1931 | void MainWindow::saveStopTimer() |
1928 | { | 1932 | { |
1929 | mSaveTimer.stop(); | 1933 | mSaveTimer.stop(); |
1930 | } | 1934 | } |
1931 | void MainWindow::backupAllFiles() | 1935 | void MainWindow::backupAllFiles() |
1932 | { | 1936 | { |
1933 | QDate reference ( 2000,1,1); | 1937 | QDate reference ( 2000,1,1); |
1934 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1938 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1935 | setCaption(i18n("Creating backup ... please wait ..." )); | 1939 | setCaption(i18n("Creating backup ... please wait ..." )); |
1936 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1940 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1937 | // we need the file path, the backup dir and the number of bups as param | 1941 | // we need the file path, the backup dir and the number of bups as param |
1938 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1942 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1939 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1943 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1940 | bupDir = KGlobalSettings::backupDataDir(); | 1944 | bupDir = KGlobalSettings::backupDataDir(); |
1941 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1945 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1942 | if ( retval == 0 ) { | 1946 | if ( retval == 0 ) { |
1943 | setCaption(i18n("Backup cancelled" )); | 1947 | setCaption(i18n("Backup cancelled" )); |
1944 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1948 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1945 | // retval == 0 : backup skipped for today, try again tomorrow | 1949 | // retval == 0 : backup skipped for today, try again tomorrow |
1946 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1950 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1947 | } else if ( retval == 1 ){ | 1951 | } else if ( retval == 1 ){ |
1948 | qDebug("KO: Backup created."); | 1952 | qDebug("KO: Backup created."); |
1949 | // backup ok | 1953 | // backup ok |
1950 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1954 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1951 | KopiCalendarFile * cal = calendars.first(); | 1955 | KopiCalendarFile * cal = calendars.first(); |
1952 | cal = calendars.next(); | 1956 | cal = calendars.next(); |
1953 | while ( cal ) { | 1957 | while ( cal ) { |
1954 | if ( !cal->mErrorOnLoad ) { | 1958 | if ( !cal->mErrorOnLoad ) { |
1955 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1959 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1956 | } | 1960 | } |
1957 | cal = calendars.next(); | 1961 | cal = calendars.next(); |
1958 | } | 1962 | } |
1959 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1963 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1960 | setCaption(i18n("Backup succesfully finished" )); | 1964 | setCaption(i18n("Backup succesfully finished" )); |
1961 | } else if ( retval == 2 ){ | 1965 | } else if ( retval == 2 ){ |
1962 | setCaption(i18n("Backup globally disabled" )); | 1966 | setCaption(i18n("Backup globally disabled" )); |
1963 | qDebug("KO: Backup globally cancelled."); | 1967 | qDebug("KO: Backup globally cancelled."); |
1964 | // backup globally cancelled | 1968 | // backup globally cancelled |
1965 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1969 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1966 | } | 1970 | } |
1967 | // retval == 3: do nothing, try again later | 1971 | // retval == 3: do nothing, try again later |
1968 | } | 1972 | } |
1969 | void MainWindow::save() | 1973 | void MainWindow::save() |
1970 | { | 1974 | { |
1971 | 1975 | ||
1972 | if ( mView->viewManager()->journalView() ) | 1976 | if ( mView->viewManager()->journalView() ) |
1973 | mView->viewManager()->journalView()->checkModified(); | 1977 | mView->viewManager()->journalView()->checkModified(); |
1974 | if ( !mCalendarModifiedFlag ) { | 1978 | if ( !mCalendarModifiedFlag ) { |
1975 | qDebug("KO: Calendar not modified. Nothing saved."); | 1979 | qDebug("KO: Calendar not modified. Nothing saved."); |
1976 | return; | 1980 | return; |
1977 | } | 1981 | } |
1978 | if ( mSyncManager->blockSave() ) | 1982 | if ( mSyncManager->blockSave() ) { |
1979 | return; | 1983 | return; |
1984 | } | ||
1980 | mSyncManager->setBlockSave(true); | 1985 | mSyncManager->setBlockSave(true); |
1981 | if ( mView->checkAllFileVersions() ) { | 1986 | if ( mView->checkAllFileVersions() ) { |
1982 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1987 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1983 | QDate reference ( 2000,1,1); | 1988 | QDate reference ( 2000,1,1); |
1984 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1989 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1985 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1990 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1986 | backupAllFiles(); | 1991 | backupAllFiles(); |
1987 | } | 1992 | } |
1988 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1993 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1989 | } | 1994 | } |
1990 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1995 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1991 | if ( !isMinimized () ) | 1996 | if ( !isMinimized () ) |
1992 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1997 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1993 | qDebug("KO: Start saving data to file!"); | 1998 | qDebug("KO: Start saving data to file!"); |
1994 | mView->saveCalendars(); | 1999 | mView->saveCalendars(); |
1995 | mCalendarModifiedFlag = false; | 2000 | mCalendarModifiedFlag = false; |
1996 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 2001 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1997 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 2002 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1998 | QString savemes; | 2003 | QString savemes; |
1999 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 2004 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
2000 | if ( !isMinimized () ) | 2005 | if ( !isMinimized () ) |
2001 | setCaption(savemes); | 2006 | setCaption(savemes); |
2002 | else | 2007 | else |
2003 | qDebug(savemes); | 2008 | qDebug(savemes); |
2004 | } else | 2009 | } else { |
2005 | setCaption(i18n("Saving cancelled!")); | 2010 | setCaption(i18n("Saving cancelled!")); |
2011 | mCalendarModifiedFlag = false; | ||
2012 | slotModifiedChanged( true ); | ||
2013 | } | ||
2006 | mSyncManager->setBlockSave( false ); | 2014 | mSyncManager->setBlockSave( false ); |
2007 | } | 2015 | } |
2008 | 2016 | ||
2009 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 2017 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
2010 | { | 2018 | { |
2011 | if ( !e->isAutoRepeat() ) { | 2019 | if ( !e->isAutoRepeat() ) { |
2012 | mFlagKeyPressed = false; | 2020 | mFlagKeyPressed = false; |
2013 | } | 2021 | } |
2014 | } | 2022 | } |
2015 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 2023 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
2016 | { | 2024 | { |
2017 | qApp->processEvents(); | 2025 | qApp->processEvents(); |
2018 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2026 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2019 | e->ignore(); | 2027 | e->ignore(); |
2020 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 2028 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2021 | return; | 2029 | return; |
2022 | } | 2030 | } |
2023 | if (! e->isAutoRepeat() ) | 2031 | if (! e->isAutoRepeat() ) |
2024 | mFlagKeyPressed = true; | 2032 | mFlagKeyPressed = true; |
2025 | KOPrefs *p = KOPrefs::instance(); | 2033 | KOPrefs *p = KOPrefs::instance(); |
2026 | bool showSelectedDates = false; | 2034 | bool showSelectedDates = false; |
2027 | int size; | 2035 | int size; |
2028 | int pro = 0; | 2036 | int pro = 0; |
2029 | //qDebug("MainWindow::keyPressEvent "); | 2037 | //qDebug("MainWindow::keyPressEvent "); |
2030 | switch ( e->key() ) { | 2038 | switch ( e->key() ) { |
2031 | case Qt::Key_Right: | 2039 | case Qt::Key_Right: |
2032 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2040 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2033 | mView->goNextMonth(); | 2041 | mView->goNextMonth(); |
2034 | else | 2042 | else |
2035 | mView->goNext(); | 2043 | mView->goNext(); |
2036 | showSelectedDates = true; | 2044 | showSelectedDates = true; |
2037 | break; | 2045 | break; |
2038 | case Qt::Key_Left: | 2046 | case Qt::Key_Left: |
2039 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2047 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2040 | mView->goPreviousMonth(); | 2048 | mView->goPreviousMonth(); |
2041 | else | 2049 | else |
2042 | mView->goPrevious(); | 2050 | mView->goPrevious(); |
2043 | showSelectedDates = true; | 2051 | showSelectedDates = true; |
2044 | break; | 2052 | break; |
2045 | case Qt::Key_Down: | 2053 | case Qt::Key_Down: |
2046 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2054 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2047 | break; | 2055 | break; |
2048 | case Qt::Key_Up: | 2056 | case Qt::Key_Up: |
2049 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2057 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2050 | break; | 2058 | break; |
2051 | case Qt::Key_K: | 2059 | case Qt::Key_K: |
2052 | mView->viewManager()->showMonthViewWeek(); | 2060 | mView->viewManager()->showMonthViewWeek(); |
2053 | break; | 2061 | break; |
2054 | case Qt::Key_I: | 2062 | case Qt::Key_I: |
2055 | mView->showIncidence(); | 2063 | mView->showIncidence(); |
2056 | break; | 2064 | break; |
2057 | case Qt::Key_Delete: | 2065 | case Qt::Key_Delete: |
2058 | case Qt::Key_Backspace: | 2066 | case Qt::Key_Backspace: |
2059 | mView->deleteIncidence(); | 2067 | mView->deleteIncidence(); |
2060 | break; | 2068 | break; |
2061 | case Qt::Key_D: | 2069 | case Qt::Key_D: |
2062 | mView->viewManager()->showDayView(); | 2070 | mView->viewManager()->showDayView(); |
2063 | showSelectedDates = true; | 2071 | showSelectedDates = true; |
2064 | break; | 2072 | break; |
2065 | case Qt::Key_O: | 2073 | case Qt::Key_O: |
2066 | mView->toggleFilerEnabled( ); | 2074 | mView->toggleFilerEnabled( ); |
2067 | break; | 2075 | break; |
2068 | case Qt::Key_0: | 2076 | case Qt::Key_0: |
2069 | case Qt::Key_1: | 2077 | case Qt::Key_1: |
2070 | case Qt::Key_2: | 2078 | case Qt::Key_2: |
2071 | case Qt::Key_3: | 2079 | case Qt::Key_3: |
2072 | case Qt::Key_4: | 2080 | case Qt::Key_4: |
2073 | case Qt::Key_5: | 2081 | case Qt::Key_5: |
2074 | case Qt::Key_6: | 2082 | case Qt::Key_6: |
2075 | case Qt::Key_7: | 2083 | case Qt::Key_7: |
2076 | case Qt::Key_8: | 2084 | case Qt::Key_8: |
2077 | case Qt::Key_9: | 2085 | case Qt::Key_9: |
2078 | pro = e->key()-48; | 2086 | pro = e->key()-48; |
2079 | if ( pro == 0 ) | 2087 | if ( pro == 0 ) |
2080 | pro = 10; | 2088 | pro = 10; |
2081 | if ( e->state() == Qt::ControlButton) | 2089 | if ( e->state() == Qt::ControlButton) |
2082 | pro += 10; | 2090 | pro += 10; |
2083 | break; | 2091 | break; |
2084 | case Qt::Key_M: | 2092 | case Qt::Key_M: |
2085 | mView->viewManager()->showMonthView(); | 2093 | mView->viewManager()->showMonthView(); |
2086 | showSelectedDates = true; | 2094 | showSelectedDates = true; |
2087 | break; | 2095 | break; |
2088 | case Qt::Key_Insert: | 2096 | case Qt::Key_Insert: |
2089 | mView->newEvent(); | 2097 | mView->newEvent(); |
2090 | break; | 2098 | break; |
2091 | case Qt::Key_S : | 2099 | case Qt::Key_S : |
2092 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2100 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2093 | mView->newSubTodo(); | 2101 | mView->newSubTodo(); |
2094 | else | 2102 | else |
2095 | mView->dialogManager()->showSearchDialog(); | 2103 | mView->dialogManager()->showSearchDialog(); |
2096 | break; | 2104 | break; |
2097 | case Qt::Key_Y : | 2105 | case Qt::Key_Y : |
2098 | case Qt::Key_Z : | 2106 | case Qt::Key_Z : |
2099 | mView->viewManager()->showWorkWeekView(); | 2107 | mView->viewManager()->showWorkWeekView(); |
2100 | showSelectedDates = true; | 2108 | showSelectedDates = true; |
2101 | break; | 2109 | break; |
2102 | case Qt::Key_U : | 2110 | case Qt::Key_U : |
2103 | mView->viewManager()->showWeekView(); | 2111 | mView->viewManager()->showWeekView(); |
2104 | showSelectedDates = true; | 2112 | showSelectedDates = true; |
2105 | break; | 2113 | break; |
2106 | case Qt::Key_H : | 2114 | case Qt::Key_H : |
2107 | keyBindings(); | 2115 | keyBindings(); |
2108 | break; | 2116 | break; |
2109 | case Qt::Key_W: | 2117 | case Qt::Key_W: |
2110 | mView->viewManager()->showWhatsNextView(); | 2118 | mView->viewManager()->showWhatsNextView(); |
2111 | break; | 2119 | break; |
2112 | case Qt::Key_L: | 2120 | case Qt::Key_L: |
2113 | mView->viewManager()->showListView(); | 2121 | mView->viewManager()->showListView(); |
2114 | break; | 2122 | break; |
2115 | case Qt::Key_N: | 2123 | case Qt::Key_N: |
2116 | mView->viewManager()->showNextView(); | 2124 | mView->viewManager()->showNextView(); |
2117 | break; | 2125 | break; |
2118 | case Qt::Key_V: | 2126 | case Qt::Key_V: |
2119 | mView->viewManager()->showTodoView(); | 2127 | mView->viewManager()->showTodoView(); |
2120 | break; | 2128 | break; |
2121 | case Qt::Key_C: | 2129 | case Qt::Key_C: |
2122 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2130 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2123 | break; | 2131 | break; |
2124 | case Qt::Key_P: | 2132 | case Qt::Key_P: |
2125 | mView->showDatePicker( ); | 2133 | mView->showDatePicker( ); |
2126 | break; | 2134 | break; |
2127 | case Qt::Key_F: | 2135 | case Qt::Key_F: |
2128 | mView->editFilters(); | 2136 | mView->editFilters(); |
2129 | break; | 2137 | break; |
2130 | case Qt::Key_R: | 2138 | case Qt::Key_R: |
2131 | mView->toggleFilter(); | 2139 | mView->toggleFilter(); |
2132 | break; | 2140 | break; |
2133 | case Qt::Key_X: | 2141 | case Qt::Key_X: |
2134 | if ( e->state() == Qt::ControlButton ) | 2142 | if ( e->state() == Qt::ControlButton ) |
2135 | mView->toggleDateNavigatorWidget(); | 2143 | mView->toggleDateNavigatorWidget(); |
2136 | else { | 2144 | else { |
2137 | mView->viewManager()->showNextXView(); | 2145 | mView->viewManager()->showNextXView(); |
2138 | showSelectedDates = true; | 2146 | showSelectedDates = true; |
2139 | } | 2147 | } |
2140 | break; | 2148 | break; |
2141 | case Qt::Key_Space: | 2149 | case Qt::Key_Space: |
2142 | mView->toggleExpand(); | 2150 | mView->toggleExpand(); |
2143 | break; | 2151 | break; |
2144 | case Qt::Key_A: | 2152 | case Qt::Key_A: |
2145 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2153 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2146 | mView->showNextAlarms(); | 2154 | mView->showNextAlarms(); |
2147 | else | 2155 | else |
2148 | mView->toggleAllDaySize(); | 2156 | mView->toggleAllDaySize(); |
2149 | break; | 2157 | break; |
2150 | case Qt::Key_T: | 2158 | case Qt::Key_T: |
2151 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2159 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2152 | mView->newTodo(); | 2160 | mView->newTodo(); |
2153 | else { | 2161 | else { |
2154 | mView->goToday(); | 2162 | mView->goToday(); |
2155 | showSelectedDates = true; | 2163 | showSelectedDates = true; |
2156 | } | 2164 | } |
2157 | break; | 2165 | break; |
2158 | case Qt::Key_Q: | 2166 | case Qt::Key_Q: |
2159 | if ( e->state() == Qt::ControlButton ) | 2167 | if ( e->state() == Qt::ControlButton ) |
2160 | mView->conflictNotAll(); | 2168 | mView->conflictNotAll(); |
2161 | else if ( e->state() == Qt::ShiftButton ) | 2169 | else if ( e->state() == Qt::ShiftButton ) |
2162 | mView->conflictAllday(); | 2170 | mView->conflictAllday(); |
2163 | else | 2171 | else |
2164 | mView->conflictAll(); | 2172 | mView->conflictAll(); |
2165 | break; | 2173 | break; |
2166 | case Qt::Key_J: | 2174 | case Qt::Key_J: |
2167 | mView->viewManager()->showJournalView(); | 2175 | mView->viewManager()->showJournalView(); |
2168 | break; | 2176 | break; |
2169 | case Qt::Key_B: | 2177 | case Qt::Key_B: |
2170 | mView->editIncidenceDescription();; | 2178 | mView->editIncidenceDescription();; |
2171 | break; | 2179 | break; |
2172 | // case Qt::Key_Return: | 2180 | // case Qt::Key_Return: |
2173 | case Qt::Key_E: | 2181 | case Qt::Key_E: |
2174 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2182 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2175 | mView->newEvent(); | 2183 | mView->newEvent(); |
2176 | else | 2184 | else |
2177 | mView->editIncidence(); | 2185 | mView->editIncidence(); |
2178 | break; | 2186 | break; |
2179 | case Qt::Key_Plus: | 2187 | case Qt::Key_Plus: |
2180 | size = p->mHourSize +2; | 2188 | size = p->mHourSize +2; |
2181 | if ( size <= 22 ) | 2189 | if ( size <= 22 ) |
2182 | configureAgenda( size ); | 2190 | configureAgenda( size ); |
2183 | break; | 2191 | break; |
2184 | case Qt::Key_Minus: | 2192 | case Qt::Key_Minus: |
2185 | size = p->mHourSize - 2; | 2193 | size = p->mHourSize - 2; |
2186 | if ( size >= 4 ) | 2194 | if ( size >= 4 ) |
2187 | configureAgenda( size ); | 2195 | configureAgenda( size ); |
2188 | break; | 2196 | break; |
2189 | 2197 | ||
2190 | 2198 | ||
2191 | default: | 2199 | default: |
2192 | e->ignore(); | 2200 | e->ignore(); |
2193 | } | 2201 | } |
2194 | if ( pro > 0 ) { | 2202 | if ( pro > 0 ) { |
2195 | selectFilter( pro+1 ); | 2203 | selectFilter( pro+1 ); |
2196 | } | 2204 | } |
2197 | if ( showSelectedDates ) { | 2205 | if ( showSelectedDates ) { |
2198 | ;// setCaptionToDates(); | 2206 | ;// setCaptionToDates(); |
2199 | } | 2207 | } |
2200 | 2208 | ||
2201 | } | 2209 | } |
2202 | void MainWindow::fillFilterMenuTB() | 2210 | void MainWindow::fillFilterMenuTB() |
2203 | { | 2211 | { |
2204 | selectFilterMenuTB->clear(); | 2212 | selectFilterMenuTB->clear(); |
2205 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2213 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2206 | selectFilterMenuTB->insertSeparator(); | 2214 | selectFilterMenuTB->insertSeparator(); |
2207 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2215 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2208 | 2216 | ||
2209 | selectFilterMenuTB->insertSeparator(); | 2217 | selectFilterMenuTB->insertSeparator(); |
2210 | QPtrList<CalFilter> fili = mView->filters(); | 2218 | QPtrList<CalFilter> fili = mView->filters(); |
2211 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2219 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2212 | CalFilter *filter = fili.first(); | 2220 | CalFilter *filter = fili.first(); |
2213 | int iii = 2; | 2221 | int iii = 2; |
2214 | bool checkitem = mView->filterView()->filtersEnabled(); | 2222 | bool checkitem = mView->filterView()->filtersEnabled(); |
2215 | while(filter) { | 2223 | while(filter) { |
2216 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2224 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2217 | if ( filter == curfilter) | 2225 | if ( filter == curfilter) |
2218 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2226 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2219 | filter = fili.next(); | 2227 | filter = fili.next(); |
2220 | ++iii; | 2228 | ++iii; |
2221 | } | 2229 | } |
2222 | if ( !checkitem ) | 2230 | if ( !checkitem ) |
2223 | selectFilterMenuTB->setItemChecked( 1, true ); | 2231 | selectFilterMenuTB->setItemChecked( 1, true ); |
2224 | 2232 | ||
2225 | int x = 0; | 2233 | int x = 0; |
2226 | int y = iconToolBar->height(); | 2234 | int y = iconToolBar->height(); |
2227 | int dX = 0; | 2235 | int dX = 0; |
2228 | int dY = 0; | 2236 | int dY = 0; |
2229 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2237 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2230 | if ( iconToolBar->y() > height()/2 ) { | 2238 | if ( iconToolBar->y() > height()/2 ) { |
2231 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2239 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2232 | y = 0; | 2240 | y = 0; |
2233 | } | 2241 | } |
2234 | } else { | 2242 | } else { |
2235 | if ( iconToolBar->x() > width()/2 ) { // right side | 2243 | if ( iconToolBar->x() > width()/2 ) { // right side |
2236 | x=0; | 2244 | x=0; |
2237 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2245 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2238 | y = 0; | 2246 | y = 0; |
2239 | } else { | 2247 | } else { |
2240 | x= iconToolBar->width(); | 2248 | x= iconToolBar->width(); |
2241 | y = 0; | 2249 | y = 0; |
2242 | } | 2250 | } |
2243 | } | 2251 | } |
2244 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2252 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2245 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2253 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2246 | } | 2254 | } |
2247 | void MainWindow::fillFilterMenu() | 2255 | void MainWindow::fillFilterMenu() |
2248 | { | 2256 | { |
2249 | selectFilterMenu->clear(); | 2257 | selectFilterMenu->clear(); |
2250 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2258 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2251 | selectFilterMenu->insertSeparator(); | 2259 | selectFilterMenu->insertSeparator(); |
2252 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2260 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2253 | 2261 | ||
2254 | selectFilterMenu->insertSeparator(); | 2262 | selectFilterMenu->insertSeparator(); |
2255 | QPtrList<CalFilter> fili = mView->filters(); | 2263 | QPtrList<CalFilter> fili = mView->filters(); |
2256 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2264 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2257 | CalFilter *filter = fili.first(); | 2265 | CalFilter *filter = fili.first(); |
2258 | int iii = 2; | 2266 | int iii = 2; |
2259 | bool checkitem = mView->filterView()->filtersEnabled(); | 2267 | bool checkitem = mView->filterView()->filtersEnabled(); |
2260 | while(filter) { | 2268 | while(filter) { |
2261 | selectFilterMenu->insertItem( filter->name(), iii ); | 2269 | selectFilterMenu->insertItem( filter->name(), iii ); |
2262 | if ( filter == curfilter) | 2270 | if ( filter == curfilter) |
2263 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2271 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2264 | filter = fili.next(); | 2272 | filter = fili.next(); |
2265 | ++iii; | 2273 | ++iii; |
2266 | } | 2274 | } |
2267 | if ( !checkitem ) | 2275 | if ( !checkitem ) |
2268 | selectFilterMenu->setItemChecked( 1, true ); | 2276 | selectFilterMenu->setItemChecked( 1, true ); |
2269 | } | 2277 | } |
2270 | void MainWindow::fillFilterMenuPopup() | 2278 | void MainWindow::fillFilterMenuPopup() |
2271 | { | 2279 | { |
2272 | filterPopupMenu->clear(); | 2280 | filterPopupMenu->clear(); |
2273 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2281 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2274 | 2282 | ||
2275 | filterPopupMenu->insertSeparator(); | 2283 | filterPopupMenu->insertSeparator(); |
2276 | QPtrList<CalFilter> fili = mView->filters(); | 2284 | QPtrList<CalFilter> fili = mView->filters(); |
2277 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2285 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2278 | CalFilter *filter = fili.first(); | 2286 | CalFilter *filter = fili.first(); |
2279 | int iii = 1; | 2287 | int iii = 1; |
2280 | bool checkitem = mView->filterView()->filtersEnabled(); | 2288 | bool checkitem = mView->filterView()->filtersEnabled(); |
2281 | while(filter) { | 2289 | while(filter) { |
2282 | filterPopupMenu->insertItem( filter->name(), iii ); | 2290 | filterPopupMenu->insertItem( filter->name(), iii ); |
2283 | if ( filter == curfilter) | 2291 | if ( filter == curfilter) |
2284 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2292 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2285 | filter = fili.next(); | 2293 | filter = fili.next(); |
2286 | ++iii; | 2294 | ++iii; |
2287 | } | 2295 | } |
2288 | if ( !checkitem ) | 2296 | if ( !checkitem ) |
2289 | filterPopupMenu->setItemChecked( 0, true ); | 2297 | filterPopupMenu->setItemChecked( 0, true ); |
2290 | } | 2298 | } |
2291 | void MainWindow::selectFilter( int fil ) | 2299 | void MainWindow::selectFilter( int fil ) |
2292 | { | 2300 | { |
2293 | 2301 | ||
2294 | if ( fil == 0 ) { | 2302 | if ( fil == 0 ) { |
2295 | mView->editFilters( ); | 2303 | mView->editFilters( ); |
2296 | } else if ( fil == 1 ){ | 2304 | } else if ( fil == 1 ){ |
2297 | if ( mView->filterView()->filtersEnabled() ) | 2305 | if ( mView->filterView()->filtersEnabled() ) |
2298 | mView->toggleFilerEnabled( ); | 2306 | mView->toggleFilerEnabled( ); |
2299 | } else { | 2307 | } else { |
2300 | if ( !mView->filterView()->filtersEnabled() ) { | 2308 | if ( !mView->filterView()->filtersEnabled() ) { |
2301 | mView->filterView()->blockSignals( true ); | 2309 | mView->filterView()->blockSignals( true ); |
2302 | mView->toggleFilerEnabled( ); | 2310 | mView->toggleFilerEnabled( ); |
2303 | mView->filterView()->blockSignals( false ); | 2311 | mView->filterView()->blockSignals( false ); |
2304 | } | 2312 | } |
2305 | mView->selectFilter( fil-2 ); | 2313 | mView->selectFilter( fil-2 ); |
2306 | } | 2314 | } |
2307 | } | 2315 | } |
2308 | void MainWindow::updateFilterToolbar() | 2316 | void MainWindow::updateFilterToolbar() |
2309 | { | 2317 | { |
2310 | if ( filterMenubar ) { | 2318 | if ( filterMenubar ) { |
2311 | if ( !mView->filterView()->filtersEnabled() ) { | 2319 | if ( !mView->filterView()->filtersEnabled() ) { |
2312 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2320 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2313 | } else { | 2321 | } else { |
2314 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2322 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2315 | if ( curfilter ) { | 2323 | if ( curfilter ) { |
2316 | filterMenubar->changeItem( 0, curfilter->name() ); | 2324 | filterMenubar->changeItem( 0, curfilter->name() ); |
2317 | } | 2325 | } |
2318 | } | 2326 | } |
2319 | } | 2327 | } |
2320 | } | 2328 | } |
2321 | void MainWindow::selectFilterPopup( int fil ) | 2329 | void MainWindow::selectFilterPopup( int fil ) |
2322 | { | 2330 | { |
2323 | selectFilter( fil + 1 ); | 2331 | selectFilter( fil + 1 ); |
2324 | 2332 | ||
2325 | } | 2333 | } |
2326 | void MainWindow::configureToolBar( int item ) | 2334 | void MainWindow::configureToolBar( int item ) |
2327 | { | 2335 | { |
2328 | 2336 | ||
2329 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2337 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2330 | KOPrefs *p = KOPrefs::instance(); | 2338 | KOPrefs *p = KOPrefs::instance(); |
2331 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2339 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2332 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2340 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2333 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2341 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2334 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2342 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2335 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2343 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2336 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2344 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2337 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2345 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2338 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2346 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2339 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2347 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2340 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2348 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2341 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2349 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2342 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2350 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2343 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2351 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2344 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2352 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2345 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2353 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2346 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2354 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2347 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2355 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2348 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2356 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2349 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2357 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2350 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2358 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2351 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2359 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2352 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2360 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2353 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2361 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2354 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2362 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2355 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2363 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2356 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2364 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2357 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2365 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2358 | // initActions(); | 2366 | // initActions(); |
2359 | setCaption ( i18n("Toolbar changes needs a restart!") ); | 2367 | setCaption ( i18n("Toolbar changes needs a restart!") ); |
2360 | } | 2368 | } |
2361 | void MainWindow::setCaption ( const QString & c ) | 2369 | void MainWindow::setCaption ( const QString & c ) |
2362 | { | 2370 | { |
2363 | QString cap = c; | 2371 | QString cap = c; |
2364 | cap.replace( QRegExp("\n"), " " ); | 2372 | cap.replace( QRegExp("\n"), " " ); |
2365 | cap = cap.stripWhiteSpace(); | 2373 | cap = cap.stripWhiteSpace(); |
2366 | if ( cap.isEmpty() ) | 2374 | if ( cap.isEmpty() ) |
2367 | cap = "KO/Pi"; | 2375 | cap = "KO/Pi"; |
2368 | QWidget::setCaption( cap ); | 2376 | QWidget::setCaption( cap ); |
2369 | } | 2377 | } |
2370 | void MainWindow::setCaptionToDates() | 2378 | void MainWindow::setCaptionToDates() |
2371 | { | 2379 | { |
2372 | QString selDates; | 2380 | QString selDates; |
2373 | QDate date = mView->startDate(); | 2381 | QDate date = mView->startDate(); |
2374 | if ( ! date.isValid() ) { | 2382 | if ( ! date.isValid() ) { |
2375 | setCaption(""); | 2383 | setCaption(""); |
2376 | return; | 2384 | return; |
2377 | } | 2385 | } |
2378 | selDates = KGlobal::locale()->formatDate( date, true); | 2386 | selDates = KGlobal::locale()->formatDate( date, true); |
2379 | if (mView->startDate() < mView->endDate() ) | 2387 | if (mView->startDate() < mView->endDate() ) |
2380 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2388 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2381 | else { | 2389 | else { |
2382 | QString addString; | 2390 | QString addString; |
2383 | if ( date == QDateTime::currentDateTime().date() ) | 2391 | if ( date == QDateTime::currentDateTime().date() ) |
2384 | addString = i18n("Today"); | 2392 | addString = i18n("Today"); |
2385 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2393 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2386 | addString = i18n("Tomorrow"); | 2394 | addString = i18n("Tomorrow"); |
2387 | if ( !addString.isEmpty() ) | 2395 | if ( !addString.isEmpty() ) |
2388 | selDates = addString+", "+selDates ; | 2396 | selDates = addString+", "+selDates ; |
2389 | } | 2397 | } |