-rw-r--r-- | korganizer/calendarview.cpp | 7 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 5 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 5 | ||||
-rw-r--r-- | microkde/kdeui/kbuttonbox.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/kpopupmenu.cpp | 19 | ||||
-rw-r--r-- | microkde/kdeui/kpopupmenu.h | 22 | ||||
-rw-r--r-- | microkde/microkde.pro | 2 | ||||
-rw-r--r-- | microkde/microkdeE.pro | 2 |
10 files changed, 64 insertions, 15 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 5a2482e..17f1659 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,2193 +1,2200 @@ | |||
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 | ||
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 | |||
659 | void CalendarView::slotResetFocus() | ||
660 | { | ||
661 | qDebug(" CalendarView::slotResetFocus() %x", qApp->focusWidget()); | ||
662 | |||
663 | } | ||
664 | |||
658 | void CalendarView::nextConflict( bool all, bool allday ) | 665 | void CalendarView::nextConflict( bool all, bool allday ) |
659 | { | 666 | { |
660 | 667 | ||
661 | QPtrList<Event> testlist = mCalendar->events(); | 668 | QPtrList<Event> testlist = mCalendar->events(); |
662 | Event * test = testlist.first(); | 669 | Event * test = testlist.first(); |
663 | while ( test ) { | 670 | while ( test ) { |
664 | test->setTagged( false ); | 671 | test->setTagged( false ); |
665 | test = testlist.next(); | 672 | test = testlist.next(); |
666 | } | 673 | } |
667 | QTime st ( 0,0,0); | 674 | QTime st ( 0,0,0); |
668 | if ( mViewManager->currentView() == mViewManager->agendaView() ) | 675 | if ( mViewManager->currentView() == mViewManager->agendaView() ) |
669 | st = mViewManager->agendaView()->agenda()->getEndTime(); | 676 | st = mViewManager->agendaView()->agenda()->getEndTime(); |
670 | //qDebug("time %s ", st.toString().latin1()); | 677 | //qDebug("time %s ", st.toString().latin1()); |
671 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); | 678 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); |
672 | QDateTime conflict; | 679 | QDateTime conflict; |
673 | QDateTime retVal; | 680 | QDateTime retVal; |
674 | bool found = false; | 681 | bool found = false; |
675 | Event * cE = 0; | 682 | Event * cE = 0; |
676 | Event * cE2 = 0; | 683 | Event * cE2 = 0; |
677 | QPtrList<Event> testlist2 = testlist; | 684 | QPtrList<Event> testlist2 = testlist; |
678 | test = testlist.first(); | 685 | test = testlist.first(); |
679 | bool skip = false; | 686 | bool skip = false; |
680 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 687 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
681 | while ( test ) { | 688 | while ( test ) { |
682 | qApp->processEvents(); | 689 | qApp->processEvents(); |
683 | skip = false; | 690 | skip = false; |
684 | if ( !all ) skip = ( allday != test->doesFloat() ); | 691 | if ( !all ) skip = ( allday != test->doesFloat() ); |
685 | if ( !skip ) { | 692 | if ( !skip ) { |
686 | Event * test2 = testlist2.first(); | 693 | Event * test2 = testlist2.first(); |
687 | while ( test2 ) { | 694 | while ( test2 ) { |
688 | skip = false; | 695 | skip = false; |
689 | if ( !all ) skip = ( allday != test2->doesFloat() ); | 696 | if ( !all ) skip = ( allday != test2->doesFloat() ); |
690 | if ( !skip ) { | 697 | if ( !skip ) { |
691 | if ( !test2->isTagged() ) { | 698 | if ( !test2->isTagged() ) { |
692 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { | 699 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { |
693 | //qDebug("overlap "); | 700 | //qDebug("overlap "); |
694 | if ( ! found ) { | 701 | if ( ! found ) { |
695 | if ( retVal >= startDT ) { | 702 | if ( retVal >= startDT ) { |
696 | conflict = retVal; | 703 | conflict = retVal; |
697 | cE = test; | 704 | cE = test; |
698 | cE2 = test2; | 705 | cE2 = test2; |
699 | found = true; | 706 | found = true; |
700 | } | 707 | } |
701 | } else { | 708 | } else { |
702 | if ( retVal >= startDT && retVal < conflict ) { | 709 | if ( retVal >= startDT && retVal < conflict ) { |
703 | conflict = retVal; | 710 | conflict = retVal; |
704 | cE = test; | 711 | cE = test; |
705 | cE2 = test2; | 712 | cE2 = test2; |
706 | } | 713 | } |
707 | } | 714 | } |
708 | } | 715 | } |
709 | } | 716 | } |
710 | } | 717 | } |
711 | test2 = testlist2.next(); | 718 | test2 = testlist2.next(); |
712 | } | 719 | } |
713 | } | 720 | } |
714 | test->setTagged( true ); | 721 | test->setTagged( true ); |
715 | test = testlist.next(); | 722 | test = testlist.next(); |
716 | } | 723 | } |
717 | if ( found ) { | 724 | if ( found ) { |
718 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 725 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
719 | mViewManager->showDayView(); | 726 | mViewManager->showDayView(); |
720 | mNavigator->slotDaySelect( conflict.date() ); | 727 | mNavigator->slotDaySelect( conflict.date() ); |
721 | int hour = conflict.time().hour(); | 728 | int hour = conflict.time().hour(); |
722 | mViewManager->agendaView()->setStartHour( hour ); | 729 | mViewManager->agendaView()->setStartHour( hour ); |
723 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); | 730 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
724 | return; | 731 | return; |
725 | } | 732 | } |
726 | 733 | ||
727 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 734 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
728 | qDebug("No conflict found "); | 735 | qDebug("No conflict found "); |
729 | return; | 736 | return; |
730 | } | 737 | } |
731 | 738 | ||
732 | void CalendarView::conflictAll() | 739 | void CalendarView::conflictAll() |
733 | { | 740 | { |
734 | nextConflict ( true, true ); | 741 | nextConflict ( true, true ); |
735 | } | 742 | } |
736 | void CalendarView::conflictAllday() | 743 | void CalendarView::conflictAllday() |
737 | { | 744 | { |
738 | nextConflict ( false, true ); | 745 | nextConflict ( false, true ); |
739 | } | 746 | } |
740 | void CalendarView::conflictNotAll() | 747 | void CalendarView::conflictNotAll() |
741 | { | 748 | { |
742 | nextConflict ( false, false ); | 749 | nextConflict ( false, false ); |
743 | } | 750 | } |
744 | 751 | ||
745 | void CalendarView::setCalReadOnly( int id, bool readO ) | 752 | void CalendarView::setCalReadOnly( int id, bool readO ) |
746 | { | 753 | { |
747 | if ( readO ) { | 754 | if ( readO ) { |
748 | emit save(); | 755 | emit save(); |
749 | } | 756 | } |
750 | mCalendar->setReadOnly( id, readO ); | 757 | mCalendar->setReadOnly( id, readO ); |
751 | } | 758 | } |
752 | void CalendarView::setScrollBarStep(int val ) | 759 | void CalendarView::setScrollBarStep(int val ) |
753 | { | 760 | { |
754 | #ifdef DESKTOP_VERSION | 761 | #ifdef DESKTOP_VERSION |
755 | mDateScrollBar->setLineStep ( val ); | 762 | mDateScrollBar->setLineStep ( val ); |
756 | #endif | 763 | #endif |
757 | } | 764 | } |
758 | void CalendarView::scrollBarValue(int val ) | 765 | void CalendarView::scrollBarValue(int val ) |
759 | { | 766 | { |
760 | #ifdef DESKTOP_VERSION | 767 | #ifdef DESKTOP_VERSION |
761 | if ( QApplication::desktop()->width() < 800 ) return; | 768 | if ( QApplication::desktop()->width() < 800 ) return; |
762 | static bool block = false; | 769 | static bool block = false; |
763 | if ( block ) return; | 770 | if ( block ) return; |
764 | block = true; | 771 | block = true; |
765 | int count = mNavigator->selectedDates().count(); | 772 | int count = mNavigator->selectedDates().count(); |
766 | int day = mNavigator->selectedDates().first().dayOfYear(); | 773 | int day = mNavigator->selectedDates().first().dayOfYear(); |
767 | int stepdays = val; | 774 | int stepdays = val; |
768 | if ( mDateScrollBar->lineStep () <= count ) { | 775 | if ( mDateScrollBar->lineStep () <= count ) { |
769 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 776 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
770 | //qDebug("VAL %d ",val ); | 777 | //qDebug("VAL %d ",val ); |
771 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 778 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
772 | stepdays = day+stepdays; | 779 | stepdays = day+stepdays; |
773 | if ( stepdays < 0 ) stepdays = 0; | 780 | if ( stepdays < 0 ) stepdays = 0; |
774 | } | 781 | } |
775 | if ( stepdays == day ) { | 782 | if ( stepdays == day ) { |
776 | block = false; | 783 | block = false; |
777 | return; | 784 | return; |
778 | } | 785 | } |
779 | int year = mNavigator->selectedDates().first().year(); | 786 | int year = mNavigator->selectedDates().first().year(); |
780 | QDate d ( year,1,1 ); | 787 | QDate d ( year,1,1 ); |
781 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); | 788 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); |
782 | block = false; | 789 | block = false; |
783 | #endif | 790 | #endif |
784 | 791 | ||
785 | } | 792 | } |
786 | void CalendarView::updateView(const QDate &start, const QDate &end) | 793 | void CalendarView::updateView(const QDate &start, const QDate &end) |
787 | { | 794 | { |
788 | #ifdef DESKTOP_VERSION | 795 | #ifdef DESKTOP_VERSION |
789 | if ( ! mDateScrollBar->draggingSlider () ) { | 796 | if ( ! mDateScrollBar->draggingSlider () ) { |
790 | int dof = start.dayOfYear(); | 797 | int dof = start.dayOfYear(); |
791 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); | 798 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); |
792 | if ( dof != mDateScrollBar->value() ) { | 799 | if ( dof != mDateScrollBar->value() ) { |
793 | mDateScrollBar->blockSignals( true ); | 800 | mDateScrollBar->blockSignals( true ); |
794 | mDateScrollBar->setValue( start.dayOfYear()); | 801 | mDateScrollBar->setValue( start.dayOfYear()); |
795 | mDateScrollBar->blockSignals( false ); | 802 | mDateScrollBar->blockSignals( false ); |
796 | } | 803 | } |
797 | } | 804 | } |
798 | #endif | 805 | #endif |
799 | mTodoList->updateView(); | 806 | mTodoList->updateView(); |
800 | mViewManager->updateView(start, end); | 807 | mViewManager->updateView(start, end); |
801 | //mDateNavigator->updateView(); | 808 | //mDateNavigator->updateView(); |
802 | } | 809 | } |
803 | 810 | ||
804 | 811 | ||
805 | 812 | ||
806 | void CalendarView::checkFiles() | 813 | void CalendarView::checkFiles() |
807 | { | 814 | { |
808 | QString message; | 815 | QString message; |
809 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 816 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
810 | KopiCalendarFile * cal = calendars.first(); | 817 | KopiCalendarFile * cal = calendars.first(); |
811 | while ( cal ) { | 818 | while ( cal ) { |
812 | if ( cal->mErrorOnLoad ) { | 819 | if ( cal->mErrorOnLoad ) { |
813 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | 820 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |
814 | } | 821 | } |
815 | cal = calendars.next(); | 822 | cal = calendars.next(); |
816 | } | 823 | } |
817 | if ( !message.isEmpty() ) { | 824 | if ( !message.isEmpty() ) { |
818 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); | 825 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); |
819 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); | 826 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); |
820 | } | 827 | } |
821 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); | 828 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); |
822 | } | 829 | } |
823 | void CalendarView::checkAlarms() | 830 | void CalendarView::checkAlarms() |
824 | { | 831 | { |
825 | 832 | ||
826 | 833 | ||
827 | KConfig *config = KOGlobals::config(); | 834 | KConfig *config = KOGlobals::config(); |
828 | config->setGroup( "AppRun" ); | 835 | config->setGroup( "AppRun" ); |
829 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 836 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
830 | int daysto = dt.daysTo( QDate::currentDate() ); | 837 | int daysto = dt.daysTo( QDate::currentDate() ); |
831 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 838 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
832 | dt = dt.addDays( days ); | 839 | dt = dt.addDays( days ); |
833 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 840 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
834 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 841 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
835 | //qDebug("KO: Reading program stop %d ", secs); | 842 | //qDebug("KO: Reading program stop %d ", secs); |
836 | //secs -= ( 3600 * 24*3 ); // debug only | 843 | //secs -= ( 3600 * 24*3 ); // debug only |
837 | QDateTime latest = dt.addSecs ( secs ); | 844 | QDateTime latest = dt.addSecs ( secs ); |
838 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 845 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
839 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 846 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
840 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 847 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
841 | QPtrList<Incidence> al; | 848 | QPtrList<Incidence> al; |
842 | Incidence* inL = el.first(); | 849 | Incidence* inL = el.first(); |
843 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 850 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
844 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 851 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
845 | while ( inL ) { | 852 | while ( inL ) { |
846 | bool ok = false; | 853 | bool ok = false; |
847 | int offset = 0; | 854 | int offset = 0; |
848 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 855 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
849 | if ( ok ) { | 856 | if ( ok ) { |
850 | //qDebug("OK %s",next.toString().latin1()); | 857 | //qDebug("OK %s",next.toString().latin1()); |
851 | if ( next < cur ) { | 858 | if ( next < cur ) { |
852 | al.append( inL ); | 859 | al.append( inL ); |
853 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 860 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
854 | } | 861 | } |
855 | } | 862 | } |
856 | inL = el.next(); | 863 | inL = el.next(); |
857 | } | 864 | } |
858 | if ( al.count() ) { | 865 | if ( al.count() ) { |
859 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 866 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
860 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 867 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
861 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 868 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
862 | lay->setSpacing( 0 ); | 869 | lay->setSpacing( 0 ); |
863 | lay->setMargin( 0 ); | 870 | lay->setMargin( 0 ); |
864 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 871 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
865 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 872 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
866 | lay->addWidget( matb ); | 873 | lay->addWidget( matb ); |
867 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 874 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
868 | int wid = 210; | 875 | int wid = 210; |
869 | int x = QApplication::desktop()->width() - wid - 7; | 876 | int x = QApplication::desktop()->width() - wid - 7; |
870 | int y = QApplication::desktop()->height() - wid - 70; | 877 | int y = QApplication::desktop()->height() - wid - 70; |
871 | dia->setGeometry ( x,y,wid,wid); | 878 | dia->setGeometry ( x,y,wid,wid); |
872 | } else { | 879 | } else { |
873 | int si = 220; | 880 | int si = 220; |
874 | if ( QApplication::desktop()->width() > 470 ) | 881 | if ( QApplication::desktop()->width() > 470 ) |
875 | si = 400; | 882 | si = 400; |
876 | dia->resize(si,si/2); | 883 | dia->resize(si,si/2); |
877 | } | 884 | } |
878 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 885 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
879 | dia->show(); | 886 | dia->show(); |
880 | 887 | ||
881 | } | 888 | } |
882 | } | 889 | } |
883 | void CalendarView::showDay( QDate d ) | 890 | void CalendarView::showDay( QDate d ) |
884 | { | 891 | { |
885 | dateNavigator()->blockSignals( true ); | 892 | dateNavigator()->blockSignals( true ); |
886 | dateNavigator()->selectDate( d ); | 893 | dateNavigator()->selectDate( d ); |
887 | dateNavigator()->blockSignals( false ); | 894 | dateNavigator()->blockSignals( false ); |
888 | mViewManager->showDayView(); | 895 | mViewManager->showDayView(); |
889 | //dateNavigator()->selectDate( d ); | 896 | //dateNavigator()->selectDate( d ); |
890 | } | 897 | } |
891 | void CalendarView::timerAlarm() | 898 | void CalendarView::timerAlarm() |
892 | { | 899 | { |
893 | //qDebug("CalendarView::timerAlarm() "); | 900 | //qDebug("CalendarView::timerAlarm() "); |
894 | computeAlarm(mAlarmNotification ); | 901 | computeAlarm(mAlarmNotification ); |
895 | } | 902 | } |
896 | 903 | ||
897 | void CalendarView::suspendAlarm() | 904 | void CalendarView::suspendAlarm() |
898 | { | 905 | { |
899 | //qDebug(" CalendarView::suspendAlarm() "); | 906 | //qDebug(" CalendarView::suspendAlarm() "); |
900 | computeAlarm(mSuspendAlarmNotification ); | 907 | computeAlarm(mSuspendAlarmNotification ); |
901 | 908 | ||
902 | } | 909 | } |
903 | 910 | ||
904 | void CalendarView::startAlarm( QString mess , QString filename) | 911 | void CalendarView::startAlarm( QString mess , QString filename) |
905 | { | 912 | { |
906 | 913 | ||
907 | topLevelWidget()->showNormal(); | 914 | topLevelWidget()->showNormal(); |
908 | topLevelWidget()->setActiveWindow(); | 915 | topLevelWidget()->setActiveWindow(); |
909 | topLevelWidget()->raise(); | 916 | topLevelWidget()->raise(); |
910 | 917 | ||
911 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 918 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
912 | QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); | 919 | QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); |
913 | 920 | ||
914 | } | 921 | } |
915 | 922 | ||
916 | void CalendarView::checkNextTimerAlarm() | 923 | void CalendarView::checkNextTimerAlarm() |
917 | { | 924 | { |
918 | mCalendar->checkAlarmForIncidence( 0, true ); | 925 | mCalendar->checkAlarmForIncidence( 0, true ); |
919 | } | 926 | } |
920 | 927 | ||
921 | void CalendarView::computeAlarm( QString msg ) | 928 | void CalendarView::computeAlarm( QString msg ) |
922 | { | 929 | { |
923 | 930 | ||
924 | QString mess = msg; | 931 | QString mess = msg; |
925 | QString mAlarmMessage = mess.mid( 9 ); | 932 | QString mAlarmMessage = mess.mid( 9 ); |
926 | QString filename = MainWindow::resourcePath(); | 933 | QString filename = MainWindow::resourcePath(); |
927 | filename += "koalarm.wav"; | 934 | filename += "koalarm.wav"; |
928 | QString tempfilename; | 935 | QString tempfilename; |
929 | if ( mess.left( 13 ) == "suspend_alarm") { | 936 | if ( mess.left( 13 ) == "suspend_alarm") { |
930 | bool error = false; | 937 | bool error = false; |
931 | int len = mess.mid( 13 ).find("+++"); | 938 | int len = mess.mid( 13 ).find("+++"); |
932 | if ( len < 2 ) | 939 | if ( len < 2 ) |
933 | error = true; | 940 | error = true; |
934 | else { | 941 | else { |
935 | tempfilename = mess.mid( 13, len ); | 942 | tempfilename = mess.mid( 13, len ); |
936 | if ( !QFile::exists( tempfilename ) ) | 943 | if ( !QFile::exists( tempfilename ) ) |
937 | error = true; | 944 | error = true; |
938 | } | 945 | } |
939 | if ( ! error ) { | 946 | if ( ! error ) { |
940 | filename = tempfilename; | 947 | filename = tempfilename; |
941 | } | 948 | } |
942 | mAlarmMessage = mess.mid( 13+len+3 ); | 949 | mAlarmMessage = mess.mid( 13+len+3 ); |
943 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 950 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
944 | startAlarm( mAlarmMessage, filename); | 951 | startAlarm( mAlarmMessage, filename); |
945 | return; | 952 | return; |
946 | } | 953 | } |
947 | if ( mess.left( 11 ) == "timer_alarm") { | 954 | if ( mess.left( 11 ) == "timer_alarm") { |
948 | //mTimerTime = 0; | 955 | //mTimerTime = 0; |
949 | startAlarm( mess.mid( 11 ), filename ); | 956 | startAlarm( mess.mid( 11 ), filename ); |
950 | return; | 957 | return; |
951 | } | 958 | } |
952 | if ( mess.left( 10 ) == "proc_alarm") { | 959 | if ( mess.left( 10 ) == "proc_alarm") { |
953 | bool error = false; | 960 | bool error = false; |
954 | int len = mess.mid( 10 ).find("+++"); | 961 | int len = mess.mid( 10 ).find("+++"); |
955 | if ( len < 2 ) | 962 | if ( len < 2 ) |
956 | error = true; | 963 | error = true; |
957 | else { | 964 | else { |
958 | tempfilename = mess.mid( 10, len ); | 965 | tempfilename = mess.mid( 10, len ); |
959 | if ( !QFile::exists( tempfilename ) ) | 966 | if ( !QFile::exists( tempfilename ) ) |
960 | error = true; | 967 | error = true; |
961 | } | 968 | } |
962 | if ( error ) { | 969 | if ( error ) { |
963 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 970 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
964 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 971 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
965 | } else { | 972 | } else { |
966 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 973 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
967 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 974 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
968 | #ifndef _WIN32_ | 975 | #ifndef _WIN32_ |
969 | if ( vfork () == 0 ) { | 976 | if ( vfork () == 0 ) { |
970 | execl ( tempfilename.latin1(), 0 ); | 977 | execl ( tempfilename.latin1(), 0 ); |
971 | return; | 978 | return; |
972 | } | 979 | } |
973 | #else | 980 | #else |
974 | QProcess* p = new QProcess(); | 981 | QProcess* p = new QProcess(); |
975 | p->addArgument( tempfilename.latin1() ); | 982 | p->addArgument( tempfilename.latin1() ); |
976 | p->start(); | 983 | p->start(); |
977 | return; | 984 | return; |
978 | #endif | 985 | #endif |
979 | 986 | ||
980 | return; | 987 | return; |
981 | } | 988 | } |
982 | 989 | ||
983 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 990 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
984 | } | 991 | } |
985 | if ( mess.left( 11 ) == "audio_alarm") { | 992 | if ( mess.left( 11 ) == "audio_alarm") { |
986 | bool error = false; | 993 | bool error = false; |
987 | int len = mess.mid( 11 ).find("+++"); | 994 | int len = mess.mid( 11 ).find("+++"); |
988 | if ( len < 2 ) | 995 | if ( len < 2 ) |
989 | error = true; | 996 | error = true; |
990 | else { | 997 | else { |
991 | tempfilename = mess.mid( 11, len ); | 998 | tempfilename = mess.mid( 11, len ); |
992 | if ( !QFile::exists( tempfilename ) ) | 999 | if ( !QFile::exists( tempfilename ) ) |
993 | error = true; | 1000 | error = true; |
994 | } | 1001 | } |
995 | if ( ! error ) { | 1002 | if ( ! error ) { |
996 | filename = tempfilename; | 1003 | filename = tempfilename; |
997 | } | 1004 | } |
998 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 1005 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
999 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 1006 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
1000 | } | 1007 | } |
1001 | if ( mess.left( 9 ) == "cal_alarm") { | 1008 | if ( mess.left( 9 ) == "cal_alarm") { |
1002 | mAlarmMessage = mess.mid( 9 ) ; | 1009 | mAlarmMessage = mess.mid( 9 ) ; |
1003 | } | 1010 | } |
1004 | 1011 | ||
1005 | startAlarm( mAlarmMessage, filename ); | 1012 | startAlarm( mAlarmMessage, filename ); |
1006 | 1013 | ||
1007 | 1014 | ||
1008 | } | 1015 | } |
1009 | 1016 | ||
1010 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 1017 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
1011 | { | 1018 | { |
1012 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1019 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1013 | 1020 | ||
1014 | mSuspendAlarmNotification = noti; | 1021 | mSuspendAlarmNotification = noti; |
1015 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 1022 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
1016 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 1023 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
1017 | mSuspendTimer->start( ms , true ); | 1024 | mSuspendTimer->start( ms , true ); |
1018 | 1025 | ||
1019 | } | 1026 | } |
1020 | 1027 | ||
1021 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 1028 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
1022 | { | 1029 | { |
1023 | mNextAlarmDateTime = qdt; | 1030 | mNextAlarmDateTime = qdt; |
1024 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1031 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1025 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 1032 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
1026 | #ifndef DESKTOP_VERSION | 1033 | #ifndef DESKTOP_VERSION |
1027 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 1034 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
1028 | #endif | 1035 | #endif |
1029 | return; | 1036 | return; |
1030 | } | 1037 | } |
1031 | int maxSec; | 1038 | int maxSec; |
1032 | //maxSec = 5; //testing only | 1039 | //maxSec = 5; //testing only |
1033 | maxSec = 86400+3600; // one day+1hour | 1040 | maxSec = 86400+3600; // one day+1hour |
1034 | mAlarmNotification = noti; | 1041 | mAlarmNotification = noti; |
1035 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 1042 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
1036 | if ( sec > maxSec ) { | 1043 | if ( sec > maxSec ) { |
1037 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 1044 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
1038 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 1045 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
1039 | return; | 1046 | return; |
1040 | } else { | 1047 | } else { |
1041 | mRecheckAlarmTimer->stop(); | 1048 | mRecheckAlarmTimer->stop(); |
1042 | } | 1049 | } |
1043 | //qDebug("Alarm timer started with secs: %d ", sec); | 1050 | //qDebug("Alarm timer started with secs: %d ", sec); |
1044 | mAlarmTimer->start( sec *1000 , true ); | 1051 | mAlarmTimer->start( sec *1000 , true ); |
1045 | 1052 | ||
1046 | } | 1053 | } |
1047 | // called by mRecheckAlarmTimer to get next alarm | 1054 | // called by mRecheckAlarmTimer to get next alarm |
1048 | // we need this, because a QTimer has only a max range of 25 days | 1055 | // we need this, because a QTimer has only a max range of 25 days |
1049 | void CalendarView::recheckTimerAlarm() | 1056 | void CalendarView::recheckTimerAlarm() |
1050 | { | 1057 | { |
1051 | mAlarmTimer->stop(); | 1058 | mAlarmTimer->stop(); |
1052 | mRecheckAlarmTimer->stop(); | 1059 | mRecheckAlarmTimer->stop(); |
1053 | mCalendar->checkAlarmForIncidence( 0, true ); | 1060 | mCalendar->checkAlarmForIncidence( 0, true ); |
1054 | } | 1061 | } |
1055 | #ifndef DESKTOP_VERSION | 1062 | #ifndef DESKTOP_VERSION |
1056 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 1063 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
1057 | #else | 1064 | #else |
1058 | void CalendarView::removeAlarm(const QDateTime &, const QString & ) | 1065 | void CalendarView::removeAlarm(const QDateTime &, const QString & ) |
1059 | #endif | 1066 | #endif |
1060 | { | 1067 | { |
1061 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1068 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1062 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 1069 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
1063 | #ifndef DESKTOP_VERSION | 1070 | #ifndef DESKTOP_VERSION |
1064 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); | 1071 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); |
1065 | #endif | 1072 | #endif |
1066 | return; | 1073 | return; |
1067 | } | 1074 | } |
1068 | mAlarmTimer->stop(); | 1075 | mAlarmTimer->stop(); |
1069 | } | 1076 | } |
1070 | void CalendarView::selectWeekNum ( int num ) | 1077 | void CalendarView::selectWeekNum ( int num ) |
1071 | { | 1078 | { |
1072 | dateNavigator()->blockSignals( true ); | 1079 | dateNavigator()->blockSignals( true ); |
1073 | dateNavigator()->selectWeek( num ); | 1080 | dateNavigator()->selectWeek( num ); |
1074 | dateNavigator()->blockSignals( false ); | 1081 | dateNavigator()->blockSignals( false ); |
1075 | mViewManager->showWeekView(); | 1082 | mViewManager->showWeekView(); |
1076 | } | 1083 | } |
1077 | KOViewManager *CalendarView::viewManager() | 1084 | KOViewManager *CalendarView::viewManager() |
1078 | { | 1085 | { |
1079 | return mViewManager; | 1086 | return mViewManager; |
1080 | } | 1087 | } |
1081 | 1088 | ||
1082 | KODialogManager *CalendarView::dialogManager() | 1089 | KODialogManager *CalendarView::dialogManager() |
1083 | { | 1090 | { |
1084 | return mDialogManager; | 1091 | return mDialogManager; |
1085 | } | 1092 | } |
1086 | 1093 | ||
1087 | QDate CalendarView::startDate() | 1094 | QDate CalendarView::startDate() |
1088 | { | 1095 | { |
1089 | DateList dates = mNavigator->selectedDates(); | 1096 | DateList dates = mNavigator->selectedDates(); |
1090 | 1097 | ||
1091 | return dates.first(); | 1098 | return dates.first(); |
1092 | } | 1099 | } |
1093 | 1100 | ||
1094 | QDate CalendarView::endDate() | 1101 | QDate CalendarView::endDate() |
1095 | { | 1102 | { |
1096 | DateList dates = mNavigator->selectedDates(); | 1103 | DateList dates = mNavigator->selectedDates(); |
1097 | 1104 | ||
1098 | return dates.last(); | 1105 | return dates.last(); |
1099 | } | 1106 | } |
1100 | 1107 | ||
1101 | 1108 | ||
1102 | void CalendarView::createPrinter() | 1109 | void CalendarView::createPrinter() |
1103 | { | 1110 | { |
1104 | #ifndef KORG_NOPRINTER | 1111 | #ifndef KORG_NOPRINTER |
1105 | if (!mCalPrinter) { | 1112 | if (!mCalPrinter) { |
1106 | mCalPrinter = new CalPrinter(this, mCalendar); | 1113 | mCalPrinter = new CalPrinter(this, mCalendar); |
1107 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 1114 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
1108 | } | 1115 | } |
1109 | #endif | 1116 | #endif |
1110 | } | 1117 | } |
1111 | 1118 | ||
1112 | 1119 | ||
1113 | //KOPrefs::instance()->mWriteBackFile | 1120 | //KOPrefs::instance()->mWriteBackFile |
1114 | //KOPrefs::instance()->mWriteBackExistingOnly | 1121 | //KOPrefs::instance()->mWriteBackExistingOnly |
1115 | 1122 | ||
1116 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 1123 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
1117 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 1124 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
1118 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 1125 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
1119 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 1126 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
1120 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 1127 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
1121 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 1128 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
1122 | 1129 | ||
1123 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 1130 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
1124 | { | 1131 | { |
1125 | 1132 | ||
1126 | // 0 equal | 1133 | // 0 equal |
1127 | // 1 take local | 1134 | // 1 take local |
1128 | // 2 take remote | 1135 | // 2 take remote |
1129 | // 3 cancel | 1136 | // 3 cancel |
1130 | QDateTime lastSync = mLastCalendarSync; | 1137 | QDateTime lastSync = mLastCalendarSync; |
1131 | QDateTime localMod = local->lastModified(); | 1138 | QDateTime localMod = local->lastModified(); |
1132 | QDateTime remoteMod = remote->lastModified(); | 1139 | QDateTime remoteMod = remote->lastModified(); |
1133 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1140 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1134 | bool remCh, locCh; | 1141 | bool remCh, locCh; |
1135 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 1142 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
1136 | //if ( remCh ) | 1143 | //if ( remCh ) |
1137 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 1144 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
1138 | locCh = ( localMod > mLastCalendarSync ); | 1145 | locCh = ( localMod > mLastCalendarSync ); |
1139 | if ( !remCh && ! locCh ) { | 1146 | if ( !remCh && ! locCh ) { |
1140 | //qDebug("both not changed "); | 1147 | //qDebug("both not changed "); |
1141 | lastSync = localMod.addDays(1); | 1148 | lastSync = localMod.addDays(1); |
1142 | if ( mode <= SYNC_PREF_ASK ) | 1149 | if ( mode <= SYNC_PREF_ASK ) |
1143 | return 0; | 1150 | return 0; |
1144 | } else { | 1151 | } else { |
1145 | if ( locCh ) { | 1152 | if ( locCh ) { |
1146 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 1153 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
1147 | lastSync = localMod.addDays( -1 ); | 1154 | lastSync = localMod.addDays( -1 ); |
1148 | if ( !remCh ) | 1155 | if ( !remCh ) |
1149 | remoteMod = ( lastSync.addDays( -1 ) ); | 1156 | remoteMod = ( lastSync.addDays( -1 ) ); |
1150 | } else { | 1157 | } else { |
1151 | //qDebug(" not loc changed "); | 1158 | //qDebug(" not loc changed "); |
1152 | lastSync = localMod.addDays( 1 ); | 1159 | lastSync = localMod.addDays( 1 ); |
1153 | if ( remCh ) | 1160 | if ( remCh ) |
1154 | remoteMod =( lastSync.addDays( 1 ) ); | 1161 | remoteMod =( lastSync.addDays( 1 ) ); |
1155 | 1162 | ||
1156 | } | 1163 | } |
1157 | } | 1164 | } |
1158 | full = true; | 1165 | full = true; |
1159 | if ( mode < SYNC_PREF_ASK ) | 1166 | if ( mode < SYNC_PREF_ASK ) |
1160 | mode = SYNC_PREF_ASK; | 1167 | mode = SYNC_PREF_ASK; |
1161 | } else { | 1168 | } else { |
1162 | if ( localMod == remoteMod ) | 1169 | if ( localMod == remoteMod ) |
1163 | // if ( local->revision() == remote->revision() ) | 1170 | // if ( local->revision() == remote->revision() ) |
1164 | return 0; | 1171 | return 0; |
1165 | 1172 | ||
1166 | } | 1173 | } |
1167 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 1174 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
1168 | 1175 | ||
1169 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 1176 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
1170 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 1177 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
1171 | //full = true; //debug only | 1178 | //full = true; //debug only |
1172 | if ( full ) { | 1179 | if ( full ) { |
1173 | bool equ = false; | 1180 | bool equ = false; |
1174 | if ( local->typeID() == eventID ) { | 1181 | if ( local->typeID() == eventID ) { |
1175 | equ = (*((Event*) local) == *((Event*) remote)); | 1182 | equ = (*((Event*) local) == *((Event*) remote)); |
1176 | } | 1183 | } |
1177 | else if ( local->typeID() == todoID ) | 1184 | else if ( local->typeID() == todoID ) |
1178 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 1185 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
1179 | else if ( local->typeID() == journalID ) | 1186 | else if ( local->typeID() == journalID ) |
1180 | equ = (*((Journal*) local) == *((Journal*) remote)); | 1187 | equ = (*((Journal*) local) == *((Journal*) remote)); |
1181 | if ( equ ) { | 1188 | if ( equ ) { |
1182 | //qDebug("equal "); | 1189 | //qDebug("equal "); |
1183 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1190 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1184 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 1191 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
1185 | } | 1192 | } |
1186 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 1193 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
1187 | return 0; | 1194 | return 0; |
1188 | 1195 | ||
1189 | }//else //debug only | 1196 | }//else //debug only |
1190 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 1197 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
1191 | } | 1198 | } |
1192 | int result; | 1199 | int result; |
1193 | bool localIsNew; | 1200 | bool localIsNew; |
1194 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 1201 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
1195 | 1202 | ||
1196 | 1203 | ||
1197 | // ************************************************ | 1204 | // ************************************************ |
1198 | // ************************************************ | 1205 | // ************************************************ |
1199 | // ************************************************ | 1206 | // ************************************************ |
1200 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1207 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1201 | // BUT remoteMod != localMod | 1208 | // BUT remoteMod != localMod |
1202 | 1209 | ||
1203 | 1210 | ||
1204 | if ( full && mode < SYNC_PREF_NEWEST ) | 1211 | if ( full && mode < SYNC_PREF_NEWEST ) |
1205 | mode = SYNC_PREF_ASK; | 1212 | mode = SYNC_PREF_ASK; |
1206 | 1213 | ||
1207 | switch( mode ) { | 1214 | switch( mode ) { |
1208 | case SYNC_PREF_LOCAL: | 1215 | case SYNC_PREF_LOCAL: |
1209 | if ( lastSync > remoteMod ) | 1216 | if ( lastSync > remoteMod ) |
1210 | return 1; | 1217 | return 1; |
1211 | if ( lastSync > localMod ) | 1218 | if ( lastSync > localMod ) |
1212 | return 2; | 1219 | return 2; |
1213 | return 1; | 1220 | return 1; |
1214 | break; | 1221 | break; |
1215 | case SYNC_PREF_REMOTE: | 1222 | case SYNC_PREF_REMOTE: |
1216 | if ( lastSync > localMod ) | 1223 | if ( lastSync > localMod ) |
1217 | return 2; | 1224 | return 2; |
1218 | if ( lastSync > remoteMod ) | 1225 | if ( lastSync > remoteMod ) |
1219 | return 1; | 1226 | return 1; |
1220 | return 2; | 1227 | return 2; |
1221 | break; | 1228 | break; |
1222 | case SYNC_PREF_NEWEST: | 1229 | case SYNC_PREF_NEWEST: |
1223 | if ( localMod >= remoteMod ) | 1230 | if ( localMod >= remoteMod ) |
1224 | return 1; | 1231 | return 1; |
1225 | else | 1232 | else |
1226 | return 2; | 1233 | return 2; |
1227 | break; | 1234 | break; |
1228 | case SYNC_PREF_ASK: | 1235 | case SYNC_PREF_ASK: |
1229 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1236 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1230 | if ( lastSync > remoteMod && lastSync > localMod) | 1237 | if ( lastSync > remoteMod && lastSync > localMod) |
1231 | return 0; | 1238 | return 0; |
1232 | if ( lastSync > remoteMod ) | 1239 | if ( lastSync > remoteMod ) |
1233 | return 1; | 1240 | return 1; |
1234 | if ( lastSync > localMod ) | 1241 | if ( lastSync > localMod ) |
1235 | return 2; | 1242 | return 2; |
1236 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1243 | qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1237 | localIsNew = localMod >= remoteMod; | 1244 | localIsNew = localMod >= remoteMod; |
1238 | if ( localIsNew ) | 1245 | if ( localIsNew ) |
1239 | getEventViewerDialog()->setColorMode( 1 ); | 1246 | getEventViewerDialog()->setColorMode( 1 ); |
1240 | else | 1247 | else |
1241 | getEventViewerDialog()->setColorMode( 2 ); | 1248 | getEventViewerDialog()->setColorMode( 2 ); |
1242 | getEventViewerDialog()->setIncidence(local); | 1249 | getEventViewerDialog()->setIncidence(local); |
1243 | if ( localIsNew ) | 1250 | if ( localIsNew ) |
1244 | getEventViewerDialog()->setColorMode( 2 ); | 1251 | getEventViewerDialog()->setColorMode( 2 ); |
1245 | else | 1252 | else |
1246 | getEventViewerDialog()->setColorMode( 1 ); | 1253 | getEventViewerDialog()->setColorMode( 1 ); |
1247 | getEventViewerDialog()->addIncidence(remote); | 1254 | getEventViewerDialog()->addIncidence(remote); |
1248 | getEventViewerDialog()->setColorMode( 0 ); | 1255 | getEventViewerDialog()->setColorMode( 0 ); |
1249 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 1256 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
1250 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 1257 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
1251 | getEventViewerDialog()->showMe(); | 1258 | getEventViewerDialog()->showMe(); |
1252 | result = getEventViewerDialog()->executeS( localIsNew ); | 1259 | result = getEventViewerDialog()->executeS( localIsNew ); |
1253 | return result; | 1260 | return result; |
1254 | 1261 | ||
1255 | break; | 1262 | break; |
1256 | case SYNC_PREF_FORCE_LOCAL: | 1263 | case SYNC_PREF_FORCE_LOCAL: |
1257 | return 1; | 1264 | return 1; |
1258 | break; | 1265 | break; |
1259 | case SYNC_PREF_FORCE_REMOTE: | 1266 | case SYNC_PREF_FORCE_REMOTE: |
1260 | return 2; | 1267 | return 2; |
1261 | break; | 1268 | break; |
1262 | 1269 | ||
1263 | default: | 1270 | default: |
1264 | // SYNC_PREF_TAKE_BOTH not implemented | 1271 | // SYNC_PREF_TAKE_BOTH not implemented |
1265 | break; | 1272 | break; |
1266 | } | 1273 | } |
1267 | return 0; | 1274 | return 0; |
1268 | } | 1275 | } |
1269 | Event* CalendarView::getLastSyncEvent() | 1276 | Event* CalendarView::getLastSyncEvent() |
1270 | { | 1277 | { |
1271 | Event* lse; | 1278 | Event* lse; |
1272 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1279 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1273 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1280 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1274 | if (!lse) { | 1281 | if (!lse) { |
1275 | lse = new Event(); | 1282 | lse = new Event(); |
1276 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1283 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1277 | QString sum = ""; | 1284 | QString sum = ""; |
1278 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1285 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1279 | sum = "E: "; | 1286 | sum = "E: "; |
1280 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1287 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1281 | lse->setDtStart( mLastCalendarSync ); | 1288 | lse->setDtStart( mLastCalendarSync ); |
1282 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1289 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1283 | lse->setCategories( i18n("SyncEvent") ); | 1290 | lse->setCategories( i18n("SyncEvent") ); |
1284 | lse->setReadOnly( true ); | 1291 | lse->setReadOnly( true ); |
1285 | mCalendar->addEvent( lse ); | 1292 | mCalendar->addEvent( lse ); |
1286 | } | 1293 | } |
1287 | 1294 | ||
1288 | return lse; | 1295 | return lse; |
1289 | 1296 | ||
1290 | } | 1297 | } |
1291 | 1298 | ||
1292 | // we check, if the to delete event has a id for a profile | 1299 | // we check, if the to delete event has a id for a profile |
1293 | // if yes, we set this id in the profile to delete | 1300 | // if yes, we set this id in the profile to delete |
1294 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1301 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1295 | { | 1302 | { |
1296 | if ( lastSync.count() == 0 ) { | 1303 | if ( lastSync.count() == 0 ) { |
1297 | //qDebug(" lastSync.count() == 0"); | 1304 | //qDebug(" lastSync.count() == 0"); |
1298 | return; | 1305 | return; |
1299 | } | 1306 | } |
1300 | if ( toDelete->typeID() == journalID ) | 1307 | if ( toDelete->typeID() == journalID ) |
1301 | return; | 1308 | return; |
1302 | 1309 | ||
1303 | Event* eve = lastSync.first(); | 1310 | Event* eve = lastSync.first(); |
1304 | 1311 | ||
1305 | while ( eve ) { | 1312 | while ( eve ) { |
1306 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1313 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1307 | if ( !id.isEmpty() ) { | 1314 | if ( !id.isEmpty() ) { |
1308 | QString des = eve->description(); | 1315 | QString des = eve->description(); |
1309 | QString pref = "e"; | 1316 | QString pref = "e"; |
1310 | if ( toDelete->typeID() == todoID ) | 1317 | if ( toDelete->typeID() == todoID ) |
1311 | pref = "t"; | 1318 | pref = "t"; |
1312 | des += pref+ id + ","; | 1319 | des += pref+ id + ","; |
1313 | eve->setReadOnly( false ); | 1320 | eve->setReadOnly( false ); |
1314 | eve->setDescription( des ); | 1321 | eve->setDescription( des ); |
1315 | //qDebug("setdes %s ", des.latin1()); | 1322 | //qDebug("setdes %s ", des.latin1()); |
1316 | eve->setReadOnly( true ); | 1323 | eve->setReadOnly( true ); |
1317 | } | 1324 | } |
1318 | eve = lastSync.next(); | 1325 | eve = lastSync.next(); |
1319 | } | 1326 | } |
1320 | 1327 | ||
1321 | } | 1328 | } |
1322 | void CalendarView::checkExternalId( Incidence * inc ) | 1329 | void CalendarView::checkExternalId( Incidence * inc ) |
1323 | { | 1330 | { |
1324 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1331 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1325 | checkExternSyncEvent( lastSync, inc ); | 1332 | checkExternSyncEvent( lastSync, inc ); |
1326 | 1333 | ||
1327 | } | 1334 | } |
1328 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1335 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1329 | { | 1336 | { |
1330 | bool syncOK = true; | 1337 | bool syncOK = true; |
1331 | int addedEvent = 0; | 1338 | int addedEvent = 0; |
1332 | int addedEventR = 0; | 1339 | int addedEventR = 0; |
1333 | int deletedEventR = 0; | 1340 | int deletedEventR = 0; |
1334 | int deletedEventL = 0; | 1341 | int deletedEventL = 0; |
1335 | int changedLocal = 0; | 1342 | int changedLocal = 0; |
1336 | int changedRemote = 0; | 1343 | int changedRemote = 0; |
1337 | int filteredIN = 0; | 1344 | int filteredIN = 0; |
1338 | int filteredOUT = 0; | 1345 | int filteredOUT = 0; |
1339 | //QPtrList<Event> el = local->rawEvents(); | 1346 | //QPtrList<Event> el = local->rawEvents(); |
1340 | Event* eventR; | 1347 | Event* eventR; |
1341 | QString uid; | 1348 | QString uid; |
1342 | int take; | 1349 | int take; |
1343 | Event* eventRSync; | 1350 | Event* eventRSync; |
1344 | Event* eventLSync; | 1351 | Event* eventLSync; |
1345 | clearAllViews(); | 1352 | clearAllViews(); |
1346 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1353 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1347 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1354 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1348 | bool fullDateRange = false; | 1355 | bool fullDateRange = false; |
1349 | local->resetTempSyncStat(); | 1356 | local->resetTempSyncStat(); |
1350 | mLastCalendarSync = QDateTime::currentDateTime(); | 1357 | mLastCalendarSync = QDateTime::currentDateTime(); |
1351 | if ( mSyncManager->syncWithDesktop() ) { | 1358 | if ( mSyncManager->syncWithDesktop() ) { |
1352 | remote->resetPilotStat(1); | 1359 | remote->resetPilotStat(1); |
1353 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1360 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1354 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1361 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1355 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1362 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1356 | } else { | 1363 | } else { |
1357 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1364 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1358 | } | 1365 | } |
1359 | } | 1366 | } |
1360 | QDateTime modifiedCalendar = mLastCalendarSync; | 1367 | QDateTime modifiedCalendar = mLastCalendarSync; |
1361 | eventLSync = getLastSyncEvent(); | 1368 | eventLSync = getLastSyncEvent(); |
1362 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1369 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1363 | if ( eventR ) { | 1370 | if ( eventR ) { |
1364 | qDebug("last-syncEvent on remote found "); | 1371 | qDebug("last-syncEvent on remote found "); |
1365 | eventRSync = (Event*) eventR->clone(); | 1372 | eventRSync = (Event*) eventR->clone(); |
1366 | remote->deleteEvent(eventR ); | 1373 | remote->deleteEvent(eventR ); |
1367 | 1374 | ||
1368 | } else { | 1375 | } else { |
1369 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1376 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1370 | eventRSync = (Event*)eventLSync->clone(); | 1377 | eventRSync = (Event*)eventLSync->clone(); |
1371 | } else { | 1378 | } else { |
1372 | fullDateRange = true; | 1379 | fullDateRange = true; |
1373 | eventRSync = new Event(); | 1380 | eventRSync = new Event(); |
1374 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1381 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1375 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1382 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1376 | eventRSync->setDtStart( mLastCalendarSync ); | 1383 | eventRSync->setDtStart( mLastCalendarSync ); |
1377 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1384 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1378 | eventRSync->setCategories( i18n("SyncEvent") ); | 1385 | eventRSync->setCategories( i18n("SyncEvent") ); |
1379 | } | 1386 | } |
1380 | } | 1387 | } |
1381 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1388 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1382 | fullDateRange = true; | 1389 | fullDateRange = true; |
1383 | 1390 | ||
1384 | if ( ! fullDateRange ) { | 1391 | if ( ! fullDateRange ) { |
1385 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1392 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1386 | 1393 | ||
1387 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1394 | qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1388 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1395 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1389 | fullDateRange = true; | 1396 | fullDateRange = true; |
1390 | } | 1397 | } |
1391 | } | 1398 | } |
1392 | if ( mSyncManager->syncWithDesktop() ) { | 1399 | if ( mSyncManager->syncWithDesktop() ) { |
1393 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1400 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1394 | } | 1401 | } |
1395 | if ( fullDateRange ) | 1402 | if ( fullDateRange ) |
1396 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1403 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1397 | else | 1404 | else |
1398 | mLastCalendarSync = eventLSync->dtStart(); | 1405 | mLastCalendarSync = eventLSync->dtStart(); |
1399 | // for resyncing if own file has changed | 1406 | // for resyncing if own file has changed |
1400 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1407 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1401 | mLastCalendarSync = loadedFileVersion; | 1408 | mLastCalendarSync = loadedFileVersion; |
1402 | //qDebug("setting mLastCalendarSync "); | 1409 | //qDebug("setting mLastCalendarSync "); |
1403 | } | 1410 | } |
1404 | //qDebug("*************************** "); | 1411 | //qDebug("*************************** "); |
1405 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1412 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1406 | QPtrList<Incidence> er = remote->rawIncidences(); | 1413 | QPtrList<Incidence> er = remote->rawIncidences(); |
1407 | Incidence* inR = er.first(); | 1414 | Incidence* inR = er.first(); |
1408 | Incidence* inL; | 1415 | Incidence* inL; |
1409 | QProgressBar bar( er.count(),0 ); | 1416 | QProgressBar bar( er.count(),0 ); |
1410 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1417 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1411 | 1418 | ||
1412 | // ************** setting up filter ************* | 1419 | // ************** setting up filter ************* |
1413 | CalFilter *filterIN = 0; | 1420 | CalFilter *filterIN = 0; |
1414 | CalFilter *filterOUT = 0; | 1421 | CalFilter *filterOUT = 0; |
1415 | CalFilter *filter = mFilters.first(); | 1422 | CalFilter *filter = mFilters.first(); |
1416 | while(filter) { | 1423 | while(filter) { |
1417 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1424 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1418 | filterIN = filter; | 1425 | filterIN = filter; |
1419 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1426 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1420 | filterOUT = filter; | 1427 | filterOUT = filter; |
1421 | filter = mFilters.next(); | 1428 | filter = mFilters.next(); |
1422 | } | 1429 | } |
1423 | int w = 300; | 1430 | int w = 300; |
1424 | if ( QApplication::desktop()->width() < 320 ) | 1431 | if ( QApplication::desktop()->width() < 320 ) |
1425 | w = 220; | 1432 | w = 220; |
1426 | int h = bar.sizeHint().height() ; | 1433 | int h = bar.sizeHint().height() ; |
1427 | int dw = QApplication::desktop()->width(); | 1434 | int dw = QApplication::desktop()->width(); |
1428 | int dh = QApplication::desktop()->height(); | 1435 | int dh = QApplication::desktop()->height(); |
1429 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1436 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1430 | bar.show(); | 1437 | bar.show(); |
1431 | int modulo = (er.count()/10)+1; | 1438 | int modulo = (er.count()/10)+1; |
1432 | int incCounter = 0; | 1439 | int incCounter = 0; |
1433 | while ( inR ) { | 1440 | while ( inR ) { |
1434 | if ( ! bar.isVisible() ) | 1441 | if ( ! bar.isVisible() ) |
1435 | return false; | 1442 | return false; |
1436 | if ( incCounter % modulo == 0 ) | 1443 | if ( incCounter % modulo == 0 ) |
1437 | bar.setProgress( incCounter ); | 1444 | bar.setProgress( incCounter ); |
1438 | ++incCounter; | 1445 | ++incCounter; |
1439 | uid = inR->uid(); | 1446 | uid = inR->uid(); |
1440 | bool skipIncidence = false; | 1447 | bool skipIncidence = false; |
1441 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1448 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1442 | skipIncidence = true; | 1449 | skipIncidence = true; |
1443 | QString idS; | 1450 | QString idS; |
1444 | qApp->processEvents(); | 1451 | qApp->processEvents(); |
1445 | if ( !skipIncidence ) { | 1452 | if ( !skipIncidence ) { |
1446 | inL = local->incidenceForUid( uid , false ); | 1453 | inL = local->incidenceForUid( uid , false ); |
1447 | if ( inL ) { // maybe conflict - same uid in both calendars | 1454 | if ( inL ) { // maybe conflict - same uid in both calendars |
1448 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1455 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1449 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1456 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1450 | if ( take == 3 ) | 1457 | if ( take == 3 ) |
1451 | return false; | 1458 | return false; |
1452 | if ( take == 1 ) {// take local ********************** | 1459 | if ( take == 1 ) {// take local ********************** |
1453 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1460 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1454 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1461 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1455 | else | 1462 | else |
1456 | idS = inR->IDStr(); | 1463 | idS = inR->IDStr(); |
1457 | int calID = inR->calID(); | 1464 | int calID = inR->calID(); |
1458 | remote->deleteIncidence( inR ); | 1465 | remote->deleteIncidence( inR ); |
1459 | inR = inL->clone(); | 1466 | inR = inL->clone(); |
1460 | inR->setCalID( calID ); | 1467 | inR->setCalID( calID ); |
1461 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1468 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1462 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1469 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1463 | inR->setIDStr( idS ); | 1470 | inR->setIDStr( idS ); |
1464 | remote->addIncidence( inR ); | 1471 | remote->addIncidence( inR ); |
1465 | if ( mSyncManager->syncWithDesktop() ) | 1472 | if ( mSyncManager->syncWithDesktop() ) |
1466 | inR->setPilotId( 2 ); | 1473 | inR->setPilotId( 2 ); |
1467 | ++changedRemote; | 1474 | ++changedRemote; |
1468 | } else {// take remote ********************** | 1475 | } else {// take remote ********************** |
1469 | if ( !inL->isReadOnly() ) { | 1476 | if ( !inL->isReadOnly() ) { |
1470 | idS = inL->IDStr(); | 1477 | idS = inL->IDStr(); |
1471 | int pid = inL->pilotId(); | 1478 | int pid = inL->pilotId(); |
1472 | int calID = inL->calID(); | 1479 | int calID = inL->calID(); |
1473 | local->deleteIncidence( inL ); | 1480 | local->deleteIncidence( inL ); |
1474 | inL = inR->clone(); | 1481 | inL = inR->clone(); |
1475 | inL->setCalID( calID ); | 1482 | inL->setCalID( calID ); |
1476 | if ( mSyncManager->syncWithDesktop() ) | 1483 | if ( mSyncManager->syncWithDesktop() ) |
1477 | inL->setPilotId( pid ); | 1484 | inL->setPilotId( pid ); |
1478 | inL->setIDStr( idS ); | 1485 | inL->setIDStr( idS ); |
1479 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1486 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1480 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1487 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1481 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1488 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1482 | } | 1489 | } |
1483 | local->addIncidence( inL ); | 1490 | local->addIncidence( inL ); |
1484 | ++changedLocal; | 1491 | ++changedLocal; |
1485 | } | 1492 | } |
1486 | } | 1493 | } |
1487 | } | 1494 | } |
1488 | } else { // no conflict ********** add or delete remote | 1495 | } else { // no conflict ********** add or delete remote |
1489 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1496 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1490 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1497 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1491 | QString des = eventLSync->description(); | 1498 | QString des = eventLSync->description(); |
1492 | QString pref = "e"; | 1499 | QString pref = "e"; |
1493 | if ( inR->typeID() == todoID ) | 1500 | if ( inR->typeID() == todoID ) |
1494 | pref = "t"; | 1501 | pref = "t"; |
1495 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1502 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1496 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1503 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1497 | //remote->deleteIncidence( inR ); | 1504 | //remote->deleteIncidence( inR ); |
1498 | ++deletedEventR; | 1505 | ++deletedEventR; |
1499 | } else { | 1506 | } else { |
1500 | inR->setLastModified( modifiedCalendar ); | 1507 | inR->setLastModified( modifiedCalendar ); |
1501 | inL = inR->clone(); | 1508 | inL = inR->clone(); |
1502 | inL->setIDStr( ":" ); | 1509 | inL->setIDStr( ":" ); |
1503 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1510 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1504 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1511 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1505 | 1512 | ||
1506 | inL->setCalID( 0 );// add to default cal | 1513 | inL->setCalID( 0 );// add to default cal |
1507 | local->addIncidence( inL ); | 1514 | local->addIncidence( inL ); |
1508 | ++addedEvent; | 1515 | ++addedEvent; |
1509 | 1516 | ||
1510 | } | 1517 | } |
1511 | } else { | 1518 | } else { |
1512 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1519 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1513 | inR->setLastModified( modifiedCalendar ); | 1520 | inR->setLastModified( modifiedCalendar ); |
1514 | inL = inR->clone(); | 1521 | inL = inR->clone(); |
1515 | inL->setIDStr( ":" ); | 1522 | inL->setIDStr( ":" ); |
1516 | inL->setCalID( 0 );// add to default cal | 1523 | inL->setCalID( 0 );// add to default cal |
1517 | local->addIncidence( inL ); | 1524 | local->addIncidence( inL ); |
1518 | ++addedEvent; | 1525 | ++addedEvent; |
1519 | 1526 | ||
1520 | } else { | 1527 | } else { |
1521 | checkExternSyncEvent(eventRSyncSharp, inR); | 1528 | checkExternSyncEvent(eventRSyncSharp, inR); |
1522 | remote->deleteIncidence( inR ); | 1529 | remote->deleteIncidence( inR ); |
1523 | ++deletedEventR; | 1530 | ++deletedEventR; |
1524 | } | 1531 | } |
1525 | } | 1532 | } |
1526 | } else { | 1533 | } else { |
1527 | ++filteredIN; | 1534 | ++filteredIN; |
1528 | } | 1535 | } |
1529 | } | 1536 | } |
1530 | } | 1537 | } |
1531 | inR = er.next(); | 1538 | inR = er.next(); |
1532 | } | 1539 | } |
1533 | QPtrList<Incidence> el = local->rawIncidences(); | 1540 | QPtrList<Incidence> el = local->rawIncidences(); |
1534 | inL = el.first(); | 1541 | inL = el.first(); |
1535 | modulo = (el.count()/10)+1; | 1542 | modulo = (el.count()/10)+1; |
1536 | bar.setCaption (i18n("Add / remove events") ); | 1543 | bar.setCaption (i18n("Add / remove events") ); |
1537 | bar.setTotalSteps ( el.count() ) ; | 1544 | bar.setTotalSteps ( el.count() ) ; |
1538 | bar.show(); | 1545 | bar.show(); |
1539 | incCounter = 0; | 1546 | incCounter = 0; |
1540 | 1547 | ||
1541 | while ( inL ) { | 1548 | while ( inL ) { |
1542 | 1549 | ||
1543 | qApp->processEvents(); | 1550 | qApp->processEvents(); |
1544 | if ( ! bar.isVisible() ) | 1551 | if ( ! bar.isVisible() ) |
1545 | return false; | 1552 | return false; |
1546 | if ( incCounter % modulo == 0 ) | 1553 | if ( incCounter % modulo == 0 ) |
1547 | bar.setProgress( incCounter ); | 1554 | bar.setProgress( incCounter ); |
1548 | ++incCounter; | 1555 | ++incCounter; |
1549 | uid = inL->uid(); | 1556 | uid = inL->uid(); |
1550 | bool skipIncidence = false; | 1557 | bool skipIncidence = false; |
1551 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1558 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1552 | skipIncidence = true; | 1559 | skipIncidence = true; |
1553 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1560 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1554 | skipIncidence = true; | 1561 | skipIncidence = true; |
1555 | if ( !skipIncidence ) { | 1562 | if ( !skipIncidence ) { |
1556 | inR = remote->incidenceForUid( uid , true ); | 1563 | inR = remote->incidenceForUid( uid , true ); |
1557 | if ( ! inR ) { | 1564 | if ( ! inR ) { |
1558 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1565 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1559 | // no conflict ********** add or delete local | 1566 | // no conflict ********** add or delete local |
1560 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1567 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1561 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1568 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1562 | checkExternSyncEvent(eventLSyncSharp, inL); | 1569 | checkExternSyncEvent(eventLSyncSharp, inL); |
1563 | local->deleteIncidence( inL ); | 1570 | local->deleteIncidence( inL ); |
1564 | ++deletedEventL; | 1571 | ++deletedEventL; |
1565 | } else { | 1572 | } else { |
1566 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1573 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1567 | inL->removeID(mCurrentSyncDevice ); | 1574 | inL->removeID(mCurrentSyncDevice ); |
1568 | ++addedEventR; | 1575 | ++addedEventR; |
1569 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1576 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1570 | inL->setLastModified( modifiedCalendar ); | 1577 | inL->setLastModified( modifiedCalendar ); |
1571 | inR = inL->clone(); | 1578 | inR = inL->clone(); |
1572 | inR->setIDStr( ":" ); | 1579 | inR->setIDStr( ":" ); |
1573 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1580 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1574 | inR->setCalID( 0 );// add to default cal | 1581 | inR->setCalID( 0 );// add to default cal |
1575 | remote->addIncidence( inR ); | 1582 | remote->addIncidence( inR ); |
1576 | } | 1583 | } |
1577 | } | 1584 | } |
1578 | } else { | 1585 | } else { |
1579 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1586 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1580 | checkExternSyncEvent(eventLSyncSharp, inL); | 1587 | checkExternSyncEvent(eventLSyncSharp, inL); |
1581 | local->deleteIncidence( inL ); | 1588 | local->deleteIncidence( inL ); |
1582 | ++deletedEventL; | 1589 | ++deletedEventL; |
1583 | } else { | 1590 | } else { |
1584 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1591 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1585 | ++addedEventR; | 1592 | ++addedEventR; |
1586 | inL->setLastModified( modifiedCalendar ); | 1593 | inL->setLastModified( modifiedCalendar ); |
1587 | inR = inL->clone(); | 1594 | inR = inL->clone(); |
1588 | inR->setIDStr( ":" ); | 1595 | inR->setIDStr( ":" ); |
1589 | inR->setCalID( 0 );// add to default cal | 1596 | inR->setCalID( 0 );// add to default cal |
1590 | remote->addIncidence( inR ); | 1597 | remote->addIncidence( inR ); |
1591 | } | 1598 | } |
1592 | } | 1599 | } |
1593 | } | 1600 | } |
1594 | } else { | 1601 | } else { |
1595 | ++filteredOUT; | 1602 | ++filteredOUT; |
1596 | } | 1603 | } |
1597 | } | 1604 | } |
1598 | } | 1605 | } |
1599 | inL = el.next(); | 1606 | inL = el.next(); |
1600 | } | 1607 | } |
1601 | int delFut = 0; | 1608 | int delFut = 0; |
1602 | int remRem = 0; | 1609 | int remRem = 0; |
1603 | if ( mSyncManager->mWriteBackInFuture ) { | 1610 | if ( mSyncManager->mWriteBackInFuture ) { |
1604 | er = remote->rawIncidences(); | 1611 | er = remote->rawIncidences(); |
1605 | remRem = er.count(); | 1612 | remRem = er.count(); |
1606 | inR = er.first(); | 1613 | inR = er.first(); |
1607 | QDateTime dt; | 1614 | QDateTime dt; |
1608 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1615 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1609 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1616 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1610 | while ( inR ) { | 1617 | while ( inR ) { |
1611 | if ( inR->typeID() == todoID ) { | 1618 | if ( inR->typeID() == todoID ) { |
1612 | Todo * t = (Todo*)inR; | 1619 | Todo * t = (Todo*)inR; |
1613 | if ( t->hasDueDate() ) | 1620 | if ( t->hasDueDate() ) |
1614 | dt = t->dtDue(); | 1621 | dt = t->dtDue(); |
1615 | else | 1622 | else |
1616 | dt = cur.addSecs( 62 ); | 1623 | dt = cur.addSecs( 62 ); |
1617 | } | 1624 | } |
1618 | else if (inR->typeID() == eventID ) { | 1625 | else if (inR->typeID() == eventID ) { |
1619 | bool ok; | 1626 | bool ok; |
1620 | dt = inR->getNextOccurence( cur, &ok ); | 1627 | dt = inR->getNextOccurence( cur, &ok ); |
1621 | if ( !ok ) | 1628 | if ( !ok ) |
1622 | dt = cur.addSecs( -62 ); | 1629 | dt = cur.addSecs( -62 ); |
1623 | } | 1630 | } |
1624 | else | 1631 | else |
1625 | dt = inR->dtStart(); | 1632 | dt = inR->dtStart(); |
1626 | if ( dt < cur || dt > end ) { | 1633 | if ( dt < cur || dt > end ) { |
1627 | remote->deleteIncidence( inR ); | 1634 | remote->deleteIncidence( inR ); |
1628 | ++delFut; | 1635 | ++delFut; |
1629 | } | 1636 | } |
1630 | inR = er.next(); | 1637 | inR = er.next(); |
1631 | } | 1638 | } |
1632 | } | 1639 | } |
1633 | bar.hide(); | 1640 | bar.hide(); |
1634 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1641 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1635 | eventLSync->setReadOnly( false ); | 1642 | eventLSync->setReadOnly( false ); |
1636 | eventLSync->setDtStart( mLastCalendarSync ); | 1643 | eventLSync->setDtStart( mLastCalendarSync ); |
1637 | eventRSync->setDtStart( mLastCalendarSync ); | 1644 | eventRSync->setDtStart( mLastCalendarSync ); |
1638 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1645 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1639 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1646 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1640 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1647 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1641 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1648 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1642 | eventLSync->setReadOnly( true ); | 1649 | eventLSync->setReadOnly( true ); |
1643 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1650 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1644 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1651 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1645 | remote->addEvent( eventRSync ); | 1652 | remote->addEvent( eventRSync ); |
1646 | else | 1653 | else |
1647 | delete eventRSync; | 1654 | delete eventRSync; |
1648 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1655 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1649 | QString mes; | 1656 | QString mes; |
1650 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); | 1657 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); |
1651 | QString delmess; | 1658 | QString delmess; |
1652 | if ( delFut ) { | 1659 | if ( delFut ) { |
1653 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1660 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1654 | mes += delmess; | 1661 | mes += delmess; |
1655 | } | 1662 | } |
1656 | mes = i18n("Local calendar changed!\n") +mes; | 1663 | mes = i18n("Local calendar changed!\n") +mes; |
1657 | mCalendar->checkAlarmForIncidence( 0, true ); | 1664 | mCalendar->checkAlarmForIncidence( 0, true ); |
1658 | qDebug( mes ); | 1665 | qDebug( mes ); |
1659 | if ( mSyncManager->mShowSyncSummary ) { | 1666 | if ( mSyncManager->mShowSyncSummary ) { |
1660 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1667 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1661 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1668 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1662 | qDebug("KO: WB cancelled "); | 1669 | qDebug("KO: WB cancelled "); |
1663 | mSyncManager->mWriteBackFile = false; | 1670 | mSyncManager->mWriteBackFile = false; |
1664 | return syncOK; | 1671 | return syncOK; |
1665 | } | 1672 | } |
1666 | } | 1673 | } |
1667 | return syncOK; | 1674 | return syncOK; |
1668 | } | 1675 | } |
1669 | 1676 | ||
1670 | void CalendarView::setSyncDevice( QString s ) | 1677 | void CalendarView::setSyncDevice( QString s ) |
1671 | { | 1678 | { |
1672 | mCurrentSyncDevice= s; | 1679 | mCurrentSyncDevice= s; |
1673 | } | 1680 | } |
1674 | void CalendarView::setSyncName( QString s ) | 1681 | void CalendarView::setSyncName( QString s ) |
1675 | { | 1682 | { |
1676 | mCurrentSyncName= s; | 1683 | mCurrentSyncName= s; |
1677 | } | 1684 | } |
1678 | bool CalendarView::syncCalendar(QString filename, int mode) | 1685 | bool CalendarView::syncCalendar(QString filename, int mode) |
1679 | { | 1686 | { |
1680 | //qDebug("syncCalendar %s ", filename.latin1()); | 1687 | //qDebug("syncCalendar %s ", filename.latin1()); |
1681 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1688 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1682 | CalendarLocal* calendar = new CalendarLocal(); | 1689 | CalendarLocal* calendar = new CalendarLocal(); |
1683 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1690 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1684 | FileStorage* storage = new FileStorage( calendar ); | 1691 | FileStorage* storage = new FileStorage( calendar ); |
1685 | bool syncOK = false; | 1692 | bool syncOK = false; |
1686 | storage->setFileName( filename ); | 1693 | storage->setFileName( filename ); |
1687 | // qDebug("loading ... "); | 1694 | // qDebug("loading ... "); |
1688 | if ( storage->load() ) { | 1695 | if ( storage->load() ) { |
1689 | getEventViewerDialog()->setSyncMode( true ); | 1696 | getEventViewerDialog()->setSyncMode( true ); |
1690 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1697 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1691 | getEventViewerDialog()->setSyncMode( false ); | 1698 | getEventViewerDialog()->setSyncMode( false ); |
1692 | if ( syncOK ) { | 1699 | if ( syncOK ) { |
1693 | if ( mSyncManager->mWriteBackFile ) | 1700 | if ( mSyncManager->mWriteBackFile ) |
1694 | { | 1701 | { |
1695 | storage->setSaveFormat( new ICalFormat() ); | 1702 | storage->setSaveFormat( new ICalFormat() ); |
1696 | storage->save(); | 1703 | storage->save(); |
1697 | } | 1704 | } |
1698 | } | 1705 | } |
1699 | setModified( true ); | 1706 | setModified( true ); |
1700 | } | 1707 | } |
1701 | delete storage; | 1708 | delete storage; |
1702 | delete calendar; | 1709 | delete calendar; |
1703 | if ( syncOK ) | 1710 | if ( syncOK ) |
1704 | updateView(); | 1711 | updateView(); |
1705 | return syncOK; | 1712 | return syncOK; |
1706 | } | 1713 | } |
1707 | 1714 | ||
1708 | void CalendarView::syncExternal( int mode ) | 1715 | void CalendarView::syncExternal( int mode ) |
1709 | { | 1716 | { |
1710 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1717 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1711 | 1718 | ||
1712 | qApp->processEvents(); | 1719 | qApp->processEvents(); |
1713 | CalendarLocal* calendar = new CalendarLocal(); | 1720 | CalendarLocal* calendar = new CalendarLocal(); |
1714 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1721 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1715 | bool syncOK = false; | 1722 | bool syncOK = false; |
1716 | bool loadSuccess = false; | 1723 | bool loadSuccess = false; |
1717 | PhoneFormat* phoneFormat = 0; | 1724 | PhoneFormat* phoneFormat = 0; |
1718 | emit tempDisableBR(true); | 1725 | emit tempDisableBR(true); |
1719 | #ifndef DESKTOP_VERSION | 1726 | #ifndef DESKTOP_VERSION |
1720 | SharpFormat* sharpFormat = 0; | 1727 | SharpFormat* sharpFormat = 0; |
1721 | if ( mode == 0 ) { // sharp | 1728 | if ( mode == 0 ) { // sharp |
1722 | sharpFormat = new SharpFormat () ; | 1729 | sharpFormat = new SharpFormat () ; |
1723 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1730 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1724 | 1731 | ||
1725 | } else | 1732 | } else |
1726 | #endif | 1733 | #endif |
1727 | if ( mode == 1 ) { // phone | 1734 | if ( mode == 1 ) { // phone |
1728 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1735 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1729 | mSyncManager->mPhoneDevice, | 1736 | mSyncManager->mPhoneDevice, |
1730 | mSyncManager->mPhoneConnection, | 1737 | mSyncManager->mPhoneConnection, |
1731 | mSyncManager->mPhoneModel); | 1738 | mSyncManager->mPhoneModel); |
1732 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1739 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1733 | 1740 | ||
1734 | } else { | 1741 | } else { |
1735 | emit tempDisableBR(false); | 1742 | emit tempDisableBR(false); |
1736 | return; | 1743 | return; |
1737 | } | 1744 | } |
1738 | if ( loadSuccess ) { | 1745 | if ( loadSuccess ) { |
1739 | getEventViewerDialog()->setSyncMode( true ); | 1746 | getEventViewerDialog()->setSyncMode( true ); |
1740 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1747 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1741 | getEventViewerDialog()->setSyncMode( false ); | 1748 | getEventViewerDialog()->setSyncMode( false ); |
1742 | qApp->processEvents(); | 1749 | qApp->processEvents(); |
1743 | if ( syncOK ) { | 1750 | if ( syncOK ) { |
1744 | if ( mSyncManager->mWriteBackFile ) | 1751 | if ( mSyncManager->mWriteBackFile ) |
1745 | { | 1752 | { |
1746 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1753 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1747 | Incidence* inc = iL.first(); | 1754 | Incidence* inc = iL.first(); |
1748 | if ( phoneFormat ) { | 1755 | if ( phoneFormat ) { |
1749 | while ( inc ) { | 1756 | while ( inc ) { |
1750 | inc->removeID(mCurrentSyncDevice); | 1757 | inc->removeID(mCurrentSyncDevice); |
1751 | inc = iL.next(); | 1758 | inc = iL.next(); |
1752 | } | 1759 | } |
1753 | } | 1760 | } |
1754 | #ifndef DESKTOP_VERSION | 1761 | #ifndef DESKTOP_VERSION |
1755 | if ( sharpFormat ) | 1762 | if ( sharpFormat ) |
1756 | sharpFormat->save(calendar); | 1763 | sharpFormat->save(calendar); |
1757 | #endif | 1764 | #endif |
1758 | if ( phoneFormat ) | 1765 | if ( phoneFormat ) |
1759 | phoneFormat->save(calendar); | 1766 | phoneFormat->save(calendar); |
1760 | iL = calendar->rawIncidences(); | 1767 | iL = calendar->rawIncidences(); |
1761 | inc = iL.first(); | 1768 | inc = iL.first(); |
1762 | Incidence* loc; | 1769 | Incidence* loc; |
1763 | while ( inc ) { | 1770 | while ( inc ) { |
1764 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1771 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1765 | loc = mCalendar->incidence(inc->uid() ); | 1772 | loc = mCalendar->incidence(inc->uid() ); |
1766 | if ( loc ) { | 1773 | if ( loc ) { |
1767 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1774 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1768 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1775 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1769 | } | 1776 | } |
1770 | } | 1777 | } |
1771 | inc = iL.next(); | 1778 | inc = iL.next(); |
1772 | } | 1779 | } |
1773 | Incidence* lse = getLastSyncEvent(); | 1780 | Incidence* lse = getLastSyncEvent(); |
1774 | if ( lse ) { | 1781 | if ( lse ) { |
1775 | lse->setReadOnly( false ); | 1782 | lse->setReadOnly( false ); |
1776 | lse->setDescription( "" ); | 1783 | lse->setDescription( "" ); |
1777 | lse->setReadOnly( true ); | 1784 | lse->setReadOnly( true ); |
1778 | } | 1785 | } |
1779 | } | 1786 | } |
1780 | } else { | 1787 | } else { |
1781 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1788 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1782 | } | 1789 | } |
1783 | setModified( true ); | 1790 | setModified( true ); |
1784 | } else { | 1791 | } else { |
1785 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1792 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1786 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1793 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1787 | question, i18n("Ok")) ; | 1794 | question, i18n("Ok")) ; |
1788 | 1795 | ||
1789 | } | 1796 | } |
1790 | delete calendar; | 1797 | delete calendar; |
1791 | updateView(); | 1798 | updateView(); |
1792 | emit tempDisableBR(false); | 1799 | emit tempDisableBR(false); |
1793 | return ;//syncOK; | 1800 | return ;//syncOK; |
1794 | 1801 | ||
1795 | } | 1802 | } |
1796 | 1803 | ||
1797 | bool CalendarView::importBday() | 1804 | bool CalendarView::importBday() |
1798 | { | 1805 | { |
1799 | #ifndef KORG_NOKABC | 1806 | #ifndef KORG_NOKABC |
1800 | 1807 | ||
1801 | #ifdef DESKTOP_VERSION | 1808 | #ifdef DESKTOP_VERSION |
1802 | int curCal = mCalendar->defaultCalendar(); | 1809 | int curCal = mCalendar->defaultCalendar(); |
1803 | int bd = mCalEditView->getBirtdayID(); | 1810 | int bd = mCalEditView->getBirtdayID(); |
1804 | if ( bd == 0 ) | 1811 | if ( bd == 0 ) |
1805 | return false; | 1812 | return false; |
1806 | mCalendar->setDefaultCalendar( bd ); | 1813 | mCalendar->setDefaultCalendar( bd ); |
1807 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1814 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1808 | KABC::AddressBook::Iterator it; | 1815 | KABC::AddressBook::Iterator it; |
1809 | int count = 0; | 1816 | int count = 0; |
1810 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1817 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1811 | ++count; | 1818 | ++count; |
1812 | } | 1819 | } |
1813 | QProgressBar bar(count,0 ); | 1820 | QProgressBar bar(count,0 ); |
1814 | int w = 300; | 1821 | int w = 300; |
1815 | if ( QApplication::desktop()->width() < 320 ) | 1822 | if ( QApplication::desktop()->width() < 320 ) |
1816 | w = 220; | 1823 | w = 220; |
1817 | int h = bar.sizeHint().height() ; | 1824 | int h = bar.sizeHint().height() ; |
1818 | int dw = QApplication::desktop()->width(); | 1825 | int dw = QApplication::desktop()->width(); |
1819 | int dh = QApplication::desktop()->height(); | 1826 | int dh = QApplication::desktop()->height(); |
1820 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1827 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1821 | bar.show(); | 1828 | bar.show(); |
1822 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1829 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1823 | qApp->processEvents(); | 1830 | qApp->processEvents(); |
1824 | count = 0; | 1831 | count = 0; |
1825 | int addCount = 0; | 1832 | int addCount = 0; |
1826 | KCal::Attendee* a = 0; | 1833 | KCal::Attendee* a = 0; |
1827 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1834 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1828 | if ( ! bar.isVisible() ) | 1835 | if ( ! bar.isVisible() ) |
1829 | return false; | 1836 | return false; |
1830 | bar.setProgress( count++ ); | 1837 | bar.setProgress( count++ ); |
1831 | qApp->processEvents(); | 1838 | qApp->processEvents(); |
1832 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1839 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1833 | if ( (*it).birthday().date().isValid() ){ | 1840 | if ( (*it).birthday().date().isValid() ){ |
1834 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1841 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1835 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1842 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1836 | ++addCount; | 1843 | ++addCount; |
1837 | } | 1844 | } |
1838 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1845 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1839 | if ( anni.isValid() ){ | 1846 | if ( anni.isValid() ){ |
1840 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1847 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1841 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1848 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1842 | ++addCount; | 1849 | ++addCount; |
1843 | } | 1850 | } |
1844 | } | 1851 | } |
1845 | mCalendar->setDefaultCalendar( curCal ); | 1852 | mCalendar->setDefaultCalendar( curCal ); |
1846 | updateView(); | 1853 | updateView(); |
1847 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1854 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1848 | #else //DESKTOP_VERSION | 1855 | #else //DESKTOP_VERSION |
1849 | 1856 | ||
1850 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1857 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1851 | // the result should now arrive through method insertBirthdays | 1858 | // the result should now arrive through method insertBirthdays |
1852 | 1859 | ||
1853 | #endif //DESKTOP_VERSION | 1860 | #endif //DESKTOP_VERSION |
1854 | 1861 | ||
1855 | #endif //KORG_NOKABC | 1862 | #endif //KORG_NOKABC |
1856 | 1863 | ||
1857 | 1864 | ||
1858 | return true; | 1865 | return true; |
1859 | } | 1866 | } |
1860 | 1867 | ||
1861 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1868 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1862 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1869 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1863 | const QStringList& anniversaryList, const QStringList& realNameList, | 1870 | const QStringList& anniversaryList, const QStringList& realNameList, |
1864 | const QStringList& emailList, const QStringList& assembledNameList, | 1871 | const QStringList& emailList, const QStringList& assembledNameList, |
1865 | const QStringList& uidList) | 1872 | const QStringList& uidList) |
1866 | { | 1873 | { |
1867 | 1874 | ||
1868 | //qDebug("KO::CalendarView::insertBirthdays"); | 1875 | //qDebug("KO::CalendarView::insertBirthdays"); |
1869 | if (uid == this->name()) | 1876 | if (uid == this->name()) |
1870 | { | 1877 | { |
1871 | int curCal = mCalendar->defaultCalendar(); | 1878 | int curCal = mCalendar->defaultCalendar(); |
1872 | int bd = mCalEditView->getBirtdayID(); | 1879 | int bd = mCalEditView->getBirtdayID(); |
1873 | if ( bd == 0 ) | 1880 | if ( bd == 0 ) |
1874 | return; | 1881 | return; |
1875 | mCalendar->setDefaultCalendar( bd ); | 1882 | mCalendar->setDefaultCalendar( bd ); |
1876 | 1883 | ||
1877 | 1884 | ||
1878 | int count = birthdayList.count(); | 1885 | int count = birthdayList.count(); |
1879 | int addCount = 0; | 1886 | int addCount = 0; |
1880 | KCal::Attendee* a = 0; | 1887 | KCal::Attendee* a = 0; |
1881 | 1888 | ||
1882 | //qDebug("CalView 1 %i", count); | 1889 | //qDebug("CalView 1 %i", count); |
1883 | 1890 | ||
1884 | QProgressBar bar(count,0 ); | 1891 | QProgressBar bar(count,0 ); |
1885 | int w = 300; | 1892 | int w = 300; |
1886 | if ( QApplication::desktop()->width() < 320 ) | 1893 | if ( QApplication::desktop()->width() < 320 ) |
1887 | w = 220; | 1894 | w = 220; |
1888 | int h = bar.sizeHint().height() ; | 1895 | int h = bar.sizeHint().height() ; |
1889 | int dw = QApplication::desktop()->width(); | 1896 | int dw = QApplication::desktop()->width(); |
1890 | int dh = QApplication::desktop()->height(); | 1897 | int dh = QApplication::desktop()->height(); |
1891 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1898 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1892 | bar.show(); | 1899 | bar.show(); |
1893 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1900 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1894 | qApp->processEvents(); | 1901 | qApp->processEvents(); |
1895 | 1902 | ||
1896 | QDate birthday; | 1903 | QDate birthday; |
1897 | QDate anniversary; | 1904 | QDate anniversary; |
1898 | QString realName; | 1905 | QString realName; |
1899 | QString email; | 1906 | QString email; |
1900 | QString assembledName; | 1907 | QString assembledName; |
1901 | QString uid; | 1908 | QString uid; |
1902 | bool ok = true; | 1909 | bool ok = true; |
1903 | for ( int i = 0; i < count; i++) | 1910 | for ( int i = 0; i < count; i++) |
1904 | { | 1911 | { |
1905 | if ( ! bar.isVisible() ) | 1912 | if ( ! bar.isVisible() ) |
1906 | return; | 1913 | return; |
1907 | bar.setProgress( i ); | 1914 | bar.setProgress( i ); |
1908 | qApp->processEvents(); | 1915 | qApp->processEvents(); |
1909 | 1916 | ||
1910 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1917 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1911 | if (!ok) { | 1918 | if (!ok) { |
1912 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1919 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1913 | } | 1920 | } |
1914 | 1921 | ||
1915 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1922 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1916 | if (!ok) { | 1923 | if (!ok) { |
1917 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1924 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1918 | } | 1925 | } |
1919 | realName = realNameList[i]; | 1926 | realName = realNameList[i]; |
1920 | email = emailList[i]; | 1927 | email = emailList[i]; |
1921 | assembledName = assembledNameList[i]; | 1928 | assembledName = assembledNameList[i]; |
1922 | uid = uidList[i]; | 1929 | uid = uidList[i]; |
1923 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1930 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1924 | 1931 | ||
1925 | if ( birthday.isValid() ){ | 1932 | if ( birthday.isValid() ){ |
1926 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1933 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1927 | KCal::Attendee::ReqParticipant,uid) ; | 1934 | KCal::Attendee::ReqParticipant,uid) ; |
1928 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1935 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1929 | ++addCount; | 1936 | ++addCount; |
1930 | } | 1937 | } |
1931 | 1938 | ||
1932 | if ( anniversary.isValid() ){ | 1939 | if ( anniversary.isValid() ){ |
1933 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1940 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1934 | KCal::Attendee::ReqParticipant,uid) ; | 1941 | KCal::Attendee::ReqParticipant,uid) ; |
1935 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1942 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1936 | ++addCount; | 1943 | ++addCount; |
1937 | } | 1944 | } |
1938 | } | 1945 | } |
1939 | 1946 | ||
1940 | mCalendar->setDefaultCalendar( curCal ); | 1947 | mCalendar->setDefaultCalendar( curCal ); |
1941 | updateView(); | 1948 | updateView(); |
1942 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1949 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1943 | 1950 | ||
1944 | } | 1951 | } |
1945 | 1952 | ||
1946 | } | 1953 | } |
1947 | 1954 | ||
1948 | 1955 | ||
1949 | 1956 | ||
1950 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1957 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1951 | { | 1958 | { |
1952 | //qDebug("addAnni "); | 1959 | //qDebug("addAnni "); |
1953 | Event * ev = new Event(); | 1960 | Event * ev = new Event(); |
1954 | ev->setOrganizer(KOPrefs::instance()->email()); | 1961 | ev->setOrganizer(KOPrefs::instance()->email()); |
1955 | if ( a ) { | 1962 | if ( a ) { |
1956 | ev->addAttendee( a ); | 1963 | ev->addAttendee( a ); |
1957 | } | 1964 | } |
1958 | QString kind; | 1965 | QString kind; |
1959 | if ( birthday ) { | 1966 | if ( birthday ) { |
1960 | kind = i18n( "Birthday" ); | 1967 | kind = i18n( "Birthday" ); |
1961 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1968 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1962 | } | 1969 | } |
1963 | else { | 1970 | else { |
1964 | kind = i18n( "Anniversary" ); | 1971 | kind = i18n( "Anniversary" ); |
1965 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1972 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1966 | } | 1973 | } |
1967 | ev->setCategories( kind ); | 1974 | ev->setCategories( kind ); |
1968 | ev->setDtStart( QDateTime(date) ); | 1975 | ev->setDtStart( QDateTime(date) ); |
1969 | ev->setDtEnd( QDateTime(date) ); | 1976 | ev->setDtEnd( QDateTime(date) ); |
1970 | ev->setFloats( true ); | 1977 | ev->setFloats( true ); |
1971 | Recurrence * rec = ev->recurrence(); | 1978 | Recurrence * rec = ev->recurrence(); |
1972 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1979 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1973 | rec->addYearlyNum( date.month() ); | 1980 | rec->addYearlyNum( date.month() ); |
1974 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1981 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1975 | delete ev; | 1982 | delete ev; |
1976 | return false; | 1983 | return false; |
1977 | } | 1984 | } |
1978 | return true; | 1985 | return true; |
1979 | 1986 | ||
1980 | } | 1987 | } |
1981 | bool CalendarView::importQtopia( const QString &categories, | 1988 | bool CalendarView::importQtopia( const QString &categories, |
1982 | const QString &datebook, | 1989 | const QString &datebook, |
1983 | const QString &todolist ) | 1990 | const QString &todolist ) |
1984 | { | 1991 | { |
1985 | 1992 | ||
1986 | QtopiaFormat qtopiaFormat; | 1993 | QtopiaFormat qtopiaFormat; |
1987 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1994 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1988 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1995 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1989 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1996 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1990 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1997 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1991 | 1998 | ||
1992 | updateView(); | 1999 | updateView(); |
1993 | return true; | 2000 | return true; |
1994 | 2001 | ||
1995 | #if 0 | 2002 | #if 0 |
1996 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 2003 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1997 | mCurrentSyncDevice = "qtopia-XML"; | 2004 | mCurrentSyncDevice = "qtopia-XML"; |
1998 | if ( mSyncManager->mAskForPreferences ) | 2005 | if ( mSyncManager->mAskForPreferences ) |
1999 | edit_sync_options(); | 2006 | edit_sync_options(); |
2000 | qApp->processEvents(); | 2007 | qApp->processEvents(); |
2001 | CalendarLocal* calendar = new CalendarLocal(); | 2008 | CalendarLocal* calendar = new CalendarLocal(); |
2002 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2009 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2003 | bool syncOK = false; | 2010 | bool syncOK = false; |
2004 | QtopiaFormat qtopiaFormat; | 2011 | QtopiaFormat qtopiaFormat; |
2005 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 2012 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
2006 | bool loadOk = true; | 2013 | bool loadOk = true; |
2007 | if ( !categories.isEmpty() ) | 2014 | if ( !categories.isEmpty() ) |
2008 | loadOk = qtopiaFormat.load( calendar, categories ); | 2015 | loadOk = qtopiaFormat.load( calendar, categories ); |
2009 | if ( loadOk && !datebook.isEmpty() ) | 2016 | if ( loadOk && !datebook.isEmpty() ) |
2010 | loadOk = qtopiaFormat.load( calendar, datebook ); | 2017 | loadOk = qtopiaFormat.load( calendar, datebook ); |
2011 | if ( loadOk && !todolist.isEmpty() ) | 2018 | if ( loadOk && !todolist.isEmpty() ) |
2012 | loadOk = qtopiaFormat.load( calendar, todolist ); | 2019 | loadOk = qtopiaFormat.load( calendar, todolist ); |
2013 | 2020 | ||
2014 | if ( loadOk ) { | 2021 | if ( loadOk ) { |
2015 | getEventViewerDialog()->setSyncMode( true ); | 2022 | getEventViewerDialog()->setSyncMode( true ); |
2016 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 2023 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
2017 | getEventViewerDialog()->setSyncMode( false ); | 2024 | getEventViewerDialog()->setSyncMode( false ); |
2018 | qApp->processEvents(); | 2025 | qApp->processEvents(); |
2019 | if ( syncOK ) { | 2026 | if ( syncOK ) { |
2020 | if ( mSyncManager->mWriteBackFile ) | 2027 | if ( mSyncManager->mWriteBackFile ) |
2021 | { | 2028 | { |
2022 | // write back XML file | 2029 | // write back XML file |
2023 | 2030 | ||
2024 | } | 2031 | } |
2025 | setModified( true ); | 2032 | setModified( true ); |
2026 | } | 2033 | } |
2027 | } else { | 2034 | } else { |
2028 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 2035 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
2029 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 2036 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
2030 | question, i18n("Ok")) ; | 2037 | question, i18n("Ok")) ; |
2031 | } | 2038 | } |
2032 | delete calendar; | 2039 | delete calendar; |
2033 | updateView(); | 2040 | updateView(); |
2034 | return syncOK; | 2041 | return syncOK; |
2035 | 2042 | ||
2036 | 2043 | ||
2037 | #endif | 2044 | #endif |
2038 | 2045 | ||
2039 | } | 2046 | } |
2040 | 2047 | ||
2041 | void CalendarView::setSyncEventsReadOnly() | 2048 | void CalendarView::setSyncEventsReadOnly() |
2042 | { | 2049 | { |
2043 | mCalendar->setSyncEventsReadOnly(); | 2050 | mCalendar->setSyncEventsReadOnly(); |
2044 | } | 2051 | } |
2045 | 2052 | ||
2046 | bool CalendarView::loadCalendars() | 2053 | bool CalendarView::loadCalendars() |
2047 | { | 2054 | { |
2048 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2055 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2049 | KopiCalendarFile * cal = calendars.first(); | 2056 | KopiCalendarFile * cal = calendars.first(); |
2050 | mCalendar->setDefaultCalendar( 1 ); | 2057 | mCalendar->setDefaultCalendar( 1 ); |
2051 | openCalendar( MainWindow::defaultFileName(), false ); | 2058 | openCalendar( MainWindow::defaultFileName(), false ); |
2052 | cal = calendars.next(); | 2059 | cal = calendars.next(); |
2053 | while ( cal ) { | 2060 | while ( cal ) { |
2054 | addCalendar( cal ); | 2061 | addCalendar( cal ); |
2055 | cal = calendars.next(); | 2062 | cal = calendars.next(); |
2056 | } | 2063 | } |
2057 | restoreCalendarSettings(); | 2064 | restoreCalendarSettings(); |
2058 | return true; | 2065 | return true; |
2059 | } | 2066 | } |
2060 | bool CalendarView::restoreCalendarSettings() | 2067 | bool CalendarView::restoreCalendarSettings() |
2061 | { | 2068 | { |
2062 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 2069 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
2063 | KopiCalendarFile * cal = calendars.first(); | 2070 | KopiCalendarFile * cal = calendars.first(); |
2064 | while ( cal ) { | 2071 | while ( cal ) { |
2065 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 2072 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
2066 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 2073 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
2067 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 2074 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
2068 | if ( cal->isStandard ) | 2075 | if ( cal->isStandard ) |
2069 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 2076 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
2070 | cal = calendars.next(); | 2077 | cal = calendars.next(); |
2071 | } | 2078 | } |
2072 | setSyncEventsReadOnly(); | 2079 | setSyncEventsReadOnly(); |
2073 | mCalendar->reInitAlarmSettings(); | 2080 | mCalendar->reInitAlarmSettings(); |
2074 | updateUnmanagedViews(); | 2081 | updateUnmanagedViews(); |
2075 | updateView(); | 2082 | updateView(); |
2076 | return true; | 2083 | return true; |
2077 | } | 2084 | } |
2078 | void CalendarView::addCalendarId( int id ) | 2085 | void CalendarView::addCalendarId( int id ) |
2079 | { | 2086 | { |
2080 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); | 2087 | KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); |
2081 | if ( cal ) | 2088 | if ( cal ) |
2082 | addCalendar( cal ); | 2089 | addCalendar( cal ); |
2083 | } | 2090 | } |
2084 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) | 2091 | bool CalendarView::addCalendar( KopiCalendarFile * cal ) |
2085 | { | 2092 | { |
2086 | cal->mErrorOnLoad = false; | 2093 | cal->mErrorOnLoad = false; |
2087 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { | 2094 | if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { |
2088 | cal->mLoadDt = QDateTime::currentDateTime(); | 2095 | cal->mLoadDt = QDateTime::currentDateTime(); |
2089 | return true; | 2096 | return true; |
2090 | } | 2097 | } |
2091 | qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); | 2098 | qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() ); |
2092 | cal->mErrorOnLoad = true; | 2099 | cal->mErrorOnLoad = true; |
2093 | return false; | 2100 | return false; |
2094 | } | 2101 | } |
2095 | bool CalendarView::openCalendar(QString filename, bool merge) | 2102 | bool CalendarView::openCalendar(QString filename, bool merge) |
2096 | { | 2103 | { |
2097 | 2104 | ||
2098 | if (filename.isEmpty()) { | 2105 | if (filename.isEmpty()) { |
2099 | return false; | 2106 | return false; |
2100 | } | 2107 | } |
2101 | 2108 | ||
2102 | if (!QFile::exists(filename)) { | 2109 | if (!QFile::exists(filename)) { |
2103 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 2110 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
2104 | return false; | 2111 | return false; |
2105 | } | 2112 | } |
2106 | 2113 | ||
2107 | globalFlagBlockAgenda = 1; | 2114 | globalFlagBlockAgenda = 1; |
2108 | clearAllViews(); | 2115 | clearAllViews(); |
2109 | if (!merge) { | 2116 | if (!merge) { |
2110 | mViewManager->setDocumentId( filename ); | 2117 | mViewManager->setDocumentId( filename ); |
2111 | mCalendar->close(); | 2118 | mCalendar->close(); |
2112 | } | 2119 | } |
2113 | mStorage->setFileName( filename ); | 2120 | mStorage->setFileName( filename ); |
2114 | 2121 | ||
2115 | if ( mStorage->load() ) { | 2122 | if ( mStorage->load() ) { |
2116 | if ( merge ) ;//setModified( true ); | 2123 | if ( merge ) ;//setModified( true ); |
2117 | else { | 2124 | else { |
2118 | //setModified( true ); | 2125 | //setModified( true ); |
2119 | mViewManager->setDocumentId( filename ); | 2126 | mViewManager->setDocumentId( filename ); |
2120 | mDialogManager->setDocumentId( filename ); | 2127 | mDialogManager->setDocumentId( filename ); |
2121 | mTodoList->setDocumentId( filename ); | 2128 | mTodoList->setDocumentId( filename ); |
2122 | } | 2129 | } |
2123 | globalFlagBlockAgenda = 2; | 2130 | globalFlagBlockAgenda = 2; |
2124 | // if ( getLastSyncEvent() ) | 2131 | // if ( getLastSyncEvent() ) |
2125 | // getLastSyncEvent()->setReadOnly( true ); | 2132 | // getLastSyncEvent()->setReadOnly( true ); |
2126 | mCalendar->reInitAlarmSettings(); | 2133 | mCalendar->reInitAlarmSettings(); |
2127 | setSyncEventsReadOnly(); | 2134 | setSyncEventsReadOnly(); |
2128 | updateUnmanagedViews(); | 2135 | updateUnmanagedViews(); |
2129 | updateView(); | 2136 | updateView(); |
2130 | if ( filename != MainWindow::defaultFileName() ) { | 2137 | if ( filename != MainWindow::defaultFileName() ) { |
2131 | saveCalendar( MainWindow::defaultFileName() ); | 2138 | saveCalendar( MainWindow::defaultFileName() ); |
2132 | } else { | 2139 | } else { |
2133 | QFileInfo finf ( MainWindow::defaultFileName()); | 2140 | QFileInfo finf ( MainWindow::defaultFileName()); |
2134 | if ( finf.exists() ) { | 2141 | if ( finf.exists() ) { |
2135 | setLoadedFileVersion( finf.lastModified () ); | 2142 | setLoadedFileVersion( finf.lastModified () ); |
2136 | } | 2143 | } |
2137 | } | 2144 | } |
2138 | return true; | 2145 | return true; |
2139 | } else { | 2146 | } else { |
2140 | // while failing to load, the calendar object could | 2147 | // while failing to load, the calendar object could |
2141 | // have become partially populated. Clear it out. | 2148 | // have become partially populated. Clear it out. |
2142 | if ( !merge ) { | 2149 | if ( !merge ) { |
2143 | mCalendar->close(); | 2150 | mCalendar->close(); |
2144 | mViewManager->setDocumentId( filename ); | 2151 | mViewManager->setDocumentId( filename ); |
2145 | mDialogManager->setDocumentId( filename ); | 2152 | mDialogManager->setDocumentId( filename ); |
2146 | mTodoList->setDocumentId( filename ); | 2153 | mTodoList->setDocumentId( filename ); |
2147 | } | 2154 | } |
2148 | 2155 | ||
2149 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 2156 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
2150 | 2157 | ||
2151 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 2158 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
2152 | globalFlagBlockAgenda = 2; | 2159 | globalFlagBlockAgenda = 2; |
2153 | mCalendar->reInitAlarmSettings(); | 2160 | mCalendar->reInitAlarmSettings(); |
2154 | setSyncEventsReadOnly(); | 2161 | setSyncEventsReadOnly(); |
2155 | updateUnmanagedViews(); | 2162 | updateUnmanagedViews(); |
2156 | updateView(); | 2163 | updateView(); |
2157 | } | 2164 | } |
2158 | return false; | 2165 | return false; |
2159 | } | 2166 | } |
2160 | void CalendarView::mergeFile( QString fn ) | 2167 | void CalendarView::mergeFile( QString fn ) |
2161 | { | 2168 | { |
2162 | clearAllViews(); | 2169 | clearAllViews(); |
2163 | mCalendar->mergeCalendarFile( fn ); | 2170 | mCalendar->mergeCalendarFile( fn ); |
2164 | mCalendar->reInitAlarmSettings(); | 2171 | mCalendar->reInitAlarmSettings(); |
2165 | setSyncEventsReadOnly(); | 2172 | setSyncEventsReadOnly(); |
2166 | updateUnmanagedViews(); | 2173 | updateUnmanagedViews(); |
2167 | updateView(); | 2174 | updateView(); |
2168 | } | 2175 | } |
2169 | void CalendarView::showOpenError() | 2176 | void CalendarView::showOpenError() |
2170 | { | 2177 | { |
2171 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 2178 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
2172 | } | 2179 | } |
2173 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 2180 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
2174 | { | 2181 | { |
2175 | loadedFileVersion = dt; | 2182 | loadedFileVersion = dt; |
2176 | } | 2183 | } |
2177 | bool CalendarView::checkFileChanged(QString fn) | 2184 | bool CalendarView::checkFileChanged(QString fn) |
2178 | { | 2185 | { |
2179 | QFileInfo finf ( fn ); | 2186 | QFileInfo finf ( fn ); |
2180 | if ( !finf.exists() ) | 2187 | if ( !finf.exists() ) |
2181 | return true; | 2188 | return true; |
2182 | QDateTime dt = finf.lastModified (); | 2189 | QDateTime dt = finf.lastModified (); |
2183 | if ( dt <= loadedFileVersion ) | 2190 | if ( dt <= loadedFileVersion ) |
2184 | return false; | 2191 | return false; |
2185 | return true; | 2192 | return true; |
2186 | 2193 | ||
2187 | } | 2194 | } |
2188 | void CalendarView::watchSavedFile() | 2195 | void CalendarView::watchSavedFile() |
2189 | { | 2196 | { |
2190 | QFileInfo finf ( MainWindow::defaultFileName()); | 2197 | QFileInfo finf ( MainWindow::defaultFileName()); |
2191 | if ( !finf.exists() ) | 2198 | if ( !finf.exists() ) |
2192 | return; | 2199 | return; |
2193 | QDateTime dt = finf.lastModified (); | 2200 | QDateTime dt = finf.lastModified (); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 799c297..456c2d7 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -1,667 +1,668 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 | 3 | Copyright (c) 2000, 2001 |
4 | Cornelius Schumacher <schumacher@kde.org> | 4 | Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef CALENDARVIEW_H | 24 | #ifndef CALENDARVIEW_H |
25 | #define CALENDARVIEW_H | 25 | #define CALENDARVIEW_H |
26 | 26 | ||
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qptrlist.h> | 30 | #include <qptrlist.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qmap.h> | 32 | #include <qmap.h> |
33 | #include <qscrollbar.h> | 33 | #include <qscrollbar.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qtopia/ir.h> | 35 | #include <qtopia/ir.h> |
36 | #else | 36 | #else |
37 | #define Ir char | 37 | #define Ir char |
38 | #endif | 38 | #endif |
39 | #include <libkcal/calendar.h> | 39 | #include <libkcal/calendar.h> |
40 | #include <libkcal/scheduler.h> | 40 | #include <libkcal/scheduler.h> |
41 | #include <libkcal/calendarresources.h> | 41 | #include <libkcal/calendarresources.h> |
42 | #include <libkcal/resourcecalendar.h> | 42 | #include <libkcal/resourcecalendar.h> |
43 | #include <KDGanttMinimizeSplitter.h> | 43 | #include <KDGanttMinimizeSplitter.h> |
44 | 44 | ||
45 | #include <korganizer/calendarviewbase.h> | 45 | #include <korganizer/calendarviewbase.h> |
46 | 46 | ||
47 | #include <ksyncmanager.h> | 47 | #include <ksyncmanager.h> |
48 | //#include <koprefs.h> | 48 | //#include <koprefs.h> |
49 | 49 | ||
50 | class QWidgetStack; | 50 | class QWidgetStack; |
51 | class QSplitter; | 51 | class QSplitter; |
52 | class KopiCalendarFile; | 52 | class KopiCalendarFile; |
53 | class CalPrinter; | 53 | class CalPrinter; |
54 | class KOFilterView; | 54 | class KOFilterView; |
55 | class KOCalEditView; | 55 | class KOCalEditView; |
56 | class KOViewManager; | 56 | class KOViewManager; |
57 | class KODialogManager; | 57 | class KODialogManager; |
58 | class KOTodoView; | 58 | class KOTodoView; |
59 | class KDateNavigator; | 59 | class KDateNavigator; |
60 | class DateNavigatorContainer; | 60 | class DateNavigatorContainer; |
61 | class DateNavigator; | 61 | class DateNavigator; |
62 | class KOIncidenceEditor; | 62 | class KOIncidenceEditor; |
63 | class KDatePicker; | 63 | class KDatePicker; |
64 | class ResourceView; | 64 | class ResourceView; |
65 | class KOEventEditor; | 65 | class KOEventEditor; |
66 | class KOTodoEditor ; | 66 | class KOTodoEditor ; |
67 | class KOEventViewerDialog; | 67 | class KOEventViewerDialog; |
68 | class KOBeamPrefs; | 68 | class KOBeamPrefs; |
69 | class KSyncProfile; | 69 | class KSyncProfile; |
70 | class AlarmDialog; | 70 | class AlarmDialog; |
71 | class KCal::Attendee; | 71 | class KCal::Attendee; |
72 | 72 | ||
73 | namespace KCal { class FileStorage; } | 73 | namespace KCal { class FileStorage; } |
74 | 74 | ||
75 | using namespace KCal; | 75 | using namespace KCal; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | This is the main calendar widget. It provides the different vies on t he | 78 | This is the main calendar widget. It provides the different vies on t he |
79 | calendar data as well as the date navigator. It also handles synchronisation | 79 | calendar data as well as the date navigator. It also handles synchronisation |
80 | of the different views and controls the different dialogs like preferences, | 80 | of the different views and controls the different dialogs like preferences, |
81 | event editor, search dialog etc. | 81 | event editor, search dialog etc. |
82 | 82 | ||
83 | @short main calendar view widget | 83 | @short main calendar view widget |
84 | @author Cornelius Schumacher | 84 | @author Cornelius Schumacher |
85 | */ | 85 | */ |
86 | 86 | ||
87 | #include <qtextbrowser.h> | 87 | #include <qtextbrowser.h> |
88 | #include <qtextcodec.h> | 88 | #include <qtextcodec.h> |
89 | 89 | ||
90 | class MissedAlarmTextBrowser : public QTextBrowser { | 90 | class MissedAlarmTextBrowser : public QTextBrowser { |
91 | Q_OBJECT | 91 | Q_OBJECT |
92 | public: | 92 | public: |
93 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); | 93 | MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); |
94 | ~MissedAlarmTextBrowser(); | 94 | ~MissedAlarmTextBrowser(); |
95 | void setSource(const QString & n); | 95 | void setSource(const QString & n); |
96 | 96 | ||
97 | private: | 97 | private: |
98 | Incidence * getNextInc(QDateTime start ); | 98 | Incidence * getNextInc(QDateTime start ); |
99 | QPtrList<Incidence> mAlarms; | 99 | QPtrList<Incidence> mAlarms; |
100 | signals: | 100 | signals: |
101 | void showIncidence( QString uid); | 101 | void showIncidence( QString uid); |
102 | }; | 102 | }; |
103 | 103 | ||
104 | 104 | ||
105 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface | 105 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface |
106 | { | 106 | { |
107 | Q_OBJECT | 107 | Q_OBJECT |
108 | public: | 108 | public: |
109 | /** | 109 | /** |
110 | Constructs a new calendar view widget. | 110 | Constructs a new calendar view widget. |
111 | 111 | ||
112 | @param calendar calendar document | 112 | @param calendar calendar document |
113 | @param parent parent window | 113 | @param parent parent window |
114 | @param name Qt internal widget object name | 114 | @param name Qt internal widget object name |
115 | */ | 115 | */ |
116 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 116 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
117 | const char *name = 0 ); | 117 | const char *name = 0 ); |
118 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 118 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
119 | const char *name = 0 ); | 119 | const char *name = 0 ); |
120 | virtual ~CalendarView(); | 120 | virtual ~CalendarView(); |
121 | 121 | ||
122 | Calendar *calendar() { return mCalendar; } | 122 | Calendar *calendar() { return mCalendar; } |
123 | 123 | ||
124 | KOViewManager *viewManager(); | 124 | KOViewManager *viewManager(); |
125 | KODialogManager *dialogManager(); | 125 | KODialogManager *dialogManager(); |
126 | 126 | ||
127 | QDate startDate(); | 127 | QDate startDate(); |
128 | QDate endDate(); | 128 | QDate endDate(); |
129 | 129 | ||
130 | QWidgetStack *viewStack(); | 130 | QWidgetStack *viewStack(); |
131 | QWidget *leftFrame(); | 131 | QWidget *leftFrame(); |
132 | 132 | ||
133 | DateNavigator *dateNavigator(); | 133 | DateNavigator *dateNavigator(); |
134 | KDateNavigator *dateNavigatorWidget(); | 134 | KDateNavigator *dateNavigatorWidget(); |
135 | 135 | ||
136 | void addView(KOrg::BaseView *); | 136 | void addView(KOrg::BaseView *); |
137 | void showView(KOrg::BaseView *); | 137 | void showView(KOrg::BaseView *); |
138 | KOEventViewerDialog* getEventViewerDialog(); | 138 | KOEventViewerDialog* getEventViewerDialog(); |
139 | Incidence *currentSelection(); | 139 | Incidence *currentSelection(); |
140 | void checkSuspendAlarm(); | 140 | void checkSuspendAlarm(); |
141 | void mergeFile( QString fn ); | 141 | void mergeFile( QString fn ); |
142 | 142 | ||
143 | signals: | 143 | signals: |
144 | void save (); | 144 | void save (); |
145 | void saveStopTimer (); | 145 | void saveStopTimer (); |
146 | void tempDisableBR(bool); | 146 | void tempDisableBR(bool); |
147 | /** This todo has been modified */ | 147 | /** This todo has been modified */ |
148 | void todoModified(Todo *, int); | 148 | void todoModified(Todo *, int); |
149 | 149 | ||
150 | /** when change is made to options dialog, the topwidget will catch this | 150 | /** when change is made to options dialog, the topwidget will catch this |
151 | * and emit this signal which notifies all widgets which have registered | 151 | * and emit this signal which notifies all widgets which have registered |
152 | * for notification to update their settings. */ | 152 | * for notification to update their settings. */ |
153 | void configChanged(); | 153 | void configChanged(); |
154 | /** emitted when the topwidget is closing down, so that any attached | 154 | /** emitted when the topwidget is closing down, so that any attached |
155 | child windows can also close. */ | 155 | child windows can also close. */ |
156 | void closingDown(); | 156 | void closingDown(); |
157 | /** emitted right before we die */ | 157 | /** emitted right before we die */ |
158 | void closed(QWidget *); | 158 | void closed(QWidget *); |
159 | 159 | ||
160 | /** Emitted when state of modified flag changes */ | 160 | /** Emitted when state of modified flag changes */ |
161 | void modifiedChanged(bool); | 161 | void modifiedChanged(bool); |
162 | void signalmodified(); | 162 | void signalmodified(); |
163 | 163 | ||
164 | /** Emitted when state of read-only flag changes */ | 164 | /** Emitted when state of read-only flag changes */ |
165 | void readOnlyChanged(bool); | 165 | void readOnlyChanged(bool); |
166 | 166 | ||
167 | /** Emitted when the unit of navigation changes */ | 167 | /** Emitted when the unit of navigation changes */ |
168 | void changeNavStringPrev(const QString &); | 168 | void changeNavStringPrev(const QString &); |
169 | void changeNavStringNext(const QString &); | 169 | void changeNavStringNext(const QString &); |
170 | 170 | ||
171 | /** Emitted when state of events selection has changed and user is organizer*/ | 171 | /** Emitted when state of events selection has changed and user is organizer*/ |
172 | void organizerEventsSelected(bool); | 172 | void organizerEventsSelected(bool); |
173 | /** Emitted when state of events selection has changed and user is attendee*/ | 173 | /** Emitted when state of events selection has changed and user is attendee*/ |
174 | void groupEventsSelected(bool); | 174 | void groupEventsSelected(bool); |
175 | /** | 175 | /** |
176 | Emitted when an incidence gets selected. If the selection is cleared the | 176 | Emitted when an incidence gets selected. If the selection is cleared the |
177 | signal is emitted with 0 as argument. | 177 | signal is emitted with 0 as argument. |
178 | */ | 178 | */ |
179 | void incidenceSelected( Incidence * ); | 179 | void incidenceSelected( Incidence * ); |
180 | /** Emitted, when a todoitem is selected or deselected. */ | 180 | /** Emitted, when a todoitem is selected or deselected. */ |
181 | void todoSelected( bool ); | 181 | void todoSelected( bool ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | Emitted, when clipboard content changes. Parameter indicates if paste | 184 | Emitted, when clipboard content changes. Parameter indicates if paste |
185 | is possible or not. | 185 | is possible or not. |
186 | */ | 186 | */ |
187 | void pasteEnabled(bool); | 187 | void pasteEnabled(bool); |
188 | 188 | ||
189 | /** Emitted, when the number of incoming messages has changed. */ | 189 | /** Emitted, when the number of incoming messages has changed. */ |
190 | void numIncomingChanged(int); | 190 | void numIncomingChanged(int); |
191 | 191 | ||
192 | /** Emitted, when the number of outgoing messages has changed. */ | 192 | /** Emitted, when the number of outgoing messages has changed. */ |
193 | void numOutgoingChanged(int); | 193 | void numOutgoingChanged(int); |
194 | 194 | ||
195 | /** Send status message, which can e.g. be displayed in the status bar. */ | 195 | /** Send status message, which can e.g. be displayed in the status bar. */ |
196 | void statusMessage(const QString &); | 196 | void statusMessage(const QString &); |
197 | 197 | ||
198 | void calendarViewExpanded( bool ); | 198 | void calendarViewExpanded( bool ); |
199 | void updateSearchDialog(); | 199 | void updateSearchDialog(); |
200 | void filtersUpdated(); | 200 | void filtersUpdated(); |
201 | 201 | ||
202 | 202 | ||
203 | public slots: | 203 | public slots: |
204 | void slotResetFocus(); | ||
204 | void nextConflict( bool all, bool allday ); | 205 | void nextConflict( bool all, bool allday ); |
205 | void conflictAll(); | 206 | void conflictAll(); |
206 | void conflictAllday(); | 207 | void conflictAllday(); |
207 | void conflictNotAll(); | 208 | void conflictNotAll(); |
208 | void setCalReadOnly( int id, bool readO ); | 209 | void setCalReadOnly( int id, bool readO ); |
209 | void checkAlarms(); | 210 | void checkAlarms(); |
210 | void checkFiles(); | 211 | void checkFiles(); |
211 | void slotprintSelInc(); | 212 | void slotprintSelInc(); |
212 | void showNextAlarms(); | 213 | void showNextAlarms(); |
213 | void showOpenError(); | 214 | void showOpenError(); |
214 | void watchSavedFile(); | 215 | void watchSavedFile(); |
215 | void recheckTimerAlarm(); | 216 | void recheckTimerAlarm(); |
216 | void checkNextTimerAlarm(); | 217 | void checkNextTimerAlarm(); |
217 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 218 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
218 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 219 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
219 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 220 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
220 | 221 | ||
221 | /** options dialog made a changed to the configuration. we catch this | 222 | /** options dialog made a changed to the configuration. we catch this |
222 | * and notify all widgets which need to update their configuration. */ | 223 | * and notify all widgets which need to update their configuration. */ |
223 | void updateConfig(); | 224 | void updateConfig(); |
224 | 225 | ||
225 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, | 226 | void insertBirthdays(const QString& uid, const QStringList& birthdayList, |
226 | const QStringList& anniversaryList, const QStringList& realNameList, | 227 | const QStringList& anniversaryList, const QStringList& realNameList, |
227 | const QStringList& emailList, const QStringList& assembledNameList, | 228 | const QStringList& emailList, const QStringList& assembledNameList, |
228 | const QStringList& uidList); | 229 | const QStringList& uidList); |
229 | 230 | ||
230 | /** | 231 | /** |
231 | Load calendar from file \a filename. If \a merge is true, load | 232 | Load calendar from file \a filename. If \a merge is true, load |
232 | calendar into existing one, if it is false, clear calendar, before | 233 | calendar into existing one, if it is false, clear calendar, before |
233 | loading. Return true, if calendar could be successfully loaded. | 234 | loading. Return true, if calendar could be successfully loaded. |
234 | */ | 235 | */ |
235 | bool openCalendar(QString filename, bool merge=false); | 236 | bool openCalendar(QString filename, bool merge=false); |
236 | bool loadCalendars(); | 237 | bool loadCalendars(); |
237 | bool saveCalendars(); | 238 | bool saveCalendars(); |
238 | bool restoreCalendarSettings(); | 239 | bool restoreCalendarSettings(); |
239 | bool addCalendar( KopiCalendarFile * ); | 240 | bool addCalendar( KopiCalendarFile * ); |
240 | void addCalendarId( int id ); | 241 | void addCalendarId( int id ); |
241 | bool syncCalendar(QString filename,int mode = 0 ); | 242 | bool syncCalendar(QString filename,int mode = 0 ); |
242 | 243 | ||
243 | /** | 244 | /** |
244 | Save calendar data to file. Return true if calendar could be | 245 | Save calendar data to file. Return true if calendar could be |
245 | successfully saved. | 246 | successfully saved. |
246 | */ | 247 | */ |
247 | bool saveCalendar(QString filename); | 248 | bool saveCalendar(QString filename); |
248 | 249 | ||
249 | /** | 250 | /** |
250 | Close calendar. Clear calendar data and reset views to display an empty | 251 | Close calendar. Clear calendar data and reset views to display an empty |
251 | calendar. | 252 | calendar. |
252 | */ | 253 | */ |
253 | void closeCalendar(); | 254 | void closeCalendar(); |
254 | 255 | ||
255 | /** Archive old events of calendar */ | 256 | /** Archive old events of calendar */ |
256 | void archiveCalendar(); | 257 | void archiveCalendar(); |
257 | 258 | ||
258 | void showIncidence(); | 259 | void showIncidence(); |
259 | void editIncidence(); | 260 | void editIncidence(); |
260 | void editIncidenceDescription(); | 261 | void editIncidenceDescription(); |
261 | void deleteIncidence(); | 262 | void deleteIncidence(); |
262 | void cloneIncidence(); | 263 | void cloneIncidence(); |
263 | void moveIncidence(); | 264 | void moveIncidence(); |
264 | void beamIncidence(); | 265 | void beamIncidence(); |
265 | void toggleCancelIncidence(); | 266 | void toggleCancelIncidence(); |
266 | 267 | ||
267 | /** create an editeventwin with supplied date/time, and if bool is true, | 268 | /** create an editeventwin with supplied date/time, and if bool is true, |
268 | * make the event take all day. */ | 269 | * make the event take all day. */ |
269 | void newEvent(QDateTime, QDateTime, bool allDay ); | 270 | void newEvent(QDateTime, QDateTime, bool allDay ); |
270 | void newEvent(QDateTime, QDateTime); | 271 | void newEvent(QDateTime, QDateTime); |
271 | void newEvent(QDateTime fh); | 272 | void newEvent(QDateTime fh); |
272 | void newEvent(QDate dt); | 273 | void newEvent(QDate dt); |
273 | /** create new event without having a date hint. Takes current date as | 274 | /** create new event without having a date hint. Takes current date as |
274 | default hint. */ | 275 | default hint. */ |
275 | void newEvent(); | 276 | void newEvent(); |
276 | void newFloatingEvent(); | 277 | void newFloatingEvent(); |
277 | 278 | ||
278 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 279 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
279 | void showIncidence(Incidence *); | 280 | void showIncidence(Incidence *); |
280 | void showIncidence(QString uid); | 281 | void showIncidence(QString uid); |
281 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 282 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
282 | void editIncidence(Incidence *); | 283 | void editIncidence(Incidence *); |
283 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 284 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
284 | void deleteIncidence(Incidence *); | 285 | void deleteIncidence(Incidence *); |
285 | void cloneIncidence(Incidence *); | 286 | void cloneIncidence(Incidence *); |
286 | void cancelIncidence(Incidence *); | 287 | void cancelIncidence(Incidence *); |
287 | /** Create an editor for the supplied event. */ | 288 | /** Create an editor for the supplied event. */ |
288 | void editEvent(Event *); | 289 | void editEvent(Event *); |
289 | /** Delete the supplied event. */ | 290 | /** Delete the supplied event. */ |
290 | void deleteEvent(Event *); | 291 | void deleteEvent(Event *); |
291 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 292 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
292 | found. */ | 293 | found. */ |
293 | bool deleteEvent(const QString &uid); | 294 | bool deleteEvent(const QString &uid); |
294 | /** Create a read-only viewer dialog for the supplied event. */ | 295 | /** Create a read-only viewer dialog for the supplied event. */ |
295 | void showEvent(Event *); | 296 | void showEvent(Event *); |
296 | 297 | ||
297 | void editJournal(Journal *); | 298 | void editJournal(Journal *); |
298 | void showJournal(Journal *); | 299 | void showJournal(Journal *); |
299 | void deleteJournal(Journal *); | 300 | void deleteJournal(Journal *); |
300 | /** Create an editor dialog for a todo */ | 301 | /** Create an editor dialog for a todo */ |
301 | void editTodo(Todo *); | 302 | void editTodo(Todo *); |
302 | /** Create a read-only viewer dialog for the supplied todo */ | 303 | /** Create a read-only viewer dialog for the supplied todo */ |
303 | void showTodo(Todo *); | 304 | void showTodo(Todo *); |
304 | /** create new todo */ | 305 | /** create new todo */ |
305 | void newTodo(); | 306 | void newTodo(); |
306 | void newTodoDateTime(QDateTime, bool allday); | 307 | void newTodoDateTime(QDateTime, bool allday); |
307 | /** create new todo with a parent todo */ | 308 | /** create new todo with a parent todo */ |
308 | void newSubTodo(); | 309 | void newSubTodo(); |
309 | /** create new todo with a parent todo */ | 310 | /** create new todo with a parent todo */ |
310 | void newSubTodo(Todo *); | 311 | void newSubTodo(Todo *); |
311 | /** Delete todo */ | 312 | /** Delete todo */ |
312 | void deleteTodo(Todo *); | 313 | void deleteTodo(Todo *); |
313 | 314 | ||
314 | 315 | ||
315 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 316 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
316 | * emitted as result. */ | 317 | * emitted as result. */ |
317 | void checkClipboard(); | 318 | void checkClipboard(); |
318 | 319 | ||
319 | /** using the KConfig associated with the kapp variable, read in the | 320 | /** using the KConfig associated with the kapp variable, read in the |
320 | * settings from the config file. | 321 | * settings from the config file. |
321 | */ | 322 | */ |
322 | void readSettings(); | 323 | void readSettings(); |
323 | 324 | ||
324 | /** write current state to config file. */ | 325 | /** write current state to config file. */ |
325 | void writeSettings(); | 326 | void writeSettings(); |
326 | 327 | ||
327 | /** read settings for calendar filters */ | 328 | /** read settings for calendar filters */ |
328 | void readFilterSettings(KConfig *config); | 329 | void readFilterSettings(KConfig *config); |
329 | 330 | ||
330 | /** write settings for calendar filters */ | 331 | /** write settings for calendar filters */ |
331 | void writeFilterSettings(KConfig *config); | 332 | void writeFilterSettings(KConfig *config); |
332 | 333 | ||
333 | /** passes on the message that an event has changed to the currently | 334 | /** passes on the message that an event has changed to the currently |
334 | * activated view so that it can make appropriate display changes. */ | 335 | * activated view so that it can make appropriate display changes. */ |
335 | void changeEventDisplay(Event *, int); | 336 | void changeEventDisplay(Event *, int); |
336 | void changeIncidenceDisplay(Incidence *, int); | 337 | void changeIncidenceDisplay(Incidence *, int); |
337 | void changeTodoDisplay(Todo *, int); | 338 | void changeTodoDisplay(Todo *, int); |
338 | 339 | ||
339 | void eventAdded(Event *); | 340 | void eventAdded(Event *); |
340 | void eventChanged(Event *); | 341 | void eventChanged(Event *); |
341 | void eventToBeDeleted(Event *); | 342 | void eventToBeDeleted(Event *); |
342 | void eventDeleted(); | 343 | void eventDeleted(); |
343 | 344 | ||
344 | void todoAdded(Todo *); | 345 | void todoAdded(Todo *); |
345 | void todoChanged(Todo *); | 346 | void todoChanged(Todo *); |
346 | void todoToBeDeleted(Todo *); | 347 | void todoToBeDeleted(Todo *); |
347 | void todoDeleted(); | 348 | void todoDeleted(); |
348 | 349 | ||
349 | void updateView(const QDate &start, const QDate &end); | 350 | void updateView(const QDate &start, const QDate &end); |
350 | void updateView(); | 351 | void updateView(); |
351 | void clearAllViews(); | 352 | void clearAllViews(); |
352 | 353 | ||
353 | /** Full update of visible todo views */ | 354 | /** Full update of visible todo views */ |
354 | void updateTodoViews(); | 355 | void updateTodoViews(); |
355 | 356 | ||
356 | void updateUnmanagedViews(); | 357 | void updateUnmanagedViews(); |
357 | 358 | ||
358 | /** cut the current appointment to the clipboard */ | 359 | /** cut the current appointment to the clipboard */ |
359 | void edit_cut(); | 360 | void edit_cut(); |
360 | 361 | ||
361 | /** copy the current appointment(s) to the clipboard */ | 362 | /** copy the current appointment(s) to the clipboard */ |
362 | void edit_copy(); | 363 | void edit_copy(); |
363 | 364 | ||
364 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 365 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
365 | void edit_paste(); | 366 | void edit_paste(); |
366 | 367 | ||
367 | /** edit viewing and configuration options. */ | 368 | /** edit viewing and configuration options. */ |
368 | void edit_options(); | 369 | void edit_options(); |
369 | void edit_global_options(); | 370 | void edit_global_options(); |
370 | /** | 371 | /** |
371 | Functions for printing, previewing a print, and setting up printing | 372 | Functions for printing, previewing a print, and setting up printing |
372 | parameters. | 373 | parameters. |
373 | */ | 374 | */ |
374 | void print(); | 375 | void print(); |
375 | void printSetup(); | 376 | void printSetup(); |
376 | void printPreview(); | 377 | void printPreview(); |
377 | 378 | ||
378 | /** Export as iCalendar file */ | 379 | /** Export as iCalendar file */ |
379 | void exportICalendar(); | 380 | void exportICalendar(); |
380 | 381 | ||
381 | /** Export as vCalendar file */ | 382 | /** Export as vCalendar file */ |
382 | bool exportVCalendar( QString fn); | 383 | bool exportVCalendar( QString fn); |
383 | 384 | ||
384 | /** pop up a dialog to show an existing appointment. */ | 385 | /** pop up a dialog to show an existing appointment. */ |
385 | void appointment_show(); | 386 | void appointment_show(); |
386 | /** | 387 | /** |
387 | * pop up an Appointment Dialog to edit an existing appointment.Get | 388 | * pop up an Appointment Dialog to edit an existing appointment.Get |
388 | * information on the appointment from the list of unique IDs that is | 389 | * information on the appointment from the list of unique IDs that is |
389 | * currently in the View, called currIds. | 390 | * currently in the View, called currIds. |
390 | */ | 391 | */ |
391 | void appointment_edit(); | 392 | void appointment_edit(); |
392 | /** | 393 | /** |
393 | * pop up dialog confirming deletion of currently selected event in the | 394 | * pop up dialog confirming deletion of currently selected event in the |
394 | * View. | 395 | * View. |
395 | */ | 396 | */ |
396 | void appointment_delete(); | 397 | void appointment_delete(); |
397 | 398 | ||
398 | /** mails the currently selected event to a particular user as a vCalendar | 399 | /** mails the currently selected event to a particular user as a vCalendar |
399 | attachment. */ | 400 | attachment. */ |
400 | void action_mail(); | 401 | void action_mail(); |
401 | 402 | ||
402 | /* frees a subtodo from it's relation */ | 403 | /* frees a subtodo from it's relation */ |
403 | void todo_unsub( Todo * ); | 404 | void todo_unsub( Todo * ); |
404 | void todo_resub( Todo * parent, Todo * sub ); | 405 | void todo_resub( Todo * parent, Todo * sub ); |
405 | 406 | ||
406 | /** Take ownership of selected event. */ | 407 | /** Take ownership of selected event. */ |
407 | void takeOverEvent(); | 408 | void takeOverEvent(); |
408 | 409 | ||
409 | /** Take ownership of all events in calendar. */ | 410 | /** Take ownership of all events in calendar. */ |
410 | void takeOverCalendar(); | 411 | void takeOverCalendar(); |
411 | 412 | ||
412 | /** query whether or not the calendar is "dirty". */ | 413 | /** query whether or not the calendar is "dirty". */ |
413 | bool isModified(); | 414 | bool isModified(); |
414 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 415 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
415 | void setModified(bool modified=true); | 416 | void setModified(bool modified=true); |
416 | 417 | ||
417 | /** query if the calendar is read-only. */ | 418 | /** query if the calendar is read-only. */ |
418 | bool isReadOnly(); | 419 | bool isReadOnly(); |
419 | /** set state of calendar to read-only */ | 420 | /** set state of calendar to read-only */ |
420 | void setReadOnly(bool readOnly=true); | 421 | void setReadOnly(bool readOnly=true); |
421 | 422 | ||
422 | void eventUpdated(Incidence *); | 423 | void eventUpdated(Incidence *); |
423 | 424 | ||
424 | /* iTIP scheduling actions */ | 425 | /* iTIP scheduling actions */ |
425 | void schedule_publish(Incidence *incidence = 0); | 426 | void schedule_publish(Incidence *incidence = 0); |
426 | void schedule_request(Incidence *incidence = 0); | 427 | void schedule_request(Incidence *incidence = 0); |
427 | void schedule_refresh(Incidence *incidence = 0); | 428 | void schedule_refresh(Incidence *incidence = 0); |
428 | void schedule_cancel(Incidence *incidence = 0); | 429 | void schedule_cancel(Incidence *incidence = 0); |
429 | void schedule_add(Incidence *incidence = 0); | 430 | void schedule_add(Incidence *incidence = 0); |
430 | void schedule_reply(Incidence *incidence = 0); | 431 | void schedule_reply(Incidence *incidence = 0); |
431 | void schedule_counter(Incidence *incidence = 0); | 432 | void schedule_counter(Incidence *incidence = 0); |
432 | void schedule_declinecounter(Incidence *incidence = 0); | 433 | void schedule_declinecounter(Incidence *incidence = 0); |
433 | void schedule_publish_freebusy(int daysToPublish = 30); | 434 | void schedule_publish_freebusy(int daysToPublish = 30); |
434 | 435 | ||
435 | void openAddressbook(); | 436 | void openAddressbook(); |
436 | 437 | ||
437 | void editFilters(); | 438 | void editFilters(); |
438 | void toggleFilerEnabled(); | 439 | void toggleFilerEnabled(); |
439 | QPtrList<CalFilter> filters(); | 440 | QPtrList<CalFilter> filters(); |
440 | void toggleFilter(); | 441 | void toggleFilter(); |
441 | void showFilter(bool visible); | 442 | void showFilter(bool visible); |
442 | void updateFilter(); | 443 | void updateFilter(); |
443 | void filterEdited(); | 444 | void filterEdited(); |
444 | void selectFilter( int ); | 445 | void selectFilter( int ); |
445 | KOFilterView *filterView(); | 446 | KOFilterView *filterView(); |
446 | 447 | ||
447 | void showIntro(); | 448 | void showIntro(); |
448 | 449 | ||
449 | /** Move the curdatepient view date to today */ | 450 | /** Move the curdatepient view date to today */ |
450 | void goToday(); | 451 | void goToday(); |
451 | 452 | ||
452 | /** Move to the next date(s) in the current view */ | 453 | /** Move to the next date(s) in the current view */ |
453 | void goNext(); | 454 | void goNext(); |
454 | 455 | ||
455 | /** Move to the previous date(s) in the current view */ | 456 | /** Move to the previous date(s) in the current view */ |
456 | void goPrevious(); | 457 | void goPrevious(); |
457 | /** Move to the next date(s) in the current view */ | 458 | /** Move to the next date(s) in the current view */ |
458 | void goNextMonth(); | 459 | void goNextMonth(); |
459 | 460 | ||
460 | /** Move to the previous date(s) in the current view */ | 461 | /** Move to the previous date(s) in the current view */ |
461 | void goPreviousMonth(); | 462 | void goPreviousMonth(); |
462 | 463 | ||
463 | void toggleExpand(); | 464 | void toggleExpand(); |
464 | void toggleDateNavigatorWidget(); | 465 | void toggleDateNavigatorWidget(); |
465 | void toggleAllDaySize(); | 466 | void toggleAllDaySize(); |
466 | 467 | ||
467 | /** Look for new messages in the inbox */ | 468 | /** Look for new messages in the inbox */ |
468 | void lookForIncomingMessages(); | 469 | void lookForIncomingMessages(); |
469 | /** Look for new messages in the outbox */ | 470 | /** Look for new messages in the outbox */ |
470 | void lookForOutgoingMessages(); | 471 | void lookForOutgoingMessages(); |
471 | 472 | ||
472 | void processMainViewSelection( Incidence * ); | 473 | void processMainViewSelection( Incidence * ); |
473 | void processTodoListSelection( Incidence * ); | 474 | void processTodoListSelection( Incidence * ); |
474 | 475 | ||
475 | void processIncidenceSelection( Incidence * ); | 476 | void processIncidenceSelection( Incidence * ); |
476 | 477 | ||
477 | void purgeCompleted(); | 478 | void purgeCompleted(); |
478 | bool removeCompletedSubTodos( Todo* ); | 479 | bool removeCompletedSubTodos( Todo* ); |
479 | void slotCalendarChanged(); | 480 | void slotCalendarChanged(); |
480 | bool importBday(); | 481 | bool importBday(); |
481 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 482 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
482 | bool importQtopia( const QString &categoriesFile, | 483 | bool importQtopia( const QString &categoriesFile, |
483 | const QString &datebookFile, | 484 | const QString &datebookFile, |
484 | const QString &tasklistFile ); | 485 | const QString &tasklistFile ); |
485 | void syncExternal( int mode ); | 486 | void syncExternal( int mode ); |
486 | void slotSelectPickerDate( QDate ) ; | 487 | void slotSelectPickerDate( QDate ) ; |
487 | void showDatePicker() ; | 488 | void showDatePicker() ; |
488 | void showDatePickerPopup() ; | 489 | void showDatePickerPopup() ; |
489 | void moveIncidence(Incidence *) ; | 490 | void moveIncidence(Incidence *) ; |
490 | void beamIncidence(Incidence *) ; | 491 | void beamIncidence(Incidence *) ; |
491 | void beamCalendar() ; | 492 | void beamCalendar() ; |
492 | void beamFilteredCalendar() ; | 493 | void beamFilteredCalendar() ; |
493 | void beamIncidenceList(QPtrList<Incidence>) ; | 494 | void beamIncidenceList(QPtrList<Incidence>) ; |
494 | void manageCategories(); | 495 | void manageCategories(); |
495 | void editCategories(); | 496 | void editCategories(); |
496 | int addCategories(); | 497 | int addCategories(); |
497 | void removeCategories(); | 498 | void removeCategories(); |
498 | void setSyncDevice( QString ); | 499 | void setSyncDevice( QString ); |
499 | void setSyncName( QString ); | 500 | void setSyncName( QString ); |
500 | void showDay( QDate ); | 501 | void showDay( QDate ); |
501 | void undo_delete(); | 502 | void undo_delete(); |
502 | protected slots: | 503 | protected slots: |
503 | void resetFocus(); | 504 | void resetFocus(); |
504 | void scrollBarValue(int); | 505 | void scrollBarValue(int); |
505 | void slotViewerClosed(); | 506 | void slotViewerClosed(); |
506 | void timerAlarm(); | 507 | void timerAlarm(); |
507 | void suspendAlarm(); | 508 | void suspendAlarm(); |
508 | void beamDone( Ir *ir ); | 509 | void beamDone( Ir *ir ); |
509 | /** Select a view or adapt the current view to display the specified dates. */ | 510 | /** Select a view or adapt the current view to display the specified dates. */ |
510 | void showDates( const KCal::DateList & ); | 511 | void showDates( const KCal::DateList & ); |
511 | void selectWeekNum ( int ); | 512 | void selectWeekNum ( int ); |
512 | void checkConflictForEvent(); | 513 | void checkConflictForEvent(); |
513 | 514 | ||
514 | public: | 515 | public: |
515 | // show a standard warning | 516 | // show a standard warning |
516 | // returns KMsgBox::yesNoCancel() | 517 | // returns KMsgBox::yesNoCancel() |
517 | int msgCalModified(); | 518 | int msgCalModified(); |
518 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 519 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
519 | 520 | ||
520 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 521 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
521 | virtual void removeSyncInfo( QString syncProfile); | 522 | virtual void removeSyncInfo( QString syncProfile); |
522 | void setSyncManager(KSyncManager* manager); | 523 | void setSyncManager(KSyncManager* manager); |
523 | void setLoadedFileVersion(QDateTime); | 524 | void setLoadedFileVersion(QDateTime); |
524 | bool checkFileVersion(QString fn); | 525 | bool checkFileVersion(QString fn); |
525 | bool checkAllFileVersions(); | 526 | bool checkAllFileVersions(); |
526 | bool checkFileChanged(QString fn); | 527 | bool checkFileChanged(QString fn); |
527 | Event* getLastSyncEvent(); | 528 | Event* getLastSyncEvent(); |
528 | /** Adapt navigation units correpsonding to step size of navigation of the | 529 | /** Adapt navigation units correpsonding to step size of navigation of the |
529 | * current view. | 530 | * current view. |
530 | */ | 531 | */ |
531 | void adaptNavigationUnits(); | 532 | void adaptNavigationUnits(); |
532 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 533 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
533 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 534 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
534 | //Attendee* getYourAttendee(Event *event); | 535 | //Attendee* getYourAttendee(Event *event); |
535 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 536 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
536 | void setScrollBarStep(int val ); | 537 | void setScrollBarStep(int val ); |
537 | 538 | ||
538 | protected: | 539 | protected: |
539 | Event *mConflictingEvent; | 540 | Event *mConflictingEvent; |
540 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 541 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
541 | 542 | ||
542 | // returns KMsgBox::OKCandel() | 543 | // returns KMsgBox::OKCandel() |
543 | int msgItemDelete(const QString name); | 544 | int msgItemDelete(const QString name); |
544 | void showEventEditor(); | 545 | void showEventEditor(); |
545 | void showTodoEditor(); | 546 | void showTodoEditor(); |
546 | Todo *selectedTodo(); | 547 | Todo *selectedTodo(); |
547 | private: | 548 | private: |
548 | #ifdef DESKTOP_VERSION | 549 | #ifdef DESKTOP_VERSION |
549 | QScrollBar * mDateScrollBar; | 550 | QScrollBar * mDateScrollBar; |
550 | #endif | 551 | #endif |
551 | QDateTime mNextAlarmDateTime; | 552 | QDateTime mNextAlarmDateTime; |
552 | bool mViewerCallerIsSearchDialog; | 553 | bool mViewerCallerIsSearchDialog; |
553 | bool mBlockShowDates; | 554 | bool mBlockShowDates; |
554 | KSyncManager* mSyncManager; | 555 | KSyncManager* mSyncManager; |
555 | AlarmDialog * mAlarmDialog; | 556 | AlarmDialog * mAlarmDialog; |
556 | QString mAlarmNotification; | 557 | QString mAlarmNotification; |
557 | QString mSuspendAlarmNotification; | 558 | QString mSuspendAlarmNotification; |
558 | QTimer* mSuspendTimer; | 559 | QTimer* mSuspendTimer; |
559 | QTimer* mAlarmTimer; | 560 | QTimer* mAlarmTimer; |
560 | QTimer* mRecheckAlarmTimer; | 561 | QTimer* mRecheckAlarmTimer; |
561 | void computeAlarm( QString ); | 562 | void computeAlarm( QString ); |
562 | void startAlarm( QString, QString ); | 563 | void startAlarm( QString, QString ); |
563 | void setSyncEventsReadOnly(); | 564 | void setSyncEventsReadOnly(); |
564 | 565 | ||
565 | QDateTime loadedFileVersion; | 566 | QDateTime loadedFileVersion; |
566 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 567 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
567 | void checkExternalId( Incidence * inc ); | 568 | void checkExternalId( Incidence * inc ); |
568 | int mGlobalSyncMode; | 569 | int mGlobalSyncMode; |
569 | QString mCurrentSyncDevice; | 570 | QString mCurrentSyncDevice; |
570 | QString mCurrentSyncName; | 571 | QString mCurrentSyncName; |
571 | void init(); | 572 | void init(); |
572 | int mDatePickerMode; | 573 | int mDatePickerMode; |
573 | bool mFlagEditDescription; | 574 | bool mFlagEditDescription; |
574 | QDateTime mLastCalendarSync; | 575 | QDateTime mLastCalendarSync; |
575 | void createPrinter(); | 576 | void createPrinter(); |
576 | 577 | ||
577 | void calendarModified( bool, Calendar * ); | 578 | void calendarModified( bool, Calendar * ); |
578 | 579 | ||
579 | CalPrinter *mCalPrinter; | 580 | CalPrinter *mCalPrinter; |
580 | 581 | ||
581 | QSplitter *mPanner; | 582 | QSplitter *mPanner; |
582 | QSplitter *mLeftSplitter; | 583 | QSplitter *mLeftSplitter; |
583 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; | 584 | KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; |
584 | QWidgetStack *mRightFrame; | 585 | QWidgetStack *mRightFrame; |
585 | 586 | ||
586 | KDatePicker* mDatePicker; | 587 | KDatePicker* mDatePicker; |
587 | QVBox* mDateFrame; | 588 | QVBox* mDateFrame; |
588 | 589 | ||
589 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. | 590 | DateNavigatorContainer *mDateNavigator; // widget showing small month view. |
590 | 591 | ||
591 | KOFilterView *mFilterView; | 592 | KOFilterView *mFilterView; |
592 | KOCalEditView *mCalEditView; | 593 | KOCalEditView *mCalEditView; |
593 | 594 | ||
594 | ResourceView *mResourceView; | 595 | ResourceView *mResourceView; |
595 | 596 | ||
596 | // calendar object for this viewing instance | 597 | // calendar object for this viewing instance |
597 | Calendar *mCalendar; | 598 | Calendar *mCalendar; |
598 | 599 | ||
599 | CalendarResourceManager *mResourceManager; | 600 | CalendarResourceManager *mResourceManager; |
600 | 601 | ||
601 | FileStorage *mStorage; | 602 | FileStorage *mStorage; |
602 | 603 | ||
603 | DateNavigator *mNavigator; | 604 | DateNavigator *mNavigator; |
604 | 605 | ||
605 | KOViewManager *mViewManager; | 606 | KOViewManager *mViewManager; |
606 | KODialogManager *mDialogManager; | 607 | KODialogManager *mDialogManager; |
607 | 608 | ||
608 | // Calendar filters | 609 | // Calendar filters |
609 | QPtrList<CalFilter> mFilters; | 610 | QPtrList<CalFilter> mFilters; |
610 | 611 | ||
611 | // various housekeeping variables. | 612 | // various housekeeping variables. |
612 | bool mModified; // flag indicating if calendar is modified | 613 | bool mModified; // flag indicating if calendar is modified |
613 | bool mReadOnly; // flag indicating if calendar is read-only | 614 | bool mReadOnly; // flag indicating if calendar is read-only |
614 | QDate mSaveSingleDate; | 615 | QDate mSaveSingleDate; |
615 | 616 | ||
616 | Incidence *mSelectedIncidence; | 617 | Incidence *mSelectedIncidence; |
617 | Incidence *mMoveIncidence; | 618 | Incidence *mMoveIncidence; |
618 | QDate mMoveIncidenceOldDate; | 619 | QDate mMoveIncidenceOldDate; |
619 | KOTodoView *mTodoList; | 620 | KOTodoView *mTodoList; |
620 | KOEventEditor * mEventEditor; | 621 | KOEventEditor * mEventEditor; |
621 | KOTodoEditor * mTodoEditor; | 622 | KOTodoEditor * mTodoEditor; |
622 | KOEventViewerDialog * mEventViewerDialog; | 623 | KOEventViewerDialog * mEventViewerDialog; |
623 | void keyPressEvent ( QKeyEvent *e) ; | 624 | void keyPressEvent ( QKeyEvent *e) ; |
624 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 625 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
625 | }; | 626 | }; |
626 | 627 | ||
627 | 628 | ||
628 | class CalendarViewVisitor : public Incidence::Visitor | 629 | class CalendarViewVisitor : public Incidence::Visitor |
629 | { | 630 | { |
630 | public: | 631 | public: |
631 | CalendarViewVisitor() : mView( 0 ) {} | 632 | CalendarViewVisitor() : mView( 0 ) {} |
632 | 633 | ||
633 | bool act( Incidence *incidence, CalendarView *view ) | 634 | bool act( Incidence *incidence, CalendarView *view ) |
634 | { | 635 | { |
635 | mView = view; | 636 | mView = view; |
636 | return incidence->accept( *this ); | 637 | return incidence->accept( *this ); |
637 | } | 638 | } |
638 | 639 | ||
639 | protected: | 640 | protected: |
640 | CalendarView *mView; | 641 | CalendarView *mView; |
641 | }; | 642 | }; |
642 | 643 | ||
643 | class ShowIncidenceVisitor : public CalendarViewVisitor | 644 | class ShowIncidenceVisitor : public CalendarViewVisitor |
644 | { | 645 | { |
645 | protected: | 646 | protected: |
646 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 647 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
647 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 648 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
648 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 649 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
649 | }; | 650 | }; |
650 | 651 | ||
651 | class EditIncidenceVisitor : public CalendarViewVisitor | 652 | class EditIncidenceVisitor : public CalendarViewVisitor |
652 | { | 653 | { |
653 | protected: | 654 | protected: |
654 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 655 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
655 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 656 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
656 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 657 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
657 | }; | 658 | }; |
658 | 659 | ||
659 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 660 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
660 | { | 661 | { |
661 | protected: | 662 | protected: |
662 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 663 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
663 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 664 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
664 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 665 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
665 | }; | 666 | }; |
666 | 667 | ||
667 | #endif | 668 | #endif |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 779f12e..0dd5ef5 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -102,2164 +102,2167 @@ int MarcusBains::todayColumn() | |||
102 | ++col; | 102 | ++col; |
103 | } | 103 | } |
104 | 104 | ||
105 | return -1; | 105 | return -1; |
106 | } | 106 | } |
107 | void MarcusBains::updateLoc() | 107 | void MarcusBains::updateLoc() |
108 | { | 108 | { |
109 | updateLocation(); | 109 | updateLocation(); |
110 | } | 110 | } |
111 | void MarcusBains::updateLocation(bool recalculate) | 111 | void MarcusBains::updateLocation(bool recalculate) |
112 | { | 112 | { |
113 | 113 | ||
114 | QTime tim = QTime::currentTime(); | 114 | QTime tim = QTime::currentTime(); |
115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
116 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 116 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
117 | recalculate = true; | 117 | recalculate = true; |
118 | 118 | ||
119 | int mins = tim.hour()*60 + tim.minute(); | 119 | int mins = tim.hour()*60 + tim.minute(); |
120 | int minutesPerCell = 24 * 60 / agenda->rows(); | 120 | int minutesPerCell = 24 * 60 / agenda->rows(); |
121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
122 | int today = recalculate ? todayColumn() : oldToday; | 122 | int today = recalculate ? todayColumn() : oldToday; |
123 | int x = agenda->gridSpacingX()*today; | 123 | int x = agenda->gridSpacingX()*today; |
124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
125 | 125 | ||
126 | oldTime = tim; | 126 | oldTime = tim; |
127 | oldToday = today; | 127 | oldToday = today; |
128 | 128 | ||
129 | if(disabled || (today<0)) { | 129 | if(disabled || (today<0)) { |
130 | hide(); mTimeBox->hide(); | 130 | hide(); mTimeBox->hide(); |
131 | return; | 131 | return; |
132 | } else { | 132 | } else { |
133 | show(); mTimeBox->show(); | 133 | show(); mTimeBox->show(); |
134 | } | 134 | } |
135 | 135 | ||
136 | if(recalculate) | 136 | if(recalculate) |
137 | setFixedSize(agenda->gridSpacingX(),1); | 137 | setFixedSize(agenda->gridSpacingX(),1); |
138 | agenda->moveChild(this, x, y); | 138 | agenda->moveChild(this, x, y); |
139 | raise(); | 139 | raise(); |
140 | 140 | ||
141 | if(recalculate) | 141 | if(recalculate) |
142 | //mTimeBox->setFont(QFont("helvetica",10)); | 142 | //mTimeBox->setFont(QFont("helvetica",10)); |
143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
144 | 144 | ||
145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
146 | mTimeBox->adjustSize(); | 146 | mTimeBox->adjustSize(); |
147 | // the -2 below is there because there is a bug in this program | 147 | // the -2 below is there because there is a bug in this program |
148 | // somewhere, where the last column of this widget is a few pixels | 148 | // somewhere, where the last column of this widget is a few pixels |
149 | // narrower than the other columns. | 149 | // narrower than the other columns. |
150 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 150 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
151 | agenda->moveChild(mTimeBox, | 151 | agenda->moveChild(mTimeBox, |
152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
153 | y-mTimeBox->height()); | 153 | y-mTimeBox->height()); |
154 | mTimeBox->raise(); | 154 | mTimeBox->raise(); |
155 | //mTimeBox->setAutoMask(true); | 155 | //mTimeBox->setAutoMask(true); |
156 | int secs = QTime::currentTime().second(); | 156 | int secs = QTime::currentTime().second(); |
157 | minutes->start( (60 - secs +1)*1000 ,true); | 157 | minutes->start( (60 - secs +1)*1000 ,true); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | //////////////////////////////////////////////////////////////////////////// | 161 | //////////////////////////////////////////////////////////////////////////// |
162 | 162 | ||
163 | 163 | ||
164 | /* | 164 | /* |
165 | Create an agenda widget with rows rows and columns columns. | 165 | Create an agenda widget with rows rows and columns columns. |
166 | */ | 166 | */ |
167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
168 | const char *name,WFlags f) : | 168 | const char *name,WFlags f) : |
169 | QScrollView(parent,name,f) | 169 | QScrollView(parent,name,f) |
170 | { | 170 | { |
171 | 171 | ||
172 | mAllAgendaPopup = 0; | 172 | mAllAgendaPopup = 0; |
173 | mColumns = columns; | 173 | mColumns = columns; |
174 | mRows = rows; | 174 | mRows = rows; |
175 | mGridSpacingY = rowSize; | 175 | mGridSpacingY = rowSize; |
176 | mAllDayMode = false; | 176 | mAllDayMode = false; |
177 | #ifndef DESKTOP_VERSION | 177 | #ifndef DESKTOP_VERSION |
178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
179 | #endif | 179 | #endif |
180 | mHolidayMask = 0; | 180 | mHolidayMask = 0; |
181 | init(); | 181 | init(); |
182 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); | 182 | connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) ); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
186 | Create an agenda widget with columns columns and one row. This is used for | 186 | Create an agenda widget with columns columns and one row. This is used for |
187 | all-day events. | 187 | all-day events. |
188 | */ | 188 | */ |
189 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 189 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
190 | QScrollView(parent,name,f) | 190 | QScrollView(parent,name,f) |
191 | { | 191 | { |
192 | mAllAgendaPopup = 0; | 192 | mAllAgendaPopup = 0; |
193 | blockResize = false; | 193 | blockResize = false; |
194 | mColumns = columns; | 194 | mColumns = columns; |
195 | mRows = 1; | 195 | mRows = 1; |
196 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 196 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
197 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 197 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
198 | mAllDayMode = true; | 198 | mAllDayMode = true; |
199 | #ifndef DESKTOP_VERSION | 199 | #ifndef DESKTOP_VERSION |
200 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 200 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
201 | #endif | 201 | #endif |
202 | mHolidayMask = 0; | 202 | mHolidayMask = 0; |
203 | init(); | 203 | init(); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | KOAgenda::~KOAgenda() | 207 | KOAgenda::~KOAgenda() |
208 | { | 208 | { |
209 | if(mMarcusBains) delete mMarcusBains; | 209 | if(mMarcusBains) delete mMarcusBains; |
210 | 210 | ||
211 | } | 211 | } |
212 | 212 | ||
213 | Incidence *KOAgenda::selectedIncidence() const | 213 | Incidence *KOAgenda::selectedIncidence() const |
214 | { | 214 | { |
215 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 215 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | QDate KOAgenda::selectedIncidenceDate() const | 219 | QDate KOAgenda::selectedIncidenceDate() const |
220 | { | 220 | { |
221 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 221 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | void KOAgenda::init() | 225 | void KOAgenda::init() |
226 | { | 226 | { |
227 | mPopupTimer = new QTimer(this); | 227 | mPopupTimer = new QTimer(this); |
228 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 228 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
229 | 229 | ||
230 | mNewItemPopup = new QPopupMenu( this ); | 230 | mNewItemPopup = new QPopupMenu( this ); |
231 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 231 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
232 | QString pathString = ""; | 232 | QString pathString = ""; |
233 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 233 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
234 | if ( QApplication::desktop()->width() < 480 ) | 234 | if ( QApplication::desktop()->width() < 480 ) |
235 | pathString += "icons16/"; | 235 | pathString += "icons16/"; |
236 | } else | 236 | } else |
237 | pathString += "iconsmini/"; | 237 | pathString += "iconsmini/"; |
238 | 238 | ||
239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); | 240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); |
241 | mNewItemPopup->insertSeparator ( ); | 241 | mNewItemPopup->insertSeparator ( ); |
242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); | 243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); |
244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); | 244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); |
245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); | 245 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); |
246 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); | 246 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 ); |
247 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 247 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
248 | #ifndef _WIN32_ | 248 | #ifndef _WIN32_ |
249 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 249 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
250 | viewport()->setWFlags ( wflags); | 250 | viewport()->setWFlags ( wflags); |
251 | #endif | 251 | #endif |
252 | mGridSpacingX = 80; | 252 | mGridSpacingX = 80; |
253 | mResizeBorderWidth = 8; | 253 | mResizeBorderWidth = 8; |
254 | mScrollBorderWidth = 8; | 254 | mScrollBorderWidth = 8; |
255 | mScrollDelay = 30; | 255 | mScrollDelay = 30; |
256 | mScrollOffset = 10; | 256 | mScrollOffset = 10; |
257 | mPaintPixmap.resize( 20,20); | 257 | mPaintPixmap.resize( 20,20); |
258 | //enableClipper(true); | 258 | //enableClipper(true); |
259 | 259 | ||
260 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 260 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
261 | // effect. Has to be fixed. | 261 | // effect. Has to be fixed. |
262 | setFocusPolicy(WheelFocus); | 262 | setFocusPolicy(WheelFocus); |
263 | 263 | ||
264 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 264 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
265 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 265 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
266 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 266 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
267 | 267 | ||
268 | mStartCellX = 0; | 268 | mStartCellX = 0; |
269 | mStartCellY = 0; | 269 | mStartCellY = 0; |
270 | mCurrentCellX = 0; | 270 | mCurrentCellX = 0; |
271 | mCurrentCellY = 0; | 271 | mCurrentCellY = 0; |
272 | 272 | ||
273 | mSelectionCellX = 0; | 273 | mSelectionCellX = 0; |
274 | mSelectionYTop = 0; | 274 | mSelectionYTop = 0; |
275 | mSelectionHeight = 0; | 275 | mSelectionHeight = 0; |
276 | 276 | ||
277 | mOldLowerScrollValue = -1; | 277 | mOldLowerScrollValue = -1; |
278 | mOldUpperScrollValue = -1; | 278 | mOldUpperScrollValue = -1; |
279 | 279 | ||
280 | mClickedItem = 0; | 280 | mClickedItem = 0; |
281 | 281 | ||
282 | mActionItem = 0; | 282 | mActionItem = 0; |
283 | mActionType = NOP; | 283 | mActionType = NOP; |
284 | mItemMoved = false; | 284 | mItemMoved = false; |
285 | 285 | ||
286 | mSelectedItem = 0; | 286 | mSelectedItem = 0; |
287 | 287 | ||
288 | // mItems.setAutoDelete(true); | 288 | // mItems.setAutoDelete(true); |
289 | 289 | ||
290 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 290 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
291 | 291 | ||
292 | viewport()->update(); | 292 | viewport()->update(); |
293 | 293 | ||
294 | setMinimumSize(30, 1); | 294 | setMinimumSize(30, 1); |
295 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 295 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
296 | 296 | ||
297 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 297 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
298 | // controlled in a way that the contents horizontally always fits. Then it is | 298 | // controlled in a way that the contents horizontally always fits. Then it is |
299 | // not necessary to turn off the scrollbar. | 299 | // not necessary to turn off the scrollbar. |
300 | setHScrollBarMode(AlwaysOff); | 300 | setHScrollBarMode(AlwaysOff); |
301 | if ( ! mAllDayMode ) | 301 | if ( ! mAllDayMode ) |
302 | setVScrollBarMode(AlwaysOn); | 302 | setVScrollBarMode(AlwaysOn); |
303 | else | 303 | else |
304 | setVScrollBarMode(AlwaysOff); | 304 | setVScrollBarMode(AlwaysOff); |
305 | 305 | ||
306 | setStartHour(KOPrefs::instance()->mDayBegins); | 306 | setStartHour(KOPrefs::instance()->mDayBegins); |
307 | 307 | ||
308 | calculateWorkingHours(); | 308 | calculateWorkingHours(); |
309 | 309 | ||
310 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 310 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
311 | SLOT(checkScrollBoundaries(int))); | 311 | SLOT(checkScrollBoundaries(int))); |
312 | 312 | ||
313 | // Create the Marcus Bains line. | 313 | // Create the Marcus Bains line. |
314 | if(mAllDayMode) | 314 | if(mAllDayMode) |
315 | mMarcusBains = 0; | 315 | mMarcusBains = 0; |
316 | else { | 316 | else { |
317 | mMarcusBains = new MarcusBains(this); | 317 | mMarcusBains = new MarcusBains(this); |
318 | addChild(mMarcusBains); | 318 | addChild(mMarcusBains); |
319 | } | 319 | } |
320 | mPopupKind = 0; | 320 | mPopupKind = 0; |
321 | mPopupItem = 0; | 321 | mPopupItem = 0; |
322 | mInvalidPixmap = false; | 322 | mInvalidPixmap = false; |
323 | 323 | ||
324 | } | 324 | } |
325 | 325 | ||
326 | void KOAgenda::shrinkPixmap() | 326 | void KOAgenda::shrinkPixmap() |
327 | { | 327 | { |
328 | mPaintPixmap.resize( 20,20); | 328 | mPaintPixmap.resize( 20,20); |
329 | mInvalidPixmap = true; | 329 | mInvalidPixmap = true; |
330 | } | 330 | } |
331 | void KOAgenda::slotContentMove(int,int) | 331 | void KOAgenda::slotContentMove(int,int) |
332 | { | 332 | { |
333 | emit sendPing(); | 333 | emit sendPing(); |
334 | if ( mActionType == NOP ) | 334 | if ( mActionType == NOP ) |
335 | slotClearSelection(); | 335 | slotClearSelection(); |
336 | if ( mSelectedItem && !mActionItem ) { | 336 | if ( mSelectedItem && !mActionItem ) { |
337 | deselectItem(); | 337 | deselectItem(); |
338 | emit incidenceSelected( 0 ); | 338 | emit incidenceSelected( 0 ); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | void KOAgenda::clear() | 341 | void KOAgenda::clear() |
342 | { | 342 | { |
343 | KOAgendaItem *item; | 343 | KOAgendaItem *item; |
344 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 344 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
345 | mUnusedItems.append( item ); | 345 | mUnusedItems.append( item ); |
346 | //item->hide(); | 346 | //item->hide(); |
347 | } | 347 | } |
348 | mItems.clear(); | 348 | mItems.clear(); |
349 | mSelectedItem = 0; | 349 | mSelectedItem = 0; |
350 | clearSelection(); | 350 | clearSelection(); |
351 | } | 351 | } |
352 | 352 | ||
353 | void KOAgenda::clearSelection() | 353 | void KOAgenda::clearSelection() |
354 | { | 354 | { |
355 | mSelectionCellX = 0; | 355 | mSelectionCellX = 0; |
356 | mSelectionYTop = 0; | 356 | mSelectionYTop = 0; |
357 | mSelectionHeight = 0; | 357 | mSelectionHeight = 0; |
358 | } | 358 | } |
359 | 359 | ||
360 | void KOAgenda::marcus_bains() | 360 | void KOAgenda::marcus_bains() |
361 | { | 361 | { |
362 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 362 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
363 | } | 363 | } |
364 | 364 | ||
365 | 365 | ||
366 | void KOAgenda::changeColumns(int columns) | 366 | void KOAgenda::changeColumns(int columns) |
367 | { | 367 | { |
368 | if (columns == 0) { | 368 | if (columns == 0) { |
369 | qDebug("KOAgenda::changeColumns() called with argument 0 "); | 369 | qDebug("KOAgenda::changeColumns() called with argument 0 "); |
370 | return; | 370 | return; |
371 | } | 371 | } |
372 | clear(); | 372 | clear(); |
373 | mColumns = columns; | 373 | mColumns = columns; |
374 | computeSizes(); | 374 | computeSizes(); |
375 | } | 375 | } |
376 | 376 | ||
377 | /* | 377 | /* |
378 | This is the eventFilter function, which gets all events from the KOAgendaItems | 378 | This is the eventFilter function, which gets all events from the KOAgendaItems |
379 | contained in the agenda. It has to handle moving and resizing for all items. | 379 | contained in the agenda. It has to handle moving and resizing for all items. |
380 | */ | 380 | */ |
381 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 381 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
382 | { | 382 | { |
383 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 383 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
384 | switch(event->type()) { | 384 | switch(event->type()) { |
385 | case QEvent::MouseButtonPress: | 385 | case QEvent::MouseButtonPress: |
386 | case QEvent::MouseButtonDblClick: | 386 | case QEvent::MouseButtonDblClick: |
387 | case QEvent::MouseButtonRelease: | 387 | case QEvent::MouseButtonRelease: |
388 | case QEvent::MouseMove: | 388 | case QEvent::MouseMove: |
389 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 389 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
390 | 390 | ||
391 | case (QEvent::Leave): | 391 | case (QEvent::Leave): |
392 | if (!mActionItem) | 392 | if (!mActionItem) |
393 | setCursor(arrowCursor); | 393 | setCursor(arrowCursor); |
394 | return true; | 394 | return true; |
395 | 395 | ||
396 | default: | 396 | default: |
397 | return QScrollView::eventFilter(object,event); | 397 | return QScrollView::eventFilter(object,event); |
398 | } | 398 | } |
399 | } | 399 | } |
400 | void KOAgenda::popupMenu() | 400 | void KOAgenda::popupMenu() |
401 | { | 401 | { |
402 | mPopupTimer->stop(); | 402 | mPopupTimer->stop(); |
403 | if ( mPopupKind == 1 || mPopupKind == 3 ) { | 403 | if ( mPopupKind == 1 || mPopupKind == 3 ) { |
404 | if (mActionItem ) { | 404 | if (mActionItem ) { |
405 | endItemAction(); | 405 | endItemAction(); |
406 | } | 406 | } |
407 | mLeftMouseDown = false; // no more leftMouse computation | 407 | mLeftMouseDown = false; // no more leftMouse computation |
408 | if (mPopupItem) { | 408 | if (mPopupItem) { |
409 | //mClickedItem = mPopupItem; | 409 | //mClickedItem = mPopupItem; |
410 | selectItem(mPopupItem); | 410 | selectItem(mPopupItem); |
411 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) | 411 | if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 ) |
412 | mAllAgendaPopup->installEventFilter( this ); | 412 | mAllAgendaPopup->installEventFilter( this ); |
413 | emit showIncidencePopupSignal(mPopupItem->incidence()); | 413 | emit showIncidencePopupSignal(mPopupItem->incidence()); |
414 | 414 | ||
415 | } | 415 | } |
416 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { | 416 | } else if ( mPopupKind == 2 || mPopupKind == 4 ) { |
417 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | 417 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action |
418 | endSelectAction( false ); // do not emit new event signal | 418 | endSelectAction( false ); // do not emit new event signal |
419 | mLeftMouseDown = false; // no more leftMouse computation | 419 | mLeftMouseDown = false; // no more leftMouse computation |
420 | } | 420 | } |
421 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) | 421 | if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 ) |
422 | mNewItemPopup->installEventFilter( this ); | 422 | mNewItemPopup->installEventFilter( this ); |
423 | mNewItemPopup->popup( mPopupPos); | 423 | mNewItemPopup->popup( mPopupPos); |
424 | 424 | ||
425 | } | 425 | } |
426 | mLeftMouseDown = false; | 426 | mLeftMouseDown = false; |
427 | mPopupItem = 0; | 427 | mPopupItem = 0; |
428 | mPopupKind = 0; | 428 | mPopupKind = 0; |
429 | } | 429 | } |
430 | void KOAgenda::categoryChanged(Incidence * inc) | 430 | void KOAgenda::categoryChanged(Incidence * inc) |
431 | { | 431 | { |
432 | KOAgendaItem *item; | 432 | KOAgendaItem *item; |
433 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 433 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
434 | if ( item->incidence() == inc ) { | 434 | if ( item->incidence() == inc ) { |
435 | item->initColor (); | 435 | item->initColor (); |
436 | item->updateItem(); | 436 | item->updateItem(); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | } | 439 | } |
440 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 440 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
441 | { | 441 | { |
442 | 442 | ||
443 | if ( mInvalidPixmap ) { | 443 | if ( mInvalidPixmap ) { |
444 | mInvalidPixmap = false; | 444 | mInvalidPixmap = false; |
445 | qDebug("KO: Upsizing Pixmaps "); | 445 | qDebug("KO: Upsizing Pixmaps "); |
446 | computeSizes(); | 446 | computeSizes(); |
447 | emit updateViewSignal(); | 447 | emit updateViewSignal(); |
448 | return true; | 448 | return true; |
449 | } | 449 | } |
450 | emit sendPing(); | 450 | emit sendPing(); |
451 | static int startX = 0; | 451 | static int startX = 0; |
452 | static int startY = 0; | 452 | static int startY = 0; |
453 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); | 453 | int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 7 : 9 ); |
454 | static bool blockMoving = true; | 454 | static bool blockMoving = true; |
455 | 455 | ||
456 | //qDebug("KOAgenda::eventFilter_mous "); | 456 | //qDebug("KOAgenda::eventFilter_mous "); |
457 | if ( object == mNewItemPopup ) { | 457 | if ( object == mNewItemPopup ) { |
458 | //qDebug("mNewItemPopup "); | 458 | //qDebug("mNewItemPopup "); |
459 | if ( me->type() == QEvent::MouseButtonRelease ) { | 459 | if ( me->type() == QEvent::MouseButtonRelease ) { |
460 | mNewItemPopup->removeEventFilter( this ); | 460 | mNewItemPopup->removeEventFilter( this ); |
461 | int dX = me->globalPos().x() - mPopupPos.x();; | 461 | int dX = me->globalPos().x() - mPopupPos.x();; |
462 | if ( dX < 0 ) | 462 | if ( dX < 0 ) |
463 | dX = -dX; | 463 | dX = -dX; |
464 | int dY = me->globalPos().y() - mPopupPos.y(); | 464 | int dY = me->globalPos().y() - mPopupPos.y(); |
465 | if ( dY < 0 ) | 465 | if ( dY < 0 ) |
466 | dY = -dY; | 466 | dY = -dY; |
467 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 467 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
468 | mNewItemPopup->hide(); | 468 | mNewItemPopup->hide(); |
469 | } | 469 | } |
470 | } | 470 | } |
471 | return true; | 471 | return true; |
472 | } | 472 | } |
473 | if ( object == mAllAgendaPopup ) { | 473 | if ( object == mAllAgendaPopup ) { |
474 | //qDebug(" mAllAgendaPopup "); | 474 | //qDebug(" mAllAgendaPopup "); |
475 | if ( me->type() == QEvent::MouseButtonRelease ) { | 475 | if ( me->type() == QEvent::MouseButtonRelease ) { |
476 | mAllAgendaPopup->removeEventFilter( this ); | 476 | mAllAgendaPopup->removeEventFilter( this ); |
477 | int dX = me->globalPos().x() - mPopupPos.x();; | 477 | int dX = me->globalPos().x() - mPopupPos.x();; |
478 | if ( dX < 0 ) | 478 | if ( dX < 0 ) |
479 | dX = -dX; | 479 | dX = -dX; |
480 | int dY = me->globalPos().y() - mPopupPos.y(); | 480 | int dY = me->globalPos().y() - mPopupPos.y(); |
481 | if ( dY < 0 ) | 481 | if ( dY < 0 ) |
482 | dY = -dY; | 482 | dY = -dY; |
483 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 483 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
484 | mAllAgendaPopup->hide(); | 484 | mAllAgendaPopup->hide(); |
485 | } | 485 | } |
486 | } | 486 | } |
487 | return true; | 487 | return true; |
488 | } | 488 | } |
489 | QPoint viewportPos; | 489 | QPoint viewportPos; |
490 | if (object != viewport()) { | 490 | if (object != viewport()) { |
491 | blockmoveDist = blockmoveDist*2; | 491 | blockmoveDist = blockmoveDist*2; |
492 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 492 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
493 | } else { | 493 | } else { |
494 | viewportPos = me->pos(); | 494 | viewportPos = me->pos(); |
495 | } | 495 | } |
496 | bool objIsNotViewport = (object != viewport()); | 496 | bool objIsNotViewport = (object != viewport()); |
497 | bool leftButt = false; | 497 | bool leftButt = false; |
498 | #ifdef DESKTOP_VERSION | 498 | #ifdef DESKTOP_VERSION |
499 | leftButt = (me->button() == LeftButton); | 499 | leftButt = (me->button() == LeftButton); |
500 | #endif | 500 | #endif |
501 | switch (me->type()) { | 501 | switch (me->type()) { |
502 | case QEvent::MouseButtonPress: | 502 | case QEvent::MouseButtonPress: |
503 | if (me->button() == LeftButton) { | 503 | if (me->button() == LeftButton) { |
504 | mPopupTimer->start( 600 ); | 504 | mPopupTimer->start( 600 ); |
505 | mLeftMouseDown = true; | 505 | mLeftMouseDown = true; |
506 | } | 506 | } |
507 | blockMoving = true; | 507 | blockMoving = true; |
508 | startX = viewportPos.x(); | 508 | startX = viewportPos.x(); |
509 | startY = viewportPos.y(); | 509 | startY = viewportPos.y(); |
510 | mPopupPos = me->globalPos(); | 510 | mPopupPos = me->globalPos(); |
511 | if ( objIsNotViewport && !leftButt ) { | 511 | if ( objIsNotViewport && !leftButt ) { |
512 | KOAgendaItem * tempItem = (KOAgendaItem *)object; | 512 | KOAgendaItem * tempItem = (KOAgendaItem *)object; |
513 | if (mAllDayMode) { | 513 | if (mAllDayMode) { |
514 | if ( tempItem->height() > 10 ) { | 514 | if ( tempItem->height() > 10 ) { |
515 | int minV = tempItem->height()/4; | 515 | int minV = tempItem->height()/4; |
516 | if ( minV > (blockmoveDist/2)-2 ) { | 516 | if ( minV > (blockmoveDist/2)-2 ) { |
517 | if ( minV > blockmoveDist ) | 517 | if ( minV > blockmoveDist ) |
518 | minV = blockmoveDist; | 518 | minV = blockmoveDist; |
519 | else | 519 | else |
520 | minV = (blockmoveDist/2); | 520 | minV = (blockmoveDist/2); |
521 | } | 521 | } |
522 | bool border = false; | 522 | bool border = false; |
523 | int diff = tempItem->y() - viewportPos.y(); | 523 | int diff = tempItem->y() - viewportPos.y(); |
524 | if ( diff < 0 ) | 524 | if ( diff < 0 ) |
525 | diff *= -1; | 525 | diff *= -1; |
526 | if ( diff < minV ) { | 526 | if ( diff < minV ) { |
527 | border = true; | 527 | border = true; |
528 | objIsNotViewport = false; | 528 | objIsNotViewport = false; |
529 | } | 529 | } |
530 | if ( ! border ) { | 530 | if ( ! border ) { |
531 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); | 531 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); |
532 | if ( diff < 0 ) | 532 | if ( diff < 0 ) |
533 | diff *= -1; | 533 | diff *= -1; |
534 | if ( diff < minV ) { | 534 | if ( diff < minV ) { |
535 | border = true; | 535 | border = true; |
536 | objIsNotViewport = false; | 536 | objIsNotViewport = false; |
537 | } | 537 | } |
538 | } | 538 | } |
539 | } | 539 | } |
540 | } else { // not allday | 540 | } else { // not allday |
541 | if ( tempItem->width() > 10 ) { | 541 | if ( tempItem->width() > 10 ) { |
542 | int minH = tempItem->width()/4; | 542 | int minH = tempItem->width()/4; |
543 | if ( minH > (blockmoveDist/2)-2 ) { | 543 | if ( minH > (blockmoveDist/2)-2 ) { |
544 | if ( minH > blockmoveDist ) | 544 | if ( minH > blockmoveDist ) |
545 | minH = blockmoveDist; | 545 | minH = blockmoveDist; |
546 | else | 546 | else |
547 | minH = (blockmoveDist/2); | 547 | minH = (blockmoveDist/2); |
548 | } | 548 | } |
549 | bool border = false; | 549 | bool border = false; |
550 | int diff = tempItem->x() - viewportPos.x(); | 550 | int diff = tempItem->x() - viewportPos.x(); |
551 | if ( diff < 0 ) | 551 | if ( diff < 0 ) |
552 | diff *= -1; | 552 | diff *= -1; |
553 | if ( diff < minH ) { | 553 | if ( diff < minH ) { |
554 | border = true; | 554 | border = true; |
555 | objIsNotViewport = false; | 555 | objIsNotViewport = false; |
556 | } | 556 | } |
557 | if ( ! border ) { | 557 | if ( ! border ) { |
558 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); | 558 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); |
559 | if ( diff < 0 ) | 559 | if ( diff < 0 ) |
560 | diff *= -1; | 560 | diff *= -1; |
561 | if ( diff < minH ) { | 561 | if ( diff < minH ) { |
562 | border = true; | 562 | border = true; |
563 | objIsNotViewport = false; | 563 | objIsNotViewport = false; |
564 | } | 564 | } |
565 | } | 565 | } |
566 | } | 566 | } |
567 | } | 567 | } |
568 | } | 568 | } |
569 | if ( objIsNotViewport ) { | 569 | if ( objIsNotViewport ) { |
570 | mPopupItem = (KOAgendaItem *)object; | 570 | mPopupItem = (KOAgendaItem *)object; |
571 | mPopupKind = 1; | 571 | mPopupKind = 1; |
572 | if (me->button() == RightButton) { | 572 | if (me->button() == RightButton) { |
573 | mPopupKind = 3; | 573 | mPopupKind = 3; |
574 | popupMenu(); | 574 | popupMenu(); |
575 | } else if (me->button() == LeftButton) { | 575 | } else if (me->button() == LeftButton) { |
576 | mActionItem = (KOAgendaItem *)object; | 576 | mActionItem = (KOAgendaItem *)object; |
577 | if (mActionItem) { | 577 | if (mActionItem) { |
578 | emit signalClearSelection(); | 578 | emit signalClearSelection(); |
579 | slotClearSelection(); | 579 | slotClearSelection(); |
580 | selectItem(mActionItem); | 580 | selectItem(mActionItem); |
581 | Incidence *incidence = mActionItem->incidence(); | 581 | Incidence *incidence = mActionItem->incidence(); |
582 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 582 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
583 | mActionItem = 0; | 583 | mActionItem = 0; |
584 | } else { | 584 | } else { |
585 | startItemAction(viewportPos); | 585 | startItemAction(viewportPos); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | } | 588 | } |
589 | } else { // ---------- viewport() | 589 | } else { // ---------- viewport() |
590 | mPopupItem = 0; | 590 | mPopupItem = 0; |
591 | mPopupKind = 2; | 591 | mPopupKind = 2; |
592 | selectItem(0); | 592 | selectItem(0); |
593 | mActionItem = 0; | 593 | mActionItem = 0; |
594 | if (me->button() == RightButton) { | 594 | if (me->button() == RightButton) { |
595 | int x,y; | 595 | int x,y; |
596 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 596 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
597 | int gx,gy; | 597 | int gx,gy; |
598 | contentsToGrid(x,y,gx,gy); | 598 | contentsToGrid(x,y,gx,gy); |
599 | mCurrentCellX = gx; | 599 | mCurrentCellX = gx; |
600 | mCurrentCellY = gy; | 600 | mCurrentCellY = gy; |
601 | mStartCellX = gx; | 601 | mStartCellX = gx; |
602 | mStartCellY = gy; | 602 | mStartCellY = gy; |
603 | mPopupKind = 4; | 603 | mPopupKind = 4; |
604 | popupMenu(); | 604 | popupMenu(); |
605 | } else if (me->button() == LeftButton) { | 605 | } else if (me->button() == LeftButton) { |
606 | setCursor(arrowCursor); | 606 | setCursor(arrowCursor); |
607 | startSelectAction(viewportPos); | 607 | startSelectAction(viewportPos); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | break; | 610 | break; |
611 | 611 | ||
612 | case QEvent::MouseButtonRelease: | 612 | case QEvent::MouseButtonRelease: |
613 | if (me->button() == LeftButton ) { | 613 | if (me->button() == LeftButton ) { |
614 | mPopupTimer->stop(); | 614 | mPopupTimer->stop(); |
615 | } | 615 | } |
616 | if (object != viewport()) { | 616 | if (object != viewport()) { |
617 | if (me->button() == LeftButton && mLeftMouseDown) { | 617 | if (me->button() == LeftButton && mLeftMouseDown) { |
618 | if (mActionItem) { | 618 | if (mActionItem) { |
619 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 619 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
620 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 620 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
621 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 621 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
622 | mScrollUpTimer.stop(); | 622 | mScrollUpTimer.stop(); |
623 | mScrollDownTimer.stop(); | 623 | mScrollDownTimer.stop(); |
624 | mActionItem->resetMove(); | 624 | mActionItem->resetMove(); |
625 | placeSubCells( mActionItem ); | 625 | placeSubCells( mActionItem ); |
626 | // emit startDragSignal( mActionItem->incidence() ); | 626 | // emit startDragSignal( mActionItem->incidence() ); |
627 | setCursor( arrowCursor ); | 627 | setCursor( arrowCursor ); |
628 | mActionItem = 0; | 628 | mActionItem = 0; |
629 | mActionType = NOP; | 629 | mActionType = NOP; |
630 | mItemMoved = 0; | 630 | mItemMoved = 0; |
631 | mLeftMouseDown = false; | 631 | mLeftMouseDown = false; |
632 | return true; | 632 | return true; |
633 | } | 633 | } |
634 | endItemAction(); | 634 | endItemAction(); |
635 | } | 635 | } |
636 | } | 636 | } |
637 | 637 | ||
638 | } else { // ---------- viewport() | 638 | } else { // ---------- viewport() |
639 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | 639 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click |
640 | endSelectAction( true ); // emit new event signal | 640 | endSelectAction( true ); // emit new event signal |
641 | } | 641 | } |
642 | } | 642 | } |
643 | if (me->button() == LeftButton) | 643 | if (me->button() == LeftButton) |
644 | mLeftMouseDown = false; | 644 | mLeftMouseDown = false; |
645 | 645 | ||
646 | break; | 646 | break; |
647 | 647 | ||
648 | case QEvent::MouseMove: | 648 | case QEvent::MouseMove: |
649 | //qDebug("mm "); | 649 | //qDebug("mm "); |
650 | if ( !mLeftMouseDown ) | 650 | if ( !mLeftMouseDown ) |
651 | return false; | 651 | return false; |
652 | if ( blockMoving ) { | 652 | if ( blockMoving ) { |
653 | int dX, dY; | 653 | int dX, dY; |
654 | dX = startX - viewportPos.x(); | 654 | dX = startX - viewportPos.x(); |
655 | if ( dX < 0 ) | 655 | if ( dX < 0 ) |
656 | dX = -dX; | 656 | dX = -dX; |
657 | dY = viewportPos.y() - startY; | 657 | dY = viewportPos.y() - startY; |
658 | if ( dY < 0 ) | 658 | if ( dY < 0 ) |
659 | dY = -dY; | 659 | dY = -dY; |
660 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 660 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
661 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 661 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
662 | blockMoving = false; | 662 | blockMoving = false; |
663 | } | 663 | } |
664 | } | 664 | } |
665 | if ( ! blockMoving ) | 665 | if ( ! blockMoving ) |
666 | mPopupTimer->stop(); | 666 | mPopupTimer->stop(); |
667 | if (object != viewport()) { | 667 | if (object != viewport()) { |
668 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 668 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
669 | if (!moveItem->incidence()->isReadOnly() ) { | 669 | if (!moveItem->incidence()->isReadOnly() ) { |
670 | if (!mActionItem) | 670 | if (!mActionItem) |
671 | setNoActionCursor(moveItem,viewportPos); | 671 | setNoActionCursor(moveItem,viewportPos); |
672 | else { | 672 | else { |
673 | if ( !blockMoving ) | 673 | if ( !blockMoving ) |
674 | performItemAction(viewportPos); | 674 | performItemAction(viewportPos); |
675 | } | 675 | } |
676 | } | 676 | } |
677 | } else { // ---------- viewport() | 677 | } else { // ---------- viewport() |
678 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | 678 | mPopupPos = viewport()->mapToGlobal( me->pos() ); |
679 | if ( mActionType == SELECT ) { | 679 | if ( mActionType == SELECT ) { |
680 | performSelectAction( viewportPos ); | 680 | performSelectAction( viewportPos ); |
681 | } | 681 | } |
682 | } | 682 | } |
683 | break; | 683 | break; |
684 | 684 | ||
685 | case QEvent::MouseButtonDblClick: | 685 | case QEvent::MouseButtonDblClick: |
686 | mPopupTimer->stop(); | 686 | mPopupTimer->stop(); |
687 | if (object == viewport()) { | 687 | if (object == viewport()) { |
688 | selectItem(0); | 688 | selectItem(0); |
689 | int x,y; | 689 | int x,y; |
690 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 690 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
691 | int gx,gy; | 691 | int gx,gy; |
692 | contentsToGrid(x,y,gx,gy); | 692 | contentsToGrid(x,y,gx,gy); |
693 | emit newEventSignal(gx,gy); | 693 | emit newEventSignal(gx,gy); |
694 | } else { | 694 | } else { |
695 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 695 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
696 | selectItem(doubleClickedItem); | 696 | selectItem(doubleClickedItem); |
697 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 697 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
698 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 698 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
699 | else | 699 | else |
700 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 700 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
701 | } | 701 | } |
702 | break; | 702 | break; |
703 | 703 | ||
704 | default: | 704 | default: |
705 | break; | 705 | break; |
706 | } | 706 | } |
707 | return true; | 707 | return true; |
708 | 708 | ||
709 | } | 709 | } |
710 | 710 | ||
711 | void KOAgenda::newItem( int item ) | 711 | void KOAgenda::newItem( int item ) |
712 | { | 712 | { |
713 | if ( item == 1 ) { //new event | 713 | if ( item == 1 ) { //new event |
714 | newEventSignal(mStartCellX ,mStartCellY ); | 714 | newEventSignal(mStartCellX ,mStartCellY ); |
715 | } else | 715 | } else |
716 | if ( item == 2 ) { //new event | 716 | if ( item == 2 ) { //new event |
717 | newTodoSignal(mStartCellX ,mStartCellY ); | 717 | newTodoSignal(mStartCellX ,mStartCellY ); |
718 | } else | 718 | } else |
719 | { | 719 | { |
720 | emit showDateView( item, mStartCellX ); | 720 | emit showDateView( item, mStartCellX ); |
721 | // 3Day view | 721 | // 3Day view |
722 | // 4Week view | 722 | // 4Week view |
723 | // 5Month view | 723 | // 5Month view |
724 | // 6Journal view | 724 | // 6Journal view |
725 | } | 725 | } |
726 | } | 726 | } |
727 | void KOAgenda::slotClearSelection() | 727 | void KOAgenda::slotClearSelection() |
728 | { | 728 | { |
729 | if (mSelectionHeight) { | 729 | if (mSelectionHeight) { |
730 | int selectionX = mSelectionCellX * mGridSpacingX; | 730 | int selectionX = mSelectionCellX * mGridSpacingX; |
731 | int top = mSelectionYTop - 2 *mGridSpacingY; | 731 | int top = mSelectionYTop - 2 *mGridSpacingY; |
732 | int hei = mSelectionHeight + 4 *mGridSpacingY; | 732 | int hei = mSelectionHeight + 4 *mGridSpacingY; |
733 | clearSelection(); | 733 | clearSelection(); |
734 | repaintContents( selectionX, top, | 734 | repaintContents( selectionX, top, |
735 | mGridSpacingX, hei ,false ); | 735 | mGridSpacingX, hei ,false ); |
736 | } | 736 | } |
737 | 737 | ||
738 | } | 738 | } |
739 | void KOAgenda::startSelectAction(QPoint viewportPos) | 739 | void KOAgenda::startSelectAction(QPoint viewportPos) |
740 | { | 740 | { |
741 | 741 | ||
742 | emit signalClearSelection(); | 742 | emit signalClearSelection(); |
743 | slotClearSelection(); | 743 | slotClearSelection(); |
744 | 744 | ||
745 | mActionType = SELECT; | 745 | mActionType = SELECT; |
746 | 746 | ||
747 | int x,y; | 747 | int x,y; |
748 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 748 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
749 | int gx,gy; | 749 | int gx,gy; |
750 | contentsToGrid(x,y,gx,gy); | 750 | contentsToGrid(x,y,gx,gy); |
751 | 751 | ||
752 | mStartCellX = gx; | 752 | mStartCellX = gx; |
753 | mStartCellY = gy; | 753 | mStartCellY = gy; |
754 | mCurrentCellX = gx; | 754 | mCurrentCellX = gx; |
755 | mCurrentCellY = gy; | 755 | mCurrentCellY = gy; |
756 | 756 | ||
757 | // Store new selection | 757 | // Store new selection |
758 | mSelectionCellX = gx; | 758 | mSelectionCellX = gx; |
759 | mSelectionYTop = gy * mGridSpacingY; | 759 | mSelectionYTop = gy * mGridSpacingY; |
760 | mSelectionHeight = mGridSpacingY; | 760 | mSelectionHeight = mGridSpacingY; |
761 | 761 | ||
762 | // Paint new selection | 762 | // Paint new selection |
763 | repaintContents( mSelectionCellX * mGridSpacingX+1, mSelectionYTop, | 763 | repaintContents( mSelectionCellX * mGridSpacingX+1, mSelectionYTop, |
764 | mGridSpacingX-1, mSelectionHeight ); | 764 | mGridSpacingX-1, mSelectionHeight ); |
765 | } | 765 | } |
766 | 766 | ||
767 | void KOAgenda::performSelectAction(QPoint viewportPos) | 767 | void KOAgenda::performSelectAction(QPoint viewportPos) |
768 | { | 768 | { |
769 | int x,y; | 769 | int x,y; |
770 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 770 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
771 | int gx,gy; | 771 | int gx,gy; |
772 | contentsToGrid(x,y,gx,gy); | 772 | contentsToGrid(x,y,gx,gy); |
773 | 773 | ||
774 | QPoint clipperPos = clipper()-> | 774 | QPoint clipperPos = clipper()-> |
775 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 775 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
776 | 776 | ||
777 | // Scroll if cursor was moved to upper or lower end of agenda. | 777 | // Scroll if cursor was moved to upper or lower end of agenda. |
778 | if (clipperPos.y() < mScrollBorderWidth) { | 778 | if (clipperPos.y() < mScrollBorderWidth) { |
779 | mScrollUpTimer.start(mScrollDelay); | 779 | mScrollUpTimer.start(mScrollDelay); |
780 | } else if (visibleHeight() - clipperPos.y() < | 780 | } else if (visibleHeight() - clipperPos.y() < |
781 | mScrollBorderWidth) { | 781 | mScrollBorderWidth) { |
782 | mScrollDownTimer.start(mScrollDelay); | 782 | mScrollDownTimer.start(mScrollDelay); |
783 | } else { | 783 | } else { |
784 | mScrollUpTimer.stop(); | 784 | mScrollUpTimer.stop(); |
785 | mScrollDownTimer.stop(); | 785 | mScrollDownTimer.stop(); |
786 | } | 786 | } |
787 | 787 | ||
788 | if ( gy > mCurrentCellY ) { | 788 | if ( gy > mCurrentCellY ) { |
789 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 789 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
790 | 790 | ||
791 | 791 | ||
792 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 792 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
793 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 793 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
794 | mGridSpacingX, mSelectionYTop, | 794 | mGridSpacingX, mSelectionYTop, |
795 | mGridSpacingX, mSelectionHeight , false); | 795 | mGridSpacingX, mSelectionHeight , false); |
796 | 796 | ||
797 | mCurrentCellY = gy; | 797 | mCurrentCellY = gy; |
798 | } else if ( gy < mCurrentCellY ) { | 798 | } else if ( gy < mCurrentCellY ) { |
799 | if ( gy >= mStartCellY ) { | 799 | if ( gy >= mStartCellY ) { |
800 | int selectionHeight = mSelectionHeight; | 800 | int selectionHeight = mSelectionHeight; |
801 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 801 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
802 | 802 | ||
803 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 803 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
804 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 804 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
805 | mGridSpacingX, mSelectionYTop, | 805 | mGridSpacingX, mSelectionYTop, |
806 | mGridSpacingX, selectionHeight,false ); | 806 | mGridSpacingX, selectionHeight,false ); |
807 | 807 | ||
808 | mCurrentCellY = gy; | 808 | mCurrentCellY = gy; |
809 | } else { | 809 | } else { |
810 | } | 810 | } |
811 | } | 811 | } |
812 | } | 812 | } |
813 | 813 | ||
814 | void KOAgenda::endSelectAction( bool emitNewEvent ) | 814 | void KOAgenda::endSelectAction( bool emitNewEvent ) |
815 | { | 815 | { |
816 | mActionType = NOP; | 816 | mActionType = NOP; |
817 | mScrollUpTimer.stop(); | 817 | mScrollUpTimer.stop(); |
818 | mScrollDownTimer.stop(); | 818 | mScrollDownTimer.stop(); |
819 | 819 | ||
820 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 820 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
821 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { | 821 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { |
822 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 822 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
823 | } | 823 | } |
824 | } | 824 | } |
825 | 825 | ||
826 | void KOAgenda::startItemAction(QPoint viewportPos) | 826 | void KOAgenda::startItemAction(QPoint viewportPos) |
827 | { | 827 | { |
828 | int x,y; | 828 | int x,y; |
829 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 829 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
830 | int gx,gy; | 830 | int gx,gy; |
831 | contentsToGrid(x,y,gx,gy); | 831 | contentsToGrid(x,y,gx,gy); |
832 | 832 | ||
833 | mStartCellX = gx; | 833 | mStartCellX = gx; |
834 | mStartCellY = gy; | 834 | mStartCellY = gy; |
835 | mCurrentCellX = gx; | 835 | mCurrentCellX = gx; |
836 | mCurrentCellY = gy; | 836 | mCurrentCellY = gy; |
837 | 837 | ||
838 | if (mAllDayMode) { | 838 | if (mAllDayMode) { |
839 | int gridDistanceX = (x - gx * mGridSpacingX); | 839 | int gridDistanceX = (x - gx * mGridSpacingX); |
840 | if (gridDistanceX < mResizeBorderWidth && | 840 | if (gridDistanceX < mResizeBorderWidth && |
841 | mActionItem->cellX() == mCurrentCellX) { | 841 | mActionItem->cellX() == mCurrentCellX) { |
842 | mActionType = RESIZELEFT; | 842 | mActionType = RESIZELEFT; |
843 | setCursor(sizeHorCursor); | 843 | setCursor(sizeHorCursor); |
844 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 844 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
845 | mActionItem->cellXWidth() == mCurrentCellX) { | 845 | mActionItem->cellXWidth() == mCurrentCellX) { |
846 | mActionType = RESIZERIGHT; | 846 | mActionType = RESIZERIGHT; |
847 | setCursor(sizeHorCursor); | 847 | setCursor(sizeHorCursor); |
848 | } else { | 848 | } else { |
849 | mActionType = MOVE; | 849 | mActionType = MOVE; |
850 | mActionItem->startMove(); | 850 | mActionItem->startMove(); |
851 | setCursor(sizeAllCursor); | 851 | setCursor(sizeAllCursor); |
852 | } | 852 | } |
853 | } else { | 853 | } else { |
854 | int gridDistanceY = (y - gy * mGridSpacingY); | 854 | int gridDistanceY = (y - gy * mGridSpacingY); |
855 | bool allowResize = ( mActionItem->incidence()->typeID() != todoID ); | 855 | bool allowResize = ( mActionItem->incidence()->typeID() != todoID ); |
856 | if (allowResize && gridDistanceY < mResizeBorderWidth && | 856 | if (allowResize && gridDistanceY < mResizeBorderWidth && |
857 | mActionItem->cellYTop() == mCurrentCellY && | 857 | mActionItem->cellYTop() == mCurrentCellY && |
858 | !mActionItem->firstMultiItem()) { | 858 | !mActionItem->firstMultiItem()) { |
859 | mActionType = RESIZETOP; | 859 | mActionType = RESIZETOP; |
860 | setCursor(sizeVerCursor); | 860 | setCursor(sizeVerCursor); |
861 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 861 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
862 | mActionItem->cellYBottom() == mCurrentCellY && | 862 | mActionItem->cellYBottom() == mCurrentCellY && |
863 | !mActionItem->lastMultiItem()) { | 863 | !mActionItem->lastMultiItem()) { |
864 | mActionType = RESIZEBOTTOM; | 864 | mActionType = RESIZEBOTTOM; |
865 | setCursor(sizeVerCursor); | 865 | setCursor(sizeVerCursor); |
866 | } else { | 866 | } else { |
867 | mActionType = MOVE; | 867 | mActionType = MOVE; |
868 | mActionItem->startMove(); | 868 | mActionItem->startMove(); |
869 | setCursor(sizeAllCursor); | 869 | setCursor(sizeAllCursor); |
870 | } | 870 | } |
871 | } | 871 | } |
872 | } | 872 | } |
873 | 873 | ||
874 | void KOAgenda::performItemAction(QPoint viewportPos) | 874 | void KOAgenda::performItemAction(QPoint viewportPos) |
875 | { | 875 | { |
876 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 876 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
877 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 877 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
878 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 878 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
879 | // point = clipper()->mapFromGlobal(point); | 879 | // point = clipper()->mapFromGlobal(point); |
880 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 880 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
881 | // kdDebug() << "visible height: " << visibleHeight() << endl; | 881 | // kdDebug() << "visible height: " << visibleHeight() << endl; |
882 | int x,y; | 882 | int x,y; |
883 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 883 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
884 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 884 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
885 | int gx,gy; | 885 | int gx,gy; |
886 | contentsToGrid(x,y,gx,gy); | 886 | contentsToGrid(x,y,gx,gy); |
887 | QPoint clipperPos = clipper()-> | 887 | QPoint clipperPos = clipper()-> |
888 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 888 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
889 | 889 | ||
890 | // Cursor left active agenda area. | 890 | // Cursor left active agenda area. |
891 | // This starts a drag. | 891 | // This starts a drag. |
892 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ | 892 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ |
893 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { | 893 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { |
894 | if ( mActionType == MOVE ) { | 894 | if ( mActionType == MOVE ) { |
895 | mScrollUpTimer.stop(); | 895 | mScrollUpTimer.stop(); |
896 | mScrollDownTimer.stop(); | 896 | mScrollDownTimer.stop(); |
897 | mActionItem->resetMove(); | 897 | mActionItem->resetMove(); |
898 | placeSubCells( mActionItem ); | 898 | placeSubCells( mActionItem ); |
899 | // emit startDragSignal( mActionItem->incidence() ); | 899 | // emit startDragSignal( mActionItem->incidence() ); |
900 | setCursor( arrowCursor ); | 900 | setCursor( arrowCursor ); |
901 | mActionItem = 0; | 901 | mActionItem = 0; |
902 | mActionType = NOP; | 902 | mActionType = NOP; |
903 | mItemMoved = 0; | 903 | mItemMoved = 0; |
904 | return; | 904 | return; |
905 | } | 905 | } |
906 | } else { | 906 | } else { |
907 | switch ( mActionType ) { | 907 | switch ( mActionType ) { |
908 | case MOVE: | 908 | case MOVE: |
909 | setCursor( sizeAllCursor ); | 909 | setCursor( sizeAllCursor ); |
910 | break; | 910 | break; |
911 | case RESIZETOP: | 911 | case RESIZETOP: |
912 | case RESIZEBOTTOM: | 912 | case RESIZEBOTTOM: |
913 | setCursor( sizeVerCursor ); | 913 | setCursor( sizeVerCursor ); |
914 | break; | 914 | break; |
915 | case RESIZELEFT: | 915 | case RESIZELEFT: |
916 | case RESIZERIGHT: | 916 | case RESIZERIGHT: |
917 | setCursor( sizeHorCursor ); | 917 | setCursor( sizeHorCursor ); |
918 | break; | 918 | break; |
919 | default: | 919 | default: |
920 | setCursor( arrowCursor ); | 920 | setCursor( arrowCursor ); |
921 | } | 921 | } |
922 | } | 922 | } |
923 | 923 | ||
924 | // Scroll if item was moved to upper or lower end of agenda. | 924 | // Scroll if item was moved to upper or lower end of agenda. |
925 | if (clipperPos.y() < mScrollBorderWidth) { | 925 | if (clipperPos.y() < mScrollBorderWidth) { |
926 | mScrollUpTimer.start(mScrollDelay); | 926 | mScrollUpTimer.start(mScrollDelay); |
927 | } else if (visibleHeight() - clipperPos.y() < | 927 | } else if (visibleHeight() - clipperPos.y() < |
928 | mScrollBorderWidth) { | 928 | mScrollBorderWidth) { |
929 | mScrollDownTimer.start(mScrollDelay); | 929 | mScrollDownTimer.start(mScrollDelay); |
930 | } else { | 930 | } else { |
931 | mScrollUpTimer.stop(); | 931 | mScrollUpTimer.stop(); |
932 | mScrollDownTimer.stop(); | 932 | mScrollDownTimer.stop(); |
933 | } | 933 | } |
934 | 934 | ||
935 | // Move or resize item if necessary | 935 | // Move or resize item if necessary |
936 | if (mCurrentCellX != gx || mCurrentCellY != gy) { | 936 | if (mCurrentCellX != gx || mCurrentCellY != gy) { |
937 | mItemMoved = true; | 937 | mItemMoved = true; |
938 | mActionItem->raise(); | 938 | mActionItem->raise(); |
939 | if (mActionType == MOVE) { | 939 | if (mActionType == MOVE) { |
940 | // Move all items belonging to a multi item | 940 | // Move all items belonging to a multi item |
941 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); | 941 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); |
942 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); | 942 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); |
943 | if (!moveItem) moveItem = mActionItem; | 943 | if (!moveItem) moveItem = mActionItem; |
944 | while (moveItem) { | 944 | while (moveItem) { |
945 | int dy; | 945 | int dy; |
946 | if (isMultiItem) dy = 0; | 946 | if (isMultiItem) dy = 0; |
947 | else dy = gy - mCurrentCellY; | 947 | else dy = gy - mCurrentCellY; |
948 | moveItem->moveRelative(gx - mCurrentCellX,dy); | 948 | moveItem->moveRelative(gx - mCurrentCellX,dy); |
949 | int x,y; | 949 | int x,y; |
950 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); | 950 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); |
951 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), | 951 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), |
952 | mGridSpacingY * moveItem->cellHeight()); | 952 | mGridSpacingY * moveItem->cellHeight()); |
953 | moveItem->raise(); | 953 | moveItem->raise(); |
954 | moveChild(moveItem,x,y); | 954 | moveChild(moveItem,x,y); |
955 | moveItem = moveItem->nextMultiItem(); | 955 | moveItem = moveItem->nextMultiItem(); |
956 | } | 956 | } |
957 | } else if (mActionType == RESIZETOP) { | 957 | } else if (mActionType == RESIZETOP) { |
958 | if (mCurrentCellY <= mActionItem->cellYBottom()) { | 958 | if (mCurrentCellY <= mActionItem->cellYBottom()) { |
959 | mActionItem->expandTop(gy - mCurrentCellY); | 959 | mActionItem->expandTop(gy - mCurrentCellY); |
960 | mActionItem->resize(mActionItem->width(), | 960 | mActionItem->resize(mActionItem->width(), |
961 | mGridSpacingY * mActionItem->cellHeight()); | 961 | mGridSpacingY * mActionItem->cellHeight()); |
962 | int x,y; | 962 | int x,y; |
963 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); | 963 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); |
964 | //moveChild(mActionItem,childX(mActionItem),y); | 964 | //moveChild(mActionItem,childX(mActionItem),y); |
965 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); | 965 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); |
966 | } | 966 | } |
967 | } else if (mActionType == RESIZEBOTTOM) { | 967 | } else if (mActionType == RESIZEBOTTOM) { |
968 | if (mCurrentCellY >= mActionItem->cellYTop()) { | 968 | if (mCurrentCellY >= mActionItem->cellYTop()) { |
969 | mActionItem->expandBottom(gy - mCurrentCellY); | 969 | mActionItem->expandBottom(gy - mCurrentCellY); |
970 | mActionItem->resize(mActionItem->width(), | 970 | mActionItem->resize(mActionItem->width(), |
971 | mGridSpacingY * mActionItem->cellHeight()); | 971 | mGridSpacingY * mActionItem->cellHeight()); |
972 | } | 972 | } |
973 | } else if (mActionType == RESIZELEFT) { | 973 | } else if (mActionType == RESIZELEFT) { |
974 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 974 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
975 | mActionItem->expandLeft(gx - mCurrentCellX); | 975 | mActionItem->expandLeft(gx - mCurrentCellX); |
976 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 976 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
977 | mActionItem->height()); | 977 | mActionItem->height()); |
978 | int x,y; | 978 | int x,y; |
979 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 979 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
980 | moveChild(mActionItem,x,childY(mActionItem)); | 980 | moveChild(mActionItem,x,childY(mActionItem)); |
981 | } | 981 | } |
982 | } else if (mActionType == RESIZERIGHT) { | 982 | } else if (mActionType == RESIZERIGHT) { |
983 | if (mCurrentCellX >= mActionItem->cellX()) { | 983 | if (mCurrentCellX >= mActionItem->cellX()) { |
984 | mActionItem->expandRight(gx - mCurrentCellX); | 984 | mActionItem->expandRight(gx - mCurrentCellX); |
985 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 985 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
986 | mActionItem->height()); | 986 | mActionItem->height()); |
987 | } | 987 | } |
988 | } | 988 | } |
989 | mCurrentCellX = gx; | 989 | mCurrentCellX = gx; |
990 | mCurrentCellY = gy; | 990 | mCurrentCellY = gy; |
991 | } | 991 | } |
992 | } | 992 | } |
993 | 993 | ||
994 | void KOAgenda::endItemAction() | 994 | void KOAgenda::endItemAction() |
995 | { | 995 | { |
996 | 996 | ||
997 | if ( mItemMoved ) { | 997 | if ( mItemMoved ) { |
998 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 998 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
999 | if ( !placeItem ) { | 999 | if ( !placeItem ) { |
1000 | placeItem = mActionItem; | 1000 | placeItem = mActionItem; |
1001 | } | 1001 | } |
1002 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 1002 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { |
1003 | Incidence* oldInc = placeItem->incidence(); | 1003 | Incidence* oldInc = placeItem->incidence(); |
1004 | placeItem->recreateIncidence(); | 1004 | placeItem->recreateIncidence(); |
1005 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 1005 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
1006 | } | 1006 | } |
1007 | int type = mActionType; | 1007 | int type = mActionType; |
1008 | if ( mAllDayMode ) | 1008 | if ( mAllDayMode ) |
1009 | type = -1; | 1009 | type = -1; |
1010 | KOAgendaItem *modifiedItem = placeItem; | 1010 | KOAgendaItem *modifiedItem = placeItem; |
1011 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 1011 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
1012 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 1012 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
1013 | KOAgendaItem *item; | 1013 | KOAgendaItem *item; |
1014 | 1014 | ||
1015 | if ( placeItem->incidence()->typeID() == todoID ) { | 1015 | if ( placeItem->incidence()->typeID() == todoID ) { |
1016 | mSelectedItem = 0; | 1016 | mSelectedItem = 0; |
1017 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 1017 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
1018 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 1018 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
1019 | emit itemModified( modifiedItem, mActionType ); | 1019 | emit itemModified( modifiedItem, mActionType ); |
1020 | } | 1020 | } |
1021 | else { | 1021 | else { |
1022 | 1022 | ||
1023 | 1023 | ||
1024 | globalFlagBlockAgendaItemPaint = 1; | 1024 | globalFlagBlockAgendaItemPaint = 1; |
1025 | for ( item=oldconflictItems.first(); item != 0; | 1025 | for ( item=oldconflictItems.first(); item != 0; |
1026 | item=oldconflictItems.next() ) { | 1026 | item=oldconflictItems.next() ) { |
1027 | placeSubCells(item); | 1027 | placeSubCells(item); |
1028 | } | 1028 | } |
1029 | while ( placeItem ) { | 1029 | while ( placeItem ) { |
1030 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1030 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1031 | oldconflictItems = placeItem->conflictItems(); | 1031 | oldconflictItems = placeItem->conflictItems(); |
1032 | for ( item=oldconflictItems.first(); item != 0; | 1032 | for ( item=oldconflictItems.first(); item != 0; |
1033 | item=oldconflictItems.next() ) { | 1033 | item=oldconflictItems.next() ) { |
1034 | placeSubCells(item); | 1034 | placeSubCells(item); |
1035 | } | 1035 | } |
1036 | placeSubCells( placeItem ); | 1036 | placeSubCells( placeItem ); |
1037 | placeItem = placeItem->nextMultiItem(); | 1037 | placeItem = placeItem->nextMultiItem(); |
1038 | } | 1038 | } |
1039 | globalFlagBlockAgendaItemPaint = 0; | 1039 | globalFlagBlockAgendaItemPaint = 0; |
1040 | for ( item=oldconflictItems.first(); item != 0; | 1040 | for ( item=oldconflictItems.first(); item != 0; |
1041 | item=oldconflictItems.next() ) { | 1041 | item=oldconflictItems.next() ) { |
1042 | globalFlagBlockAgendaItemUpdate = 0; | 1042 | globalFlagBlockAgendaItemUpdate = 0; |
1043 | item->repaintMe(); | 1043 | item->repaintMe(); |
1044 | globalFlagBlockAgendaItemUpdate = 1; | 1044 | globalFlagBlockAgendaItemUpdate = 1; |
1045 | item->repaint( false ); | 1045 | item->repaint( false ); |
1046 | } | 1046 | } |
1047 | placeItem = modifiedItem; | 1047 | placeItem = modifiedItem; |
1048 | 1048 | ||
1049 | while ( placeItem ) { | 1049 | while ( placeItem ) { |
1050 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1050 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1051 | globalFlagBlockAgendaItemUpdate = 0; | 1051 | globalFlagBlockAgendaItemUpdate = 0; |
1052 | placeItem->repaintMe(); | 1052 | placeItem->repaintMe(); |
1053 | globalFlagBlockAgendaItemUpdate = 1; | 1053 | globalFlagBlockAgendaItemUpdate = 1; |
1054 | placeItem->repaint(false); | 1054 | placeItem->repaint(false); |
1055 | placeItem = placeItem->nextMultiItem(); | 1055 | placeItem = placeItem->nextMultiItem(); |
1056 | } | 1056 | } |
1057 | emit itemModified( modifiedItem, mActionType ); | 1057 | emit itemModified( modifiedItem, mActionType ); |
1058 | 1058 | ||
1059 | 1059 | ||
1060 | placeItem = modifiedItem; | 1060 | placeItem = modifiedItem; |
1061 | while ( placeItem ) { | 1061 | while ( placeItem ) { |
1062 | oldconflictItems = placeItem->conflictItems(); | 1062 | oldconflictItems = placeItem->conflictItems(); |
1063 | for ( item=oldconflictItems.first(); item != 0; | 1063 | for ( item=oldconflictItems.first(); item != 0; |
1064 | item=oldconflictItems.next() ) { | 1064 | item=oldconflictItems.next() ) { |
1065 | placeSubCells(item); | 1065 | placeSubCells(item); |
1066 | } | 1066 | } |
1067 | placeSubCells( placeItem ); | 1067 | placeSubCells( placeItem ); |
1068 | placeItem = placeItem->nextMultiItem(); | 1068 | placeItem = placeItem->nextMultiItem(); |
1069 | 1069 | ||
1070 | } | 1070 | } |
1071 | placeItem = modifiedItem; | 1071 | placeItem = modifiedItem; |
1072 | while ( placeItem ) { | 1072 | while ( placeItem ) { |
1073 | oldconflictItems = placeItem->conflictItems(); | 1073 | oldconflictItems = placeItem->conflictItems(); |
1074 | for ( item=oldconflictItems.first(); item != 0; | 1074 | for ( item=oldconflictItems.first(); item != 0; |
1075 | item=oldconflictItems.next() ) { | 1075 | item=oldconflictItems.next() ) { |
1076 | globalFlagBlockAgendaItemUpdate = 0; | 1076 | globalFlagBlockAgendaItemUpdate = 0; |
1077 | item->repaintMe(); | 1077 | item->repaintMe(); |
1078 | globalFlagBlockAgendaItemUpdate = 1; | 1078 | globalFlagBlockAgendaItemUpdate = 1; |
1079 | item->repaint(false); | 1079 | item->repaint(false); |
1080 | } | 1080 | } |
1081 | placeItem = placeItem->nextMultiItem(); | 1081 | placeItem = placeItem->nextMultiItem(); |
1082 | } | 1082 | } |
1083 | /* | 1083 | /* |
1084 | 1084 | ||
1085 | oldconflictItems = modifiedItem->conflictItems(); | 1085 | oldconflictItems = modifiedItem->conflictItems(); |
1086 | for ( item=oldconflictItems.first(); item != 0; | 1086 | for ( item=oldconflictItems.first(); item != 0; |
1087 | item=oldconflictItems.next() ) { | 1087 | item=oldconflictItems.next() ) { |
1088 | globalFlagBlockAgendaItemUpdate = 0; | 1088 | globalFlagBlockAgendaItemUpdate = 0; |
1089 | item->paintMe(false); | 1089 | item->paintMe(false); |
1090 | globalFlagBlockAgendaItemUpdate = 1; | 1090 | globalFlagBlockAgendaItemUpdate = 1; |
1091 | item->repaint(false); | 1091 | item->repaint(false); |
1092 | } | 1092 | } |
1093 | */ | 1093 | */ |
1094 | 1094 | ||
1095 | 1095 | ||
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | } | 1098 | } |
1099 | if ( mActionItem ) | 1099 | if ( mActionItem ) |
1100 | emit incidenceSelected( mActionItem->incidence() ); | 1100 | emit incidenceSelected( mActionItem->incidence() ); |
1101 | mScrollUpTimer.stop(); | 1101 | mScrollUpTimer.stop(); |
1102 | mScrollDownTimer.stop(); | 1102 | mScrollDownTimer.stop(); |
1103 | setCursor( arrowCursor ); | 1103 | setCursor( arrowCursor ); |
1104 | mActionItem = 0; | 1104 | mActionItem = 0; |
1105 | mActionType = NOP; | 1105 | mActionType = NOP; |
1106 | mItemMoved = 0; | 1106 | mItemMoved = 0; |
1107 | 1107 | ||
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | 1110 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) |
1111 | { | 1111 | { |
1112 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 1112 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
1113 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 1113 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
1114 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 1114 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
1115 | // point = clipper()->mapFromGlobal(point); | 1115 | // point = clipper()->mapFromGlobal(point); |
1116 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 1116 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
1117 | 1117 | ||
1118 | int x,y; | 1118 | int x,y; |
1119 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 1119 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
1120 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 1120 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
1121 | int gx,gy; | 1121 | int gx,gy; |
1122 | contentsToGrid(x,y,gx,gy); | 1122 | contentsToGrid(x,y,gx,gy); |
1123 | 1123 | ||
1124 | // Change cursor to resize cursor if appropriate | 1124 | // Change cursor to resize cursor if appropriate |
1125 | if (mAllDayMode) { | 1125 | if (mAllDayMode) { |
1126 | int gridDistanceX = (x - gx * mGridSpacingX); | 1126 | int gridDistanceX = (x - gx * mGridSpacingX); |
1127 | if (gridDistanceX < mResizeBorderWidth && | 1127 | if (gridDistanceX < mResizeBorderWidth && |
1128 | moveItem->cellX() == gx) { | 1128 | moveItem->cellX() == gx) { |
1129 | setCursor(sizeHorCursor); | 1129 | setCursor(sizeHorCursor); |
1130 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 1130 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
1131 | moveItem->cellXWidth() == gx) { | 1131 | moveItem->cellXWidth() == gx) { |
1132 | setCursor(sizeHorCursor); | 1132 | setCursor(sizeHorCursor); |
1133 | } else { | 1133 | } else { |
1134 | setCursor(arrowCursor); | 1134 | setCursor(arrowCursor); |
1135 | } | 1135 | } |
1136 | } else { | 1136 | } else { |
1137 | int gridDistanceY = (y - gy * mGridSpacingY); | 1137 | int gridDistanceY = (y - gy * mGridSpacingY); |
1138 | if (gridDistanceY < mResizeBorderWidth && | 1138 | if (gridDistanceY < mResizeBorderWidth && |
1139 | moveItem->cellYTop() == gy && | 1139 | moveItem->cellYTop() == gy && |
1140 | !moveItem->firstMultiItem()) { | 1140 | !moveItem->firstMultiItem()) { |
1141 | setCursor(sizeVerCursor); | 1141 | setCursor(sizeVerCursor); |
1142 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 1142 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
1143 | moveItem->cellYBottom() == gy && | 1143 | moveItem->cellYBottom() == gy && |
1144 | !moveItem->lastMultiItem()) { | 1144 | !moveItem->lastMultiItem()) { |
1145 | setCursor(sizeVerCursor); | 1145 | setCursor(sizeVerCursor); |
1146 | } else { | 1146 | } else { |
1147 | setCursor(arrowCursor); | 1147 | setCursor(arrowCursor); |
1148 | } | 1148 | } |
1149 | } | 1149 | } |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | 1152 | ||
1153 | /* | 1153 | /* |
1154 | Place item in cell and take care that multiple items using the same cell do | 1154 | Place item in cell and take care that multiple items using the same cell do |
1155 | not overlap. This method is not yet optimal. It doesn´t use the maximum space | 1155 | not overlap. This method is not yet optimal. It doesn´t use the maximum space |
1156 | it can get in all cases. | 1156 | it can get in all cases. |
1157 | At the moment the method has a bug: When an item is placed only the sub cell | 1157 | At the moment the method has a bug: When an item is placed only the sub cell |
1158 | widths of the items are changed, which are within the Y region the item to | 1158 | widths of the items are changed, which are within the Y region the item to |
1159 | place spans. When the sub cell width change of one of this items affects a | 1159 | place spans. When the sub cell width change of one of this items affects a |
1160 | cell, where other items are, which do not overlap in Y with the item to place, | 1160 | cell, where other items are, which do not overlap in Y with the item to place, |
1161 | the display gets corrupted, although the corruption looks quite nice. | 1161 | the display gets corrupted, although the corruption looks quite nice. |
1162 | */ | 1162 | */ |
1163 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 1163 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) |
1164 | { | 1164 | { |
1165 | 1165 | ||
1166 | QPtrList<KOAgendaItem> conflictItems; | 1166 | QPtrList<KOAgendaItem> conflictItems; |
1167 | int maxSubCells = 0; | 1167 | int maxSubCells = 0; |
1168 | QIntDict<KOAgendaItem> subCellDict(7); | 1168 | QIntDict<KOAgendaItem> subCellDict(7); |
1169 | 1169 | ||
1170 | KOAgendaItem *item; | 1170 | KOAgendaItem *item; |
1171 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1171 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1172 | if (item != placeItem) { | 1172 | if (item != placeItem) { |
1173 | if (placeItem->cellX() <= item->cellXWidth() && | 1173 | if (placeItem->cellX() <= item->cellXWidth() && |
1174 | placeItem->cellXWidth() >= item->cellX()) { | 1174 | placeItem->cellXWidth() >= item->cellX()) { |
1175 | if ((placeItem->cellYTop() <= item->cellYBottom()) && | 1175 | if ((placeItem->cellYTop() <= item->cellYBottom()) && |
1176 | (placeItem->cellYBottom() >= item->cellYTop())) { | 1176 | (placeItem->cellYBottom() >= item->cellYTop())) { |
1177 | conflictItems.append(item); | 1177 | conflictItems.append(item); |
1178 | if (item->subCells() > maxSubCells) | 1178 | if (item->subCells() > maxSubCells) |
1179 | maxSubCells = item->subCells(); | 1179 | maxSubCells = item->subCells(); |
1180 | subCellDict.insert(item->subCell(),item); | 1180 | subCellDict.insert(item->subCell(),item); |
1181 | } | 1181 | } |
1182 | } | 1182 | } |
1183 | } | 1183 | } |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | if (conflictItems.count() > 0) { | 1186 | if (conflictItems.count() > 0) { |
1187 | // Look for unused sub cell and insert item | 1187 | // Look for unused sub cell and insert item |
1188 | int i; | 1188 | int i; |
1189 | for(i=0;i<maxSubCells;++i) { | 1189 | for(i=0;i<maxSubCells;++i) { |
1190 | if (!subCellDict.find(i)) { | 1190 | if (!subCellDict.find(i)) { |
1191 | placeItem->setSubCell(i); | 1191 | placeItem->setSubCell(i); |
1192 | break; | 1192 | break; |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | if (i == maxSubCells) { | 1195 | if (i == maxSubCells) { |
1196 | placeItem->setSubCell(maxSubCells); | 1196 | placeItem->setSubCell(maxSubCells); |
1197 | maxSubCells++; // add new item to number of sub cells | 1197 | maxSubCells++; // add new item to number of sub cells |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | // Prepare for sub cell geometry adjustment | 1200 | // Prepare for sub cell geometry adjustment |
1201 | int newSubCellWidth; | 1201 | int newSubCellWidth; |
1202 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1202 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1203 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1203 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1204 | conflictItems.append(placeItem); | 1204 | conflictItems.append(placeItem); |
1205 | 1205 | ||
1206 | 1206 | ||
1207 | // Adjust sub cell geometry of all direct conflict items | 1207 | // Adjust sub cell geometry of all direct conflict items |
1208 | for ( item=conflictItems.first(); item != 0; | 1208 | for ( item=conflictItems.first(); item != 0; |
1209 | item=conflictItems.next() ) { | 1209 | item=conflictItems.next() ) { |
1210 | item->setSubCells(maxSubCells); | 1210 | item->setSubCells(maxSubCells); |
1211 | if (mAllDayMode) { | 1211 | if (mAllDayMode) { |
1212 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1212 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1213 | } else { | 1213 | } else { |
1214 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1214 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1215 | } | 1215 | } |
1216 | int x,y; | 1216 | int x,y; |
1217 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1217 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1218 | if (mAllDayMode) { | 1218 | if (mAllDayMode) { |
1219 | y += item->subCell() * newSubCellWidth; | 1219 | y += item->subCell() * newSubCellWidth; |
1220 | } else { | 1220 | } else { |
1221 | x += item->subCell() * newSubCellWidth; | 1221 | x += item->subCell() * newSubCellWidth; |
1222 | } | 1222 | } |
1223 | moveChild(item,x,y); | 1223 | moveChild(item,x,y); |
1224 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1224 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1225 | //item->updateItem(); | 1225 | //item->updateItem(); |
1226 | } | 1226 | } |
1227 | // Adjust sub cell geometry of all conflict items of all conflict items | 1227 | // Adjust sub cell geometry of all conflict items of all conflict items |
1228 | for ( item=conflictItems.first(); item != 0; | 1228 | for ( item=conflictItems.first(); item != 0; |
1229 | item=conflictItems.next() ) { | 1229 | item=conflictItems.next() ) { |
1230 | if ( placeItem != item ) { | 1230 | if ( placeItem != item ) { |
1231 | KOAgendaItem *item2; | 1231 | KOAgendaItem *item2; |
1232 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | 1232 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); |
1233 | for ( item2=conflictItems2.first(); item2 != 0; | 1233 | for ( item2=conflictItems2.first(); item2 != 0; |
1234 | item2=conflictItems2.next() ) { | 1234 | item2=conflictItems2.next() ) { |
1235 | if ( item2->subCells() != maxSubCells) { | 1235 | if ( item2->subCells() != maxSubCells) { |
1236 | item2->setSubCells(maxSubCells); | 1236 | item2->setSubCells(maxSubCells); |
1237 | if (mAllDayMode) { | 1237 | if (mAllDayMode) { |
1238 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | 1238 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); |
1239 | } else { | 1239 | } else { |
1240 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | 1240 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); |
1241 | } | 1241 | } |
1242 | int x,y; | 1242 | int x,y; |
1243 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | 1243 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); |
1244 | if (mAllDayMode) { | 1244 | if (mAllDayMode) { |
1245 | y += item2->subCell() * newSubCellWidth; | 1245 | y += item2->subCell() * newSubCellWidth; |
1246 | } else { | 1246 | } else { |
1247 | x += item2->subCell() * newSubCellWidth; | 1247 | x += item2->subCell() * newSubCellWidth; |
1248 | } | 1248 | } |
1249 | moveChild(item2,x,y); | 1249 | moveChild(item2,x,y); |
1250 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | 1250 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); |
1251 | } | 1251 | } |
1252 | } | 1252 | } |
1253 | } | 1253 | } |
1254 | } | 1254 | } |
1255 | } else { | 1255 | } else { |
1256 | placeItem->setSubCell(0); | 1256 | placeItem->setSubCell(0); |
1257 | placeItem->setSubCells(1); | 1257 | placeItem->setSubCells(1); |
1258 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1258 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1259 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1259 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1260 | int x,y; | 1260 | int x,y; |
1261 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1261 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1262 | moveChild(placeItem,x,y); | 1262 | moveChild(placeItem,x,y); |
1263 | } | 1263 | } |
1264 | placeItem->setConflictItems(conflictItems); | 1264 | placeItem->setConflictItems(conflictItems); |
1265 | // for ( item=conflictItems.first(); item != 0; | 1265 | // for ( item=conflictItems.first(); item != 0; |
1266 | // item=conflictItems.next() ) { | 1266 | // item=conflictItems.next() ) { |
1267 | // //item->updateItem(); | 1267 | // //item->updateItem(); |
1268 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1268 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1269 | // } | 1269 | // } |
1270 | // placeItem->updateItem(); | 1270 | // placeItem->updateItem(); |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1273 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1274 | { | 1274 | { |
1275 | if ( globalFlagBlockAgenda ) | 1275 | if ( globalFlagBlockAgenda ) |
1276 | return; | 1276 | return; |
1277 | 1277 | ||
1278 | if ( mInvalidPixmap ) { | 1278 | if ( mInvalidPixmap ) { |
1279 | mInvalidPixmap = false; | 1279 | mInvalidPixmap = false; |
1280 | qDebug("KO: Upsizing Pixmaps "); | 1280 | qDebug("KO: Upsizing Pixmaps "); |
1281 | computeSizes(); | 1281 | computeSizes(); |
1282 | emit updateViewSignal(); | 1282 | emit updateViewSignal(); |
1283 | return; | 1283 | return; |
1284 | } | 1284 | } |
1285 | if ( ! mAllDayMode ) { | 1285 | if ( ! mAllDayMode ) { |
1286 | // currently not working for | 1286 | // currently not working for |
1287 | 1287 | ||
1288 | //qDebug("KOAgenda::drawContents "); | 1288 | //qDebug("KOAgenda::drawContents "); |
1289 | #if 0 | 1289 | #if 0 |
1290 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { | 1290 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1291 | qDebug("WAU "); | 1291 | qDebug("WAU "); |
1292 | drawContentsToPainter(); | 1292 | drawContentsToPainter(); |
1293 | } | 1293 | } |
1294 | #endif | 1294 | #endif |
1295 | QPaintDevice* pd = p->device(); | 1295 | QPaintDevice* pd = p->device(); |
1296 | p->end(); | 1296 | p->end(); |
1297 | int vx, vy; | 1297 | int vx, vy; |
1298 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1298 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1299 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1299 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1300 | mSelectionCellX * mGridSpacingX; | 1300 | mSelectionCellX * mGridSpacingX; |
1301 | contentsToViewport ( cx, cy, vx,vy); | 1301 | contentsToViewport ( cx, cy, vx,vy); |
1302 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; | 1302 | //qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ; |
1303 | 1303 | ||
1304 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { | 1304 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) { |
1305 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1305 | if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1306 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { | 1306 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) { |
1307 | 1307 | ||
1308 | int vxSel, vySel; | 1308 | int vxSel, vySel; |
1309 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); | 1309 | contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel); |
1310 | int off = mSelectionHeight; | 1310 | int off = mSelectionHeight; |
1311 | if ( vySel < 0 ) | 1311 | if ( vySel < 0 ) |
1312 | off += vySel; | 1312 | off += vySel; |
1313 | //qDebug("OFF %d %d %d", off,vySel, vy ); | 1313 | //qDebug("OFF %d %d %d", off,vySel, vy ); |
1314 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); | 1314 | bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP); |
1315 | } else { | 1315 | } else { |
1316 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1316 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | if ( mSelectionHeight > 0 ) { | 1319 | if ( mSelectionHeight > 0 ) { |
1320 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1320 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1321 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1321 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1322 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1322 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1323 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1323 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1324 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1324 | // bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1325 | int hei = mSelectionHeight; | 1325 | int hei = mSelectionHeight; |
1326 | int offset = 0; | 1326 | int offset = 0; |
1327 | while ( hei > 0 ) { | 1327 | while ( hei > 0 ) { |
1328 | int p_hei = 5; | 1328 | int p_hei = 5; |
1329 | if ( hei < 5 ) p_hei = hei; | 1329 | if ( hei < 5 ) p_hei = hei; |
1330 | hei -= 5; | 1330 | hei -= 5; |
1331 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1331 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1332 | offset += 5; | 1332 | offset += 5; |
1333 | } | 1333 | } |
1334 | } | 1334 | } |
1335 | } | 1335 | } |
1336 | p->begin( pd ); | 1336 | p->begin( pd ); |
1337 | } else { | 1337 | } else { |
1338 | #if 0 | 1338 | #if 0 |
1339 | qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); | 1339 | qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() ); |
1340 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { | 1340 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) { |
1341 | qDebug("WAUWAU "); | 1341 | qDebug("WAUWAU "); |
1342 | drawContentsToPainter(); | 1342 | drawContentsToPainter(); |
1343 | } | 1343 | } |
1344 | #endif | 1344 | #endif |
1345 | QPaintDevice* pd = p->device(); | 1345 | QPaintDevice* pd = p->device(); |
1346 | p->end(); | 1346 | p->end(); |
1347 | int vx, vy; | 1347 | int vx, vy; |
1348 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1348 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1349 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1349 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1350 | mSelectionCellX * mGridSpacingX; | 1350 | mSelectionCellX * mGridSpacingX; |
1351 | contentsToViewport ( cx, cy, vx,vy); | 1351 | contentsToViewport ( cx, cy, vx,vy); |
1352 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1352 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1353 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1353 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1354 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1354 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1355 | 1355 | ||
1356 | if ( mSelectionHeight > 0 ) { | 1356 | if ( mSelectionHeight > 0 ) { |
1357 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1357 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1358 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1358 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1359 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1359 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1360 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1360 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1361 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1361 | //bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1362 | int hei = mSelectionHeight; | 1362 | int hei = mSelectionHeight; |
1363 | int offset = 0; | 1363 | int offset = 0; |
1364 | while ( hei > 0 ) { | 1364 | while ( hei > 0 ) { |
1365 | int p_hei = 5; | 1365 | int p_hei = 5; |
1366 | if ( hei < 5 ) p_hei = hei; | 1366 | if ( hei < 5 ) p_hei = hei; |
1367 | hei -= 5; | 1367 | hei -= 5; |
1368 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); | 1368 | bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP); |
1369 | offset += 5; | 1369 | offset += 5; |
1370 | } | 1370 | } |
1371 | } | 1371 | } |
1372 | } | 1372 | } |
1373 | p->begin( pd ); | 1373 | p->begin( pd ); |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | void KOAgenda::finishUpdate() | 1378 | void KOAgenda::finishUpdate() |
1379 | { | 1379 | { |
1380 | 1380 | ||
1381 | KOAgendaItem *item; | 1381 | KOAgendaItem *item; |
1382 | globalFlagBlockAgendaItemPaint = 1; | 1382 | globalFlagBlockAgendaItemPaint = 1; |
1383 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems | 1383 | // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems |
1384 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1384 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1385 | if ( !item->checkLayout() ) { | 1385 | if ( !item->checkLayout() ) { |
1386 | //qDebug(" conflictitem found "); | 1386 | //qDebug(" conflictitem found "); |
1387 | int newSubCellWidth; | 1387 | int newSubCellWidth; |
1388 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); | 1388 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells(); |
1389 | else newSubCellWidth = mGridSpacingX / item->subCells(); | 1389 | else newSubCellWidth = mGridSpacingX / item->subCells(); |
1390 | 1390 | ||
1391 | if (mAllDayMode) { | 1391 | if (mAllDayMode) { |
1392 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1392 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1393 | } else { | 1393 | } else { |
1394 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1394 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1395 | } | 1395 | } |
1396 | int x,y; | 1396 | int x,y; |
1397 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1397 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1398 | if (mAllDayMode) { | 1398 | if (mAllDayMode) { |
1399 | y += item->subCell() * newSubCellWidth; | 1399 | y += item->subCell() * newSubCellWidth; |
1400 | } else { | 1400 | } else { |
1401 | x += item->subCell() * newSubCellWidth; | 1401 | x += item->subCell() * newSubCellWidth; |
1402 | } | 1402 | } |
1403 | moveChild(item,x,y); | 1403 | moveChild(item,x,y); |
1404 | } | 1404 | } |
1405 | } | 1405 | } |
1406 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1406 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1407 | if ( !item->isVisible() ) | 1407 | if ( !item->isVisible() ) |
1408 | item->show(); | 1408 | item->show(); |
1409 | 1409 | ||
1410 | } | 1410 | } |
1411 | globalFlagBlockAgendaItemUpdate = 0; | 1411 | globalFlagBlockAgendaItemUpdate = 0; |
1412 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1412 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1413 | item->repaintMe( ); | 1413 | item->repaintMe( ); |
1414 | } | 1414 | } |
1415 | globalFlagBlockAgendaItemUpdate = 1; | 1415 | globalFlagBlockAgendaItemUpdate = 1; |
1416 | qApp->processEvents(); | 1416 | qApp->processEvents(); |
1417 | globalFlagBlockAgendaItemPaint = 0; | 1417 | globalFlagBlockAgendaItemPaint = 0; |
1418 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1418 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1419 | item->repaint( false ); | 1419 | item->repaint( false ); |
1420 | } | 1420 | } |
1421 | marcus_bains(); | 1421 | marcus_bains(); |
1422 | } | 1422 | } |
1423 | 1423 | ||
1424 | /* | 1424 | /* |
1425 | Draw grid in the background of the agenda. | 1425 | Draw grid in the background of the agenda. |
1426 | */ | 1426 | */ |
1427 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1427 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1428 | { | 1428 | { |
1429 | 1429 | ||
1430 | 1430 | ||
1431 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1431 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1432 | return; | 1432 | return; |
1433 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1433 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1434 | return; | 1434 | return; |
1435 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1435 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1436 | if ( ch < 1 ) | 1436 | if ( ch < 1 ) |
1437 | ch = 1; | 1437 | ch = 1; |
1438 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1438 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1439 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1439 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1440 | } | 1440 | } |
1441 | mCurPixWid = contentsWidth(); | 1441 | mCurPixWid = contentsWidth(); |
1442 | mCurPixHei = ch; | 1442 | mCurPixHei = ch; |
1443 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { | 1443 | if ( mHighlightPixmap.width() < mGridSpacingX-1 ) { |
1444 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); | 1444 | mHighlightPixmap.resize( mGridSpacingX-1, 5 ); |
1445 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1445 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1446 | } | 1446 | } |
1447 | mPixPainter.begin( &mPaintPixmap) ; | 1447 | mPixPainter.begin( &mPaintPixmap) ; |
1448 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1448 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1449 | QPainter * p ; | 1449 | QPainter * p ; |
1450 | if (paint == 0) { | 1450 | if (paint == 0) { |
1451 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1451 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1452 | p = &mPixPainter; | 1452 | p = &mPixPainter; |
1453 | } | 1453 | } |
1454 | else | 1454 | else |
1455 | p = paint ; | 1455 | p = paint ; |
1456 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1456 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1457 | 1457 | ||
1458 | //--cx;++cw; | 1458 | //--cx;++cw; |
1459 | int lGridSpacingY = mGridSpacingY*2; | 1459 | int lGridSpacingY = mGridSpacingY*2; |
1460 | int selDay; | 1460 | int selDay; |
1461 | QDate curDate = QDate::currentDate(); | 1461 | QDate curDate = QDate::currentDate(); |
1462 | if ( !backgroundOnly ) { | 1462 | if ( !backgroundOnly ) { |
1463 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1463 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1464 | { | 1464 | { |
1465 | if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { | 1465 | if ( mSelectedDates[selDay] == curDate && KOPrefs::instance()->mHighlightCurrentDay) { |
1466 | int x1 = cx; | 1466 | int x1 = cx; |
1467 | int y1 = 0; | 1467 | int y1 = 0; |
1468 | if (y1 < cy) y1 = cy; | 1468 | if (y1 < cy) y1 = cy; |
1469 | int x2 = cx+cw-1; | 1469 | int x2 = cx+cw-1; |
1470 | int y2 = contentsHeight(); | 1470 | int y2 = contentsHeight(); |
1471 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1471 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1472 | if (x2 >= x1 && y2 >= y1) { | 1472 | if (x2 >= x1 && y2 >= y1) { |
1473 | int gxStart = selDay; | 1473 | int gxStart = selDay; |
1474 | int gxEnd = gxStart ; | 1474 | int gxEnd = gxStart ; |
1475 | int xStart = KOGlobals::self()->reverseLayout() ? | 1475 | int xStart = KOGlobals::self()->reverseLayout() ? |
1476 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1476 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1477 | gxStart*mGridSpacingX; | 1477 | gxStart*mGridSpacingX; |
1478 | if (xStart < x1) xStart = x1; | 1478 | if (xStart < x1) xStart = x1; |
1479 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1479 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1480 | (mColumns - gxStart)*mGridSpacingX-1 : | 1480 | (mColumns - gxStart)*mGridSpacingX-1 : |
1481 | (gxStart+1)*mGridSpacingX-1; | 1481 | (gxStart+1)*mGridSpacingX-1; |
1482 | if (xEnd > x2) xEnd = x2; | 1482 | if (xEnd > x2) xEnd = x2; |
1483 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1483 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1484 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1484 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1485 | KOPrefs::instance()->mAgendaBgColor.light()); | 1485 | KOPrefs::instance()->mAgendaBgColor.light()); |
1486 | else | 1486 | else |
1487 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1487 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1488 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1488 | KOPrefs::instance()->mAgendaBgColor.dark()); |
1489 | 1489 | ||
1490 | } | 1490 | } |
1491 | } | 1491 | } |
1492 | } | 1492 | } |
1493 | } | 1493 | } |
1494 | // Highlight working hours | 1494 | // Highlight working hours |
1495 | 1495 | ||
1496 | if ( !backgroundOnly ) | 1496 | if ( !backgroundOnly ) |
1497 | if (mWorkingHoursEnable) { | 1497 | if (mWorkingHoursEnable) { |
1498 | int x1 = cx; | 1498 | int x1 = cx; |
1499 | int y1 = mWorkingHoursYTop; | 1499 | int y1 = mWorkingHoursYTop; |
1500 | if (y1 < cy) y1 = cy; | 1500 | if (y1 < cy) y1 = cy; |
1501 | int x2 = cx+cw-1; | 1501 | int x2 = cx+cw-1; |
1502 | // int x2 = mGridSpacingX * 5 - 1; | 1502 | // int x2 = mGridSpacingX * 5 - 1; |
1503 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1503 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1504 | int y2 = mWorkingHoursYBottom; | 1504 | int y2 = mWorkingHoursYBottom; |
1505 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1505 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1506 | 1506 | ||
1507 | if (x2 >= x1 && y2 >= y1) { | 1507 | if (x2 >= x1 && y2 >= y1) { |
1508 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1508 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1509 | int gxStart = x1/mGridSpacingX; | 1509 | int gxStart = x1/mGridSpacingX; |
1510 | int gxEnd = x2/mGridSpacingX; | 1510 | int gxEnd = x2/mGridSpacingX; |
1511 | while(gxStart <= gxEnd) { | 1511 | while(gxStart <= gxEnd) { |
1512 | if (gxStart < int(mHolidayMask->count()) && | 1512 | if (gxStart < int(mHolidayMask->count()) && |
1513 | !mHolidayMask->at(gxStart)) { | 1513 | !mHolidayMask->at(gxStart)) { |
1514 | int xStart = KOGlobals::self()->reverseLayout() ? | 1514 | int xStart = KOGlobals::self()->reverseLayout() ? |
1515 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1515 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1516 | gxStart*mGridSpacingX; | 1516 | gxStart*mGridSpacingX; |
1517 | if (xStart < x1) xStart = x1; | 1517 | if (xStart < x1) xStart = x1; |
1518 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1518 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1519 | (mColumns - gxStart)*mGridSpacingX-1 : | 1519 | (mColumns - gxStart)*mGridSpacingX-1 : |
1520 | (gxStart+1)*mGridSpacingX-1; | 1520 | (gxStart+1)*mGridSpacingX-1; |
1521 | if (xEnd > x2) xEnd = x2; | 1521 | if (xEnd > x2) xEnd = x2; |
1522 | if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { | 1522 | if ( mSelectedDates[gxStart] == curDate && KOPrefs::instance()->mHighlightCurrentDay ) { |
1523 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1523 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1524 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1524 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1525 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1525 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1526 | else | 1526 | else |
1527 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1527 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1528 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1528 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1529 | } else { | 1529 | } else { |
1530 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1530 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1531 | KOPrefs::instance()->mWorkingHoursColor); | 1531 | KOPrefs::instance()->mWorkingHoursColor); |
1532 | } | 1532 | } |
1533 | } | 1533 | } |
1534 | ++gxStart; | 1534 | ++gxStart; |
1535 | } | 1535 | } |
1536 | } | 1536 | } |
1537 | } | 1537 | } |
1538 | /* | 1538 | /* |
1539 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1539 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1540 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1540 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1541 | mSelectionCellX * mGridSpacingX; | 1541 | mSelectionCellX * mGridSpacingX; |
1542 | 1542 | ||
1543 | // Draw selection | 1543 | // Draw selection |
1544 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1544 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1545 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1545 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1546 | // TODO: paint only part within cx,cy,cw,ch | 1546 | // TODO: paint only part within cx,cy,cw,ch |
1547 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | 1547 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, |
1548 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | 1548 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); |
1549 | } | 1549 | } |
1550 | */ | 1550 | */ |
1551 | // Draw vertical lines of grid | 1551 | // Draw vertical lines of grid |
1552 | 1552 | ||
1553 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; | 1553 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; |
1554 | if ( mGridSpacingX > 0 ) { | 1554 | if ( mGridSpacingX > 0 ) { |
1555 | while (x < cx + cw) { | 1555 | while (x < cx + cw) { |
1556 | p->drawLine(x,cy,x,cy+ch); | 1556 | p->drawLine(x,cy,x,cy+ch); |
1557 | x+=mGridSpacingX; | 1557 | x+=mGridSpacingX; |
1558 | } | 1558 | } |
1559 | } | 1559 | } |
1560 | // Draw horizontal lines of grid | 1560 | // Draw horizontal lines of grid |
1561 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; | 1561 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; |
1562 | if ( lGridSpacingY > 0 ) { | 1562 | if ( lGridSpacingY > 0 ) { |
1563 | while (y < cy + ch) { | 1563 | while (y < cy + ch) { |
1564 | p->setPen( SolidLine ); | 1564 | p->setPen( SolidLine ); |
1565 | p->drawLine(cx,y,cx+cw,y); | 1565 | p->drawLine(cx,y,cx+cw,y); |
1566 | y+=lGridSpacingY; | 1566 | y+=lGridSpacingY; |
1567 | p->setPen( DotLine ); | 1567 | p->setPen( DotLine ); |
1568 | p->drawLine(cx,y,cx+cw,y); | 1568 | p->drawLine(cx,y,cx+cw,y); |
1569 | y+=lGridSpacingY; | 1569 | y+=lGridSpacingY; |
1570 | } | 1570 | } |
1571 | p->setPen( SolidLine ); | 1571 | p->setPen( SolidLine ); |
1572 | } | 1572 | } |
1573 | mPixPainter.end() ; | 1573 | mPixPainter.end() ; |
1574 | } | 1574 | } |
1575 | 1575 | ||
1576 | /* | 1576 | /* |
1577 | Convert srcollview contents coordinates to agenda grid coordinates. | 1577 | Convert srcollview contents coordinates to agenda grid coordinates. |
1578 | */ | 1578 | */ |
1579 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) | 1579 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) |
1580 | { | 1580 | { |
1581 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : | 1581 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : |
1582 | x/mGridSpacingX; | 1582 | x/mGridSpacingX; |
1583 | gy = y/mGridSpacingY; | 1583 | gy = y/mGridSpacingY; |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | /* | 1586 | /* |
1587 | Convert agenda grid coordinates to scrollview contents coordinates. | 1587 | Convert agenda grid coordinates to scrollview contents coordinates. |
1588 | */ | 1588 | */ |
1589 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) | 1589 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) |
1590 | { | 1590 | { |
1591 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: | 1591 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: |
1592 | gx*mGridSpacingX; | 1592 | gx*mGridSpacingX; |
1593 | y = gy*mGridSpacingY; | 1593 | y = gy*mGridSpacingY; |
1594 | } | 1594 | } |
1595 | 1595 | ||
1596 | 1596 | ||
1597 | /* | 1597 | /* |
1598 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into | 1598 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into |
1599 | the grid. | 1599 | the grid. |
1600 | */ | 1600 | */ |
1601 | int KOAgenda::timeToY(const QTime &time) | 1601 | int KOAgenda::timeToY(const QTime &time) |
1602 | { | 1602 | { |
1603 | int minutesPerCell = 24 * 60 / mRows; | 1603 | int minutesPerCell = 24 * 60 / mRows; |
1604 | int timeMinutes = time.hour() * 60 + time.minute(); | 1604 | int timeMinutes = time.hour() * 60 + time.minute(); |
1605 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; | 1605 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; |
1606 | return Y; | 1606 | return Y; |
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | 1609 | ||
1610 | /* | 1610 | /* |
1611 | Return time corresponding to cell y coordinate. Coordinates are rounded to | 1611 | Return time corresponding to cell y coordinate. Coordinates are rounded to |
1612 | fit into the grid. | 1612 | fit into the grid. |
1613 | */ | 1613 | */ |
1614 | QTime KOAgenda::gyToTime(int gy) | 1614 | QTime KOAgenda::gyToTime(int gy) |
1615 | { | 1615 | { |
1616 | 1616 | ||
1617 | int secondsPerCell = 24 * 60 * 60/ mRows; | 1617 | int secondsPerCell = 24 * 60 * 60/ mRows; |
1618 | 1618 | ||
1619 | int timeSeconds = secondsPerCell * gy; | 1619 | int timeSeconds = secondsPerCell * gy; |
1620 | 1620 | ||
1621 | QTime time( 0, 0, 0 ); | 1621 | QTime time( 0, 0, 0 ); |
1622 | if ( timeSeconds < 24 * 60 * 60 ) { | 1622 | if ( timeSeconds < 24 * 60 * 60 ) { |
1623 | time = time.addSecs(timeSeconds); | 1623 | time = time.addSecs(timeSeconds); |
1624 | } else { | 1624 | } else { |
1625 | time.setHMS( 23, 59, 59 ); | 1625 | time.setHMS( 23, 59, 59 ); |
1626 | } | 1626 | } |
1627 | 1627 | ||
1628 | return time; | 1628 | return time; |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | void KOAgenda::setStartHour(int startHour) | 1631 | void KOAgenda::setStartHour(int startHour) |
1632 | { | 1632 | { |
1633 | int startCell = startHour * mRows / 24; | 1633 | int startCell = startHour * mRows / 24; |
1634 | setContentsPos(0,startCell * gridSpacingY()); | 1634 | setContentsPos(0,startCell * gridSpacingY()); |
1635 | } | 1635 | } |
1636 | QTime KOAgenda::getEndTime() | 1636 | QTime KOAgenda::getEndTime() |
1637 | { | 1637 | { |
1638 | return QTime ( (contentsY ()+viewport()->height())*24/contentsHeight ()+1,0,0); | 1638 | int tim = (contentsY ()+viewport()->height())*24/contentsHeight (); |
1639 | if ( tim > 23 ) | ||
1640 | return QTime ( 23,59,59); | ||
1641 | return QTime ( tim,0,0); | ||
1639 | } | 1642 | } |
1640 | void KOAgenda::hideUnused() | 1643 | void KOAgenda::hideUnused() |
1641 | { | 1644 | { |
1642 | // experimental only | 1645 | // experimental only |
1643 | // return; | 1646 | // return; |
1644 | KOAgendaItem *item; | 1647 | KOAgendaItem *item; |
1645 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { | 1648 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { |
1646 | item->hide(); | 1649 | item->hide(); |
1647 | } | 1650 | } |
1648 | } | 1651 | } |
1649 | 1652 | ||
1650 | 1653 | ||
1651 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) | 1654 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) |
1652 | { | 1655 | { |
1653 | 1656 | ||
1654 | KOAgendaItem *fi; | 1657 | KOAgendaItem *fi; |
1655 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { | 1658 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { |
1656 | if ( fi->incidence() == event ) { | 1659 | if ( fi->incidence() == event ) { |
1657 | mUnusedItems.remove(); | 1660 | mUnusedItems.remove(); |
1658 | fi->init( event, qd ); | 1661 | fi->init( event, qd ); |
1659 | return fi; | 1662 | return fi; |
1660 | } | 1663 | } |
1661 | } | 1664 | } |
1662 | fi=mUnusedItems.first(); | 1665 | fi=mUnusedItems.first(); |
1663 | if ( fi ) { | 1666 | if ( fi ) { |
1664 | mUnusedItems.remove(); | 1667 | mUnusedItems.remove(); |
1665 | fi->init( event, qd ); | 1668 | fi->init( event, qd ); |
1666 | return fi; | 1669 | return fi; |
1667 | } | 1670 | } |
1668 | // qDebug("new KOAgendaItem "); | 1671 | // qDebug("new KOAgendaItem "); |
1669 | 1672 | ||
1670 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); | 1673 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); |
1671 | agendaItem->installEventFilter(this); | 1674 | agendaItem->installEventFilter(this); |
1672 | addChild(agendaItem,0,0); | 1675 | addChild(agendaItem,0,0); |
1673 | return agendaItem; | 1676 | return agendaItem; |
1674 | } | 1677 | } |
1675 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) | 1678 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) |
1676 | { | 1679 | { |
1677 | KOAgendaItem *item; | 1680 | KOAgendaItem *item; |
1678 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1681 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1679 | if ( item->incidence() == todo ) { | 1682 | if ( item->incidence() == todo ) { |
1680 | mItems.remove(); | 1683 | mItems.remove(); |
1681 | return item; | 1684 | return item; |
1682 | } | 1685 | } |
1683 | } | 1686 | } |
1684 | return 0; | 1687 | return 0; |
1685 | } | 1688 | } |
1686 | 1689 | ||
1687 | 1690 | ||
1688 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | 1691 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) |
1689 | { | 1692 | { |
1690 | // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| | 1693 | // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| |
1691 | KOAgendaItem *item; | 1694 | KOAgendaItem *item; |
1692 | item = getItemForTodo ( todo ); | 1695 | item = getItemForTodo ( todo ); |
1693 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); | 1696 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); |
1694 | if ( item ) { | 1697 | if ( item ) { |
1695 | blockSignals( true ); | 1698 | blockSignals( true ); |
1696 | //qDebug("item found "); | 1699 | //qDebug("item found "); |
1697 | item->hide(); | 1700 | item->hide(); |
1698 | item->setCellX(-2, -1 ); | 1701 | item->setCellX(-2, -1 ); |
1699 | item->select(false); | 1702 | item->select(false); |
1700 | mUnusedItems.append( item ); | 1703 | mUnusedItems.append( item ); |
1701 | mItems.remove( item ); | 1704 | mItems.remove( item ); |
1702 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1705 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1703 | KOAgendaItem *itemit; | 1706 | KOAgendaItem *itemit; |
1704 | //globalFlagBlockAgendaItemPaint = 1; | 1707 | //globalFlagBlockAgendaItemPaint = 1; |
1705 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1708 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1706 | itemit=oldconflictItems.next() ) { | 1709 | itemit=oldconflictItems.next() ) { |
1707 | if ( itemit != item ) | 1710 | if ( itemit != item ) |
1708 | placeSubCells(itemit); | 1711 | placeSubCells(itemit); |
1709 | } | 1712 | } |
1710 | qApp->processEvents(); | 1713 | qApp->processEvents(); |
1711 | //globalFlagBlockAgendaItemPaint = 0; | 1714 | //globalFlagBlockAgendaItemPaint = 0; |
1712 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1715 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1713 | itemit=oldconflictItems.next() ) { | 1716 | itemit=oldconflictItems.next() ) { |
1714 | globalFlagBlockAgendaItemUpdate = 0; | 1717 | globalFlagBlockAgendaItemUpdate = 0; |
1715 | if ( itemit != item ) | 1718 | if ( itemit != item ) |
1716 | itemit->repaintMe(); | 1719 | itemit->repaintMe(); |
1717 | globalFlagBlockAgendaItemUpdate = 1; | 1720 | globalFlagBlockAgendaItemUpdate = 1; |
1718 | //qDebug("sigleshot "); | 1721 | //qDebug("sigleshot "); |
1719 | QTimer::singleShot( 0, itemit, SLOT ( repaintItem() )); | 1722 | QTimer::singleShot( 0, itemit, SLOT ( repaintItem() )); |
1720 | //itemit->repaint( false ); repaintItem() | 1723 | //itemit->repaint( false ); repaintItem() |
1721 | } | 1724 | } |
1722 | blockSignals( false ); | 1725 | blockSignals( false ); |
1723 | } | 1726 | } |
1724 | if ( remove ) { | 1727 | if ( remove ) { |
1725 | //qDebug("remove****************************************** "); | 1728 | //qDebug("remove****************************************** "); |
1726 | return; | 1729 | return; |
1727 | } | 1730 | } |
1728 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) | 1731 | if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) |
1729 | return; | 1732 | return; |
1730 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); | 1733 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); |
1731 | QDate currentDate = QDate::currentDate(); | 1734 | QDate currentDate = QDate::currentDate(); |
1732 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); | 1735 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda ); |
1733 | QDateTime dt; | 1736 | QDateTime dt; |
1734 | if ( todo->hasCompletedDate() ) | 1737 | if ( todo->hasCompletedDate() ) |
1735 | dt = todo->completed(); | 1738 | dt = todo->completed(); |
1736 | else | 1739 | else |
1737 | dt = todo->dtDue(); | 1740 | dt = todo->dtDue(); |
1738 | if ( overdue ) { | 1741 | if ( overdue ) { |
1739 | days += todo->dtDue().date().daysTo( currentDate ); | 1742 | days += todo->dtDue().date().daysTo( currentDate ); |
1740 | } | 1743 | } |
1741 | else | 1744 | else |
1742 | currentDate = dt.date(); | 1745 | currentDate = dt.date(); |
1743 | 1746 | ||
1744 | if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { | 1747 | if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) { |
1745 | if ( ! mAllDayMode ) return; | 1748 | if ( ! mAllDayMode ) return; |
1746 | // aldayagenda | 1749 | // aldayagenda |
1747 | globalFlagBlockAgendaItemPaint = 1; | 1750 | globalFlagBlockAgendaItemPaint = 1; |
1748 | item = insertAllDayItem(todo, currentDate,days, days); | 1751 | item = insertAllDayItem(todo, currentDate,days, days); |
1749 | item->show(); | 1752 | item->show(); |
1750 | 1753 | ||
1751 | } | 1754 | } |
1752 | else { | 1755 | else { |
1753 | if ( mAllDayMode ) return; | 1756 | if ( mAllDayMode ) return; |
1754 | // mAgenda | 1757 | // mAgenda |
1755 | globalFlagBlockAgendaItemPaint = 1; | 1758 | globalFlagBlockAgendaItemPaint = 1; |
1756 | int endY = timeToY(dt.time()) - 1; | 1759 | int endY = timeToY(dt.time()) - 1; |
1757 | int hi = 12/KOPrefs::instance()->mHourSize; | 1760 | int hi = 12/KOPrefs::instance()->mHourSize; |
1758 | int startY = endY - 1-hi; | 1761 | int startY = endY - 1-hi; |
1759 | item = insertItem(todo,currentDate,days,startY,endY); | 1762 | item = insertItem(todo,currentDate,days,startY,endY); |
1760 | item->show(); | 1763 | item->show(); |
1761 | } | 1764 | } |
1762 | qApp->processEvents(); | 1765 | qApp->processEvents(); |
1763 | globalFlagBlockAgendaItemPaint = 0; | 1766 | globalFlagBlockAgendaItemPaint = 0; |
1764 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1767 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1765 | KOAgendaItem *itemit; | 1768 | KOAgendaItem *itemit; |
1766 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1769 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1767 | itemit=oldconflictItems.next() ) { | 1770 | itemit=oldconflictItems.next() ) { |
1768 | globalFlagBlockAgendaItemUpdate = 0; | 1771 | globalFlagBlockAgendaItemUpdate = 0; |
1769 | itemit->repaintMe(); | 1772 | itemit->repaintMe(); |
1770 | globalFlagBlockAgendaItemUpdate = 1; | 1773 | globalFlagBlockAgendaItemUpdate = 1; |
1771 | itemit->repaint(); | 1774 | itemit->repaint(); |
1772 | } | 1775 | } |
1773 | globalFlagBlockAgendaItemUpdate = 0; | 1776 | globalFlagBlockAgendaItemUpdate = 0; |
1774 | item->repaintMe(); | 1777 | item->repaintMe(); |
1775 | globalFlagBlockAgendaItemUpdate = 1; | 1778 | globalFlagBlockAgendaItemUpdate = 1; |
1776 | item->repaint(); | 1779 | item->repaint(); |
1777 | } | 1780 | } |
1778 | /* | 1781 | /* |
1779 | Insert KOAgendaItem into agenda. | 1782 | Insert KOAgendaItem into agenda. |
1780 | */ | 1783 | */ |
1781 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) | 1784 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) |
1782 | { | 1785 | { |
1783 | if (mAllDayMode) { | 1786 | if (mAllDayMode) { |
1784 | qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); | 1787 | qDebug("KOAgenda: calling insertItem in all-day mode is illegal. "); |
1785 | return 0; | 1788 | return 0; |
1786 | } | 1789 | } |
1787 | 1790 | ||
1788 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1791 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1789 | //agendaItem->setFrameStyle(WinPanel|Raised); | 1792 | //agendaItem->setFrameStyle(WinPanel|Raised); |
1790 | 1793 | ||
1791 | int YSize = YBottom - YTop + 1; | 1794 | int YSize = YBottom - YTop + 1; |
1792 | if (YSize < 0) { | 1795 | if (YSize < 0) { |
1793 | YSize = 1; | 1796 | YSize = 1; |
1794 | } | 1797 | } |
1795 | int iheight = mGridSpacingY * YSize; | 1798 | int iheight = mGridSpacingY * YSize; |
1796 | 1799 | ||
1797 | agendaItem->resize(mGridSpacingX,iheight ); | 1800 | agendaItem->resize(mGridSpacingX,iheight ); |
1798 | agendaItem->setCellXY(X,YTop,YBottom); | 1801 | agendaItem->setCellXY(X,YTop,YBottom); |
1799 | agendaItem->setCellXWidth(X); | 1802 | agendaItem->setCellXWidth(X); |
1800 | 1803 | ||
1801 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); | 1804 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); |
1802 | mItems.append(agendaItem); | 1805 | mItems.append(agendaItem); |
1803 | 1806 | ||
1804 | placeSubCells(agendaItem); | 1807 | placeSubCells(agendaItem); |
1805 | 1808 | ||
1806 | //agendaItem->show(); | 1809 | //agendaItem->show(); |
1807 | 1810 | ||
1808 | 1811 | ||
1809 | return agendaItem; | 1812 | return agendaItem; |
1810 | } | 1813 | } |
1811 | 1814 | ||
1812 | 1815 | ||
1813 | /* | 1816 | /* |
1814 | Insert all-day KOAgendaItem into agenda. | 1817 | Insert all-day KOAgendaItem into agenda. |
1815 | */ | 1818 | */ |
1816 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) | 1819 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) |
1817 | { | 1820 | { |
1818 | if (!mAllDayMode) { | 1821 | if (!mAllDayMode) { |
1819 | return 0; | 1822 | return 0; |
1820 | } | 1823 | } |
1821 | 1824 | ||
1822 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1825 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1823 | 1826 | ||
1824 | agendaItem->setCellXY(XBegin,0,0); | 1827 | agendaItem->setCellXY(XBegin,0,0); |
1825 | agendaItem->setCellXWidth(XEnd); | 1828 | agendaItem->setCellXWidth(XEnd); |
1826 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); | 1829 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); |
1827 | 1830 | ||
1828 | //addChild(agendaItem,XBegin*mGridSpacingX,0); | 1831 | //addChild(agendaItem,XBegin*mGridSpacingX,0); |
1829 | mItems.append(agendaItem); | 1832 | mItems.append(agendaItem); |
1830 | 1833 | ||
1831 | placeSubCells(agendaItem); | 1834 | placeSubCells(agendaItem); |
1832 | 1835 | ||
1833 | //agendaItem->show(); | 1836 | //agendaItem->show(); |
1834 | 1837 | ||
1835 | return agendaItem; | 1838 | return agendaItem; |
1836 | } | 1839 | } |
1837 | 1840 | ||
1838 | 1841 | ||
1839 | void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | 1842 | void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, |
1840 | int YTop,int YBottom) | 1843 | int YTop,int YBottom) |
1841 | { | 1844 | { |
1842 | if (mAllDayMode) { | 1845 | if (mAllDayMode) { |
1843 | ; | 1846 | ; |
1844 | return; | 1847 | return; |
1845 | } | 1848 | } |
1846 | 1849 | ||
1847 | int cellX,cellYTop,cellYBottom; | 1850 | int cellX,cellYTop,cellYBottom; |
1848 | QString newtext; | 1851 | QString newtext; |
1849 | int width = XEnd - XBegin + 1; | 1852 | int width = XEnd - XBegin + 1; |
1850 | int count = 0; | 1853 | int count = 0; |
1851 | KOAgendaItem *current = 0; | 1854 | KOAgendaItem *current = 0; |
1852 | QPtrList<KOAgendaItem> multiItems; | 1855 | QPtrList<KOAgendaItem> multiItems; |
1853 | for (cellX = XBegin;cellX <= XEnd;++cellX) { | 1856 | for (cellX = XBegin;cellX <= XEnd;++cellX) { |
1854 | if (cellX == XBegin) cellYTop = YTop; | 1857 | if (cellX == XBegin) cellYTop = YTop; |
1855 | else cellYTop = 0; | 1858 | else cellYTop = 0; |
1856 | if (cellX == XEnd) cellYBottom = YBottom; | 1859 | if (cellX == XEnd) cellYBottom = YBottom; |
1857 | else cellYBottom = rows() - 1; | 1860 | else cellYBottom = rows() - 1; |
1858 | newtext = QString("(%1/%2): ").arg(++count).arg(width); | 1861 | newtext = QString("(%1/%2): ").arg(++count).arg(width); |
1859 | newtext.append(event->summary()); | 1862 | newtext.append(event->summary()); |
1860 | current = insertItem(event,qd,cellX,cellYTop,cellYBottom); | 1863 | current = insertItem(event,qd,cellX,cellYTop,cellYBottom); |
1861 | current->setText(newtext); | 1864 | current->setText(newtext); |
1862 | multiItems.append(current); | 1865 | multiItems.append(current); |
1863 | } | 1866 | } |
1864 | 1867 | ||
1865 | KOAgendaItem *next = 0; | 1868 | KOAgendaItem *next = 0; |
1866 | KOAgendaItem *last = multiItems.last(); | 1869 | KOAgendaItem *last = multiItems.last(); |
1867 | KOAgendaItem *first = multiItems.first(); | 1870 | KOAgendaItem *first = multiItems.first(); |
1868 | KOAgendaItem *setFirst,*setLast; | 1871 | KOAgendaItem *setFirst,*setLast; |
1869 | current = first; | 1872 | current = first; |
1870 | while (current) { | 1873 | while (current) { |
1871 | next = multiItems.next(); | 1874 | next = multiItems.next(); |
1872 | if (current == first) setFirst = 0; | 1875 | if (current == first) setFirst = 0; |
1873 | else setFirst = first; | 1876 | else setFirst = first; |
1874 | if (current == last) setLast = 0; | 1877 | if (current == last) setLast = 0; |
1875 | else setLast = last; | 1878 | else setLast = last; |
1876 | 1879 | ||
1877 | current->setMultiItem(setFirst,next,setLast); | 1880 | current->setMultiItem(setFirst,next,setLast); |
1878 | current = next; | 1881 | current = next; |
1879 | } | 1882 | } |
1880 | } | 1883 | } |
1881 | 1884 | ||
1882 | 1885 | ||
1883 | //QSizePolicy KOAgenda::sizePolicy() const | 1886 | //QSizePolicy KOAgenda::sizePolicy() const |
1884 | //{ | 1887 | //{ |
1885 | // Thought this would make the all-day event agenda minimum size and the | 1888 | // Thought this would make the all-day event agenda minimum size and the |
1886 | // normal agenda take the remaining space. But it doesn´t work. The QSplitter | 1889 | // normal agenda take the remaining space. But it doesn´t work. The QSplitter |
1887 | // don´t seem to think that an Expanding widget needs more space than a | 1890 | // don´t seem to think that an Expanding widget needs more space than a |
1888 | // Preferred one. | 1891 | // Preferred one. |
1889 | // But it doesn´t hurt, so it stays. | 1892 | // But it doesn´t hurt, so it stays. |
1890 | // if (mAllDayMode) { | 1893 | // if (mAllDayMode) { |
1891 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); | 1894 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); |
1892 | // } else { | 1895 | // } else { |
1893 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); | 1896 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); |
1894 | // } | 1897 | // } |
1895 | //} | 1898 | //} |
1896 | void KOAgenda::finishResize ( ) | 1899 | void KOAgenda::finishResize ( ) |
1897 | { | 1900 | { |
1898 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); | 1901 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); |
1899 | if ( globalFlagBlockAgenda == 0 ) { | 1902 | if ( globalFlagBlockAgenda == 0 ) { |
1900 | finishUpdate(); | 1903 | finishUpdate(); |
1901 | //qDebug("finishUpdate() called "); | 1904 | //qDebug("finishUpdate() called "); |
1902 | } | 1905 | } |
1903 | } | 1906 | } |
1904 | /* | 1907 | /* |
1905 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. | 1908 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. |
1906 | */ | 1909 | */ |
1907 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) | 1910 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) |
1908 | { | 1911 | { |
1909 | mSelectionHeight = 0; | 1912 | mSelectionHeight = 0; |
1910 | mResizeTimer.start( 150 , true ); | 1913 | mResizeTimer.start( 150 , true ); |
1911 | computeSizes(); | 1914 | computeSizes(); |
1912 | return; | 1915 | return; |
1913 | 1916 | ||
1914 | } | 1917 | } |
1915 | void KOAgenda::computeSizes() | 1918 | void KOAgenda::computeSizes() |
1916 | { | 1919 | { |
1917 | if ( globalFlagBlockStartup ) | 1920 | if ( globalFlagBlockStartup ) |
1918 | return; | 1921 | return; |
1919 | int frameOffset = frameWidth() * 2 +1; | 1922 | int frameOffset = frameWidth() * 2 +1; |
1920 | if (mAllDayMode) { | 1923 | if (mAllDayMode) { |
1921 | mGridSpacingX = (width()-frameOffset) / mColumns; | 1924 | mGridSpacingX = (width()-frameOffset) / mColumns; |
1922 | mGridSpacingY = height() - 2 * frameWidth() - 1; | 1925 | mGridSpacingY = height() - 2 * frameWidth() - 1; |
1923 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); | 1926 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); |
1924 | // mGridSpacingY = height(); | 1927 | // mGridSpacingY = height(); |
1925 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1928 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1926 | 1929 | ||
1927 | KOAgendaItem *item; | 1930 | KOAgendaItem *item; |
1928 | int subCellWidth; | 1931 | int subCellWidth; |
1929 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1932 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1930 | subCellWidth = mGridSpacingY / item->subCells(); | 1933 | subCellWidth = mGridSpacingY / item->subCells(); |
1931 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); | 1934 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); |
1932 | moveChild(item,KOGlobals::self()->reverseLayout() ? | 1935 | moveChild(item,KOGlobals::self()->reverseLayout() ? |
1933 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1936 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1934 | item->cellX() * mGridSpacingX, | 1937 | item->cellX() * mGridSpacingX, |
1935 | item->subCell() * subCellWidth); | 1938 | item->subCell() * subCellWidth); |
1936 | } | 1939 | } |
1937 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; | 1940 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; |
1938 | } else { | 1941 | } else { |
1939 | mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; | 1942 | mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; |
1940 | if (height() > mGridSpacingY * mRows + 1 ) { | 1943 | if (height() > mGridSpacingY * mRows + 1 ) { |
1941 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; | 1944 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; |
1942 | mGridSpacingY = KOPrefs::instance()->mHourSize ; | 1945 | mGridSpacingY = KOPrefs::instance()->mHourSize ; |
1943 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1946 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1944 | emit resizedSignal(); | 1947 | emit resizedSignal(); |
1945 | } else | 1948 | } else |
1946 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1949 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1947 | KOAgendaItem *item; | 1950 | KOAgendaItem *item; |
1948 | int subCellWidth; | 1951 | int subCellWidth; |
1949 | 1952 | ||
1950 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1953 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1951 | subCellWidth = mGridSpacingX / item->subCells(); | 1954 | subCellWidth = mGridSpacingX / item->subCells(); |
1952 | item->resize(subCellWidth,item->height()); | 1955 | item->resize(subCellWidth,item->height()); |
1953 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | 1956 | moveChild(item,(KOGlobals::self()->reverseLayout() ? |
1954 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1957 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1955 | item->cellX() * mGridSpacingX) + | 1958 | item->cellX() * mGridSpacingX) + |
1956 | item->subCell() * subCellWidth,childY(item)); | 1959 | item->subCell() * subCellWidth,childY(item)); |
1957 | } | 1960 | } |
1958 | } | 1961 | } |
1959 | int cw = contentsWidth(); | 1962 | int cw = contentsWidth(); |
1960 | int ch = contentsHeight(); | 1963 | int ch = contentsHeight(); |
1961 | if ( mAllDayMode ) { | 1964 | if ( mAllDayMode ) { |
1962 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); | 1965 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); |
1963 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { | 1966 | if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) { |
1964 | //qDebug("paintPixAll->resize "); | 1967 | //qDebug("paintPixAll->resize "); |
1965 | paintPixAll->resize( cw, ch ); | 1968 | paintPixAll->resize( cw, ch ); |
1966 | } | 1969 | } |
1967 | } else { | 1970 | } else { |
1968 | QPixmap* paintPix = KOAgendaItem::paintPix(); | 1971 | QPixmap* paintPix = KOAgendaItem::paintPix(); |
1969 | if ( paintPix->width() < cw || paintPix->height() < ch ) { | 1972 | if ( paintPix->width() < cw || paintPix->height() < ch ) { |
1970 | //qDebug("paintPix->resize "); | 1973 | //qDebug("paintPix->resize "); |
1971 | paintPix->resize( cw , ch ); | 1974 | paintPix->resize( cw , ch ); |
1972 | } | 1975 | } |
1973 | } | 1976 | } |
1974 | 1977 | ||
1975 | checkScrollBoundaries(); | 1978 | checkScrollBoundaries(); |
1976 | drawContentsToPainter(); | 1979 | drawContentsToPainter(); |
1977 | viewport()->repaint(false); | 1980 | viewport()->repaint(false); |
1978 | } | 1981 | } |
1979 | 1982 | ||
1980 | void KOAgenda::scrollUp() | 1983 | void KOAgenda::scrollUp() |
1981 | { | 1984 | { |
1982 | scrollBy(0,-mScrollOffset); | 1985 | scrollBy(0,-mScrollOffset); |
1983 | } | 1986 | } |
1984 | 1987 | ||
1985 | 1988 | ||
1986 | void KOAgenda::scrollDown() | 1989 | void KOAgenda::scrollDown() |
1987 | { | 1990 | { |
1988 | scrollBy(0,mScrollOffset); | 1991 | scrollBy(0,mScrollOffset); |
1989 | } | 1992 | } |
1990 | 1993 | ||
1991 | void KOAgenda::popupAlarm() | 1994 | void KOAgenda::popupAlarm() |
1992 | { | 1995 | { |
1993 | if (!mClickedItem) { | 1996 | if (!mClickedItem) { |
1994 | qDebug("KOAgenda::popupAlarm() called without having a clicked item "); | 1997 | qDebug("KOAgenda::popupAlarm() called without having a clicked item "); |
1995 | return; | 1998 | return; |
1996 | } | 1999 | } |
1997 | // TODO: deal correctly with multiple alarms | 2000 | // TODO: deal correctly with multiple alarms |
1998 | Alarm* alarm; | 2001 | Alarm* alarm; |
1999 | QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); | 2002 | QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); |
2000 | for(alarm=list.first();alarm;alarm=list.next()) { | 2003 | for(alarm=list.first();alarm;alarm=list.next()) { |
2001 | alarm->toggleAlarm(); | 2004 | alarm->toggleAlarm(); |
2002 | } | 2005 | } |
2003 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); | 2006 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); |
2004 | mClickedItem->paintMe( true ); | 2007 | mClickedItem->paintMe( true ); |
2005 | mClickedItem->repaint( false ); | 2008 | mClickedItem->repaint( false ); |
2006 | } | 2009 | } |
2007 | 2010 | ||
2008 | /* | 2011 | /* |
2009 | Calculates the minimum width | 2012 | Calculates the minimum width |
2010 | */ | 2013 | */ |
2011 | int KOAgenda::minimumWidth() const | 2014 | int KOAgenda::minimumWidth() const |
2012 | { | 2015 | { |
2013 | // TODO:: develop a way to dynamically determine the minimum width | 2016 | // TODO:: develop a way to dynamically determine the minimum width |
2014 | int min = 100; | 2017 | int min = 100; |
2015 | 2018 | ||
2016 | return min; | 2019 | return min; |
2017 | } | 2020 | } |
2018 | 2021 | ||
2019 | void KOAgenda::updateConfig() | 2022 | void KOAgenda::updateConfig() |
2020 | { | 2023 | { |
2021 | if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) | 2024 | if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) |
2022 | viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); | 2025 | viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); |
2023 | if ( mAllDayMode ) { | 2026 | if ( mAllDayMode ) { |
2024 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; | 2027 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; |
2025 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 2028 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
2026 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); | 2029 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); |
2027 | // setMaximumHeight( mGridSpacingY+1 ); | 2030 | // setMaximumHeight( mGridSpacingY+1 ); |
2028 | viewport()->repaint( false ); | 2031 | viewport()->repaint( false ); |
2029 | //setFixedHeight( mGridSpacingY+1 ); | 2032 | //setFixedHeight( mGridSpacingY+1 ); |
2030 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); | 2033 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); |
2031 | } | 2034 | } |
2032 | else { | 2035 | else { |
2033 | mGridSpacingY = KOPrefs::instance()->mHourSize; | 2036 | mGridSpacingY = KOPrefs::instance()->mHourSize; |
2034 | calculateWorkingHours(); | 2037 | calculateWorkingHours(); |
2035 | } | 2038 | } |
2036 | } | 2039 | } |
2037 | 2040 | ||
2038 | void KOAgenda::checkScrollBoundaries() | 2041 | void KOAgenda::checkScrollBoundaries() |
2039 | { | 2042 | { |
2040 | // Invalidate old values to force update | 2043 | // Invalidate old values to force update |
2041 | mOldLowerScrollValue = -1; | 2044 | mOldLowerScrollValue = -1; |
2042 | mOldUpperScrollValue = -1; | 2045 | mOldUpperScrollValue = -1; |
2043 | 2046 | ||
2044 | checkScrollBoundaries(verticalScrollBar()->value()); | 2047 | checkScrollBoundaries(verticalScrollBar()->value()); |
2045 | } | 2048 | } |
2046 | 2049 | ||
2047 | void KOAgenda::checkScrollBoundaries(int v) | 2050 | void KOAgenda::checkScrollBoundaries(int v) |
2048 | { | 2051 | { |
2049 | if ( mGridSpacingY == 0 ) | 2052 | if ( mGridSpacingY == 0 ) |
2050 | return; | 2053 | return; |
2051 | int yMin = v/mGridSpacingY; | 2054 | int yMin = v/mGridSpacingY; |
2052 | int yMax = (v+visibleHeight())/mGridSpacingY; | 2055 | int yMax = (v+visibleHeight())/mGridSpacingY; |
2053 | 2056 | ||
2054 | // kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; | 2057 | // kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; |
2055 | 2058 | ||
2056 | if (yMin != mOldLowerScrollValue) { | 2059 | if (yMin != mOldLowerScrollValue) { |
2057 | mOldLowerScrollValue = yMin; | 2060 | mOldLowerScrollValue = yMin; |
2058 | emit lowerYChanged(yMin); | 2061 | emit lowerYChanged(yMin); |
2059 | } | 2062 | } |
2060 | if (yMax != mOldUpperScrollValue) { | 2063 | if (yMax != mOldUpperScrollValue) { |
2061 | mOldUpperScrollValue = yMax; | 2064 | mOldUpperScrollValue = yMax; |
2062 | emit upperYChanged(yMax); | 2065 | emit upperYChanged(yMax); |
2063 | } | 2066 | } |
2064 | } | 2067 | } |
2065 | 2068 | ||
2066 | void KOAgenda::deselectItem() | 2069 | void KOAgenda::deselectItem() |
2067 | { | 2070 | { |
2068 | if (mSelectedItem.isNull()) return; | 2071 | if (mSelectedItem.isNull()) return; |
2069 | mSelectedItem->select(false); | 2072 | mSelectedItem->select(false); |
2070 | mSelectedItem = 0; | 2073 | mSelectedItem = 0; |
2071 | } | 2074 | } |
2072 | 2075 | ||
2073 | void KOAgenda::selectItem(KOAgendaItem *item) | 2076 | void KOAgenda::selectItem(KOAgendaItem *item) |
2074 | { | 2077 | { |
2075 | if ((KOAgendaItem *)mSelectedItem == item) return; | 2078 | if ((KOAgendaItem *)mSelectedItem == item) return; |
2076 | deselectItem(); | 2079 | deselectItem(); |
2077 | if (item == 0) { | 2080 | if (item == 0) { |
2078 | emit incidenceSelected( 0 ); | 2081 | emit incidenceSelected( 0 ); |
2079 | return; | 2082 | return; |
2080 | } | 2083 | } |
2081 | mSelectedItem = item; | 2084 | mSelectedItem = item; |
2082 | mSelectedItem->select(); | 2085 | mSelectedItem->select(); |
2083 | emit incidenceSelected( mSelectedItem->incidence() ); | 2086 | emit incidenceSelected( mSelectedItem->incidence() ); |
2084 | } | 2087 | } |
2085 | 2088 | ||
2086 | // This function seems never be called. | 2089 | // This function seems never be called. |
2087 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) | 2090 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) |
2088 | { | 2091 | { |
2089 | switch(kev->key()) { | 2092 | switch(kev->key()) { |
2090 | case Key_PageDown: | 2093 | case Key_PageDown: |
2091 | verticalScrollBar()->addPage(); | 2094 | verticalScrollBar()->addPage(); |
2092 | break; | 2095 | break; |
2093 | case Key_PageUp: | 2096 | case Key_PageUp: |
2094 | verticalScrollBar()->subtractPage(); | 2097 | verticalScrollBar()->subtractPage(); |
2095 | break; | 2098 | break; |
2096 | case Key_Down: | 2099 | case Key_Down: |
2097 | verticalScrollBar()->addLine(); | 2100 | verticalScrollBar()->addLine(); |
2098 | break; | 2101 | break; |
2099 | case Key_Up: | 2102 | case Key_Up: |
2100 | verticalScrollBar()->subtractLine(); | 2103 | verticalScrollBar()->subtractLine(); |
2101 | break; | 2104 | break; |
2102 | default: | 2105 | default: |
2103 | ; | 2106 | ; |
2104 | } | 2107 | } |
2105 | } | 2108 | } |
2106 | 2109 | ||
2107 | void KOAgenda::calculateWorkingHours() | 2110 | void KOAgenda::calculateWorkingHours() |
2108 | { | 2111 | { |
2109 | // mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; | 2112 | // mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; |
2110 | mWorkingHoursEnable = !mAllDayMode; | 2113 | mWorkingHoursEnable = !mAllDayMode; |
2111 | 2114 | ||
2112 | mWorkingHoursYTop = mGridSpacingY * | 2115 | mWorkingHoursYTop = mGridSpacingY * |
2113 | KOPrefs::instance()->mWorkingHoursStart * 4; | 2116 | KOPrefs::instance()->mWorkingHoursStart * 4; |
2114 | mWorkingHoursYBottom = mGridSpacingY * | 2117 | mWorkingHoursYBottom = mGridSpacingY * |
2115 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; | 2118 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; |
2116 | } | 2119 | } |
2117 | 2120 | ||
2118 | 2121 | ||
2119 | DateList KOAgenda::dateList() const | 2122 | DateList KOAgenda::dateList() const |
2120 | { | 2123 | { |
2121 | return mSelectedDates; | 2124 | return mSelectedDates; |
2122 | } | 2125 | } |
2123 | 2126 | ||
2124 | void KOAgenda::setDateList(const DateList &selectedDates) | 2127 | void KOAgenda::setDateList(const DateList &selectedDates) |
2125 | { | 2128 | { |
2126 | mSelectedDates = selectedDates; | 2129 | mSelectedDates = selectedDates; |
2127 | } | 2130 | } |
2128 | 2131 | ||
2129 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) | 2132 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) |
2130 | { | 2133 | { |
2131 | mHolidayMask = mask; | 2134 | mHolidayMask = mask; |
2132 | 2135 | ||
2133 | /* | 2136 | /* |
2134 | kdDebug() << "HolidayMask: "; | 2137 | kdDebug() << "HolidayMask: "; |
2135 | for(uint i=0;i<mask->count();++i) { | 2138 | for(uint i=0;i<mask->count();++i) { |
2136 | kdDebug() << (mask->at(i) ? "*" : "o"); | 2139 | kdDebug() << (mask->at(i) ? "*" : "o"); |
2137 | } | 2140 | } |
2138 | kdDebug() << endl; | 2141 | kdDebug() << endl; |
2139 | */ | 2142 | */ |
2140 | } | 2143 | } |
2141 | 2144 | ||
2142 | void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) | 2145 | void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) |
2143 | { | 2146 | { |
2144 | 2147 | ||
2145 | QScrollView::contentsMousePressEvent(event); | 2148 | QScrollView::contentsMousePressEvent(event); |
2146 | } | 2149 | } |
2147 | 2150 | ||
2148 | void KOAgenda::storePosition() | 2151 | void KOAgenda::storePosition() |
2149 | { | 2152 | { |
2150 | //mContentPosition | 2153 | //mContentPosition |
2151 | int max = mGridSpacingY*4*24; | 2154 | int max = mGridSpacingY*4*24; |
2152 | if ( contentsY() < 5 && max > viewport()->height()*3/2 ) | 2155 | if ( contentsY() < 5 && max > viewport()->height()*3/2 ) |
2153 | mContentPosition = 0; | 2156 | mContentPosition = 0; |
2154 | else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) | 2157 | else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) |
2155 | mContentPosition = -1.0; | 2158 | mContentPosition = -1.0; |
2156 | else | 2159 | else |
2157 | mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); | 2160 | mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); |
2158 | //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); | 2161 | //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); |
2159 | 2162 | ||
2160 | } | 2163 | } |
2161 | void KOAgenda::restorePosition() | 2164 | void KOAgenda::restorePosition() |
2162 | { | 2165 | { |
2163 | int posY; | 2166 | int posY; |
2164 | int max = mGridSpacingY*4*24; | 2167 | int max = mGridSpacingY*4*24; |
2165 | if ( mContentPosition < 0 ) | 2168 | if ( mContentPosition < 0 ) |
2166 | posY = max-viewport()->height(); | 2169 | posY = max-viewport()->height(); |
2167 | else | 2170 | else |
2168 | if ( mContentPosition == 0 ) | 2171 | if ( mContentPosition == 0 ) |
2169 | posY = 0; | 2172 | posY = 0; |
2170 | else | 2173 | else |
2171 | posY = (max/mContentPosition)-(viewport()->height()/2); | 2174 | posY = (max/mContentPosition)-(viewport()->height()/2); |
2172 | setContentsPos (0, posY ); | 2175 | setContentsPos (0, posY ); |
2173 | //qDebug("posY %d hei %d", posY, max); | 2176 | //qDebug("posY %d hei %d", posY, max); |
2174 | 2177 | ||
2175 | } | 2178 | } |
2176 | void KOAgenda::moveChild( QWidget *w, int x , int y ) | 2179 | void KOAgenda::moveChild( QWidget *w, int x , int y ) |
2177 | { | 2180 | { |
2178 | ++x; | 2181 | ++x; |
2179 | QScrollView::moveChild( w, x , y ); | 2182 | QScrollView::moveChild( w, x , y ); |
2180 | } | 2183 | } |
2181 | #include <qmessagebox.h> | 2184 | #include <qmessagebox.h> |
2182 | #ifdef DESKTOP_VERSION | 2185 | #ifdef DESKTOP_VERSION |
2183 | #include <qprinter.h> | 2186 | #include <qprinter.h> |
2184 | #include <qpainter.h> | 2187 | #include <qpainter.h> |
2185 | #include <qpaintdevicemetrics.h> | 2188 | #include <qpaintdevicemetrics.h> |
2186 | 2189 | ||
2187 | #endif | 2190 | #endif |
2188 | void KOAgenda::printSelection() | 2191 | void KOAgenda::printSelection() |
2189 | { | 2192 | { |
2190 | #ifdef DESKTOP_VERSION | 2193 | #ifdef DESKTOP_VERSION |
2191 | if ( mStartCellY == mCurrentCellY ) { | 2194 | if ( mStartCellY == mCurrentCellY ) { |
2192 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2195 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2193 | i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), | 2196 | i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), |
2194 | i18n("OK"), 0, 0, | 2197 | i18n("OK"), 0, 0, |
2195 | 0, 1 ); | 2198 | 0, 1 ); |
2196 | return; | 2199 | return; |
2197 | } | 2200 | } |
2198 | 2201 | ||
2199 | float dx, dy; | 2202 | float dx, dy; |
2200 | int x,y,w,h; | 2203 | int x,y,w,h; |
2201 | x= 0; | 2204 | x= 0; |
2202 | w= contentsWidth()+2; | 2205 | w= contentsWidth()+2; |
2203 | // h= contentsHeight(); | 2206 | // h= contentsHeight(); |
2204 | y = mGridSpacingY*mStartCellY; | 2207 | y = mGridSpacingY*mStartCellY; |
2205 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; | 2208 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; |
2206 | 2209 | ||
2207 | //return; | 2210 | //return; |
2208 | QPrinter* printer = new QPrinter(); | 2211 | QPrinter* printer = new QPrinter(); |
2209 | if ( !printer->setup()) { | 2212 | if ( !printer->setup()) { |
2210 | delete printer; | 2213 | delete printer; |
2211 | return; | 2214 | return; |
2212 | } | 2215 | } |
2213 | QPainter p( printer ); | 2216 | QPainter p( printer ); |
2214 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); | 2217 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); |
2215 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); | 2218 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); |
2216 | //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); | 2219 | //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); |
2217 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); | 2220 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); |
2218 | // p.drawText( 0, 0, date ); | 2221 | // p.drawText( 0, 0, date ); |
2219 | int offset = m.width()/8; | 2222 | int offset = m.width()/8; |
2220 | // compute the scale | 2223 | // compute the scale |
2221 | dx = ((float) m.width()-offset) / (float)w; | 2224 | dx = ((float) m.width()-offset) / (float)w; |
2222 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; | 2225 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; |
2223 | float scale; | 2226 | float scale; |
2224 | // scale to fit the width or height of the paper | 2227 | // scale to fit the width or height of the paper |
2225 | if ( dx < dy ) | 2228 | if ( dx < dy ) |
2226 | scale = dx; | 2229 | scale = dx; |
2227 | else | 2230 | else |
2228 | scale = dy; | 2231 | scale = dy; |
2229 | // set the scale | 2232 | // set the scale |
2230 | p.drawText( offset* scale, offset* scale*3/4, date ); | 2233 | p.drawText( offset* scale, offset* scale*3/4, date ); |
2231 | 2234 | ||
2232 | int selDay; | 2235 | int selDay; |
2233 | float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); | 2236 | float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); |
2234 | float startX = 1; | 2237 | float startX = 1; |
2235 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 2238 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
2236 | { | 2239 | { |
2237 | QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); | 2240 | QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); |
2238 | p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); | 2241 | p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); |
2239 | p.drawText( offset* scale+startX, (offset+hei)* scale, text ); | 2242 | p.drawText( offset* scale+startX, (offset+hei)* scale, text ); |
2240 | startX += widOffset; | 2243 | startX += widOffset; |
2241 | 2244 | ||
2242 | } | 2245 | } |
2243 | p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); | 2246 | p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); |
2244 | p.scale( scale, scale ); | 2247 | p.scale( scale, scale ); |
2245 | p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); | 2248 | p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); |
2246 | // now printing with y offset: 2 hei | 2249 | // now printing with y offset: 2 hei |
2247 | // p.translate( 0, -y*scale); | 2250 | // p.translate( 0, -y*scale); |
2248 | 2251 | ||
2249 | drawContentsToPainter(&p, true ); | 2252 | drawContentsToPainter(&p, true ); |
2250 | globalFlagBlockAgendaItemUpdate = false; | 2253 | globalFlagBlockAgendaItemUpdate = false; |
2251 | KOAgendaItem *item; | 2254 | KOAgendaItem *item; |
2252 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 2255 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
2253 | item->select(false); | 2256 | item->select(false); |
2254 | item->paintMe( false, &p ); | 2257 | item->paintMe( false, &p ); |
2255 | } | 2258 | } |
2256 | globalFlagBlockAgendaItemUpdate = true; | 2259 | globalFlagBlockAgendaItemUpdate = true; |
2257 | p.end(); | 2260 | p.end(); |
2258 | delete printer; | 2261 | delete printer; |
2259 | #else | 2262 | #else |
2260 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2263 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2261 | i18n("Not supported \non PDA!\n"), | 2264 | i18n("Not supported \non PDA!\n"), |
2262 | i18n("OK"), 0, 0, | 2265 | i18n("OK"), 0, 0, |
2263 | 0, 1 ); | 2266 | 0, 1 ); |
2264 | #endif | 2267 | #endif |
2265 | } | 2268 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 4bedb61..21d5a35 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2256 +1,2254 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | ||
25 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 27 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 28 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 29 | #include <unistd.h> // for sleep |
31 | #else | 30 | #else |
32 | #include <qmenubar.h> | ||
33 | #include <qtoolbar.h> | 31 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 32 | #include <qapplication.h> |
35 | //#include <resource.h> | 33 | //#include <resource.h> |
36 | 34 | ||
37 | #endif | 35 | #endif |
38 | #include <libkcal/calendarlocal.h> | 36 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 37 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 38 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 39 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 40 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 41 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 42 | #include <libkdepim/kpimglobalprefs.h> |
45 | 43 | ||
46 | #include "calendarview.h" | 44 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 45 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 47 | #include "koagendaview.h" |
50 | #include "kojournalview.h" | 48 | #include "kojournalview.h" |
51 | #include "koagenda.h" | 49 | #include "koagenda.h" |
52 | #include "kodialogmanager.h" | 50 | #include "kodialogmanager.h" |
53 | #include "kdialogbase.h" | 51 | #include "kdialogbase.h" |
54 | #include "kapplication.h" | 52 | #include "kapplication.h" |
55 | #include "kofilterview.h" | 53 | #include "kofilterview.h" |
56 | #include "kstandarddirs.h" | 54 | #include "kstandarddirs.h" |
57 | #include "koprefs.h" | 55 | #include "koprefs.h" |
58 | #include "kfiledialog.h" | 56 | #include "kfiledialog.h" |
59 | #include "koglobals.h" | 57 | #include "koglobals.h" |
60 | #include "kglobal.h" | 58 | #include "kglobal.h" |
61 | #include "ktoolbar.h" | 59 | #include "ktoolbar.h" |
62 | #include "klocale.h" | 60 | #include "klocale.h" |
63 | #include "kconfig.h" | 61 | #include "kconfig.h" |
64 | #include "externalapphandler.h" | 62 | #include "externalapphandler.h" |
65 | #include <kglobalsettings.h> | 63 | #include <kglobalsettings.h> |
66 | 64 | ||
67 | using namespace KCal; | 65 | using namespace KCal; |
68 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
69 | #include <unistd.h> | 67 | #include <unistd.h> |
70 | #else | 68 | #else |
71 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
72 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
73 | #endif | 71 | #endif |
74 | #endif | 72 | #endif |
75 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
76 | 74 | ||
77 | 75 | ||
78 | class KOex2phonePrefs : public QDialog | 76 | class KOex2phonePrefs : public QDialog |
79 | { | 77 | { |
80 | public: | 78 | public: |
81 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 79 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
82 | QDialog( parent, name, true ) | 80 | QDialog( parent, name, true ) |
83 | { | 81 | { |
84 | setCaption( i18n("Export to phone options") ); | 82 | setCaption( i18n("Export to phone options") ); |
85 | QVBoxLayout* lay = new QVBoxLayout( this ); | 83 | QVBoxLayout* lay = new QVBoxLayout( this ); |
86 | lay->setSpacing( 3 ); | 84 | lay->setSpacing( 3 ); |
87 | lay->setMargin( 3 ); | 85 | lay->setMargin( 3 ); |
88 | QLabel *lab; | 86 | QLabel *lab; |
89 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 87 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
90 | lab->setAlignment (AlignHCenter ); | 88 | lab->setAlignment (AlignHCenter ); |
91 | QHBox* temphb; | 89 | QHBox* temphb; |
92 | temphb = new QHBox( this ); | 90 | temphb = new QHBox( this ); |
93 | new QLabel( i18n("I/O device: "), temphb ); | 91 | new QLabel( i18n("I/O device: "), temphb ); |
94 | mPhoneDevice = new QLineEdit( temphb); | 92 | mPhoneDevice = new QLineEdit( temphb); |
95 | lay->addWidget( temphb ); | 93 | lay->addWidget( temphb ); |
96 | temphb = new QHBox( this ); | 94 | temphb = new QHBox( this ); |
97 | new QLabel( i18n("Connection: "), temphb ); | 95 | new QLabel( i18n("Connection: "), temphb ); |
98 | mPhoneConnection = new QLineEdit( temphb); | 96 | mPhoneConnection = new QLineEdit( temphb); |
99 | lay->addWidget( temphb ); | 97 | lay->addWidget( temphb ); |
100 | temphb = new QHBox( this ); | 98 | temphb = new QHBox( this ); |
101 | new QLabel( i18n("Model(opt.): "), temphb ); | 99 | new QLabel( i18n("Model(opt.): "), temphb ); |
102 | mPhoneModel = new QLineEdit( temphb); | 100 | mPhoneModel = new QLineEdit( temphb); |
103 | lay->addWidget( temphb ); | 101 | lay->addWidget( temphb ); |
104 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 102 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
105 | mWriteBackFuture->setChecked( true ); | 103 | mWriteBackFuture->setChecked( true ); |
106 | lay->addWidget( mWriteBackFuture ); | 104 | lay->addWidget( mWriteBackFuture ); |
107 | temphb = new QHBox( this ); | 105 | temphb = new QHBox( this ); |
108 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 106 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
109 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 107 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
110 | mWriteBackFutureWeeks->setValue( 8 ); | 108 | mWriteBackFutureWeeks->setValue( 8 ); |
111 | lay->addWidget( temphb ); | 109 | lay->addWidget( temphb ); |
112 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 110 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
113 | lab->setAlignment (AlignHCenter ); | 111 | lab->setAlignment (AlignHCenter ); |
114 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 112 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
115 | lay->addWidget( ok ); | 113 | lay->addWidget( ok ); |
116 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 114 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
117 | lay->addWidget( cancel ); | 115 | lay->addWidget( cancel ); |
118 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 116 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
119 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 117 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
120 | resize( 220, 240 ); | 118 | resize( 220, 240 ); |
121 | qApp->processEvents(); | 119 | qApp->processEvents(); |
122 | int dw = QApplication::desktop()->width(); | 120 | int dw = QApplication::desktop()->width(); |
123 | int dh = QApplication::desktop()->height(); | 121 | int dh = QApplication::desktop()->height(); |
124 | move( (dw-width())/2, (dh - height() )/2 ); | 122 | move( (dw-width())/2, (dh - height() )/2 ); |
125 | } | 123 | } |
126 | 124 | ||
127 | public: | 125 | public: |
128 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 126 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
129 | QCheckBox* mWriteBackFuture; | 127 | QCheckBox* mWriteBackFuture; |
130 | QSpinBox* mWriteBackFutureWeeks; | 128 | QSpinBox* mWriteBackFutureWeeks; |
131 | }; | 129 | }; |
132 | 130 | ||
133 | QPixmap* sgListViewCompletedPix[6]; | 131 | QPixmap* sgListViewCompletedPix[6]; |
134 | QPixmap* sgListViewJournalPix; | 132 | QPixmap* sgListViewJournalPix; |
135 | 133 | ||
136 | 134 | ||
137 | int globalFlagBlockStartup; | 135 | int globalFlagBlockStartup; |
138 | MainWindow::MainWindow( QWidget *parent, const char *name ) : | 136 | MainWindow::MainWindow( QWidget *parent, const char *name ) : |
139 | QMainWindow( parent, name ) | 137 | QMainWindow( parent, name ) |
140 | { | 138 | { |
141 | sgListViewCompletedPix[5] = &listviewPix; | 139 | sgListViewCompletedPix[5] = &listviewPix; |
142 | sgListViewCompletedPix[0] = &listviewPix0; | 140 | sgListViewCompletedPix[0] = &listviewPix0; |
143 | sgListViewCompletedPix[1] = &listviewPix20; | 141 | sgListViewCompletedPix[1] = &listviewPix20; |
144 | sgListViewCompletedPix[2] = &listviewPix40; | 142 | sgListViewCompletedPix[2] = &listviewPix40; |
145 | sgListViewCompletedPix[3] = &listviewPix60; | 143 | sgListViewCompletedPix[3] = &listviewPix60; |
146 | sgListViewCompletedPix[4] = &listviewPix80; | 144 | sgListViewCompletedPix[4] = &listviewPix80; |
147 | //int size = 12; | 145 | //int size = 12; |
148 | { | 146 | { |
149 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 147 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
150 | sgListViewCompletedPix[5]->fill( Qt::white ); | 148 | sgListViewCompletedPix[5]->fill( Qt::white ); |
151 | QPainter p ( sgListViewCompletedPix[5] ); | 149 | QPainter p ( sgListViewCompletedPix[5] ); |
152 | p.drawRect( 0,0,11,11); | 150 | p.drawRect( 0,0,11,11); |
153 | p.drawLine ( 2, 5, 4 , 7 ) ; | 151 | p.drawLine ( 2, 5, 4 , 7 ) ; |
154 | p.drawLine ( 4 , 7 , 8, 3) ; | 152 | p.drawLine ( 4 , 7 , 8, 3) ; |
155 | int iii = 0; | 153 | int iii = 0; |
156 | for ( iii = 0; iii < 5; ++iii ) { | 154 | for ( iii = 0; iii < 5; ++iii ) { |
157 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 155 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
158 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 156 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
159 | QPainter p ( sgListViewCompletedPix[iii] ); | 157 | QPainter p ( sgListViewCompletedPix[iii] ); |
160 | p.drawRect( 0,0,11,11); | 158 | p.drawRect( 0,0,11,11); |
161 | if ( iii ) | 159 | if ( iii ) |
162 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 160 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
163 | } | 161 | } |
164 | sgListViewJournalPix = &journalPix; | 162 | sgListViewJournalPix = &journalPix; |
165 | sgListViewJournalPix->resize( 11, 11 ); | 163 | sgListViewJournalPix->resize( 11, 11 ); |
166 | sgListViewJournalPix->fill( Qt::white ); | 164 | sgListViewJournalPix->fill( Qt::white ); |
167 | { | 165 | { |
168 | QPainter p ( sgListViewJournalPix ); | 166 | QPainter p ( sgListViewJournalPix ); |
169 | p.drawRect( 0,0,11,11); | 167 | p.drawRect( 0,0,11,11); |
170 | p.drawLine( 2,3,5,3); | 168 | p.drawLine( 2,3,5,3); |
171 | p.drawLine( 2,5,8,5); | 169 | p.drawLine( 2,5,8,5); |
172 | p.drawLine( 2,7,6,7); | 170 | p.drawLine( 2,7,6,7); |
173 | } | 171 | } |
174 | } | 172 | } |
175 | mClosed = false; | 173 | mClosed = false; |
176 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 174 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
177 | QString confFile = locateLocal("config","korganizerrc"); | 175 | QString confFile = locateLocal("config","korganizerrc"); |
178 | QFileInfo finf ( confFile ); | 176 | QFileInfo finf ( confFile ); |
179 | bool showWarning = !finf.exists(); | 177 | bool showWarning = !finf.exists(); |
180 | setIcon(SmallIcon( "ko24" ) ); | 178 | setIcon(SmallIcon( "ko24" ) ); |
181 | mBlockAtStartup = true; | 179 | mBlockAtStartup = true; |
182 | mFlagKeyPressed = false; | 180 | mFlagKeyPressed = false; |
183 | setCaption("KO/Pi"); | 181 | setCaption("KO/Pi"); |
184 | KOPrefs *p = KOPrefs::instance(); | 182 | KOPrefs *p = KOPrefs::instance(); |
185 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 183 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
186 | p->mCurrentDisplayedView = 0; | 184 | p->mCurrentDisplayedView = 0; |
187 | if ( p->mHourSize > 22 ) | 185 | if ( p->mHourSize > 22 ) |
188 | p->mHourSize = 22; | 186 | p->mHourSize = 22; |
189 | QMainWindow::ToolBarDock tbd; | 187 | QMainWindow::ToolBarDock tbd; |
190 | if ( p->mToolBarHor ) { | 188 | if ( p->mToolBarHor ) { |
191 | if ( p->mToolBarUp ) | 189 | if ( p->mToolBarUp ) |
192 | tbd = Bottom; | 190 | tbd = Bottom; |
193 | else | 191 | else |
194 | tbd = Top; | 192 | tbd = Top; |
195 | } | 193 | } |
196 | else { | 194 | else { |
197 | if ( p->mToolBarUp ) | 195 | if ( p->mToolBarUp ) |
198 | tbd = Right; | 196 | tbd = Right; |
199 | else | 197 | else |
200 | tbd = Left; | 198 | tbd = Left; |
201 | } | 199 | } |
202 | if ( KOPrefs::instance()->mUseAppColors ) | 200 | if ( KOPrefs::instance()->mUseAppColors ) |
203 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 201 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
204 | globalFlagBlockStartup = 1; | 202 | globalFlagBlockStartup = 1; |
205 | iconToolBar = new QPEToolBar( this ); | 203 | iconToolBar = new QPEToolBar( this ); |
206 | addToolBar (iconToolBar , tbd ); | 204 | addToolBar (iconToolBar , tbd ); |
207 | 205 | ||
208 | #ifdef DESKTOP_VERSION | 206 | #ifdef DESKTOP_VERSION |
209 | if ( KOPrefs::instance()->mShowIconFilter ) | 207 | if ( KOPrefs::instance()->mShowIconFilter ) |
210 | #else | 208 | #else |
211 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 209 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
212 | #endif | 210 | #endif |
213 | 211 | ||
214 | { | 212 | { |
215 | if ( p->mToolBarHorF ) { | 213 | if ( p->mToolBarHorF ) { |
216 | if ( p->mToolBarUpF ) | 214 | if ( p->mToolBarUpF ) |
217 | tbd = Bottom; | 215 | tbd = Bottom; |
218 | else | 216 | else |
219 | tbd = Top; | 217 | tbd = Top; |
220 | } | 218 | } |
221 | else { | 219 | else { |
222 | if ( p->mToolBarUpF ) | 220 | if ( p->mToolBarUpF ) |
223 | tbd = Right; | 221 | tbd = Right; |
224 | else | 222 | else |
225 | tbd = Left; | 223 | tbd = Left; |
226 | } | 224 | } |
227 | filterToolBar = new QPEToolBar ( this ); | 225 | filterToolBar = new QPEToolBar ( this ); |
228 | filterMenubar = new QMenuBar( 0 ); | 226 | filterMenubar = new KMenuBar( 0 ); |
229 | QFontMetrics fm ( filterMenubar->font() ); | 227 | QFontMetrics fm ( filterMenubar->font() ); |
230 | 228 | ||
231 | filterPopupMenu = new QPopupMenu( this ); | 229 | filterPopupMenu = new QPopupMenu( this ); |
232 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 230 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
233 | QString addTest = "A"; | 231 | QString addTest = "A"; |
234 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 232 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
235 | #ifdef DESKTOP_VERSION | 233 | #ifdef DESKTOP_VERSION |
236 | addTest = "AAABBBCCCx"; | 234 | addTest = "AAABBBCCCx"; |
237 | #else | 235 | #else |
238 | addTest = "AAx"; | 236 | addTest = "AAx"; |
239 | #endif | 237 | #endif |
240 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 238 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
241 | addToolBar (filterToolBar , tbd ); | 239 | addToolBar (filterToolBar , tbd ); |
242 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 240 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
243 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 241 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
244 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 242 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
245 | filterToolBar->hide(); | 243 | filterToolBar->hide(); |
246 | } else { | 244 | } else { |
247 | filterToolBar = 0; | 245 | filterToolBar = 0; |
248 | filterMenubar = 0; | 246 | filterMenubar = 0; |
249 | filterPopupMenu = 0; | 247 | filterPopupMenu = 0; |
250 | } | 248 | } |
251 | if ( p->mShowIconOnetoolbar ) { | 249 | if ( p->mShowIconOnetoolbar ) { |
252 | viewToolBar = iconToolBar ; | 250 | viewToolBar = iconToolBar ; |
253 | navigatorToolBar = iconToolBar ; | 251 | navigatorToolBar = iconToolBar ; |
254 | } else { | 252 | } else { |
255 | #ifndef DESKTOP_VERSION | 253 | #ifndef DESKTOP_VERSION |
256 | setToolBarsMovable( false ); | 254 | setToolBarsMovable( false ); |
257 | #endif | 255 | #endif |
258 | if ( p->mToolBarHorV ) { | 256 | if ( p->mToolBarHorV ) { |
259 | if ( p->mToolBarUpV ) | 257 | if ( p->mToolBarUpV ) |
260 | tbd = Bottom; | 258 | tbd = Bottom; |
261 | else | 259 | else |
262 | tbd = Top; | 260 | tbd = Top; |
263 | } | 261 | } |
264 | else { | 262 | else { |
265 | if ( p->mToolBarUpV ) | 263 | if ( p->mToolBarUpV ) |
266 | tbd = Right; | 264 | tbd = Right; |
267 | else | 265 | else |
268 | tbd = Left; | 266 | tbd = Left; |
269 | } | 267 | } |
270 | viewToolBar = new QPEToolBar( this ); | 268 | viewToolBar = new QPEToolBar( this ); |
271 | addToolBar (viewToolBar , tbd ); | 269 | addToolBar (viewToolBar , tbd ); |
272 | if ( p->mToolBarHorN ) { | 270 | if ( p->mToolBarHorN ) { |
273 | if ( p->mToolBarUpN ) | 271 | if ( p->mToolBarUpN ) |
274 | tbd = Bottom; | 272 | tbd = Bottom; |
275 | else | 273 | else |
276 | tbd = Top; | 274 | tbd = Top; |
277 | } | 275 | } |
278 | else { | 276 | else { |
279 | if ( p->mToolBarUpN ) | 277 | if ( p->mToolBarUpN ) |
280 | tbd = Right; | 278 | tbd = Right; |
281 | else | 279 | else |
282 | tbd = Left; | 280 | tbd = Left; |
283 | } | 281 | } |
284 | navigatorToolBar = new QPEToolBar( this ); | 282 | navigatorToolBar = new QPEToolBar( this ); |
285 | addToolBar (navigatorToolBar , tbd ); | 283 | addToolBar (navigatorToolBar , tbd ); |
286 | } | 284 | } |
287 | 285 | ||
288 | 286 | ||
289 | 287 | ||
290 | mCalendarModifiedFlag = false; | 288 | mCalendarModifiedFlag = false; |
291 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 289 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
292 | splash->setAlignment ( AlignCenter ); | 290 | splash->setAlignment ( AlignCenter ); |
293 | setCentralWidget( splash ); | 291 | setCentralWidget( splash ); |
294 | #ifndef DESKTOP_VERSION | 292 | #ifndef DESKTOP_VERSION |
295 | showMaximized(); | 293 | showMaximized(); |
296 | #endif | 294 | #endif |
297 | 295 | ||
298 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 296 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
299 | setDefaultPreferences(); | 297 | setDefaultPreferences(); |
300 | mCalendar = new CalendarLocal(); | 298 | mCalendar = new CalendarLocal(); |
301 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 299 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
302 | mView->hide(); | 300 | mView->hide(); |
303 | //mView->resize(splash->size() ); | 301 | //mView->resize(splash->size() ); |
304 | initActions(); | 302 | initActions(); |
305 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 303 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
306 | mSyncManager->setBlockSave(false); | 304 | mSyncManager->setBlockSave(false); |
307 | mView->setSyncManager(mSyncManager); | 305 | mView->setSyncManager(mSyncManager); |
308 | #ifndef DESKTOP_VERSION | 306 | #ifndef DESKTOP_VERSION |
309 | iconToolBar->show(); | 307 | iconToolBar->show(); |
310 | qApp->processEvents(); | 308 | qApp->processEvents(); |
311 | #endif | 309 | #endif |
312 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 310 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
313 | int vh = height() ; | 311 | int vh = height() ; |
314 | int vw = width(); | 312 | int vw = width(); |
315 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 313 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
316 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 314 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
317 | vh -= iconToolBar->height(); | 315 | vh -= iconToolBar->height(); |
318 | } else { | 316 | } else { |
319 | vw -= iconToolBar->height(); | 317 | vw -= iconToolBar->height(); |
320 | } | 318 | } |
321 | //mView->setMaximumSize( splash->size() ); | 319 | //mView->setMaximumSize( splash->size() ); |
322 | //mView->resize( splash->size() ); | 320 | //mView->resize( splash->size() ); |
323 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 321 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
324 | mView->readSettings(); | 322 | mView->readSettings(); |
325 | bool newFile = false; | 323 | bool newFile = false; |
326 | if( !QFile::exists( defaultFileName() ) ) { | 324 | if( !QFile::exists( defaultFileName() ) ) { |
327 | QFileInfo finfo ( defaultFileName() ); | 325 | QFileInfo finfo ( defaultFileName() ); |
328 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 326 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
329 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 327 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
330 | finfo.setFile( oldFile ); | 328 | finfo.setFile( oldFile ); |
331 | if (finfo.exists() ) { | 329 | if (finfo.exists() ) { |
332 | KMessageBox::information( this, message); | 330 | KMessageBox::information( this, message); |
333 | mView->openCalendar( oldFile ); | 331 | mView->openCalendar( oldFile ); |
334 | qApp->processEvents(); | 332 | qApp->processEvents(); |
335 | } else { | 333 | } else { |
336 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 334 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
337 | finfo.setFile( oldFile ); | 335 | finfo.setFile( oldFile ); |
338 | if (finfo.exists() ) { | 336 | if (finfo.exists() ) { |
339 | KMessageBox::information( this, message); | 337 | KMessageBox::information( this, message); |
340 | mView->openCalendar( oldFile ); | 338 | mView->openCalendar( oldFile ); |
341 | qApp->processEvents(); | 339 | qApp->processEvents(); |
342 | } | 340 | } |
343 | } | 341 | } |
344 | mView->saveCalendar( defaultFileName() ); | 342 | mView->saveCalendar( defaultFileName() ); |
345 | newFile = true; | 343 | newFile = true; |
346 | } | 344 | } |
347 | 345 | ||
348 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 346 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
349 | mView->loadCalendars(); | 347 | mView->loadCalendars(); |
350 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 348 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
351 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 349 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
352 | 350 | ||
353 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 351 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
354 | KOPrefs::instance()->setAllDefaults(); | 352 | KOPrefs::instance()->setAllDefaults(); |
355 | } | 353 | } |
356 | processIncidenceSelection( 0 ); | 354 | processIncidenceSelection( 0 ); |
357 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 355 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
358 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 356 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
359 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 357 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
360 | SLOT( slotModifiedChanged( bool ) ) ); | 358 | SLOT( slotModifiedChanged( bool ) ) ); |
361 | 359 | ||
362 | 360 | ||
363 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 361 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
364 | SLOT( disableBR(bool) ) ); | 362 | SLOT( disableBR(bool) ) ); |
365 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 363 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
366 | mView->setModified( false ); | 364 | mView->setModified( false ); |
367 | mBlockAtStartup = false; | 365 | mBlockAtStartup = false; |
368 | mView->setModified( false ); | 366 | mView->setModified( false ); |
369 | setCentralWidget( mView ); | 367 | setCentralWidget( mView ); |
370 | globalFlagBlockStartup = 0; | 368 | globalFlagBlockStartup = 0; |
371 | mView->show(); | 369 | mView->show(); |
372 | delete splash; | 370 | delete splash; |
373 | if ( newFile ) | 371 | if ( newFile ) |
374 | mView->updateConfig(); | 372 | mView->updateConfig(); |
375 | // qApp->processEvents(); | 373 | // qApp->processEvents(); |
376 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 374 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
377 | //fillSyncMenu(); | 375 | //fillSyncMenu(); |
378 | 376 | ||
379 | 377 | ||
380 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 378 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
381 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 379 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
382 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 380 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
383 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 381 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
384 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 382 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
385 | mSyncManager->setDefaultFileName( sentSyncFile()); | 383 | mSyncManager->setDefaultFileName( sentSyncFile()); |
386 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 384 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
387 | mSyncManager->fillSyncMenu(); | 385 | mSyncManager->fillSyncMenu(); |
388 | 386 | ||
389 | 387 | ||
390 | 388 | ||
391 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 389 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
392 | if ( showWarning ) { | 390 | if ( showWarning ) { |
393 | KMessageBox::information( this, | 391 | KMessageBox::information( this, |
394 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 392 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
395 | qApp->processEvents(); | 393 | qApp->processEvents(); |
396 | mView->dialogManager()->showSyncOptions(); | 394 | mView->dialogManager()->showSyncOptions(); |
397 | } | 395 | } |
398 | 396 | ||
399 | //US listen for result adressed from Ka/Pi | 397 | //US listen for result adressed from Ka/Pi |
400 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
401 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 399 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
402 | #endif | 400 | #endif |
403 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
404 | infrared = 0; | 402 | infrared = 0; |
405 | #endif | 403 | #endif |
406 | updateFilterToolbar(); | 404 | updateFilterToolbar(); |
407 | updateWeek( mView->startDate() ); | 405 | updateWeek( mView->startDate() ); |
408 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 406 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
409 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 407 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
410 | mBRdisabled = false; | 408 | mBRdisabled = false; |
411 | //toggleBeamReceive(); | 409 | //toggleBeamReceive(); |
412 | 410 | ||
413 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); | 411 | QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); |
414 | } | 412 | } |
415 | MainWindow::~MainWindow() | 413 | MainWindow::~MainWindow() |
416 | { | 414 | { |
417 | //qDebug("MainWindow::~MainWindow() "); | 415 | //qDebug("MainWindow::~MainWindow() "); |
418 | //save toolbar location | 416 | //save toolbar location |
419 | delete mCalendar; | 417 | delete mCalendar; |
420 | delete mSyncManager; | 418 | delete mSyncManager; |
421 | #ifndef DESKTOP_VERSION | 419 | #ifndef DESKTOP_VERSION |
422 | if ( infrared ) | 420 | if ( infrared ) |
423 | delete infrared; | 421 | delete infrared; |
424 | #endif | 422 | #endif |
425 | 423 | ||
426 | 424 | ||
427 | } | 425 | } |
428 | 426 | ||
429 | void MainWindow::disableBR(bool b) | 427 | void MainWindow::disableBR(bool b) |
430 | { | 428 | { |
431 | #ifndef DESKTOP_VERSION | 429 | #ifndef DESKTOP_VERSION |
432 | if ( b ) { | 430 | if ( b ) { |
433 | if ( infrared ) { | 431 | if ( infrared ) { |
434 | toggleBeamReceive(); | 432 | toggleBeamReceive(); |
435 | mBRdisabled = true; | 433 | mBRdisabled = true; |
436 | } | 434 | } |
437 | mBRdisabled = true; | 435 | mBRdisabled = true; |
438 | } else { | 436 | } else { |
439 | if ( mBRdisabled ) { | 437 | if ( mBRdisabled ) { |
440 | mBRdisabled = false; | 438 | mBRdisabled = false; |
441 | //makes no sense,because other cal ap is probably running | 439 | //makes no sense,because other cal ap is probably running |
442 | // toggleBeamReceive(); | 440 | // toggleBeamReceive(); |
443 | } | 441 | } |
444 | } | 442 | } |
445 | #endif | 443 | #endif |
446 | 444 | ||
447 | } | 445 | } |
448 | bool MainWindow::beamReceiveEnabled() | 446 | bool MainWindow::beamReceiveEnabled() |
449 | { | 447 | { |
450 | #ifndef DESKTOP_VERSION | 448 | #ifndef DESKTOP_VERSION |
451 | return ( infrared != 0 ); | 449 | return ( infrared != 0 ); |
452 | #endif | 450 | #endif |
453 | return false; | 451 | return false; |
454 | } | 452 | } |
455 | 453 | ||
456 | void MainWindow::toggleBeamReceive() | 454 | void MainWindow::toggleBeamReceive() |
457 | { | 455 | { |
458 | if ( mBRdisabled ) | 456 | if ( mBRdisabled ) |
459 | return; | 457 | return; |
460 | #ifndef DESKTOP_VERSION | 458 | #ifndef DESKTOP_VERSION |
461 | if ( infrared ) { | 459 | if ( infrared ) { |
462 | qDebug("KO: Disable BeamReceive "); | 460 | qDebug("KO: Disable BeamReceive "); |
463 | delete infrared; | 461 | delete infrared; |
464 | infrared = 0; | 462 | infrared = 0; |
465 | brAction->setOn(false); | 463 | brAction->setOn(false); |
466 | return; | 464 | return; |
467 | } | 465 | } |
468 | qDebug("KO: Enable BeamReceive "); | 466 | qDebug("KO: Enable BeamReceive "); |
469 | brAction->setOn(true); | 467 | brAction->setOn(true); |
470 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 468 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
471 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 469 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
472 | #endif | 470 | #endif |
473 | } | 471 | } |
474 | void MainWindow::showMaximized () | 472 | void MainWindow::showMaximized () |
475 | { | 473 | { |
476 | #ifndef DESKTOP_VERSION | 474 | #ifndef DESKTOP_VERSION |
477 | if ( ! globalFlagBlockStartup ) | 475 | if ( ! globalFlagBlockStartup ) |
478 | if ( mClosed ) | 476 | if ( mClosed ) |
479 | mView->goToday(); | 477 | mView->goToday(); |
480 | #endif | 478 | #endif |
481 | QWidget::showMaximized () ; | 479 | QWidget::showMaximized () ; |
482 | mClosed = false; | 480 | mClosed = false; |
483 | } | 481 | } |
484 | void MainWindow::closeEvent( QCloseEvent* ce ) | 482 | void MainWindow::closeEvent( QCloseEvent* ce ) |
485 | { | 483 | { |
486 | 484 | ||
487 | 485 | ||
488 | 486 | ||
489 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 487 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
490 | saveOnClose(); | 488 | saveOnClose(); |
491 | mClosed = true; | 489 | mClosed = true; |
492 | ce->accept(); | 490 | ce->accept(); |
493 | return; | 491 | return; |
494 | 492 | ||
495 | } | 493 | } |
496 | 494 | ||
497 | switch( QMessageBox::information( this, "KO/Pi", | 495 | switch( QMessageBox::information( this, "KO/Pi", |
498 | i18n("Do you really want\nto close KO/Pi?"), | 496 | i18n("Do you really want\nto close KO/Pi?"), |
499 | i18n("Close"), i18n("No"), | 497 | i18n("Close"), i18n("No"), |
500 | 0, 0 ) ) { | 498 | 0, 0 ) ) { |
501 | case 0: | 499 | case 0: |
502 | saveOnClose(); | 500 | saveOnClose(); |
503 | mClosed = true; | 501 | mClosed = true; |
504 | ce->accept(); | 502 | ce->accept(); |
505 | break; | 503 | break; |
506 | case 1: | 504 | case 1: |
507 | ce->ignore(); | 505 | ce->ignore(); |
508 | break; | 506 | break; |
509 | case 2: | 507 | case 2: |
510 | 508 | ||
511 | default: | 509 | default: |
512 | break; | 510 | break; |
513 | } | 511 | } |
514 | 512 | ||
515 | 513 | ||
516 | } | 514 | } |
517 | 515 | ||
518 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 516 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
519 | { | 517 | { |
520 | QDataStream stream( data, IO_ReadOnly ); | 518 | QDataStream stream( data, IO_ReadOnly ); |
521 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 519 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
522 | //QString datamess; | 520 | //QString datamess; |
523 | //qDebug("message "); | 521 | //qDebug("message "); |
524 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 522 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
525 | 523 | ||
526 | if ( cmsg == "setDocument(QString)" ) { | 524 | if ( cmsg == "setDocument(QString)" ) { |
527 | QDataStream stream( data, IO_ReadOnly ); | 525 | QDataStream stream( data, IO_ReadOnly ); |
528 | QString fileName; | 526 | QString fileName; |
529 | stream >> fileName; | 527 | stream >> fileName; |
530 | //qDebug("filename %s ", fileName.latin1()); | 528 | //qDebug("filename %s ", fileName.latin1()); |
531 | showMaximized(); | 529 | showMaximized(); |
532 | raise(); | 530 | raise(); |
533 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 531 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
534 | mSyncManager->slotSyncMenu( 1002 ); | 532 | mSyncManager->slotSyncMenu( 1002 ); |
535 | return; | 533 | return; |
536 | } | 534 | } |
537 | 535 | ||
538 | if ( cmsg == "-writeFile" ) { | 536 | if ( cmsg == "-writeFile" ) { |
539 | // I made from the "-writeFile" an "-writeAlarm" | 537 | // I made from the "-writeFile" an "-writeAlarm" |
540 | mView->viewManager()->showWhatsNextView(); | 538 | mView->viewManager()->showWhatsNextView(); |
541 | mCalendar->checkAlarmForIncidence( 0, true); | 539 | mCalendar->checkAlarmForIncidence( 0, true); |
542 | showMaximized(); | 540 | showMaximized(); |
543 | raise(); | 541 | raise(); |
544 | return; | 542 | return; |
545 | 543 | ||
546 | } | 544 | } |
547 | if ( cmsg == "-writeFileSilent" ) { | 545 | if ( cmsg == "-writeFileSilent" ) { |
548 | // I made from the "-writeFile" an "-writeAlarm" | 546 | // I made from the "-writeFile" an "-writeAlarm" |
549 | // mView->viewManager()->showWhatsNextView(); | 547 | // mView->viewManager()->showWhatsNextView(); |
550 | mCalendar->checkAlarmForIncidence( 0, true); | 548 | mCalendar->checkAlarmForIncidence( 0, true); |
551 | //showMaximized(); | 549 | //showMaximized(); |
552 | //raise(); | 550 | //raise(); |
553 | hide(); | 551 | hide(); |
554 | return; | 552 | return; |
555 | } | 553 | } |
556 | if ( cmsg == "-newCountdown" ) { | 554 | if ( cmsg == "-newCountdown" ) { |
557 | qDebug("newCountdown "); | 555 | qDebug("newCountdown "); |
558 | 556 | ||
559 | } | 557 | } |
560 | QString msg ; | 558 | QString msg ; |
561 | QString allmsg = cmsg; | 559 | QString allmsg = cmsg; |
562 | while ( allmsg.length() > 0 ) { | 560 | while ( allmsg.length() > 0 ) { |
563 | int nextC = allmsg.find( "-", 1 ); | 561 | int nextC = allmsg.find( "-", 1 ); |
564 | if ( nextC == -1 ) { | 562 | if ( nextC == -1 ) { |
565 | msg = allmsg; | 563 | msg = allmsg; |
566 | allmsg = ""; | 564 | allmsg = ""; |
567 | } else{ | 565 | } else{ |
568 | msg = allmsg.left( nextC ); | 566 | msg = allmsg.left( nextC ); |
569 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 567 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
570 | } | 568 | } |
571 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 569 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
572 | if ( msg == "-newEvent" ) { | 570 | if ( msg == "-newEvent" ) { |
573 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); | 571 | QTimer::singleShot( 0, mView, SLOT ( newEvent())); |
574 | } | 572 | } |
575 | if ( msg == "-newTodo" ) { | 573 | if ( msg == "-newTodo" ) { |
576 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); | 574 | QTimer::singleShot( 0, mView, SLOT ( newTodo())); |
577 | } | 575 | } |
578 | if ( msg == "-showWN" ) { | 576 | if ( msg == "-showWN" ) { |
579 | mView->viewManager()->showWhatsNextView(); | 577 | mView->viewManager()->showWhatsNextView(); |
580 | } | 578 | } |
581 | if ( msg == "-showTodo" ) { | 579 | if ( msg == "-showTodo" ) { |
582 | mView->viewManager()->showTodoView(); | 580 | mView->viewManager()->showTodoView(); |
583 | } | 581 | } |
584 | if ( msg == "-showList" ) { | 582 | if ( msg == "-showList" ) { |
585 | mView->viewManager()->showListView(); | 583 | mView->viewManager()->showListView(); |
586 | } | 584 | } |
587 | else if ( msg == "-showDay" ) { | 585 | else if ( msg == "-showDay" ) { |
588 | mView->viewManager()->showDayView(); | 586 | mView->viewManager()->showDayView(); |
589 | } | 587 | } |
590 | else if ( msg == "-showWWeek" ) { | 588 | else if ( msg == "-showWWeek" ) { |
591 | mView->viewManager()->showWorkWeekView(); | 589 | mView->viewManager()->showWorkWeekView(); |
592 | } | 590 | } |
593 | else if ( msg == "-ringSync" ) { | 591 | else if ( msg == "-ringSync" ) { |
594 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); | 592 | QTimer::singleShot( 0, this, SLOT (startMultiSync())); |
595 | } | 593 | } |
596 | else if ( msg == "-showWeek" ) { | 594 | else if ( msg == "-showWeek" ) { |
597 | mView->viewManager()->showWeekView(); | 595 | mView->viewManager()->showWeekView(); |
598 | } | 596 | } |
599 | else if ( msg == "-showTodo" ) { | 597 | else if ( msg == "-showTodo" ) { |
600 | mView->viewManager()->showTodoView(); | 598 | mView->viewManager()->showTodoView(); |
601 | } | 599 | } |
602 | else if ( msg == "-showJournal" ) { | 600 | else if ( msg == "-showJournal" ) { |
603 | mView->dateNavigator()->selectDates( 1 ); | 601 | mView->dateNavigator()->selectDates( 1 ); |
604 | mView->dateNavigator()->selectToday(); | 602 | mView->dateNavigator()->selectToday(); |
605 | mView->viewManager()->showJournalView(); | 603 | mView->viewManager()->showJournalView(); |
606 | } | 604 | } |
607 | else if ( msg == "-showKO" ) { | 605 | else if ( msg == "-showKO" ) { |
608 | mView->viewManager()->showNextXView(); | 606 | mView->viewManager()->showNextXView(); |
609 | } | 607 | } |
610 | else if ( msg == "-showWNext" ) { | 608 | else if ( msg == "-showWNext" ) { |
611 | mView->viewManager()->showWhatsNextView(); | 609 | mView->viewManager()->showWhatsNextView(); |
612 | } | 610 | } |
613 | else if ( msg == "nextView()" ) { | 611 | else if ( msg == "nextView()" ) { |
614 | mView->viewManager()->showNextView(); | 612 | mView->viewManager()->showNextView(); |
615 | } | 613 | } |
616 | else if ( msg == "-showNextXView" ) { | 614 | else if ( msg == "-showNextXView" ) { |
617 | mView->viewManager()->showNextXView(); | 615 | mView->viewManager()->showNextXView(); |
618 | } | 616 | } |
619 | 617 | ||
620 | 618 | ||
621 | } | 619 | } |
622 | 620 | ||
623 | showMaximized(); | 621 | showMaximized(); |
624 | raise(); | 622 | raise(); |
625 | } | 623 | } |
626 | void MainWindow::startMultiSync() | 624 | void MainWindow::startMultiSync() |
627 | { | 625 | { |
628 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 626 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
629 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), | 627 | if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), |
630 | question, | 628 | question, |
631 | i18n("Yes"), i18n("No"), | 629 | i18n("Yes"), i18n("No"), |
632 | 0, 0 ) != 0 ) { | 630 | 0, 0 ) != 0 ) { |
633 | setCaption(i18n("Aborted! Nothing synced!")); | 631 | setCaption(i18n("Aborted! Nothing synced!")); |
634 | return; | 632 | return; |
635 | } | 633 | } |
636 | mSyncManager->multiSync( false ); | 634 | mSyncManager->multiSync( false ); |
637 | #ifndef DESKTOP_VERSION | 635 | #ifndef DESKTOP_VERSION |
638 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); | 636 | QCopEnvelope e("QPE/Application/kapi", "doRingSync"); |
639 | #endif | 637 | #endif |
640 | } | 638 | } |
641 | QPixmap MainWindow::loadPixmap( QString name ) | 639 | QPixmap MainWindow::loadPixmap( QString name ) |
642 | { | 640 | { |
643 | return SmallIcon( name ); | 641 | return SmallIcon( name ); |
644 | 642 | ||
645 | } | 643 | } |
646 | void MainWindow::setUsesBigPixmaps ( bool b ) | 644 | void MainWindow::setUsesBigPixmaps ( bool b ) |
647 | { | 645 | { |
648 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); | 646 | qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); |
649 | if ( b ) | 647 | if ( b ) |
650 | qDebug("KO: BigPixmaps are not supported "); | 648 | qDebug("KO: BigPixmaps are not supported "); |
651 | } | 649 | } |
652 | void MainWindow::initActions() | 650 | void MainWindow::initActions() |
653 | { | 651 | { |
654 | //KOPrefs::instance()->mShowFullMenu | 652 | //KOPrefs::instance()->mShowFullMenu |
655 | iconToolBar->clear(); | 653 | iconToolBar->clear(); |
656 | KOPrefs *p = KOPrefs::instance(); | 654 | KOPrefs *p = KOPrefs::instance(); |
657 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 655 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
658 | 656 | ||
659 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 657 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
660 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 658 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
661 | mCurrentItemMenu = new QPopupMenu ( this ); | 659 | mCurrentItemMenu = new QPopupMenu ( this ); |
662 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); | 660 | QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); |
663 | QPopupMenu *importMenu = new QPopupMenu( this ); | 661 | QPopupMenu *importMenu = new QPopupMenu( this ); |
664 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 662 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
665 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 663 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
666 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 664 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
667 | selectFilterMenu = new QPopupMenu( this ); | 665 | selectFilterMenu = new QPopupMenu( this ); |
668 | selectFilterMenu->setCheckable( true ); | 666 | selectFilterMenu->setCheckable( true ); |
669 | syncMenu = new QPopupMenu( this ); | 667 | syncMenu = new QPopupMenu( this ); |
670 | configureAgendaMenu = new QPopupMenu( this ); | 668 | configureAgendaMenu = new QPopupMenu( this ); |
671 | configureToolBarMenu = new QPopupMenu( this ); | 669 | configureToolBarMenu = new QPopupMenu( this ); |
672 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 670 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
673 | QIconSet icon; | 671 | QIconSet icon; |
674 | int pixWid = 22, pixHei = 22; | 672 | int pixWid = 22, pixHei = 22; |
675 | QString pathString = ""; | 673 | QString pathString = ""; |
676 | if ( !p->mToolBarMiniIcons ) { | 674 | if ( !p->mToolBarMiniIcons ) { |
677 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { | 675 | if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { |
678 | pathString += "icons16/"; | 676 | pathString += "icons16/"; |
679 | pixWid = 18; pixHei = 16; | 677 | pixWid = 18; pixHei = 16; |
680 | } | 678 | } |
681 | } else { | 679 | } else { |
682 | pathString += "iconsmini/"; | 680 | pathString += "iconsmini/"; |
683 | pixWid = 18; pixHei = 16; | 681 | pixWid = 18; pixHei = 16; |
684 | } | 682 | } |
683 | KMenuBar *menuBar1; | ||
685 | if ( KOPrefs::instance()->mShowFullMenu ) { | 684 | if ( KOPrefs::instance()->mShowFullMenu ) { |
686 | QMenuBar *menuBar1; | 685 | menuBar1 = new KMenuBar( this );//menuBar(); |
687 | menuBar1 = menuBar(); | ||
688 | menuBar1->insertItem( i18n("File"), importMenu ); | 686 | menuBar1->insertItem( i18n("File"), importMenu ); |
689 | menuBar1->insertItem( i18n("View"), viewMenu ); | 687 | menuBar1->insertItem( i18n("View"), viewMenu ); |
690 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); | 688 | menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); |
691 | menuBar1->insertItem( i18n("Action"), actionMenu ); | 689 | menuBar1->insertItem( i18n("Action"), actionMenu ); |
692 | #ifdef DESKTOP_VERSION | 690 | #ifdef DESKTOP_VERSION |
693 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 691 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
694 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 692 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
695 | #else | 693 | #else |
696 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 694 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
697 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 695 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
698 | #endif | 696 | #endif |
699 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 697 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
700 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 698 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
701 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 699 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
702 | } else { | 700 | } else { |
703 | QPEMenuBar *menuBar1; | 701 | menuBar1 = new KMenuBar( iconToolBar ); |
704 | menuBar1 = new QPEMenuBar( iconToolBar ); | ||
705 | QPopupMenu *menuBar = new QPopupMenu( this ); | 702 | QPopupMenu *menuBar = new QPopupMenu( this ); |
706 | icon = loadPixmap( pathString + "z_menu" ); | 703 | icon = loadPixmap( pathString + "z_menu" ); |
707 | menuBar1->insertItem( icon.pixmap(), menuBar); | 704 | menuBar1->insertItem( icon.pixmap(), menuBar); |
708 | //menuBar1->insertItem( i18n("ME"), menuBar); | 705 | //menuBar1->insertItem( i18n("ME"), menuBar); |
709 | menuBar->insertItem( i18n("File"), importMenu ); | 706 | menuBar->insertItem( i18n("File"), importMenu ); |
710 | menuBar->insertItem( i18n("View"), viewMenu ); | 707 | menuBar->insertItem( i18n("View"), viewMenu ); |
711 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); | 708 | menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); |
712 | menuBar->insertItem( i18n("Action"), actionMenu ); | 709 | menuBar->insertItem( i18n("Action"), actionMenu ); |
713 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 710 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
714 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 711 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
715 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 712 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
716 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 713 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
717 | menuBar->insertItem( i18n("Help"), helpMenu ); | 714 | menuBar->insertItem( i18n("Help"), helpMenu ); |
718 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 715 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
719 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 716 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
720 | } | 717 | } |
718 | connect ( menuBar1, SIGNAL( lostFocus () ), mView, SLOT ( slotResetFocus() ) ); | ||
721 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 719 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
722 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 720 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
723 | 721 | ||
724 | 722 | ||
725 | mWeekBgColor = iconToolBar->backgroundColor(); | 723 | mWeekBgColor = iconToolBar->backgroundColor(); |
726 | mWeekPixmap.resize( pixWid , pixHei ); | 724 | mWeekPixmap.resize( pixWid , pixHei ); |
727 | mWeekPixmap.fill( mWeekBgColor ); | 725 | mWeekPixmap.fill( mWeekBgColor ); |
728 | icon = mWeekPixmap; | 726 | icon = mWeekPixmap; |
729 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 727 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
730 | if ( p-> mShowIconWeekNum ) | 728 | if ( p-> mShowIconWeekNum ) |
731 | mWeekAction->addTo( iconToolBar ); | 729 | mWeekAction->addTo( iconToolBar ); |
732 | mWeekFont = font(); | 730 | mWeekFont = font(); |
733 | 731 | ||
734 | int fontPoint = mWeekFont.pointSize(); | 732 | int fontPoint = mWeekFont.pointSize(); |
735 | QFontMetrics f( mWeekFont ); | 733 | QFontMetrics f( mWeekFont ); |
736 | int fontWid = f.width( "30" ); | 734 | int fontWid = f.width( "30" ); |
737 | while ( fontWid > pixWid ) { | 735 | while ( fontWid > pixWid ) { |
738 | --fontPoint; | 736 | --fontPoint; |
739 | mWeekFont.setPointSize( fontPoint ); | 737 | mWeekFont.setPointSize( fontPoint ); |
740 | QFontMetrics f( mWeekFont ); | 738 | QFontMetrics f( mWeekFont ); |
741 | fontWid = f.width( "30" ); | 739 | fontWid = f.width( "30" ); |
742 | //qDebug("dec-- "); | 740 | //qDebug("dec-- "); |
743 | } | 741 | } |
744 | 742 | ||
745 | connect( mWeekAction, SIGNAL( activated() ), | 743 | connect( mWeekAction, SIGNAL( activated() ), |
746 | this, SLOT( weekAction() ) ); | 744 | this, SLOT( weekAction() ) ); |
747 | 745 | ||
748 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 746 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
749 | if ( p->mShowIconFilterview ) { | 747 | if ( p->mShowIconFilterview ) { |
750 | icon = loadPixmap( pathString + "filter" ); | 748 | icon = loadPixmap( pathString + "filter" ); |
751 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 749 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
752 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 750 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
753 | this, SLOT( fillFilterMenuTB() ) ); | 751 | this, SLOT( fillFilterMenuTB() ) ); |
754 | actionFilterMenuTB->addTo( iconToolBar ); | 752 | actionFilterMenuTB->addTo( iconToolBar ); |
755 | selectFilterMenuTB = new QPopupMenu( this ); | 753 | selectFilterMenuTB = new QPopupMenu( this ); |
756 | selectFilterMenuTB->setCheckable( true ); | 754 | selectFilterMenuTB->setCheckable( true ); |
757 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 755 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
758 | } | 756 | } |
759 | 757 | ||
760 | //#endif | 758 | //#endif |
761 | // ****************** | 759 | // ****************** |
762 | QAction *action; | 760 | QAction *action; |
763 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 761 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
764 | configureToolBarMenu->setCheckable( true ); | 762 | configureToolBarMenu->setCheckable( true ); |
765 | 763 | ||
766 | 764 | ||
767 | configureAgendaMenu->setCheckable( true ); | 765 | configureAgendaMenu->setCheckable( true ); |
768 | int iii ; | 766 | int iii ; |
769 | for ( iii = 1;iii<= 10 ;++iii ){ | 767 | for ( iii = 1;iii<= 10 ;++iii ){ |
770 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 768 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
771 | } | 769 | } |
772 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 770 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
773 | 771 | ||
774 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 772 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
775 | this, SLOT( showConfigureAgenda( ) ) ); | 773 | this, SLOT( showConfigureAgenda( ) ) ); |
776 | icon = loadPixmap( pathString + "today" ); | 774 | icon = loadPixmap( pathString + "today" ); |
777 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 775 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
778 | today_action->addTo( actionMenu ); | 776 | today_action->addTo( actionMenu ); |
779 | connect( today_action, SIGNAL( activated() ), | 777 | connect( today_action, SIGNAL( activated() ), |
780 | mView, SLOT( goToday() ) ); | 778 | mView, SLOT( goToday() ) ); |
781 | 779 | ||
782 | icon = loadPixmap( pathString + "picker" ); | 780 | icon = loadPixmap( pathString + "picker" ); |
783 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); | 781 | QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); |
784 | dPickerAction->addTo( actionMenu ); | 782 | dPickerAction->addTo( actionMenu ); |
785 | connect( dPickerAction, SIGNAL( activated() ), | 783 | connect( dPickerAction, SIGNAL( activated() ), |
786 | mView, SLOT( showDatePicker() ) ); | 784 | mView, SLOT( showDatePicker() ) ); |
787 | 785 | ||
788 | icon = loadPixmap( pathString + "search" ); | 786 | icon = loadPixmap( pathString + "search" ); |
789 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 787 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
790 | search_action->addTo( actionMenu ); | 788 | search_action->addTo( actionMenu ); |
791 | connect( search_action, SIGNAL( activated() ), | 789 | connect( search_action, SIGNAL( activated() ), |
792 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 790 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
793 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); | 791 | actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); |
794 | 792 | ||
795 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); | 793 | action = new QAction( "Undo Delete", i18n("All events"), 0, this ); |
796 | action->addTo( nextConflictMenu ); | 794 | action->addTo( nextConflictMenu ); |
797 | connect( action, SIGNAL( activated() ), | 795 | connect( action, SIGNAL( activated() ), |
798 | mView, SLOT( conflictAll() ) ); | 796 | mView, SLOT( conflictAll() ) ); |
799 | 797 | ||
800 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); | 798 | action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); |
801 | action->addTo( nextConflictMenu ); | 799 | action->addTo( nextConflictMenu ); |
802 | connect( action, SIGNAL( activated() ), | 800 | connect( action, SIGNAL( activated() ), |
803 | mView, SLOT( conflictAllday() ) ); | 801 | mView, SLOT( conflictAllday() ) ); |
804 | 802 | ||
805 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); | 803 | action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); |
806 | action->addTo( nextConflictMenu ); | 804 | action->addTo( nextConflictMenu ); |
807 | connect( action, SIGNAL( activated() ), | 805 | connect( action, SIGNAL( activated() ), |
808 | mView, SLOT( conflictNotAll() ) ); | 806 | mView, SLOT( conflictNotAll() ) ); |
809 | 807 | ||
810 | actionMenu->insertSeparator(); | 808 | actionMenu->insertSeparator(); |
811 | 809 | ||
812 | icon = loadPixmap( pathString + "newevent" ); | 810 | icon = loadPixmap( pathString + "newevent" ); |
813 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 811 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
814 | ne_action->addTo( mCurrentItemMenu ); | 812 | ne_action->addTo( mCurrentItemMenu ); |
815 | connect( ne_action, SIGNAL( activated() ), | 813 | connect( ne_action, SIGNAL( activated() ), |
816 | mView, SLOT( newEvent() ) ); | 814 | mView, SLOT( newEvent() ) ); |
817 | icon = loadPixmap( pathString + "newtodo" ); | 815 | icon = loadPixmap( pathString + "newtodo" ); |
818 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 816 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
819 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 817 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
820 | nt_action->addTo( mCurrentItemMenu ); | 818 | nt_action->addTo( mCurrentItemMenu ); |
821 | connect( nt_action, SIGNAL( activated() ), | 819 | connect( nt_action, SIGNAL( activated() ), |
822 | mView, SLOT( newTodo() ) ); | 820 | mView, SLOT( newTodo() ) ); |
823 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 821 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
824 | this ); | 822 | this ); |
825 | mNewSubTodoAction->addTo( mCurrentItemMenu ); | 823 | mNewSubTodoAction->addTo( mCurrentItemMenu ); |
826 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 824 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
827 | mView, SLOT( newSubTodo() ) ); | 825 | mView, SLOT( newSubTodo() ) ); |
828 | 826 | ||
829 | mCurrentItemMenu->insertSeparator(); | 827 | mCurrentItemMenu->insertSeparator(); |
830 | icon = loadPixmap( pathString + "newevent" ); | 828 | icon = loadPixmap( pathString + "newevent" ); |
831 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 829 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
832 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 830 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
833 | configureToolBarMenu->insertSeparator(); | 831 | configureToolBarMenu->insertSeparator(); |
834 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 832 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
835 | configureToolBarMenu->insertSeparator(); | 833 | configureToolBarMenu->insertSeparator(); |
836 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 834 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
837 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 835 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
838 | 836 | ||
839 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); | 837 | //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); |
840 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); | 838 | mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); |
841 | mShowAction->addTo( mCurrentItemMenu ); | 839 | mShowAction->addTo( mCurrentItemMenu ); |
842 | connect( mShowAction, SIGNAL( activated() ), | 840 | connect( mShowAction, SIGNAL( activated() ), |
843 | mView, SLOT( showIncidence() ) ); | 841 | mView, SLOT( showIncidence() ) ); |
844 | 842 | ||
845 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 843 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
846 | mEditAction->addTo( mCurrentItemMenu ); | 844 | mEditAction->addTo( mCurrentItemMenu ); |
847 | connect( mEditAction, SIGNAL( activated() ), | 845 | connect( mEditAction, SIGNAL( activated() ), |
848 | mView, SLOT( editIncidence() ) ); | 846 | mView, SLOT( editIncidence() ) ); |
849 | 847 | ||
850 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 848 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
851 | mDeleteAction->addTo( mCurrentItemMenu ); | 849 | mDeleteAction->addTo( mCurrentItemMenu ); |
852 | connect( mDeleteAction, SIGNAL( activated() ), | 850 | connect( mDeleteAction, SIGNAL( activated() ), |
853 | mView, SLOT( deleteIncidence() ) ); | 851 | mView, SLOT( deleteIncidence() ) ); |
854 | 852 | ||
855 | 853 | ||
856 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 854 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
857 | mCloneAction->addTo( mCurrentItemMenu ); | 855 | mCloneAction->addTo( mCurrentItemMenu ); |
858 | connect( mCloneAction, SIGNAL( activated() ), | 856 | connect( mCloneAction, SIGNAL( activated() ), |
859 | mView, SLOT( cloneIncidence() ) ); | 857 | mView, SLOT( cloneIncidence() ) ); |
860 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 858 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
861 | mMoveAction->addTo( mCurrentItemMenu ); | 859 | mMoveAction->addTo( mCurrentItemMenu ); |
862 | connect( mMoveAction, SIGNAL( activated() ), | 860 | connect( mMoveAction, SIGNAL( activated() ), |
863 | mView, SLOT( moveIncidence() ) ); | 861 | mView, SLOT( moveIncidence() ) ); |
864 | #ifndef DESKTOP_VERSION | 862 | #ifndef DESKTOP_VERSION |
865 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 863 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
866 | mBeamAction->addTo(mCurrentItemMenu ); | 864 | mBeamAction->addTo(mCurrentItemMenu ); |
867 | connect( mBeamAction, SIGNAL( activated() ), | 865 | connect( mBeamAction, SIGNAL( activated() ), |
868 | mView, SLOT( beamIncidence() ) ); | 866 | mView, SLOT( beamIncidence() ) ); |
869 | #endif | 867 | #endif |
870 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 868 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
871 | mCancelAction->addTo( mCurrentItemMenu ); | 869 | mCancelAction->addTo( mCurrentItemMenu ); |
872 | connect( mCancelAction, SIGNAL( activated() ), | 870 | connect( mCancelAction, SIGNAL( activated() ), |
873 | mView, SLOT( toggleCancelIncidence() ) ); | 871 | mView, SLOT( toggleCancelIncidence() ) ); |
874 | 872 | ||
875 | 873 | ||
876 | mCurrentItemMenu->insertSeparator(); | 874 | mCurrentItemMenu->insertSeparator(); |
877 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 875 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
878 | action->addTo( mCurrentItemMenu ); | 876 | action->addTo( mCurrentItemMenu ); |
879 | connect( action, SIGNAL( activated() ), | 877 | connect( action, SIGNAL( activated() ), |
880 | mView, SLOT( undo_delete() ) ); | 878 | mView, SLOT( undo_delete() ) ); |
881 | 879 | ||
882 | // *********************** | 880 | // *********************** |
883 | if ( KOPrefs::instance()->mVerticalScreen ) { | 881 | if ( KOPrefs::instance()->mVerticalScreen ) { |
884 | icon = SmallIcon( "1updownarrow" ); | 882 | icon = SmallIcon( "1updownarrow" ); |
885 | } else { | 883 | } else { |
886 | icon = SmallIcon("1leftrightarrow" ); | 884 | icon = SmallIcon("1leftrightarrow" ); |
887 | } | 885 | } |
888 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 886 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
889 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 887 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
890 | FSaction->addTo( viewMenu ); | 888 | FSaction->addTo( viewMenu ); |
891 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 889 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
892 | 890 | ||
893 | 891 | ||
894 | icon = loadPixmap( pathString + "filter" ); | 892 | icon = loadPixmap( pathString + "filter" ); |
895 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 893 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
896 | icon = loadPixmap( pathString + "configure" ); | 894 | icon = loadPixmap( pathString + "configure" ); |
897 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); | 895 | action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); |
898 | action->addTo( viewMenu ); | 896 | action->addTo( viewMenu ); |
899 | connect( action, SIGNAL( activated() ), | 897 | connect( action, SIGNAL( activated() ), |
900 | mView, SLOT( toggleFilter() ) ); | 898 | mView, SLOT( toggleFilter() ) ); |
901 | mToggleFilter = action; | 899 | mToggleFilter = action; |
902 | icon = loadPixmap( pathString + "navi" ); | 900 | icon = loadPixmap( pathString + "navi" ); |
903 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 901 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
904 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 902 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
905 | action->addTo( viewMenu ); | 903 | action->addTo( viewMenu ); |
906 | connect( action, SIGNAL( activated() ), | 904 | connect( action, SIGNAL( activated() ), |
907 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 905 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
908 | mToggleNav = action ; | 906 | mToggleNav = action ; |
909 | icon = loadPixmap( pathString + "allday" ); | 907 | icon = loadPixmap( pathString + "allday" ); |
910 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 908 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
911 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 909 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
912 | action->addTo( viewMenu ); | 910 | action->addTo( viewMenu ); |
913 | connect( action, SIGNAL( activated() ), | 911 | connect( action, SIGNAL( activated() ), |
914 | mView, SLOT( toggleAllDaySize() ) ); | 912 | mView, SLOT( toggleAllDaySize() ) ); |
915 | mToggleAllday = action; | 913 | mToggleAllday = action; |
916 | 914 | ||
917 | 915 | ||
918 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 916 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
919 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 917 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
920 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 918 | //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
921 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 919 | // mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
922 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 920 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
923 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 921 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
924 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 922 | // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
925 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); | 923 | // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); |
926 | 924 | ||
927 | 925 | ||
928 | dPickerAction->addTo( iconToolBar ); | 926 | dPickerAction->addTo( iconToolBar ); |
929 | viewMenu->insertSeparator(); | 927 | viewMenu->insertSeparator(); |
930 | 928 | ||
931 | if ( p-> mShowIconToggleFull ) | 929 | if ( p-> mShowIconToggleFull ) |
932 | FSaction->addTo( iconToolBar ); | 930 | FSaction->addTo( iconToolBar ); |
933 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 931 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
934 | 932 | ||
935 | //******************** | 933 | //******************** |
936 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 934 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
937 | 935 | ||
938 | 936 | ||
939 | icon = loadPixmap( pathString + "whatsnext" ); | 937 | icon = loadPixmap( pathString + "whatsnext" ); |
940 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 938 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
941 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 939 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
942 | whatsnext_action->addTo( viewMenu ); | 940 | whatsnext_action->addTo( viewMenu ); |
943 | connect( whatsnext_action, SIGNAL( activated() ), | 941 | connect( whatsnext_action, SIGNAL( activated() ), |
944 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 942 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
945 | 943 | ||
946 | icon = loadPixmap( pathString + "xdays" ); | 944 | icon = loadPixmap( pathString + "xdays" ); |
947 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 945 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
948 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 946 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
949 | xdays_action->addTo( viewMenu ); | 947 | xdays_action->addTo( viewMenu ); |
950 | connect( xdays_action, SIGNAL( activated() ), | 948 | connect( xdays_action, SIGNAL( activated() ), |
951 | mView->viewManager(), SLOT( showNextXView() ) ); | 949 | mView->viewManager(), SLOT( showNextXView() ) ); |
952 | 950 | ||
953 | 951 | ||
954 | icon = loadPixmap( pathString + "journal" ); | 952 | icon = loadPixmap( pathString + "journal" ); |
955 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 953 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
956 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 954 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
957 | viewjournal_action->addTo( viewMenu ); | 955 | viewjournal_action->addTo( viewMenu ); |
958 | connect( viewjournal_action, SIGNAL( activated() ), | 956 | connect( viewjournal_action, SIGNAL( activated() ), |
959 | mView->viewManager(), SLOT( showJournalView() ) ); | 957 | mView->viewManager(), SLOT( showJournalView() ) ); |
960 | 958 | ||
961 | 959 | ||
962 | icon = loadPixmap( pathString + "day" ); | 960 | icon = loadPixmap( pathString + "day" ); |
963 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 961 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
964 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 962 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
965 | day1_action->addTo( viewMenu ); | 963 | day1_action->addTo( viewMenu ); |
966 | // action->addTo( toolBar ); | 964 | // action->addTo( toolBar ); |
967 | connect( day1_action, SIGNAL( activated() ), | 965 | connect( day1_action, SIGNAL( activated() ), |
968 | mView->viewManager(), SLOT( showDayView() ) ); | 966 | mView->viewManager(), SLOT( showDayView() ) ); |
969 | 967 | ||
970 | icon = loadPixmap( pathString + "workweek" ); | 968 | icon = loadPixmap( pathString + "workweek" ); |
971 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 969 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
972 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 970 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
973 | day5_action->addTo( viewMenu ); | 971 | day5_action->addTo( viewMenu ); |
974 | connect( day5_action, SIGNAL( activated() ), | 972 | connect( day5_action, SIGNAL( activated() ), |
975 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 973 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
976 | 974 | ||
977 | icon = loadPixmap( pathString + "week" ); | 975 | icon = loadPixmap( pathString + "week" ); |
978 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 976 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
979 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 977 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
980 | day7_action->addTo( viewMenu ); | 978 | day7_action->addTo( viewMenu ); |
981 | connect( day7_action, SIGNAL( activated() ), | 979 | connect( day7_action, SIGNAL( activated() ), |
982 | mView->viewManager(), SLOT( showWeekView() ) ); | 980 | mView->viewManager(), SLOT( showWeekView() ) ); |
983 | 981 | ||
984 | icon = loadPixmap( pathString + "workweek2" ); | 982 | icon = loadPixmap( pathString + "workweek2" ); |
985 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 983 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
986 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 984 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
987 | day6_action->addTo( viewMenu ); | 985 | day6_action->addTo( viewMenu ); |
988 | connect( day6_action, SIGNAL( activated() ), | 986 | connect( day6_action, SIGNAL( activated() ), |
989 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 987 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
990 | 988 | ||
991 | icon = loadPixmap( pathString + "month" ); | 989 | icon = loadPixmap( pathString + "month" ); |
992 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 990 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
993 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 991 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
994 | month_action->addTo( viewMenu ); | 992 | month_action->addTo( viewMenu ); |
995 | connect( month_action, SIGNAL( activated() ), | 993 | connect( month_action, SIGNAL( activated() ), |
996 | mView->viewManager(), SLOT( showMonthView() ) ); | 994 | mView->viewManager(), SLOT( showMonthView() ) ); |
997 | 995 | ||
998 | icon = loadPixmap( pathString + "list" ); | 996 | icon = loadPixmap( pathString + "list" ); |
999 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 997 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
1000 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 998 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
1001 | showlist_action->addTo( viewMenu ); | 999 | showlist_action->addTo( viewMenu ); |
1002 | connect( showlist_action, SIGNAL( activated() ), | 1000 | connect( showlist_action, SIGNAL( activated() ), |
1003 | mView->viewManager(), SLOT( showListView() ) ); | 1001 | mView->viewManager(), SLOT( showListView() ) ); |
1004 | 1002 | ||
1005 | icon = loadPixmap( pathString + "todo" ); | 1003 | icon = loadPixmap( pathString + "todo" ); |
1006 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 1004 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
1007 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 1005 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
1008 | todoview_action->addTo( viewMenu ); | 1006 | todoview_action->addTo( viewMenu ); |
1009 | connect( todoview_action, SIGNAL( activated() ), | 1007 | connect( todoview_action, SIGNAL( activated() ), |
1010 | mView->viewManager(), SLOT( showTodoView() ) ); | 1008 | mView->viewManager(), SLOT( showTodoView() ) ); |
1011 | 1009 | ||
1012 | 1010 | ||
1013 | 1011 | ||
1014 | #if 0 | 1012 | #if 0 |
1015 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 1013 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
1016 | action->addTo( viewMenu ); | 1014 | action->addTo( viewMenu ); |
1017 | connect( action, SIGNAL( activated() ), | 1015 | connect( action, SIGNAL( activated() ), |
1018 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 1016 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
1019 | #endif | 1017 | #endif |
1020 | 1018 | ||
1021 | 1019 | ||
1022 | 1020 | ||
1023 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, | 1021 | action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, |
1024 | this ); | 1022 | this ); |
1025 | action->addTo( actionMenu ); | 1023 | action->addTo( actionMenu ); |
1026 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 1024 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
1027 | 1025 | ||
1028 | 1026 | ||
1029 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 1027 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
1030 | 1028 | ||
1031 | 1029 | ||
1032 | 1030 | ||
1033 | actionMenu->insertSeparator(); | 1031 | actionMenu->insertSeparator(); |
1034 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, | 1032 | action = new QAction( "manage cat", i18n("Edit category list..."), 0, |
1035 | this ); | 1033 | this ); |
1036 | action->addTo( actionMenu ); | 1034 | action->addTo( actionMenu ); |
1037 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); | 1035 | connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); |
1038 | 1036 | ||
1039 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1037 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1040 | this ); | 1038 | this ); |
1041 | action->addTo( actionMenu ); | 1039 | action->addTo( actionMenu ); |
1042 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1040 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1043 | 1041 | ||
1044 | 1042 | ||
1045 | actionMenu->insertSeparator(); | 1043 | actionMenu->insertSeparator(); |
1046 | icon = loadPixmap( pathString + "configure" ); | 1044 | icon = loadPixmap( pathString + "configure" ); |
1047 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); | 1045 | action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); |
1048 | action->addTo( actionMenu ); | 1046 | action->addTo( actionMenu ); |
1049 | connect( action, SIGNAL( activated() ), | 1047 | connect( action, SIGNAL( activated() ), |
1050 | mView, SLOT( edit_options() ) ); | 1048 | mView, SLOT( edit_options() ) ); |
1051 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); | 1049 | action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); |
1052 | action->addTo( actionMenu ); | 1050 | action->addTo( actionMenu ); |
1053 | connect( action, SIGNAL( activated() ), | 1051 | connect( action, SIGNAL( activated() ), |
1054 | this, SLOT( calHint() ) ); | 1052 | this, SLOT( calHint() ) ); |
1055 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); | 1053 | action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); |
1056 | action->addTo( actionMenu ); | 1054 | action->addTo( actionMenu ); |
1057 | connect( action, SIGNAL( activated() ), | 1055 | connect( action, SIGNAL( activated() ), |
1058 | mView, SLOT( edit_global_options() ) ); | 1056 | mView, SLOT( edit_global_options() ) ); |
1059 | if ( KOPrefs::instance()->mShowFullMenu ) { | 1057 | if ( KOPrefs::instance()->mShowFullMenu ) { |
1060 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 1058 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
1061 | 1059 | ||
1062 | } | 1060 | } |
1063 | // actionMenu->insertSeparator(); | 1061 | // actionMenu->insertSeparator(); |
1064 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 1062 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
1065 | this ); | 1063 | this ); |
1066 | action->addTo( importMenu_X ); | 1064 | action->addTo( importMenu_X ); |
1067 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 1065 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
1068 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 1066 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
1069 | this ); | 1067 | this ); |
1070 | action->addTo( importMenu_X ); | 1068 | action->addTo( importMenu_X ); |
1071 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 1069 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
1072 | importMenu_X->insertSeparator(); | 1070 | importMenu_X->insertSeparator(); |
1073 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 1071 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
1074 | this ); | 1072 | this ); |
1075 | action->addTo( importMenu_X ); | 1073 | action->addTo( importMenu_X ); |
1076 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 1074 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
1077 | //#ifndef DESKTOP_VERSION | 1075 | //#ifndef DESKTOP_VERSION |
1078 | importMenu_X->insertSeparator(); | 1076 | importMenu_X->insertSeparator(); |
1079 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 1077 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
1080 | this ); | 1078 | this ); |
1081 | action->addTo( importMenu_X ); | 1079 | action->addTo( importMenu_X ); |
1082 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 1080 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
1083 | //#else | 1081 | //#else |
1084 | #ifdef _OL_IMPORT_ | 1082 | #ifdef _OL_IMPORT_ |
1085 | importMenu_X->insertSeparator(); | 1083 | importMenu_X->insertSeparator(); |
1086 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 1084 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
1087 | this ); | 1085 | this ); |
1088 | action->addTo( importMenu_X ); | 1086 | action->addTo( importMenu_X ); |
1089 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 1087 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
1090 | #endif | 1088 | #endif |
1091 | //#endif | 1089 | //#endif |
1092 | 1090 | ||
1093 | //importMenu->insertSeparator(); | 1091 | //importMenu->insertSeparator(); |
1094 | #if 0 | 1092 | #if 0 |
1095 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1093 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1096 | this ); | 1094 | this ); |
1097 | action->addTo( importMenu ); | 1095 | action->addTo( importMenu ); |
1098 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1096 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1099 | #endif | 1097 | #endif |
1100 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, | 1098 | action = new QAction( "save_cal", i18n("Save Backup..."), 0, |
1101 | this ); | 1099 | this ); |
1102 | action->addTo( importMenu ); | 1100 | action->addTo( importMenu ); |
1103 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 1101 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
1104 | importMenu->insertSeparator(); | 1102 | importMenu->insertSeparator(); |
1105 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 1103 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
1106 | //importMenu->insertSeparator(); | 1104 | //importMenu->insertSeparator(); |
1107 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 1105 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
1108 | this ); | 1106 | this ); |
1109 | action->addTo( exportMenu_X ); | 1107 | action->addTo( exportMenu_X ); |
1110 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1108 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1111 | 1109 | ||
1112 | 1110 | ||
1113 | //LR | 1111 | //LR |
1114 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1112 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1115 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1113 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1116 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1114 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1117 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1115 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1118 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1116 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1119 | 1117 | ||
1120 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1118 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1121 | mPrintSelAction = 0; | 1119 | mPrintSelAction = 0; |
1122 | #ifndef DESKTOP_VERSION | 1120 | #ifndef DESKTOP_VERSION |
1123 | //importMenu->insertSeparator(); | 1121 | //importMenu->insertSeparator(); |
1124 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1122 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1125 | this ); | 1123 | this ); |
1126 | brAction->addTo( beamMenu_X ); | 1124 | brAction->addTo( beamMenu_X ); |
1127 | brAction->setToggleAction (true ) ; | 1125 | brAction->setToggleAction (true ) ; |
1128 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1126 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1129 | 1127 | ||
1130 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1128 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1131 | this ); | 1129 | this ); |
1132 | action->addTo( beamMenu_X ); | 1130 | action->addTo( beamMenu_X ); |
1133 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1131 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1134 | 1132 | ||
1135 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1133 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1136 | this ); | 1134 | this ); |
1137 | action->addTo( beamMenu_X ); | 1135 | action->addTo( beamMenu_X ); |
1138 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1136 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1139 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1137 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1140 | #else | 1138 | #else |
1141 | //importMenu->insertSeparator(); | 1139 | //importMenu->insertSeparator(); |
1142 | icon = loadPixmap( pathString + "print" ); | 1140 | icon = loadPixmap( pathString + "print" ); |
1143 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1141 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1144 | action->addTo( beamMenu_X ); | 1142 | action->addTo( beamMenu_X ); |
1145 | connect( action, SIGNAL( activated() ), | 1143 | connect( action, SIGNAL( activated() ), |
1146 | this, SLOT( printCal() ) ); | 1144 | this, SLOT( printCal() ) ); |
1147 | 1145 | ||
1148 | icon = loadPixmap( pathString + "week" ); | 1146 | icon = loadPixmap( pathString + "week" ); |
1149 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1147 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1150 | action->addTo( beamMenu_X ); | 1148 | action->addTo( beamMenu_X ); |
1151 | connect( action, SIGNAL( activated() ), | 1149 | connect( action, SIGNAL( activated() ), |
1152 | this, SLOT( printSel() ) ); | 1150 | this, SLOT( printSel() ) ); |
1153 | icon = loadPixmap( pathString + "whatsnext" ); | 1151 | icon = loadPixmap( pathString + "whatsnext" ); |
1154 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1152 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1155 | action->addTo( beamMenu_X ); | 1153 | action->addTo( beamMenu_X ); |
1156 | connect( action, SIGNAL( activated() ), | 1154 | connect( action, SIGNAL( activated() ), |
1157 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1155 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1158 | 1156 | ||
1159 | 1157 | ||
1160 | icon = loadPixmap( pathString + "list" ); | 1158 | icon = loadPixmap( pathString + "list" ); |
1161 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); | 1159 | action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); |
1162 | action->addTo( beamMenu_X ); | 1160 | action->addTo( beamMenu_X ); |
1163 | connect( action, SIGNAL( activated() ), | 1161 | connect( action, SIGNAL( activated() ), |
1164 | this, SLOT( printListView() ) ); | 1162 | this, SLOT( printListView() ) ); |
1165 | 1163 | ||
1166 | icon = loadPixmap( pathString + "newevent" ); | 1164 | icon = loadPixmap( pathString + "newevent" ); |
1167 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1165 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1168 | action->addTo( beamMenu_X ); | 1166 | action->addTo( beamMenu_X ); |
1169 | connect( action, SIGNAL( activated() ), | 1167 | connect( action, SIGNAL( activated() ), |
1170 | mView, SLOT( slotprintSelInc() ) ); | 1168 | mView, SLOT( slotprintSelInc() ) ); |
1171 | mPrintSelAction = action; | 1169 | mPrintSelAction = action; |
1172 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1170 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1173 | #endif | 1171 | #endif |
1174 | 1172 | ||
1175 | importMenu->insertSeparator(); | 1173 | importMenu->insertSeparator(); |
1176 | action = new QAction( "beam all", i18n("Save"), 0, | 1174 | action = new QAction( "beam all", i18n("Save"), 0, |
1177 | this ); | 1175 | this ); |
1178 | action->addTo( importMenu ); | 1176 | action->addTo( importMenu ); |
1179 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1177 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1180 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1178 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1181 | this ); | 1179 | this ); |
1182 | action->addTo( importMenu ); | 1180 | action->addTo( importMenu ); |
1183 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1181 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1184 | 1182 | ||
1185 | //menuBar->insertItem( "Configure",configureMenu ); | 1183 | //menuBar->insertItem( "Configure",configureMenu ); |
1186 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1184 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1187 | icon = loadPixmap( "korganizer/korganizer" ); | 1185 | icon = loadPixmap( "korganizer/korganizer" ); |
1188 | 1186 | ||
1189 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1187 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1190 | action->addTo( helpMenu ); | 1188 | action->addTo( helpMenu ); |
1191 | connect( action, SIGNAL( activated() ), | 1189 | connect( action, SIGNAL( activated() ), |
1192 | SLOT( whatsNew() ) ); | 1190 | SLOT( whatsNew() ) ); |
1193 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1191 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1194 | action->addTo( helpMenu ); | 1192 | action->addTo( helpMenu ); |
1195 | connect( action, SIGNAL( activated() ), | 1193 | connect( action, SIGNAL( activated() ), |
1196 | SLOT( features() ) ); | 1194 | SLOT( features() ) ); |
1197 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1195 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1198 | action->addTo( helpMenu ); | 1196 | action->addTo( helpMenu ); |
1199 | connect( action, SIGNAL( activated() ), | 1197 | connect( action, SIGNAL( activated() ), |
1200 | SLOT( keyBindings() ) ); | 1198 | SLOT( keyBindings() ) ); |
1201 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1199 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1202 | action->addTo( helpMenu ); | 1200 | action->addTo( helpMenu ); |
1203 | connect( action, SIGNAL( activated() ), | 1201 | connect( action, SIGNAL( activated() ), |
1204 | SLOT( storagehowto() ) ); | 1202 | SLOT( storagehowto() ) ); |
1205 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); | 1203 | action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); |
1206 | action->addTo( helpMenu ); | 1204 | action->addTo( helpMenu ); |
1207 | connect( action, SIGNAL( activated() ), | 1205 | connect( action, SIGNAL( activated() ), |
1208 | SLOT( timetrackinghowto() ) ); | 1206 | SLOT( timetrackinghowto() ) ); |
1209 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1207 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1210 | action->addTo( helpMenu ); | 1208 | action->addTo( helpMenu ); |
1211 | connect( action, SIGNAL( activated() ), | 1209 | connect( action, SIGNAL( activated() ), |
1212 | SLOT( synchowto() ) ); | 1210 | SLOT( synchowto() ) ); |
1213 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1211 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1214 | action->addTo( helpMenu ); | 1212 | action->addTo( helpMenu ); |
1215 | connect( action, SIGNAL( activated() ), | 1213 | connect( action, SIGNAL( activated() ), |
1216 | SLOT( kdesynchowto() ) ); | 1214 | SLOT( kdesynchowto() ) ); |
1217 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1215 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1218 | action->addTo( helpMenu ); | 1216 | action->addTo( helpMenu ); |
1219 | connect( action, SIGNAL( activated() ), | 1217 | connect( action, SIGNAL( activated() ), |
1220 | SLOT( multisynchowto() ) ); | 1218 | SLOT( multisynchowto() ) ); |
1221 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1219 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1222 | action->addTo( helpMenu ); | 1220 | action->addTo( helpMenu ); |
1223 | connect( action, SIGNAL( activated() ), | 1221 | connect( action, SIGNAL( activated() ), |
1224 | SLOT( aboutAutoSaving() ) ); | 1222 | SLOT( aboutAutoSaving() ) ); |
1225 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1223 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1226 | action->addTo( helpMenu ); | 1224 | action->addTo( helpMenu ); |
1227 | connect( action, SIGNAL( activated() ), | 1225 | connect( action, SIGNAL( activated() ), |
1228 | SLOT( aboutKnownBugs() ) ); | 1226 | SLOT( aboutKnownBugs() ) ); |
1229 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1227 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1230 | action->addTo( helpMenu ); | 1228 | action->addTo( helpMenu ); |
1231 | connect( action, SIGNAL( activated() ), | 1229 | connect( action, SIGNAL( activated() ), |
1232 | SLOT( usertrans() ) ); | 1230 | SLOT( usertrans() ) ); |
1233 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1231 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1234 | action->addTo( helpMenu ); | 1232 | action->addTo( helpMenu ); |
1235 | connect( action, SIGNAL( activated() ), | 1233 | connect( action, SIGNAL( activated() ), |
1236 | SLOT( faq() ) ); | 1234 | SLOT( faq() ) ); |
1237 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1235 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1238 | action->addTo( helpMenu ); | 1236 | action->addTo( helpMenu ); |
1239 | connect( action, SIGNAL( activated() ), | 1237 | connect( action, SIGNAL( activated() ), |
1240 | SLOT( licence() ) ); | 1238 | SLOT( licence() ) ); |
1241 | action = new QAction( "about", i18n("About..."), 0, this ); | 1239 | action = new QAction( "about", i18n("About..."), 0, this ); |
1242 | action->addTo( helpMenu ); | 1240 | action->addTo( helpMenu ); |
1243 | connect( action, SIGNAL( activated() ), | 1241 | connect( action, SIGNAL( activated() ), |
1244 | SLOT( about() ) ); | 1242 | SLOT( about() ) ); |
1245 | //menuBar->insertSeparator(); | 1243 | //menuBar->insertSeparator(); |
1246 | 1244 | ||
1247 | // ****************************************************** | 1245 | // ****************************************************** |
1248 | // menubar icons | 1246 | // menubar icons |
1249 | 1247 | ||
1250 | 1248 | ||
1251 | 1249 | ||
1252 | //menuBar->insertItem( iconToolBar ); | 1250 | //menuBar->insertItem( iconToolBar ); |
1253 | //xdays_action | 1251 | //xdays_action |
1254 | if (p-> mShowIconNewEvent) | 1252 | if (p-> mShowIconNewEvent) |
1255 | ne_action->addTo( iconToolBar ); | 1253 | ne_action->addTo( iconToolBar ); |
1256 | if (p->mShowIconNewTodo ) | 1254 | if (p->mShowIconNewTodo ) |
1257 | nt_action->addTo( iconToolBar ); | 1255 | nt_action->addTo( iconToolBar ); |
1258 | if (p-> mShowIconSearch) | 1256 | if (p-> mShowIconSearch) |
1259 | search_action->addTo( iconToolBar ); | 1257 | search_action->addTo( iconToolBar ); |
1260 | if (p-> mShowIconWhatsThis) | 1258 | if (p-> mShowIconWhatsThis) |
1261 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1259 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1262 | if (p-> mShowIconNext) | 1260 | if (p-> mShowIconNext) |
1263 | whatsnext_action->addTo( viewToolBar ); | 1261 | whatsnext_action->addTo( viewToolBar ); |
1264 | if (p-> mShowIconNextDays) | 1262 | if (p-> mShowIconNextDays) |
1265 | xdays_action->addTo( viewToolBar ); | 1263 | xdays_action->addTo( viewToolBar ); |
1266 | if (p-> mShowIconJournal) | 1264 | if (p-> mShowIconJournal) |
1267 | viewjournal_action->addTo( viewToolBar ); | 1265 | viewjournal_action->addTo( viewToolBar ); |
1268 | if (p-> mShowIconDay1) | 1266 | if (p-> mShowIconDay1) |
1269 | day1_action->addTo( viewToolBar ); | 1267 | day1_action->addTo( viewToolBar ); |
1270 | if (p-> mShowIconDay5) | 1268 | if (p-> mShowIconDay5) |
1271 | day5_action->addTo( viewToolBar ); | 1269 | day5_action->addTo( viewToolBar ); |
1272 | if (p-> mShowIconDay7) | 1270 | if (p-> mShowIconDay7) |
1273 | day7_action->addTo( viewToolBar ); | 1271 | day7_action->addTo( viewToolBar ); |
1274 | if (p-> mShowIconDay6) | 1272 | if (p-> mShowIconDay6) |
1275 | day6_action->addTo( viewToolBar ); | 1273 | day6_action->addTo( viewToolBar ); |
1276 | if (p-> mShowIconMonth) | 1274 | if (p-> mShowIconMonth) |
1277 | month_action->addTo( viewToolBar ); | 1275 | month_action->addTo( viewToolBar ); |
1278 | if (p-> mShowIconList) | 1276 | if (p-> mShowIconList) |
1279 | showlist_action->addTo( viewToolBar ); | 1277 | showlist_action->addTo( viewToolBar ); |
1280 | if (p-> mShowIconTodoview) | 1278 | if (p-> mShowIconTodoview) |
1281 | todoview_action->addTo( viewToolBar ); | 1279 | todoview_action->addTo( viewToolBar ); |
1282 | 1280 | ||
1283 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1281 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1284 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1282 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1285 | if (p-> mShowIconBackFast) { | 1283 | if (p-> mShowIconBackFast) { |
1286 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1284 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1287 | connect( action, SIGNAL( activated() ), | 1285 | connect( action, SIGNAL( activated() ), |
1288 | mView, SLOT( goPreviousMonth() ) ); | 1286 | mView, SLOT( goPreviousMonth() ) ); |
1289 | action->addTo( navigatorToolBar ); | 1287 | action->addTo( navigatorToolBar ); |
1290 | } | 1288 | } |
1291 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1289 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1292 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1290 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1293 | if (p-> mShowIconBack) { | 1291 | if (p-> mShowIconBack) { |
1294 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1292 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1295 | connect( action, SIGNAL( activated() ), | 1293 | connect( action, SIGNAL( activated() ), |
1296 | mView, SLOT( goPrevious() ) ); | 1294 | mView, SLOT( goPrevious() ) ); |
1297 | action->addTo( navigatorToolBar ); | 1295 | action->addTo( navigatorToolBar ); |
1298 | } | 1296 | } |
1299 | icon = loadPixmap( pathString + "today" ); | 1297 | icon = loadPixmap( pathString + "today" ); |
1300 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1298 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1301 | if (p-> mShowIconToday) | 1299 | if (p-> mShowIconToday) |
1302 | today_action->addTo( navigatorToolBar ); | 1300 | today_action->addTo( navigatorToolBar ); |
1303 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1301 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1304 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1302 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1305 | if (p-> mShowIconForward) { | 1303 | if (p-> mShowIconForward) { |
1306 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1304 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1307 | connect( action, SIGNAL( activated() ), | 1305 | connect( action, SIGNAL( activated() ), |
1308 | mView, SLOT( goNext() ) ); | 1306 | mView, SLOT( goNext() ) ); |
1309 | action->addTo( navigatorToolBar ); | 1307 | action->addTo( navigatorToolBar ); |
1310 | } | 1308 | } |
1311 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1309 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1312 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1310 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1313 | if (p-> mShowIconForwardFast) { | 1311 | if (p-> mShowIconForwardFast) { |
1314 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1312 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1315 | connect( action, SIGNAL( activated() ), | 1313 | connect( action, SIGNAL( activated() ), |
1316 | mView, SLOT( goNextMonth() ) ); | 1314 | mView, SLOT( goNextMonth() ) ); |
1317 | action->addTo( navigatorToolBar ); | 1315 | action->addTo( navigatorToolBar ); |
1318 | } | 1316 | } |
1319 | 1317 | ||
1320 | 1318 | ||
1321 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1319 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1322 | 1320 | ||
1323 | 1321 | ||
1324 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1322 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1325 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1323 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1326 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1324 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1327 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1325 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1328 | 1326 | ||
1329 | if (p-> mShowIconNewEvent) | 1327 | if (p-> mShowIconNewEvent) |
1330 | configureToolBarMenu->setItemChecked( 10, true ); | 1328 | configureToolBarMenu->setItemChecked( 10, true ); |
1331 | if (p->mShowIconNewTodo ) | 1329 | if (p->mShowIconNewTodo ) |
1332 | configureToolBarMenu->setItemChecked( 20, true ); | 1330 | configureToolBarMenu->setItemChecked( 20, true ); |
1333 | if (p-> mShowIconSearch) | 1331 | if (p-> mShowIconSearch) |
1334 | configureToolBarMenu->setItemChecked( 120, true ); | 1332 | configureToolBarMenu->setItemChecked( 120, true ); |
1335 | if (p-> mShowIconList) | 1333 | if (p-> mShowIconList) |
1336 | configureToolBarMenu->setItemChecked( 30, true ); | 1334 | configureToolBarMenu->setItemChecked( 30, true ); |
1337 | if (p-> mShowIconDay1) | 1335 | if (p-> mShowIconDay1) |
1338 | configureToolBarMenu->setItemChecked( 40, true ); | 1336 | configureToolBarMenu->setItemChecked( 40, true ); |
1339 | if (p-> mShowIconDay5) | 1337 | if (p-> mShowIconDay5) |
1340 | configureToolBarMenu->setItemChecked( 50, true ); | 1338 | configureToolBarMenu->setItemChecked( 50, true ); |
1341 | if (p-> mShowIconDay6) | 1339 | if (p-> mShowIconDay6) |
1342 | configureToolBarMenu->setItemChecked( 75, true ); | 1340 | configureToolBarMenu->setItemChecked( 75, true ); |
1343 | if (p-> mShowIconDay7) | 1341 | if (p-> mShowIconDay7) |
1344 | configureToolBarMenu->setItemChecked( 60, true ); | 1342 | configureToolBarMenu->setItemChecked( 60, true ); |
1345 | if (p-> mShowIconMonth) | 1343 | if (p-> mShowIconMonth) |
1346 | configureToolBarMenu->setItemChecked( 70, true ); | 1344 | configureToolBarMenu->setItemChecked( 70, true ); |
1347 | if (p-> mShowIconTodoview) | 1345 | if (p-> mShowIconTodoview) |
1348 | configureToolBarMenu->setItemChecked( 80, true ); | 1346 | configureToolBarMenu->setItemChecked( 80, true ); |
1349 | if (p-> mShowIconBackFast) | 1347 | if (p-> mShowIconBackFast) |
1350 | configureToolBarMenu->setItemChecked( 200, true ); | 1348 | configureToolBarMenu->setItemChecked( 200, true ); |
1351 | if (p-> mShowIconBack) | 1349 | if (p-> mShowIconBack) |
1352 | configureToolBarMenu->setItemChecked( 210, true ); | 1350 | configureToolBarMenu->setItemChecked( 210, true ); |
1353 | if (p-> mShowIconToday) | 1351 | if (p-> mShowIconToday) |
1354 | configureToolBarMenu->setItemChecked( 130, true ); | 1352 | configureToolBarMenu->setItemChecked( 130, true ); |
1355 | if (p-> mShowIconForward) | 1353 | if (p-> mShowIconForward) |
1356 | configureToolBarMenu->setItemChecked( 220, true ); | 1354 | configureToolBarMenu->setItemChecked( 220, true ); |
1357 | if (p-> mShowIconForwardFast) | 1355 | if (p-> mShowIconForwardFast) |
1358 | configureToolBarMenu->setItemChecked( 230, true ); | 1356 | configureToolBarMenu->setItemChecked( 230, true ); |
1359 | if (p-> mShowIconNextDays) | 1357 | if (p-> mShowIconNextDays) |
1360 | configureToolBarMenu->setItemChecked( 100, true ); | 1358 | configureToolBarMenu->setItemChecked( 100, true ); |
1361 | if (p-> mShowIconNext) | 1359 | if (p-> mShowIconNext) |
1362 | configureToolBarMenu->setItemChecked( 110, true ); | 1360 | configureToolBarMenu->setItemChecked( 110, true ); |
1363 | if (p-> mShowIconJournal) | 1361 | if (p-> mShowIconJournal) |
1364 | configureToolBarMenu->setItemChecked( 90, true ); | 1362 | configureToolBarMenu->setItemChecked( 90, true ); |
1365 | if (p-> mShowIconWhatsThis) | 1363 | if (p-> mShowIconWhatsThis) |
1366 | configureToolBarMenu->setItemChecked( 300, true ); | 1364 | configureToolBarMenu->setItemChecked( 300, true ); |
1367 | if (p-> mShowIconWeekNum) | 1365 | if (p-> mShowIconWeekNum) |
1368 | configureToolBarMenu->setItemChecked( 400, true ); | 1366 | configureToolBarMenu->setItemChecked( 400, true ); |
1369 | if (!p-> mShowIconStretch) { | 1367 | if (!p-> mShowIconStretch) { |
1370 | QLabel* dummy = new QLabel( iconToolBar ); | 1368 | QLabel* dummy = new QLabel( iconToolBar ); |
1371 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1369 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1372 | dummy->setMinimumWidth( 0 ); | 1370 | dummy->setMinimumWidth( 0 ); |
1373 | iconToolBar->setStretchableWidget ( dummy ) ; | 1371 | iconToolBar->setStretchableWidget ( dummy ) ; |
1374 | } | 1372 | } |
1375 | else { | 1373 | else { |
1376 | iconToolBar->setHorizontalStretchable (true ); | 1374 | iconToolBar->setHorizontalStretchable (true ); |
1377 | viewToolBar->setHorizontalStretchable (true ); | 1375 | viewToolBar->setHorizontalStretchable (true ); |
1378 | navigatorToolBar->setHorizontalStretchable (true ); | 1376 | navigatorToolBar->setHorizontalStretchable (true ); |
1379 | iconToolBar->setVerticalStretchable (true ); | 1377 | iconToolBar->setVerticalStretchable (true ); |
1380 | viewToolBar->setVerticalStretchable (true ); | 1378 | viewToolBar->setVerticalStretchable (true ); |
1381 | navigatorToolBar->setVerticalStretchable (true ); | 1379 | navigatorToolBar->setVerticalStretchable (true ); |
1382 | configureToolBarMenu->setItemChecked( 5, true ); | 1380 | configureToolBarMenu->setItemChecked( 5, true ); |
1383 | } | 1381 | } |
1384 | if (p-> mShowIconFilter) | 1382 | if (p-> mShowIconFilter) |
1385 | configureToolBarMenu->setItemChecked( 7, true ); | 1383 | configureToolBarMenu->setItemChecked( 7, true ); |
1386 | if (p-> mShowIconOnetoolbar) | 1384 | if (p-> mShowIconOnetoolbar) |
1387 | configureToolBarMenu->setItemChecked( 6, true ); | 1385 | configureToolBarMenu->setItemChecked( 6, true ); |
1388 | 1386 | ||
1389 | 1387 | ||
1390 | if ( filterMenubar ) { | 1388 | if ( filterMenubar ) { |
1391 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); | 1389 | filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); |
1392 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); | 1390 | connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); |
1393 | } | 1391 | } |
1394 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1392 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1395 | configureAgenda( p->mHourSize ); | 1393 | configureAgenda( p->mHourSize ); |
1396 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1394 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1397 | } | 1395 | } |
1398 | void MainWindow::calHint() | 1396 | void MainWindow::calHint() |
1399 | { | 1397 | { |
1400 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); | 1398 | QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); |
1401 | 1399 | ||
1402 | KMessageBox::information( this, message); | 1400 | KMessageBox::information( this, message); |
1403 | } | 1401 | } |
1404 | void MainWindow::exportToPhone( int mode ) | 1402 | void MainWindow::exportToPhone( int mode ) |
1405 | { | 1403 | { |
1406 | 1404 | ||
1407 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1405 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1408 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1406 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1409 | KOex2phonePrefs ex2phone; | 1407 | KOex2phonePrefs ex2phone; |
1410 | 1408 | ||
1411 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1409 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1412 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1410 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1413 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1411 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1414 | if ( mode == 1 ) | 1412 | if ( mode == 1 ) |
1415 | ex2phone.setCaption(i18n("Export complete calendar")); | 1413 | ex2phone.setCaption(i18n("Export complete calendar")); |
1416 | if ( mode == 2 ) | 1414 | if ( mode == 2 ) |
1417 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1415 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1418 | 1416 | ||
1419 | if ( !ex2phone.exec() ) { | 1417 | if ( !ex2phone.exec() ) { |
1420 | return; | 1418 | return; |
1421 | } | 1419 | } |
1422 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1420 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1423 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1421 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1424 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1422 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1425 | 1423 | ||
1426 | int inFuture = 0; | 1424 | int inFuture = 0; |
1427 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1425 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1428 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1426 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1429 | QPtrList<Incidence> delSel; | 1427 | QPtrList<Incidence> delSel; |
1430 | if ( mode == 1 ) | 1428 | if ( mode == 1 ) |
1431 | delSel = mCalendar->rawIncidences(); | 1429 | delSel = mCalendar->rawIncidences(); |
1432 | if ( mode == 2 ) | 1430 | if ( mode == 2 ) |
1433 | delSel = mCalendar->incidences(); | 1431 | delSel = mCalendar->incidences(); |
1434 | CalendarLocal* cal = new CalendarLocal(); | 1432 | CalendarLocal* cal = new CalendarLocal(); |
1435 | cal->setLocalTime(); | 1433 | cal->setLocalTime(); |
1436 | Incidence *incidence = delSel.first(); | 1434 | Incidence *incidence = delSel.first(); |
1437 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1435 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1438 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1436 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1439 | while ( incidence ) { | 1437 | while ( incidence ) { |
1440 | if ( incidence->typeID() != journalID ) { | 1438 | if ( incidence->typeID() != journalID ) { |
1441 | bool add = true; | 1439 | bool add = true; |
1442 | if ( inFuture ) { | 1440 | if ( inFuture ) { |
1443 | QDateTime dt; | 1441 | QDateTime dt; |
1444 | if ( incidence->typeID() == todoID ) { | 1442 | if ( incidence->typeID() == todoID ) { |
1445 | Todo * t = (Todo*)incidence; | 1443 | Todo * t = (Todo*)incidence; |
1446 | if ( t->hasDueDate() ) | 1444 | if ( t->hasDueDate() ) |
1447 | dt = t->dtDue(); | 1445 | dt = t->dtDue(); |
1448 | else | 1446 | else |
1449 | dt = cur.addSecs( 62 ); | 1447 | dt = cur.addSecs( 62 ); |
1450 | } | 1448 | } |
1451 | else { | 1449 | else { |
1452 | bool ok; | 1450 | bool ok; |
1453 | dt = incidence->getNextOccurence( cur, &ok ); | 1451 | dt = incidence->getNextOccurence( cur, &ok ); |
1454 | if ( !ok ) | 1452 | if ( !ok ) |
1455 | dt = cur.addSecs( -62 ); | 1453 | dt = cur.addSecs( -62 ); |
1456 | } | 1454 | } |
1457 | if ( dt < cur || dt > end ) { | 1455 | if ( dt < cur || dt > end ) { |
1458 | add = false; | 1456 | add = false; |
1459 | } | 1457 | } |
1460 | } | 1458 | } |
1461 | if ( add ) { | 1459 | if ( add ) { |
1462 | Incidence *in = incidence->clone(); | 1460 | Incidence *in = incidence->clone(); |
1463 | cal->addIncidence( in ); | 1461 | cal->addIncidence( in ); |
1464 | } | 1462 | } |
1465 | } | 1463 | } |
1466 | incidence = delSel.next(); | 1464 | incidence = delSel.next(); |
1467 | } | 1465 | } |
1468 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1466 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1469 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1467 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1470 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1468 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1471 | 1469 | ||
1472 | setCaption( i18n("Writing to phone...")); | 1470 | setCaption( i18n("Writing to phone...")); |
1473 | if ( PhoneFormat::writeToPhone( cal ) ) | 1471 | if ( PhoneFormat::writeToPhone( cal ) ) |
1474 | setCaption( i18n("Export to phone successful!")); | 1472 | setCaption( i18n("Export to phone successful!")); |
1475 | else | 1473 | else |
1476 | setCaption( i18n("Error exporting to phone!")); | 1474 | setCaption( i18n("Error exporting to phone!")); |
1477 | delete cal; | 1475 | delete cal; |
1478 | } | 1476 | } |
1479 | 1477 | ||
1480 | 1478 | ||
1481 | void MainWindow::setDefaultPreferences() | 1479 | void MainWindow::setDefaultPreferences() |
1482 | { | 1480 | { |
1483 | KOPrefs *p = KOPrefs::instance(); | 1481 | KOPrefs *p = KOPrefs::instance(); |
1484 | 1482 | ||
1485 | p->mCompactDialogs = true; | 1483 | p->mCompactDialogs = true; |
1486 | p->mConfirm = true; | 1484 | p->mConfirm = true; |
1487 | // p->mEnableQuickTodo = false; | 1485 | // p->mEnableQuickTodo = false; |
1488 | 1486 | ||
1489 | } | 1487 | } |
1490 | 1488 | ||
1491 | QString MainWindow::resourcePath() | 1489 | QString MainWindow::resourcePath() |
1492 | { | 1490 | { |
1493 | return KGlobal::iconLoader()->iconPath(); | 1491 | return KGlobal::iconLoader()->iconPath(); |
1494 | } | 1492 | } |
1495 | 1493 | ||
1496 | void MainWindow::displayText( QString text ,QString cap ) | 1494 | void MainWindow::displayText( QString text ,QString cap ) |
1497 | { | 1495 | { |
1498 | QDialog dia( this, "name", true ); ; | 1496 | QDialog dia( this, "name", true ); ; |
1499 | dia.setCaption( cap ); | 1497 | dia.setCaption( cap ); |
1500 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1498 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1501 | lay->setSpacing( 3 ); | 1499 | lay->setSpacing( 3 ); |
1502 | lay->setMargin( 3 ); | 1500 | lay->setMargin( 3 ); |
1503 | QTextBrowser tb ( &dia ); | 1501 | QTextBrowser tb ( &dia ); |
1504 | lay->addWidget( &tb ); | 1502 | lay->addWidget( &tb ); |
1505 | tb.setText( text ); | 1503 | tb.setText( text ); |
1506 | #ifdef DESKTOP_VERSION | 1504 | #ifdef DESKTOP_VERSION |
1507 | dia.resize( 640, 480); | 1505 | dia.resize( 640, 480); |
1508 | #else | 1506 | #else |
1509 | dia.showMaximized(); | 1507 | dia.showMaximized(); |
1510 | #endif | 1508 | #endif |
1511 | dia.exec(); | 1509 | dia.exec(); |
1512 | } | 1510 | } |
1513 | 1511 | ||
1514 | void MainWindow::features() | 1512 | void MainWindow::features() |
1515 | { | 1513 | { |
1516 | 1514 | ||
1517 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1515 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1518 | } | 1516 | } |
1519 | 1517 | ||
1520 | void MainWindow::usertrans() | 1518 | void MainWindow::usertrans() |
1521 | { | 1519 | { |
1522 | 1520 | ||
1523 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1521 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1524 | } | 1522 | } |
1525 | 1523 | ||
1526 | void MainWindow::storagehowto() | 1524 | void MainWindow::storagehowto() |
1527 | { | 1525 | { |
1528 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1526 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1529 | } | 1527 | } |
1530 | void MainWindow::timetrackinghowto() | 1528 | void MainWindow::timetrackinghowto() |
1531 | { | 1529 | { |
1532 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); | 1530 | KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); |
1533 | } | 1531 | } |
1534 | void MainWindow::kdesynchowto() | 1532 | void MainWindow::kdesynchowto() |
1535 | { | 1533 | { |
1536 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1534 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1537 | } | 1535 | } |
1538 | void MainWindow::multisynchowto() | 1536 | void MainWindow::multisynchowto() |
1539 | { | 1537 | { |
1540 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1538 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1541 | } | 1539 | } |
1542 | void MainWindow::synchowto() | 1540 | void MainWindow::synchowto() |
1543 | { | 1541 | { |
1544 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1542 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1545 | } | 1543 | } |
1546 | void MainWindow::faq() | 1544 | void MainWindow::faq() |
1547 | { | 1545 | { |
1548 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1546 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1549 | 1547 | ||
1550 | } | 1548 | } |
1551 | void MainWindow::whatsNew() | 1549 | void MainWindow::whatsNew() |
1552 | { | 1550 | { |
1553 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1551 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1554 | 1552 | ||
1555 | } | 1553 | } |
1556 | void MainWindow::licence() | 1554 | void MainWindow::licence() |
1557 | { | 1555 | { |
1558 | KApplication::showLicence(); | 1556 | KApplication::showLicence(); |
1559 | 1557 | ||
1560 | } | 1558 | } |
1561 | void MainWindow::about() | 1559 | void MainWindow::about() |
1562 | { | 1560 | { |
1563 | QString version; | 1561 | QString version; |
1564 | #include <../version> | 1562 | #include <../version> |
1565 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1563 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1566 | i18n("KOrganizer/Platform-independent\n") + | 1564 | i18n("KOrganizer/Platform-independent\n") + |
1567 | "(KO/Pi) " + version + " - " + | 1565 | "(KO/Pi) " + version + " - " + |
1568 | 1566 | ||
1569 | #ifdef DESKTOP_VERSION | 1567 | #ifdef DESKTOP_VERSION |
1570 | i18n("Desktop Edition\n") + | 1568 | i18n("Desktop Edition\n") + |
1571 | #else | 1569 | #else |
1572 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1570 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1573 | #endif | 1571 | #endif |
1574 | 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!") ); | 1572 | 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!") ); |
1575 | } | 1573 | } |
1576 | void MainWindow::keyBindings() | 1574 | void MainWindow::keyBindings() |
1577 | { | 1575 | { |
1578 | QString cap = i18n("KO/Pi Keys + Colors"); | 1576 | QString cap = i18n("KO/Pi Keys + Colors"); |
1579 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1577 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1580 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1578 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1581 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1579 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1582 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1580 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1583 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1581 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1584 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1582 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1585 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ | 1583 | i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ |
1586 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1584 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1587 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1585 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1588 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1586 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1589 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ | 1587 | i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ |
1590 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1588 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1591 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1589 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1592 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1590 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1593 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1591 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1594 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1592 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1595 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1593 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1596 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1594 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1597 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1595 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1598 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1596 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1599 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1597 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1600 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1598 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1601 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1599 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1602 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1600 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1603 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1601 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1604 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1602 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1605 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1603 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1606 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1604 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1607 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1605 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1608 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1606 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1609 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1607 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1610 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1608 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1611 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1609 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1612 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1610 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1613 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1611 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1614 | i18n("<p><h3>In list view:</h3></p>\n") + | 1612 | i18n("<p><h3>In list view:</h3></p>\n") + |
1615 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1613 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1616 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1614 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1617 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1615 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1618 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1616 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1619 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1617 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1620 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1618 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1621 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1619 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1622 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1620 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1623 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1621 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1624 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1622 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1625 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1623 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1626 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1624 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1627 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1625 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1628 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1626 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1629 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1627 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1630 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1628 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1631 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1629 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1632 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1630 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1633 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1631 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1634 | displayText( text, cap); | 1632 | displayText( text, cap); |
1635 | } | 1633 | } |
1636 | void MainWindow::aboutAutoSaving() | 1634 | void MainWindow::aboutAutoSaving() |
1637 | { | 1635 | { |
1638 | 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"); | 1636 | 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"); |
1639 | 1637 | ||
1640 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1638 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1641 | 1639 | ||
1642 | } | 1640 | } |
1643 | void MainWindow::aboutKnownBugs() | 1641 | void MainWindow::aboutKnownBugs() |
1644 | { | 1642 | { |
1645 | QMessageBox* msg; | 1643 | QMessageBox* msg; |
1646 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1644 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1647 | 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")+ | 1645 | 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")+ |
1648 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1646 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1649 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1647 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1650 | i18n("\nor report them in the bugtracker on\n") + | 1648 | i18n("\nor report them in the bugtracker on\n") + |
1651 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1649 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1652 | QMessageBox::NoIcon, | 1650 | QMessageBox::NoIcon, |
1653 | QMessageBox::Ok, | 1651 | QMessageBox::Ok, |
1654 | QMessageBox::NoButton, | 1652 | QMessageBox::NoButton, |
1655 | QMessageBox::NoButton); | 1653 | QMessageBox::NoButton); |
1656 | msg->exec(); | 1654 | msg->exec(); |
1657 | delete msg; | 1655 | delete msg; |
1658 | 1656 | ||
1659 | } | 1657 | } |
1660 | 1658 | ||
1661 | QString MainWindow::defaultFileName() | 1659 | QString MainWindow::defaultFileName() |
1662 | { | 1660 | { |
1663 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1661 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1664 | } | 1662 | } |
1665 | QString MainWindow::syncFileName() | 1663 | QString MainWindow::syncFileName() |
1666 | { | 1664 | { |
1667 | #ifdef DESKTOP_VERSION | 1665 | #ifdef DESKTOP_VERSION |
1668 | return locateLocal( "tmp", "synccalendar.ics" ); | 1666 | return locateLocal( "tmp", "synccalendar.ics" ); |
1669 | #else | 1667 | #else |
1670 | return QString( "/tmp/synccalendar.ics" ); | 1668 | return QString( "/tmp/synccalendar.ics" ); |
1671 | #endif | 1669 | #endif |
1672 | } | 1670 | } |
1673 | #include "koglobals.h" | 1671 | #include "koglobals.h" |
1674 | #include <kcalendarsystem.h> | 1672 | #include <kcalendarsystem.h> |
1675 | void MainWindow::updateWeek(QDate seda) | 1673 | void MainWindow::updateWeek(QDate seda) |
1676 | { | 1674 | { |
1677 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1675 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1678 | mWeekPixmap.fill( mWeekBgColor ); | 1676 | mWeekPixmap.fill( mWeekBgColor ); |
1679 | QPainter p ( &mWeekPixmap ); | 1677 | QPainter p ( &mWeekPixmap ); |
1680 | p.setFont( mWeekFont ); | 1678 | p.setFont( mWeekFont ); |
1681 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1679 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1682 | p.end(); | 1680 | p.end(); |
1683 | QIconSet icon3 ( mWeekPixmap ); | 1681 | QIconSet icon3 ( mWeekPixmap ); |
1684 | mWeekAction->setIconSet ( icon3 ); | 1682 | mWeekAction->setIconSet ( icon3 ); |
1685 | 1683 | ||
1686 | } | 1684 | } |
1687 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1685 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1688 | { | 1686 | { |
1689 | updateWeek( selectedDates.first() ); | 1687 | updateWeek( selectedDates.first() ); |
1690 | } | 1688 | } |
1691 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1689 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1692 | { | 1690 | { |
1693 | if ( !incidence ) { | 1691 | if ( !incidence ) { |
1694 | mShowAction->setMenuText( i18n("Show") ); | 1692 | mShowAction->setMenuText( i18n("Show") ); |
1695 | enableIncidenceActions( false ); | 1693 | enableIncidenceActions( false ); |
1696 | mNewSubTodoAction->setEnabled( false ); | 1694 | mNewSubTodoAction->setEnabled( false ); |
1697 | setCaptionToDates(); | 1695 | setCaptionToDates(); |
1698 | return; | 1696 | return; |
1699 | } | 1697 | } |
1700 | QString startString = ""; | 1698 | QString startString = ""; |
1701 | if ( incidence->typeID() != todoID ) { | 1699 | if ( incidence->typeID() != todoID ) { |
1702 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1700 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1703 | if ( incidence->doesFloat() ) { | 1701 | if ( incidence->doesFloat() ) { |
1704 | startString += ": "+incidence->dtStartDateStr( true ); | 1702 | startString += ": "+incidence->dtStartDateStr( true ); |
1705 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1703 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1706 | } else { | 1704 | } else { |
1707 | startString = ": "+incidence->dtStartStr(true); | 1705 | startString = ": "+incidence->dtStartStr(true); |
1708 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1706 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1709 | } | 1707 | } |
1710 | } else { | 1708 | } else { |
1711 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1709 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1712 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1710 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1713 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1711 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1714 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { | 1712 | if ( incidence->isBirthday() || incidence->isAnniversary() ) { |
1715 | bool ok; | 1713 | bool ok; |
1716 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1714 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1717 | if ( ok ) { | 1715 | if ( ok ) { |
1718 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1716 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1719 | startString += i18n(" (%1 y.)"). arg( years ); | 1717 | startString += i18n(" (%1 y.)"). arg( years ); |
1720 | } | 1718 | } |
1721 | } | 1719 | } |
1722 | else | 1720 | else |
1723 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1721 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1724 | } | 1722 | } |
1725 | } | 1723 | } |
1726 | else { | 1724 | else { |
1727 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) | 1725 | if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) |
1728 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); | 1726 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); |
1729 | else | 1727 | else |
1730 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1728 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1731 | } | 1729 | } |
1732 | if ( !incidence->location().isEmpty() ) | 1730 | if ( !incidence->location().isEmpty() ) |
1733 | startString += " (" +incidence->location()+")"; | 1731 | startString += " (" +incidence->location()+")"; |
1734 | setCaption( incidence->summary()+startString); | 1732 | setCaption( incidence->summary()+startString); |
1735 | enableIncidenceActions( true ); | 1733 | enableIncidenceActions( true ); |
1736 | if ( incidence->typeID() == eventID ) { | 1734 | if ( incidence->typeID() == eventID ) { |
1737 | mShowAction->setMenuText( i18n("Show Event") ); | 1735 | mShowAction->setMenuText( i18n("Show Event") ); |
1738 | mNewSubTodoAction->setEnabled( false ); | 1736 | mNewSubTodoAction->setEnabled( false ); |
1739 | } else if ( incidence->typeID() == todoID ) { | 1737 | } else if ( incidence->typeID() == todoID ) { |
1740 | mShowAction->setMenuText( i18n("Show Todo") ); | 1738 | mShowAction->setMenuText( i18n("Show Todo") ); |
1741 | mNewSubTodoAction->setEnabled( true ); | 1739 | mNewSubTodoAction->setEnabled( true ); |
1742 | } else { | 1740 | } else { |
1743 | mShowAction->setMenuText( i18n("Show") ); | 1741 | mShowAction->setMenuText( i18n("Show") ); |
1744 | mNewSubTodoAction->setEnabled( false ); | 1742 | mNewSubTodoAction->setEnabled( false ); |
1745 | } | 1743 | } |
1746 | static QPixmap jP = SmallIcon( "journal" ); | 1744 | static QPixmap jP = SmallIcon( "journal" ); |
1747 | static QPixmap eP = SmallIcon( "newevent" ); | 1745 | static QPixmap eP = SmallIcon( "newevent" ); |
1748 | static QPixmap tP = SmallIcon( "newtodo" ); | 1746 | static QPixmap tP = SmallIcon( "newtodo" ); |
1749 | #ifdef DESKTOP_VERSION | 1747 | #ifdef DESKTOP_VERSION |
1750 | QIconSet icon; | 1748 | QIconSet icon; |
1751 | if ( incidence->typeID() == todoID ) | 1749 | if ( incidence->typeID() == todoID ) |
1752 | icon = QIconSet ( tP ); | 1750 | icon = QIconSet ( tP ); |
1753 | else if ( incidence->typeID() == eventID ) | 1751 | else if ( incidence->typeID() == eventID ) |
1754 | icon = QIconSet ( eP ); | 1752 | icon = QIconSet ( eP ); |
1755 | else if ( incidence->typeID() == journalID ) | 1753 | else if ( incidence->typeID() == journalID ) |
1756 | icon = QIconSet ( jP ); | 1754 | icon = QIconSet ( jP ); |
1757 | mPrintSelAction->setIconSet ( icon ); | 1755 | mPrintSelAction->setIconSet ( icon ); |
1758 | #endif | 1756 | #endif |
1759 | } | 1757 | } |
1760 | 1758 | ||
1761 | void MainWindow::enableIncidenceActions( bool enabled ) | 1759 | void MainWindow::enableIncidenceActions( bool enabled ) |
1762 | { | 1760 | { |
1763 | mShowAction->setEnabled( enabled ); | 1761 | mShowAction->setEnabled( enabled ); |
1764 | mEditAction->setEnabled( enabled ); | 1762 | mEditAction->setEnabled( enabled ); |
1765 | mDeleteAction->setEnabled( enabled ); | 1763 | mDeleteAction->setEnabled( enabled ); |
1766 | 1764 | ||
1767 | mCloneAction->setEnabled( enabled ); | 1765 | mCloneAction->setEnabled( enabled ); |
1768 | mMoveAction->setEnabled( enabled ); | 1766 | mMoveAction->setEnabled( enabled ); |
1769 | #ifndef DESKTOP_VERSION | 1767 | #ifndef DESKTOP_VERSION |
1770 | mBeamAction->setEnabled( enabled ); | 1768 | mBeamAction->setEnabled( enabled ); |
1771 | #else | 1769 | #else |
1772 | mPrintSelAction->setEnabled( enabled ); | 1770 | mPrintSelAction->setEnabled( enabled ); |
1773 | #endif | 1771 | #endif |
1774 | mCancelAction->setEnabled( enabled ); | 1772 | mCancelAction->setEnabled( enabled ); |
1775 | } | 1773 | } |
1776 | 1774 | ||
1777 | void MainWindow::importOL() | 1775 | void MainWindow::importOL() |
1778 | { | 1776 | { |
1779 | #ifdef _OL_IMPORT_ | 1777 | #ifdef _OL_IMPORT_ |
1780 | mView->clearAllViews(); | 1778 | mView->clearAllViews(); |
1781 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1779 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1782 | id->exec(); | 1780 | id->exec(); |
1783 | delete id; | 1781 | delete id; |
1784 | mView->calendar()->checkAlarmForIncidence( 0, true ); | 1782 | mView->calendar()->checkAlarmForIncidence( 0, true ); |
1785 | mView->updateView(); | 1783 | mView->updateView(); |
1786 | #endif | 1784 | #endif |
1787 | } | 1785 | } |
1788 | void MainWindow::importBday() | 1786 | void MainWindow::importBday() |
1789 | { | 1787 | { |
1790 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), | 1788 | int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), |
1791 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1789 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1792 | i18n("Import!"), i18n("Cancel"), 0, | 1790 | i18n("Import!"), i18n("Cancel"), 0, |
1793 | 0, 1 ); | 1791 | 0, 1 ); |
1794 | if ( result == 0 ) { | 1792 | if ( result == 0 ) { |
1795 | mView->importBday(); | 1793 | mView->importBday(); |
1796 | 1794 | ||
1797 | } | 1795 | } |
1798 | 1796 | ||
1799 | 1797 | ||
1800 | } | 1798 | } |
1801 | void MainWindow::importQtopia() | 1799 | void MainWindow::importQtopia() |
1802 | { | 1800 | { |
1803 | //#ifndef DESKTOP_VERSION | 1801 | //#ifndef DESKTOP_VERSION |
1804 | 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"); | 1802 | 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"); |
1805 | #ifdef DESKTOP_VERSION | 1803 | #ifdef DESKTOP_VERSION |
1806 | 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"); | 1804 | 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"); |
1807 | #endif | 1805 | #endif |
1808 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1806 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1809 | i18n("Import!"), i18n("Cancel"), 0, | 1807 | i18n("Import!"), i18n("Cancel"), 0, |
1810 | 0, 1 ); | 1808 | 0, 1 ); |
1811 | if ( result == 0 ) { | 1809 | if ( result == 0 ) { |
1812 | #ifndef DESKTOP_VERSION | 1810 | #ifndef DESKTOP_VERSION |
1813 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1811 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1814 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1812 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1815 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1813 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1816 | #else | 1814 | #else |
1817 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1815 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1818 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1816 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1819 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1817 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1820 | #endif | 1818 | #endif |
1821 | mView->importQtopia( categories, datebook, todolist ); | 1819 | mView->importQtopia( categories, datebook, todolist ); |
1822 | } | 1820 | } |
1823 | mView->calendar()->reInitAlarmSettings(); | 1821 | mView->calendar()->reInitAlarmSettings(); |
1824 | #if 0 | 1822 | #if 0 |
1825 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1823 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1826 | i18n("Not supported \non desktop!\n"), | 1824 | i18n("Not supported \non desktop!\n"), |
1827 | i18n("Ok"), i18n("Cancel"), 0, | 1825 | i18n("Ok"), i18n("Cancel"), 0, |
1828 | 0, 1 ); | 1826 | 0, 1 ); |
1829 | 1827 | ||
1830 | #endif | 1828 | #endif |
1831 | } | 1829 | } |
1832 | 1830 | ||
1833 | void MainWindow::saveOnClose() | 1831 | void MainWindow::saveOnClose() |
1834 | { | 1832 | { |
1835 | KOPrefs *p = KOPrefs::instance(); | 1833 | KOPrefs *p = KOPrefs::instance(); |
1836 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1834 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1837 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1835 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1838 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1836 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1839 | if ( filterToolBar ) { | 1837 | if ( filterToolBar ) { |
1840 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1838 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1841 | } | 1839 | } |
1842 | #ifdef DESKTOP_VERSION | 1840 | #ifdef DESKTOP_VERSION |
1843 | 1841 | ||
1844 | QPoint myP; | 1842 | QPoint myP; |
1845 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1843 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1846 | if ( p->mToolBarHor ) | 1844 | if ( p->mToolBarHor ) |
1847 | p->mToolBarUp = myP.y() > height()/2; | 1845 | p->mToolBarUp = myP.y() > height()/2; |
1848 | else | 1846 | else |
1849 | p->mToolBarUp = myP.x() > width()/2; | 1847 | p->mToolBarUp = myP.x() > width()/2; |
1850 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1848 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1851 | if ( p->mToolBarHorV ) | 1849 | if ( p->mToolBarHorV ) |
1852 | p->mToolBarUpV = myP.y() > height()/2; | 1850 | p->mToolBarUpV = myP.y() > height()/2; |
1853 | else | 1851 | else |
1854 | p->mToolBarUpV = myP.x() > width()/2 ; | 1852 | p->mToolBarUpV = myP.x() > width()/2 ; |
1855 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1853 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1856 | if ( p->mToolBarHorN ) | 1854 | if ( p->mToolBarHorN ) |
1857 | p->mToolBarUpN = myP.y() > height()/2; | 1855 | p->mToolBarUpN = myP.y() > height()/2; |
1858 | else | 1856 | else |
1859 | p->mToolBarUpN = myP.x() > width()/2 ; | 1857 | p->mToolBarUpN = myP.x() > width()/2 ; |
1860 | if ( filterToolBar ) { | 1858 | if ( filterToolBar ) { |
1861 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1859 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1862 | if ( p->mToolBarHorF ) | 1860 | if ( p->mToolBarHorF ) |
1863 | p->mToolBarUpF = myP.y() > height()/2; | 1861 | p->mToolBarUpF = myP.y() > height()/2; |
1864 | else | 1862 | else |
1865 | p->mToolBarUpF = myP.x() > width()/2 ; | 1863 | p->mToolBarUpF = myP.x() > width()/2 ; |
1866 | } | 1864 | } |
1867 | #else | 1865 | #else |
1868 | if ( p->mToolBarHor ) | 1866 | if ( p->mToolBarHor ) |
1869 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1867 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1870 | else | 1868 | else |
1871 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1869 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1872 | if ( p->mToolBarHorV ) | 1870 | if ( p->mToolBarHorV ) |
1873 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1871 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1874 | else | 1872 | else |
1875 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1873 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1876 | 1874 | ||
1877 | if ( p->mToolBarHorN ) | 1875 | if ( p->mToolBarHorN ) |
1878 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1876 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1879 | else | 1877 | else |
1880 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1878 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1881 | if ( filterToolBar ) { | 1879 | if ( filterToolBar ) { |
1882 | if ( p->mToolBarHorF ) | 1880 | if ( p->mToolBarHorF ) |
1883 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1881 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1884 | else | 1882 | else |
1885 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1883 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1886 | } | 1884 | } |
1887 | #endif | 1885 | #endif |
1888 | save(); | 1886 | save(); |
1889 | mView->writeSettings(); | 1887 | mView->writeSettings(); |
1890 | mView->checkSuspendAlarm(); | 1888 | mView->checkSuspendAlarm(); |
1891 | } | 1889 | } |
1892 | void MainWindow::slotModifiedChanged( bool ) | 1890 | void MainWindow::slotModifiedChanged( bool ) |
1893 | { | 1891 | { |
1894 | if ( mBlockAtStartup ) | 1892 | if ( mBlockAtStartup ) |
1895 | return; | 1893 | return; |
1896 | 1894 | ||
1897 | int msec; | 1895 | int msec; |
1898 | // we store the changes after 1 minute, | 1896 | // we store the changes after 1 minute, |
1899 | // and for safety reasons after 10 minutes again | 1897 | // and for safety reasons after 10 minutes again |
1900 | if ( !mSyncManager->blockSave() ) | 1898 | if ( !mSyncManager->blockSave() ) |
1901 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1899 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1902 | else | 1900 | else |
1903 | msec = 1000 * 600; | 1901 | msec = 1000 * 600; |
1904 | mSaveTimer.start( msec, true ); // 1 minute | 1902 | mSaveTimer.start( msec, true ); // 1 minute |
1905 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1903 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1906 | mCalendarModifiedFlag = true; | 1904 | mCalendarModifiedFlag = true; |
1907 | } | 1905 | } |
1908 | void MainWindow::saveStopTimer() | 1906 | void MainWindow::saveStopTimer() |
1909 | { | 1907 | { |
1910 | mSaveTimer.stop(); | 1908 | mSaveTimer.stop(); |
1911 | } | 1909 | } |
1912 | void MainWindow::backupAllFiles() | 1910 | void MainWindow::backupAllFiles() |
1913 | { | 1911 | { |
1914 | QDate reference ( 2000,1,1); | 1912 | QDate reference ( 2000,1,1); |
1915 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1913 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1916 | setCaption(i18n("Creating backup ... please wait ..." )); | 1914 | setCaption(i18n("Creating backup ... please wait ..." )); |
1917 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1915 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1918 | // we need the file path, the backup dir and the number of bups as param | 1916 | // we need the file path, the backup dir and the number of bups as param |
1919 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1917 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1920 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1918 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1921 | bupDir = KGlobalSettings::backupDataDir(); | 1919 | bupDir = KGlobalSettings::backupDataDir(); |
1922 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1920 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1923 | if ( retval == 0 ) { | 1921 | if ( retval == 0 ) { |
1924 | setCaption(i18n("Backup cancelled" )); | 1922 | setCaption(i18n("Backup cancelled" )); |
1925 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1923 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1926 | // retval == 0 : backup skipped for today, try again tomorrow | 1924 | // retval == 0 : backup skipped for today, try again tomorrow |
1927 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1925 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1928 | } else if ( retval == 1 ){ | 1926 | } else if ( retval == 1 ){ |
1929 | qDebug("KO: Backup created."); | 1927 | qDebug("KO: Backup created."); |
1930 | // backup ok | 1928 | // backup ok |
1931 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 1929 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
1932 | KopiCalendarFile * cal = calendars.first(); | 1930 | KopiCalendarFile * cal = calendars.first(); |
1933 | cal = calendars.next(); | 1931 | cal = calendars.next(); |
1934 | while ( cal ) { | 1932 | while ( cal ) { |
1935 | if ( !cal->mErrorOnLoad ) { | 1933 | if ( !cal->mErrorOnLoad ) { |
1936 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1934 | KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1937 | } | 1935 | } |
1938 | cal = calendars.next(); | 1936 | cal = calendars.next(); |
1939 | } | 1937 | } |
1940 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1938 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1941 | setCaption(i18n("Backup succesfully finished" )); | 1939 | setCaption(i18n("Backup succesfully finished" )); |
1942 | } else if ( retval == 2 ){ | 1940 | } else if ( retval == 2 ){ |
1943 | setCaption(i18n("Backup globally disabled" )); | 1941 | setCaption(i18n("Backup globally disabled" )); |
1944 | qDebug("KO: Backup globally cancelled."); | 1942 | qDebug("KO: Backup globally cancelled."); |
1945 | // backup globally cancelled | 1943 | // backup globally cancelled |
1946 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1944 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1947 | } | 1945 | } |
1948 | // retval == 3: do nothing, try again later | 1946 | // retval == 3: do nothing, try again later |
1949 | } | 1947 | } |
1950 | void MainWindow::save() | 1948 | void MainWindow::save() |
1951 | { | 1949 | { |
1952 | 1950 | ||
1953 | if ( mView->viewManager()->journalView() ) | 1951 | if ( mView->viewManager()->journalView() ) |
1954 | mView->viewManager()->journalView()->checkModified(); | 1952 | mView->viewManager()->journalView()->checkModified(); |
1955 | if ( !mCalendarModifiedFlag ) { | 1953 | if ( !mCalendarModifiedFlag ) { |
1956 | qDebug("KO: Calendar not modified. Nothing saved."); | 1954 | qDebug("KO: Calendar not modified. Nothing saved."); |
1957 | return; | 1955 | return; |
1958 | } | 1956 | } |
1959 | if ( mSyncManager->blockSave() ) | 1957 | if ( mSyncManager->blockSave() ) |
1960 | return; | 1958 | return; |
1961 | mSyncManager->setBlockSave(true); | 1959 | mSyncManager->setBlockSave(true); |
1962 | if ( mView->checkAllFileVersions() ) { | 1960 | if ( mView->checkAllFileVersions() ) { |
1963 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1961 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1964 | QDate reference ( 2000,1,1); | 1962 | QDate reference ( 2000,1,1); |
1965 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1963 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1966 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1964 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1967 | backupAllFiles(); | 1965 | backupAllFiles(); |
1968 | } | 1966 | } |
1969 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1967 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1970 | } | 1968 | } |
1971 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1969 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1972 | if ( !isMinimized () ) | 1970 | if ( !isMinimized () ) |
1973 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1971 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1974 | qDebug("KO: Start saving data to file!"); | 1972 | qDebug("KO: Start saving data to file!"); |
1975 | mView->saveCalendars(); | 1973 | mView->saveCalendars(); |
1976 | mCalendarModifiedFlag = false; | 1974 | mCalendarModifiedFlag = false; |
1977 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1975 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1978 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1976 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1979 | QString savemes; | 1977 | QString savemes; |
1980 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1978 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1981 | if ( !isMinimized () ) | 1979 | if ( !isMinimized () ) |
1982 | setCaption(savemes); | 1980 | setCaption(savemes); |
1983 | else | 1981 | else |
1984 | qDebug(savemes); | 1982 | qDebug(savemes); |
1985 | } else | 1983 | } else |
1986 | setCaption(i18n("Saving cancelled!")); | 1984 | setCaption(i18n("Saving cancelled!")); |
1987 | mSyncManager->setBlockSave( false ); | 1985 | mSyncManager->setBlockSave( false ); |
1988 | } | 1986 | } |
1989 | 1987 | ||
1990 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1988 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1991 | { | 1989 | { |
1992 | if ( !e->isAutoRepeat() ) { | 1990 | if ( !e->isAutoRepeat() ) { |
1993 | mFlagKeyPressed = false; | 1991 | mFlagKeyPressed = false; |
1994 | } | 1992 | } |
1995 | } | 1993 | } |
1996 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1994 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1997 | { | 1995 | { |
1998 | qApp->processEvents(); | 1996 | qApp->processEvents(); |
1999 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1997 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2000 | e->ignore(); | 1998 | e->ignore(); |
2001 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1999 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
2002 | return; | 2000 | return; |
2003 | } | 2001 | } |
2004 | if (! e->isAutoRepeat() ) | 2002 | if (! e->isAutoRepeat() ) |
2005 | mFlagKeyPressed = true; | 2003 | mFlagKeyPressed = true; |
2006 | KOPrefs *p = KOPrefs::instance(); | 2004 | KOPrefs *p = KOPrefs::instance(); |
2007 | bool showSelectedDates = false; | 2005 | bool showSelectedDates = false; |
2008 | int size; | 2006 | int size; |
2009 | int pro = 0; | 2007 | int pro = 0; |
2010 | //qDebug("MainWindow::keyPressEvent "); | 2008 | //qDebug("MainWindow::keyPressEvent "); |
2011 | switch ( e->key() ) { | 2009 | switch ( e->key() ) { |
2012 | case Qt::Key_Right: | 2010 | case Qt::Key_Right: |
2013 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2011 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2014 | mView->goNextMonth(); | 2012 | mView->goNextMonth(); |
2015 | else | 2013 | else |
2016 | mView->goNext(); | 2014 | mView->goNext(); |
2017 | showSelectedDates = true; | 2015 | showSelectedDates = true; |
2018 | break; | 2016 | break; |
2019 | case Qt::Key_Left: | 2017 | case Qt::Key_Left: |
2020 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2018 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2021 | mView->goPreviousMonth(); | 2019 | mView->goPreviousMonth(); |
2022 | else | 2020 | else |
2023 | mView->goPrevious(); | 2021 | mView->goPrevious(); |
2024 | showSelectedDates = true; | 2022 | showSelectedDates = true; |
2025 | break; | 2023 | break; |
2026 | case Qt::Key_Down: | 2024 | case Qt::Key_Down: |
2027 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 2025 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
2028 | break; | 2026 | break; |
2029 | case Qt::Key_Up: | 2027 | case Qt::Key_Up: |
2030 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 2028 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
2031 | break; | 2029 | break; |
2032 | case Qt::Key_K: | 2030 | case Qt::Key_K: |
2033 | mView->viewManager()->showMonthViewWeek(); | 2031 | mView->viewManager()->showMonthViewWeek(); |
2034 | break; | 2032 | break; |
2035 | case Qt::Key_I: | 2033 | case Qt::Key_I: |
2036 | mView->showIncidence(); | 2034 | mView->showIncidence(); |
2037 | break; | 2035 | break; |
2038 | case Qt::Key_Delete: | 2036 | case Qt::Key_Delete: |
2039 | case Qt::Key_Backspace: | 2037 | case Qt::Key_Backspace: |
2040 | mView->deleteIncidence(); | 2038 | mView->deleteIncidence(); |
2041 | break; | 2039 | break; |
2042 | case Qt::Key_D: | 2040 | case Qt::Key_D: |
2043 | mView->viewManager()->showDayView(); | 2041 | mView->viewManager()->showDayView(); |
2044 | showSelectedDates = true; | 2042 | showSelectedDates = true; |
2045 | break; | 2043 | break; |
2046 | case Qt::Key_O: | 2044 | case Qt::Key_O: |
2047 | mView->toggleFilerEnabled( ); | 2045 | mView->toggleFilerEnabled( ); |
2048 | break; | 2046 | break; |
2049 | case Qt::Key_0: | 2047 | case Qt::Key_0: |
2050 | case Qt::Key_1: | 2048 | case Qt::Key_1: |
2051 | case Qt::Key_2: | 2049 | case Qt::Key_2: |
2052 | case Qt::Key_3: | 2050 | case Qt::Key_3: |
2053 | case Qt::Key_4: | 2051 | case Qt::Key_4: |
2054 | case Qt::Key_5: | 2052 | case Qt::Key_5: |
2055 | case Qt::Key_6: | 2053 | case Qt::Key_6: |
2056 | case Qt::Key_7: | 2054 | case Qt::Key_7: |
2057 | case Qt::Key_8: | 2055 | case Qt::Key_8: |
2058 | case Qt::Key_9: | 2056 | case Qt::Key_9: |
2059 | pro = e->key()-48; | 2057 | pro = e->key()-48; |
2060 | if ( pro == 0 ) | 2058 | if ( pro == 0 ) |
2061 | pro = 10; | 2059 | pro = 10; |
2062 | if ( e->state() == Qt::ControlButton) | 2060 | if ( e->state() == Qt::ControlButton) |
2063 | pro += 10; | 2061 | pro += 10; |
2064 | break; | 2062 | break; |
2065 | case Qt::Key_M: | 2063 | case Qt::Key_M: |
2066 | mView->viewManager()->showMonthView(); | 2064 | mView->viewManager()->showMonthView(); |
2067 | showSelectedDates = true; | 2065 | showSelectedDates = true; |
2068 | break; | 2066 | break; |
2069 | case Qt::Key_Insert: | 2067 | case Qt::Key_Insert: |
2070 | mView->newEvent(); | 2068 | mView->newEvent(); |
2071 | break; | 2069 | break; |
2072 | case Qt::Key_S : | 2070 | case Qt::Key_S : |
2073 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 2071 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
2074 | mView->newSubTodo(); | 2072 | mView->newSubTodo(); |
2075 | else | 2073 | else |
2076 | mView->dialogManager()->showSearchDialog(); | 2074 | mView->dialogManager()->showSearchDialog(); |
2077 | break; | 2075 | break; |
2078 | case Qt::Key_Y : | 2076 | case Qt::Key_Y : |
2079 | case Qt::Key_Z : | 2077 | case Qt::Key_Z : |
2080 | mView->viewManager()->showWorkWeekView(); | 2078 | mView->viewManager()->showWorkWeekView(); |
2081 | showSelectedDates = true; | 2079 | showSelectedDates = true; |
2082 | break; | 2080 | break; |
2083 | case Qt::Key_U : | 2081 | case Qt::Key_U : |
2084 | mView->viewManager()->showWeekView(); | 2082 | mView->viewManager()->showWeekView(); |
2085 | showSelectedDates = true; | 2083 | showSelectedDates = true; |
2086 | break; | 2084 | break; |
2087 | case Qt::Key_H : | 2085 | case Qt::Key_H : |
2088 | keyBindings(); | 2086 | keyBindings(); |
2089 | break; | 2087 | break; |
2090 | case Qt::Key_W: | 2088 | case Qt::Key_W: |
2091 | mView->viewManager()->showWhatsNextView(); | 2089 | mView->viewManager()->showWhatsNextView(); |
2092 | break; | 2090 | break; |
2093 | case Qt::Key_L: | 2091 | case Qt::Key_L: |
2094 | mView->viewManager()->showListView(); | 2092 | mView->viewManager()->showListView(); |
2095 | break; | 2093 | break; |
2096 | case Qt::Key_N: | 2094 | case Qt::Key_N: |
2097 | mView->viewManager()->showNextView(); | 2095 | mView->viewManager()->showNextView(); |
2098 | break; | 2096 | break; |
2099 | case Qt::Key_V: | 2097 | case Qt::Key_V: |
2100 | mView->viewManager()->showTodoView(); | 2098 | mView->viewManager()->showTodoView(); |
2101 | break; | 2099 | break; |
2102 | case Qt::Key_C: | 2100 | case Qt::Key_C: |
2103 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 2101 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
2104 | break; | 2102 | break; |
2105 | case Qt::Key_P: | 2103 | case Qt::Key_P: |
2106 | mView->showDatePicker( ); | 2104 | mView->showDatePicker( ); |
2107 | break; | 2105 | break; |
2108 | case Qt::Key_F: | 2106 | case Qt::Key_F: |
2109 | mView->editFilters(); | 2107 | mView->editFilters(); |
2110 | break; | 2108 | break; |
2111 | case Qt::Key_R: | 2109 | case Qt::Key_R: |
2112 | mView->toggleFilter(); | 2110 | mView->toggleFilter(); |
2113 | break; | 2111 | break; |
2114 | case Qt::Key_X: | 2112 | case Qt::Key_X: |
2115 | if ( e->state() == Qt::ControlButton ) | 2113 | if ( e->state() == Qt::ControlButton ) |
2116 | mView->toggleDateNavigatorWidget(); | 2114 | mView->toggleDateNavigatorWidget(); |
2117 | else { | 2115 | else { |
2118 | mView->viewManager()->showNextXView(); | 2116 | mView->viewManager()->showNextXView(); |
2119 | showSelectedDates = true; | 2117 | showSelectedDates = true; |
2120 | } | 2118 | } |
2121 | break; | 2119 | break; |
2122 | case Qt::Key_Space: | 2120 | case Qt::Key_Space: |
2123 | mView->toggleExpand(); | 2121 | mView->toggleExpand(); |
2124 | break; | 2122 | break; |
2125 | case Qt::Key_A: | 2123 | case Qt::Key_A: |
2126 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 2124 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
2127 | mView->showNextAlarms(); | 2125 | mView->showNextAlarms(); |
2128 | else | 2126 | else |
2129 | mView->toggleAllDaySize(); | 2127 | mView->toggleAllDaySize(); |
2130 | break; | 2128 | break; |
2131 | case Qt::Key_T: | 2129 | case Qt::Key_T: |
2132 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2130 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2133 | mView->newTodo(); | 2131 | mView->newTodo(); |
2134 | else { | 2132 | else { |
2135 | mView->goToday(); | 2133 | mView->goToday(); |
2136 | showSelectedDates = true; | 2134 | showSelectedDates = true; |
2137 | } | 2135 | } |
2138 | break; | 2136 | break; |
2139 | case Qt::Key_Q: | 2137 | case Qt::Key_Q: |
2140 | if ( e->state() == Qt::ControlButton ) | 2138 | if ( e->state() == Qt::ControlButton ) |
2141 | mView->conflictNotAll(); | 2139 | mView->conflictNotAll(); |
2142 | else if ( e->state() == Qt::ShiftButton ) | 2140 | else if ( e->state() == Qt::ShiftButton ) |
2143 | mView->conflictAllday(); | 2141 | mView->conflictAllday(); |
2144 | else | 2142 | else |
2145 | mView->conflictAll(); | 2143 | mView->conflictAll(); |
2146 | break; | 2144 | break; |
2147 | case Qt::Key_J: | 2145 | case Qt::Key_J: |
2148 | mView->viewManager()->showJournalView(); | 2146 | mView->viewManager()->showJournalView(); |
2149 | break; | 2147 | break; |
2150 | case Qt::Key_B: | 2148 | case Qt::Key_B: |
2151 | mView->editIncidenceDescription();; | 2149 | mView->editIncidenceDescription();; |
2152 | break; | 2150 | break; |
2153 | // case Qt::Key_Return: | 2151 | // case Qt::Key_Return: |
2154 | case Qt::Key_E: | 2152 | case Qt::Key_E: |
2155 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 2153 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
2156 | mView->newEvent(); | 2154 | mView->newEvent(); |
2157 | else | 2155 | else |
2158 | mView->editIncidence(); | 2156 | mView->editIncidence(); |
2159 | break; | 2157 | break; |
2160 | case Qt::Key_Plus: | 2158 | case Qt::Key_Plus: |
2161 | size = p->mHourSize +2; | 2159 | size = p->mHourSize +2; |
2162 | if ( size <= 22 ) | 2160 | if ( size <= 22 ) |
2163 | configureAgenda( size ); | 2161 | configureAgenda( size ); |
2164 | break; | 2162 | break; |
2165 | case Qt::Key_Minus: | 2163 | case Qt::Key_Minus: |
2166 | size = p->mHourSize - 2; | 2164 | size = p->mHourSize - 2; |
2167 | if ( size >= 4 ) | 2165 | if ( size >= 4 ) |
2168 | configureAgenda( size ); | 2166 | configureAgenda( size ); |
2169 | break; | 2167 | break; |
2170 | 2168 | ||
2171 | 2169 | ||
2172 | default: | 2170 | default: |
2173 | e->ignore(); | 2171 | e->ignore(); |
2174 | } | 2172 | } |
2175 | if ( pro > 0 ) { | 2173 | if ( pro > 0 ) { |
2176 | selectFilter( pro+1 ); | 2174 | selectFilter( pro+1 ); |
2177 | } | 2175 | } |
2178 | if ( showSelectedDates ) { | 2176 | if ( showSelectedDates ) { |
2179 | ;// setCaptionToDates(); | 2177 | ;// setCaptionToDates(); |
2180 | } | 2178 | } |
2181 | 2179 | ||
2182 | } | 2180 | } |
2183 | void MainWindow::fillFilterMenuTB() | 2181 | void MainWindow::fillFilterMenuTB() |
2184 | { | 2182 | { |
2185 | selectFilterMenuTB->clear(); | 2183 | selectFilterMenuTB->clear(); |
2186 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 2184 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
2187 | selectFilterMenuTB->insertSeparator(); | 2185 | selectFilterMenuTB->insertSeparator(); |
2188 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 2186 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
2189 | 2187 | ||
2190 | selectFilterMenuTB->insertSeparator(); | 2188 | selectFilterMenuTB->insertSeparator(); |
2191 | QPtrList<CalFilter> fili = mView->filters(); | 2189 | QPtrList<CalFilter> fili = mView->filters(); |
2192 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2190 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2193 | CalFilter *filter = fili.first(); | 2191 | CalFilter *filter = fili.first(); |
2194 | int iii = 2; | 2192 | int iii = 2; |
2195 | bool checkitem = mView->filterView()->filtersEnabled(); | 2193 | bool checkitem = mView->filterView()->filtersEnabled(); |
2196 | while(filter) { | 2194 | while(filter) { |
2197 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2195 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2198 | if ( filter == curfilter) | 2196 | if ( filter == curfilter) |
2199 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2197 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2200 | filter = fili.next(); | 2198 | filter = fili.next(); |
2201 | ++iii; | 2199 | ++iii; |
2202 | } | 2200 | } |
2203 | if ( !checkitem ) | 2201 | if ( !checkitem ) |
2204 | selectFilterMenuTB->setItemChecked( 1, true ); | 2202 | selectFilterMenuTB->setItemChecked( 1, true ); |
2205 | 2203 | ||
2206 | int x = 0; | 2204 | int x = 0; |
2207 | int y = iconToolBar->height(); | 2205 | int y = iconToolBar->height(); |
2208 | int dX = 0; | 2206 | int dX = 0; |
2209 | int dY = 0; | 2207 | int dY = 0; |
2210 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2208 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2211 | if ( iconToolBar->y() > height()/2 ) { | 2209 | if ( iconToolBar->y() > height()/2 ) { |
2212 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2210 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2213 | y = 0; | 2211 | y = 0; |
2214 | } | 2212 | } |
2215 | } else { | 2213 | } else { |
2216 | if ( iconToolBar->x() > width()/2 ) { // right side | 2214 | if ( iconToolBar->x() > width()/2 ) { // right side |
2217 | x=0; | 2215 | x=0; |
2218 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2216 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2219 | y = 0; | 2217 | y = 0; |
2220 | } else { | 2218 | } else { |
2221 | x= iconToolBar->width(); | 2219 | x= iconToolBar->width(); |
2222 | y = 0; | 2220 | y = 0; |
2223 | } | 2221 | } |
2224 | } | 2222 | } |
2225 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2223 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2226 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2224 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2227 | } | 2225 | } |
2228 | void MainWindow::fillFilterMenu() | 2226 | void MainWindow::fillFilterMenu() |
2229 | { | 2227 | { |
2230 | selectFilterMenu->clear(); | 2228 | selectFilterMenu->clear(); |
2231 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2229 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2232 | selectFilterMenu->insertSeparator(); | 2230 | selectFilterMenu->insertSeparator(); |
2233 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2231 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2234 | 2232 | ||
2235 | selectFilterMenu->insertSeparator(); | 2233 | selectFilterMenu->insertSeparator(); |
2236 | QPtrList<CalFilter> fili = mView->filters(); | 2234 | QPtrList<CalFilter> fili = mView->filters(); |
2237 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2235 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2238 | CalFilter *filter = fili.first(); | 2236 | CalFilter *filter = fili.first(); |
2239 | int iii = 2; | 2237 | int iii = 2; |
2240 | bool checkitem = mView->filterView()->filtersEnabled(); | 2238 | bool checkitem = mView->filterView()->filtersEnabled(); |
2241 | while(filter) { | 2239 | while(filter) { |
2242 | selectFilterMenu->insertItem( filter->name(), iii ); | 2240 | selectFilterMenu->insertItem( filter->name(), iii ); |
2243 | if ( filter == curfilter) | 2241 | if ( filter == curfilter) |
2244 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2242 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2245 | filter = fili.next(); | 2243 | filter = fili.next(); |
2246 | ++iii; | 2244 | ++iii; |
2247 | } | 2245 | } |
2248 | if ( !checkitem ) | 2246 | if ( !checkitem ) |
2249 | selectFilterMenu->setItemChecked( 1, true ); | 2247 | selectFilterMenu->setItemChecked( 1, true ); |
2250 | } | 2248 | } |
2251 | void MainWindow::fillFilterMenuPopup() | 2249 | void MainWindow::fillFilterMenuPopup() |
2252 | { | 2250 | { |
2253 | filterPopupMenu->clear(); | 2251 | filterPopupMenu->clear(); |
2254 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2252 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2255 | 2253 | ||
2256 | filterPopupMenu->insertSeparator(); | 2254 | filterPopupMenu->insertSeparator(); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index d648f14..e2de3ba 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,174 +1,173 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #include <kpopupmenu.h> | ||
14 | #ifndef DESKTOP_VERSION | 15 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 16 | #include <qcopchannel_qws.h> |
16 | #endif | 17 | #endif |
17 | class QAction; | 18 | class QAction; |
18 | class CalendarView; | 19 | class CalendarView; |
19 | class KSyncProfile; | 20 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 21 | #ifdef DESKTOP_VERSION |
21 | 22 | ||
22 | #define QPEToolBar QToolBar | 23 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | ||
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | class QPEMenuBar; | ||
27 | 26 | ||
28 | 27 | ||
29 | namespace KCal { | 28 | namespace KCal { |
30 | class CalendarLocal; | 29 | class CalendarLocal; |
31 | } | 30 | } |
32 | 31 | ||
33 | using namespace KCal; | 32 | using namespace KCal; |
34 | 33 | ||
35 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
36 | { | 35 | { |
37 | Q_OBJECT | 36 | Q_OBJECT |
38 | public: | 37 | public: |
39 | MainWindow( QWidget *parent = 0, const char *name = 0 ); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0 ); |
40 | ~MainWindow(); | 39 | ~MainWindow(); |
41 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
42 | static QString defaultFileName(); | 41 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 42 | static QString syncFileName(); |
44 | static QString resourcePath(); | 43 | static QString resourcePath(); |
45 | public slots: | 44 | public slots: |
46 | void setUsesBigPixmaps ( bool ); | 45 | void setUsesBigPixmaps ( bool ); |
47 | void setCaption ( const QString & ); | 46 | void setCaption ( const QString & ); |
48 | void updateWeekNum(const KCal::DateList &); | 47 | void updateWeekNum(const KCal::DateList &); |
49 | void updateWeek(QDate); | 48 | void updateWeek(QDate); |
50 | void updateFilterToolbar(); | 49 | void updateFilterToolbar(); |
51 | virtual void showMaximized (); | 50 | virtual void showMaximized (); |
52 | void configureAgenda( int ); | 51 | void configureAgenda( int ); |
53 | void recieve( const QCString& msg, const QByteArray& data ); | 52 | void recieve( const QCString& msg, const QByteArray& data ); |
54 | protected slots: | 53 | protected slots: |
55 | void calHint(); | 54 | void calHint(); |
56 | void startMultiSync(); | 55 | void startMultiSync(); |
57 | void setCaptionToDates(); | 56 | void setCaptionToDates(); |
58 | void weekAction(); | 57 | void weekAction(); |
59 | void about(); | 58 | void about(); |
60 | void licence(); | 59 | void licence(); |
61 | void faq(); | 60 | void faq(); |
62 | void usertrans(); | 61 | void usertrans(); |
63 | void features(); | 62 | void features(); |
64 | void synchowto(); | 63 | void synchowto(); |
65 | void storagehowto(); | 64 | void storagehowto(); |
66 | void timetrackinghowto(); | 65 | void timetrackinghowto(); |
67 | void kdesynchowto(); | 66 | void kdesynchowto(); |
68 | void multisynchowto(); | 67 | void multisynchowto(); |
69 | void whatsNew(); | 68 | void whatsNew(); |
70 | void keyBindings(); | 69 | void keyBindings(); |
71 | void aboutAutoSaving();; | 70 | void aboutAutoSaving();; |
72 | void aboutKnownBugs(); | 71 | void aboutKnownBugs(); |
73 | 72 | ||
74 | void processIncidenceSelection( Incidence * ); | 73 | void processIncidenceSelection( Incidence * ); |
75 | 74 | ||
76 | void importQtopia(); | 75 | void importQtopia(); |
77 | void importBday(); | 76 | void importBday(); |
78 | void importOL(); | 77 | void importOL(); |
79 | void importIcal(); | 78 | void importIcal(); |
80 | void importFile( QString, bool ); | 79 | void importFile( QString, bool ); |
81 | void quickImportIcal(); | 80 | void quickImportIcal(); |
82 | 81 | ||
83 | void slotModifiedChanged( bool ); | 82 | void slotModifiedChanged( bool ); |
84 | 83 | ||
85 | void save(); | 84 | void save(); |
86 | void backupAllFiles(); | 85 | void backupAllFiles(); |
87 | void saveStopTimer(); | 86 | void saveStopTimer(); |
88 | void configureToolBar( int ); | 87 | void configureToolBar( int ); |
89 | void printSel(); | 88 | void printSel(); |
90 | void printCal(); | 89 | void printCal(); |
91 | void printListView(); | 90 | void printListView(); |
92 | void saveCalendar(); | 91 | void saveCalendar(); |
93 | void loadCalendar(); | 92 | void loadCalendar(); |
94 | void exportVCalendar(); | 93 | void exportVCalendar(); |
95 | void fillFilterMenu(); | 94 | void fillFilterMenu(); |
96 | void fillFilterMenuTB(); | 95 | void fillFilterMenuTB(); |
97 | void selectFilter( int ); | 96 | void selectFilter( int ); |
98 | void fillFilterMenuPopup(); | 97 | void fillFilterMenuPopup(); |
99 | void selectFilterPopup( int ); | 98 | void selectFilterPopup( int ); |
100 | void exportToPhone( int ); | 99 | void exportToPhone( int ); |
101 | void toggleBeamReceive(); | 100 | void toggleBeamReceive(); |
102 | void disableBR(bool); | 101 | void disableBR(bool); |
103 | signals: | 102 | signals: |
104 | void selectWeek ( int ); | 103 | void selectWeek ( int ); |
105 | private slots: | 104 | private slots: |
106 | void showConfigureAgenda(); | 105 | void showConfigureAgenda(); |
107 | void getFile( bool ); | 106 | void getFile( bool ); |
108 | void syncFileRequest(); | 107 | void syncFileRequest(); |
109 | 108 | ||
110 | protected: | 109 | protected: |
111 | void hideEvent ( QHideEvent * ); | 110 | void hideEvent ( QHideEvent * ); |
112 | QString sentSyncFile(); | 111 | QString sentSyncFile(); |
113 | void displayText( QString, QString); | 112 | void displayText( QString, QString); |
114 | void enableIncidenceActions( bool ); | 113 | void enableIncidenceActions( bool ); |
115 | 114 | ||
116 | private: | 115 | private: |
117 | bool mBRdisabled; | 116 | bool mBRdisabled; |
118 | #ifndef DESKTOP_VERSION | 117 | #ifndef DESKTOP_VERSION |
119 | QCopChannel* infrared; | 118 | QCopChannel* infrared; |
120 | #endif | 119 | #endif |
121 | QAction* brAction; | 120 | QAction* brAction; |
122 | KSyncManager* mSyncManager; | 121 | KSyncManager* mSyncManager; |
123 | bool mClosed; | 122 | bool mClosed; |
124 | void saveOnClose(); | 123 | void saveOnClose(); |
125 | bool mFlagKeyPressed; | 124 | bool mFlagKeyPressed; |
126 | bool mBlockAtStartup; | 125 | bool mBlockAtStartup; |
127 | QPEToolBar *iconToolBar; | 126 | QPEToolBar *iconToolBar; |
128 | QPEToolBar *viewToolBar; | 127 | QPEToolBar *viewToolBar; |
129 | QPEToolBar *navigatorToolBar; | 128 | QPEToolBar *navigatorToolBar; |
130 | QPEToolBar *filterToolBar; | 129 | QPEToolBar *filterToolBar; |
131 | QMenuBar *filterMenubar; | 130 | KMenuBar *filterMenubar; |
132 | QPopupMenu * filterPopupMenu; | 131 | QPopupMenu * filterPopupMenu; |
133 | QPopupMenu * mCurrentItemMenu; | 132 | QPopupMenu * mCurrentItemMenu; |
134 | void initActions(); | 133 | void initActions(); |
135 | void setDefaultPreferences(); | 134 | void setDefaultPreferences(); |
136 | void resizeEvent( QResizeEvent* e); | 135 | void resizeEvent( QResizeEvent* e); |
137 | void keyPressEvent ( QKeyEvent * ) ; | 136 | void keyPressEvent ( QKeyEvent * ) ; |
138 | void keyReleaseEvent ( QKeyEvent * ) ; | 137 | void keyReleaseEvent ( QKeyEvent * ) ; |
139 | QPopupMenu *configureToolBarMenu; | 138 | QPopupMenu *configureToolBarMenu; |
140 | QPopupMenu *selectFilterMenu; | 139 | QPopupMenu *selectFilterMenu; |
141 | QPopupMenu *selectFilterMenuTB; | 140 | QPopupMenu *selectFilterMenuTB; |
142 | QPopupMenu *configureAgendaMenu, *syncMenu; | 141 | QPopupMenu *configureAgendaMenu, *syncMenu; |
143 | CalendarLocal *mCalendar; | 142 | CalendarLocal *mCalendar; |
144 | CalendarView *mView; | 143 | CalendarView *mView; |
145 | QAction *mNewSubTodoAction; | 144 | QAction *mNewSubTodoAction; |
146 | QAction *mWeekAction; | 145 | QAction *mWeekAction; |
147 | QFont mWeekFont; | 146 | QFont mWeekFont; |
148 | QPixmap mWeekPixmap; | 147 | QPixmap mWeekPixmap; |
149 | QColor mWeekBgColor; | 148 | QColor mWeekBgColor; |
150 | 149 | ||
151 | QAction *mShowAction; | 150 | QAction *mShowAction; |
152 | QAction *mEditAction; | 151 | QAction *mEditAction; |
153 | QAction *mDeleteAction; | 152 | QAction *mDeleteAction; |
154 | QAction *mCloneAction; | 153 | QAction *mCloneAction; |
155 | QAction *mMoveAction; | 154 | QAction *mMoveAction; |
156 | QAction *mBeamAction; | 155 | QAction *mBeamAction; |
157 | QAction *mCancelAction; | 156 | QAction *mCancelAction; |
158 | QAction *mPrintSelAction; | 157 | QAction *mPrintSelAction; |
159 | 158 | ||
160 | QAction *mToggleNav; | 159 | QAction *mToggleNav; |
161 | QAction *mToggleFilter; | 160 | QAction *mToggleFilter; |
162 | QAction *mToggleAllday; | 161 | QAction *mToggleAllday; |
163 | QAction *actionFilterMenuTB; | 162 | QAction *actionFilterMenuTB; |
164 | 163 | ||
165 | void closeEvent( QCloseEvent* ce ); | 164 | void closeEvent( QCloseEvent* ce ); |
166 | QTimer mSaveTimer; | 165 | QTimer mSaveTimer; |
167 | //bool mBlockSaveFlag; | 166 | //bool mBlockSaveFlag; |
168 | bool mCalendarModifiedFlag; | 167 | bool mCalendarModifiedFlag; |
169 | QPixmap loadPixmap( QString ); | 168 | QPixmap loadPixmap( QString ); |
170 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; | 169 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; |
171 | }; | 170 | }; |
172 | 171 | ||
173 | 172 | ||
174 | #endif | 173 | #endif |
diff --git a/microkde/kdeui/kbuttonbox.cpp b/microkde/kdeui/kbuttonbox.cpp index 16206e8..83d622a 100644 --- a/microkde/kdeui/kbuttonbox.cpp +++ b/microkde/kdeui/kbuttonbox.cpp | |||
@@ -1,300 +1,300 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com) | 2 | Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * KButtonBox class | 21 | * KButtonBox class |
22 | * | 22 | * |
23 | * A container widget for buttons. Uses Qt layout control to place the | 23 | * A container widget for buttons. Uses Qt layout control to place the |
24 | * buttons, can handle both vertical and horizontal button placement. | 24 | * buttons, can handle both vertical and horizontal button placement. |
25 | * | 25 | * |
26 | * HISTORY | 26 | * HISTORY |
27 | * | 27 | * |
28 | * 03/08/2000 Mario Weilguni <mweilguni@kde.org> | 28 | * 03/08/2000 Mario Weilguni <mweilguni@kde.org> |
29 | * Removed all those long outdated Motif stuff | 29 | * Removed all those long outdated Motif stuff |
30 | * Improved and clarified some if conditions (easier to understand) | 30 | * Improved and clarified some if conditions (easier to understand) |
31 | * | 31 | * |
32 | * 11/13/98 Reginald Stadlbauer <reggie@kde.org> | 32 | * 11/13/98 Reginald Stadlbauer <reggie@kde.org> |
33 | * Now in Qt 1.4x motif default buttons have no extra width/height anymore. | 33 | * Now in Qt 1.4x motif default buttons have no extra width/height anymore. |
34 | * So the KButtonBox doesn't add this width/height to default buttons anymore | 34 | * So the KButtonBox doesn't add this width/height to default buttons anymore |
35 | * which makes the buttons look better. | 35 | * which makes the buttons look better. |
36 | * | 36 | * |
37 | * 01/17/98 Mario Weilguni <mweilguni@sime.com> | 37 | * 01/17/98 Mario Weilguni <mweilguni@sime.com> |
38 | * Fixed a bug in sizeHint() | 38 | * Fixed a bug in sizeHint() |
39 | * Improved the handling of Motif default buttons | 39 | * Improved the handling of Motif default buttons |
40 | * | 40 | * |
41 | * 01/09/98 Mario Weilguni <mweilguni@sime.com> | 41 | * 01/09/98 Mario Weilguni <mweilguni@sime.com> |
42 | * The last button was to far right away from the right/bottom border. | 42 | * The last button was to far right away from the right/bottom border. |
43 | * Fixed this. Removed old code. Buttons get now a minimum width. | 43 | * Fixed this. Removed old code. Buttons get now a minimum width. |
44 | * Programmer may now override minimum width and height of a button. | 44 | * Programmer may now override minimum width and height of a button. |
45 | * | 45 | * |
46 | */ | 46 | */ |
47 | 47 | ||
48 | //US #include "kbuttonbox.moc" | 48 | //US #include "kbuttonbox.moc" |
49 | 49 | ||
50 | #include <kbuttonbox.h> | 50 | #include <kbuttonbox.h> |
51 | #include <qpushbutton.h> | 51 | #include <qpushbutton.h> |
52 | #include <qptrlist.h> | 52 | #include <qptrlist.h> |
53 | #include <assert.h> | 53 | #include <assert.h> |
54 | 54 | ||
55 | #define minButtonWidth 50 | 55 | #define minButtonWidth 50 |
56 | 56 | ||
57 | class KButtonBox::Item { | 57 | class KButtonBox::Item { |
58 | public: | 58 | public: |
59 | QPushButton *button; | 59 | QPushButton *button; |
60 | bool noexpand; | 60 | bool noexpand; |
61 | unsigned short stretch; | 61 | unsigned short stretch; |
62 | unsigned short actual_size; | 62 | unsigned short actual_size; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | template class QPtrList<KButtonBox::Item>; | 65 | template class QPtrList<KButtonBox::Item>; |
66 | 66 | ||
67 | class KButtonBoxPrivate { | 67 | class KButtonBoxPrivate { |
68 | public: | 68 | public: |
69 | unsigned short border; | 69 | unsigned short border; |
70 | unsigned short autoborder; | 70 | unsigned short autoborder; |
71 | unsigned short orientation; | 71 | unsigned short orientation; |
72 | bool activated; | 72 | bool activated; |
73 | QPtrList<KButtonBox::Item> buttons; | 73 | QPtrList<KButtonBox::Item> buttons; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation, | 76 | KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation, |
77 | int border, int autoborder) | 77 | int border, int autoborder) |
78 | : QWidget(parent) | 78 | : QWidget(parent) |
79 | { | 79 | { |
80 | data = new KButtonBoxPrivate; | 80 | data = new KButtonBoxPrivate; |
81 | assert(data != 0); | 81 | assert(data != 0); |
82 | 82 | ||
83 | data->orientation = _orientation; | 83 | data->orientation = _orientation; |
84 | data->border = border; | 84 | data->border = border; |
85 | data->autoborder = autoborder < 0 ? border : autoborder; | 85 | data->autoborder = autoborder < 0 ? border : autoborder; |
86 | data->buttons.setAutoDelete(TRUE); | 86 | data->buttons.setAutoDelete(TRUE); |
87 | } | 87 | } |
88 | 88 | ||
89 | KButtonBox::~KButtonBox() { | 89 | KButtonBox::~KButtonBox() { |
90 | delete data; | 90 | delete data; |
91 | } | 91 | } |
92 | 92 | ||
93 | QPushButton *KButtonBox::addButton(const QString& text, bool noexpand) { | 93 | QPushButton *KButtonBox::addButton(const QString& text, bool noexpand) { |
94 | Item *item = new Item; | 94 | Item *item = new Item; |
95 | 95 | ||
96 | item->button = new QPushButton(text, this); | 96 | item->button = new QPushButton(text, this); |
97 | item->noexpand = noexpand; | 97 | item->noexpand = noexpand; |
98 | data->buttons.append(item); | 98 | data->buttons.append(item); |
99 | item->button->adjustSize(); | 99 | item->button->adjustSize(); |
100 | 100 | ||
101 | return item->button; | 101 | return item->button; |
102 | } | 102 | } |
103 | 103 | ||
104 | QPushButton * | 104 | QPushButton * |
105 | KButtonBox::addButton( | 105 | KButtonBox::addButton( |
106 | const QString & text, | 106 | const QString & text, |
107 | QObject * receiver, | 107 | QObject * receiver, |
108 | const char * slot, | 108 | const char * slot, |
109 | bool noexpand | 109 | bool noexpand |
110 | ) | 110 | ) |
111 | { | 111 | { |
112 | QPushButton * pb = addButton(text, noexpand); | 112 | QPushButton * pb = addButton(text, noexpand); |
113 | 113 | ||
114 | if ((0 != receiver) && (0 != slot)) | 114 | if ((0 != receiver) && (0 != slot)) |
115 | QObject::connect(pb, SIGNAL(clicked()), receiver, slot); | 115 | QObject::connect(pb, SIGNAL(clicked()), receiver, slot); |
116 | 116 | ||
117 | return pb; | 117 | return pb; |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | void KButtonBox::addStretch(int scale) { | 121 | void KButtonBox::addStretch(int scale) { |
122 | if(scale > 0) { | 122 | if(scale > 0) { |
123 | Item *item = new Item; | 123 | Item *item = new Item; |
124 | item->button = 0; | 124 | item->button = 0; |
125 | item->noexpand = FALSE; | 125 | item->noexpand = FALSE; |
126 | item->stretch = scale; | 126 | item->stretch = scale; |
127 | data->buttons.append(item); | 127 | data->buttons.append(item); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | void KButtonBox::layout() { | 131 | void KButtonBox::layout() { |
132 | // resize all buttons | 132 | // resize all buttons |
133 | QSize bs = bestButtonSize(); | 133 | QSize bs = bestButtonSize(); |
134 | 134 | ||
135 | for(unsigned int i = 0; i < data->buttons.count(); i++) { | 135 | for(unsigned int i = 0; i < data->buttons.count(); i++) { |
136 | Item *item = data->buttons.at(i); | 136 | Item *item = data->buttons.at(i); |
137 | QPushButton *b = item->button; | 137 | QPushButton *b = item->button; |
138 | if(b != 0) { | 138 | if(b != 0) { |
139 | if(item->noexpand) | 139 | if(item->noexpand) |
140 | b->setFixedSize(buttonSizeHint(b)); | 140 | b->setFixedSize(buttonSizeHint(b)); |
141 | else | 141 | else |
142 | b->setFixedSize(bs); | 142 | b->setFixedSize(bs); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | setMinimumSize(sizeHint()); | 146 | setMinimumSize(sizeHint()); |
147 | } | 147 | } |
148 | 148 | ||
149 | void KButtonBox::placeButtons() { | 149 | void KButtonBox::placeButtons() { |
150 | unsigned int i; | 150 | unsigned int i; |
151 | 151 | ||
152 | if(data->orientation == Horizontal) { | 152 | if(data->orientation == Horizontal) { |
153 | // calculate free size and stretches | 153 | // calculate free size and stretches |
154 | int fs = width() - 2 * data->border; | 154 | int fs = width() - 2 * data->border; |
155 | int stretch = 0; | 155 | int stretch = 0; |
156 | for(i = 0; i < data->buttons.count(); i++) { | 156 | for(i = 0; i < data->buttons.count(); i++) { |
157 | Item *item = data->buttons.at(i); | 157 | Item *item = data->buttons.at(i); |
158 | if(item->button != 0) { | 158 | if(item->button != 0) { |
159 | fs -= item->button->width(); | 159 | fs -= item->button->width(); |
160 | 160 | ||
161 | // Last button? | 161 | // Last button? |
162 | if(i != data->buttons.count() - 1) | 162 | if(i != data->buttons.count() - 1) |
163 | fs -= data->autoborder; | 163 | fs -= data->autoborder; |
164 | } else | 164 | } else |
165 | stretch +=item->stretch; | 165 | stretch +=item->stretch; |
166 | } | 166 | } |
167 | 167 | ||
168 | // distribute buttons | 168 | // distribute buttons |
169 | int x_pos = data->border; | 169 | int x_pos = data->border; |
170 | for(i = 0; i < data->buttons.count(); i++) { | 170 | for(i = 0; i < data->buttons.count(); i++) { |
171 | Item *item = data->buttons.at(i); | 171 | Item *item = data->buttons.at(i); |
172 | if(item->button != 0) { | 172 | if(item->button != 0) { |
173 | QPushButton *b = item->button; | 173 | QPushButton *b = item->button; |
174 | b->move(x_pos, (height() - b->height()) / 2); | 174 | b->move(x_pos, (height() - b->height()) / 2); |
175 | 175 | ||
176 | x_pos += b->width() + data->autoborder; | 176 | x_pos += b->width() + data->autoborder; |
177 | } else | 177 | } else |
178 | x_pos += (int)((((double)fs) * item->stretch) / stretch); | 178 | x_pos += (int)((((double)fs) * item->stretch) / stretch); |
179 | } | 179 | } |
180 | } else { // VERTICAL | 180 | } else { // VERTICAL |
181 | // calcualte free size and stretches | 181 | // calcualte free size and stretches |
182 | int fs = height() - 2 * data->border; | 182 | int fs = height() - 2 * data->border; |
183 | int stretch = 0; | 183 | int stretch = 0; |
184 | for(i = 0; i < data->buttons.count(); i++) { | 184 | for(i = 0; i < data->buttons.count(); i++) { |
185 | Item *item = data->buttons.at(i); | 185 | Item *item = data->buttons.at(i); |
186 | if(item->button != 0) | 186 | if(item->button != 0) |
187 | fs -= item->button->height() + data->autoborder; | 187 | fs -= item->button->height() + data->autoborder; |
188 | else | 188 | else |
189 | stretch +=item->stretch; | 189 | stretch +=item->stretch; |
190 | } | 190 | } |
191 | 191 | ||
192 | // distribute buttons | 192 | // distribute buttons |
193 | int y_pos = data->border; | 193 | int y_pos = data->border; |
194 | for(i = 0; i < data->buttons.count(); i++) { | 194 | for(i = 0; i < data->buttons.count(); i++) { |
195 | Item *item = data->buttons.at(i); | 195 | Item *item = data->buttons.at(i); |
196 | if(item->button != 0) { | 196 | if(item->button != 0) { |
197 | QPushButton *b = item->button; | 197 | QPushButton *b = item->button; |
198 | b->move((width() - b->width()) / 2, y_pos); | 198 | b->move((width() - b->width()) / 2, y_pos); |
199 | 199 | ||
200 | y_pos += b->height() + data->autoborder; | 200 | y_pos += b->height() + data->autoborder; |
201 | } else | 201 | } else |
202 | y_pos += (int)((((double)fs) * item->stretch) / stretch); | 202 | y_pos += (int)((((double)fs) * item->stretch) / stretch); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | 206 | ||
207 | void KButtonBox::resizeEvent(QResizeEvent *) { | 207 | void KButtonBox::resizeEvent(QResizeEvent *) { |
208 | placeButtons(); | 208 | placeButtons(); |
209 | } | 209 | } |
210 | 210 | ||
211 | QSize KButtonBox::bestButtonSize() const { | 211 | QSize KButtonBox::bestButtonSize() const { |
212 | QSize s(0, 0); | 212 | QSize s(0, 0); |
213 | unsigned int i; | 213 | unsigned int i; |
214 | 214 | ||
215 | // calculate optimal size | 215 | // calculate optimal size |
216 | for(i = 0; i < data->buttons.count(); i++) { | 216 | for(i = 0; i < data->buttons.count(); i++) { |
217 | KButtonBox *that = (KButtonBox*)this; // to remove the const ;( | 217 | KButtonBox *that = (KButtonBox*)this; // to remove the const ;( |
218 | Item *item = that->data->buttons.at(i); | 218 | Item *item = that->data->buttons.at(i); |
219 | QPushButton *b = item->button; | 219 | QPushButton *b = item->button; |
220 | 220 | ||
221 | if(b != 0 && !item->noexpand) { | 221 | if(b != 0 && !item->noexpand) { |
222 | QSize bs = buttonSizeHint(b); | 222 | QSize bs = buttonSizeHint(b); |
223 | 223 | ||
224 | if(bs.width() > s.width()) | 224 | if(bs.width() > s.width()) |
225 | s.setWidth(bs.width()); | 225 | s.setWidth(bs.width()); |
226 | if(bs.height() > s.height()) | 226 | if(bs.height() > s.height()) |
227 | s.setHeight(bs.height()); | 227 | s.setHeight(bs.height()); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | return s; | 231 | return s; |
232 | } | 232 | } |
233 | 233 | ||
234 | QSize KButtonBox::sizeHint() const { | 234 | QSize KButtonBox::sizeHint() const { |
235 | unsigned int i, dw; | 235 | unsigned int i, dw; |
236 | 236 | ||
237 | if(data->buttons.count() == 0) | 237 | if(data->buttons.count() == 0) |
238 | return QSize(0, 0); | 238 | return QSize(0, 0); |
239 | else { | 239 | else { |
240 | dw = 2 * data->border; | 240 | dw = 2 * data->border; |
241 | 241 | ||
242 | QSize bs = bestButtonSize(); | 242 | QSize bs = bestButtonSize(); |
243 | for(i = 0; i < data->buttons.count(); i++) { | 243 | for(i = 0; i < data->buttons.count(); i++) { |
244 | KButtonBox *that = (KButtonBox*)this; | 244 | KButtonBox *that = (KButtonBox*)this; |
245 | Item *item = that->data->buttons.at(i); | 245 | Item *item = that->data->buttons.at(i); |
246 | QPushButton *b = item->button; | 246 | QPushButton *b = item->button; |
247 | if(b != 0) { | 247 | if(b != 0) { |
248 | QSize s; | 248 | QSize s; |
249 | if(item->noexpand) | 249 | if(item->noexpand) |
250 | s = that->buttonSizeHint(b); | 250 | s = that->buttonSizeHint(b); |
251 | else | 251 | else |
252 | s = bs; | 252 | s = bs; |
253 | 253 | ||
254 | if(data->orientation == Horizontal) | 254 | if(data->orientation == Horizontal) |
255 | dw += s.width(); | 255 | dw += s.width(); |
256 | else | 256 | else |
257 | dw += s.height(); | 257 | dw += s.height(); |
258 | 258 | ||
259 | if( i != data->buttons.count() - 1 ) | 259 | if( i != data->buttons.count() - 1 ) |
260 | dw += data->autoborder; | 260 | dw += data->autoborder; |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | if(data->orientation == Horizontal) | 264 | if(data->orientation == Horizontal) |
265 | return QSize(dw, bs.height() + 2 * data->border); | 265 | return QSize(dw, bs.height() + 2 * data->border); |
266 | else | 266 | else |
267 | return QSize(bs.width() + 2 * data->border, dw); | 267 | return QSize(bs.width() + 2 * data->border, dw); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | QSizePolicy KButtonBox::sizePolicy() const | 271 | QSizePolicy KButtonBox::sizePolicy() const |
272 | { | 272 | { |
273 | return data->orientation == Horizontal? | 273 | return data->orientation == Horizontal? |
274 | QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) : | 274 | QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) : |
275 | QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ); | 275 | QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ); |
276 | } | 276 | } |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * Returns the best size for a button. If a button is less than | 279 | * Returns the best size for a button. If a button is less than |
280 | * minButtonWidth pixels wide, return minButtonWidth pixels | 280 | * minButtonWidth pixels wide, return minButtonWidth pixels |
281 | * as minimum width | 281 | * as minimum width |
282 | */ | 282 | */ |
283 | QSize KButtonBox::buttonSizeHint(QPushButton *b) const { | 283 | QSize KButtonBox::buttonSizeHint(QPushButton *b) const { |
284 | QSize s = b->sizeHint(); | 284 | QSize s = b->sizeHint(); |
285 | QSize ms = b->minimumSize(); | 285 | QSize ms = b->minimumSize(); |
286 | if(s.width() < minButtonWidth) | 286 | if(s.width() < minButtonWidth) |
287 | s.setWidth(minButtonWidth); | 287 | s.setWidth(minButtonWidth); |
288 | 288 | ||
289 | // allows the programmer to override the settings | 289 | // allows the programmer to override the settings |
290 | if(ms.width() > s.width()) | 290 | if(ms.width() > s.width()) |
291 | s.setWidth(ms.width()); | 291 | s.setWidth(ms.width()); |
292 | if(ms.height() > s.height()) | 292 | if(ms.height() > s.height()) |
293 | s.setHeight(ms.height()); | 293 | s.setHeight(ms.height()); |
294 | 294 | ||
295 | return s; | 295 | return s; |
296 | } | 296 | } |
297 | 297 | ||
298 | void KButtonBox::virtual_hook( int, void* ) | 298 | void KButtonBox::virtual_hook( int, void* ) |
299 | { /*BASE::virtual_hook( id, data );*/ } | 299 | { /*BASE::virtual_hook( id, data );*/ } |
300 | 300 | ||
diff --git a/microkde/kdeui/kpopupmenu.cpp b/microkde/kdeui/kpopupmenu.cpp new file mode 100644 index 0000000..96d2a87 --- a/dev/null +++ b/microkde/kdeui/kpopupmenu.cpp | |||
@@ -0,0 +1,19 @@ | |||
1 | |||
2 | #include <kpopupmenu.h> | ||
3 | #include <qtimer.h> | ||
4 | |||
5 | |||
6 | KPopupMenu::KPopupMenu ( QWidget * parent, const char * name ) | ||
7 | : QPopupMenu ( parent, name ) {;} | ||
8 | |||
9 | |||
10 | |||
11 | KMenuBar::KMenuBar ( QWidget * parent, const char * name ) | ||
12 | : QPEMenuBar ( parent, name ) {} | ||
13 | |||
14 | void KMenuBar::focusOutEvent ( QFocusEvent * e) | ||
15 | { | ||
16 | QPEMenuBar::focusOutEvent( e ); | ||
17 | QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) ); | ||
18 | |||
19 | } | ||
diff --git a/microkde/kdeui/kpopupmenu.h b/microkde/kdeui/kpopupmenu.h index 1352429..f16ce77 100644 --- a/microkde/kdeui/kpopupmenu.h +++ b/microkde/kdeui/kpopupmenu.h | |||
@@ -1,14 +1,32 @@ | |||
1 | #ifndef KPOPUPMENU_H | 1 | #ifndef KPOPUPMENU_H |
2 | #define KPOPUPMENU_H | 2 | #define KPOPUPMENU_H |
3 | 3 | ||
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #ifdef DESKTOP_VERSION | ||
6 | #include <qmenubar.h> | ||
7 | #define QPEMenuBar QMenubar | ||
8 | #else | ||
9 | #include <qpe/qpemenubar.h> | ||
10 | #endif | ||
5 | 11 | ||
6 | class KPopupMenu : public QPopupMenu | 12 | class KPopupMenu : public QPopupMenu |
7 | { | 13 | { |
14 | Q_OBJECT | ||
8 | public: | 15 | public: |
9 | KPopupMenu ( QWidget * parent=0, const char * name=0 ) | 16 | KPopupMenu ( QWidget * parent=0, const char * name=0 ); |
10 | : QPopupMenu ( parent, name ) {} | 17 | |
18 | }; | ||
11 | 19 | ||
20 | |||
21 | class KMenuBar : public QPEMenuBar | ||
22 | { | ||
23 | Q_OBJECT | ||
24 | public: | ||
25 | KMenuBar ( QWidget * parent=0, const char * name=0 ); | ||
26 | signals: | ||
27 | void lostFocus(); | ||
28 | protected: | ||
29 | void focusOutEvent ( QFocusEvent * e); | ||
12 | }; | 30 | }; |
13 | 31 | ||
14 | #endif | 32 | #endif |
diff --git a/microkde/microkde.pro b/microkde/microkde.pro index 44e5f9d..7120bdd 100644 --- a/microkde/microkde.pro +++ b/microkde/microkde.pro | |||
@@ -1,178 +1,180 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | include( ../variables.pri ) | 3 | include( ../variables.pri ) |
4 | #INCLUDEPATH += $(QTDIR)/include . | 4 | #INCLUDEPATH += $(QTDIR)/include . |
5 | #DEPENDPATH += $(QTDIR)/include | 5 | #DEPENDPATH += $(QTDIR)/include |
6 | INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio | 6 | INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio |
7 | #LIBS += -lqtcompat | 7 | #LIBS += -lqtcompat |
8 | 8 | ||
9 | TARGET = microkde | 9 | TARGET = microkde |
10 | DESTDIR= ../bin | 10 | DESTDIR= ../bin |
11 | DEFINES += DESKTOP_VERSION KDE_QT_ONLY | 11 | DEFINES += DESKTOP_VERSION KDE_QT_ONLY |
12 | unix : { | 12 | unix : { |
13 | staticlib: { | 13 | staticlib: { |
14 | INCLUDEPATH += ../kabc/plugins | 14 | INCLUDEPATH += ../kabc/plugins |
15 | DEFINES += STATIC_RESOURCES | 15 | DEFINES += STATIC_RESOURCES |
16 | } | 16 | } |
17 | 17 | ||
18 | 18 | ||
19 | OBJECTS_DIR = obj/unix | 19 | OBJECTS_DIR = obj/unix |
20 | MOC_DIR = moc/unix | 20 | MOC_DIR = moc/unix |
21 | } | 21 | } |
22 | win32: { | 22 | win32: { |
23 | DEFINES += _WIN32_ | 23 | DEFINES += _WIN32_ |
24 | OBJECTS_DIR = obj/win | 24 | OBJECTS_DIR = obj/win |
25 | MOC_DIR = moc/win | 25 | MOC_DIR = moc/win |
26 | } | 26 | } |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | HEADERS = \ | 30 | HEADERS = \ |
31 | qlayoutengine_p.h \ | 31 | qlayoutengine_p.h \ |
32 | KDGanttMinimizeSplitter.h \ | 32 | KDGanttMinimizeSplitter.h \ |
33 | kapplication.h \ | 33 | kapplication.h \ |
34 | kaudioplayer.h \ | 34 | kaudioplayer.h \ |
35 | kcalendarsystem.h \ | 35 | kcalendarsystem.h \ |
36 | kcalendarsystemgregorian.h \ | 36 | kcalendarsystemgregorian.h \ |
37 | kcolorbutton.h \ | 37 | kcolorbutton.h \ |
38 | kcombobox.h \ | 38 | kcombobox.h \ |
39 | kconfig.h \ | 39 | kconfig.h \ |
40 | kdatetbl.h \ | 40 | kdatetbl.h \ |
41 | kdebug.h \ | 41 | kdebug.h \ |
42 | kdialog.h \ | 42 | kdialog.h \ |
43 | kdialogbase.h \ | 43 | kdialogbase.h \ |
44 | keditlistbox.h \ | 44 | keditlistbox.h \ |
45 | kemailsettings.h \ | 45 | kemailsettings.h \ |
46 | kfiledialog.h \ | 46 | kfiledialog.h \ |
47 | kfontdialog.h \ | 47 | kfontdialog.h \ |
48 | kglobal.h \ | 48 | kglobal.h \ |
49 | kglobalsettings.h \ | 49 | kglobalsettings.h \ |
50 | kiconloader.h \ | 50 | kiconloader.h \ |
51 | klineedit.h \ | 51 | klineedit.h \ |
52 | klineeditdlg.h \ | 52 | klineeditdlg.h \ |
53 | kmessagebox.h \ | 53 | kmessagebox.h \ |
54 | knotifyclient.h \ | 54 | knotifyclient.h \ |
55 | kprinter.h \ | 55 | kprinter.h \ |
56 | kprocess.h \ | 56 | kprocess.h \ |
57 | krestrictedline.h \ | 57 | krestrictedline.h \ |
58 | krun.h \ | 58 | krun.h \ |
59 | ksimpleconfig.h \ | 59 | ksimpleconfig.h \ |
60 | kstaticdeleter.h \ | 60 | kstaticdeleter.h \ |
61 | ksystemtray.h \ | 61 | ksystemtray.h \ |
62 | ktempfile.h \ | 62 | ktempfile.h \ |
63 | ktextedit.h \ | 63 | ktextedit.h \ |
64 | kunload.h \ | 64 | kunload.h \ |
65 | kurl.h \ | 65 | kurl.h \ |
66 | kdeui/kguiitem.h \ | 66 | kdeui/kguiitem.h \ |
67 | kdeui/kcmodule.h \ | 67 | kdeui/kcmodule.h \ |
68 | kdeui/kbuttonbox.h \ | 68 | kdeui/kbuttonbox.h \ |
69 | kdeui/klistbox.h \ | 69 | kdeui/klistbox.h \ |
70 | kdeui/klistview.h \ | 70 | kdeui/klistview.h \ |
71 | kdeui/kjanuswidget.h \ | 71 | kdeui/kjanuswidget.h \ |
72 | kdeui/kseparator.h \ | 72 | kdeui/kseparator.h \ |
73 | kdeui/knuminput.h \ | 73 | kdeui/knuminput.h \ |
74 | kdeui/knumvalidator.h \ | 74 | kdeui/knumvalidator.h \ |
75 | kdeui/ksqueezedtextlabel.h \ | 75 | kdeui/ksqueezedtextlabel.h \ |
76 | kio/job.h \ | 76 | kio/job.h \ |
77 | kio/kio/kdirwatch.h \ | 77 | kio/kio/kdirwatch.h \ |
78 | kio/kio/kdirwatch_p.h \ | 78 | kio/kio/kdirwatch_p.h \ |
79 | kio/kfile/kurlrequester.h \ | 79 | kio/kfile/kurlrequester.h \ |
80 | kresources/resource.h \ | 80 | kresources/resource.h \ |
81 | kresources/factory.h \ | 81 | kresources/factory.h \ |
82 | kresources/managerimpl.h \ | 82 | kresources/managerimpl.h \ |
83 | kresources/manager.h \ | 83 | kresources/manager.h \ |
84 | kresources/selectdialog.h \ | 84 | kresources/selectdialog.h \ |
85 | kresources/configpage.h \ | 85 | kresources/configpage.h \ |
86 | kresources/configwidget.h \ | 86 | kresources/configwidget.h \ |
87 | kresources/configdialog.h \ | 87 | kresources/configdialog.h \ |
88 | kresources/kcmkresources.h \ | 88 | kresources/kcmkresources.h \ |
89 | kdecore/kmdcodec.h \ | 89 | kdecore/kmdcodec.h \ |
90 | kdecore/kconfigbase.h \ | 90 | kdecore/kconfigbase.h \ |
91 | kdecore/klocale.h \ | 91 | kdecore/klocale.h \ |
92 | kdecore/kcatalogue.h \ | 92 | kdecore/kcatalogue.h \ |
93 | kdecore/ksharedptr.h \ | 93 | kdecore/ksharedptr.h \ |
94 | kdecore/kshell.h \ | 94 | kdecore/kshell.h \ |
95 | kdecore/kstandarddirs.h \ | 95 | kdecore/kstandarddirs.h \ |
96 | kdecore/kstringhandler.h \ | 96 | kdecore/kstringhandler.h \ |
97 | kdecore/kshortcut.h \ | 97 | kdecore/kshortcut.h \ |
98 | kutils/kcmultidialog.h \ | 98 | kutils/kcmultidialog.h \ |
99 | kdeui/kxmlguiclient.h \ | 99 | kdeui/kxmlguiclient.h \ |
100 | kdeui/kstdaction.h \ | 100 | kdeui/kstdaction.h \ |
101 | kdeui/kmainwindow.h \ | 101 | kdeui/kmainwindow.h \ |
102 | kdeui/ktoolbar.h \ | 102 | kdeui/ktoolbar.h \ |
103 | kdeui/ktoolbarbutton.h \ | 103 | kdeui/ktoolbarbutton.h \ |
104 | kdeui/ktoolbarhandler.h \ | 104 | kdeui/ktoolbarhandler.h \ |
105 | kdeui/kaction.h \ | 105 | kdeui/kaction.h \ |
106 | kdeui/kpopupmenu.h \ | ||
106 | kdeui/kactionclasses.h \ | 107 | kdeui/kactionclasses.h \ |
107 | kdeui/kactioncollection.h \ | 108 | kdeui/kactioncollection.h \ |
108 | kdecore/kprefs.h \ | 109 | kdecore/kprefs.h \ |
109 | kdecore/klibloader.h \ | 110 | kdecore/klibloader.h \ |
110 | kidmanager.h | 111 | kidmanager.h |
111 | 112 | ||
112 | 113 | ||
113 | # kdecore/klibloader.h \ | 114 | # kdecore/klibloader.h \ |
114 | 115 | ||
115 | 116 | ||
116 | SOURCES = \ | 117 | SOURCES = \ |
117 | KDGanttMinimizeSplitter.cpp \ | 118 | KDGanttMinimizeSplitter.cpp \ |
118 | kapplication.cpp \ | 119 | kapplication.cpp \ |
119 | kcalendarsystem.cpp \ | 120 | kcalendarsystem.cpp \ |
120 | kcalendarsystemgregorian.cpp \ | 121 | kcalendarsystemgregorian.cpp \ |
121 | kcolorbutton.cpp \ | 122 | kcolorbutton.cpp \ |
122 | kconfig.cpp \ | 123 | kconfig.cpp \ |
123 | kdatetbl.cpp \ | 124 | kdatetbl.cpp \ |
124 | kdialog.cpp \ | 125 | kdialog.cpp \ |
125 | kdialogbase.cpp \ | 126 | kdialogbase.cpp \ |
126 | keditlistbox.cpp \ | 127 | keditlistbox.cpp \ |
127 | kemailsettings.cpp \ | 128 | kemailsettings.cpp \ |
128 | kfontdialog.cpp \ | 129 | kfontdialog.cpp \ |
129 | kfiledialog.cpp \ | 130 | kfiledialog.cpp \ |
130 | kglobal.cpp \ | 131 | kglobal.cpp \ |
131 | kglobalsettings.cpp \ | 132 | kglobalsettings.cpp \ |
132 | kiconloader.cpp \ | 133 | kiconloader.cpp \ |
133 | kmessagebox.cpp \ | 134 | kmessagebox.cpp \ |
134 | ktextedit.cpp \ | 135 | ktextedit.cpp \ |
135 | kprocess.cpp \ | 136 | kprocess.cpp \ |
136 | krun.cpp \ | 137 | krun.cpp \ |
137 | ksystemtray.cpp \ | 138 | ksystemtray.cpp \ |
138 | ktempfile.cpp \ | 139 | ktempfile.cpp \ |
139 | kurl.cpp \ | 140 | kurl.cpp \ |
140 | kdecore/kcatalogue.cpp \ | 141 | kdecore/kcatalogue.cpp \ |
141 | kdecore/klocale.cpp \ | 142 | kdecore/klocale.cpp \ |
142 | kdecore/kmdcodec.cpp \ | 143 | kdecore/kmdcodec.cpp \ |
143 | kdecore/kshell.cpp \ | 144 | kdecore/kshell.cpp \ |
144 | kdecore/kstandarddirs.cpp \ | 145 | kdecore/kstandarddirs.cpp \ |
145 | kdecore/kstringhandler.cpp \ | 146 | kdecore/kstringhandler.cpp \ |
146 | kdeui/kbuttonbox.cpp \ | 147 | kdeui/kbuttonbox.cpp \ |
147 | kdeui/kcmodule.cpp \ | 148 | kdeui/kcmodule.cpp \ |
148 | kdeui/kguiitem.cpp \ | 149 | kdeui/kguiitem.cpp \ |
149 | kdeui/kjanuswidget.cpp \ | 150 | kdeui/kjanuswidget.cpp \ |
150 | kdeui/klistbox.cpp \ | 151 | kdeui/klistbox.cpp \ |
151 | kdeui/klistview.cpp \ | 152 | kdeui/klistview.cpp \ |
152 | kdeui/knuminput.cpp \ | 153 | kdeui/knuminput.cpp \ |
153 | kdeui/knumvalidator.cpp \ | 154 | kdeui/knumvalidator.cpp \ |
154 | kdeui/kseparator.cpp \ | 155 | kdeui/kseparator.cpp \ |
155 | kdeui/ksqueezedtextlabel.cpp \ | 156 | kdeui/ksqueezedtextlabel.cpp \ |
156 | kio/kio/kdirwatch.cpp \ | 157 | kio/kio/kdirwatch.cpp \ |
157 | kio/kfile/kurlrequester.cpp \ | 158 | kio/kfile/kurlrequester.cpp \ |
158 | kresources/configpage.cpp \ | 159 | kresources/configpage.cpp \ |
159 | kresources/configdialog.cpp \ | 160 | kresources/configdialog.cpp \ |
160 | kresources/configwidget.cpp \ | 161 | kresources/configwidget.cpp \ |
161 | kresources/factory.cpp \ | 162 | kresources/factory.cpp \ |
162 | kresources/kcmkresources.cpp \ | 163 | kresources/kcmkresources.cpp \ |
163 | kresources/managerimpl.cpp \ | 164 | kresources/managerimpl.cpp \ |
164 | kresources/resource.cpp \ | 165 | kresources/resource.cpp \ |
165 | kresources/selectdialog.cpp \ | 166 | kresources/selectdialog.cpp \ |
166 | kutils/kcmultidialog.cpp \ | 167 | kutils/kcmultidialog.cpp \ |
167 | kdeui/kaction.cpp \ | 168 | kdeui/kaction.cpp \ |
169 | kdeui/kpopupmenu.cpp \ | ||
168 | kdeui/kactionclasses.cpp \ | 170 | kdeui/kactionclasses.cpp \ |
169 | kdeui/kactioncollection.cpp \ | 171 | kdeui/kactioncollection.cpp \ |
170 | kdeui/kmainwindow.cpp \ | 172 | kdeui/kmainwindow.cpp \ |
171 | kdeui/ktoolbar.cpp \ | 173 | kdeui/ktoolbar.cpp \ |
172 | kdeui/ktoolbarbutton.cpp \ | 174 | kdeui/ktoolbarbutton.cpp \ |
173 | kdeui/ktoolbarhandler.cpp \ | 175 | kdeui/ktoolbarhandler.cpp \ |
174 | kdeui/kstdaction.cpp \ | 176 | kdeui/kstdaction.cpp \ |
175 | kdeui/kxmlguiclient.cpp \ | 177 | kdeui/kxmlguiclient.cpp \ |
176 | kdecore/kprefs.cpp \ | 178 | kdecore/kprefs.cpp \ |
177 | kdecore/klibloader.cpp \ | 179 | kdecore/klibloader.cpp \ |
178 | kidmanager.cpp | 180 | kidmanager.cpp |
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro index 335fcd0..8fe2bd5 100644 --- a/microkde/microkdeE.pro +++ b/microkde/microkdeE.pro | |||
@@ -1,172 +1,174 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include | 3 | INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include |
4 | 4 | ||
5 | DEPENDPATH += $(QPEDIR)/include | 5 | DEPENDPATH += $(QPEDIR)/include |
6 | LIBS += -lmicroqtcompat -L$(QPEDIR)/lib | 6 | LIBS += -lmicroqtcompat -L$(QPEDIR)/lib |
7 | 7 | ||
8 | DEFINES += KDE_QT_ONLY | 8 | DEFINES += KDE_QT_ONLY |
9 | 9 | ||
10 | TARGET = microkde | 10 | TARGET = microkde |
11 | OBJECTS_DIR = obj/$(PLATFORM) | 11 | OBJECTS_DIR = obj/$(PLATFORM) |
12 | MOC_DIR = moc/$(PLATFORM) | 12 | MOC_DIR = moc/$(PLATFORM) |
13 | DESTDIR=$(QPEDIR)/lib | 13 | DESTDIR=$(QPEDIR)/lib |
14 | 14 | ||
15 | 15 | ||
16 | INTERFACES = \ | 16 | INTERFACES = \ |
17 | 17 | ||
18 | HEADERS = \ | 18 | HEADERS = \ |
19 | qlayoutengine_p.h fncolordialog.h\ | 19 | qlayoutengine_p.h fncolordialog.h\ |
20 | KDGanttMinimizeSplitter.h \ | 20 | KDGanttMinimizeSplitter.h \ |
21 | kapplication.h \ | 21 | kapplication.h \ |
22 | kaudioplayer.h \ | 22 | kaudioplayer.h \ |
23 | kcalendarsystem.h \ | 23 | kcalendarsystem.h \ |
24 | kcalendarsystemgregorian.h \ | 24 | kcalendarsystemgregorian.h \ |
25 | kcolorbutton.h \ | 25 | kcolorbutton.h \ |
26 | kcolordialog.h \ | 26 | kcolordialog.h \ |
27 | kcombobox.h \ | 27 | kcombobox.h \ |
28 | kconfig.h \ | 28 | kconfig.h \ |
29 | kdatetbl.h \ | 29 | kdatetbl.h \ |
30 | kdebug.h \ | 30 | kdebug.h \ |
31 | kdialog.h \ | 31 | kdialog.h \ |
32 | kdialogbase.h \ | 32 | kdialogbase.h \ |
33 | keditlistbox.h \ | 33 | keditlistbox.h \ |
34 | kemailsettings.h \ | 34 | kemailsettings.h \ |
35 | kfiledialog.h \ | 35 | kfiledialog.h \ |
36 | kfontdialog.h \ | 36 | kfontdialog.h \ |
37 | kglobal.h \ | 37 | kglobal.h \ |
38 | kglobalsettings.h \ | 38 | kglobalsettings.h \ |
39 | kiconloader.h \ | 39 | kiconloader.h \ |
40 | klineedit.h \ | 40 | klineedit.h \ |
41 | klineeditdlg.h \ | 41 | klineeditdlg.h \ |
42 | kmessagebox.h \ | 42 | kmessagebox.h \ |
43 | knotifyclient.h \ | 43 | knotifyclient.h \ |
44 | kprinter.h \ | 44 | kprinter.h \ |
45 | kprocess.h \ | 45 | kprocess.h \ |
46 | krestrictedline.h \ | 46 | krestrictedline.h \ |
47 | krun.h \ | 47 | krun.h \ |
48 | ksimpleconfig.h \ | 48 | ksimpleconfig.h \ |
49 | kstaticdeleter.h \ | 49 | kstaticdeleter.h \ |
50 | ksystemtray.h \ | 50 | ksystemtray.h \ |
51 | ktempfile.h \ | 51 | ktempfile.h \ |
52 | ktextedit.h \ | 52 | ktextedit.h \ |
53 | kunload.h \ | 53 | kunload.h \ |
54 | kurl.h \ | 54 | kurl.h \ |
55 | ofileselector_p.h \ | 55 | ofileselector_p.h \ |
56 | ofontselector.h \ | 56 | ofontselector.h \ |
57 | kdeui/kguiitem.h \ | 57 | kdeui/kguiitem.h \ |
58 | kdeui/kaction.h \ | 58 | kdeui/kaction.h \ |
59 | kdeui/kpopupmenu.h \ | ||
59 | kdeui/kactionclasses.h \ | 60 | kdeui/kactionclasses.h \ |
60 | kdeui/kactioncollection.h \ | 61 | kdeui/kactioncollection.h \ |
61 | kdeui/kcmodule.h \ | 62 | kdeui/kcmodule.h \ |
62 | kdeui/kstdaction.h \ | 63 | kdeui/kstdaction.h \ |
63 | kdeui/kbuttonbox.h \ | 64 | kdeui/kbuttonbox.h \ |
64 | kdeui/klistbox.h \ | 65 | kdeui/klistbox.h \ |
65 | kdeui/klistview.h \ | 66 | kdeui/klistview.h \ |
66 | kdeui/kjanuswidget.h \ | 67 | kdeui/kjanuswidget.h \ |
67 | kdeui/kseparator.h \ | 68 | kdeui/kseparator.h \ |
68 | kdeui/kmainwindow.h \ | 69 | kdeui/kmainwindow.h \ |
69 | kdeui/knuminput.h \ | 70 | kdeui/knuminput.h \ |
70 | kdeui/knumvalidator.h \ | 71 | kdeui/knumvalidator.h \ |
71 | kdeui/ksqueezedtextlabel.h \ | 72 | kdeui/ksqueezedtextlabel.h \ |
72 | kdeui/ktoolbar.h \ | 73 | kdeui/ktoolbar.h \ |
73 | kdeui/ktoolbarbutton.h \ | 74 | kdeui/ktoolbarbutton.h \ |
74 | kdeui/ktoolbarhandler.h \ | 75 | kdeui/ktoolbarhandler.h \ |
75 | kdeui/kxmlguiclient.h \ | 76 | kdeui/kxmlguiclient.h \ |
76 | kio/job.h \ | 77 | kio/job.h \ |
77 | kio/kio/kdirwatch.h \ | 78 | kio/kio/kdirwatch.h \ |
78 | kio/kio/kdirwatch_p.h \ | 79 | kio/kio/kdirwatch_p.h \ |
79 | kio/kfile/kurlrequester.h \ | 80 | kio/kfile/kurlrequester.h \ |
80 | kresources/resource.h \ | 81 | kresources/resource.h \ |
81 | kresources/factory.h \ | 82 | kresources/factory.h \ |
82 | kresources/managerimpl.h \ | 83 | kresources/managerimpl.h \ |
83 | kresources/manager.h \ | 84 | kresources/manager.h \ |
84 | kresources/selectdialog.h \ | 85 | kresources/selectdialog.h \ |
85 | kresources/configpage.h \ | 86 | kresources/configpage.h \ |
86 | kresources/configwidget.h \ | 87 | kresources/configwidget.h \ |
87 | kresources/configdialog.h \ | 88 | kresources/configdialog.h \ |
88 | kresources/kcmkresources.h \ | 89 | kresources/kcmkresources.h \ |
89 | kdecore/kmdcodec.h \ | 90 | kdecore/kmdcodec.h \ |
90 | kdecore/kconfigbase.h \ | 91 | kdecore/kconfigbase.h \ |
91 | kdecore/klocale.h \ | 92 | kdecore/klocale.h \ |
92 | kdecore/klibloader.h \ | 93 | kdecore/klibloader.h \ |
93 | kdecore/kcatalogue.h \ | 94 | kdecore/kcatalogue.h \ |
94 | kdecore/kprefs.h \ | 95 | kdecore/kprefs.h \ |
95 | kdecore/ksharedptr.h \ | 96 | kdecore/ksharedptr.h \ |
96 | kdecore/kshell.h \ | 97 | kdecore/kshell.h \ |
97 | kdecore/kstandarddirs.h \ | 98 | kdecore/kstandarddirs.h \ |
98 | kdecore/kstringhandler.h \ | 99 | kdecore/kstringhandler.h \ |
99 | kdecore/kshortcut.h \ | 100 | kdecore/kshortcut.h \ |
100 | kutils/kcmultidialog.h \ | 101 | kutils/kcmultidialog.h \ |
101 | kidmanager.h | 102 | kidmanager.h |
102 | 103 | ||
103 | 104 | ||
104 | 105 | ||
105 | 106 | ||
106 | SOURCES = \ | 107 | SOURCES = \ |
107 | KDGanttMinimizeSplitter.cpp fncolordialog.cpp \ | 108 | KDGanttMinimizeSplitter.cpp fncolordialog.cpp \ |
108 | kapplication.cpp \ | 109 | kapplication.cpp \ |
109 | kcalendarsystem.cpp \ | 110 | kcalendarsystem.cpp \ |
110 | kcalendarsystemgregorian.cpp \ | 111 | kcalendarsystemgregorian.cpp \ |
111 | kcolorbutton.cpp \ | 112 | kcolorbutton.cpp \ |
112 | kcolordialog.cpp \ | 113 | kcolordialog.cpp \ |
113 | kconfig.cpp \ | 114 | kconfig.cpp \ |
114 | kdatetbl.cpp \ | 115 | kdatetbl.cpp \ |
115 | kdialog.cpp \ | 116 | kdialog.cpp \ |
116 | kdialogbase.cpp \ | 117 | kdialogbase.cpp \ |
117 | keditlistbox.cpp \ | 118 | keditlistbox.cpp \ |
118 | kemailsettings.cpp \ | 119 | kemailsettings.cpp \ |
119 | kfontdialog.cpp \ | 120 | kfontdialog.cpp \ |
120 | kfiledialog.cpp \ | 121 | kfiledialog.cpp \ |
121 | kglobal.cpp \ | 122 | kglobal.cpp \ |
122 | kglobalsettings.cpp \ | 123 | kglobalsettings.cpp \ |
123 | kiconloader.cpp \ | 124 | kiconloader.cpp \ |
124 | kmessagebox.cpp \ | 125 | kmessagebox.cpp \ |
125 | kprocess.cpp \ | 126 | kprocess.cpp \ |
126 | krun.cpp \ | 127 | krun.cpp \ |
127 | ksystemtray.cpp \ | 128 | ksystemtray.cpp \ |
128 | ktempfile.cpp \ | 129 | ktempfile.cpp \ |
129 | kurl.cpp \ | 130 | kurl.cpp \ |
130 | ktextedit.cpp \ | 131 | ktextedit.cpp \ |
131 | ofileselector_p.cpp \ | 132 | ofileselector_p.cpp \ |
132 | ofontselector.cpp \ | 133 | ofontselector.cpp \ |
133 | kdecore/kcatalogue.cpp \ | 134 | kdecore/kcatalogue.cpp \ |
134 | kdecore/klibloader.cpp \ | 135 | kdecore/klibloader.cpp \ |
135 | kdecore/klocale.cpp \ | 136 | kdecore/klocale.cpp \ |
136 | kdecore/kmdcodec.cpp \ | 137 | kdecore/kmdcodec.cpp \ |
137 | kdecore/kprefs.cpp \ | 138 | kdecore/kprefs.cpp \ |
138 | kdecore/kshell.cpp \ | 139 | kdecore/kshell.cpp \ |
139 | kdecore/kstandarddirs.cpp \ | 140 | kdecore/kstandarddirs.cpp \ |
140 | kdecore/kstringhandler.cpp \ | 141 | kdecore/kstringhandler.cpp \ |
141 | kdeui/kaction.cpp \ | 142 | kdeui/kaction.cpp \ |
143 | kdeui/kpopupmenu.cpp \ | ||
142 | kdeui/kactionclasses.cpp \ | 144 | kdeui/kactionclasses.cpp \ |
143 | kdeui/kactioncollection.cpp \ | 145 | kdeui/kactioncollection.cpp \ |
144 | kdeui/kbuttonbox.cpp \ | 146 | kdeui/kbuttonbox.cpp \ |
145 | kdeui/kcmodule.cpp \ | 147 | kdeui/kcmodule.cpp \ |
146 | kdeui/kguiitem.cpp \ | 148 | kdeui/kguiitem.cpp \ |
147 | kdeui/kjanuswidget.cpp \ | 149 | kdeui/kjanuswidget.cpp \ |
148 | kdeui/klistbox.cpp \ | 150 | kdeui/klistbox.cpp \ |
149 | kdeui/klistview.cpp \ | 151 | kdeui/klistview.cpp \ |
150 | kdeui/kmainwindow.cpp \ | 152 | kdeui/kmainwindow.cpp \ |
151 | kdeui/knuminput.cpp \ | 153 | kdeui/knuminput.cpp \ |
152 | kdeui/knumvalidator.cpp \ | 154 | kdeui/knumvalidator.cpp \ |
153 | kdeui/kseparator.cpp \ | 155 | kdeui/kseparator.cpp \ |
154 | kdeui/kstdaction.cpp \ | 156 | kdeui/kstdaction.cpp \ |
155 | kdeui/ksqueezedtextlabel.cpp \ | 157 | kdeui/ksqueezedtextlabel.cpp \ |
156 | kdeui/ktoolbar.cpp \ | 158 | kdeui/ktoolbar.cpp \ |
157 | kdeui/ktoolbarbutton.cpp \ | 159 | kdeui/ktoolbarbutton.cpp \ |
158 | kdeui/ktoolbarhandler.cpp \ | 160 | kdeui/ktoolbarhandler.cpp \ |
159 | kdeui/kxmlguiclient.cpp \ | 161 | kdeui/kxmlguiclient.cpp \ |
160 | kio/kfile/kurlrequester.cpp \ | 162 | kio/kfile/kurlrequester.cpp \ |
161 | kio/kio/kdirwatch.cpp \ | 163 | kio/kio/kdirwatch.cpp \ |
162 | kresources/configpage.cpp \ | 164 | kresources/configpage.cpp \ |
163 | kresources/configdialog.cpp \ | 165 | kresources/configdialog.cpp \ |
164 | kresources/configwidget.cpp \ | 166 | kresources/configwidget.cpp \ |
165 | kresources/factory.cpp \ | 167 | kresources/factory.cpp \ |
166 | kresources/kcmkresources.cpp \ | 168 | kresources/kcmkresources.cpp \ |
167 | kresources/managerimpl.cpp \ | 169 | kresources/managerimpl.cpp \ |
168 | kresources/resource.cpp \ | 170 | kresources/resource.cpp \ |
169 | kresources/selectdialog.cpp \ | 171 | kresources/selectdialog.cpp \ |
170 | kutils/kcmultidialog.cpp \ | 172 | kutils/kcmultidialog.cpp \ |
171 | kidmanager.cpp | 173 | kidmanager.cpp |
172 | 174 | ||