summaryrefslogtreecommitdiffabout
path: root/korganizer/koviewmanager.cpp
Unidiff
Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f97aa98..c442d0b 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -93,97 +93,97 @@ void KOViewManager::readSettings(KConfig *config)
93 showMonthView(); 93 showMonthView();
94 else 94 else
95 showMonthViewWeek(); 95 showMonthViewWeek();
96 } 96 }
97 else if (view == "List") showListView(); 97 else if (view == "List") showListView();
98 else if (view == "Journal") showJournalView(); 98 else if (view == "Journal") showJournalView();
99 else if (view == "TimeSpan") showTimeSpanView(); 99 else if (view == "TimeSpan") showTimeSpanView();
100 else if (view == "Todo") showTodoView(); 100 else if (view == "Todo") showTodoView();
101 else { 101 else {
102 config->setGroup( "Views" ); 102 config->setGroup( "Views" );
103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
104 mCurrentAgendaView = dateCount; 104 mCurrentAgendaView = dateCount;
105 showAgendaView(); 105 showAgendaView();
106 mCurrentAgendaView = dateCount; 106 mCurrentAgendaView = dateCount;
107#ifdef DESKTOP_VERSION 107#ifdef DESKTOP_VERSION
108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
109#endif 109#endif
110 } 110 }
111} 111}
112 112
113void KOViewManager::showDateView( int view, QDate date) 113void KOViewManager::showDateView( int view, QDate date)
114{ 114{
115 static int lastMode = 0; 115 static int lastMode = 0;
116 static int lastCount = 0; 116 static int lastCount = 0;
117 static bool lastNDMode = false; 117 static bool lastNDMode = false;
118 static QDate lastDate; 118 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
120 120
121 if (view != 9) 121 if (view != 9)
122 lastMode = 0; 122 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 126 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ; 133 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 134 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 137 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 140 } else if (view == 6 ) {
141 //mMainView->dateNavigator()->selectDates( date, 7 ); 141 resetDateSilent( date,1);
142 showMonthView(); 142 showMonthView();
143 } else if (view == 7 ) { 143 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 145 showJournalView();
146 } else if (view == 8 ) { 146 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 157 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
161 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
162 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
163 } 163 }
164 } else 164 } else
165 showWeekView(); 165 showWeekView();
166 } else if (view == 10) { 166 } else if (view == 10) {
167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
168 } 168 }
169} 169}
170 170
171 171
172 172
173void KOViewManager::writeSettings(KConfig *config) 173void KOViewManager::writeSettings(KConfig *config)
174{ 174{
175 config->setGroup("General"); 175 config->setGroup("General");
176 176
177 QString view; 177 QString view;
178 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 178 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
179 else if (mCurrentView == mMonthView) view = "Month"; 179 else if (mCurrentView == mMonthView) view = "Month";
180 else if (mCurrentView == mListView) view = "List"; 180 else if (mCurrentView == mListView) view = "List";
181 else if (mCurrentView == mJournalView) view = "Journal"; 181 else if (mCurrentView == mJournalView) view = "Journal";
182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
183 else if (mCurrentView == mTodoView) view = "Todo"; 183 else if (mCurrentView == mTodoView) view = "Todo";
184 else view = "Agenda"; 184 else view = "Agenda";
185 185
186 config->writeEntry("Current View",view); 186 config->writeEntry("Current View",view);
187 187
188 if (mAgendaView) { 188 if (mAgendaView) {
189 mAgendaView->writeSettings(config); 189 mAgendaView->writeSettings(config);
@@ -344,96 +344,98 @@ void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
344 globalFlagBlockAgenda = 4; 344 globalFlagBlockAgenda = 4;
345 globalFlagBlockAgendaItemPaint = 1; 345 globalFlagBlockAgendaItemPaint = 1;
346 } 346 }
347 mMainView->viewStack()->raiseWidget(mCurrentView); 347 mMainView->viewStack()->raiseWidget(mCurrentView);
348 if ( globalFlagBlockAgenda == 4 ) { 348 if ( globalFlagBlockAgenda == 4 ) {
349 if ( mCurrentView == mAgendaView ) { 349 if ( mCurrentView == mAgendaView ) {
350 //globalFlagBlockAgenda =1 ; 350 //globalFlagBlockAgenda =1 ;
351 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 351 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
352 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 352 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
353 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 353 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
354 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 354 mAgendaView->setStartHour( QTime::currentTime ().hour() );
355 qApp->processEvents(); 355 qApp->processEvents();
356 //qDebug("qApp->processEvents() "); 356 //qDebug("qApp->processEvents() ");
357 globalFlagBlockAgenda = 0; 357 globalFlagBlockAgenda = 0;
358 mAgendaView->repaintAgenda(); 358 mAgendaView->repaintAgenda();
359 359
360 } 360 }
361 globalFlagBlockAgenda = 0; 361 globalFlagBlockAgenda = 0;
362 } 362 }
363 emit signalAgendaView( mCurrentView == mAgendaView ); 363 emit signalAgendaView( mCurrentView == mAgendaView );
364 //qDebug("raiseCurrentView ende "); 364 //qDebug("raiseCurrentView ende ");
365 365
366} 366}
367 367
368void KOViewManager::updateView() 368void KOViewManager::updateView()
369{ 369{
370 // qDebug("KOViewManager::updateView() "); 370 // qDebug("KOViewManager::updateView() ");
371 // if we are updating mTodoView, we get endless recursion 371 // if we are updating mTodoView, we get endless recursion
372 if ( mTodoView == mCurrentView ) 372 if ( mTodoView == mCurrentView )
373 return; 373 return;
374 if ( mCurrentView ) mCurrentView->updateView(); 374 if ( mCurrentView ) mCurrentView->updateView();
375 375
376} 376}
377 377
378void KOViewManager::updateView(const QDate &start, const QDate &end) 378void KOViewManager::updateView(const QDate &start, const QDate &end)
379{ 379{
380 // kdDebug() << "KOViewManager::updateView()" << endl; 380 // kdDebug() << "KOViewManager::updateView()" << endl;
381 381
382 if (mCurrentView) mCurrentView->showDates(start, end); 382 if (mCurrentView) mCurrentView->showDates(start, end);
383 383
384 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 384 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
385} 385}
386 386
387 387
388void KOViewManager::updateWNview() 388void KOViewManager::updateWNview()
389{ 389{
390 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 390 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
391 mWhatsNextView->updateView(); 391 mWhatsNextView->updateView();
392 if ( mCurrentView == mMonthView && mMonthView )
393 mMonthView->updateView();
392 394
393} 395}
394void KOViewManager::showWhatsNextView() 396void KOViewManager::showWhatsNextView()
395{ 397{
396 if (!mWhatsNextView) { 398 if (!mWhatsNextView) {
397 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 399 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
398 "KOViewManager::WhatsNextView"); 400 "KOViewManager::WhatsNextView");
399 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 401 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
400 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 402 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
401 addView(mWhatsNextView); 403 addView(mWhatsNextView);
402 connect(this, SIGNAL( printWNV() ), 404 connect(this, SIGNAL( printWNV() ),
403 mWhatsNextView, SLOT( printMe() ) ); 405 mWhatsNextView, SLOT( printMe() ) );
404 } 406 }
405 globalFlagBlockAgenda = 1; 407 globalFlagBlockAgenda = 1;
406 showView(mWhatsNextView, true ); 408 showView(mWhatsNextView, true );
407 //mWhatsNextView->updateView(); 409 //mWhatsNextView->updateView();
408 410
409} 411}
410 412
411void KOViewManager::slotprintWNV() 413void KOViewManager::slotprintWNV()
412{ 414{
413 if (!mWhatsNextView) 415 if (!mWhatsNextView)
414 showWhatsNextView(); 416 showWhatsNextView();
415 emit printWNV(); 417 emit printWNV();
416 418
417} 419}
418void KOViewManager::showListView() 420void KOViewManager::showListView()
419{ 421{
420 if (!mListView) { 422 if (!mListView) {
421 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 423 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
422 addView(mListView); 424 addView(mListView);
423 425
424 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 426 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
425 mMainView, SLOT(showIncidence(Incidence *))); 427 mMainView, SLOT(showIncidence(Incidence *)));
426 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 428 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
427 mMainView, SLOT(editIncidence(Incidence *))); 429 mMainView, SLOT(editIncidence(Incidence *)));
428 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 430 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
429 mMainView, SLOT(deleteIncidence(Incidence *))); 431 mMainView, SLOT(deleteIncidence(Incidence *)));
430 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 432 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
431 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 433 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
432 connect( mListView, SIGNAL( signalNewEvent() ), 434 connect( mListView, SIGNAL( signalNewEvent() ),
433 mMainView, SLOT( newEvent() ) ); 435 mMainView, SLOT( newEvent() ) );
434 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 436 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
435 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 437 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
436 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 438 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
437 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 439 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
438 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 440 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
439 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 441 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),