summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-04 10:29:18 (UTC)
committer zautrix <zautrix>2005-06-04 10:29:18 (UTC)
commita7939017000e165e711e3f0cffeab46852a9fb2e (patch) (unidiff)
tree6b1c0d44051039e47f7b7f6cf55e25af9a6e7024
parentd40cf5135c640506011334364274b8ee5df9998b (diff)
downloadkdepimpi-a7939017000e165e711e3f0cffeab46852a9fb2e.zip
kdepimpi-a7939017000e165e711e3f0cffeab46852a9fb2e.tar.gz
kdepimpi-a7939017000e165e711e3f0cffeab46852a9fb2e.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/ic_family.pngbin0 -> 7865 bytes
-rw-r--r--bin/kdepim/korganizer/ic_female.pngbin0 -> 6234 bytes
-rw-r--r--bin/kdepim/korganizer/ic_kids.pngbin0 -> 9039 bytes
-rw-r--r--bin/kdepim/korganizer/ic_male.pngbin0 -> 6440 bytes
-rw-r--r--bin/kdepim/korganizer/ic_penguin.pngbin0 -> 5343 bytes
-rw-r--r--korganizer/calendarview.cpp40
6 files changed, 27 insertions, 13 deletions
diff --git a/bin/kdepim/korganizer/ic_family.png b/bin/kdepim/korganizer/ic_family.png
new file mode 100644
index 0000000..6b0dec6
--- a/dev/null
+++ b/bin/kdepim/korganizer/ic_family.png
Binary files differ
diff --git a/bin/kdepim/korganizer/ic_female.png b/bin/kdepim/korganizer/ic_female.png
new file mode 100644
index 0000000..74deae4
--- a/dev/null
+++ b/bin/kdepim/korganizer/ic_female.png
Binary files differ
diff --git a/bin/kdepim/korganizer/ic_kids.png b/bin/kdepim/korganizer/ic_kids.png
new file mode 100644
index 0000000..fdbdabc
--- a/dev/null
+++ b/bin/kdepim/korganizer/ic_kids.png
Binary files differ
diff --git a/bin/kdepim/korganizer/ic_male.png b/bin/kdepim/korganizer/ic_male.png
new file mode 100644
index 0000000..f22eaab
--- a/dev/null
+++ b/bin/kdepim/korganizer/ic_male.png
Binary files differ
diff --git a/bin/kdepim/korganizer/ic_penguin.png b/bin/kdepim/korganizer/ic_penguin.png
new file mode 100644
index 0000000..a78da37
--- a/dev/null
+++ b/bin/kdepim/korganizer/ic_penguin.png
Binary files differ
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 42166ab..608b73b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,393 +1,400 @@
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 setBackgroundColor( QColor( 86, 153, 205 ) ); 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->type() == "Event" ) { 173 if ( inc->type() == "Event" ) {
174 tempText += "href=\"event:"; 174 tempText += "href=\"event:";
175 } else if ( inc->type() == "Todo" ) { 175 } else if ( inc->type() == "Todo" ) {
176 tempText += "href=\"todo:"; 176 tempText += "href=\"todo:";
177 } 177 }
178 tempText += inc->uid() + "\">"; 178 tempText += inc->uid() + "\">";
179 if ( inc->type() == "Todo" ) 179 if ( inc->type() == "Todo" )
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>";
192 mText += "<table>";
191 time = 1; 193 time = 1;
192 mText +="</table>"; 194 }
195 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
196 if ( time > 0 )
197 mText +="</table>";
193 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 198 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
194 mText += "<table>"; 199 mText += "<table>";
200 time = 2;
195 201
196 } 202 }
197 if ( dt.date() > QDate::currentDate() && time != 2 ) { 203 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
198 time = 2; 204 if ( time > 0 )
199 mText +="</table>"; 205 mText +="</table>";
200 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 206 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
201 mText += "<table>"; 207 mText += "<table>";
208 time = 3;
202 } 209 }
203 mText +="<tr><td><b>"; 210 mText +="<tr><td><b>";
204 mText += timestr; 211 mText += timestr;
205 mText += "</b></td><td>"; 212 mText += "</b></td><td>";
206 mText += tempText; 213 mText += tempText;
207 mText += "</td></tr>\n"; 214 mText += "</td></tr>\n";
208 inc = getNextInc( start ); 215 inc = getNextInc( start );
209 } 216 }
210 mText +="</table>"; 217 mText +="</table>";
211 setText( mText ); 218 setText( mText );
212} 219}
213 220
214MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 221MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
215{ 222{
216 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 223 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
217} 224}
218Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 225Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
219{ 226{
220 QDateTime dt ; 227 QDateTime dt ;
221 Incidence * retInc; 228 Incidence * retInc;
222 Incidence * inc = mAlarms.first(); 229 Incidence * inc = mAlarms.first();
223 if ( inc == 0 ) 230 if ( inc == 0 )
224 return 0; 231 return 0;
225 bool ok; 232 bool ok;
226 dt = inc->getNextOccurence( start, &ok ); 233 dt = inc->getNextOccurence( start, &ok );
227 if ( ! ok ) return 0; 234 if ( ! ok ) return 0;
228 QDateTime dtn ; 235 QDateTime dtn ;
229 retInc = inc; 236 retInc = inc;
230 inc = mAlarms.next(); 237 inc = mAlarms.next();
231 while ( inc ) { 238 while ( inc ) {
232 dtn = inc->getNextOccurence( start, &ok ); 239 dtn = inc->getNextOccurence( start, &ok );
233 if ( ! ok ) return 0; 240 if ( ! ok ) return 0;
234 if ( dtn < dt ) { 241 if ( dtn < dt ) {
235 dt = dtn; 242 dt = dtn;
236 retInc = inc; 243 retInc = inc;
237 } 244 }
238 inc = mAlarms.next(); 245 inc = mAlarms.next();
239 } 246 }
240 mAlarms.remove( retInc ); 247 mAlarms.remove( retInc );
241 return retInc; 248 return retInc;
242 249
243} 250}
244void MissedAlarmTextBrowser::setSource(const QString & n) 251void MissedAlarmTextBrowser::setSource(const QString & n)
245{ 252{
246 if (n.startsWith("event:")) { 253 if (n.startsWith("event:")) {
247#ifdef DESKTOP_VERSION 254#ifdef DESKTOP_VERSION
248 emit showIncidence(n.mid(8)); 255 emit showIncidence(n.mid(8));
249#else 256#else
250 emit showIncidence(n.mid(6)); 257 emit showIncidence(n.mid(6));
251#endif 258#endif
252 return; 259 return;
253 } else if (n.startsWith("todo:")) { 260 } else if (n.startsWith("todo:")) {
254#ifdef DESKTOP_VERSION 261#ifdef DESKTOP_VERSION
255 emit showIncidence(n.mid(7)); 262 emit showIncidence(n.mid(7));
256#else 263#else
257 emit showIncidence(n.mid(5)); 264 emit showIncidence(n.mid(5));
258#endif 265#endif
259 return; 266 return;
260 } 267 }
261} 268}
262 269
263 270
264class KOBeamPrefs : public QDialog 271class KOBeamPrefs : public QDialog
265{ 272{
266 public: 273 public:
267 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 274 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
268 QDialog( parent, name, true ) 275 QDialog( parent, name, true )
269 { 276 {
270 setCaption( i18n("Beam Options") ); 277 setCaption( i18n("Beam Options") );
271 QVBoxLayout* lay = new QVBoxLayout( this ); 278 QVBoxLayout* lay = new QVBoxLayout( this );
272 lay->setSpacing( 3 ); 279 lay->setSpacing( 3 );
273 lay->setMargin( 3 ); 280 lay->setMargin( 3 );
274 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 281 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
275 lay->addWidget( format ); 282 lay->addWidget( format );
276 format->setExclusive ( true ) ; 283 format->setExclusive ( true ) ;
277 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 284 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
278 lay->addWidget( time ); time->setExclusive ( true ) ; 285 lay->addWidget( time ); time->setExclusive ( true ) ;
279 vcal = new QRadioButton(" vCalendar ", format ); 286 vcal = new QRadioButton(" vCalendar ", format );
280 ical = new QRadioButton(" iCalendar ", format ); 287 ical = new QRadioButton(" iCalendar ", format );
281 vcal->setChecked( true ); 288 vcal->setChecked( true );
282 tz = new QRadioButton(i18n(" With timezone "), time ); 289 tz = new QRadioButton(i18n(" With timezone "), time );
283 local = new QRadioButton(i18n(" Local time "), time ); 290 local = new QRadioButton(i18n(" Local time "), time );
284 tz->setChecked( true ); 291 tz->setChecked( true );
285 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 292 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
286 lay->addWidget( ok ); 293 lay->addWidget( ok );
287 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 294 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
288 lay->addWidget( cancel ); 295 lay->addWidget( cancel );
289 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 296 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
290 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 297 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
291 resize( 200, 200 ); 298 resize( 200, 200 );
292 } 299 }
293 300
294 bool beamVcal() { return vcal->isChecked(); } 301 bool beamVcal() { return vcal->isChecked(); }
295 bool beamLocal() { return local->isChecked(); } 302 bool beamLocal() { return local->isChecked(); }
296private: 303private:
297 QRadioButton* vcal, *ical, *local, *tz; 304 QRadioButton* vcal, *ical, *local, *tz;
298}; 305};
299class KOCatPrefs : public QDialog 306class KOCatPrefs : public QDialog
300{ 307{
301 public: 308 public:
302 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 309 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
303 QDialog( parent, name, true ) 310 QDialog( parent, name, true )
304 { 311 {
305 setCaption( i18n("Manage new Categories") ); 312 setCaption( i18n("Manage new Categories") );
306 QVBoxLayout* lay = new QVBoxLayout( this ); 313 QVBoxLayout* lay = new QVBoxLayout( this );
307 lay->setSpacing( 3 ); 314 lay->setSpacing( 3 );
308 lay->setMargin( 3 ); 315 lay->setMargin( 3 );
309 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 );
310 lay->addWidget( lab ); 317 lay->addWidget( lab );
311 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 );
312 lay->addWidget( format ); 319 lay->addWidget( format );
313 format->setExclusive ( true ) ; 320 format->setExclusive ( true ) ;
314 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 321 addCatBut = new QRadioButton(i18n("Add to category list"), format );
315 new QRadioButton(i18n("Remove from Events/Todos"), format ); 322 new QRadioButton(i18n("Remove from Events/Todos"), format );
316 addCatBut->setChecked( true ); 323 addCatBut->setChecked( true );
317 QPushButton * ok = new QPushButton( i18n("OK"), this ); 324 QPushButton * ok = new QPushButton( i18n("OK"), this );
318 lay->addWidget( ok ); 325 lay->addWidget( ok );
319 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 326 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
320 lay->addWidget( cancel ); 327 lay->addWidget( cancel );
321 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 328 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
322 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 329 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
323 resize( 200, 200 ); 330 resize( 200, 200 );
324 } 331 }
325 332
326 bool addCat() { return addCatBut->isChecked(); } 333 bool addCat() { return addCatBut->isChecked(); }
327private: 334private:
328 QRadioButton* addCatBut; 335 QRadioButton* addCatBut;
329}; 336};
330 337
331 338
332 339
333CalendarView::CalendarView( CalendarResources *calendar, 340CalendarView::CalendarView( CalendarResources *calendar,
334 QWidget *parent, const char *name ) 341 QWidget *parent, const char *name )
335 : CalendarViewBase( parent, name ), 342 : CalendarViewBase( parent, name ),
336 mCalendar( calendar ), 343 mCalendar( calendar ),
337 mResourceManager( calendar->resourceManager() ) 344 mResourceManager( calendar->resourceManager() )
338{ 345{
339 346
340 mEventEditor = 0; 347 mEventEditor = 0;
341 mTodoEditor = 0; 348 mTodoEditor = 0;
342 349
343 init(); 350 init();
344} 351}
345 352
346CalendarView::CalendarView( Calendar *calendar, 353CalendarView::CalendarView( Calendar *calendar,
347 QWidget *parent, const char *name ) 354 QWidget *parent, const char *name )
348 : CalendarViewBase( parent, name ), 355 : CalendarViewBase( parent, name ),
349 mCalendar( calendar ), 356 mCalendar( calendar ),
350 mResourceManager( 0 ) 357 mResourceManager( 0 )
351{ 358{
352 359
353 mEventEditor = 0; 360 mEventEditor = 0;
354 mTodoEditor = 0; 361 mTodoEditor = 0;
355 init(); 362 init();
356} 363}
357 364
358void CalendarView::init() 365void CalendarView::init()
359{ 366{
360 mNextAlarmDateTime = QDateTime::currentDateTime(); 367 mNextAlarmDateTime = QDateTime::currentDateTime();
361 setFocusPolicy ( NoFocus ); 368 setFocusPolicy ( NoFocus );
362 mViewerCallerIsSearchDialog = false; 369 mViewerCallerIsSearchDialog = false;
363 mBlockShowDates = false; 370 mBlockShowDates = false;
364 beamDialog = new KOBeamPrefs(); 371 beamDialog = new KOBeamPrefs();
365 mDatePickerMode = 0; 372 mDatePickerMode = 0;
366 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
367 writeLocale(); 374 writeLocale();
368 mViewManager = new KOViewManager( this ); 375 mViewManager = new KOViewManager( this );
369 mDialogManager = new KODialogManager( this ); 376 mDialogManager = new KODialogManager( this );
370 mEventViewerDialog = 0; 377 mEventViewerDialog = 0;
371 mModified = false; 378 mModified = false;
372 mReadOnly = false; 379 mReadOnly = false;
373 mSelectedIncidence = 0; 380 mSelectedIncidence = 0;
374 mCalPrinter = 0; 381 mCalPrinter = 0;
375 mFilters.setAutoDelete(true); 382 mFilters.setAutoDelete(true);
376 383
377 mCalendar->registerObserver( this ); 384 mCalendar->registerObserver( this );
378 // TODO: Make sure that view is updated, when calendar is changed. 385 // TODO: Make sure that view is updated, when calendar is changed.
379 386
380 mStorage = new FileStorage( mCalendar ); 387 mStorage = new FileStorage( mCalendar );
381 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 388 mNavigator = new DateNavigator( this, "datevav", mViewManager );
382 389
383 QBoxLayout *topLayout = (QBoxLayout*)layout(); 390 QBoxLayout *topLayout = (QBoxLayout*)layout();
384#ifndef KORG_NOSPLITTER 391#ifndef KORG_NOSPLITTER
385 // create the main layout frames. 392 // create the main layout frames.
386 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
387 topLayout->addWidget(mPanner); 394 topLayout->addWidget(mPanner);
388 395
389 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
390 "CalendarView::LeftFrame"); 397 "CalendarView::LeftFrame");
391 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
392 399
393 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
@@ -445,416 +452,423 @@ void CalendarView::init()
445#if 0 452#if 0
446 // FIXME 453 // FIXME
447 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
448 "CalendarView::DateNavigator", QDate::currentDate()); 455 "CalendarView::DateNavigator", QDate::currentDate());
449#endif 456#endif
450 // mDateNavigator->blockSignals( true ); 457 // mDateNavigator->blockSignals( true );
451 //leftFrameLayout->addWidget( mDateNavigator ); 458 //leftFrameLayout->addWidget( mDateNavigator );
452 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
453 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
454 mTodoList->setNavigator( mNavigator ); 461 mTodoList->setNavigator( mNavigator );
455#if 0 462#if 0
456 if ( QApplication::desktop()->width() < 480 ) { 463 if ( QApplication::desktop()->width() < 480 ) {
457 leftFrameLayout->addWidget(mFilterView); 464 leftFrameLayout->addWidget(mFilterView);
458 leftFrameLayout->addWidget(mTodoList, 2 ); 465 leftFrameLayout->addWidget(mTodoList, 2 );
459 466
460 } else { 467 } else {
461 leftFrameLayout->addWidget(mTodoList,2 ); 468 leftFrameLayout->addWidget(mTodoList,2 );
462 leftFrameLayout->addWidget(mFilterView ); 469 leftFrameLayout->addWidget(mFilterView );
463 } 470 }
464#endif 471#endif
465 mFilterView->hide(); 472 mFilterView->hide();
466 QWidget *rightBox = new QWidget( mMainFrame ); 473 QWidget *rightBox = new QWidget( mMainFrame );
467 //mainBoxLayout->addWidget ( rightBox, 10 ); 474 //mainBoxLayout->addWidget ( rightBox, 10 );
468 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 475 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
469 mRightFrame = new QWidgetStack( rightBox ); 476 mRightFrame = new QWidgetStack( rightBox );
470 rightLayout->addWidget( mRightFrame, 10 ); 477 rightLayout->addWidget( mRightFrame, 10 );
471 478
472 //mLeftFrame = (QWidget *)leftFrame; 479 //mLeftFrame = (QWidget *)leftFrame;
473 if ( KOPrefs::instance()->mVerticalScreen ) { 480 if ( KOPrefs::instance()->mVerticalScreen ) {
474 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 481 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
475 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 482 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
476 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 483 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
477 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 484 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
478 } else { 485 } else {
479 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 486 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
480 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 487 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
481 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 488 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
482 } 489 }
483 if ( !KOPrefs::instance()->mShowDateNavigator) 490 if ( !KOPrefs::instance()->mShowDateNavigator)
484 mDateNavigator->hide(); 491 mDateNavigator->hide();
485 //qDebug("Calendarview Size %d %d ", width(), height()); 492 //qDebug("Calendarview Size %d %d ", width(), height());
486#endif 493#endif
487 494
488 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 495 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
489 SLOT( showDates( const KCal::DateList & ) ) ); 496 SLOT( showDates( const KCal::DateList & ) ) );
490 497
491 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 498 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
492 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 499 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
493 500
494 501
495 502
496 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 503 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
497 mViewManager, SLOT( showMonth( const QDate & ) ) ); 504 mViewManager, SLOT( showMonth( const QDate & ) ) );
498 505
499 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 506 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
500 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 507 mNavigator, SLOT( selectWeek( const QDate & ) ) );
501 508
502 connect( mDateNavigator, SIGNAL( goPrevYear() ), 509 connect( mDateNavigator, SIGNAL( goPrevYear() ),
503 mNavigator, SLOT( selectPreviousYear() ) ); 510 mNavigator, SLOT( selectPreviousYear() ) );
504 connect( mDateNavigator, SIGNAL( goNextYear() ), 511 connect( mDateNavigator, SIGNAL( goNextYear() ),
505 mNavigator, SLOT( selectNextYear() ) ); 512 mNavigator, SLOT( selectNextYear() ) );
506 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 513 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
507 mNavigator, SLOT( selectPreviousMonth() ) ); 514 mNavigator, SLOT( selectPreviousMonth() ) );
508 connect( mDateNavigator, SIGNAL( goNextMonth() ), 515 connect( mDateNavigator, SIGNAL( goNextMonth() ),
509 mNavigator, SLOT( selectNextMonth() ) ); 516 mNavigator, SLOT( selectNextMonth() ) );
510 517
511 connect( mDateNavigator, SIGNAL( goPrevious() ), 518 connect( mDateNavigator, SIGNAL( goPrevious() ),
512 mNavigator, SLOT( selectPrevious() ) ); 519 mNavigator, SLOT( selectPrevious() ) );
513 connect( mDateNavigator, SIGNAL( goNext() ), 520 connect( mDateNavigator, SIGNAL( goNext() ),
514 mNavigator, SLOT( selectNext() ) ); 521 mNavigator, SLOT( selectNext() ) );
515 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 522 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
516 mNavigator, SLOT( slotMonthSelect( int ) ) ); 523 mNavigator, SLOT( slotMonthSelect( int ) ) );
517 524
518 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 525 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
519 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 526 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
520#if 0 527#if 0
521 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 528 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
522 SLOT( incidenceAdded( Incidence *) ) ); 529 SLOT( incidenceAdded( Incidence *) ) );
523#endif 530#endif
524 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 531 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
525 532
526 connect( this, SIGNAL( configChanged() ), 533 connect( this, SIGNAL( configChanged() ),
527 mDateNavigator, SLOT( updateConfig() ) ); 534 mDateNavigator, SLOT( updateConfig() ) );
528 535
529 connect( mTodoList, SIGNAL( newTodoSignal() ), 536 connect( mTodoList, SIGNAL( newTodoSignal() ),
530 SLOT( newTodo() ) ); 537 SLOT( newTodo() ) );
531 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 538 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
532 SLOT( newSubTodo( Todo * ) ) ); 539 SLOT( newSubTodo( Todo * ) ) );
533 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 540 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
534 SLOT( editTodo( Todo * ) ) ); 541 SLOT( editTodo( Todo * ) ) );
535 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 542 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
536 SLOT( showTodo( Todo *) ) ); 543 SLOT( showTodo( Todo *) ) );
537 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 544 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
538 SLOT( deleteTodo( Todo *) ) ); 545 SLOT( deleteTodo( Todo *) ) );
539 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 546 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
540 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 547 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
541 SLOT( purgeCompleted() ) ); 548 SLOT( purgeCompleted() ) );
542 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 549 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
543 SIGNAL( todoModified( Todo *, int ) ) ); 550 SIGNAL( todoModified( Todo *, int ) ) );
544 551
545 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 552 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
546 this, SLOT ( cloneIncidence( Incidence * ) ) ); 553 this, SLOT ( cloneIncidence( Incidence * ) ) );
547 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 554 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
548 this, SLOT (cancelIncidence( Incidence * ) ) ); 555 this, SLOT (cancelIncidence( Incidence * ) ) );
549 556
550 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 557 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
551 this, SLOT ( moveIncidence( Incidence * ) ) ); 558 this, SLOT ( moveIncidence( Incidence * ) ) );
552 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 559 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
553 this, SLOT ( beamIncidence( Incidence * ) ) ); 560 this, SLOT ( beamIncidence( Incidence * ) ) );
554 561
555 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 562 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
556 this, SLOT ( todo_unsub( Todo * ) ) ); 563 this, SLOT ( todo_unsub( Todo * ) ) );
557 564
558 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 565 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
559 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 566 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
560 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 567 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
561 SLOT( updateTodo( Todo *, int ) ) ); 568 SLOT( updateTodo( Todo *, int ) ) );
562 connect( this, SIGNAL( todoModified( Todo *, int )), this, 569 connect( this, SIGNAL( todoModified( Todo *, int )), this,
563 SLOT( changeTodoDisplay( Todo *, int ) ) ); 570 SLOT( changeTodoDisplay( Todo *, int ) ) );
564 571
565 572
566 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 573 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
567 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 574 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
568 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 575 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
569 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 576 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
570 577
571 578
572 579
573 580
574 581
575 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 582 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
576 SLOT(checkClipboard())); 583 SLOT(checkClipboard()));
577 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 584 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
578 SLOT( processTodoListSelection( Incidence * ) ) ); 585 SLOT( processTodoListSelection( Incidence * ) ) );
579 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 586 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
580 587
581 // kdDebug() << "CalendarView::CalendarView() done" << endl; 588 // kdDebug() << "CalendarView::CalendarView() done" << endl;
582 589
583 mDateFrame = new QVBox(0,0,WType_Popup); 590 mDateFrame = new QVBox(0,0,WType_Popup);
584 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 591 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
585 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 592 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
586 mDateFrame->setLineWidth(3); 593 mDateFrame->setLineWidth(3);
587 mDateFrame->hide(); 594 mDateFrame->hide();
588 mDateFrame->setCaption( i18n( "Pick a date to display")); 595 mDateFrame->setCaption( i18n( "Pick a date to display"));
589 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 596 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
590 597
591 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 598 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
592 599
593 mEventEditor = mDialogManager->getEventEditor(); 600 mEventEditor = mDialogManager->getEventEditor();
594 mTodoEditor = mDialogManager->getTodoEditor(); 601 mTodoEditor = mDialogManager->getTodoEditor();
595 602
596 mFlagEditDescription = false; 603 mFlagEditDescription = false;
597 604
598 mSuspendTimer = new QTimer( this ); 605 mSuspendTimer = new QTimer( this );
599 mAlarmTimer = new QTimer( this ); 606 mAlarmTimer = new QTimer( this );
600 mRecheckAlarmTimer = new QTimer( this ); 607 mRecheckAlarmTimer = new QTimer( this );
601 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 608 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
602 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 609 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
603 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 610 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
604 mAlarmDialog = new AlarmDialog( this ); 611 mAlarmDialog = new AlarmDialog( this );
605 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 612 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
606 mAlarmDialog->setServerNotification( false ); 613 mAlarmDialog->setServerNotification( false );
607 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 614 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
608 615
609 616
610#ifndef DESKTOP_VERSION 617#ifndef DESKTOP_VERSION
611//US listen for arriving address resultsets 618//US listen for arriving address resultsets
612 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 619 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
613 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 620 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
614#endif 621#endif
615 mDateNavigator->setCalendar( mCalendar ); 622 mDateNavigator->setCalendar( mCalendar );
616} 623}
617 624
618 625
619CalendarView::~CalendarView() 626CalendarView::~CalendarView()
620{ 627{
621 // kdDebug() << "~CalendarView()" << endl; 628 // kdDebug() << "~CalendarView()" << endl;
622 //qDebug("CalendarView::~CalendarView() "); 629 //qDebug("CalendarView::~CalendarView() ");
623 delete mDialogManager; 630 delete mDialogManager;
624 delete mViewManager; 631 delete mViewManager;
625 delete mStorage; 632 delete mStorage;
626 delete mDateFrame ; 633 delete mDateFrame ;
627 delete beamDialog; 634 delete beamDialog;
628 delete mEventViewerDialog; 635 delete mEventViewerDialog;
629 //kdDebug() << "~CalendarView() done" << endl; 636 //kdDebug() << "~CalendarView() done" << endl;
630} 637}
631void CalendarView::checkAlarms() 638void CalendarView::checkAlarms()
632{ 639{
633 KConfig *config = KOGlobals::config(); 640 KConfig *config = KOGlobals::config();
634 config->setGroup( "AppRun" ); 641 config->setGroup( "AppRun" );
635 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 642 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
636 int secs = config->readNumEntry( "LatestProgramStop" ) - 30; 643 int secs = config->readNumEntry( "LatestProgramStop" ) - 30;
637 secs -= ( 3600 * 24*3 ); // debug only 644 //secs -= ( 3600 * 24*3 ); // debug only
638 QDateTime latest = dt.addSecs ( secs ); 645 QDateTime latest = dt.addSecs ( secs );
639 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 646 qDebug("KO: Last termination on %s ", latest.toString().latin1());
640 QPtrList<Incidence> el = mCalendar->rawIncidences(); 647 QPtrList<Incidence> el = mCalendar->rawIncidences();
641 QPtrList<Incidence> al; 648 QPtrList<Incidence> al;
642 Incidence* inL = el.first(); 649 Incidence* inL = el.first();
643 while ( inL ) { 650 while ( inL ) {
644 bool ok = false; 651 bool ok = false;
645 int offset = 0; 652 int offset = 0;
646 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 653 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
647 if ( ok ) { 654 if ( ok ) {
648 //qDebug("OK %s",next.toString().latin1()); 655 //qDebug("OK %s",next.toString().latin1());
649 if ( next < QDateTime::currentDateTime() ) { 656 if ( next < QDateTime::currentDateTime() ) {
650 al.append( inL ); 657 al.append( inL );
651 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 658 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
652 } 659 }
653 } 660 }
654 inL = el.next(); 661 inL = el.next();
655 } 662 }
656 if ( al.count() ) { 663 if ( al.count() ) {
657 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 664 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
658 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 665 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
659 QVBoxLayout* lay = new QVBoxLayout( dia ); 666 QVBoxLayout* lay = new QVBoxLayout( dia );
660 lay->setSpacing( 0 ); 667 lay->setSpacing( 0 );
661 lay->setMargin( 0 ); 668 lay->setMargin( 0 );
662 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 669 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
663 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 670 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
664 lay->addWidget( matb ); 671 lay->addWidget( matb );
665 int si = 220; 672 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
666 if ( QApplication::desktop()->width() > 470 ) 673 int wid = 210;
667 si = 400; 674 int x = QApplication::desktop()->width() - wid - 7;
668 dia->resize(si,si/2); 675 int y = QApplication::desktop()->height() - wid - 70;
676 dia->setGeometry ( x,y,wid,wid);
677 } else {
678 int si = 220;
679 if ( QApplication::desktop()->width() > 470 )
680 si = 400;
681 dia->resize(si,si/2);
682 }
669 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 683 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
670 dia->show(); 684 dia->show();
671 685
672 } 686 }
673} 687}
674void CalendarView::showDay( QDate d ) 688void CalendarView::showDay( QDate d )
675{ 689{
676 dateNavigator()->blockSignals( true ); 690 dateNavigator()->blockSignals( true );
677 dateNavigator()->selectDate( d ); 691 dateNavigator()->selectDate( d );
678 dateNavigator()->blockSignals( false ); 692 dateNavigator()->blockSignals( false );
679 mViewManager->showDayView(); 693 mViewManager->showDayView();
680 //dateNavigator()->selectDate( d ); 694 //dateNavigator()->selectDate( d );
681} 695}
682void CalendarView::timerAlarm() 696void CalendarView::timerAlarm()
683{ 697{
684 //qDebug("CalendarView::timerAlarm() "); 698 //qDebug("CalendarView::timerAlarm() ");
685 computeAlarm(mAlarmNotification ); 699 computeAlarm(mAlarmNotification );
686} 700}
687 701
688void CalendarView::suspendAlarm() 702void CalendarView::suspendAlarm()
689{ 703{
690 //qDebug(" CalendarView::suspendAlarm() "); 704 //qDebug(" CalendarView::suspendAlarm() ");
691 computeAlarm(mSuspendAlarmNotification ); 705 computeAlarm(mSuspendAlarmNotification );
692 706
693} 707}
694 708
695void CalendarView::startAlarm( QString mess , QString filename) 709void CalendarView::startAlarm( QString mess , QString filename)
696{ 710{
697 711
698 topLevelWidget()->showNormal(); 712 topLevelWidget()->showNormal();
699 topLevelWidget()->setActiveWindow(); 713 topLevelWidget()->setActiveWindow();
700 topLevelWidget()->raise(); 714 topLevelWidget()->raise();
701 715
702 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 716 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
703 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 717 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
704 718
705} 719}
706 720
707void CalendarView::checkNextTimerAlarm() 721void CalendarView::checkNextTimerAlarm()
708{ 722{
709 mCalendar->checkAlarmForIncidence( 0, true ); 723 mCalendar->checkAlarmForIncidence( 0, true );
710} 724}
711 725
712void CalendarView::computeAlarm( QString msg ) 726void CalendarView::computeAlarm( QString msg )
713{ 727{
714 728
715 QString mess = msg; 729 QString mess = msg;
716 QString mAlarmMessage = mess.mid( 9 ); 730 QString mAlarmMessage = mess.mid( 9 );
717 QString filename = MainWindow::resourcePath(); 731 QString filename = MainWindow::resourcePath();
718 filename += "koalarm.wav"; 732 filename += "koalarm.wav";
719 QString tempfilename; 733 QString tempfilename;
720 if ( mess.left( 13 ) == "suspend_alarm") { 734 if ( mess.left( 13 ) == "suspend_alarm") {
721 bool error = false; 735 bool error = false;
722 int len = mess.mid( 13 ).find("+++"); 736 int len = mess.mid( 13 ).find("+++");
723 if ( len < 2 ) 737 if ( len < 2 )
724 error = true; 738 error = true;
725 else { 739 else {
726 tempfilename = mess.mid( 13, len ); 740 tempfilename = mess.mid( 13, len );
727 if ( !QFile::exists( tempfilename ) ) 741 if ( !QFile::exists( tempfilename ) )
728 error = true; 742 error = true;
729 } 743 }
730 if ( ! error ) { 744 if ( ! error ) {
731 filename = tempfilename; 745 filename = tempfilename;
732 } 746 }
733 mAlarmMessage = mess.mid( 13+len+3 ); 747 mAlarmMessage = mess.mid( 13+len+3 );
734 //qDebug("suspend file %s ",tempfilename.latin1() ); 748 //qDebug("suspend file %s ",tempfilename.latin1() );
735 startAlarm( mAlarmMessage, filename); 749 startAlarm( mAlarmMessage, filename);
736 return; 750 return;
737 } 751 }
738 if ( mess.left( 11 ) == "timer_alarm") { 752 if ( mess.left( 11 ) == "timer_alarm") {
739 //mTimerTime = 0; 753 //mTimerTime = 0;
740 startAlarm( mess.mid( 11 ), filename ); 754 startAlarm( mess.mid( 11 ), filename );
741 return; 755 return;
742 } 756 }
743 if ( mess.left( 10 ) == "proc_alarm") { 757 if ( mess.left( 10 ) == "proc_alarm") {
744 bool error = false; 758 bool error = false;
745 int len = mess.mid( 10 ).find("+++"); 759 int len = mess.mid( 10 ).find("+++");
746 if ( len < 2 ) 760 if ( len < 2 )
747 error = true; 761 error = true;
748 else { 762 else {
749 tempfilename = mess.mid( 10, len ); 763 tempfilename = mess.mid( 10, len );
750 if ( !QFile::exists( tempfilename ) ) 764 if ( !QFile::exists( tempfilename ) )
751 error = true; 765 error = true;
752 } 766 }
753 if ( error ) { 767 if ( error ) {
754 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 768 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
755 mAlarmMessage += mess.mid( 10+len+3+9 ); 769 mAlarmMessage += mess.mid( 10+len+3+9 );
756 } else { 770 } else {
757 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 771 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
758 //qDebug("-----system command %s ",tempfilename.latin1() ); 772 //qDebug("-----system command %s ",tempfilename.latin1() );
759#ifndef _WIN32_ 773#ifndef _WIN32_
760 if ( vfork () == 0 ) { 774 if ( vfork () == 0 ) {
761 execl ( tempfilename.latin1(), 0 ); 775 execl ( tempfilename.latin1(), 0 );
762 return; 776 return;
763 } 777 }
764#else 778#else
765 QProcess* p = new QProcess(); 779 QProcess* p = new QProcess();
766 p->addArgument( tempfilename.latin1() ); 780 p->addArgument( tempfilename.latin1() );
767 p->start(); 781 p->start();
768 return; 782 return;
769#endif 783#endif
770 784
771 return; 785 return;
772 } 786 }
773 787
774 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 788 //qDebug("+++++++system command %s ",tempfilename.latin1() );
775 } 789 }
776 if ( mess.left( 11 ) == "audio_alarm") { 790 if ( mess.left( 11 ) == "audio_alarm") {
777 bool error = false; 791 bool error = false;
778 int len = mess.mid( 11 ).find("+++"); 792 int len = mess.mid( 11 ).find("+++");
779 if ( len < 2 ) 793 if ( len < 2 )
780 error = true; 794 error = true;
781 else { 795 else {
782 tempfilename = mess.mid( 11, len ); 796 tempfilename = mess.mid( 11, len );
783 if ( !QFile::exists( tempfilename ) ) 797 if ( !QFile::exists( tempfilename ) )
784 error = true; 798 error = true;
785 } 799 }
786 if ( ! error ) { 800 if ( ! error ) {
787 filename = tempfilename; 801 filename = tempfilename;
788 } 802 }
789 mAlarmMessage = mess.mid( 11+len+3+9 ); 803 mAlarmMessage = mess.mid( 11+len+3+9 );
790 //qDebug("audio file command %s ",tempfilename.latin1() ); 804 //qDebug("audio file command %s ",tempfilename.latin1() );
791 } 805 }
792 if ( mess.left( 9 ) == "cal_alarm") { 806 if ( mess.left( 9 ) == "cal_alarm") {
793 mAlarmMessage = mess.mid( 9 ) ; 807 mAlarmMessage = mess.mid( 9 ) ;
794 } 808 }
795 809
796 startAlarm( mAlarmMessage, filename ); 810 startAlarm( mAlarmMessage, filename );
797 811
798 812
799} 813}
800 814
801void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 815void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
802{ 816{
803 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 817 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
804 818
805 mSuspendAlarmNotification = noti; 819 mSuspendAlarmNotification = noti;
806 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 820 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
807 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 821 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
808 mSuspendTimer->start( ms , true ); 822 mSuspendTimer->start( ms , true );
809 823
810} 824}
811 825
812void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 826void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
813{ 827{
814 mNextAlarmDateTime = qdt; 828 mNextAlarmDateTime = qdt;
815 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 829 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
816 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 830 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
817#ifndef DESKTOP_VERSION 831#ifndef DESKTOP_VERSION
818 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 832 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
819#endif 833#endif
820 return; 834 return;
821 } 835 }
822 int maxSec; 836 int maxSec;
823 //maxSec = 5; //testing only 837 //maxSec = 5; //testing only
824 maxSec = 86400+3600; // one day+1hour 838 maxSec = 86400+3600; // one day+1hour
825 mAlarmNotification = noti; 839 mAlarmNotification = noti;
826 int sec = QDateTime::currentDateTime().secsTo( qdt ); 840 int sec = QDateTime::currentDateTime().secsTo( qdt );
827 if ( sec > maxSec ) { 841 if ( sec > maxSec ) {
828 mRecheckAlarmTimer->start( maxSec * 1000 ); 842 mRecheckAlarmTimer->start( maxSec * 1000 );
829 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 843 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
830 return; 844 return;
831 } else { 845 } else {
832 mRecheckAlarmTimer->stop(); 846 mRecheckAlarmTimer->stop();
833 } 847 }
834 //qDebug("Alarm timer started with secs: %d ", sec); 848 //qDebug("Alarm timer started with secs: %d ", sec);
835 mAlarmTimer->start( sec *1000 , true ); 849 mAlarmTimer->start( sec *1000 , true );
836 850
837} 851}
838// called by mRecheckAlarmTimer to get next alarm 852// called by mRecheckAlarmTimer to get next alarm
839// we need this, because a QTimer has only a max range of 25 days 853// we need this, because a QTimer has only a max range of 25 days
840void CalendarView::recheckTimerAlarm() 854void CalendarView::recheckTimerAlarm()
841{ 855{
842 mAlarmTimer->stop(); 856 mAlarmTimer->stop();
843 mRecheckAlarmTimer->stop(); 857 mRecheckAlarmTimer->stop();
844 mCalendar->checkAlarmForIncidence( 0, true ); 858 mCalendar->checkAlarmForIncidence( 0, true );
845} 859}
846void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 860void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
847{ 861{
848 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 862 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
849 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 863 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
850#ifndef DESKTOP_VERSION 864#ifndef DESKTOP_VERSION
851 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 865 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
852#endif 866#endif
853 return; 867 return;
854 } 868 }
855 mAlarmTimer->stop(); 869 mAlarmTimer->stop();
856} 870}
857void CalendarView::selectWeekNum ( int num ) 871void CalendarView::selectWeekNum ( int num )
858{ 872{
859 dateNavigator()->blockSignals( true ); 873 dateNavigator()->blockSignals( true );
860 dateNavigator()->selectWeek( num ); 874 dateNavigator()->selectWeek( num );