summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/main.cpp6
-rw-r--r--korganizer/mainwindow.cpp59
-rw-r--r--korganizer/mainwindow.h12
5 files changed, 77 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 884c61a..0306e07 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,2841 +1,2845 @@
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 (preston.brown@yale.edu) 8 Preston Brown (preston.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "statusdialog.h" 110#include "statusdialog.h"
111#include "kdatenavigator.h" 111#include "kdatenavigator.h"
112#include "kotodoview.h" 112#include "kotodoview.h"
113#include "datenavigator.h" 113#include "datenavigator.h"
114#include "resourceview.h" 114#include "resourceview.h"
115#include "navigatorbar.h" 115#include "navigatorbar.h"
116#include "searchdialog.h" 116#include "searchdialog.h"
117#include "mainwindow.h" 117#include "mainwindow.h"
118 118
119#include "calendarview.h" 119#include "calendarview.h"
120#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
121#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
122#endif 122#endif
123#ifndef _WIN32_ 123#ifndef _WIN32_
124#include <stdlib.h> 124#include <stdlib.h>
125#include <stdio.h> 125#include <stdio.h>
126#include <unistd.h> 126#include <unistd.h>
127#else 127#else
128#include <qprocess.h> 128#include <qprocess.h>
129#endif 129#endif
130 130
131#ifdef DESKTOP_VERSION 131#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 132#include <kabc/stdaddressbook.h>
133#endif 133#endif
134using namespace KOrg; 134using namespace KOrg;
135using namespace KCal; 135using namespace KCal;
136extern int globalFlagBlockAgenda; 136extern int globalFlagBlockAgenda;
137extern int globalFlagBlockStartup; 137extern int globalFlagBlockStartup;
138 138
139 139
140 140
141class KOBeamPrefs : public QDialog 141class KOBeamPrefs : public QDialog
142{ 142{
143 public: 143 public:
144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
145 QDialog( parent, name, true ) 145 QDialog( parent, name, true )
146 { 146 {
147 setCaption( i18n("Beam Options") ); 147 setCaption( i18n("Beam Options") );
148 QVBoxLayout* lay = new QVBoxLayout( this ); 148 QVBoxLayout* lay = new QVBoxLayout( this );
149 lay->setSpacing( 3 ); 149 lay->setSpacing( 3 );
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 beamDialog = new KOBeamPrefs(); 236 beamDialog = new KOBeamPrefs();
237 mDatePickerMode = 0; 237 mDatePickerMode = 0;
238 mCurrentSyncDevice = ""; 238 mCurrentSyncDevice = "";
239 writeLocale(); 239 writeLocale();
240 mViewManager = new KOViewManager( this ); 240 mViewManager = new KOViewManager( this );
241 mDialogManager = new KODialogManager( this ); 241 mDialogManager = new KODialogManager( this );
242 mEventViewerDialog = 0; 242 mEventViewerDialog = 0;
243 mModified = false; 243 mModified = false;
244 mReadOnly = false; 244 mReadOnly = false;
245 mSelectedIncidence = 0; 245 mSelectedIncidence = 0;
246 mCalPrinter = 0; 246 mCalPrinter = 0;
247 mFilters.setAutoDelete(true); 247 mFilters.setAutoDelete(true);
248 248
249 mCalendar->registerObserver( this ); 249 mCalendar->registerObserver( this );
250 // TODO: Make sure that view is updated, when calendar is changed. 250 // TODO: Make sure that view is updated, when calendar is changed.
251 251
252 mStorage = new FileStorage( mCalendar ); 252 mStorage = new FileStorage( mCalendar );
253 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 253 mNavigator = new DateNavigator( this, "datevav", mViewManager );
254 254
255 QBoxLayout *topLayout = (QBoxLayout*)layout(); 255 QBoxLayout *topLayout = (QBoxLayout*)layout();
256#ifndef KORG_NOSPLITTER 256#ifndef KORG_NOSPLITTER
257 // create the main layout frames. 257 // create the main layout frames.
258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
259 topLayout->addWidget(mPanner); 259 topLayout->addWidget(mPanner);
260 260
261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
262 "CalendarView::LeftFrame"); 262 "CalendarView::LeftFrame");
263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
264 264
265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
266 "CalendarView::DateNavigator", QDate::currentDate() ); 266 "CalendarView::DateNavigator", QDate::currentDate() );
267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
270 270
271#ifdef KORG_NORESOURCEVIEW 271#ifdef KORG_NORESOURCEVIEW
272 mResourceView = 0; 272 mResourceView = 0;
273#else 273#else
274 if ( mResourceManager ) { 274 if ( mResourceManager ) {
275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
276 mResourceView->updateView(); 276 mResourceView->updateView();
277 connect( mResourceView, SIGNAL( resourcesChanged() ), 277 connect( mResourceView, SIGNAL( resourcesChanged() ),
278 SLOT( updateView() ) ); 278 SLOT( updateView() ) );
279 } else { 279 } else {
280 mResourceView = 0; 280 mResourceView = 0;
281 } 281 }
282#endif 282#endif
283 QWidget *rightBox = new QWidget( mPanner ); 283 QWidget *rightBox = new QWidget( mPanner );
284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
285 285
286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
287 rightLayout->addWidget( mNavigatorBar ); 287 rightLayout->addWidget( mNavigatorBar );
288 288
289 mRightFrame = new QWidgetStack( rightBox ); 289 mRightFrame = new QWidgetStack( rightBox );
290 rightLayout->addWidget( mRightFrame, 1 ); 290 rightLayout->addWidget( mRightFrame, 1 );
291 291
292 mLeftFrame = mLeftSplitter; 292 mLeftFrame = mLeftSplitter;
293#else 293#else
294 QWidget *mainBox = new QWidget( this ); 294 QWidget *mainBox = new QWidget( this );
295 QWidget *leftFrame = new QWidget( mainBox ); 295 QWidget *leftFrame = new QWidget( mainBox );
296 296
297 QBoxLayout * mainBoxLayout; 297 QBoxLayout * mainBoxLayout;
298 QBoxLayout * leftFrameLayout; 298 QBoxLayout * leftFrameLayout;
299 if ( KOPrefs::instance()->mVerticalScreen ) { 299 if ( KOPrefs::instance()->mVerticalScreen ) {
300 mainBoxLayout = new QVBoxLayout(mainBox); 300 mainBoxLayout = new QVBoxLayout(mainBox);
301 leftFrameLayout = new QHBoxLayout(leftFrame ); 301 leftFrameLayout = new QHBoxLayout(leftFrame );
302 } else { 302 } else {
303 mainBoxLayout = new QHBoxLayout(mainBox); 303 mainBoxLayout = new QHBoxLayout(mainBox);
304 leftFrameLayout = new QVBoxLayout(leftFrame ); 304 leftFrameLayout = new QVBoxLayout(leftFrame );
305 } 305 }
306 topLayout->addWidget( mainBox ); 306 topLayout->addWidget( mainBox );
307 mainBoxLayout->addWidget (leftFrame); 307 mainBoxLayout->addWidget (leftFrame);
308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
309 "CalendarView::DateNavigator", QDate::currentDate()); 309 "CalendarView::DateNavigator", QDate::currentDate());
310 // mDateNavigator->blockSignals( true ); 310 // mDateNavigator->blockSignals( true );
311 leftFrameLayout->addWidget( mDateNavigator ); 311 leftFrameLayout->addWidget( mDateNavigator );
312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
314 314
315 if ( QApplication::desktop()->width() < 480 ) { 315 if ( QApplication::desktop()->width() < 480 ) {
316 leftFrameLayout->addWidget(mFilterView); 316 leftFrameLayout->addWidget(mFilterView);
317 leftFrameLayout->addWidget(mTodoList, 2 ); 317 leftFrameLayout->addWidget(mTodoList, 2 );
318 318
319 } else { 319 } else {
320 leftFrameLayout->addWidget(mTodoList,2 ); 320 leftFrameLayout->addWidget(mTodoList,2 );
321 leftFrameLayout->addWidget(mFilterView ); 321 leftFrameLayout->addWidget(mFilterView );
322 } 322 }
323 mFilterView->hide(); 323 mFilterView->hide();
324 QWidget *rightBox = new QWidget( mainBox ); 324 QWidget *rightBox = new QWidget( mainBox );
325 mainBoxLayout->addWidget ( rightBox, 10 ); 325 mainBoxLayout->addWidget ( rightBox, 10 );
326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
328 mRightFrame = new QWidgetStack( rightBox ); 328 mRightFrame = new QWidgetStack( rightBox );
329 rightLayout->addWidget( mNavigatorBar ); 329 rightLayout->addWidget( mNavigatorBar );
330 rightLayout->addWidget( mRightFrame, 10 ); 330 rightLayout->addWidget( mRightFrame, 10 );
331 331
332 mLeftFrame = leftFrame; 332 mLeftFrame = leftFrame;
333 if ( KOPrefs::instance()->mVerticalScreen ) { 333 if ( KOPrefs::instance()->mVerticalScreen ) {
334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
336 } else { 336 } else {
337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
339 } 339 }
340 340
341 //qDebug("Calendarview Size %d %d ", width(), height()); 341 //qDebug("Calendarview Size %d %d ", width(), height());
342#endif 342#endif
343 343
344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
345 SLOT( showDates( const KCal::DateList & ) ) ); 345 SLOT( showDates( const KCal::DateList & ) ) );
346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
348 348
349 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 349 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
350 mNavigator, SLOT( selectPreviousYear() ) ); 350 mNavigator, SLOT( selectPreviousYear() ) );
351 connect( mNavigatorBar, SIGNAL( goNextYear() ), 351 connect( mNavigatorBar, SIGNAL( goNextYear() ),
352 mNavigator, SLOT( selectNextYear() ) ); 352 mNavigator, SLOT( selectNextYear() ) );
353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
354 mNavigator, SLOT( selectPreviousMonth() ) ); 354 mNavigator, SLOT( selectPreviousMonth() ) );
355 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 355 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
356 mNavigator, SLOT( selectNextMonth() ) ); 356 mNavigator, SLOT( selectNextMonth() ) );
357 357
358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
360 360
361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
362 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 362 mNavigator, SLOT( selectWeek( const QDate & ) ) );
363 363
364 connect( mDateNavigator, SIGNAL( goPrevYear() ), 364 connect( mDateNavigator, SIGNAL( goPrevYear() ),
365 mNavigator, SLOT( selectPreviousYear() ) ); 365 mNavigator, SLOT( selectPreviousYear() ) );
366 connect( mDateNavigator, SIGNAL( goNextYear() ), 366 connect( mDateNavigator, SIGNAL( goNextYear() ),
367 mNavigator, SLOT( selectNextYear() ) ); 367 mNavigator, SLOT( selectNextYear() ) );
368 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 368 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
369 mNavigator, SLOT( selectPreviousMonth() ) ); 369 mNavigator, SLOT( selectPreviousMonth() ) );
370 connect( mDateNavigator, SIGNAL( goNextMonth() ), 370 connect( mDateNavigator, SIGNAL( goNextMonth() ),
371 mNavigator, SLOT( selectNextMonth() ) ); 371 mNavigator, SLOT( selectNextMonth() ) );
372 372
373 connect( mDateNavigator, SIGNAL( goPrevious() ), 373 connect( mDateNavigator, SIGNAL( goPrevious() ),
374 mNavigator, SLOT( selectPrevious() ) ); 374 mNavigator, SLOT( selectPrevious() ) );
375 connect( mDateNavigator, SIGNAL( goNext() ), 375 connect( mDateNavigator, SIGNAL( goNext() ),
376 mNavigator, SLOT( selectNext() ) ); 376 mNavigator, SLOT( selectNext() ) );
377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
378 mNavigator, SLOT( slotMonthSelect( int ) ) ); 378 mNavigator, SLOT( slotMonthSelect( int ) ) );
379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
380 mNavigator, SLOT( slotMonthSelect( int ) ) ); 380 mNavigator, SLOT( slotMonthSelect( int ) ) );
381 381
382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
384 384
385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
386 SLOT( eventAdded( Event *) ) ); 386 SLOT( eventAdded( Event *) ) );
387 387
388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
389 389
390 connect( this, SIGNAL( configChanged() ), 390 connect( this, SIGNAL( configChanged() ),
391 mDateNavigator, SLOT( updateConfig() ) ); 391 mDateNavigator, SLOT( updateConfig() ) );
392 392
393 connect( mTodoList, SIGNAL( newTodoSignal() ), 393 connect( mTodoList, SIGNAL( newTodoSignal() ),
394 SLOT( newTodo() ) ); 394 SLOT( newTodo() ) );
395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
396 SLOT( newSubTodo( Todo * ) ) ); 396 SLOT( newSubTodo( Todo * ) ) );
397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
398 SLOT( editTodo( Todo * ) ) ); 398 SLOT( editTodo( Todo * ) ) );
399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
400 SLOT( showTodo( Todo *) ) ); 400 SLOT( showTodo( Todo *) ) );
401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
402 SLOT( deleteTodo( Todo *) ) ); 402 SLOT( deleteTodo( Todo *) ) );
403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
405 SLOT( purgeCompleted() ) ); 405 SLOT( purgeCompleted() ) );
406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
407 SIGNAL( todoModified( Todo *, int ) ) ); 407 SIGNAL( todoModified( Todo *, int ) ) );
408 408
409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
410 this, SLOT ( cloneIncidence( Incidence * ) ) ); 410 this, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
412 this, SLOT (cancelIncidence( Incidence * ) ) ); 412 this, SLOT (cancelIncidence( Incidence * ) ) );
413 413
414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
415 this, SLOT ( moveIncidence( Incidence * ) ) ); 415 this, SLOT ( moveIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
417 this, SLOT ( beamIncidence( Incidence * ) ) ); 417 this, SLOT ( beamIncidence( Incidence * ) ) );
418 418
419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
420 this, SLOT ( todo_unsub( Todo * ) ) ); 420 this, SLOT ( todo_unsub( Todo * ) ) );
421 421
422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
423 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 423 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
425 SLOT( updateTodo( Todo *, int ) ) ); 425 SLOT( updateTodo( Todo *, int ) ) );
426 connect( this, SIGNAL( todoModified( Todo *, int )), this, 426 connect( this, SIGNAL( todoModified( Todo *, int )), this,
427 SLOT( changeTodoDisplay( Todo *, int ) ) ); 427 SLOT( changeTodoDisplay( Todo *, int ) ) );
428 428
429 429
430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
434 434
435 435
436 436
437 437
438 438
439 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 439 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
440 SLOT(checkClipboard())); 440 SLOT(checkClipboard()));
441 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 441 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
442 SLOT( processTodoListSelection( Incidence * ) ) ); 442 SLOT( processTodoListSelection( Incidence * ) ) );
443 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 443 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
444 444
445 // kdDebug() << "CalendarView::CalendarView() done" << endl; 445 // kdDebug() << "CalendarView::CalendarView() done" << endl;
446 446
447 mDateFrame = new QVBox(0,0,WType_Popup); 447 mDateFrame = new QVBox(0,0,WType_Popup);
448 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 448 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
449 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 449 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
450 mDateFrame->setLineWidth(3); 450 mDateFrame->setLineWidth(3);
451 mDateFrame->hide(); 451 mDateFrame->hide();
452 mDateFrame->setCaption( i18n( "Pick a date to display")); 452 mDateFrame->setCaption( i18n( "Pick a date to display"));
453 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 453 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
454 454
455 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 455 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
456 456
457 mEventEditor = mDialogManager->getEventEditor(); 457 mEventEditor = mDialogManager->getEventEditor();
458 mTodoEditor = mDialogManager->getTodoEditor(); 458 mTodoEditor = mDialogManager->getTodoEditor();
459 459
460 mFlagEditDescription = false; 460 mFlagEditDescription = false;
461 461
462 mSuspendTimer = new QTimer( this ); 462 mSuspendTimer = new QTimer( this );
463 mAlarmTimer = new QTimer( this ); 463 mAlarmTimer = new QTimer( this );
464 mRecheckAlarmTimer = new QTimer( this ); 464 mRecheckAlarmTimer = new QTimer( this );
465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
468 mAlarmDialog = new AlarmDialog( this ); 468 mAlarmDialog = new AlarmDialog( this );
469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
470 mAlarmDialog->setServerNotification( false ); 470 mAlarmDialog->setServerNotification( false );
471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
472 472
473 473
474#ifndef DESKTOP_VERSION 474#ifndef DESKTOP_VERSION
475//US listen for arriving address resultsets 475//US listen for arriving address resultsets
476 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 476 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
477 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 477 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
478#endif 478#endif
479 479
480} 480}
481 481
482 482
483CalendarView::~CalendarView() 483CalendarView::~CalendarView()
484{ 484{
485 // kdDebug() << "~CalendarView()" << endl; 485 // kdDebug() << "~CalendarView()" << endl;
486 //qDebug("CalendarView::~CalendarView() "); 486 //qDebug("CalendarView::~CalendarView() ");
487 delete mDialogManager; 487 delete mDialogManager;
488 delete mViewManager; 488 delete mViewManager;
489 delete mStorage; 489 delete mStorage;
490 delete mDateFrame ; 490 delete mDateFrame ;
491 delete beamDialog; 491 delete beamDialog;
492 //kdDebug() << "~CalendarView() done" << endl; 492 //kdDebug() << "~CalendarView() done" << endl;
493} 493}
494void CalendarView::timerAlarm() 494void CalendarView::timerAlarm()
495{ 495{
496 //qDebug("CalendarView::timerAlarm() "); 496 //qDebug("CalendarView::timerAlarm() ");
497 computeAlarm(mAlarmNotification ); 497 computeAlarm(mAlarmNotification );
498} 498}
499 499
500void CalendarView::suspendAlarm() 500void CalendarView::suspendAlarm()
501{ 501{
502 //qDebug(" CalendarView::suspendAlarm() "); 502 //qDebug(" CalendarView::suspendAlarm() ");
503 computeAlarm(mSuspendAlarmNotification ); 503 computeAlarm(mSuspendAlarmNotification );
504 504
505} 505}
506 506
507void CalendarView::startAlarm( QString mess , QString filename) 507void CalendarView::startAlarm( QString mess , QString filename)
508{ 508{
509 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 509 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
510 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 510 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
511 511
512} 512}
513 513
514void CalendarView::checkNextTimerAlarm() 514void CalendarView::checkNextTimerAlarm()
515{ 515{
516 mCalendar->checkAlarmForIncidence( 0, true ); 516 mCalendar->checkAlarmForIncidence( 0, true );
517} 517}
518 518
519void CalendarView::computeAlarm( QString msg ) 519void CalendarView::computeAlarm( QString msg )
520{ 520{
521 521
522 QString mess = msg; 522 QString mess = msg;
523 QString mAlarmMessage = mess.mid( 9 ); 523 QString mAlarmMessage = mess.mid( 9 );
524 QString filename = MainWindow::resourcePath(); 524 QString filename = MainWindow::resourcePath();
525 filename += "koalarm.wav"; 525 filename += "koalarm.wav";
526 QString tempfilename; 526 QString tempfilename;
527 if ( mess.left( 13 ) == "suspend_alarm") { 527 if ( mess.left( 13 ) == "suspend_alarm") {
528 bool error = false; 528 bool error = false;
529 int len = mess.mid( 13 ).find("+++"); 529 int len = mess.mid( 13 ).find("+++");
530 if ( len < 2 ) 530 if ( len < 2 )
531 error = true; 531 error = true;
532 else { 532 else {
533 tempfilename = mess.mid( 13, len ); 533 tempfilename = mess.mid( 13, len );
534 if ( !QFile::exists( tempfilename ) ) 534 if ( !QFile::exists( tempfilename ) )
535 error = true; 535 error = true;
536 } 536 }
537 if ( ! error ) { 537 if ( ! error ) {
538 filename = tempfilename; 538 filename = tempfilename;
539 } 539 }
540 mAlarmMessage = mess.mid( 13+len+3 ); 540 mAlarmMessage = mess.mid( 13+len+3 );
541 //qDebug("suspend file %s ",tempfilename.latin1() ); 541 //qDebug("suspend file %s ",tempfilename.latin1() );
542 startAlarm( mAlarmMessage, filename); 542 startAlarm( mAlarmMessage, filename);
543 return; 543 return;
544 } 544 }
545 if ( mess.left( 11 ) == "timer_alarm") { 545 if ( mess.left( 11 ) == "timer_alarm") {
546 //mTimerTime = 0; 546 //mTimerTime = 0;
547 startAlarm( mess.mid( 11 ), filename ); 547 startAlarm( mess.mid( 11 ), filename );
548 return; 548 return;
549 } 549 }
550 if ( mess.left( 10 ) == "proc_alarm") { 550 if ( mess.left( 10 ) == "proc_alarm") {
551 bool error = false; 551 bool error = false;
552 int len = mess.mid( 10 ).find("+++"); 552 int len = mess.mid( 10 ).find("+++");
553 if ( len < 2 ) 553 if ( len < 2 )
554 error = true; 554 error = true;
555 else { 555 else {
556 tempfilename = mess.mid( 10, len ); 556 tempfilename = mess.mid( 10, len );
557 if ( !QFile::exists( tempfilename ) ) 557 if ( !QFile::exists( tempfilename ) )
558 error = true; 558 error = true;
559 } 559 }
560 if ( error ) { 560 if ( error ) {
561 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 561 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
562 mAlarmMessage += mess.mid( 10+len+3+9 ); 562 mAlarmMessage += mess.mid( 10+len+3+9 );
563 } else { 563 } else {
564 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 564 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
565 //qDebug("-----system command %s ",tempfilename.latin1() ); 565 //qDebug("-----system command %s ",tempfilename.latin1() );
566#ifndef _WIN32_ 566#ifndef _WIN32_
567 if ( vfork () == 0 ) { 567 if ( vfork () == 0 ) {
568 execl ( tempfilename.latin1(), 0 ); 568 execl ( tempfilename.latin1(), 0 );
569 return; 569 return;
570 } 570 }
571#else 571#else
572 QProcess* p = new QProcess(); 572 QProcess* p = new QProcess();
573 p->addArgument( tempfilename.latin1() ); 573 p->addArgument( tempfilename.latin1() );
574 p->start(); 574 p->start();
575 return; 575 return;
576#endif 576#endif
577 577
578 return; 578 return;
579 } 579 }
580 580
581 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 581 //qDebug("+++++++system command %s ",tempfilename.latin1() );
582 } 582 }
583 if ( mess.left( 11 ) == "audio_alarm") { 583 if ( mess.left( 11 ) == "audio_alarm") {
584 bool error = false; 584 bool error = false;
585 int len = mess.mid( 11 ).find("+++"); 585 int len = mess.mid( 11 ).find("+++");
586 if ( len < 2 ) 586 if ( len < 2 )
587 error = true; 587 error = true;
588 else { 588 else {
589 tempfilename = mess.mid( 11, len ); 589 tempfilename = mess.mid( 11, len );
590 if ( !QFile::exists( tempfilename ) ) 590 if ( !QFile::exists( tempfilename ) )
591 error = true; 591 error = true;
592 } 592 }
593 if ( ! error ) { 593 if ( ! error ) {
594 filename = tempfilename; 594 filename = tempfilename;
595 } 595 }
596 mAlarmMessage = mess.mid( 11+len+3+9 ); 596 mAlarmMessage = mess.mid( 11+len+3+9 );
597 //qDebug("audio file command %s ",tempfilename.latin1() ); 597 //qDebug("audio file command %s ",tempfilename.latin1() );
598 } 598 }
599 if ( mess.left( 9 ) == "cal_alarm") { 599 if ( mess.left( 9 ) == "cal_alarm") {
600 mAlarmMessage = mess.mid( 9 ) ; 600 mAlarmMessage = mess.mid( 9 ) ;
601 } 601 }
602 602
603 startAlarm( mAlarmMessage, filename ); 603 startAlarm( mAlarmMessage, filename );
604 604
605 605
606} 606}
607 607
608void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 608void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
609{ 609{
610 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 610 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
611 611
612 mSuspendAlarmNotification = noti; 612 mSuspendAlarmNotification = noti;
613 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 613 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
614 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 614 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
615 mSuspendTimer->start( ms , true ); 615 mSuspendTimer->start( ms , true );
616 616
617} 617}
618 618
619void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 619void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
620{ 620{
621 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 621 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
622 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 622 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
623#ifndef DESKTOP_VERSION 623#ifndef DESKTOP_VERSION
624 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 624 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
625#endif 625#endif
626 return; 626 return;
627 } 627 }
628 int maxSec; 628 int maxSec;
629 //maxSec = 5; //testing only 629 //maxSec = 5; //testing only
630 maxSec = 86400+3600; // one day+1hour 630 maxSec = 86400+3600; // one day+1hour
631 mAlarmNotification = noti; 631 mAlarmNotification = noti;
632 int sec = QDateTime::currentDateTime().secsTo( qdt ); 632 int sec = QDateTime::currentDateTime().secsTo( qdt );
633 if ( sec > maxSec ) { 633 if ( sec > maxSec ) {
634 mRecheckAlarmTimer->start( maxSec * 1000 ); 634 mRecheckAlarmTimer->start( maxSec * 1000 );
635 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 635 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
636 return; 636 return;
637 } else { 637 } else {
638 mRecheckAlarmTimer->stop(); 638 mRecheckAlarmTimer->stop();
639 } 639 }
640 //qDebug("Alarm timer started with secs: %d ", sec); 640 //qDebug("Alarm timer started with secs: %d ", sec);
641 mAlarmTimer->start( sec *1000 , true ); 641 mAlarmTimer->start( sec *1000 , true );
642 642
643} 643}
644// called by mRecheckAlarmTimer to get next alarm 644// called by mRecheckAlarmTimer to get next alarm
645// we need this, because a QTimer has only a max range of 25 days 645// we need this, because a QTimer has only a max range of 25 days
646void CalendarView::recheckTimerAlarm() 646void CalendarView::recheckTimerAlarm()
647{ 647{
648 mAlarmTimer->stop(); 648 mAlarmTimer->stop();
649 mRecheckAlarmTimer->stop(); 649 mRecheckAlarmTimer->stop();
650 mCalendar->checkAlarmForIncidence( 0, true ); 650 mCalendar->checkAlarmForIncidence( 0, true );
651} 651}
652void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 652void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
653{ 653{
654 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 654 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
655 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 655 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
656#ifndef DESKTOP_VERSION 656#ifndef DESKTOP_VERSION
657 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 657 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
658#endif 658#endif
659 return; 659 return;
660 } 660 }
661 mAlarmTimer->stop(); 661 mAlarmTimer->stop();
662} 662}
663void CalendarView::selectWeekNum ( int num ) 663void CalendarView::selectWeekNum ( int num )
664{ 664{
665 dateNavigator()->selectWeek( num ); 665 dateNavigator()->selectWeek( num );
666 mViewManager->showWeekView(); 666 mViewManager->showWeekView();
667} 667}
668KOViewManager *CalendarView::viewManager() 668KOViewManager *CalendarView::viewManager()
669{ 669{
670 return mViewManager; 670 return mViewManager;
671} 671}
672 672
673KODialogManager *CalendarView::dialogManager() 673KODialogManager *CalendarView::dialogManager()
674{ 674{
675 return mDialogManager; 675 return mDialogManager;
676} 676}
677 677
678QDate CalendarView::startDate() 678QDate CalendarView::startDate()
679{ 679{
680 DateList dates = mNavigator->selectedDates(); 680 DateList dates = mNavigator->selectedDates();
681 681
682 return dates.first(); 682 return dates.first();
683} 683}
684 684
685QDate CalendarView::endDate() 685QDate CalendarView::endDate()
686{ 686{
687 DateList dates = mNavigator->selectedDates(); 687 DateList dates = mNavigator->selectedDates();
688 688
689 return dates.last(); 689 return dates.last();
690} 690}
691 691
692 692
693void CalendarView::createPrinter() 693void CalendarView::createPrinter()
694{ 694{
695#ifndef KORG_NOPRINTER 695#ifndef KORG_NOPRINTER
696 if (!mCalPrinter) { 696 if (!mCalPrinter) {
697 mCalPrinter = new CalPrinter(this, mCalendar); 697 mCalPrinter = new CalPrinter(this, mCalendar);
698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 698 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
699 } 699 }
700#endif 700#endif
701} 701}
702 702
703 703
704//KOPrefs::instance()->mWriteBackFile 704//KOPrefs::instance()->mWriteBackFile
705//KOPrefs::instance()->mWriteBackExistingOnly 705//KOPrefs::instance()->mWriteBackExistingOnly
706 706
707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
713 713
714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
715{ 715{
716 716
717 // 0 equal 717 // 0 equal
718 // 1 take local 718 // 1 take local
719 // 2 take remote 719 // 2 take remote
720 // 3 cancel 720 // 3 cancel
721 QDateTime lastSync = mLastCalendarSync; 721 QDateTime lastSync = mLastCalendarSync;
722 QDateTime localMod = local->lastModified(); 722 QDateTime localMod = local->lastModified();
723 QDateTime remoteMod = remote->lastModified(); 723 QDateTime remoteMod = remote->lastModified();
724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 724 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
725 bool remCh, locCh; 725 bool remCh, locCh;
726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 726 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
727 //if ( remCh ) 727 //if ( remCh )
728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 728 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
729 locCh = ( localMod > mLastCalendarSync ); 729 locCh = ( localMod > mLastCalendarSync );
730 if ( !remCh && ! locCh ) { 730 if ( !remCh && ! locCh ) {
731 //qDebug("both not changed "); 731 //qDebug("both not changed ");
732 lastSync = localMod.addDays(1); 732 lastSync = localMod.addDays(1);
733 if ( mode <= SYNC_PREF_ASK ) 733 if ( mode <= SYNC_PREF_ASK )
734 return 0; 734 return 0;
735 } else { 735 } else {
736 if ( locCh ) { 736 if ( locCh ) {
737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 737 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
738 lastSync = localMod.addDays( -1 ); 738 lastSync = localMod.addDays( -1 );
739 if ( !remCh ) 739 if ( !remCh )
740 remoteMod = ( lastSync.addDays( -1 ) ); 740 remoteMod = ( lastSync.addDays( -1 ) );
741 } else { 741 } else {
742 //qDebug(" not loc changed "); 742 //qDebug(" not loc changed ");
743 lastSync = localMod.addDays( 1 ); 743 lastSync = localMod.addDays( 1 );
744 if ( remCh ) 744 if ( remCh )
745 remoteMod =( lastSync.addDays( 1 ) ); 745 remoteMod =( lastSync.addDays( 1 ) );
746 746
747 } 747 }
748 } 748 }
749 full = true; 749 full = true;
750 if ( mode < SYNC_PREF_ASK ) 750 if ( mode < SYNC_PREF_ASK )
751 mode = SYNC_PREF_ASK; 751 mode = SYNC_PREF_ASK;
752 } else { 752 } else {
753 if ( localMod == remoteMod ) 753 if ( localMod == remoteMod )
754 // if ( local->revision() == remote->revision() ) 754 // if ( local->revision() == remote->revision() )
755 return 0; 755 return 0;
756 756
757 } 757 }
758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 758 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
759 759
760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 760 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 761 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
762 //full = true; //debug only 762 //full = true; //debug only
763 if ( full ) { 763 if ( full ) {
764 bool equ = false; 764 bool equ = false;
765 if ( local->type() == "Event" ) { 765 if ( local->type() == "Event" ) {
766 equ = (*((Event*) local) == *((Event*) remote)); 766 equ = (*((Event*) local) == *((Event*) remote));
767 } 767 }
768 else if ( local->type() =="Todo" ) 768 else if ( local->type() =="Todo" )
769 equ = (*((Todo*) local) == (*(Todo*) remote)); 769 equ = (*((Todo*) local) == (*(Todo*) remote));
770 else if ( local->type() =="Journal" ) 770 else if ( local->type() =="Journal" )
771 equ = (*((Journal*) local) == *((Journal*) remote)); 771 equ = (*((Journal*) local) == *((Journal*) remote));
772 if ( equ ) { 772 if ( equ ) {
773 //qDebug("equal "); 773 //qDebug("equal ");
774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 774 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 775 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
776 } 776 }
777 if ( mode < SYNC_PREF_FORCE_LOCAL ) 777 if ( mode < SYNC_PREF_FORCE_LOCAL )
778 return 0; 778 return 0;
779 779
780 }//else //debug only 780 }//else //debug only
781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 781 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
782 } 782 }
783 int result; 783 int result;
784 bool localIsNew; 784 bool localIsNew;
785 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); 785 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() );
786 786
787 if ( full && mode < SYNC_PREF_NEWEST ) 787 if ( full && mode < SYNC_PREF_NEWEST )
788 mode = SYNC_PREF_ASK; 788 mode = SYNC_PREF_ASK;
789 789
790 switch( mode ) { 790 switch( mode ) {
791 case SYNC_PREF_LOCAL: 791 case SYNC_PREF_LOCAL:
792 if ( lastSync > remoteMod ) 792 if ( lastSync > remoteMod )
793 return 1; 793 return 1;
794 if ( lastSync > localMod ) 794 if ( lastSync > localMod )
795 return 2; 795 return 2;
796 return 1; 796 return 1;
797 break; 797 break;
798 case SYNC_PREF_REMOTE: 798 case SYNC_PREF_REMOTE:
799 if ( lastSync > remoteMod ) 799 if ( lastSync > remoteMod )
800 return 1; 800 return 1;
801 if ( lastSync > localMod ) 801 if ( lastSync > localMod )
802 return 2; 802 return 2;
803 return 2; 803 return 2;
804 break; 804 break;
805 case SYNC_PREF_NEWEST: 805 case SYNC_PREF_NEWEST:
806 if ( localMod > remoteMod ) 806 if ( localMod > remoteMod )
807 return 1; 807 return 1;
808 else 808 else
809 return 2; 809 return 2;
810 break; 810 break;
811 case SYNC_PREF_ASK: 811 case SYNC_PREF_ASK:
812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
813 if ( lastSync > remoteMod ) 813 if ( lastSync > remoteMod )
814 return 1; 814 return 1;
815 if ( lastSync > localMod ) 815 if ( lastSync > localMod )
816 return 2; 816 return 2;
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
818 localIsNew = localMod >= remoteMod; 818 localIsNew = localMod >= remoteMod;
819 if ( localIsNew ) 819 if ( localIsNew )
820 getEventViewerDialog()->setColorMode( 1 ); 820 getEventViewerDialog()->setColorMode( 1 );
821 else 821 else
822 getEventViewerDialog()->setColorMode( 2 ); 822 getEventViewerDialog()->setColorMode( 2 );
823 getEventViewerDialog()->setIncidence(local); 823 getEventViewerDialog()->setIncidence(local);
824 if ( localIsNew ) 824 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 2 ); 825 getEventViewerDialog()->setColorMode( 2 );
826 else 826 else
827 getEventViewerDialog()->setColorMode( 1 ); 827 getEventViewerDialog()->setColorMode( 1 );
828 getEventViewerDialog()->addIncidence(remote); 828 getEventViewerDialog()->addIncidence(remote);
829 getEventViewerDialog()->setColorMode( 0 ); 829 getEventViewerDialog()->setColorMode( 0 );
830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
832 getEventViewerDialog()->showMe(); 832 getEventViewerDialog()->showMe();
833 result = getEventViewerDialog()->executeS( localIsNew ); 833 result = getEventViewerDialog()->executeS( localIsNew );
834 return result; 834 return result;
835 835
836 break; 836 break;
837 case SYNC_PREF_FORCE_LOCAL: 837 case SYNC_PREF_FORCE_LOCAL:
838 return 1; 838 return 1;
839 break; 839 break;
840 case SYNC_PREF_FORCE_REMOTE: 840 case SYNC_PREF_FORCE_REMOTE:
841 return 2; 841 return 2;
842 break; 842 break;
843 843
844 default: 844 default:
845 // SYNC_PREF_TAKE_BOTH not implemented 845 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 846 break;
847 } 847 }
848 return 0; 848 return 0;
849} 849}
850Event* CalendarView::getLastSyncEvent() 850Event* CalendarView::getLastSyncEvent()
851{ 851{
852 Event* lse; 852 Event* lse;
853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 854 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
855 if (!lse) { 855 if (!lse) {
856 lse = new Event(); 856 lse = new Event();
857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 857 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
858 QString sum = ""; 858 QString sum = "";
859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 859 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
860 sum = "E: "; 860 sum = "E: ";
861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 861 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
862 lse->setDtStart( mLastCalendarSync ); 862 lse->setDtStart( mLastCalendarSync );
863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 863 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
864 lse->setCategories( i18n("SyncEvent") ); 864 lse->setCategories( i18n("SyncEvent") );
865 lse->setReadOnly( true ); 865 lse->setReadOnly( true );
866 mCalendar->addEvent( lse ); 866 mCalendar->addEvent( lse );
867 } 867 }
868 868
869 return lse; 869 return lse;
870 870
871} 871}
872 872
873// we check, if the to delete event has a id for a profile 873// we check, if the to delete event has a id for a profile
874// if yes, we set this id in the profile to delete 874// if yes, we set this id in the profile to delete
875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 875void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
876{ 876{
877 if ( lastSync.count() == 0 ) { 877 if ( lastSync.count() == 0 ) {
878 //qDebug(" lastSync.count() == 0"); 878 //qDebug(" lastSync.count() == 0");
879 return; 879 return;
880 } 880 }
881 if ( toDelete->type() == "Journal" ) 881 if ( toDelete->type() == "Journal" )
882 return; 882 return;
883 883
884 Event* eve = lastSync.first(); 884 Event* eve = lastSync.first();
885 885
886 while ( eve ) { 886 while ( eve ) {
887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 887 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
888 if ( !id.isEmpty() ) { 888 if ( !id.isEmpty() ) {
889 QString des = eve->description(); 889 QString des = eve->description();
890 QString pref = "e"; 890 QString pref = "e";
891 if ( toDelete->type() == "Todo" ) 891 if ( toDelete->type() == "Todo" )
892 pref = "t"; 892 pref = "t";
893 des += pref+ id + ","; 893 des += pref+ id + ",";
894 eve->setReadOnly( false ); 894 eve->setReadOnly( false );
895 eve->setDescription( des ); 895 eve->setDescription( des );
896 //qDebug("setdes %s ", des.latin1()); 896 //qDebug("setdes %s ", des.latin1());
897 eve->setReadOnly( true ); 897 eve->setReadOnly( true );
898 } 898 }
899 eve = lastSync.next(); 899 eve = lastSync.next();
900 } 900 }
901 901
902} 902}
903void CalendarView::checkExternalId( Incidence * inc ) 903void CalendarView::checkExternalId( Incidence * inc )
904{ 904{
905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 905 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
906 checkExternSyncEvent( lastSync, inc ); 906 checkExternSyncEvent( lastSync, inc );
907 907
908} 908}
909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 909bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
910{ 910{
911 bool syncOK = true; 911 bool syncOK = true;
912 int addedEvent = 0; 912 int addedEvent = 0;
913 int addedEventR = 0; 913 int addedEventR = 0;
914 int deletedEventR = 0; 914 int deletedEventR = 0;
915 int deletedEventL = 0; 915 int deletedEventL = 0;
916 int changedLocal = 0; 916 int changedLocal = 0;
917 int changedRemote = 0; 917 int changedRemote = 0;
918 //QPtrList<Event> el = local->rawEvents(); 918 //QPtrList<Event> el = local->rawEvents();
919 Event* eventR; 919 Event* eventR;
920 QString uid; 920 QString uid;
921 int take; 921 int take;
922 Event* eventL; 922 Event* eventL;
923 Event* eventRSync; 923 Event* eventRSync;
924 Event* eventLSync; 924 Event* eventLSync;
925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 925 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 926 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
927 bool fullDateRange = false; 927 bool fullDateRange = false;
928 local->resetTempSyncStat(); 928 local->resetTempSyncStat();
929 if ( mSyncKDE ) 929 if ( mSyncKDE )
930 remote->resetPilotStat(1); 930 remote->resetPilotStat(1);
931 mLastCalendarSync = QDateTime::currentDateTime(); 931 mLastCalendarSync = QDateTime::currentDateTime();
932 QDateTime modifiedCalendar = mLastCalendarSync;; 932 QDateTime modifiedCalendar = mLastCalendarSync;;
933 eventLSync = getLastSyncEvent(); 933 eventLSync = getLastSyncEvent();
934 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 934 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
935 if ( eventR ) { 935 if ( eventR ) {
936 eventRSync = (Event*) eventR->clone(); 936 eventRSync = (Event*) eventR->clone();
937 remote->deleteEvent(eventR ); 937 remote->deleteEvent(eventR );
938 938
939 } else { 939 } else {
940 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) { 940 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) {
941 eventRSync = (Event*)eventLSync->clone(); 941 eventRSync = (Event*)eventLSync->clone();
942 } else { 942 } else {
943 fullDateRange = true; 943 fullDateRange = true;
944 eventRSync = new Event(); 944 eventRSync = new Event();
945 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 945 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
946 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 946 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
947 eventRSync->setDtStart( mLastCalendarSync ); 947 eventRSync->setDtStart( mLastCalendarSync );
948 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 948 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
949 eventRSync->setCategories( i18n("SyncEvent") ); 949 eventRSync->setCategories( i18n("SyncEvent") );
950 } 950 }
951 } 951 }
952 if ( eventLSync->dtStart() == mLastCalendarSync ) 952 if ( eventLSync->dtStart() == mLastCalendarSync )
953 fullDateRange = true; 953 fullDateRange = true;
954 954
955 if ( ! fullDateRange ) { 955 if ( ! fullDateRange ) {
956 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 956 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
957 957
958 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 958 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
959 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 959 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
960 fullDateRange = true; 960 fullDateRange = true;
961 } 961 }
962 } 962 }
963 if ( fullDateRange && !mSyncKDE ) 963 if ( fullDateRange && !mSyncKDE )
964 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 964 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
965 else 965 else
966 mLastCalendarSync = eventLSync->dtStart(); 966 mLastCalendarSync = eventLSync->dtStart();
967 // for resyncing if own file has changed 967 // for resyncing if own file has changed
968 if ( mCurrentSyncDevice == "deleteaftersync" ) { 968 if ( mCurrentSyncDevice == "deleteaftersync" ) {
969 mLastCalendarSync = loadedFileVersion; 969 mLastCalendarSync = loadedFileVersion;
970 //qDebug("setting mLastCalendarSync "); 970 //qDebug("setting mLastCalendarSync ");
971 } 971 }
972 //qDebug("*************************** "); 972 //qDebug("*************************** ");
973 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 973 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
974 QPtrList<Incidence> er = remote->rawIncidences(); 974 QPtrList<Incidence> er = remote->rawIncidences();
975 Incidence* inR = er.first(); 975 Incidence* inR = er.first();
976 Incidence* inL; 976 Incidence* inL;
977 QProgressBar bar( er.count(),0 ); 977 QProgressBar bar( er.count(),0 );
978 bar.setCaption (i18n("Syncing - close to abort!") ); 978 bar.setCaption (i18n("Syncing - close to abort!") );
979 979
980 int w = 300; 980 int w = 300;
981 if ( QApplication::desktop()->width() < 320 ) 981 if ( QApplication::desktop()->width() < 320 )
982 w = 220; 982 w = 220;
983 int h = bar.sizeHint().height() ; 983 int h = bar.sizeHint().height() ;
984 int dw = QApplication::desktop()->width(); 984 int dw = QApplication::desktop()->width();
985 int dh = QApplication::desktop()->height(); 985 int dh = QApplication::desktop()->height();
986 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 986 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
987 bar.show(); 987 bar.show();
988 int modulo = (er.count()/10)+1; 988 int modulo = (er.count()/10)+1;
989 int incCounter = 0; 989 int incCounter = 0;
990 while ( inR ) { 990 while ( inR ) {
991 if ( ! bar.isVisible() ) 991 if ( ! bar.isVisible() )
992 return false; 992 return false;
993 if ( incCounter % modulo == 0 ) 993 if ( incCounter % modulo == 0 )
994 bar.setProgress( incCounter ); 994 bar.setProgress( incCounter );
995 ++incCounter; 995 ++incCounter;
996 uid = inR->uid(); 996 uid = inR->uid();
997 bool skipIncidence = false; 997 bool skipIncidence = false;
998 if ( uid.left(15) == QString("last-syncEvent-") ) 998 if ( uid.left(15) == QString("last-syncEvent-") )
999 skipIncidence = true; 999 skipIncidence = true;
1000 QString idS; 1000 QString idS;
1001 qApp->processEvents(); 1001 qApp->processEvents();
1002 if ( !skipIncidence ) { 1002 if ( !skipIncidence ) {
1003 inL = local->incidence( uid ); 1003 inL = local->incidence( uid );
1004 if ( inL ) { // maybe conflict - same uid in both calendars 1004 if ( inL ) { // maybe conflict - same uid in both calendars
1005 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1005 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1006 //qDebug("take %d %s ", take, inL->summary().latin1()); 1006 //qDebug("take %d %s ", take, inL->summary().latin1());
1007 if ( take == 3 ) 1007 if ( take == 3 )
1008 return false; 1008 return false;
1009 if ( take == 1 ) {// take local 1009 if ( take == 1 ) {// take local
1010 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1010 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1011 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1011 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1012 else 1012 else
1013 idS = inR->IDStr(); 1013 idS = inR->IDStr();
1014 remote->deleteIncidence( inR ); 1014 remote->deleteIncidence( inR );
1015 inR = inL->clone(); 1015 inR = inL->clone();
1016 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1016 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1017 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1017 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1018 inR->setIDStr( idS ); 1018 inR->setIDStr( idS );
1019 remote->addIncidence( inR ); 1019 remote->addIncidence( inR );
1020 if ( mSyncKDE ) 1020 if ( mSyncKDE )
1021 inR->setPilotId( 2 ); 1021 inR->setPilotId( 2 );
1022 ++changedRemote; 1022 ++changedRemote;
1023 } else { 1023 } else {
1024 idS = inL->IDStr(); 1024 idS = inL->IDStr();
1025 int pid = inL->pilotId(); 1025 int pid = inL->pilotId();
1026 local->deleteIncidence( inL ); 1026 local->deleteIncidence( inL );
1027 inL = inR->clone(); 1027 inL = inR->clone();
1028 if ( mSyncKDE ) 1028 if ( mSyncKDE )
1029 inL->setPilotId( pid ); 1029 inL->setPilotId( pid );
1030 inL->setIDStr( idS ); 1030 inL->setIDStr( idS );
1031 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1031 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1032 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1032 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1033 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1033 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1034 } 1034 }
1035 local->addIncidence( inL ); 1035 local->addIncidence( inL );
1036 ++changedLocal; 1036 ++changedLocal;
1037 } 1037 }
1038 } 1038 }
1039 } else { // no conflict 1039 } else { // no conflict
1040 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1040 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1041 QString des = eventLSync->description(); 1041 QString des = eventLSync->description();
1042 QString pref = "e"; 1042 QString pref = "e";
1043 if ( inR->type() == "Todo" ) 1043 if ( inR->type() == "Todo" )
1044 pref = "t"; 1044 pref = "t";
1045 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1045 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1046 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1046 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1047 //remote->deleteIncidence( inR ); 1047 //remote->deleteIncidence( inR );
1048 ++deletedEventR; 1048 ++deletedEventR;
1049 } else { 1049 } else {
1050 inR->setLastModified( modifiedCalendar ); 1050 inR->setLastModified( modifiedCalendar );
1051 inL = inR->clone(); 1051 inL = inR->clone();
1052 local->addIncidence( inL ); 1052 local->addIncidence( inL );
1053 ++addedEvent; 1053 ++addedEvent;
1054 } 1054 }
1055 } else { 1055 } else {
1056 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1056 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1057 inR->setLastModified( modifiedCalendar ); 1057 inR->setLastModified( modifiedCalendar );
1058 local->addIncidence( inR->clone() ); 1058 local->addIncidence( inR->clone() );
1059 ++addedEvent; 1059 ++addedEvent;
1060 } else { 1060 } else {
1061 checkExternSyncEvent(eventRSyncSharp, inR); 1061 checkExternSyncEvent(eventRSyncSharp, inR);
1062 remote->deleteIncidence( inR ); 1062 remote->deleteIncidence( inR );
1063 ++deletedEventR; 1063 ++deletedEventR;
1064 } 1064 }
1065 } 1065 }
1066 } 1066 }
1067 } 1067 }
1068 inR = er.next(); 1068 inR = er.next();
1069 } 1069 }
1070 QPtrList<Incidence> el = local->rawIncidences(); 1070 QPtrList<Incidence> el = local->rawIncidences();
1071 inL = el.first(); 1071 inL = el.first();
1072 modulo = (el.count()/10)+1; 1072 modulo = (el.count()/10)+1;
1073 bar.setCaption (i18n("Add / remove events") ); 1073 bar.setCaption (i18n("Add / remove events") );
1074 bar.setTotalSteps ( el.count() ) ; 1074 bar.setTotalSteps ( el.count() ) ;
1075 bar.show(); 1075 bar.show();
1076 incCounter = 0; 1076 incCounter = 0;
1077 1077
1078 while ( inL ) { 1078 while ( inL ) {
1079 1079
1080 qApp->processEvents(); 1080 qApp->processEvents();
1081 if ( ! bar.isVisible() ) 1081 if ( ! bar.isVisible() )
1082 return false; 1082 return false;
1083 if ( incCounter % modulo == 0 ) 1083 if ( incCounter % modulo == 0 )
1084 bar.setProgress( incCounter ); 1084 bar.setProgress( incCounter );
1085 ++incCounter; 1085 ++incCounter;
1086 uid = inL->uid(); 1086 uid = inL->uid();
1087 bool skipIncidence = false; 1087 bool skipIncidence = false;
1088 if ( uid.left(15) == QString("last-syncEvent-") ) 1088 if ( uid.left(15) == QString("last-syncEvent-") )
1089 skipIncidence = true; 1089 skipIncidence = true;
1090 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1090 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1091 skipIncidence = true; 1091 skipIncidence = true;
1092 if ( !skipIncidence ) { 1092 if ( !skipIncidence ) {
1093 inR = remote->incidence( uid ); 1093 inR = remote->incidence( uid );
1094 if ( ! inR ) { 1094 if ( ! inR ) {
1095 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1095 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1096 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1096 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1097 checkExternSyncEvent(eventLSyncSharp, inL); 1097 checkExternSyncEvent(eventLSyncSharp, inL);
1098 local->deleteIncidence( inL ); 1098 local->deleteIncidence( inL );
1099 ++deletedEventL; 1099 ++deletedEventL;
1100 } else { 1100 } else {
1101 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1101 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1102 inL->removeID(mCurrentSyncDevice ); 1102 inL->removeID(mCurrentSyncDevice );
1103 ++addedEventR; 1103 ++addedEventR;
1104 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1104 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1105 inL->setLastModified( modifiedCalendar ); 1105 inL->setLastModified( modifiedCalendar );
1106 inR = inL->clone(); 1106 inR = inL->clone();
1107 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1107 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1108 remote->addIncidence( inR ); 1108 remote->addIncidence( inR );
1109 } 1109 }
1110 } 1110 }
1111 } else { 1111 } else {
1112 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1112 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1113 checkExternSyncEvent(eventLSyncSharp, inL); 1113 checkExternSyncEvent(eventLSyncSharp, inL);
1114 local->deleteIncidence( inL ); 1114 local->deleteIncidence( inL );
1115 ++deletedEventL; 1115 ++deletedEventL;
1116 } else { 1116 } else {
1117 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1117 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1118 ++addedEventR; 1118 ++addedEventR;
1119 inL->setLastModified( modifiedCalendar ); 1119 inL->setLastModified( modifiedCalendar );
1120 remote->addIncidence( inL->clone() ); 1120 remote->addIncidence( inL->clone() );
1121 } 1121 }
1122 } 1122 }
1123 } 1123 }
1124 } 1124 }
1125 } 1125 }
1126 inL = el.next(); 1126 inL = el.next();
1127 } 1127 }
1128 int delFut = 0; 1128 int delFut = 0;
1129 int remRem = 0; 1129 int remRem = 0;
1130 if ( mSyncManager->mWriteBackInFuture ) { 1130 if ( mSyncManager->mWriteBackInFuture ) {
1131 er = remote->rawIncidences(); 1131 er = remote->rawIncidences();
1132 remRem = er.count(); 1132 remRem = er.count();
1133 inR = er.first(); 1133 inR = er.first();
1134 QDateTime dt; 1134 QDateTime dt;
1135 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1135 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1136 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1136 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1137 while ( inR ) { 1137 while ( inR ) {
1138 if ( inR->type() == "Todo" ) { 1138 if ( inR->type() == "Todo" ) {
1139 Todo * t = (Todo*)inR; 1139 Todo * t = (Todo*)inR;
1140 if ( t->hasDueDate() ) 1140 if ( t->hasDueDate() )
1141 dt = t->dtDue(); 1141 dt = t->dtDue();
1142 else 1142 else
1143 dt = cur.addSecs( 62 ); 1143 dt = cur.addSecs( 62 );
1144 } 1144 }
1145 else if (inR->type() == "Event" ) { 1145 else if (inR->type() == "Event" ) {
1146 bool ok; 1146 bool ok;
1147 dt = inR->getNextOccurence( cur, &ok ); 1147 dt = inR->getNextOccurence( cur, &ok );
1148 if ( !ok ) 1148 if ( !ok )
1149 dt = cur.addSecs( -62 ); 1149 dt = cur.addSecs( -62 );
1150 } 1150 }
1151 else 1151 else
1152 dt = inR->dtStart(); 1152 dt = inR->dtStart();
1153 if ( dt < cur || dt > end ) { 1153 if ( dt < cur || dt > end ) {
1154 remote->deleteIncidence( inR ); 1154 remote->deleteIncidence( inR );
1155 ++delFut; 1155 ++delFut;
1156 } 1156 }
1157 inR = er.next(); 1157 inR = er.next();
1158 } 1158 }
1159 } 1159 }
1160 bar.hide(); 1160 bar.hide();
1161 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1161 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1162 eventLSync->setReadOnly( false ); 1162 eventLSync->setReadOnly( false );
1163 eventLSync->setDtStart( mLastCalendarSync ); 1163 eventLSync->setDtStart( mLastCalendarSync );
1164 eventRSync->setDtStart( mLastCalendarSync ); 1164 eventRSync->setDtStart( mLastCalendarSync );
1165 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1165 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1166 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1166 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1167 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1167 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1168 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1168 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1169 eventLSync->setReadOnly( true ); 1169 eventLSync->setReadOnly( true );
1170 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... 1170 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
1171 remote->addEvent( eventRSync ); 1171 remote->addEvent( eventRSync );
1172 else 1172 else
1173 delete eventRSync; 1173 delete eventRSync;
1174 QString mes; 1174 QString mes;
1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1176 QString delmess; 1176 QString delmess;
1177 if ( delFut ) { 1177 if ( delFut ) {
1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1179 mes += delmess; 1179 mes += delmess;
1180 } 1180 }
1181 if ( mSyncManager->mShowSyncSummary ) { 1181 if ( mSyncManager->mShowSyncSummary ) {
1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1183 } 1183 }
1184 qDebug( mes ); 1184 qDebug( mes );
1185 mCalendar->checkAlarmForIncidence( 0, true ); 1185 mCalendar->checkAlarmForIncidence( 0, true );
1186 return syncOK; 1186 return syncOK;
1187} 1187}
1188 1188
1189void CalendarView::setSyncDevice( QString s ) 1189void CalendarView::setSyncDevice( QString s )
1190{ 1190{
1191 mCurrentSyncDevice= s; 1191 mCurrentSyncDevice= s;
1192} 1192}
1193void CalendarView::setSyncName( QString s ) 1193void CalendarView::setSyncName( QString s )
1194{ 1194{
1195 mCurrentSyncName= s; 1195 mCurrentSyncName= s;
1196} 1196}
1197bool CalendarView::syncCalendar(QString filename, int mode) 1197bool CalendarView::syncCalendar(QString filename, int mode)
1198{ 1198{
1199 //qDebug("syncCalendar %s ", filename.latin1()); 1199 //qDebug("syncCalendar %s ", filename.latin1());
1200 mGlobalSyncMode = SYNC_MODE_NORMAL; 1200 mGlobalSyncMode = SYNC_MODE_NORMAL;
1201 CalendarLocal* calendar = new CalendarLocal(); 1201 CalendarLocal* calendar = new CalendarLocal();
1202 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1202 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1203 FileStorage* storage = new FileStorage( calendar ); 1203 FileStorage* storage = new FileStorage( calendar );
1204 bool syncOK = false; 1204 bool syncOK = false;
1205 storage->setFileName( filename ); 1205 storage->setFileName( filename );
1206 // qDebug("loading ... "); 1206 // qDebug("loading ... ");
1207 if ( storage->load() ) { 1207 if ( storage->load() ) {
1208 getEventViewerDialog()->setSyncMode( true ); 1208 getEventViewerDialog()->setSyncMode( true );
1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1210 getEventViewerDialog()->setSyncMode( false ); 1210 getEventViewerDialog()->setSyncMode( false );
1211 if ( syncOK ) { 1211 if ( syncOK ) {
1212 if ( mSyncManager->mWriteBackFile ) 1212 if ( mSyncManager->mWriteBackFile )
1213 { 1213 {
1214 storage->setSaveFormat( new ICalFormat() ); 1214 storage->setSaveFormat( new ICalFormat() );
1215 storage->save(); 1215 storage->save();
1216 } 1216 }
1217 } 1217 }
1218 setModified( true ); 1218 setModified( true );
1219 } 1219 }
1220 delete storage; 1220 delete storage;
1221 delete calendar; 1221 delete calendar;
1222 if ( syncOK ) 1222 if ( syncOK )
1223 updateView(); 1223 updateView();
1224 return syncOK; 1224 return syncOK;
1225} 1225}
1226 1226
1227void CalendarView::syncExternal( int mode ) 1227void CalendarView::syncExternal( int mode )
1228{ 1228{
1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1230 1230
1231 qApp->processEvents(); 1231 qApp->processEvents();
1232 CalendarLocal* calendar = new CalendarLocal(); 1232 CalendarLocal* calendar = new CalendarLocal();
1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1234 bool syncOK = false; 1234 bool syncOK = false;
1235 bool loadSuccess = false; 1235 bool loadSuccess = false;
1236 PhoneFormat* phoneFormat = 0; 1236 PhoneFormat* phoneFormat = 0;
1237 emit tempDisableBR(true);
1237#ifndef DESKTOP_VERSION 1238#ifndef DESKTOP_VERSION
1238 SharpFormat* sharpFormat = 0; 1239 SharpFormat* sharpFormat = 0;
1239 if ( mode == 0 ) { // sharp 1240 if ( mode == 0 ) { // sharp
1240 sharpFormat = new SharpFormat () ; 1241 sharpFormat = new SharpFormat () ;
1241 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1242 loadSuccess = sharpFormat->load( calendar, mCalendar );
1242 1243
1243 } else 1244 } else
1244#endif 1245#endif
1245 if ( mode == 1 ) { // phone 1246 if ( mode == 1 ) { // phone
1246 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1247 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1247 mSyncManager->mPhoneDevice, 1248 mSyncManager->mPhoneDevice,
1248 mSyncManager->mPhoneConnection, 1249 mSyncManager->mPhoneConnection,
1249 mSyncManager->mPhoneModel); 1250 mSyncManager->mPhoneModel);
1250 loadSuccess = phoneFormat->load( calendar,mCalendar); 1251 loadSuccess = phoneFormat->load( calendar,mCalendar);
1251 1252
1252 } else 1253 } else {
1253 return; 1254 emit tempDisableBR(false);
1255 return;
1256 }
1254 if ( loadSuccess ) { 1257 if ( loadSuccess ) {
1255 getEventViewerDialog()->setSyncMode( true ); 1258 getEventViewerDialog()->setSyncMode( true );
1256 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1259 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1257 getEventViewerDialog()->setSyncMode( false ); 1260 getEventViewerDialog()->setSyncMode( false );
1258 qApp->processEvents(); 1261 qApp->processEvents();
1259 if ( syncOK ) { 1262 if ( syncOK ) {
1260 if ( mSyncManager->mWriteBackFile ) 1263 if ( mSyncManager->mWriteBackFile )
1261 { 1264 {
1262 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1265 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1263 Incidence* inc = iL.first(); 1266 Incidence* inc = iL.first();
1264 if ( phoneFormat ) { 1267 if ( phoneFormat ) {
1265 while ( inc ) { 1268 while ( inc ) {
1266 inc->removeID(mCurrentSyncDevice); 1269 inc->removeID(mCurrentSyncDevice);
1267 inc = iL.next(); 1270 inc = iL.next();
1268 } 1271 }
1269 } 1272 }
1270#ifndef DESKTOP_VERSION 1273#ifndef DESKTOP_VERSION
1271 if ( sharpFormat ) 1274 if ( sharpFormat )
1272 sharpFormat->save(calendar); 1275 sharpFormat->save(calendar);
1273#endif 1276#endif
1274 if ( phoneFormat ) 1277 if ( phoneFormat )
1275 phoneFormat->save(calendar); 1278 phoneFormat->save(calendar);
1276 iL = calendar->rawIncidences(); 1279 iL = calendar->rawIncidences();
1277 inc = iL.first(); 1280 inc = iL.first();
1278 Incidence* loc; 1281 Incidence* loc;
1279 while ( inc ) { 1282 while ( inc ) {
1280 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1283 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1281 loc = mCalendar->incidence(inc->uid() ); 1284 loc = mCalendar->incidence(inc->uid() );
1282 if ( loc ) { 1285 if ( loc ) {
1283 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1286 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1284 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1287 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1285 } 1288 }
1286 } 1289 }
1287 inc = iL.next(); 1290 inc = iL.next();
1288 } 1291 }
1289 Incidence* lse = getLastSyncEvent(); 1292 Incidence* lse = getLastSyncEvent();
1290 if ( lse ) { 1293 if ( lse ) {
1291 lse->setReadOnly( false ); 1294 lse->setReadOnly( false );
1292 lse->setDescription( "" ); 1295 lse->setDescription( "" );
1293 lse->setReadOnly( true ); 1296 lse->setReadOnly( true );
1294 } 1297 }
1295 } 1298 }
1296 } 1299 }
1297 setModified( true ); 1300 setModified( true );
1298 } else { 1301 } else {
1299 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1302 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1300 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1303 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1301 question, i18n("Ok")) ; 1304 question, i18n("Ok")) ;
1302 1305
1303 } 1306 }
1304 delete calendar; 1307 delete calendar;
1305 updateView(); 1308 updateView();
1309 emit tempDisableBR(false);
1306 return ;//syncOK; 1310 return ;//syncOK;
1307 1311
1308} 1312}
1309 1313
1310bool CalendarView::importBday() 1314bool CalendarView::importBday()
1311{ 1315{
1312#ifndef KORG_NOKABC 1316#ifndef KORG_NOKABC
1313 1317
1314#ifdef DESKTOP_VERSION 1318#ifdef DESKTOP_VERSION
1315 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1319 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1316 KABC::AddressBook::Iterator it; 1320 KABC::AddressBook::Iterator it;
1317 int count = 0; 1321 int count = 0;
1318 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1322 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1319 ++count; 1323 ++count;
1320 } 1324 }
1321 QProgressBar bar(count,0 ); 1325 QProgressBar bar(count,0 );
1322 int w = 300; 1326 int w = 300;
1323 if ( QApplication::desktop()->width() < 320 ) 1327 if ( QApplication::desktop()->width() < 320 )
1324 w = 220; 1328 w = 220;
1325 int h = bar.sizeHint().height() ; 1329 int h = bar.sizeHint().height() ;
1326 int dw = QApplication::desktop()->width(); 1330 int dw = QApplication::desktop()->width();
1327 int dh = QApplication::desktop()->height(); 1331 int dh = QApplication::desktop()->height();
1328 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1332 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1329 bar.show(); 1333 bar.show();
1330 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1334 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1331 qApp->processEvents(); 1335 qApp->processEvents();
1332 count = 0; 1336 count = 0;
1333 int addCount = 0; 1337 int addCount = 0;
1334 KCal::Attendee* a = 0; 1338 KCal::Attendee* a = 0;
1335 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1339 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1336 if ( ! bar.isVisible() ) 1340 if ( ! bar.isVisible() )
1337 return false; 1341 return false;
1338 bar.setProgress( count++ ); 1342 bar.setProgress( count++ );
1339 qApp->processEvents(); 1343 qApp->processEvents();
1340 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1344 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1341 if ( (*it).birthday().date().isValid() ){ 1345 if ( (*it).birthday().date().isValid() ){
1342 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1346 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1343 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1347 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1344 ++addCount; 1348 ++addCount;
1345 } 1349 }
1346 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1350 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1347 if ( anni.isValid() ){ 1351 if ( anni.isValid() ){
1348 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1352 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1349 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1353 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1350 ++addCount; 1354 ++addCount;
1351 } 1355 }
1352 } 1356 }
1353 updateView(); 1357 updateView();
1354 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1358 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1355#else //DESKTOP_VERSION 1359#else //DESKTOP_VERSION
1356 1360
1357 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1361 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1358 // the result should now arrive through method insertBirthdays 1362 // the result should now arrive through method insertBirthdays
1359 1363
1360#endif //DESKTOP_VERSION 1364#endif //DESKTOP_VERSION
1361 1365
1362#endif //KORG_NOKABC 1366#endif //KORG_NOKABC
1363 1367
1364 1368
1365 return true; 1369 return true;
1366} 1370}
1367 1371
1368// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1372// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1369void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1373void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1370 const QStringList& anniversaryList, const QStringList& realNameList, 1374 const QStringList& anniversaryList, const QStringList& realNameList,
1371 const QStringList& emailList, const QStringList& assembledNameList, 1375 const QStringList& emailList, const QStringList& assembledNameList,
1372 const QStringList& uidList) 1376 const QStringList& uidList)
1373{ 1377{
1374 qDebug("CalendarView::insertBirthdays"); 1378 qDebug("CalendarView::insertBirthdays");
1375 if (uid == this->name()) 1379 if (uid == this->name())
1376 { 1380 {
1377 int count = birthdayList.count(); 1381 int count = birthdayList.count();
1378 int addCount = 0; 1382 int addCount = 0;
1379 KCal::Attendee* a = 0; 1383 KCal::Attendee* a = 0;
1380 1384
1381 qDebug("CalView 1 %i", count); 1385 qDebug("CalView 1 %i", count);
1382 1386
1383 QProgressBar bar(count,0 ); 1387 QProgressBar bar(count,0 );
1384 int w = 300; 1388 int w = 300;
1385 if ( QApplication::desktop()->width() < 320 ) 1389 if ( QApplication::desktop()->width() < 320 )
1386 w = 220; 1390 w = 220;
1387 int h = bar.sizeHint().height() ; 1391 int h = bar.sizeHint().height() ;
1388 int dw = QApplication::desktop()->width(); 1392 int dw = QApplication::desktop()->width();
1389 int dh = QApplication::desktop()->height(); 1393 int dh = QApplication::desktop()->height();
1390 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1394 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1391 bar.show(); 1395 bar.show();
1392 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1396 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1393 qApp->processEvents(); 1397 qApp->processEvents();
1394 1398
1395 QDate birthday; 1399 QDate birthday;
1396 QDate anniversary; 1400 QDate anniversary;
1397 QString realName; 1401 QString realName;
1398 QString email; 1402 QString email;
1399 QString assembledName; 1403 QString assembledName;
1400 QString uid; 1404 QString uid;
1401 bool ok = true; 1405 bool ok = true;
1402 for ( int i = 0; i < count; i++) 1406 for ( int i = 0; i < count; i++)
1403 { 1407 {
1404 if ( ! bar.isVisible() ) 1408 if ( ! bar.isVisible() )
1405 return; 1409 return;
1406 bar.setProgress( i ); 1410 bar.setProgress( i );
1407 qApp->processEvents(); 1411 qApp->processEvents();
1408 1412
1409 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1413 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1410 if (!ok) { 1414 if (!ok) {
1411 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1415 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1412 } 1416 }
1413 1417
1414 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1418 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1415 if (!ok) { 1419 if (!ok) {
1416 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1420 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1417 } 1421 }
1418 realName = realNameList[i]; 1422 realName = realNameList[i];
1419 email = emailList[i]; 1423 email = emailList[i];
1420 assembledName = assembledNameList[i]; 1424 assembledName = assembledNameList[i];
1421 uid = uidList[i]; 1425 uid = uidList[i];
1422 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); 1426 //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() );
1423 1427
1424 if ( birthday.isValid() ){ 1428 if ( birthday.isValid() ){
1425 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1429 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1426 KCal::Attendee::ReqParticipant,uid) ; 1430 KCal::Attendee::ReqParticipant,uid) ;
1427 if ( addAnniversary( birthday, assembledName, a, true ) ) 1431 if ( addAnniversary( birthday, assembledName, a, true ) )
1428 ++addCount; 1432 ++addCount;
1429 } 1433 }
1430 1434
1431 if ( anniversary.isValid() ){ 1435 if ( anniversary.isValid() ){
1432 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1436 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1433 KCal::Attendee::ReqParticipant,uid) ; 1437 KCal::Attendee::ReqParticipant,uid) ;
1434 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1438 if ( addAnniversary( anniversary, assembledName, a, false ) )
1435 ++addCount; 1439 ++addCount;
1436 } 1440 }
1437 } 1441 }
1438 1442
1439 updateView(); 1443 updateView();
1440 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1444 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1441 1445
1442 } 1446 }
1443 1447
1444} 1448}
1445 1449
1446 1450
1447 1451
1448bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1452bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1449{ 1453{
1450 //qDebug("addAnni "); 1454 //qDebug("addAnni ");
1451 Event * ev = new Event(); 1455 Event * ev = new Event();
1452 if ( a ) { 1456 if ( a ) {
1453 ev->addAttendee( a ); 1457 ev->addAttendee( a );
1454 } 1458 }
1455 QString kind; 1459 QString kind;
1456 if ( birthday ) 1460 if ( birthday )
1457 kind = i18n( "Birthday" ); 1461 kind = i18n( "Birthday" );
1458 else 1462 else
1459 kind = i18n( "Anniversary" ); 1463 kind = i18n( "Anniversary" );
1460 ev->setSummary( name + " - " + kind ); 1464 ev->setSummary( name + " - " + kind );
1461 ev->setOrganizer( "nobody@nowhere" ); 1465 ev->setOrganizer( "nobody@nowhere" );
1462 ev->setCategories( kind ); 1466 ev->setCategories( kind );
1463 ev->setDtStart( QDateTime(date) ); 1467 ev->setDtStart( QDateTime(date) );
1464 ev->setDtEnd( QDateTime(date) ); 1468 ev->setDtEnd( QDateTime(date) );
1465 ev->setFloats( true ); 1469 ev->setFloats( true );
1466 Recurrence * rec = ev->recurrence(); 1470 Recurrence * rec = ev->recurrence();
1467 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1471 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1468 rec->addYearlyNum( date.month() ); 1472 rec->addYearlyNum( date.month() );
1469 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1473 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1470 delete ev; 1474 delete ev;
1471 return false; 1475 return false;
1472 } 1476 }
1473 return true; 1477 return true;
1474 1478
1475} 1479}
1476bool CalendarView::importQtopia( const QString &categories, 1480bool CalendarView::importQtopia( const QString &categories,
1477 const QString &datebook, 1481 const QString &datebook,
1478 const QString &todolist ) 1482 const QString &todolist )
1479{ 1483{
1480 1484
1481 QtopiaFormat qtopiaFormat; 1485 QtopiaFormat qtopiaFormat;
1482 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1486 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1483 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1487 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1484 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1488 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1485 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1489 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1486 1490
1487 updateView(); 1491 updateView();
1488 return true; 1492 return true;
1489 1493
1490#if 0 1494#if 0
1491 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1495 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1492 mCurrentSyncDevice = "qtopia-XML"; 1496 mCurrentSyncDevice = "qtopia-XML";
1493 if ( mSyncManager->mAskForPreferences ) 1497 if ( mSyncManager->mAskForPreferences )
1494 edit_sync_options(); 1498 edit_sync_options();
1495 qApp->processEvents(); 1499 qApp->processEvents();
1496 CalendarLocal* calendar = new CalendarLocal(); 1500 CalendarLocal* calendar = new CalendarLocal();
1497 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1501 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1498 bool syncOK = false; 1502 bool syncOK = false;
1499 QtopiaFormat qtopiaFormat; 1503 QtopiaFormat qtopiaFormat;
1500 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1504 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1501 bool loadOk = true; 1505 bool loadOk = true;
1502 if ( !categories.isEmpty() ) 1506 if ( !categories.isEmpty() )
1503 loadOk = qtopiaFormat.load( calendar, categories ); 1507 loadOk = qtopiaFormat.load( calendar, categories );
1504 if ( loadOk && !datebook.isEmpty() ) 1508 if ( loadOk && !datebook.isEmpty() )
1505 loadOk = qtopiaFormat.load( calendar, datebook ); 1509 loadOk = qtopiaFormat.load( calendar, datebook );
1506 if ( loadOk && !todolist.isEmpty() ) 1510 if ( loadOk && !todolist.isEmpty() )
1507 loadOk = qtopiaFormat.load( calendar, todolist ); 1511 loadOk = qtopiaFormat.load( calendar, todolist );
1508 1512
1509 if ( loadOk ) { 1513 if ( loadOk ) {
1510 getEventViewerDialog()->setSyncMode( true ); 1514 getEventViewerDialog()->setSyncMode( true );
1511 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1515 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1512 getEventViewerDialog()->setSyncMode( false ); 1516 getEventViewerDialog()->setSyncMode( false );
1513 qApp->processEvents(); 1517 qApp->processEvents();
1514 if ( syncOK ) { 1518 if ( syncOK ) {
1515 if ( mSyncManager->mWriteBackFile ) 1519 if ( mSyncManager->mWriteBackFile )
1516 { 1520 {
1517 // write back XML file 1521 // write back XML file
1518 1522
1519 } 1523 }
1520 setModified( true ); 1524 setModified( true );
1521 } 1525 }
1522 } else { 1526 } else {
1523 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1527 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1524 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1528 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1525 question, i18n("Ok")) ; 1529 question, i18n("Ok")) ;
1526 } 1530 }
1527 delete calendar; 1531 delete calendar;
1528 updateView(); 1532 updateView();
1529 return syncOK; 1533 return syncOK;
1530 1534
1531 1535
1532#endif 1536#endif
1533 1537
1534} 1538}
1535 1539
1536void CalendarView::setSyncEventsReadOnly() 1540void CalendarView::setSyncEventsReadOnly()
1537{ 1541{
1538 Event * ev; 1542 Event * ev;
1539 QPtrList<Event> eL = mCalendar->rawEvents(); 1543 QPtrList<Event> eL = mCalendar->rawEvents();
1540 ev = eL.first(); 1544 ev = eL.first();
1541 while ( ev ) { 1545 while ( ev ) {
1542 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1546 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1543 ev->setReadOnly( true ); 1547 ev->setReadOnly( true );
1544 ev = eL.next(); 1548 ev = eL.next();
1545 } 1549 }
1546} 1550}
1547bool CalendarView::openCalendar(QString filename, bool merge) 1551bool CalendarView::openCalendar(QString filename, bool merge)
1548{ 1552{
1549 1553
1550 if (filename.isEmpty()) { 1554 if (filename.isEmpty()) {
1551 return false; 1555 return false;
1552 } 1556 }
1553 1557
1554 if (!QFile::exists(filename)) { 1558 if (!QFile::exists(filename)) {
1555 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1559 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1556 return false; 1560 return false;
1557 } 1561 }
1558 1562
1559 globalFlagBlockAgenda = 1; 1563 globalFlagBlockAgenda = 1;
1560 if (!merge) mCalendar->close(); 1564 if (!merge) mCalendar->close();
1561 1565
1562 mStorage->setFileName( filename ); 1566 mStorage->setFileName( filename );
1563 1567
1564 if ( mStorage->load() ) { 1568 if ( mStorage->load() ) {
1565 if ( merge ) ;//setModified( true ); 1569 if ( merge ) ;//setModified( true );
1566 else { 1570 else {
1567 //setModified( true ); 1571 //setModified( true );
1568 mViewManager->setDocumentId( filename ); 1572 mViewManager->setDocumentId( filename );
1569 mDialogManager->setDocumentId( filename ); 1573 mDialogManager->setDocumentId( filename );
1570 mTodoList->setDocumentId( filename ); 1574 mTodoList->setDocumentId( filename );
1571 } 1575 }
1572 globalFlagBlockAgenda = 2; 1576 globalFlagBlockAgenda = 2;
1573 // if ( getLastSyncEvent() ) 1577 // if ( getLastSyncEvent() )
1574 // getLastSyncEvent()->setReadOnly( true ); 1578 // getLastSyncEvent()->setReadOnly( true );
1575 mCalendar->reInitAlarmSettings(); 1579 mCalendar->reInitAlarmSettings();
1576 setSyncEventsReadOnly(); 1580 setSyncEventsReadOnly();
1577 updateUnmanagedViews(); 1581 updateUnmanagedViews();
1578 updateView(); 1582 updateView();
1579 if ( filename != MainWindow::defaultFileName() ) { 1583 if ( filename != MainWindow::defaultFileName() ) {
1580 saveCalendar( MainWindow::defaultFileName() ); 1584 saveCalendar( MainWindow::defaultFileName() );
1581 } else { 1585 } else {
1582 QFileInfo finf ( MainWindow::defaultFileName()); 1586 QFileInfo finf ( MainWindow::defaultFileName());
1583 if ( finf.exists() ) { 1587 if ( finf.exists() ) {
1584 setLoadedFileVersion( finf.lastModified () ); 1588 setLoadedFileVersion( finf.lastModified () );
1585 } 1589 }
1586 } 1590 }
1587 return true; 1591 return true;
1588 } else { 1592 } else {
1589 // while failing to load, the calendar object could 1593 // while failing to load, the calendar object could
1590 // have become partially populated. Clear it out. 1594 // have become partially populated. Clear it out.
1591 if ( !merge ) { 1595 if ( !merge ) {
1592 mCalendar->close(); 1596 mCalendar->close();
1593 mViewManager->setDocumentId( filename ); 1597 mViewManager->setDocumentId( filename );
1594 mDialogManager->setDocumentId( filename ); 1598 mDialogManager->setDocumentId( filename );
1595 mTodoList->setDocumentId( filename ); 1599 mTodoList->setDocumentId( filename );
1596 } 1600 }
1597 1601
1598 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1602 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1599 1603
1600 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1604 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1601 globalFlagBlockAgenda = 2; 1605 globalFlagBlockAgenda = 2;
1602 mCalendar->reInitAlarmSettings(); 1606 mCalendar->reInitAlarmSettings();
1603 setSyncEventsReadOnly(); 1607 setSyncEventsReadOnly();
1604 updateUnmanagedViews(); 1608 updateUnmanagedViews();
1605 updateView(); 1609 updateView();
1606 } 1610 }
1607 return false; 1611 return false;
1608} 1612}
1609void CalendarView::showOpenError() 1613void CalendarView::showOpenError()
1610{ 1614{
1611 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1615 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1612} 1616}
1613void CalendarView::setLoadedFileVersion(QDateTime dt) 1617void CalendarView::setLoadedFileVersion(QDateTime dt)
1614{ 1618{
1615 loadedFileVersion = dt; 1619 loadedFileVersion = dt;
1616} 1620}
1617bool CalendarView::checkFileChanged(QString fn) 1621bool CalendarView::checkFileChanged(QString fn)
1618{ 1622{
1619 QFileInfo finf ( fn ); 1623 QFileInfo finf ( fn );
1620 if ( !finf.exists() ) 1624 if ( !finf.exists() )
1621 return true; 1625 return true;
1622 QDateTime dt = finf.lastModified (); 1626 QDateTime dt = finf.lastModified ();
1623 if ( dt <= loadedFileVersion ) 1627 if ( dt <= loadedFileVersion )
1624 return false; 1628 return false;
1625 return true; 1629 return true;
1626 1630
1627} 1631}
1628void CalendarView::watchSavedFile() 1632void CalendarView::watchSavedFile()
1629{ 1633{
1630 QFileInfo finf ( MainWindow::defaultFileName()); 1634 QFileInfo finf ( MainWindow::defaultFileName());
1631 if ( !finf.exists() ) 1635 if ( !finf.exists() )
1632 return; 1636 return;
1633 QDateTime dt = finf.lastModified (); 1637 QDateTime dt = finf.lastModified ();
1634 if ( dt < loadedFileVersion ) { 1638 if ( dt < loadedFileVersion ) {
1635 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1639 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1636 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1640 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1637 return; 1641 return;
1638 } 1642 }
1639 loadedFileVersion = dt; 1643 loadedFileVersion = dt;
1640} 1644}
1641 1645
1642bool CalendarView::checkFileVersion(QString fn) 1646bool CalendarView::checkFileVersion(QString fn)
1643{ 1647{
1644 QFileInfo finf ( fn ); 1648 QFileInfo finf ( fn );
1645 if ( !finf.exists() ) 1649 if ( !finf.exists() )
1646 return true; 1650 return true;
1647 QDateTime dt = finf.lastModified (); 1651 QDateTime dt = finf.lastModified ();
1648 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1652 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1649 //qDebug("file on disk version %s",dt.toString().latin1()); 1653 //qDebug("file on disk version %s",dt.toString().latin1());
1650 if ( dt <= loadedFileVersion ) 1654 if ( dt <= loadedFileVersion )
1651 return true; 1655 return true;
1652 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , 1656 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
1653 i18n("KO/Pi Warning"),i18n("Overwrite"), 1657 i18n("KO/Pi Warning"),i18n("Overwrite"),
1654 i18n("Sync+save")); 1658 i18n("Sync+save"));
1655 1659
1656 if ( km == KMessageBox::Cancel ) 1660 if ( km == KMessageBox::Cancel )
1657 return false; 1661 return false;
1658 if ( km == KMessageBox::Yes ) 1662 if ( km == KMessageBox::Yes )
1659 return true; 1663 return true;
1660 1664
1661 setSyncDevice("deleteaftersync" ); 1665 setSyncDevice("deleteaftersync" );
1662 mSyncManager->mAskForPreferences = true; 1666 mSyncManager->mAskForPreferences = true;
1663 mSyncManager->mSyncAlgoPrefs = 3; 1667 mSyncManager->mSyncAlgoPrefs = 3;
1664 mSyncManager->mWriteBackFile = false; 1668 mSyncManager->mWriteBackFile = false;
1665 mSyncManager->mWriteBackExistingOnly = false; 1669 mSyncManager->mWriteBackExistingOnly = false;
1666 mSyncManager->mShowSyncSummary = false; 1670 mSyncManager->mShowSyncSummary = false;
1667 syncCalendar( fn, 3 ); 1671 syncCalendar( fn, 3 );
1668 Event * e = getLastSyncEvent(); 1672 Event * e = getLastSyncEvent();
1669 mCalendar->deleteEvent ( e ); 1673 mCalendar->deleteEvent ( e );
1670 updateView(); 1674 updateView();
1671 return true; 1675 return true;
1672} 1676}
1673 1677
1674bool CalendarView::saveCalendar( QString filename ) 1678bool CalendarView::saveCalendar( QString filename )
1675{ 1679{
1676 1680
1677 // Store back all unsaved data into calendar object 1681 // Store back all unsaved data into calendar object
1678 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1682 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1679 if ( mViewManager->currentView() ) 1683 if ( mViewManager->currentView() )
1680 mViewManager->currentView()->flushView(); 1684 mViewManager->currentView()->flushView();
1681 1685
1682 1686
1683 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1687 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1684 mStorage->setSaveFormat( new ICalFormat() ); 1688 mStorage->setSaveFormat( new ICalFormat() );
1685 mStorage->setFileName( filename ); 1689 mStorage->setFileName( filename );
1686 bool success; 1690 bool success;
1687 success = mStorage->save(); 1691 success = mStorage->save();
1688 if ( !success ) { 1692 if ( !success ) {
1689 return false; 1693 return false;
1690 } 1694 }
1691 if ( filename == MainWindow::defaultFileName() ) { 1695 if ( filename == MainWindow::defaultFileName() ) {
1692 setLoadedFileVersion( lfv ); 1696 setLoadedFileVersion( lfv );
1693 watchSavedFile(); 1697 watchSavedFile();
1694 } 1698 }
1695 return true; 1699 return true;
1696} 1700}
1697 1701
1698void CalendarView::closeCalendar() 1702void CalendarView::closeCalendar()
1699{ 1703{
1700 1704
1701 // child windows no longer valid 1705 // child windows no longer valid
1702 emit closingDown(); 1706 emit closingDown();
1703 1707
1704 mCalendar->close(); 1708 mCalendar->close();
1705 setModified(false); 1709 setModified(false);
1706 updateView(); 1710 updateView();
1707} 1711}
1708 1712
1709void CalendarView::archiveCalendar() 1713void CalendarView::archiveCalendar()
1710{ 1714{
1711 mDialogManager->showArchiveDialog(); 1715 mDialogManager->showArchiveDialog();
1712} 1716}
1713 1717
1714 1718
1715void CalendarView::readSettings() 1719void CalendarView::readSettings()
1716{ 1720{
1717 1721
1718 1722
1719 // mViewManager->showAgendaView(); 1723 // mViewManager->showAgendaView();
1720 QString str; 1724 QString str;
1721 //qDebug("CalendarView::readSettings() "); 1725 //qDebug("CalendarView::readSettings() ");
1722 // read settings from the KConfig, supplying reasonable 1726 // read settings from the KConfig, supplying reasonable
1723 // defaults where none are to be found 1727 // defaults where none are to be found
1724 KConfig *config = KOGlobals::config(); 1728 KConfig *config = KOGlobals::config();
1725#ifndef KORG_NOSPLITTER 1729#ifndef KORG_NOSPLITTER
1726 config->setGroup("KOrganizer Geometry"); 1730 config->setGroup("KOrganizer Geometry");
1727 1731
1728 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1732 QValueList<int> sizes = config->readIntListEntry("Separator1");
1729 if (sizes.count() != 2) { 1733 if (sizes.count() != 2) {
1730 sizes << mDateNavigator->minimumSizeHint().width(); 1734 sizes << mDateNavigator->minimumSizeHint().width();
1731 sizes << 300; 1735 sizes << 300;
1732 } 1736 }
1733 mPanner->setSizes(sizes); 1737 mPanner->setSizes(sizes);
1734 1738
1735 sizes = config->readIntListEntry("Separator2"); 1739 sizes = config->readIntListEntry("Separator2");
1736 if ( ( mResourceView && sizes.count() == 4 ) || 1740 if ( ( mResourceView && sizes.count() == 4 ) ||
1737 ( !mResourceView && sizes.count() == 3 ) ) { 1741 ( !mResourceView && sizes.count() == 3 ) ) {
1738 mLeftSplitter->setSizes(sizes); 1742 mLeftSplitter->setSizes(sizes);
1739 } 1743 }
1740#endif 1744#endif
1741 globalFlagBlockAgenda = 1; 1745 globalFlagBlockAgenda = 1;
1742 mViewManager->showAgendaView(); 1746 mViewManager->showAgendaView();
1743 //mViewManager->readSettings( config ); 1747 //mViewManager->readSettings( config );
1744 mTodoList->restoreLayout(config,QString("Todo Layout")); 1748 mTodoList->restoreLayout(config,QString("Todo Layout"));
1745 readFilterSettings(config); 1749 readFilterSettings(config);
1746 config->setGroup( "Views" ); 1750 config->setGroup( "Views" );
1747 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1751 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1748 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1752 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1749 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1753 else if ( dateCount == 7 ) mNavigator->selectWeek();
1750 else mNavigator->selectDates( dateCount ); 1754 else mNavigator->selectDates( dateCount );
1751 // mViewManager->readSettings( config ); 1755 // mViewManager->readSettings( config );
1752 updateConfig(); 1756 updateConfig();
1753 globalFlagBlockAgenda = 2; 1757 globalFlagBlockAgenda = 2;
1754 mViewManager->readSettings( config ); 1758 mViewManager->readSettings( config );
1755#ifdef DESKTOP_VERSION 1759#ifdef DESKTOP_VERSION
1756 config->setGroup("WidgetLayout"); 1760 config->setGroup("WidgetLayout");
1757 QStringList list; 1761 QStringList list;
1758 list = config->readListEntry("MainLayout"); 1762 list = config->readListEntry("MainLayout");
1759 int x,y,w,h; 1763 int x,y,w,h;
1760 if ( ! list.isEmpty() ) { 1764 if ( ! list.isEmpty() ) {
1761 x = list[0].toInt(); 1765 x = list[0].toInt();
1762 y = list[1].toInt(); 1766 y = list[1].toInt();
1763 w = list[2].toInt(); 1767 w = list[2].toInt();
1764 h = list[3].toInt(); 1768 h = list[3].toInt();
1765 topLevelWidget()->setGeometry(x,y,w,h); 1769 topLevelWidget()->setGeometry(x,y,w,h);
1766 1770
1767 } else { 1771 } else {
1768 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1772 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1769 } 1773 }
1770 list = config->readListEntry("EditEventLayout"); 1774 list = config->readListEntry("EditEventLayout");
1771 if ( ! list.isEmpty() ) { 1775 if ( ! list.isEmpty() ) {
1772 x = list[0].toInt(); 1776 x = list[0].toInt();
1773 y = list[1].toInt(); 1777 y = list[1].toInt();
1774 w = list[2].toInt(); 1778 w = list[2].toInt();
1775 h = list[3].toInt(); 1779 h = list[3].toInt();
1776 mEventEditor->setGeometry(x,y,w,h); 1780 mEventEditor->setGeometry(x,y,w,h);
1777 1781
1778 } 1782 }
1779 list = config->readListEntry("EditTodoLayout"); 1783 list = config->readListEntry("EditTodoLayout");
1780 if ( ! list.isEmpty() ) { 1784 if ( ! list.isEmpty() ) {
1781 x = list[0].toInt(); 1785 x = list[0].toInt();
1782 y = list[1].toInt(); 1786 y = list[1].toInt();
1783 w = list[2].toInt(); 1787 w = list[2].toInt();
1784 h = list[3].toInt(); 1788 h = list[3].toInt();
1785 mTodoEditor->setGeometry(x,y,w,h); 1789 mTodoEditor->setGeometry(x,y,w,h);
1786 1790
1787 } 1791 }
1788 list = config->readListEntry("ViewerLayout"); 1792 list = config->readListEntry("ViewerLayout");
1789 if ( ! list.isEmpty() ) { 1793 if ( ! list.isEmpty() ) {
1790 x = list[0].toInt(); 1794 x = list[0].toInt();
1791 y = list[1].toInt(); 1795 y = list[1].toInt();
1792 w = list[2].toInt(); 1796 w = list[2].toInt();
1793 h = list[3].toInt(); 1797 h = list[3].toInt();
1794 getEventViewerDialog()->setGeometry(x,y,w,h); 1798 getEventViewerDialog()->setGeometry(x,y,w,h);
1795 } 1799 }
1796#endif 1800#endif
1797 1801
1798} 1802}
1799 1803
1800 1804
1801void CalendarView::writeSettings() 1805void CalendarView::writeSettings()
1802{ 1806{
1803 // kdDebug() << "CalendarView::writeSettings" << endl; 1807 // kdDebug() << "CalendarView::writeSettings" << endl;
1804 1808
1805 KConfig *config = KOGlobals::config(); 1809 KConfig *config = KOGlobals::config();
1806 1810
1807#ifndef KORG_NOSPLITTER 1811#ifndef KORG_NOSPLITTER
1808 config->setGroup("KOrganizer Geometry"); 1812 config->setGroup("KOrganizer Geometry");
1809 1813
1810 QValueList<int> list = mPanner->sizes(); 1814 QValueList<int> list = mPanner->sizes();
1811 config->writeEntry("Separator1",list); 1815 config->writeEntry("Separator1",list);
1812 1816
1813 list = mLeftSplitter->sizes(); 1817 list = mLeftSplitter->sizes();
1814 config->writeEntry("Separator2",list); 1818 config->writeEntry("Separator2",list);
1815#endif 1819#endif
1816 1820
1817 mViewManager->writeSettings( config ); 1821 mViewManager->writeSettings( config );
1818 mTodoList->saveLayout(config,QString("Todo Layout")); 1822 mTodoList->saveLayout(config,QString("Todo Layout"));
1819 mDialogManager->writeSettings( config ); 1823 mDialogManager->writeSettings( config );
1820 //KOPrefs::instance()->usrWriteConfig(); 1824 //KOPrefs::instance()->usrWriteConfig();
1821 KOPrefs::instance()->writeConfig(); 1825 KOPrefs::instance()->writeConfig();
1822 1826
1823 writeFilterSettings(config); 1827 writeFilterSettings(config);
1824 1828
1825 config->setGroup( "Views" ); 1829 config->setGroup( "Views" );
1826 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1830 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1827 1831
1828#ifdef DESKTOP_VERSION 1832#ifdef DESKTOP_VERSION
1829 config->setGroup("WidgetLayout"); 1833 config->setGroup("WidgetLayout");
1830 QStringList list ;//= config->readListEntry("MainLayout"); 1834 QStringList list ;//= config->readListEntry("MainLayout");
1831 int x,y,w,h; 1835 int x,y,w,h;
1832 QWidget* wid; 1836 QWidget* wid;
1833 wid = topLevelWidget(); 1837 wid = topLevelWidget();
1834 x = wid->geometry().x(); 1838 x = wid->geometry().x();
1835 y = wid->geometry().y(); 1839 y = wid->geometry().y();
1836 w = wid->width(); 1840 w = wid->width();
1837 h = wid->height(); 1841 h = wid->height();
1838 list.clear(); 1842 list.clear();
1839 list << QString::number( x ); 1843 list << QString::number( x );
1840 list << QString::number( y ); 1844 list << QString::number( y );
1841 list << QString::number( w ); 1845 list << QString::number( w );
1842 list << QString::number( h ); 1846 list << QString::number( h );
1843 config->writeEntry("MainLayout",list ); 1847 config->writeEntry("MainLayout",list );
1844 1848
1845 wid = mEventEditor; 1849 wid = mEventEditor;
1846 x = wid->geometry().x(); 1850 x = wid->geometry().x();
1847 y = wid->geometry().y(); 1851 y = wid->geometry().y();
1848 w = wid->width(); 1852 w = wid->width();
1849 h = wid->height(); 1853 h = wid->height();
1850 list.clear(); 1854 list.clear();
1851 list << QString::number( x ); 1855 list << QString::number( x );
1852 list << QString::number( y ); 1856 list << QString::number( y );
1853 list << QString::number( w ); 1857 list << QString::number( w );
1854 list << QString::number( h ); 1858 list << QString::number( h );
1855 config->writeEntry("EditEventLayout",list ); 1859 config->writeEntry("EditEventLayout",list );
1856 1860
1857 wid = mTodoEditor; 1861 wid = mTodoEditor;
1858 x = wid->geometry().x(); 1862 x = wid->geometry().x();
1859 y = wid->geometry().y(); 1863 y = wid->geometry().y();
1860 w = wid->width(); 1864 w = wid->width();
1861 h = wid->height(); 1865 h = wid->height();
1862 list.clear(); 1866 list.clear();
1863 list << QString::number( x ); 1867 list << QString::number( x );
1864 list << QString::number( y ); 1868 list << QString::number( y );
1865 list << QString::number( w ); 1869 list << QString::number( w );
1866 list << QString::number( h ); 1870 list << QString::number( h );
1867 config->writeEntry("EditTodoLayout",list ); 1871 config->writeEntry("EditTodoLayout",list );
1868 wid = getEventViewerDialog(); 1872 wid = getEventViewerDialog();
1869 x = wid->geometry().x(); 1873 x = wid->geometry().x();
1870 y = wid->geometry().y(); 1874 y = wid->geometry().y();
1871 w = wid->width(); 1875 w = wid->width();
1872 h = wid->height(); 1876 h = wid->height();
1873 list.clear(); 1877 list.clear();
1874 list << QString::number( x ); 1878 list << QString::number( x );
1875 list << QString::number( y ); 1879 list << QString::number( y );
1876 list << QString::number( w ); 1880 list << QString::number( w );
1877 list << QString::number( h ); 1881 list << QString::number( h );
1878 config->writeEntry("ViewerLayout",list ); 1882 config->writeEntry("ViewerLayout",list );
1879 wid = mDialogManager->getSearchDialog(); 1883 wid = mDialogManager->getSearchDialog();
1880 if ( wid ) { 1884 if ( wid ) {
1881 x = wid->geometry().x(); 1885 x = wid->geometry().x();
1882 y = wid->geometry().y(); 1886 y = wid->geometry().y();
1883 w = wid->width(); 1887 w = wid->width();
1884 h = wid->height(); 1888 h = wid->height();
1885 list.clear(); 1889 list.clear();
1886 list << QString::number( x ); 1890 list << QString::number( x );
1887 list << QString::number( y ); 1891 list << QString::number( y );
1888 list << QString::number( w ); 1892 list << QString::number( w );
1889 list << QString::number( h ); 1893 list << QString::number( h );
1890 config->writeEntry("SearchLayout",list ); 1894 config->writeEntry("SearchLayout",list );
1891 } 1895 }
1892#endif 1896#endif
1893 1897
1894 1898
1895 config->sync(); 1899 config->sync();
1896} 1900}
1897 1901
1898void CalendarView::readFilterSettings(KConfig *config) 1902void CalendarView::readFilterSettings(KConfig *config)
1899{ 1903{
1900 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1904 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1901 1905
1902 mFilters.clear(); 1906 mFilters.clear();
1903 1907
1904 config->setGroup("General"); 1908 config->setGroup("General");
1905 QStringList filterList = config->readListEntry("CalendarFilters"); 1909 QStringList filterList = config->readListEntry("CalendarFilters");
1906 1910
1907 QStringList::ConstIterator it = filterList.begin(); 1911 QStringList::ConstIterator it = filterList.begin();
1908 QStringList::ConstIterator end = filterList.end(); 1912 QStringList::ConstIterator end = filterList.end();
1909 while(it != end) { 1913 while(it != end) {
1910 // kdDebug() << " filter: " << (*it) << endl; 1914 // kdDebug() << " filter: " << (*it) << endl;
1911 1915
1912 CalFilter *filter; 1916 CalFilter *filter;
1913 filter = new CalFilter(*it); 1917 filter = new CalFilter(*it);
1914 config->setGroup("Filter_" + (*it)); 1918 config->setGroup("Filter_" + (*it));
1915 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1919 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1916 filter->setCriteria(config->readNumEntry("Criteria",0)); 1920 filter->setCriteria(config->readNumEntry("Criteria",0));
1917 filter->setCategoryList(config->readListEntry("CategoryList")); 1921 filter->setCategoryList(config->readListEntry("CategoryList"));
1918 mFilters.append(filter); 1922 mFilters.append(filter);
1919 1923
1920 ++it; 1924 ++it;
1921 } 1925 }
1922 1926
1923 if (mFilters.count() == 0) { 1927 if (mFilters.count() == 0) {
1924 CalFilter *filter = new CalFilter(i18n("Default")); 1928 CalFilter *filter = new CalFilter(i18n("Default"));
1925 mFilters.append(filter); 1929 mFilters.append(filter);
1926 } 1930 }
1927 mFilterView->updateFilters(); 1931 mFilterView->updateFilters();
1928 config->setGroup("FilterView"); 1932 config->setGroup("FilterView");
1929 1933
1930 mFilterView->blockSignals(true); 1934 mFilterView->blockSignals(true);
1931 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1935 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1932 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1936 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1933 mFilterView->blockSignals(false); 1937 mFilterView->blockSignals(false);
1934 // We do it manually to avoid it being done twice by the above calls 1938 // We do it manually to avoid it being done twice by the above calls
1935 updateFilter(); 1939 updateFilter();
1936} 1940}
1937 1941
1938void CalendarView::writeFilterSettings(KConfig *config) 1942void CalendarView::writeFilterSettings(KConfig *config)
1939{ 1943{
1940 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1944 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1941 1945
1942 QStringList filterList; 1946 QStringList filterList;
1943 1947
1944 CalFilter *filter = mFilters.first(); 1948 CalFilter *filter = mFilters.first();
1945 while(filter) { 1949 while(filter) {
1946 // kdDebug() << " fn: " << filter->name() << endl; 1950 // kdDebug() << " fn: " << filter->name() << endl;
1947 filterList << filter->name(); 1951 filterList << filter->name();
1948 config->setGroup("Filter_" + filter->name()); 1952 config->setGroup("Filter_" + filter->name());
1949 config->writeEntry("Criteria",filter->criteria()); 1953 config->writeEntry("Criteria",filter->criteria());
1950 config->writeEntry("CategoryList",filter->categoryList()); 1954 config->writeEntry("CategoryList",filter->categoryList());
1951 filter = mFilters.next(); 1955 filter = mFilters.next();
1952 } 1956 }
1953 config->setGroup("General"); 1957 config->setGroup("General");
1954 config->writeEntry("CalendarFilters",filterList); 1958 config->writeEntry("CalendarFilters",filterList);
1955 1959
1956 config->setGroup("FilterView"); 1960 config->setGroup("FilterView");
1957 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1961 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1958 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1962 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1959} 1963}
1960 1964
1961 1965
1962void CalendarView::goToday() 1966void CalendarView::goToday()
1963{ 1967{
1964 mNavigator->selectToday(); 1968 mNavigator->selectToday();
1965} 1969}
1966 1970
1967void CalendarView::goNext() 1971void CalendarView::goNext()
1968{ 1972{
1969 mNavigator->selectNext(); 1973 mNavigator->selectNext();
1970} 1974}
1971 1975
1972void CalendarView::goPrevious() 1976void CalendarView::goPrevious()
1973{ 1977{
1974 mNavigator->selectPrevious(); 1978 mNavigator->selectPrevious();
1975} 1979}
1976void CalendarView::goNextMonth() 1980void CalendarView::goNextMonth()
1977{ 1981{
1978 mNavigator->selectNextMonth(); 1982 mNavigator->selectNextMonth();
1979} 1983}
1980 1984
1981void CalendarView::goPreviousMonth() 1985void CalendarView::goPreviousMonth()
1982{ 1986{
1983 mNavigator->selectPreviousMonth(); 1987 mNavigator->selectPreviousMonth();
1984} 1988}
1985void CalendarView::writeLocale() 1989void CalendarView::writeLocale()
1986{ 1990{
1987 //KPimGlobalPrefs::instance()->setGlobalConfig(); 1991 //KPimGlobalPrefs::instance()->setGlobalConfig();
1988#if 0 1992#if 0
1989 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1993 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1990 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1994 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1991 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1995 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1992 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1996 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1993 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1997 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1994 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1998 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1995 dummy = KOPrefs::instance()->mUserDateFormatShort; 1999 dummy = KOPrefs::instance()->mUserDateFormatShort;
1996 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2000 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
1997 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2001 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
1998 KOPrefs::instance()->mDaylightsavingStart, 2002 KOPrefs::instance()->mDaylightsavingStart,
1999 KOPrefs::instance()->mDaylightsavingEnd ); 2003 KOPrefs::instance()->mDaylightsavingEnd );
2000 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 2004 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId );
2001#endif 2005#endif
2002} 2006}
2003void CalendarView::updateConfig() 2007void CalendarView::updateConfig()
2004{ 2008{
2005 writeLocale(); 2009 writeLocale();
2006 if ( KOPrefs::instance()->mUseAppColors ) 2010 if ( KOPrefs::instance()->mUseAppColors )
2007 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2011 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2008 emit configChanged(); 2012 emit configChanged();
2009 mTodoList->updateConfig(); 2013 mTodoList->updateConfig();
2010 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2014 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2011 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2015 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2012 // To make the "fill window" configurations work 2016 // To make the "fill window" configurations work
2013 //mViewManager->raiseCurrentView(); 2017 //mViewManager->raiseCurrentView();
2014} 2018}
2015 2019
2016 2020
2017void CalendarView::eventChanged(Event *event) 2021void CalendarView::eventChanged(Event *event)
2018{ 2022{
2019 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2023 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2020 //updateUnmanagedViews(); 2024 //updateUnmanagedViews();
2021} 2025}
2022 2026
2023void CalendarView::eventAdded(Event *event) 2027void CalendarView::eventAdded(Event *event)
2024{ 2028{
2025 changeEventDisplay(event,KOGlobals::EVENTADDED); 2029 changeEventDisplay(event,KOGlobals::EVENTADDED);
2026} 2030}
2027 2031
2028void CalendarView::eventToBeDeleted(Event *) 2032void CalendarView::eventToBeDeleted(Event *)
2029{ 2033{
2030 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2034 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2031} 2035}
2032 2036
2033void CalendarView::eventDeleted() 2037void CalendarView::eventDeleted()
2034{ 2038{
2035 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2039 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2036} 2040}
2037void CalendarView::changeTodoDisplay(Todo *which, int action) 2041void CalendarView::changeTodoDisplay(Todo *which, int action)
2038{ 2042{
2039 changeIncidenceDisplay((Incidence *)which, action); 2043 changeIncidenceDisplay((Incidence *)which, action);
2040 mDateNavigator->updateView(); //LR 2044 mDateNavigator->updateView(); //LR
2041 //mDialogManager->updateSearchDialog(); 2045 //mDialogManager->updateSearchDialog();
2042 2046
2043 if (which) { 2047 if (which) {
2044 mViewManager->updateWNview(); 2048 mViewManager->updateWNview();
2045 //mTodoList->updateView(); 2049 //mTodoList->updateView();
2046 } 2050 }
2047 2051
2048} 2052}
2049 2053
2050void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2054void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2051{ 2055{
2052 updateUnmanagedViews(); 2056 updateUnmanagedViews();
2053 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2057 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2054 if ( action == KOGlobals::EVENTDELETED ) { //delete 2058 if ( action == KOGlobals::EVENTDELETED ) { //delete
2055 mCalendar->checkAlarmForIncidence( 0, true ); 2059 mCalendar->checkAlarmForIncidence( 0, true );
2056 if ( mEventViewerDialog ) 2060 if ( mEventViewerDialog )
2057 mEventViewerDialog->hide(); 2061 mEventViewerDialog->hide();
2058 } 2062 }
2059 else 2063 else
2060 mCalendar->checkAlarmForIncidence( which , false ); 2064 mCalendar->checkAlarmForIncidence( which , false );
2061} 2065}
2062 2066
2063// most of the changeEventDisplays() right now just call the view's 2067// most of the changeEventDisplays() right now just call the view's
2064// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2068// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2065void CalendarView::changeEventDisplay(Event *which, int action) 2069void CalendarView::changeEventDisplay(Event *which, int action)
2066{ 2070{
2067 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2071 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2068 changeIncidenceDisplay((Incidence *)which, action); 2072 changeIncidenceDisplay((Incidence *)which, action);
2069 mDateNavigator->updateView(); 2073 mDateNavigator->updateView();
2070 //mDialogManager->updateSearchDialog(); 2074 //mDialogManager->updateSearchDialog();
2071 2075
2072 if (which) { 2076 if (which) {
2073 // If there is an event view visible update the display 2077 // If there is an event view visible update the display
2074 mViewManager->currentView()->changeEventDisplay(which,action); 2078 mViewManager->currentView()->changeEventDisplay(which,action);
2075 // TODO: check, if update needed 2079 // TODO: check, if update needed
2076 // if (which->getTodoStatus()) { 2080 // if (which->getTodoStatus()) {
2077 mTodoList->updateView(); 2081 mTodoList->updateView();
2078 // } 2082 // }
2079 } else { 2083 } else {
2080 mViewManager->currentView()->updateView(); 2084 mViewManager->currentView()->updateView();
2081 } 2085 }
2082} 2086}
2083 2087
2084 2088
2085void CalendarView::updateTodoViews() 2089void CalendarView::updateTodoViews()
2086{ 2090{
2087 2091
2088 mTodoList->updateView(); 2092 mTodoList->updateView();
2089 mViewManager->currentView()->updateView(); 2093 mViewManager->currentView()->updateView();
2090 2094
2091} 2095}
2092 2096
2093 2097
2094void CalendarView::updateView(const QDate &start, const QDate &end) 2098void CalendarView::updateView(const QDate &start, const QDate &end)
2095{ 2099{
2096 mTodoList->updateView(); 2100 mTodoList->updateView();
2097 mViewManager->updateView(start, end); 2101 mViewManager->updateView(start, end);
2098 //mDateNavigator->updateView(); 2102 //mDateNavigator->updateView();
2099} 2103}
2100 2104
2101void CalendarView::updateView() 2105void CalendarView::updateView()
2102{ 2106{
2103 DateList tmpList = mNavigator->selectedDates(); 2107 DateList tmpList = mNavigator->selectedDates();
2104 2108
2105 // We assume that the navigator only selects consecutive days. 2109 // We assume that the navigator only selects consecutive days.
2106 updateView( tmpList.first(), tmpList.last() ); 2110 updateView( tmpList.first(), tmpList.last() );
2107} 2111}
2108 2112
2109void CalendarView::updateUnmanagedViews() 2113void CalendarView::updateUnmanagedViews()
2110{ 2114{
2111 mDateNavigator->updateDayMatrix(); 2115 mDateNavigator->updateDayMatrix();
2112} 2116}
2113 2117
2114int CalendarView::msgItemDelete() 2118int CalendarView::msgItemDelete()
2115{ 2119{
2116 return KMessageBox::warningContinueCancel(this, 2120 return KMessageBox::warningContinueCancel(this,
2117 i18n("This item will be\npermanently deleted."), 2121 i18n("This item will be\npermanently deleted."),
2118 i18n("KO/Pi Confirmation"),i18n("Delete")); 2122 i18n("KO/Pi Confirmation"),i18n("Delete"));
2119} 2123}
2120 2124
2121 2125
2122void CalendarView::edit_cut() 2126void CalendarView::edit_cut()
2123{ 2127{
2124 Event *anEvent=0; 2128 Event *anEvent=0;
2125 2129
2126 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2130 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2127 2131
2128 if (mViewManager->currentView()->isEventView()) { 2132 if (mViewManager->currentView()->isEventView()) {
2129 if ( incidence && incidence->type() == "Event" ) { 2133 if ( incidence && incidence->type() == "Event" ) {
2130 anEvent = static_cast<Event *>(incidence); 2134 anEvent = static_cast<Event *>(incidence);
2131 } 2135 }
2132 } 2136 }
2133 2137
2134 if (!anEvent) { 2138 if (!anEvent) {
2135 KNotifyClient::beep(); 2139 KNotifyClient::beep();
2136 return; 2140 return;
2137 } 2141 }
2138 DndFactory factory( mCalendar ); 2142 DndFactory factory( mCalendar );
2139 factory.cutEvent(anEvent); 2143 factory.cutEvent(anEvent);
2140 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2144 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2141} 2145}
2142 2146
2143void CalendarView::edit_copy() 2147void CalendarView::edit_copy()
2144{ 2148{
2145 Event *anEvent=0; 2149 Event *anEvent=0;
2146 2150
2147 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2151 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2148 2152
2149 if (mViewManager->currentView()->isEventView()) { 2153 if (mViewManager->currentView()->isEventView()) {
2150 if ( incidence && incidence->type() == "Event" ) { 2154 if ( incidence && incidence->type() == "Event" ) {
2151 anEvent = static_cast<Event *>(incidence); 2155 anEvent = static_cast<Event *>(incidence);
2152 } 2156 }
2153 } 2157 }
2154 2158
2155 if (!anEvent) { 2159 if (!anEvent) {
2156 KNotifyClient::beep(); 2160 KNotifyClient::beep();
2157 return; 2161 return;
2158 } 2162 }
2159 DndFactory factory( mCalendar ); 2163 DndFactory factory( mCalendar );
2160 factory.copyEvent(anEvent); 2164 factory.copyEvent(anEvent);
2161} 2165}
2162 2166
2163void CalendarView::edit_paste() 2167void CalendarView::edit_paste()
2164{ 2168{
2165 QDate date = mNavigator->selectedDates().first(); 2169 QDate date = mNavigator->selectedDates().first();
2166 2170
2167 DndFactory factory( mCalendar ); 2171 DndFactory factory( mCalendar );
2168 Event *pastedEvent = factory.pasteEvent( date ); 2172 Event *pastedEvent = factory.pasteEvent( date );
2169 2173
2170 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2174 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2171} 2175}
2172 2176
2173void CalendarView::edit_options() 2177void CalendarView::edit_options()
2174{ 2178{
2175 mDialogManager->showOptionsDialog(); 2179 mDialogManager->showOptionsDialog();
2176 //writeSettings(); 2180 //writeSettings();
2177} 2181}
2178 2182
2179void CalendarView::slotSelectPickerDate( QDate d) 2183void CalendarView::slotSelectPickerDate( QDate d)
2180{ 2184{
2181 mDateFrame->hide(); 2185 mDateFrame->hide();
2182 if ( mDatePickerMode == 1 ) { 2186 if ( mDatePickerMode == 1 ) {
2183 mNavigator->slotDaySelect( d ); 2187 mNavigator->slotDaySelect( d );
2184 } else if ( mDatePickerMode == 2 ) { 2188 } else if ( mDatePickerMode == 2 ) {
2185 if ( mMoveIncidence->type() == "Todo" ) { 2189 if ( mMoveIncidence->type() == "Todo" ) {
2186 Todo * to = (Todo *) mMoveIncidence; 2190 Todo * to = (Todo *) mMoveIncidence;
2187 QTime tim; 2191 QTime tim;
2188 if ( to->hasDueDate() ) 2192 if ( to->hasDueDate() )
2189 tim = to->dtDue().time(); 2193 tim = to->dtDue().time();
2190 else { 2194 else {
2191 tim = QTime ( 0,0,0 ); 2195 tim = QTime ( 0,0,0 );
2192 to->setFloats( true ); 2196 to->setFloats( true );
2193 to->setHasDueDate( true ); 2197 to->setHasDueDate( true );
2194 } 2198 }
2195 QDateTime dt ( d,tim ); 2199 QDateTime dt ( d,tim );
2196 to->setDtDue( dt ); 2200 to->setDtDue( dt );
2197 todoChanged( to ); 2201 todoChanged( to );
2198 } else { 2202 } else {
2199 QTime tim = mMoveIncidence->dtStart().time(); 2203 QTime tim = mMoveIncidence->dtStart().time();
2200 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2204 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2201 QDateTime dt ( d,tim ); 2205 QDateTime dt ( d,tim );
2202 mMoveIncidence->setDtStart( dt ); 2206 mMoveIncidence->setDtStart( dt );
2203 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2207 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2204 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2208 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2205 } 2209 }
2206 2210
2207 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2211 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2208 } 2212 }
2209} 2213}
2210 2214
2211void CalendarView::removeCategories() 2215void CalendarView::removeCategories()
2212{ 2216{
2213 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2217 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2214 QStringList catList = KOPrefs::instance()->mCustomCategories; 2218 QStringList catList = KOPrefs::instance()->mCustomCategories;
2215 QStringList catIncList; 2219 QStringList catIncList;
2216 QStringList newCatList; 2220 QStringList newCatList;
2217 Incidence* inc = incList.first(); 2221 Incidence* inc = incList.first();
2218 int i; 2222 int i;
2219 int count = 0; 2223 int count = 0;
2220 while ( inc ) { 2224 while ( inc ) {
2221 newCatList.clear(); 2225 newCatList.clear();
2222 catIncList = inc->categories() ; 2226 catIncList = inc->categories() ;
2223 for( i = 0; i< catIncList.count(); ++i ) { 2227 for( i = 0; i< catIncList.count(); ++i ) {
2224 if ( catList.contains (catIncList[i])) 2228 if ( catList.contains (catIncList[i]))
2225 newCatList.append( catIncList[i] ); 2229 newCatList.append( catIncList[i] );
2226 } 2230 }
2227 newCatList.sort(); 2231 newCatList.sort();
2228 inc->setCategories( newCatList.join(",") ); 2232 inc->setCategories( newCatList.join(",") );
2229 inc = incList.next(); 2233 inc = incList.next();
2230 } 2234 }
2231} 2235}
2232 2236
2233int CalendarView::addCategories() 2237int CalendarView::addCategories()
2234{ 2238{
2235 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2239 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2236 QStringList catList = KOPrefs::instance()->mCustomCategories; 2240 QStringList catList = KOPrefs::instance()->mCustomCategories;
2237 QStringList catIncList; 2241 QStringList catIncList;
2238 Incidence* inc = incList.first(); 2242 Incidence* inc = incList.first();
2239 int i; 2243 int i;
2240 int count = 0; 2244 int count = 0;
2241 while ( inc ) { 2245 while ( inc ) {
2242 catIncList = inc->categories() ; 2246 catIncList = inc->categories() ;
2243 for( i = 0; i< catIncList.count(); ++i ) { 2247 for( i = 0; i< catIncList.count(); ++i ) {
2244 if ( !catList.contains (catIncList[i])) { 2248 if ( !catList.contains (catIncList[i])) {
2245 catList.append( catIncList[i] ); 2249 catList.append( catIncList[i] );
2246 //qDebug("add cat %s ", catIncList[i].latin1()); 2250 //qDebug("add cat %s ", catIncList[i].latin1());
2247 ++count; 2251 ++count;
2248 } 2252 }
2249 } 2253 }
2250 inc = incList.next(); 2254 inc = incList.next();
2251 } 2255 }
2252 catList.sort(); 2256 catList.sort();
2253 KOPrefs::instance()->mCustomCategories = catList; 2257 KOPrefs::instance()->mCustomCategories = catList;
2254 return count; 2258 return count;
2255} 2259}
2256 2260
2257void CalendarView::manageCategories() 2261void CalendarView::manageCategories()
2258{ 2262{
2259 KOCatPrefs* cp = new KOCatPrefs(); 2263 KOCatPrefs* cp = new KOCatPrefs();
2260 cp->show(); 2264 cp->show();
2261 int w =cp->sizeHint().width() ; 2265 int w =cp->sizeHint().width() ;
2262 int h = cp->sizeHint().height() ; 2266 int h = cp->sizeHint().height() ;
2263 int dw = QApplication::desktop()->width(); 2267 int dw = QApplication::desktop()->width();
2264 int dh = QApplication::desktop()->height(); 2268 int dh = QApplication::desktop()->height();
2265 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2269 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2266 if ( !cp->exec() ) { 2270 if ( !cp->exec() ) {
2267 delete cp; 2271 delete cp;
2268 return; 2272 return;
2269 } 2273 }
2270 int count = 0; 2274 int count = 0;
2271 if ( cp->addCat() ) { 2275 if ( cp->addCat() ) {
2272 count = addCategories(); 2276 count = addCategories();
2273 if ( count ) { 2277 if ( count ) {
2274 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2278 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2275 writeSettings(); 2279 writeSettings();
2276 } 2280 }
2277 } else { 2281 } else {
2278 removeCategories(); 2282 removeCategories();
2279 updateView(); 2283 updateView();
2280 } 2284 }
2281 delete cp; 2285 delete cp;
2282} 2286}
2283 2287
2284void CalendarView::beamIncidence(Incidence * Inc) 2288void CalendarView::beamIncidence(Incidence * Inc)
2285{ 2289{
2286 QPtrList<Incidence> delSel ; 2290 QPtrList<Incidence> delSel ;
2287 delSel.append(Inc); 2291 delSel.append(Inc);
2288 beamIncidenceList( delSel ); 2292 beamIncidenceList( delSel );
2289} 2293}
2290void CalendarView::beamCalendar() 2294void CalendarView::beamCalendar()
2291{ 2295{
2292 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2296 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2293 //qDebug("beamCalendar() "); 2297 //qDebug("beamCalendar() ");
2294 beamIncidenceList( delSel ); 2298 beamIncidenceList( delSel );
2295} 2299}
2296void CalendarView::beamFilteredCalendar() 2300void CalendarView::beamFilteredCalendar()
2297{ 2301{
2298 QPtrList<Incidence> delSel = mCalendar->incidences(); 2302 QPtrList<Incidence> delSel = mCalendar->incidences();
2299 //qDebug("beamFilteredCalendar() "); 2303 //qDebug("beamFilteredCalendar() ");
2300 beamIncidenceList( delSel ); 2304 beamIncidenceList( delSel );
2301} 2305}
2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2306void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2303{ 2307{
2304 if ( beamDialog->exec () == QDialog::Rejected ) 2308 if ( beamDialog->exec () == QDialog::Rejected )
2305 return; 2309 return;
2306#ifdef DESKTOP_VERSION 2310#ifdef DESKTOP_VERSION
2307 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2311 QString fn = locateLocal( "tmp", "kopibeamfile" );
2308#else 2312#else
2309 QString fn = "/tmp/kopibeamfile"; 2313 QString fn = "/tmp/kopibeamfile";
2310#endif 2314#endif
2311 QString mes; 2315 QString mes;
2312 bool createbup = true; 2316 bool createbup = true;
2313 if ( createbup ) { 2317 if ( createbup ) {
2314 QString description = "\n"; 2318 QString description = "\n";
2315 CalendarLocal* cal = new CalendarLocal(); 2319 CalendarLocal* cal = new CalendarLocal();
2316 if ( beamDialog->beamLocal() ) 2320 if ( beamDialog->beamLocal() )
2317 cal->setLocalTime(); 2321 cal->setLocalTime();
2318 else 2322 else
2319 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2323 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2320 Incidence *incidence = delSel.first(); 2324 Incidence *incidence = delSel.first();
2321 bool addText = false; 2325 bool addText = false;
2322 if ( delSel.count() < 10 ) 2326 if ( delSel.count() < 10 )
2323 addText = true; 2327 addText = true;
2324 else { 2328 else {
2325 description.sprintf(i18n(" %d items?"),delSel.count() ); 2329 description.sprintf(i18n(" %d items?"),delSel.count() );
2326 } 2330 }
2327 while ( incidence ) { 2331 while ( incidence ) {
2328 Incidence *in = incidence->clone(); 2332 Incidence *in = incidence->clone();
2329 if ( ! in->summary().isEmpty() ) { 2333 if ( ! in->summary().isEmpty() ) {
2330 in->setDescription(""); 2334 in->setDescription("");
2331 } else { 2335 } else {
2332 in->setSummary( in->description().left(20)); 2336 in->setSummary( in->description().left(20));
2333 in->setDescription(""); 2337 in->setDescription("");
2334 } 2338 }
2335 if ( addText ) 2339 if ( addText )
2336 description += in->summary() + "\n"; 2340 description += in->summary() + "\n";
2337 cal->addIncidence( in ); 2341 cal->addIncidence( in );
2338 incidence = delSel.next(); 2342 incidence = delSel.next();
2339 } 2343 }
2340 if ( beamDialog->beamVcal() ) { 2344 if ( beamDialog->beamVcal() ) {
2341 fn += ".vcs"; 2345 fn += ".vcs";
2342 FileStorage storage( cal, fn, new VCalFormat ); 2346 FileStorage storage( cal, fn, new VCalFormat );
2343 storage.save(); 2347 storage.save();
2344 } else { 2348 } else {
2345 fn += ".ics"; 2349 fn += ".ics";
2346 FileStorage storage( cal, fn, new ICalFormat( ) ); 2350 FileStorage storage( cal, fn, new ICalFormat( ) );
2347 storage.save(); 2351 storage.save();
2348 } 2352 }
2349 delete cal; 2353 delete cal;
2350 mes = i18n("KO/Pi: Ready for beaming"); 2354 mes = i18n("KO/Pi: Ready for beaming");
2351 topLevelWidget()->setCaption(mes); 2355 topLevelWidget()->setCaption(mes);
2352 KApplication::convert2latin1( fn ); 2356 KApplication::convert2latin1( fn );
2353#ifndef DESKTOP_VERSION 2357#ifndef DESKTOP_VERSION
2354 Ir *ir = new Ir( this ); 2358 Ir *ir = new Ir( this );
2355 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2359 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2356 ir->send( fn, description, "text/x-vCalendar" ); 2360 ir->send( fn, description, "text/x-vCalendar" );
2357#endif 2361#endif
2358 } 2362 }
2359} 2363}
2360void CalendarView::beamDone( Ir *ir ) 2364void CalendarView::beamDone( Ir *ir )
2361{ 2365{
2362#ifndef DESKTOP_VERSION 2366#ifndef DESKTOP_VERSION
2363 delete ir; 2367 delete ir;
2364#endif 2368#endif
2365 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2369 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2366 topLevelWidget()->raise(); 2370 topLevelWidget()->raise();
2367} 2371}
2368 2372
2369void CalendarView::moveIncidence(Incidence * inc ) 2373void CalendarView::moveIncidence(Incidence * inc )
2370{ 2374{
2371 if ( !inc ) return; 2375 if ( !inc ) return;
2372 // qDebug("showDatePickerForIncidence( ) "); 2376 // qDebug("showDatePickerForIncidence( ) ");
2373 if ( mDateFrame->isVisible() ) 2377 if ( mDateFrame->isVisible() )
2374 mDateFrame->hide(); 2378 mDateFrame->hide();
2375 else { 2379 else {
2376 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2380 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2377 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2381 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2378 int dw = QApplication::desktop()->width(); 2382 int dw = QApplication::desktop()->width();
2379 int dh = QApplication::desktop()->height(); 2383 int dh = QApplication::desktop()->height();
2380 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2384 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2381 mDateFrame->show(); 2385 mDateFrame->show();
2382 } 2386 }
2383 mDatePickerMode = 2; 2387 mDatePickerMode = 2;
2384 mMoveIncidence = inc ; 2388 mMoveIncidence = inc ;
2385 QDate da; 2389 QDate da;
2386 if ( mMoveIncidence->type() == "Todo" ) { 2390 if ( mMoveIncidence->type() == "Todo" ) {
2387 Todo * to = (Todo *) mMoveIncidence; 2391 Todo * to = (Todo *) mMoveIncidence;
2388 if ( to->hasDueDate() ) 2392 if ( to->hasDueDate() )
2389 da = to->dtDue().date(); 2393 da = to->dtDue().date();
2390 else 2394 else
2391 da = QDate::currentDate(); 2395 da = QDate::currentDate();
2392 } else { 2396 } else {
2393 da = mMoveIncidence->dtStart().date(); 2397 da = mMoveIncidence->dtStart().date();
2394 } 2398 }
2395 mDatePicker->setDate( da ); 2399 mDatePicker->setDate( da );
2396} 2400}
2397void CalendarView::showDatePicker( ) 2401void CalendarView::showDatePicker( )
2398{ 2402{
2399 //qDebug("CalendarView::showDatePicker( ) "); 2403 //qDebug("CalendarView::showDatePicker( ) ");
2400 if ( mDateFrame->isVisible() ) 2404 if ( mDateFrame->isVisible() )
2401 mDateFrame->hide(); 2405 mDateFrame->hide();
2402 else { 2406 else {
2403 int w =mDatePicker->sizeHint().width() ; 2407 int w =mDatePicker->sizeHint().width() ;
2404 int h = mDatePicker->sizeHint().height() ; 2408 int h = mDatePicker->sizeHint().height() ;
2405 int dw = QApplication::desktop()->width(); 2409 int dw = QApplication::desktop()->width();
2406 int dh = QApplication::desktop()->height(); 2410 int dh = QApplication::desktop()->height();
2407 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2411 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2408 mDateFrame->show(); 2412 mDateFrame->show();
2409 } 2413 }
2410 mDatePickerMode = 1; 2414 mDatePickerMode = 1;
2411 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2415 mDatePicker->setDate( mNavigator->selectedDates().first() );
2412} 2416}
2413 2417
2414void CalendarView::showEventEditor() 2418void CalendarView::showEventEditor()
2415{ 2419{
2416#ifdef DESKTOP_VERSION 2420#ifdef DESKTOP_VERSION
2417 mEventEditor->show(); 2421 mEventEditor->show();
2418#else 2422#else
2419 mEventEditor->showMaximized(); 2423 mEventEditor->showMaximized();
2420#endif 2424#endif
2421} 2425}
2422void CalendarView::showTodoEditor() 2426void CalendarView::showTodoEditor()
2423{ 2427{
2424#ifdef DESKTOP_VERSION 2428#ifdef DESKTOP_VERSION
2425 mTodoEditor->show(); 2429 mTodoEditor->show();
2426#else 2430#else
2427 mTodoEditor->showMaximized(); 2431 mTodoEditor->showMaximized();
2428#endif 2432#endif
2429} 2433}
2430 2434
2431void CalendarView::cloneIncidence() 2435void CalendarView::cloneIncidence()
2432{ 2436{
2433 Incidence *incidence = currentSelection(); 2437 Incidence *incidence = currentSelection();
2434 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2438 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2435 if ( incidence ) { 2439 if ( incidence ) {
2436 cloneIncidence(incidence); 2440 cloneIncidence(incidence);
2437 } 2441 }
2438} 2442}
2439void CalendarView::moveIncidence() 2443void CalendarView::moveIncidence()
2440{ 2444{
2441 Incidence *incidence = currentSelection(); 2445 Incidence *incidence = currentSelection();
2442 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2446 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2443 if ( incidence ) { 2447 if ( incidence ) {
2444 moveIncidence(incidence); 2448 moveIncidence(incidence);
2445 } 2449 }
2446} 2450}
2447void CalendarView::beamIncidence() 2451void CalendarView::beamIncidence()
2448{ 2452{
2449 Incidence *incidence = currentSelection(); 2453 Incidence *incidence = currentSelection();
2450 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2454 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2451 if ( incidence ) { 2455 if ( incidence ) {
2452 beamIncidence(incidence); 2456 beamIncidence(incidence);
2453 } 2457 }
2454} 2458}
2455void CalendarView::toggleCancelIncidence() 2459void CalendarView::toggleCancelIncidence()
2456{ 2460{
2457 Incidence *incidence = currentSelection(); 2461 Incidence *incidence = currentSelection();
2458 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2462 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2459 if ( incidence ) { 2463 if ( incidence ) {
2460 cancelIncidence(incidence); 2464 cancelIncidence(incidence);
2461 } 2465 }
2462} 2466}
2463 2467
2464 2468
2465void CalendarView::cancelIncidence(Incidence * inc ) 2469void CalendarView::cancelIncidence(Incidence * inc )
2466{ 2470{
2467 inc->setCancelled( ! inc->cancelled() ); 2471 inc->setCancelled( ! inc->cancelled() );
2468 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2472 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2469 updateView(); 2473 updateView();
2470} 2474}
2471void CalendarView::cloneIncidence(Incidence * orgInc ) 2475void CalendarView::cloneIncidence(Incidence * orgInc )
2472{ 2476{
2473 Incidence * newInc = orgInc->clone(); 2477 Incidence * newInc = orgInc->clone();
2474 newInc->recreate(); 2478 newInc->recreate();
2475 2479
2476 if ( newInc->type() == "Todo" ) { 2480 if ( newInc->type() == "Todo" ) {
2477 Todo* t = (Todo*) newInc; 2481 Todo* t = (Todo*) newInc;
2478 mTodoEditor->editTodo( t ); 2482 mTodoEditor->editTodo( t );
2479 showTodoEditor(); 2483 showTodoEditor();
2480 if ( mTodoEditor->exec() ) { 2484 if ( mTodoEditor->exec() ) {
2481 mCalendar->addTodo( t ); 2485 mCalendar->addTodo( t );
2482 updateView(); 2486 updateView();
2483 } else { 2487 } else {
2484 delete t; 2488 delete t;
2485 } 2489 }
2486 } 2490 }
2487 else { 2491 else {
2488 Event* e = (Event*) newInc; 2492 Event* e = (Event*) newInc;
2489 mEventEditor->editEvent( e ); 2493 mEventEditor->editEvent( e );
2490 showEventEditor(); 2494 showEventEditor();
2491 if ( mEventEditor->exec() ) { 2495 if ( mEventEditor->exec() ) {
2492 mCalendar->addEvent( e ); 2496 mCalendar->addEvent( e );
2493 updateView(); 2497 updateView();
2494 } else { 2498 } else {
2495 delete e; 2499 delete e;
2496 } 2500 }
2497 } 2501 }
2498} 2502}
2499 2503
2500void CalendarView::newEvent() 2504void CalendarView::newEvent()
2501{ 2505{
2502 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2506 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2503 KOAgendaView *aView = mViewManager->agendaView(); 2507 KOAgendaView *aView = mViewManager->agendaView();
2504 if (aView) { 2508 if (aView) {
2505 if (aView->selectionStart().isValid()) { 2509 if (aView->selectionStart().isValid()) {
2506 if (aView->selectedIsAllDay()) { 2510 if (aView->selectedIsAllDay()) {
2507 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2511 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2508 } else { 2512 } else {
2509 newEvent(aView->selectionStart(),aView->selectionEnd()); 2513 newEvent(aView->selectionStart(),aView->selectionEnd());
2510 } 2514 }
2511 return; 2515 return;
2512 } 2516 }
2513 } 2517 }
2514 2518
2515 QDate date = mNavigator->selectedDates().first(); 2519 QDate date = mNavigator->selectedDates().first();
2516 QDateTime current = QDateTime::currentDateTime(); 2520 QDateTime current = QDateTime::currentDateTime();
2517 if ( date <= current.date() ) { 2521 if ( date <= current.date() ) {
2518 int hour = current.time().hour() +1; 2522 int hour = current.time().hour() +1;
2519 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2523 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2520 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2524 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2521 } else 2525 } else
2522 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2526 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2523 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2527 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2524 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2528 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2525} 2529}
2526 2530
2527void CalendarView::newEvent(QDateTime fh) 2531void CalendarView::newEvent(QDateTime fh)
2528{ 2532{
2529 newEvent(fh, 2533 newEvent(fh,
2530 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2534 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2531} 2535}
2532 2536
2533void CalendarView::newEvent(QDate dt) 2537void CalendarView::newEvent(QDate dt)
2534{ 2538{
2535 newEvent(QDateTime(dt, QTime(0,0,0)), 2539 newEvent(QDateTime(dt, QTime(0,0,0)),
2536 QDateTime(dt, QTime(0,0,0)), true); 2540 QDateTime(dt, QTime(0,0,0)), true);
2537} 2541}
2538 2542
2539void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2543void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2540{ 2544{
2541 2545
2542 mEventEditor->newEvent(fromHint,toHint,allDay); 2546 mEventEditor->newEvent(fromHint,toHint,allDay);
2543 if ( mFilterView->filtersEnabled() ) { 2547 if ( mFilterView->filtersEnabled() ) {
2544 CalFilter *filter = mFilterView->selectedFilter(); 2548 CalFilter *filter = mFilterView->selectedFilter();
2545 if (filter && filter->showCategories()) { 2549 if (filter && filter->showCategories()) {
2546 mEventEditor->setCategories(filter->categoryList().join(",") ); 2550 mEventEditor->setCategories(filter->categoryList().join(",") );
2547 } 2551 }
2548 if ( filter ) 2552 if ( filter )
2549 mEventEditor->setSecrecy( filter->getSecrecy() ); 2553 mEventEditor->setSecrecy( filter->getSecrecy() );
2550 } 2554 }
2551 showEventEditor(); 2555 showEventEditor();
2552} 2556}
2553void CalendarView::todoAdded(Todo * t) 2557void CalendarView::todoAdded(Todo * t)
2554{ 2558{
2555 2559
2556 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2560 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2557 updateTodoViews(); 2561 updateTodoViews();
2558} 2562}
2559void CalendarView::todoChanged(Todo * t) 2563void CalendarView::todoChanged(Todo * t)
2560{ 2564{
2561 emit todoModified( t, 4 ); 2565 emit todoModified( t, 4 );
2562 // updateTodoViews(); 2566 // updateTodoViews();
2563} 2567}
2564void CalendarView::todoToBeDeleted(Todo *) 2568void CalendarView::todoToBeDeleted(Todo *)
2565{ 2569{
2566 //qDebug("todoToBeDeleted(Todo *) "); 2570 //qDebug("todoToBeDeleted(Todo *) ");
2567 updateTodoViews(); 2571 updateTodoViews();
2568} 2572}
2569void CalendarView::todoDeleted() 2573void CalendarView::todoDeleted()
2570{ 2574{
2571 //qDebug(" todoDeleted()"); 2575 //qDebug(" todoDeleted()");
2572 updateTodoViews(); 2576 updateTodoViews();
2573} 2577}
2574 2578
2575 2579
2576 2580
2577void CalendarView::newTodo() 2581void CalendarView::newTodo()
2578{ 2582{
2579 2583
2580 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2584 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2581 if ( mFilterView->filtersEnabled() ) { 2585 if ( mFilterView->filtersEnabled() ) {
2582 CalFilter *filter = mFilterView->selectedFilter(); 2586 CalFilter *filter = mFilterView->selectedFilter();
2583 if (filter && filter->showCategories()) { 2587 if (filter && filter->showCategories()) {
2584 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2588 mTodoEditor->setCategories(filter->categoryList().join(",") );
2585 } 2589 }
2586 if ( filter ) 2590 if ( filter )
2587 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2591 mTodoEditor->setSecrecy( filter->getSecrecy() );
2588 } 2592 }
2589 showTodoEditor(); 2593 showTodoEditor();
2590} 2594}
2591 2595
2592void CalendarView::newSubTodo() 2596void CalendarView::newSubTodo()
2593{ 2597{
2594 Todo *todo = selectedTodo(); 2598 Todo *todo = selectedTodo();
2595 if ( todo ) newSubTodo( todo ); 2599 if ( todo ) newSubTodo( todo );
2596} 2600}
2597 2601
2598void CalendarView::newSubTodo(Todo *parentEvent) 2602void CalendarView::newSubTodo(Todo *parentEvent)
2599{ 2603{
2600 2604
2601 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2605 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2602 showTodoEditor(); 2606 showTodoEditor();
2603} 2607}
2604 2608
2605void CalendarView::newFloatingEvent() 2609void CalendarView::newFloatingEvent()
2606{ 2610{
2607 DateList tmpList = mNavigator->selectedDates(); 2611 DateList tmpList = mNavigator->selectedDates();
2608 QDate date = tmpList.first(); 2612 QDate date = tmpList.first();
2609 2613
2610 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2614 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2611 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2615 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2612} 2616}
2613 2617
2614 2618
2615void CalendarView::editEvent( Event *event ) 2619void CalendarView::editEvent( Event *event )
2616{ 2620{
2617 2621
2618 if ( !event ) return; 2622 if ( !event ) return;
2619 if ( event->isReadOnly() ) { 2623 if ( event->isReadOnly() ) {
2620 showEvent( event ); 2624 showEvent( event );
2621 return; 2625 return;
2622 } 2626 }
2623 mEventEditor->editEvent( event , mFlagEditDescription); 2627 mEventEditor->editEvent( event , mFlagEditDescription);
2624 showEventEditor(); 2628 showEventEditor();
2625} 2629}
2626void CalendarView::editJournal( Journal *jour ) 2630void CalendarView::editJournal( Journal *jour )
2627{ 2631{
2628 if ( !jour ) return; 2632 if ( !jour ) return;
2629 mDialogManager->hideSearchDialog(); 2633 mDialogManager->hideSearchDialog();
2630 mViewManager->showJournalView(); 2634 mViewManager->showJournalView();
2631 mNavigator->slotDaySelect( jour->dtStart().date() ); 2635 mNavigator->slotDaySelect( jour->dtStart().date() );
2632} 2636}
2633void CalendarView::editTodo( Todo *todo ) 2637void CalendarView::editTodo( Todo *todo )
2634{ 2638{
2635 if ( !todo ) return; 2639 if ( !todo ) return;
2636 2640
2637 if ( todo->isReadOnly() ) { 2641 if ( todo->isReadOnly() ) {
2638 showTodo( todo ); 2642 showTodo( todo );
2639 return; 2643 return;
2640 } 2644 }
2641 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2645 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2642 showTodoEditor(); 2646 showTodoEditor();
2643 2647
2644} 2648}
2645 2649
2646KOEventViewerDialog* CalendarView::getEventViewerDialog() 2650KOEventViewerDialog* CalendarView::getEventViewerDialog()
2647{ 2651{
2648 if ( !mEventViewerDialog ) { 2652 if ( !mEventViewerDialog ) {
2649 mEventViewerDialog = new KOEventViewerDialog(this); 2653 mEventViewerDialog = new KOEventViewerDialog(this);
2650 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2654 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2651 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2655 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2652 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2656 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2653 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2657 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2654 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2658 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2655 viewManager(), SLOT( showAgendaView( bool ) ) ); 2659 viewManager(), SLOT( showAgendaView( bool ) ) );
2656 mEventViewerDialog->resize( 640, 480 ); 2660 mEventViewerDialog->resize( 640, 480 );
2657 2661
2658 } 2662 }
2659 return mEventViewerDialog; 2663 return mEventViewerDialog;
2660} 2664}
2661void CalendarView::showEvent(Event *event) 2665void CalendarView::showEvent(Event *event)
2662{ 2666{
2663 getEventViewerDialog()->setEvent(event); 2667 getEventViewerDialog()->setEvent(event);
2664 getEventViewerDialog()->showMe(); 2668 getEventViewerDialog()->showMe();
2665} 2669}
2666 2670
2667void CalendarView::showTodo(Todo *event) 2671void CalendarView::showTodo(Todo *event)
2668{ 2672{
2669 getEventViewerDialog()->setTodo(event); 2673 getEventViewerDialog()->setTodo(event);
2670 getEventViewerDialog()->showMe(); 2674 getEventViewerDialog()->showMe();
2671} 2675}
2672void CalendarView::showJournal( Journal *jour ) 2676void CalendarView::showJournal( Journal *jour )
2673{ 2677{
2674 getEventViewerDialog()->setJournal(jour); 2678 getEventViewerDialog()->setJournal(jour);
2675 getEventViewerDialog()->showMe(); 2679 getEventViewerDialog()->showMe();
2676 2680
2677} 2681}
2678// void CalendarView::todoModified (Todo *event, int changed) 2682// void CalendarView::todoModified (Todo *event, int changed)
2679// { 2683// {
2680// // if (mDialogList.find (event) != mDialogList.end ()) { 2684// // if (mDialogList.find (event) != mDialogList.end ()) {
2681// // kdDebug() << "Todo modified and open" << endl; 2685// // kdDebug() << "Todo modified and open" << endl;
2682// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2686// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2683// // temp->modified (changed); 2687// // temp->modified (changed);
2684 2688
2685// // } 2689// // }
2686 2690
2687// mViewManager->updateView(); 2691// mViewManager->updateView();
2688// } 2692// }
2689 2693
2690void CalendarView::appointment_show() 2694void CalendarView::appointment_show()
2691{ 2695{
2692 Event *anEvent = 0; 2696 Event *anEvent = 0;
2693 2697
2694 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2698 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2695 2699
2696 if (mViewManager->currentView()->isEventView()) { 2700 if (mViewManager->currentView()->isEventView()) {
2697 if ( incidence && incidence->type() == "Event" ) { 2701 if ( incidence && incidence->type() == "Event" ) {
2698 anEvent = static_cast<Event *>(incidence); 2702 anEvent = static_cast<Event *>(incidence);
2699 } 2703 }
2700 } 2704 }
2701 2705
2702 if (!anEvent) { 2706 if (!anEvent) {
2703 KNotifyClient::beep(); 2707 KNotifyClient::beep();
2704 return; 2708 return;
2705 } 2709 }
2706 2710
2707 showEvent(anEvent); 2711 showEvent(anEvent);
2708} 2712}
2709 2713
2710void CalendarView::appointment_edit() 2714void CalendarView::appointment_edit()
2711{ 2715{
2712 Event *anEvent = 0; 2716 Event *anEvent = 0;
2713 2717
2714 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2718 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2715 2719
2716 if (mViewManager->currentView()->isEventView()) { 2720 if (mViewManager->currentView()->isEventView()) {
2717 if ( incidence && incidence->type() == "Event" ) { 2721 if ( incidence && incidence->type() == "Event" ) {
2718 anEvent = static_cast<Event *>(incidence); 2722 anEvent = static_cast<Event *>(incidence);
2719 } 2723 }
2720 } 2724 }
2721 2725
2722 if (!anEvent) { 2726 if (!anEvent) {
2723 KNotifyClient::beep(); 2727 KNotifyClient::beep();
2724 return; 2728 return;
2725 } 2729 }
2726 2730
2727 editEvent(anEvent); 2731 editEvent(anEvent);
2728} 2732}
2729 2733
2730void CalendarView::appointment_delete() 2734void CalendarView::appointment_delete()
2731{ 2735{
2732 Event *anEvent = 0; 2736 Event *anEvent = 0;
2733 2737
2734 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2738 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2735 2739
2736 if (mViewManager->currentView()->isEventView()) { 2740 if (mViewManager->currentView()->isEventView()) {
2737 if ( incidence && incidence->type() == "Event" ) { 2741 if ( incidence && incidence->type() == "Event" ) {
2738 anEvent = static_cast<Event *>(incidence); 2742 anEvent = static_cast<Event *>(incidence);
2739 } 2743 }
2740 } 2744 }
2741 2745
2742 if (!anEvent) { 2746 if (!anEvent) {
2743 KNotifyClient::beep(); 2747 KNotifyClient::beep();
2744 return; 2748 return;
2745 } 2749 }
2746 2750
2747 deleteEvent(anEvent); 2751 deleteEvent(anEvent);
2748} 2752}
2749 2753
2750void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2754void CalendarView::todo_resub( Todo * parent, Todo * sub )
2751{ 2755{
2752 if (!sub) return; 2756 if (!sub) return;
2753 if (!parent) return; 2757 if (!parent) return;
2754 if ( sub->relatedTo() ) 2758 if ( sub->relatedTo() )
2755 sub->relatedTo()->removeRelation(sub); 2759 sub->relatedTo()->removeRelation(sub);
2756 sub->setRelatedTo(parent); 2760 sub->setRelatedTo(parent);
2757 sub->setRelatedToUid(parent->uid()); 2761 sub->setRelatedToUid(parent->uid());
2758 parent->addRelation(sub); 2762 parent->addRelation(sub);
2759 sub->updated(); 2763 sub->updated();
2760 parent->updated(); 2764 parent->updated();
2761 setModified(true); 2765 setModified(true);
2762 updateView(); 2766 updateView();
2763} 2767}
2764void CalendarView::todo_unsub(Todo *anTodo ) 2768void CalendarView::todo_unsub(Todo *anTodo )
2765{ 2769{
2766 // Todo *anTodo = selectedTodo(); 2770 // Todo *anTodo = selectedTodo();
2767 if (!anTodo) return; 2771 if (!anTodo) return;
2768 if (!anTodo->relatedTo()) return; 2772 if (!anTodo->relatedTo()) return;
2769 anTodo->relatedTo()->removeRelation(anTodo); 2773 anTodo->relatedTo()->removeRelation(anTodo);
2770 anTodo->setRelatedTo(0); 2774 anTodo->setRelatedTo(0);
2771 anTodo->updated(); 2775 anTodo->updated();
2772 anTodo->setRelatedToUid(""); 2776 anTodo->setRelatedToUid("");
2773 setModified(true); 2777 setModified(true);
2774 updateView(); 2778 updateView();
2775} 2779}
2776 2780
2777void CalendarView::deleteTodo(Todo *todo) 2781void CalendarView::deleteTodo(Todo *todo)
2778{ 2782{
2779 if (!todo) { 2783 if (!todo) {
2780 KNotifyClient::beep(); 2784 KNotifyClient::beep();
2781 return; 2785 return;
2782 } 2786 }
2783 if (KOPrefs::instance()->mConfirm) { 2787 if (KOPrefs::instance()->mConfirm) {
2784 switch (msgItemDelete()) { 2788 switch (msgItemDelete()) {
2785 case KMessageBox::Continue: // OK 2789 case KMessageBox::Continue: // OK
2786 if (!todo->relations().isEmpty()) { 2790 if (!todo->relations().isEmpty()) {
2787 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2791 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2788 i18n("Delete To-Do")); 2792 i18n("Delete To-Do"));
2789 } else { 2793 } else {
2790 checkExternalId( todo ); 2794 checkExternalId( todo );
2791 calendar()->deleteTodo(todo); 2795 calendar()->deleteTodo(todo);
2792 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2796 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2793 updateView(); 2797 updateView();
2794 } 2798 }
2795 break; 2799 break;
2796 } // switch 2800 } // switch
2797 } else { 2801 } else {
2798 if (!todo->relations().isEmpty()) { 2802 if (!todo->relations().isEmpty()) {
2799 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2803 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2800 i18n("Delete To-Do")); 2804 i18n("Delete To-Do"));
2801 } else { 2805 } else {
2802 checkExternalId( todo ); 2806 checkExternalId( todo );
2803 mCalendar->deleteTodo(todo); 2807 mCalendar->deleteTodo(todo);
2804 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2808 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2805 updateView(); 2809 updateView();
2806 } 2810 }
2807 } 2811 }
2808 emit updateSearchDialog(); 2812 emit updateSearchDialog();
2809} 2813}
2810void CalendarView::deleteJournal(Journal *jour) 2814void CalendarView::deleteJournal(Journal *jour)
2811{ 2815{
2812 if (!jour) { 2816 if (!jour) {
2813 KNotifyClient::beep(); 2817 KNotifyClient::beep();
2814 return; 2818 return;
2815 } 2819 }
2816 if (KOPrefs::instance()->mConfirm) { 2820 if (KOPrefs::instance()->mConfirm) {
2817 switch (msgItemDelete()) { 2821 switch (msgItemDelete()) {
2818 case KMessageBox::Continue: // OK 2822 case KMessageBox::Continue: // OK
2819 calendar()->deleteJournal(jour); 2823 calendar()->deleteJournal(jour);
2820 updateView(); 2824 updateView();
2821 break; 2825 break;
2822 } // switch 2826 } // switch
2823 } else { 2827 } else {
2824 calendar()->deleteJournal(jour);; 2828 calendar()->deleteJournal(jour);;
2825 updateView(); 2829 updateView();
2826 } 2830 }
2827 emit updateSearchDialog(); 2831 emit updateSearchDialog();
2828} 2832}
2829 2833
2830void CalendarView::deleteEvent(Event *anEvent) 2834void CalendarView::deleteEvent(Event *anEvent)
2831{ 2835{
2832 if (!anEvent) { 2836 if (!anEvent) {
2833 KNotifyClient::beep(); 2837 KNotifyClient::beep();
2834 return; 2838 return;
2835 } 2839 }
2836 2840
2837 if (anEvent->recurrence()->doesRecur()) { 2841 if (anEvent->recurrence()->doesRecur()) {
2838 QDate itemDate = mViewManager->currentSelectionDate(); 2842 QDate itemDate = mViewManager->currentSelectionDate();
2839 int km; 2843 int km;
2840 if (!itemDate.isValid()) { 2844 if (!itemDate.isValid()) {
2841 //kdDebug() << "Date Not Valid" << endl; 2845 //kdDebug() << "Date Not Valid" << endl;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 1cd896d..2818ee9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,604 +1,605 @@
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#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45#include <ksyncmanager.h> 45#include <ksyncmanager.h>
46 46
47class QWidgetStack; 47class QWidgetStack;
48class QSplitter; 48class QSplitter;
49 49
50class CalPrinter; 50class CalPrinter;
51class KOFilterView; 51class KOFilterView;
52class KOViewManager; 52class KOViewManager;
53class KODialogManager; 53class KODialogManager;
54class KOTodoView; 54class KOTodoView;
55class KDateNavigator; 55class KDateNavigator;
56class DateNavigator; 56class DateNavigator;
57class KOIncidenceEditor; 57class KOIncidenceEditor;
58class KDatePicker; 58class KDatePicker;
59class ResourceView; 59class ResourceView;
60class NavigatorBar; 60class NavigatorBar;
61class KOEventEditor; 61class KOEventEditor;
62class KOTodoEditor ; 62class KOTodoEditor ;
63class KOEventViewerDialog; 63class KOEventViewerDialog;
64class KOBeamPrefs; 64class KOBeamPrefs;
65class KSyncProfile; 65class KSyncProfile;
66class AlarmDialog; 66class AlarmDialog;
67class KCal::Attendee; 67class KCal::Attendee;
68 68
69namespace KCal { class FileStorage; } 69namespace KCal { class FileStorage; }
70 70
71using namespace KCal; 71using namespace KCal;
72 72
73/** 73/**
74 This is the main calendar widget. It provides the different vies on t he 74 This is the main calendar widget. It provides the different vies on t he
75 calendar data as well as the date navigator. It also handles synchronisation 75 calendar data as well as the date navigator. It also handles synchronisation
76 of the different views and controls the different dialogs like preferences, 76 of the different views and controls the different dialogs like preferences,
77 event editor, search dialog etc. 77 event editor, search dialog etc.
78 78
79 @short main calendar view widget 79 @short main calendar view widget
80 @author Cornelius Schumacher 80 @author Cornelius Schumacher
81*/ 81*/
82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
83{ 83{
84 Q_OBJECT 84 Q_OBJECT
85 public: 85 public:
86 /** 86 /**
87 Constructs a new calendar view widget. 87 Constructs a new calendar view widget.
88 88
89 @param calendar calendar document 89 @param calendar calendar document
90 @param parent parent window 90 @param parent parent window
91 @param name Qt internal widget object name 91 @param name Qt internal widget object name
92 */ 92 */
93 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 93 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 94 const char *name = 0 );
95 CalendarView( Calendar *calendar, QWidget *parent = 0, 95 CalendarView( Calendar *calendar, QWidget *parent = 0,
96 const char *name = 0 ); 96 const char *name = 0 );
97 virtual ~CalendarView(); 97 virtual ~CalendarView();
98 98
99 Calendar *calendar() { return mCalendar; } 99 Calendar *calendar() { return mCalendar; }
100 100
101 KOViewManager *viewManager(); 101 KOViewManager *viewManager();
102 KODialogManager *dialogManager(); 102 KODialogManager *dialogManager();
103 103
104 QDate startDate(); 104 QDate startDate();
105 QDate endDate(); 105 QDate endDate();
106 106
107 QWidgetStack *viewStack(); 107 QWidgetStack *viewStack();
108 QWidget *leftFrame(); 108 QWidget *leftFrame();
109 NavigatorBar *navigatorBar(); 109 NavigatorBar *navigatorBar();
110 110
111 DateNavigator *dateNavigator(); 111 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 112 KDateNavigator *dateNavigatorWidget();
113 113
114 void addView(KOrg::BaseView *); 114 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 115 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 116 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 117 Incidence *currentSelection();
118 118
119 signals: 119 signals:
120 void tempDisableBR(bool);
120 /** This todo has been modified */ 121 /** This todo has been modified */
121 void todoModified(Todo *, int); 122 void todoModified(Todo *, int);
122 123
123 /** when change is made to options dialog, the topwidget will catch this 124 /** when change is made to options dialog, the topwidget will catch this
124 * and emit this signal which notifies all widgets which have registered 125 * and emit this signal which notifies all widgets which have registered
125 * for notification to update their settings. */ 126 * for notification to update their settings. */
126 void configChanged(); 127 void configChanged();
127 /** emitted when the topwidget is closing down, so that any attached 128 /** emitted when the topwidget is closing down, so that any attached
128 child windows can also close. */ 129 child windows can also close. */
129 void closingDown(); 130 void closingDown();
130 /** emitted right before we die */ 131 /** emitted right before we die */
131 void closed(QWidget *); 132 void closed(QWidget *);
132 133
133 /** Emitted when state of modified flag changes */ 134 /** Emitted when state of modified flag changes */
134 void modifiedChanged(bool); 135 void modifiedChanged(bool);
135 void signalmodified(); 136 void signalmodified();
136 137
137 /** Emitted when state of read-only flag changes */ 138 /** Emitted when state of read-only flag changes */
138 void readOnlyChanged(bool); 139 void readOnlyChanged(bool);
139 140
140 /** Emitted when the unit of navigation changes */ 141 /** Emitted when the unit of navigation changes */
141 void changeNavStringPrev(const QString &); 142 void changeNavStringPrev(const QString &);
142 void changeNavStringNext(const QString &); 143 void changeNavStringNext(const QString &);
143 144
144 /** Emitted when state of events selection has changed and user is organizer*/ 145 /** Emitted when state of events selection has changed and user is organizer*/
145 void organizerEventsSelected(bool); 146 void organizerEventsSelected(bool);
146 /** Emitted when state of events selection has changed and user is attendee*/ 147 /** Emitted when state of events selection has changed and user is attendee*/
147 void groupEventsSelected(bool); 148 void groupEventsSelected(bool);
148 /** 149 /**
149 Emitted when an incidence gets selected. If the selection is cleared the 150 Emitted when an incidence gets selected. If the selection is cleared the
150 signal is emitted with 0 as argument. 151 signal is emitted with 0 as argument.
151 */ 152 */
152 void incidenceSelected( Incidence * ); 153 void incidenceSelected( Incidence * );
153 /** Emitted, when a todoitem is selected or deselected. */ 154 /** Emitted, when a todoitem is selected or deselected. */
154 void todoSelected( bool ); 155 void todoSelected( bool );
155 156
156 /** 157 /**
157 Emitted, when clipboard content changes. Parameter indicates if paste 158 Emitted, when clipboard content changes. Parameter indicates if paste
158 is possible or not. 159 is possible or not.
159 */ 160 */
160 void pasteEnabled(bool); 161 void pasteEnabled(bool);
161 162
162 /** Emitted, when the number of incoming messages has changed. */ 163 /** Emitted, when the number of incoming messages has changed. */
163 void numIncomingChanged(int); 164 void numIncomingChanged(int);
164 165
165 /** Emitted, when the number of outgoing messages has changed. */ 166 /** Emitted, when the number of outgoing messages has changed. */
166 void numOutgoingChanged(int); 167 void numOutgoingChanged(int);
167 168
168 /** Send status message, which can e.g. be displayed in the status bar. */ 169 /** Send status message, which can e.g. be displayed in the status bar. */
169 void statusMessage(const QString &); 170 void statusMessage(const QString &);
170 171
171 void calendarViewExpanded( bool ); 172 void calendarViewExpanded( bool );
172 void updateSearchDialog(); 173 void updateSearchDialog();
173 174
174 175
175 public slots: 176 public slots:
176 void showOpenError(); 177 void showOpenError();
177 void watchSavedFile(); 178 void watchSavedFile();
178 void recheckTimerAlarm(); 179 void recheckTimerAlarm();
179 void checkNextTimerAlarm(); 180 void checkNextTimerAlarm();
180 void addAlarm(const QDateTime &qdt, const QString &noti ); 181 void addAlarm(const QDateTime &qdt, const QString &noti );
181 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 182 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
182 void removeAlarm(const QDateTime &qdt, const QString &noti ); 183 void removeAlarm(const QDateTime &qdt, const QString &noti );
183 184
184 /** options dialog made a changed to the configuration. we catch this 185 /** options dialog made a changed to the configuration. we catch this
185 * and notify all widgets which need to update their configuration. */ 186 * and notify all widgets which need to update their configuration. */
186 void updateConfig(); 187 void updateConfig();
187 188
188 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 189 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
189 const QStringList& anniversaryList, const QStringList& realNameList, 190 const QStringList& anniversaryList, const QStringList& realNameList,
190 const QStringList& emailList, const QStringList& assembledNameList, 191 const QStringList& emailList, const QStringList& assembledNameList,
191 const QStringList& uidList); 192 const QStringList& uidList);
192 193
193 /** 194 /**
194 Load calendar from file \a filename. If \a merge is true, load 195 Load calendar from file \a filename. If \a merge is true, load
195 calendar into existing one, if it is false, clear calendar, before 196 calendar into existing one, if it is false, clear calendar, before
196 loading. Return true, if calendar could be successfully loaded. 197 loading. Return true, if calendar could be successfully loaded.
197 */ 198 */
198 bool openCalendar(QString filename, bool merge=false); 199 bool openCalendar(QString filename, bool merge=false);
199 bool syncCalendar(QString filename,int mode = 0 ); 200 bool syncCalendar(QString filename,int mode = 0 );
200 201
201 /** 202 /**
202 Save calendar data to file. Return true if calendar could be 203 Save calendar data to file. Return true if calendar could be
203 successfully saved. 204 successfully saved.
204 */ 205 */
205 bool saveCalendar(QString filename); 206 bool saveCalendar(QString filename);
206 207
207 /** 208 /**
208 Close calendar. Clear calendar data and reset views to display an empty 209 Close calendar. Clear calendar data and reset views to display an empty
209 calendar. 210 calendar.
210 */ 211 */
211 void closeCalendar(); 212 void closeCalendar();
212 213
213 /** Archive old events of calendar */ 214 /** Archive old events of calendar */
214 void archiveCalendar(); 215 void archiveCalendar();
215 216
216 void showIncidence(); 217 void showIncidence();
217 void editIncidence(); 218 void editIncidence();
218 void editIncidenceDescription(); 219 void editIncidenceDescription();
219 void deleteIncidence(); 220 void deleteIncidence();
220 void cloneIncidence(); 221 void cloneIncidence();
221 void moveIncidence(); 222 void moveIncidence();
222 void beamIncidence(); 223 void beamIncidence();
223 void toggleCancelIncidence(); 224 void toggleCancelIncidence();
224 225
225 /** create an editeventwin with supplied date/time, and if bool is true, 226 /** create an editeventwin with supplied date/time, and if bool is true,
226 * make the event take all day. */ 227 * make the event take all day. */
227 void newEvent(QDateTime, QDateTime, bool allDay = false); 228 void newEvent(QDateTime, QDateTime, bool allDay = false);
228 void newEvent(QDateTime fh); 229 void newEvent(QDateTime fh);
229 void newEvent(QDate dt); 230 void newEvent(QDate dt);
230 /** create new event without having a date hint. Takes current date as 231 /** create new event without having a date hint. Takes current date as
231 default hint. */ 232 default hint. */
232 void newEvent(); 233 void newEvent();
233 void newFloatingEvent(); 234 void newFloatingEvent();
234 235
235 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 236 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
236 void showIncidence(Incidence *); 237 void showIncidence(Incidence *);
237 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 238 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
238 void editIncidence(Incidence *); 239 void editIncidence(Incidence *);
239 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 240 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
240 void deleteIncidence(Incidence *); 241 void deleteIncidence(Incidence *);
241 void cloneIncidence(Incidence *); 242 void cloneIncidence(Incidence *);
242 void cancelIncidence(Incidence *); 243 void cancelIncidence(Incidence *);
243 /** Create an editor for the supplied event. */ 244 /** Create an editor for the supplied event. */
244 void editEvent(Event *); 245 void editEvent(Event *);
245 /** Delete the supplied event. */ 246 /** Delete the supplied event. */
246 void deleteEvent(Event *); 247 void deleteEvent(Event *);
247 /** Delete the event with the given unique ID. Returns false, if event wasn't 248 /** Delete the event with the given unique ID. Returns false, if event wasn't
248 found. */ 249 found. */
249 bool deleteEvent(const QString &uid); 250 bool deleteEvent(const QString &uid);
250 /** Create a read-only viewer dialog for the supplied event. */ 251 /** Create a read-only viewer dialog for the supplied event. */
251 void showEvent(Event *); 252 void showEvent(Event *);
252 253
253 void editJournal(Journal *); 254 void editJournal(Journal *);
254 void showJournal(Journal *); 255 void showJournal(Journal *);
255 void deleteJournal(Journal *); 256 void deleteJournal(Journal *);
256 /** Create an editor dialog for a todo */ 257 /** Create an editor dialog for a todo */
257 void editTodo(Todo *); 258 void editTodo(Todo *);
258 /** Create a read-only viewer dialog for the supplied todo */ 259 /** Create a read-only viewer dialog for the supplied todo */
259 void showTodo(Todo *); 260 void showTodo(Todo *);
260 /** create new todo */ 261 /** create new todo */
261 void newTodo(); 262 void newTodo();
262 /** create new todo with a parent todo */ 263 /** create new todo with a parent todo */
263 void newSubTodo(); 264 void newSubTodo();
264 /** create new todo with a parent todo */ 265 /** create new todo with a parent todo */
265 void newSubTodo(Todo *); 266 void newSubTodo(Todo *);
266 /** Delete todo */ 267 /** Delete todo */
267 void deleteTodo(Todo *); 268 void deleteTodo(Todo *);
268 269
269 270
270 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 271 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
271 * emitted as result. */ 272 * emitted as result. */
272 void checkClipboard(); 273 void checkClipboard();
273 274
274 /** using the KConfig associated with the kapp variable, read in the 275 /** using the KConfig associated with the kapp variable, read in the
275 * settings from the config file. 276 * settings from the config file.
276 */ 277 */
277 void readSettings(); 278 void readSettings();
278 279
279 /** write current state to config file. */ 280 /** write current state to config file. */
280 void writeSettings(); 281 void writeSettings();
281 282
282 /** read settings for calendar filters */ 283 /** read settings for calendar filters */
283 void readFilterSettings(KConfig *config); 284 void readFilterSettings(KConfig *config);
284 285
285 /** write settings for calendar filters */ 286 /** write settings for calendar filters */
286 void writeFilterSettings(KConfig *config); 287 void writeFilterSettings(KConfig *config);
287 288
288 /** passes on the message that an event has changed to the currently 289 /** passes on the message that an event has changed to the currently
289 * activated view so that it can make appropriate display changes. */ 290 * activated view so that it can make appropriate display changes. */
290 void changeEventDisplay(Event *, int); 291 void changeEventDisplay(Event *, int);
291 void changeIncidenceDisplay(Incidence *, int); 292 void changeIncidenceDisplay(Incidence *, int);
292 void changeTodoDisplay(Todo *, int); 293 void changeTodoDisplay(Todo *, int);
293 294
294 void eventAdded(Event *); 295 void eventAdded(Event *);
295 void eventChanged(Event *); 296 void eventChanged(Event *);
296 void eventToBeDeleted(Event *); 297 void eventToBeDeleted(Event *);
297 void eventDeleted(); 298 void eventDeleted();
298 299
299 void todoAdded(Todo *); 300 void todoAdded(Todo *);
300 void todoChanged(Todo *); 301 void todoChanged(Todo *);
301 void todoToBeDeleted(Todo *); 302 void todoToBeDeleted(Todo *);
302 void todoDeleted(); 303 void todoDeleted();
303 304
304 void updateView(const QDate &start, const QDate &end); 305 void updateView(const QDate &start, const QDate &end);
305 void updateView(); 306 void updateView();
306 307
307 /** Full update of visible todo views */ 308 /** Full update of visible todo views */
308 void updateTodoViews(); 309 void updateTodoViews();
309 310
310 void updateUnmanagedViews(); 311 void updateUnmanagedViews();
311 312
312 /** cut the current appointment to the clipboard */ 313 /** cut the current appointment to the clipboard */
313 void edit_cut(); 314 void edit_cut();
314 315
315 /** copy the current appointment(s) to the clipboard */ 316 /** copy the current appointment(s) to the clipboard */
316 void edit_copy(); 317 void edit_copy();
317 318
318 /** paste the current vobject(s) in the clipboard buffer into calendar */ 319 /** paste the current vobject(s) in the clipboard buffer into calendar */
319 void edit_paste(); 320 void edit_paste();
320 321
321 /** edit viewing and configuration options. */ 322 /** edit viewing and configuration options. */
322 void edit_options(); 323 void edit_options();
323 /** 324 /**
324 Functions for printing, previewing a print, and setting up printing 325 Functions for printing, previewing a print, and setting up printing
325 parameters. 326 parameters.
326 */ 327 */
327 void print(); 328 void print();
328 void printSetup(); 329 void printSetup();
329 void printPreview(); 330 void printPreview();
330 331
331 /** Export as iCalendar file */ 332 /** Export as iCalendar file */
332 void exportICalendar(); 333 void exportICalendar();
333 334
334 /** Export as vCalendar file */ 335 /** Export as vCalendar file */
335 bool exportVCalendar( QString fn); 336 bool exportVCalendar( QString fn);
336 337
337 /** pop up a dialog to show an existing appointment. */ 338 /** pop up a dialog to show an existing appointment. */
338 void appointment_show(); 339 void appointment_show();
339 /** 340 /**
340 * pop up an Appointment Dialog to edit an existing appointment.Get 341 * pop up an Appointment Dialog to edit an existing appointment.Get
341 * information on the appointment from the list of unique IDs that is 342 * information on the appointment from the list of unique IDs that is
342 * currently in the View, called currIds. 343 * currently in the View, called currIds.
343 */ 344 */
344 void appointment_edit(); 345 void appointment_edit();
345 /** 346 /**
346 * pop up dialog confirming deletion of currently selected event in the 347 * pop up dialog confirming deletion of currently selected event in the
347 * View. 348 * View.
348 */ 349 */
349 void appointment_delete(); 350 void appointment_delete();
350 351
351 /** mails the currently selected event to a particular user as a vCalendar 352 /** mails the currently selected event to a particular user as a vCalendar
352 attachment. */ 353 attachment. */
353 void action_mail(); 354 void action_mail();
354 355
355 /* frees a subtodo from it's relation */ 356 /* frees a subtodo from it's relation */
356 void todo_unsub( Todo * ); 357 void todo_unsub( Todo * );
357 void todo_resub( Todo * parent, Todo * sub ); 358 void todo_resub( Todo * parent, Todo * sub );
358 359
359 /** Take ownership of selected event. */ 360 /** Take ownership of selected event. */
360 void takeOverEvent(); 361 void takeOverEvent();
361 362
362 /** Take ownership of all events in calendar. */ 363 /** Take ownership of all events in calendar. */
363 void takeOverCalendar(); 364 void takeOverCalendar();
364 365
365 /** query whether or not the calendar is "dirty". */ 366 /** query whether or not the calendar is "dirty". */
366 bool isModified(); 367 bool isModified();
367 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 368 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
368 void setModified(bool modified=true); 369 void setModified(bool modified=true);
369 370
370 /** query if the calendar is read-only. */ 371 /** query if the calendar is read-only. */
371 bool isReadOnly(); 372 bool isReadOnly();
372 /** set state of calendar to read-only */ 373 /** set state of calendar to read-only */
373 void setReadOnly(bool readOnly=true); 374 void setReadOnly(bool readOnly=true);
374 375
375 void eventUpdated(Incidence *); 376 void eventUpdated(Incidence *);
376 377
377 /* iTIP scheduling actions */ 378 /* iTIP scheduling actions */
378 void schedule_publish(Incidence *incidence = 0); 379 void schedule_publish(Incidence *incidence = 0);
379 void schedule_request(Incidence *incidence = 0); 380 void schedule_request(Incidence *incidence = 0);
380 void schedule_refresh(Incidence *incidence = 0); 381 void schedule_refresh(Incidence *incidence = 0);
381 void schedule_cancel(Incidence *incidence = 0); 382 void schedule_cancel(Incidence *incidence = 0);
382 void schedule_add(Incidence *incidence = 0); 383 void schedule_add(Incidence *incidence = 0);
383 void schedule_reply(Incidence *incidence = 0); 384 void schedule_reply(Incidence *incidence = 0);
384 void schedule_counter(Incidence *incidence = 0); 385 void schedule_counter(Incidence *incidence = 0);
385 void schedule_declinecounter(Incidence *incidence = 0); 386 void schedule_declinecounter(Incidence *incidence = 0);
386 void schedule_publish_freebusy(int daysToPublish = 30); 387 void schedule_publish_freebusy(int daysToPublish = 30);
387 388
388 void openAddressbook(); 389 void openAddressbook();
389 390
390 void editFilters(); 391 void editFilters();
391 void toggleFilerEnabled(); 392 void toggleFilerEnabled();
392 QPtrList<CalFilter> filters(); 393 QPtrList<CalFilter> filters();
393 void toggleFilter(); 394 void toggleFilter();
394 void showFilter(bool visible); 395 void showFilter(bool visible);
395 void updateFilter(); 396 void updateFilter();
396 void filterEdited(); 397 void filterEdited();
397 void selectFilter( int ); 398 void selectFilter( int );
398 KOFilterView *filterView(); 399 KOFilterView *filterView();
399 400
400 void showIntro(); 401 void showIntro();
401 402
402 /** Move the curdatepient view date to today */ 403 /** Move the curdatepient view date to today */
403 void goToday(); 404 void goToday();
404 405
405 /** Move to the next date(s) in the current view */ 406 /** Move to the next date(s) in the current view */
406 void goNext(); 407 void goNext();
407 408
408 /** Move to the previous date(s) in the current view */ 409 /** Move to the previous date(s) in the current view */
409 void goPrevious(); 410 void goPrevious();
410 /** Move to the next date(s) in the current view */ 411 /** Move to the next date(s) in the current view */
411 void goNextMonth(); 412 void goNextMonth();
412 413
413 /** Move to the previous date(s) in the current view */ 414 /** Move to the previous date(s) in the current view */
414 void goPreviousMonth(); 415 void goPreviousMonth();
415 416
416 void toggleExpand(); 417 void toggleExpand();
417 void toggleDateNavigatorWidget(); 418 void toggleDateNavigatorWidget();
418 void toggleAllDaySize(); 419 void toggleAllDaySize();
419 void dialogClosing(Incidence *); 420 void dialogClosing(Incidence *);
420 421
421 /** Look for new messages in the inbox */ 422 /** Look for new messages in the inbox */
422 void lookForIncomingMessages(); 423 void lookForIncomingMessages();
423 /** Look for new messages in the outbox */ 424 /** Look for new messages in the outbox */
424 void lookForOutgoingMessages(); 425 void lookForOutgoingMessages();
425 426
426 void processMainViewSelection( Incidence * ); 427 void processMainViewSelection( Incidence * );
427 void processTodoListSelection( Incidence * ); 428 void processTodoListSelection( Incidence * );
428 429
429 void processIncidenceSelection( Incidence * ); 430 void processIncidenceSelection( Incidence * );
430 431
431 void purgeCompleted(); 432 void purgeCompleted();
432 bool removeCompletedSubTodos( Todo* ); 433 bool removeCompletedSubTodos( Todo* );
433 void slotCalendarChanged(); 434 void slotCalendarChanged();
434 bool importBday(); 435 bool importBday();
435 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 436 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
436 bool importQtopia( const QString &categoriesFile, 437 bool importQtopia( const QString &categoriesFile,
437 const QString &datebookFile, 438 const QString &datebookFile,
438 const QString &tasklistFile ); 439 const QString &tasklistFile );
439 void syncExternal( int mode ); 440 void syncExternal( int mode );
440 void slotSelectPickerDate( QDate ) ; 441 void slotSelectPickerDate( QDate ) ;
441 void showDatePicker( ) ; 442 void showDatePicker( ) ;
442 void moveIncidence(Incidence *) ; 443 void moveIncidence(Incidence *) ;
443 void beamIncidence(Incidence *) ; 444 void beamIncidence(Incidence *) ;
444 void beamCalendar() ; 445 void beamCalendar() ;
445 void beamFilteredCalendar() ; 446 void beamFilteredCalendar() ;
446 void beamIncidenceList(QPtrList<Incidence>) ; 447 void beamIncidenceList(QPtrList<Incidence>) ;
447 void manageCategories(); 448 void manageCategories();
448 int addCategories(); 449 int addCategories();
449 void removeCategories(); 450 void removeCategories();
450 void setSyncDevice( QString ); 451 void setSyncDevice( QString );
451 void setSyncName( QString ); 452 void setSyncName( QString );
452 protected slots: 453 protected slots:
453 void timerAlarm(); 454 void timerAlarm();
454 void suspendAlarm(); 455 void suspendAlarm();
455 void beamDone( Ir *ir ); 456 void beamDone( Ir *ir );
456 /** Select a view or adapt the current view to display the specified dates. */ 457 /** Select a view or adapt the current view to display the specified dates. */
457 void showDates( const KCal::DateList & ); 458 void showDates( const KCal::DateList & );
458 void selectWeekNum ( int ); 459 void selectWeekNum ( int );
459 460
460 public: 461 public:
461 // show a standard warning 462 // show a standard warning
462 // returns KMsgBox::yesNoCancel() 463 // returns KMsgBox::yesNoCancel()
463 int msgCalModified(); 464 int msgCalModified();
464 virtual bool sync(KSyncManager* manager, QString filename, int mode); 465 virtual bool sync(KSyncManager* manager, QString filename, int mode);
465 466
466 virtual bool syncExternal(KSyncManager* manager, QString resource); 467 virtual bool syncExternal(KSyncManager* manager, QString resource);
467 void setSyncManager(KSyncManager* manager); 468 void setSyncManager(KSyncManager* manager);
468 void setLoadedFileVersion(QDateTime); 469 void setLoadedFileVersion(QDateTime);
469 bool checkFileVersion(QString fn); 470 bool checkFileVersion(QString fn);
470 bool checkFileChanged(QString fn); 471 bool checkFileChanged(QString fn);
471 Event* getLastSyncEvent(); 472 Event* getLastSyncEvent();
472 /** Adapt navigation units correpsonding to step size of navigation of the 473 /** Adapt navigation units correpsonding to step size of navigation of the
473 * current view. 474 * current view.
474 */ 475 */
475 void adaptNavigationUnits(); 476 void adaptNavigationUnits();
476 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 477 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
477 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 478 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
478 //Attendee* getYourAttendee(Event *event); 479 //Attendee* getYourAttendee(Event *event);
479 protected: 480 protected:
480 void schedule(Scheduler::Method, Incidence *incidence = 0); 481 void schedule(Scheduler::Method, Incidence *incidence = 0);
481 482
482 // returns KMsgBox::OKCandel() 483 // returns KMsgBox::OKCandel()
483 int msgItemDelete(); 484 int msgItemDelete();
484 void showEventEditor(); 485 void showEventEditor();
485 void showTodoEditor(); 486 void showTodoEditor();
486 void writeLocale(); 487 void writeLocale();
487 Todo *selectedTodo(); 488 Todo *selectedTodo();
488 489
489 private: 490 private:
490 bool mSyncKDE; 491 bool mSyncKDE;
491 KSyncManager* mSyncManager; 492 KSyncManager* mSyncManager;
492 AlarmDialog * mAlarmDialog; 493 AlarmDialog * mAlarmDialog;
493 QString mAlarmNotification; 494 QString mAlarmNotification;
494 QString mSuspendAlarmNotification; 495 QString mSuspendAlarmNotification;
495 QTimer* mSuspendTimer; 496 QTimer* mSuspendTimer;
496 QTimer* mAlarmTimer; 497 QTimer* mAlarmTimer;
497 QTimer* mRecheckAlarmTimer; 498 QTimer* mRecheckAlarmTimer;
498 void computeAlarm( QString ); 499 void computeAlarm( QString );
499 void startAlarm( QString, QString ); 500 void startAlarm( QString, QString );
500 void setSyncEventsReadOnly(); 501 void setSyncEventsReadOnly();
501 502
502 QDateTime loadedFileVersion; 503 QDateTime loadedFileVersion;
503 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 504 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
504 void checkExternalId( Incidence * inc ); 505 void checkExternalId( Incidence * inc );
505 int mGlobalSyncMode; 506 int mGlobalSyncMode;
506 QString mCurrentSyncDevice; 507 QString mCurrentSyncDevice;
507 QString mCurrentSyncName; 508 QString mCurrentSyncName;
508 KOBeamPrefs* beamDialog; 509 KOBeamPrefs* beamDialog;
509 void init(); 510 void init();
510 int mDatePickerMode; 511 int mDatePickerMode;
511 bool mFlagEditDescription; 512 bool mFlagEditDescription;
512 QDateTime mLastCalendarSync; 513 QDateTime mLastCalendarSync;
513 void createPrinter(); 514 void createPrinter();
514 515
515 void calendarModified( bool, Calendar * ); 516 void calendarModified( bool, Calendar * );
516 517
517 CalPrinter *mCalPrinter; 518 CalPrinter *mCalPrinter;
518 519
519 QSplitter *mPanner; 520 QSplitter *mPanner;
520 QSplitter *mLeftSplitter; 521 QSplitter *mLeftSplitter;
521 QWidget *mLeftFrame; 522 QWidget *mLeftFrame;
522 QWidgetStack *mRightFrame; 523 QWidgetStack *mRightFrame;
523 524
524 KDatePicker* mDatePicker; 525 KDatePicker* mDatePicker;
525 QVBox* mDateFrame; 526 QVBox* mDateFrame;
526 NavigatorBar *mNavigatorBar; 527 NavigatorBar *mNavigatorBar;
527 528
528 KDateNavigator *mDateNavigator; // widget showing small month view. 529 KDateNavigator *mDateNavigator; // widget showing small month view.
529 530
530 KOFilterView *mFilterView; 531 KOFilterView *mFilterView;
531 532
532 ResourceView *mResourceView; 533 ResourceView *mResourceView;
533 534
534 // calendar object for this viewing instance 535 // calendar object for this viewing instance
535 Calendar *mCalendar; 536 Calendar *mCalendar;
536 537
537 CalendarResourceManager *mResourceManager; 538 CalendarResourceManager *mResourceManager;
538 539
539 FileStorage *mStorage; 540 FileStorage *mStorage;
540 541
541 DateNavigator *mNavigator; 542 DateNavigator *mNavigator;
542 543
543 KOViewManager *mViewManager; 544 KOViewManager *mViewManager;
544 KODialogManager *mDialogManager; 545 KODialogManager *mDialogManager;
545 546
546 // Calendar filters 547 // Calendar filters
547 QPtrList<CalFilter> mFilters; 548 QPtrList<CalFilter> mFilters;
548 549
549 // various housekeeping variables. 550 // various housekeeping variables.
550 bool mModified; // flag indicating if calendar is modified 551 bool mModified; // flag indicating if calendar is modified
551 bool mReadOnly; // flag indicating if calendar is read-only 552 bool mReadOnly; // flag indicating if calendar is read-only
552 QDate mSaveSingleDate; 553 QDate mSaveSingleDate;
553 554
554 Incidence *mSelectedIncidence; 555 Incidence *mSelectedIncidence;
555 Incidence *mMoveIncidence; 556 Incidence *mMoveIncidence;
556 KOTodoView *mTodoList; 557 KOTodoView *mTodoList;
557 KOEventEditor * mEventEditor; 558 KOEventEditor * mEventEditor;
558 KOTodoEditor * mTodoEditor; 559 KOTodoEditor * mTodoEditor;
559 KOEventViewerDialog * mEventViewerDialog; 560 KOEventViewerDialog * mEventViewerDialog;
560 void keyPressEvent ( QKeyEvent *e) ; 561 void keyPressEvent ( QKeyEvent *e) ;
561 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 562 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
562}; 563};
563 564
564 565
565class CalendarViewVisitor : public Incidence::Visitor 566class CalendarViewVisitor : public Incidence::Visitor
566{ 567{
567 public: 568 public:
568 CalendarViewVisitor() : mView( 0 ) {} 569 CalendarViewVisitor() : mView( 0 ) {}
569 570
570 bool act( Incidence *incidence, CalendarView *view ) 571 bool act( Incidence *incidence, CalendarView *view )
571 { 572 {
572 mView = view; 573 mView = view;
573 return incidence->accept( *this ); 574 return incidence->accept( *this );
574 } 575 }
575 576
576 protected: 577 protected:
577 CalendarView *mView; 578 CalendarView *mView;
578}; 579};
579 580
580class ShowIncidenceVisitor : public CalendarViewVisitor 581class ShowIncidenceVisitor : public CalendarViewVisitor
581{ 582{
582 protected: 583 protected:
583 bool visit( Event *event ) { mView->showEvent( event ); return true; } 584 bool visit( Event *event ) { mView->showEvent( event ); return true; }
584 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 585 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
585 bool visit( Journal * j ) { mView->showJournal( j );return true; } 586 bool visit( Journal * j ) { mView->showJournal( j );return true; }
586}; 587};
587 588
588class EditIncidenceVisitor : public CalendarViewVisitor 589class EditIncidenceVisitor : public CalendarViewVisitor
589{ 590{
590 protected: 591 protected:
591 bool visit( Event *event ) { mView->editEvent( event ); return true; } 592 bool visit( Event *event ) { mView->editEvent( event ); return true; }
592 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 593 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
593 bool visit( Journal *j ) { mView->editJournal( j); return true; } 594 bool visit( Journal *j ) { mView->editJournal( j); return true; }
594}; 595};
595 596
596class DeleteIncidenceVisitor : public CalendarViewVisitor 597class DeleteIncidenceVisitor : public CalendarViewVisitor
597{ 598{
598 protected: 599 protected:
599 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 600 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
600 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 601 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
601 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 602 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
602}; 603};
603 604
604#endif 605#endif
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 16186c0..c8a55d2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,108 +1,104 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#endif 14#endif
15 15
16#include <qdir.h> 16#include <qdir.h>
17#include <kstandarddirs.h> 17#include <kstandarddirs.h>
18#include <kglobal.h> 18#include <kglobal.h>
19#include <stdio.h> 19#include <stdio.h>
20#include "mainwindow.h" 20#include "mainwindow.h"
21 21
22int main( int argc, char **argv ) 22int main( int argc, char **argv )
23{ 23{
24#ifndef DESKTOP_VERSION 24#ifndef DESKTOP_VERSION
25 QPEApplication a( argc, argv ); 25 QPEApplication a( argc, argv );
26 a.setKeepRunning (); 26 a.setKeepRunning ();
27#else 27#else
28 QApplication a( argc, argv ); 28 QApplication a( argc, argv );
29 QApplication::setStyle( new QPlatinumStyle ()); 29 QApplication::setStyle( new QPlatinumStyle ());
30 QString hdir = QDir::homeDirPath(); 30 QString hdir = QDir::homeDirPath();
31 // there is a bug when creating dirs for WIN 98 31 // there is a bug when creating dirs for WIN 98
32 // it is difficult to fix, because we have no WIN 98 runnung 32 // it is difficult to fix, because we have no WIN 98 runnung
33 // such that we try it to create the dirs at startup here 33 // such that we try it to create the dirs at startup here
34 if ( hdir == "C:\\" ) { // win 98 or ME 34 if ( hdir == "C:\\" ) { // win 98 or ME
35 QDir app_dir; 35 QDir app_dir;
36 if ( !app_dir.exists("C:\\kdepim") ) 36 if ( !app_dir.exists("C:\\kdepim") )
37 app_dir.mkdir ("C:\\kdepim"); 37 app_dir.mkdir ("C:\\kdepim");
38 if ( !app_dir.exists("C:\\kdepim\\apps") ) 38 if ( !app_dir.exists("C:\\kdepim\\apps") )
39 app_dir.mkdir ("C:\\kdepim\\apps"); 39 app_dir.mkdir ("C:\\kdepim\\apps");
40 if ( !app_dir.exists("C:\\kdepim\\config") ) 40 if ( !app_dir.exists("C:\\kdepim\\config") )
41 app_dir.mkdir ("C:\\kdepim\\config"); 41 app_dir.mkdir ("C:\\kdepim\\config");
42 if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) 42 if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") )
43 app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); 43 app_dir.mkdir ("C:\\kdepim\\apps\\korganizer");
44 } 44 }
45#endif 45#endif
46 bool exitHelp = false; 46 bool exitHelp = false;
47 if ( argc > 1 ) { 47 if ( argc > 1 ) {
48 QString command = argv[1]; 48 QString command = argv[1];
49 if ( command == "-help" ){ 49 if ( command == "-help" ){
50 printf("KO/Pi command line commands:\n"); 50 printf("KO/Pi command line commands:\n");
51 printf(" no command: Start KO/Pi in usual way\n"); 51 printf(" no command: Start KO/Pi in usual way\n");
52 printf(" -help: This output\n"); 52 printf(" -help: This output\n");
53 printf("Next Option: Open or Show after start:\n"); 53 printf("Next Option: Open or Show after start:\n");
54 printf(" -newTodo: New Todo dialog\n"); 54 printf(" -newTodo: New Todo dialog\n");
55 printf(" -newEvent: New Event dialog\n"); 55 printf(" -newEvent: New Event dialog\n");
56 printf(" -showList: List view\n"); 56 printf(" -showList: List view\n");
57 printf(" -showDay: Day view\n"); 57 printf(" -showDay: Day view\n");
58 printf(" -showWWeek: Work Week view\n"); 58 printf(" -showWWeek: Work Week view\n");
59 printf(" -showWeek: Week view\n"); 59 printf(" -showWeek: Week view\n");
60 printf(" -showTodo: Todo view\n"); 60 printf(" -showTodo: Todo view\n");
61 printf(" -showJournal: Journal view\n"); 61 printf(" -showJournal: Journal view\n");
62 printf(" -showKO: Next Days view\n"); 62 printf(" -showKO: Next Days view\n");
63 printf(" -showWNext: What's Next view\n"); 63 printf(" -showWNext: What's Next view\n");
64 printf(" -showNextXView: Next X View\n"); 64 printf(" -showNextXView: Next X View\n");
65 printf(" -new[Y] and -show[X] may be used togehther\n"); 65 printf(" -new[Y] and -show[X] may be used togehther\n");
66 printf(" KO/Pi is exiting now. Bye!\n"); 66 printf(" KO/Pi is exiting now. Bye!\n");
67 exitHelp = true; 67 exitHelp = true;
68 } 68 }
69 } 69 }
70 if ( ! exitHelp ) { 70 if ( ! exitHelp ) {
71 KGlobal::setAppName( "korganizer" ); 71 KGlobal::setAppName( "korganizer" );
72 QString fileName ; 72 QString fileName ;
73#ifndef DESKTOP_VERSION 73#ifndef DESKTOP_VERSION
74 fileName = getenv("QPEDIR"); 74 fileName = getenv("QPEDIR");
75 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 75 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
76#else 76#else
77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 77 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 78 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
79#endif 79#endif
80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 80 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
81 MainWindow m; 81 MainWindow m;
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ; 83
84 QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
85 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 84 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
86 a.showMainWidget(&m ); 85 a.showMainWidget(&m );
87#else 86#else
88 a.setMainWidget(&m ); 87 a.setMainWidget(&m );
89 m.show(); 88 m.show();
90 //m.resize( 800, 600 ); 89 //m.resize( 800, 600 );
91 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 90 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
92#endif 91#endif
93 if ( argc > 1 ) { 92 if ( argc > 1 ) {
94 QCString command = argv[1]; 93 QCString command = argv[1];
95 if ( argc > 2 ) 94 if ( argc > 2 )
96 command += argv[2]; 95 command += argv[2];
97 qApp->processEvents(); 96 qApp->processEvents();
98 m.recieve(command, QByteArray() ); 97 m.recieve(command, QByteArray() );
99 98
100 } 99 }
101 a.exec(); 100 a.exec();
102#ifndef DESKTOP_VERSION
103 delete c1;
104#endif
105 101
106 } 102 }
107 qDebug("KO: Bye! "); 103 qDebug("KO: Bye! ");
108} 104}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 02ca523..9e215b9 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1825 +1,1882 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.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#include "koimportoldialog.h" 69#include "koimportoldialog.h"
70#endif 70#endif
71#include "mainwindow.h" 71#include "mainwindow.h"
72 72
73class KOex2phonePrefs : public QDialog 73class KOex2phonePrefs : public QDialog
74{ 74{
75 public: 75 public:
76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
77 QDialog( parent, name, true ) 77 QDialog( parent, name, true )
78 { 78 {
79 setCaption( i18n("Export to phone options") ); 79 setCaption( i18n("Export to phone options") );
80 QVBoxLayout* lay = new QVBoxLayout( this ); 80 QVBoxLayout* lay = new QVBoxLayout( this );
81 lay->setSpacing( 3 ); 81 lay->setSpacing( 3 );
82 lay->setMargin( 3 ); 82 lay->setMargin( 3 );
83 QLabel *lab; 83 QLabel *lab;
84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
85 lab->setAlignment (AlignHCenter ); 85 lab->setAlignment (AlignHCenter );
86 QHBox* temphb; 86 QHBox* temphb;
87 temphb = new QHBox( this ); 87 temphb = new QHBox( this );
88 new QLabel( i18n("I/O device: "), temphb ); 88 new QLabel( i18n("I/O device: "), temphb );
89 mPhoneDevice = new QLineEdit( temphb); 89 mPhoneDevice = new QLineEdit( temphb);
90 lay->addWidget( temphb ); 90 lay->addWidget( temphb );
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("Connection: "), temphb ); 92 new QLabel( i18n("Connection: "), temphb );
93 mPhoneConnection = new QLineEdit( temphb); 93 mPhoneConnection = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Model(opt.): "), temphb ); 96 new QLabel( i18n("Model(opt.): "), temphb );
97 mPhoneModel = new QLineEdit( temphb); 97 mPhoneModel = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 100 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 101 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 102 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 103 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 105 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 106 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 108 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116
117 } 117 }
118 118
119public: 119public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 121 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 122 QSpinBox* mWriteBackFutureWeeks;
123}; 123};
124 124
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 127 QMainWindow( parent, name )
128{ 128{
129 129
130#ifdef DESKTOP_VERSION 130#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 131 setFont( QFont("Arial"), 14 );
132#endif 132#endif
133 mClosed = false; 133 mClosed = false;
134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
135 QString confFile = locateLocal("config","korganizerrc"); 135 QString confFile = locateLocal("config","korganizerrc");
136 QFileInfo finf ( confFile ); 136 QFileInfo finf ( confFile );
137 bool showWarning = !finf.exists(); 137 bool showWarning = !finf.exists();
138 setIcon(SmallIcon( "ko24" ) ); 138 setIcon(SmallIcon( "ko24" ) );
139 mBlockAtStartup = true; 139 mBlockAtStartup = true;
140 mFlagKeyPressed = false; 140 mFlagKeyPressed = false;
141 setCaption("KOrganizer/Pi"); 141 setCaption("KOrganizer/Pi");
142 KOPrefs *p = KOPrefs::instance(); 142 KOPrefs *p = KOPrefs::instance();
143 KPimGlobalPrefs::instance()->setGlobalConfig(); 143 KPimGlobalPrefs::instance()->setGlobalConfig();
144 if ( p->mHourSize > 18 ) 144 if ( p->mHourSize > 18 )
145 p->mHourSize = 18; 145 p->mHourSize = 18;
146 QMainWindow::ToolBarDock tbd; 146 QMainWindow::ToolBarDock tbd;
147 if ( p->mToolBarHor ) { 147 if ( p->mToolBarHor ) {
148 if ( p->mToolBarUp ) 148 if ( p->mToolBarUp )
149 tbd = Bottom; 149 tbd = Bottom;
150 else 150 else
151 tbd = Top; 151 tbd = Top;
152 } 152 }
153 else { 153 else {
154 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
155 tbd = Right; 155 tbd = Right;
156 else 156 else
157 tbd = Left; 157 tbd = Left;
158 } 158 }
159 if ( KOPrefs::instance()->mUseAppColors ) 159 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 161 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 162 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 163 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 164 mCalendarModifiedFlag = false;
165 165
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 167 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 168 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 169#ifndef DESKTOP_VERSION
170 showMaximized(); 170 showMaximized();
171#endif 171#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 173 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 174 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 175 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 176 mView->hide();
177 //mView->resize(splash->size() ); 177 //mView->resize(splash->size() );
178 initActions(); 178 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 180 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 181 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 183 iconToolBar->show();
184 qApp->processEvents(); 184 qApp->processEvents();
185#endif 185#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 187 int vh = height() ;
188 int vw = width(); 188 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 189 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 190 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 191 vh -= iconToolBar->height();
192 } else { 192 } else {
193 vw -= iconToolBar->height(); 193 vw -= iconToolBar->height();
194 } 194 }
195 //mView->setMaximumSize( splash->size() ); 195 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 196 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 198 mView->readSettings();
199 bool newFile = false; 199 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 200 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 201 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 203 qDebug("oldfile %s ", oldFile.latin1());
204 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"; 204 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";
205 finfo.setFile( oldFile ); 205 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 206 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 207 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 208 mView->openCalendar( oldFile );
209 qApp->processEvents(); 209 qApp->processEvents();
210 } else { 210 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 224 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 226 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 227
228 if ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KOPrefs::instance()->mLanguageChanged ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false; 231 KOPrefs::instance()->mLanguageChanged = false;
232 } 232 }
233 processIncidenceSelection( 0 ); 233 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) );
240 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
241 mView->setModified( false ); 243 mView->setModified( false );
242 mBlockAtStartup = false; 244 mBlockAtStartup = false;
243 mView->setModified( false ); 245 mView->setModified( false );
244 setCentralWidget( mView ); 246 setCentralWidget( mView );
245 globalFlagBlockStartup = 0; 247 globalFlagBlockStartup = 0;
246 mView->show(); 248 mView->show();
247 delete splash; 249 delete splash;
248 if ( newFile ) 250 if ( newFile )
249 mView->updateConfig(); 251 mView->updateConfig();
250 // qApp->processEvents(); 252 // qApp->processEvents();
251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
252 //fillSyncMenu(); 254 //fillSyncMenu();
253 255
254 256
255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
258 mSyncManager->setDefaultFileName( defaultFileName()); 260 mSyncManager->setDefaultFileName( defaultFileName());
259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
260 mSyncManager->fillSyncMenu(); 262 mSyncManager->fillSyncMenu();
261 263
262 264
263 265
264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
265 if ( showWarning ) { 267 if ( showWarning ) {
266 KMessageBox::information( this, 268 KMessageBox::information( this,
267 "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"); 269 "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");
268 qApp->processEvents(); 270 qApp->processEvents();
269 mView->dialogManager()->showSyncOptions(); 271 mView->dialogManager()->showSyncOptions();
270 } 272 }
271 273
272 //US listen for result adressed from Ka/Pi 274 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 277#endif
276 278#ifndef DESKTOP_VERSION
279 infrared = 0;
280#endif
281
282 mBRdisabled = false;
283 toggleBeamReceive();
277} 284}
278MainWindow::~MainWindow() 285MainWindow::~MainWindow()
279{ 286{
280 //qDebug("MainWindow::~MainWindow() "); 287 //qDebug("MainWindow::~MainWindow() ");
281 //save toolbar location 288 //save toolbar location
282 delete mCalendar; 289 delete mCalendar;
283 delete mSyncManager; 290 delete mSyncManager;
291 if ( infrared )
292 delete infrared;
293
294
295}
296
297void MainWindow::disableBR(bool b)
298{
299 if ( b ) {
300 if ( infrared ) {
301 toggleBeamReceive();
302 mBRdisabled = true;
303 }
304 } else {
305 if ( mBRdisabled ) {
306 mBRdisabled = false;
307 toggleBeamReceive();
308 }
309 }
284 310
311}
312bool MainWindow::beamReceiveEnabled()
313{
314#ifndef DESKTOP_VERSION
315 return ( infrared != 0 );
316#endif
317 return false;
318}
285 319
320void MainWindow::toggleBeamReceive()
321{
322 if ( mBRdisabled )
323 return;
324#ifndef DESKTOP_VERSION
325 if ( infrared ) {
326 qDebug("disable BeamReceive ");
327 delete infrared;
328 infrared = 0;
329 brAction->setOn(false);
330 return;
331 }
332 qDebug("enable BeamReceive ");
333 brAction->setOn(true);
334 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
335 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
336#endif
286} 337}
287void MainWindow::showMaximized () 338void MainWindow::showMaximized ()
288{ 339{
289#ifndef DESKTOP_VERSION 340#ifndef DESKTOP_VERSION
290 if ( ! globalFlagBlockStartup ) 341 if ( ! globalFlagBlockStartup )
291 if ( mClosed ) 342 if ( mClosed )
292 mView->goToday(); 343 mView->goToday();
293#endif 344#endif
294 QWidget::showMaximized () ; 345 QWidget::showMaximized () ;
295 mClosed = false; 346 mClosed = false;
296} 347}
297void MainWindow::closeEvent( QCloseEvent* ce ) 348void MainWindow::closeEvent( QCloseEvent* ce )
298{ 349{
299 350
300 351
301 352
302 if ( ! KOPrefs::instance()->mAskForQuit ) { 353 if ( ! KOPrefs::instance()->mAskForQuit ) {
303 saveOnClose(); 354 saveOnClose();
304 mClosed = true; 355 mClosed = true;
305 ce->accept(); 356 ce->accept();
306 return; 357 return;
307 358
308 } 359 }
309 360
310 switch( QMessageBox::information( this, "KO/Pi", 361 switch( QMessageBox::information( this, "KO/Pi",
311 i18n("Do you really want\nto close KO/Pi?"), 362 i18n("Do you really want\nto close KO/Pi?"),
312 i18n("Close"), i18n("No"), 363 i18n("Close"), i18n("No"),
313 0, 0 ) ) { 364 0, 0 ) ) {
314 case 0: 365 case 0:
315 saveOnClose(); 366 saveOnClose();
316 mClosed = true; 367 mClosed = true;
317 ce->accept(); 368 ce->accept();
318 break; 369 break;
319 case 1: 370 case 1:
320 ce->ignore(); 371 ce->ignore();
321 break; 372 break;
322 case 2: 373 case 2:
323 374
324 default: 375 default:
325 break; 376 break;
326 } 377 }
327 378
328 379
329} 380}
330 381
331void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 382void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
332{ 383{
333 QDataStream stream( data, IO_ReadOnly ); 384 QDataStream stream( data, IO_ReadOnly );
334 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 385 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
335 //QString datamess; 386 //QString datamess;
336 //qDebug("message "); 387 //qDebug("message ");
337 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 388 qDebug("KO: QCOP message received: %s ", cmsg.data() );
338 389
339 if ( cmsg == "setDocument(QString)" ) { 390 if ( cmsg == "setDocument(QString)" ) {
340 QDataStream stream( data, IO_ReadOnly ); 391 QDataStream stream( data, IO_ReadOnly );
341 QString fileName; 392 QString fileName;
342 stream >> fileName; 393 stream >> fileName;
343 //qDebug("filename %s ", fileName.latin1()); 394 //qDebug("filename %s ", fileName.latin1());
344 showMaximized(); 395 showMaximized();
345 raise(); 396 raise();
346 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 397 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
347 mSyncManager->slotSyncMenu( 1002 ); 398 mSyncManager->slotSyncMenu( 1002 );
348 return; 399 return;
349 } 400 }
350 401
351 if ( cmsg == "-writeFile" ) { 402 if ( cmsg == "-writeFile" ) {
352 // I made from the "-writeFile" an "-writeAlarm" 403 // I made from the "-writeFile" an "-writeAlarm"
353 mView->viewManager()->showWhatsNextView(); 404 mView->viewManager()->showWhatsNextView();
354 mCalendar->checkAlarmForIncidence( 0, true); 405 mCalendar->checkAlarmForIncidence( 0, true);
355 showMaximized(); 406 showMaximized();
356 raise(); 407 raise();
357 return; 408 return;
358 409
359 } 410 }
360 if ( cmsg == "-writeFileSilent" ) { 411 if ( cmsg == "-writeFileSilent" ) {
361 // I made from the "-writeFile" an "-writeAlarm" 412 // I made from the "-writeFile" an "-writeAlarm"
362 // mView->viewManager()->showWhatsNextView(); 413 // mView->viewManager()->showWhatsNextView();
363 mCalendar->checkAlarmForIncidence( 0, true); 414 mCalendar->checkAlarmForIncidence( 0, true);
364 //showMaximized(); 415 //showMaximized();
365 //raise(); 416 //raise();
366 hide(); 417 hide();
367 return; 418 return;
368 } 419 }
369 if ( cmsg == "-newCountdown" ) { 420 if ( cmsg == "-newCountdown" ) {
370 qDebug("newCountdown "); 421 qDebug("newCountdown ");
371 422
372 } 423 }
373 QString msg ; 424 QString msg ;
374 QString allmsg = cmsg; 425 QString allmsg = cmsg;
375 while ( allmsg.length() > 0 ) { 426 while ( allmsg.length() > 0 ) {
376 int nextC = allmsg.find( "-", 1 ); 427 int nextC = allmsg.find( "-", 1 );
377 if ( nextC == -1 ) { 428 if ( nextC == -1 ) {
378 msg = allmsg; 429 msg = allmsg;
379 allmsg = ""; 430 allmsg = "";
380 } else{ 431 } else{
381 msg = allmsg.left( nextC ); 432 msg = allmsg.left( nextC );
382 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 433 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
383 } 434 }
384 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 435 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
385 if ( msg == "-newEvent" ) { 436 if ( msg == "-newEvent" ) {
386 mView->newEvent(); 437 mView->newEvent();
387 } 438 }
388 if ( msg == "-newTodo" ) { 439 if ( msg == "-newTodo" ) {
389 mView->newTodo(); 440 mView->newTodo();
390 441
391 } 442 }
392 if ( msg == "-showWN" ) { 443 if ( msg == "-showWN" ) {
393 mView->viewManager()->showWhatsNextView(); 444 mView->viewManager()->showWhatsNextView();
394 } 445 }
395 if ( msg == "-showTodo" ) { 446 if ( msg == "-showTodo" ) {
396 mView->viewManager()->showTodoView(); 447 mView->viewManager()->showTodoView();
397 } 448 }
398 if ( msg == "-showList" ) { 449 if ( msg == "-showList" ) {
399 mView->viewManager()->showListView(); 450 mView->viewManager()->showListView();
400 } 451 }
401 else if ( msg == "-showDay" ) { 452 else if ( msg == "-showDay" ) {
402 mView->viewManager()->showDayView(); 453 mView->viewManager()->showDayView();
403 } 454 }
404 else if ( msg == "-showWWeek" ) { 455 else if ( msg == "-showWWeek" ) {
405 mView->viewManager()->showWorkWeekView(); 456 mView->viewManager()->showWorkWeekView();
406 } 457 }
407 else if ( msg == "-ringSync" ) { 458 else if ( msg == "-ringSync" ) {
408 mSyncManager->multiSync( false ); 459 mSyncManager->multiSync( false );
409 } 460 }
410 else if ( msg == "-showWeek" ) { 461 else if ( msg == "-showWeek" ) {
411 mView->viewManager()->showWeekView(); 462 mView->viewManager()->showWeekView();
412 } 463 }
413 else if ( msg == "-showTodo" ) { 464 else if ( msg == "-showTodo" ) {
414 mView->viewManager()->showTodoView(); 465 mView->viewManager()->showTodoView();
415 } 466 }
416 else if ( msg == "-showJournal" ) { 467 else if ( msg == "-showJournal" ) {
417 mView->dateNavigator()->selectDates( 1 ); 468 mView->dateNavigator()->selectDates( 1 );
418 mView->dateNavigator()->selectToday(); 469 mView->dateNavigator()->selectToday();
419 mView->viewManager()->showJournalView(); 470 mView->viewManager()->showJournalView();
420 } 471 }
421 else if ( msg == "-showKO" ) { 472 else if ( msg == "-showKO" ) {
422 mView->viewManager()->showNextXView(); 473 mView->viewManager()->showNextXView();
423 } 474 }
424 else if ( msg == "-showWNext" || msg == "nextView()" ) { 475 else if ( msg == "-showWNext" || msg == "nextView()" ) {
425 mView->viewManager()->showWhatsNextView(); 476 mView->viewManager()->showWhatsNextView();
426 } 477 }
427 else if ( msg == "-showNextXView" ) { 478 else if ( msg == "-showNextXView" ) {
428 mView->viewManager()->showNextXView(); 479 mView->viewManager()->showNextXView();
429 } 480 }
430 481
431 482
432 } 483 }
433 484
434 showMaximized(); 485 showMaximized();
435 raise(); 486 raise();
436} 487}
437 488
438QPixmap MainWindow::loadPixmap( QString name ) 489QPixmap MainWindow::loadPixmap( QString name )
439{ 490{
440 return SmallIcon( name ); 491 return SmallIcon( name );
441 492
442} 493}
443void MainWindow::initActions() 494void MainWindow::initActions()
444{ 495{
445 //KOPrefs::instance()->mShowFullMenu 496 //KOPrefs::instance()->mShowFullMenu
446 iconToolBar->clear(); 497 iconToolBar->clear();
447 KOPrefs *p = KOPrefs::instance(); 498 KOPrefs *p = KOPrefs::instance();
448 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 499 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
449 500
450 QPopupMenu *viewMenu = new QPopupMenu( this ); 501 QPopupMenu *viewMenu = new QPopupMenu( this );
451 QPopupMenu *actionMenu = new QPopupMenu( this ); 502 QPopupMenu *actionMenu = new QPopupMenu( this );
452 QPopupMenu *importMenu = new QPopupMenu( this ); 503 QPopupMenu *importMenu = new QPopupMenu( this );
453 selectFilterMenu = new QPopupMenu( this ); 504 selectFilterMenu = new QPopupMenu( this );
454 selectFilterMenu->setCheckable( true ); 505 selectFilterMenu->setCheckable( true );
455 syncMenu = new QPopupMenu( this ); 506 syncMenu = new QPopupMenu( this );
456 configureAgendaMenu = new QPopupMenu( this ); 507 configureAgendaMenu = new QPopupMenu( this );
457 configureToolBarMenu = new QPopupMenu( this ); 508 configureToolBarMenu = new QPopupMenu( this );
458 QPopupMenu *helpMenu = new QPopupMenu( this ); 509 QPopupMenu *helpMenu = new QPopupMenu( this );
459 if ( KOPrefs::instance()->mShowFullMenu ) { 510 if ( KOPrefs::instance()->mShowFullMenu ) {
460 QMenuBar *menuBar1; 511 QMenuBar *menuBar1;
461 menuBar1 = menuBar(); 512 menuBar1 = menuBar();
462 menuBar1->insertItem( i18n("File"), importMenu ); 513 menuBar1->insertItem( i18n("File"), importMenu );
463 menuBar1->insertItem( i18n("View"), viewMenu ); 514 menuBar1->insertItem( i18n("View"), viewMenu );
464 menuBar1->insertItem( i18n("Actions"), actionMenu ); 515 menuBar1->insertItem( i18n("Actions"), actionMenu );
465 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 516 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
466 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 517 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
467 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 518 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
468 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 519 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
469 menuBar1->insertItem( i18n("Help"), helpMenu ); 520 menuBar1->insertItem( i18n("Help"), helpMenu );
470 } else { 521 } else {
471 QPEMenuBar *menuBar1; 522 QPEMenuBar *menuBar1;
472 menuBar1 = new QPEMenuBar( iconToolBar ); 523 menuBar1 = new QPEMenuBar( iconToolBar );
473 QPopupMenu *menuBar = new QPopupMenu( this ); 524 QPopupMenu *menuBar = new QPopupMenu( this );
474 menuBar1->insertItem( i18n("ME"), menuBar); 525 menuBar1->insertItem( i18n("ME"), menuBar);
475 menuBar->insertItem( i18n("File"), importMenu ); 526 menuBar->insertItem( i18n("File"), importMenu );
476 menuBar->insertItem( i18n("View"), viewMenu ); 527 menuBar->insertItem( i18n("View"), viewMenu );
477 menuBar->insertItem( i18n("Actions"), actionMenu ); 528 menuBar->insertItem( i18n("Actions"), actionMenu );
478 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 529 menuBar->insertItem( i18n("Synchronize"), syncMenu );
479 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 530 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
480 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 531 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
481 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 532 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
482 menuBar->insertItem( i18n("Help"), helpMenu ); 533 menuBar->insertItem( i18n("Help"), helpMenu );
483 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 534 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
484 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 535 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
485 } 536 }
486 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 537 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
487 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 538 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
488 539
489 // ****************** 540 // ******************
490 QAction *action; 541 QAction *action;
491 QIconSet icon; 542 QIconSet icon;
492 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 543 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
493 configureToolBarMenu->setCheckable( true ); 544 configureToolBarMenu->setCheckable( true );
494 545
495 QString pathString = ""; 546 QString pathString = "";
496 if ( !p->mToolBarMiniIcons ) { 547 if ( !p->mToolBarMiniIcons ) {
497 if ( QApplication::desktop()->width() < 480 ) 548 if ( QApplication::desktop()->width() < 480 )
498 pathString += "icons16/"; 549 pathString += "icons16/";
499 } else 550 } else
500 pathString += "iconsmini/"; 551 pathString += "iconsmini/";
501 configureAgendaMenu->setCheckable( true ); 552 configureAgendaMenu->setCheckable( true );
502 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 553 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
503 configureAgendaMenu->insertSeparator(); 554 configureAgendaMenu->insertSeparator();
504 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 555 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
505 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 556 configureAgendaMenu->insertItem(i18n("Small"), 6 );
506 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 557 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
507 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 558 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
508 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 559 configureAgendaMenu->insertItem(i18n("Large"), 12 );
509 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 560 configureAgendaMenu->insertItem(i18n("Big"), 14 );
510 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 561 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
511 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 562 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
512 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 563 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
513 564
514 icon = loadPixmap( pathString + "configure" ); 565 icon = loadPixmap( pathString + "configure" );
515 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 566 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
516 action->addTo( actionMenu ); 567 action->addTo( actionMenu );
517 connect( action, SIGNAL( activated() ), 568 connect( action, SIGNAL( activated() ),
518 mView, SLOT( edit_options() ) ); 569 mView, SLOT( edit_options() ) );
519 actionMenu->insertSeparator(); 570 actionMenu->insertSeparator();
520 icon = loadPixmap( pathString + "newevent" ); 571 icon = loadPixmap( pathString + "newevent" );
521 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 572 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
522 configureToolBarMenu->insertSeparator(); 573 configureToolBarMenu->insertSeparator();
523 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 574 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
524 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 575 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
525 ne_action->addTo( actionMenu ); 576 ne_action->addTo( actionMenu );
526 connect( ne_action, SIGNAL( activated() ), 577 connect( ne_action, SIGNAL( activated() ),
527 mView, SLOT( newEvent() ) ); 578 mView, SLOT( newEvent() ) );
528 icon = loadPixmap( pathString + "newtodo" ); 579 icon = loadPixmap( pathString + "newtodo" );
529 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 580 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
530 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 581 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
531 nt_action->addTo( actionMenu ); 582 nt_action->addTo( actionMenu );
532 connect( nt_action, SIGNAL( activated() ), 583 connect( nt_action, SIGNAL( activated() ),
533 mView, SLOT( newTodo() ) ); 584 mView, SLOT( newTodo() ) );
534 icon = loadPixmap( pathString + "navi" ); 585 icon = loadPixmap( pathString + "navi" );
535 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 586 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
536 action->addTo( viewMenu ); 587 action->addTo( viewMenu );
537 connect( action, SIGNAL( activated() ), 588 connect( action, SIGNAL( activated() ),
538 mView, SLOT( toggleDateNavigatorWidget() ) ); 589 mView, SLOT( toggleDateNavigatorWidget() ) );
539 icon = loadPixmap( pathString + "filter" ); 590 icon = loadPixmap( pathString + "filter" );
540 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 591 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
541 action->addTo( viewMenu ); 592 action->addTo( viewMenu );
542 connect( action, SIGNAL( activated() ), 593 connect( action, SIGNAL( activated() ),
543 mView, SLOT( toggleFilter() ) ); 594 mView, SLOT( toggleFilter() ) );
544 595
545 596
546 viewMenu->insertSeparator(); 597 viewMenu->insertSeparator();
547 icon = loadPixmap( pathString + "picker" ); 598 icon = loadPixmap( pathString + "picker" );
548 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 599 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
549 action->addTo( viewMenu ); 600 action->addTo( viewMenu );
550 connect( action, SIGNAL( activated() ), 601 connect( action, SIGNAL( activated() ),
551 mView, SLOT( showDatePicker() ) ); 602 mView, SLOT( showDatePicker() ) );
552 action->addTo( iconToolBar ); 603 action->addTo( iconToolBar );
553 viewMenu->insertSeparator(); 604 viewMenu->insertSeparator();
554 icon = loadPixmap( pathString + "list" ); 605 icon = loadPixmap( pathString + "list" );
555 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 606 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
556 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 607 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
557 showlist_action->addTo( viewMenu ); 608 showlist_action->addTo( viewMenu );
558 connect( showlist_action, SIGNAL( activated() ), 609 connect( showlist_action, SIGNAL( activated() ),
559 mView->viewManager(), SLOT( showListView() ) ); 610 mView->viewManager(), SLOT( showListView() ) );
560 611
561 612
562 icon = loadPixmap( pathString + "day" ); 613 icon = loadPixmap( pathString + "day" );
563 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 614 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
564 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 615 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
565 day1_action->addTo( viewMenu ); 616 day1_action->addTo( viewMenu );
566 // action->addTo( toolBar ); 617 // action->addTo( toolBar );
567 connect( day1_action, SIGNAL( activated() ), 618 connect( day1_action, SIGNAL( activated() ),
568 mView->viewManager(), SLOT( showDayView() ) ); 619 mView->viewManager(), SLOT( showDayView() ) );
569 620
570 icon = loadPixmap( pathString + "workweek" ); 621 icon = loadPixmap( pathString + "workweek" );
571 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 622 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
572 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 623 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
573 day5_action->addTo( viewMenu ); 624 day5_action->addTo( viewMenu );
574 connect( day5_action, SIGNAL( activated() ), 625 connect( day5_action, SIGNAL( activated() ),
575 mView->viewManager(), SLOT( showWorkWeekView() ) ); 626 mView->viewManager(), SLOT( showWorkWeekView() ) );
576 627
577 icon = loadPixmap( pathString + "week" ); 628 icon = loadPixmap( pathString + "week" );
578 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 629 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
579 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 630 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
580 day7_action->addTo( viewMenu ); 631 day7_action->addTo( viewMenu );
581 connect( day7_action, SIGNAL( activated() ), 632 connect( day7_action, SIGNAL( activated() ),
582 mView->viewManager(), SLOT( showWeekView() ) ); 633 mView->viewManager(), SLOT( showWeekView() ) );
583 634
584 icon = loadPixmap( pathString + "month" ); 635 icon = loadPixmap( pathString + "month" );
585 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 636 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
586 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 637 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
587 month_action->addTo( viewMenu ); 638 month_action->addTo( viewMenu );
588 connect( month_action, SIGNAL( activated() ), 639 connect( month_action, SIGNAL( activated() ),
589 mView->viewManager(), SLOT( showMonthView() ) ); 640 mView->viewManager(), SLOT( showMonthView() ) );
590 641
591 icon = loadPixmap( pathString + "todo" ); 642 icon = loadPixmap( pathString + "todo" );
592 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 643 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
593 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 644 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
594 todoview_action->addTo( viewMenu ); 645 todoview_action->addTo( viewMenu );
595 connect( todoview_action, SIGNAL( activated() ), 646 connect( todoview_action, SIGNAL( activated() ),
596 mView->viewManager(), SLOT( showTodoView() ) ); 647 mView->viewManager(), SLOT( showTodoView() ) );
597 648
598 icon = loadPixmap( pathString + "journal" ); 649 icon = loadPixmap( pathString + "journal" );
599 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 650 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
600 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 651 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
601 viewjournal_action->addTo( viewMenu ); 652 viewjournal_action->addTo( viewMenu );
602 connect( viewjournal_action, SIGNAL( activated() ), 653 connect( viewjournal_action, SIGNAL( activated() ),
603 mView->viewManager(), SLOT( showJournalView() ) ); 654 mView->viewManager(), SLOT( showJournalView() ) );
604 655
605 icon = loadPixmap( pathString + "xdays" ); 656 icon = loadPixmap( pathString + "xdays" );
606 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 657 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
607 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 658 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
608 xdays_action->addTo( viewMenu ); 659 xdays_action->addTo( viewMenu );
609 connect( xdays_action, SIGNAL( activated() ), 660 connect( xdays_action, SIGNAL( activated() ),
610 mView->viewManager(), SLOT( showNextXView() ) ); 661 mView->viewManager(), SLOT( showNextXView() ) );
611 662
612 icon = loadPixmap( pathString + "whatsnext" ); 663 icon = loadPixmap( pathString + "whatsnext" );
613 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 664 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
614 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 665 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
615 whatsnext_action->addTo( viewMenu ); 666 whatsnext_action->addTo( viewMenu );
616 connect( whatsnext_action, SIGNAL( activated() ), 667 connect( whatsnext_action, SIGNAL( activated() ),
617 mView->viewManager(), SLOT( showWhatsNextView() ) ); 668 mView->viewManager(), SLOT( showWhatsNextView() ) );
618 669
619#if 0 670#if 0
620 action = new QAction( "view_timespan", "Time Span", 0, this ); 671 action = new QAction( "view_timespan", "Time Span", 0, this );
621 action->addTo( viewMenu ); 672 action->addTo( viewMenu );
622 connect( action, SIGNAL( activated() ), 673 connect( action, SIGNAL( activated() ),
623 mView->viewManager(), SLOT( showTimeSpanView() ) ); 674 mView->viewManager(), SLOT( showTimeSpanView() ) );
624#endif 675#endif
625 676
626 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 677 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
627 this ); 678 this );
628 mNewSubTodoAction->addTo( actionMenu ); 679 mNewSubTodoAction->addTo( actionMenu );
629 connect( mNewSubTodoAction, SIGNAL( activated() ), 680 connect( mNewSubTodoAction, SIGNAL( activated() ),
630 mView, SLOT( newSubTodo() ) ); 681 mView, SLOT( newSubTodo() ) );
631 682
632 actionMenu->insertSeparator(); 683 actionMenu->insertSeparator();
633 684
634 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 685 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
635 mShowAction->addTo( actionMenu ); 686 mShowAction->addTo( actionMenu );
636 connect( mShowAction, SIGNAL( activated() ), 687 connect( mShowAction, SIGNAL( activated() ),
637 mView, SLOT( showIncidence() ) ); 688 mView, SLOT( showIncidence() ) );
638 689
639 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 690 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
640 mEditAction->addTo( actionMenu ); 691 mEditAction->addTo( actionMenu );
641 connect( mEditAction, SIGNAL( activated() ), 692 connect( mEditAction, SIGNAL( activated() ),
642 mView, SLOT( editIncidence() ) ); 693 mView, SLOT( editIncidence() ) );
643 694
644 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 695 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
645 mDeleteAction->addTo( actionMenu ); 696 mDeleteAction->addTo( actionMenu );
646 connect( mDeleteAction, SIGNAL( activated() ), 697 connect( mDeleteAction, SIGNAL( activated() ),
647 mView, SLOT( deleteIncidence() ) ); 698 mView, SLOT( deleteIncidence() ) );
648 699
649 700
650 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 701 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
651 mCloneAction->addTo( actionMenu ); 702 mCloneAction->addTo( actionMenu );
652 connect( mCloneAction, SIGNAL( activated() ), 703 connect( mCloneAction, SIGNAL( activated() ),
653 mView, SLOT( cloneIncidence() ) ); 704 mView, SLOT( cloneIncidence() ) );
654 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 705 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
655 mMoveAction->addTo( actionMenu ); 706 mMoveAction->addTo( actionMenu );
656 connect( mMoveAction, SIGNAL( activated() ), 707 connect( mMoveAction, SIGNAL( activated() ),
657 mView, SLOT( moveIncidence() ) ); 708 mView, SLOT( moveIncidence() ) );
658 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 709 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
659 mBeamAction->addTo( actionMenu ); 710 mBeamAction->addTo( actionMenu );
660 connect( mBeamAction, SIGNAL( activated() ), 711 connect( mBeamAction, SIGNAL( activated() ),
661 mView, SLOT( beamIncidence() ) ); 712 mView, SLOT( beamIncidence() ) );
662 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 713 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
663 mCancelAction->addTo( actionMenu ); 714 mCancelAction->addTo( actionMenu );
664 connect( mCancelAction, SIGNAL( activated() ), 715 connect( mCancelAction, SIGNAL( activated() ),
665 mView, SLOT( toggleCancelIncidence() ) ); 716 mView, SLOT( toggleCancelIncidence() ) );
666 717
667 actionMenu->insertSeparator(); 718 actionMenu->insertSeparator();
668 719
669 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 720 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
670 this ); 721 this );
671 action->addTo( actionMenu ); 722 action->addTo( actionMenu );
672 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 723 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
673 724
674 icon = loadPixmap( pathString + "search" ); 725 icon = loadPixmap( pathString + "search" );
675 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 726 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
676 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 727 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
677 search_action->addTo( actionMenu ); 728 search_action->addTo( actionMenu );
678 connect( search_action, SIGNAL( activated() ), 729 connect( search_action, SIGNAL( activated() ),
679 mView->dialogManager(), SLOT( showSearchDialog() ) ); 730 mView->dialogManager(), SLOT( showSearchDialog() ) );
680 731
681 icon = loadPixmap( pathString + "today" ); 732 icon = loadPixmap( pathString + "today" );
682 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 733 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
683 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 734 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
684 today_action->addTo( actionMenu ); 735 today_action->addTo( actionMenu );
685 connect( today_action, SIGNAL( activated() ), 736 connect( today_action, SIGNAL( activated() ),
686 mView, SLOT( goToday() ) ); 737 mView, SLOT( goToday() ) );
687 738
688 if ( KOPrefs::instance()->mShowFullMenu ) { 739 if ( KOPrefs::instance()->mShowFullMenu ) {
689 actionMenu->insertSeparator(); 740 actionMenu->insertSeparator();
690 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 741 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
691 742
692 } 743 }
693 // actionMenu->insertSeparator(); 744 // actionMenu->insertSeparator();
694 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 745 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
695 this ); 746 this );
696 action->addTo( importMenu ); 747 action->addTo( importMenu );
697 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 748 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
698 action = new QAction( "import_quick", i18n("Import last file"), 0, 749 action = new QAction( "import_quick", i18n("Import last file"), 0,
699 this ); 750 this );
700 action->addTo( importMenu ); 751 action->addTo( importMenu );
701 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 752 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
702 importMenu->insertSeparator(); 753 importMenu->insertSeparator();
703 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 754 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
704 this ); 755 this );
705 action->addTo( importMenu ); 756 action->addTo( importMenu );
706 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 757 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
707#ifndef DESKTOP_VERSION 758#ifndef DESKTOP_VERSION
708 importMenu->insertSeparator(); 759 importMenu->insertSeparator();
709 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 760 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
710 this ); 761 this );
711 action->addTo( importMenu ); 762 action->addTo( importMenu );
712 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 763 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
713#else 764#else
714#ifdef _WIN32_ 765#ifdef _WIN32_
715 importMenu->insertSeparator(); 766 importMenu->insertSeparator();
716 action = new QAction( "import_ol", i18n("Import from OL"), 0, 767 action = new QAction( "import_ol", i18n("Import from OL"), 0,
717 this ); 768 this );
718 action->addTo( importMenu ); 769 action->addTo( importMenu );
719 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 770 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
720#endif 771#endif
721#endif 772#endif
722 773
723 importMenu->insertSeparator(); 774 importMenu->insertSeparator();
724 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 775 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
725 this ); 776 this );
726 action->addTo( importMenu ); 777 action->addTo( importMenu );
727 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 778 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
728 779
729 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 780 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
730 this ); 781 this );
731 action->addTo( importMenu ); 782 action->addTo( importMenu );
732 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 783 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
733 784
734 importMenu->insertSeparator(); 785 importMenu->insertSeparator();
735 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 786 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
736 this ); 787 this );
737 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 788 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
738 789
739 790
740 //LR 791 //LR
741 QPopupMenu *ex2phone = new QPopupMenu( this ); 792 QPopupMenu *ex2phone = new QPopupMenu( this );
742 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 793 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
743 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 794 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
744 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 795 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
745 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 796 importMenu->insertItem( i18n("Export to phone"), ex2phone );
746 797
747 importMenu->insertSeparator(); 798 importMenu->insertSeparator();
748 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 799 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
749 this ); 800 this );
750 action->addTo( importMenu ); 801 action->addTo( importMenu );
751 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 802 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
752#ifndef DESKTOP_VERSION 803#ifndef DESKTOP_VERSION
753 importMenu->insertSeparator(); 804 importMenu->insertSeparator();
805 brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0,
806 this );
807 brAction->addTo( importMenu );
808 brAction->setToggleAction (true ) ;
809 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
810
754 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 811 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
755 this ); 812 this );
756 action->addTo( importMenu ); 813 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 814 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
758 815
759 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 816 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
760 this ); 817 this );
761 action->addTo( importMenu ); 818 action->addTo( importMenu );
762 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 819 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
763#else 820#else
764 importMenu->insertSeparator(); 821 importMenu->insertSeparator();
765 icon = loadPixmap( pathString + "print" ); 822 icon = loadPixmap( pathString + "print" );
766 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 823 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
767 action->addTo( importMenu ); 824 action->addTo( importMenu );
768 connect( action, SIGNAL( activated() ), 825 connect( action, SIGNAL( activated() ),
769 this, SLOT( printCal() ) ); 826 this, SLOT( printCal() ) );
770 827
771 icon = loadPixmap( pathString + "print" ); 828 icon = loadPixmap( pathString + "print" );
772 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 829 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
773 action->addTo( importMenu ); 830 action->addTo( importMenu );
774 connect( action, SIGNAL( activated() ), 831 connect( action, SIGNAL( activated() ),
775 this, SLOT( printSel() ) ); 832 this, SLOT( printSel() ) );
776#endif 833#endif
777 importMenu->insertSeparator(); 834 importMenu->insertSeparator();
778 action = new QAction( "beam all", i18n("Save"), 0, 835 action = new QAction( "beam all", i18n("Save"), 0,
779 this ); 836 this );
780 action->addTo( importMenu ); 837 action->addTo( importMenu );
781 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 838 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
782 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 839 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
783 this ); 840 this );
784 action->addTo( importMenu ); 841 action->addTo( importMenu );
785 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 842 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
786 843
787 //menuBar->insertItem( "Configure",configureMenu ); 844 //menuBar->insertItem( "Configure",configureMenu );
788 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 845 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
789 icon = loadPixmap( "korganizer/korganizer" ); 846 icon = loadPixmap( "korganizer/korganizer" );
790 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 847 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
791 action->addTo( helpMenu ); 848 action->addTo( helpMenu );
792 connect( action, SIGNAL( activated() ), 849 connect( action, SIGNAL( activated() ),
793 SLOT( keyBindings() ) ); 850 SLOT( keyBindings() ) );
794 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 851 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
795 action->addTo( helpMenu ); 852 action->addTo( helpMenu );
796 connect( action, SIGNAL( activated() ), 853 connect( action, SIGNAL( activated() ),
797 SLOT( features() ) ); 854 SLOT( features() ) );
798 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 855 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
799 action->addTo( helpMenu ); 856 action->addTo( helpMenu );
800 connect( action, SIGNAL( activated() ), 857 connect( action, SIGNAL( activated() ),
801 SLOT( aboutAutoSaving() ) ); 858 SLOT( aboutAutoSaving() ) );
802 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 859 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
803 action->addTo( helpMenu ); 860 action->addTo( helpMenu );
804 connect( action, SIGNAL( activated() ), 861 connect( action, SIGNAL( activated() ),
805 SLOT( aboutKnownBugs() ) ); 862 SLOT( aboutKnownBugs() ) );
806 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 863 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
807 action->addTo( helpMenu ); 864 action->addTo( helpMenu );
808 connect( action, SIGNAL( activated() ), 865 connect( action, SIGNAL( activated() ),
809 SLOT( usertrans() ) ); 866 SLOT( usertrans() ) );
810 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 867 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
811 action->addTo( helpMenu ); 868 action->addTo( helpMenu );
812 connect( action, SIGNAL( activated() ), 869 connect( action, SIGNAL( activated() ),
813 SLOT( synchowto() ) ); 870 SLOT( synchowto() ) );
814 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 871 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
815 action->addTo( helpMenu ); 872 action->addTo( helpMenu );
816 connect( action, SIGNAL( activated() ), 873 connect( action, SIGNAL( activated() ),
817 SLOT( whatsNew() ) ); 874 SLOT( whatsNew() ) );
818 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 875 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
819 action->addTo( helpMenu ); 876 action->addTo( helpMenu );
820 connect( action, SIGNAL( activated() ), 877 connect( action, SIGNAL( activated() ),
821 SLOT( faq() ) ); 878 SLOT( faq() ) );
822 879
823 880
824 action = new QAction( "about", i18n("About..."), 0, this ); 881 action = new QAction( "about", i18n("About..."), 0, this );
825 action->addTo( helpMenu ); 882 action->addTo( helpMenu );
826 connect( action, SIGNAL( activated() ), 883 connect( action, SIGNAL( activated() ),
827 SLOT( about() ) ); 884 SLOT( about() ) );
828 action = new QAction( "licence", i18n("Licence..."), 0, this ); 885 action = new QAction( "licence", i18n("Licence..."), 0, this );
829 action->addTo( helpMenu ); 886 action->addTo( helpMenu );
830 connect( action, SIGNAL( activated() ), 887 connect( action, SIGNAL( activated() ),
831 SLOT( licence() ) ); 888 SLOT( licence() ) );
832 //menuBar->insertSeparator(); 889 //menuBar->insertSeparator();
833 890
834 // ****************************************************** 891 // ******************************************************
835 // menubar icons 892 // menubar icons
836 893
837 894
838 iconToolBar->setHorizontalStretchable (true ); 895 iconToolBar->setHorizontalStretchable (true );
839 //menuBar->insertItem( iconToolBar ); 896 //menuBar->insertItem( iconToolBar );
840 //xdays_action 897 //xdays_action
841 if (p-> mShowIconNewEvent) 898 if (p-> mShowIconNewEvent)
842 ne_action->addTo( iconToolBar ); 899 ne_action->addTo( iconToolBar );
843 if (p->mShowIconNewTodo ) 900 if (p->mShowIconNewTodo )
844 nt_action->addTo( iconToolBar ); 901 nt_action->addTo( iconToolBar );
845 if (p-> mShowIconSearch) 902 if (p-> mShowIconSearch)
846 search_action->addTo( iconToolBar ); 903 search_action->addTo( iconToolBar );
847 if (p-> mShowIconNext) 904 if (p-> mShowIconNext)
848 whatsnext_action->addTo( iconToolBar ); 905 whatsnext_action->addTo( iconToolBar );
849 if (p-> mShowIconNextDays) 906 if (p-> mShowIconNextDays)
850 xdays_action->addTo( iconToolBar ); 907 xdays_action->addTo( iconToolBar );
851 if (p-> mShowIconList) 908 if (p-> mShowIconList)
852 showlist_action->addTo( iconToolBar ); 909 showlist_action->addTo( iconToolBar );
853 if (p-> mShowIconDay1) 910 if (p-> mShowIconDay1)
854 day1_action->addTo( iconToolBar ); 911 day1_action->addTo( iconToolBar );
855 if (p-> mShowIconDay5) 912 if (p-> mShowIconDay5)
856 day5_action->addTo( iconToolBar ); 913 day5_action->addTo( iconToolBar );
857 if (p-> mShowIconDay7) 914 if (p-> mShowIconDay7)
858 day7_action->addTo( iconToolBar ); 915 day7_action->addTo( iconToolBar );
859 if (p-> mShowIconMonth) 916 if (p-> mShowIconMonth)
860 month_action->addTo( iconToolBar ); 917 month_action->addTo( iconToolBar );
861 if (p-> mShowIconTodoview) 918 if (p-> mShowIconTodoview)
862 todoview_action->addTo( iconToolBar ); 919 todoview_action->addTo( iconToolBar );
863 if (p-> mShowIconJournal) 920 if (p-> mShowIconJournal)
864 viewjournal_action->addTo( iconToolBar ); 921 viewjournal_action->addTo( iconToolBar );
865 icon = loadPixmap( pathString + "2leftarrowB" ); 922 icon = loadPixmap( pathString + "2leftarrowB" );
866 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 923 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
867 if (p-> mShowIconBackFast) { 924 if (p-> mShowIconBackFast) {
868 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 925 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
869 connect( action, SIGNAL( activated() ), 926 connect( action, SIGNAL( activated() ),
870 mView, SLOT( goPreviousMonth() ) ); 927 mView, SLOT( goPreviousMonth() ) );
871 action->addTo( iconToolBar ); 928 action->addTo( iconToolBar );
872 } 929 }
873 icon = loadPixmap( pathString + "1leftarrowB" ); 930 icon = loadPixmap( pathString + "1leftarrowB" );
874 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 931 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
875 if (p-> mShowIconBack) { 932 if (p-> mShowIconBack) {
876 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 933 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
877 connect( action, SIGNAL( activated() ), 934 connect( action, SIGNAL( activated() ),
878 mView, SLOT( goPrevious() ) ); 935 mView, SLOT( goPrevious() ) );
879 action->addTo( iconToolBar ); 936 action->addTo( iconToolBar );
880 } 937 }
881 if (p-> mShowIconToday) 938 if (p-> mShowIconToday)
882 today_action->addTo( iconToolBar ); 939 today_action->addTo( iconToolBar );
883 icon = loadPixmap( pathString + "1rightarrowB" ); 940 icon = loadPixmap( pathString + "1rightarrowB" );
884 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 941 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
885 if (p-> mShowIconForward) { 942 if (p-> mShowIconForward) {
886 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 943 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
887 connect( action, SIGNAL( activated() ), 944 connect( action, SIGNAL( activated() ),
888 mView, SLOT( goNext() ) ); 945 mView, SLOT( goNext() ) );
889 action->addTo( iconToolBar ); 946 action->addTo( iconToolBar );
890 } 947 }
891 icon = loadPixmap( pathString + "2rightarrowB" ); 948 icon = loadPixmap( pathString + "2rightarrowB" );
892 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 949 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
893 if (p-> mShowIconForwardFast) { 950 if (p-> mShowIconForwardFast) {
894 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 951 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
895 connect( action, SIGNAL( activated() ), 952 connect( action, SIGNAL( activated() ),
896 mView, SLOT( goNextMonth() ) ); 953 mView, SLOT( goNextMonth() ) );
897 action->addTo( iconToolBar ); 954 action->addTo( iconToolBar );
898 } 955 }
899 956
900 957
901 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 958 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
902 959
903 if (p-> mShowIconNewEvent) 960 if (p-> mShowIconNewEvent)
904 configureToolBarMenu->setItemChecked( 10, true ); 961 configureToolBarMenu->setItemChecked( 10, true );
905 if (p->mShowIconNewTodo ) 962 if (p->mShowIconNewTodo )
906 configureToolBarMenu->setItemChecked( 20, true ); 963 configureToolBarMenu->setItemChecked( 20, true );
907 if (p-> mShowIconSearch) 964 if (p-> mShowIconSearch)
908 configureToolBarMenu->setItemChecked( 120, true ); 965 configureToolBarMenu->setItemChecked( 120, true );
909 if (p-> mShowIconList) 966 if (p-> mShowIconList)
910 configureToolBarMenu->setItemChecked( 30, true ); 967 configureToolBarMenu->setItemChecked( 30, true );
911 if (p-> mShowIconDay1) 968 if (p-> mShowIconDay1)
912 configureToolBarMenu->setItemChecked( 40, true ); 969 configureToolBarMenu->setItemChecked( 40, true );
913 if (p-> mShowIconDay5) 970 if (p-> mShowIconDay5)
914 configureToolBarMenu->setItemChecked( 50, true ); 971 configureToolBarMenu->setItemChecked( 50, true );
915 if (p-> mShowIconDay7) 972 if (p-> mShowIconDay7)
916 configureToolBarMenu->setItemChecked( 60, true ); 973 configureToolBarMenu->setItemChecked( 60, true );
917 if (p-> mShowIconMonth) 974 if (p-> mShowIconMonth)
918 configureToolBarMenu->setItemChecked( 70, true ); 975 configureToolBarMenu->setItemChecked( 70, true );
919 if (p-> mShowIconTodoview) 976 if (p-> mShowIconTodoview)
920 configureToolBarMenu->setItemChecked( 80, true ); 977 configureToolBarMenu->setItemChecked( 80, true );
921 if (p-> mShowIconBackFast) 978 if (p-> mShowIconBackFast)
922 configureToolBarMenu->setItemChecked( 200, true ); 979 configureToolBarMenu->setItemChecked( 200, true );
923 if (p-> mShowIconBack) 980 if (p-> mShowIconBack)
924 configureToolBarMenu->setItemChecked( 210, true ); 981 configureToolBarMenu->setItemChecked( 210, true );
925 if (p-> mShowIconToday) 982 if (p-> mShowIconToday)
926 configureToolBarMenu->setItemChecked( 130, true ); 983 configureToolBarMenu->setItemChecked( 130, true );
927 if (p-> mShowIconForward) 984 if (p-> mShowIconForward)
928 configureToolBarMenu->setItemChecked( 220, true ); 985 configureToolBarMenu->setItemChecked( 220, true );
929 if (p-> mShowIconForwardFast) 986 if (p-> mShowIconForwardFast)
930 configureToolBarMenu->setItemChecked( 230, true ); 987 configureToolBarMenu->setItemChecked( 230, true );
931 if (p-> mShowIconNextDays) 988 if (p-> mShowIconNextDays)
932 configureToolBarMenu->setItemChecked( 100, true ); 989 configureToolBarMenu->setItemChecked( 100, true );
933 if (p-> mShowIconNext) 990 if (p-> mShowIconNext)
934 configureToolBarMenu->setItemChecked( 110, true ); 991 configureToolBarMenu->setItemChecked( 110, true );
935 if (p-> mShowIconJournal) 992 if (p-> mShowIconJournal)
936 configureToolBarMenu->setItemChecked( 90, true ); 993 configureToolBarMenu->setItemChecked( 90, true );
937 if (p-> mShowIconWhatsThis) 994 if (p-> mShowIconWhatsThis)
938 configureToolBarMenu->setItemChecked( 300, true ); 995 configureToolBarMenu->setItemChecked( 300, true );
939 996
940 QLabel* dummy = new QLabel( iconToolBar ); 997 QLabel* dummy = new QLabel( iconToolBar );
941 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 998 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
942 if (!p-> mShowIconStretch) 999 if (!p-> mShowIconStretch)
943 iconToolBar->setStretchableWidget ( dummy ) ; 1000 iconToolBar->setStretchableWidget ( dummy ) ;
944 else 1001 else
945 configureToolBarMenu->setItemChecked( 5, true ); 1002 configureToolBarMenu->setItemChecked( 5, true );
946 if (p-> mShowIconWhatsThis) 1003 if (p-> mShowIconWhatsThis)
947 QWhatsThis::whatsThisButton ( iconToolBar ); 1004 QWhatsThis::whatsThisButton ( iconToolBar );
948 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1005 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
949 configureAgenda( p->mHourSize ); 1006 configureAgenda( p->mHourSize );
950 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1007 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
951} 1008}
952 1009
953void MainWindow::exportToPhone( int mode ) 1010void MainWindow::exportToPhone( int mode )
954{ 1011{
955 1012
956 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1013 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
957 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1014 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
958 KOex2phonePrefs ex2phone; 1015 KOex2phonePrefs ex2phone;
959 1016
960 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1017 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
961 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1018 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
962 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1019 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
963 if ( mode == 1 ) 1020 if ( mode == 1 )
964 ex2phone.setCaption(i18n("Export complete calendar")); 1021 ex2phone.setCaption(i18n("Export complete calendar"));
965 if ( mode == 2 ) 1022 if ( mode == 2 )
966 ex2phone.setCaption(i18n("Export filtered calendar")); 1023 ex2phone.setCaption(i18n("Export filtered calendar"));
967 1024
968 if ( !ex2phone.exec() ) { 1025 if ( !ex2phone.exec() ) {
969 return; 1026 return;
970 } 1027 }
971 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1028 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
972 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1029 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
973 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1030 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
974 1031
975 int inFuture = 0; 1032 int inFuture = 0;
976 if ( ex2phone.mWriteBackFuture->isChecked() ) 1033 if ( ex2phone.mWriteBackFuture->isChecked() )
977 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1034 inFuture = ex2phone.mWriteBackFutureWeeks->value();
978 QPtrList<Incidence> delSel; 1035 QPtrList<Incidence> delSel;
979 if ( mode == 1 ) 1036 if ( mode == 1 )
980 delSel = mCalendar->rawIncidences(); 1037 delSel = mCalendar->rawIncidences();
981 if ( mode == 2 ) 1038 if ( mode == 2 )
982 delSel = mCalendar->incidences(); 1039 delSel = mCalendar->incidences();
983 CalendarLocal* cal = new CalendarLocal(); 1040 CalendarLocal* cal = new CalendarLocal();
984 cal->setLocalTime(); 1041 cal->setLocalTime();
985 Incidence *incidence = delSel.first(); 1042 Incidence *incidence = delSel.first();
986 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1043 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
987 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1044 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
988 while ( incidence ) { 1045 while ( incidence ) {
989 if ( incidence->type() != "Journal" ) { 1046 if ( incidence->type() != "Journal" ) {
990 bool add = true; 1047 bool add = true;
991 if ( inFuture ) { 1048 if ( inFuture ) {
992 QDateTime dt; 1049 QDateTime dt;
993 if ( incidence->type() == "Todo" ) { 1050 if ( incidence->type() == "Todo" ) {
994 Todo * t = (Todo*)incidence; 1051 Todo * t = (Todo*)incidence;
995 if ( t->hasDueDate() ) 1052 if ( t->hasDueDate() )
996 dt = t->dtDue(); 1053 dt = t->dtDue();
997 else 1054 else
998 dt = cur.addSecs( 62 ); 1055 dt = cur.addSecs( 62 );
999 } 1056 }
1000 else { 1057 else {
1001 bool ok; 1058 bool ok;
1002 dt = incidence->getNextOccurence( cur, &ok ); 1059 dt = incidence->getNextOccurence( cur, &ok );
1003 if ( !ok ) 1060 if ( !ok )
1004 dt = cur.addSecs( -62 ); 1061 dt = cur.addSecs( -62 );
1005 } 1062 }
1006 if ( dt < cur || dt > end ) { 1063 if ( dt < cur || dt > end ) {
1007 add = false; 1064 add = false;
1008 } 1065 }
1009 } 1066 }
1010 if ( add ) { 1067 if ( add ) {
1011 Incidence *in = incidence->clone(); 1068 Incidence *in = incidence->clone();
1012 cal->addIncidence( in ); 1069 cal->addIncidence( in );
1013 } 1070 }
1014 } 1071 }
1015 incidence = delSel.next(); 1072 incidence = delSel.next();
1016 } 1073 }
1017 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1074 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1018 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1075 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1019 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1076 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1020 1077
1021 setCaption( i18n("Writing to phone...")); 1078 setCaption( i18n("Writing to phone..."));
1022 if ( PhoneFormat::writeToPhone( cal ) ) 1079 if ( PhoneFormat::writeToPhone( cal ) )
1023 setCaption( i18n("Export to phone successful!")); 1080 setCaption( i18n("Export to phone successful!"));
1024 else 1081 else
1025 setCaption( i18n("Error exporting to phone!")); 1082 setCaption( i18n("Error exporting to phone!"));
1026 delete cal; 1083 delete cal;
1027} 1084}
1028 1085
1029 1086
1030void MainWindow::setDefaultPreferences() 1087void MainWindow::setDefaultPreferences()
1031{ 1088{
1032 KOPrefs *p = KOPrefs::instance(); 1089 KOPrefs *p = KOPrefs::instance();
1033 1090
1034 p->mCompactDialogs = true; 1091 p->mCompactDialogs = true;
1035 p->mConfirm = true; 1092 p->mConfirm = true;
1036 // p->mEnableQuickTodo = false; 1093 // p->mEnableQuickTodo = false;
1037 1094
1038} 1095}
1039 1096
1040QString MainWindow::resourcePath() 1097QString MainWindow::resourcePath()
1041{ 1098{
1042 return KGlobal::iconLoader()->iconPath(); 1099 return KGlobal::iconLoader()->iconPath();
1043} 1100}
1044 1101
1045void MainWindow::displayText( QString text ,QString cap ) 1102void MainWindow::displayText( QString text ,QString cap )
1046{ 1103{
1047 QDialog dia( this, "name", true ); ; 1104 QDialog dia( this, "name", true ); ;
1048 dia.setCaption( cap ); 1105 dia.setCaption( cap );
1049 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1106 QVBoxLayout* lay = new QVBoxLayout( &dia );
1050 lay->setSpacing( 3 ); 1107 lay->setSpacing( 3 );
1051 lay->setMargin( 3 ); 1108 lay->setMargin( 3 );
1052 QTextBrowser tb ( &dia ); 1109 QTextBrowser tb ( &dia );
1053 lay->addWidget( &tb ); 1110 lay->addWidget( &tb );
1054 tb.setText( text ); 1111 tb.setText( text );
1055#ifdef DESKTOP_VERSION 1112#ifdef DESKTOP_VERSION
1056 dia.resize( 640, 480); 1113 dia.resize( 640, 480);
1057#else 1114#else
1058 dia.showMaximized(); 1115 dia.showMaximized();
1059#endif 1116#endif
1060 dia.exec(); 1117 dia.exec();
1061} 1118}
1062void MainWindow::displayFile( QString fn, QString cap ) 1119void MainWindow::displayFile( QString fn, QString cap )
1063{ 1120{
1064 QString fileName = resourcePath() + fn; 1121 QString fileName = resourcePath() + fn;
1065 QString text; 1122 QString text;
1066 QFile file( fileName ); 1123 QFile file( fileName );
1067 if (!file.open( IO_ReadOnly ) ) { 1124 if (!file.open( IO_ReadOnly ) ) {
1068 return ; 1125 return ;
1069 1126
1070 } 1127 }
1071 QTextStream ts( &file ); 1128 QTextStream ts( &file );
1072 text = ts.read(); 1129 text = ts.read();
1073 file.close(); 1130 file.close();
1074 displayText( text, cap); 1131 displayText( text, cap);
1075} 1132}
1076void MainWindow::features() 1133void MainWindow::features()
1077{ 1134{
1078 1135
1079 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1136 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1080} 1137}
1081 1138
1082void MainWindow::usertrans() 1139void MainWindow::usertrans()
1083{ 1140{
1084 1141
1085 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1142 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1086} 1143}
1087 1144
1088void MainWindow::synchowto() 1145void MainWindow::synchowto()
1089{ 1146{
1090 1147
1091 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1148 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1092} 1149}
1093void MainWindow::faq() 1150void MainWindow::faq()
1094{ 1151{
1095 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1152 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1096 1153
1097} 1154}
1098void MainWindow::whatsNew() 1155void MainWindow::whatsNew()
1099{ 1156{
1100 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1157 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1101 1158
1102} 1159}
1103void MainWindow::licence() 1160void MainWindow::licence()
1104{ 1161{
1105 KApplication::showLicence(); 1162 KApplication::showLicence();
1106 1163
1107} 1164}
1108void MainWindow::about() 1165void MainWindow::about()
1109{ 1166{
1110 QString version; 1167 QString version;
1111#include <../version> 1168#include <../version>
1112 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1169 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1113 i18n("KOrganizer/Platform-independent\n") + 1170 i18n("KOrganizer/Platform-independent\n") +
1114 "(KO/Pi) " + version + " - " + 1171 "(KO/Pi) " + version + " - " +
1115 1172
1116#ifdef DESKTOP_VERSION 1173#ifdef DESKTOP_VERSION
1117 i18n("Desktop Edition\n") + 1174 i18n("Desktop Edition\n") +
1118#else 1175#else
1119 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1176 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1120#endif 1177#endif
1121 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1178 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1122} 1179}
1123void MainWindow::keyBindings() 1180void MainWindow::keyBindings()
1124{ 1181{
1125 QString cap = i18n("Key bindings KOrganizer/Pi"); 1182 QString cap = i18n("Key bindings KOrganizer/Pi");
1126 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1183 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1127 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1184 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1128 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1185 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1129 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1186 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1130 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1187 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1131 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1188 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1132 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1189 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1133 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1190 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1134 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1191 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1135 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1192 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1136 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1193 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1137 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1194 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1195 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1196 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1197 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1198 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1199 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1200 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1201 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1202 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1146 i18n("<p><h3>In agenda view:</h3></p>\n") + 1203 i18n("<p><h3>In agenda view:</h3></p>\n") +
1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1204 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1205 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1149 i18n("<p><h3>In todo view:</h3></p>\n") + 1206 i18n("<p><h3>In todo view:</h3></p>\n") +
1150 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1207 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1151 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1208 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1152 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1209 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1153 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1210 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1211 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1155 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1212 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1156 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1213 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1157 i18n("<p><h3>In list view:</h3></p>\n") + 1214 i18n("<p><h3>In list view:</h3></p>\n") +
1158 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1215 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1159 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1216 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1160 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1217 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1161 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1218 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1162 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1219 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1163 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1220 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1164 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1221 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1165 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1222 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1166 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1223 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1167 i18n("<p><b>E</b>: Edit item</p>\n") + 1224 i18n("<p><b>E</b>: Edit item</p>\n") +
1168 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1225 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1169 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1226 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1170 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1227 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1171 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1228 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1172 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1229 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1173 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1230 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1174 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1231 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1175 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1232 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1176 i18n("<p><b>White</b>: Item readonly</p>\n"); 1233 i18n("<p><b>White</b>: Item readonly</p>\n");
1177 displayText( text, cap); 1234 displayText( text, cap);
1178 1235
1179} 1236}
1180void MainWindow::aboutAutoSaving() 1237void MainWindow::aboutAutoSaving()
1181{ 1238{
1182 QMessageBox* msg; 1239 QMessageBox* msg;
1183 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1240 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1184 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1241 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1185 QMessageBox::Ok, 1242 QMessageBox::Ok,
1186 QMessageBox::NoButton, 1243 QMessageBox::NoButton,
1187 QMessageBox::NoButton); 1244 QMessageBox::NoButton);
1188 msg->exec(); 1245 msg->exec();
1189 delete msg; 1246 delete msg;
1190 1247
1191 1248
1192} 1249}
1193void MainWindow::aboutKnownBugs() 1250void MainWindow::aboutKnownBugs()
1194{ 1251{
1195 QMessageBox* msg; 1252 QMessageBox* msg;
1196 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1253 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1197 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1254 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1198 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1255 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1199 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1256 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1200 i18n("\nor report them in the bugtracker on\n") + 1257 i18n("\nor report them in the bugtracker on\n") +
1201 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1258 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1202 QMessageBox::NoIcon, 1259 QMessageBox::NoIcon,
1203 QMessageBox::Ok, 1260 QMessageBox::Ok,
1204 QMessageBox::NoButton, 1261 QMessageBox::NoButton,
1205 QMessageBox::NoButton); 1262 QMessageBox::NoButton);
1206 msg->exec(); 1263 msg->exec();
1207 delete msg; 1264 delete msg;
1208 1265
1209} 1266}
1210 1267
1211QString MainWindow::defaultFileName() 1268QString MainWindow::defaultFileName()
1212{ 1269{
1213 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1270 return locateLocal( "data", "korganizer/mycalendar.ics" );
1214} 1271}
1215QString MainWindow::syncFileName() 1272QString MainWindow::syncFileName()
1216{ 1273{
1217#ifdef DESKTOP_VERSION 1274#ifdef DESKTOP_VERSION
1218 return locateLocal( "tmp", "synccalendar.ics" ); 1275 return locateLocal( "tmp", "synccalendar.ics" );
1219#else 1276#else
1220 return QString( "/tmp/synccalendar.ics" ); 1277 return QString( "/tmp/synccalendar.ics" );
1221#endif 1278#endif
1222} 1279}
1223 1280
1224void MainWindow::processIncidenceSelection( Incidence *incidence ) 1281void MainWindow::processIncidenceSelection( Incidence *incidence )
1225{ 1282{
1226 if ( !incidence ) { 1283 if ( !incidence ) {
1227 enableIncidenceActions( false ); 1284 enableIncidenceActions( false );
1228 1285
1229 mNewSubTodoAction->setEnabled( false ); 1286 mNewSubTodoAction->setEnabled( false );
1230 setCaptionToDates(); 1287 setCaptionToDates();
1231 return; 1288 return;
1232 1289
1233 } 1290 }
1234 1291
1235 //KGlobal::locale()->formatDateTime(nextA, true); 1292 //KGlobal::locale()->formatDateTime(nextA, true);
1236 QString startString = ""; 1293 QString startString = "";
1237 if ( incidence->type() != "Todo" ) { 1294 if ( incidence->type() != "Todo" ) {
1238 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1295 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1239 if ( incidence->doesFloat() ) { 1296 if ( incidence->doesFloat() ) {
1240 startString += ": "+incidence->dtStartDateStr( true ); 1297 startString += ": "+incidence->dtStartDateStr( true );
1241 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1298 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1242 1299
1243 } else { 1300 } else {
1244 startString = ": "+incidence->dtStartStr(true); 1301 startString = ": "+incidence->dtStartStr(true);
1245 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1302 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1246 1303
1247 } 1304 }
1248 1305
1249 } else { 1306 } else {
1250 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1307 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1251 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1308 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1252 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1309 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1253 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1310 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1254 } 1311 }
1255 1312
1256 } 1313 }
1257 else 1314 else
1258 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1315 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1259 if ( !incidence->location().isEmpty() ) 1316 if ( !incidence->location().isEmpty() )
1260 startString += " (" +incidence->location()+")"; 1317 startString += " (" +incidence->location()+")";
1261 setCaption( incidence->summary()+startString); 1318 setCaption( incidence->summary()+startString);
1262 1319
1263 enableIncidenceActions( true ); 1320 enableIncidenceActions( true );
1264 1321
1265 if ( incidence->type() == "Event" ) { 1322 if ( incidence->type() == "Event" ) {
1266 mShowAction->setText( i18n("Show Event...") ); 1323 mShowAction->setText( i18n("Show Event...") );
1267 mEditAction->setText( i18n("Edit Event...") ); 1324 mEditAction->setText( i18n("Edit Event...") );
1268 mDeleteAction->setText( i18n("Delete Event...") ); 1325 mDeleteAction->setText( i18n("Delete Event...") );
1269 1326
1270 mNewSubTodoAction->setEnabled( false ); 1327 mNewSubTodoAction->setEnabled( false );
1271 } else if ( incidence->type() == "Todo" ) { 1328 } else if ( incidence->type() == "Todo" ) {
1272 mShowAction->setText( i18n("Show Todo...") ); 1329 mShowAction->setText( i18n("Show Todo...") );
1273 mEditAction->setText( i18n("Edit Todo...") ); 1330 mEditAction->setText( i18n("Edit Todo...") );
1274 mDeleteAction->setText( i18n("Delete Todo...") ); 1331 mDeleteAction->setText( i18n("Delete Todo...") );
1275 1332
1276 mNewSubTodoAction->setEnabled( true ); 1333 mNewSubTodoAction->setEnabled( true );
1277 } else { 1334 } else {
1278 mShowAction->setText( i18n("Show...") ); 1335 mShowAction->setText( i18n("Show...") );
1279 mShowAction->setText( i18n("Edit...") ); 1336 mShowAction->setText( i18n("Edit...") );
1280 mShowAction->setText( i18n("Delete...") ); 1337 mShowAction->setText( i18n("Delete...") );
1281 1338
1282 mNewSubTodoAction->setEnabled( false ); 1339 mNewSubTodoAction->setEnabled( false );
1283 } 1340 }
1284} 1341}
1285 1342
1286void MainWindow::enableIncidenceActions( bool enabled ) 1343void MainWindow::enableIncidenceActions( bool enabled )
1287{ 1344{
1288 mShowAction->setEnabled( enabled ); 1345 mShowAction->setEnabled( enabled );
1289 mEditAction->setEnabled( enabled ); 1346 mEditAction->setEnabled( enabled );
1290 mDeleteAction->setEnabled( enabled ); 1347 mDeleteAction->setEnabled( enabled );
1291 1348
1292 mCloneAction->setEnabled( enabled ); 1349 mCloneAction->setEnabled( enabled );
1293 mMoveAction->setEnabled( enabled ); 1350 mMoveAction->setEnabled( enabled );
1294 mBeamAction->setEnabled( enabled ); 1351 mBeamAction->setEnabled( enabled );
1295 mCancelAction->setEnabled( enabled ); 1352 mCancelAction->setEnabled( enabled );
1296} 1353}
1297 1354
1298void MainWindow::importOL() 1355void MainWindow::importOL()
1299{ 1356{
1300#ifdef _WIN32_ 1357#ifdef _WIN32_
1301 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1358 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1302 id->exec(); 1359 id->exec();
1303 delete id; 1360 delete id;
1304 mView->updateView(); 1361 mView->updateView();
1305#endif 1362#endif
1306} 1363}
1307void MainWindow::importBday() 1364void MainWindow::importBday()
1308{ 1365{
1309 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1366 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1310 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1367 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1311 i18n("Import!"), i18n("Cancel"), 0, 1368 i18n("Import!"), i18n("Cancel"), 0,
1312 0, 1 ); 1369 0, 1 );
1313 if ( result == 0 ) { 1370 if ( result == 0 ) {
1314 mView->importBday(); 1371 mView->importBday();
1315 1372
1316 } 1373 }
1317 1374
1318 1375
1319} 1376}
1320void MainWindow::importQtopia() 1377void MainWindow::importQtopia()
1321{ 1378{
1322#ifndef DESKTOP_VERSION 1379#ifndef DESKTOP_VERSION
1323 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1380 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1324 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1381 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1325 i18n("Import!"), i18n("Cancel"), 0, 1382 i18n("Import!"), i18n("Cancel"), 0,
1326 0, 1 ); 1383 0, 1 );
1327 if ( result == 0 ) { 1384 if ( result == 0 ) {
1328 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1385 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1329 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1386 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1330 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1387 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1331 mView->importQtopia( categories, datebook, todolist ); 1388 mView->importQtopia( categories, datebook, todolist );
1332 } 1389 }
1333#else 1390#else
1334 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1391 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1335 i18n("Not supported \non desktop!\n"), 1392 i18n("Not supported \non desktop!\n"),
1336 i18n("Ok"), i18n("Cancel"), 0, 1393 i18n("Ok"), i18n("Cancel"), 0,
1337 0, 1 ); 1394 0, 1 );
1338 1395
1339#endif 1396#endif
1340} 1397}
1341 1398
1342void MainWindow::saveOnClose() 1399void MainWindow::saveOnClose()
1343{ 1400{
1344 KOPrefs *p = KOPrefs::instance(); 1401 KOPrefs *p = KOPrefs::instance();
1345 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1402 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1346 p->mToolBarUp = iconToolBar->x() > width()/2 || 1403 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1347 iconToolBar->y() > height()/2; 1404 iconToolBar->y() > height()/2;
1348 mView->writeSettings(); 1405 mView->writeSettings();
1349 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1406 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1350 save(); 1407 save();
1351} 1408}
1352void MainWindow::slotModifiedChanged( bool changed ) 1409void MainWindow::slotModifiedChanged( bool changed )
1353{ 1410{
1354 if ( mBlockAtStartup ) 1411 if ( mBlockAtStartup )
1355 return; 1412 return;
1356 int msec; 1413 int msec;
1357 // we store the changes after 1 minute, 1414 // we store the changes after 1 minute,
1358 // and for safety reasons after 10 minutes again 1415 // and for safety reasons after 10 minutes again
1359 if ( !mSyncManager->blockSave() ) 1416 if ( !mSyncManager->blockSave() )
1360 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1417 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1361 else 1418 else
1362 msec = 1000 * 600; 1419 msec = 1000 * 600;
1363 mSaveTimer.start( msec, true ); // 1 minute 1420 mSaveTimer.start( msec, true ); // 1 minute
1364 qDebug("KO: Saving File in %d secs!", msec/1000); 1421 qDebug("KO: Saving File in %d secs!", msec/1000);
1365 mCalendarModifiedFlag = true; 1422 mCalendarModifiedFlag = true;
1366} 1423}
1367void MainWindow::save() 1424void MainWindow::save()
1368{ 1425{
1369 if ( mSyncManager->blockSave() ) 1426 if ( mSyncManager->blockSave() )
1370 return; 1427 return;
1371 mSyncManager->setBlockSave(true); 1428 mSyncManager->setBlockSave(true);
1372 if ( mView->checkFileVersion( defaultFileName()) ) { 1429 if ( mView->checkFileVersion( defaultFileName()) ) {
1373 1430
1374 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1431 QTime neededSaveTime = QDateTime::currentDateTime().time();
1375 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1432 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1376 qDebug("KO: Start saving data to file!"); 1433 qDebug("KO: Start saving data to file!");
1377 mView->saveCalendar( defaultFileName() ); 1434 mView->saveCalendar( defaultFileName() );
1378 1435
1379 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1436 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1380 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1437 qDebug("KO: Needed %d ms for saving.",msNeeded );
1381 QString savemes; 1438 QString savemes;
1382 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1439 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1383 setCaption(savemes); 1440 setCaption(savemes);
1384 } else 1441 } else
1385 setCaption(i18n("Saving cancelled!")); 1442 setCaption(i18n("Saving cancelled!"));
1386 mCalendarModifiedFlag = false; 1443 mCalendarModifiedFlag = false;
1387 mSyncManager->setBlockSave( false ); 1444 mSyncManager->setBlockSave( false );
1388} 1445}
1389 1446
1390void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1447void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1391{ 1448{
1392 if ( !e->isAutoRepeat() ) { 1449 if ( !e->isAutoRepeat() ) {
1393 mFlagKeyPressed = false; 1450 mFlagKeyPressed = false;
1394 } 1451 }
1395} 1452}
1396void MainWindow::keyPressEvent ( QKeyEvent * e ) 1453void MainWindow::keyPressEvent ( QKeyEvent * e )
1397{ 1454{
1398 qApp->processEvents(); 1455 qApp->processEvents();
1399 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1456 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1400 e->ignore(); 1457 e->ignore();
1401 // qDebug(" ignore %d",e->isAutoRepeat() ); 1458 // qDebug(" ignore %d",e->isAutoRepeat() );
1402 return; 1459 return;
1403 } 1460 }
1404 if (! e->isAutoRepeat() ) 1461 if (! e->isAutoRepeat() )
1405 mFlagKeyPressed = true; 1462 mFlagKeyPressed = true;
1406 KOPrefs *p = KOPrefs::instance(); 1463 KOPrefs *p = KOPrefs::instance();
1407 bool showSelectedDates = false; 1464 bool showSelectedDates = false;
1408 int size; 1465 int size;
1409 int pro = 0; 1466 int pro = 0;
1410 //qDebug("MainWindow::keyPressEvent "); 1467 //qDebug("MainWindow::keyPressEvent ");
1411 switch ( e->key() ) { 1468 switch ( e->key() ) {
1412 case Qt::Key_Right: 1469 case Qt::Key_Right:
1413 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1470 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1414 mView->goNextMonth(); 1471 mView->goNextMonth();
1415 else 1472 else
1416 mView->goNext(); 1473 mView->goNext();
1417 showSelectedDates = true; 1474 showSelectedDates = true;
1418 break; 1475 break;
1419 case Qt::Key_Left: 1476 case Qt::Key_Left:
1420 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1477 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1421 mView->goPreviousMonth(); 1478 mView->goPreviousMonth();
1422 else 1479 else
1423 mView->goPrevious(); 1480 mView->goPrevious();
1424 showSelectedDates = true; 1481 showSelectedDates = true;
1425 break; 1482 break;
1426 case Qt::Key_Down: 1483 case Qt::Key_Down:
1427 mView->viewManager()->agendaView()->scrollOneHourDown(); 1484 mView->viewManager()->agendaView()->scrollOneHourDown();
1428 break; 1485 break;
1429 case Qt::Key_Up: 1486 case Qt::Key_Up:
1430 mView->viewManager()->agendaView()->scrollOneHourUp(); 1487 mView->viewManager()->agendaView()->scrollOneHourUp();
1431 break; 1488 break;
1432 case Qt::Key_I: 1489 case Qt::Key_I:
1433 mView->showIncidence(); 1490 mView->showIncidence();
1434 break; 1491 break;
1435 case Qt::Key_Delete: 1492 case Qt::Key_Delete:
1436 case Qt::Key_Backspace: 1493 case Qt::Key_Backspace:
1437 mView->deleteIncidence(); 1494 mView->deleteIncidence();
1438 break; 1495 break;
1439 case Qt::Key_D: 1496 case Qt::Key_D:
1440 mView->viewManager()->showDayView(); 1497 mView->viewManager()->showDayView();
1441 showSelectedDates = true; 1498 showSelectedDates = true;
1442 break; 1499 break;
1443 case Qt::Key_O: 1500 case Qt::Key_O:
1444 mView->toggleFilerEnabled( ); 1501 mView->toggleFilerEnabled( );
1445 break; 1502 break;
1446 case Qt::Key_0: 1503 case Qt::Key_0:
1447 case Qt::Key_1: 1504 case Qt::Key_1:
1448 case Qt::Key_2: 1505 case Qt::Key_2:
1449 case Qt::Key_3: 1506 case Qt::Key_3:
1450 case Qt::Key_4: 1507 case Qt::Key_4:
1451 case Qt::Key_5: 1508 case Qt::Key_5:
1452 case Qt::Key_6: 1509 case Qt::Key_6:
1453 case Qt::Key_7: 1510 case Qt::Key_7:
1454 case Qt::Key_8: 1511 case Qt::Key_8:
1455 case Qt::Key_9: 1512 case Qt::Key_9:
1456 pro = e->key()-48; 1513 pro = e->key()-48;
1457 if ( pro == 0 ) 1514 if ( pro == 0 )
1458 pro = 10; 1515 pro = 10;
1459 if ( e->state() == Qt::ControlButton) 1516 if ( e->state() == Qt::ControlButton)
1460 pro += 10; 1517 pro += 10;
1461 break; 1518 break;
1462 case Qt::Key_M: 1519 case Qt::Key_M:
1463 mView->viewManager()->showMonthView(); 1520 mView->viewManager()->showMonthView();
1464 showSelectedDates = true; 1521 showSelectedDates = true;
1465 break; 1522 break;
1466 case Qt::Key_Insert: 1523 case Qt::Key_Insert:
1467 mView->newEvent(); 1524 mView->newEvent();
1468 break; 1525 break;
1469 case Qt::Key_S : 1526 case Qt::Key_S :
1470 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1527 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1471 mView->newSubTodo(); 1528 mView->newSubTodo();
1472 else 1529 else
1473 mView->dialogManager()->showSearchDialog(); 1530 mView->dialogManager()->showSearchDialog();
1474 break; 1531 break;
1475 case Qt::Key_Y : 1532 case Qt::Key_Y :
1476 case Qt::Key_Z : 1533 case Qt::Key_Z :
1477 mView->viewManager()->showWorkWeekView(); 1534 mView->viewManager()->showWorkWeekView();
1478 showSelectedDates = true; 1535 showSelectedDates = true;
1479 break; 1536 break;
1480 case Qt::Key_U : 1537 case Qt::Key_U :
1481 mView->viewManager()->showWeekView(); 1538 mView->viewManager()->showWeekView();
1482 showSelectedDates = true; 1539 showSelectedDates = true;
1483 break; 1540 break;
1484 case Qt::Key_H : 1541 case Qt::Key_H :
1485 keyBindings(); 1542 keyBindings();
1486 break; 1543 break;
1487 case Qt::Key_W: 1544 case Qt::Key_W:
1488 mView->viewManager()->showWhatsNextView(); 1545 mView->viewManager()->showWhatsNextView();
1489 break; 1546 break;
1490 case Qt::Key_L: 1547 case Qt::Key_L:
1491 mView->viewManager()->showListView(); 1548 mView->viewManager()->showListView();
1492 break; 1549 break;
1493 case Qt::Key_N: 1550 case Qt::Key_N:
1494 mView->viewManager()->showNextXView(); 1551 mView->viewManager()->showNextXView();
1495 showSelectedDates = true; 1552 showSelectedDates = true;
1496 break; 1553 break;
1497 case Qt::Key_V: 1554 case Qt::Key_V:
1498 mView->viewManager()->showTodoView(); 1555 mView->viewManager()->showTodoView();
1499 break; 1556 break;
1500 case Qt::Key_C: 1557 case Qt::Key_C:
1501 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1558 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1502 break; 1559 break;
1503 case Qt::Key_P: 1560 case Qt::Key_P:
1504 mView->showDatePicker( ); 1561 mView->showDatePicker( );
1505 break; 1562 break;
1506 case Qt::Key_F: 1563 case Qt::Key_F:
1507 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1564 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1508 mView->editFilters(); 1565 mView->editFilters();
1509 else 1566 else
1510 mView->toggleFilter(); 1567 mView->toggleFilter();
1511 break; 1568 break;
1512 case Qt::Key_X: 1569 case Qt::Key_X:
1513 mView->toggleDateNavigatorWidget(); 1570 mView->toggleDateNavigatorWidget();
1514 break; 1571 break;
1515 case Qt::Key_Space: 1572 case Qt::Key_Space:
1516 mView->toggleExpand(); 1573 mView->toggleExpand();
1517 break; 1574 break;
1518 case Qt::Key_A: 1575 case Qt::Key_A:
1519 mView->toggleAllDaySize(); 1576 mView->toggleAllDaySize();
1520 break; 1577 break;
1521 case Qt::Key_T: 1578 case Qt::Key_T:
1522 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1579 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1523 mView->newTodo(); 1580 mView->newTodo();
1524 else { 1581 else {
1525 mView->goToday(); 1582 mView->goToday();
1526 showSelectedDates = true; 1583 showSelectedDates = true;
1527 } 1584 }
1528 break; 1585 break;
1529 case Qt::Key_J: 1586 case Qt::Key_J:
1530 mView->viewManager()->showJournalView(); 1587 mView->viewManager()->showJournalView();
1531 break; 1588 break;
1532 case Qt::Key_B: 1589 case Qt::Key_B:
1533 mView->editIncidenceDescription();; 1590 mView->editIncidenceDescription();;
1534 break; 1591 break;
1535 // case Qt::Key_Return: 1592 // case Qt::Key_Return:
1536 case Qt::Key_E: 1593 case Qt::Key_E:
1537 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1594 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1538 mView->newEvent(); 1595 mView->newEvent();
1539 else 1596 else
1540 mView->editIncidence(); 1597 mView->editIncidence();
1541 break; 1598 break;
1542 case Qt::Key_Plus: 1599 case Qt::Key_Plus:
1543 size = p->mHourSize +2; 1600 size = p->mHourSize +2;
1544 if ( size <= 18 ) 1601 if ( size <= 18 )
1545 configureAgenda( size ); 1602 configureAgenda( size );
1546 break; 1603 break;
1547 case Qt::Key_Minus: 1604 case Qt::Key_Minus:
1548 size = p->mHourSize - 2; 1605 size = p->mHourSize - 2;
1549 if ( size >= 4 ) 1606 if ( size >= 4 )
1550 configureAgenda( size ); 1607 configureAgenda( size );
1551 break; 1608 break;
1552 1609
1553 1610
1554 default: 1611 default:
1555 e->ignore(); 1612 e->ignore();
1556 } 1613 }
1557 if ( pro > 0 ) { 1614 if ( pro > 0 ) {
1558 mView->selectFilter( pro-1 ); 1615 mView->selectFilter( pro-1 );
1559 } 1616 }
1560 if ( showSelectedDates ) { 1617 if ( showSelectedDates ) {
1561 ;// setCaptionToDates(); 1618 ;// setCaptionToDates();
1562 } 1619 }
1563 1620
1564} 1621}
1565 1622
1566void MainWindow::fillFilterMenu() 1623void MainWindow::fillFilterMenu()
1567{ 1624{
1568 selectFilterMenu->clear(); 1625 selectFilterMenu->clear();
1569 bool disable = false; 1626 bool disable = false;
1570 if ( mView->filterView()->filtersEnabled() ) { 1627 if ( mView->filterView()->filtersEnabled() ) {
1571 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1628 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1572 } 1629 }
1573 else { 1630 else {
1574 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1631 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1575 disable = true; 1632 disable = true;
1576 } 1633 }
1577 selectFilterMenu->insertSeparator(); 1634 selectFilterMenu->insertSeparator();
1578 QPtrList<CalFilter> fili = mView->filters(); 1635 QPtrList<CalFilter> fili = mView->filters();
1579 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1636 CalFilter *curfilter = mView->filterView()->selectedFilter();
1580 CalFilter *filter = fili.first(); 1637 CalFilter *filter = fili.first();
1581 int iii = 1; 1638 int iii = 1;
1582 while(filter) { 1639 while(filter) {
1583 selectFilterMenu->insertItem( filter->name(), iii ); 1640 selectFilterMenu->insertItem( filter->name(), iii );
1584 if ( filter == curfilter) 1641 if ( filter == curfilter)
1585 selectFilterMenu->setItemChecked( iii, true ); 1642 selectFilterMenu->setItemChecked( iii, true );
1586 if ( disable ) 1643 if ( disable )
1587 selectFilterMenu->setItemEnabled( iii, false ); 1644 selectFilterMenu->setItemEnabled( iii, false );
1588 filter = fili.next(); 1645 filter = fili.next();
1589 ++iii; 1646 ++iii;
1590 } 1647 }
1591} 1648}
1592void MainWindow::selectFilter( int fil ) 1649void MainWindow::selectFilter( int fil )
1593{ 1650{
1594 if ( fil == 0 ) { 1651 if ( fil == 0 ) {
1595 mView->toggleFilerEnabled( ); 1652 mView->toggleFilerEnabled( );
1596 } else { 1653 } else {
1597 mView->selectFilter( fil-1 ); 1654 mView->selectFilter( fil-1 );
1598 } 1655 }
1599} 1656}
1600void MainWindow::configureToolBar( int item ) 1657void MainWindow::configureToolBar( int item )
1601{ 1658{
1602 1659
1603 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1660 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1604 KOPrefs *p = KOPrefs::instance(); 1661 KOPrefs *p = KOPrefs::instance();
1605 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1662 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1606 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1663 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1607 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1664 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1608 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1665 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1609 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1666 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1610 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1667 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1611 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1668 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1612 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1669 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1613 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1670 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1614 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1671 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1615 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1672 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1616 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1673 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1617 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1674 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1618 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1675 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1619 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1676 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1620 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1677 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1621 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1678 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1622 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1679 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1623 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1680 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1624 // initActions(); 1681 // initActions();
1625} 1682}
1626 1683
1627void MainWindow::setCaptionToDates() 1684void MainWindow::setCaptionToDates()
1628{ 1685{
1629 QString selDates; 1686 QString selDates;
1630 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1687 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1631 if (mView->startDate() < mView->endDate() ) 1688 if (mView->startDate() < mView->endDate() )
1632 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1689 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1633 setCaption( i18n("Dates: ") + selDates ); 1690 setCaption( i18n("Dates: ") + selDates );
1634 1691
1635} 1692}
1636// parameter item == 0: reinit 1693// parameter item == 0: reinit
1637void MainWindow::configureAgenda( int item ) 1694void MainWindow::configureAgenda( int item )
1638{ 1695{
1639 1696
1640 KOPrefs *p = KOPrefs::instance(); 1697 KOPrefs *p = KOPrefs::instance();
1641 1698
1642 int i; 1699 int i;
1643 if ( item == 1 ) { 1700 if ( item == 1 ) {
1644 mView->toggleAllDaySize(); 1701 mView->toggleAllDaySize();
1645 return; 1702 return;
1646 } 1703 }
1647 // do not allow 4 for widgets higher than 480 1704 // do not allow 4 for widgets higher than 480
1648 // if ( QApplication::desktop()->height() > 480 ) { 1705 // if ( QApplication::desktop()->height() > 480 ) {
1649// if ( item == 4 ) 1706// if ( item == 4 )
1650// item = 6; 1707// item = 6;
1651// } 1708// }
1652 for ( i = 4; i <= 18; i= i+2 ) 1709 for ( i = 4; i <= 18; i= i+2 )
1653 configureAgendaMenu->setItemChecked( i, false ); 1710 configureAgendaMenu->setItemChecked( i, false );
1654 configureAgendaMenu->setItemChecked( item, true ); 1711 configureAgendaMenu->setItemChecked( item, true );
1655 if ( p->mHourSize == item ) 1712 if ( p->mHourSize == item )
1656 return; 1713 return;
1657 p->mHourSize=item; 1714 p->mHourSize=item;
1658 mView->viewManager()->agendaView()->updateConfig(); 1715 mView->viewManager()->agendaView()->updateConfig();
1659} 1716}
1660 1717
1661void MainWindow::saveCalendar() 1718void MainWindow::saveCalendar()
1662{ 1719{
1663 QString fn = KOPrefs::instance()->mLastSaveFile; 1720 QString fn = KOPrefs::instance()->mLastSaveFile;
1664 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1721 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1665 1722
1666 if ( fn == "" ) 1723 if ( fn == "" )
1667 return; 1724 return;
1668 QFileInfo info; 1725 QFileInfo info;
1669 info.setFile( fn ); 1726 info.setFile( fn );
1670 QString mes; 1727 QString mes;
1671 bool createbup = true; 1728 bool createbup = true;
1672 if ( info. exists() ) { 1729 if ( info. exists() ) {
1673 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1730 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1674 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1731 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1675 i18n("Overwrite!"), i18n("Cancel"), 0, 1732 i18n("Overwrite!"), i18n("Cancel"), 0,
1676 0, 1 ); 1733 0, 1 );
1677 if ( result != 0 ) { 1734 if ( result != 0 ) {
1678 createbup = false; 1735 createbup = false;
1679 } 1736 }
1680 } 1737 }
1681 if ( createbup ) { 1738 if ( createbup ) {
1682 mView->saveCalendar( fn ); 1739 mView->saveCalendar( fn );
1683 mes = i18n("KO/Pi:Saved %1").arg(fn); 1740 mes = i18n("KO/Pi:Saved %1").arg(fn);
1684 KOPrefs::instance()->mLastSaveFile = fn; 1741 KOPrefs::instance()->mLastSaveFile = fn;
1685 setCaption(mes); 1742 setCaption(mes);
1686 } 1743 }
1687} 1744}
1688void MainWindow::loadCalendar() 1745void MainWindow::loadCalendar()
1689{ 1746{
1690 1747
1691 QString fn = KOPrefs::instance()->mLastLoadFile; 1748 QString fn = KOPrefs::instance()->mLastLoadFile;
1692 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1749 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1693 1750
1694 if ( fn == "" ) 1751 if ( fn == "" )
1695 return; 1752 return;
1696 QFileInfo info; 1753 QFileInfo info;
1697 info.setFile( fn ); 1754 info.setFile( fn );
1698 QString mess; 1755 QString mess;
1699 bool loadbup = true; 1756 bool loadbup = true;
1700 if ( info. exists() ) { 1757 if ( info. exists() ) {
1701 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1758 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1702 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1759 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1703 mess, 1760 mess,
1704 i18n("Load!"), i18n("Cancel"), 0, 1761 i18n("Load!"), i18n("Cancel"), 0,
1705 0, 1 ); 1762 0, 1 );
1706 if ( result != 0 ) { 1763 if ( result != 0 ) {
1707 loadbup = false; 1764 loadbup = false;
1708 } 1765 }
1709 } else { 1766 } else {
1710 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1767 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1711 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1768 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1712 0, 1 ); 1769 0, 1 );
1713 1770
1714 return; 1771 return;
1715 } 1772 }
1716 if ( loadbup ) { 1773 if ( loadbup ) {
1717 mView->openCalendar( fn ); 1774 mView->openCalendar( fn );
1718 KOPrefs::instance()->mLastLoadFile = fn; 1775 KOPrefs::instance()->mLastLoadFile = fn;
1719 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1776 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1720 setCaption(mess); 1777 setCaption(mess);
1721 } 1778 }
1722 1779
1723} 1780}
1724void MainWindow::quickImportIcal() 1781void MainWindow::quickImportIcal()
1725{ 1782{
1726 importFile( KOPrefs::instance()->mLastImportFile, false ); 1783 importFile( KOPrefs::instance()->mLastImportFile, false );
1727} 1784}
1728void MainWindow::importFile( QString fn, bool quick ) 1785void MainWindow::importFile( QString fn, bool quick )
1729{ 1786{
1730 QFileInfo info; 1787 QFileInfo info;
1731 info.setFile( fn ); 1788 info.setFile( fn );
1732 QString mess; 1789 QString mess;
1733 bool loadbup = true; 1790 bool loadbup = true;
1734 if ( !info. exists() ) { 1791 if ( !info. exists() ) {
1735 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1792 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1736 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1793 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1737 mess ); 1794 mess );
1738 return; 1795 return;
1739 } 1796 }
1740 int result = 0; 1797 int result = 0;
1741 if ( !quick ) { 1798 if ( !quick ) {
1742 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1799 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1743 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1800 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1744 mess, 1801 mess,
1745 "Import", "Cancel", 0, 1802 "Import", "Cancel", 0,
1746 0, 1 ); 1803 0, 1 );
1747 } 1804 }
1748 if ( result == 0 ) { 1805 if ( result == 0 ) {
1749 if ( mView->openCalendar( fn, true )) { 1806 if ( mView->openCalendar( fn, true )) {
1750 KOPrefs::instance()->mLastImportFile = fn; 1807 KOPrefs::instance()->mLastImportFile = fn;
1751 setCaption(i18n("Imported file successfully")); 1808 setCaption(i18n("Imported file successfully"));
1752 } else { 1809 } else {
1753 setCaption(i18n("Error importing file")); 1810 setCaption(i18n("Error importing file"));
1754 } 1811 }
1755 } 1812 }
1756} 1813}
1757 1814
1758void MainWindow::importIcal() 1815void MainWindow::importIcal()
1759{ 1816{
1760 1817
1761 QString fn =KOPrefs::instance()->mLastImportFile; 1818 QString fn =KOPrefs::instance()->mLastImportFile;
1762 1819
1763 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1820 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1764 if ( fn == "" ) 1821 if ( fn == "" )
1765 return; 1822 return;
1766 importFile( fn, true ); 1823 importFile( fn, true );
1767 1824
1768} 1825}
1769 1826
1770void MainWindow::exportVCalendar() 1827void MainWindow::exportVCalendar()
1771{ 1828{
1772 QString fn = KOPrefs::instance()->mLastVcalFile; 1829 QString fn = KOPrefs::instance()->mLastVcalFile;
1773 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1830 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1774 if ( fn == "" ) 1831 if ( fn == "" )
1775 return; 1832 return;
1776 QFileInfo info; 1833 QFileInfo info;
1777 info.setFile( fn ); 1834 info.setFile( fn );
1778 QString mes; 1835 QString mes;
1779 bool createbup = true; 1836 bool createbup = true;
1780 if ( info. exists() ) { 1837 if ( info. exists() ) {
1781 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1838 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1782 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1839 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1783 i18n("Overwrite!"), i18n("Cancel"), 0, 1840 i18n("Overwrite!"), i18n("Cancel"), 0,
1784 0, 1 ); 1841 0, 1 );
1785 if ( result != 0 ) { 1842 if ( result != 0 ) {
1786 createbup = false; 1843 createbup = false;
1787 } 1844 }
1788 } 1845 }
1789 if ( createbup ) { 1846 if ( createbup ) {
1790 if ( mView->exportVCalendar( fn ) ) { 1847 if ( mView->exportVCalendar( fn ) ) {
1791 KOPrefs::instance()->mLastVcalFile = fn; 1848 KOPrefs::instance()->mLastVcalFile = fn;
1792 if ( fn.length() > 20 ) 1849 if ( fn.length() > 20 )
1793 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1850 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1794 else 1851 else
1795 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1852 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1796 setCaption(mes); 1853 setCaption(mes);
1797 } 1854 }
1798 } 1855 }
1799 1856
1800} 1857}
1801 1858
1802void MainWindow::syncFileRequest() 1859void MainWindow::syncFileRequest()
1803{ 1860{
1804 save(); 1861 save();
1805} 1862}
1806void MainWindow::getFile( bool success ) 1863void MainWindow::getFile( bool success )
1807{ 1864{
1808 if ( ! success ) { 1865 if ( ! success ) {
1809 setCaption( i18n("Error receiving file. Nothing changed!") ); 1866 setCaption( i18n("Error receiving file. Nothing changed!") );
1810 return; 1867 return;
1811 } 1868 }
1812 mView->openCalendar( defaultFileName() ); 1869 mView->openCalendar( defaultFileName() );
1813 setCaption( i18n("Pi-Sync successful!") ); 1870 setCaption( i18n("Pi-Sync successful!") );
1814} 1871}
1815 1872
1816void MainWindow::printSel( ) 1873void MainWindow::printSel( )
1817{ 1874{
1818 mView->viewManager()->agendaView()->agenda()->printSelection(); 1875 mView->viewManager()->agendaView()->agenda()->printSelection();
1819} 1876}
1820 1877
1821void MainWindow::printCal() 1878void MainWindow::printCal()
1822{ 1879{
1823 mView->print();//mCp->showDialog(); 1880 mView->print();//mCp->showDialog();
1824} 1881}
1825 1882
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e3383ed..0926313 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,128 +1,138 @@
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 <qtextstream.h> 8#include <qtextstream.h>
9#include <qregexp.h> 9#include <qregexp.h>
10 10
11#include <libkcal/incidence.h> 11#include <libkcal/incidence.h>
12#include "simplealarmclient.h" 12#include "simplealarmclient.h"
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h>
16#endif
15class QAction; 17class QAction;
16class CalendarView; 18class CalendarView;
17class KSyncProfile; 19class KSyncProfile;
18#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
19 21
20#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
21#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
22#endif 24#endif
23class QPEToolBar; 25class QPEToolBar;
24 26
25 27
26namespace KCal { 28namespace KCal {
27class CalendarLocal; 29class CalendarLocal;
28} 30}
29 31
30using namespace KCal; 32using namespace KCal;
31 33
32class MainWindow : public QMainWindow 34class MainWindow : public QMainWindow
33{ 35{
34 Q_OBJECT 36 Q_OBJECT
35 public: 37 public:
36 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 38 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
37 ~MainWindow(); 39 ~MainWindow();
40 bool beamReceiveEnabled();
38 public slots: 41 public slots:
39 virtual void showMaximized (); 42 virtual void showMaximized ();
40 void configureAgenda( int ); 43 void configureAgenda( int );
41 void recieve( const QCString& msg, const QByteArray& data ); 44 void recieve( const QCString& msg, const QByteArray& data );
42 static QString defaultFileName(); 45 static QString defaultFileName();
43 static QString syncFileName(); 46 static QString syncFileName();
44 static QString resourcePath(); 47 static QString resourcePath();
45 protected slots: 48 protected slots:
46 void setCaptionToDates(); 49 void setCaptionToDates();
47 void about(); 50 void about();
48 void licence(); 51 void licence();
49 void faq(); 52 void faq();
50 void usertrans(); 53 void usertrans();
51 void features(); 54 void features();
52 void synchowto(); 55 void synchowto();
53 void whatsNew(); 56 void whatsNew();
54 void keyBindings(); 57 void keyBindings();
55 void aboutAutoSaving();; 58 void aboutAutoSaving();;
56 void aboutKnownBugs(); 59 void aboutKnownBugs();
57 60
58 void processIncidenceSelection( Incidence * ); 61 void processIncidenceSelection( Incidence * );
59 62
60 void importQtopia(); 63 void importQtopia();
61 void importBday(); 64 void importBday();
62 void importOL(); 65 void importOL();
63 void importIcal(); 66 void importIcal();
64 void importFile( QString, bool ); 67 void importFile( QString, bool );
65 void quickImportIcal(); 68 void quickImportIcal();
66 69
67 void slotModifiedChanged( bool ); 70 void slotModifiedChanged( bool );
68 71
69 void save(); 72 void save();
70 void configureToolBar( int ); 73 void configureToolBar( int );
71 void printSel(); 74 void printSel();
72 void printCal(); 75 void printCal();
73 void saveCalendar(); 76 void saveCalendar();
74 void loadCalendar(); 77 void loadCalendar();
75 void exportVCalendar(); 78 void exportVCalendar();
76 void fillFilterMenu(); 79 void fillFilterMenu();
77 void selectFilter( int ); 80 void selectFilter( int );
78 void exportToPhone( int ); 81 void exportToPhone( int );
82 void toggleBeamReceive();
83 void disableBR(bool);
79 84
80 85
81 protected: 86 protected:
82 void displayText( QString, QString); 87 void displayText( QString, QString);
83 void displayFile( QString, QString); 88 void displayFile( QString, QString);
84 89
85 void enableIncidenceActions( bool ); 90 void enableIncidenceActions( bool );
86 91
87 private slots: 92 private slots:
88 QSocket* piSocket; 93 QSocket* piSocket;
89 QString piFileString; 94 QString piFileString;
90 QTime piTime; 95 QTime piTime;
91 void getFile( bool ); 96 void getFile( bool );
92 void syncFileRequest(); 97 void syncFileRequest();
93 private: 98 private:
99 bool mBRdisabled;
100#ifndef DESKTOP_VERSION
101 QCopChannel* infrared;
102#endif
103 QAction* brAction;
94 KSyncManager* mSyncManager; 104 KSyncManager* mSyncManager;
95 bool mClosed; 105 bool mClosed;
96 void saveOnClose(); 106 void saveOnClose();
97 bool mFlagKeyPressed; 107 bool mFlagKeyPressed;
98 bool mBlockAtStartup; 108 bool mBlockAtStartup;
99 QPEToolBar *iconToolBar; 109 QPEToolBar *iconToolBar;
100 void initActions(); 110 void initActions();
101 void setDefaultPreferences(); 111 void setDefaultPreferences();
102 void keyPressEvent ( QKeyEvent * ) ; 112 void keyPressEvent ( QKeyEvent * ) ;
103 void keyReleaseEvent ( QKeyEvent * ) ; 113 void keyReleaseEvent ( QKeyEvent * ) ;
104 QPopupMenu *configureToolBarMenu; 114 QPopupMenu *configureToolBarMenu;
105 QPopupMenu *selectFilterMenu; 115 QPopupMenu *selectFilterMenu;
106 QPopupMenu *configureAgendaMenu, *syncMenu; 116 QPopupMenu *configureAgendaMenu, *syncMenu;
107 CalendarLocal *mCalendar; 117 CalendarLocal *mCalendar;
108 CalendarView *mView; 118 CalendarView *mView;
109 QAction *mNewSubTodoAction; 119 QAction *mNewSubTodoAction;
110 120
111 QAction *mShowAction; 121 QAction *mShowAction;
112 QAction *mEditAction; 122 QAction *mEditAction;
113 QAction *mDeleteAction; 123 QAction *mDeleteAction;
114 QAction *mCloneAction; 124 QAction *mCloneAction;
115 QAction *mMoveAction; 125 QAction *mMoveAction;
116 QAction *mBeamAction; 126 QAction *mBeamAction;
117 QAction *mCancelAction; 127 QAction *mCancelAction;
118 128
119 void closeEvent( QCloseEvent* ce ); 129 void closeEvent( QCloseEvent* ce );
120 SimpleAlarmClient mAlarmClient; 130 SimpleAlarmClient mAlarmClient;
121 QTimer mSaveTimer; 131 QTimer mSaveTimer;
122 //bool mBlockSaveFlag; 132 //bool mBlockSaveFlag;
123 bool mCalendarModifiedFlag; 133 bool mCalendarModifiedFlag;
124 QPixmap loadPixmap( QString ); 134 QPixmap loadPixmap( QString );
125}; 135};
126 136
127 137
128#endif 138#endif