summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp76
1 files changed, 56 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3ce123c..ab59d00 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -203,247 +203,251 @@ class KOCatPrefs : public QDialog
203 203
204 bool addCat() { return addCatBut->isChecked(); } 204 bool addCat() { return addCatBut->isChecked(); }
205private: 205private:
206 QRadioButton* addCatBut; 206 QRadioButton* addCatBut;
207}; 207};
208 208
209 209
210 210
211CalendarView::CalendarView( CalendarResources *calendar, 211CalendarView::CalendarView( CalendarResources *calendar,
212 QWidget *parent, const char *name ) 212 QWidget *parent, const char *name )
213 : CalendarViewBase( parent, name ), 213 : CalendarViewBase( parent, name ),
214 mCalendar( calendar ), 214 mCalendar( calendar ),
215 mResourceManager( calendar->resourceManager() ) 215 mResourceManager( calendar->resourceManager() )
216{ 216{
217 217
218 mEventEditor = 0; 218 mEventEditor = 0;
219 mTodoEditor = 0; 219 mTodoEditor = 0;
220 220
221 init(); 221 init();
222} 222}
223 223
224CalendarView::CalendarView( Calendar *calendar, 224CalendarView::CalendarView( Calendar *calendar,
225 QWidget *parent, const char *name ) 225 QWidget *parent, const char *name )
226 : CalendarViewBase( parent, name ), 226 : CalendarViewBase( parent, name ),
227 mCalendar( calendar ), 227 mCalendar( calendar ),
228 mResourceManager( 0 ) 228 mResourceManager( 0 )
229{ 229{
230 230
231 mEventEditor = 0; 231 mEventEditor = 0;
232 mTodoEditor = 0; 232 mTodoEditor = 0;
233 init(); 233 init();
234} 234}
235 235
236void CalendarView::init() 236void CalendarView::init()
237{ 237{
238 238
239 setFocusPolicy ( WheelFocus ); 239 setFocusPolicy ( WheelFocus );
240 mViewerCallerIsSearchDialog = false; 240 mViewerCallerIsSearchDialog = false;
241 mBlockShowDates = false; 241 mBlockShowDates = false;
242 beamDialog = new KOBeamPrefs(); 242 beamDialog = new KOBeamPrefs();
243 mDatePickerMode = 0; 243 mDatePickerMode = 0;
244 mCurrentSyncDevice = ""; 244 mCurrentSyncDevice = "";
245 writeLocale(); 245 writeLocale();
246 mViewManager = new KOViewManager( this ); 246 mViewManager = new KOViewManager( this );
247 mDialogManager = new KODialogManager( this ); 247 mDialogManager = new KODialogManager( this );
248 mEventViewerDialog = 0; 248 mEventViewerDialog = 0;
249 mModified = false; 249 mModified = false;
250 mReadOnly = false; 250 mReadOnly = false;
251 mSelectedIncidence = 0; 251 mSelectedIncidence = 0;
252 mCalPrinter = 0; 252 mCalPrinter = 0;
253 mFilters.setAutoDelete(true); 253 mFilters.setAutoDelete(true);
254 254
255 mCalendar->registerObserver( this ); 255 mCalendar->registerObserver( this );
256 // TODO: Make sure that view is updated, when calendar is changed. 256 // TODO: Make sure that view is updated, when calendar is changed.
257 257
258 mStorage = new FileStorage( mCalendar ); 258 mStorage = new FileStorage( mCalendar );
259 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 259 mNavigator = new DateNavigator( this, "datevav", mViewManager );
260 260
261 QBoxLayout *topLayout = (QBoxLayout*)layout(); 261 QBoxLayout *topLayout = (QBoxLayout*)layout();
262#ifndef KORG_NOSPLITTER 262#ifndef KORG_NOSPLITTER
263 // create the main layout frames. 263 // create the main layout frames.
264 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 264 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
265 topLayout->addWidget(mPanner); 265 topLayout->addWidget(mPanner);
266 266
267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
268 "CalendarView::LeftFrame"); 268 "CalendarView::LeftFrame");
269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
270 270
271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
272 "CalendarView::DateNavigator" ); 272 "CalendarView::DateNavigator" );
273 273
274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
276 mTodoList->setNavigator( mNavigator ); 276 mTodoList->setNavigator( mNavigator );
277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
278 278
279#ifdef KORG_NORESOURCEVIEW 279#ifdef KORG_NORESOURCEVIEW
280 mResourceView = 0; 280 mResourceView = 0;
281#else 281#else
282 if ( mResourceManager ) { 282 if ( mResourceManager ) {
283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
284 mResourceView->updateView(); 284 mResourceView->updateView();
285 connect( mResourceView, SIGNAL( resourcesChanged() ), 285 connect( mResourceView, SIGNAL( resourcesChanged() ),
286 SLOT( updateView() ) ); 286 SLOT( updateView() ) );
287 } else { 287 } else {
288 mResourceView = 0; 288 mResourceView = 0;
289 } 289 }
290#endif 290#endif
291 QWidget *rightBox = new QWidget( mPanner ); 291 QWidget *rightBox = new QWidget( mPanner );
292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
293 293
294 mRightFrame = new QWidgetStack( rightBox ); 294 mRightFrame = new QWidgetStack( rightBox );
295 rightLayout->addWidget( mRightFrame, 1 ); 295 rightLayout->addWidget( mRightFrame, 1 );
296 296
297 mLeftFrame = mLeftSplitter; 297 mLeftFrame = mLeftSplitter;
298#else 298#else
299 QWidget *mainBox = new QWidget( this ); 299 //QWidget *mainBox = new QWidget( this );
300 //QWidget *leftFrame = new QWidget( mainBox ); 300 //QWidget *leftFrame = new QWidget( mainBox );
301 QBoxLayout * mainBoxLayout; 301 //QBoxLayout * mainBoxLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 302 if ( KOPrefs::instance()->mVerticalScreen ) {
303 mainBoxLayout = new QVBoxLayout(mainBox); 303 //mainBoxLayout = new QVBoxLayout(mainBox);
304 //leftFrameLayout = new QHBoxLayout(leftFrame ); 304 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);; 305 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
306 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); 306 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
307 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
308 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
307 } else { 309 } else {
308 mainBoxLayout = new QHBoxLayout(mainBox); 310 //mainBoxLayout = new QHBoxLayout(mainBox);
309 //leftFrameLayout = new QVBoxLayout(leftFrame ); 311 //leftFrameLayout = new QVBoxLayout(leftFrame );
310 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);; 312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
311 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
312 } 316 }
313 //QBoxLayout * leftFrameLayout; 317 //QBoxLayout * leftFrameLayout;
314 topLayout->addWidget( mainBox ); 318 topLayout->addWidget( mMainFrame );
315 mainBoxLayout->addWidget (mLeftFrame); 319 //mainBoxLayout->addWidget (mLeftFrame);
316 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 320 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
317 "CalendarView::DateNavigator" ); 321 "CalendarView::DateNavigator" );
318#if 0 322#if 0
319 // FIXME 323 // FIXME
320 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 324 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
321 "CalendarView::DateNavigator", QDate::currentDate()); 325 "CalendarView::DateNavigator", QDate::currentDate());
322#endif 326#endif
323 // mDateNavigator->blockSignals( true ); 327 // mDateNavigator->blockSignals( true );
324 //leftFrameLayout->addWidget( mDateNavigator ); 328 //leftFrameLayout->addWidget( mDateNavigator );
325 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 329 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
326 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 330 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
327 mTodoList->setNavigator( mNavigator ); 331 mTodoList->setNavigator( mNavigator );
328#if 0 332#if 0
329 if ( QApplication::desktop()->width() < 480 ) { 333 if ( QApplication::desktop()->width() < 480 ) {
330 leftFrameLayout->addWidget(mFilterView); 334 leftFrameLayout->addWidget(mFilterView);
331 leftFrameLayout->addWidget(mTodoList, 2 ); 335 leftFrameLayout->addWidget(mTodoList, 2 );
332 336
333 } else { 337 } else {
334 leftFrameLayout->addWidget(mTodoList,2 ); 338 leftFrameLayout->addWidget(mTodoList,2 );
335 leftFrameLayout->addWidget(mFilterView ); 339 leftFrameLayout->addWidget(mFilterView );
336 } 340 }
337#endif 341#endif
338 mFilterView->hide(); 342 mFilterView->hide();
339 QWidget *rightBox = new QWidget( mainBox ); 343 QWidget *rightBox = new QWidget( mMainFrame );
340 mainBoxLayout->addWidget ( rightBox, 10 ); 344 //mainBoxLayout->addWidget ( rightBox, 10 );
341 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 345 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
342 mRightFrame = new QWidgetStack( rightBox ); 346 mRightFrame = new QWidgetStack( rightBox );
343 rightLayout->addWidget( mRightFrame, 10 ); 347 rightLayout->addWidget( mRightFrame, 10 );
344 348
345 //mLeftFrame = (QWidget *)leftFrame; 349 //mLeftFrame = (QWidget *)leftFrame;
346 if ( KOPrefs::instance()->mVerticalScreen ) { 350 if ( KOPrefs::instance()->mVerticalScreen ) {
347 mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); 351 //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
348 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); 352 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
349 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 353 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
350 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 354 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
351 } else { 355 } else {
352 mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); 356 //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
353 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 357 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
354 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 358 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
355 } 359 }
356 if ( !KOPrefs::instance()->mShowDateNavigator) 360 if ( !KOPrefs::instance()->mShowDateNavigator)
357 mDateNavigator->hide(); 361 mDateNavigator->hide();
358 //qDebug("Calendarview Size %d %d ", width(), height()); 362 //qDebug("Calendarview Size %d %d ", width(), height());
359#endif 363#endif
360 364
361 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 365 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
362 SLOT( showDates( const KCal::DateList & ) ) ); 366 SLOT( showDates( const KCal::DateList & ) ) );
363 367
364 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 368 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
365 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 369 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
366 370
367 371
368 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 372 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
369 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 373 mNavigator, SLOT( selectWeek( const QDate & ) ) );
370 374
371 connect( mDateNavigator, SIGNAL( goPrevYear() ), 375 connect( mDateNavigator, SIGNAL( goPrevYear() ),
372 mNavigator, SLOT( selectPreviousYear() ) ); 376 mNavigator, SLOT( selectPreviousYear() ) );
373 connect( mDateNavigator, SIGNAL( goNextYear() ), 377 connect( mDateNavigator, SIGNAL( goNextYear() ),
374 mNavigator, SLOT( selectNextYear() ) ); 378 mNavigator, SLOT( selectNextYear() ) );
375 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 379 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
376 mNavigator, SLOT( selectPreviousMonth() ) ); 380 mNavigator, SLOT( selectPreviousMonth() ) );
377 connect( mDateNavigator, SIGNAL( goNextMonth() ), 381 connect( mDateNavigator, SIGNAL( goNextMonth() ),
378 mNavigator, SLOT( selectNextMonth() ) ); 382 mNavigator, SLOT( selectNextMonth() ) );
379 383
380 connect( mDateNavigator, SIGNAL( goPrevious() ), 384 connect( mDateNavigator, SIGNAL( goPrevious() ),
381 mNavigator, SLOT( selectPrevious() ) ); 385 mNavigator, SLOT( selectPrevious() ) );
382 connect( mDateNavigator, SIGNAL( goNext() ), 386 connect( mDateNavigator, SIGNAL( goNext() ),
383 mNavigator, SLOT( selectNext() ) ); 387 mNavigator, SLOT( selectNext() ) );
384 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 388 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
385 mNavigator, SLOT( slotMonthSelect( int ) ) ); 389 mNavigator, SLOT( slotMonthSelect( int ) ) );
386 390
387 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 391 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
388 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 392 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
389#if 0 393#if 0
390 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), 394 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
391 SLOT( incidenceAdded( Incidence *) ) ); 395 SLOT( incidenceAdded( Incidence *) ) );
392#endif 396#endif
393 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 397 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
394 398
395 connect( this, SIGNAL( configChanged() ), 399 connect( this, SIGNAL( configChanged() ),
396 mDateNavigator, SLOT( updateConfig() ) ); 400 mDateNavigator, SLOT( updateConfig() ) );
397 401
398 connect( mTodoList, SIGNAL( newTodoSignal() ), 402 connect( mTodoList, SIGNAL( newTodoSignal() ),
399 SLOT( newTodo() ) ); 403 SLOT( newTodo() ) );
400 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 404 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
401 SLOT( newSubTodo( Todo * ) ) ); 405 SLOT( newSubTodo( Todo * ) ) );
402 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 406 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
403 SLOT( editTodo( Todo * ) ) ); 407 SLOT( editTodo( Todo * ) ) );
404 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 408 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
405 SLOT( showTodo( Todo *) ) ); 409 SLOT( showTodo( Todo *) ) );
406 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 410 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
407 SLOT( deleteTodo( Todo *) ) ); 411 SLOT( deleteTodo( Todo *) ) );
408 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 412 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
409 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 413 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
410 SLOT( purgeCompleted() ) ); 414 SLOT( purgeCompleted() ) );
411 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 415 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
412 SIGNAL( todoModified( Todo *, int ) ) ); 416 SIGNAL( todoModified( Todo *, int ) ) );
413 417
414 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 418 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
415 this, SLOT ( cloneIncidence( Incidence * ) ) ); 419 this, SLOT ( cloneIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 420 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
417 this, SLOT (cancelIncidence( Incidence * ) ) ); 421 this, SLOT (cancelIncidence( Incidence * ) ) );
418 422
419 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 423 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
420 this, SLOT ( moveIncidence( Incidence * ) ) ); 424 this, SLOT ( moveIncidence( Incidence * ) ) );
421 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 425 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
422 this, SLOT ( beamIncidence( Incidence * ) ) ); 426 this, SLOT ( beamIncidence( Incidence * ) ) );
423 427
424 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 428 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
425 this, SLOT ( todo_unsub( Todo * ) ) ); 429 this, SLOT ( todo_unsub( Todo * ) ) );
426 430
427 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 431 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
428 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 432 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
429 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 433 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
430 SLOT( updateTodo( Todo *, int ) ) ); 434 SLOT( updateTodo( Todo *, int ) ) );
431 connect( this, SIGNAL( todoModified( Todo *, int )), this, 435 connect( this, SIGNAL( todoModified( Todo *, int )), this,
432 SLOT( changeTodoDisplay( Todo *, int ) ) ); 436 SLOT( changeTodoDisplay( Todo *, int ) ) );
433 437
434 438
435 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 439 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
436 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 440 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
437 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 441 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
438 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 442 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
439 443
440 444
441 445
442 446
443 447
444 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 448 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
445 SLOT(checkClipboard())); 449 SLOT(checkClipboard()));
446 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 450 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
447 SLOT( processTodoListSelection( Incidence * ) ) ); 451 SLOT( processTodoListSelection( Incidence * ) ) );
448 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 452 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
449 453
@@ -1742,286 +1746,318 @@ bool CalendarView::checkFileVersion(QString fn)
1742 mSyncManager->mShowSyncSummary = false; 1746 mSyncManager->mShowSyncSummary = false;
1743 syncCalendar( fn, 3 ); 1747 syncCalendar( fn, 3 );
1744 Event * e = getLastSyncEvent(); 1748 Event * e = getLastSyncEvent();
1745 mCalendar->deleteEvent ( e ); 1749 mCalendar->deleteEvent ( e );
1746 updateView(); 1750 updateView();
1747 return true; 1751 return true;
1748} 1752}
1749 1753
1750bool CalendarView::saveCalendar( QString filename ) 1754bool CalendarView::saveCalendar( QString filename )
1751{ 1755{
1752 1756
1753 // Store back all unsaved data into calendar object 1757 // Store back all unsaved data into calendar object
1754 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1758 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1755 if ( mViewManager->currentView() ) 1759 if ( mViewManager->currentView() )
1756 mViewManager->currentView()->flushView(); 1760 mViewManager->currentView()->flushView();
1757 1761
1758 1762
1759 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1763 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1760 mStorage->setSaveFormat( new ICalFormat() ); 1764 mStorage->setSaveFormat( new ICalFormat() );
1761 mStorage->setFileName( filename ); 1765 mStorage->setFileName( filename );
1762 bool success; 1766 bool success;
1763 success = mStorage->save(); 1767 success = mStorage->save();
1764 if ( !success ) { 1768 if ( !success ) {
1765 return false; 1769 return false;
1766 } 1770 }
1767 if ( filename == MainWindow::defaultFileName() ) { 1771 if ( filename == MainWindow::defaultFileName() ) {
1768 setLoadedFileVersion( lfv ); 1772 setLoadedFileVersion( lfv );
1769 watchSavedFile(); 1773 watchSavedFile();
1770 } 1774 }
1771 return true; 1775 return true;
1772} 1776}
1773 1777
1774void CalendarView::closeCalendar() 1778void CalendarView::closeCalendar()
1775{ 1779{
1776 1780
1777 // child windows no longer valid 1781 // child windows no longer valid
1778 emit closingDown(); 1782 emit closingDown();
1779 1783
1780 mCalendar->close(); 1784 mCalendar->close();
1781 setModified(false); 1785 setModified(false);
1782 updateView(); 1786 updateView();
1783} 1787}
1784 1788
1785void CalendarView::archiveCalendar() 1789void CalendarView::archiveCalendar()
1786{ 1790{
1787 mDialogManager->showArchiveDialog(); 1791 mDialogManager->showArchiveDialog();
1788} 1792}
1789 1793
1790 1794
1791void CalendarView::readSettings() 1795void CalendarView::readSettings()
1792{ 1796{
1793 1797
1794 1798
1795 // mViewManager->showAgendaView(); 1799 // mViewManager->showAgendaView();
1796 QString str; 1800 QString str;
1797 //qDebug("CalendarView::readSettings() "); 1801 //qDebug("CalendarView::readSettings() ");
1798 // read settings from the KConfig, supplying reasonable 1802 // read settings from the KConfig, supplying reasonable
1799 // defaults where none are to be found 1803 // defaults where none are to be found
1800 KConfig *config = KOGlobals::config(); 1804 KConfig *config = KOGlobals::config();
1801#ifndef KORG_NOSPLITTER 1805#ifndef KORG_NOSPLITTER
1802 config->setGroup("KOrganizer Geometry"); 1806 config->setGroup("KOrganizer Geometry");
1803 1807
1804 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1808 QValueList<int> sizes = config->readIntListEntry("Separator1");
1805 if (sizes.count() != 2) { 1809 if (sizes.count() != 2) {
1806 sizes << mDateNavigator->minimumSizeHint().width(); 1810 sizes << mDateNavigator->minimumSizeHint().width();
1807 sizes << 300; 1811 sizes << 300;
1808 } 1812 }
1809 mPanner->setSizes(sizes); 1813 mPanner->setSizes(sizes);
1810 1814
1811 sizes = config->readIntListEntry("Separator2"); 1815 sizes = config->readIntListEntry("Separator2");
1812 if ( ( mResourceView && sizes.count() == 4 ) || 1816 if ( ( mResourceView && sizes.count() == 4 ) ||
1813 ( !mResourceView && sizes.count() == 3 ) ) { 1817 ( !mResourceView && sizes.count() == 3 ) ) {
1814 mLeftSplitter->setSizes(sizes); 1818 mLeftSplitter->setSizes(sizes);
1815 } 1819 }
1816#endif 1820#endif
1817 globalFlagBlockAgenda = 1; 1821 globalFlagBlockAgenda = 1;
1818 mViewManager->showAgendaView(); 1822 mViewManager->showAgendaView();
1819 //mViewManager->readSettings( config ); 1823 //mViewManager->readSettings( config );
1820 mTodoList->restoreLayout(config,QString("Todo Layout")); 1824 mTodoList->restoreLayout(config,QString("Todo Layout"));
1821 readFilterSettings(config); 1825 readFilterSettings(config);
1822 config->setGroup( "Views" ); 1826 config->setGroup( "Views" );
1823 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1827 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1824 1828
1825 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); 1829 QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
1826 1830
1827 int resetval = 0; 1831 int resetval = 0;
1828 int maxVal = 0; 1832 int maxVal = 0;
1829 if (sizes.count() != 3) { 1833 if (sizes.count() != 3) {
1830 if ( KOPrefs::instance()->mVerticalScreen ) { 1834 if ( KOPrefs::instance()->mVerticalScreen ) {
1831 resetval = mDateNavigator->sizeHint().width()+2; 1835 resetval = mDateNavigator->sizeHint().width()+2;
1832 } else { 1836 } else {
1833 resetval = mDateNavigator->sizeHint().height()+2; 1837 resetval = mDateNavigator->sizeHint().height()+2;
1834 } 1838 }
1835 } 1839 }
1836 if ( !resetval ){// i.e. sizes.count() == 3 1840 if ( !resetval ){// i.e. sizes.count() == 3
1837 if ( KOPrefs::instance()->mVerticalScreen ) { 1841 if ( KOPrefs::instance()->mVerticalScreen ) {
1838 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 ) 1842 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1839 resetval = mDateNavigator->sizeHint().width()+2; 1843 resetval = mDateNavigator->sizeHint().width()+2;
1840 } else { 1844 } else {
1841 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 ) 1845 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1842 resetval = mDateNavigator->sizeHint().height()+2; 1846 resetval = mDateNavigator->sizeHint().height()+2;
1843 } 1847 }
1844 } 1848 }
1845 if ( resetval ) { 1849 if ( resetval ) {
1846 sizes.clear(); 1850 sizes.clear();
1847 if ( KOPrefs::instance()->mVerticalScreen ) { 1851 if ( KOPrefs::instance()->mVerticalScreen ) {
1848 maxVal = QApplication::desktop()->width() -10; 1852 maxVal = QApplication::desktop()->width() -10;
1849 } else { 1853 } else {
1850 maxVal = QApplication::desktop()->height()-10; 1854 maxVal = QApplication::desktop()->height()-10;
1851 } 1855 }
1852 sizes << resetval; 1856 sizes << resetval;
1853 if ( maxVal < resetval + resetval) 1857 if ( maxVal < resetval + resetval)
1854 resetval = maxVal - resetval; 1858 resetval = maxVal - resetval;
1855 sizes << resetval; 1859 sizes << resetval;
1856 sizes << 100; 1860 sizes << 100;
1857 } 1861 }
1858 mLeftFrame->setSizes(sizes); 1862 mLeftFrame->setSizes(sizes);
1863 sizes = config->readIntListEntry("Main Splitter Frame");
1864 if (sizes.count() != 3) {
1865 if ( !KOPrefs::instance()->mVerticalScreen ) {
1866 resetval = mDateNavigator->sizeHint().width()+2;
1867 } else {
1868 resetval = mDateNavigator->sizeHint().height()+2;
1869 }
1870 }
1871 if ( !resetval ){// i.e. sizes.count() == 3
1872 if ( !KOPrefs::instance()->mVerticalScreen ) {
1873 if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
1874 resetval = mDateNavigator->sizeHint().width()+2;
1875 } else {
1876 if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
1877 resetval = mDateNavigator->sizeHint().height()+2;
1878 }
1879 }
1880 if ( resetval ) {
1881 sizes.clear();
1882 if ( !KOPrefs::instance()->mVerticalScreen ) {
1883 maxVal = QApplication::desktop()->width() -10;
1884 } else {
1885 maxVal = QApplication::desktop()->height()-10;
1886 }
1887 sizes << resetval;
1888 if ( maxVal < resetval + resetval)
1889 resetval = maxVal - resetval;
1890 sizes << resetval;
1891 }
1892 mMainFrame->setSizes(sizes);
1893
1859 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1894 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1860 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1895 else if ( dateCount == 7 ) mNavigator->selectWeek();
1861 else mNavigator->selectDates( dateCount ); 1896 else mNavigator->selectDates( dateCount );
1862 // mViewManager->readSettings( config ); 1897 // mViewManager->readSettings( config );
1863 updateConfig(); 1898 updateConfig();
1864 globalFlagBlockAgenda = 2; 1899 globalFlagBlockAgenda = 2;
1865 mViewManager->readSettings( config ); 1900 mViewManager->readSettings( config );
1866#ifdef DESKTOP_VERSION 1901#ifdef DESKTOP_VERSION
1867 config->setGroup("WidgetLayout"); 1902 config->setGroup("WidgetLayout");
1868 QStringList list; 1903 QStringList list;
1869 list = config->readListEntry("MainLayout"); 1904 list = config->readListEntry("MainLayout");
1870 int x,y,w,h; 1905 int x,y,w,h;
1871 if ( ! list.isEmpty() ) { 1906 if ( ! list.isEmpty() ) {
1872 x = list[0].toInt(); 1907 x = list[0].toInt();
1873 y = list[1].toInt(); 1908 y = list[1].toInt();
1874 w = list[2].toInt(); 1909 w = list[2].toInt();
1875 h = list[3].toInt(); 1910 h = list[3].toInt();
1876 topLevelWidget()->setGeometry(x,y,w,h); 1911 topLevelWidget()->setGeometry(x,y,w,h);
1877 1912
1878 } else { 1913 } else {
1879 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1914 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1880 } 1915 }
1881 list = config->readListEntry("EditEventLayout"); 1916 list = config->readListEntry("EditEventLayout");
1882 if ( ! list.isEmpty() ) { 1917 if ( ! list.isEmpty() ) {
1883 x = list[0].toInt(); 1918 x = list[0].toInt();
1884 y = list[1].toInt(); 1919 y = list[1].toInt();
1885 w = list[2].toInt(); 1920 w = list[2].toInt();
1886 h = list[3].toInt(); 1921 h = list[3].toInt();
1887 mEventEditor->setGeometry(x,y,w,h); 1922 mEventEditor->setGeometry(x,y,w,h);
1888 1923
1889 } 1924 }
1890 list = config->readListEntry("EditTodoLayout"); 1925 list = config->readListEntry("EditTodoLayout");
1891 if ( ! list.isEmpty() ) { 1926 if ( ! list.isEmpty() ) {
1892 x = list[0].toInt(); 1927 x = list[0].toInt();
1893 y = list[1].toInt(); 1928 y = list[1].toInt();
1894 w = list[2].toInt(); 1929 w = list[2].toInt();
1895 h = list[3].toInt(); 1930 h = list[3].toInt();
1896 mTodoEditor->setGeometry(x,y,w,h); 1931 mTodoEditor->setGeometry(x,y,w,h);
1897 1932
1898 } 1933 }
1899 list = config->readListEntry("ViewerLayout"); 1934 list = config->readListEntry("ViewerLayout");
1900 if ( ! list.isEmpty() ) { 1935 if ( ! list.isEmpty() ) {
1901 x = list[0].toInt(); 1936 x = list[0].toInt();
1902 y = list[1].toInt(); 1937 y = list[1].toInt();
1903 w = list[2].toInt(); 1938 w = list[2].toInt();
1904 h = list[3].toInt(); 1939 h = list[3].toInt();
1905 getEventViewerDialog()->setGeometry(x,y,w,h); 1940 getEventViewerDialog()->setGeometry(x,y,w,h);
1906 } 1941 }
1907#endif 1942#endif
1908 1943
1909} 1944}
1910 1945
1911 1946
1912void CalendarView::writeSettings() 1947void CalendarView::writeSettings()
1913{ 1948{
1914 // kdDebug() << "CalendarView::writeSettings" << endl; 1949 // kdDebug() << "CalendarView::writeSettings" << endl;
1915 1950
1916 KConfig *config = KOGlobals::config(); 1951 KConfig *config = KOGlobals::config();
1917 1952
1918 mViewManager->writeSettings( config ); 1953 mViewManager->writeSettings( config );
1919 mTodoList->saveLayout(config,QString("Todo Layout")); 1954 mTodoList->saveLayout(config,QString("Todo Layout"));
1920 mDialogManager->writeSettings( config ); 1955 mDialogManager->writeSettings( config );
1921 //KOPrefs::instance()->usrWriteConfig(); 1956 //KOPrefs::instance()->usrWriteConfig();
1922 KOPrefs::instance()->writeConfig(); 1957 KOPrefs::instance()->writeConfig();
1923 1958
1924 writeFilterSettings(config); 1959 writeFilterSettings(config);
1925 1960
1926 config->setGroup( "Views" ); 1961 config->setGroup( "Views" );
1927 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1962 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1928 1963
1929 QValueList<int> listINT = mLeftFrame->sizes(); 1964 QValueList<int> listINT = mLeftFrame->sizes();
1930 config->writeEntry("Left Splitter Frame",listINT); 1965 config->writeEntry("Left Splitter Frame",listINT);
1931 1966 listINT = mMainFrame->sizes();
1967 config->writeEntry("Main Splitter Frame",listINT);
1932#ifdef DESKTOP_VERSION 1968#ifdef DESKTOP_VERSION
1933 config->setGroup("WidgetLayout"); 1969 config->setGroup("WidgetLayout");
1934 QStringList list ;//= config->readListEntry("MainLayout"); 1970 QStringList list ;//= config->readListEntry("MainLayout");
1935 int x,y,w,h; 1971 int x,y,w,h;
1936 QWidget* wid; 1972 QWidget* wid;
1937 wid = topLevelWidget(); 1973 wid = topLevelWidget();
1938 x = wid->geometry().x(); 1974 x = wid->geometry().x();
1939 y = wid->geometry().y(); 1975 y = wid->geometry().y();
1940 w = wid->width(); 1976 w = wid->width();
1941 h = wid->height(); 1977 h = wid->height();
1942 list.clear(); 1978 list.clear();
1943 list << QString::number( x ); 1979 list << QString::number( x );
1944 list << QString::number( y ); 1980 list << QString::number( y );
1945 list << QString::number( w ); 1981 list << QString::number( w );
1946 list << QString::number( h ); 1982 list << QString::number( h );
1947 config->writeEntry("MainLayout",list ); 1983 config->writeEntry("MainLayout",list );
1948 1984
1949 wid = mEventEditor; 1985 wid = mEventEditor;
1950 x = wid->geometry().x(); 1986 x = wid->geometry().x();
1951 y = wid->geometry().y(); 1987 y = wid->geometry().y();
1952 w = wid->width(); 1988 w = wid->width();
1953 h = wid->height(); 1989 h = wid->height();
1954 list.clear(); 1990 list.clear();
1955 list << QString::number( x ); 1991 list << QString::number( x );
1956 list << QString::number( y ); 1992 list << QString::number( y );
1957 list << QString::number( w ); 1993 list << QString::number( w );
1958 list << QString::number( h ); 1994 list << QString::number( h );
1959 config->writeEntry("EditEventLayout",list ); 1995 config->writeEntry("EditEventLayout",list );
1960 1996
1961 wid = mTodoEditor; 1997 wid = mTodoEditor;
1962 x = wid->geometry().x(); 1998 x = wid->geometry().x();
1963 y = wid->geometry().y(); 1999 y = wid->geometry().y();
1964 w = wid->width(); 2000 w = wid->width();
1965 h = wid->height(); 2001 h = wid->height();
1966 list.clear(); 2002 list.clear();
1967 list << QString::number( x ); 2003 list << QString::number( x );
1968 list << QString::number( y ); 2004 list << QString::number( y );
1969 list << QString::number( w ); 2005 list << QString::number( w );
1970 list << QString::number( h ); 2006 list << QString::number( h );
1971 config->writeEntry("EditTodoLayout",list ); 2007 config->writeEntry("EditTodoLayout",list );
1972 wid = getEventViewerDialog(); 2008 wid = getEventViewerDialog();
1973 x = wid->geometry().x(); 2009 x = wid->geometry().x();
1974 y = wid->geometry().y(); 2010 y = wid->geometry().y();
1975 w = wid->width(); 2011 w = wid->width();
1976 h = wid->height(); 2012 h = wid->height();
1977 list.clear(); 2013 list.clear();
1978 list << QString::number( x ); 2014 list << QString::number( x );
1979 list << QString::number( y ); 2015 list << QString::number( y );
1980 list << QString::number( w ); 2016 list << QString::number( w );
1981 list << QString::number( h ); 2017 list << QString::number( h );
1982 config->writeEntry("ViewerLayout",list ); 2018 config->writeEntry("ViewerLayout",list );
1983 wid = mDialogManager->getSearchDialog(); 2019 wid = mDialogManager->getSearchDialog();
1984 if ( wid ) { 2020 if ( wid ) {
1985 x = wid->geometry().x(); 2021 x = wid->geometry().x();
1986 y = wid->geometry().y(); 2022 y = wid->geometry().y();
1987 w = wid->width(); 2023 w = wid->width();
1988 h = wid->height(); 2024 h = wid->height();
1989 list.clear(); 2025 list.clear();
1990 list << QString::number( x ); 2026 list << QString::number( x );
1991 list << QString::number( y ); 2027 list << QString::number( y );
1992 list << QString::number( w ); 2028 list << QString::number( w );
1993 list << QString::number( h ); 2029 list << QString::number( h );
1994 config->writeEntry("SearchLayout",list ); 2030 config->writeEntry("SearchLayout",list );
1995 } 2031 }
1996#endif 2032#endif
1997 2033
1998 2034
1999 config->sync(); 2035 config->sync();
2000} 2036}
2001 2037
2002void CalendarView::readFilterSettings(KConfig *config) 2038void CalendarView::readFilterSettings(KConfig *config)
2003{ 2039{
2004 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 2040 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
2005 2041
2006 mFilters.clear(); 2042 mFilters.clear();
2007 2043
2008 config->setGroup("General"); 2044 config->setGroup("General");
2009 QStringList filterList = config->readListEntry("CalendarFilters"); 2045 QStringList filterList = config->readListEntry("CalendarFilters");
2010 2046
2011 QStringList::ConstIterator it = filterList.begin(); 2047 QStringList::ConstIterator it = filterList.begin();
2012 QStringList::ConstIterator end = filterList.end(); 2048 QStringList::ConstIterator end = filterList.end();
2013 while(it != end) { 2049 while(it != end) {
2014 // kdDebug() << " filter: " << (*it) << endl; 2050 // kdDebug() << " filter: " << (*it) << endl;
2015 2051
2016 CalFilter *filter; 2052 CalFilter *filter;
2017 filter = new CalFilter(*it); 2053 filter = new CalFilter(*it);
2018 config->setGroup("Filter_" + (*it)); 2054 config->setGroup("Filter_" + (*it));
2019 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 2055 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
2020 filter->setCriteria(config->readNumEntry("Criteria",0)); 2056 filter->setCriteria(config->readNumEntry("Criteria",0));
2021 filter->setCategoryList(config->readListEntry("CategoryList")); 2057 filter->setCategoryList(config->readListEntry("CategoryList"));
2022 mFilters.append(filter); 2058 mFilters.append(filter);
2023 2059
2024 ++it; 2060 ++it;
2025 } 2061 }
2026 2062
2027 if (mFilters.count() == 0) { 2063 if (mFilters.count() == 0) {