summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-02 16:54:00 (UTC)
committer zautrix <zautrix>2005-07-02 16:54:00 (UTC)
commit78866028c185f4227bfb653ee2050d7feb2e2b78 (patch) (unidiff)
tree899b85d02584992f608da22f48076f590483d2bd
parent20c9e9cb71ad64aebfa27157bb152ece4e34c00a (diff)
downloadkdepimpi-78866028c185f4227bfb653ee2050d7feb2e2b78.zip
kdepimpi-78866028c185f4227bfb653ee2050d7feb2e2b78.tar.gz
kdepimpi-78866028c185f4227bfb653ee2050d7feb2e2b78.tar.bz2
fixxxxxxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp9
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/kofilterview.cpp4
3 files changed, 11 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 5c88abd..6746de2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -87,954 +87,961 @@
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h" 110#include "datenavigatorcontainer.h"
111#include "statusdialog.h" 111#include "statusdialog.h"
112#include "kdatenavigator.h" 112#include "kdatenavigator.h"
113#include "kotodoview.h" 113#include "kotodoview.h"
114#include "datenavigator.h" 114#include "datenavigator.h"
115#include "resourceview.h" 115#include "resourceview.h"
116#include "navigatorbar.h" 116#include "navigatorbar.h"
117#include "searchdialog.h" 117#include "searchdialog.h"
118#include "mainwindow.h" 118#include "mainwindow.h"
119#include "categoryeditdialog.h" 119#include "categoryeditdialog.h"
120 120
121#include "calendarview.h" 121#include "calendarview.h"
122#ifndef DESKTOP_VERSION 122#ifndef DESKTOP_VERSION
123#include <qtopia/alarmserver.h> 123#include <qtopia/alarmserver.h>
124#endif 124#endif
125#ifndef _WIN32_ 125#ifndef _WIN32_
126#include <stdlib.h> 126#include <stdlib.h>
127#include <stdio.h> 127#include <stdio.h>
128#include <unistd.h> 128#include <unistd.h>
129#else 129#else
130#include <qprocess.h> 130#include <qprocess.h>
131#endif 131#endif
132 132
133#ifdef DESKTOP_VERSION 133#ifdef DESKTOP_VERSION
134#include <kabc/stdaddressbook.h> 134#include <kabc/stdaddressbook.h>
135#endif 135#endif
136using namespace KOrg; 136using namespace KOrg;
137using namespace KCal; 137using namespace KCal;
138extern int globalFlagBlockAgenda; 138extern int globalFlagBlockAgenda;
139extern int globalFlagBlockStartup; 139extern int globalFlagBlockStartup;
140 140
141 141
142MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent) 142MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
143 143
144{ 144{
145 mAlarms = alarms; 145 mAlarms = alarms;
146 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) ); 146 viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
147 QString mText = "<table width=\"100%\">\n"; 147 QString mText = "<table width=\"100%\">\n";
148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 148 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
149#ifdef DESKTOP_VERSION 149#ifdef DESKTOP_VERSION
150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 150 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
151#else 151#else
152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>"; 152 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
153#endif 153#endif
154 // mText += "<img src=\""; 154 // mText += "<img src=\"";
155 // mText += ipath; 155 // mText += ipath;
156 // mText += "\">"; 156 // mText += "\">";
157 //mEventDate = QDate::currentDate(); 157 //mEventDate = QDate::currentDate();
158#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
159 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>"; 159 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
160#else 160#else
161 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>"; 161 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
162#endif 162#endif
163 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 163 //mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
164 164
165 Incidence * inc = getNextInc( start ); 165 Incidence * inc = getNextInc( start );
166 int time = 0; 166 int time = 0;
167 //mText += "<table>"; 167 //mText += "<table>";
168 while ( inc ) { 168 while ( inc ) {
169 QDateTime dt ; 169 QDateTime dt ;
170 QString tempText = "<a "; 170 QString tempText = "<a ";
171 bool ok; 171 bool ok;
172 dt = inc->getNextOccurence( start, &ok ); 172 dt = inc->getNextOccurence( start, &ok );
173 if ( !ok ) continue; 173 if ( !ok ) continue;
174 if ( inc->typeID() == eventID ) { 174 if ( inc->typeID() == eventID ) {
175 tempText += "href=\"event:"; 175 tempText += "href=\"event:";
176 } else if ( inc->typeID() == todoID ) { 176 } else if ( inc->typeID() == todoID ) {
177 tempText += "href=\"todo:"; 177 tempText += "href=\"todo:";
178 } 178 }
179 tempText += inc->uid() + "\">"; 179 tempText += inc->uid() + "\">";
180 if ( inc->typeID() == todoID ) 180 if ( inc->typeID() == todoID )
181 tempText += i18n("Todo: "); 181 tempText += i18n("Todo: ");
182 if ( inc->summary().length() > 0 ) 182 if ( inc->summary().length() > 0 )
183 tempText += inc->summary(); 183 tempText += inc->summary();
184 else 184 else
185 tempText += i18n("-no summary-"); 185 tempText += i18n("-no summary-");
186 QString timestr; 186 QString timestr;
187 if (!inc->doesFloat()) 187 if (!inc->doesFloat())
188 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": "; 188 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
189 else 189 else
190 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 190 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
191 if ( dt.date() < QDate::currentDate() && time == 0 ) { 191 if ( dt.date() < QDate::currentDate() && time == 0 ) {
192 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>"; 192 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
193 mText += "<table>"; 193 mText += "<table>";
194 time = 1; 194 time = 1;
195 } 195 }
196 if ( dt.date() == QDate::currentDate() && time <= 1 ) { 196 if ( dt.date() == QDate::currentDate() && time <= 1 ) {
197 if ( time > 0 ) 197 if ( time > 0 )
198 mText +="</table>"; 198 mText +="</table>";
199 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>"; 199 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
200 mText += "<table>"; 200 mText += "<table>";
201 time = 2; 201 time = 2;
202 202
203 } 203 }
204 if ( dt.date() > QDate::currentDate() && time <= 2 ) { 204 if ( dt.date() > QDate::currentDate() && time <= 2 ) {
205 if ( time > 0 ) 205 if ( time > 0 )
206 mText +="</table>"; 206 mText +="</table>";
207 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>"; 207 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
208 mText += "<table>"; 208 mText += "<table>";
209 time = 3; 209 time = 3;
210 } 210 }
211 mText +="<tr><td><b>"; 211 mText +="<tr><td><b>";
212 mText += timestr; 212 mText += timestr;
213 mText += "</b></td><td>"; 213 mText += "</b></td><td>";
214 mText += tempText; 214 mText += tempText;
215 mText += "</td></tr>\n"; 215 mText += "</td></tr>\n";
216 inc = getNextInc( start ); 216 inc = getNextInc( start );
217 } 217 }
218 mText +="</table>"; 218 mText +="</table>";
219 setText( mText ); 219 setText( mText );
220} 220}
221 221
222MissedAlarmTextBrowser::~MissedAlarmTextBrowser() 222MissedAlarmTextBrowser::~MissedAlarmTextBrowser()
223{ 223{
224 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() "); 224 //qDebug("delete MissedAlarmTextBrowser::~MissedAlarmTextBrowser() ");
225} 225}
226Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start ) 226Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
227{ 227{
228 QDateTime dt ; 228 QDateTime dt ;
229 Incidence * retInc; 229 Incidence * retInc;
230 Incidence * inc = mAlarms.first(); 230 Incidence * inc = mAlarms.first();
231 if ( inc == 0 ) 231 if ( inc == 0 )
232 return 0; 232 return 0;
233 bool ok; 233 bool ok;
234 dt = inc->getNextOccurence( start, &ok ); 234 dt = inc->getNextOccurence( start, &ok );
235 if ( ! ok ) return 0; 235 if ( ! ok ) return 0;
236 QDateTime dtn ; 236 QDateTime dtn ;
237 retInc = inc; 237 retInc = inc;
238 inc = mAlarms.next(); 238 inc = mAlarms.next();
239 while ( inc ) { 239 while ( inc ) {
240 dtn = inc->getNextOccurence( start, &ok ); 240 dtn = inc->getNextOccurence( start, &ok );
241 if ( ! ok ) return 0; 241 if ( ! ok ) return 0;
242 if ( dtn < dt ) { 242 if ( dtn < dt ) {
243 dt = dtn; 243 dt = dtn;
244 retInc = inc; 244 retInc = inc;
245 } 245 }
246 inc = mAlarms.next(); 246 inc = mAlarms.next();
247 } 247 }
248 mAlarms.remove( retInc ); 248 mAlarms.remove( retInc );
249 return retInc; 249 return retInc;
250 250
251} 251}
252void MissedAlarmTextBrowser::setSource(const QString & n) 252void MissedAlarmTextBrowser::setSource(const QString & n)
253{ 253{
254 if (n.startsWith("event:")) { 254 if (n.startsWith("event:")) {
255#ifdef DESKTOP_VERSION 255#ifdef DESKTOP_VERSION
256 emit showIncidence(n.mid(8)); 256 emit showIncidence(n.mid(8));
257#else 257#else
258 emit showIncidence(n.mid(6)); 258 emit showIncidence(n.mid(6));
259#endif 259#endif
260 return; 260 return;
261 } else if (n.startsWith("todo:")) { 261 } else if (n.startsWith("todo:")) {
262#ifdef DESKTOP_VERSION 262#ifdef DESKTOP_VERSION
263 emit showIncidence(n.mid(7)); 263 emit showIncidence(n.mid(7));
264#else 264#else
265 emit showIncidence(n.mid(5)); 265 emit showIncidence(n.mid(5));
266#endif 266#endif
267 return; 267 return;
268 } 268 }
269} 269}
270 270
271 271
272class KOBeamPrefs : public QDialog 272class KOBeamPrefs : public QDialog
273{ 273{
274 public: 274 public:
275 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 275 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
276 QDialog( parent, name, true ) 276 QDialog( parent, name, true )
277 { 277 {
278 setCaption( i18n("Beam Options") ); 278 setCaption( i18n("Beam Options") );
279 QVBoxLayout* lay = new QVBoxLayout( this ); 279 QVBoxLayout* lay = new QVBoxLayout( this );
280 lay->setSpacing( 3 ); 280 lay->setSpacing( 3 );
281 lay->setMargin( 3 ); 281 lay->setMargin( 3 );
282 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 282 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
283 lay->addWidget( format ); 283 lay->addWidget( format );
284 format->setExclusive ( true ) ; 284 format->setExclusive ( true ) ;
285 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 285 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
286 lay->addWidget( time ); time->setExclusive ( true ) ; 286 lay->addWidget( time ); time->setExclusive ( true ) ;
287 vcal = new QRadioButton(" vCalendar ", format ); 287 vcal = new QRadioButton(" vCalendar ", format );
288 ical = new QRadioButton(" iCalendar ", format ); 288 ical = new QRadioButton(" iCalendar ", format );
289 vcal->setChecked( true ); 289 vcal->setChecked( true );
290 tz = new QRadioButton(i18n(" With timezone "), time ); 290 tz = new QRadioButton(i18n(" With timezone "), time );
291 local = new QRadioButton(i18n(" Local time "), time ); 291 local = new QRadioButton(i18n(" Local time "), time );
292 tz->setChecked( true ); 292 tz->setChecked( true );
293 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 293 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
294 lay->addWidget( ok ); 294 lay->addWidget( ok );
295 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 295 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
296 lay->addWidget( cancel ); 296 lay->addWidget( cancel );
297 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 297 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
298 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 298 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
299 resize( 200, 200 ); 299 resize( 200, 200 );
300 } 300 }
301 301
302 bool beamVcal() { return vcal->isChecked(); } 302 bool beamVcal() { return vcal->isChecked(); }
303 bool beamLocal() { return local->isChecked(); } 303 bool beamLocal() { return local->isChecked(); }
304private: 304private:
305 QRadioButton* vcal, *ical, *local, *tz; 305 QRadioButton* vcal, *ical, *local, *tz;
306}; 306};
307class KOCatPrefs : public QDialog 307class KOCatPrefs : public QDialog
308{ 308{
309 public: 309 public:
310 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 310 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
311 QDialog( parent, name, true ) 311 QDialog( parent, name, true )
312 { 312 {
313 setCaption( i18n("Manage new Categories") ); 313 setCaption( i18n("Manage new Categories") );
314 QVBoxLayout* lay = new QVBoxLayout( this ); 314 QVBoxLayout* lay = new QVBoxLayout( this );
315 lay->setSpacing( 3 ); 315 lay->setSpacing( 3 );
316 lay->setMargin( 3 ); 316 lay->setMargin( 3 );
317 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 317 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
318 lay->addWidget( lab ); 318 lay->addWidget( lab );
319 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 319 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
320 lay->addWidget( format ); 320 lay->addWidget( format );
321 format->setExclusive ( true ) ; 321 format->setExclusive ( true ) ;
322 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 322 addCatBut = new QRadioButton(i18n("Add to category list"), format );
323 new QRadioButton(i18n("Remove from Events/Todos"), format ); 323 new QRadioButton(i18n("Remove from Events/Todos"), format );
324 addCatBut->setChecked( true ); 324 addCatBut->setChecked( true );
325 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 325 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
326 lay->addWidget( ok ); 326 lay->addWidget( ok );
327 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 327 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
328 lay->addWidget( cancel ); 328 lay->addWidget( cancel );
329 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 329 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
330 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 330 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
331 resize( 200, 200 ); 331 resize( 200, 200 );
332 } 332 }
333 333
334 bool addCat() { return addCatBut->isChecked(); } 334 bool addCat() { return addCatBut->isChecked(); }
335private: 335private:
336 QRadioButton* addCatBut; 336 QRadioButton* addCatBut;
337}; 337};
338 338
339 339
340 340
341CalendarView::CalendarView( CalendarResources *calendar, 341CalendarView::CalendarView( CalendarResources *calendar,
342 QWidget *parent, const char *name ) 342 QWidget *parent, const char *name )
343 : CalendarViewBase( parent, name ), 343 : CalendarViewBase( parent, name ),
344 mCalendar( calendar ), 344 mCalendar( calendar ),
345 mResourceManager( calendar->resourceManager() ) 345 mResourceManager( calendar->resourceManager() )
346{ 346{
347 347
348 mEventEditor = 0; 348 mEventEditor = 0;
349 mTodoEditor = 0; 349 mTodoEditor = 0;
350 350
351 init(); 351 init();
352} 352}
353 353
354CalendarView::CalendarView( Calendar *calendar, 354CalendarView::CalendarView( Calendar *calendar,
355 QWidget *parent, const char *name ) 355 QWidget *parent, const char *name )
356 : CalendarViewBase( parent, name ), 356 : CalendarViewBase( parent, name ),
357 mCalendar( calendar ), 357 mCalendar( calendar ),
358 mResourceManager( 0 ) 358 mResourceManager( 0 )
359{ 359{
360 360
361 mEventEditor = 0; 361 mEventEditor = 0;
362 mTodoEditor = 0; 362 mTodoEditor = 0;
363 init(); 363 init();
364} 364}
365 365
366void CalendarView::init() 366void CalendarView::init()
367{ 367{
368 mNextAlarmDateTime = QDateTime::currentDateTime(); 368 mNextAlarmDateTime = QDateTime::currentDateTime();
369 setFocusPolicy ( NoFocus ); 369 setFocusPolicy ( NoFocus );
370 mViewerCallerIsSearchDialog = false; 370 mViewerCallerIsSearchDialog = false;
371 mBlockShowDates = false; 371 mBlockShowDates = false;
372 372
373 mDatePickerMode = 0; 373 mDatePickerMode = 0;
374 mCurrentSyncDevice = ""; 374 mCurrentSyncDevice = "";
375 mViewManager = new KOViewManager( this ); 375 mViewManager = new KOViewManager( this );
376 mDialogManager = new KODialogManager( this ); 376 mDialogManager = new KODialogManager( this );
377 mEventViewerDialog = 0; 377 mEventViewerDialog = 0;
378 mModified = false; 378 mModified = false;
379 mReadOnly = false; 379 mReadOnly = false;
380 mSelectedIncidence = 0; 380 mSelectedIncidence = 0;
381 mCalPrinter = 0; 381 mCalPrinter = 0;
382 mFilters.setAutoDelete(true); 382 mFilters.setAutoDelete(true);
383 383
384 mCalendar->registerObserver( this ); 384 mCalendar->registerObserver( this );
385 // TODO: Make sure that view is updated, when calendar is changed. 385 // TODO: Make sure that view is updated, when calendar is changed.
386 386
387 mStorage = new FileStorage( mCalendar ); 387 mStorage = new FileStorage( mCalendar );
388 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 388 mNavigator = new DateNavigator( this, "datevav", mViewManager );
389 389
390 QBoxLayout *topLayout = (QBoxLayout*)layout(); 390 QBoxLayout *topLayout = (QBoxLayout*)layout();
391#ifndef KORG_NOSPLITTER 391#ifndef KORG_NOSPLITTER
392 // create the main layout frames. 392 // create the main layout frames.
393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 393 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
394 topLayout->addWidget(mPanner); 394 topLayout->addWidget(mPanner);
395 395
396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 396 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
397 "CalendarView::LeftFrame"); 397 "CalendarView::LeftFrame");
398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 398 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
399 399
400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 400 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
401 "CalendarView::DateNavigator" ); 401 "CalendarView::DateNavigator" );
402 402
403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 403 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 404 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
405 mTodoList->setNavigator( mNavigator ); 405 mTodoList->setNavigator( mNavigator );
406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 406 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
407 407
408#ifdef KORG_NORESOURCEVIEW 408#ifdef KORG_NORESOURCEVIEW
409 mResourceView = 0; 409 mResourceView = 0;
410#else 410#else
411 if ( mResourceManager ) { 411 if ( mResourceManager ) {
412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 412 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
413 mResourceView->updateView(); 413 mResourceView->updateView();
414 connect( mResourceView, SIGNAL( resourcesChanged() ), 414 connect( mResourceView, SIGNAL( resourcesChanged() ),
415 SLOT( updateView() ) ); 415 SLOT( updateView() ) );
416 } else { 416 } else {
417 mResourceView = 0; 417 mResourceView = 0;
418 } 418 }
419#endif 419#endif
420 QWidget *rightBox = new QWidget( mPanner ); 420 QWidget *rightBox = new QWidget( mPanner );
421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 421 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
422 422
423 mRightFrame = new QWidgetStack( rightBox ); 423 mRightFrame = new QWidgetStack( rightBox );
424 rightLayout->addWidget( mRightFrame, 1 ); 424 rightLayout->addWidget( mRightFrame, 1 );
425 425
426 mLeftFrame = mLeftSplitter; 426 mLeftFrame = mLeftSplitter;
427#else 427#else
428 //QWidget *mainBox = new QWidget( this ); 428 //QWidget *mainBox = new QWidget( this );
429 //QWidget *leftFrame = new QWidget( mainBox ); 429 //QWidget *leftFrame = new QWidget( mainBox );
430 //QBoxLayout * mainBoxLayout; 430 //QBoxLayout * mainBoxLayout;
431 if ( KOPrefs::instance()->mVerticalScreen ) { 431 if ( KOPrefs::instance()->mVerticalScreen ) {
432 //mainBoxLayout = new QVBoxLayout(mainBox); 432 //mainBoxLayout = new QVBoxLayout(mainBox);
433 //leftFrameLayout = new QHBoxLayout(leftFrame ); 433 //leftFrameLayout = new QHBoxLayout(leftFrame );
434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
438 } else { 438 } else {
439 //mainBoxLayout = new QHBoxLayout(mainBox); 439 //mainBoxLayout = new QHBoxLayout(mainBox);
440 //leftFrameLayout = new QVBoxLayout(leftFrame ); 440 //leftFrameLayout = new QVBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
445 } 445 }
446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
447 //QBoxLayout * leftFrameLayout; 447 //QBoxLayout * leftFrameLayout;
448 topLayout->addWidget( mMainFrame ); 448 topLayout->addWidget( mMainFrame );
449#ifdef DESKTOP_VERSION 449#ifdef DESKTOP_VERSION
450 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); 450 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
451 topLayout->addWidget( mDateScrollBar ); 451 topLayout->addWidget( mDateScrollBar );
452 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 452 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
453 if ( QApplication::desktop()->width() < 800 ) 453 if ( QApplication::desktop()->width() < 800 )
454 mDateScrollBar->hide(); 454 mDateScrollBar->hide();
455#endif 455#endif
456 //mainBoxLayout->addWidget (mLeftFrame); 456 //mainBoxLayout->addWidget (mLeftFrame);
457 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 457 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
458 "CalendarView::DateNavigator" ); 458 "CalendarView::DateNavigator" );
459#if 0 459#if 0
460 // FIXME 460 // FIXME
461 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 461 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
462 "CalendarView::DateNavigator", QDate::currentDate()); 462 "CalendarView::DateNavigator", QDate::currentDate());
463#endif 463#endif
464 // mDateNavigator->blockSignals( true ); 464 // mDateNavigator->blockSignals( true );
465 //leftFrameLayout->addWidget( mDateNavigator ); 465 //leftFrameLayout->addWidget( mDateNavigator );
466 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 466 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
467 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 467 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
468 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 468 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
469 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 469 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
470 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 470 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
471 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 471 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) );
472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 472 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 473 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
474 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 474 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
475 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 475 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 476 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
477 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); 477 connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() ));
478 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 478 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
479 479
480 mTodoList->setNavigator( mNavigator ); 480 mTodoList->setNavigator( mNavigator );
481#if 0 481#if 0
482 if ( QApplication::desktop()->width() < 480 ) { 482 if ( QApplication::desktop()->width() < 480 ) {
483 leftFrameLayout->addWidget(mFilterView); 483 leftFrameLayout->addWidget(mFilterView);
484 leftFrameLayout->addWidget(mTodoList, 2 ); 484 leftFrameLayout->addWidget(mTodoList, 2 );
485 485
486 } else { 486 } else {
487 leftFrameLayout->addWidget(mTodoList,2 ); 487 leftFrameLayout->addWidget(mTodoList,2 );
488 leftFrameLayout->addWidget(mFilterView ); 488 leftFrameLayout->addWidget(mFilterView );
489 } 489 }
490#endif 490#endif
491 mFilterView->hide(); 491 mFilterView->hide();
492 mCalEditView->hide(); 492 mCalEditView->hide();
493 QWidget *rightBox = new QWidget( mMainFrame ); 493 QWidget *rightBox = new QWidget( mMainFrame );
494 //mainBoxLayout->addWidget ( rightBox, 10 ); 494 //mainBoxLayout->addWidget ( rightBox, 10 );
495 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 495 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
496 mRightFrame = new QWidgetStack( rightBox ); 496 mRightFrame = new QWidgetStack( rightBox );
497 rightLayout->addWidget( mRightFrame, 10 ); 497 rightLayout->addWidget( mRightFrame, 10 );
498 498
499 //mLeftFrame = (QWidget *)leftFrame; 499 //mLeftFrame = (QWidget *)leftFrame;
500 if ( KOPrefs::instance()->mVerticalScreen ) { 500 if ( KOPrefs::instance()->mVerticalScreen ) {
501 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 501 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
502 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 502 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
503 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 503 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
504 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 504 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
505 } else { 505 } else {
506 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 506 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
507 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 507 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
508 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 508 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
509 } 509 }
510 if ( !KOPrefs::instance()->mShowDateNavigator) 510 if ( !KOPrefs::instance()->mShowDateNavigator)
511 mDateNavigator->hide(); 511 mDateNavigator->hide();
512 //qDebug("Calendarview Size %d %d ", width(), height()); 512 //qDebug("Calendarview Size %d %d ", width(), height());
513#endif 513#endif
514 514
515 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 515 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
516 SLOT( showDates( const KCal::DateList & ) ) ); 516 SLOT( showDates( const KCal::DateList & ) ) );
517 517
518 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 518 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
519 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 519 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
520 520
521 521
522 522
523 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), 523 connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
524 mViewManager, SLOT( showMonth( const QDate & ) ) ); 524 mViewManager, SLOT( showMonth( const QDate & ) ) );
525 525
526 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 526 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
527 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 527 mNavigator, SLOT( selectWeek( const QDate & ) ) );
528 528
529 connect( mDateNavigator, SIGNAL( goPrevYear() ), 529 connect( mDateNavigator, SIGNAL( goPrevYear() ),
530 mNavigator, SLOT( selectPreviousYear() ) ); 530 mNavigator, SLOT( selectPreviousYear() ) );
531 connect( mDateNavigator, SIGNAL( goNextYear() ), 531 connect( mDateNavigator, SIGNAL( goNextYear() ),
532 mNavigator, SLOT( selectNextYear() ) ); 532 mNavigator, SLOT( selectNextYear() ) );
533 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 533 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
534 mNavigator, SLOT( selectPreviousMonth() ) ); 534 mNavigator, SLOT( selectPreviousMonth() ) );
535 connect( mDateNavigator, SIGNAL( goNextMonth() ), 535 connect( mDateNavigator, SIGNAL( goNextMonth() ),
536 mNavigator, SLOT( selectNextMonth() ) ); 536 mNavigator, SLOT( selectNextMonth() ) );
537 537
538 connect( mDateNavigator, SIGNAL( goPrevious() ), 538 connect( mDateNavigator, SIGNAL( goPrevious() ),
539 mNavigator, SLOT( selectPrevious() ) ); 539 mNavigator, SLOT( selectPrevious() ) );
540 connect( mDateNavigator, SIGNAL( goNext() ), 540 connect( mDateNavigator, SIGNAL( goNext() ),
541 mNavigator, SLOT( selectNext() ) ); 541 mNavigator, SLOT( selectNext() ) );
542 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 542 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
543 mNavigator, SLOT( slotMonthSelect( int ) ) ); 543 mNavigator, SLOT( slotMonthSelect( int ) ) );
544 544
545 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 545 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
546 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 546 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
547#if 0 547#if 0
548 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 548 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
549 SLOT( incidenceAdded( Incidence *) ) ); 549 SLOT( incidenceAdded( Incidence *) ) );
550#endif 550#endif
551 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 551 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
552 552
553 connect( this, SIGNAL( configChanged() ), 553 connect( this, SIGNAL( configChanged() ),
554 mDateNavigator, SLOT( updateConfig() ) ); 554 mDateNavigator, SLOT( updateConfig() ) );
555 555
556 connect( mTodoList, SIGNAL( newTodoSignal() ), 556 connect( mTodoList, SIGNAL( newTodoSignal() ),
557 SLOT( newTodo() ) ); 557 SLOT( newTodo() ) );
558 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 558 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
559 SLOT( newSubTodo( Todo * ) ) ); 559 SLOT( newSubTodo( Todo * ) ) );
560 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 560 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
561 SLOT( editTodo( Todo * ) ) ); 561 SLOT( editTodo( Todo * ) ) );
562 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 562 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
563 SLOT( showTodo( Todo *) ) ); 563 SLOT( showTodo( Todo *) ) );
564 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 564 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
565 SLOT( deleteTodo( Todo *) ) ); 565 SLOT( deleteTodo( Todo *) ) );
566 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 566 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
567 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 567 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
568 SLOT( purgeCompleted() ) ); 568 SLOT( purgeCompleted() ) );
569 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 569 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
570 SIGNAL( todoModified( Todo *, int ) ) ); 570 SIGNAL( todoModified( Todo *, int ) ) );
571 571
572 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 572 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
573 this, SLOT ( cloneIncidence( Incidence * ) ) ); 573 this, SLOT ( cloneIncidence( Incidence * ) ) );
574 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 574 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
575 this, SLOT (cancelIncidence( Incidence * ) ) ); 575 this, SLOT (cancelIncidence( Incidence * ) ) );
576 576
577 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 577 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
578 this, SLOT ( moveIncidence( Incidence * ) ) ); 578 this, SLOT ( moveIncidence( Incidence * ) ) );
579 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 579 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
580 this, SLOT ( beamIncidence( Incidence * ) ) ); 580 this, SLOT ( beamIncidence( Incidence * ) ) );
581 581
582 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 582 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
583 this, SLOT ( todo_unsub( Todo * ) ) ); 583 this, SLOT ( todo_unsub( Todo * ) ) );
584 584
585 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 585 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
586 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 586 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
587 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 587 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
588 SLOT( updateTodo( Todo *, int ) ) ); 588 SLOT( updateTodo( Todo *, int ) ) );
589 connect( this, SIGNAL( todoModified( Todo *, int )), this, 589 connect( this, SIGNAL( todoModified( Todo *, int )), this,
590 SLOT( changeTodoDisplay( Todo *, int ) ) ); 590 SLOT( changeTodoDisplay( Todo *, int ) ) );
591 591
592 592
593 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 593 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
594 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 594 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
595 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 595 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
596 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 596 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
597 597
598 598
599 599
600 600
601 601
602 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 602 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
603 SLOT(checkClipboard())); 603 SLOT(checkClipboard()));
604 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 604 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
605 SLOT( processTodoListSelection( Incidence * ) ) ); 605 SLOT( processTodoListSelection( Incidence * ) ) );
606 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 606 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
607 607
608 // kdDebug() << "CalendarView::CalendarView() done" << endl; 608 // kdDebug() << "CalendarView::CalendarView() done" << endl;
609 609
610 mDateFrame = new QVBox(0,0,WType_Popup); 610 mDateFrame = new QVBox(0,0,WType_Popup);
611 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 611 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
612 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 612 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
613 mDateFrame->setLineWidth(3); 613 mDateFrame->setLineWidth(3);
614 mDateFrame->hide(); 614 mDateFrame->hide();
615 mDateFrame->setCaption( i18n( "Pick a date to display")); 615 mDateFrame->setCaption( i18n( "Pick a date to display"));
616 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 616 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
617 617
618 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 618 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
619 619
620 mEventEditor = mDialogManager->getEventEditor(); 620 mEventEditor = mDialogManager->getEventEditor();
621 mTodoEditor = mDialogManager->getTodoEditor(); 621 mTodoEditor = mDialogManager->getTodoEditor();
622 622
623 mFlagEditDescription = false; 623 mFlagEditDescription = false;
624 624
625 mSuspendTimer = new QTimer( this ); 625 mSuspendTimer = new QTimer( this );
626 mAlarmTimer = new QTimer( this ); 626 mAlarmTimer = new QTimer( this );
627 mRecheckAlarmTimer = new QTimer( this ); 627 mRecheckAlarmTimer = new QTimer( this );
628 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 628 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
629 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 629 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
630 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 630 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
631 mAlarmDialog = new AlarmDialog( this ); 631 mAlarmDialog = new AlarmDialog( this );
632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 632 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
633 mAlarmDialog->setServerNotification( false ); 633 mAlarmDialog->setServerNotification( false );
634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 634 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
635 635
636 636
637#ifndef DESKTOP_VERSION 637#ifndef DESKTOP_VERSION
638//US listen for arriving address resultsets 638//US listen for arriving address resultsets
639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 639 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 640 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
641#endif 641#endif
642 mDateNavigator->setCalendar( mCalendar ); 642 mDateNavigator->setCalendar( mCalendar );
643} 643}
644 644
645 645
646CalendarView::~CalendarView() 646CalendarView::~CalendarView()
647{ 647{
648 // kdDebug() << "~CalendarView()" << endl; 648 // kdDebug() << "~CalendarView()" << endl;
649 //qDebug("CalendarView::~CalendarView() "); 649 //qDebug("CalendarView::~CalendarView() ");
650 delete mDialogManager; 650 delete mDialogManager;
651 delete mViewManager; 651 delete mViewManager;
652 delete mStorage; 652 delete mStorage;
653 delete mDateFrame ; 653 delete mDateFrame ;
654 delete mEventViewerDialog; 654 delete mEventViewerDialog;
655 //kdDebug() << "~CalendarView() done" << endl; 655 //kdDebug() << "~CalendarView() done" << endl;
656} 656}
657void CalendarView::setCalReadOnly( int id, bool readO )
658{
659 if ( readO ) {
660 emit save();
661 }
662 mCalendar->setReadOnly( id, readO );
663}
657void CalendarView::setScrollBarStep(int val ) 664void CalendarView::setScrollBarStep(int val )
658{ 665{
659#ifdef DESKTOP_VERSION 666#ifdef DESKTOP_VERSION
660 mDateScrollBar->setLineStep ( val ); 667 mDateScrollBar->setLineStep ( val );
661#endif 668#endif
662} 669}
663void CalendarView::scrollBarValue(int val ) 670void CalendarView::scrollBarValue(int val )
664{ 671{
665#ifdef DESKTOP_VERSION 672#ifdef DESKTOP_VERSION
666 if ( QApplication::desktop()->width() < 800 ) return; 673 if ( QApplication::desktop()->width() < 800 ) return;
667 static bool block = false; 674 static bool block = false;
668 if ( block ) return; 675 if ( block ) return;
669 block = true; 676 block = true;
670 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 677 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
671 //qDebug("VAL %d ",val ); 678 //qDebug("VAL %d ",val );
672 int count = mNavigator->selectedDates().count(); 679 int count = mNavigator->selectedDates().count();
673 int year = mNavigator->selectedDates().first().year(); 680 int year = mNavigator->selectedDates().first().year();
674 int day = mNavigator->selectedDates().first().dayOfYear(); 681 int day = mNavigator->selectedDates().first().dayOfYear();
675 if ( val == day -1 ) { 682 if ( val == day -1 ) {
676 block = false; 683 block = false;
677 return; 684 return;
678 } 685 }
679 QDate d ( year,1,1 ); 686 QDate d ( year,1,1 );
680 mNavigator->selectDates( d.addDays( val ), count ); 687 mNavigator->selectDates( d.addDays( val ), count );
681 block = false; 688 block = false;
682#endif 689#endif
683 690
684} 691}
685void CalendarView::checkFiles() 692void CalendarView::checkFiles()
686{ 693{
687 QString message; 694 QString message;
688 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 695 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
689 KopiCalendarFile * cal = calendars.first(); 696 KopiCalendarFile * cal = calendars.first();
690 while ( cal ) { 697 while ( cal ) {
691 if ( cal->mErrorOnLoad ) { 698 if ( cal->mErrorOnLoad ) {
692 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 699 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
693 } 700 }
694 cal = calendars.next(); 701 cal = calendars.next();
695 } 702 }
696 if ( !message.isEmpty() ) { 703 if ( !message.isEmpty() ) {
697 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); 704 message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
698 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 705 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
699 } 706 }
700 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 707 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
701} 708}
702void CalendarView::checkAlarms() 709void CalendarView::checkAlarms()
703{ 710{
704 711
705 712
706 KConfig *config = KOGlobals::config(); 713 KConfig *config = KOGlobals::config();
707 config->setGroup( "AppRun" ); 714 config->setGroup( "AppRun" );
708 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 715 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
709 int daysto = dt.daysTo( QDate::currentDate() ); 716 int daysto = dt.daysTo( QDate::currentDate() );
710 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 717 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
711 dt = dt.addDays( days ); 718 dt = dt.addDays( days );
712 int secto = dt.secsTo( QDateTime::currentDateTime() ); 719 int secto = dt.secsTo( QDateTime::currentDateTime() );
713 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 720 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
714 //qDebug("KO: Reading program stop %d ", secs); 721 //qDebug("KO: Reading program stop %d ", secs);
715 //secs -= ( 3600 * 24*3 ); // debug only 722 //secs -= ( 3600 * 24*3 ); // debug only
716 QDateTime latest = dt.addSecs ( secs ); 723 QDateTime latest = dt.addSecs ( secs );
717 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 724 qDebug("KO: Last termination on %s ", latest.toString().latin1());
718 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 725 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
719 QPtrList<Incidence> el = mCalendar->rawIncidences(); 726 QPtrList<Incidence> el = mCalendar->rawIncidences();
720 QPtrList<Incidence> al; 727 QPtrList<Incidence> al;
721 Incidence* inL = el.first(); 728 Incidence* inL = el.first();
722 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 729 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
723 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 730 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
724 while ( inL ) { 731 while ( inL ) {
725 bool ok = false; 732 bool ok = false;
726 int offset = 0; 733 int offset = 0;
727 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 734 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
728 if ( ok ) { 735 if ( ok ) {
729 //qDebug("OK %s",next.toString().latin1()); 736 //qDebug("OK %s",next.toString().latin1());
730 if ( next < cur ) { 737 if ( next < cur ) {
731 al.append( inL ); 738 al.append( inL );
732 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 739 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
733 } 740 }
734 } 741 }
735 inL = el.next(); 742 inL = el.next();
736 } 743 }
737 if ( al.count() ) { 744 if ( al.count() ) {
738 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 745 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
739 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 746 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
740 QVBoxLayout* lay = new QVBoxLayout( dia ); 747 QVBoxLayout* lay = new QVBoxLayout( dia );
741 lay->setSpacing( 0 ); 748 lay->setSpacing( 0 );
742 lay->setMargin( 0 ); 749 lay->setMargin( 0 );
743 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 750 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
744 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 751 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
745 lay->addWidget( matb ); 752 lay->addWidget( matb );
746 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 753 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
747 int wid = 210; 754 int wid = 210;
748 int x = QApplication::desktop()->width() - wid - 7; 755 int x = QApplication::desktop()->width() - wid - 7;
749 int y = QApplication::desktop()->height() - wid - 70; 756 int y = QApplication::desktop()->height() - wid - 70;
750 dia->setGeometry ( x,y,wid,wid); 757 dia->setGeometry ( x,y,wid,wid);
751 } else { 758 } else {
752 int si = 220; 759 int si = 220;
753 if ( QApplication::desktop()->width() > 470 ) 760 if ( QApplication::desktop()->width() > 470 )
754 si = 400; 761 si = 400;
755 dia->resize(si,si/2); 762 dia->resize(si,si/2);
756 } 763 }
757 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 764 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
758 dia->show(); 765 dia->show();
759 766
760 } 767 }
761} 768}
762void CalendarView::showDay( QDate d ) 769void CalendarView::showDay( QDate d )
763{ 770{
764 dateNavigator()->blockSignals( true ); 771 dateNavigator()->blockSignals( true );
765 dateNavigator()->selectDate( d ); 772 dateNavigator()->selectDate( d );
766 dateNavigator()->blockSignals( false ); 773 dateNavigator()->blockSignals( false );
767 mViewManager->showDayView(); 774 mViewManager->showDayView();
768 //dateNavigator()->selectDate( d ); 775 //dateNavigator()->selectDate( d );
769} 776}
770void CalendarView::timerAlarm() 777void CalendarView::timerAlarm()
771{ 778{
772 //qDebug("CalendarView::timerAlarm() "); 779 //qDebug("CalendarView::timerAlarm() ");
773 computeAlarm(mAlarmNotification ); 780 computeAlarm(mAlarmNotification );
774} 781}
775 782
776void CalendarView::suspendAlarm() 783void CalendarView::suspendAlarm()
777{ 784{
778 //qDebug(" CalendarView::suspendAlarm() "); 785 //qDebug(" CalendarView::suspendAlarm() ");
779 computeAlarm(mSuspendAlarmNotification ); 786 computeAlarm(mSuspendAlarmNotification );
780 787
781} 788}
782 789
783void CalendarView::startAlarm( QString mess , QString filename) 790void CalendarView::startAlarm( QString mess , QString filename)
784{ 791{
785 792
786 topLevelWidget()->showNormal(); 793 topLevelWidget()->showNormal();
787 topLevelWidget()->setActiveWindow(); 794 topLevelWidget()->setActiveWindow();
788 topLevelWidget()->raise(); 795 topLevelWidget()->raise();
789 796
790 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 797 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
791 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); 798 QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) );
792 799
793} 800}
794 801
795void CalendarView::checkNextTimerAlarm() 802void CalendarView::checkNextTimerAlarm()
796{ 803{
797 mCalendar->checkAlarmForIncidence( 0, true ); 804 mCalendar->checkAlarmForIncidence( 0, true );
798} 805}
799 806
800void CalendarView::computeAlarm( QString msg ) 807void CalendarView::computeAlarm( QString msg )
801{ 808{
802 809
803 QString mess = msg; 810 QString mess = msg;
804 QString mAlarmMessage = mess.mid( 9 ); 811 QString mAlarmMessage = mess.mid( 9 );
805 QString filename = MainWindow::resourcePath(); 812 QString filename = MainWindow::resourcePath();
806 filename += "koalarm.wav"; 813 filename += "koalarm.wav";
807 QString tempfilename; 814 QString tempfilename;
808 if ( mess.left( 13 ) == "suspend_alarm") { 815 if ( mess.left( 13 ) == "suspend_alarm") {
809 bool error = false; 816 bool error = false;
810 int len = mess.mid( 13 ).find("+++"); 817 int len = mess.mid( 13 ).find("+++");
811 if ( len < 2 ) 818 if ( len < 2 )
812 error = true; 819 error = true;
813 else { 820 else {
814 tempfilename = mess.mid( 13, len ); 821 tempfilename = mess.mid( 13, len );
815 if ( !QFile::exists( tempfilename ) ) 822 if ( !QFile::exists( tempfilename ) )
816 error = true; 823 error = true;
817 } 824 }
818 if ( ! error ) { 825 if ( ! error ) {
819 filename = tempfilename; 826 filename = tempfilename;
820 } 827 }
821 mAlarmMessage = mess.mid( 13+len+3 ); 828 mAlarmMessage = mess.mid( 13+len+3 );
822 //qDebug("suspend file %s ",tempfilename.latin1() ); 829 //qDebug("suspend file %s ",tempfilename.latin1() );
823 startAlarm( mAlarmMessage, filename); 830 startAlarm( mAlarmMessage, filename);
824 return; 831 return;
825 } 832 }
826 if ( mess.left( 11 ) == "timer_alarm") { 833 if ( mess.left( 11 ) == "timer_alarm") {
827 //mTimerTime = 0; 834 //mTimerTime = 0;
828 startAlarm( mess.mid( 11 ), filename ); 835 startAlarm( mess.mid( 11 ), filename );
829 return; 836 return;
830 } 837 }
831 if ( mess.left( 10 ) == "proc_alarm") { 838 if ( mess.left( 10 ) == "proc_alarm") {
832 bool error = false; 839 bool error = false;
833 int len = mess.mid( 10 ).find("+++"); 840 int len = mess.mid( 10 ).find("+++");
834 if ( len < 2 ) 841 if ( len < 2 )
835 error = true; 842 error = true;
836 else { 843 else {
837 tempfilename = mess.mid( 10, len ); 844 tempfilename = mess.mid( 10, len );
838 if ( !QFile::exists( tempfilename ) ) 845 if ( !QFile::exists( tempfilename ) )
839 error = true; 846 error = true;
840 } 847 }
841 if ( error ) { 848 if ( error ) {
842 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 849 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
843 mAlarmMessage += mess.mid( 10+len+3+9 ); 850 mAlarmMessage += mess.mid( 10+len+3+9 );
844 } else { 851 } else {
845 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 852 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
846 //qDebug("-----system command %s ",tempfilename.latin1() ); 853 //qDebug("-----system command %s ",tempfilename.latin1() );
847#ifndef _WIN32_ 854#ifndef _WIN32_
848 if ( vfork () == 0 ) { 855 if ( vfork () == 0 ) {
849 execl ( tempfilename.latin1(), 0 ); 856 execl ( tempfilename.latin1(), 0 );
850 return; 857 return;
851 } 858 }
852#else 859#else
853 QProcess* p = new QProcess(); 860 QProcess* p = new QProcess();
854 p->addArgument( tempfilename.latin1() ); 861 p->addArgument( tempfilename.latin1() );
855 p->start(); 862 p->start();
856 return; 863 return;
857#endif 864#endif
858 865
859 return; 866 return;
860 } 867 }
861 868
862 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 869 //qDebug("+++++++system command %s ",tempfilename.latin1() );
863 } 870 }
864 if ( mess.left( 11 ) == "audio_alarm") { 871 if ( mess.left( 11 ) == "audio_alarm") {
865 bool error = false; 872 bool error = false;
866 int len = mess.mid( 11 ).find("+++"); 873 int len = mess.mid( 11 ).find("+++");
867 if ( len < 2 ) 874 if ( len < 2 )
868 error = true; 875 error = true;
869 else { 876 else {
870 tempfilename = mess.mid( 11, len ); 877 tempfilename = mess.mid( 11, len );
871 if ( !QFile::exists( tempfilename ) ) 878 if ( !QFile::exists( tempfilename ) )
872 error = true; 879 error = true;
873 } 880 }
874 if ( ! error ) { 881 if ( ! error ) {
875 filename = tempfilename; 882 filename = tempfilename;
876 } 883 }
877 mAlarmMessage = mess.mid( 11+len+3+9 ); 884 mAlarmMessage = mess.mid( 11+len+3+9 );
878 //qDebug("audio file command %s ",tempfilename.latin1() ); 885 //qDebug("audio file command %s ",tempfilename.latin1() );
879 } 886 }
880 if ( mess.left( 9 ) == "cal_alarm") { 887 if ( mess.left( 9 ) == "cal_alarm") {
881 mAlarmMessage = mess.mid( 9 ) ; 888 mAlarmMessage = mess.mid( 9 ) ;
882 } 889 }
883 890
884 startAlarm( mAlarmMessage, filename ); 891 startAlarm( mAlarmMessage, filename );
885 892
886 893
887} 894}
888 895
889void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 896void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
890{ 897{
891 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 898 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
892 899
893 mSuspendAlarmNotification = noti; 900 mSuspendAlarmNotification = noti;
894 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 901 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
895 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 902 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
896 mSuspendTimer->start( ms , true ); 903 mSuspendTimer->start( ms , true );
897 904
898} 905}
899 906
900void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 907void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
901{ 908{
902 mNextAlarmDateTime = qdt; 909 mNextAlarmDateTime = qdt;
903 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 910 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
904 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 911 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
905#ifndef DESKTOP_VERSION 912#ifndef DESKTOP_VERSION
906 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); 913 AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
907#endif 914#endif
908 return; 915 return;
909 } 916 }
910 int maxSec; 917 int maxSec;
911 //maxSec = 5; //testing only 918 //maxSec = 5; //testing only
912 maxSec = 86400+3600; // one day+1hour 919 maxSec = 86400+3600; // one day+1hour
913 mAlarmNotification = noti; 920 mAlarmNotification = noti;
914 int sec = QDateTime::currentDateTime().secsTo( qdt ); 921 int sec = QDateTime::currentDateTime().secsTo( qdt );
915 if ( sec > maxSec ) { 922 if ( sec > maxSec ) {
916 mRecheckAlarmTimer->start( maxSec * 1000 ); 923 mRecheckAlarmTimer->start( maxSec * 1000 );
917 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 924 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
918 return; 925 return;
919 } else { 926 } else {
920 mRecheckAlarmTimer->stop(); 927 mRecheckAlarmTimer->stop();
921 } 928 }
922 //qDebug("Alarm timer started with secs: %d ", sec); 929 //qDebug("Alarm timer started with secs: %d ", sec);
923 mAlarmTimer->start( sec *1000 , true ); 930 mAlarmTimer->start( sec *1000 , true );
924 931
925} 932}
926// called by mRecheckAlarmTimer to get next alarm 933// called by mRecheckAlarmTimer to get next alarm
927// we need this, because a QTimer has only a max range of 25 days 934// we need this, because a QTimer has only a max range of 25 days
928void CalendarView::recheckTimerAlarm() 935void CalendarView::recheckTimerAlarm()
929{ 936{
930 mAlarmTimer->stop(); 937 mAlarmTimer->stop();
931 mRecheckAlarmTimer->stop(); 938 mRecheckAlarmTimer->stop();
932 mCalendar->checkAlarmForIncidence( 0, true ); 939 mCalendar->checkAlarmForIncidence( 0, true );
933} 940}
934#ifndef DESKTOP_VERSION 941#ifndef DESKTOP_VERSION
935void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 942void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
936#else 943#else
937void CalendarView::removeAlarm(const QDateTime &, const QString & ) 944void CalendarView::removeAlarm(const QDateTime &, const QString & )
938#endif 945#endif
939{ 946{
940 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 947 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
941 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 948 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
942#ifndef DESKTOP_VERSION 949#ifndef DESKTOP_VERSION
943 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); 950 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() );
944#endif 951#endif
945 return; 952 return;
946 } 953 }
947 mAlarmTimer->stop(); 954 mAlarmTimer->stop();
948} 955}
949void CalendarView::selectWeekNum ( int num ) 956void CalendarView::selectWeekNum ( int num )
950{ 957{
951 dateNavigator()->blockSignals( true ); 958 dateNavigator()->blockSignals( true );
952 dateNavigator()->selectWeek( num ); 959 dateNavigator()->selectWeek( num );
953 dateNavigator()->blockSignals( false ); 960 dateNavigator()->blockSignals( false );
954 mViewManager->showWeekView(); 961 mViewManager->showWeekView();
955} 962}
956KOViewManager *CalendarView::viewManager() 963KOViewManager *CalendarView::viewManager()
957{ 964{
958 return mViewManager; 965 return mViewManager;
959} 966}
960 967
961KODialogManager *CalendarView::dialogManager() 968KODialogManager *CalendarView::dialogManager()
962{ 969{
963 return mDialogManager; 970 return mDialogManager;
964} 971}
965 972
966QDate CalendarView::startDate() 973QDate CalendarView::startDate()
967{ 974{
968 DateList dates = mNavigator->selectedDates(); 975 DateList dates = mNavigator->selectedDates();
969 976
970 return dates.first(); 977 return dates.first();
971} 978}
972 979
973QDate CalendarView::endDate() 980QDate CalendarView::endDate()
974{ 981{
975 DateList dates = mNavigator->selectedDates(); 982 DateList dates = mNavigator->selectedDates();
976 983
977 return dates.last(); 984 return dates.last();
978} 985}
979 986
980 987
981void CalendarView::createPrinter() 988void CalendarView::createPrinter()
982{ 989{
983#ifndef KORG_NOPRINTER 990#ifndef KORG_NOPRINTER
984 if (!mCalPrinter) { 991 if (!mCalPrinter) {
985 mCalPrinter = new CalPrinter(this, mCalendar); 992 mCalPrinter = new CalPrinter(this, mCalendar);
986 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 993 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
987 } 994 }
988#endif 995#endif
989} 996}
990 997
991 998
992//KOPrefs::instance()->mWriteBackFile 999//KOPrefs::instance()->mWriteBackFile
993//KOPrefs::instance()->mWriteBackExistingOnly 1000//KOPrefs::instance()->mWriteBackExistingOnly
994 1001
995// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 1002// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
996// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 1003// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
997// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 1004// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
998// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 1005// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
999// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 1006// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
1000// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 1007// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
1001 1008
1002int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 1009int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
1003{ 1010{
1004 1011
1005 // 0 equal 1012 // 0 equal
1006 // 1 take local 1013 // 1 take local
1007 // 2 take remote 1014 // 2 take remote
1008 // 3 cancel 1015 // 3 cancel
1009 QDateTime lastSync = mLastCalendarSync; 1016 QDateTime lastSync = mLastCalendarSync;
1010 QDateTime localMod = local->lastModified(); 1017 QDateTime localMod = local->lastModified();
1011 QDateTime remoteMod = remote->lastModified(); 1018 QDateTime remoteMod = remote->lastModified();
1012 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1019 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1013 bool remCh, locCh; 1020 bool remCh, locCh;
1014 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 1021 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
1015 //if ( remCh ) 1022 //if ( remCh )
1016 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 1023 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
1017 locCh = ( localMod > mLastCalendarSync ); 1024 locCh = ( localMod > mLastCalendarSync );
1018 if ( !remCh && ! locCh ) { 1025 if ( !remCh && ! locCh ) {
1019 //qDebug("both not changed "); 1026 //qDebug("both not changed ");
1020 lastSync = localMod.addDays(1); 1027 lastSync = localMod.addDays(1);
1021 if ( mode <= SYNC_PREF_ASK ) 1028 if ( mode <= SYNC_PREF_ASK )
1022 return 0; 1029 return 0;
1023 } else { 1030 } else {
1024 if ( locCh ) { 1031 if ( locCh ) {
1025 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 1032 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
1026 lastSync = localMod.addDays( -1 ); 1033 lastSync = localMod.addDays( -1 );
1027 if ( !remCh ) 1034 if ( !remCh )
1028 remoteMod = ( lastSync.addDays( -1 ) ); 1035 remoteMod = ( lastSync.addDays( -1 ) );
1029 } else { 1036 } else {
1030 //qDebug(" not loc changed "); 1037 //qDebug(" not loc changed ");
1031 lastSync = localMod.addDays( 1 ); 1038 lastSync = localMod.addDays( 1 );
1032 if ( remCh ) 1039 if ( remCh )
1033 remoteMod =( lastSync.addDays( 1 ) ); 1040 remoteMod =( lastSync.addDays( 1 ) );
1034 1041
1035 } 1042 }
1036 } 1043 }
1037 full = true; 1044 full = true;
1038 if ( mode < SYNC_PREF_ASK ) 1045 if ( mode < SYNC_PREF_ASK )
1039 mode = SYNC_PREF_ASK; 1046 mode = SYNC_PREF_ASK;
1040 } else { 1047 } else {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 651194b..a5f230a 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,586 +1,587 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#include <qscrollbar.h> 33#include <qscrollbar.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qtopia/ir.h> 35#include <qtopia/ir.h>
36#else 36#else
37#define Ir char 37#define Ir char
38#endif 38#endif
39#include <libkcal/calendar.h> 39#include <libkcal/calendar.h>
40#include <libkcal/scheduler.h> 40#include <libkcal/scheduler.h>
41#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
42#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
43#include <KDGanttMinimizeSplitter.h> 43#include <KDGanttMinimizeSplitter.h>
44 44
45#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
46 46
47#include <ksyncmanager.h> 47#include <ksyncmanager.h>
48//#include <koprefs.h> 48//#include <koprefs.h>
49 49
50class QWidgetStack; 50class QWidgetStack;
51class QSplitter; 51class QSplitter;
52class KopiCalendarFile; 52class KopiCalendarFile;
53class CalPrinter; 53class CalPrinter;
54class KOFilterView; 54class KOFilterView;
55class KOCalEditView; 55class KOCalEditView;
56class KOViewManager; 56class KOViewManager;
57class KODialogManager; 57class KODialogManager;
58class KOTodoView; 58class KOTodoView;
59class KDateNavigator; 59class KDateNavigator;
60class DateNavigatorContainer; 60class DateNavigatorContainer;
61class DateNavigator; 61class DateNavigator;
62class KOIncidenceEditor; 62class KOIncidenceEditor;
63class KDatePicker; 63class KDatePicker;
64class ResourceView; 64class ResourceView;
65class KOEventEditor; 65class KOEventEditor;
66class KOTodoEditor ; 66class KOTodoEditor ;
67class KOEventViewerDialog; 67class KOEventViewerDialog;
68class KOBeamPrefs; 68class KOBeamPrefs;
69class KSyncProfile; 69class KSyncProfile;
70class AlarmDialog; 70class AlarmDialog;
71class KCal::Attendee; 71class KCal::Attendee;
72 72
73namespace KCal { class FileStorage; } 73namespace KCal { class FileStorage; }
74 74
75using namespace KCal; 75using namespace KCal;
76 76
77/** 77/**
78 This is the main calendar widget. It provides the different vies on t he 78 This is the main calendar widget. It provides the different vies on t he
79 calendar data as well as the date navigator. It also handles synchronisation 79 calendar data as well as the date navigator. It also handles synchronisation
80 of the different views and controls the different dialogs like preferences, 80 of the different views and controls the different dialogs like preferences,
81 event editor, search dialog etc. 81 event editor, search dialog etc.
82 82
83 @short main calendar view widget 83 @short main calendar view widget
84 @author Cornelius Schumacher 84 @author Cornelius Schumacher
85*/ 85*/
86 86
87#include <qtextbrowser.h> 87#include <qtextbrowser.h>
88#include <qtextcodec.h> 88#include <qtextcodec.h>
89 89
90class MissedAlarmTextBrowser : public QTextBrowser { 90class MissedAlarmTextBrowser : public QTextBrowser {
91 Q_OBJECT 91 Q_OBJECT
92 public: 92 public:
93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start); 93 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
94 ~MissedAlarmTextBrowser(); 94 ~MissedAlarmTextBrowser();
95 void setSource(const QString & n); 95 void setSource(const QString & n);
96 96
97 private: 97 private:
98 Incidence * getNextInc(QDateTime start ); 98 Incidence * getNextInc(QDateTime start );
99 QPtrList<Incidence> mAlarms; 99 QPtrList<Incidence> mAlarms;
100 signals: 100 signals:
101 void showIncidence( QString uid); 101 void showIncidence( QString uid);
102}; 102};
103 103
104 104
105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 105class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
106{ 106{
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 /** 109 /**
110 Constructs a new calendar view widget. 110 Constructs a new calendar view widget.
111 111
112 @param calendar calendar document 112 @param calendar calendar document
113 @param parent parent window 113 @param parent parent window
114 @param name Qt internal widget object name 114 @param name Qt internal widget object name
115 */ 115 */
116 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 116 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 CalendarView( Calendar *calendar, QWidget *parent = 0, 118 CalendarView( Calendar *calendar, QWidget *parent = 0,
119 const char *name = 0 ); 119 const char *name = 0 );
120 virtual ~CalendarView(); 120 virtual ~CalendarView();
121 121
122 Calendar *calendar() { return mCalendar; } 122 Calendar *calendar() { return mCalendar; }
123 123
124 KOViewManager *viewManager(); 124 KOViewManager *viewManager();
125 KODialogManager *dialogManager(); 125 KODialogManager *dialogManager();
126 126
127 QDate startDate(); 127 QDate startDate();
128 QDate endDate(); 128 QDate endDate();
129 129
130 QWidgetStack *viewStack(); 130 QWidgetStack *viewStack();
131 QWidget *leftFrame(); 131 QWidget *leftFrame();
132 132
133 DateNavigator *dateNavigator(); 133 DateNavigator *dateNavigator();
134 KDateNavigator *dateNavigatorWidget(); 134 KDateNavigator *dateNavigatorWidget();
135 135
136 void addView(KOrg::BaseView *); 136 void addView(KOrg::BaseView *);
137 void showView(KOrg::BaseView *); 137 void showView(KOrg::BaseView *);
138 KOEventViewerDialog* getEventViewerDialog(); 138 KOEventViewerDialog* getEventViewerDialog();
139 Incidence *currentSelection(); 139 Incidence *currentSelection();
140 void checkSuspendAlarm(); 140 void checkSuspendAlarm();
141 141
142 signals: 142 signals:
143 void save (); 143 void save ();
144 void saveStopTimer (); 144 void saveStopTimer ();
145 void tempDisableBR(bool); 145 void tempDisableBR(bool);
146 /** This todo has been modified */ 146 /** This todo has been modified */
147 void todoModified(Todo *, int); 147 void todoModified(Todo *, int);
148 148
149 /** when change is made to options dialog, the topwidget will catch this 149 /** when change is made to options dialog, the topwidget will catch this
150 * and emit this signal which notifies all widgets which have registered 150 * and emit this signal which notifies all widgets which have registered
151 * for notification to update their settings. */ 151 * for notification to update their settings. */
152 void configChanged(); 152 void configChanged();
153 /** emitted when the topwidget is closing down, so that any attached 153 /** emitted when the topwidget is closing down, so that any attached
154 child windows can also close. */ 154 child windows can also close. */
155 void closingDown(); 155 void closingDown();
156 /** emitted right before we die */ 156 /** emitted right before we die */
157 void closed(QWidget *); 157 void closed(QWidget *);
158 158
159 /** Emitted when state of modified flag changes */ 159 /** Emitted when state of modified flag changes */
160 void modifiedChanged(bool); 160 void modifiedChanged(bool);
161 void signalmodified(); 161 void signalmodified();
162 162
163 /** Emitted when state of read-only flag changes */ 163 /** Emitted when state of read-only flag changes */
164 void readOnlyChanged(bool); 164 void readOnlyChanged(bool);
165 165
166 /** Emitted when the unit of navigation changes */ 166 /** Emitted when the unit of navigation changes */
167 void changeNavStringPrev(const QString &); 167 void changeNavStringPrev(const QString &);
168 void changeNavStringNext(const QString &); 168 void changeNavStringNext(const QString &);
169 169
170 /** Emitted when state of events selection has changed and user is organizer*/ 170 /** Emitted when state of events selection has changed and user is organizer*/
171 void organizerEventsSelected(bool); 171 void organizerEventsSelected(bool);
172 /** Emitted when state of events selection has changed and user is attendee*/ 172 /** Emitted when state of events selection has changed and user is attendee*/
173 void groupEventsSelected(bool); 173 void groupEventsSelected(bool);
174 /** 174 /**
175 Emitted when an incidence gets selected. If the selection is cleared the 175 Emitted when an incidence gets selected. If the selection is cleared the
176 signal is emitted with 0 as argument. 176 signal is emitted with 0 as argument.
177 */ 177 */
178 void incidenceSelected( Incidence * ); 178 void incidenceSelected( Incidence * );
179 /** Emitted, when a todoitem is selected or deselected. */ 179 /** Emitted, when a todoitem is selected or deselected. */
180 void todoSelected( bool ); 180 void todoSelected( bool );
181 181
182 /** 182 /**
183 Emitted, when clipboard content changes. Parameter indicates if paste 183 Emitted, when clipboard content changes. Parameter indicates if paste
184 is possible or not. 184 is possible or not.
185 */ 185 */
186 void pasteEnabled(bool); 186 void pasteEnabled(bool);
187 187
188 /** Emitted, when the number of incoming messages has changed. */ 188 /** Emitted, when the number of incoming messages has changed. */
189 void numIncomingChanged(int); 189 void numIncomingChanged(int);
190 190
191 /** Emitted, when the number of outgoing messages has changed. */ 191 /** Emitted, when the number of outgoing messages has changed. */
192 void numOutgoingChanged(int); 192 void numOutgoingChanged(int);
193 193
194 /** Send status message, which can e.g. be displayed in the status bar. */ 194 /** Send status message, which can e.g. be displayed in the status bar. */
195 void statusMessage(const QString &); 195 void statusMessage(const QString &);
196 196
197 void calendarViewExpanded( bool ); 197 void calendarViewExpanded( bool );
198 void updateSearchDialog(); 198 void updateSearchDialog();
199 void filtersUpdated(); 199 void filtersUpdated();
200 200
201 201
202 public slots: 202 public slots:
203 void setCalReadOnly( int id, bool readO );
203 void checkAlarms(); 204 void checkAlarms();
204 void checkFiles(); 205 void checkFiles();
205 void slotprintSelInc(); 206 void slotprintSelInc();
206 void showNextAlarms(); 207 void showNextAlarms();
207 void showOpenError(); 208 void showOpenError();
208 void watchSavedFile(); 209 void watchSavedFile();
209 void recheckTimerAlarm(); 210 void recheckTimerAlarm();
210 void checkNextTimerAlarm(); 211 void checkNextTimerAlarm();
211 void addAlarm(const QDateTime &qdt, const QString &noti ); 212 void addAlarm(const QDateTime &qdt, const QString &noti );
212 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 213 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
213 void removeAlarm(const QDateTime &qdt, const QString &noti ); 214 void removeAlarm(const QDateTime &qdt, const QString &noti );
214 215
215 /** options dialog made a changed to the configuration. we catch this 216 /** options dialog made a changed to the configuration. we catch this
216 * and notify all widgets which need to update their configuration. */ 217 * and notify all widgets which need to update their configuration. */
217 void updateConfig(); 218 void updateConfig();
218 219
219 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 220 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
220 const QStringList& anniversaryList, const QStringList& realNameList, 221 const QStringList& anniversaryList, const QStringList& realNameList,
221 const QStringList& emailList, const QStringList& assembledNameList, 222 const QStringList& emailList, const QStringList& assembledNameList,
222 const QStringList& uidList); 223 const QStringList& uidList);
223 224
224 /** 225 /**
225 Load calendar from file \a filename. If \a merge is true, load 226 Load calendar from file \a filename. If \a merge is true, load
226 calendar into existing one, if it is false, clear calendar, before 227 calendar into existing one, if it is false, clear calendar, before
227 loading. Return true, if calendar could be successfully loaded. 228 loading. Return true, if calendar could be successfully loaded.
228 */ 229 */
229 bool openCalendar(QString filename, bool merge=false); 230 bool openCalendar(QString filename, bool merge=false);
230 bool loadCalendars(); 231 bool loadCalendars();
231 bool saveCalendars(); 232 bool saveCalendars();
232 bool restoreCalendarSettings(); 233 bool restoreCalendarSettings();
233 bool addCalendar( KopiCalendarFile * ); 234 bool addCalendar( KopiCalendarFile * );
234 void addCalendarId( int id ); 235 void addCalendarId( int id );
235 bool syncCalendar(QString filename,int mode = 0 ); 236 bool syncCalendar(QString filename,int mode = 0 );
236 237
237 /** 238 /**
238 Save calendar data to file. Return true if calendar could be 239 Save calendar data to file. Return true if calendar could be
239 successfully saved. 240 successfully saved.
240 */ 241 */
241 bool saveCalendar(QString filename); 242 bool saveCalendar(QString filename);
242 243
243 /** 244 /**
244 Close calendar. Clear calendar data and reset views to display an empty 245 Close calendar. Clear calendar data and reset views to display an empty
245 calendar. 246 calendar.
246 */ 247 */
247 void closeCalendar(); 248 void closeCalendar();
248 249
249 /** Archive old events of calendar */ 250 /** Archive old events of calendar */
250 void archiveCalendar(); 251 void archiveCalendar();
251 252
252 void showIncidence(); 253 void showIncidence();
253 void editIncidence(); 254 void editIncidence();
254 void editIncidenceDescription(); 255 void editIncidenceDescription();
255 void deleteIncidence(); 256 void deleteIncidence();
256 void cloneIncidence(); 257 void cloneIncidence();
257 void moveIncidence(); 258 void moveIncidence();
258 void beamIncidence(); 259 void beamIncidence();
259 void toggleCancelIncidence(); 260 void toggleCancelIncidence();
260 261
261 /** create an editeventwin with supplied date/time, and if bool is true, 262 /** create an editeventwin with supplied date/time, and if bool is true,
262 * make the event take all day. */ 263 * make the event take all day. */
263 void newEvent(QDateTime, QDateTime, bool allDay ); 264 void newEvent(QDateTime, QDateTime, bool allDay );
264 void newEvent(QDateTime, QDateTime); 265 void newEvent(QDateTime, QDateTime);
265 void newEvent(QDateTime fh); 266 void newEvent(QDateTime fh);
266 void newEvent(QDate dt); 267 void newEvent(QDate dt);
267 /** create new event without having a date hint. Takes current date as 268 /** create new event without having a date hint. Takes current date as
268 default hint. */ 269 default hint. */
269 void newEvent(); 270 void newEvent();
270 void newFloatingEvent(); 271 void newFloatingEvent();
271 272
272 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 273 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
273 void showIncidence(Incidence *); 274 void showIncidence(Incidence *);
274 void showIncidence(QString uid); 275 void showIncidence(QString uid);
275 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 276 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
276 void editIncidence(Incidence *); 277 void editIncidence(Incidence *);
277 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 278 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
278 void deleteIncidence(Incidence *); 279 void deleteIncidence(Incidence *);
279 void cloneIncidence(Incidence *); 280 void cloneIncidence(Incidence *);
280 void cancelIncidence(Incidence *); 281 void cancelIncidence(Incidence *);
281 /** Create an editor for the supplied event. */ 282 /** Create an editor for the supplied event. */
282 void editEvent(Event *); 283 void editEvent(Event *);
283 /** Delete the supplied event. */ 284 /** Delete the supplied event. */
284 void deleteEvent(Event *); 285 void deleteEvent(Event *);
285 /** Delete the event with the given unique ID. Returns false, if event wasn't 286 /** Delete the event with the given unique ID. Returns false, if event wasn't
286 found. */ 287 found. */
287 bool deleteEvent(const QString &uid); 288 bool deleteEvent(const QString &uid);
288 /** Create a read-only viewer dialog for the supplied event. */ 289 /** Create a read-only viewer dialog for the supplied event. */
289 void showEvent(Event *); 290 void showEvent(Event *);
290 291
291 void editJournal(Journal *); 292 void editJournal(Journal *);
292 void showJournal(Journal *); 293 void showJournal(Journal *);
293 void deleteJournal(Journal *); 294 void deleteJournal(Journal *);
294 /** Create an editor dialog for a todo */ 295 /** Create an editor dialog for a todo */
295 void editTodo(Todo *); 296 void editTodo(Todo *);
296 /** Create a read-only viewer dialog for the supplied todo */ 297 /** Create a read-only viewer dialog for the supplied todo */
297 void showTodo(Todo *); 298 void showTodo(Todo *);
298 /** create new todo */ 299 /** create new todo */
299 void newTodo(); 300 void newTodo();
300 void newTodoDateTime(QDateTime, bool allday); 301 void newTodoDateTime(QDateTime, bool allday);
301 /** create new todo with a parent todo */ 302 /** create new todo with a parent todo */
302 void newSubTodo(); 303 void newSubTodo();
303 /** create new todo with a parent todo */ 304 /** create new todo with a parent todo */
304 void newSubTodo(Todo *); 305 void newSubTodo(Todo *);
305 /** Delete todo */ 306 /** Delete todo */
306 void deleteTodo(Todo *); 307 void deleteTodo(Todo *);
307 308
308 309
309 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is 310 /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
310 * emitted as result. */ 311 * emitted as result. */
311 void checkClipboard(); 312 void checkClipboard();
312 313
313 /** using the KConfig associated with the kapp variable, read in the 314 /** using the KConfig associated with the kapp variable, read in the
314 * settings from the config file. 315 * settings from the config file.
315 */ 316 */
316 void readSettings(); 317 void readSettings();
317 318
318 /** write current state to config file. */ 319 /** write current state to config file. */
319 void writeSettings(); 320 void writeSettings();
320 321
321 /** read settings for calendar filters */ 322 /** read settings for calendar filters */
322 void readFilterSettings(KConfig *config); 323 void readFilterSettings(KConfig *config);
323 324
324 /** write settings for calendar filters */ 325 /** write settings for calendar filters */
325 void writeFilterSettings(KConfig *config); 326 void writeFilterSettings(KConfig *config);
326 327
327 /** passes on the message that an event has changed to the currently 328 /** passes on the message that an event has changed to the currently
328 * activated view so that it can make appropriate display changes. */ 329 * activated view so that it can make appropriate display changes. */
329 void changeEventDisplay(Event *, int); 330 void changeEventDisplay(Event *, int);
330 void changeIncidenceDisplay(Incidence *, int); 331 void changeIncidenceDisplay(Incidence *, int);
331 void changeTodoDisplay(Todo *, int); 332 void changeTodoDisplay(Todo *, int);
332 333
333 void eventAdded(Event *); 334 void eventAdded(Event *);
334 void eventChanged(Event *); 335 void eventChanged(Event *);
335 void eventToBeDeleted(Event *); 336 void eventToBeDeleted(Event *);
336 void eventDeleted(); 337 void eventDeleted();
337 338
338 void todoAdded(Todo *); 339 void todoAdded(Todo *);
339 void todoChanged(Todo *); 340 void todoChanged(Todo *);
340 void todoToBeDeleted(Todo *); 341 void todoToBeDeleted(Todo *);
341 void todoDeleted(); 342 void todoDeleted();
342 343
343 void updateView(const QDate &start, const QDate &end); 344 void updateView(const QDate &start, const QDate &end);
344 void updateView(); 345 void updateView();
345 void clearAllViews(); 346 void clearAllViews();
346 347
347 /** Full update of visible todo views */ 348 /** Full update of visible todo views */
348 void updateTodoViews(); 349 void updateTodoViews();
349 350
350 void updateUnmanagedViews(); 351 void updateUnmanagedViews();
351 352
352 /** cut the current appointment to the clipboard */ 353 /** cut the current appointment to the clipboard */
353 void edit_cut(); 354 void edit_cut();
354 355
355 /** copy the current appointment(s) to the clipboard */ 356 /** copy the current appointment(s) to the clipboard */
356 void edit_copy(); 357 void edit_copy();
357 358
358 /** paste the current vobject(s) in the clipboard buffer into calendar */ 359 /** paste the current vobject(s) in the clipboard buffer into calendar */
359 void edit_paste(); 360 void edit_paste();
360 361
361 /** edit viewing and configuration options. */ 362 /** edit viewing and configuration options. */
362 void edit_options(); 363 void edit_options();
363 void edit_global_options(); 364 void edit_global_options();
364 /** 365 /**
365 Functions for printing, previewing a print, and setting up printing 366 Functions for printing, previewing a print, and setting up printing
366 parameters. 367 parameters.
367 */ 368 */
368 void print(); 369 void print();
369 void printSetup(); 370 void printSetup();
370 void printPreview(); 371 void printPreview();
371 372
372 /** Export as iCalendar file */ 373 /** Export as iCalendar file */
373 void exportICalendar(); 374 void exportICalendar();
374 375
375 /** Export as vCalendar file */ 376 /** Export as vCalendar file */
376 bool exportVCalendar( QString fn); 377 bool exportVCalendar( QString fn);
377 378
378 /** pop up a dialog to show an existing appointment. */ 379 /** pop up a dialog to show an existing appointment. */
379 void appointment_show(); 380 void appointment_show();
380 /** 381 /**
381 * pop up an Appointment Dialog to edit an existing appointment.Get 382 * pop up an Appointment Dialog to edit an existing appointment.Get
382 * information on the appointment from the list of unique IDs that is 383 * information on the appointment from the list of unique IDs that is
383 * currently in the View, called currIds. 384 * currently in the View, called currIds.
384 */ 385 */
385 void appointment_edit(); 386 void appointment_edit();
386 /** 387 /**
387 * pop up dialog confirming deletion of currently selected event in the 388 * pop up dialog confirming deletion of currently selected event in the
388 * View. 389 * View.
389 */ 390 */
390 void appointment_delete(); 391 void appointment_delete();
391 392
392 /** mails the currently selected event to a particular user as a vCalendar 393 /** mails the currently selected event to a particular user as a vCalendar
393 attachment. */ 394 attachment. */
394 void action_mail(); 395 void action_mail();
395 396
396 /* frees a subtodo from it's relation */ 397 /* frees a subtodo from it's relation */
397 void todo_unsub( Todo * ); 398 void todo_unsub( Todo * );
398 void todo_resub( Todo * parent, Todo * sub ); 399 void todo_resub( Todo * parent, Todo * sub );
399 400
400 /** Take ownership of selected event. */ 401 /** Take ownership of selected event. */
401 void takeOverEvent(); 402 void takeOverEvent();
402 403
403 /** Take ownership of all events in calendar. */ 404 /** Take ownership of all events in calendar. */
404 void takeOverCalendar(); 405 void takeOverCalendar();
405 406
406 /** query whether or not the calendar is "dirty". */ 407 /** query whether or not the calendar is "dirty". */
407 bool isModified(); 408 bool isModified();
408 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ 409 /** set the state of calendar. Modified means "dirty", i.e. needing a save. */
409 void setModified(bool modified=true); 410 void setModified(bool modified=true);
410 411
411 /** query if the calendar is read-only. */ 412 /** query if the calendar is read-only. */
412 bool isReadOnly(); 413 bool isReadOnly();
413 /** set state of calendar to read-only */ 414 /** set state of calendar to read-only */
414 void setReadOnly(bool readOnly=true); 415 void setReadOnly(bool readOnly=true);
415 416
416 void eventUpdated(Incidence *); 417 void eventUpdated(Incidence *);
417 418
418 /* iTIP scheduling actions */ 419 /* iTIP scheduling actions */
419 void schedule_publish(Incidence *incidence = 0); 420 void schedule_publish(Incidence *incidence = 0);
420 void schedule_request(Incidence *incidence = 0); 421 void schedule_request(Incidence *incidence = 0);
421 void schedule_refresh(Incidence *incidence = 0); 422 void schedule_refresh(Incidence *incidence = 0);
422 void schedule_cancel(Incidence *incidence = 0); 423 void schedule_cancel(Incidence *incidence = 0);
423 void schedule_add(Incidence *incidence = 0); 424 void schedule_add(Incidence *incidence = 0);
424 void schedule_reply(Incidence *incidence = 0); 425 void schedule_reply(Incidence *incidence = 0);
425 void schedule_counter(Incidence *incidence = 0); 426 void schedule_counter(Incidence *incidence = 0);
426 void schedule_declinecounter(Incidence *incidence = 0); 427 void schedule_declinecounter(Incidence *incidence = 0);
427 void schedule_publish_freebusy(int daysToPublish = 30); 428 void schedule_publish_freebusy(int daysToPublish = 30);
428 429
429 void openAddressbook(); 430 void openAddressbook();
430 431
431 void editFilters(); 432 void editFilters();
432 void toggleFilerEnabled(); 433 void toggleFilerEnabled();
433 QPtrList<CalFilter> filters(); 434 QPtrList<CalFilter> filters();
434 void toggleFilter(); 435 void toggleFilter();
435 void showFilter(bool visible); 436 void showFilter(bool visible);
436 void updateFilter(); 437 void updateFilter();
437 void filterEdited(); 438 void filterEdited();
438 void selectFilter( int ); 439 void selectFilter( int );
439 KOFilterView *filterView(); 440 KOFilterView *filterView();
440 441
441 void showIntro(); 442 void showIntro();
442 443
443 /** Move the curdatepient view date to today */ 444 /** Move the curdatepient view date to today */
444 void goToday(); 445 void goToday();
445 446
446 /** Move to the next date(s) in the current view */ 447 /** Move to the next date(s) in the current view */
447 void goNext(); 448 void goNext();
448 449
449 /** Move to the previous date(s) in the current view */ 450 /** Move to the previous date(s) in the current view */
450 void goPrevious(); 451 void goPrevious();
451 /** Move to the next date(s) in the current view */ 452 /** Move to the next date(s) in the current view */
452 void goNextMonth(); 453 void goNextMonth();
453 454
454 /** Move to the previous date(s) in the current view */ 455 /** Move to the previous date(s) in the current view */
455 void goPreviousMonth(); 456 void goPreviousMonth();
456 457
457 void toggleExpand(); 458 void toggleExpand();
458 void toggleDateNavigatorWidget(); 459 void toggleDateNavigatorWidget();
459 void toggleAllDaySize(); 460 void toggleAllDaySize();
460 461
461 /** Look for new messages in the inbox */ 462 /** Look for new messages in the inbox */
462 void lookForIncomingMessages(); 463 void lookForIncomingMessages();
463 /** Look for new messages in the outbox */ 464 /** Look for new messages in the outbox */
464 void lookForOutgoingMessages(); 465 void lookForOutgoingMessages();
465 466
466 void processMainViewSelection( Incidence * ); 467 void processMainViewSelection( Incidence * );
467 void processTodoListSelection( Incidence * ); 468 void processTodoListSelection( Incidence * );
468 469
469 void processIncidenceSelection( Incidence * ); 470 void processIncidenceSelection( Incidence * );
470 471
471 void purgeCompleted(); 472 void purgeCompleted();
472 bool removeCompletedSubTodos( Todo* ); 473 bool removeCompletedSubTodos( Todo* );
473 void slotCalendarChanged(); 474 void slotCalendarChanged();
474 bool importBday(); 475 bool importBday();
475 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 476 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
476 bool importQtopia( const QString &categoriesFile, 477 bool importQtopia( const QString &categoriesFile,
477 const QString &datebookFile, 478 const QString &datebookFile,
478 const QString &tasklistFile ); 479 const QString &tasklistFile );
479 void syncExternal( int mode ); 480 void syncExternal( int mode );
480 void slotSelectPickerDate( QDate ) ; 481 void slotSelectPickerDate( QDate ) ;
481 void showDatePicker() ; 482 void showDatePicker() ;
482 void showDatePickerPopup() ; 483 void showDatePickerPopup() ;
483 void moveIncidence(Incidence *) ; 484 void moveIncidence(Incidence *) ;
484 void beamIncidence(Incidence *) ; 485 void beamIncidence(Incidence *) ;
485 void beamCalendar() ; 486 void beamCalendar() ;
486 void beamFilteredCalendar() ; 487 void beamFilteredCalendar() ;
487 void beamIncidenceList(QPtrList<Incidence>) ; 488 void beamIncidenceList(QPtrList<Incidence>) ;
488 void manageCategories(); 489 void manageCategories();
489 void editCategories(); 490 void editCategories();
490 int addCategories(); 491 int addCategories();
491 void removeCategories(); 492 void removeCategories();
492 void setSyncDevice( QString ); 493 void setSyncDevice( QString );
493 void setSyncName( QString ); 494 void setSyncName( QString );
494 void showDay( QDate ); 495 void showDay( QDate );
495 void undo_delete(); 496 void undo_delete();
496 protected slots: 497 protected slots:
497 void resetFocus(); 498 void resetFocus();
498 void scrollBarValue(int); 499 void scrollBarValue(int);
499 void slotViewerClosed(); 500 void slotViewerClosed();
500 void timerAlarm(); 501 void timerAlarm();
501 void suspendAlarm(); 502 void suspendAlarm();
502 void beamDone( Ir *ir ); 503 void beamDone( Ir *ir );
503 /** Select a view or adapt the current view to display the specified dates. */ 504 /** Select a view or adapt the current view to display the specified dates. */
504 void showDates( const KCal::DateList & ); 505 void showDates( const KCal::DateList & );
505 void selectWeekNum ( int ); 506 void selectWeekNum ( int );
506 507
507 public: 508 public:
508 // show a standard warning 509 // show a standard warning
509 // returns KMsgBox::yesNoCancel() 510 // returns KMsgBox::yesNoCancel()
510 int msgCalModified(); 511 int msgCalModified();
511 virtual bool sync(KSyncManager* manager, QString filename, int mode); 512 virtual bool sync(KSyncManager* manager, QString filename, int mode);
512 513
513 virtual bool syncExternal(KSyncManager* manager, QString resource); 514 virtual bool syncExternal(KSyncManager* manager, QString resource);
514 virtual void removeSyncInfo( QString syncProfile); 515 virtual void removeSyncInfo( QString syncProfile);
515 void setSyncManager(KSyncManager* manager); 516 void setSyncManager(KSyncManager* manager);
516 void setLoadedFileVersion(QDateTime); 517 void setLoadedFileVersion(QDateTime);
517 bool checkFileVersion(QString fn); 518 bool checkFileVersion(QString fn);
518 bool checkAllFileVersions(); 519 bool checkAllFileVersions();
519 bool checkFileChanged(QString fn); 520 bool checkFileChanged(QString fn);
520 Event* getLastSyncEvent(); 521 Event* getLastSyncEvent();
521 /** Adapt navigation units correpsonding to step size of navigation of the 522 /** Adapt navigation units correpsonding to step size of navigation of the
522 * current view. 523 * current view.
523 */ 524 */
524 void adaptNavigationUnits(); 525 void adaptNavigationUnits();
525 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 526 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
526 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 527 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
527 //Attendee* getYourAttendee(Event *event); 528 //Attendee* getYourAttendee(Event *event);
528 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 529 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
529 void setScrollBarStep(int val ); 530 void setScrollBarStep(int val );
530 531
531 protected: 532 protected:
532 void schedule(Scheduler::Method, Incidence *incidence = 0); 533 void schedule(Scheduler::Method, Incidence *incidence = 0);
533 534
534 // returns KMsgBox::OKCandel() 535 // returns KMsgBox::OKCandel()
535 int msgItemDelete(const QString name); 536 int msgItemDelete(const QString name);
536 void showEventEditor(); 537 void showEventEditor();
537 void showTodoEditor(); 538 void showTodoEditor();
538 Todo *selectedTodo(); 539 Todo *selectedTodo();
539 private: 540 private:
540#ifdef DESKTOP_VERSION 541#ifdef DESKTOP_VERSION
541 QScrollBar * mDateScrollBar; 542 QScrollBar * mDateScrollBar;
542#endif 543#endif
543 QDateTime mNextAlarmDateTime; 544 QDateTime mNextAlarmDateTime;
544 bool mViewerCallerIsSearchDialog; 545 bool mViewerCallerIsSearchDialog;
545 bool mBlockShowDates; 546 bool mBlockShowDates;
546 KSyncManager* mSyncManager; 547 KSyncManager* mSyncManager;
547 AlarmDialog * mAlarmDialog; 548 AlarmDialog * mAlarmDialog;
548 QString mAlarmNotification; 549 QString mAlarmNotification;
549 QString mSuspendAlarmNotification; 550 QString mSuspendAlarmNotification;
550 QTimer* mSuspendTimer; 551 QTimer* mSuspendTimer;
551 QTimer* mAlarmTimer; 552 QTimer* mAlarmTimer;
552 QTimer* mRecheckAlarmTimer; 553 QTimer* mRecheckAlarmTimer;
553 void computeAlarm( QString ); 554 void computeAlarm( QString );
554 void startAlarm( QString, QString ); 555 void startAlarm( QString, QString );
555 void setSyncEventsReadOnly(); 556 void setSyncEventsReadOnly();
556 557
557 QDateTime loadedFileVersion; 558 QDateTime loadedFileVersion;
558 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 559 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
559 void checkExternalId( Incidence * inc ); 560 void checkExternalId( Incidence * inc );
560 int mGlobalSyncMode; 561 int mGlobalSyncMode;
561 QString mCurrentSyncDevice; 562 QString mCurrentSyncDevice;
562 QString mCurrentSyncName; 563 QString mCurrentSyncName;
563 void init(); 564 void init();
564 int mDatePickerMode; 565 int mDatePickerMode;
565 bool mFlagEditDescription; 566 bool mFlagEditDescription;
566 QDateTime mLastCalendarSync; 567 QDateTime mLastCalendarSync;
567 void createPrinter(); 568 void createPrinter();
568 569
569 void calendarModified( bool, Calendar * ); 570 void calendarModified( bool, Calendar * );
570 571
571 CalPrinter *mCalPrinter; 572 CalPrinter *mCalPrinter;
572 573
573 QSplitter *mPanner; 574 QSplitter *mPanner;
574 QSplitter *mLeftSplitter; 575 QSplitter *mLeftSplitter;
575 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 576 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
576 QWidgetStack *mRightFrame; 577 QWidgetStack *mRightFrame;
577 578
578 KDatePicker* mDatePicker; 579 KDatePicker* mDatePicker;
579 QVBox* mDateFrame; 580 QVBox* mDateFrame;
580 581
581 DateNavigatorContainer *mDateNavigator; // widget showing small month view. 582 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
582 583
583 KOFilterView *mFilterView; 584 KOFilterView *mFilterView;
584 KOCalEditView *mCalEditView; 585 KOCalEditView *mCalEditView;
585 586
586 ResourceView *mResourceView; 587 ResourceView *mResourceView;
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 1335d7e..3f08ef8 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -1,469 +1,469 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qtextcodec.h> 31#include <qtextcodec.h>
32 32
33 33
34#include <libkcal/calfilter.h> 34#include <libkcal/calfilter.h>
35 35
36#include "kofilterview.h" 36#include "kofilterview.h"
37#include "koprefs.h" 37#include "koprefs.h"
38#include <kiconloader.h> 38#include <kiconloader.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <kcolorbutton.h> 40#include <kcolorbutton.h>
41#include <kmessagebox.h> 41#include <kmessagebox.h>
42 42
43 43
44 44
45 45
46 46
47KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 47KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
48 const char* name,WFlags fl ) 48 const char* name,WFlags fl )
49 : KOFilterView_base(parent,name,fl) 49 : KOFilterView_base(parent,name,fl)
50{ 50{
51 mFilters = filterList; 51 mFilters = filterList;
52 52
53 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 53 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
54 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 54 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
55 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 55 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
56} 56}
57 57
58KOFilterView::~KOFilterView() 58KOFilterView::~KOFilterView()
59{ 59{
60 // no need to delete child widgets, Qt does it all for us 60 // no need to delete child widgets, Qt does it all for us
61} 61}
62 62
63bool KOFilterView::filtersEnabled() 63bool KOFilterView::filtersEnabled()
64{ 64{
65 return mEnabledCheck->isChecked(); 65 return mEnabledCheck->isChecked();
66} 66}
67 67
68void KOFilterView::setFiltersEnabled(bool set) 68void KOFilterView::setFiltersEnabled(bool set)
69{ 69{
70 mEnabledCheck->setChecked(set); 70 mEnabledCheck->setChecked(set);
71 emit filterChanged(); 71 emit filterChanged();
72} 72}
73 73
74 74
75void KOFilterView::updateFilters() 75void KOFilterView::updateFilters()
76{ 76{
77 mSelectionCombo->clear(); 77 mSelectionCombo->clear();
78 78
79 CalFilter *filter = mFilters->first(); 79 CalFilter *filter = mFilters->first();
80 while(filter) { 80 while(filter) {
81 mSelectionCombo->insertItem(filter->name()); 81 mSelectionCombo->insertItem(filter->name());
82 filter = mFilters->next(); 82 filter = mFilters->next();
83 } 83 }
84} 84}
85 85
86CalFilter *KOFilterView::selectedFilter() 86CalFilter *KOFilterView::selectedFilter()
87{ 87{
88 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 88 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
89 return f; 89 return f;
90} 90}
91 91
92void KOFilterView::setSelectedFilter(QString filterName) 92void KOFilterView::setSelectedFilter(QString filterName)
93{ 93{
94 int filter_num = mSelectionCombo->count(); 94 int filter_num = mSelectionCombo->count();
95 int i; 95 int i;
96 for (i=0;i<filter_num;i++) { 96 for (i=0;i<filter_num;i++) {
97 if (mSelectionCombo->text(i)==filterName) 97 if (mSelectionCombo->text(i)==filterName)
98 mSelectionCombo->setCurrentItem(i); 98 mSelectionCombo->setCurrentItem(i);
99 } 99 }
100 emit filterChanged(); 100 emit filterChanged();
101} 101}
102void KOFilterView::setSelectedFilter( int fil ) 102void KOFilterView::setSelectedFilter( int fil )
103{ 103{
104 if ( fil >= mSelectionCombo->count() ) 104 if ( fil >= mSelectionCombo->count() )
105 return; 105 return;
106 mSelectionCombo->setCurrentItem( fil ); 106 mSelectionCombo->setCurrentItem( fil );
107 emit filterChanged(); 107 emit filterChanged();
108} 108}
109 109
110 110
111 111
112KOCalEditView::KOCalEditView(QWidget* parent, 112KOCalEditView::KOCalEditView(QWidget* parent,
113 const char* name ) 113 const char* name )
114 : QScrollView(parent,name) 114 : QScrollView(parent,name)
115{ 115{
116 mw = 0; 116 mw = 0;
117 setResizePolicy( AutoOneFit ); 117 setResizePolicy( AutoOneFit );
118 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 118 setFrameStyle ( QFrame::Panel | QFrame::Plain );
119 setLineWidth ( 1 ); 119 setLineWidth ( 1 );
120 setMidLineWidth ( 1 ); 120 setMidLineWidth ( 1 );
121 setFocusPolicy(NoFocus); 121 setFocusPolicy(NoFocus);
122} 122}
123 123
124KOCalEditView::~KOCalEditView() 124KOCalEditView::~KOCalEditView()
125{ 125{
126 // no need to delete child widgets, Qt does it all for us 126 // no need to delete child widgets, Qt does it all for us
127} 127}
128void KOCalEditView::selectCal(int id ,bool b) 128void KOCalEditView::selectCal(int id ,bool b)
129{ 129{
130 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 130 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
131 emit calendarEnabled ( id, b ); 131 emit calendarEnabled ( id, b );
132 emit needsUpdate(); 132 emit needsUpdate();
133 133
134} 134}
135void KOCalEditView::selectStdCal( int id ) 135void KOCalEditView::selectStdCal( int id )
136{ 136{
137 KOCalRadioButton* it = mStdandardB.first(); 137 KOCalRadioButton* it = mStdandardB.first();
138 while ( it ) { 138 while ( it ) {
139 it->blockSignals( true ); 139 it->blockSignals( true );
140 it->setChecked( it->num() == id ); 140 it->setChecked( it->num() == id );
141 it->blockSignals( false ); 141 it->blockSignals( false );
142 it = mStdandardB.next(); 142 it = mStdandardB.next();
143 } 143 }
144 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 144 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
145 while ( kkf ) { 145 while ( kkf ) {
146 kkf->isStandard = (kkf->mCalNumber == id ); 146 kkf->isStandard = (kkf->mCalNumber == id );
147 kkf = KOPrefs::instance()->mCalendars.next(); 147 kkf = KOPrefs::instance()->mCalendars.next();
148 } 148 }
149 emit setCalendarDefault ( id ); 149 emit setCalendarDefault ( id );
150} 150}
151 151
152void KOCalEditView::selectCalAlarm(int id ,bool b ) 152void KOCalEditView::selectCalAlarm(int id ,bool b )
153{ 153{
154 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 154 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
155 emit alarmEnabled ( id , b ); 155 emit alarmEnabled ( id , b );
156 emit needsUpdate(); 156 emit needsUpdate();
157} 157}
158void KOCalEditView::selectReadOnly(int id ,bool b ) 158void KOCalEditView::selectReadOnly(int id ,bool b )
159{ 159{
160 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
161 emit calendarReadonly ( id , b );
162 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) { 160 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b ) {
163 findNewStandard(); 161 findNewStandard();
164 } else { 162 } else {
165 if ( !b ){ 163 if ( !b ){
166 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 164 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
167 while ( kkf ) { 165 while ( kkf ) {
168 if (kkf->isReadOnly && kkf->isStandard ) { 166 if (kkf->isReadOnly && kkf->isStandard ) {
169 selectStdCal( id ); 167 selectStdCal( id );
170 break; 168 break;
171 } 169 }
172 kkf = KOPrefs::instance()->mCalendars.next(); 170 kkf = KOPrefs::instance()->mCalendars.next();
173 } 171 }
174 } 172 }
175 } 173 }
176 mStdandardB.at(id-1)->setEnabled( !b ); 174 mStdandardB.at(id-1)->setEnabled( !b );
175 emit calendarReadonly ( id , b );
176 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
177 emit needsUpdate(); 177 emit needsUpdate();
178 178
179} 179}
180void KOCalEditView::findNewStandard() 180void KOCalEditView::findNewStandard()
181{ 181{
182 bool found = false; 182 bool found = false;
183 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 183 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
184 while ( kkf ) { 184 while ( kkf ) {
185 if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) { 185 if (!kkf->isReadOnly && !kkf->mErrorOnLoad ) {
186 found = true; 186 found = true;
187 selectStdCal( kkf->mCalNumber ); 187 selectStdCal( kkf->mCalNumber );
188 break; 188 break;
189 } 189 }
190 kkf = KOPrefs::instance()->mCalendars.next(); 190 kkf = KOPrefs::instance()->mCalendars.next();
191 } 191 }
192 if ( !found ) { 192 if ( !found ) {
193 KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"), 193 KMessageBox::error( this,i18n("\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n"),
194 i18n("Houston, we have a problem!") ); 194 i18n("Houston, we have a problem!") );
195 195
196 } 196 }
197} 197}
198 198
199void KOCalEditView::setColor( const QColor& c, int id ) 199void KOCalEditView::setColor( const QColor& c, int id )
200{ 200{
201 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 201 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
202 emit needsUpdate(); 202 emit needsUpdate();
203} 203}
204void KOCalEditView::deleteCal( int id ) 204void KOCalEditView::deleteCal( int id )
205{ 205{
206 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 206 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
207 QString name = kkf->mName; 207 QString name = kkf->mName;
208 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 ); 208 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 );
209 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 209 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
210 bool findnewstd = kkf->isStandard; 210 bool findnewstd = kkf->isStandard;
211 emit removeCalendar ( id ); 211 emit removeCalendar ( id );
212 KOPrefs::instance()->mCalendars.remove ( kkf ); 212 KOPrefs::instance()->mCalendars.remove ( kkf );
213 if ( findnewstd ) findNewStandard(); 213 if ( findnewstd ) findNewStandard();
214 emit needsUpdate(); 214 emit needsUpdate();
215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
216} 216}
217void KOCalEditView::infoCal( int id ) 217void KOCalEditView::infoCal( int id )
218{ 218{
219 QString name = KOPrefs::instance()->getCalendar( id )->mName; 219 QString name = KOPrefs::instance()->getCalendar( id )->mName;
220 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 ); 220 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
221 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 221 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
222 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { 222 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
223 emit calendarAdded( id ); 223 emit calendarAdded( id );
224 emit needsUpdate(); 224 emit needsUpdate();
225 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 225 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
226 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); 226 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
227 } 227 }
228 } 228 }
229 else 229 else
230 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 230 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
231} 231}
232void KOCalEditView::readConfig() 232void KOCalEditView::readConfig()
233{ 233{
234 234
235 mStdandardB.clear(); 235 mStdandardB.clear();
236 mEnabledB.clear(); 236 mEnabledB.clear();
237 mAlarmB.clear(); 237 mAlarmB.clear();
238 mROB.clear(); 238 mROB.clear();
239 239
240 if ( mw ) delete mw; 240 if ( mw ) delete mw;
241 mw = new QWidget ( viewport() ); 241 mw = new QWidget ( viewport() );
242 addChild(mw); 242 addChild(mw);
243 int ii = 0; 243 int ii = 0;
244 mainLayout = new QGridLayout ( mw , 2, 8 ); 244 mainLayout = new QGridLayout ( mw , 2, 8 );
245 mainLayout->setMargin( 2 ); 245 mainLayout->setMargin( 2 );
246 mainLayout->setSpacing( 2 ); 246 mainLayout->setSpacing( 2 );
247 QPushButton * addBut = new QPushButton ( mw ); 247 QPushButton * addBut = new QPushButton ( mw );
248 addBut->setFocusPolicy(NoFocus); 248 addBut->setFocusPolicy(NoFocus);
249 mainLayout->addWidget( addBut,0,0 ); 249 mainLayout->addWidget( addBut,0,0 );
250 addBut->setText( "D"); 250 addBut->setText( "D");
251 connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo())); 251 connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo()));
252 //addBut->setPixmap ( SmallIcon("greenhook16")); 252 //addBut->setPixmap ( SmallIcon("greenhook16"));
253 addBut->setMaximumWidth( addBut->sizeHint().height() ); 253 addBut->setMaximumWidth( addBut->sizeHint().height() );
254 int max = addBut->sizeHint().height(); 254 int max = addBut->sizeHint().height();
255 addBut = new QPushButton ( mw ); 255 addBut = new QPushButton ( mw );
256 addBut->setFocusPolicy(NoFocus); 256 addBut->setFocusPolicy(NoFocus);
257 mainLayout->addWidget( addBut,0,++ii ); 257 mainLayout->addWidget( addBut,0,++ii );
258 addBut->setPixmap ( SmallIcon("eye")); 258 addBut->setPixmap ( SmallIcon("eye"));
259 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 259 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
260 addBut->setMaximumWidth( addBut->sizeHint().height() ); 260 addBut->setMaximumWidth( addBut->sizeHint().height() );
261 261
262 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 262 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
263 mainLayout->addWidget( lab,0,++ii ); 263 mainLayout->addWidget( lab,0,++ii );
264 //lab = new QLabel ( i18n(" "), mw ); 264 //lab = new QLabel ( i18n(" "), mw );
265 //mainLayout->addWidget( lab,0,++ii ); 265 //mainLayout->addWidget( lab,0,++ii );
266 //lab->setFixedWidth( 1 ); 266 //lab->setFixedWidth( 1 );
267 addBut = new QPushButton ( mw ); 267 addBut = new QPushButton ( mw );
268 addBut->setFocusPolicy(NoFocus); 268 addBut->setFocusPolicy(NoFocus);
269 mainLayout->addWidget( addBut,0,++ii ); 269 mainLayout->addWidget( addBut,0,++ii );
270 addBut->setPixmap ( SmallIcon("bell")); 270 addBut->setPixmap ( SmallIcon("bell"));
271 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 271 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
272 addBut->setMaximumWidth( addBut->sizeHint().height() ); 272 addBut->setMaximumWidth( addBut->sizeHint().height() );
273 273
274 addBut = new QPushButton ( mw ); 274 addBut = new QPushButton ( mw );
275 addBut->setFocusPolicy(NoFocus); 275 addBut->setFocusPolicy(NoFocus);
276 mainLayout->addWidget( addBut,0,++ii ); 276 mainLayout->addWidget( addBut,0,++ii );
277 addBut->setPixmap ( SmallIcon("pencil")); 277 addBut->setPixmap ( SmallIcon("pencil"));
278 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 278 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
279 addBut->setMaximumWidth( addBut->sizeHint().height() ); 279 addBut->setMaximumWidth( addBut->sizeHint().height() );
280 lab = new QLabel ( "", mw ); 280 lab = new QLabel ( "", mw );
281 mainLayout->addWidget( lab,0,++ii ); 281 mainLayout->addWidget( lab,0,++ii );
282 282
283 addBut = new QPushButton ( mw ); 283 addBut = new QPushButton ( mw );
284 addBut->setFocusPolicy(NoFocus); 284 addBut->setFocusPolicy(NoFocus);
285 mainLayout->addWidget( addBut,0,++ii ); 285 mainLayout->addWidget( addBut,0,++ii );
286 addBut->setPixmap ( SmallIcon("plus")); 286 addBut->setPixmap ( SmallIcon("plus"));
287 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 287 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
288 288
289 lab = new QLabel ( " ", mw ); 289 lab = new QLabel ( " ", mw );
290 mainLayout->addWidget( lab,0,++ii ); 290 mainLayout->addWidget( lab,0,++ii );
291 291
292 292
293 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 293 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
294 int row = 1; 294 int row = 1;
295 bool errorLoadStandard = false; 295 bool errorLoadStandard = false;
296 while ( kkf ) { 296 while ( kkf ) {
297 int iii = 0; 297 int iii = 0;
298 KOCalRadioButton* rb = new KOCalRadioButton( mw ); 298 KOCalRadioButton* rb = new KOCalRadioButton( mw );
299 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); 299 mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb );
300 rb->setChecked( kkf->isStandard ); 300 rb->setChecked( kkf->isStandard );
301 if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) ) 301 if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) )
302 errorLoadStandard = true; 302 errorLoadStandard = true;
303 rb->setNum( kkf->mCalNumber ); 303 rb->setNum( kkf->mCalNumber );
304 connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) ); 304 connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) );
305 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 305 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
306 rb->setEnabled( false ); 306 rb->setEnabled( false );
307 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 307 KOCalCheckButton* cb = new KOCalCheckButton( mw );
308 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 308 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
309 cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad ); 309 cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad );
310 cb->setNum( kkf->mCalNumber ); 310 cb->setNum( kkf->mCalNumber );
311 if ( kkf->mErrorOnLoad ) 311 if ( kkf->mErrorOnLoad )
312 cb->setEnabled( false ); 312 cb->setEnabled( false );
313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
314 KOCalButton* name = new KOCalButton( mw ); 314 KOCalButton* name = new KOCalButton( mw );
315 name->setNum( kkf->mCalNumber ); 315 name->setNum( kkf->mCalNumber );
316 name->setText( kkf->mName ); 316 name->setText( kkf->mName );
317 mainLayout->addWidget( name,row,++iii ); 317 mainLayout->addWidget( name,row,++iii );
318 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 318 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
319 //lab = new QLabel (" ", mw ); 319 //lab = new QLabel (" ", mw );
320 //mainLayout->addWidget( lab,row,++iii ); 320 //mainLayout->addWidget( lab,row,++iii );
321 cb = new KOCalCheckButton( mw ); 321 cb = new KOCalCheckButton( mw );
322 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 322 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
323 cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); 323 cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad);
324 cb->setNum( kkf->mCalNumber ); 324 cb->setNum( kkf->mCalNumber );
325 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 325 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
326 if ( kkf->mErrorOnLoad ) 326 if ( kkf->mErrorOnLoad )
327 cb->setEnabled( false ); 327 cb->setEnabled( false );
328 cb = new KOCalCheckButton( mw ); 328 cb = new KOCalCheckButton( mw );
329 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 329 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
330 cb->setChecked( kkf->isReadOnly ); 330 cb->setChecked( kkf->isReadOnly );
331 cb->setNum( kkf->mCalNumber ); 331 cb->setNum( kkf->mCalNumber );
332 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 332 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
333 if ( kkf->mErrorOnLoad ) 333 if ( kkf->mErrorOnLoad )
334 cb->setEnabled( false ); 334 cb->setEnabled( false );
335 if ( row > 1) { 335 if ( row > 1) {
336 KColorButton *colb = new KColorButton( mw ); 336 KColorButton *colb = new KColorButton( mw );
337 mainLayout->addWidget( colb,row,++iii ); 337 mainLayout->addWidget( colb,row,++iii );
338 colb->setID( kkf->mCalNumber ); 338 colb->setID( kkf->mCalNumber );
339 colb->setColor( kkf->mDefaultColor ); 339 colb->setColor( kkf->mDefaultColor );
340 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); 340 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
341 KOCalButton* calb = new KOCalButton( mw ); 341 KOCalButton* calb = new KOCalButton( mw );
342 mainLayout->addWidget( calb,row,++iii ); 342 mainLayout->addWidget( calb,row,++iii );
343 calb->setNum( kkf->mCalNumber ); 343 calb->setNum( kkf->mCalNumber );
344 calb->setPixmap ( SmallIcon("minus")); 344 calb->setPixmap ( SmallIcon("minus"));
345 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 345 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
346 int hei = calb->sizeHint().height(); 346 int hei = calb->sizeHint().height();
347 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 347 //calb->setMaximumSize( hei*9/10, hei*9/10 );
348 } 348 }
349 ++row; 349 ++row;
350 kkf = KOPrefs::instance()->mCalendars.next(); 350 kkf = KOPrefs::instance()->mCalendars.next();
351 } 351 }
352 if ( errorLoadStandard ) 352 if ( errorLoadStandard )
353 findNewStandard(); 353 findNewStandard();
354 lab = new QLabel ( "", mw ); 354 lab = new QLabel ( "", mw );
355 mainLayout->addWidget( lab,row,0 ); 355 mainLayout->addWidget( lab,row,0 );
356 mw->show(); 356 mw->show();
357 357
358} 358}
359 359
360void KOCalEditView::defaultInfo() 360void KOCalEditView::defaultInfo()
361{ 361{
362 KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); 362 KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
363} 363}
364void KOCalEditView::addCal() 364void KOCalEditView::addCal()
365{ 365{
366 bool tryagain = true; 366 bool tryagain = true;
367 QString name, file; 367 QString name, file;
368 while ( tryagain ) { 368 while ( tryagain ) {
369 KONewCalPrefs prefs ( this ); 369 KONewCalPrefs prefs ( this );
370 prefs.nameE->setText( name ); 370 prefs.nameE->setText( name );
371 prefs.url->setURL( file ); 371 prefs.url->setURL( file );
372 if ( ! prefs.exec() ) 372 if ( ! prefs.exec() )
373 return; 373 return;
374 name = prefs.calName(); 374 name = prefs.calName();
375 file = prefs.calFileName(); 375 file = prefs.calFileName();
376 tryagain = false; 376 tryagain = false;
377 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 377 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
378 while ( kkf ) { 378 while ( kkf ) {
379 if ( kkf->mName == name ) { 379 if ( kkf->mName == name ) {
380 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); 380 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
381 name = ""; 381 name = "";
382 tryagain = true; 382 tryagain = true;
383 break; 383 break;
384 } 384 }
385 if ( kkf->mFileName == file ) { 385 if ( kkf->mFileName == file ) {
386 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); 386 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
387 tryagain = true; 387 tryagain = true;
388 file = ""; 388 file = "";
389 break; 389 break;
390 } 390 }
391 kkf = KOPrefs::instance()->mCalendars.next(); 391 kkf = KOPrefs::instance()->mCalendars.next();
392 } 392 }
393 } 393 }
394 addCalendar ( name, file ); 394 addCalendar ( name, file );
395 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); 395 QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
396} 396}
397int KOCalEditView::addCalendar( QString name, QString file, bool ask ) 397int KOCalEditView::addCalendar( QString name, QString file, bool ask )
398{ 398{
399 399
400 QFileInfo fi ( file ); 400 QFileInfo fi ( file );
401 if (!fi.exists() ) { 401 if (!fi.exists() ) {
402 if ( ask ) 402 if ( ask )
403 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) 403 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
404 return 0; 404 return 0;
405 QFile fileIn( file ); 405 QFile fileIn( file );
406 if (!fileIn.open( IO_WriteOnly ) ) { 406 if (!fileIn.open( IO_WriteOnly ) ) {
407 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 407 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
408 return 0; 408 return 0;
409 } 409 }
410 QTextStream tsIn( &fileIn ); 410 QTextStream tsIn( &fileIn );
411 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 411 tsIn.setCodec( QTextCodec::codecForName("utf8") );
412 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 412 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
413 fileIn.close(); 413 fileIn.close();
414 } 414 }
415 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 415 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
416 kkf->mName = name; 416 kkf->mName = name;
417 kkf->mFileName = file; 417 kkf->mFileName = file;
418 emit calendarAdded( kkf->mCalNumber ); 418 emit calendarAdded( kkf->mCalNumber );
419 if ( ask ) 419 if ( ask )
420 emit needsUpdate(); 420 emit needsUpdate();
421 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 421 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
422 return kkf->mCalNumber; 422 return kkf->mCalNumber;
423} 423}
424int KOCalEditView::getBirtdayID() 424int KOCalEditView::getBirtdayID()
425{ 425{
426 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 426 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
427 while ( kkf ) { 427 while ( kkf ) {
428 if ( kkf->mName == i18n("Birthdays") ) 428 if ( kkf->mName == i18n("Birthdays") )
429 return kkf->mCalNumber; 429 return kkf->mCalNumber;
430 kkf = KOPrefs::instance()->mCalendars.next(); 430 kkf = KOPrefs::instance()->mCalendars.next();
431 } 431 }
432 QString file = locateLocal( "data", "korganizer/birthdays.ics" ); 432 QString file = locateLocal( "data", "korganizer/birthdays.ics" );
433 return addCalendar( i18n("Birthdays"), file, false ); 433 return addCalendar( i18n("Birthdays"), file, false );
434} 434}
435 435
436void KOCalEditView::enableAll() 436void KOCalEditView::enableAll()
437{ 437{
438 toggleList( mEnabledB ); 438 toggleList( mEnabledB );
439} 439}
440void KOCalEditView::enableAlarm() 440void KOCalEditView::enableAlarm()
441{ 441{
442 toggleList( mAlarmB ); 442 toggleList( mAlarmB );
443} 443}
444void KOCalEditView::disableRO() 444void KOCalEditView::disableRO()
445{ 445{
446 toggleList( mROB, false ); 446 toggleList( mROB, false );
447} 447}
448void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable ) 448void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable )
449{ 449{
450 bool dis = !enable; 450 bool dis = !enable;
451 KOCalCheckButton* it = list.first(); 451 KOCalCheckButton* it = list.first();
452 while ( it ) { 452 while ( it ) {
453 if ( !it->isChecked() == enable && it->isEnabled() ) { 453 if ( !it->isChecked() == enable && it->isEnabled() ) {
454 dis = !dis; 454 dis = !dis;
455 break; 455 break;
456 } 456 }
457 it = list.next(); 457 it = list.next();
458 } 458 }
459 it = list.first(); 459 it = list.first();
460 while ( it ) { 460 while ( it ) {
461 if ( it->isEnabled() ) 461 if ( it->isEnabled() )
462 it->setChecked(dis); 462 it->setChecked(dis);
463 it = list.next(); 463 it = list.next();
464 } 464 }
465} 465}
466void KOCalEditView::deleteAll() 466void KOCalEditView::deleteAll()
467{ 467{
468 qDebug("delteAll"); 468 qDebug("delteAll");
469} 469}