summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp7
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp27
-rw-r--r--korganizer/mainwindow.h5
4 files changed, 30 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 17f1659..a9e402e 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,1047 +1,1042 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preton.brown@yale.edu) 8 Preston Brown (preton.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "koagenda.h" 107#include "koagenda.h"
108#include "kodialogmanager.h" 108#include "kodialogmanager.h"
109#include "outgoingdialog.h" 109#include "outgoingdialog.h"
110#include "incomingdialog.h" 110#include "incomingdialog.h"
111#include "datenavigatorcontainer.h" 111#include "datenavigatorcontainer.h"
112#include "statusdialog.h" 112#include "statusdialog.h"
113#include "kdatenavigator.h" 113#include "kdatenavigator.h"
114#include "kotodoview.h" 114#include "kotodoview.h"
115#include "datenavigator.h" 115#include "datenavigator.h"
116#include "resourceview.h" 116#include "resourceview.h"
117#include "navigatorbar.h" 117#include "navigatorbar.h"
118#include "searchdialog.h" 118#include "searchdialog.h"
119#include "mainwindow.h" 119#include "mainwindow.h"
120#include "categoryeditdialog.h" 120#include "categoryeditdialog.h"
121 121
122#include "calendarview.h" 122#include "calendarview.h"
123#ifndef DESKTOP_VERSION 123#ifndef DESKTOP_VERSION
124#include <qtopia/alarmserver.h> 124#include <qtopia/alarmserver.h>
125#endif 125#endif
126#ifndef _WIN32_ 126#ifndef _WIN32_
127#include <stdlib.h> 127#include <stdlib.h>
128#include <stdio.h> 128#include <stdio.h>
129#include <unistd.h> 129#include <unistd.h>
130#else 130#else
131#include <qprocess.h> 131#include <qprocess.h>
132#endif 132#endif
133 133
134#ifdef DESKTOP_VERSION 134#ifdef DESKTOP_VERSION
135#include <kabc/stdaddressbook.h> 135#include <kabc/stdaddressbook.h>
136#endif 136#endif
137using namespace KOrg; 137using namespace KOrg;
138using namespace KCal; 138using namespace KCal;
139extern int globalFlagBlockAgenda; 139extern int globalFlagBlockAgenda;
140extern int globalFlagBlockStartup; 140extern int globalFlagBlockStartup;
141 141
142 142
143MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 143MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
144 144
145{ 145{
146 mAlarms = alarms; 146 mAlarms = alarms;
147 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 147 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
148 QString mText = "<table width=\"100%\">\n"; 148 QString mText = "<table width=\"100%\">\n";
149 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 149 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
150#ifdef DESKTOP_VERSION 150#ifdef DESKTOP_VERSION
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
152#else 152#else
153 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 153 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
154#endif 154#endif
155 // mText += "<img src=\""; 155 // mText += "<img src=\"";
156 // mText += ipath; 156 // mText += ipath;
157 // mText += "\">"; 157 // mText += "\">";
158 //mEventDate = QDate::currentDate(); 158 //mEventDate = QDate::currentDate();
159#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
161#else 161#else
162 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 162 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
163#endif 163#endif
164 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 164 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
165 165
166 Incidence * inc = getNextInc( start ); 166 Incidence * inc = getNextInc( start );
167 int time = 0; 167 int time = 0;
168 //mText += "<table>"; 168 //mText += "<table>";
169 while ( inc ) { 169 while ( inc ) {
170 QDateTime dt ; 170 QDateTime dt ;
171 QString tempText = "<a "; 171 QString tempText = "<a ";
172 bool ok; 172 bool ok;
173 dt = inc->getNextOccurence( start, &ok ); 173 dt = inc->getNextOccurence( start, &ok );
174 if ( !ok ) continue; 174 if ( !ok ) continue;
175 if ( inc->typeID() == eventID ) { 175 if ( inc->typeID() == eventID ) {
176 tempText += "href=\"event:"; 176 tempText += "href=\"event:";
177 } else if ( inc->typeID() == todoID ) { 177 } else if ( inc->typeID() == todoID ) {
178 tempText += "href=\"todo:"; 178 tempText += "href=\"todo:";
179 } 179 }
180 tempText += inc->uid() + "\">"; 180 tempText += inc->uid() + "\">";
181 if ( inc->typeID() == todoID ) 181 if ( inc->typeID() == todoID )
182 tempText += i18n("Todo: "); 182 tempText += i18n("Todo: ");
183 if ( inc->summary().length() > 0 ) 183 if ( inc->summary().length() > 0 )
184 tempText += inc->summary(); 184 tempText += inc->summary();
185 else 185 else
186 tempText += i18n("-no summary-"); 186 tempText += i18n("-no summary-");
187 QString timestr; 187 QString timestr;
188 if (!inc->doesFloat()) 188 if (!inc->doesFloat())
189 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 189 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
190 else 190 else
191 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 191 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
192 if ( dt.date() < QDate::currentDate() && time == 0 ) { 192 if ( dt.date() < QDate::currentDate() && time == 0 ) {
193 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 193 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
194 mText += "<table>"; 194 mText += "<table>";
195 time = 1; 195 time = 1;
196 } 196 }
197 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 197 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
198 if ( time > 0 ) 198 if ( time > 0 )
199 mText +="</table>"; 199 mText +="</table>";
200 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 200 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
201 mText += "<table>"; 201 mText += "<table>";
202 time = 2; 202 time = 2;
203 203
204 } 204 }
205 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 205 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
206 if ( time > 0 ) 206 if ( time > 0 )
207 mText +="</table>"; 207 mText +="</table>";
208 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 208 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
209 mText += "<table>"; 209 mText += "<table>";
210 time = 3; 210 time = 3;
211 } 211 }
212 mText +="<tr><td><b>"; 212 mText +="<tr><td><b>";
213 mText += timestr; 213 mText += timestr;
214 mText += "</b></td><td>"; 214 mText += "</b></td><td>";
215 mText += tempText; 215 mText += tempText;
216 mText += "</td></tr>\n"; 216 mText += "</td></tr>\n";
217 inc = getNextInc( start ); 217 inc = getNextInc( start );
218 } 218 }
219 mText +="</table>"; 219 mText +="</table>";
220 setText( mText ); 220 setText( mText );
221} 221}
222 222
223MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 223MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
224{ 224{
225 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 225 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
226} 226}
227Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 227Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
228{ 228{
229 QDateTime dt ; 229 QDateTime dt ;
230 Incidence * retInc; 230 Incidence * retInc;
231 Incidence * inc = mAlarms.first(); 231 Incidence * inc = mAlarms.first();
232 if ( inc == 0 ) 232 if ( inc == 0 )
233 return 0; 233 return 0;
234 bool ok; 234 bool ok;
235 dt = inc->getNextOccurence( start, &ok ); 235 dt = inc->getNextOccurence( start, &ok );
236 if ( ! ok ) return 0; 236 if ( ! ok ) return 0;
237 QDateTime dtn ; 237 QDateTime dtn ;
238 retInc = inc; 238 retInc = inc;
239 inc = mAlarms.next(); 239 inc = mAlarms.next();
240 while ( inc ) { 240 while ( inc ) {
241 dtn = inc->getNextOccurence( start, &ok ); 241 dtn = inc->getNextOccurence( start, &ok );
242 if ( ! ok ) return 0; 242 if ( ! ok ) return 0;
243 if ( dtn < dt ) { 243 if ( dtn < dt ) {
244 dt = dtn; 244 dt = dtn;
245 retInc = inc; 245 retInc = inc;
246 } 246 }
247 inc = mAlarms.next(); 247 inc = mAlarms.next();
248 } 248 }
249 mAlarms.remove( retInc ); 249 mAlarms.remove( retInc );
250 return retInc; 250 return retInc;
251 251
252} 252}
253void MissedAlarmTextBrowser::setSource(const QString & n) 253void MissedAlarmTextBrowser::setSource(const QString & n)
254{ 254{
255 if (n.startsWith("event:")) { 255 if (n.startsWith("event:")) {
256#ifdef DESKTOP_VERSION 256#ifdef DESKTOP_VERSION
257 emit showIncidence(n.mid(8)); 257 emit showIncidence(n.mid(8));
258#else 258#else
259 emit showIncidence(n.mid(6)); 259 emit showIncidence(n.mid(6));
260#endif 260#endif
261 return; 261 return;
262 } else if (n.startsWith("todo:")) { 262 } else if (n.startsWith("todo:")) {
263#ifdef DESKTOP_VERSION 263#ifdef DESKTOP_VERSION
264 emit showIncidence(n.mid(7)); 264 emit showIncidence(n.mid(7));
265#else 265#else
266 emit showIncidence(n.mid(5)); 266 emit showIncidence(n.mid(5));
267#endif 267#endif
268 return; 268 return;
269 } 269 }
270} 270}
271 271
272 272
273class KOBeamPrefs : public QDialog 273class KOBeamPrefs : public QDialog
274{ 274{
275 public: 275 public:
276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
277 QDialog( parent, name, true ) 277 QDialog( parent, name, true )
278 { 278 {
279 setCaption( i18n("Beam Options") ); 279 setCaption( i18n("Beam Options") );
280 QVBoxLayout* lay = new QVBoxLayout( this ); 280 QVBoxLayout* lay = new QVBoxLayout( this );
281 lay->setSpacing( 3 ); 281 lay->setSpacing( 3 );
282 lay->setMargin( 3 ); 282 lay->setMargin( 3 );
283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
284 lay->addWidget( format ); 284 lay->addWidget( format );
285 format->setExclusive ( true ) ; 285 format->setExclusive ( true ) ;
286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
287 lay->addWidget( time ); time->setExclusive ( true ) ; 287 lay->addWidget( time ); time->setExclusive ( true ) ;
288 vcal = new QRadioButton(" vCalendar ", format ); 288 vcal = new QRadioButton(" vCalendar ", format );
289 ical = new QRadioButton(" iCalendar ", format ); 289 ical = new QRadioButton(" iCalendar ", format );
290 vcal->setChecked( true ); 290 vcal->setChecked( true );
291 tz = new QRadioButton(i18n(" With timezone "), time ); 291 tz = new QRadioButton(i18n(" With timezone "), time );
292 local = new QRadioButton(i18n(" Local time "), time ); 292 local = new QRadioButton(i18n(" Local time "), time );
293 tz->setChecked( true ); 293 tz->setChecked( true );
294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
295 lay->addWidget( ok ); 295 lay->addWidget( ok );
296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
297 lay->addWidget( cancel ); 297 lay->addWidget( cancel );
298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
300 resize( 200, 200 ); 300 resize( 200, 200 );
301 } 301 }
302 302
303 bool beamVcal() { return vcal->isChecked(); } 303 bool beamVcal() { return vcal->isChecked(); }
304 bool beamLocal() { return local->isChecked(); } 304 bool beamLocal() { return local->isChecked(); }
305private: 305private:
306 QRadioButton* vcal, *ical, *local, *tz; 306 QRadioButton* vcal, *ical, *local, *tz;
307}; 307};
308class KOCatPrefs : public QDialog 308class KOCatPrefs : public QDialog
309{ 309{
310 public: 310 public:
311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
312 QDialog( parent, name, true ) 312 QDialog( parent, name, true )
313 { 313 {
314 setCaption( i18n("Manage new Categories") ); 314 setCaption( i18n("Manage new Categories") );
315 QVBoxLayout* lay = new QVBoxLayout( this ); 315 QVBoxLayout* lay = new QVBoxLayout( this );
316 lay->setSpacing( 3 ); 316 lay->setSpacing( 3 );
317 lay->setMargin( 3 ); 317 lay->setMargin( 3 );
318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
319 lay->addWidget( lab ); 319 lay->addWidget( lab );
320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
321 lay->addWidget( format ); 321 lay->addWidget( format );
322 format->setExclusive ( true ) ; 322 format->setExclusive ( true ) ;
323 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 323 addCatBut = new QRadioButton(i18n("Add to category list"), format );
324 new QRadioButton(i18n("Remove from Events/Todos"), format ); 324 new QRadioButton(i18n("Remove from Events/Todos"), format );
325 addCatBut->setChecked( true ); 325 addCatBut->setChecked( true );
326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
327 lay->addWidget( ok ); 327 lay->addWidget( ok );
328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
329 lay->addWidget( cancel ); 329 lay->addWidget( cancel );
330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
332 resize( 200, 200 ); 332 resize( 200, 200 );
333 } 333 }
334 334
335 bool addCat() { return addCatBut->isChecked(); } 335 bool addCat() { return addCatBut->isChecked(); }
336private: 336private:
337 QRadioButton* addCatBut; 337 QRadioButton* addCatBut;
338}; 338};
339 339
340 340
341 341
342CalendarView::CalendarView( CalendarResources *calendar, 342CalendarView::CalendarView( CalendarResources *calendar,
343 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
344 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
345 mCalendar( calendar ), 345 mCalendar( calendar ),
346 mResourceManager( calendar->resourceManager() ) 346 mResourceManager( calendar->resourceManager() )
347{ 347{
348 348
349 mEventEditor = 0; 349 mEventEditor = 0;
350 mTodoEditor = 0; 350 mTodoEditor = 0;
351 351
352 init(); 352 init();
353} 353}
354 354
355CalendarView::CalendarView( Calendar *calendar, 355CalendarView::CalendarView( Calendar *calendar,
356 QWidget *parent, const char *name ) 356 QWidget *parent, const char *name )
357 : CalendarViewBase( parent, name ), 357 : CalendarViewBase( parent, name ),
358 mCalendar( calendar ), 358 mCalendar( calendar ),
359 mResourceManager( 0 ) 359 mResourceManager( 0 )
360{ 360{
361 361
362 mEventEditor = 0; 362 mEventEditor = 0;
363 mTodoEditor = 0; 363 mTodoEditor = 0;
364 init(); 364 init();
365} 365}
366 366
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 mNextAlarmDateTime = QDateTime::currentDateTime(); 369 mNextAlarmDateTime = QDateTime::currentDateTime();
370 //setFocusPolicy ( NoFocus ); 370 setFocusPolicy (NoFocus );
371 mViewerCallerIsSearchDialog = false; 371 mViewerCallerIsSearchDialog = false;
372 mBlockShowDates = false; 372 mBlockShowDates = false;
373 373
374 mDatePickerMode = 0; 374 mDatePickerMode = 0;
375 mCurrentSyncDevice = ""; 375 mCurrentSyncDevice = "";
376 mViewManager = new KOViewManager( this ); 376 mViewManager = new KOViewManager( this );
377 mDialogManager = new KODialogManager( this ); 377 mDialogManager = new KODialogManager( this );
378 mEventViewerDialog = 0; 378 mEventViewerDialog = 0;
379 mModified = false; 379 mModified = false;
380 mReadOnly = false; 380 mReadOnly = false;
381 mSelectedIncidence = 0; 381 mSelectedIncidence = 0;
382 mCalPrinter = 0; 382 mCalPrinter = 0;
383 mFilters.setAutoDelete(true); 383 mFilters.setAutoDelete(true);
384 384
385 mCalendar->registerObserver( this ); 385 mCalendar->registerObserver( this );
386 // TODO: Make sure that view is updated, when calendar is changed. 386 // TODO: Make sure that view is updated, when calendar is changed.
387 387
388 mStorage = new FileStorage( mCalendar ); 388 mStorage = new FileStorage( mCalendar );
389 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 389 mNavigator = new DateNavigator( this, "datevav", mViewManager );
390 390
391 QBoxLayout *topLayout = (QBoxLayout*)layout(); 391 QBoxLayout *topLayout = (QBoxLayout*)layout();
392#ifndef KORG_NOSPLITTER 392#ifndef KORG_NOSPLITTER
393 // create the main layout frames. 393 // create the main layout frames.
394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
395 topLayout->addWidget(mPanner); 395 topLayout->addWidget(mPanner);
396 396
397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
398 "CalendarView::LeftFrame"); 398 "CalendarView::LeftFrame");
399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
400 400
401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
402 "CalendarView::DateNavigator" ); 402 "CalendarView::DateNavigator" );
403 403
404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
406 mTodoList->setNavigator( mNavigator ); 406 mTodoList->setNavigator( mNavigator );
407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
408 408
409#ifdef KORG_NORESOURCEVIEW 409#ifdef KORG_NORESOURCEVIEW
410 mResourceView = 0; 410 mResourceView = 0;
411#else 411#else
412 if ( mResourceManager ) { 412 if ( mResourceManager ) {
413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
414 mResourceView->updateView(); 414 mResourceView->updateView();
415 connect( mResourceView, SIGNAL( resourcesChanged() ), 415 connect( mResourceView, SIGNAL( resourcesChanged() ),
416 SLOT( updateView() ) ); 416 SLOT( updateView() ) );
417 } else { 417 } else {
418 mResourceView = 0; 418 mResourceView = 0;
419 } 419 }
420#endif 420#endif
421 QWidget *rightBox = new QWidget( mPanner ); 421 QWidget *rightBox = new QWidget( mPanner );
422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
423 423
424 mRightFrame = new QWidgetStack( rightBox ); 424 mRightFrame = new QWidgetStack( rightBox );
425 rightLayout->addWidget( mRightFrame, 1 ); 425 rightLayout->addWidget( mRightFrame, 1 );
426 426
427 mLeftFrame = mLeftSplitter; 427 mLeftFrame = mLeftSplitter;
428#else 428#else
429 //QWidget *mainBox = new QWidget( this ); 429 //QWidget *mainBox = new QWidget( this );
430 //QWidget *leftFrame = new QWidget( mainBox ); 430 //QWidget *leftFrame = new QWidget( mainBox );
431 //QBoxLayout * mainBoxLayout; 431 //QBoxLayout * mainBoxLayout;
432 if ( KOPrefs::instance()->mVerticalScreen ) { 432 if ( KOPrefs::instance()->mVerticalScreen ) {
433 //mainBoxLayout = new QVBoxLayout(mainBox); 433 //mainBoxLayout = new QVBoxLayout(mainBox);
434 //leftFrameLayout = new QHBoxLayout(leftFrame ); 434 //leftFrameLayout = new QHBoxLayout(leftFrame );
435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
439 } else { 439 } else {
440 //mainBoxLayout = new QHBoxLayout(mainBox); 440 //mainBoxLayout = new QHBoxLayout(mainBox);
441 //leftFrameLayout = new QVBoxLayout(leftFrame ); 441 //leftFrameLayout = new QVBoxLayout(leftFrame );
442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
446 } 446 }
447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
448 //QBoxLayout * leftFrameLayout; 448 //QBoxLayout * leftFrameLayout;
449 topLayout->addWidget( mMainFrame ); 449 topLayout->addWidget( mMainFrame );
450#ifdef DESKTOP_VERSION 450#ifdef DESKTOP_VERSION
451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); 451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this );
452 topLayout->addWidget( mDateScrollBar ); 452 topLayout->addWidget( mDateScrollBar );
453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
454 if ( QApplication::desktop()->width() < 800 ) 454 if ( QApplication::desktop()->width() < 800 )
455 mDateScrollBar->hide(); 455 mDateScrollBar->hide();
456#endif 456#endif
457 //mainBoxLayout->addWidget (mLeftFrame); 457 //mainBoxLayout->addWidget (mLeftFrame);
458 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 458 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
459 "CalendarView::DateNavigator" ); 459 "CalendarView::DateNavigator" );
460#if 0 460#if 0
461 // FIXME 461 // FIXME
462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
463 "CalendarView::DateNavigator", QDate::currentDate()); 463 "CalendarView::DateNavigator", QDate::currentDate());
464#endif 464#endif
465 // mDateNavigator->blockSignals( true ); 465 // mDateNavigator->blockSignals( true );
466 //leftFrameLayout->addWidget( mDateNavigator ); 466 //leftFrameLayout->addWidget( mDateNavigator );
467 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 467 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
468 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 468 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
469 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 469 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
470 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 470 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
471 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 471 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
472 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); 472 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) );
473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
474 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 474 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
475 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 475 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
476 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 476 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 477 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
478 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); 478 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() ));
479 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 479 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
480 480
481 mTodoList->setNavigator( mNavigator ); 481 mTodoList->setNavigator( mNavigator );
482#if 0 482#if 0
483 if ( QApplication::desktop()->width() < 480 ) { 483 if ( QApplication::desktop()->width() < 480 ) {
484 leftFrameLayout->addWidget(mFilterView); 484 leftFrameLayout->addWidget(mFilterView);
485 leftFrameLayout->addWidget(mTodoList, 2 ); 485 leftFrameLayout->addWidget(mTodoList, 2 );
486 486
487 } else { 487 } else {
488 leftFrameLayout->addWidget(mTodoList,2 ); 488 leftFrameLayout->addWidget(mTodoList,2 );
489 leftFrameLayout->addWidget(mFilterView ); 489 leftFrameLayout->addWidget(mFilterView );
490 } 490 }
491#endif 491#endif
492 mFilterView->hide(); 492 mFilterView->hide();
493 mCalEditView->hide(); 493 mCalEditView->hide();
494 QWidget *rightBox = new QWidget( mMainFrame ); 494 QWidget *rightBox = new QWidget( mMainFrame );
495 //mainBoxLayout->addWidget ( rightBox, 10 ); 495 //mainBoxLayout->addWidget ( rightBox, 10 );
496 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 496 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
497 mRightFrame = new QWidgetStack( rightBox ); 497 mRightFrame = new QWidgetStack( rightBox );
498 rightLayout->addWidget( mRightFrame, 10 ); 498 rightLayout->addWidget( mRightFrame, 10 );
499 499
500 //mLeftFrame = (QWidget *)leftFrame; 500 //mLeftFrame = (QWidget *)leftFrame;
501 if ( KOPrefs::instance()->mVerticalScreen ) { 501 if ( KOPrefs::instance()->mVerticalScreen ) {
502 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 502 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
503 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 503 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
504 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 504 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
505 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 505 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
506 } else { 506 } else {
507 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
508 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 508 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
509 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 509 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
510 } 510 }
511 if ( !KOPrefs::instance()->mShowDateNavigator) 511 if ( !KOPrefs::instance()->mShowDateNavigator)
512 mDateNavigator->hide(); 512 mDateNavigator->hide();
513 //qDebug("Calendarview Size %d %d ", width(), height()); 513 //qDebug("Calendarview Size %d %d ", width(), height());
514#endif 514#endif
515 515
516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 516 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
517 SLOT( showDates( const KCal::DateList & ) ) ); 517 SLOT( showDates( const KCal::DateList & ) ) );
518 518
519 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 519 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
520 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 520 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
521 521
522 522
523 523
524 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 524 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
525 mViewManager, SLOT( showMonth( const QDate & ) ) ); 525 mViewManager, SLOT( showMonth( const QDate & ) ) );
526 526
527 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 527 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
528 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 528 mNavigator, SLOT( selectWeek( const QDate & ) ) );
529 529
530 connect( mDateNavigator, SIGNAL( goPrevYear() ), 530 connect( mDateNavigator, SIGNAL( goPrevYear() ),
531 mNavigator, SLOT( selectPreviousYear() ) ); 531 mNavigator, SLOT( selectPreviousYear() ) );
532 connect( mDateNavigator, SIGNAL( goNextYear() ), 532 connect( mDateNavigator, SIGNAL( goNextYear() ),
533 mNavigator, SLOT( selectNextYear() ) ); 533 mNavigator, SLOT( selectNextYear() ) );
534 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 534 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
535 mNavigator, SLOT( selectPreviousMonth() ) ); 535 mNavigator, SLOT( selectPreviousMonth() ) );
536 connect( mDateNavigator, SIGNAL( goNextMonth() ), 536 connect( mDateNavigator, SIGNAL( goNextMonth() ),
537 mNavigator, SLOT( selectNextMonth() ) ); 537 mNavigator, SLOT( selectNextMonth() ) );
538 538
539 connect( mDateNavigator, SIGNAL( goPrevious() ), 539 connect( mDateNavigator, SIGNAL( goPrevious() ),
540 mNavigator, SLOT( selectPrevious() ) ); 540 mNavigator, SLOT( selectPrevious() ) );
541 connect( mDateNavigator, SIGNAL( goNext() ), 541 connect( mDateNavigator, SIGNAL( goNext() ),
542 mNavigator, SLOT( selectNext() ) ); 542 mNavigator, SLOT( selectNext() ) );
543 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 543 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
544 mNavigator, SLOT( slotMonthSelect( int ) ) ); 544 mNavigator, SLOT( slotMonthSelect( int ) ) );
545 545
546 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 546 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
547 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 547 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
548#if 0 548#if 0
549 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 549 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
550 SLOT( incidenceAdded( Incidence *) ) ); 550 SLOT( incidenceAdded( Incidence *) ) );
551#endif 551#endif
552 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 552 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
553 553
554 connect( this, SIGNAL( configChanged() ), 554 connect( this, SIGNAL( configChanged() ),
555 mDateNavigator, SLOT( updateConfig() ) ); 555 mDateNavigator, SLOT( updateConfig() ) );
556 556
557 connect( mTodoList, SIGNAL( newTodoSignal() ), 557 connect( mTodoList, SIGNAL( newTodoSignal() ),
558 SLOT( newTodo() ) ); 558 SLOT( newTodo() ) );
559 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 559 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
560 SLOT( newSubTodo( Todo * ) ) ); 560 SLOT( newSubTodo( Todo * ) ) );
561 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 561 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
562 SLOT( editTodo( Todo * ) ) ); 562 SLOT( editTodo( Todo * ) ) );
563 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 563 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
564 SLOT( showTodo( Todo *) ) ); 564 SLOT( showTodo( Todo *) ) );
565 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 565 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
566 SLOT( deleteTodo( Todo *) ) ); 566 SLOT( deleteTodo( Todo *) ) );
567 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 567 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
568 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 568 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
569 SLOT( purgeCompleted() ) ); 569 SLOT( purgeCompleted() ) );
570 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 570 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
571 SIGNAL( todoModified( Todo *, int ) ) ); 571 SIGNAL( todoModified( Todo *, int ) ) );
572 572
573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 573 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
574 this, SLOT ( cloneIncidence( Incidence * ) ) ); 574 this, SLOT ( cloneIncidence( Incidence * ) ) );
575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 575 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
576 this, SLOT (cancelIncidence( Incidence * ) ) ); 576 this, SLOT (cancelIncidence( Incidence * ) ) );
577 577
578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 578 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
579 this, SLOT ( moveIncidence( Incidence * ) ) ); 579 this, SLOT ( moveIncidence( Incidence * ) ) );
580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 580 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
581 this, SLOT ( beamIncidence( Incidence * ) ) ); 581 this, SLOT ( beamIncidence( Incidence * ) ) );
582 582
583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 583 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
584 this, SLOT ( todo_unsub( Todo * ) ) ); 584 this, SLOT ( todo_unsub( Todo * ) ) );
585 585
586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 586 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
587 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 587 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 588 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
589 SLOT( updateTodo( Todo *, int ) ) ); 589 SLOT( updateTodo( Todo *, int ) ) );
590 connect( this, SIGNAL( todoModified( Todo *, int )), this, 590 connect( this, SIGNAL( todoModified( Todo *, int )), this,
591 SLOT( changeTodoDisplay( Todo *, int ) ) ); 591 SLOT( changeTodoDisplay( Todo *, int ) ) );
592 592
593 593
594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 594 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 595 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 596 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 597 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
598 598
599 599
600 600
601 601
602 602
603 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 603 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
604 SLOT(checkClipboard())); 604 SLOT(checkClipboard()));
605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 605 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
606 SLOT( processTodoListSelection( Incidence * ) ) ); 606 SLOT( processTodoListSelection( Incidence * ) ) );
607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 607 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
608 608
609 // kdDebug() << "CalendarView::CalendarView() done" << endl; 609 // kdDebug() << "CalendarView::CalendarView() done" << endl;
610 610
611 mDateFrame = new QVBox(0,0,WType_Popup); 611 mDateFrame = new QVBox(0,0,WType_Popup);
612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 612 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 613 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
614 mDateFrame->setLineWidth(3); 614 mDateFrame->setLineWidth(3);
615 mDateFrame->hide(); 615 mDateFrame->hide();
616 mDateFrame->setCaption( i18n( "Pick a date to display")); 616 mDateFrame->setCaption( i18n( "Pick a date to display"));
617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 617 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
618 618
619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 619 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
620 620
621 mEventEditor = mDialogManager->getEventEditor(); 621 mEventEditor = mDialogManager->getEventEditor();
622 mTodoEditor = mDialogManager->getTodoEditor(); 622 mTodoEditor = mDialogManager->getTodoEditor();
623 623
624 mFlagEditDescription = false; 624 mFlagEditDescription = false;
625 625
626 mSuspendTimer = new QTimer( this ); 626 mSuspendTimer = new QTimer( this );
627 mAlarmTimer = new QTimer( this ); 627 mAlarmTimer = new QTimer( this );
628 mRecheckAlarmTimer = new QTimer( this ); 628 mRecheckAlarmTimer = new QTimer( this );
629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 629 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 630 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 631 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
632 mAlarmDialog = new AlarmDialog( this ); 632 mAlarmDialog = new AlarmDialog( this );
633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 633 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
634 mAlarmDialog->setServerNotification( false ); 634 mAlarmDialog->setServerNotification( false );
635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 635 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
636 636
637 637
638#ifndef DESKTOP_VERSION 638#ifndef DESKTOP_VERSION
639//US listen for arriving address resultsets 639//US listen for arriving address resultsets
640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 640 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 641 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
642#endif 642#endif
643 mDateNavigator->setCalendar( mCalendar ); 643 mDateNavigator->setCalendar( mCalendar );
644} 644}
645 645
646 646
647CalendarView::~CalendarView() 647CalendarView::~CalendarView()
648{ 648{
649 // kdDebug() << "~CalendarView()" << endl; 649 // kdDebug() << "~CalendarView()" << endl;
650 //qDebug("CalendarView::~CalendarView() "); 650 //qDebug("CalendarView::~CalendarView() ");
651 delete mDialogManager; 651 delete mDialogManager;
652 delete mViewManager; 652 delete mViewManager;
653 delete mStorage; 653 delete mStorage;
654 delete mDateFrame ; 654 delete mDateFrame ;
655 delete mEventViewerDialog; 655 delete mEventViewerDialog;
656 //kdDebug() << "~CalendarView() done" << endl; 656 //kdDebug() << "~CalendarView() done" << endl;
657} 657}
658 658
659void CalendarView::slotResetFocus()
660{
661 qDebug(" CalendarView::slotResetFocus() %x", qApp->focusWidget());
662
663}
664 659
665void CalendarView::nextConflict( bool all, bool allday ) 660void CalendarView::nextConflict( bool all, bool allday )
666{ 661{
667 662
668 QPtrList<Event> testlist = mCalendar->events(); 663 QPtrList<Event> testlist = mCalendar->events();
669 Event * test = testlist.first(); 664 Event * test = testlist.first();
670 while ( test ) { 665 while ( test ) {
671 test->setTagged( false ); 666 test->setTagged( false );
672 test = testlist.next(); 667 test = testlist.next();
673 } 668 }
674 QTime st ( 0,0,0); 669 QTime st ( 0,0,0);
675 if ( mViewManager->currentView() == mViewManager->agendaView() ) 670 if ( mViewManager->currentView() == mViewManager->agendaView() )
676 st = mViewManager->agendaView()->agenda()->getEndTime(); 671 st = mViewManager->agendaView()->agenda()->getEndTime();
677 //qDebug("time %s ", st.toString().latin1()); 672 //qDebug("time %s ", st.toString().latin1());
678 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); 673 QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
679 QDateTime conflict; 674 QDateTime conflict;
680 QDateTime retVal; 675 QDateTime retVal;
681 bool found = false; 676 bool found = false;
682 Event * cE = 0; 677 Event * cE = 0;
683 Event * cE2 = 0; 678 Event * cE2 = 0;
684 QPtrList<Event> testlist2 = testlist; 679 QPtrList<Event> testlist2 = testlist;
685 test = testlist.first(); 680 test = testlist.first();
686 bool skip = false; 681 bool skip = false;
687 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); 682 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
688 while ( test ) { 683 while ( test ) {
689 qApp->processEvents(); 684 qApp->processEvents();
690 skip = false; 685 skip = false;
691 if ( !all ) skip = ( allday != test->doesFloat() ); 686 if ( !all ) skip = ( allday != test->doesFloat() );
692 if ( !skip ) { 687 if ( !skip ) {
693 Event * test2 = testlist2.first(); 688 Event * test2 = testlist2.first();
694 while ( test2 ) { 689 while ( test2 ) {
695 skip = false; 690 skip = false;
696 if ( !all ) skip = ( allday != test2->doesFloat() ); 691 if ( !all ) skip = ( allday != test2->doesFloat() );
697 if ( !skip ) { 692 if ( !skip ) {
698 if ( !test2->isTagged() ) { 693 if ( !test2->isTagged() ) {
699 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { 694 if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
700 //qDebug("overlap "); 695 //qDebug("overlap ");
701 if ( ! found ) { 696 if ( ! found ) {
702 if ( retVal >= startDT ) { 697 if ( retVal >= startDT ) {
703 conflict = retVal; 698 conflict = retVal;
704 cE = test; 699 cE = test;
705 cE2 = test2; 700 cE2 = test2;
706 found = true; 701 found = true;
707 } 702 }
708 } else { 703 } else {
709 if ( retVal >= startDT && retVal < conflict ) { 704 if ( retVal >= startDT && retVal < conflict ) {
710 conflict = retVal; 705 conflict = retVal;
711 cE = test; 706 cE = test;
712 cE2 = test2; 707 cE2 = test2;
713 } 708 }
714 } 709 }
715 } 710 }
716 } 711 }
717 } 712 }
718 test2 = testlist2.next(); 713 test2 = testlist2.next();
719 } 714 }
720 } 715 }
721 test->setTagged( true ); 716 test->setTagged( true );
722 test = testlist.next(); 717 test = testlist.next();
723 } 718 }
724 if ( found ) { 719 if ( found ) {
725 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 720 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
726 mViewManager->showDayView(); 721 mViewManager->showDayView();
727 mNavigator->slotDaySelect( conflict.date() ); 722 mNavigator->slotDaySelect( conflict.date() );
728 int hour = conflict.time().hour(); 723 int hour = conflict.time().hour();
729 mViewManager->agendaView()->setStartHour( hour ); 724 mViewManager->agendaView()->setStartHour( hour );
730 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); 725 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
731 return; 726 return;
732 } 727 }
733 728
734 topLevelWidget()->setCaption( i18n("No conflict found") ); 729 topLevelWidget()->setCaption( i18n("No conflict found") );
735 qDebug("No conflict found "); 730 qDebug("No conflict found ");
736 return; 731 return;
737} 732}
738 733
739void CalendarView::conflictAll() 734void CalendarView::conflictAll()
740{ 735{
741 nextConflict ( true, true ); 736 nextConflict ( true, true );
742} 737}
743void CalendarView::conflictAllday() 738void CalendarView::conflictAllday()
744{ 739{
745 nextConflict ( false, true ); 740 nextConflict ( false, true );
746} 741}
747void CalendarView::conflictNotAll() 742void CalendarView::conflictNotAll()
748{ 743{
749 nextConflict ( false, false ); 744 nextConflict ( false, false );
750} 745}
751 746
752void CalendarView::setCalReadOnly( int id, bool readO ) 747void CalendarView::setCalReadOnly( int id, bool readO )
753{ 748{
754 if ( readO ) { 749 if ( readO ) {
755 emit save(); 750 emit save();
756 } 751 }
757 mCalendar->setReadOnly( id, readO ); 752 mCalendar->setReadOnly( id, readO );
758} 753}
759void CalendarView::setScrollBarStep(int val ) 754void CalendarView::setScrollBarStep(int val )
760{ 755{
761#ifdef DESKTOP_VERSION 756#ifdef DESKTOP_VERSION
762 mDateScrollBar->setLineStep ( val ); 757 mDateScrollBar->setLineStep ( val );
763#endif 758#endif
764} 759}
765void CalendarView::scrollBarValue(int val ) 760void CalendarView::scrollBarValue(int val )
766{ 761{
767#ifdef DESKTOP_VERSION 762#ifdef DESKTOP_VERSION
768 if ( QApplication::desktop()->width() < 800 ) return; 763 if ( QApplication::desktop()->width() < 800 ) return;
769 static bool block = false; 764 static bool block = false;
770 if ( block ) return; 765 if ( block ) return;
771 block = true; 766 block = true;
772 int count = mNavigator->selectedDates().count(); 767 int count = mNavigator->selectedDates().count();
773 int day = mNavigator->selectedDates().first().dayOfYear(); 768 int day = mNavigator->selectedDates().first().dayOfYear();
774 int stepdays = val; 769 int stepdays = val;
775 if ( mDateScrollBar->lineStep () <= count ) { 770 if ( mDateScrollBar->lineStep () <= count ) {
776 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 771 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
777 //qDebug("VAL %d ",val ); 772 //qDebug("VAL %d ",val );
778 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 773 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
779 stepdays = day+stepdays; 774 stepdays = day+stepdays;
780 if ( stepdays < 0 ) stepdays = 0; 775 if ( stepdays < 0 ) stepdays = 0;
781 } 776 }
782 if ( stepdays == day ) { 777 if ( stepdays == day ) {
783 block = false; 778 block = false;
784 return; 779 return;
785 } 780 }
786 int year = mNavigator->selectedDates().first().year(); 781 int year = mNavigator->selectedDates().first().year();
787 QDate d ( year,1,1 ); 782 QDate d ( year,1,1 );
788 mNavigator->selectDates( d.addDays( stepdays-1) , count ); 783 mNavigator->selectDates( d.addDays( stepdays-1) , count );
789 block = false; 784 block = false;
790#endif 785#endif
791 786
792} 787}
793void CalendarView::updateView(const QDate &start, const QDate &end) 788void CalendarView::updateView(const QDate &start, const QDate &end)
794{ 789{
795#ifdef DESKTOP_VERSION 790#ifdef DESKTOP_VERSION
796 if ( ! mDateScrollBar->draggingSlider () ) { 791 if ( ! mDateScrollBar->draggingSlider () ) {
797 int dof = start.dayOfYear(); 792 int dof = start.dayOfYear();
798 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); 793 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() );
799 if ( dof != mDateScrollBar->value() ) { 794 if ( dof != mDateScrollBar->value() ) {
800 mDateScrollBar->blockSignals( true ); 795 mDateScrollBar->blockSignals( true );
801 mDateScrollBar->setValue( start.dayOfYear()); 796 mDateScrollBar->setValue( start.dayOfYear());
802 mDateScrollBar->blockSignals( false ); 797 mDateScrollBar->blockSignals( false );
803 } 798 }
804 } 799 }
805#endif 800#endif
806 mTodoList->updateView(); 801 mTodoList->updateView();
807 mViewManager->updateView(start, end); 802 mViewManager->updateView(start, end);
808 //mDateNavigator->updateView(); 803 //mDateNavigator->updateView();
809} 804}
810 805
811 806
812 807
813void CalendarView::checkFiles() 808void CalendarView::checkFiles()
814{ 809{
815 QString message; 810 QString message;
816 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 811 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
817 KopiCalendarFile * cal = calendars.first(); 812 KopiCalendarFile * cal = calendars.first();
818 while ( cal ) { 813 while ( cal ) {
819 if ( cal->mErrorOnLoad ) { 814 if ( cal->mErrorOnLoad ) {
820 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 815 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
821 } 816 }
822 cal = calendars.next(); 817 cal = calendars.next();
823 } 818 }
824 if ( !message.isEmpty() ) { 819 if ( !message.isEmpty() ) {
825 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 820 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
826 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 821 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
827 } 822 }
828 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 823 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
829} 824}
830void CalendarView::checkAlarms() 825void CalendarView::checkAlarms()
831{ 826{
832 827
833 828
834 KConfig *config = KOGlobals::config(); 829 KConfig *config = KOGlobals::config();
835 config->setGroup( "AppRun" ); 830 config->setGroup( "AppRun" );
836 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 831 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
837 int daysto = dt.daysTo( QDate::currentDate() ); 832 int daysto = dt.daysTo( QDate::currentDate() );
838 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 833 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
839 dt = dt.addDays( days ); 834 dt = dt.addDays( days );
840 int secto = dt.secsTo( QDateTime::currentDateTime() ); 835 int secto = dt.secsTo( QDateTime::currentDateTime() );
841 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 836 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
842 //qDebug("KO: Reading program stop %d ", secs); 837 //qDebug("KO: Reading program stop %d ", secs);
843 //secs -= ( 3600 * 24*3 ); // debug only 838 //secs -= ( 3600 * 24*3 ); // debug only
844 QDateTime latest = dt.addSecs ( secs ); 839 QDateTime latest = dt.addSecs ( secs );
845 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 840 qDebug("KO: Last termination on %s ", latest.toString().latin1());
846 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 841 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
847 QPtrList<Incidence> el = mCalendar->rawIncidences(); 842 QPtrList<Incidence> el = mCalendar->rawIncidences();
848 QPtrList<Incidence> al; 843 QPtrList<Incidence> al;
849 Incidence* inL = el.first(); 844 Incidence* inL = el.first();
850 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 845 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
851 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 846 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
852 while ( inL ) { 847 while ( inL ) {
853 bool ok = false; 848 bool ok = false;
854 int offset = 0; 849 int offset = 0;
855 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 850 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
856 if ( ok ) { 851 if ( ok ) {
857 //qDebug("OK %s",next.toString().latin1()); 852 //qDebug("OK %s",next.toString().latin1());
858 if ( next < cur ) { 853 if ( next < cur ) {
859 al.append( inL ); 854 al.append( inL );
860 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 855 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
861 } 856 }
862 } 857 }
863 inL = el.next(); 858 inL = el.next();
864 } 859 }
865 if ( al.count() ) { 860 if ( al.count() ) {
866 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 861 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
867 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 862 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
868 QVBoxLayout* lay = new QVBoxLayout( dia ); 863 QVBoxLayout* lay = new QVBoxLayout( dia );
869 lay->setSpacing( 0 ); 864 lay->setSpacing( 0 );
870 lay->setMargin( 0 ); 865 lay->setMargin( 0 );
871 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 866 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
872 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 867 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
873 lay->addWidget( matb ); 868 lay->addWidget( matb );
874 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 869 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
875 int wid = 210; 870 int wid = 210;
876 int x = QApplication::desktop()->width() - wid - 7; 871 int x = QApplication::desktop()->width() - wid - 7;
877 int y = QApplication::desktop()->height() - wid - 70; 872 int y = QApplication::desktop()->height() - wid - 70;
878 dia->setGeometry ( x,y,wid,wid); 873 dia->setGeometry ( x,y,wid,wid);
879 } else { 874 } else {
880 int si = 220; 875 int si = 220;
881 if ( QApplication::desktop()->width() > 470 ) 876 if ( QApplication::desktop()->width() > 470 )
882 si = 400; 877 si = 400;
883 dia->resize(si,si/2); 878 dia->resize(si,si/2);
884 } 879 }
885 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 880 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
886 dia->show(); 881 dia->show();
887 882
888 } 883 }
889} 884}
890void CalendarView::showDay( QDate d ) 885void CalendarView::showDay( QDate d )
891{ 886{
892 dateNavigator()->blockSignals( true ); 887 dateNavigator()->blockSignals( true );
893 dateNavigator()->selectDate( d ); 888 dateNavigator()->selectDate( d );
894 dateNavigator()->blockSignals( false ); 889 dateNavigator()->blockSignals( false );
895 mViewManager->showDayView(); 890 mViewManager->showDayView();
896 //dateNavigator()->selectDate( d ); 891 //dateNavigator()->selectDate( d );
897} 892}
898void CalendarView::timerAlarm() 893void CalendarView::timerAlarm()
899{ 894{
900 //qDebug("CalendarView::timerAlarm() "); 895 //qDebug("CalendarView::timerAlarm() ");
901 computeAlarm(mAlarmNotification ); 896 computeAlarm(mAlarmNotification );
902} 897}
903 898
904void CalendarView::suspendAlarm() 899void CalendarView::suspendAlarm()
905{ 900{
906 //qDebug(" CalendarView::suspendAlarm() "); 901 //qDebug(" CalendarView::suspendAlarm() ");
907 computeAlarm(mSuspendAlarmNotification ); 902 computeAlarm(mSuspendAlarmNotification );
908 903
909} 904}
910 905
911void CalendarView::startAlarm( QString mess , QString filename) 906void CalendarView::startAlarm( QString mess , QString filename)
912{ 907{
913 908
914 topLevelWidget()->showNormal(); 909 topLevelWidget()->showNormal();
915 topLevelWidget()->setActiveWindow(); 910 topLevelWidget()->setActiveWindow();
916 topLevelWidget()->raise(); 911 topLevelWidget()->raise();
917 912
918 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 913 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
919 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); 914 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) );
920 915
921} 916}
922 917
923void CalendarView::checkNextTimerAlarm() 918void CalendarView::checkNextTimerAlarm()
924{ 919{
925 mCalendar->checkAlarmForIncidence( 0, true ); 920 mCalendar->checkAlarmForIncidence( 0, true );
926} 921}
927 922
928void CalendarView::computeAlarm( QString msg ) 923void CalendarView::computeAlarm( QString msg )
929{ 924{
930 925
931 QString mess = msg; 926 QString mess = msg;
932 QString mAlarmMessage = mess.mid( 9 ); 927 QString mAlarmMessage = mess.mid( 9 );
933 QString filename = MainWindow::resourcePath(); 928 QString filename = MainWindow::resourcePath();
934 filename += "koalarm.wav"; 929 filename += "koalarm.wav";
935 QString tempfilename; 930 QString tempfilename;
936 if ( mess.left( 13 ) == "suspend_alarm") { 931 if ( mess.left( 13 ) == "suspend_alarm") {
937 bool error = false; 932 bool error = false;
938 int len = mess.mid( 13 ).find("+++"); 933 int len = mess.mid( 13 ).find("+++");
939 if ( len < 2 ) 934 if ( len < 2 )
940 error = true; 935 error = true;
941 else { 936 else {
942 tempfilename = mess.mid( 13, len ); 937 tempfilename = mess.mid( 13, len );
943 if ( !QFile::exists( tempfilename ) ) 938 if ( !QFile::exists( tempfilename ) )
944 error = true; 939 error = true;
945 } 940 }
946 if ( ! error ) { 941 if ( ! error ) {
947 filename = tempfilename; 942 filename = tempfilename;
948 } 943 }
949 mAlarmMessage = mess.mid( 13+len+3 ); 944 mAlarmMessage = mess.mid( 13+len+3 );
950 //qDebug("suspend file %s ",tempfilename.latin1() ); 945 //qDebug("suspend file %s ",tempfilename.latin1() );
951 startAlarm( mAlarmMessage, filename); 946 startAlarm( mAlarmMessage, filename);
952 return; 947 return;
953 } 948 }
954 if ( mess.left( 11 ) == "timer_alarm") { 949 if ( mess.left( 11 ) == "timer_alarm") {
955 //mTimerTime = 0; 950 //mTimerTime = 0;
956 startAlarm( mess.mid( 11 ), filename ); 951 startAlarm( mess.mid( 11 ), filename );
957 return; 952 return;
958 } 953 }
959 if ( mess.left( 10 ) == "proc_alarm") { 954 if ( mess.left( 10 ) == "proc_alarm") {
960 bool error = false; 955 bool error = false;
961 int len = mess.mid( 10 ).find("+++"); 956 int len = mess.mid( 10 ).find("+++");
962 if ( len < 2 ) 957 if ( len < 2 )
963 error = true; 958 error = true;
964 else { 959 else {
965 tempfilename = mess.mid( 10, len ); 960 tempfilename = mess.mid( 10, len );
966 if ( !QFile::exists( tempfilename ) ) 961 if ( !QFile::exists( tempfilename ) )
967 error = true; 962 error = true;
968 } 963 }
969 if ( error ) { 964 if ( error ) {
970 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 965 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
971 mAlarmMessage += mess.mid( 10+len+3+9 ); 966 mAlarmMessage += mess.mid( 10+len+3+9 );
972 } else { 967 } else {
973 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 968 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
974 //qDebug("-----system command %s ",tempfilename.latin1() ); 969 //qDebug("-----system command %s ",tempfilename.latin1() );
975#ifndef _WIN32_ 970#ifndef _WIN32_
976 if ( vfork () == 0 ) { 971 if ( vfork () == 0 ) {
977 execl ( tempfilename.latin1(), 0 ); 972 execl ( tempfilename.latin1(), 0 );
978 return; 973 return;
979 } 974 }
980#else 975#else
981 QProcess* p = new QProcess(); 976 QProcess* p = new QProcess();
982 p->addArgument( tempfilename.latin1() ); 977 p->addArgument( tempfilename.latin1() );
983 p->start(); 978 p->start();
984 return; 979 return;
985#endif 980#endif
986 981
987 return; 982 return;
988 } 983 }
989 984
990 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 985 //qDebug("+++++++system command %s ",tempfilename.latin1() );
991 } 986 }
992 if ( mess.left( 11 ) == "audio_alarm") { 987 if ( mess.left( 11 ) == "audio_alarm") {
993 bool error = false; 988 bool error = false;
994 int len = mess.mid( 11 ).find("+++"); 989 int len = mess.mid( 11 ).find("+++");
995 if ( len < 2 ) 990 if ( len < 2 )
996 error = true; 991 error = true;
997 else { 992 else {
998 tempfilename = mess.mid( 11, len ); 993 tempfilename = mess.mid( 11, len );
999 if ( !QFile::exists( tempfilename ) ) 994 if ( !QFile::exists( tempfilename ) )
1000 error = true; 995 error = true;
1001 } 996 }
1002 if ( ! error ) { 997 if ( ! error ) {
1003 filename = tempfilename; 998 filename = tempfilename;
1004 } 999 }
1005 mAlarmMessage = mess.mid( 11+len+3+9 ); 1000 mAlarmMessage = mess.mid( 11+len+3+9 );
1006 //qDebug("audio file command %s ",tempfilename.latin1() ); 1001 //qDebug("audio file command %s ",tempfilename.latin1() );
1007 } 1002 }
1008 if ( mess.left( 9 ) == "cal_alarm") { 1003 if ( mess.left( 9 ) == "cal_alarm") {
1009 mAlarmMessage = mess.mid( 9 ) ; 1004 mAlarmMessage = mess.mid( 9 ) ;
1010 } 1005 }
1011 1006
1012 startAlarm( mAlarmMessage, filename ); 1007 startAlarm( mAlarmMessage, filename );
1013 1008
1014 1009
1015} 1010}
1016 1011
1017void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 1012void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
1018{ 1013{
1019 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 1014 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
1020 1015
1021 mSuspendAlarmNotification = noti; 1016 mSuspendAlarmNotification = noti;
1022 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 1017 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
1023 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 1018 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
1024 mSuspendTimer->start( ms , true ); 1019 mSuspendTimer->start( ms , true );
1025 1020
1026} 1021}
1027 1022
1028void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 1023void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
1029{ 1024{
1030 mNextAlarmDateTime = qdt; 1025 mNextAlarmDateTime = qdt;
1031 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 1026 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
1032 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 1027 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
1033#ifndef DESKTOP_VERSION 1028#ifndef DESKTOP_VERSION
1034 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 1029 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
1035#endif 1030#endif
1036 return; 1031 return;
1037 } 1032 }
1038 int maxSec; 1033 int maxSec;
1039 //maxSec = 5; //testing only 1034 //maxSec = 5; //testing only
1040 maxSec = 86400+3600; // one day+1hour 1035 maxSec = 86400+3600; // one day+1hour
1041 mAlarmNotification = noti; 1036 mAlarmNotification = noti;
1042 int sec = QDateTime::currentDateTime().secsTo( qdt ); 1037 int sec = QDateTime::currentDateTime().secsTo( qdt );
1043 if ( sec > maxSec ) { 1038 if ( sec > maxSec ) {
1044 mRecheckAlarmTimer->start( maxSec * 1000 ); 1039 mRecheckAlarmTimer->start( maxSec * 1000 );
1045 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 1040 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
1046 return; 1041 return;
1047 } else { 1042 } else {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 456c2d7..1debef7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,588 +1,587 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#include <qscrollbar.h> 33#include <qscrollbar.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qtopia/ir.h> 35#include <qtopia/ir.h>
36#else 36#else
37#define Ir char 37#define Ir char
38#endif 38#endif
39#include <libkcal/calendar.h> 39#include <libkcal/calendar.h>
40#include <libkcal/scheduler.h> 40#include <libkcal/scheduler.h>
41#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
43#include <KDGanttMinimizeSplitter.h> 43#include <KDGanttMinimizeSplitter.h>
44 44
45#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
46 46
47#include <ksyncmanager.h> 47#include <ksyncmanager.h>
48//#include <koprefs.h> 48//#include <koprefs.h>
49 49
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 void checkSuspendAlarm(); 140 void checkSuspendAlarm();
141 void mergeFile( QString fn ); 141 void mergeFile( QString fn );
142 142
143 signals: 143 signals:
144 void save (); 144 void save ();
145 void saveStopTimer (); 145 void saveStopTimer ();
146 void tempDisableBR(bool); 146 void tempDisableBR(bool);
147 /** This todo has been modified */ 147 /** This todo has been modified */
148 void todoModified(Todo *, int); 148 void todoModified(Todo *, int);
149 149
150 /** when change is made to options dialog, the topwidget will catch this 150 /** when change is made to options dialog, the topwidget will catch this
151 * and emit this signal which notifies all widgets which have registered 151 * and emit this signal which notifies all widgets which have registered
152 * for notification to update their settings. */ 152 * for notification to update their settings. */
153 void configChanged(); 153 void configChanged();
154 /** emitted when the topwidget is closing down, so that any attached 154 /** emitted when the topwidget is closing down, so that any attached
155 child windows can also close. */ 155 child windows can also close. */
156 void closingDown(); 156 void closingDown();
157 /** emitted right before we die */ 157 /** emitted right before we die */
158 void closed(QWidget *); 158 void closed(QWidget *);
159 159
160 /** Emitted when state of modified flag changes */ 160 /** Emitted when state of modified flag changes */
161 void modifiedChanged(bool); 161 void modifiedChanged(bool);
162 void signalmodified(); 162 void signalmodified();
163 163
164 /** Emitted when state of read-only flag changes */ 164 /** Emitted when state of read-only flag changes */
165 void readOnlyChanged(bool); 165 void readOnlyChanged(bool);
166 166
167 /** Emitted when the unit of navigation changes */ 167 /** Emitted when the unit of navigation changes */
168 void changeNavStringPrev(const QString &); 168 void changeNavStringPrev(const QString &);
169 void changeNavStringNext(const QString &); 169 void changeNavStringNext(const QString &);
170 170
171 /** Emitted when state of events selection has changed and user is organizer*/ 171 /** Emitted when state of events selection has changed and user is organizer*/
172 void organizerEventsSelected(bool); 172 void organizerEventsSelected(bool);
173 /** Emitted when state of events selection has changed and user is attendee*/ 173 /** Emitted when state of events selection has changed and user is attendee*/
174 void groupEventsSelected(bool); 174 void groupEventsSelected(bool);
175 /** 175 /**
176 Emitted when an incidence gets selected. If the selection is cleared the 176 Emitted when an incidence gets selected. If the selection is cleared the
177 signal is emitted with 0 as argument. 177 signal is emitted with 0 as argument.
178 */ 178 */
179 void incidenceSelected( Incidence * ); 179 void incidenceSelected( Incidence * );
180 /** Emitted, when a todoitem is selected or deselected. */ 180 /** Emitted, when a todoitem is selected or deselected. */
181 void todoSelected( bool ); 181 void todoSelected( bool );
182 182
183 /** 183 /**
184 Emitted, when clipboard content changes. Parameter indicates if paste 184 Emitted, when clipboard content changes. Parameter indicates if paste
185 is possible or not. 185 is possible or not.
186 */ 186 */
187 void pasteEnabled(bool); 187 void pasteEnabled(bool);
188 188
189 /** Emitted, when the number of incoming messages has changed. */ 189 /** Emitted, when the number of incoming messages has changed. */
190 void numIncomingChanged(int); 190 void numIncomingChanged(int);
191 191
192 /** Emitted, when the number of outgoing messages has changed. */ 192 /** Emitted, when the number of outgoing messages has changed. */
193 void numOutgoingChanged(int); 193 void numOutgoingChanged(int);
194 194
195 /** Send status message, which can e.g. be displayed in the status bar. */ 195 /** Send status message, which can e.g. be displayed in the status bar. */
196 void statusMessage(const QString &); 196 void statusMessage(const QString &);
197 197
198 void calendarViewExpanded( bool ); 198 void calendarViewExpanded( bool );
199 void updateSearchDialog(); 199 void updateSearchDialog();
200 void filtersUpdated(); 200 void filtersUpdated();
201 201
202 202
203 public slots: 203 public slots:
204 void slotResetFocus();
205 void nextConflict( bool all, bool allday ); 204 void nextConflict( bool all, bool allday );
206 void conflictAll(); 205 void conflictAll();
207 void conflictAllday(); 206 void conflictAllday();
208 void conflictNotAll(); 207 void conflictNotAll();
209 void setCalReadOnly( int id, bool readO ); 208 void setCalReadOnly( int id, bool readO );
210 void checkAlarms(); 209 void checkAlarms();
211 void checkFiles(); 210 void checkFiles();
212 void slotprintSelInc(); 211 void slotprintSelInc();
213 void showNextAlarms(); 212 void showNextAlarms();
214 void showOpenError(); 213 void showOpenError();
215 void watchSavedFile(); 214 void watchSavedFile();
216 void recheckTimerAlarm(); 215 void recheckTimerAlarm();
217 void checkNextTimerAlarm(); 216 void checkNextTimerAlarm();
218 void addAlarm(const QDateTime &qdt, const QString &noti ); 217 void addAlarm(const QDateTime &qdt, const QString &noti );
219 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 218 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
220 void removeAlarm(const QDateTime &qdt, const QString &noti ); 219 void removeAlarm(const QDateTime &qdt, const QString &noti );
221 220
222 /** options dialog made a changed to the configuration. we catch this 221 /** options dialog made a changed to the configuration. we catch this
223 * and notify all widgets which need to update their configuration. */ 222 * and notify all widgets which need to update their configuration. */
224 void updateConfig(); 223 void updateConfig();
225 224
226 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 225 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
227 const QStringList& anniversaryList, const QStringList& realNameList, 226 const QStringList& anniversaryList, const QStringList& realNameList,
228 const QStringList& emailList, const QStringList& assembledNameList, 227 const QStringList& emailList, const QStringList& assembledNameList,
229 const QStringList& uidList); 228 const QStringList& uidList);
230 229
231 /** 230 /**
232 Load calendar from file \a filename. If \a merge is true, load 231 Load calendar from file \a filename. If \a merge is true, load
233 calendar into existing one, if it is false, clear calendar, before 232 calendar into existing one, if it is false, clear calendar, before
234 loading. Return true, if calendar could be successfully loaded. 233 loading. Return true, if calendar could be successfully loaded.
235 */ 234 */
236 bool openCalendar(QString filename, bool merge=false); 235 bool openCalendar(QString filename, bool merge=false);
237 bool loadCalendars(); 236 bool loadCalendars();
238 bool saveCalendars(); 237 bool saveCalendars();
239 bool restoreCalendarSettings(); 238 bool restoreCalendarSettings();
240 bool addCalendar( KopiCalendarFile * ); 239 bool addCalendar( KopiCalendarFile * );
241 void addCalendarId( int id ); 240 void addCalendarId( int id );
242 bool syncCalendar(QString filename,int mode = 0 ); 241 bool syncCalendar(QString filename,int mode = 0 );
243 242
244 /** 243 /**
245 Save calendar data to file. Return true if calendar could be 244 Save calendar data to file. Return true if calendar could be
246 successfully saved. 245 successfully saved.
247 */ 246 */
248 bool saveCalendar(QString filename); 247 bool saveCalendar(QString filename);
249 248
250 /** 249 /**
251 Close calendar. Clear calendar data and reset views to display an empty 250 Close calendar. Clear calendar data and reset views to display an empty
252 calendar. 251 calendar.
253 */ 252 */
254 void closeCalendar(); 253 void closeCalendar();
255 254
256 /** Archive old events of calendar */ 255 /** Archive old events of calendar */
257 void archiveCalendar(); 256 void archiveCalendar();
258 257
259 void showIncidence(); 258 void showIncidence();
260 void editIncidence(); 259 void editIncidence();
261 void editIncidenceDescription(); 260 void editIncidenceDescription();
262 void deleteIncidence(); 261 void deleteIncidence();
263 void cloneIncidence(); 262 void cloneIncidence();
264 void moveIncidence(); 263 void moveIncidence();
265 void beamIncidence(); 264 void beamIncidence();
266 void toggleCancelIncidence(); 265 void toggleCancelIncidence();
267 266
268 /** create an editeventwin with supplied date/time, and if bool is true, 267 /** create an editeventwin with supplied date/time, and if bool is true,
269 * make the event take all day. */ 268 * make the event take all day. */
270 void newEvent(QDateTime, QDateTime, bool allDay ); 269 void newEvent(QDateTime, QDateTime, bool allDay );
271 void newEvent(QDateTime, QDateTime); 270 void newEvent(QDateTime, QDateTime);
272 void newEvent(QDateTime fh); 271 void newEvent(QDateTime fh);
273 void newEvent(QDate dt); 272 void newEvent(QDate dt);
274 /** create new event without having a date hint. Takes current date as 273 /** create new event without having a date hint. Takes current date as
275 default hint. */ 274 default hint. */
276 void newEvent(); 275 void newEvent();
277 void newFloatingEvent(); 276 void newFloatingEvent();
278 277
279 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 278 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
280 void showIncidence(Incidence *); 279 void showIncidence(Incidence *);
281 void showIncidence(QString uid); 280 void showIncidence(QString uid);
282 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 281 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
283 void editIncidence(Incidence *); 282 void editIncidence(Incidence *);
284 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 283 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
285 void deleteIncidence(Incidence *); 284 void deleteIncidence(Incidence *);
286 void cloneIncidence(Incidence *); 285 void cloneIncidence(Incidence *);
287 void cancelIncidence(Incidence *); 286 void cancelIncidence(Incidence *);
288 /** Create an editor for the supplied event. */ 287 /** Create an editor for the supplied event. */
289 void editEvent(Event *); 288 void editEvent(Event *);
290 /** Delete the supplied event. */ 289 /** Delete the supplied event. */
291 void deleteEvent(Event *); 290 void deleteEvent(Event *);
292 /** Delete the event with the given unique ID. Returns false, if event wasn't 291 /** Delete the event with the given unique ID. Returns false, if event wasn't
293 found. */ 292 found. */
294 bool deleteEvent(const QString &uid); 293 bool deleteEvent(const QString &uid);
295 /** Create a read-only viewer dialog for the supplied event. */ 294 /** Create a read-only viewer dialog for the supplied event. */
296 void showEvent(Event *); 295 void showEvent(Event *);
297 296
298 void editJournal(Journal *); 297 void editJournal(Journal *);
299 void showJournal(Journal *); 298 void showJournal(Journal *);
300 void deleteJournal(Journal *); 299 void deleteJournal(Journal *);
301 /** Create an editor dialog for a todo */ 300 /** Create an editor dialog for a todo */
302 void editTodo(Todo *); 301 void editTodo(Todo *);
303 /** Create a read-only viewer dialog for the supplied todo */ 302 /** Create a read-only viewer dialog for the supplied todo */
304 void showTodo(Todo *); 303 void showTodo(Todo *);
305 /** create new todo */ 304 /** create new todo */
306 void newTodo(); 305 void newTodo();
307 void newTodoDateTime(QDateTime, bool allday); 306 void newTodoDateTime(QDateTime, bool allday);
308 /** create new todo with a parent todo */ 307 /** create new todo with a parent todo */
309 void newSubTodo(); 308 void newSubTodo();
310 /** create new todo with a parent todo */ 309 /** create new todo with a parent todo */
311 void newSubTodo(Todo *); 310 void newSubTodo(Todo *);
312 /** Delete todo */ 311 /** Delete todo */
313 void deleteTodo(Todo *); 312 void deleteTodo(Todo *);
314 313
315 314
316 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 315 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
317 * emitted as result. */ 316 * emitted as result. */
318 void checkClipboard(); 317 void checkClipboard();
319 318
320 /** using the KConfig associated with the kapp variable, read in the 319 /** using the KConfig associated with the kapp variable, read in the
321 * settings from the config file. 320 * settings from the config file.
322 */ 321 */
323 void readSettings(); 322 void readSettings();
324 323
325 /** write current state to config file. */ 324 /** write current state to config file. */
326 void writeSettings(); 325 void writeSettings();
327 326
328 /** read settings for calendar filters */ 327 /** read settings for calendar filters */
329 void readFilterSettings(KConfig *config); 328 void readFilterSettings(KConfig *config);
330 329
331 /** write settings for calendar filters */ 330 /** write settings for calendar filters */
332 void writeFilterSettings(KConfig *config); 331 void writeFilterSettings(KConfig *config);
333 332
334 /** passes on the message that an event has changed to the currently 333 /** passes on the message that an event has changed to the currently
335 * activated view so that it can make appropriate display changes. */ 334 * activated view so that it can make appropriate display changes. */
336 void changeEventDisplay(Event *, int); 335 void changeEventDisplay(Event *, int);
337 void changeIncidenceDisplay(Incidence *, int); 336 void changeIncidenceDisplay(Incidence *, int);
338 void changeTodoDisplay(Todo *, int); 337 void changeTodoDisplay(Todo *, int);
339 338
340 void eventAdded(Event *); 339 void eventAdded(Event *);
341 void eventChanged(Event *); 340 void eventChanged(Event *);
342 void eventToBeDeleted(Event *); 341 void eventToBeDeleted(Event *);
343 void eventDeleted(); 342 void eventDeleted();
344 343
345 void todoAdded(Todo *); 344 void todoAdded(Todo *);
346 void todoChanged(Todo *); 345 void todoChanged(Todo *);
347 void todoToBeDeleted(Todo *); 346 void todoToBeDeleted(Todo *);
348 void todoDeleted(); 347 void todoDeleted();
349 348
350 void updateView(const QDate &start, const QDate &end); 349 void updateView(const QDate &start, const QDate &end);
351 void updateView(); 350 void updateView();
352 void clearAllViews(); 351 void clearAllViews();
353 352
354 /** Full update of visible todo views */ 353 /** Full update of visible todo views */
355 void updateTodoViews(); 354 void updateTodoViews();
356 355
357 void updateUnmanagedViews(); 356 void updateUnmanagedViews();
358 357
359 /** cut the current appointment to the clipboard */ 358 /** cut the current appointment to the clipboard */
360 void edit_cut(); 359 void edit_cut();
361 360
362 /** copy the current appointment(s) to the clipboard */ 361 /** copy the current appointment(s) to the clipboard */
363 void edit_copy(); 362 void edit_copy();
364 363
365 /** paste the current vobject(s) in the clipboard buffer into calendar */ 364 /** paste the current vobject(s) in the clipboard buffer into calendar */
366 void edit_paste(); 365 void edit_paste();
367 366
368 /** edit viewing and configuration options. */ 367 /** edit viewing and configuration options. */
369 void edit_options(); 368 void edit_options();
370 void edit_global_options(); 369 void edit_global_options();
371 /** 370 /**
372 Functions for printing, previewing a print, and setting up printing 371 Functions for printing, previewing a print, and setting up printing
373 parameters. 372 parameters.
374 */ 373 */
375 void print(); 374 void print();
376 void printSetup(); 375 void printSetup();
377 void printPreview(); 376 void printPreview();
378 377
379 /** Export as iCalendar file */ 378 /** Export as iCalendar file */
380 void exportICalendar(); 379 void exportICalendar();
381 380
382 /** Export as vCalendar file */ 381 /** Export as vCalendar file */
383 bool exportVCalendar( QString fn); 382 bool exportVCalendar( QString fn);
384 383
385 /** pop up a dialog to show an existing appointment. */ 384 /** pop up a dialog to show an existing appointment. */
386 void appointment_show(); 385 void appointment_show();
387 /** 386 /**
388 * pop up an Appointment Dialog to edit an existing appointment.Get 387 * pop up an Appointment Dialog to edit an existing appointment.Get
389 * information on the appointment from the list of unique IDs that is 388 * information on the appointment from the list of unique IDs that is
390 * currently in the View, called currIds. 389 * currently in the View, called currIds.
391 */ 390 */
392 void appointment_edit(); 391 void appointment_edit();
393 /** 392 /**
394 * pop up dialog confirming deletion of currently selected event in the 393 * pop up dialog confirming deletion of currently selected event in the
395 * View. 394 * View.
396 */ 395 */
397 void appointment_delete(); 396 void appointment_delete();
398 397
399 /** mails the currently selected event to a particular user as a vCalendar 398 /** mails the currently selected event to a particular user as a vCalendar
400 attachment. */ 399 attachment. */
401 void action_mail(); 400 void action_mail();
402 401
403 /* frees a subtodo from it's relation */ 402 /* frees a subtodo from it's relation */
404 void todo_unsub( Todo * ); 403 void todo_unsub( Todo * );
405 void todo_resub( Todo * parent, Todo * sub ); 404 void todo_resub( Todo * parent, Todo * sub );
406 405
407 /** Take ownership of selected event. */ 406 /** Take ownership of selected event. */
408 void takeOverEvent(); 407 void takeOverEvent();
409 408
410 /** Take ownership of all events in calendar. */ 409 /** Take ownership of all events in calendar. */
411 void takeOverCalendar(); 410 void takeOverCalendar();
412 411
413 /** query whether or not the calendar is "dirty". */ 412 /** query whether or not the calendar is "dirty". */
414 bool isModified(); 413 bool isModified();
415 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 414 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
416 void setModified(bool modified=true); 415 void setModified(bool modified=true);
417 416
418 /** query if the calendar is read-only. */ 417 /** query if the calendar is read-only. */
419 bool isReadOnly(); 418 bool isReadOnly();
420 /** set state of calendar to read-only */ 419 /** set state of calendar to read-only */
421 void setReadOnly(bool readOnly=true); 420 void setReadOnly(bool readOnly=true);
422 421
423 void eventUpdated(Incidence *); 422 void eventUpdated(Incidence *);
424 423
425 /* iTIP scheduling actions */ 424 /* iTIP scheduling actions */
426 void schedule_publish(Incidence *incidence = 0); 425 void schedule_publish(Incidence *incidence = 0);
427 void schedule_request(Incidence *incidence = 0); 426 void schedule_request(Incidence *incidence = 0);
428 void schedule_refresh(Incidence *incidence = 0); 427 void schedule_refresh(Incidence *incidence = 0);
429 void schedule_cancel(Incidence *incidence = 0); 428 void schedule_cancel(Incidence *incidence = 0);
430 void schedule_add(Incidence *incidence = 0); 429 void schedule_add(Incidence *incidence = 0);
431 void schedule_reply(Incidence *incidence = 0); 430 void schedule_reply(Incidence *incidence = 0);
432 void schedule_counter(Incidence *incidence = 0); 431 void schedule_counter(Incidence *incidence = 0);
433 void schedule_declinecounter(Incidence *incidence = 0); 432 void schedule_declinecounter(Incidence *incidence = 0);
434 void schedule_publish_freebusy(int daysToPublish = 30); 433 void schedule_publish_freebusy(int daysToPublish = 30);
435 434
436 void openAddressbook(); 435 void openAddressbook();
437 436
438 void editFilters(); 437 void editFilters();
439 void toggleFilerEnabled(); 438 void toggleFilerEnabled();
440 QPtrList<CalFilter> filters(); 439 QPtrList<CalFilter> filters();
441 void toggleFilter(); 440 void toggleFilter();
442 void showFilter(bool visible); 441 void showFilter(bool visible);
443 void updateFilter(); 442 void updateFilter();
444 void filterEdited(); 443 void filterEdited();
445 void selectFilter( int ); 444 void selectFilter( int );
446 KOFilterView *filterView(); 445 KOFilterView *filterView();
447 446
448 void showIntro(); 447 void showIntro();
449 448
450 /** Move the curdatepient view date to today */ 449 /** Move the curdatepient view date to today */
451 void goToday(); 450 void goToday();
452 451
453 /** Move to the next date(s) in the current view */ 452 /** Move to the next date(s) in the current view */
454 void goNext(); 453 void goNext();
455 454
456 /** Move to the previous date(s) in the current view */ 455 /** Move to the previous date(s) in the current view */
457 void goPrevious(); 456 void goPrevious();
458 /** Move to the next date(s) in the current view */ 457 /** Move to the next date(s) in the current view */
459 void goNextMonth(); 458 void goNextMonth();
460 459
461 /** Move to the previous date(s) in the current view */ 460 /** Move to the previous date(s) in the current view */
462 void goPreviousMonth(); 461 void goPreviousMonth();
463 462
464 void toggleExpand(); 463 void toggleExpand();
465 void toggleDateNavigatorWidget(); 464 void toggleDateNavigatorWidget();
466 void toggleAllDaySize(); 465 void toggleAllDaySize();
467 466
468 /** Look for new messages in the inbox */ 467 /** Look for new messages in the inbox */
469 void lookForIncomingMessages(); 468 void lookForIncomingMessages();
470 /** Look for new messages in the outbox */ 469 /** Look for new messages in the outbox */
471 void lookForOutgoingMessages(); 470 void lookForOutgoingMessages();
472 471
473 void processMainViewSelection( Incidence * ); 472 void processMainViewSelection( Incidence * );
474 void processTodoListSelection( Incidence * ); 473 void processTodoListSelection( Incidence * );
475 474
476 void processIncidenceSelection( Incidence * ); 475 void processIncidenceSelection( Incidence * );
477 476
478 void purgeCompleted(); 477 void purgeCompleted();
479 bool removeCompletedSubTodos( Todo* ); 478 bool removeCompletedSubTodos( Todo* );
480 void slotCalendarChanged(); 479 void slotCalendarChanged();
481 bool importBday(); 480 bool importBday();
482 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 481 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
483 bool importQtopia( const QString &categoriesFile, 482 bool importQtopia( const QString &categoriesFile,
484 const QString &datebookFile, 483 const QString &datebookFile,
485 const QString &tasklistFile ); 484 const QString &tasklistFile );
486 void syncExternal( int mode ); 485 void syncExternal( int mode );
487 void slotSelectPickerDate( QDate ) ; 486 void slotSelectPickerDate( QDate ) ;
488 void showDatePicker() ; 487 void showDatePicker() ;
489 void showDatePickerPopup() ; 488 void showDatePickerPopup() ;
490 void moveIncidence(Incidence *) ; 489 void moveIncidence(Incidence *) ;
491 void beamIncidence(Incidence *) ; 490 void beamIncidence(Incidence *) ;
492 void beamCalendar() ; 491 void beamCalendar() ;
493 void beamFilteredCalendar() ; 492 void beamFilteredCalendar() ;
494 void beamIncidenceList(QPtrList<Incidence>) ; 493 void beamIncidenceList(QPtrList<Incidence>) ;
495 void manageCategories(); 494 void manageCategories();
496 void editCategories(); 495 void editCategories();
497 int addCategories(); 496 int addCategories();
498 void removeCategories(); 497 void removeCategories();
499 void setSyncDevice( QString ); 498 void setSyncDevice( QString );
500 void setSyncName( QString ); 499 void setSyncName( QString );
501 void showDay( QDate ); 500 void showDay( QDate );
502 void undo_delete(); 501 void undo_delete();
503 protected slots: 502 protected slots:
504 void resetFocus(); 503 void resetFocus();
505 void scrollBarValue(int); 504 void scrollBarValue(int);
506 void slotViewerClosed(); 505 void slotViewerClosed();
507 void timerAlarm(); 506 void timerAlarm();
508 void suspendAlarm(); 507 void suspendAlarm();
509 void beamDone( Ir *ir ); 508 void beamDone( Ir *ir );
510 /** Select a view or adapt the current view to display the specified dates. */ 509 /** Select a view or adapt the current view to display the specified dates. */
511 void showDates( const KCal::DateList & ); 510 void showDates( const KCal::DateList & );
512 void selectWeekNum ( int ); 511 void selectWeekNum ( int );
513 void checkConflictForEvent(); 512 void checkConflictForEvent();
514 513
515 public: 514 public:
516 // show a standard warning 515 // show a standard warning
517 // returns KMsgBox::yesNoCancel() 516 // returns KMsgBox::yesNoCancel()
518 int msgCalModified(); 517 int msgCalModified();
519 virtual bool sync(KSyncManager* manager, QString filename, int mode); 518 virtual bool sync(KSyncManager* manager, QString filename, int mode);
520 519
521 virtual bool syncExternal(KSyncManager* manager, QString resource); 520 virtual bool syncExternal(KSyncManager* manager, QString resource);
522 virtual void removeSyncInfo( QString syncProfile); 521 virtual void removeSyncInfo( QString syncProfile);
523 void setSyncManager(KSyncManager* manager); 522 void setSyncManager(KSyncManager* manager);
524 void setLoadedFileVersion(QDateTime); 523 void setLoadedFileVersion(QDateTime);
525 bool checkFileVersion(QString fn); 524 bool checkFileVersion(QString fn);
526 bool checkAllFileVersions(); 525 bool checkAllFileVersions();
527 bool checkFileChanged(QString fn); 526 bool checkFileChanged(QString fn);
528 Event* getLastSyncEvent(); 527 Event* getLastSyncEvent();
529 /** Adapt navigation units correpsonding to step size of navigation of the 528 /** Adapt navigation units correpsonding to step size of navigation of the
530 * current view. 529 * current view.
531 */ 530 */
532 void adaptNavigationUnits(); 531 void adaptNavigationUnits();
533 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 532 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
534 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 533 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
535 //Attendee* getYourAttendee(Event *event); 534 //Attendee* getYourAttendee(Event *event);
536 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 535 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
537 void setScrollBarStep(int val ); 536 void setScrollBarStep(int val );
538 537
539 protected: 538 protected:
540 Event *mConflictingEvent; 539 Event *mConflictingEvent;
541 void schedule(Scheduler::Method, Incidence *incidence = 0); 540 void schedule(Scheduler::Method, Incidence *incidence = 0);
542 541
543 // returns KMsgBox::OKCandel() 542 // returns KMsgBox::OKCandel()
544 int msgItemDelete(const QString name); 543 int msgItemDelete(const QString name);
545 void showEventEditor(); 544 void showEventEditor();
546 void showTodoEditor(); 545 void showTodoEditor();
547 Todo *selectedTodo(); 546 Todo *selectedTodo();
548 private: 547 private:
549#ifdef DESKTOP_VERSION 548#ifdef DESKTOP_VERSION
550 QScrollBar * mDateScrollBar; 549 QScrollBar * mDateScrollBar;
551#endif 550#endif
552 QDateTime mNextAlarmDateTime; 551 QDateTime mNextAlarmDateTime;
553 bool mViewerCallerIsSearchDialog; 552 bool mViewerCallerIsSearchDialog;
554 bool mBlockShowDates; 553 bool mBlockShowDates;
555 KSyncManager* mSyncManager; 554 KSyncManager* mSyncManager;
556 AlarmDialog * mAlarmDialog; 555 AlarmDialog * mAlarmDialog;
557 QString mAlarmNotification; 556 QString mAlarmNotification;
558 QString mSuspendAlarmNotification; 557 QString mSuspendAlarmNotification;
559 QTimer* mSuspendTimer; 558 QTimer* mSuspendTimer;
560 QTimer* mAlarmTimer; 559 QTimer* mAlarmTimer;
561 QTimer* mRecheckAlarmTimer; 560 QTimer* mRecheckAlarmTimer;
562 void computeAlarm( QString ); 561 void computeAlarm( QString );
563 void startAlarm( QString, QString ); 562 void startAlarm( QString, QString );
564 void setSyncEventsReadOnly(); 563 void setSyncEventsReadOnly();
565 564
566 QDateTime loadedFileVersion; 565 QDateTime loadedFileVersion;
567 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 566 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
568 void checkExternalId( Incidence * inc ); 567 void checkExternalId( Incidence * inc );
569 int mGlobalSyncMode; 568 int mGlobalSyncMode;
570 QString mCurrentSyncDevice; 569 QString mCurrentSyncDevice;
571 QString mCurrentSyncName; 570 QString mCurrentSyncName;
572 void init(); 571 void init();
573 int mDatePickerMode; 572 int mDatePickerMode;
574 bool mFlagEditDescription; 573 bool mFlagEditDescription;
575 QDateTime mLastCalendarSync; 574 QDateTime mLastCalendarSync;
576 void createPrinter(); 575 void createPrinter();
577 576
578 void calendarModified( bool, Calendar * ); 577 void calendarModified( bool, Calendar * );
579 578
580 CalPrinter *mCalPrinter; 579 CalPrinter *mCalPrinter;
581 580
582 QSplitter *mPanner; 581 QSplitter *mPanner;
583 QSplitter *mLeftSplitter; 582 QSplitter *mLeftSplitter;
584 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 583 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
585 QWidgetStack *mRightFrame; 584 QWidgetStack *mRightFrame;
586 585
587 KDatePicker* mDatePicker; 586 KDatePicker* mDatePicker;
588 QVBox* mDateFrame; 587 QVBox* mDateFrame;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 21d5a35..279955f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -42,1061 +42,1082 @@
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43 43
44#include "calendarview.h" 44#include "calendarview.h"
45#include "koviewmanager.h" 45#include "koviewmanager.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47#include "koagendaview.h" 47#include "koagendaview.h"
48#include "kojournalview.h" 48#include "kojournalview.h"
49#include "koagenda.h" 49#include "koagenda.h"
50#include "kodialogmanager.h" 50#include "kodialogmanager.h"
51#include "kdialogbase.h" 51#include "kdialogbase.h"
52#include "kapplication.h" 52#include "kapplication.h"
53#include "kofilterview.h" 53#include "kofilterview.h"
54#include "kstandarddirs.h" 54#include "kstandarddirs.h"
55#include "koprefs.h" 55#include "koprefs.h"
56#include "kfiledialog.h" 56#include "kfiledialog.h"
57#include "koglobals.h" 57#include "koglobals.h"
58#include "kglobal.h" 58#include "kglobal.h"
59#include "ktoolbar.h" 59#include "ktoolbar.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63#include <kglobalsettings.h> 63#include <kglobalsettings.h>
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131QPixmap* sgListViewCompletedPix[6]; 131QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 132QPixmap* sgListViewJournalPix;
133 133
134 134
135int globalFlagBlockStartup; 135int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 136MainWindow::MainWindow( QWidget *parent, const char *name ) :
137 QMainWindow( parent, name ) 137 QMainWindow( parent, name )
138{ 138{
139 sgListViewCompletedPix[5] = &listviewPix; 139 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 140 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 141 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 142 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 143 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 144 sgListViewCompletedPix[4] = &listviewPix80;
145 //int size = 12; 145 //int size = 12;
146 { 146 {
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 147 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 148 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 153 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
159 if ( iii ) 159 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 161 }
162 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
165 { 165 {
166 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
171 } 171 }
172 } 172 }
173 mClosed = false; 173 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
175 QString confFile = locateLocal("config","korganizerrc"); 175 QString confFile = locateLocal("config","korganizerrc");
176 QFileInfo finf ( confFile ); 176 QFileInfo finf ( confFile );
177 bool showWarning = !finf.exists(); 177 bool showWarning = !finf.exists();
178 setIcon(SmallIcon( "ko24" ) ); 178 setIcon(SmallIcon( "ko24" ) );
179 mBlockAtStartup = true; 179 mBlockAtStartup = true;
180 mFlagKeyPressed = false; 180 mFlagKeyPressed = false;
181 setCaption("KO/Pi"); 181 setCaption("KO/Pi");
182 KOPrefs *p = KOPrefs::instance(); 182 KOPrefs *p = KOPrefs::instance();
183 //KPimGlobalPrefs::instance()->setGlobalConfig(); 183 //KPimGlobalPrefs::instance()->setGlobalConfig();
184 p->mCurrentDisplayedView = 0; 184 p->mCurrentDisplayedView = 0;
185 if ( p->mHourSize > 22 ) 185 if ( p->mHourSize > 22 )
186 p->mHourSize = 22; 186 p->mHourSize = 22;
187 QMainWindow::ToolBarDock tbd; 187 QMainWindow::ToolBarDock tbd;
188 if ( p->mToolBarHor ) { 188 if ( p->mToolBarHor ) {
189 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
190 tbd = Bottom; 190 tbd = Bottom;
191 else 191 else
192 tbd = Top; 192 tbd = Top;
193 } 193 }
194 else { 194 else {
195 if ( p->mToolBarUp ) 195 if ( p->mToolBarUp )
196 tbd = Right; 196 tbd = Right;
197 else 197 else
198 tbd = Left; 198 tbd = Left;
199 } 199 }
200 if ( KOPrefs::instance()->mUseAppColors ) 200 if ( KOPrefs::instance()->mUseAppColors )
201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
202 globalFlagBlockStartup = 1; 202 globalFlagBlockStartup = 1;
203 iconToolBar = new QPEToolBar( this ); 203 iconToolBar = new QPEToolBar( this );
204 addToolBar (iconToolBar , tbd ); 204 addToolBar (iconToolBar , tbd );
205 205
206#ifdef DESKTOP_VERSION 206#ifdef DESKTOP_VERSION
207 if ( KOPrefs::instance()->mShowIconFilter ) 207 if ( KOPrefs::instance()->mShowIconFilter )
208#else 208#else
209 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 209 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
210#endif 210#endif
211 211
212{ 212{
213 if ( p->mToolBarHorF ) { 213 if ( p->mToolBarHorF ) {
214 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
215 tbd = Bottom; 215 tbd = Bottom;
216 else 216 else
217 tbd = Top; 217 tbd = Top;
218 } 218 }
219 else { 219 else {
220 if ( p->mToolBarUpF ) 220 if ( p->mToolBarUpF )
221 tbd = Right; 221 tbd = Right;
222 else 222 else
223 tbd = Left; 223 tbd = Left;
224 } 224 }
225 filterToolBar = new QPEToolBar ( this ); 225 filterToolBar = new QPEToolBar ( this );
226 filterMenubar = new KMenuBar( 0 ); 226 filterMenubar = new KMenuBar( 0 );
227 QFontMetrics fm ( filterMenubar->font() ); 227 QFontMetrics fm ( filterMenubar->font() );
228 228
229 filterPopupMenu = new QPopupMenu( this ); 229 filterPopupMenu = new QPopupMenu( this );
230 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 230 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
231 QString addTest = "A"; 231 QString addTest = "A";
232 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 232 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
233#ifdef DESKTOP_VERSION 233#ifdef DESKTOP_VERSION
234 addTest = "AAABBBCCCx"; 234 addTest = "AAABBBCCCx";
235#else 235#else
236 addTest = "AAx"; 236 addTest = "AAx";
237#endif 237#endif
238 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 238 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
239 addToolBar (filterToolBar , tbd ); 239 addToolBar (filterToolBar , tbd );
240 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 240 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
241 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 241 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
242 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 242 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
243 filterToolBar->hide(); 243 filterToolBar->hide();
244 } else { 244 } else {
245 filterToolBar = 0; 245 filterToolBar = 0;
246 filterMenubar = 0; 246 filterMenubar = 0;
247 filterPopupMenu = 0; 247 filterPopupMenu = 0;
248 } 248 }
249 if ( p->mShowIconOnetoolbar ) { 249 if ( p->mShowIconOnetoolbar ) {
250 viewToolBar = iconToolBar ; 250 viewToolBar = iconToolBar ;
251 navigatorToolBar = iconToolBar ; 251 navigatorToolBar = iconToolBar ;
252 } else { 252 } else {
253#ifndef DESKTOP_VERSION 253#ifndef DESKTOP_VERSION
254 setToolBarsMovable( false ); 254 setToolBarsMovable( false );
255#endif 255#endif
256 if ( p->mToolBarHorV ) { 256 if ( p->mToolBarHorV ) {
257 if ( p->mToolBarUpV ) 257 if ( p->mToolBarUpV )
258 tbd = Bottom; 258 tbd = Bottom;
259 else 259 else
260 tbd = Top; 260 tbd = Top;
261 } 261 }
262 else { 262 else {
263 if ( p->mToolBarUpV ) 263 if ( p->mToolBarUpV )
264 tbd = Right; 264 tbd = Right;
265 else 265 else
266 tbd = Left; 266 tbd = Left;
267 } 267 }
268 viewToolBar = new QPEToolBar( this ); 268 viewToolBar = new QPEToolBar( this );
269 addToolBar (viewToolBar , tbd ); 269 addToolBar (viewToolBar , tbd );
270 if ( p->mToolBarHorN ) { 270 if ( p->mToolBarHorN ) {
271 if ( p->mToolBarUpN ) 271 if ( p->mToolBarUpN )
272 tbd = Bottom; 272 tbd = Bottom;
273 else 273 else
274 tbd = Top; 274 tbd = Top;
275 } 275 }
276 else { 276 else {
277 if ( p->mToolBarUpN ) 277 if ( p->mToolBarUpN )
278 tbd = Right; 278 tbd = Right;
279 else 279 else
280 tbd = Left; 280 tbd = Left;
281 } 281 }
282 navigatorToolBar = new QPEToolBar( this ); 282 navigatorToolBar = new QPEToolBar( this );
283 addToolBar (navigatorToolBar , tbd ); 283 addToolBar (navigatorToolBar , tbd );
284 } 284 }
285 285
286 286
287 287
288 mCalendarModifiedFlag = false; 288 mCalendarModifiedFlag = false;
289 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 289 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
290 splash->setAlignment ( AlignCenter ); 290 splash->setAlignment ( AlignCenter );
291 setCentralWidget( splash ); 291 setCentralWidget( splash );
292#ifndef DESKTOP_VERSION 292#ifndef DESKTOP_VERSION
293 showMaximized(); 293 showMaximized();
294#endif 294#endif
295 295
296 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 296 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
297 setDefaultPreferences(); 297 setDefaultPreferences();
298 mCalendar = new CalendarLocal(); 298 mCalendar = new CalendarLocal();
299 mView = new CalendarView( mCalendar, this,"mCalendar " ); 299 mView = new CalendarView( mCalendar, this,"mCalendar " );
300 mView->hide(); 300 mView->hide();
301 //mView->resize(splash->size() ); 301 //mView->resize(splash->size() );
302 initActions(); 302 initActions();
303 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 303 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
304 mSyncManager->setBlockSave(false); 304 mSyncManager->setBlockSave(false);
305 mView->setSyncManager(mSyncManager); 305 mView->setSyncManager(mSyncManager);
306#ifndef DESKTOP_VERSION 306#ifndef DESKTOP_VERSION
307 iconToolBar->show(); 307 iconToolBar->show();
308 qApp->processEvents(); 308 qApp->processEvents();
309#endif 309#endif
310 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 310 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
311 int vh = height() ; 311 int vh = height() ;
312 int vw = width(); 312 int vw = width();
313 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 313 //qDebug("Toolbar hei %d ",iconToolBar->height() );
314 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 314 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
315 vh -= iconToolBar->height(); 315 vh -= iconToolBar->height();
316 } else { 316 } else {
317 vw -= iconToolBar->height(); 317 vw -= iconToolBar->height();
318 } 318 }
319 //mView->setMaximumSize( splash->size() ); 319 //mView->setMaximumSize( splash->size() );
320 //mView->resize( splash->size() ); 320 //mView->resize( splash->size() );
321 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 321 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
322 mView->readSettings(); 322 mView->readSettings();
323 bool newFile = false; 323 bool newFile = false;
324 if( !QFile::exists( defaultFileName() ) ) { 324 if( !QFile::exists( defaultFileName() ) ) {
325 QFileInfo finfo ( defaultFileName() ); 325 QFileInfo finfo ( defaultFileName() );
326 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 326 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
327 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 327 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
328 finfo.setFile( oldFile ); 328 finfo.setFile( oldFile );
329 if (finfo.exists() ) { 329 if (finfo.exists() ) {
330 KMessageBox::information( this, message); 330 KMessageBox::information( this, message);
331 mView->openCalendar( oldFile ); 331 mView->openCalendar( oldFile );
332 qApp->processEvents(); 332 qApp->processEvents();
333 } else { 333 } else {
334 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 334 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
335 finfo.setFile( oldFile ); 335 finfo.setFile( oldFile );
336 if (finfo.exists() ) { 336 if (finfo.exists() ) {
337 KMessageBox::information( this, message); 337 KMessageBox::information( this, message);
338 mView->openCalendar( oldFile ); 338 mView->openCalendar( oldFile );
339 qApp->processEvents(); 339 qApp->processEvents();
340 } 340 }
341 } 341 }
342 mView->saveCalendar( defaultFileName() ); 342 mView->saveCalendar( defaultFileName() );
343 newFile = true; 343 newFile = true;
344 } 344 }
345 345
346 QTime neededSaveTime = QDateTime::currentDateTime().time(); 346 QTime neededSaveTime = QDateTime::currentDateTime().time();
347 mView->loadCalendars(); 347 mView->loadCalendars();
348 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 348 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
349 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 349 qDebug("KO: Calendar loading time: %d ms",msNeeded );
350 350
351 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 351 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
352 KOPrefs::instance()->setAllDefaults(); 352 KOPrefs::instance()->setAllDefaults();
353 } 353 }
354 processIncidenceSelection( 0 ); 354 processIncidenceSelection( 0 );
355 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 355 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
356 SLOT( processIncidenceSelection( Incidence * ) ) ); 356 SLOT( processIncidenceSelection( Incidence * ) ) );
357 connect( mView, SIGNAL( modifiedChanged( bool ) ), 357 connect( mView, SIGNAL( modifiedChanged( bool ) ),
358 SLOT( slotModifiedChanged( bool ) ) ); 358 SLOT( slotModifiedChanged( bool ) ) );
359 359
360 360
361 connect( mView, SIGNAL( tempDisableBR(bool) ), 361 connect( mView, SIGNAL( tempDisableBR(bool) ),
362 SLOT( disableBR(bool) ) ); 362 SLOT( disableBR(bool) ) );
363 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 363 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
364 mView->setModified( false ); 364 mView->setModified( false );
365 mBlockAtStartup = false; 365 mBlockAtStartup = false;
366 mView->setModified( false ); 366 mView->setModified( false );
367 setCentralWidget( mView ); 367 setCentralWidget( mView );
368 globalFlagBlockStartup = 0; 368 globalFlagBlockStartup = 0;
369 mView->show(); 369 mView->show();
370 delete splash; 370 delete splash;
371 if ( newFile ) 371 if ( newFile )
372 mView->updateConfig(); 372 mView->updateConfig();
373 // qApp->processEvents(); 373 // qApp->processEvents();
374 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 374 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
375 //fillSyncMenu(); 375 //fillSyncMenu();
376 376
377 377
378 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 378 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
379 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 379 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
380 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 380 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
381 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 381 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
382 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 382 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
383 mSyncManager->setDefaultFileName( sentSyncFile()); 383 mSyncManager->setDefaultFileName( sentSyncFile());
384 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 384 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
385 mSyncManager->fillSyncMenu(); 385 mSyncManager->fillSyncMenu();
386 386
387 387
388 388
389 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 389 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
390 if ( showWarning ) { 390 if ( showWarning ) {
391 KMessageBox::information( this, 391 KMessageBox::information( this,
392 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 392 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
393 qApp->processEvents(); 393 qApp->processEvents();
394 mView->dialogManager()->showSyncOptions(); 394 mView->dialogManager()->showSyncOptions();
395 } 395 }
396 396
397 //US listen for result adressed from Ka/Pi 397 //US listen for result adressed from Ka/Pi
398#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
399 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 399 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
400#endif 400#endif
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
402 infrared = 0; 402 infrared = 0;
403#endif 403#endif
404 updateFilterToolbar(); 404 updateFilterToolbar();
405 updateWeek( mView->startDate() ); 405 updateWeek( mView->startDate() );
406 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 406 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
407 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 407 SLOT( updateWeekNum( const KCal::DateList & ) ) );
408 mBRdisabled = false; 408 mBRdisabled = false;
409 //toggleBeamReceive(); 409 //toggleBeamReceive();
410 410
411 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 411 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
412} 412}
413MainWindow::~MainWindow() 413MainWindow::~MainWindow()
414{ 414{
415 //qDebug("MainWindow::~MainWindow() "); 415 //qDebug("MainWindow::~MainWindow() ");
416 //save toolbar location 416 //save toolbar location
417 delete mCalendar; 417 delete mCalendar;
418 delete mSyncManager; 418 delete mSyncManager;
419#ifndef DESKTOP_VERSION 419#ifndef DESKTOP_VERSION
420 if ( infrared ) 420 if ( infrared )
421 delete infrared; 421 delete infrared;
422#endif 422#endif
423 423
424 424
425} 425}
426 426void MainWindow::slotResetFocus()
427{
428 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
429 mFocusLoop = 3;
430 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
431}
432void MainWindow::slotResetFocusLoop()
433{
434 --mFocusLoop;
435 QWidget* fw = mView->viewManager()->currentView();
436 if ( fw ) {
437 //qDebug("loop ");
438 fw->setFocus();
439 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
440 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
441 }
442
443}
427void MainWindow::disableBR(bool b) 444void MainWindow::disableBR(bool b)
428{ 445{
429#ifndef DESKTOP_VERSION 446#ifndef DESKTOP_VERSION
430 if ( b ) { 447 if ( b ) {
431 if ( infrared ) { 448 if ( infrared ) {
432 toggleBeamReceive(); 449 toggleBeamReceive();
433 mBRdisabled = true; 450 mBRdisabled = true;
434 } 451 }
435 mBRdisabled = true; 452 mBRdisabled = true;
436 } else { 453 } else {
437 if ( mBRdisabled ) { 454 if ( mBRdisabled ) {
438 mBRdisabled = false; 455 mBRdisabled = false;
439 //makes no sense,because other cal ap is probably running 456 //makes no sense,because other cal ap is probably running
440 // toggleBeamReceive(); 457 // toggleBeamReceive();
441 } 458 }
442 } 459 }
443#endif 460#endif
444 461
445} 462}
446bool MainWindow::beamReceiveEnabled() 463bool MainWindow::beamReceiveEnabled()
447{ 464{
448#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
449 return ( infrared != 0 ); 466 return ( infrared != 0 );
450#endif 467#endif
451 return false; 468 return false;
452} 469}
453 470
454void MainWindow::toggleBeamReceive() 471void MainWindow::toggleBeamReceive()
455{ 472{
456 if ( mBRdisabled ) 473 if ( mBRdisabled )
457 return; 474 return;
458#ifndef DESKTOP_VERSION 475#ifndef DESKTOP_VERSION
459 if ( infrared ) { 476 if ( infrared ) {
460 qDebug("KO: Disable BeamReceive "); 477 qDebug("KO: Disable BeamReceive ");
461 delete infrared; 478 delete infrared;
462 infrared = 0; 479 infrared = 0;
463 brAction->setOn(false); 480 brAction->setOn(false);
464 return; 481 return;
465 } 482 }
466 qDebug("KO: Enable BeamReceive "); 483 qDebug("KO: Enable BeamReceive ");
467 brAction->setOn(true); 484 brAction->setOn(true);
468 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 485 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
469 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 486 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
470#endif 487#endif
471} 488}
472void MainWindow::showMaximized () 489void MainWindow::showMaximized ()
473{ 490{
474#ifndef DESKTOP_VERSION 491#ifndef DESKTOP_VERSION
475 if ( ! globalFlagBlockStartup ) 492 if ( ! globalFlagBlockStartup )
476 if ( mClosed ) 493 if ( mClosed )
477 mView->goToday(); 494 mView->goToday();
478#endif 495#endif
479 QWidget::showMaximized () ; 496 QWidget::showMaximized () ;
480 mClosed = false; 497 mClosed = false;
481} 498}
482void MainWindow::closeEvent( QCloseEvent* ce ) 499void MainWindow::closeEvent( QCloseEvent* ce )
483{ 500{
484 501
485 502
486 503
487 if ( ! KOPrefs::instance()->mAskForQuit ) { 504 if ( ! KOPrefs::instance()->mAskForQuit ) {
488 saveOnClose(); 505 saveOnClose();
489 mClosed = true; 506 mClosed = true;
490 ce->accept(); 507 ce->accept();
491 return; 508 return;
492 509
493 } 510 }
494 511
495 switch( QMessageBox::information( this, "KO/Pi", 512 switch( QMessageBox::information( this, "KO/Pi",
496 i18n("Do you really want\nto close KO/Pi?"), 513 i18n("Do you really want\nto close KO/Pi?"),
497 i18n("Close"), i18n("No"), 514 i18n("Close"), i18n("No"),
498 0, 0 ) ) { 515 0, 0 ) ) {
499 case 0: 516 case 0:
500 saveOnClose(); 517 saveOnClose();
501 mClosed = true; 518 mClosed = true;
502 ce->accept(); 519 ce->accept();
503 break; 520 break;
504 case 1: 521 case 1:
505 ce->ignore(); 522 ce->ignore();
506 break; 523 break;
507 case 2: 524 case 2:
508 525
509 default: 526 default:
510 break; 527 break;
511 } 528 }
512 529
513 530
514} 531}
515 532
516void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 533void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
517{ 534{
518 QDataStream stream( data, IO_ReadOnly ); 535 QDataStream stream( data, IO_ReadOnly );
519 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 536 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
520 //QString datamess; 537 //QString datamess;
521 //qDebug("message "); 538 //qDebug("message ");
522 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 539 qDebug("KO: QCOP message received: %s ", cmsg.data() );
523 540
524 if ( cmsg == "setDocument(QString)" ) { 541 if ( cmsg == "setDocument(QString)" ) {
525 QDataStream stream( data, IO_ReadOnly ); 542 QDataStream stream( data, IO_ReadOnly );
526 QString fileName; 543 QString fileName;
527 stream >> fileName; 544 stream >> fileName;
528 //qDebug("filename %s ", fileName.latin1()); 545 //qDebug("filename %s ", fileName.latin1());
529 showMaximized(); 546 showMaximized();
530 raise(); 547 raise();
531 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 548 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
532 mSyncManager->slotSyncMenu( 1002 ); 549 mSyncManager->slotSyncMenu( 1002 );
533 return; 550 return;
534 } 551 }
535 552
536 if ( cmsg == "-writeFile" ) { 553 if ( cmsg == "-writeFile" ) {
537 // I made from the "-writeFile" an "-writeAlarm" 554 // I made from the "-writeFile" an "-writeAlarm"
538 mView->viewManager()->showWhatsNextView(); 555 mView->viewManager()->showWhatsNextView();
539 mCalendar->checkAlarmForIncidence( 0, true); 556 mCalendar->checkAlarmForIncidence( 0, true);
540 showMaximized(); 557 showMaximized();
541 raise(); 558 raise();
542 return; 559 return;
543 560
544 } 561 }
545 if ( cmsg == "-writeFileSilent" ) { 562 if ( cmsg == "-writeFileSilent" ) {
546 // I made from the "-writeFile" an "-writeAlarm" 563 // I made from the "-writeFile" an "-writeAlarm"
547 // mView->viewManager()->showWhatsNextView(); 564 // mView->viewManager()->showWhatsNextView();
548 mCalendar->checkAlarmForIncidence( 0, true); 565 mCalendar->checkAlarmForIncidence( 0, true);
549 //showMaximized(); 566 //showMaximized();
550 //raise(); 567 //raise();
551 hide(); 568 hide();
552 return; 569 return;
553 } 570 }
554 if ( cmsg == "-newCountdown" ) { 571 if ( cmsg == "-newCountdown" ) {
555 qDebug("newCountdown "); 572 qDebug("newCountdown ");
556 573
557 } 574 }
558 QString msg ; 575 QString msg ;
559 QString allmsg = cmsg; 576 QString allmsg = cmsg;
560 while ( allmsg.length() > 0 ) { 577 while ( allmsg.length() > 0 ) {
561 int nextC = allmsg.find( "-", 1 ); 578 int nextC = allmsg.find( "-", 1 );
562 if ( nextC == -1 ) { 579 if ( nextC == -1 ) {
563 msg = allmsg; 580 msg = allmsg;
564 allmsg = ""; 581 allmsg = "";
565 } else{ 582 } else{
566 msg = allmsg.left( nextC ); 583 msg = allmsg.left( nextC );
567 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 584 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
568 } 585 }
569 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 586 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
570 if ( msg == "-newEvent" ) { 587 if ( msg == "-newEvent" ) {
571 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 588 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
572 } 589 }
573 if ( msg == "-newTodo" ) { 590 if ( msg == "-newTodo" ) {
574 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 591 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
575 } 592 }
576 if ( msg == "-showWN" ) { 593 if ( msg == "-showWN" ) {
577 mView->viewManager()->showWhatsNextView(); 594 mView->viewManager()->showWhatsNextView();
578 } 595 }
579 if ( msg == "-showTodo" ) { 596 if ( msg == "-showTodo" ) {
580 mView->viewManager()->showTodoView(); 597 mView->viewManager()->showTodoView();
581 } 598 }
582 if ( msg == "-showList" ) { 599 if ( msg == "-showList" ) {
583 mView->viewManager()->showListView(); 600 mView->viewManager()->showListView();
584 } 601 }
585 else if ( msg == "-showDay" ) { 602 else if ( msg == "-showDay" ) {
586 mView->viewManager()->showDayView(); 603 mView->viewManager()->showDayView();
587 } 604 }
588 else if ( msg == "-showWWeek" ) { 605 else if ( msg == "-showWWeek" ) {
589 mView->viewManager()->showWorkWeekView(); 606 mView->viewManager()->showWorkWeekView();
590 } 607 }
591 else if ( msg == "-ringSync" ) { 608 else if ( msg == "-ringSync" ) {
592 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 609 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
593 } 610 }
594 else if ( msg == "-showWeek" ) { 611 else if ( msg == "-showWeek" ) {
595 mView->viewManager()->showWeekView(); 612 mView->viewManager()->showWeekView();
596 } 613 }
597 else if ( msg == "-showTodo" ) { 614 else if ( msg == "-showTodo" ) {
598 mView->viewManager()->showTodoView(); 615 mView->viewManager()->showTodoView();
599 } 616 }
600 else if ( msg == "-showJournal" ) { 617 else if ( msg == "-showJournal" ) {
601 mView->dateNavigator()->selectDates( 1 ); 618 mView->dateNavigator()->selectDates( 1 );
602 mView->dateNavigator()->selectToday(); 619 mView->dateNavigator()->selectToday();
603 mView->viewManager()->showJournalView(); 620 mView->viewManager()->showJournalView();
604 } 621 }
605 else if ( msg == "-showKO" ) { 622 else if ( msg == "-showKO" ) {
606 mView->viewManager()->showNextXView(); 623 mView->viewManager()->showNextXView();
607 } 624 }
608 else if ( msg == "-showWNext" ) { 625 else if ( msg == "-showWNext" ) {
609 mView->viewManager()->showWhatsNextView(); 626 mView->viewManager()->showWhatsNextView();
610 } 627 }
611 else if ( msg == "nextView()" ) { 628 else if ( msg == "nextView()" ) {
612 mView->viewManager()->showNextView(); 629 mView->viewManager()->showNextView();
613 } 630 }
614 else if ( msg == "-showNextXView" ) { 631 else if ( msg == "-showNextXView" ) {
615 mView->viewManager()->showNextXView(); 632 mView->viewManager()->showNextXView();
616 } 633 }
617 634
618 635
619 } 636 }
620 637
621 showMaximized(); 638 showMaximized();
622 raise(); 639 raise();
623} 640}
624void MainWindow::startMultiSync() 641void MainWindow::startMultiSync()
625{ 642{
626 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 643 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
627 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 644 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
628 question, 645 question,
629 i18n("Yes"), i18n("No"), 646 i18n("Yes"), i18n("No"),
630 0, 0 ) != 0 ) { 647 0, 0 ) != 0 ) {
631 setCaption(i18n("Aborted! Nothing synced!")); 648 setCaption(i18n("Aborted! Nothing synced!"));
632 return; 649 return;
633 } 650 }
634 mSyncManager->multiSync( false ); 651 mSyncManager->multiSync( false );
635#ifndef DESKTOP_VERSION 652#ifndef DESKTOP_VERSION
636 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 653 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
637#endif 654#endif
638} 655}
639QPixmap MainWindow::loadPixmap( QString name ) 656QPixmap MainWindow::loadPixmap( QString name )
640{ 657{
641 return SmallIcon( name ); 658 return SmallIcon( name );
642 659
643} 660}
644void MainWindow::setUsesBigPixmaps ( bool b ) 661void MainWindow::setUsesBigPixmaps ( bool b )
645{ 662{
646 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 663 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
647 if ( b ) 664 if ( b )
648 qDebug("KO: BigPixmaps are not supported "); 665 qDebug("KO: BigPixmaps are not supported ");
649} 666}
650void MainWindow::initActions() 667void MainWindow::initActions()
651{ 668{
652 //KOPrefs::instance()->mShowFullMenu 669 //KOPrefs::instance()->mShowFullMenu
653 iconToolBar->clear(); 670 iconToolBar->clear();
654 KOPrefs *p = KOPrefs::instance(); 671 KOPrefs *p = KOPrefs::instance();
655 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 672 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
656 673
657 QPopupMenu *viewMenu = new QPopupMenu( this ); 674 QPopupMenu *viewMenu = new QPopupMenu( this );
658 QPopupMenu *actionMenu = new QPopupMenu( this ); 675 QPopupMenu *actionMenu = new QPopupMenu( this );
659 mCurrentItemMenu = new QPopupMenu ( this ); 676 mCurrentItemMenu = new QPopupMenu ( this );
660 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 677 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
661 QPopupMenu *importMenu = new QPopupMenu( this ); 678 QPopupMenu *importMenu = new QPopupMenu( this );
662 QPopupMenu *importMenu_X = new QPopupMenu( this ); 679 QPopupMenu *importMenu_X = new QPopupMenu( this );
663 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 680 QPopupMenu *exportMenu_X = new QPopupMenu( this );
664 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 681 QPopupMenu *beamMenu_X = new QPopupMenu( this );
665 selectFilterMenu = new QPopupMenu( this ); 682 selectFilterMenu = new QPopupMenu( this );
666 selectFilterMenu->setCheckable( true ); 683 selectFilterMenu->setCheckable( true );
667 syncMenu = new QPopupMenu( this ); 684 syncMenu = new QPopupMenu( this );
668 configureAgendaMenu = new QPopupMenu( this ); 685 configureAgendaMenu = new QPopupMenu( this );
669 configureToolBarMenu = new QPopupMenu( this ); 686 configureToolBarMenu = new QPopupMenu( this );
670 QPopupMenu *helpMenu = new QPopupMenu( this ); 687 QPopupMenu *helpMenu = new QPopupMenu( this );
671 QIconSet icon; 688 QIconSet icon;
672 int pixWid = 22, pixHei = 22; 689 int pixWid = 22, pixHei = 22;
673 QString pathString = ""; 690 QString pathString = "";
674 if ( !p->mToolBarMiniIcons ) { 691 if ( !p->mToolBarMiniIcons ) {
675 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 692 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
676 pathString += "icons16/"; 693 pathString += "icons16/";
677 pixWid = 18; pixHei = 16; 694 pixWid = 18; pixHei = 16;
678 } 695 }
679 } else { 696 } else {
680 pathString += "iconsmini/"; 697 pathString += "iconsmini/";
681 pixWid = 18; pixHei = 16; 698 pixWid = 18; pixHei = 16;
682 } 699 }
683 KMenuBar *menuBar1; 700
684 if ( KOPrefs::instance()->mShowFullMenu ) { 701 if ( KOPrefs::instance()->mShowFullMenu ) {
685 menuBar1 = new KMenuBar( this );//menuBar(); 702 menuBar1 = new KMenuBar( this );//menuBar();
703 //setMenuBar( menuBar1 );
704 menuBar1->show();
686 menuBar1->insertItem( i18n("File"), importMenu ); 705 menuBar1->insertItem( i18n("File"), importMenu );
687 menuBar1->insertItem( i18n("View"), viewMenu ); 706 menuBar1->insertItem( i18n("View"), viewMenu );
688 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 707 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
689 menuBar1->insertItem( i18n("Action"), actionMenu ); 708 menuBar1->insertItem( i18n("Action"), actionMenu );
690#ifdef DESKTOP_VERSION 709#ifdef DESKTOP_VERSION
691 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 710 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
692 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 711 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
693#else 712#else
694 menuBar1->insertItem( i18n("Sync"), syncMenu ); 713 menuBar1->insertItem( i18n("Sync"), syncMenu );
695 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 714 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
696#endif 715#endif
697 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 716 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
698 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 717 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
699 menuBar1->insertItem( i18n("Help"), helpMenu ); 718 menuBar1->insertItem( i18n("Help"), helpMenu );
700 } else { 719 } else {
701 menuBar1 = new KMenuBar( iconToolBar ); 720 menuBar1 = new KMenuBar( iconToolBar );
702 QPopupMenu *menuBar = new QPopupMenu( this ); 721 QPopupMenu *menuBar = new QPopupMenu( this );
703 icon = loadPixmap( pathString + "z_menu" ); 722 icon = loadPixmap( pathString + "z_menu" );
704 menuBar1->insertItem( icon.pixmap(), menuBar); 723 menuBar1->insertItem( icon.pixmap(), menuBar);
705 //menuBar1->insertItem( i18n("ME"), menuBar); 724 //menuBar1->insertItem( i18n("ME"), menuBar);
706 menuBar->insertItem( i18n("File"), importMenu ); 725 menuBar->insertItem( i18n("File"), importMenu );
707 menuBar->insertItem( i18n("View"), viewMenu ); 726 menuBar->insertItem( i18n("View"), viewMenu );
708 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 727 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
709 menuBar->insertItem( i18n("Action"), actionMenu ); 728 menuBar->insertItem( i18n("Action"), actionMenu );
710 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 729 menuBar->insertItem( i18n("Synchronize"), syncMenu );
711 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 730 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
712 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 731 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
713 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 732 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
714 menuBar->insertItem( i18n("Help"), helpMenu ); 733 menuBar->insertItem( i18n("Help"), helpMenu );
715 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 734 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
716 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 735 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
736 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
717 } 737 }
718 connect ( menuBar1, SIGNAL( lostFocus () ), mView, SLOT ( slotResetFocus() ) ); 738 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
739 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
719 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 740 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
720 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 741 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
721 742
722 743
723 mWeekBgColor = iconToolBar->backgroundColor(); 744 mWeekBgColor = iconToolBar->backgroundColor();
724 mWeekPixmap.resize( pixWid , pixHei ); 745 mWeekPixmap.resize( pixWid , pixHei );
725 mWeekPixmap.fill( mWeekBgColor ); 746 mWeekPixmap.fill( mWeekBgColor );
726 icon = mWeekPixmap; 747 icon = mWeekPixmap;
727 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 748 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
728 if ( p-> mShowIconWeekNum ) 749 if ( p-> mShowIconWeekNum )
729 mWeekAction->addTo( iconToolBar ); 750 mWeekAction->addTo( iconToolBar );
730 mWeekFont = font(); 751 mWeekFont = font();
731 752
732 int fontPoint = mWeekFont.pointSize(); 753 int fontPoint = mWeekFont.pointSize();
733 QFontMetrics f( mWeekFont ); 754 QFontMetrics f( mWeekFont );
734 int fontWid = f.width( "30" ); 755 int fontWid = f.width( "30" );
735 while ( fontWid > pixWid ) { 756 while ( fontWid > pixWid ) {
736 --fontPoint; 757 --fontPoint;
737 mWeekFont.setPointSize( fontPoint ); 758 mWeekFont.setPointSize( fontPoint );
738 QFontMetrics f( mWeekFont ); 759 QFontMetrics f( mWeekFont );
739 fontWid = f.width( "30" ); 760 fontWid = f.width( "30" );
740 //qDebug("dec-- "); 761 //qDebug("dec-- ");
741 } 762 }
742 763
743 connect( mWeekAction, SIGNAL( activated() ), 764 connect( mWeekAction, SIGNAL( activated() ),
744 this, SLOT( weekAction() ) ); 765 this, SLOT( weekAction() ) );
745 766
746 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 767 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
747 if ( p->mShowIconFilterview ) { 768 if ( p->mShowIconFilterview ) {
748 icon = loadPixmap( pathString + "filter" ); 769 icon = loadPixmap( pathString + "filter" );
749 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 770 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
750 connect( actionFilterMenuTB, SIGNAL( activated() ), 771 connect( actionFilterMenuTB, SIGNAL( activated() ),
751 this, SLOT( fillFilterMenuTB() ) ); 772 this, SLOT( fillFilterMenuTB() ) );
752 actionFilterMenuTB->addTo( iconToolBar ); 773 actionFilterMenuTB->addTo( iconToolBar );
753 selectFilterMenuTB = new QPopupMenu( this ); 774 selectFilterMenuTB = new QPopupMenu( this );
754 selectFilterMenuTB->setCheckable( true ); 775 selectFilterMenuTB->setCheckable( true );
755 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 776 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
756 } 777 }
757 778
758 //#endif 779 //#endif
759 // ****************** 780 // ******************
760 QAction *action; 781 QAction *action;
761 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 782 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
762 configureToolBarMenu->setCheckable( true ); 783 configureToolBarMenu->setCheckable( true );
763 784
764 785
765 configureAgendaMenu->setCheckable( true ); 786 configureAgendaMenu->setCheckable( true );
766 int iii ; 787 int iii ;
767 for ( iii = 1;iii<= 10 ;++iii ){ 788 for ( iii = 1;iii<= 10 ;++iii ){
768 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 789 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
769 } 790 }
770 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 791 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
771 792
772 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 793 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
773 this, SLOT( showConfigureAgenda( ) ) ); 794 this, SLOT( showConfigureAgenda( ) ) );
774 icon = loadPixmap( pathString + "today" ); 795 icon = loadPixmap( pathString + "today" );
775 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 796 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
776 today_action->addTo( actionMenu ); 797 today_action->addTo( actionMenu );
777 connect( today_action, SIGNAL( activated() ), 798 connect( today_action, SIGNAL( activated() ),
778 mView, SLOT( goToday() ) ); 799 mView, SLOT( goToday() ) );
779 800
780 icon = loadPixmap( pathString + "picker" ); 801 icon = loadPixmap( pathString + "picker" );
781 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 802 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
782 dPickerAction->addTo( actionMenu ); 803 dPickerAction->addTo( actionMenu );
783 connect( dPickerAction, SIGNAL( activated() ), 804 connect( dPickerAction, SIGNAL( activated() ),
784 mView, SLOT( showDatePicker() ) ); 805 mView, SLOT( showDatePicker() ) );
785 806
786 icon = loadPixmap( pathString + "search" ); 807 icon = loadPixmap( pathString + "search" );
787 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 808 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
788 search_action->addTo( actionMenu ); 809 search_action->addTo( actionMenu );
789 connect( search_action, SIGNAL( activated() ), 810 connect( search_action, SIGNAL( activated() ),
790 mView->dialogManager(), SLOT( showSearchDialog() ) ); 811 mView->dialogManager(), SLOT( showSearchDialog() ) );
791 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 812 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
792 813
793 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 814 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
794 action->addTo( nextConflictMenu ); 815 action->addTo( nextConflictMenu );
795 connect( action, SIGNAL( activated() ), 816 connect( action, SIGNAL( activated() ),
796 mView, SLOT( conflictAll() ) ); 817 mView, SLOT( conflictAll() ) );
797 818
798 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 819 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
799 action->addTo( nextConflictMenu ); 820 action->addTo( nextConflictMenu );
800 connect( action, SIGNAL( activated() ), 821 connect( action, SIGNAL( activated() ),
801 mView, SLOT( conflictAllday() ) ); 822 mView, SLOT( conflictAllday() ) );
802 823
803 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 824 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
804 action->addTo( nextConflictMenu ); 825 action->addTo( nextConflictMenu );
805 connect( action, SIGNAL( activated() ), 826 connect( action, SIGNAL( activated() ),
806 mView, SLOT( conflictNotAll() ) ); 827 mView, SLOT( conflictNotAll() ) );
807 828
808 actionMenu->insertSeparator(); 829 actionMenu->insertSeparator();
809 830
810 icon = loadPixmap( pathString + "newevent" ); 831 icon = loadPixmap( pathString + "newevent" );
811 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 832 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
812 ne_action->addTo( mCurrentItemMenu ); 833 ne_action->addTo( mCurrentItemMenu );
813 connect( ne_action, SIGNAL( activated() ), 834 connect( ne_action, SIGNAL( activated() ),
814 mView, SLOT( newEvent() ) ); 835 mView, SLOT( newEvent() ) );
815 icon = loadPixmap( pathString + "newtodo" ); 836 icon = loadPixmap( pathString + "newtodo" );
816 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 837 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
817 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 838 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
818 nt_action->addTo( mCurrentItemMenu ); 839 nt_action->addTo( mCurrentItemMenu );
819 connect( nt_action, SIGNAL( activated() ), 840 connect( nt_action, SIGNAL( activated() ),
820 mView, SLOT( newTodo() ) ); 841 mView, SLOT( newTodo() ) );
821 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 842 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
822 this ); 843 this );
823 mNewSubTodoAction->addTo( mCurrentItemMenu ); 844 mNewSubTodoAction->addTo( mCurrentItemMenu );
824 connect( mNewSubTodoAction, SIGNAL( activated() ), 845 connect( mNewSubTodoAction, SIGNAL( activated() ),
825 mView, SLOT( newSubTodo() ) ); 846 mView, SLOT( newSubTodo() ) );
826 847
827 mCurrentItemMenu->insertSeparator(); 848 mCurrentItemMenu->insertSeparator();
828 icon = loadPixmap( pathString + "newevent" ); 849 icon = loadPixmap( pathString + "newevent" );
829 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 850 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
830 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 851 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
831 configureToolBarMenu->insertSeparator(); 852 configureToolBarMenu->insertSeparator();
832 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 853 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
833 configureToolBarMenu->insertSeparator(); 854 configureToolBarMenu->insertSeparator();
834 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 855 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
835 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 856 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
836 857
837 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 858 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
838 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 859 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
839 mShowAction->addTo( mCurrentItemMenu ); 860 mShowAction->addTo( mCurrentItemMenu );
840 connect( mShowAction, SIGNAL( activated() ), 861 connect( mShowAction, SIGNAL( activated() ),
841 mView, SLOT( showIncidence() ) ); 862 mView, SLOT( showIncidence() ) );
842 863
843 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 864 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
844 mEditAction->addTo( mCurrentItemMenu ); 865 mEditAction->addTo( mCurrentItemMenu );
845 connect( mEditAction, SIGNAL( activated() ), 866 connect( mEditAction, SIGNAL( activated() ),
846 mView, SLOT( editIncidence() ) ); 867 mView, SLOT( editIncidence() ) );
847 868
848 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 869 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
849 mDeleteAction->addTo( mCurrentItemMenu ); 870 mDeleteAction->addTo( mCurrentItemMenu );
850 connect( mDeleteAction, SIGNAL( activated() ), 871 connect( mDeleteAction, SIGNAL( activated() ),
851 mView, SLOT( deleteIncidence() ) ); 872 mView, SLOT( deleteIncidence() ) );
852 873
853 874
854 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 875 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
855 mCloneAction->addTo( mCurrentItemMenu ); 876 mCloneAction->addTo( mCurrentItemMenu );
856 connect( mCloneAction, SIGNAL( activated() ), 877 connect( mCloneAction, SIGNAL( activated() ),
857 mView, SLOT( cloneIncidence() ) ); 878 mView, SLOT( cloneIncidence() ) );
858 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 879 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
859 mMoveAction->addTo( mCurrentItemMenu ); 880 mMoveAction->addTo( mCurrentItemMenu );
860 connect( mMoveAction, SIGNAL( activated() ), 881 connect( mMoveAction, SIGNAL( activated() ),
861 mView, SLOT( moveIncidence() ) ); 882 mView, SLOT( moveIncidence() ) );
862#ifndef DESKTOP_VERSION 883#ifndef DESKTOP_VERSION
863 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 884 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
864 mBeamAction->addTo(mCurrentItemMenu ); 885 mBeamAction->addTo(mCurrentItemMenu );
865 connect( mBeamAction, SIGNAL( activated() ), 886 connect( mBeamAction, SIGNAL( activated() ),
866 mView, SLOT( beamIncidence() ) ); 887 mView, SLOT( beamIncidence() ) );
867#endif 888#endif
868 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 889 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
869 mCancelAction->addTo( mCurrentItemMenu ); 890 mCancelAction->addTo( mCurrentItemMenu );
870 connect( mCancelAction, SIGNAL( activated() ), 891 connect( mCancelAction, SIGNAL( activated() ),
871 mView, SLOT( toggleCancelIncidence() ) ); 892 mView, SLOT( toggleCancelIncidence() ) );
872 893
873 894
874 mCurrentItemMenu->insertSeparator(); 895 mCurrentItemMenu->insertSeparator();
875 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 896 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
876 action->addTo( mCurrentItemMenu ); 897 action->addTo( mCurrentItemMenu );
877 connect( action, SIGNAL( activated() ), 898 connect( action, SIGNAL( activated() ),
878 mView, SLOT( undo_delete() ) ); 899 mView, SLOT( undo_delete() ) );
879 900
880 // *********************** 901 // ***********************
881 if ( KOPrefs::instance()->mVerticalScreen ) { 902 if ( KOPrefs::instance()->mVerticalScreen ) {
882 icon = SmallIcon( "1updownarrow" ); 903 icon = SmallIcon( "1updownarrow" );
883 } else { 904 } else {
884 icon = SmallIcon("1leftrightarrow" ); 905 icon = SmallIcon("1leftrightarrow" );
885 } 906 }
886 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 907 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
887 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 908 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
888 FSaction->addTo( viewMenu ); 909 FSaction->addTo( viewMenu );
889 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 910 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
890 911
891 912
892 icon = loadPixmap( pathString + "filter" ); 913 icon = loadPixmap( pathString + "filter" );
893 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 914 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
894 icon = loadPixmap( pathString + "configure" ); 915 icon = loadPixmap( pathString + "configure" );
895 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 916 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
896 action->addTo( viewMenu ); 917 action->addTo( viewMenu );
897 connect( action, SIGNAL( activated() ), 918 connect( action, SIGNAL( activated() ),
898 mView, SLOT( toggleFilter() ) ); 919 mView, SLOT( toggleFilter() ) );
899 mToggleFilter = action; 920 mToggleFilter = action;
900 icon = loadPixmap( pathString + "navi" ); 921 icon = loadPixmap( pathString + "navi" );
901 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 922 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
902 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 923 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
903 action->addTo( viewMenu ); 924 action->addTo( viewMenu );
904 connect( action, SIGNAL( activated() ), 925 connect( action, SIGNAL( activated() ),
905 mView, SLOT( toggleDateNavigatorWidget() ) ); 926 mView, SLOT( toggleDateNavigatorWidget() ) );
906 mToggleNav = action ; 927 mToggleNav = action ;
907 icon = loadPixmap( pathString + "allday" ); 928 icon = loadPixmap( pathString + "allday" );
908 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 929 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
909 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 930 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
910 action->addTo( viewMenu ); 931 action->addTo( viewMenu );
911 connect( action, SIGNAL( activated() ), 932 connect( action, SIGNAL( activated() ),
912 mView, SLOT( toggleAllDaySize() ) ); 933 mView, SLOT( toggleAllDaySize() ) );
913 mToggleAllday = action; 934 mToggleAllday = action;
914 935
915 936
916 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 937 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
917 mToggleNav, SLOT( setEnabled ( bool ) ) ); 938 mToggleNav, SLOT( setEnabled ( bool ) ) );
918 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 939 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
919 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 940 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
920 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 941 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
921 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 942 mToggleAllday, SLOT( setEnabled ( bool ) ) );
922 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 943 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
923 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 944 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
924 945
925 946
926 dPickerAction->addTo( iconToolBar ); 947 dPickerAction->addTo( iconToolBar );
927 viewMenu->insertSeparator(); 948 viewMenu->insertSeparator();
928 949
929 if ( p-> mShowIconToggleFull ) 950 if ( p-> mShowIconToggleFull )
930 FSaction->addTo( iconToolBar ); 951 FSaction->addTo( iconToolBar );
931 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 952 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
932 953
933 //******************** 954 //********************
934 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 955 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
935 956
936 957
937 icon = loadPixmap( pathString + "whatsnext" ); 958 icon = loadPixmap( pathString + "whatsnext" );
938 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 959 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
939 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 960 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
940 whatsnext_action->addTo( viewMenu ); 961 whatsnext_action->addTo( viewMenu );
941 connect( whatsnext_action, SIGNAL( activated() ), 962 connect( whatsnext_action, SIGNAL( activated() ),
942 mView->viewManager(), SLOT( showWhatsNextView() ) ); 963 mView->viewManager(), SLOT( showWhatsNextView() ) );
943 964
944 icon = loadPixmap( pathString + "xdays" ); 965 icon = loadPixmap( pathString + "xdays" );
945 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 966 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
946 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 967 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
947 xdays_action->addTo( viewMenu ); 968 xdays_action->addTo( viewMenu );
948 connect( xdays_action, SIGNAL( activated() ), 969 connect( xdays_action, SIGNAL( activated() ),
949 mView->viewManager(), SLOT( showNextXView() ) ); 970 mView->viewManager(), SLOT( showNextXView() ) );
950 971
951 972
952 icon = loadPixmap( pathString + "journal" ); 973 icon = loadPixmap( pathString + "journal" );
953 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 974 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
954 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 975 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
955 viewjournal_action->addTo( viewMenu ); 976 viewjournal_action->addTo( viewMenu );
956 connect( viewjournal_action, SIGNAL( activated() ), 977 connect( viewjournal_action, SIGNAL( activated() ),
957 mView->viewManager(), SLOT( showJournalView() ) ); 978 mView->viewManager(), SLOT( showJournalView() ) );
958 979
959 980
960 icon = loadPixmap( pathString + "day" ); 981 icon = loadPixmap( pathString + "day" );
961 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 982 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
962 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 983 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
963 day1_action->addTo( viewMenu ); 984 day1_action->addTo( viewMenu );
964 // action->addTo( toolBar ); 985 // action->addTo( toolBar );
965 connect( day1_action, SIGNAL( activated() ), 986 connect( day1_action, SIGNAL( activated() ),
966 mView->viewManager(), SLOT( showDayView() ) ); 987 mView->viewManager(), SLOT( showDayView() ) );
967 988
968 icon = loadPixmap( pathString + "workweek" ); 989 icon = loadPixmap( pathString + "workweek" );
969 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 990 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
970 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 991 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
971 day5_action->addTo( viewMenu ); 992 day5_action->addTo( viewMenu );
972 connect( day5_action, SIGNAL( activated() ), 993 connect( day5_action, SIGNAL( activated() ),
973 mView->viewManager(), SLOT( showWorkWeekView() ) ); 994 mView->viewManager(), SLOT( showWorkWeekView() ) );
974 995
975 icon = loadPixmap( pathString + "week" ); 996 icon = loadPixmap( pathString + "week" );
976 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 997 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
977 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 998 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
978 day7_action->addTo( viewMenu ); 999 day7_action->addTo( viewMenu );
979 connect( day7_action, SIGNAL( activated() ), 1000 connect( day7_action, SIGNAL( activated() ),
980 mView->viewManager(), SLOT( showWeekView() ) ); 1001 mView->viewManager(), SLOT( showWeekView() ) );
981 1002
982 icon = loadPixmap( pathString + "workweek2" ); 1003 icon = loadPixmap( pathString + "workweek2" );
983 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1004 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
984 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1005 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
985 day6_action->addTo( viewMenu ); 1006 day6_action->addTo( viewMenu );
986 connect( day6_action, SIGNAL( activated() ), 1007 connect( day6_action, SIGNAL( activated() ),
987 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1008 mView->viewManager(), SLOT( showMonthViewWeek() ) );
988 1009
989 icon = loadPixmap( pathString + "month" ); 1010 icon = loadPixmap( pathString + "month" );
990 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1011 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
991 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1012 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
992 month_action->addTo( viewMenu ); 1013 month_action->addTo( viewMenu );
993 connect( month_action, SIGNAL( activated() ), 1014 connect( month_action, SIGNAL( activated() ),
994 mView->viewManager(), SLOT( showMonthView() ) ); 1015 mView->viewManager(), SLOT( showMonthView() ) );
995 1016
996 icon = loadPixmap( pathString + "list" ); 1017 icon = loadPixmap( pathString + "list" );
997 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1018 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
998 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1019 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
999 showlist_action->addTo( viewMenu ); 1020 showlist_action->addTo( viewMenu );
1000 connect( showlist_action, SIGNAL( activated() ), 1021 connect( showlist_action, SIGNAL( activated() ),
1001 mView->viewManager(), SLOT( showListView() ) ); 1022 mView->viewManager(), SLOT( showListView() ) );
1002 1023
1003 icon = loadPixmap( pathString + "todo" ); 1024 icon = loadPixmap( pathString + "todo" );
1004 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1025 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1005 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1026 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1006 todoview_action->addTo( viewMenu ); 1027 todoview_action->addTo( viewMenu );
1007 connect( todoview_action, SIGNAL( activated() ), 1028 connect( todoview_action, SIGNAL( activated() ),
1008 mView->viewManager(), SLOT( showTodoView() ) ); 1029 mView->viewManager(), SLOT( showTodoView() ) );
1009 1030
1010 1031
1011 1032
1012#if 0 1033#if 0
1013 action = new QAction( "view_timespan", "Time Span", 0, this ); 1034 action = new QAction( "view_timespan", "Time Span", 0, this );
1014 action->addTo( viewMenu ); 1035 action->addTo( viewMenu );
1015 connect( action, SIGNAL( activated() ), 1036 connect( action, SIGNAL( activated() ),
1016 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1037 mView->viewManager(), SLOT( showTimeSpanView() ) );
1017#endif 1038#endif
1018 1039
1019 1040
1020 1041
1021 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1042 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1022 this ); 1043 this );
1023 action->addTo( actionMenu ); 1044 action->addTo( actionMenu );
1024 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1045 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1025 1046
1026 1047
1027 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1048 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1028 1049
1029 1050
1030 1051
1031 actionMenu->insertSeparator(); 1052 actionMenu->insertSeparator();
1032 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1053 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1033 this ); 1054 this );
1034 action->addTo( actionMenu ); 1055 action->addTo( actionMenu );
1035 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1056 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1036 1057
1037 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1058 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1038 this ); 1059 this );
1039 action->addTo( actionMenu ); 1060 action->addTo( actionMenu );
1040 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1061 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1041 1062
1042 1063
1043 actionMenu->insertSeparator(); 1064 actionMenu->insertSeparator();
1044 icon = loadPixmap( pathString + "configure" ); 1065 icon = loadPixmap( pathString + "configure" );
1045 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1066 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1046 action->addTo( actionMenu ); 1067 action->addTo( actionMenu );
1047 connect( action, SIGNAL( activated() ), 1068 connect( action, SIGNAL( activated() ),
1048 mView, SLOT( edit_options() ) ); 1069 mView, SLOT( edit_options() ) );
1049 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1070 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1050 action->addTo( actionMenu ); 1071 action->addTo( actionMenu );
1051 connect( action, SIGNAL( activated() ), 1072 connect( action, SIGNAL( activated() ),
1052 this, SLOT( calHint() ) ); 1073 this, SLOT( calHint() ) );
1053 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1074 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1054 action->addTo( actionMenu ); 1075 action->addTo( actionMenu );
1055 connect( action, SIGNAL( activated() ), 1076 connect( action, SIGNAL( activated() ),
1056 mView, SLOT( edit_global_options() ) ); 1077 mView, SLOT( edit_global_options() ) );
1057 if ( KOPrefs::instance()->mShowFullMenu ) { 1078 if ( KOPrefs::instance()->mShowFullMenu ) {
1058 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1079 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1059 1080
1060 } 1081 }
1061 // actionMenu->insertSeparator(); 1082 // actionMenu->insertSeparator();
1062 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1083 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1063 this ); 1084 this );
1064 action->addTo( importMenu_X ); 1085 action->addTo( importMenu_X );
1065 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1086 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1066 action = new QAction( "import_quick", i18n("Import last file"), 0, 1087 action = new QAction( "import_quick", i18n("Import last file"), 0,
1067 this ); 1088 this );
1068 action->addTo( importMenu_X ); 1089 action->addTo( importMenu_X );
1069 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1090 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1070 importMenu_X->insertSeparator(); 1091 importMenu_X->insertSeparator();
1071 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1092 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1072 this ); 1093 this );
1073 action->addTo( importMenu_X ); 1094 action->addTo( importMenu_X );
1074 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1095 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1075 //#ifndef DESKTOP_VERSION 1096 //#ifndef DESKTOP_VERSION
1076 importMenu_X->insertSeparator(); 1097 importMenu_X->insertSeparator();
1077 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1098 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1078 this ); 1099 this );
1079 action->addTo( importMenu_X ); 1100 action->addTo( importMenu_X );
1080 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1101 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1081 //#else 1102 //#else
1082#ifdef _OL_IMPORT_ 1103#ifdef _OL_IMPORT_
1083 importMenu_X->insertSeparator(); 1104 importMenu_X->insertSeparator();
1084 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1105 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1085 this ); 1106 this );
1086 action->addTo( importMenu_X ); 1107 action->addTo( importMenu_X );
1087 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1108 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1088#endif 1109#endif
1089 //#endif 1110 //#endif
1090 1111
1091 //importMenu->insertSeparator(); 1112 //importMenu->insertSeparator();
1092#if 0 1113#if 0
1093 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1114 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1094 this ); 1115 this );
1095 action->addTo( importMenu ); 1116 action->addTo( importMenu );
1096 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1117 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1097#endif 1118#endif
1098 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1119 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1099 this ); 1120 this );
1100 action->addTo( importMenu ); 1121 action->addTo( importMenu );
1101 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1122 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1102 importMenu->insertSeparator(); 1123 importMenu->insertSeparator();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e2de3ba..7d3d492 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,173 +1,178 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#include <kpopupmenu.h> 14#include <kpopupmenu.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26 26
27 27
28namespace KCal { 28namespace KCal {
29class CalendarLocal; 29class CalendarLocal;
30} 30}
31 31
32using namespace KCal; 32using namespace KCal;
33 33
34class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 public: 37 public:
38 MainWindow( QWidget *parent = 0, const char *name = 0 ); 38 MainWindow( QWidget *parent = 0, const char *name = 0 );
39 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled(); 40 bool beamReceiveEnabled();
41 static QString defaultFileName(); 41 static QString defaultFileName();
42 static QString syncFileName(); 42 static QString syncFileName();
43 static QString resourcePath(); 43 static QString resourcePath();
44 public slots: 44 public slots:
45 void setUsesBigPixmaps ( bool ); 45 void setUsesBigPixmaps ( bool );
46 void setCaption ( const QString & ); 46 void setCaption ( const QString & );
47 void updateWeekNum(const KCal::DateList &); 47 void updateWeekNum(const KCal::DateList &);
48 void updateWeek(QDate); 48 void updateWeek(QDate);
49 void updateFilterToolbar(); 49 void updateFilterToolbar();
50 virtual void showMaximized (); 50 virtual void showMaximized ();
51 void configureAgenda( int ); 51 void configureAgenda( int );
52 void recieve( const QCString& msg, const QByteArray& data ); 52 void recieve( const QCString& msg, const QByteArray& data );
53 protected slots: 53 protected slots:
54 void calHint(); 54 void calHint();
55 void startMultiSync(); 55 void startMultiSync();
56 void setCaptionToDates(); 56 void setCaptionToDates();
57 void weekAction(); 57 void weekAction();
58 void about(); 58 void about();
59 void licence(); 59 void licence();
60 void faq(); 60 void faq();
61 void usertrans(); 61 void usertrans();
62 void features(); 62 void features();
63 void synchowto(); 63 void synchowto();
64 void storagehowto(); 64 void storagehowto();
65 void timetrackinghowto(); 65 void timetrackinghowto();
66 void kdesynchowto(); 66 void kdesynchowto();
67 void multisynchowto(); 67 void multisynchowto();
68 void whatsNew(); 68 void whatsNew();
69 void keyBindings(); 69 void keyBindings();
70 void aboutAutoSaving();; 70 void aboutAutoSaving();;
71 void aboutKnownBugs(); 71 void aboutKnownBugs();
72 72
73 void processIncidenceSelection( Incidence * ); 73 void processIncidenceSelection( Incidence * );
74 74
75 void importQtopia(); 75 void importQtopia();
76 void importBday(); 76 void importBday();
77 void importOL(); 77 void importOL();
78 void importIcal(); 78 void importIcal();
79 void importFile( QString, bool ); 79 void importFile( QString, bool );
80 void quickImportIcal(); 80 void quickImportIcal();
81 81
82 void slotModifiedChanged( bool ); 82 void slotModifiedChanged( bool );
83 83
84 void save(); 84 void save();
85 void backupAllFiles(); 85 void backupAllFiles();
86 void saveStopTimer(); 86 void saveStopTimer();
87 void configureToolBar( int ); 87 void configureToolBar( int );
88 void printSel(); 88 void printSel();
89 void printCal(); 89 void printCal();
90 void printListView(); 90 void printListView();
91 void saveCalendar(); 91 void saveCalendar();
92 void loadCalendar(); 92 void loadCalendar();
93 void exportVCalendar(); 93 void exportVCalendar();
94 void fillFilterMenu(); 94 void fillFilterMenu();
95 void fillFilterMenuTB(); 95 void fillFilterMenuTB();
96 void selectFilter( int ); 96 void selectFilter( int );
97 void fillFilterMenuPopup(); 97 void fillFilterMenuPopup();
98 void selectFilterPopup( int ); 98 void selectFilterPopup( int );
99 void exportToPhone( int ); 99 void exportToPhone( int );
100 void toggleBeamReceive(); 100 void toggleBeamReceive();
101 void disableBR(bool); 101 void disableBR(bool);
102 signals: 102 signals:
103 void selectWeek ( int ); 103 void selectWeek ( int );
104 private slots: 104 private slots:
105 void slotResetFocus();
106 void slotResetFocusLoop();
105 void showConfigureAgenda(); 107 void showConfigureAgenda();
106 void getFile( bool ); 108 void getFile( bool );
107 void syncFileRequest(); 109 void syncFileRequest();
108 110
109 protected: 111 protected:
112 int mFocusLoop;
110 void hideEvent ( QHideEvent * ); 113 void hideEvent ( QHideEvent * );
111 QString sentSyncFile(); 114 QString sentSyncFile();
112 void displayText( QString, QString); 115 void displayText( QString, QString);
113 void enableIncidenceActions( bool ); 116 void enableIncidenceActions( bool );
114 117
115 private: 118 private:
119 //void setMenuBar( QMenuBar * );
116 bool mBRdisabled; 120 bool mBRdisabled;
117#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
118 QCopChannel* infrared; 122 QCopChannel* infrared;
119#endif 123#endif
120 QAction* brAction; 124 QAction* brAction;
121 KSyncManager* mSyncManager; 125 KSyncManager* mSyncManager;
122 bool mClosed; 126 bool mClosed;
123 void saveOnClose(); 127 void saveOnClose();
124 bool mFlagKeyPressed; 128 bool mFlagKeyPressed;
125 bool mBlockAtStartup; 129 bool mBlockAtStartup;
130 KMenuBar *menuBar1;
126 QPEToolBar *iconToolBar; 131 QPEToolBar *iconToolBar;
127 QPEToolBar *viewToolBar; 132 QPEToolBar *viewToolBar;
128 QPEToolBar *navigatorToolBar; 133 QPEToolBar *navigatorToolBar;
129 QPEToolBar *filterToolBar; 134 QPEToolBar *filterToolBar;
130 KMenuBar *filterMenubar; 135 KMenuBar *filterMenubar;
131 QPopupMenu * filterPopupMenu; 136 QPopupMenu * filterPopupMenu;
132 QPopupMenu * mCurrentItemMenu; 137 QPopupMenu * mCurrentItemMenu;
133 void initActions(); 138 void initActions();
134 void setDefaultPreferences(); 139 void setDefaultPreferences();
135 void resizeEvent( QResizeEvent* e); 140 void resizeEvent( QResizeEvent* e);
136 void keyPressEvent ( QKeyEvent * ) ; 141 void keyPressEvent ( QKeyEvent * ) ;
137 void keyReleaseEvent ( QKeyEvent * ) ; 142 void keyReleaseEvent ( QKeyEvent * ) ;
138 QPopupMenu *configureToolBarMenu; 143 QPopupMenu *configureToolBarMenu;
139 QPopupMenu *selectFilterMenu; 144 QPopupMenu *selectFilterMenu;
140 QPopupMenu *selectFilterMenuTB; 145 QPopupMenu *selectFilterMenuTB;
141 QPopupMenu *configureAgendaMenu, *syncMenu; 146 QPopupMenu *configureAgendaMenu, *syncMenu;
142 CalendarLocal *mCalendar; 147 CalendarLocal *mCalendar;
143 CalendarView *mView; 148 CalendarView *mView;
144 QAction *mNewSubTodoAction; 149 QAction *mNewSubTodoAction;
145 QAction *mWeekAction; 150 QAction *mWeekAction;
146 QFont mWeekFont; 151 QFont mWeekFont;
147 QPixmap mWeekPixmap; 152 QPixmap mWeekPixmap;
148 QColor mWeekBgColor; 153 QColor mWeekBgColor;
149 154
150 QAction *mShowAction; 155 QAction *mShowAction;
151 QAction *mEditAction; 156 QAction *mEditAction;
152 QAction *mDeleteAction; 157 QAction *mDeleteAction;
153 QAction *mCloneAction; 158 QAction *mCloneAction;
154 QAction *mMoveAction; 159 QAction *mMoveAction;
155 QAction *mBeamAction; 160 QAction *mBeamAction;
156 QAction *mCancelAction; 161 QAction *mCancelAction;
157 QAction *mPrintSelAction; 162 QAction *mPrintSelAction;
158 163
159 QAction *mToggleNav; 164 QAction *mToggleNav;
160 QAction *mToggleFilter; 165 QAction *mToggleFilter;
161 QAction *mToggleAllday; 166 QAction *mToggleAllday;
162 QAction *actionFilterMenuTB; 167 QAction *actionFilterMenuTB;
163 168
164 void closeEvent( QCloseEvent* ce ); 169 void closeEvent( QCloseEvent* ce );
165 QTimer mSaveTimer; 170 QTimer mSaveTimer;
166 //bool mBlockSaveFlag; 171 //bool mBlockSaveFlag;
167 bool mCalendarModifiedFlag; 172 bool mCalendarModifiedFlag;
168 QPixmap loadPixmap( QString ); 173 QPixmap loadPixmap( QString );
169 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; 174 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix;
170}; 175};
171 176
172 177
173#endif 178#endif