summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-29 20:48:31 (UTC)
committer zautrix <zautrix>2005-06-29 20:48:31 (UTC)
commitf55b992a98cc081207b23283aadcf2ecffc90a87 (patch) (unidiff)
treeb0b54ac4f2a164ac7e7ca49bea78f62e4f58fa62
parent8954bae7bb5afc9706e37e808e9c1e237399f214 (diff)
downloadkdepimpi-f55b992a98cc081207b23283aadcf2ecffc90a87.zip
kdepimpi-f55b992a98cc081207b23283aadcf2ecffc90a87.tar.gz
kdepimpi-f55b992a98cc081207b23283aadcf2ecffc90a87.tar.bz2
fixxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
-rw-r--r--korganizer/calendarview.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 776cdd3..623cf9d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,1182 +1,1190 @@
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 "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 110#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 111#include "statusdialog.h"
112#include "kdatenavigator.h" 112#include "kdatenavigator.h"
113#include "kotodoview.h" 113#include "kotodoview.h"
114#include "datenavigator.h" 114#include "datenavigator.h"
115#include "resourceview.h" 115#include "resourceview.h"
116#include "navigatorbar.h" 116#include "navigatorbar.h"
117#include "searchdialog.h" 117#include "searchdialog.h"
118#include "mainwindow.h" 118#include "mainwindow.h"
119 119
120#include "calendarview.h" 120#include "calendarview.h"
121#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
122#include <qtopia/alarmserver.h> 122#include <qtopia/alarmserver.h>
123#endif 123#endif
124#ifndef _WIN32_ 124#ifndef _WIN32_
125#include <stdlib.h> 125#include <stdlib.h>
126#include <stdio.h> 126#include <stdio.h>
127#include <unistd.h> 127#include <unistd.h>
128#else 128#else
129#include <qprocess.h> 129#include <qprocess.h>
130#endif 130#endif
131 131
132#ifdef DESKTOP_VERSION 132#ifdef DESKTOP_VERSION
133#include <kabc/stdaddressbook.h> 133#include <kabc/stdaddressbook.h>
134#endif 134#endif
135using namespace KOrg; 135using namespace KOrg;
136using namespace KCal; 136using namespace KCal;
137extern int globalFlagBlockAgenda; 137extern int globalFlagBlockAgenda;
138extern int globalFlagBlockStartup; 138extern int globalFlagBlockStartup;
139 139
140 140
141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
142 142
143{ 143{
144 mAlarms = alarms; 144 mAlarms = alarms;
145 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 145 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
146 QString mText = "<table width=\"100%\">\n"; 146 QString mText = "<table width=\"100%\">\n";
147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
148#ifdef DESKTOP_VERSION 148#ifdef DESKTOP_VERSION
149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
150#else 150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
152#endif 152#endif
153 // mText += "<img src=\""; 153 // mText += "<img src=\"";
154 // mText += ipath; 154 // mText += ipath;
155 // mText += "\">"; 155 // mText += "\">";
156 //mEventDate = QDate::currentDate(); 156 //mEventDate = QDate::currentDate();
157#ifdef DESKTOP_VERSION 157#ifdef DESKTOP_VERSION
158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
159#else 159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
161#endif 161#endif
162 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 162 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
163 163
164 Incidence * inc = getNextInc( start ); 164 Incidence * inc = getNextInc( start );
165 int time = 0; 165 int time = 0;
166 //mText += "<table>"; 166 //mText += "<table>";
167 while ( inc ) { 167 while ( inc ) {
168 QDateTime dt ; 168 QDateTime dt ;
169 QString tempText = "<a "; 169 QString tempText = "<a ";
170 bool ok; 170 bool ok;
171 dt = inc->getNextOccurence( start, &ok ); 171 dt = inc->getNextOccurence( start, &ok );
172 if ( !ok ) continue; 172 if ( !ok ) continue;
173 if ( inc->typeID() == eventID ) { 173 if ( inc->typeID() == eventID ) {
174 tempText += "href=\"event:"; 174 tempText += "href=\"event:";
175 } else if ( inc->typeID() == todoID ) { 175 } else if ( inc->typeID() == todoID ) {
176 tempText += "href=\"todo:"; 176 tempText += "href=\"todo:";
177 } 177 }
178 tempText += inc->uid() + "\">"; 178 tempText += inc->uid() + "\">";
179 if ( inc->typeID() == todoID ) 179 if ( inc->typeID() == todoID )
180 tempText += i18n("Todo: "); 180 tempText += i18n("Todo: ");
181 if ( inc->summary().length() > 0 ) 181 if ( inc->summary().length() > 0 )
182 tempText += inc->summary(); 182 tempText += inc->summary();
183 else 183 else
184 tempText += i18n("-no summary-"); 184 tempText += i18n("-no summary-");
185 QString timestr; 185 QString timestr;
186 if (!inc->doesFloat()) 186 if (!inc->doesFloat())
187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
188 else 188 else
189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
190 if ( dt.date() < QDate::currentDate() && time == 0 ) { 190 if ( dt.date() < QDate::currentDate() && time == 0 ) {
191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 191 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
192 mText += "<table>"; 192 mText += "<table>";
193 time = 1; 193 time = 1;
194 } 194 }
195 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 195 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
196 if ( time > 0 ) 196 if ( time > 0 )
197 mText +="</table>"; 197 mText +="</table>";
198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
199 mText += "<table>"; 199 mText += "<table>";
200 time = 2; 200 time = 2;
201 201
202 } 202 }
203 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 203 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
204 if ( time > 0 ) 204 if ( time > 0 )
205 mText +="</table>"; 205 mText +="</table>";
206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
207 mText += "<table>"; 207 mText += "<table>";
208 time = 3; 208 time = 3;
209 } 209 }
210 mText +="<tr><td><b>"; 210 mText +="<tr><td><b>";
211 mText += timestr; 211 mText += timestr;
212 mText += "</b></td><td>"; 212 mText += "</b></td><td>";
213 mText += tempText; 213 mText += tempText;
214 mText += "</td></tr>\n"; 214 mText += "</td></tr>\n";
215 inc = getNextInc( start ); 215 inc = getNextInc( start );
216 } 216 }
217 mText +="</table>"; 217 mText +="</table>";
218 setText( mText ); 218 setText( mText );
219} 219}
220 220
221MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 221MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
222{ 222{
223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
224} 224}
225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
226{ 226{
227 QDateTime dt ; 227 QDateTime dt ;
228 Incidence * retInc; 228 Incidence * retInc;
229 Incidence * inc = mAlarms.first(); 229 Incidence * inc = mAlarms.first();
230 if ( inc == 0 ) 230 if ( inc == 0 )
231 return 0; 231 return 0;
232 bool ok; 232 bool ok;
233 dt = inc->getNextOccurence( start, &ok ); 233 dt = inc->getNextOccurence( start, &ok );
234 if ( ! ok ) return 0; 234 if ( ! ok ) return 0;
235 QDateTime dtn ; 235 QDateTime dtn ;
236 retInc = inc; 236 retInc = inc;
237 inc = mAlarms.next(); 237 inc = mAlarms.next();
238 while ( inc ) { 238 while ( inc ) {
239 dtn = inc->getNextOccurence( start, &ok ); 239 dtn = inc->getNextOccurence( start, &ok );
240 if ( ! ok ) return 0; 240 if ( ! ok ) return 0;
241 if ( dtn < dt ) { 241 if ( dtn < dt ) {
242 dt = dtn; 242 dt = dtn;
243 retInc = inc; 243 retInc = inc;
244 } 244 }
245 inc = mAlarms.next(); 245 inc = mAlarms.next();
246 } 246 }
247 mAlarms.remove( retInc ); 247 mAlarms.remove( retInc );
248 return retInc; 248 return retInc;
249 249
250} 250}
251void MissedAlarmTextBrowser::setSource(const QString & n) 251void MissedAlarmTextBrowser::setSource(const QString & n)
252{ 252{
253 if (n.startsWith("event:")) { 253 if (n.startsWith("event:")) {
254#ifdef DESKTOP_VERSION 254#ifdef DESKTOP_VERSION
255 emit showIncidence(n.mid(8)); 255 emit showIncidence(n.mid(8));
256#else 256#else
257 emit showIncidence(n.mid(6)); 257 emit showIncidence(n.mid(6));
258#endif 258#endif
259 return; 259 return;
260 } else if (n.startsWith("todo:")) { 260 } else if (n.startsWith("todo:")) {
261#ifdef DESKTOP_VERSION 261#ifdef DESKTOP_VERSION
262 emit showIncidence(n.mid(7)); 262 emit showIncidence(n.mid(7));
263#else 263#else
264 emit showIncidence(n.mid(5)); 264 emit showIncidence(n.mid(5));
265#endif 265#endif
266 return; 266 return;
267 } 267 }
268} 268}
269 269
270 270
271class KOBeamPrefs : public QDialog 271class KOBeamPrefs : public QDialog
272{ 272{
273 public: 273 public:
274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
275 QDialog( parent, name, true ) 275 QDialog( parent, name, true )
276 { 276 {
277 setCaption( i18n("Beam Options") ); 277 setCaption( i18n("Beam Options") );
278 QVBoxLayout* lay = new QVBoxLayout( this ); 278 QVBoxLayout* lay = new QVBoxLayout( this );
279 lay->setSpacing( 3 ); 279 lay->setSpacing( 3 );
280 lay->setMargin( 3 ); 280 lay->setMargin( 3 );
281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
282 lay->addWidget( format ); 282 lay->addWidget( format );
283 format->setExclusive ( true ) ; 283 format->setExclusive ( true ) ;
284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
285 lay->addWidget( time ); time->setExclusive ( true ) ; 285 lay->addWidget( time ); time->setExclusive ( true ) ;
286 vcal = new QRadioButton(" vCalendar ", format ); 286 vcal = new QRadioButton(" vCalendar ", format );
287 ical = new QRadioButton(" iCalendar ", format ); 287 ical = new QRadioButton(" iCalendar ", format );
288 vcal->setChecked( true ); 288 vcal->setChecked( true );
289 tz = new QRadioButton(i18n(" With timezone "), time ); 289 tz = new QRadioButton(i18n(" With timezone "), time );
290 local = new QRadioButton(i18n(" Local time "), time ); 290 local = new QRadioButton(i18n(" Local time "), time );
291 tz->setChecked( true ); 291 tz->setChecked( true );
292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
293 lay->addWidget( ok ); 293 lay->addWidget( ok );
294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
295 lay->addWidget( cancel ); 295 lay->addWidget( cancel );
296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
298 resize( 200, 200 ); 298 resize( 200, 200 );
299 } 299 }
300 300
301 bool beamVcal() { return vcal->isChecked(); } 301 bool beamVcal() { return vcal->isChecked(); }
302 bool beamLocal() { return local->isChecked(); } 302 bool beamLocal() { return local->isChecked(); }
303private: 303private:
304 QRadioButton* vcal, *ical, *local, *tz; 304 QRadioButton* vcal, *ical, *local, *tz;
305}; 305};
306class KOCatPrefs : public QDialog 306class KOCatPrefs : public QDialog
307{ 307{
308 public: 308 public:
309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
310 QDialog( parent, name, true ) 310 QDialog( parent, name, true )
311 { 311 {
312 setCaption( i18n("Manage new Categories") ); 312 setCaption( i18n("Manage new Categories") );
313 QVBoxLayout* lay = new QVBoxLayout( this ); 313 QVBoxLayout* lay = new QVBoxLayout( this );
314 lay->setSpacing( 3 ); 314 lay->setSpacing( 3 );
315 lay->setMargin( 3 ); 315 lay->setMargin( 3 );
316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 316 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
317 lay->addWidget( lab ); 317 lay->addWidget( lab );
318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 318 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
319 lay->addWidget( format ); 319 lay->addWidget( format );
320 format->setExclusive ( true ) ; 320 format->setExclusive ( true ) ;
321 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 321 addCatBut = new QRadioButton(i18n("Add to category list"), format );
322 new QRadioButton(i18n("Remove from Events/Todos"), format ); 322 new QRadioButton(i18n("Remove from Events/Todos"), format );
323 addCatBut->setChecked( true ); 323 addCatBut->setChecked( true );
324 QPushButton * ok = new QPushButton( i18n("OK"), this ); 324 QPushButton * ok = new QPushButton( i18n("OK"), this );
325 lay->addWidget( ok ); 325 lay->addWidget( ok );
326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
327 lay->addWidget( cancel ); 327 lay->addWidget( cancel );
328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
330 resize( 200, 200 ); 330 resize( 200, 200 );
331 } 331 }
332 332
333 bool addCat() { return addCatBut->isChecked(); } 333 bool addCat() { return addCatBut->isChecked(); }
334private: 334private:
335 QRadioButton* addCatBut; 335 QRadioButton* addCatBut;
336}; 336};
337 337
338 338
339 339
340CalendarView::CalendarView( CalendarResources *calendar, 340CalendarView::CalendarView( CalendarResources *calendar,
341 QWidget *parent, const char *name ) 341 QWidget *parent, const char *name )
342 : CalendarViewBase( parent, name ), 342 : CalendarViewBase( parent, name ),
343 mCalendar( calendar ), 343 mCalendar( calendar ),
344 mResourceManager( calendar->resourceManager() ) 344 mResourceManager( calendar->resourceManager() )
345{ 345{
346 346
347 mEventEditor = 0; 347 mEventEditor = 0;
348 mTodoEditor = 0; 348 mTodoEditor = 0;
349 349
350 init(); 350 init();
351} 351}
352 352
353CalendarView::CalendarView( Calendar *calendar, 353CalendarView::CalendarView( Calendar *calendar,
354 QWidget *parent, const char *name ) 354 QWidget *parent, const char *name )
355 : CalendarViewBase( parent, name ), 355 : CalendarViewBase( parent, name ),
356 mCalendar( calendar ), 356 mCalendar( calendar ),
357 mResourceManager( 0 ) 357 mResourceManager( 0 )
358{ 358{
359 359
360 mEventEditor = 0; 360 mEventEditor = 0;
361 mTodoEditor = 0; 361 mTodoEditor = 0;
362 init(); 362 init();
363} 363}
364 364
365void CalendarView::init() 365void CalendarView::init()
366{ 366{
367 mNextAlarmDateTime = QDateTime::currentDateTime(); 367 mNextAlarmDateTime = QDateTime::currentDateTime();
368 setFocusPolicy ( NoFocus ); 368 setFocusPolicy ( NoFocus );
369 mViewerCallerIsSearchDialog = false; 369 mViewerCallerIsSearchDialog = false;
370 mBlockShowDates = false; 370 mBlockShowDates = false;
371 371
372 mDatePickerMode = 0; 372 mDatePickerMode = 0;
373 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
374 mViewManager = new KOViewManager( this ); 374 mViewManager = new KOViewManager( this );
375 mDialogManager = new KODialogManager( this ); 375 mDialogManager = new KODialogManager( this );
376 mEventViewerDialog = 0; 376 mEventViewerDialog = 0;
377 mModified = false; 377 mModified = false;
378 mReadOnly = false; 378 mReadOnly = false;
379 mSelectedIncidence = 0; 379 mSelectedIncidence = 0;
380 mCalPrinter = 0; 380 mCalPrinter = 0;
381 mFilters.setAutoDelete(true); 381 mFilters.setAutoDelete(true);
382 382
383 mCalendar->registerObserver( this ); 383 mCalendar->registerObserver( this );
384 // TODO: Make sure that view is updated, when calendar is changed. 384 // TODO: Make sure that view is updated, when calendar is changed.
385 385
386 mStorage = new FileStorage( mCalendar ); 386 mStorage = new FileStorage( mCalendar );
387 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 387 mNavigator = new DateNavigator( this, "datevav", mViewManager );
388 388
389 QBoxLayout *topLayout = (QBoxLayout*)layout(); 389 QBoxLayout *topLayout = (QBoxLayout*)layout();
390#ifndef KORG_NOSPLITTER 390#ifndef KORG_NOSPLITTER
391 // create the main layout frames. 391 // create the main layout frames.
392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 392 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
393 topLayout->addWidget(mPanner); 393 topLayout->addWidget(mPanner);
394 394
395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 395 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
396 "CalendarView::LeftFrame"); 396 "CalendarView::LeftFrame");
397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 397 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
398 398
399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 399 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
400 "CalendarView::DateNavigator" ); 400 "CalendarView::DateNavigator" );
401 401
402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 402 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 403 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
404 mTodoList->setNavigator( mNavigator ); 404 mTodoList->setNavigator( mNavigator );
405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 405 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
406 406
407#ifdef KORG_NORESOURCEVIEW 407#ifdef KORG_NORESOURCEVIEW
408 mResourceView = 0; 408 mResourceView = 0;
409#else 409#else
410 if ( mResourceManager ) { 410 if ( mResourceManager ) {
411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 411 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
412 mResourceView->updateView(); 412 mResourceView->updateView();
413 connect( mResourceView, SIGNAL( resourcesChanged() ), 413 connect( mResourceView, SIGNAL( resourcesChanged() ),
414 SLOT( updateView() ) ); 414 SLOT( updateView() ) );
415 } else { 415 } else {
416 mResourceView = 0; 416 mResourceView = 0;
417 } 417 }
418#endif 418#endif
419 QWidget *rightBox = new QWidget( mPanner ); 419 QWidget *rightBox = new QWidget( mPanner );
420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 420 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
421 421
422 mRightFrame = new QWidgetStack( rightBox ); 422 mRightFrame = new QWidgetStack( rightBox );
423 rightLayout->addWidget( mRightFrame, 1 ); 423 rightLayout->addWidget( mRightFrame, 1 );
424 424
425 mLeftFrame = mLeftSplitter; 425 mLeftFrame = mLeftSplitter;
426#else 426#else
427 //QWidget *mainBox = new QWidget( this ); 427 //QWidget *mainBox = new QWidget( this );
428 //QWidget *leftFrame = new QWidget( mainBox ); 428 //QWidget *leftFrame = new QWidget( mainBox );
429 //QBoxLayout * mainBoxLayout; 429 //QBoxLayout * mainBoxLayout;
430 if ( KOPrefs::instance()->mVerticalScreen ) { 430 if ( KOPrefs::instance()->mVerticalScreen ) {
431 //mainBoxLayout = new QVBoxLayout(mainBox); 431 //mainBoxLayout = new QVBoxLayout(mainBox);
432 //leftFrameLayout = new QHBoxLayout(leftFrame ); 432 //leftFrameLayout = new QHBoxLayout(leftFrame );
433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
437 } else { 437 } else {
438 //mainBoxLayout = new QHBoxLayout(mainBox); 438 //mainBoxLayout = new QHBoxLayout(mainBox);
439 //leftFrameLayout = new QVBoxLayout(leftFrame ); 439 //leftFrameLayout = new QVBoxLayout(leftFrame );
440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
444 } 444 }
445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
446 //QBoxLayout * leftFrameLayout; 446 //QBoxLayout * leftFrameLayout;
447 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
448 topLayout->addWidget( mMainFrame ); 447 topLayout->addWidget( mMainFrame );
449 topLayout->addWidget( mDateScrollBar ); 448#ifdef DESKTOP_VERSION
449 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
450 topLayout->addWidget( mDateScrollBar );
451 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
452#endif
450 //mainBoxLayout->addWidget (mLeftFrame); 453 //mainBoxLayout->addWidget (mLeftFrame);
451 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 454 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
452 "CalendarView::DateNavigator" ); 455 "CalendarView::DateNavigator" );
453#if 0 456#if 0
454 // FIXME 457 // FIXME
455 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 458 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
456 "CalendarView::DateNavigator", QDate::currentDate()); 459 "CalendarView::DateNavigator", QDate::currentDate());
457#endif 460#endif
458 // mDateNavigator->blockSignals( true ); 461 // mDateNavigator->blockSignals( true );
459 //leftFrameLayout->addWidget( mDateNavigator ); 462 //leftFrameLayout->addWidget( mDateNavigator );
460 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 463 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
461 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 464 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
462 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 465 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
463 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 466 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 467 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
465 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 468 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 469 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
467 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 470 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
468 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 471 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
469 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 472 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
470 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 473 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
471 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 474 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
472 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 475
473 mTodoList->setNavigator( mNavigator ); 476 mTodoList->setNavigator( mNavigator );
474#if 0 477#if 0
475 if ( QApplication::desktop()->width() < 480 ) { 478 if ( QApplication::desktop()->width() < 480 ) {
476 leftFrameLayout->addWidget(mFilterView); 479 leftFrameLayout->addWidget(mFilterView);
477 leftFrameLayout->addWidget(mTodoList, 2 ); 480 leftFrameLayout->addWidget(mTodoList, 2 );
478 481
479 } else { 482 } else {
480 leftFrameLayout->addWidget(mTodoList,2 ); 483 leftFrameLayout->addWidget(mTodoList,2 );
481 leftFrameLayout->addWidget(mFilterView ); 484 leftFrameLayout->addWidget(mFilterView );
482 } 485 }
483#endif 486#endif
484 mFilterView->hide(); 487 mFilterView->hide();
485 mCalEditView->hide(); 488 mCalEditView->hide();
486 QWidget *rightBox = new QWidget( mMainFrame ); 489 QWidget *rightBox = new QWidget( mMainFrame );
487 //mainBoxLayout->addWidget ( rightBox, 10 ); 490 //mainBoxLayout->addWidget ( rightBox, 10 );
488 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 491 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
489 mRightFrame = new QWidgetStack( rightBox ); 492 mRightFrame = new QWidgetStack( rightBox );
490 rightLayout->addWidget( mRightFrame, 10 ); 493 rightLayout->addWidget( mRightFrame, 10 );
491 494
492 //mLeftFrame = (QWidget *)leftFrame; 495 //mLeftFrame = (QWidget *)leftFrame;
493 if ( KOPrefs::instance()->mVerticalScreen ) { 496 if ( KOPrefs::instance()->mVerticalScreen ) {
494 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 497 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
495 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 498 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
496 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 499 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
497 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 500 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
498 } else { 501 } else {
499 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 502 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
500 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 503 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
501 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 504 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
502 } 505 }
503 if ( !KOPrefs::instance()->mShowDateNavigator) 506 if ( !KOPrefs::instance()->mShowDateNavigator)
504 mDateNavigator->hide(); 507 mDateNavigator->hide();
505 //qDebug("Calendarview Size %d %d ", width(), height()); 508 //qDebug("Calendarview Size %d %d ", width(), height());
506#endif 509#endif
507 510
508 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 511 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
509 SLOT( showDates( const KCal::DateList & ) ) ); 512 SLOT( showDates( const KCal::DateList & ) ) );
510 513
511 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 514 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
512 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 515 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
513 516
514 517
515 518
516 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 519 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
517 mViewManager, SLOT( showMonth( const QDate & ) ) ); 520 mViewManager, SLOT( showMonth( const QDate & ) ) );
518 521
519 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 522 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
520 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 523 mNavigator, SLOT( selectWeek( const QDate & ) ) );
521 524
522 connect( mDateNavigator, SIGNAL( goPrevYear() ), 525 connect( mDateNavigator, SIGNAL( goPrevYear() ),
523 mNavigator, SLOT( selectPreviousYear() ) ); 526 mNavigator, SLOT( selectPreviousYear() ) );
524 connect( mDateNavigator, SIGNAL( goNextYear() ), 527 connect( mDateNavigator, SIGNAL( goNextYear() ),
525 mNavigator, SLOT( selectNextYear() ) ); 528 mNavigator, SLOT( selectNextYear() ) );
526 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 529 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
527 mNavigator, SLOT( selectPreviousMonth() ) ); 530 mNavigator, SLOT( selectPreviousMonth() ) );
528 connect( mDateNavigator, SIGNAL( goNextMonth() ), 531 connect( mDateNavigator, SIGNAL( goNextMonth() ),
529 mNavigator, SLOT( selectNextMonth() ) ); 532 mNavigator, SLOT( selectNextMonth() ) );
530 533
531 connect( mDateNavigator, SIGNAL( goPrevious() ), 534 connect( mDateNavigator, SIGNAL( goPrevious() ),
532 mNavigator, SLOT( selectPrevious() ) ); 535 mNavigator, SLOT( selectPrevious() ) );
533 connect( mDateNavigator, SIGNAL( goNext() ), 536 connect( mDateNavigator, SIGNAL( goNext() ),
534 mNavigator, SLOT( selectNext() ) ); 537 mNavigator, SLOT( selectNext() ) );
535 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 538 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
536 mNavigator, SLOT( slotMonthSelect( int ) ) ); 539 mNavigator, SLOT( slotMonthSelect( int ) ) );
537 540
538 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 541 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
539 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 542 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
540#if 0 543#if 0
541 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 544 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
542 SLOT( incidenceAdded( Incidence *) ) ); 545 SLOT( incidenceAdded( Incidence *) ) );
543#endif 546#endif
544 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 547 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
545 548
546 connect( this, SIGNAL( configChanged() ), 549 connect( this, SIGNAL( configChanged() ),
547 mDateNavigator, SLOT( updateConfig() ) ); 550 mDateNavigator, SLOT( updateConfig() ) );
548 551
549 connect( mTodoList, SIGNAL( newTodoSignal() ), 552 connect( mTodoList, SIGNAL( newTodoSignal() ),
550 SLOT( newTodo() ) ); 553 SLOT( newTodo() ) );
551 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 554 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
552 SLOT( newSubTodo( Todo * ) ) ); 555 SLOT( newSubTodo( Todo * ) ) );
553 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 556 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
554 SLOT( editTodo( Todo * ) ) ); 557 SLOT( editTodo( Todo * ) ) );
555 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 558 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
556 SLOT( showTodo( Todo *) ) ); 559 SLOT( showTodo( Todo *) ) );
557 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 560 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
558 SLOT( deleteTodo( Todo *) ) ); 561 SLOT( deleteTodo( Todo *) ) );
559 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 562 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
560 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 563 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
561 SLOT( purgeCompleted() ) ); 564 SLOT( purgeCompleted() ) );
562 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 565 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
563 SIGNAL( todoModified( Todo *, int ) ) ); 566 SIGNAL( todoModified( Todo *, int ) ) );
564 567
565 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 568 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
566 this, SLOT ( cloneIncidence( Incidence * ) ) ); 569 this, SLOT ( cloneIncidence( Incidence * ) ) );
567 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 570 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
568 this, SLOT (cancelIncidence( Incidence * ) ) ); 571 this, SLOT (cancelIncidence( Incidence * ) ) );
569 572
570 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
571 this, SLOT ( moveIncidence( Incidence * ) ) ); 574 this, SLOT ( moveIncidence( Incidence * ) ) );
572 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
573 this, SLOT ( beamIncidence( Incidence * ) ) ); 576 this, SLOT ( beamIncidence( Incidence * ) ) );
574 577
575 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 578 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
576 this, SLOT ( todo_unsub( Todo * ) ) ); 579 this, SLOT ( todo_unsub( Todo * ) ) );
577 580
578 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 581 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
579 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 582 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
580 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 583 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
581 SLOT( updateTodo( Todo *, int ) ) ); 584 SLOT( updateTodo( Todo *, int ) ) );
582 connect( this, SIGNAL( todoModified( Todo *, int )), this, 585 connect( this, SIGNAL( todoModified( Todo *, int )), this,
583 SLOT( changeTodoDisplay( Todo *, int ) ) ); 586 SLOT( changeTodoDisplay( Todo *, int ) ) );
584 587
585 588
586 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 589 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
587 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 590 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
588 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 591 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
589 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 592 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
590 593
591 594
592 595
593 596
594 597
595 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 598 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
596 SLOT(checkClipboard())); 599 SLOT(checkClipboard()));
597 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 600 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
598 SLOT( processTodoListSelection( Incidence * ) ) ); 601 SLOT( processTodoListSelection( Incidence * ) ) );
599 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 602 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
600 603
601 // kdDebug() << "CalendarView::CalendarView() done" << endl; 604 // kdDebug() << "CalendarView::CalendarView() done" << endl;
602 605
603 mDateFrame = new QVBox(0,0,WType_Popup); 606 mDateFrame = new QVBox(0,0,WType_Popup);
604 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 607 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
605 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 608 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
606 mDateFrame->setLineWidth(3); 609 mDateFrame->setLineWidth(3);
607 mDateFrame->hide(); 610 mDateFrame->hide();
608 mDateFrame->setCaption( i18n( "Pick a date to display")); 611 mDateFrame->setCaption( i18n( "Pick a date to display"));
609 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 612 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
610 613
611 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 614 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
612 615
613 mEventEditor = mDialogManager->getEventEditor(); 616 mEventEditor = mDialogManager->getEventEditor();
614 mTodoEditor = mDialogManager->getTodoEditor(); 617 mTodoEditor = mDialogManager->getTodoEditor();
615 618
616 mFlagEditDescription = false; 619 mFlagEditDescription = false;
617 620
618 mSuspendTimer = new QTimer( this ); 621 mSuspendTimer = new QTimer( this );
619 mAlarmTimer = new QTimer( this ); 622 mAlarmTimer = new QTimer( this );
620 mRecheckAlarmTimer = new QTimer( this ); 623 mRecheckAlarmTimer = new QTimer( this );
621 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 624 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
622 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 625 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
623 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 626 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
624 mAlarmDialog = new AlarmDialog( this ); 627 mAlarmDialog = new AlarmDialog( this );
625 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 628 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
626 mAlarmDialog->setServerNotification( false ); 629 mAlarmDialog->setServerNotification( false );
627 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 630 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
628 631
629 632
630#ifndef DESKTOP_VERSION 633#ifndef DESKTOP_VERSION
631//US listen for arriving address resultsets 634//US listen for arriving address resultsets
632 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 635 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
633 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 636 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
634#endif 637#endif
635 mDateNavigator->setCalendar( mCalendar ); 638 mDateNavigator->setCalendar( mCalendar );
636} 639}
637 640
638 641
639CalendarView::~CalendarView() 642CalendarView::~CalendarView()
640{ 643{
641 // kdDebug() << "~CalendarView()" << endl; 644 // kdDebug() << "~CalendarView()" << endl;
642 //qDebug("CalendarView::~CalendarView() "); 645 //qDebug("CalendarView::~CalendarView() ");
643 delete mDialogManager; 646 delete mDialogManager;
644 delete mViewManager; 647 delete mViewManager;
645 delete mStorage; 648 delete mStorage;
646 delete mDateFrame ; 649 delete mDateFrame ;
647 delete mEventViewerDialog; 650 delete mEventViewerDialog;
648 //kdDebug() << "~CalendarView() done" << endl; 651 //kdDebug() << "~CalendarView() done" << endl;
649} 652}
650void CalendarView::setScrollBarStep(int val ) 653void CalendarView::setScrollBarStep(int val )
651{ 654{
655#ifdef DESKTOP_VERSION
652 mDateScrollBar->setLineStep ( val ); 656 mDateScrollBar->setLineStep ( val );
657#endif
653} 658}
654void CalendarView::scrollBarValue(int val ) 659void CalendarView::scrollBarValue(int val )
655{ 660{
661#ifdef DESKTOP_VERSION
662 if ( QApplication::desktop()->width() < 800 ) return;
656 static bool block = false; 663 static bool block = false;
657 if ( block ) return; 664 if ( block ) return;
658 block = true; 665 block = true;
659 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 666 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
660 //qDebug("VAL %d ",val ); 667 //qDebug("VAL %d ",val );
661 int count = mNavigator->selectedDates().count(); 668 int count = mNavigator->selectedDates().count();
662 int year = mNavigator->selectedDates().first().year(); 669 int year = mNavigator->selectedDates().first().year();
663 int day = mNavigator->selectedDates().first().dayOfYear(); 670 int day = mNavigator->selectedDates().first().dayOfYear();
664 if ( val == day -1 ) { 671 if ( val == day -1 ) {
665 block = false; 672 block = false;
666 return; 673 return;
667 } 674 }
668 QDate d ( year,1,1 ); 675 QDate d ( year,1,1 );
669 mNavigator->selectDates( d.addDays( val ), count ); 676 mNavigator->selectDates( d.addDays( val ), count );
670 block = false; 677 block = false;
678#endif
671 679
672} 680}
673 681
674void CalendarView::checkAlarms() 682void CalendarView::checkAlarms()
675{ 683{
676 KConfig *config = KOGlobals::config(); 684 KConfig *config = KOGlobals::config();
677 config->setGroup( "AppRun" ); 685 config->setGroup( "AppRun" );
678 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 686 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
679 int daysto = dt.daysTo( QDate::currentDate() ); 687 int daysto = dt.daysTo( QDate::currentDate() );
680 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 688 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
681 dt = dt.addDays( days ); 689 dt = dt.addDays( days );
682 int secto = dt.secsTo( QDateTime::currentDateTime() ); 690 int secto = dt.secsTo( QDateTime::currentDateTime() );
683 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 691 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
684 //qDebug("KO: Reading program stop %d ", secs); 692 //qDebug("KO: Reading program stop %d ", secs);
685 //secs -= ( 3600 * 24*3 ); // debug only 693 //secs -= ( 3600 * 24*3 ); // debug only
686 QDateTime latest = dt.addSecs ( secs ); 694 QDateTime latest = dt.addSecs ( secs );
687 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 695 qDebug("KO: Last termination on %s ", latest.toString().latin1());
688 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 696 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
689 QPtrList<Incidence> el = mCalendar->rawIncidences(); 697 QPtrList<Incidence> el = mCalendar->rawIncidences();
690 QPtrList<Incidence> al; 698 QPtrList<Incidence> al;
691 Incidence* inL = el.first(); 699 Incidence* inL = el.first();
692 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 700 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
693 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 701 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
694 while ( inL ) { 702 while ( inL ) {
695 bool ok = false; 703 bool ok = false;
696 int offset = 0; 704 int offset = 0;
697 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 705 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
698 if ( ok ) { 706 if ( ok ) {
699 //qDebug("OK %s",next.toString().latin1()); 707 //qDebug("OK %s",next.toString().latin1());
700 if ( next < cur ) { 708 if ( next < cur ) {
701 al.append( inL ); 709 al.append( inL );
702 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 710 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
703 } 711 }
704 } 712 }
705 inL = el.next(); 713 inL = el.next();
706 } 714 }
707 if ( al.count() ) { 715 if ( al.count() ) {
708 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 716 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
709 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 717 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
710 QVBoxLayout* lay = new QVBoxLayout( dia ); 718 QVBoxLayout* lay = new QVBoxLayout( dia );
711 lay->setSpacing( 0 ); 719 lay->setSpacing( 0 );
712 lay->setMargin( 0 ); 720 lay->setMargin( 0 );
713 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 721 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
714 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 722 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
715 lay->addWidget( matb ); 723 lay->addWidget( matb );
716 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 724 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
717 int wid = 210; 725 int wid = 210;
718 int x = QApplication::desktop()->width() - wid - 7; 726 int x = QApplication::desktop()->width() - wid - 7;
719 int y = QApplication::desktop()->height() - wid - 70; 727 int y = QApplication::desktop()->height() - wid - 70;
720 dia->setGeometry ( x,y,wid,wid); 728 dia->setGeometry ( x,y,wid,wid);
721 } else { 729 } else {
722 int si = 220; 730 int si = 220;
723 if ( QApplication::desktop()->width() > 470 ) 731 if ( QApplication::desktop()->width() > 470 )
724 si = 400; 732 si = 400;
725 dia->resize(si,si/2); 733 dia->resize(si,si/2);
726 } 734 }
727 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 735 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
728 dia->show(); 736 dia->show();
729 737
730 } 738 }
731} 739}
732void CalendarView::showDay( QDate d ) 740void CalendarView::showDay( QDate d )
733{ 741{
734 dateNavigator()->blockSignals( true ); 742 dateNavigator()->blockSignals( true );
735 dateNavigator()->selectDate( d ); 743 dateNavigator()->selectDate( d );
736 dateNavigator()->blockSignals( false ); 744 dateNavigator()->blockSignals( false );
737 mViewManager->showDayView(); 745 mViewManager->showDayView();
738 //dateNavigator()->selectDate( d ); 746 //dateNavigator()->selectDate( d );
739} 747}
740void CalendarView::timerAlarm() 748void CalendarView::timerAlarm()
741{ 749{
742 //qDebug("CalendarView::timerAlarm() "); 750 //qDebug("CalendarView::timerAlarm() ");
743 computeAlarm(mAlarmNotification ); 751 computeAlarm(mAlarmNotification );
744} 752}
745 753
746void CalendarView::suspendAlarm() 754void CalendarView::suspendAlarm()
747{ 755{
748 //qDebug(" CalendarView::suspendAlarm() "); 756 //qDebug(" CalendarView::suspendAlarm() ");
749 computeAlarm(mSuspendAlarmNotification ); 757 computeAlarm(mSuspendAlarmNotification );
750 758
751} 759}
752 760
753void CalendarView::startAlarm( QString mess , QString filename) 761void CalendarView::startAlarm( QString mess , QString filename)
754{ 762{
755 763
756 topLevelWidget()->showNormal(); 764 topLevelWidget()->showNormal();
757 topLevelWidget()->setActiveWindow(); 765 topLevelWidget()->setActiveWindow();
758 topLevelWidget()->raise(); 766 topLevelWidget()->raise();
759 767
760 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 768 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
761 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 769 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
762 770
763} 771}
764 772
765void CalendarView::checkNextTimerAlarm() 773void CalendarView::checkNextTimerAlarm()
766{ 774{
767 mCalendar->checkAlarmForIncidence( 0, true ); 775 mCalendar->checkAlarmForIncidence( 0, true );
768} 776}
769 777
770void CalendarView::computeAlarm( QString msg ) 778void CalendarView::computeAlarm( QString msg )
771{ 779{
772 780
773 QString mess = msg; 781 QString mess = msg;
774 QString mAlarmMessage = mess.mid( 9 ); 782 QString mAlarmMessage = mess.mid( 9 );
775 QString filename = MainWindow::resourcePath(); 783 QString filename = MainWindow::resourcePath();
776 filename += "koalarm.wav"; 784 filename += "koalarm.wav";
777 QString tempfilename; 785 QString tempfilename;
778 if ( mess.left( 13 ) == "suspend_alarm") { 786 if ( mess.left( 13 ) == "suspend_alarm") {
779 bool error = false; 787 bool error = false;
780 int len = mess.mid( 13 ).find("+++"); 788 int len = mess.mid( 13 ).find("+++");
781 if ( len < 2 ) 789 if ( len < 2 )
782 error = true; 790 error = true;
783 else { 791 else {
784 tempfilename = mess.mid( 13, len ); 792 tempfilename = mess.mid( 13, len );
785 if ( !QFile::exists( tempfilename ) ) 793 if ( !QFile::exists( tempfilename ) )
786 error = true; 794 error = true;
787 } 795 }
788 if ( ! error ) { 796 if ( ! error ) {
789 filename = tempfilename; 797 filename = tempfilename;
790 } 798 }
791 mAlarmMessage = mess.mid( 13+len+3 ); 799 mAlarmMessage = mess.mid( 13+len+3 );
792 //qDebug("suspend file %s ",tempfilename.latin1() ); 800 //qDebug("suspend file %s ",tempfilename.latin1() );
793 startAlarm( mAlarmMessage, filename); 801 startAlarm( mAlarmMessage, filename);
794 return; 802 return;
795 } 803 }
796 if ( mess.left( 11 ) == "timer_alarm") { 804 if ( mess.left( 11 ) == "timer_alarm") {
797 //mTimerTime = 0; 805 //mTimerTime = 0;
798 startAlarm( mess.mid( 11 ), filename ); 806 startAlarm( mess.mid( 11 ), filename );
799 return; 807 return;
800 } 808 }
801 if ( mess.left( 10 ) == "proc_alarm") { 809 if ( mess.left( 10 ) == "proc_alarm") {
802 bool error = false; 810 bool error = false;
803 int len = mess.mid( 10 ).find("+++"); 811 int len = mess.mid( 10 ).find("+++");
804 if ( len < 2 ) 812 if ( len < 2 )
805 error = true; 813 error = true;
806 else { 814 else {
807 tempfilename = mess.mid( 10, len ); 815 tempfilename = mess.mid( 10, len );
808 if ( !QFile::exists( tempfilename ) ) 816 if ( !QFile::exists( tempfilename ) )
809 error = true; 817 error = true;
810 } 818 }
811 if ( error ) { 819 if ( error ) {
812 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 820 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
813 mAlarmMessage += mess.mid( 10+len+3+9 ); 821 mAlarmMessage += mess.mid( 10+len+3+9 );
814 } else { 822 } else {
815 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 823 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
816 //qDebug("-----system command %s ",tempfilename.latin1() ); 824 //qDebug("-----system command %s ",tempfilename.latin1() );
817#ifndef _WIN32_ 825#ifndef _WIN32_
818 if ( vfork () == 0 ) { 826 if ( vfork () == 0 ) {
819 execl ( tempfilename.latin1(), 0 ); 827 execl ( tempfilename.latin1(), 0 );
820 return; 828 return;
821 } 829 }
822#else 830#else
823 QProcess* p = new QProcess(); 831 QProcess* p = new QProcess();
824 p->addArgument( tempfilename.latin1() ); 832 p->addArgument( tempfilename.latin1() );
825 p->start(); 833 p->start();
826 return; 834 return;
827#endif 835#endif
828 836
829 return; 837 return;
830 } 838 }
831 839
832 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 840 //qDebug("+++++++system command %s ",tempfilename.latin1() );
833 } 841 }
834 if ( mess.left( 11 ) == "audio_alarm") { 842 if ( mess.left( 11 ) == "audio_alarm") {
835 bool error = false; 843 bool error = false;
836 int len = mess.mid( 11 ).find("+++"); 844 int len = mess.mid( 11 ).find("+++");
837 if ( len < 2 ) 845 if ( len < 2 )
838 error = true; 846 error = true;
839 else { 847 else {
840 tempfilename = mess.mid( 11, len ); 848 tempfilename = mess.mid( 11, len );
841 if ( !QFile::exists( tempfilename ) ) 849 if ( !QFile::exists( tempfilename ) )
842 error = true; 850 error = true;
843 } 851 }
844 if ( ! error ) { 852 if ( ! error ) {
845 filename = tempfilename; 853 filename = tempfilename;
846 } 854 }
847 mAlarmMessage = mess.mid( 11+len+3+9 ); 855 mAlarmMessage = mess.mid( 11+len+3+9 );
848 //qDebug("audio file command %s ",tempfilename.latin1() ); 856 //qDebug("audio file command %s ",tempfilename.latin1() );
849 } 857 }
850 if ( mess.left( 9 ) == "cal_alarm") { 858 if ( mess.left( 9 ) == "cal_alarm") {
851 mAlarmMessage = mess.mid( 9 ) ; 859 mAlarmMessage = mess.mid( 9 ) ;
852 } 860 }
853 861
854 startAlarm( mAlarmMessage, filename ); 862 startAlarm( mAlarmMessage, filename );
855 863
856 864
857} 865}
858 866
859void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 867void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
860{ 868{
861 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 869 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
862 870
863 mSuspendAlarmNotification = noti; 871 mSuspendAlarmNotification = noti;
864 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 872 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
865 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 873 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
866 mSuspendTimer->start( ms , true ); 874 mSuspendTimer->start( ms , true );
867 875
868} 876}
869 877
870void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 878void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
871{ 879{
872 mNextAlarmDateTime = qdt; 880 mNextAlarmDateTime = qdt;
873 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 881 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
874 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 882 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
875#ifndef DESKTOP_VERSION 883#ifndef DESKTOP_VERSION
876 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 884 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
877#endif 885#endif
878 return; 886 return;
879 } 887 }
880 int maxSec; 888 int maxSec;
881 //maxSec = 5; //testing only 889 //maxSec = 5; //testing only
882 maxSec = 86400+3600; // one day+1hour 890 maxSec = 86400+3600; // one day+1hour
883 mAlarmNotification = noti; 891 mAlarmNotification = noti;
884 int sec = QDateTime::currentDateTime().secsTo( qdt ); 892 int sec = QDateTime::currentDateTime().secsTo( qdt );
885 if ( sec > maxSec ) { 893 if ( sec > maxSec ) {
886 mRecheckAlarmTimer->start( maxSec * 1000 ); 894 mRecheckAlarmTimer->start( maxSec * 1000 );
887 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 895 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
888 return; 896 return;
889 } else { 897 } else {
890 mRecheckAlarmTimer->stop(); 898 mRecheckAlarmTimer->stop();
891 } 899 }
892 //qDebug("Alarm timer started with secs: %d ", sec); 900 //qDebug("Alarm timer started with secs: %d ", sec);
893 mAlarmTimer->start( sec *1000 , true ); 901 mAlarmTimer->start( sec *1000 , true );
894 902
895} 903}
896// called by mRecheckAlarmTimer to get next alarm 904// called by mRecheckAlarmTimer to get next alarm
897// we need this, because a QTimer has only a max range of 25 days 905// we need this, because a QTimer has only a max range of 25 days
898void CalendarView::recheckTimerAlarm() 906void CalendarView::recheckTimerAlarm()
899{ 907{
900 mAlarmTimer->stop(); 908 mAlarmTimer->stop();
901 mRecheckAlarmTimer->stop(); 909 mRecheckAlarmTimer->stop();
902 mCalendar->checkAlarmForIncidence( 0, true ); 910 mCalendar->checkAlarmForIncidence( 0, true );
903} 911}
904void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 912void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
905{ 913{
906 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 914 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
907 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 915 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
908#ifndef DESKTOP_VERSION 916#ifndef DESKTOP_VERSION
909 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 917 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
910#endif 918#endif
911 return; 919 return;
912 } 920 }
913 mAlarmTimer->stop(); 921 mAlarmTimer->stop();
914} 922}
915void CalendarView::selectWeekNum ( int num ) 923void CalendarView::selectWeekNum ( int num )
916{ 924{
917 dateNavigator()->blockSignals( true ); 925 dateNavigator()->blockSignals( true );
918 dateNavigator()->selectWeek( num ); 926 dateNavigator()->selectWeek( num );
919 dateNavigator()->blockSignals( false ); 927 dateNavigator()->blockSignals( false );
920 mViewManager->showWeekView(); 928 mViewManager->showWeekView();
921} 929}
922KOViewManager *CalendarView::viewManager() 930KOViewManager *CalendarView::viewManager()
923{ 931{
924 return mViewManager; 932 return mViewManager;
925} 933}
926 934
927KODialogManager *CalendarView::dialogManager() 935KODialogManager *CalendarView::dialogManager()
928{ 936{
929 return mDialogManager; 937 return mDialogManager;
930} 938}
931 939
932QDate CalendarView::startDate() 940QDate CalendarView::startDate()
933{ 941{
934 DateList dates = mNavigator->selectedDates(); 942 DateList dates = mNavigator->selectedDates();
935 943
936 return dates.first(); 944 return dates.first();
937} 945}
938 946
939QDate CalendarView::endDate() 947QDate CalendarView::endDate()
940{ 948{
941 DateList dates = mNavigator->selectedDates(); 949 DateList dates = mNavigator->selectedDates();
942 950
943 return dates.last(); 951 return dates.last();
944} 952}
945 953
946 954
947void CalendarView::createPrinter() 955void CalendarView::createPrinter()
948{ 956{
949#ifndef KORG_NOPRINTER 957#ifndef KORG_NOPRINTER
950 if (!mCalPrinter) { 958 if (!mCalPrinter) {
951 mCalPrinter = new CalPrinter(this, mCalendar); 959 mCalPrinter = new CalPrinter(this, mCalendar);
952 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 960 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
953 } 961 }
954#endif 962#endif
955} 963}
956 964
957 965
958//KOPrefs::instance()->mWriteBackFile 966//KOPrefs::instance()->mWriteBackFile
959//KOPrefs::instance()->mWriteBackExistingOnly 967//KOPrefs::instance()->mWriteBackExistingOnly
960 968
961// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 969// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
962// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 970// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
963// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 971// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
964// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 972// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
965// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 973// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
966// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 974// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
967 975
968int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 976int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
969{ 977{
970 978
971 // 0 equal 979 // 0 equal
972 // 1 take local 980 // 1 take local
973 // 2 take remote 981 // 2 take remote
974 // 3 cancel 982 // 3 cancel
975 QDateTime lastSync = mLastCalendarSync; 983 QDateTime lastSync = mLastCalendarSync;
976 QDateTime localMod = local->lastModified(); 984 QDateTime localMod = local->lastModified();
977 QDateTime remoteMod = remote->lastModified(); 985 QDateTime remoteMod = remote->lastModified();
978 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 986 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
979 bool remCh, locCh; 987 bool remCh, locCh;
980 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 988 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
981 //if ( remCh ) 989 //if ( remCh )
982 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 990 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
983 locCh = ( localMod > mLastCalendarSync ); 991 locCh = ( localMod > mLastCalendarSync );
984 if ( !remCh && ! locCh ) { 992 if ( !remCh && ! locCh ) {
985 //qDebug("both not changed "); 993 //qDebug("both not changed ");
986 lastSync = localMod.addDays(1); 994 lastSync = localMod.addDays(1);
987 if ( mode <= SYNC_PREF_ASK ) 995 if ( mode <= SYNC_PREF_ASK )
988 return 0; 996 return 0;
989 } else { 997 } else {
990 if ( locCh ) { 998 if ( locCh ) {
991 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 999 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
992 lastSync = localMod.addDays( -1 ); 1000 lastSync = localMod.addDays( -1 );
993 if ( !remCh ) 1001 if ( !remCh )
994 remoteMod = ( lastSync.addDays( -1 ) ); 1002 remoteMod = ( lastSync.addDays( -1 ) );
995 } else { 1003 } else {
996 //qDebug(" not loc changed "); 1004 //qDebug(" not loc changed ");
997 lastSync = localMod.addDays( 1 ); 1005 lastSync = localMod.addDays( 1 );
998 if ( remCh ) 1006 if ( remCh )
999 remoteMod =( lastSync.addDays( 1 ) ); 1007 remoteMod =( lastSync.addDays( 1 ) );
1000 1008
1001 } 1009 }
1002 } 1010 }
1003 full = true; 1011 full = true;
1004 if ( mode < SYNC_PREF_ASK ) 1012 if ( mode < SYNC_PREF_ASK )
1005 mode = SYNC_PREF_ASK; 1013 mode = SYNC_PREF_ASK;
1006 } else { 1014 } else {
1007 if ( localMod == remoteMod ) 1015 if ( localMod == remoteMod )
1008 // if ( local->revision() == remote->revision() ) 1016 // if ( local->revision() == remote->revision() )
1009 return 0; 1017 return 0;
1010 1018
1011 } 1019 }
1012 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 1020 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
1013 1021
1014 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 1022 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
1015 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 1023 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
1016 //full = true; //debug only 1024 //full = true; //debug only
1017 if ( full ) { 1025 if ( full ) {
1018 bool equ = false; 1026 bool equ = false;
1019 if ( local->typeID() == eventID ) { 1027 if ( local->typeID() == eventID ) {
1020 equ = (*((Event*) local) == *((Event*) remote)); 1028 equ = (*((Event*) local) == *((Event*) remote));
1021 } 1029 }
1022 else if ( local->typeID() == todoID ) 1030 else if ( local->typeID() == todoID )
1023 equ = (*((Todo*) local) == (*(Todo*) remote)); 1031 equ = (*((Todo*) local) == (*(Todo*) remote));
1024 else if ( local->typeID() == journalID ) 1032 else if ( local->typeID() == journalID )
1025 equ = (*((Journal*) local) == *((Journal*) remote)); 1033 equ = (*((Journal*) local) == *((Journal*) remote));
1026 if ( equ ) { 1034 if ( equ ) {
1027 //qDebug("equal "); 1035 //qDebug("equal ");
1028 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1036 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1029 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 1037 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
1030 } 1038 }
1031 if ( mode < SYNC_PREF_FORCE_LOCAL ) 1039 if ( mode < SYNC_PREF_FORCE_LOCAL )
1032 return 0; 1040 return 0;
1033 1041
1034 }//else //debug only 1042 }//else //debug only
1035 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 1043 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
1036 } 1044 }
1037 int result; 1045 int result;
1038 bool localIsNew; 1046 bool localIsNew;
1039 //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() ); 1047 //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() );
1040 1048
1041 1049
1042 // ************************************************ 1050 // ************************************************
1043 // ************************************************ 1051 // ************************************************
1044 // ************************************************ 1052 // ************************************************
1045 // We may have that lastSync > remoteMod AND lastSync > localMod 1053 // We may have that lastSync > remoteMod AND lastSync > localMod
1046 // BUT remoteMod != localMod 1054 // BUT remoteMod != localMod
1047 1055
1048 1056
1049 if ( full && mode < SYNC_PREF_NEWEST ) 1057 if ( full && mode < SYNC_PREF_NEWEST )
1050 mode = SYNC_PREF_ASK; 1058 mode = SYNC_PREF_ASK;
1051 1059
1052 switch( mode ) { 1060 switch( mode ) {
1053 case SYNC_PREF_LOCAL: 1061 case SYNC_PREF_LOCAL:
1054 if ( lastSync > remoteMod ) 1062 if ( lastSync > remoteMod )
1055 return 1; 1063 return 1;
1056 if ( lastSync > localMod ) 1064 if ( lastSync > localMod )
1057 return 2; 1065 return 2;
1058 return 1; 1066 return 1;
1059 break; 1067 break;
1060 case SYNC_PREF_REMOTE: 1068 case SYNC_PREF_REMOTE:
1061 if ( lastSync > localMod ) 1069 if ( lastSync > localMod )
1062 return 2; 1070 return 2;
1063 if ( lastSync > remoteMod ) 1071 if ( lastSync > remoteMod )
1064 return 1; 1072 return 1;
1065 return 2; 1073 return 2;
1066 break; 1074 break;
1067 case SYNC_PREF_NEWEST: 1075 case SYNC_PREF_NEWEST:
1068 if ( localMod >= remoteMod ) 1076 if ( localMod >= remoteMod )
1069 return 1; 1077 return 1;
1070 else 1078 else
1071 return 2; 1079 return 2;
1072 break; 1080 break;
1073 case SYNC_PREF_ASK: 1081 case SYNC_PREF_ASK:
1074 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1082 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
1075 if ( lastSync > remoteMod && lastSync > localMod) 1083 if ( lastSync > remoteMod && lastSync > localMod)
1076 return 0; 1084 return 0;
1077 if ( lastSync > remoteMod ) 1085 if ( lastSync > remoteMod )
1078 return 1; 1086 return 1;
1079 if ( lastSync > localMod ) 1087 if ( lastSync > localMod )
1080 return 2; 1088 return 2;
1081 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 1089 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
1082 localIsNew = localMod >= remoteMod; 1090 localIsNew = localMod >= remoteMod;
1083 if ( localIsNew ) 1091 if ( localIsNew )
1084 getEventViewerDialog()->setColorMode( 1 ); 1092 getEventViewerDialog()->setColorMode( 1 );
1085 else 1093 else
1086 getEventViewerDialog()->setColorMode( 2 ); 1094 getEventViewerDialog()->setColorMode( 2 );
1087 getEventViewerDialog()->setIncidence(local); 1095 getEventViewerDialog()->setIncidence(local);
1088 if ( localIsNew ) 1096 if ( localIsNew )
1089 getEventViewerDialog()->setColorMode( 2 ); 1097 getEventViewerDialog()->setColorMode( 2 );
1090 else 1098 else
1091 getEventViewerDialog()->setColorMode( 1 ); 1099 getEventViewerDialog()->setColorMode( 1 );
1092 getEventViewerDialog()->addIncidence(remote); 1100 getEventViewerDialog()->addIncidence(remote);
1093 getEventViewerDialog()->setColorMode( 0 ); 1101 getEventViewerDialog()->setColorMode( 0 );
1094 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 1102 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
1095 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 1103 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
1096 getEventViewerDialog()->showMe(); 1104 getEventViewerDialog()->showMe();
1097 result = getEventViewerDialog()->executeS( localIsNew ); 1105 result = getEventViewerDialog()->executeS( localIsNew );
1098 return result; 1106 return result;
1099 1107
1100 break; 1108 break;
1101 case SYNC_PREF_FORCE_LOCAL: 1109 case SYNC_PREF_FORCE_LOCAL:
1102 return 1; 1110 return 1;
1103 break; 1111 break;
1104 case SYNC_PREF_FORCE_REMOTE: 1112 case SYNC_PREF_FORCE_REMOTE:
1105 return 2; 1113 return 2;
1106 break; 1114 break;
1107 1115
1108 default: 1116 default:
1109 // SYNC_PREF_TAKE_BOTH not implemented 1117 // SYNC_PREF_TAKE_BOTH not implemented
1110 break; 1118 break;
1111 } 1119 }
1112 return 0; 1120 return 0;
1113} 1121}
1114Event* CalendarView::getLastSyncEvent() 1122Event* CalendarView::getLastSyncEvent()
1115{ 1123{
1116 Event* lse; 1124 Event* lse;
1117 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 1125 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
1118 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 1126 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
1119 if (!lse) { 1127 if (!lse) {
1120 lse = new Event(); 1128 lse = new Event();
1121 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 1129 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
1122 QString sum = ""; 1130 QString sum = "";
1123 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 1131 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
1124 sum = "E: "; 1132 sum = "E: ";
1125 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 1133 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
1126 lse->setDtStart( mLastCalendarSync ); 1134 lse->setDtStart( mLastCalendarSync );
1127 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 1135 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
1128 lse->setCategories( i18n("SyncEvent") ); 1136 lse->setCategories( i18n("SyncEvent") );
1129 lse->setReadOnly( true ); 1137 lse->setReadOnly( true );
1130 mCalendar->addEvent( lse ); 1138 mCalendar->addEvent( lse );
1131 } 1139 }
1132 1140
1133 return lse; 1141 return lse;
1134 1142
1135} 1143}
1136 1144
1137// we check, if the to delete event has a id for a profile 1145// we check, if the to delete event has a id for a profile
1138// if yes, we set this id in the profile to delete 1146// if yes, we set this id in the profile to delete
1139void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 1147void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
1140{ 1148{
1141 if ( lastSync.count() == 0 ) { 1149 if ( lastSync.count() == 0 ) {
1142 //qDebug(" lastSync.count() == 0"); 1150 //qDebug(" lastSync.count() == 0");
1143 return; 1151 return;
1144 } 1152 }
1145 if ( toDelete->typeID() == journalID ) 1153 if ( toDelete->typeID() == journalID )
1146 return; 1154 return;
1147 1155
1148 Event* eve = lastSync.first(); 1156 Event* eve = lastSync.first();
1149 1157
1150 while ( eve ) { 1158 while ( eve ) {
1151 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 1159 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
1152 if ( !id.isEmpty() ) { 1160 if ( !id.isEmpty() ) {
1153 QString des = eve->description(); 1161 QString des = eve->description();
1154 QString pref = "e"; 1162 QString pref = "e";
1155 if ( toDelete->typeID() == todoID ) 1163 if ( toDelete->typeID() == todoID )
1156 pref = "t"; 1164 pref = "t";
1157 des += pref+ id + ","; 1165 des += pref+ id + ",";
1158 eve->setReadOnly( false ); 1166 eve->setReadOnly( false );
1159 eve->setDescription( des ); 1167 eve->setDescription( des );
1160 //qDebug("setdes %s ", des.latin1()); 1168 //qDebug("setdes %s ", des.latin1());
1161 eve->setReadOnly( true ); 1169 eve->setReadOnly( true );
1162 } 1170 }
1163 eve = lastSync.next(); 1171 eve = lastSync.next();
1164 } 1172 }
1165 1173
1166} 1174}
1167void CalendarView::checkExternalId( Incidence * inc ) 1175void CalendarView::checkExternalId( Incidence * inc )
1168{ 1176{
1169 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 1177 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
1170 checkExternSyncEvent( lastSync, inc ); 1178 checkExternSyncEvent( lastSync, inc );
1171 1179
1172} 1180}
1173bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 1181bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
1174{ 1182{
1175 bool syncOK = true; 1183 bool syncOK = true;
1176 int addedEvent = 0; 1184 int addedEvent = 0;
1177 int addedEventR = 0; 1185 int addedEventR = 0;
1178 int deletedEventR = 0; 1186 int deletedEventR = 0;
1179 int deletedEventL = 0; 1187 int deletedEventL = 0;
1180 int changedLocal = 0; 1188 int changedLocal = 0;
1181 int changedRemote = 0; 1189 int changedRemote = 0;
1182 int filteredIN = 0; 1190 int filteredIN = 0;
@@ -2075,1025 +2083,1027 @@ bool CalendarView::checkFileVersion(QString fn)
2075 setSyncDevice("deleteaftersync" ); 2083 setSyncDevice("deleteaftersync" );
2076 mSyncManager->mAskForPreferences = true; 2084 mSyncManager->mAskForPreferences = true;
2077 mSyncManager->mSyncAlgoPrefs = 3; 2085 mSyncManager->mSyncAlgoPrefs = 3;
2078 mSyncManager->mWriteBackFile = false; 2086 mSyncManager->mWriteBackFile = false;
2079 mSyncManager->mWriteBackExistingOnly = false; 2087 mSyncManager->mWriteBackExistingOnly = false;
2080 mSyncManager->mShowSyncSummary = false; 2088 mSyncManager->mShowSyncSummary = false;
2081 syncCalendar( fn, 3 ); 2089 syncCalendar( fn, 3 );
2082 Event * e = getLastSyncEvent(); 2090 Event * e = getLastSyncEvent();
2083 if ( e ) 2091 if ( e )
2084 mCalendar->deleteEvent( e ); 2092 mCalendar->deleteEvent( e );
2085 return true; 2093 return true;
2086} 2094}
2087bool CalendarView::saveCalendars() 2095bool CalendarView::saveCalendars()
2088{ 2096{
2089 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 2097 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
2090 KopiCalendarFile * cal = calendars.first(); 2098 KopiCalendarFile * cal = calendars.first();
2091 mCalendar->setDefaultCalendar( 1 ); 2099 mCalendar->setDefaultCalendar( 1 );
2092 mCalendar->setDefaultCalendarEnabledOnly(); 2100 mCalendar->setDefaultCalendarEnabledOnly();
2093 saveCalendar( MainWindow::defaultFileName() ); 2101 saveCalendar( MainWindow::defaultFileName() );
2094 cal = calendars.next(); 2102 cal = calendars.next();
2095 while ( cal ) { 2103 while ( cal ) {
2096 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) { 2104 if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
2097 mCalendar->setDefaultCalendar( cal->mCalNumber ); 2105 mCalendar->setDefaultCalendar( cal->mCalNumber );
2098 mCalendar->setDefaultCalendarEnabledOnly(); 2106 mCalendar->setDefaultCalendarEnabledOnly();
2099 if ( saveCalendar( cal->mFileName ) ) 2107 if ( saveCalendar( cal->mFileName ) )
2100 cal->mLoadDt = QDateTime::currentDateTime(); 2108 cal->mLoadDt = QDateTime::currentDateTime();
2101 } 2109 }
2102 cal = calendars.next(); 2110 cal = calendars.next();
2103 } 2111 }
2104 restoreCalendarSettings(); 2112 restoreCalendarSettings();
2105 return true; 2113 return true;
2106} 2114}
2107bool CalendarView::saveCalendar( QString filename ) 2115bool CalendarView::saveCalendar( QString filename )
2108{ 2116{
2109 2117
2110 // Store back all unsaved data into calendar object 2118 // Store back all unsaved data into calendar object
2111 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 2119 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
2112 if ( mViewManager->currentView() ) 2120 if ( mViewManager->currentView() )
2113 mViewManager->currentView()->flushView(); 2121 mViewManager->currentView()->flushView();
2114 2122
2115 2123
2116 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 2124 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
2117 mStorage->setSaveFormat( new ICalFormat() ); 2125 mStorage->setSaveFormat( new ICalFormat() );
2118 mStorage->setFileName( filename ); 2126 mStorage->setFileName( filename );
2119 bool success; 2127 bool success;
2120 success = mStorage->save(); 2128 success = mStorage->save();
2121 if ( !success ) { 2129 if ( !success ) {
2122 return false; 2130 return false;
2123 } 2131 }
2124 if ( filename == MainWindow::defaultFileName() ) { 2132 if ( filename == MainWindow::defaultFileName() ) {
2125 setLoadedFileVersion( lfv ); 2133 setLoadedFileVersion( lfv );
2126 watchSavedFile(); 2134 watchSavedFile();
2127 } 2135 }
2128 return true; 2136 return true;
2129} 2137}
2130 2138
2131void CalendarView::closeCalendar() 2139void CalendarView::closeCalendar()
2132{ 2140{
2133 2141
2134 // child windows no longer valid 2142 // child windows no longer valid
2135 clearAllViews(); 2143 clearAllViews();
2136 emit closingDown(); 2144 emit closingDown();
2137 2145
2138 mCalendar->close(); 2146 mCalendar->close();
2139 setModified(false); 2147 setModified(false);
2140 updateView(); 2148 updateView();
2141} 2149}
2142 2150
2143void CalendarView::archiveCalendar() 2151void CalendarView::archiveCalendar()
2144{ 2152{
2145 mDialogManager->showArchiveDialog(); 2153 mDialogManager->showArchiveDialog();
2146} 2154}
2147 2155
2148 2156
2149void CalendarView::readSettings() 2157void CalendarView::readSettings()
2150{ 2158{
2151 2159
2152 2160
2153 // mViewManager->showAgendaView(); 2161 // mViewManager->showAgendaView();
2154 QString str; 2162 QString str;
2155 //qDebug("CalendarView::readSettings() "); 2163 //qDebug("CalendarView::readSettings() ");
2156 // read settings from the KConfig, supplying reasonable 2164 // read settings from the KConfig, supplying reasonable
2157 // defaults where none are to be found 2165 // defaults where none are to be found
2158 KConfig *config = KOGlobals::config(); 2166 KConfig *config = KOGlobals::config();
2159#ifndef KORG_NOSPLITTER 2167#ifndef KORG_NOSPLITTER
2160 config->setGroup("KOrganizer Geometry"); 2168 config->setGroup("KOrganizer Geometry");
2161 2169
2162 QValueList<int> sizes = config->readIntListEntry("Separator1"); 2170 QValueList<int> sizes = config->readIntListEntry("Separator1");
2163 if (sizes.count() != 2) { 2171 if (sizes.count() != 2) {
2164 sizes << mDateNavigator->minimumSizeHint().width(); 2172 sizes << mDateNavigator->minimumSizeHint().width();
2165 sizes << 300; 2173 sizes << 300;
2166 } 2174 }
2167 mPanner->setSizes(sizes); 2175 mPanner->setSizes(sizes);
2168 2176
2169 sizes = config->readIntListEntry("Separator2"); 2177 sizes = config->readIntListEntry("Separator2");
2170 if ( ( mResourceView && sizes.count() == 4 ) || 2178 if ( ( mResourceView && sizes.count() == 4 ) ||
2171 ( !mResourceView && sizes.count() == 3 ) ) { 2179 ( !mResourceView && sizes.count() == 3 ) ) {
2172 mLeftSplitter->setSizes(sizes); 2180 mLeftSplitter->setSizes(sizes);
2173 } 2181 }
2174#endif 2182#endif
2175 globalFlagBlockAgenda = 1; 2183 globalFlagBlockAgenda = 1;
2176 mViewManager->showAgendaView(); 2184 mViewManager->showAgendaView();
2177 //mViewManager->readSettings( config ); 2185 //mViewManager->readSettings( config );
2178 mTodoList->restoreLayout(config,QString("Todo Layout")); 2186 mTodoList->restoreLayout(config,QString("Todo Layout"));
2179 readFilterSettings(config); 2187 readFilterSettings(config);
2180 2188
2181#ifdef DESKTOP_VERSION 2189#ifdef DESKTOP_VERSION
2182 config->setGroup("WidgetLayout"); 2190 config->setGroup("WidgetLayout");
2183 QStringList list; 2191 QStringList list;
2184 list = config->readListEntry("MainLayout"); 2192 list = config->readListEntry("MainLayout");
2185 int x,y,w,h; 2193 int x,y,w,h;
2186 if ( ! list.isEmpty() ) { 2194 if ( ! list.isEmpty() ) {
2187 x = list[0].toInt(); 2195 x = list[0].toInt();
2188 y = list[1].toInt(); 2196 y = list[1].toInt();
2189 w = list[2].toInt(); 2197 w = list[2].toInt();
2190 h = list[3].toInt(); 2198 h = list[3].toInt();
2191 KApplication::testCoords( &x,&y,&w,&h ); 2199 KApplication::testCoords( &x,&y,&w,&h );
2192 topLevelWidget()->setGeometry(x,y,w,h); 2200 topLevelWidget()->setGeometry(x,y,w,h);
2193 2201
2194 } else { 2202 } else {
2195 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 2203 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
2196 } 2204 }
2197 list = config->readListEntry("EditEventLayout"); 2205 list = config->readListEntry("EditEventLayout");
2198 if ( ! list.isEmpty() ) { 2206 if ( ! list.isEmpty() ) {
2199 x = list[0].toInt(); 2207 x = list[0].toInt();
2200 y = list[1].toInt(); 2208 y = list[1].toInt();
2201 w = list[2].toInt(); 2209 w = list[2].toInt();
2202 h = list[3].toInt(); 2210 h = list[3].toInt();
2203 KApplication::testCoords( &x,&y,&w,&h ); 2211 KApplication::testCoords( &x,&y,&w,&h );
2204 mEventEditor->setGeometry(x,y,w,h); 2212 mEventEditor->setGeometry(x,y,w,h);
2205 2213
2206 } 2214 }
2207 list = config->readListEntry("EditTodoLayout"); 2215 list = config->readListEntry("EditTodoLayout");
2208 if ( ! list.isEmpty() ) { 2216 if ( ! list.isEmpty() ) {
2209 x = list[0].toInt(); 2217 x = list[0].toInt();
2210 y = list[1].toInt(); 2218 y = list[1].toInt();
2211 w = list[2].toInt(); 2219 w = list[2].toInt();
2212 h = list[3].toInt(); 2220 h = list[3].toInt();
2213 KApplication::testCoords( &x,&y,&w,&h ); 2221 KApplication::testCoords( &x,&y,&w,&h );
2214 mTodoEditor->setGeometry(x,y,w,h); 2222 mTodoEditor->setGeometry(x,y,w,h);
2215 2223
2216 } 2224 }
2217 list = config->readListEntry("ViewerLayout"); 2225 list = config->readListEntry("ViewerLayout");
2218 if ( ! list.isEmpty() ) { 2226 if ( ! list.isEmpty() ) {
2219 x = list[0].toInt(); 2227 x = list[0].toInt();
2220 y = list[1].toInt(); 2228 y = list[1].toInt();
2221 w = list[2].toInt(); 2229 w = list[2].toInt();
2222 h = list[3].toInt(); 2230 h = list[3].toInt();
2223 KApplication::testCoords( &x,&y,&w,&h ); 2231 KApplication::testCoords( &x,&y,&w,&h );
2224 getEventViewerDialog()->setGeometry(x,y,w,h); 2232 getEventViewerDialog()->setGeometry(x,y,w,h);
2225 } 2233 }
2226#endif 2234#endif
2227 config->setGroup( "Views" ); 2235 config->setGroup( "Views" );
2228 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 2236 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
2229 2237
2230 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 2238 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
2231 2239
2232 int resetval = 0; 2240 int resetval = 0;
2233 int maxVal = 0; 2241 int maxVal = 0;
2234 if (sizes.count() != 3) { 2242 if (sizes.count() != 3) {
2235 if ( KOPrefs::instance()->mVerticalScreen ) { 2243 if ( KOPrefs::instance()->mVerticalScreen ) {
2236 resetval = mDateNavigator->sizeHint().width()+2; 2244 resetval = mDateNavigator->sizeHint().width()+2;
2237 } else { 2245 } else {
2238 resetval = mDateNavigator->sizeHint().height()+2; 2246 resetval = mDateNavigator->sizeHint().height()+2;
2239 } 2247 }
2240 } 2248 }
2241 if ( resetval ) { 2249 if ( resetval ) {
2242 sizes.clear(); 2250 sizes.clear();
2243 if ( KOPrefs::instance()->mVerticalScreen ) { 2251 if ( KOPrefs::instance()->mVerticalScreen ) {
2244 maxVal = QApplication::desktop()->width() -10; 2252 maxVal = QApplication::desktop()->width() -10;
2245 } else { 2253 } else {
2246 maxVal = QApplication::desktop()->height()-10; 2254 maxVal = QApplication::desktop()->height()-10;
2247 } 2255 }
2248 sizes << resetval; 2256 sizes << resetval;
2249 if ( maxVal < resetval + resetval) 2257 if ( maxVal < resetval + resetval)
2250 resetval = maxVal - resetval; 2258 resetval = maxVal - resetval;
2251 sizes << resetval; 2259 sizes << resetval;
2252 sizes << 100; 2260 sizes << 100;
2253 } 2261 }
2254 mLeftFrame->setSizes(sizes); 2262 mLeftFrame->setSizes(sizes);
2255 sizes = config->readIntListEntry("Main Splitter Frame"); 2263 sizes = config->readIntListEntry("Main Splitter Frame");
2256 resetval = 0; 2264 resetval = 0;
2257 maxVal = 0; 2265 maxVal = 0;
2258 if (sizes.count() != 2) { 2266 if (sizes.count() != 2) {
2259 if ( !KOPrefs::instance()->mVerticalScreen ) { 2267 if ( !KOPrefs::instance()->mVerticalScreen ) {
2260 resetval = mDateNavigator->sizeHint().width()+2; 2268 resetval = mDateNavigator->sizeHint().width()+2;
2261 } else { 2269 } else {
2262 resetval = mDateNavigator->sizeHint().height()+2; 2270 resetval = mDateNavigator->sizeHint().height()+2;
2263 } 2271 }
2264 } 2272 }
2265 if ( resetval ) { 2273 if ( resetval ) {
2266 sizes.clear(); 2274 sizes.clear();
2267 if ( !KOPrefs::instance()->mVerticalScreen ) { 2275 if ( !KOPrefs::instance()->mVerticalScreen ) {
2268 maxVal = QApplication::desktop()->width() -10; 2276 maxVal = QApplication::desktop()->width() -10;
2269 } else { 2277 } else {
2270 maxVal = QApplication::desktop()->height()-10; 2278 maxVal = QApplication::desktop()->height()-10;
2271 } 2279 }
2272 sizes << resetval; 2280 sizes << resetval;
2273 if ( maxVal < resetval + resetval) 2281 if ( maxVal < resetval + resetval)
2274 resetval = maxVal - resetval; 2282 resetval = maxVal - resetval;
2275 sizes << resetval; 2283 sizes << resetval;
2276 } 2284 }
2277 mMainFrame->setSizes(sizes); 2285 mMainFrame->setSizes(sizes);
2278 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 2286 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
2279 else if ( dateCount == 7 ) mNavigator->selectWeek(); 2287 else if ( dateCount == 7 ) mNavigator->selectWeek();
2280 else mNavigator->selectDates( dateCount ); 2288 else mNavigator->selectDates( dateCount );
2281 // mViewManager->readSettings( config ); 2289 // mViewManager->readSettings( config );
2282 updateConfig(); 2290 updateConfig();
2283 globalFlagBlockAgenda = 2; 2291 globalFlagBlockAgenda = 2;
2284 mViewManager->readSettings( config ); 2292 mViewManager->readSettings( config );
2285 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); 2293 QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
2286} 2294}
2287 2295
2288 2296
2289void CalendarView::writeSettings() 2297void CalendarView::writeSettings()
2290{ 2298{
2291 // kdDebug() << "CalendarView::writeSettings" << endl; 2299 // kdDebug() << "CalendarView::writeSettings" << endl;
2292 2300
2293 KConfig *config = KOGlobals::config(); 2301 KConfig *config = KOGlobals::config();
2294 2302
2295 mViewManager->writeSettings( config ); 2303 mViewManager->writeSettings( config );
2296 mTodoList->saveLayout(config,QString("Todo Layout")); 2304 mTodoList->saveLayout(config,QString("Todo Layout"));
2297 mDialogManager->writeSettings( config ); 2305 mDialogManager->writeSettings( config );
2298 //KOPrefs::instance()->usrWriteConfig(); 2306 //KOPrefs::instance()->usrWriteConfig();
2299 KOPrefs::instance()->writeConfig(); 2307 KOPrefs::instance()->writeConfig();
2300 2308
2301 writeFilterSettings(config); 2309 writeFilterSettings(config);
2302 config->setGroup( "AppRun" ); 2310 config->setGroup( "AppRun" );
2303 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 2311 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2304 int days = dt.daysTo( QDate::currentDate() ); 2312 int days = dt.daysTo( QDate::currentDate() );
2305 dt = dt.addDays( days ); 2313 dt = dt.addDays( days );
2306 int secs = dt.secsTo( QDateTime::currentDateTime() ); 2314 int secs = dt.secsTo( QDateTime::currentDateTime() );
2307 config->writeEntry( "LatestProgramStopDays", days ); 2315 config->writeEntry( "LatestProgramStopDays", days );
2308 config->writeEntry( "LatestProgramStopSecs", secs ); 2316 config->writeEntry( "LatestProgramStopSecs", secs );
2309 //qDebug("KO: Writing stop time: %d ", secs); 2317 //qDebug("KO: Writing stop time: %d ", secs);
2310 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 2318 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
2311 //QDateTime latest = dt.addSecs ( secs ); 2319 //QDateTime latest = dt.addSecs ( secs );
2312 //qDebug("KO: Termination on %s ", latest.toString().latin1()); 2320 //qDebug("KO: Termination on %s ", latest.toString().latin1());
2313 config->setGroup( "Views" ); 2321 config->setGroup( "Views" );
2314 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2322 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
2315 2323
2316#if 0 2324#if 0
2317 qDebug("********************* "); 2325 qDebug("********************* ");
2318 qDebug("Testcode secsto "); 2326 qDebug("Testcode secsto ");
2319 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); 2327 QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
2320 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); 2328 QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
2321 int secsto = dt_nodaylight.secsTo( dt_daylight ); 2329 int secsto = dt_nodaylight.secsTo( dt_daylight );
2322 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); 2330 QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
2323 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); 2331 qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
2324 qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); 2332 qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
2325 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); 2333 qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
2326 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); 2334 qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
2327 qDebug("********************* testcode end"); 2335 qDebug("********************* testcode end");
2328 2336
2329#endif 2337#endif
2330 2338
2331 QValueList<int> listINT = mLeftFrame->sizes(); 2339 QValueList<int> listINT = mLeftFrame->sizes();
2332 config->writeEntry("Left Splitter Frame",listINT); 2340 config->writeEntry("Left Splitter Frame",listINT);
2333 QValueList<int> listINT2 = mMainFrame->sizes(); 2341 QValueList<int> listINT2 = mMainFrame->sizes();
2334 config->writeEntry("Main Splitter Frame",listINT2); 2342 config->writeEntry("Main Splitter Frame",listINT2);
2335#ifdef DESKTOP_VERSION 2343#ifdef DESKTOP_VERSION
2336 config->setGroup("WidgetLayout"); 2344 config->setGroup("WidgetLayout");
2337 QStringList list ;//= config->readListEntry("MainLayout"); 2345 QStringList list ;//= config->readListEntry("MainLayout");
2338 int x,y,w,h; 2346 int x,y,w,h;
2339 QWidget* wid; 2347 QWidget* wid;
2340 wid = topLevelWidget(); 2348 wid = topLevelWidget();
2341 x = wid->geometry().x(); 2349 x = wid->geometry().x();
2342 y = wid->geometry().y(); 2350 y = wid->geometry().y();
2343 w = wid->width(); 2351 w = wid->width();
2344 h = wid->height(); 2352 h = wid->height();
2345 list.clear(); 2353 list.clear();
2346 list << QString::number( x ); 2354 list << QString::number( x );
2347 list << QString::number( y ); 2355 list << QString::number( y );
2348 list << QString::number( w ); 2356 list << QString::number( w );
2349 list << QString::number( h ); 2357 list << QString::number( h );
2350 config->writeEntry("MainLayout",list ); 2358 config->writeEntry("MainLayout",list );
2351 2359
2352 wid = mEventEditor; 2360 wid = mEventEditor;
2353 x = wid->geometry().x(); 2361 x = wid->geometry().x();
2354 y = wid->geometry().y(); 2362 y = wid->geometry().y();
2355 w = wid->width(); 2363 w = wid->width();
2356 h = wid->height(); 2364 h = wid->height();
2357 list.clear(); 2365 list.clear();
2358 list << QString::number( x ); 2366 list << QString::number( x );
2359 list << QString::number( y ); 2367 list << QString::number( y );
2360 list << QString::number( w ); 2368 list << QString::number( w );
2361 list << QString::number( h ); 2369 list << QString::number( h );
2362 config->writeEntry("EditEventLayout",list ); 2370 config->writeEntry("EditEventLayout",list );
2363 2371
2364 wid = mTodoEditor; 2372 wid = mTodoEditor;
2365 x = wid->geometry().x(); 2373 x = wid->geometry().x();
2366 y = wid->geometry().y(); 2374 y = wid->geometry().y();
2367 w = wid->width(); 2375 w = wid->width();
2368 h = wid->height(); 2376 h = wid->height();
2369 list.clear(); 2377 list.clear();
2370 list << QString::number( x ); 2378 list << QString::number( x );
2371 list << QString::number( y ); 2379 list << QString::number( y );
2372 list << QString::number( w ); 2380 list << QString::number( w );
2373 list << QString::number( h ); 2381 list << QString::number( h );
2374 config->writeEntry("EditTodoLayout",list ); 2382 config->writeEntry("EditTodoLayout",list );
2375 wid = getEventViewerDialog(); 2383 wid = getEventViewerDialog();
2376 x = wid->geometry().x(); 2384 x = wid->geometry().x();
2377 y = wid->geometry().y(); 2385 y = wid->geometry().y();
2378 w = wid->width(); 2386 w = wid->width();
2379 h = wid->height(); 2387 h = wid->height();
2380 list.clear(); 2388 list.clear();
2381 list << QString::number( x ); 2389 list << QString::number( x );
2382 list << QString::number( y ); 2390 list << QString::number( y );
2383 list << QString::number( w ); 2391 list << QString::number( w );
2384 list << QString::number( h ); 2392 list << QString::number( h );
2385 config->writeEntry("ViewerLayout",list ); 2393 config->writeEntry("ViewerLayout",list );
2386 wid = mDialogManager->getSearchDialog(); 2394 wid = mDialogManager->getSearchDialog();
2387 if ( wid ) { 2395 if ( wid ) {
2388 x = wid->geometry().x(); 2396 x = wid->geometry().x();
2389 y = wid->geometry().y(); 2397 y = wid->geometry().y();
2390 w = wid->width(); 2398 w = wid->width();
2391 h = wid->height(); 2399 h = wid->height();
2392 list.clear(); 2400 list.clear();
2393 list << QString::number( x ); 2401 list << QString::number( x );
2394 list << QString::number( y ); 2402 list << QString::number( y );
2395 list << QString::number( w ); 2403 list << QString::number( w );
2396 list << QString::number( h ); 2404 list << QString::number( h );
2397 config->writeEntry("SearchLayout",list ); 2405 config->writeEntry("SearchLayout",list );
2398 } 2406 }
2399#endif 2407#endif
2400 2408
2401 2409
2402 config->sync(); 2410 config->sync();
2403} 2411}
2404 2412
2405void CalendarView::readFilterSettings(KConfig *config) 2413void CalendarView::readFilterSettings(KConfig *config)
2406{ 2414{
2407 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2415 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2408 2416
2409 mFilters.clear(); 2417 mFilters.clear();
2410 2418
2411 config->setGroup("General"); 2419 config->setGroup("General");
2412 QStringList filterList = config->readListEntry("CalendarFilters"); 2420 QStringList filterList = config->readListEntry("CalendarFilters");
2413 2421
2414 QStringList::ConstIterator it = filterList.begin(); 2422 QStringList::ConstIterator it = filterList.begin();
2415 QStringList::ConstIterator end = filterList.end(); 2423 QStringList::ConstIterator end = filterList.end();
2416 while(it != end) { 2424 while(it != end) {
2417 // kdDebug() << " filter: " << (*it) << endl; 2425 // kdDebug() << " filter: " << (*it) << endl;
2418 2426
2419 CalFilter *filter; 2427 CalFilter *filter;
2420 filter = new CalFilter(*it); 2428 filter = new CalFilter(*it);
2421 config->setGroup("Filter_" + (*it).utf8()); 2429 config->setGroup("Filter_" + (*it).utf8());
2422 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2430 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2423 filter->setCriteria(config->readNumEntry("Criteria",0)); 2431 filter->setCriteria(config->readNumEntry("Criteria",0));
2424 filter->setCategoryList(config->readListEntry("CategoryList")); 2432 filter->setCategoryList(config->readListEntry("CategoryList"));
2425 mFilters.append(filter); 2433 mFilters.append(filter);
2426 2434
2427 ++it; 2435 ++it;
2428 } 2436 }
2429 2437
2430 if (mFilters.count() == 0) { 2438 if (mFilters.count() == 0) {
2431 CalFilter *filter = new CalFilter(i18n("Default")); 2439 CalFilter *filter = new CalFilter(i18n("Default"));
2432 mFilters.append(filter); 2440 mFilters.append(filter);
2433 } 2441 }
2434 mFilterView->updateFilters(); 2442 mFilterView->updateFilters();
2435 config->setGroup("FilterView"); 2443 config->setGroup("FilterView");
2436 2444
2437 mFilterView->blockSignals(true); 2445 mFilterView->blockSignals(true);
2438 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 2446 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
2439 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 2447 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
2440 mFilterView->blockSignals(false); 2448 mFilterView->blockSignals(false);
2441 // We do it manually to avoid it being done twice by the above calls 2449 // We do it manually to avoid it being done twice by the above calls
2442 updateFilter(); 2450 updateFilter();
2443} 2451}
2444 2452
2445void CalendarView::writeFilterSettings(KConfig *config) 2453void CalendarView::writeFilterSettings(KConfig *config)
2446{ 2454{
2447 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2455 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2448 2456
2449 QStringList filterList; 2457 QStringList filterList;
2450 2458
2451 CalFilter *filter = mFilters.first(); 2459 CalFilter *filter = mFilters.first();
2452 while(filter) { 2460 while(filter) {
2453 // kdDebug() << " fn: " << filter->name() << endl; 2461 // kdDebug() << " fn: " << filter->name() << endl;
2454 filterList << filter->name(); 2462 filterList << filter->name();
2455 config->setGroup("Filter_" + filter->name().utf8()); 2463 config->setGroup("Filter_" + filter->name().utf8());
2456 config->writeEntry("Criteria",filter->criteria()); 2464 config->writeEntry("Criteria",filter->criteria());
2457 config->writeEntry("CategoryList",filter->categoryList()); 2465 config->writeEntry("CategoryList",filter->categoryList());
2458 filter = mFilters.next(); 2466 filter = mFilters.next();
2459 } 2467 }
2460 config->setGroup("General"); 2468 config->setGroup("General");
2461 config->writeEntry("CalendarFilters",filterList); 2469 config->writeEntry("CalendarFilters",filterList);
2462 2470
2463 config->setGroup("FilterView"); 2471 config->setGroup("FilterView");
2464 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2472 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2465 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2473 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2466} 2474}
2467 2475
2468 2476
2469void CalendarView::goToday() 2477void CalendarView::goToday()
2470{ 2478{
2471 if ( mViewManager->currentView()->isMonthView() ) 2479 if ( mViewManager->currentView()->isMonthView() )
2472 mNavigator->selectTodayMonth(); 2480 mNavigator->selectTodayMonth();
2473 else 2481 else
2474 mNavigator->selectToday(); 2482 mNavigator->selectToday();
2475} 2483}
2476 2484
2477void CalendarView::goNext() 2485void CalendarView::goNext()
2478{ 2486{
2479 mNavigator->selectNext(); 2487 mNavigator->selectNext();
2480} 2488}
2481 2489
2482void CalendarView::goPrevious() 2490void CalendarView::goPrevious()
2483{ 2491{
2484 mNavigator->selectPrevious(); 2492 mNavigator->selectPrevious();
2485} 2493}
2486void CalendarView::goNextMonth() 2494void CalendarView::goNextMonth()
2487{ 2495{
2488 mNavigator->selectNextMonth(); 2496 mNavigator->selectNextMonth();
2489} 2497}
2490 2498
2491void CalendarView::goPreviousMonth() 2499void CalendarView::goPreviousMonth()
2492{ 2500{
2493 mNavigator->selectPreviousMonth(); 2501 mNavigator->selectPreviousMonth();
2494} 2502}
2495 2503
2496void CalendarView::updateConfig() 2504void CalendarView::updateConfig()
2497{ 2505{
2498 if ( KOPrefs::instance()->mUseAppColors ) 2506 if ( KOPrefs::instance()->mUseAppColors )
2499 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2507 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2500 emit configChanged(); 2508 emit configChanged();
2501 mTodoList->updateConfig(); 2509 mTodoList->updateConfig();
2502 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2510 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2503 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2511 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2504 // To make the "fill window" configurations work 2512 // To make the "fill window" configurations work
2505 //mViewManager->raiseCurrentView(); 2513 //mViewManager->raiseCurrentView();
2506} 2514}
2507 2515
2508 2516
2509void CalendarView::eventChanged(Event *event) 2517void CalendarView::eventChanged(Event *event)
2510{ 2518{
2511 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2519 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2512 //updateUnmanagedViews(); 2520 //updateUnmanagedViews();
2513} 2521}
2514 2522
2515void CalendarView::eventAdded(Event *event) 2523void CalendarView::eventAdded(Event *event)
2516{ 2524{
2517 changeEventDisplay(event,KOGlobals::EVENTADDED); 2525 changeEventDisplay(event,KOGlobals::EVENTADDED);
2518} 2526}
2519 2527
2520void CalendarView::eventToBeDeleted(Event *) 2528void CalendarView::eventToBeDeleted(Event *)
2521{ 2529{
2522 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2530 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2523} 2531}
2524 2532
2525void CalendarView::eventDeleted() 2533void CalendarView::eventDeleted()
2526{ 2534{
2527 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2535 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2528} 2536}
2529void CalendarView::changeTodoDisplay(Todo *which, int action) 2537void CalendarView::changeTodoDisplay(Todo *which, int action)
2530{ 2538{
2531 changeIncidenceDisplay((Incidence *)which, action); 2539 changeIncidenceDisplay((Incidence *)which, action);
2532 mDateNavigator->updateView(); //LR 2540 mDateNavigator->updateView(); //LR
2533 //mDialogManager->updateSearchDialog(); 2541 //mDialogManager->updateSearchDialog();
2534 2542
2535 if (which) { 2543 if (which) {
2536 mViewManager->updateWNview(); 2544 mViewManager->updateWNview();
2537 //mTodoList->updateView(); 2545 //mTodoList->updateView();
2538 } 2546 }
2539 2547
2540} 2548}
2541 2549
2542void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2550void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2543{ 2551{
2544 updateUnmanagedViews(); 2552 updateUnmanagedViews();
2545 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2553 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2546 if ( action == KOGlobals::EVENTDELETED ) { //delete 2554 if ( action == KOGlobals::EVENTDELETED ) { //delete
2547 mCalendar->checkAlarmForIncidence( 0, true ); 2555 mCalendar->checkAlarmForIncidence( 0, true );
2548 if ( mEventViewerDialog ) 2556 if ( mEventViewerDialog )
2549 mEventViewerDialog->hide(); 2557 mEventViewerDialog->hide();
2550 } 2558 }
2551 else 2559 else
2552 mCalendar->checkAlarmForIncidence( which , false ); 2560 mCalendar->checkAlarmForIncidence( which , false );
2553} 2561}
2554 2562
2555// most of the changeEventDisplays() right now just call the view's 2563// most of the changeEventDisplays() right now just call the view's
2556// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2564// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2557void CalendarView::changeEventDisplay(Event *which, int action) 2565void CalendarView::changeEventDisplay(Event *which, int action)
2558{ 2566{
2559 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2567 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2560 changeIncidenceDisplay((Incidence *)which, action); 2568 changeIncidenceDisplay((Incidence *)which, action);
2561 mDateNavigator->updateView(); 2569 mDateNavigator->updateView();
2562 //mDialogManager->updateSearchDialog(); 2570 //mDialogManager->updateSearchDialog();
2563 2571
2564 if (which) { 2572 if (which) {
2565 // If there is an event view visible update the display 2573 // If there is an event view visible update the display
2566 mViewManager->currentView()->changeEventDisplay(which,action); 2574 mViewManager->currentView()->changeEventDisplay(which,action);
2567 // TODO: check, if update needed 2575 // TODO: check, if update needed
2568 // if (which->getTodoStatus()) { 2576 // if (which->getTodoStatus()) {
2569 mTodoList->updateView(); 2577 mTodoList->updateView();
2570 // } 2578 // }
2571 } else { 2579 } else {
2572 mViewManager->currentView()->updateView(); 2580 mViewManager->currentView()->updateView();
2573 } 2581 }
2574} 2582}
2575 2583
2576 2584
2577void CalendarView::updateTodoViews() 2585void CalendarView::updateTodoViews()
2578{ 2586{
2579 mTodoList->updateView(); 2587 mTodoList->updateView();
2580 mViewManager->currentView()->updateView(); 2588 mViewManager->currentView()->updateView();
2581 2589
2582} 2590}
2583 2591
2584 2592
2585void CalendarView::updateView(const QDate &start, const QDate &end) 2593void CalendarView::updateView(const QDate &start, const QDate &end)
2586{ 2594{
2595#ifdef DESKTOP_VERSION
2587 mDateScrollBar->setValue( start.dayOfYear()-1); 2596 mDateScrollBar->setValue( start.dayOfYear()-1);
2597#endif
2588 mTodoList->updateView(); 2598 mTodoList->updateView();
2589 mViewManager->updateView(start, end); 2599 mViewManager->updateView(start, end);
2590 //mDateNavigator->updateView(); 2600 //mDateNavigator->updateView();
2591} 2601}
2592 2602
2593void CalendarView::clearAllViews() 2603void CalendarView::clearAllViews()
2594{ 2604{
2595 mTodoList->clearList(); 2605 mTodoList->clearList();
2596 mViewManager->clearAllViews(); 2606 mViewManager->clearAllViews();
2597 SearchDialog * sd = mDialogManager->getSearchDialog(); 2607 SearchDialog * sd = mDialogManager->getSearchDialog();
2598 if ( sd ) { 2608 if ( sd ) {
2599 KOListView* kol = sd->listview(); 2609 KOListView* kol = sd->listview();
2600 if ( kol ) 2610 if ( kol )
2601 kol->clearList(); 2611 kol->clearList();
2602 } 2612 }
2603} 2613}
2604void CalendarView::updateView() 2614void CalendarView::updateView()
2605{ 2615{
2606 DateList tmpList = mNavigator->selectedDates(); 2616 DateList tmpList = mNavigator->selectedDates();
2607 2617
2608 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2618 if ( KOPrefs::instance()->mHideNonStartedTodos )
2609 mTodoList->updateView(); 2619 mTodoList->updateView();
2610 // We assume that the navigator only selects consecutive days. 2620 // We assume that the navigator only selects consecutive days.
2611 updateView( tmpList.first(), tmpList.last() ); 2621 updateView( tmpList.first(), tmpList.last() );
2612} 2622}
2613 2623
2614void CalendarView::updateUnmanagedViews() 2624void CalendarView::updateUnmanagedViews()
2615{ 2625{
2616 mDateNavigator->updateDayMatrix(); 2626 mDateNavigator->updateDayMatrix();
2617} 2627}
2618 2628
2619int CalendarView::msgItemDelete(const QString name) 2629int CalendarView::msgItemDelete(const QString name)
2620{ 2630{
2621 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2631 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2622 i18n("This item will be\npermanently deleted."), 2632 i18n("This item will be\npermanently deleted."),
2623 i18n("KO/Pi Confirmation"),i18n("Delete")); 2633 i18n("KO/Pi Confirmation"),i18n("Delete"));
2624} 2634}
2625 2635
2626 2636
2627void CalendarView::edit_cut() 2637void CalendarView::edit_cut()
2628{ 2638{
2629 Event *anEvent=0; 2639 Event *anEvent=0;
2630 2640
2631 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2641 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2632 2642
2633 if (mViewManager->currentView()->isEventView()) { 2643 if (mViewManager->currentView()->isEventView()) {
2634 if ( incidence && incidence->typeID() == eventID ) { 2644 if ( incidence && incidence->typeID() == eventID ) {
2635 anEvent = static_cast<Event *>(incidence); 2645 anEvent = static_cast<Event *>(incidence);
2636 } 2646 }
2637 } 2647 }
2638 2648
2639 if (!anEvent) { 2649 if (!anEvent) {
2640 KNotifyClient::beep(); 2650 KNotifyClient::beep();
2641 return; 2651 return;
2642 } 2652 }
2643 DndFactory factory( mCalendar ); 2653 DndFactory factory( mCalendar );
2644 factory.cutIncidence(anEvent); 2654 factory.cutIncidence(anEvent);
2645 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2655 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2646} 2656}
2647 2657
2648void CalendarView::edit_copy() 2658void CalendarView::edit_copy()
2649{ 2659{
2650 Event *anEvent=0; 2660 Event *anEvent=0;
2651 2661
2652 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2662 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2653 2663
2654 if (mViewManager->currentView()->isEventView()) { 2664 if (mViewManager->currentView()->isEventView()) {
2655 if ( incidence && incidence->typeID() == eventID ) { 2665 if ( incidence && incidence->typeID() == eventID ) {
2656 anEvent = static_cast<Event *>(incidence); 2666 anEvent = static_cast<Event *>(incidence);
2657 } 2667 }
2658 } 2668 }
2659 2669
2660 if (!anEvent) { 2670 if (!anEvent) {
2661 KNotifyClient::beep(); 2671 KNotifyClient::beep();
2662 return; 2672 return;
2663 } 2673 }
2664 DndFactory factory( mCalendar ); 2674 DndFactory factory( mCalendar );
2665 factory.copyIncidence(anEvent); 2675 factory.copyIncidence(anEvent);
2666} 2676}
2667 2677
2668void CalendarView::edit_paste() 2678void CalendarView::edit_paste()
2669{ 2679{
2670 QDate date = mNavigator->selectedDates().first(); 2680 QDate date = mNavigator->selectedDates().first();
2671 2681
2672 DndFactory factory( mCalendar ); 2682 DndFactory factory( mCalendar );
2673 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2683 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2674 2684
2675 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2685 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2676} 2686}
2677void CalendarView::edit_global_options() 2687void CalendarView::edit_global_options()
2678{ 2688{
2679 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2689 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2680 emit save(); 2690 emit save();
2681 emit saveStopTimer(); 2691 emit saveStopTimer();
2682 mDialogManager->showGlobalOptionsDialog(); 2692 mDialogManager->showGlobalOptionsDialog();
2683 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2693 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2684 emit saveStopTimer(); 2694 emit saveStopTimer();
2685 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), 2695 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"),
2686 i18n("Timezone settings"),i18n("Reload"))) { 2696 i18n("Timezone settings"),i18n("Reload"))) {
2687 qDebug("KO: TZ reload cancelled "); 2697 qDebug("KO: TZ reload cancelled ");
2688 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2698 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2689 return; 2699 return;
2690 } 2700 }
2691 qDebug("KO: Timezone change "); 2701 qDebug("KO: Timezone change ");
2692 loadCalendars(); 2702 loadCalendars();
2693 setModified(true); 2703 setModified(true);
2694 } 2704 }
2695 else 2705 else
2696 qDebug("KO: No tz change "); 2706 qDebug("KO: No tz change ");
2697} 2707}
2698void CalendarView::edit_options() 2708void CalendarView::edit_options()
2699{ 2709{
2700 mDialogManager->showOptionsDialog(); 2710 mDialogManager->showOptionsDialog();
2701} 2711}
2702 2712
2703 2713
2704void CalendarView::slotSelectPickerDate( QDate d) 2714void CalendarView::slotSelectPickerDate( QDate d)
2705{ 2715{
2706 mDateFrame->hide(); 2716 mDateFrame->hide();
2707 if ( mDatePickerMode == 1 ) { 2717 if ( mDatePickerMode == 1 ) {
2708 mNavigator->slotDaySelect( d ); 2718 mNavigator->slotDaySelect( d );
2709 } else if ( mDatePickerMode == 2 ) { 2719 } else if ( mDatePickerMode == 2 ) {
2710 if ( mMoveIncidence->typeID() == todoID ) { 2720 if ( mMoveIncidence->typeID() == todoID ) {
2711 Todo * to = (Todo *) mMoveIncidence; 2721 Todo * to = (Todo *) mMoveIncidence;
2712 QTime tim; 2722 QTime tim;
2713 int len = 0; 2723 int len = 0;
2714 if ( to->hasStartDate() && to->hasDueDate() ) 2724 if ( to->hasStartDate() && to->hasDueDate() )
2715 len = to->dtStart().secsTo( to->dtDue()); 2725 len = to->dtStart().secsTo( to->dtDue());
2716 if ( to->hasDueDate() ) 2726 if ( to->hasDueDate() )
2717 tim = to->dtDue().time(); 2727 tim = to->dtDue().time();
2718 else { 2728 else {
2719 tim = QTime ( 0,0,0 ); 2729 tim = QTime ( 0,0,0 );
2720 to->setFloats( true ); 2730 to->setFloats( true );
2721 to->setHasDueDate( true ); 2731 to->setHasDueDate( true );
2722 } 2732 }
2723 QDateTime dt ( d,tim ); 2733 QDateTime dt ( d,tim );
2724 to->setDtDue( dt ); 2734 to->setDtDue( dt );
2725 2735
2726 if ( to->hasStartDate() ) { 2736 if ( to->hasStartDate() ) {
2727 if ( len>0 ) 2737 if ( len>0 )
2728 to->setDtStart(to->dtDue().addSecs( -len )); 2738 to->setDtStart(to->dtDue().addSecs( -len ));
2729 else 2739 else
2730 if (to->dtStart() > to->dtDue() ) 2740 if (to->dtStart() > to->dtDue() )
2731 to->setDtStart(to->dtDue().addDays( -3 )); 2741 to->setDtStart(to->dtDue().addDays( -3 ));
2732 } 2742 }
2733 2743
2734 todoChanged( to ); 2744 todoChanged( to );
2735 } else { 2745 } else {
2736 if ( mMoveIncidence->doesRecur() ) { 2746 if ( mMoveIncidence->doesRecur() ) {
2737#if 0 2747#if 0
2738 // PENDING implement this 2748 // PENDING implement this
2739 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2749 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2740 mCalendar()->addIncidence( newInc ); 2750 mCalendar()->addIncidence( newInc );
2741 if ( mMoveIncidence->typeID() == todoID ) 2751 if ( mMoveIncidence->typeID() == todoID )
2742 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2752 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2743 else 2753 else
2744 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2754 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2745 mMoveIncidence = newInc; 2755 mMoveIncidence = newInc;
2746 2756
2747#endif 2757#endif
2748 } 2758 }
2749 QTime tim = mMoveIncidence->dtStart().time(); 2759 QTime tim = mMoveIncidence->dtStart().time();
2750 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2760 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2751 QDateTime dt ( d,tim ); 2761 QDateTime dt ( d,tim );
2752 mMoveIncidence->setDtStart( dt ); 2762 mMoveIncidence->setDtStart( dt );
2753 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2763 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2754 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2764 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2755 } 2765 }
2756 2766
2757 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2767 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2758 } 2768 }
2759} 2769}
2760 2770
2761void CalendarView::removeCategories() 2771void CalendarView::removeCategories()
2762{ 2772{
2763 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2773 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2764 QStringList catList = KOPrefs::instance()->mCustomCategories; 2774 QStringList catList = KOPrefs::instance()->mCustomCategories;
2765 QStringList catIncList; 2775 QStringList catIncList;
2766 QStringList newCatList; 2776 QStringList newCatList;
2767 Incidence* inc = incList.first(); 2777 Incidence* inc = incList.first();
2768 int i; 2778 int i;
2769 int count = 0; 2779 int count = 0;
2770 while ( inc ) { 2780 while ( inc ) {
2771 newCatList.clear(); 2781 newCatList.clear();
2772 catIncList = inc->categories() ; 2782 catIncList = inc->categories() ;
2773 for( i = 0; i< catIncList.count(); ++i ) { 2783 for( i = 0; i< catIncList.count(); ++i ) {
2774 if ( catList.contains (catIncList[i])) 2784 if ( catList.contains (catIncList[i]))
2775 newCatList.append( catIncList[i] ); 2785 newCatList.append( catIncList[i] );
2776 } 2786 }
2777 newCatList.sort(); 2787 newCatList.sort();
2778 inc->setCategories( newCatList.join(",") ); 2788 inc->setCategories( newCatList.join(",") );
2779 inc = incList.next(); 2789 inc = incList.next();
2780 } 2790 }
2781} 2791}
2782 2792
2783int CalendarView::addCategories() 2793int CalendarView::addCategories()
2784{ 2794{
2785 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2795 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2786 QStringList catList = KOPrefs::instance()->mCustomCategories; 2796 QStringList catList = KOPrefs::instance()->mCustomCategories;
2787 QStringList catIncList; 2797 QStringList catIncList;
2788 Incidence* inc = incList.first(); 2798 Incidence* inc = incList.first();
2789 int i; 2799 int i;
2790 int count = 0; 2800 int count = 0;
2791 while ( inc ) { 2801 while ( inc ) {
2792 catIncList = inc->categories() ; 2802 catIncList = inc->categories() ;
2793 for( i = 0; i< catIncList.count(); ++i ) { 2803 for( i = 0; i< catIncList.count(); ++i ) {
2794 if ( !catList.contains (catIncList[i])) { 2804 if ( !catList.contains (catIncList[i])) {
2795 catList.append( catIncList[i] ); 2805 catList.append( catIncList[i] );
2796 //qDebug("add cat %s ", catIncList[i].latin1()); 2806 //qDebug("add cat %s ", catIncList[i].latin1());
2797 ++count; 2807 ++count;
2798 } 2808 }
2799 } 2809 }
2800 inc = incList.next(); 2810 inc = incList.next();
2801 } 2811 }
2802 catList.sort(); 2812 catList.sort();
2803 KOPrefs::instance()->mCustomCategories = catList; 2813 KOPrefs::instance()->mCustomCategories = catList;
2804 return count; 2814 return count;
2805} 2815}
2806 2816
2807void CalendarView::manageCategories() 2817void CalendarView::manageCategories()
2808{ 2818{
2809 KOCatPrefs* cp = new KOCatPrefs(); 2819 KOCatPrefs* cp = new KOCatPrefs();
2810 cp->show(); 2820 cp->show();
2811 int w =cp->sizeHint().width() ; 2821 int w =cp->sizeHint().width() ;
2812 int h = cp->sizeHint().height() ; 2822 int h = cp->sizeHint().height() ;
2813 int dw = QApplication::desktop()->width(); 2823 int dw = QApplication::desktop()->width();
2814 int dh = QApplication::desktop()->height(); 2824 int dh = QApplication::desktop()->height();
2815 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2825 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2816 if ( !cp->exec() ) { 2826 if ( !cp->exec() ) {
2817 delete cp; 2827 delete cp;
2818 return; 2828 return;
2819 } 2829 }
2820 int count = 0; 2830 int count = 0;
2821 if ( cp->addCat() ) { 2831 if ( cp->addCat() ) {
2822 count = addCategories(); 2832 count = addCategories();
2823 if ( count ) { 2833 if ( count ) {
2824 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2834 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2825 writeSettings(); 2835 writeSettings();
2826 } else 2836 } else
2827 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2837 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2828 } else { 2838 } else {
2829 removeCategories(); 2839 removeCategories();
2830 updateView(); 2840 updateView();
2831 } 2841 }
2832 delete cp; 2842 delete cp;
2833} 2843}
2834 2844
2835void CalendarView::beamIncidence(Incidence * Inc) 2845void CalendarView::beamIncidence(Incidence * Inc)
2836{ 2846{
2837 QPtrList<Incidence> delSel ; 2847 QPtrList<Incidence> delSel ;
2838 delSel.append(Inc); 2848 delSel.append(Inc);
2839 beamIncidenceList( delSel ); 2849 beamIncidenceList( delSel );
2840} 2850}
2841void CalendarView::beamCalendar() 2851void CalendarView::beamCalendar()
2842{ 2852{
2843 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2853 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2844 //qDebug("beamCalendar() "); 2854 //qDebug("beamCalendar() ");
2845 beamIncidenceList( delSel ); 2855 beamIncidenceList( delSel );
2846} 2856}
2847void CalendarView::beamFilteredCalendar() 2857void CalendarView::beamFilteredCalendar()
2848{ 2858{
2849 QPtrList<Incidence> delSel = mCalendar->incidences(); 2859 QPtrList<Incidence> delSel = mCalendar->incidences();
2850 //qDebug("beamFilteredCalendar() "); 2860 //qDebug("beamFilteredCalendar() ");
2851 beamIncidenceList( delSel ); 2861 beamIncidenceList( delSel );
2852} 2862}
2853void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2863void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2854{ 2864{
2855 2865
2856 KOBeamPrefs beamDialog; 2866 KOBeamPrefs beamDialog;
2857 if ( beamDialog.exec () == QDialog::Rejected ) 2867 if ( beamDialog.exec () == QDialog::Rejected )
2858 return; 2868 return;
2859#ifdef DESKTOP_VERSION 2869#ifdef DESKTOP_VERSION
2860 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2870 QString fn = locateLocal( "tmp", "kopibeamfile" );
2861#else 2871#else
2862 QString fn = "/tmp/kopibeamfile"; 2872 QString fn = "/tmp/kopibeamfile";
2863#endif 2873#endif
2864 QString mes; 2874 QString mes;
2865 bool createbup = true; 2875 bool createbup = true;
2866 if ( createbup ) { 2876 if ( createbup ) {
2867 QString description = "\n"; 2877 QString description = "\n";
2868 CalendarLocal* cal = new CalendarLocal(); 2878 CalendarLocal* cal = new CalendarLocal();
2869 if ( beamDialog.beamLocal() ) 2879 if ( beamDialog.beamLocal() )
2870 cal->setLocalTime(); 2880 cal->setLocalTime();
2871 else 2881 else
2872 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2882 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2873 Incidence *incidence = delSel.first(); 2883 Incidence *incidence = delSel.first();
2874 bool addText = false; 2884 bool addText = false;
2875 if ( delSel.count() < 10 ) 2885 if ( delSel.count() < 10 )
2876 addText = true; 2886 addText = true;
2877 else { 2887 else {
2878 description.sprintf(i18n(" %d items?"),delSel.count() ); 2888 description.sprintf(i18n(" %d items?"),delSel.count() );
2879 } 2889 }
2880 while ( incidence ) { 2890 while ( incidence ) {
2881 Incidence *in = incidence->clone(); 2891 Incidence *in = incidence->clone();
2882 if ( ! in->summary().isEmpty() ) { 2892 if ( ! in->summary().isEmpty() ) {
2883 in->setDescription(""); 2893 in->setDescription("");
2884 } else { 2894 } else {
2885 in->setSummary( in->description().left(20)); 2895 in->setSummary( in->description().left(20));
2886 in->setDescription(""); 2896 in->setDescription("");
2887 } 2897 }
2888 if ( addText ) 2898 if ( addText )
2889 description += in->summary() + "\n"; 2899 description += in->summary() + "\n";
2890 cal->addIncidence( in ); 2900 cal->addIncidence( in );
2891 incidence = delSel.next(); 2901 incidence = delSel.next();
2892 } 2902 }
2893 if ( beamDialog.beamVcal() ) { 2903 if ( beamDialog.beamVcal() ) {
2894 fn += ".vcs"; 2904 fn += ".vcs";
2895 FileStorage storage( cal, fn, new VCalFormat ); 2905 FileStorage storage( cal, fn, new VCalFormat );
2896 storage.save(); 2906 storage.save();
2897 } else { 2907 } else {
2898 fn += ".ics"; 2908 fn += ".ics";
2899 FileStorage storage( cal, fn, new ICalFormat( ) ); 2909 FileStorage storage( cal, fn, new ICalFormat( ) );
2900 storage.save(); 2910 storage.save();
2901 } 2911 }
2902 delete cal; 2912 delete cal;
2903 mes = i18n("KO/Pi: Ready for beaming"); 2913 mes = i18n("KO/Pi: Ready for beaming");
2904 topLevelWidget()->setCaption(mes); 2914 topLevelWidget()->setCaption(mes);
2905 KApplication::convert2latin1( fn ); 2915 KApplication::convert2latin1( fn );
2906#ifndef DESKTOP_VERSION 2916#ifndef DESKTOP_VERSION
2907 Ir *ir = new Ir( this ); 2917 Ir *ir = new Ir( this );
2908 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2918 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2909 ir->send( fn, description, "text/x-vCalendar" ); 2919 ir->send( fn, description, "text/x-vCalendar" );
2910#endif 2920#endif
2911 } 2921 }
2912} 2922}
2913void CalendarView::beamDone( Ir *ir ) 2923void CalendarView::beamDone( Ir *ir )
2914{ 2924{
2915#ifndef DESKTOP_VERSION 2925#ifndef DESKTOP_VERSION
2916 delete ir; 2926 delete ir;
2917#endif 2927#endif
2918 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2928 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2919 topLevelWidget()->raise(); 2929 topLevelWidget()->raise();
2920} 2930}
2921 2931
2922void CalendarView::moveIncidence(Incidence * inc ) 2932void CalendarView::moveIncidence(Incidence * inc )
2923{ 2933{
2924 if ( !inc ) return; 2934 if ( !inc ) return;
2925 showDatePickerPopup(); 2935 showDatePickerPopup();
2926 mDatePickerMode = 2; 2936 mDatePickerMode = 2;
2927 mMoveIncidence = inc ; 2937 mMoveIncidence = inc ;
2928 QDate da; 2938 QDate da;
2929 if ( mMoveIncidence->typeID() == todoID ) { 2939 if ( mMoveIncidence->typeID() == todoID ) {
2930 Todo * to = (Todo *) mMoveIncidence; 2940 Todo * to = (Todo *) mMoveIncidence;
2931 if ( to->hasDueDate() ) 2941 if ( to->hasDueDate() )
2932 da = to->dtDue().date(); 2942 da = to->dtDue().date();
2933 else 2943 else
2934 da = QDate::currentDate(); 2944 da = QDate::currentDate();
2935 } else { 2945 } else {
2936 da = mMoveIncidence->dtStart().date(); 2946 da = mMoveIncidence->dtStart().date();
2937 } 2947 }
2938 //PENDING set date for recurring incidence to date of recurrence 2948 //PENDING set date for recurring incidence to date of recurrence
2939 //mMoveIncidenceOldDate; 2949 //mMoveIncidenceOldDate;
2940 mDatePicker->setDate( da ); 2950 mDatePicker->setDate( da );
2941} 2951}
2942void CalendarView::showDatePickerPopup() 2952void CalendarView::showDatePickerPopup()
2943{ 2953{
2944 if ( mDateFrame->isVisible() ) 2954 if ( mDateFrame->isVisible() )
2945 mDateFrame->hide(); 2955 mDateFrame->hide();
2946 else { 2956 else {
2947 int offX = 0, offY = 0; 2957 int offX = 0, offY = 0;
2948#ifdef DESKTOP_VERSION 2958#ifdef DESKTOP_VERSION
2949 int w =mDatePicker->sizeHint().width() ; 2959 int w =mDatePicker->sizeHint().width() ;
2950 int h = mDatePicker->sizeHint().height() ; 2960 int h = mDatePicker->sizeHint().height() ;
2951 int dw = topLevelWidget()->width(); 2961 int dw = topLevelWidget()->width();
2952 int dh = topLevelWidget()->height(); 2962 int dh = topLevelWidget()->height();
2953 offX = topLevelWidget()->x(); 2963 offX = topLevelWidget()->x();
2954 offY = topLevelWidget()->y(); 2964 offY = topLevelWidget()->y();
2955#else 2965#else
2956 int w =mDatePicker->sizeHint().width() ; 2966 int w =mDatePicker->sizeHint().width() ;
2957 int h = mDatePicker->sizeHint().height() ; 2967 int h = mDatePicker->sizeHint().height() ;
2958 int dw = QApplication::desktop()->width(); 2968 int dw = QApplication::desktop()->width();
2959 int dh = QApplication::desktop()->height(); 2969 int dh = QApplication::desktop()->height();
2960#endif 2970#endif
2961 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2971 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2962 mDateFrame->show(); 2972 mDateFrame->show();
2963 } 2973 }
2964} 2974}
2965void CalendarView::showDatePicker( ) 2975void CalendarView::showDatePicker( )
2966{ 2976{
2967 showDatePickerPopup(); 2977 showDatePickerPopup();
2968 mDatePickerMode = 1; 2978 mDatePickerMode = 1;
2969 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2979 mDatePicker->setDate( mNavigator->selectedDates().first() );
2970} 2980}
2971 2981
2972void CalendarView::showEventEditor() 2982void CalendarView::showEventEditor()
2973{ 2983{
2974#ifdef DESKTOP_VERSION 2984#ifdef DESKTOP_VERSION
2975 int x,y,w,h; 2985 int x,y,w,h;
2976 x = mEventEditor->geometry().x(); 2986 x = mEventEditor->geometry().x();
2977 y = mEventEditor->geometry().y(); 2987 y = mEventEditor->geometry().y();
2978 w = mEventEditor->width(); 2988 w = mEventEditor->width();
2979 h = mEventEditor->height(); 2989 h = mEventEditor->height();
2980 mEventEditor->show(); 2990 mEventEditor->show();
2981 mEventEditor->setGeometry(x,y,w,h); 2991 mEventEditor->setGeometry(x,y,w,h);
2982#else 2992#else
2983 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2993 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2984 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2994 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2985 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2995 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2986 qApp->processEvents(); 2996 qApp->processEvents();
2987 delete mEventEditor; 2997 delete mEventEditor;
2988 mEventEditor = mDialogManager->getEventEditor(); 2998 mEventEditor = mDialogManager->getEventEditor();
2989 topLevelWidget()->setCaption( i18n("") ); 2999 topLevelWidget()->setCaption( i18n("") );
2990 } 3000 }
2991 mEventEditor->showMaximized(); 3001 mEventEditor->showMaximized();
2992#endif 3002#endif
2993} 3003}
2994void CalendarView::showTodoEditor() 3004void CalendarView::showTodoEditor()
2995{ 3005{
2996#ifdef DESKTOP_VERSION 3006#ifdef DESKTOP_VERSION
2997 int x,y,w,h; 3007 int x,y,w,h;
2998 x = mTodoEditor->geometry().x(); 3008 x = mTodoEditor->geometry().x();
2999 y = mTodoEditor->geometry().y(); 3009 y = mTodoEditor->geometry().y();
3000 w = mTodoEditor->width(); 3010 w = mTodoEditor->width();
3001 h = mTodoEditor->height(); 3011 h = mTodoEditor->height();
3002 mTodoEditor->show(); 3012 mTodoEditor->show();
3003 mTodoEditor->setGeometry(x,y,w,h); 3013 mTodoEditor->setGeometry(x,y,w,h);
3004#else 3014#else
3005 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 3015 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
3006 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 3016 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
3007 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 3017 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
3008 qApp->processEvents(); 3018 qApp->processEvents();
3009 delete mTodoEditor; 3019 delete mTodoEditor;
3010 mTodoEditor = mDialogManager->getTodoEditor(); 3020 mTodoEditor = mDialogManager->getTodoEditor();
3011 topLevelWidget()->setCaption( i18n("") ); 3021 topLevelWidget()->setCaption( i18n("") );
3012 } 3022 }
3013 mTodoEditor->showMaximized(); 3023 mTodoEditor->showMaximized();
3014#endif 3024#endif
3015} 3025}
3016 3026
3017void CalendarView::cloneIncidence() 3027void CalendarView::cloneIncidence()
3018{ 3028{
3019 Incidence *incidence = currentSelection(); 3029 Incidence *incidence = currentSelection();
3020 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3030 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3021 if ( incidence ) { 3031 if ( incidence ) {
3022 cloneIncidence(incidence); 3032 cloneIncidence(incidence);
3023 } 3033 }
3024} 3034}
3025void CalendarView::moveIncidence() 3035void CalendarView::moveIncidence()
3026{ 3036{
3027 Incidence *incidence = currentSelection(); 3037 Incidence *incidence = currentSelection();
3028 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3038 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3029 if ( incidence ) { 3039 if ( incidence ) {
3030 moveIncidence(incidence); 3040 moveIncidence(incidence);
3031 } 3041 }
3032} 3042}
3033void CalendarView::beamIncidence() 3043void CalendarView::beamIncidence()
3034{ 3044{
3035 Incidence *incidence = currentSelection(); 3045 Incidence *incidence = currentSelection();
3036 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3046 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3037 if ( incidence ) { 3047 if ( incidence ) {
3038 beamIncidence(incidence); 3048 beamIncidence(incidence);
3039 } 3049 }
3040} 3050}
3041void CalendarView::toggleCancelIncidence() 3051void CalendarView::toggleCancelIncidence()
3042{ 3052{
3043 Incidence *incidence = currentSelection(); 3053 Incidence *incidence = currentSelection();
3044 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3054 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3045 if ( incidence ) { 3055 if ( incidence ) {
3046 cancelIncidence(incidence); 3056 cancelIncidence(incidence);
3047 } 3057 }
3048} 3058}
3049 3059
3050 3060
3051void CalendarView::cancelIncidence(Incidence * inc ) 3061void CalendarView::cancelIncidence(Incidence * inc )
3052{ 3062{
3053 inc->setCancelled( ! inc->cancelled() ); 3063 inc->setCancelled( ! inc->cancelled() );
3054 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 3064 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
3055 updateView(); 3065 updateView();
3056} 3066}
3057void CalendarView::cloneIncidence(Incidence * orgInc ) 3067void CalendarView::cloneIncidence(Incidence * orgInc )
3058{ 3068{
3059 Incidence * newInc = orgInc->clone(); 3069 Incidence * newInc = orgInc->clone();
3060 newInc->recreate(); 3070 newInc->recreate();
3061 3071
3062 if ( newInc->typeID() == todoID ) { 3072 if ( newInc->typeID() == todoID ) {
3063 Todo* t = (Todo*) newInc; 3073 Todo* t = (Todo*) newInc;
3064 bool cloneSub = false; 3074 bool cloneSub = false;
3065 if ( orgInc->relations().count() ) { 3075 if ( orgInc->relations().count() ) {
3066 int result = KMessageBox::warningYesNoCancel(this, 3076 int result = KMessageBox::warningYesNoCancel(this,
3067 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), 3077 i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ),
3068 i18n("Todo has subtodos"), 3078 i18n("Todo has subtodos"),
3069 i18n("Yes"), 3079 i18n("Yes"),
3070 i18n("No")); 3080 i18n("No"));
3071 3081
3072 if ( result == KMessageBox::Cancel ) { 3082 if ( result == KMessageBox::Cancel ) {
3073 delete t; 3083 delete t;
3074 return; 3084 return;
3075 } 3085 }
3076 if (result == KMessageBox::Yes) cloneSub = true; 3086 if (result == KMessageBox::Yes) cloneSub = true;
3077 } 3087 }
3078 showTodoEditor(); 3088 showTodoEditor();
3079 mTodoEditor->editTodo( t ); 3089 mTodoEditor->editTodo( t );
3080 if ( mTodoEditor->exec() ) { 3090 if ( mTodoEditor->exec() ) {
3081 if ( cloneSub ) { 3091 if ( cloneSub ) {
3082 orgInc->cloneRelations( t ); 3092 orgInc->cloneRelations( t );
3083 mCalendar->addIncidenceBranch( t ); 3093 mCalendar->addIncidenceBranch( t );
3084 updateView(); 3094 updateView();
3085 3095
3086 } else { 3096 } else {
3087 mCalendar->addTodo( t ); 3097 mCalendar->addTodo( t );
3088 updateView(); 3098 updateView();
3089 } 3099 }
3090 } else { 3100 } else {
3091 delete t; 3101 delete t;
3092 } 3102 }
3093 } 3103 }
3094 else { 3104 else {
3095 Event* e = (Event*) newInc; 3105 Event* e = (Event*) newInc;
3096 showEventEditor(); 3106 showEventEditor();
3097 mEventEditor->editEvent( e ); 3107 mEventEditor->editEvent( e );
3098 if ( mEventEditor->exec() ) { 3108 if ( mEventEditor->exec() ) {
3099 mCalendar->addEvent( e ); 3109 mCalendar->addEvent( e );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index c89bbf7..f7e5366 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -26,630 +26,632 @@
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
50class QWidgetStack; 50class QWidgetStack;
51class QSplitter; 51class QSplitter;
52class KopiCalendarFile; 52class KopiCalendarFile;
53class CalPrinter; 53class CalPrinter;
54class KOFilterView; 54class KOFilterView;
55class KOCalEditView; 55class KOCalEditView;
56class KOViewManager; 56class KOViewManager;
57class KODialogManager; 57class KODialogManager;
58class KOTodoView; 58class KOTodoView;
59class KDateNavigator; 59class KDateNavigator;
60class DateNavigatorContainer; 60class DateNavigatorContainer;
61class DateNavigator; 61class DateNavigator;
62class KOIncidenceEditor; 62class KOIncidenceEditor;
63class KDatePicker; 63class KDatePicker;
64class ResourceView; 64class ResourceView;
65class KOEventEditor; 65class KOEventEditor;
66class KOTodoEditor ; 66class KOTodoEditor ;
67class KOEventViewerDialog; 67class KOEventViewerDialog;
68class KOBeamPrefs; 68class KOBeamPrefs;
69class KSyncProfile; 69class KSyncProfile;
70class AlarmDialog; 70class AlarmDialog;
71class KCal::Attendee; 71class KCal::Attendee;
72 72
73namespace KCal { class FileStorage; } 73namespace KCal { class FileStorage; }
74 74
75using namespace KCal; 75using 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
90class MissedAlarmTextBrowser : public QTextBrowser { 90class 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
105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 105class 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 140
141 signals: 141 signals:
142 void save (); 142 void save ();
143 void saveStopTimer (); 143 void saveStopTimer ();
144 void tempDisableBR(bool); 144 void tempDisableBR(bool);
145 /** This todo has been modified */ 145 /** This todo has been modified */
146 void todoModified(Todo *, int); 146 void todoModified(Todo *, int);
147 147
148 /** when change is made to options dialog, the topwidget will catch this 148 /** when change is made to options dialog, the topwidget will catch this
149 * and emit this signal which notifies all widgets which have registered 149 * and emit this signal which notifies all widgets which have registered
150 * for notification to update their settings. */ 150 * for notification to update their settings. */
151 void configChanged(); 151 void configChanged();
152 /** emitted when the topwidget is closing down, so that any attached 152 /** emitted when the topwidget is closing down, so that any attached
153 child windows can also close. */ 153 child windows can also close. */
154 void closingDown(); 154 void closingDown();
155 /** emitted right before we die */ 155 /** emitted right before we die */
156 void closed(QWidget *); 156 void closed(QWidget *);
157 157
158 /** Emitted when state of modified flag changes */ 158 /** Emitted when state of modified flag changes */
159 void modifiedChanged(bool); 159 void modifiedChanged(bool);
160 void signalmodified(); 160 void signalmodified();
161 161
162 /** Emitted when state of read-only flag changes */ 162 /** Emitted when state of read-only flag changes */
163 void readOnlyChanged(bool); 163 void readOnlyChanged(bool);
164 164
165 /** Emitted when the unit of navigation changes */ 165 /** Emitted when the unit of navigation changes */
166 void changeNavStringPrev(const QString &); 166 void changeNavStringPrev(const QString &);
167 void changeNavStringNext(const QString &); 167 void changeNavStringNext(const QString &);
168 168
169 /** Emitted when state of events selection has changed and user is organizer*/ 169 /** Emitted when state of events selection has changed and user is organizer*/
170 void organizerEventsSelected(bool); 170 void organizerEventsSelected(bool);
171 /** Emitted when state of events selection has changed and user is attendee*/ 171 /** Emitted when state of events selection has changed and user is attendee*/
172 void groupEventsSelected(bool); 172 void groupEventsSelected(bool);
173 /** 173 /**
174 Emitted when an incidence gets selected. If the selection is cleared the 174 Emitted when an incidence gets selected. If the selection is cleared the
175 signal is emitted with 0 as argument. 175 signal is emitted with 0 as argument.
176 */ 176 */
177 void incidenceSelected( Incidence * ); 177 void incidenceSelected( Incidence * );
178 /** Emitted, when a todoitem is selected or deselected. */ 178 /** Emitted, when a todoitem is selected or deselected. */
179 void todoSelected( bool ); 179 void todoSelected( bool );
180 180
181 /** 181 /**
182 Emitted, when clipboard content changes. Parameter indicates if paste 182 Emitted, when clipboard content changes. Parameter indicates if paste
183 is possible or not. 183 is possible or not.
184 */ 184 */
185 void pasteEnabled(bool); 185 void pasteEnabled(bool);
186 186
187 /** Emitted, when the number of incoming messages has changed. */ 187 /** Emitted, when the number of incoming messages has changed. */
188 void numIncomingChanged(int); 188 void numIncomingChanged(int);
189 189
190 /** Emitted, when the number of outgoing messages has changed. */ 190 /** Emitted, when the number of outgoing messages has changed. */
191 void numOutgoingChanged(int); 191 void numOutgoingChanged(int);
192 192
193 /** Send status message, which can e.g. be displayed in the status bar. */ 193 /** Send status message, which can e.g. be displayed in the status bar. */
194 void statusMessage(const QString &); 194 void statusMessage(const QString &);
195 195
196 void calendarViewExpanded( bool ); 196 void calendarViewExpanded( bool );
197 void updateSearchDialog(); 197 void updateSearchDialog();
198 void filtersUpdated(); 198 void filtersUpdated();
199 199
200 200
201 public slots: 201 public slots:
202 void checkAlarms(); 202 void checkAlarms();
203 void slotprintSelInc(); 203 void slotprintSelInc();
204 void showNextAlarms(); 204 void showNextAlarms();
205 void showOpenError(); 205 void showOpenError();
206 void watchSavedFile(); 206 void watchSavedFile();
207 void recheckTimerAlarm(); 207 void recheckTimerAlarm();
208 void checkNextTimerAlarm(); 208 void checkNextTimerAlarm();
209 void addAlarm(const QDateTime &qdt, const QString &noti ); 209 void addAlarm(const QDateTime &qdt, const QString &noti );
210 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 210 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
211 void removeAlarm(const QDateTime &qdt, const QString &noti ); 211 void removeAlarm(const QDateTime &qdt, const QString &noti );
212 212
213 /** options dialog made a changed to the configuration. we catch this 213 /** options dialog made a changed to the configuration. we catch this
214 * and notify all widgets which need to update their configuration. */ 214 * and notify all widgets which need to update their configuration. */
215 void updateConfig(); 215 void updateConfig();
216 216
217 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 217 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
218 const QStringList& anniversaryList, const QStringList& realNameList, 218 const QStringList& anniversaryList, const QStringList& realNameList,
219 const QStringList& emailList, const QStringList& assembledNameList, 219 const QStringList& emailList, const QStringList& assembledNameList,
220 const QStringList& uidList); 220 const QStringList& uidList);
221 221
222 /** 222 /**
223 Load calendar from file \a filename. If \a merge is true, load 223 Load calendar from file \a filename. If \a merge is true, load
224 calendar into existing one, if it is false, clear calendar, before 224 calendar into existing one, if it is false, clear calendar, before
225 loading. Return true, if calendar could be successfully loaded. 225 loading. Return true, if calendar could be successfully loaded.
226 */ 226 */
227 bool openCalendar(QString filename, bool merge=false); 227 bool openCalendar(QString filename, bool merge=false);
228 bool loadCalendars(); 228 bool loadCalendars();
229 bool saveCalendars(); 229 bool saveCalendars();
230 bool restoreCalendarSettings(); 230 bool restoreCalendarSettings();
231 bool addCalendar( KopiCalendarFile * ); 231 bool addCalendar( KopiCalendarFile * );
232 void addCalendarId( int id ); 232 void addCalendarId( int id );
233 bool syncCalendar(QString filename,int mode = 0 ); 233 bool syncCalendar(QString filename,int mode = 0 );
234 234
235 /** 235 /**
236 Save calendar data to file. Return true if calendar could be 236 Save calendar data to file. Return true if calendar could be
237 successfully saved. 237 successfully saved.
238 */ 238 */
239 bool saveCalendar(QString filename); 239 bool saveCalendar(QString filename);
240 240
241 /** 241 /**
242 Close calendar. Clear calendar data and reset views to display an empty 242 Close calendar. Clear calendar data and reset views to display an empty
243 calendar. 243 calendar.
244 */ 244 */
245 void closeCalendar(); 245 void closeCalendar();
246 246
247 /** Archive old events of calendar */ 247 /** Archive old events of calendar */
248 void archiveCalendar(); 248 void archiveCalendar();
249 249
250 void showIncidence(); 250 void showIncidence();
251 void editIncidence(); 251 void editIncidence();
252 void editIncidenceDescription(); 252 void editIncidenceDescription();
253 void deleteIncidence(); 253 void deleteIncidence();
254 void cloneIncidence(); 254 void cloneIncidence();
255 void moveIncidence(); 255 void moveIncidence();
256 void beamIncidence(); 256 void beamIncidence();
257 void toggleCancelIncidence(); 257 void toggleCancelIncidence();
258 258
259 /** create an editeventwin with supplied date/time, and if bool is true, 259 /** create an editeventwin with supplied date/time, and if bool is true,
260 * make the event take all day. */ 260 * make the event take all day. */
261 void newEvent(QDateTime, QDateTime, bool allDay ); 261 void newEvent(QDateTime, QDateTime, bool allDay );
262 void newEvent(QDateTime, QDateTime); 262 void newEvent(QDateTime, QDateTime);
263 void newEvent(QDateTime fh); 263 void newEvent(QDateTime fh);
264 void newEvent(QDate dt); 264 void newEvent(QDate dt);
265 /** create new event without having a date hint. Takes current date as 265 /** create new event without having a date hint. Takes current date as
266 default hint. */ 266 default hint. */
267 void newEvent(); 267 void newEvent();
268 void newFloatingEvent(); 268 void newFloatingEvent();
269 269
270 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 270 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
271 void showIncidence(Incidence *); 271 void showIncidence(Incidence *);
272 void showIncidence(QString uid); 272 void showIncidence(QString uid);
273 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 273 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
274 void editIncidence(Incidence *); 274 void editIncidence(Incidence *);
275 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 275 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
276 void deleteIncidence(Incidence *); 276 void deleteIncidence(Incidence *);
277 void cloneIncidence(Incidence *); 277 void cloneIncidence(Incidence *);
278 void cancelIncidence(Incidence *); 278 void cancelIncidence(Incidence *);
279 /** Create an editor for the supplied event. */ 279 /** Create an editor for the supplied event. */
280 void editEvent(Event *); 280 void editEvent(Event *);
281 /** Delete the supplied event. */ 281 /** Delete the supplied event. */
282 void deleteEvent(Event *); 282 void deleteEvent(Event *);
283 /** Delete the event with the given unique ID. Returns false, if event wasn't 283 /** Delete the event with the given unique ID. Returns false, if event wasn't
284 found. */ 284 found. */
285 bool deleteEvent(const QString &uid); 285 bool deleteEvent(const QString &uid);
286 /** Create a read-only viewer dialog for the supplied event. */ 286 /** Create a read-only viewer dialog for the supplied event. */
287 void showEvent(Event *); 287 void showEvent(Event *);
288 288
289 void editJournal(Journal *); 289 void editJournal(Journal *);
290 void showJournal(Journal *); 290 void showJournal(Journal *);
291 void deleteJournal(Journal *); 291 void deleteJournal(Journal *);
292 /** Create an editor dialog for a todo */ 292 /** Create an editor dialog for a todo */
293 void editTodo(Todo *); 293 void editTodo(Todo *);
294 /** Create a read-only viewer dialog for the supplied todo */ 294 /** Create a read-only viewer dialog for the supplied todo */
295 void showTodo(Todo *); 295 void showTodo(Todo *);
296 /** create new todo */ 296 /** create new todo */
297 void newTodo(); 297 void newTodo();
298 void newTodoDateTime(QDateTime, bool allday); 298 void newTodoDateTime(QDateTime, bool allday);
299 /** create new todo with a parent todo */ 299 /** create new todo with a parent todo */
300 void newSubTodo(); 300 void newSubTodo();
301 /** create new todo with a parent todo */ 301 /** create new todo with a parent todo */
302 void newSubTodo(Todo *); 302 void newSubTodo(Todo *);
303 /** Delete todo */ 303 /** Delete todo */
304 void deleteTodo(Todo *); 304 void deleteTodo(Todo *);
305 305
306 306
307 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 307 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
308 * emitted as result. */ 308 * emitted as result. */
309 void checkClipboard(); 309 void checkClipboard();
310 310
311 /** using the KConfig associated with the kapp variable, read in the 311 /** using the KConfig associated with the kapp variable, read in the
312 * settings from the config file. 312 * settings from the config file.
313 */ 313 */
314 void readSettings(); 314 void readSettings();
315 315
316 /** write current state to config file. */ 316 /** write current state to config file. */
317 void writeSettings(); 317 void writeSettings();
318 318
319 /** read settings for calendar filters */ 319 /** read settings for calendar filters */
320 void readFilterSettings(KConfig *config); 320 void readFilterSettings(KConfig *config);
321 321
322 /** write settings for calendar filters */ 322 /** write settings for calendar filters */
323 void writeFilterSettings(KConfig *config); 323 void writeFilterSettings(KConfig *config);
324 324
325 /** passes on the message that an event has changed to the currently 325 /** passes on the message that an event has changed to the currently
326 * activated view so that it can make appropriate display changes. */ 326 * activated view so that it can make appropriate display changes. */
327 void changeEventDisplay(Event *, int); 327 void changeEventDisplay(Event *, int);
328 void changeIncidenceDisplay(Incidence *, int); 328 void changeIncidenceDisplay(Incidence *, int);
329 void changeTodoDisplay(Todo *, int); 329 void changeTodoDisplay(Todo *, int);
330 330
331 void eventAdded(Event *); 331 void eventAdded(Event *);
332 void eventChanged(Event *); 332 void eventChanged(Event *);
333 void eventToBeDeleted(Event *); 333 void eventToBeDeleted(Event *);
334 void eventDeleted(); 334 void eventDeleted();
335 335
336 void todoAdded(Todo *); 336 void todoAdded(Todo *);
337 void todoChanged(Todo *); 337 void todoChanged(Todo *);
338 void todoToBeDeleted(Todo *); 338 void todoToBeDeleted(Todo *);
339 void todoDeleted(); 339 void todoDeleted();
340 340
341 void updateView(const QDate &start, const QDate &end); 341 void updateView(const QDate &start, const QDate &end);
342 void updateView(); 342 void updateView();
343 void clearAllViews(); 343 void clearAllViews();
344 344
345 /** Full update of visible todo views */ 345 /** Full update of visible todo views */
346 void updateTodoViews(); 346 void updateTodoViews();
347 347
348 void updateUnmanagedViews(); 348 void updateUnmanagedViews();
349 349
350 /** cut the current appointment to the clipboard */ 350 /** cut the current appointment to the clipboard */
351 void edit_cut(); 351 void edit_cut();
352 352
353 /** copy the current appointment(s) to the clipboard */ 353 /** copy the current appointment(s) to the clipboard */
354 void edit_copy(); 354 void edit_copy();
355 355
356 /** paste the current vobject(s) in the clipboard buffer into calendar */ 356 /** paste the current vobject(s) in the clipboard buffer into calendar */
357 void edit_paste(); 357 void edit_paste();
358 358
359 /** edit viewing and configuration options. */ 359 /** edit viewing and configuration options. */
360 void edit_options(); 360 void edit_options();
361 void edit_global_options(); 361 void edit_global_options();
362 /** 362 /**
363 Functions for printing, previewing a print, and setting up printing 363 Functions for printing, previewing a print, and setting up printing
364 parameters. 364 parameters.
365 */ 365 */
366 void print(); 366 void print();
367 void printSetup(); 367 void printSetup();
368 void printPreview(); 368 void printPreview();
369 369
370 /** Export as iCalendar file */ 370 /** Export as iCalendar file */
371 void exportICalendar(); 371 void exportICalendar();
372 372
373 /** Export as vCalendar file */ 373 /** Export as vCalendar file */
374 bool exportVCalendar( QString fn); 374 bool exportVCalendar( QString fn);
375 375
376 /** pop up a dialog to show an existing appointment. */ 376 /** pop up a dialog to show an existing appointment. */
377 void appointment_show(); 377 void appointment_show();
378 /** 378 /**
379 * pop up an Appointment Dialog to edit an existing appointment.Get 379 * pop up an Appointment Dialog to edit an existing appointment.Get
380 * information on the appointment from the list of unique IDs that is 380 * information on the appointment from the list of unique IDs that is
381 * currently in the View, called currIds. 381 * currently in the View, called currIds.
382 */ 382 */
383 void appointment_edit(); 383 void appointment_edit();
384 /** 384 /**
385 * pop up dialog confirming deletion of currently selected event in the 385 * pop up dialog confirming deletion of currently selected event in the
386 * View. 386 * View.
387 */ 387 */
388 void appointment_delete(); 388 void appointment_delete();
389 389
390 /** mails the currently selected event to a particular user as a vCalendar 390 /** mails the currently selected event to a particular user as a vCalendar
391 attachment. */ 391 attachment. */
392 void action_mail(); 392 void action_mail();
393 393
394 /* frees a subtodo from it's relation */ 394 /* frees a subtodo from it's relation */
395 void todo_unsub( Todo * ); 395 void todo_unsub( Todo * );
396 void todo_resub( Todo * parent, Todo * sub ); 396 void todo_resub( Todo * parent, Todo * sub );
397 397
398 /** Take ownership of selected event. */ 398 /** Take ownership of selected event. */
399 void takeOverEvent(); 399 void takeOverEvent();
400 400
401 /** Take ownership of all events in calendar. */ 401 /** Take ownership of all events in calendar. */
402 void takeOverCalendar(); 402 void takeOverCalendar();
403 403
404 /** query whether or not the calendar is "dirty". */ 404 /** query whether or not the calendar is "dirty". */
405 bool isModified(); 405 bool isModified();
406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 406 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
407 void setModified(bool modified=true); 407 void setModified(bool modified=true);
408 408
409 /** query if the calendar is read-only. */ 409 /** query if the calendar is read-only. */
410 bool isReadOnly(); 410 bool isReadOnly();
411 /** set state of calendar to read-only */ 411 /** set state of calendar to read-only */
412 void setReadOnly(bool readOnly=true); 412 void setReadOnly(bool readOnly=true);
413 413
414 void eventUpdated(Incidence *); 414 void eventUpdated(Incidence *);
415 415
416 /* iTIP scheduling actions */ 416 /* iTIP scheduling actions */
417 void schedule_publish(Incidence *incidence = 0); 417 void schedule_publish(Incidence *incidence = 0);
418 void schedule_request(Incidence *incidence = 0); 418 void schedule_request(Incidence *incidence = 0);
419 void schedule_refresh(Incidence *incidence = 0); 419 void schedule_refresh(Incidence *incidence = 0);
420 void schedule_cancel(Incidence *incidence = 0); 420 void schedule_cancel(Incidence *incidence = 0);
421 void schedule_add(Incidence *incidence = 0); 421 void schedule_add(Incidence *incidence = 0);
422 void schedule_reply(Incidence *incidence = 0); 422 void schedule_reply(Incidence *incidence = 0);
423 void schedule_counter(Incidence *incidence = 0); 423 void schedule_counter(Incidence *incidence = 0);
424 void schedule_declinecounter(Incidence *incidence = 0); 424 void schedule_declinecounter(Incidence *incidence = 0);
425 void schedule_publish_freebusy(int daysToPublish = 30); 425 void schedule_publish_freebusy(int daysToPublish = 30);
426 426
427 void openAddressbook(); 427 void openAddressbook();
428 428
429 void editFilters(); 429 void editFilters();
430 void toggleFilerEnabled(); 430 void toggleFilerEnabled();
431 QPtrList<CalFilter> filters(); 431 QPtrList<CalFilter> filters();
432 void toggleFilter(); 432 void toggleFilter();
433 void showFilter(bool visible); 433 void showFilter(bool visible);
434 void updateFilter(); 434 void updateFilter();
435 void filterEdited(); 435 void filterEdited();
436 void selectFilter( int ); 436 void selectFilter( int );
437 KOFilterView *filterView(); 437 KOFilterView *filterView();
438 438
439 void showIntro(); 439 void showIntro();
440 440
441 /** Move the curdatepient view date to today */ 441 /** Move the curdatepient view date to today */
442 void goToday(); 442 void goToday();
443 443
444 /** Move to the next date(s) in the current view */ 444 /** Move to the next date(s) in the current view */
445 void goNext(); 445 void goNext();
446 446
447 /** Move to the previous date(s) in the current view */ 447 /** Move to the previous date(s) in the current view */
448 void goPrevious(); 448 void goPrevious();
449 /** Move to the next date(s) in the current view */ 449 /** Move to the next date(s) in the current view */
450 void goNextMonth(); 450 void goNextMonth();
451 451
452 /** Move to the previous date(s) in the current view */ 452 /** Move to the previous date(s) in the current view */
453 void goPreviousMonth(); 453 void goPreviousMonth();
454 454
455 void toggleExpand(); 455 void toggleExpand();
456 void toggleDateNavigatorWidget(); 456 void toggleDateNavigatorWidget();
457 void toggleAllDaySize(); 457 void toggleAllDaySize();
458 void dialogClosing(Incidence *); 458 void dialogClosing(Incidence *);
459 459
460 /** Look for new messages in the inbox */ 460 /** Look for new messages in the inbox */
461 void lookForIncomingMessages(); 461 void lookForIncomingMessages();
462 /** Look for new messages in the outbox */ 462 /** Look for new messages in the outbox */
463 void lookForOutgoingMessages(); 463 void lookForOutgoingMessages();
464 464
465 void processMainViewSelection( Incidence * ); 465 void processMainViewSelection( Incidence * );
466 void processTodoListSelection( Incidence * ); 466 void processTodoListSelection( Incidence * );
467 467
468 void processIncidenceSelection( Incidence * ); 468 void processIncidenceSelection( Incidence * );
469 469
470 void purgeCompleted(); 470 void purgeCompleted();
471 bool removeCompletedSubTodos( Todo* ); 471 bool removeCompletedSubTodos( Todo* );
472 void slotCalendarChanged(); 472 void slotCalendarChanged();
473 bool importBday(); 473 bool importBday();
474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 474 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
475 bool importQtopia( const QString &categoriesFile, 475 bool importQtopia( const QString &categoriesFile,
476 const QString &datebookFile, 476 const QString &datebookFile,
477 const QString &tasklistFile ); 477 const QString &tasklistFile );
478 void syncExternal( int mode ); 478 void syncExternal( int mode );
479 void slotSelectPickerDate( QDate ) ; 479 void slotSelectPickerDate( QDate ) ;
480 void showDatePicker() ; 480 void showDatePicker() ;
481 void showDatePickerPopup() ; 481 void showDatePickerPopup() ;
482 void moveIncidence(Incidence *) ; 482 void moveIncidence(Incidence *) ;
483 void beamIncidence(Incidence *) ; 483 void beamIncidence(Incidence *) ;
484 void beamCalendar() ; 484 void beamCalendar() ;
485 void beamFilteredCalendar() ; 485 void beamFilteredCalendar() ;
486 void beamIncidenceList(QPtrList<Incidence>) ; 486 void beamIncidenceList(QPtrList<Incidence>) ;
487 void manageCategories(); 487 void manageCategories();
488 int addCategories(); 488 int addCategories();
489 void removeCategories(); 489 void removeCategories();
490 void setSyncDevice( QString ); 490 void setSyncDevice( QString );
491 void setSyncName( QString ); 491 void setSyncName( QString );
492 void showDay( QDate ); 492 void showDay( QDate );
493 void undo_delete(); 493 void undo_delete();
494 protected slots: 494 protected slots:
495 void resetFocus(); 495 void resetFocus();
496 void scrollBarValue(int); 496 void scrollBarValue(int);
497 void slotViewerClosed(); 497 void slotViewerClosed();
498 void timerAlarm(); 498 void timerAlarm();
499 void suspendAlarm(); 499 void suspendAlarm();
500 void beamDone( Ir *ir ); 500 void beamDone( Ir *ir );
501 /** Select a view or adapt the current view to display the specified dates. */ 501 /** Select a view or adapt the current view to display the specified dates. */
502 void showDates( const KCal::DateList & ); 502 void showDates( const KCal::DateList & );
503 void selectWeekNum ( int ); 503 void selectWeekNum ( int );
504 504
505 public: 505 public:
506 // show a standard warning 506 // show a standard warning
507 // returns KMsgBox::yesNoCancel() 507 // returns KMsgBox::yesNoCancel()
508 int msgCalModified(); 508 int msgCalModified();
509 virtual bool sync(KSyncManager* manager, QString filename, int mode); 509 virtual bool sync(KSyncManager* manager, QString filename, int mode);
510 510
511 virtual bool syncExternal(KSyncManager* manager, QString resource); 511 virtual bool syncExternal(KSyncManager* manager, QString resource);
512 virtual void removeSyncInfo( QString syncProfile); 512 virtual void removeSyncInfo( QString syncProfile);
513 void setSyncManager(KSyncManager* manager); 513 void setSyncManager(KSyncManager* manager);
514 void setLoadedFileVersion(QDateTime); 514 void setLoadedFileVersion(QDateTime);
515 bool checkFileVersion(QString fn); 515 bool checkFileVersion(QString fn);
516 bool checkAllFileVersions(); 516 bool checkAllFileVersions();
517 bool checkFileChanged(QString fn); 517 bool checkFileChanged(QString fn);
518 Event* getLastSyncEvent(); 518 Event* getLastSyncEvent();
519 /** Adapt navigation units correpsonding to step size of navigation of the 519 /** Adapt navigation units correpsonding to step size of navigation of the
520 * current view. 520 * current view.
521 */ 521 */
522 void adaptNavigationUnits(); 522 void adaptNavigationUnits();
523 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 523 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
524 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 524 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
525 //Attendee* getYourAttendee(Event *event); 525 //Attendee* getYourAttendee(Event *event);
526 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 526 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
527 void setScrollBarStep(int val ); 527 void setScrollBarStep(int val );
528 528
529 protected: 529 protected:
530 void schedule(Scheduler::Method, Incidence *incidence = 0); 530 void schedule(Scheduler::Method, Incidence *incidence = 0);
531 531
532 // returns KMsgBox::OKCandel() 532 // returns KMsgBox::OKCandel()
533 int msgItemDelete(const QString name); 533 int msgItemDelete(const QString name);
534 void showEventEditor(); 534 void showEventEditor();
535 void showTodoEditor(); 535 void showTodoEditor();
536 Todo *selectedTodo(); 536 Todo *selectedTodo();
537 private: 537 private:
538#ifdef DESKTOP_VERSION
538 QScrollBar * mDateScrollBar; 539 QScrollBar * mDateScrollBar;
540#endif
539 QDateTime mNextAlarmDateTime; 541 QDateTime mNextAlarmDateTime;
540 bool mViewerCallerIsSearchDialog; 542 bool mViewerCallerIsSearchDialog;
541 bool mBlockShowDates; 543 bool mBlockShowDates;
542 KSyncManager* mSyncManager; 544 KSyncManager* mSyncManager;
543 AlarmDialog * mAlarmDialog; 545 AlarmDialog * mAlarmDialog;
544 QString mAlarmNotification; 546 QString mAlarmNotification;
545 QString mSuspendAlarmNotification; 547 QString mSuspendAlarmNotification;
546 QTimer* mSuspendTimer; 548 QTimer* mSuspendTimer;
547 QTimer* mAlarmTimer; 549 QTimer* mAlarmTimer;
548 QTimer* mRecheckAlarmTimer; 550 QTimer* mRecheckAlarmTimer;
549 void computeAlarm( QString ); 551 void computeAlarm( QString );
550 void startAlarm( QString, QString ); 552 void startAlarm( QString, QString );
551 void setSyncEventsReadOnly(); 553 void setSyncEventsReadOnly();
552 554
553 QDateTime loadedFileVersion; 555 QDateTime loadedFileVersion;
554 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 556 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
555 void checkExternalId( Incidence * inc ); 557 void checkExternalId( Incidence * inc );
556 int mGlobalSyncMode; 558 int mGlobalSyncMode;
557 QString mCurrentSyncDevice; 559 QString mCurrentSyncDevice;
558 QString mCurrentSyncName; 560 QString mCurrentSyncName;
559 void init(); 561 void init();
560 int mDatePickerMode; 562 int mDatePickerMode;
561 bool mFlagEditDescription; 563 bool mFlagEditDescription;
562 QDateTime mLastCalendarSync; 564 QDateTime mLastCalendarSync;
563 void createPrinter(); 565 void createPrinter();
564 566
565 void calendarModified( bool, Calendar * ); 567 void calendarModified( bool, Calendar * );
566 568
567 CalPrinter *mCalPrinter; 569 CalPrinter *mCalPrinter;
568 570
569 QSplitter *mPanner; 571 QSplitter *mPanner;
570 QSplitter *mLeftSplitter; 572 QSplitter *mLeftSplitter;
571 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 573 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
572 QWidgetStack *mRightFrame; 574 QWidgetStack *mRightFrame;
573 575
574 KDatePicker* mDatePicker; 576 KDatePicker* mDatePicker;
575 QVBox* mDateFrame; 577 QVBox* mDateFrame;
576 578
577 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 579 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
578 580
579 KOFilterView *mFilterView; 581 KOFilterView *mFilterView;
580 KOCalEditView *mCalEditView; 582 KOCalEditView *mCalEditView;
581 583
582 ResourceView *mResourceView; 584 ResourceView *mResourceView;
583 585
584 // calendar object for this viewing instance 586 // calendar object for this viewing instance
585 Calendar *mCalendar; 587 Calendar *mCalendar;
586 588
587 CalendarResourceManager *mResourceManager; 589 CalendarResourceManager *mResourceManager;
588 590
589 FileStorage *mStorage; 591 FileStorage *mStorage;
590 592
591 DateNavigator *mNavigator; 593 DateNavigator *mNavigator;
592 594
593 KOViewManager *mViewManager; 595 KOViewManager *mViewManager;
594 KODialogManager *mDialogManager; 596 KODialogManager *mDialogManager;
595 597
596 // Calendar filters 598 // Calendar filters
597 QPtrList<CalFilter> mFilters; 599 QPtrList<CalFilter> mFilters;
598 600
599 // various housekeeping variables. 601 // various housekeeping variables.
600 bool mModified; // flag indicating if calendar is modified 602 bool mModified; // flag indicating if calendar is modified
601 bool mReadOnly; // flag indicating if calendar is read-only 603 bool mReadOnly; // flag indicating if calendar is read-only
602 QDate mSaveSingleDate; 604 QDate mSaveSingleDate;
603 605
604 Incidence *mSelectedIncidence; 606 Incidence *mSelectedIncidence;
605 Incidence *mMoveIncidence; 607 Incidence *mMoveIncidence;
606 QDate mMoveIncidenceOldDate; 608 QDate mMoveIncidenceOldDate;
607 KOTodoView *mTodoList; 609 KOTodoView *mTodoList;
608 KOEventEditor * mEventEditor; 610 KOEventEditor * mEventEditor;
609 KOTodoEditor * mTodoEditor; 611 KOTodoEditor * mTodoEditor;
610 KOEventViewerDialog * mEventViewerDialog; 612 KOEventViewerDialog * mEventViewerDialog;
611 void keyPressEvent ( QKeyEvent *e) ; 613 void keyPressEvent ( QKeyEvent *e) ;
612 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 614 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
613}; 615};
614 616
615 617
616class CalendarViewVisitor : public Incidence::Visitor 618class CalendarViewVisitor : public Incidence::Visitor
617{ 619{
618 public: 620 public:
619 CalendarViewVisitor() : mView( 0 ) {} 621 CalendarViewVisitor() : mView( 0 ) {}
620 622
621 bool act( Incidence *incidence, CalendarView *view ) 623 bool act( Incidence *incidence, CalendarView *view )
622 { 624 {
623 mView = view; 625 mView = view;
624 return incidence->accept( *this ); 626 return incidence->accept( *this );
625 } 627 }
626 628
627 protected: 629 protected:
628 CalendarView *mView; 630 CalendarView *mView;
629}; 631};
630 632
631class ShowIncidenceVisitor : public CalendarViewVisitor 633class ShowIncidenceVisitor : public CalendarViewVisitor
632{ 634{
633 protected: 635 protected:
634 bool visit( Event *event ) { mView->showEvent( event ); return true; } 636 bool visit( Event *event ) { mView->showEvent( event ); return true; }
635 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 637 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
636 bool visit( Journal * j ) { mView->showJournal( j );return true; } 638 bool visit( Journal * j ) { mView->showJournal( j );return true; }
637}; 639};
638 640
639class EditIncidenceVisitor : public CalendarViewVisitor 641class EditIncidenceVisitor : public CalendarViewVisitor
640{ 642{
641 protected: 643 protected:
642 bool visit( Event *event ) { mView->editEvent( event ); return true; } 644 bool visit( Event *event ) { mView->editEvent( event ); return true; }
643 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 645 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
644 bool visit( Journal *j ) { mView->editJournal( j); return true; } 646 bool visit( Journal *j ) { mView->editJournal( j); return true; }
645}; 647};
646 648
647class DeleteIncidenceVisitor : public CalendarViewVisitor 649class DeleteIncidenceVisitor : public CalendarViewVisitor
648{ 650{
649 protected: 651 protected:
650 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 652 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
651 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 653 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
652 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 654 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
653}; 655};
654 656
655#endif 657#endif