summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp10
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h2
-rw-r--r--korganizer/mainwindow.cpp12
4 files changed, 17 insertions, 8 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 9c10ba6..12af655 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -150,385 +150,386 @@ class KOBeamPrefs : public QDialog
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 beamDialog = new KOBeamPrefs(); 236 beamDialog = new KOBeamPrefs();
237 mDatePickerMode = 0; 237 mDatePickerMode = 0;
238 mCurrentSyncDevice = ""; 238 mCurrentSyncDevice = "";
239 writeLocale(); 239 writeLocale();
240 mViewManager = new KOViewManager( this ); 240 mViewManager = new KOViewManager( this );
241 mDialogManager = new KODialogManager( this ); 241 mDialogManager = new KODialogManager( this );
242 mEventViewerDialog = 0; 242 mEventViewerDialog = 0;
243 mModified = false; 243 mModified = false;
244 mReadOnly = false; 244 mReadOnly = false;
245 mSelectedIncidence = 0; 245 mSelectedIncidence = 0;
246 mCalPrinter = 0; 246 mCalPrinter = 0;
247 mFilters.setAutoDelete(true); 247 mFilters.setAutoDelete(true);
248 248
249 mCalendar->registerObserver( this ); 249 mCalendar->registerObserver( this );
250 // TODO: Make sure that view is updated, when calendar is changed. 250 // TODO: Make sure that view is updated, when calendar is changed.
251 251
252 mStorage = new FileStorage( mCalendar ); 252 mStorage = new FileStorage( mCalendar );
253 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 253 mNavigator = new DateNavigator( this, "datevav", mViewManager );
254 254
255 QBoxLayout *topLayout = (QBoxLayout*)layout(); 255 QBoxLayout *topLayout = (QBoxLayout*)layout();
256#ifndef KORG_NOSPLITTER 256#ifndef KORG_NOSPLITTER
257 // create the main layout frames. 257 // create the main layout frames.
258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
259 topLayout->addWidget(mPanner); 259 topLayout->addWidget(mPanner);
260 260
261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
262 "CalendarView::LeftFrame"); 262 "CalendarView::LeftFrame");
263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
264 264
265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
266 "CalendarView::DateNavigator", QDate::currentDate() ); 266 "CalendarView::DateNavigator", QDate::currentDate() );
267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
269 mTodoList->setNavigator( mNavigator ); 269 mTodoList->setNavigator( mNavigator );
270 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 270 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
271 271
272#ifdef KORG_NORESOURCEVIEW 272#ifdef KORG_NORESOURCEVIEW
273 mResourceView = 0; 273 mResourceView = 0;
274#else 274#else
275 if ( mResourceManager ) { 275 if ( mResourceManager ) {
276 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 276 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
277 mResourceView->updateView(); 277 mResourceView->updateView();
278 connect( mResourceView, SIGNAL( resourcesChanged() ), 278 connect( mResourceView, SIGNAL( resourcesChanged() ),
279 SLOT( updateView() ) ); 279 SLOT( updateView() ) );
280 } else { 280 } else {
281 mResourceView = 0; 281 mResourceView = 0;
282 } 282 }
283#endif 283#endif
284 QWidget *rightBox = new QWidget( mPanner ); 284 QWidget *rightBox = new QWidget( mPanner );
285 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 285 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
286 286
287 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 287 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
288 rightLayout->addWidget( mNavigatorBar ); 288 rightLayout->addWidget( mNavigatorBar );
289 289
290 mRightFrame = new QWidgetStack( rightBox ); 290 mRightFrame = new QWidgetStack( rightBox );
291 rightLayout->addWidget( mRightFrame, 1 ); 291 rightLayout->addWidget( mRightFrame, 1 );
292 292
293 mLeftFrame = mLeftSplitter; 293 mLeftFrame = mLeftSplitter;
294#else 294#else
295 QWidget *mainBox = new QWidget( this ); 295 QWidget *mainBox = new QWidget( this );
296 QWidget *leftFrame = new QWidget( mainBox ); 296 QWidget *leftFrame = new QWidget( mainBox );
297 297
298 QBoxLayout * mainBoxLayout; 298 QBoxLayout * mainBoxLayout;
299 QBoxLayout * leftFrameLayout; 299 QBoxLayout * leftFrameLayout;
300 if ( KOPrefs::instance()->mVerticalScreen ) { 300 if ( KOPrefs::instance()->mVerticalScreen ) {
301 mainBoxLayout = new QVBoxLayout(mainBox); 301 mainBoxLayout = new QVBoxLayout(mainBox);
302 leftFrameLayout = new QHBoxLayout(leftFrame ); 302 leftFrameLayout = new QHBoxLayout(leftFrame );
303 } else { 303 } else {
304 mainBoxLayout = new QHBoxLayout(mainBox); 304 mainBoxLayout = new QHBoxLayout(mainBox);
305 leftFrameLayout = new QVBoxLayout(leftFrame ); 305 leftFrameLayout = new QVBoxLayout(leftFrame );
306 } 306 }
307 topLayout->addWidget( mainBox ); 307 topLayout->addWidget( mainBox );
308 mainBoxLayout->addWidget (leftFrame); 308 mainBoxLayout->addWidget (leftFrame);
309 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 309 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
310 "CalendarView::DateNavigator", QDate::currentDate()); 310 "CalendarView::DateNavigator", QDate::currentDate());
311 // mDateNavigator->blockSignals( true ); 311 // mDateNavigator->blockSignals( true );
312 leftFrameLayout->addWidget( mDateNavigator ); 312 leftFrameLayout->addWidget( mDateNavigator );
313 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 313 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
314 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 314 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
315 mTodoList->setNavigator( mNavigator ); 315 mTodoList->setNavigator( mNavigator );
316 316
317 if ( QApplication::desktop()->width() < 480 ) { 317 if ( QApplication::desktop()->width() < 480 ) {
318 leftFrameLayout->addWidget(mFilterView); 318 leftFrameLayout->addWidget(mFilterView);
319 leftFrameLayout->addWidget(mTodoList, 2 ); 319 leftFrameLayout->addWidget(mTodoList, 2 );
320 320
321 } else { 321 } else {
322 leftFrameLayout->addWidget(mTodoList,2 ); 322 leftFrameLayout->addWidget(mTodoList,2 );
323 leftFrameLayout->addWidget(mFilterView ); 323 leftFrameLayout->addWidget(mFilterView );
324 } 324 }
325 mFilterView->hide(); 325 mFilterView->hide();
326 QWidget *rightBox = new QWidget( mainBox ); 326 QWidget *rightBox = new QWidget( mainBox );
327 mainBoxLayout->addWidget ( rightBox, 10 ); 327 mainBoxLayout->addWidget ( rightBox, 10 );
328 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 328 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
329 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 329 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
330 mRightFrame = new QWidgetStack( rightBox ); 330 mRightFrame = new QWidgetStack( rightBox );
331 rightLayout->addWidget( mNavigatorBar ); 331 rightLayout->addWidget( mNavigatorBar );
332 rightLayout->addWidget( mRightFrame, 10 ); 332 rightLayout->addWidget( mRightFrame, 10 );
333 333
334 mLeftFrame = leftFrame; 334 mLeftFrame = leftFrame;
335 if ( KOPrefs::instance()->mVerticalScreen ) { 335 if ( KOPrefs::instance()->mVerticalScreen ) {
336 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 336 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
337 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 337 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
338 } else { 338 } else {
339 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 339 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
340 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 340 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
341 } 341 }
342 342 if ( !KOPrefs::instance()->mShowDateNavigator)
343 mDateNavigator->hide();
343 //qDebug("Calendarview Size %d %d ", width(), height()); 344 //qDebug("Calendarview Size %d %d ", width(), height());
344#endif 345#endif
345 346
346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 347 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
347 SLOT( showDates( const KCal::DateList & ) ) ); 348 SLOT( showDates( const KCal::DateList & ) ) );
348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 349 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
349 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 350 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
350 351
351 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 352 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
352 mNavigator, SLOT( selectPreviousYear() ) ); 353 mNavigator, SLOT( selectPreviousYear() ) );
353 connect( mNavigatorBar, SIGNAL( goNextYear() ), 354 connect( mNavigatorBar, SIGNAL( goNextYear() ),
354 mNavigator, SLOT( selectNextYear() ) ); 355 mNavigator, SLOT( selectNextYear() ) );
355 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 356 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
356 mNavigator, SLOT( selectPreviousMonth() ) ); 357 mNavigator, SLOT( selectPreviousMonth() ) );
357 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 358 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
358 mNavigator, SLOT( selectNextMonth() ) ); 359 mNavigator, SLOT( selectNextMonth() ) );
359 360
360 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 361 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
361 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 362 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
362 363
363 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 364 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
364 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 365 mNavigator, SLOT( selectWeek( const QDate & ) ) );
365 366
366 connect( mDateNavigator, SIGNAL( goPrevYear() ), 367 connect( mDateNavigator, SIGNAL( goPrevYear() ),
367 mNavigator, SLOT( selectPreviousYear() ) ); 368 mNavigator, SLOT( selectPreviousYear() ) );
368 connect( mDateNavigator, SIGNAL( goNextYear() ), 369 connect( mDateNavigator, SIGNAL( goNextYear() ),
369 mNavigator, SLOT( selectNextYear() ) ); 370 mNavigator, SLOT( selectNextYear() ) );
370 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 371 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
371 mNavigator, SLOT( selectPreviousMonth() ) ); 372 mNavigator, SLOT( selectPreviousMonth() ) );
372 connect( mDateNavigator, SIGNAL( goNextMonth() ), 373 connect( mDateNavigator, SIGNAL( goNextMonth() ),
373 mNavigator, SLOT( selectNextMonth() ) ); 374 mNavigator, SLOT( selectNextMonth() ) );
374 375
375 connect( mDateNavigator, SIGNAL( goPrevious() ), 376 connect( mDateNavigator, SIGNAL( goPrevious() ),
376 mNavigator, SLOT( selectPrevious() ) ); 377 mNavigator, SLOT( selectPrevious() ) );
377 connect( mDateNavigator, SIGNAL( goNext() ), 378 connect( mDateNavigator, SIGNAL( goNext() ),
378 mNavigator, SLOT( selectNext() ) ); 379 mNavigator, SLOT( selectNext() ) );
379 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 380 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
380 mNavigator, SLOT( slotMonthSelect( int ) ) ); 381 mNavigator, SLOT( slotMonthSelect( int ) ) );
381 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 382 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
382 mNavigator, SLOT( slotMonthSelect( int ) ) ); 383 mNavigator, SLOT( slotMonthSelect( int ) ) );
383 384
384 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 385 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
385 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 386 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
386 387
387 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 388 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
388 SLOT( eventAdded( Event *) ) ); 389 SLOT( eventAdded( Event *) ) );
389 390
390 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 391 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
391 392
392 connect( this, SIGNAL( configChanged() ), 393 connect( this, SIGNAL( configChanged() ),
393 mDateNavigator, SLOT( updateConfig() ) ); 394 mDateNavigator, SLOT( updateConfig() ) );
394 395
395 connect( mTodoList, SIGNAL( newTodoSignal() ), 396 connect( mTodoList, SIGNAL( newTodoSignal() ),
396 SLOT( newTodo() ) ); 397 SLOT( newTodo() ) );
397 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 398 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
398 SLOT( newSubTodo( Todo * ) ) ); 399 SLOT( newSubTodo( Todo * ) ) );
399 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 400 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
400 SLOT( editTodo( Todo * ) ) ); 401 SLOT( editTodo( Todo * ) ) );
401 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 402 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
402 SLOT( showTodo( Todo *) ) ); 403 SLOT( showTodo( Todo *) ) );
403 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 404 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
404 SLOT( deleteTodo( Todo *) ) ); 405 SLOT( deleteTodo( Todo *) ) );
405 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 406 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
406 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 407 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
407 SLOT( purgeCompleted() ) ); 408 SLOT( purgeCompleted() ) );
408 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 409 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
409 SIGNAL( todoModified( Todo *, int ) ) ); 410 SIGNAL( todoModified( Todo *, int ) ) );
410 411
411 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 412 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
412 this, SLOT ( cloneIncidence( Incidence * ) ) ); 413 this, SLOT ( cloneIncidence( Incidence * ) ) );
413 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
414 this, SLOT (cancelIncidence( Incidence * ) ) ); 415 this, SLOT (cancelIncidence( Incidence * ) ) );
415 416
416 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 417 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
417 this, SLOT ( moveIncidence( Incidence * ) ) ); 418 this, SLOT ( moveIncidence( Incidence * ) ) );
418 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 419 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
419 this, SLOT ( beamIncidence( Incidence * ) ) ); 420 this, SLOT ( beamIncidence( Incidence * ) ) );
420 421
421 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 422 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
422 this, SLOT ( todo_unsub( Todo * ) ) ); 423 this, SLOT ( todo_unsub( Todo * ) ) );
423 424
424 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 425 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
425 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 426 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
426 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 427 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
427 SLOT( updateTodo( Todo *, int ) ) ); 428 SLOT( updateTodo( Todo *, int ) ) );
428 connect( this, SIGNAL( todoModified( Todo *, int )), this, 429 connect( this, SIGNAL( todoModified( Todo *, int )), this,
429 SLOT( changeTodoDisplay( Todo *, int ) ) ); 430 SLOT( changeTodoDisplay( Todo *, int ) ) );
430 431
431 432
432 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 433 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
433 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 434 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
434 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 435 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
435 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 436 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
436 437
437 438
438 439
439 440
440 441
441 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 442 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
442 SLOT(checkClipboard())); 443 SLOT(checkClipboard()));
443 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 444 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
444 SLOT( processTodoListSelection( Incidence * ) ) ); 445 SLOT( processTodoListSelection( Incidence * ) ) );
445 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 446 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
446 447
447 // kdDebug() << "CalendarView::CalendarView() done" << endl; 448 // kdDebug() << "CalendarView::CalendarView() done" << endl;
448 449
449 mDateFrame = new QVBox(0,0,WType_Popup); 450 mDateFrame = new QVBox(0,0,WType_Popup);
450 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 451 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
451 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 452 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
452 mDateFrame->setLineWidth(3); 453 mDateFrame->setLineWidth(3);
453 mDateFrame->hide(); 454 mDateFrame->hide();
454 mDateFrame->setCaption( i18n( "Pick a date to display")); 455 mDateFrame->setCaption( i18n( "Pick a date to display"));
455 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 456 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
456 457
457 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 458 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
458 459
459 mEventEditor = mDialogManager->getEventEditor(); 460 mEventEditor = mDialogManager->getEventEditor();
460 mTodoEditor = mDialogManager->getTodoEditor(); 461 mTodoEditor = mDialogManager->getTodoEditor();
461 462
462 mFlagEditDescription = false; 463 mFlagEditDescription = false;
463 464
464 mSuspendTimer = new QTimer( this ); 465 mSuspendTimer = new QTimer( this );
465 mAlarmTimer = new QTimer( this ); 466 mAlarmTimer = new QTimer( this );
466 mRecheckAlarmTimer = new QTimer( this ); 467 mRecheckAlarmTimer = new QTimer( this );
467 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 468 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
468 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 469 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
469 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 470 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
470 mAlarmDialog = new AlarmDialog( this ); 471 mAlarmDialog = new AlarmDialog( this );
471 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 472 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
472 mAlarmDialog->setServerNotification( false ); 473 mAlarmDialog->setServerNotification( false );
473 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 474 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
474 475
475 476
476#ifndef DESKTOP_VERSION 477#ifndef DESKTOP_VERSION
477//US listen for arriving address resultsets 478//US listen for arriving address resultsets
478 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 479 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
479 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 480 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
480#endif 481#endif
481 482
482} 483}
483 484
484 485
485CalendarView::~CalendarView() 486CalendarView::~CalendarView()
486{ 487{
487 // kdDebug() << "~CalendarView()" << endl; 488 // kdDebug() << "~CalendarView()" << endl;
488 //qDebug("CalendarView::~CalendarView() "); 489 //qDebug("CalendarView::~CalendarView() ");
489 delete mDialogManager; 490 delete mDialogManager;
490 delete mViewManager; 491 delete mViewManager;
491 delete mStorage; 492 delete mStorage;
492 delete mDateFrame ; 493 delete mDateFrame ;
493 delete beamDialog; 494 delete beamDialog;
494 //kdDebug() << "~CalendarView() done" << endl; 495 //kdDebug() << "~CalendarView() done" << endl;
495} 496}
496 497
497void CalendarView::showDay( QDate d ) 498void CalendarView::showDay( QDate d )
498{ 499{
499 dateNavigator()->selectDate( d ); 500 dateNavigator()->selectDate( d );
500 mViewManager->showWeekView(); 501 mViewManager->showWeekView();
501 dateNavigator()->selectDate( d ); 502 dateNavigator()->selectDate( d );
502} 503}
503void CalendarView::timerAlarm() 504void CalendarView::timerAlarm()
504{ 505{
505 //qDebug("CalendarView::timerAlarm() "); 506 //qDebug("CalendarView::timerAlarm() ");
506 computeAlarm(mAlarmNotification ); 507 computeAlarm(mAlarmNotification );
507} 508}
508 509
509void CalendarView::suspendAlarm() 510void CalendarView::suspendAlarm()
510{ 511{
511 //qDebug(" CalendarView::suspendAlarm() "); 512 //qDebug(" CalendarView::suspendAlarm() ");
512 computeAlarm(mSuspendAlarmNotification ); 513 computeAlarm(mSuspendAlarmNotification );
513 514
514} 515}
515 516
516void CalendarView::startAlarm( QString mess , QString filename) 517void CalendarView::startAlarm( QString mess , QString filename)
517{ 518{
518 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 519 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
519 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 520 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
520 521
521} 522}
522 523
523void CalendarView::checkNextTimerAlarm() 524void CalendarView::checkNextTimerAlarm()
524{ 525{
525 mCalendar->checkAlarmForIncidence( 0, true ); 526 mCalendar->checkAlarmForIncidence( 0, true );
526} 527}
527 528
528void CalendarView::computeAlarm( QString msg ) 529void CalendarView::computeAlarm( QString msg )
529{ 530{
530 531
531 QString mess = msg; 532 QString mess = msg;
532 QString mAlarmMessage = mess.mid( 9 ); 533 QString mAlarmMessage = mess.mid( 9 );
533 QString filename = MainWindow::resourcePath(); 534 QString filename = MainWindow::resourcePath();
534 filename += "koalarm.wav"; 535 filename += "koalarm.wav";
@@ -1979,388 +1980,388 @@ void CalendarView::readFilterSettings(KConfig *config)
1979 filter->setCriteria(config->readNumEntry("Criteria",0)); 1980 filter->setCriteria(config->readNumEntry("Criteria",0));
1980 filter->setCategoryList(config->readListEntry("CategoryList")); 1981 filter->setCategoryList(config->readListEntry("CategoryList"));
1981 mFilters.append(filter); 1982 mFilters.append(filter);
1982 1983
1983 ++it; 1984 ++it;
1984 } 1985 }
1985 1986
1986 if (mFilters.count() == 0) { 1987 if (mFilters.count() == 0) {
1987 CalFilter *filter = new CalFilter(i18n("Default")); 1988 CalFilter *filter = new CalFilter(i18n("Default"));
1988 mFilters.append(filter); 1989 mFilters.append(filter);
1989 } 1990 }
1990 mFilterView->updateFilters(); 1991 mFilterView->updateFilters();
1991 config->setGroup("FilterView"); 1992 config->setGroup("FilterView");
1992 1993
1993 mFilterView->blockSignals(true); 1994 mFilterView->blockSignals(true);
1994 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1995 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1995 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1996 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1996 mFilterView->blockSignals(false); 1997 mFilterView->blockSignals(false);
1997 // We do it manually to avoid it being done twice by the above calls 1998 // We do it manually to avoid it being done twice by the above calls
1998 updateFilter(); 1999 updateFilter();
1999} 2000}
2000 2001
2001void CalendarView::writeFilterSettings(KConfig *config) 2002void CalendarView::writeFilterSettings(KConfig *config)
2002{ 2003{
2003 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 2004 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
2004 2005
2005 QStringList filterList; 2006 QStringList filterList;
2006 2007
2007 CalFilter *filter = mFilters.first(); 2008 CalFilter *filter = mFilters.first();
2008 while(filter) { 2009 while(filter) {
2009 // kdDebug() << " fn: " << filter->name() << endl; 2010 // kdDebug() << " fn: " << filter->name() << endl;
2010 filterList << filter->name(); 2011 filterList << filter->name();
2011 config->setGroup("Filter_" + filter->name()); 2012 config->setGroup("Filter_" + filter->name());
2012 config->writeEntry("Criteria",filter->criteria()); 2013 config->writeEntry("Criteria",filter->criteria());
2013 config->writeEntry("CategoryList",filter->categoryList()); 2014 config->writeEntry("CategoryList",filter->categoryList());
2014 filter = mFilters.next(); 2015 filter = mFilters.next();
2015 } 2016 }
2016 config->setGroup("General"); 2017 config->setGroup("General");
2017 config->writeEntry("CalendarFilters",filterList); 2018 config->writeEntry("CalendarFilters",filterList);
2018 2019
2019 config->setGroup("FilterView"); 2020 config->setGroup("FilterView");
2020 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 2021 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
2021 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 2022 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
2022} 2023}
2023 2024
2024 2025
2025void CalendarView::goToday() 2026void CalendarView::goToday()
2026{ 2027{
2027 if ( mViewManager->currentView()->isMonthView() ) 2028 if ( mViewManager->currentView()->isMonthView() )
2028 mNavigator->selectTodayMonth(); 2029 mNavigator->selectTodayMonth();
2029 else 2030 else
2030 mNavigator->selectToday(); 2031 mNavigator->selectToday();
2031} 2032}
2032 2033
2033void CalendarView::goNext() 2034void CalendarView::goNext()
2034{ 2035{
2035 mNavigator->selectNext(); 2036 mNavigator->selectNext();
2036} 2037}
2037 2038
2038void CalendarView::goPrevious() 2039void CalendarView::goPrevious()
2039{ 2040{
2040 mNavigator->selectPrevious(); 2041 mNavigator->selectPrevious();
2041} 2042}
2042void CalendarView::goNextMonth() 2043void CalendarView::goNextMonth()
2043{ 2044{
2044 mNavigator->selectNextMonth(); 2045 mNavigator->selectNextMonth();
2045} 2046}
2046 2047
2047void CalendarView::goPreviousMonth() 2048void CalendarView::goPreviousMonth()
2048{ 2049{
2049 mNavigator->selectPreviousMonth(); 2050 mNavigator->selectPreviousMonth();
2050} 2051}
2051void CalendarView::writeLocale() 2052void CalendarView::writeLocale()
2052{ 2053{
2053 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2054 //KPimGlobalPrefs::instance()->setGlobalConfig();
2054#if 0 2055#if 0
2055 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2056 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2056 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2057 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2057 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2058 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2058 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2059 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2059 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2060 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2060 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2061 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2061 dummy = KOPrefs::instance()->mUserDateFormatShort; 2062 dummy = KOPrefs::instance()->mUserDateFormatShort;
2062 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2063 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2063 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2064 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2064 KOPrefs::instance()->mDaylightsavingStart, 2065 KOPrefs::instance()->mDaylightsavingStart,
2065 KOPrefs::instance()->mDaylightsavingEnd ); 2066 KOPrefs::instance()->mDaylightsavingEnd );
2066 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2067 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2067#endif 2068#endif
2068} 2069}
2069void CalendarView::updateConfig() 2070void CalendarView::updateConfig()
2070{ 2071{
2071 writeLocale(); 2072 writeLocale();
2072 if ( KOPrefs::instance()->mUseAppColors ) 2073 if ( KOPrefs::instance()->mUseAppColors )
2073 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2074 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2074 emit configChanged(); 2075 emit configChanged();
2075 mTodoList->updateConfig(); 2076 mTodoList->updateConfig();
2076 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2077 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2077 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2078 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2078 // To make the "fill window" configurations work 2079 // To make the "fill window" configurations work
2079 //mViewManager->raiseCurrentView(); 2080 //mViewManager->raiseCurrentView();
2080} 2081}
2081 2082
2082 2083
2083void CalendarView::eventChanged(Event *event) 2084void CalendarView::eventChanged(Event *event)
2084{ 2085{
2085 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2086 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2086 //updateUnmanagedViews(); 2087 //updateUnmanagedViews();
2087} 2088}
2088 2089
2089void CalendarView::eventAdded(Event *event) 2090void CalendarView::eventAdded(Event *event)
2090{ 2091{
2091 changeEventDisplay(event,KOGlobals::EVENTADDED); 2092 changeEventDisplay(event,KOGlobals::EVENTADDED);
2092} 2093}
2093 2094
2094void CalendarView::eventToBeDeleted(Event *) 2095void CalendarView::eventToBeDeleted(Event *)
2095{ 2096{
2096 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2097 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2097} 2098}
2098 2099
2099void CalendarView::eventDeleted() 2100void CalendarView::eventDeleted()
2100{ 2101{
2101 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2102 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2102} 2103}
2103void CalendarView::changeTodoDisplay(Todo *which, int action) 2104void CalendarView::changeTodoDisplay(Todo *which, int action)
2104{ 2105{
2105 changeIncidenceDisplay((Incidence *)which, action); 2106 changeIncidenceDisplay((Incidence *)which, action);
2106 mDateNavigator->updateView(); //LR 2107 mDateNavigator->updateView(); //LR
2107 //mDialogManager->updateSearchDialog(); 2108 //mDialogManager->updateSearchDialog();
2108 2109
2109 if (which) { 2110 if (which) {
2110 mViewManager->updateWNview(); 2111 mViewManager->updateWNview();
2111 //mTodoList->updateView(); 2112 //mTodoList->updateView();
2112 } 2113 }
2113 2114
2114} 2115}
2115 2116
2116void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2117void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2117{ 2118{
2118 updateUnmanagedViews(); 2119 updateUnmanagedViews();
2119 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2120 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2120 if ( action == KOGlobals::EVENTDELETED ) { //delete 2121 if ( action == KOGlobals::EVENTDELETED ) { //delete
2121 mCalendar->checkAlarmForIncidence( 0, true ); 2122 mCalendar->checkAlarmForIncidence( 0, true );
2122 if ( mEventViewerDialog ) 2123 if ( mEventViewerDialog )
2123 mEventViewerDialog->hide(); 2124 mEventViewerDialog->hide();
2124 } 2125 }
2125 else 2126 else
2126 mCalendar->checkAlarmForIncidence( which , false ); 2127 mCalendar->checkAlarmForIncidence( which , false );
2127} 2128}
2128 2129
2129// most of the changeEventDisplays() right now just call the view's 2130// most of the changeEventDisplays() right now just call the view's
2130// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2131// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2131void CalendarView::changeEventDisplay(Event *which, int action) 2132void CalendarView::changeEventDisplay(Event *which, int action)
2132{ 2133{
2133 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2134 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2134 changeIncidenceDisplay((Incidence *)which, action); 2135 changeIncidenceDisplay((Incidence *)which, action);
2135 mDateNavigator->updateView(); 2136 mDateNavigator->updateView();
2136 //mDialogManager->updateSearchDialog(); 2137 //mDialogManager->updateSearchDialog();
2137 2138
2138 if (which) { 2139 if (which) {
2139 // If there is an event view visible update the display 2140 // If there is an event view visible update the display
2140 mViewManager->currentView()->changeEventDisplay(which,action); 2141 mViewManager->currentView()->changeEventDisplay(which,action);
2141 // TODO: check, if update needed 2142 // TODO: check, if update needed
2142 // if (which->getTodoStatus()) { 2143 // if (which->getTodoStatus()) {
2143 mTodoList->updateView(); 2144 mTodoList->updateView();
2144 // } 2145 // }
2145 } else { 2146 } else {
2146 mViewManager->currentView()->updateView(); 2147 mViewManager->currentView()->updateView();
2147 } 2148 }
2148} 2149}
2149 2150
2150 2151
2151void CalendarView::updateTodoViews() 2152void CalendarView::updateTodoViews()
2152{ 2153{
2153 2154
2154 mTodoList->updateView(); 2155 mTodoList->updateView();
2155 mViewManager->currentView()->updateView(); 2156 mViewManager->currentView()->updateView();
2156 2157
2157} 2158}
2158 2159
2159 2160
2160void CalendarView::updateView(const QDate &start, const QDate &end) 2161void CalendarView::updateView(const QDate &start, const QDate &end)
2161{ 2162{
2162 mTodoList->updateView(); 2163 mTodoList->updateView();
2163 mViewManager->updateView(start, end); 2164 mViewManager->updateView(start, end);
2164 //mDateNavigator->updateView(); 2165 //mDateNavigator->updateView();
2165} 2166}
2166 2167
2167void CalendarView::updateView() 2168void CalendarView::updateView()
2168{ 2169{
2169 DateList tmpList = mNavigator->selectedDates(); 2170 DateList tmpList = mNavigator->selectedDates();
2170 2171
2171 // We assume that the navigator only selects consecutive days.
2172 updateView( tmpList.first(), tmpList.last() );
2173 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2172 if ( KOPrefs::instance()->mHideNonStartedTodos )
2174 mTodoList->updateView(); 2173 mTodoList->updateView();
2174 // We assume that the navigator only selects consecutive days.
2175 updateView( tmpList.first(), tmpList.last() );
2175} 2176}
2176 2177
2177void CalendarView::updateUnmanagedViews() 2178void CalendarView::updateUnmanagedViews()
2178{ 2179{
2179 mDateNavigator->updateDayMatrix(); 2180 mDateNavigator->updateDayMatrix();
2180} 2181}
2181 2182
2182int CalendarView::msgItemDelete() 2183int CalendarView::msgItemDelete()
2183{ 2184{
2184 return KMessageBox::warningContinueCancel(this, 2185 return KMessageBox::warningContinueCancel(this,
2185 i18n("This item will be\npermanently deleted."), 2186 i18n("This item will be\npermanently deleted."),
2186 i18n("KO/Pi Confirmation"),i18n("Delete")); 2187 i18n("KO/Pi Confirmation"),i18n("Delete"));
2187} 2188}
2188 2189
2189 2190
2190void CalendarView::edit_cut() 2191void CalendarView::edit_cut()
2191{ 2192{
2192 Event *anEvent=0; 2193 Event *anEvent=0;
2193 2194
2194 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2195 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2195 2196
2196 if (mViewManager->currentView()->isEventView()) { 2197 if (mViewManager->currentView()->isEventView()) {
2197 if ( incidence && incidence->type() == "Event" ) { 2198 if ( incidence && incidence->type() == "Event" ) {
2198 anEvent = static_cast<Event *>(incidence); 2199 anEvent = static_cast<Event *>(incidence);
2199 } 2200 }
2200 } 2201 }
2201 2202
2202 if (!anEvent) { 2203 if (!anEvent) {
2203 KNotifyClient::beep(); 2204 KNotifyClient::beep();
2204 return; 2205 return;
2205 } 2206 }
2206 DndFactory factory( mCalendar ); 2207 DndFactory factory( mCalendar );
2207 factory.cutEvent(anEvent); 2208 factory.cutEvent(anEvent);
2208 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2209 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2209} 2210}
2210 2211
2211void CalendarView::edit_copy() 2212void CalendarView::edit_copy()
2212{ 2213{
2213 Event *anEvent=0; 2214 Event *anEvent=0;
2214 2215
2215 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2216 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2216 2217
2217 if (mViewManager->currentView()->isEventView()) { 2218 if (mViewManager->currentView()->isEventView()) {
2218 if ( incidence && incidence->type() == "Event" ) { 2219 if ( incidence && incidence->type() == "Event" ) {
2219 anEvent = static_cast<Event *>(incidence); 2220 anEvent = static_cast<Event *>(incidence);
2220 } 2221 }
2221 } 2222 }
2222 2223
2223 if (!anEvent) { 2224 if (!anEvent) {
2224 KNotifyClient::beep(); 2225 KNotifyClient::beep();
2225 return; 2226 return;
2226 } 2227 }
2227 DndFactory factory( mCalendar ); 2228 DndFactory factory( mCalendar );
2228 factory.copyEvent(anEvent); 2229 factory.copyEvent(anEvent);
2229} 2230}
2230 2231
2231void CalendarView::edit_paste() 2232void CalendarView::edit_paste()
2232{ 2233{
2233 QDate date = mNavigator->selectedDates().first(); 2234 QDate date = mNavigator->selectedDates().first();
2234 2235
2235 DndFactory factory( mCalendar ); 2236 DndFactory factory( mCalendar );
2236 Event *pastedEvent = factory.pasteEvent( date ); 2237 Event *pastedEvent = factory.pasteEvent( date );
2237 2238
2238 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2239 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2239} 2240}
2240 2241
2241void CalendarView::edit_options() 2242void CalendarView::edit_options()
2242{ 2243{
2243 mDialogManager->showOptionsDialog(); 2244 mDialogManager->showOptionsDialog();
2244 //writeSettings(); 2245 //writeSettings();
2245} 2246}
2246 2247
2247 2248
2248void CalendarView::slotSelectPickerDate( QDate d) 2249void CalendarView::slotSelectPickerDate( QDate d)
2249{ 2250{
2250 mDateFrame->hide(); 2251 mDateFrame->hide();
2251 if ( mDatePickerMode == 1 ) { 2252 if ( mDatePickerMode == 1 ) {
2252 mNavigator->slotDaySelect( d ); 2253 mNavigator->slotDaySelect( d );
2253 } else if ( mDatePickerMode == 2 ) { 2254 } else if ( mDatePickerMode == 2 ) {
2254 if ( mMoveIncidence->type() == "Todo" ) { 2255 if ( mMoveIncidence->type() == "Todo" ) {
2255 Todo * to = (Todo *) mMoveIncidence; 2256 Todo * to = (Todo *) mMoveIncidence;
2256 QTime tim; 2257 QTime tim;
2257 if ( to->hasDueDate() ) 2258 if ( to->hasDueDate() )
2258 tim = to->dtDue().time(); 2259 tim = to->dtDue().time();
2259 else { 2260 else {
2260 tim = QTime ( 0,0,0 ); 2261 tim = QTime ( 0,0,0 );
2261 to->setFloats( true ); 2262 to->setFloats( true );
2262 to->setHasDueDate( true ); 2263 to->setHasDueDate( true );
2263 } 2264 }
2264 QDateTime dt ( d,tim ); 2265 QDateTime dt ( d,tim );
2265 to->setDtDue( dt ); 2266 to->setDtDue( dt );
2266 todoChanged( to ); 2267 todoChanged( to );
2267 } else { 2268 } else {
2268 if ( mMoveIncidence->doesRecur() ) { 2269 if ( mMoveIncidence->doesRecur() ) {
2269#if 0 2270#if 0
2270 // PENDING implement this 2271 // PENDING implement this
2271 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2272 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2272 mCalendar()->addIncidence( newInc ); 2273 mCalendar()->addIncidence( newInc );
2273 if ( mMoveIncidence->type() == "Todo" ) 2274 if ( mMoveIncidence->type() == "Todo" )
2274 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2275 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2275 else 2276 else
2276 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2277 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2277 mMoveIncidence = newInc; 2278 mMoveIncidence = newInc;
2278 2279
2279#endif 2280#endif
2280 } 2281 }
2281 QTime tim = mMoveIncidence->dtStart().time(); 2282 QTime tim = mMoveIncidence->dtStart().time();
2282 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2283 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2283 QDateTime dt ( d,tim ); 2284 QDateTime dt ( d,tim );
2284 mMoveIncidence->setDtStart( dt ); 2285 mMoveIncidence->setDtStart( dt );
2285 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2286 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2286 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2287 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2287 } 2288 }
2288 2289
2289 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2290 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2290 } 2291 }
2291} 2292}
2292 2293
2293void CalendarView::removeCategories() 2294void CalendarView::removeCategories()
2294{ 2295{
2295 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2296 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2296 QStringList catList = KOPrefs::instance()->mCustomCategories; 2297 QStringList catList = KOPrefs::instance()->mCustomCategories;
2297 QStringList catIncList; 2298 QStringList catIncList;
2298 QStringList newCatList; 2299 QStringList newCatList;
2299 Incidence* inc = incList.first(); 2300 Incidence* inc = incList.first();
2300 int i; 2301 int i;
2301 int count = 0; 2302 int count = 0;
2302 while ( inc ) { 2303 while ( inc ) {
2303 newCatList.clear(); 2304 newCatList.clear();
2304 catIncList = inc->categories() ; 2305 catIncList = inc->categories() ;
2305 for( i = 0; i< catIncList.count(); ++i ) { 2306 for( i = 0; i< catIncList.count(); ++i ) {
2306 if ( catList.contains (catIncList[i])) 2307 if ( catList.contains (catIncList[i]))
2307 newCatList.append( catIncList[i] ); 2308 newCatList.append( catIncList[i] );
2308 } 2309 }
2309 newCatList.sort(); 2310 newCatList.sort();
2310 inc->setCategories( newCatList.join(",") ); 2311 inc->setCategories( newCatList.join(",") );
2311 inc = incList.next(); 2312 inc = incList.next();
2312 } 2313 }
2313} 2314}
2314 2315
2315int CalendarView::addCategories() 2316int CalendarView::addCategories()
2316{ 2317{
2317 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2318 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2318 QStringList catList = KOPrefs::instance()->mCustomCategories; 2319 QStringList catList = KOPrefs::instance()->mCustomCategories;
2319 QStringList catIncList; 2320 QStringList catIncList;
2320 Incidence* inc = incList.first(); 2321 Incidence* inc = incList.first();
2321 int i; 2322 int i;
2322 int count = 0; 2323 int count = 0;
2323 while ( inc ) { 2324 while ( inc ) {
2324 catIncList = inc->categories() ; 2325 catIncList = inc->categories() ;
2325 for( i = 0; i< catIncList.count(); ++i ) { 2326 for( i = 0; i< catIncList.count(); ++i ) {
2326 if ( !catList.contains (catIncList[i])) { 2327 if ( !catList.contains (catIncList[i])) {
2327 catList.append( catIncList[i] ); 2328 catList.append( catIncList[i] );
2328 //qDebug("add cat %s ", catIncList[i].latin1()); 2329 //qDebug("add cat %s ", catIncList[i].latin1());
2329 ++count; 2330 ++count;
2330 } 2331 }
2331 } 2332 }
2332 inc = incList.next(); 2333 inc = incList.next();
2333 } 2334 }
2334 catList.sort(); 2335 catList.sort();
2335 KOPrefs::instance()->mCustomCategories = catList; 2336 KOPrefs::instance()->mCustomCategories = catList;
2336 return count; 2337 return count;
2337} 2338}
2338 2339
2339void CalendarView::manageCategories() 2340void CalendarView::manageCategories()
2340{ 2341{
2341 KOCatPrefs* cp = new KOCatPrefs(); 2342 KOCatPrefs* cp = new KOCatPrefs();
2342 cp->show(); 2343 cp->show();
2343 int w =cp->sizeHint().width() ; 2344 int w =cp->sizeHint().width() ;
2344 int h = cp->sizeHint().height() ; 2345 int h = cp->sizeHint().height() ;
2345 int dw = QApplication::desktop()->width(); 2346 int dw = QApplication::desktop()->width();
2346 int dh = QApplication::desktop()->height(); 2347 int dh = QApplication::desktop()->height();
2347 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2348 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2348 if ( !cp->exec() ) { 2349 if ( !cp->exec() ) {
2349 delete cp; 2350 delete cp;
2350 return; 2351 return;
2351 } 2352 }
2352 int count = 0; 2353 int count = 0;
2353 if ( cp->addCat() ) { 2354 if ( cp->addCat() ) {
2354 count = addCategories(); 2355 count = addCategories();
2355 if ( count ) { 2356 if ( count ) {
2356 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2357 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2357 writeSettings(); 2358 writeSettings();
2358 } else 2359 } else
2359 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2360 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2360 } else { 2361 } else {
2361 removeCategories(); 2362 removeCategories();
2362 updateView(); 2363 updateView();
2363 } 2364 }
2364 delete cp; 2365 delete cp;
2365} 2366}
2366 2367
@@ -3420,385 +3421,386 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
3420 } else { 3421 } else {
3421 if ( incidence && incidence->type() == "Todo" ) { 3422 if ( incidence && incidence->type() == "Todo" ) {
3422 emit todoSelected( true ); 3423 emit todoSelected( true );
3423 Todo *event = static_cast<Todo *>( incidence ); 3424 Todo *event = static_cast<Todo *>( incidence );
3424 if ( event->organizer() == KOPrefs::instance()->email() ) { 3425 if ( event->organizer() == KOPrefs::instance()->email() ) {
3425 emit organizerEventsSelected( true ); 3426 emit organizerEventsSelected( true );
3426 } else { 3427 } else {
3427 emit organizerEventsSelected(false); 3428 emit organizerEventsSelected(false);
3428 } 3429 }
3429 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3430 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3430 KOPrefs::instance()->email() ) ) { 3431 KOPrefs::instance()->email() ) ) {
3431 emit groupEventsSelected( true ); 3432 emit groupEventsSelected( true );
3432 } else { 3433 } else {
3433 emit groupEventsSelected(false); 3434 emit groupEventsSelected(false);
3434 } 3435 }
3435 return; 3436 return;
3436 } else { 3437 } else {
3437 emit todoSelected( false ); 3438 emit todoSelected( false );
3438 emit organizerEventsSelected(false); 3439 emit organizerEventsSelected(false);
3439 emit groupEventsSelected(false); 3440 emit groupEventsSelected(false);
3440 } 3441 }
3441 return; 3442 return;
3442 } 3443 }
3443 3444
3444 /* if ( incidence && incidence->type() == "Todo" ) { 3445 /* if ( incidence && incidence->type() == "Todo" ) {
3445 emit todoSelected( true ); 3446 emit todoSelected( true );
3446 } else { 3447 } else {
3447 emit todoSelected( false ); 3448 emit todoSelected( false );
3448 }*/ 3449 }*/
3449} 3450}
3450 3451
3451 3452
3452void CalendarView::checkClipboard() 3453void CalendarView::checkClipboard()
3453{ 3454{
3454#ifndef KORG_NODND 3455#ifndef KORG_NODND
3455 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3456 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3456 emit pasteEnabled(true); 3457 emit pasteEnabled(true);
3457 } else { 3458 } else {
3458 emit pasteEnabled(false); 3459 emit pasteEnabled(false);
3459 } 3460 }
3460#endif 3461#endif
3461} 3462}
3462 3463
3463void CalendarView::showDates(const DateList &selectedDates) 3464void CalendarView::showDates(const DateList &selectedDates)
3464{ 3465{
3465 // kdDebug() << "CalendarView::selectDates()" << endl; 3466 // kdDebug() << "CalendarView::selectDates()" << endl;
3466 3467
3467 if ( mViewManager->currentView() ) { 3468 if ( mViewManager->currentView() ) {
3468 updateView( selectedDates.first(), selectedDates.last() ); 3469 updateView( selectedDates.first(), selectedDates.last() );
3469 } else { 3470 } else {
3470 mViewManager->showAgendaView(); 3471 mViewManager->showAgendaView();
3471 } 3472 }
3472 3473
3473 QString selDates; 3474 QString selDates;
3474 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3475 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3475 if (selectedDates.first() < selectedDates.last() ) 3476 if (selectedDates.first() < selectedDates.last() )
3476 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3477 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3477 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3478 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3478 3479
3479} 3480}
3480 3481
3481QPtrList<CalFilter> CalendarView::filters() 3482QPtrList<CalFilter> CalendarView::filters()
3482{ 3483{
3483 return mFilters; 3484 return mFilters;
3484 3485
3485} 3486}
3486void CalendarView::editFilters() 3487void CalendarView::editFilters()
3487{ 3488{
3488 // kdDebug() << "CalendarView::editFilters()" << endl; 3489 // kdDebug() << "CalendarView::editFilters()" << endl;
3489 3490
3490 CalFilter *filter = mFilters.first(); 3491 CalFilter *filter = mFilters.first();
3491 while(filter) { 3492 while(filter) {
3492 kdDebug() << " Filter: " << filter->name() << endl; 3493 kdDebug() << " Filter: " << filter->name() << endl;
3493 filter = mFilters.next(); 3494 filter = mFilters.next();
3494 } 3495 }
3495 3496
3496 mDialogManager->showFilterEditDialog(&mFilters); 3497 mDialogManager->showFilterEditDialog(&mFilters);
3497} 3498}
3498void CalendarView::toggleFilter() 3499void CalendarView::toggleFilter()
3499{ 3500{
3500 showFilter(! mFilterView->isVisible()); 3501 showFilter(! mFilterView->isVisible());
3501} 3502}
3502 3503
3503KOFilterView *CalendarView::filterView() 3504KOFilterView *CalendarView::filterView()
3504{ 3505{
3505 return mFilterView; 3506 return mFilterView;
3506} 3507}
3507void CalendarView::selectFilter( int fil ) 3508void CalendarView::selectFilter( int fil )
3508{ 3509{
3509 mFilterView->setSelectedFilter( fil ); 3510 mFilterView->setSelectedFilter( fil );
3510} 3511}
3511void CalendarView::showFilter(bool visible) 3512void CalendarView::showFilter(bool visible)
3512{ 3513{
3513 if (visible) mFilterView->show(); 3514 if (visible) mFilterView->show();
3514 else mFilterView->hide(); 3515 else mFilterView->hide();
3515} 3516}
3516void CalendarView::toggleFilerEnabled( ) 3517void CalendarView::toggleFilerEnabled( )
3517{ 3518{
3518 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3519 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3519 if ( !mFilterView->filtersEnabled() ) 3520 if ( !mFilterView->filtersEnabled() )
3520 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3521 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3521 3522
3522} 3523}
3523void CalendarView::updateFilter() 3524void CalendarView::updateFilter()
3524{ 3525{
3525 CalFilter *filter = mFilterView->selectedFilter(); 3526 CalFilter *filter = mFilterView->selectedFilter();
3526 if (filter) { 3527 if (filter) {
3527 if (mFilterView->filtersEnabled()) { 3528 if (mFilterView->filtersEnabled()) {
3528 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3529 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3529 filter->setEnabled(true); 3530 filter->setEnabled(true);
3530 } 3531 }
3531 else filter->setEnabled(false); 3532 else filter->setEnabled(false);
3532 mCalendar->setFilter(filter); 3533 mCalendar->setFilter(filter);
3533 updateView(); 3534 updateView();
3534 } 3535 }
3535} 3536}
3536 3537
3537void CalendarView::filterEdited() 3538void CalendarView::filterEdited()
3538{ 3539{
3539 mFilterView->updateFilters(); 3540 mFilterView->updateFilters();
3540 updateFilter(); 3541 updateFilter();
3541 writeSettings(); 3542 writeSettings();
3542} 3543}
3543 3544
3544 3545
3545void CalendarView::takeOverEvent() 3546void CalendarView::takeOverEvent()
3546{ 3547{
3547 Incidence *incidence = currentSelection(); 3548 Incidence *incidence = currentSelection();
3548 3549
3549 if (!incidence) return; 3550 if (!incidence) return;
3550 3551
3551 incidence->setOrganizer(KOPrefs::instance()->email()); 3552 incidence->setOrganizer(KOPrefs::instance()->email());
3552 incidence->recreate(); 3553 incidence->recreate();
3553 incidence->setReadOnly(false); 3554 incidence->setReadOnly(false);
3554 3555
3555 updateView(); 3556 updateView();
3556} 3557}
3557 3558
3558void CalendarView::takeOverCalendar() 3559void CalendarView::takeOverCalendar()
3559{ 3560{
3560 // TODO: Create Calendar::allIncidences() function and use it here 3561 // TODO: Create Calendar::allIncidences() function and use it here
3561 3562
3562 QPtrList<Event> events = mCalendar->events(); 3563 QPtrList<Event> events = mCalendar->events();
3563 for(uint i=0; i<events.count(); ++i) { 3564 for(uint i=0; i<events.count(); ++i) {
3564 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3565 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3565 events.at(i)->recreate(); 3566 events.at(i)->recreate();
3566 events.at(i)->setReadOnly(false); 3567 events.at(i)->setReadOnly(false);
3567 } 3568 }
3568 3569
3569 QPtrList<Todo> todos = mCalendar->todos(); 3570 QPtrList<Todo> todos = mCalendar->todos();
3570 for(uint i=0; i<todos.count(); ++i) { 3571 for(uint i=0; i<todos.count(); ++i) {
3571 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3572 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3572 todos.at(i)->recreate(); 3573 todos.at(i)->recreate();
3573 todos.at(i)->setReadOnly(false); 3574 todos.at(i)->setReadOnly(false);
3574 } 3575 }
3575 3576
3576 QPtrList<Journal> journals = mCalendar->journals(); 3577 QPtrList<Journal> journals = mCalendar->journals();
3577 for(uint i=0; i<journals.count(); ++i) { 3578 for(uint i=0; i<journals.count(); ++i) {
3578 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3579 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3579 journals.at(i)->recreate(); 3580 journals.at(i)->recreate();
3580 journals.at(i)->setReadOnly(false); 3581 journals.at(i)->setReadOnly(false);
3581 } 3582 }
3582 3583
3583 updateView(); 3584 updateView();
3584} 3585}
3585 3586
3586void CalendarView::showIntro() 3587void CalendarView::showIntro()
3587{ 3588{
3588 kdDebug() << "To be implemented." << endl; 3589 kdDebug() << "To be implemented." << endl;
3589} 3590}
3590 3591
3591QWidgetStack *CalendarView::viewStack() 3592QWidgetStack *CalendarView::viewStack()
3592{ 3593{
3593 return mRightFrame; 3594 return mRightFrame;
3594} 3595}
3595 3596
3596QWidget *CalendarView::leftFrame() 3597QWidget *CalendarView::leftFrame()
3597{ 3598{
3598 return mLeftFrame; 3599 return mLeftFrame;
3599} 3600}
3600 3601
3601DateNavigator *CalendarView::dateNavigator() 3602DateNavigator *CalendarView::dateNavigator()
3602{ 3603{
3603 return mNavigator; 3604 return mNavigator;
3604} 3605}
3605 3606
3606KDateNavigator* CalendarView::dateNavigatorWidget() 3607KDateNavigator* CalendarView::dateNavigatorWidget()
3607{ 3608{
3608 return mDateNavigator; 3609 return mDateNavigator;
3609} 3610}
3610void CalendarView::toggleDateNavigatorWidget() 3611void CalendarView::toggleDateNavigatorWidget()
3611{ 3612{
3612 if (mDateNavigator->isVisible()) 3613 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3614 if (!KOPrefs::instance()->mShowDateNavigator )
3613 mDateNavigator->hide(); 3615 mDateNavigator->hide();
3614 else 3616 else
3615 mDateNavigator->show(); 3617 mDateNavigator->show();
3616} 3618}
3617void CalendarView::addView(KOrg::BaseView *view) 3619void CalendarView::addView(KOrg::BaseView *view)
3618{ 3620{
3619 mViewManager->addView(view); 3621 mViewManager->addView(view);
3620} 3622}
3621 3623
3622void CalendarView::showView(KOrg::BaseView *view) 3624void CalendarView::showView(KOrg::BaseView *view)
3623{ 3625{
3624 mViewManager->showView(view, mLeftFrame->isVisible()); 3626 mViewManager->showView(view, mLeftFrame->isVisible());
3625} 3627}
3626 3628
3627Incidence *CalendarView::currentSelection() 3629Incidence *CalendarView::currentSelection()
3628{ 3630{
3629 return mViewManager->currentSelection(); 3631 return mViewManager->currentSelection();
3630} 3632}
3631void CalendarView::toggleAllDaySize() 3633void CalendarView::toggleAllDaySize()
3632{ 3634{
3633 /* 3635 /*
3634 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3636 if ( KOPrefs::instance()->mAllDaySize > 47 )
3635 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3637 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3636 else 3638 else
3637 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3639 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3638 */ 3640 */
3639 viewManager()->agendaView()->toggleAllDay(); 3641 viewManager()->agendaView()->toggleAllDay();
3640} 3642}
3641void CalendarView::toggleExpand() 3643void CalendarView::toggleExpand()
3642{ 3644{
3643 // if ( mLeftFrame->isHidden() ) { 3645 // if ( mLeftFrame->isHidden() ) {
3644 // mLeftFrame->show(); 3646 // mLeftFrame->show();
3645 // emit calendarViewExpanded( false ); 3647 // emit calendarViewExpanded( false );
3646 // } else { 3648 // } else {
3647 // mLeftFrame->hide(); 3649 // mLeftFrame->hide();
3648 // emit calendarViewExpanded( true ); 3650 // emit calendarViewExpanded( true );
3649 // } 3651 // }
3650 3652
3651 globalFlagBlockAgenda = 1; 3653 globalFlagBlockAgenda = 1;
3652 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3654 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3653 globalFlagBlockAgenda = 5; 3655 globalFlagBlockAgenda = 5;
3654 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3656 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3655 //mViewManager->showView( 0, true ); 3657 //mViewManager->showView( 0, true );
3656} 3658}
3657 3659
3658void CalendarView::calendarModified( bool modified, Calendar * ) 3660void CalendarView::calendarModified( bool modified, Calendar * )
3659{ 3661{
3660 setModified( modified ); 3662 setModified( modified );
3661} 3663}
3662 3664
3663Todo *CalendarView::selectedTodo() 3665Todo *CalendarView::selectedTodo()
3664{ 3666{
3665 Incidence *incidence = currentSelection(); 3667 Incidence *incidence = currentSelection();
3666 if ( incidence && incidence->type() == "Todo" ) { 3668 if ( incidence && incidence->type() == "Todo" ) {
3667 return static_cast<Todo *>( incidence ); 3669 return static_cast<Todo *>( incidence );
3668 } 3670 }
3669 3671
3670 incidence = mTodoList->selectedIncidences().first(); 3672 incidence = mTodoList->selectedIncidences().first();
3671 if ( incidence && incidence->type() == "Todo" ) { 3673 if ( incidence && incidence->type() == "Todo" ) {
3672 return static_cast<Todo *>( incidence ); 3674 return static_cast<Todo *>( incidence );
3673 } 3675 }
3674 3676
3675 return 0; 3677 return 0;
3676} 3678}
3677 3679
3678void CalendarView::dialogClosing(Incidence *in) 3680void CalendarView::dialogClosing(Incidence *in)
3679{ 3681{
3680 // mDialogList.remove(in); 3682 // mDialogList.remove(in);
3681} 3683}
3682 3684
3683void CalendarView::showIncidence() 3685void CalendarView::showIncidence()
3684{ 3686{
3685 Incidence *incidence = currentSelection(); 3687 Incidence *incidence = currentSelection();
3686 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3688 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3687 if ( incidence ) { 3689 if ( incidence ) {
3688 ShowIncidenceVisitor v; 3690 ShowIncidenceVisitor v;
3689 v.act( incidence, this ); 3691 v.act( incidence, this );
3690 } 3692 }
3691} 3693}
3692void CalendarView::editIncidenceDescription() 3694void CalendarView::editIncidenceDescription()
3693{ 3695{
3694 mFlagEditDescription = true; 3696 mFlagEditDescription = true;
3695 editIncidence(); 3697 editIncidence();
3696 mFlagEditDescription = false; 3698 mFlagEditDescription = false;
3697} 3699}
3698void CalendarView::editIncidence() 3700void CalendarView::editIncidence()
3699{ 3701{
3700 // qDebug("editIncidence() "); 3702 // qDebug("editIncidence() ");
3701 Incidence *incidence = currentSelection(); 3703 Incidence *incidence = currentSelection();
3702 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3704 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3703 if ( incidence ) { 3705 if ( incidence ) {
3704 EditIncidenceVisitor v; 3706 EditIncidenceVisitor v;
3705 v.act( incidence, this ); 3707 v.act( incidence, this );
3706 } 3708 }
3707} 3709}
3708 3710
3709void CalendarView::deleteIncidence() 3711void CalendarView::deleteIncidence()
3710{ 3712{
3711 Incidence *incidence = currentSelection(); 3713 Incidence *incidence = currentSelection();
3712 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3714 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3713 if ( incidence ) { 3715 if ( incidence ) {
3714 deleteIncidence(incidence); 3716 deleteIncidence(incidence);
3715 } 3717 }
3716} 3718}
3717 3719
3718void CalendarView::showIncidence(Incidence *incidence) 3720void CalendarView::showIncidence(Incidence *incidence)
3719{ 3721{
3720 if ( incidence ) { 3722 if ( incidence ) {
3721 ShowIncidenceVisitor v; 3723 ShowIncidenceVisitor v;
3722 v.act( incidence, this ); 3724 v.act( incidence, this );
3723 } 3725 }
3724} 3726}
3725 3727
3726void CalendarView::editIncidence(Incidence *incidence) 3728void CalendarView::editIncidence(Incidence *incidence)
3727{ 3729{
3728 if ( incidence ) { 3730 if ( incidence ) {
3729 3731
3730 EditIncidenceVisitor v; 3732 EditIncidenceVisitor v;
3731 v.act( incidence, this ); 3733 v.act( incidence, this );
3732 3734
3733 } 3735 }
3734} 3736}
3735 3737
3736void CalendarView::deleteIncidence(Incidence *incidence) 3738void CalendarView::deleteIncidence(Incidence *incidence)
3737{ 3739{
3738 //qDebug(" CalendarView::deleteIncidence "); 3740 //qDebug(" CalendarView::deleteIncidence ");
3739 if ( incidence ) { 3741 if ( incidence ) {
3740 DeleteIncidenceVisitor v; 3742 DeleteIncidenceVisitor v;
3741 v.act( incidence, this ); 3743 v.act( incidence, this );
3742 } 3744 }
3743} 3745}
3744 3746
3745 3747
3746void CalendarView::lookForOutgoingMessages() 3748void CalendarView::lookForOutgoingMessages()
3747{ 3749{
3748 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3750 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3749 ogd->loadMessages(); 3751 ogd->loadMessages();
3750} 3752}
3751 3753
3752void CalendarView::lookForIncomingMessages() 3754void CalendarView::lookForIncomingMessages()
3753{ 3755{
3754 IncomingDialog *icd = mDialogManager->incomingDialog(); 3756 IncomingDialog *icd = mDialogManager->incomingDialog();
3755 icd->retrieve(); 3757 icd->retrieve();
3756} 3758}
3757 3759
3758bool CalendarView::removeCompletedSubTodos( Todo* t ) 3760bool CalendarView::removeCompletedSubTodos( Todo* t )
3759{ 3761{
3760 bool deleteTodo = true; 3762 bool deleteTodo = true;
3761 QPtrList<Incidence> subTodos; 3763 QPtrList<Incidence> subTodos;
3762 Incidence *aTodo; 3764 Incidence *aTodo;
3763 subTodos = t->relations(); 3765 subTodos = t->relations();
3764 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3766 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3765 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3767 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3766 deleteTodo = false; 3768 deleteTodo = false;
3767 } 3769 }
3768 if ( deleteTodo ) { 3770 if ( deleteTodo ) {
3769 if ( t->isCompleted() ) { 3771 if ( t->isCompleted() ) {
3770 checkExternalId( t ); 3772 checkExternalId( t );
3771 mCalendar->deleteTodo( t ); 3773 mCalendar->deleteTodo( t );
3772 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3774 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3773 } 3775 }
3774 else 3776 else
3775 deleteTodo = false; 3777 deleteTodo = false;
3776 } 3778 }
3777 return deleteTodo; 3779 return deleteTodo;
3778 3780
3779} 3781}
3780void CalendarView::purgeCompleted() 3782void CalendarView::purgeCompleted()
3781{ 3783{
3782 int result = KMessageBox::warningContinueCancel(this, 3784 int result = KMessageBox::warningContinueCancel(this,
3783 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3785 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3784 3786
3785 if (result == KMessageBox::Continue) { 3787 if (result == KMessageBox::Continue) {
3786 3788
3787 QPtrList<Todo> todoCal; 3789 QPtrList<Todo> todoCal;
3788 QPtrList<Todo> rootTodos; 3790 QPtrList<Todo> rootTodos;
3789 //QPtrList<Incidence> rel; 3791 //QPtrList<Incidence> rel;
3790 Todo *aTodo;//, *rTodo; 3792 Todo *aTodo;//, *rTodo;
3791 Incidence *rIncidence; 3793 Incidence *rIncidence;
3792 bool childDelete = false; 3794 bool childDelete = false;
3793 bool deletedOne = true; 3795 bool deletedOne = true;
3794 todoCal = calendar()->todos(); 3796 todoCal = calendar()->todos();
3795 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3797 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3796 if ( !aTodo->relatedTo() ) 3798 if ( !aTodo->relatedTo() )
3797 rootTodos.append( aTodo ); 3799 rootTodos.append( aTodo );
3798 } 3800 }
3799 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3801 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3800 removeCompletedSubTodos( aTodo ); 3802 removeCompletedSubTodos( aTodo );
3801 } 3803 }
3802 3804
3803 updateView(); 3805 updateView();
3804 } 3806 }
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 0a767b6..4b26058 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -25,384 +25,385 @@
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
53 KPimPrefs("korganizerrc") 53 KPimPrefs("korganizerrc")
54{ 54{
55 mCategoryColors.setAutoDelete(true); 55 mCategoryColors.setAutoDelete(true);
56 fillMailDefaults(); 56 fillMailDefaults();
57 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 57 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
58 QColor defaultHolidayColor = QColor(255,0,0); 58 QColor defaultHolidayColor = QColor(255,0,0);
59 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 59 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
60 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 60 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
61 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 61 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
62 QColor defaultTodoDueTodayColor = QColor(255,220,100); 62 QColor defaultTodoDueTodayColor = QColor(255,220,100);
63 QColor defaultTodoOverdueColor = QColor(255,153,125); 63 QColor defaultTodoOverdueColor = QColor(255,153,125);
64 64
65 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 65 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
66 mDefaultViewFont = QFont("helvetica",10); 66 mDefaultViewFont = QFont("helvetica",10);
67 mDefaultMonthViewFont = QFont("helvetica",8); 67 mDefaultMonthViewFont = QFont("helvetica",8);
68 mMarcusBainsFont= QFont("helvetica",10); 68 mMarcusBainsFont= QFont("helvetica",10);
69 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 69 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
70 mEditBoxFont = QFont("helvetica",12); 70 mEditBoxFont = QFont("helvetica",12);
71 mJornalViewFont = QFont("helvetica",12); 71 mJornalViewFont = QFont("helvetica",12);
72 72
73 KPrefs::setCurrentGroup("General"); 73 KPrefs::setCurrentGroup("General");
74 74
75 75
76 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 76 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
77 77
78 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 78 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
79 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 79 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
80 addItemBool("ShowIconSearch",&mShowIconSearch,true); 80 addItemBool("ShowIconSearch",&mShowIconSearch,true);
81 addItemBool("ShowIconList",&mShowIconList,true); 81 addItemBool("ShowIconList",&mShowIconList,true);
82 addItemBool("ShowIconDay1",&mShowIconDay1,true); 82 addItemBool("ShowIconDay1",&mShowIconDay1,true);
83 addItemBool("ShowIconDay5",&mShowIconDay5,true); 83 addItemBool("ShowIconDay5",&mShowIconDay5,true);
84 addItemBool("ShowIconDay7",&mShowIconDay7,true); 84 addItemBool("ShowIconDay7",&mShowIconDay7,true);
85 addItemBool("ShowIconMonth",&mShowIconMonth,true); 85 addItemBool("ShowIconMonth",&mShowIconMonth,true);
86 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 86 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
87 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 87 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
88 addItemBool("ShowIconBack",&mShowIconBack,true); 88 addItemBool("ShowIconBack",&mShowIconBack,true);
89 addItemBool("ShowIconToday",&mShowIconToday,true); 89 addItemBool("ShowIconToday",&mShowIconToday,true);
90 addItemBool("ShowIconForward",&mShowIconForward,true); 90 addItemBool("ShowIconForward",&mShowIconForward,true);
91 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 91 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
92 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 92 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
93 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 93 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
94 addItemBool("ShowIconNext",&mShowIconNext,true); 94 addItemBool("ShowIconNext",&mShowIconNext,true);
95 addItemBool("ShowIconJournal",&mShowIconJournal,true); 95 addItemBool("ShowIconJournal",&mShowIconJournal,true);
96 addItemBool("ShowIconStretch",&mShowIconStretch,true); 96 addItemBool("ShowIconStretch",&mShowIconStretch,true);
97 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 97 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
98 98
99 addItemBool("AskForQuit",&mAskForQuit,false); 99 addItemBool("AskForQuit",&mAskForQuit,false);
100 100
101#ifndef DESKTOP_VERSION 101#ifndef DESKTOP_VERSION
102 addItemBool("ShowFullMenu",&mShowFullMenu,false); 102 addItemBool("ShowFullMenu",&mShowFullMenu,false);
103#else 103#else
104 addItemBool("ShowFullMenu",&mShowFullMenu,true); 104 addItemBool("ShowFullMenu",&mShowFullMenu,true);
105#endif 105#endif
106 addItemBool("ToolBarHor",&mToolBarHor, true ); 106 addItemBool("ToolBarHor",&mToolBarHor, true );
107 addItemBool("ToolBarUp",&mToolBarUp, false ); 107 addItemBool("ToolBarUp",&mToolBarUp, false );
108 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 108 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
109 addItemInt("Whats Next Days",&mWhatsNextDays,3); 109 addItemInt("Whats Next Days",&mWhatsNextDays,3);
110 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 110 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
111 111
112 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 112 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
113 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 113 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
114 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 114 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
115 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 115 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
116 addItemInt("AllDay Size",&mAllDaySize,28); 116 addItemInt("AllDay Size",&mAllDaySize,28);
117 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 117 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
118 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 118 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
119 119
120 addItemStringList("LocationDefaults",&mLocationDefaults ); 120 addItemStringList("LocationDefaults",&mLocationDefaults );
121 addItemStringList("EventSummary User",&mEventSummaryUser); 121 addItemStringList("EventSummary User",&mEventSummaryUser);
122 addItemStringList("TodoSummary User",&mTodoSummaryUser); 122 addItemStringList("TodoSummary User",&mTodoSummaryUser);
123 123
124 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 124 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
125 addItemBool("Enable Project View",&mEnableProjectView,false); 125 addItemBool("Enable Project View",&mEnableProjectView,false);
126 addItemBool("Auto Save",&mAutoSave,false); 126 addItemBool("Auto Save",&mAutoSave,false);
127 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 127 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
128 addItemBool("Confirm Deletes",&mConfirm,true); 128 addItemBool("Confirm Deletes",&mConfirm,true);
129 addItemString("Archive File",&mArchiveFile); 129 addItemString("Archive File",&mArchiveFile);
130 addItemString("Html Export File",&mHtmlExportFile, 130 addItemString("Html Export File",&mHtmlExportFile,
131 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 131 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
132 addItemBool("Html With Save",&mHtmlWithSave,false); 132 addItemBool("Html With Save",&mHtmlWithSave,false);
133 133
134 KPrefs::setCurrentGroup("Personal Settings"); 134 KPrefs::setCurrentGroup("Personal Settings");
135 135
136 addItemInt("Mail Client",&mMailClient,MailClientKMail); 136 addItemInt("Mail Client",&mMailClient,MailClientKMail);
137 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 137 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
138 addItemBool("Bcc",&mBcc,false); 138 addItemBool("Bcc",&mBcc,false);
139 139
140 KPrefs::setCurrentGroup("Time & Date"); 140 KPrefs::setCurrentGroup("Time & Date");
141 141
142 142
143 addItemInt("Default Start Time",&mStartTime,10); 143 addItemInt("Default Start Time",&mStartTime,10);
144 addItemInt("Default Duration",&mDefaultDuration,2); 144 addItemInt("Default Duration",&mDefaultDuration,2);
145 addItemInt("Default Alarm Time",&mAlarmTime,3); 145 addItemInt("Default Alarm Time",&mAlarmTime,3);
146 KPrefs::setCurrentGroup("AlarmSettings"); 146 KPrefs::setCurrentGroup("AlarmSettings");
147 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 147 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
148 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 148 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
149 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 149 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
150 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 150 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
151 151
152 152
153 KPrefs::setCurrentGroup("Calendar"); 153 KPrefs::setCurrentGroup("Calendar");
154 154
155 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 155 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
156 156
157 KPrefs::setCurrentGroup("Fonts"); 157 KPrefs::setCurrentGroup("Fonts");
158 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 158 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
159 addItemFont("TimeBar Font",&mTimeBarFont); 159 addItemFont("TimeBar Font",&mTimeBarFont);
160 addItemFont("MonthView Font",&mMonthViewFont); 160 addItemFont("MonthView Font",&mMonthViewFont);
161 addItemFont("AgendaView Font",&mAgendaViewFont); 161 addItemFont("AgendaView Font",&mAgendaViewFont);
162 addItemFont("MarcusBains Font",&mMarcusBainsFont); 162 addItemFont("MarcusBains Font",&mMarcusBainsFont);
163 addItemFont("TimeLabels Font",&mTimeLabelsFont); 163 addItemFont("TimeLabels Font",&mTimeLabelsFont);
164 addItemFont("TodoView Font",&mTodoViewFont); 164 addItemFont("TodoView Font",&mTodoViewFont);
165 addItemFont("ListView Font",&mListViewFont); 165 addItemFont("ListView Font",&mListViewFont);
166 addItemFont("DateNavigator Font",&mDateNavigatorFont); 166 addItemFont("DateNavigator Font",&mDateNavigatorFont);
167 addItemFont("EditBox Font",&mEditBoxFont); 167 addItemFont("EditBox Font",&mEditBoxFont);
168 addItemFont("JournalView Font",&mJornalViewFont); 168 addItemFont("JournalView Font",&mJornalViewFont);
169 addItemFont("WhatsNextView Font",&mWhatsNextFont); 169 addItemFont("WhatsNextView Font",&mWhatsNextFont);
170 addItemFont("EventView Font",&mEventViewFont); 170 addItemFont("EventView Font",&mEventViewFont);
171 171
172 KPrefs::setCurrentGroup("RemoteSyncing"); 172 KPrefs::setCurrentGroup("RemoteSyncing");
173 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 173 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
174 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 174 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
175 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 175 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
176 addItemInt("LastSyncTime",&mLastSyncTime,0); 176 addItemInt("LastSyncTime",&mLastSyncTime,0);
177 177
178#ifdef _WIN32_ 178#ifdef _WIN32_
179 QString hdp= locateLocal("data","korganizer")+"\\\\"; 179 QString hdp= locateLocal("data","korganizer")+"\\\\";
180#else 180#else
181 QString hdp= locateLocal("data","korganizer")+"/"; 181 QString hdp= locateLocal("data","korganizer")+"/";
182#endif 182#endif
183 183
184 KPrefs::setCurrentGroup("LoadSaveFileNames"); 184 KPrefs::setCurrentGroup("LoadSaveFileNames");
185 185
186 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 186 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
187 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 187 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
188 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 188 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
189 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 189 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
190 190
191 191
192 KPrefs::setCurrentGroup("Locale"); 192 KPrefs::setCurrentGroup("Locale");
193 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 193 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
194 194
195 195
196 KPrefs::setCurrentGroup("Colors"); 196 KPrefs::setCurrentGroup("Colors");
197 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 197 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
198 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 198 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
199 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 199 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
200 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 200 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
201 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 201 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
202 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 202 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
203 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 203 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
204 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 204 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
205 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 205 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
206 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 206 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
207 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 207 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
208 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 208 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
209 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 209 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
210 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 210 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
211 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 211 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
212 addItemBool("UseAppColors",&mUseAppColors,false); 212 addItemBool("UseAppColors",&mUseAppColors,false);
213 213
214 214
215 215
216 KPrefs::setCurrentGroup("Views"); 216 KPrefs::setCurrentGroup("Views");
217 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
217 addItemInt("Hour Size",&mHourSize,8); 218 addItemInt("Hour Size",&mHourSize,8);
218 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 219 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
219 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 220 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
220 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 221 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
221 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 222 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
222 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 223 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
223 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 224 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
224 addItemBool("Enable ToolTips",&mEnableToolTips,false); 225 addItemBool("Enable ToolTips",&mEnableToolTips,false);
225 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 226 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
226 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 227 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
227 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 228 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
228 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 229 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
229 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 230 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
230 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 231 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
231 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 232 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
232 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 233 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
233 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 234 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
234 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 235 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
235 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 236 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
236 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 237 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
237 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 238 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
238 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 239 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
239 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 240 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
240 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 241 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
241 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 242 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
242 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 243 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
243 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 244 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
244#ifdef DESKTOP_VERSION 245#ifdef DESKTOP_VERSION
245 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 246 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
246#else 247#else
247 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 248 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
248#endif 249#endif
249 addItemInt("Day Begins",&mDayBegins,7); 250 addItemInt("Day Begins",&mDayBegins,7);
250 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 251 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
251 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 252 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
252 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 253 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
253 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 254 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
254 255
255 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 256 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
256 addItemBool("Full View Month",&mFullViewMonth,true); 257 addItemBool("Full View Month",&mFullViewMonth,true);
257 addItemBool("Full View Todo",&mFullViewTodo,true); 258 addItemBool("Full View Todo",&mFullViewTodo,true);
258 addItemBool("Quick Todo",&mEnableQuickTodo,false); 259 addItemBool("Quick Todo",&mEnableQuickTodo,false);
259 260
260 addItemInt("Next X Days",&mNextXDays,3); 261 addItemInt("Next X Days",&mNextXDays,3);
261 262
262 KPrefs::setCurrentGroup("Printer"); 263 KPrefs::setCurrentGroup("Printer");
263 264
264 KPrefs::setCurrentGroup("Layout"); 265 KPrefs::setCurrentGroup("Layout");
265 266
266 addItemBool("CompactDialogs",&mCompactDialogs,false); 267 addItemBool("CompactDialogs",&mCompactDialogs,false);
267 addItemBool("VerticalScreen",&mVerticalScreen,true); 268 addItemBool("VerticalScreen",&mVerticalScreen,true);
268 269
269 KPrefs::setCurrentGroup("KOrganizer Plugins"); 270 KPrefs::setCurrentGroup("KOrganizer Plugins");
270 271
271 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 272 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
272 273
273 KPrefs::setCurrentGroup("Group Scheduling"); 274 KPrefs::setCurrentGroup("Group Scheduling");
274 275
275 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 276 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
276 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 277 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
277 addItemStringList("AdditionalMails",&mAdditionalMails,""); 278 addItemStringList("AdditionalMails",&mAdditionalMails,"");
278 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 279 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
279 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 280 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
280 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 281 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
281 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 282 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
282 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 283 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
283 284
284 KPrefs::setCurrentGroup( "Editors" ); 285 KPrefs::setCurrentGroup( "Editors" );
285 286
286 addItemStringList( "EventTemplates", &mEventTemplates ); 287 addItemStringList( "EventTemplates", &mEventTemplates );
287 addItemStringList( "TodoTemplates", &mTodoTemplates ); 288 addItemStringList( "TodoTemplates", &mTodoTemplates );
288 289
289 addItemInt("DestinationPolicy",&mDestination,standardDestination); 290 addItemInt("DestinationPolicy",&mDestination,standardDestination);
290 291
291 292
292 293
293} 294}
294 295
295 296
296KOPrefs::~KOPrefs() 297KOPrefs::~KOPrefs()
297{ 298{
298 if (mInstance == this) 299 if (mInstance == this)
299 mInstance = insd.setObject(0); 300 mInstance = insd.setObject(0);
300 301
301 //qDebug("KOPrefs::~KOPrefs() "); 302 //qDebug("KOPrefs::~KOPrefs() ");
302} 303}
303 304
304 305
305KOPrefs *KOPrefs::instance() 306KOPrefs *KOPrefs::instance()
306{ 307{
307 if (!mInstance) { 308 if (!mInstance) {
308 mInstance = insd.setObject(new KOPrefs()); 309 mInstance = insd.setObject(new KOPrefs());
309 mInstance->readConfig(); 310 mInstance->readConfig();
310 } 311 }
311 312
312 return mInstance; 313 return mInstance;
313} 314}
314 315
315void KOPrefs::usrSetDefaults() 316void KOPrefs::usrSetDefaults()
316{ 317{
317 318
318} 319}
319 320
320void KOPrefs::fillMailDefaults() 321void KOPrefs::fillMailDefaults()
321{ 322{
322 if (mName.isEmpty()) mName = i18n("Anonymous"); 323 if (mName.isEmpty()) mName = i18n("Anonymous");
323 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 324 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
324} 325}
325 326
326void KOPrefs::setTimeZoneIdDefault() 327void KOPrefs::setTimeZoneIdDefault()
327{ 328{
328 ; 329 ;
329} 330}
330 331
331void KOPrefs::setCategoryDefaults() 332void KOPrefs::setCategoryDefaults()
332{ 333{
333 mCustomCategories.clear(); 334 mCustomCategories.clear();
334 mCustomCategories = getDefaultList(); 335 mCustomCategories = getDefaultList();
335 336
336 QStringList::Iterator it; 337 QStringList::Iterator it;
337 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 338 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
338 setCategoryColor(*it,mDefaultCategoryColor); 339 setCategoryColor(*it,mDefaultCategoryColor);
339 } 340 }
340} 341}
341 342
342QStringList KOPrefs::getDefaultList() 343QStringList KOPrefs::getDefaultList()
343{ 344{
344 QStringList retval ; 345 QStringList retval ;
345 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 346 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
346 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 347 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
347 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 348 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
348 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 349 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
349 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 350 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
350 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 351 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
351 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 352 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
352 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 353 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
353 retval.sort(); 354 retval.sort();
354 return retval; 355 return retval;
355} 356}
356 357
357void KOPrefs::usrReadConfig() 358void KOPrefs::usrReadConfig()
358{ 359{
359 config()->setGroup("General"); 360 config()->setGroup("General");
360 361
361 mCustomCategories = config()->readListEntry("Custom Categories"); 362 mCustomCategories = config()->readListEntry("Custom Categories");
362 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { 363 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) {
363 mLocationDefaults.clear(); 364 mLocationDefaults.clear();
364 mEventSummaryUser.clear(); 365 mEventSummaryUser.clear();
365 mTodoSummaryUser.clear(); 366 mTodoSummaryUser.clear();
366 } 367 }
367 mOldLoadedLanguage = mOldLanguage ; 368 mOldLoadedLanguage = mOldLanguage ;
368 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 369 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
369 if (mLocationDefaults.isEmpty()) { 370 if (mLocationDefaults.isEmpty()) {
370 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 371 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
371 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 372 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
372 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 373 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
373 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 374 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
374 mLocationDefaults.sort(); 375 mLocationDefaults.sort();
375 } 376 }
376 377
377 if (mEventSummaryUser.isEmpty()) { 378 if (mEventSummaryUser.isEmpty()) {
378 mEventSummaryUser = getDefaultList() ; 379 mEventSummaryUser = getDefaultList() ;
379 } 380 }
380 if (mTodoSummaryUser.isEmpty()) { 381 if (mTodoSummaryUser.isEmpty()) {
381 mTodoSummaryUser = getDefaultList() ; 382 mTodoSummaryUser = getDefaultList() ;
382 } 383 }
383 384
384 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 385 if (mCustomCategories.isEmpty()) setCategoryDefaults();
385 386
386 config()->setGroup("Personal Settings"); 387 config()->setGroup("Personal Settings");
387 mName = config()->readEntry("user_name",""); 388 mName = config()->readEntry("user_name","");
388 mEmail = config()->readEntry("user_email",""); 389 mEmail = config()->readEntry("user_email","");
389 fillMailDefaults(); 390 fillMailDefaults();
390 391
391 config()->setGroup("Category Colors"); 392 config()->setGroup("Category Colors");
392 QStringList::Iterator it; 393 QStringList::Iterator it;
393 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 394 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
394 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 395 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
395 396
396 } 397 }
397 398
398 KPimPrefs::usrReadConfig(); 399 KPimPrefs::usrReadConfig();
399} 400}
400 401
401 402
402void KOPrefs::usrWriteConfig() 403void KOPrefs::usrWriteConfig()
403{ 404{
404 config()->setGroup("General"); 405 config()->setGroup("General");
405 config()->writeEntry("Custom Categories",mCustomCategories); 406 config()->writeEntry("Custom Categories",mCustomCategories);
406 407
407 config()->setGroup("Personal Settings"); 408 config()->setGroup("Personal Settings");
408 config()->writeEntry("user_name",mName); 409 config()->writeEntry("user_name",mName);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 69722a1..b3acda7 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -56,221 +56,223 @@ class KOPrefs : public KPimPrefs
56 56
57 /** Write preferences to config file */ 57 /** Write preferences to config file */
58 void usrWriteConfig(); 58 void usrWriteConfig();
59 void setCategoryDefaults(); 59 void setCategoryDefaults();
60 60
61 protected: 61 protected:
62 void setTimeZoneIdDefault(); 62 void setTimeZoneIdDefault();
63 63
64 /** Fill empty mail fields with default values. */ 64 /** Fill empty mail fields with default values. */
65 void fillMailDefaults(); 65 void fillMailDefaults();
66 66
67 private: 67 private:
68 /** Constructor disabled for public. Use instance() to create a KOPrefs 68 /** Constructor disabled for public. Use instance() to create a KOPrefs
69 object. */ 69 object. */
70 KOPrefs(); 70 KOPrefs();
71 71
72 static KOPrefs *mInstance; 72 static KOPrefs *mInstance;
73 QStringList getDefaultList(); 73 QStringList getDefaultList();
74 public: 74 public:
75 // preferences data 75 // preferences data
76 KConfig* getConfig(); 76 KConfig* getConfig();
77 void setFullName(const QString &); 77 void setFullName(const QString &);
78 QString fullName(); 78 QString fullName();
79 void setEmail(const QString &); 79 void setEmail(const QString &);
80 QString email(); 80 QString email();
81 81
82 QString mAdditional; 82 QString mAdditional;
83 83
84 bool mEmailControlCenter; 84 bool mEmailControlCenter;
85 85
86 bool mBcc; 86 bool mBcc;
87 bool mAutoSave; 87 bool mAutoSave;
88 int mAutoSaveInterval; 88 int mAutoSaveInterval;
89 bool mConfirm; 89 bool mConfirm;
90 90
91 bool mEnableGroupScheduling; 91 bool mEnableGroupScheduling;
92 bool mEnableProjectView; 92 bool mEnableProjectView;
93 93
94 int mDefaultFormat; 94 int mDefaultFormat;
95 int mMailClient; 95 int mMailClient;
96 96
97 int mStartTime; 97 int mStartTime;
98 int mDefaultDuration; 98 int mDefaultDuration;
99 int mAlarmTime; 99 int mAlarmTime;
100 100
101 int mWorkingHoursStart; 101 int mWorkingHoursStart;
102 int mWorkingHoursEnd; 102 int mWorkingHoursEnd;
103 bool mExcludeHolidays; 103 bool mExcludeHolidays;
104 bool mExcludeSaturdays; 104 bool mExcludeSaturdays;
105 bool mMarcusBainsShowSeconds; 105 bool mMarcusBainsShowSeconds;
106 106
107 QFont mTimeBarFont; 107 QFont mTimeBarFont;
108 QFont mMonthViewFont; 108 QFont mMonthViewFont;
109 QFont mAgendaViewFont; 109 QFont mAgendaViewFont;
110 QFont mMarcusBainsFont; 110 QFont mMarcusBainsFont;
111 QFont mTimeLabelsFont; 111 QFont mTimeLabelsFont;
112 QFont mTodoViewFont; 112 QFont mTodoViewFont;
113 QFont mListViewFont; 113 QFont mListViewFont;
114 QFont mDateNavigatorFont; 114 QFont mDateNavigatorFont;
115 QFont mEditBoxFont; 115 QFont mEditBoxFont;
116 QFont mJornalViewFont; 116 QFont mJornalViewFont;
117 QFont mWhatsNextFont; 117 QFont mWhatsNextFont;
118 QFont mEventViewFont; 118 QFont mEventViewFont;
119 119
120 120
121 121
122 122
123 QColor mHolidayColor; 123 QColor mHolidayColor;
124 QColor mHighlightColor; 124 QColor mHighlightColor;
125 QColor mEventColor; 125 QColor mEventColor;
126 QColor mAgendaBgColor; 126 QColor mAgendaBgColor;
127 QColor mWorkingHoursColor; 127 QColor mWorkingHoursColor;
128 QColor mTodoDueTodayColor; 128 QColor mTodoDueTodayColor;
129 QColor mTodoOverdueColor; 129 QColor mTodoOverdueColor;
130 QColor mMonthViewEvenColor; 130 QColor mMonthViewEvenColor;
131 QColor mMonthViewOddColor; 131 QColor mMonthViewOddColor;
132 QColor mMonthViewHolidayColor; 132 QColor mMonthViewHolidayColor;
133 bool mMonthViewUsesDayColors; 133 bool mMonthViewUsesDayColors;
134 bool mMonthViewSatSunTog; 134 bool mMonthViewSatSunTog;
135 QColor mAppColor1; 135 QColor mAppColor1;
136 QColor mAppColor2; 136 QColor mAppColor2;
137 bool mUseAppColors; 137 bool mUseAppColors;
138 138
139 int mDayBegins; 139 int mDayBegins;
140 int mHourSize; 140 int mHourSize;
141 int mAllDaySize; 141 int mAllDaySize;
142 bool mShowFullMenu; 142 bool mShowFullMenu;
143 bool mDailyRecur; 143 bool mDailyRecur;
144 bool mWeeklyRecur; 144 bool mWeeklyRecur;
145 bool mMonthDailyRecur; 145 bool mMonthDailyRecur;
146 bool mMonthWeeklyRecur; 146 bool mMonthWeeklyRecur;
147 bool mMonthShowIcons; 147 bool mMonthShowIcons;
148 bool mMonthShowShort; 148 bool mMonthShowShort;
149 bool mEnableToolTips; 149 bool mEnableToolTips;
150 bool mEnableMonthScroll; 150 bool mEnableMonthScroll;
151 bool mFullViewMonth; 151 bool mFullViewMonth;
152 bool mMonthViewUsesCategoryColor; 152 bool mMonthViewUsesCategoryColor;
153 bool mFullViewTodo; 153 bool mFullViewTodo;
154 bool mShowCompletedTodo; 154 bool mShowCompletedTodo;
155 bool mMarcusBainsEnabled; 155 bool mMarcusBainsEnabled;
156 int mNextXDays; 156 int mNextXDays;
157 int mWhatsNextDays; 157 int mWhatsNextDays;
158 int mWhatsNextPrios; 158 int mWhatsNextPrios;
159 bool mEnableQuickTodo; 159 bool mEnableQuickTodo;
160 160
161 bool mCompactDialogs; 161 bool mCompactDialogs;
162 bool mVerticalScreen; 162 bool mVerticalScreen;
163 163
164 bool mShowIconNewTodo; 164 bool mShowIconNewTodo;
165 bool mShowIconNewEvent; 165 bool mShowIconNewEvent;
166 bool mShowIconSearch; 166 bool mShowIconSearch;
167 bool mShowIconList; 167 bool mShowIconList;
168 bool mShowIconDay1; 168 bool mShowIconDay1;
169 bool mShowIconDay5; 169 bool mShowIconDay5;
170 bool mShowIconDay7; 170 bool mShowIconDay7;
171 bool mShowIconMonth; 171 bool mShowIconMonth;
172 bool mShowIconTodoview; 172 bool mShowIconTodoview;
173 bool mShowIconBackFast; 173 bool mShowIconBackFast;
174 bool mShowIconBack; 174 bool mShowIconBack;
175 bool mShowIconToday; 175 bool mShowIconToday;
176 bool mShowIconForward; 176 bool mShowIconForward;
177 bool mShowIconForwardFast; 177 bool mShowIconForwardFast;
178 bool mShowIconWhatsThis; 178 bool mShowIconWhatsThis;
179 bool mShowIconNextDays; 179 bool mShowIconNextDays;
180 bool mShowIconNext; 180 bool mShowIconNext;
181 bool mShowIconJournal; 181 bool mShowIconJournal;
182 182
183 bool mShowIconStretch; 183 bool mShowIconStretch;
184 184
185 bool mToolBarHor; 185 bool mToolBarHor;
186 bool mToolBarUp; 186 bool mToolBarUp;
187 bool mToolBarMiniIcons; 187 bool mToolBarMiniIcons;
188 188
189 bool mAskForQuit; 189 bool mAskForQuit;
190 bool mUsePassWd; 190 bool mUsePassWd;
191 bool mShowSyncEvents; 191 bool mShowSyncEvents;
192 bool mShowTodoInAgenda; 192 bool mShowTodoInAgenda;
193 bool mShowTimeInAgenda; 193 bool mShowTimeInAgenda;
194 bool mHideNonStartedTodos; 194 bool mHideNonStartedTodos;
195 195
196 int mLastSyncTime; 196 int mLastSyncTime;
197 void setCategoryColor(QString cat,const QColor & color); 197 void setCategoryColor(QString cat,const QColor & color);
198 QColor *categoryColor(QString cat); 198 QColor *categoryColor(QString cat);
199 199
200 QString mArchiveFile; 200 QString mArchiveFile;
201 QString mHtmlExportFile; 201 QString mHtmlExportFile;
202 bool mHtmlWithSave; 202 bool mHtmlWithSave;
203 203
204 QStringList mSelectedPlugins; 204 QStringList mSelectedPlugins;
205 205
206 QString mLastImportFile; 206 QString mLastImportFile;
207 QString mLastVcalFile; 207 QString mLastVcalFile;
208 QString mLastSaveFile; 208 QString mLastSaveFile;
209 QString mLastLoadFile; 209 QString mLastLoadFile;
210 210
211 211
212 QString mDefaultAlarmFile; 212 QString mDefaultAlarmFile;
213 int mIMIPScheduler; 213 int mIMIPScheduler;
214 int mIMIPSend; 214 int mIMIPSend;
215 QStringList mAdditionalMails; 215 QStringList mAdditionalMails;
216 int mIMIPAutoRefresh; 216 int mIMIPAutoRefresh;
217 int mIMIPAutoInsertReply; 217 int mIMIPAutoInsertReply;
218 int mIMIPAutoInsertRequest; 218 int mIMIPAutoInsertRequest;
219 int mIMIPAutoFreeBusy; 219 int mIMIPAutoFreeBusy;
220 int mIMIPAutoFreeBusyReply; 220 int mIMIPAutoFreeBusyReply;
221 221
222 QStringList mTodoTemplates; 222 QStringList mTodoTemplates;
223 QStringList mEventTemplates; 223 QStringList mEventTemplates;
224 224
225 int mDestination; 225 int mDestination;
226 226
227 227
228 bool mEditOnDoubleClick; 228 bool mEditOnDoubleClick;
229 bool mViewChangeHoldFullscreen; 229 bool mViewChangeHoldFullscreen;
230 bool mViewChangeHoldNonFullscreen; 230 bool mViewChangeHoldNonFullscreen;
231 bool mCenterOnCurrentTime; 231 bool mCenterOnCurrentTime;
232 bool mSetTimeToDayStartAt; 232 bool mSetTimeToDayStartAt;
233 bool mHighlightCurrentDay; 233 bool mHighlightCurrentDay;
234 bool mUseHighlightLightColor; 234 bool mUseHighlightLightColor;
235 bool mListViewMonthTimespan; 235 bool mListViewMonthTimespan;
236 bool mWNViewShowsParents; 236 bool mWNViewShowsParents;
237 bool mWNViewShowsPast; 237 bool mWNViewShowsPast;
238 bool mWNViewShowLocation; 238 bool mWNViewShowLocation;
239 bool mTodoViewShowsPercentage; 239 bool mTodoViewShowsPercentage;
240 bool mTodoViewUsesCatColors; 240 bool mTodoViewUsesCatColors;
241 bool mTodoViewUsesSmallFont; 241 bool mTodoViewUsesSmallFont;
242 bool mTodoViewUsesForegroundColor; 242 bool mTodoViewUsesForegroundColor;
243 bool mMonthViewUsesForegroundColor; 243 bool mMonthViewUsesForegroundColor;
244 244
245 bool mHightlightDateTimeEdit; 245 bool mHightlightDateTimeEdit;
246 bool mShortDateInViewer; 246 bool mShortDateInViewer;
247 247
248 bool mShowDateNavigator;
249
248 QStringList mLocationDefaults; 250 QStringList mLocationDefaults;
249 QStringList mEventSummaryUser; 251 QStringList mEventSummaryUser;
250 QStringList mTodoSummaryUser; 252 QStringList mTodoSummaryUser;
251 253
252 bool mUseInternalAlarmNotification; 254 bool mUseInternalAlarmNotification;
253 int mAlarmPlayBeeps; 255 int mAlarmPlayBeeps;
254 int mAlarmSuspendTime; 256 int mAlarmSuspendTime;
255 int mAlarmSuspendCount; 257 int mAlarmSuspendCount;
256 int mAlarmBeepInterval; 258 int mAlarmBeepInterval;
257 int mOldLanguage; 259 int mOldLanguage;
258 int mOldLoadedLanguage; 260 int mOldLoadedLanguage;
259 261
260 262
261 QString mActiveSyncPort; 263 QString mActiveSyncPort;
262 QString mActiveSyncIP; 264 QString mActiveSyncIP;
263 265
264 private: 266 private:
265 QDict<QColor> mCategoryColors; 267 QDict<QColor> mCategoryColors;
266 QColor mDefaultCategoryColor; 268 QColor mDefaultCategoryColor;
267 269
268 QFont mDefaultTimeBarFont; 270 QFont mDefaultTimeBarFont;
269 QFont mDefaultViewFont; 271 QFont mDefaultViewFont;
270 QFont mDefaultMonthViewFont; 272 QFont mDefaultMonthViewFont;
271 273
272 QString mName; 274 QString mName;
273 QString mEmail; 275 QString mEmail;
274}; 276};
275 277
276#endif 278#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 5ec7ddd..151b55b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1449,412 +1449,416 @@ void MainWindow::save()
1449 1449
1450 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1450 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1451 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1451 qDebug("KO: Needed %d ms for saving.",msNeeded );
1452 QString savemes; 1452 QString savemes;
1453 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1453 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1454 setCaption(savemes); 1454 setCaption(savemes);
1455 } else 1455 } else
1456 setCaption(i18n("Saving cancelled!")); 1456 setCaption(i18n("Saving cancelled!"));
1457 mCalendarModifiedFlag = false; 1457 mCalendarModifiedFlag = false;
1458 mSyncManager->setBlockSave( false ); 1458 mSyncManager->setBlockSave( false );
1459} 1459}
1460 1460
1461void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1461void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1462{ 1462{
1463 if ( !e->isAutoRepeat() ) { 1463 if ( !e->isAutoRepeat() ) {
1464 mFlagKeyPressed = false; 1464 mFlagKeyPressed = false;
1465 } 1465 }
1466} 1466}
1467void MainWindow::keyPressEvent ( QKeyEvent * e ) 1467void MainWindow::keyPressEvent ( QKeyEvent * e )
1468{ 1468{
1469 qApp->processEvents(); 1469 qApp->processEvents();
1470 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1470 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1471 e->ignore(); 1471 e->ignore();
1472 // qDebug(" ignore %d",e->isAutoRepeat() ); 1472 // qDebug(" ignore %d",e->isAutoRepeat() );
1473 return; 1473 return;
1474 } 1474 }
1475 if (! e->isAutoRepeat() ) 1475 if (! e->isAutoRepeat() )
1476 mFlagKeyPressed = true; 1476 mFlagKeyPressed = true;
1477 KOPrefs *p = KOPrefs::instance(); 1477 KOPrefs *p = KOPrefs::instance();
1478 bool showSelectedDates = false; 1478 bool showSelectedDates = false;
1479 int size; 1479 int size;
1480 int pro = 0; 1480 int pro = 0;
1481 //qDebug("MainWindow::keyPressEvent "); 1481 //qDebug("MainWindow::keyPressEvent ");
1482 switch ( e->key() ) { 1482 switch ( e->key() ) {
1483 case Qt::Key_Right: 1483 case Qt::Key_Right:
1484 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1484 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1485 mView->goNextMonth(); 1485 mView->goNextMonth();
1486 else 1486 else
1487 mView->goNext(); 1487 mView->goNext();
1488 showSelectedDates = true; 1488 showSelectedDates = true;
1489 break; 1489 break;
1490 case Qt::Key_Left: 1490 case Qt::Key_Left:
1491 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1491 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1492 mView->goPreviousMonth(); 1492 mView->goPreviousMonth();
1493 else 1493 else
1494 mView->goPrevious(); 1494 mView->goPrevious();
1495 showSelectedDates = true; 1495 showSelectedDates = true;
1496 break; 1496 break;
1497 case Qt::Key_Down: 1497 case Qt::Key_Down:
1498 mView->viewManager()->agendaView()->scrollOneHourDown(); 1498 mView->viewManager()->agendaView()->scrollOneHourDown();
1499 break; 1499 break;
1500 case Qt::Key_Up: 1500 case Qt::Key_Up:
1501 mView->viewManager()->agendaView()->scrollOneHourUp(); 1501 mView->viewManager()->agendaView()->scrollOneHourUp();
1502 break; 1502 break;
1503 case Qt::Key_I: 1503 case Qt::Key_I:
1504 mView->showIncidence(); 1504 mView->showIncidence();
1505 break; 1505 break;
1506 case Qt::Key_Delete: 1506 case Qt::Key_Delete:
1507 case Qt::Key_Backspace: 1507 case Qt::Key_Backspace:
1508 mView->deleteIncidence(); 1508 mView->deleteIncidence();
1509 break; 1509 break;
1510 case Qt::Key_D: 1510 case Qt::Key_D:
1511 mView->viewManager()->showDayView(); 1511 mView->viewManager()->showDayView();
1512 showSelectedDates = true; 1512 showSelectedDates = true;
1513 break; 1513 break;
1514 case Qt::Key_O: 1514 case Qt::Key_O:
1515 mView->toggleFilerEnabled( ); 1515 mView->toggleFilerEnabled( );
1516 break; 1516 break;
1517 case Qt::Key_0: 1517 case Qt::Key_0:
1518 case Qt::Key_1: 1518 case Qt::Key_1:
1519 case Qt::Key_2: 1519 case Qt::Key_2:
1520 case Qt::Key_3: 1520 case Qt::Key_3:
1521 case Qt::Key_4: 1521 case Qt::Key_4:
1522 case Qt::Key_5: 1522 case Qt::Key_5:
1523 case Qt::Key_6: 1523 case Qt::Key_6:
1524 case Qt::Key_7: 1524 case Qt::Key_7:
1525 case Qt::Key_8: 1525 case Qt::Key_8:
1526 case Qt::Key_9: 1526 case Qt::Key_9:
1527 pro = e->key()-48; 1527 pro = e->key()-48;
1528 if ( pro == 0 ) 1528 if ( pro == 0 )
1529 pro = 10; 1529 pro = 10;
1530 if ( e->state() == Qt::ControlButton) 1530 if ( e->state() == Qt::ControlButton)
1531 pro += 10; 1531 pro += 10;
1532 break; 1532 break;
1533 case Qt::Key_M: 1533 case Qt::Key_M:
1534 mView->viewManager()->showMonthView(); 1534 mView->viewManager()->showMonthView();
1535 showSelectedDates = true; 1535 showSelectedDates = true;
1536 break; 1536 break;
1537 case Qt::Key_Insert: 1537 case Qt::Key_Insert:
1538 mView->newEvent(); 1538 mView->newEvent();
1539 break; 1539 break;
1540 case Qt::Key_S : 1540 case Qt::Key_S :
1541 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1541 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1542 mView->newSubTodo(); 1542 mView->newSubTodo();
1543 else 1543 else
1544 mView->dialogManager()->showSearchDialog(); 1544 mView->dialogManager()->showSearchDialog();
1545 break; 1545 break;
1546 case Qt::Key_Y : 1546 case Qt::Key_Y :
1547 case Qt::Key_Z : 1547 case Qt::Key_Z :
1548 mView->viewManager()->showWorkWeekView(); 1548 mView->viewManager()->showWorkWeekView();
1549 showSelectedDates = true; 1549 showSelectedDates = true;
1550 break; 1550 break;
1551 case Qt::Key_U : 1551 case Qt::Key_U :
1552 mView->viewManager()->showWeekView(); 1552 mView->viewManager()->showWeekView();
1553 showSelectedDates = true; 1553 showSelectedDates = true;
1554 break; 1554 break;
1555 case Qt::Key_H : 1555 case Qt::Key_H :
1556 keyBindings(); 1556 keyBindings();
1557 break; 1557 break;
1558 case Qt::Key_W: 1558 case Qt::Key_W:
1559 mView->viewManager()->showWhatsNextView(); 1559 mView->viewManager()->showWhatsNextView();
1560 break; 1560 break;
1561 case Qt::Key_L: 1561 case Qt::Key_L:
1562 mView->viewManager()->showListView(); 1562 mView->viewManager()->showListView();
1563 break; 1563 break;
1564 case Qt::Key_N: 1564 case Qt::Key_N:
1565 mView->viewManager()->showNextXView(); 1565 mView->viewManager()->showNextXView();
1566 showSelectedDates = true; 1566 showSelectedDates = true;
1567 break; 1567 break;
1568 case Qt::Key_V: 1568 case Qt::Key_V:
1569 mView->viewManager()->showTodoView(); 1569 mView->viewManager()->showTodoView();
1570 break; 1570 break;
1571 case Qt::Key_C: 1571 case Qt::Key_C:
1572 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1572 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1573 break; 1573 break;
1574 case Qt::Key_P: 1574 case Qt::Key_P:
1575 mView->showDatePicker( ); 1575 mView->showDatePicker( );
1576 break; 1576 break;
1577 case Qt::Key_F: 1577 case Qt::Key_F:
1578 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1578 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1579 mView->editFilters(); 1579 mView->editFilters();
1580 else 1580 else
1581 mView->toggleFilter(); 1581 mView->toggleFilter();
1582 break; 1582 break;
1583 case Qt::Key_X: 1583 case Qt::Key_X:
1584 mView->toggleDateNavigatorWidget(); 1584 mView->toggleDateNavigatorWidget();
1585 break; 1585 break;
1586 case Qt::Key_Space: 1586 case Qt::Key_Space:
1587 mView->toggleExpand(); 1587 mView->toggleExpand();
1588 break; 1588 break;
1589 case Qt::Key_A: 1589 case Qt::Key_A:
1590 mView->toggleAllDaySize(); 1590 mView->toggleAllDaySize();
1591 break; 1591 break;
1592 case Qt::Key_T: 1592 case Qt::Key_T:
1593 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1593 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1594 mView->newTodo(); 1594 mView->newTodo();
1595 else { 1595 else {
1596 mView->goToday(); 1596 mView->goToday();
1597 showSelectedDates = true; 1597 showSelectedDates = true;
1598 } 1598 }
1599 break; 1599 break;
1600 case Qt::Key_J: 1600 case Qt::Key_J:
1601 mView->viewManager()->showJournalView(); 1601 mView->viewManager()->showJournalView();
1602 break; 1602 break;
1603 case Qt::Key_B: 1603 case Qt::Key_B:
1604 mView->editIncidenceDescription();; 1604 mView->editIncidenceDescription();;
1605 break; 1605 break;
1606 // case Qt::Key_Return: 1606 // case Qt::Key_Return:
1607 case Qt::Key_E: 1607 case Qt::Key_E:
1608 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1608 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1609 mView->newEvent(); 1609 mView->newEvent();
1610 else 1610 else
1611 mView->editIncidence(); 1611 mView->editIncidence();
1612 break; 1612 break;
1613 case Qt::Key_Plus: 1613 case Qt::Key_Plus:
1614 size = p->mHourSize +2; 1614 size = p->mHourSize +2;
1615 if ( size <= 18 ) 1615 if ( size <= 18 )
1616 configureAgenda( size ); 1616 configureAgenda( size );
1617 break; 1617 break;
1618 case Qt::Key_Minus: 1618 case Qt::Key_Minus:
1619 size = p->mHourSize - 2; 1619 size = p->mHourSize - 2;
1620 if ( size >= 4 ) 1620 if ( size >= 4 )
1621 configureAgenda( size ); 1621 configureAgenda( size );
1622 break; 1622 break;
1623 1623
1624 1624
1625 default: 1625 default:
1626 e->ignore(); 1626 e->ignore();
1627 } 1627 }
1628 if ( pro > 0 ) { 1628 if ( pro > 0 ) {
1629 mView->selectFilter( pro-1 ); 1629 mView->selectFilter( pro-1 );
1630 } 1630 }
1631 if ( showSelectedDates ) { 1631 if ( showSelectedDates ) {
1632 ;// setCaptionToDates(); 1632 ;// setCaptionToDates();
1633 } 1633 }
1634 1634
1635} 1635}
1636 1636
1637void MainWindow::fillFilterMenu() 1637void MainWindow::fillFilterMenu()
1638{ 1638{
1639 selectFilterMenu->clear(); 1639 selectFilterMenu->clear();
1640 bool disable = false; 1640 bool disable = false;
1641 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1642 selectFilterMenu->insertSeparator();
1641 if ( mView->filterView()->filtersEnabled() ) { 1643 if ( mView->filterView()->filtersEnabled() ) {
1642 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1644 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1643 } 1645 }
1644 else { 1646 else {
1645 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1647 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1646 disable = true; 1648 disable = true;
1647 } 1649 }
1648 selectFilterMenu->insertSeparator(); 1650 selectFilterMenu->insertSeparator();
1649 QPtrList<CalFilter> fili = mView->filters(); 1651 QPtrList<CalFilter> fili = mView->filters();
1650 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1652 CalFilter *curfilter = mView->filterView()->selectedFilter();
1651 CalFilter *filter = fili.first(); 1653 CalFilter *filter = fili.first();
1652 int iii = 1; 1654 int iii = 2;
1653 while(filter) { 1655 while(filter) {
1654 selectFilterMenu->insertItem( filter->name(), iii ); 1656 selectFilterMenu->insertItem( filter->name(), iii );
1655 if ( filter == curfilter) 1657 if ( filter == curfilter)
1656 selectFilterMenu->setItemChecked( iii, true ); 1658 selectFilterMenu->setItemChecked( iii, true );
1657 if ( disable ) 1659 if ( disable )
1658 selectFilterMenu->setItemEnabled( iii, false ); 1660 selectFilterMenu->setItemEnabled( iii, false );
1659 filter = fili.next(); 1661 filter = fili.next();
1660 ++iii; 1662 ++iii;
1661 } 1663 }
1662} 1664}
1663void MainWindow::selectFilter( int fil ) 1665void MainWindow::selectFilter( int fil )
1664{ 1666{
1665 if ( fil == 0 ) { 1667 if ( fil == 0 ) {
1668 mView->editFilters( );
1669 } else if ( fil == 1 ){
1666 mView->toggleFilerEnabled( ); 1670 mView->toggleFilerEnabled( );
1667 } else { 1671 } else {
1668 mView->selectFilter( fil-1 ); 1672 mView->selectFilter( fil-2 );
1669 } 1673 }
1670} 1674}
1671void MainWindow::configureToolBar( int item ) 1675void MainWindow::configureToolBar( int item )
1672{ 1676{
1673 1677
1674 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1678 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1675 KOPrefs *p = KOPrefs::instance(); 1679 KOPrefs *p = KOPrefs::instance();
1676 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1680 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1677 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1681 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1678 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1682 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1679 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1683 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1680 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1684 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1681 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1685 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1682 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1686 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1683 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1687 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1684 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1688 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1685 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1689 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1686 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1690 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1687 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1691 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1688 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1692 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1689 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1693 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1690 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1694 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1691 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1695 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1692 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1696 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1693 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1697 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1694 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1698 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1695 // initActions(); 1699 // initActions();
1696} 1700}
1697 1701
1698void MainWindow::setCaptionToDates() 1702void MainWindow::setCaptionToDates()
1699{ 1703{
1700 QString selDates; 1704 QString selDates;
1701 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1705 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1702 if (mView->startDate() < mView->endDate() ) 1706 if (mView->startDate() < mView->endDate() )
1703 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1707 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1704 setCaption( i18n("Dates: ") + selDates ); 1708 setCaption( i18n("Dates: ") + selDates );
1705 1709
1706} 1710}
1707// parameter item == 0: reinit 1711// parameter item == 0: reinit
1708void MainWindow::configureAgenda( int item ) 1712void MainWindow::configureAgenda( int item )
1709{ 1713{
1710 1714
1711 KOPrefs *p = KOPrefs::instance(); 1715 KOPrefs *p = KOPrefs::instance();
1712 1716
1713 int i; 1717 int i;
1714 // do not allow 4 for widgets higher than 480 1718 // do not allow 4 for widgets higher than 480
1715 // if ( QApplication::desktop()->height() > 480 ) { 1719 // if ( QApplication::desktop()->height() > 480 ) {
1716// if ( item == 4 ) 1720// if ( item == 4 )
1717// item = 6; 1721// item = 6;
1718// } 1722// }
1719 for ( i = 4; i <= 18; i= i+2 ) 1723 for ( i = 4; i <= 18; i= i+2 )
1720 configureAgendaMenu->setItemChecked( i, false ); 1724 configureAgendaMenu->setItemChecked( i, false );
1721 configureAgendaMenu->setItemChecked( item, true ); 1725 configureAgendaMenu->setItemChecked( item, true );
1722 if ( p->mHourSize == item ) 1726 if ( p->mHourSize == item )
1723 return; 1727 return;
1724 p->mHourSize=item; 1728 p->mHourSize=item;
1725 mView->viewManager()->agendaView()->updateConfig(); 1729 mView->viewManager()->agendaView()->updateConfig();
1726} 1730}
1727 1731
1728void MainWindow::saveCalendar() 1732void MainWindow::saveCalendar()
1729{ 1733{
1730 QString fn = KOPrefs::instance()->mLastSaveFile; 1734 QString fn = KOPrefs::instance()->mLastSaveFile;
1731 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1735 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1732 1736
1733 if ( fn == "" ) 1737 if ( fn == "" )
1734 return; 1738 return;
1735 QFileInfo info; 1739 QFileInfo info;
1736 info.setFile( fn ); 1740 info.setFile( fn );
1737 QString mes; 1741 QString mes;
1738 bool createbup = true; 1742 bool createbup = true;
1739 if ( info. exists() ) { 1743 if ( info. exists() ) {
1740 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1744 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1741 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1745 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1742 i18n("Overwrite!"), i18n("Cancel"), 0, 1746 i18n("Overwrite!"), i18n("Cancel"), 0,
1743 0, 1 ); 1747 0, 1 );
1744 if ( result != 0 ) { 1748 if ( result != 0 ) {
1745 createbup = false; 1749 createbup = false;
1746 } 1750 }
1747 } 1751 }
1748 if ( createbup ) { 1752 if ( createbup ) {
1749 mView->saveCalendar( fn ); 1753 mView->saveCalendar( fn );
1750 mes = i18n("KO/Pi:Saved %1").arg(fn); 1754 mes = i18n("KO/Pi:Saved %1").arg(fn);
1751 KOPrefs::instance()->mLastSaveFile = fn; 1755 KOPrefs::instance()->mLastSaveFile = fn;
1752 setCaption(mes); 1756 setCaption(mes);
1753 } 1757 }
1754} 1758}
1755void MainWindow::loadCalendar() 1759void MainWindow::loadCalendar()
1756{ 1760{
1757 1761
1758 QString fn = KOPrefs::instance()->mLastLoadFile; 1762 QString fn = KOPrefs::instance()->mLastLoadFile;
1759 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1763 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1760 1764
1761 if ( fn == "" ) 1765 if ( fn == "" )
1762 return; 1766 return;
1763 QFileInfo info; 1767 QFileInfo info;
1764 info.setFile( fn ); 1768 info.setFile( fn );
1765 QString mess; 1769 QString mess;
1766 bool loadbup = true; 1770 bool loadbup = true;
1767 if ( info. exists() ) { 1771 if ( info. exists() ) {
1768 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1772 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1769 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1773 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1770 mess, 1774 mess,
1771 i18n("Load!"), i18n("Cancel"), 0, 1775 i18n("Load!"), i18n("Cancel"), 0,
1772 0, 1 ); 1776 0, 1 );
1773 if ( result != 0 ) { 1777 if ( result != 0 ) {
1774 loadbup = false; 1778 loadbup = false;
1775 } 1779 }
1776 } else { 1780 } else {
1777 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1781 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1778 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1782 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1779 0, 1 ); 1783 0, 1 );
1780 1784
1781 return; 1785 return;
1782 } 1786 }
1783 if ( loadbup ) { 1787 if ( loadbup ) {
1784 mView->openCalendar( fn ); 1788 mView->openCalendar( fn );
1785 KOPrefs::instance()->mLastLoadFile = fn; 1789 KOPrefs::instance()->mLastLoadFile = fn;
1786 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1790 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1787 setCaption(mess); 1791 setCaption(mess);
1788 } 1792 }
1789 1793
1790} 1794}
1791void MainWindow::quickImportIcal() 1795void MainWindow::quickImportIcal()
1792{ 1796{
1793 importFile( KOPrefs::instance()->mLastImportFile, false ); 1797 importFile( KOPrefs::instance()->mLastImportFile, false );
1794} 1798}
1795void MainWindow::importFile( QString fn, bool quick ) 1799void MainWindow::importFile( QString fn, bool quick )
1796{ 1800{
1797 QFileInfo info; 1801 QFileInfo info;
1798 info.setFile( fn ); 1802 info.setFile( fn );
1799 QString mess; 1803 QString mess;
1800 bool loadbup = true; 1804 bool loadbup = true;
1801 if ( !info. exists() ) { 1805 if ( !info. exists() ) {
1802 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1806 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1803 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1807 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1804 mess ); 1808 mess );
1805 return; 1809 return;
1806 } 1810 }
1807 int result = 0; 1811 int result = 0;
1808 if ( !quick ) { 1812 if ( !quick ) {
1809 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1813 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1810 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1814 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1811 mess, 1815 mess,
1812 "Import", "Cancel", 0, 1816 "Import", "Cancel", 0,
1813 0, 1 ); 1817 0, 1 );
1814 } 1818 }
1815 if ( result == 0 ) { 1819 if ( result == 0 ) {
1816 if ( mView->openCalendar( fn, true )) { 1820 if ( mView->openCalendar( fn, true )) {
1817 KOPrefs::instance()->mLastImportFile = fn; 1821 KOPrefs::instance()->mLastImportFile = fn;
1818 setCaption(i18n("Imported file successfully")); 1822 setCaption(i18n("Imported file successfully"));
1819 } else { 1823 } else {
1820 setCaption(i18n("Error importing file")); 1824 setCaption(i18n("Error importing file"));
1821 } 1825 }
1822 } 1826 }
1823} 1827}
1824 1828
1825void MainWindow::importIcal() 1829void MainWindow::importIcal()
1826{ 1830{
1827 1831
1828 QString fn =KOPrefs::instance()->mLastImportFile; 1832 QString fn =KOPrefs::instance()->mLastImportFile;
1829 1833
1830 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1834 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1831 if ( fn == "" ) 1835 if ( fn == "" )
1832 return; 1836 return;
1833 importFile( fn, true ); 1837 importFile( fn, true );
1834 1838
1835} 1839}
1836 1840
1837void MainWindow::exportVCalendar() 1841void MainWindow::exportVCalendar()
1838{ 1842{
1839 QString fn = KOPrefs::instance()->mLastVcalFile; 1843 QString fn = KOPrefs::instance()->mLastVcalFile;
1840 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1844 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1841 if ( fn == "" ) 1845 if ( fn == "" )
1842 return; 1846 return;
1843 QFileInfo info; 1847 QFileInfo info;
1844 info.setFile( fn ); 1848 info.setFile( fn );
1845 QString mes; 1849 QString mes;
1846 bool createbup = true; 1850 bool createbup = true;
1847 if ( info. exists() ) { 1851 if ( info. exists() ) {
1848 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1852 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1849 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1853 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1850 i18n("Overwrite!"), i18n("Cancel"), 0, 1854 i18n("Overwrite!"), i18n("Cancel"), 0,
1851 0, 1 ); 1855 0, 1 );
1852 if ( result != 0 ) { 1856 if ( result != 0 ) {
1853 createbup = false; 1857 createbup = false;
1854 } 1858 }
1855 } 1859 }
1856 if ( createbup ) { 1860 if ( createbup ) {
1857 if ( mView->exportVCalendar( fn ) ) { 1861 if ( mView->exportVCalendar( fn ) ) {
1858 KOPrefs::instance()->mLastVcalFile = fn; 1862 KOPrefs::instance()->mLastVcalFile = fn;
1859 if ( fn.length() > 20 ) 1863 if ( fn.length() > 20 )
1860 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1864 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;