summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp120
-rw-r--r--korganizer/koviewmanager.h3
2 files changed, 76 insertions, 47 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 548ffd3..f97aa98 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -60,9 +60,9 @@ int globalFlagBlockAgendaItemUpdate = 1;
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 64 flagResetViewChangeDate = 0;
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
@@ -199,76 +199,102 @@ void KOViewManager::writeSettings(KConfig *config)
199 } 199 }
200} 200}
201void KOViewManager::showNextView() 201void KOViewManager::showNextView()
202{ 202{
203 static int selecteddatescount = 0;
204 static QDate selecteddate = QDate ( 2000, 1, 1 );
205 static QDate baseCycleDate = QDate ( 2000, 1, 1 );
206 int newCount = mMainView->dateNavigator()->selectedDates().count();
207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) {
208 flagResetViewChangeDate = 1;
209 }
210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() )
211 flagResetViewChangeDate = 1;
212 if ( flagResetViewChangeDate > 0 ) {
213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first();
214 //qDebug("newCycle ");
215 }
203 if (mCurrentView == mWhatsNextView) goto NEXT_X; 216 if (mCurrentView == mWhatsNextView) goto NEXT_X;
204
205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
206
207 if (mCurrentView == mJournalView ) goto DAY_1; 218 if (mCurrentView == mJournalView ) goto DAY_1;
208
209 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
210
211 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
212
213 if (mCurrentView == mAgendaView ) goto DAY_6; 221 if (mCurrentView == mAgendaView ) goto DAY_6;
214
215 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
216
217 if (mCurrentView == mMonthView ) goto LIST; 223 if (mCurrentView == mMonthView ) goto LIST;
218
219 if (mCurrentView == mListView ) goto TODO; 224 if (mCurrentView == mListView ) goto TODO;
220 225 // if (mCurrentView == mTodoView ) goto NEXT;
221 // if (mCurrentView == mTodoView ) goto LIST;
222
223
224 NEXT: 226 NEXT:
225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;}
226 NEXT_X: 228 NEXT_X:
227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 229 if ( KOPrefs::instance()->mShowIconNextDays ) {
230 globalFlagBlockAgenda = 1;
231 if ( mCurrentAgendaView != 3 )
232 mCurrentAgendaView = -1;
233 showAgendaView(KOPrefs::instance()->mFullViewMonth);
234 globalFlagBlockAgenda = 2;
235 mMainView->dateNavigator()->selectDates( baseCycleDate ,
236 KOPrefs::instance()->mNextXDays );
237 mFlagShowNextxDays = true;
238 mCurrentAgendaView = 3 ;
239 goto ENTE ;
240 }
228 JOURNAL: 241 JOURNAL:
229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 242 if ( KOPrefs::instance()->mShowIconJournal ) {
243 resetDateSilent( baseCycleDate , 1 );
244 showJournalView() ;goto ENTE ;}
230 DAY_1: 245 DAY_1:
231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 246 if ( KOPrefs::instance()->mShowIconDay1 ) {
247 resetDateSilent( baseCycleDate , 2 );
248 showDayView() ;goto ENTE ;}
232 DAY_5: 249 DAY_5:
233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 250 if ( KOPrefs::instance()->mShowIconDay5 ) {
251 resetDateSilent( baseCycleDate , 2 );
252 showWorkWeekView() ;goto ENTE ;}
234 DAY_7: 253 DAY_7:
235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 254 if ( KOPrefs::instance()->mShowIconDay7 ) {
255 resetDateSilent( baseCycleDate , 2 );
256 showWeekView();goto ENTE ;}
236 DAY_6: 257 DAY_6:
237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 258 if ( KOPrefs::instance()->mShowIconDay6 ) {
259 resetDateSilent( baseCycleDate , 2 );
260 showMonthViewWeek();goto ENTE ;}
238 MONTH: 261 MONTH:
239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 262 if ( KOPrefs::instance()->mShowIconMonth ) {
263 resetDateSilent( baseCycleDate , 2 );
264 showMonthView();goto ENTE ;}
240 LIST: 265 LIST:
241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 266 if ( KOPrefs::instance()->mShowIconList ) {
267 resetDateSilent( baseCycleDate , 2 );
268 showListView() ;goto ENTE ;}
242 TODO: 269 TODO:
243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 270 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
244 271 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;}
245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 272 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;}
246 273 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;}
247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 274 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;}
248 275 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;}
249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 276 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;}
250 277 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;}
251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 278 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;}
252 279 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;}
253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 280 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
254 281 ENTE:
255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 282 flagResetViewChangeDate = 0;
256 283 selecteddatescount = mMainView->dateNavigator()->selectedDates().count();
257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 284 selecteddate = mMainView->dateNavigator()->selectedDates().first();
258 285
259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 286}
260 287void KOViewManager::resetDateSilent( QDate date , int days )
261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 288{
262 289 mMainView->dateNavigator()->blockSignals( true );
263 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 290 mMainView->dateNavigator()->selectDates( date , days );
264 291 mMainView->dateNavigator()->blockSignals( false );
265
266
267} 292}
268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 293void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
269{ 294{
270 295 if ( flagResetViewChangeDate < 10 )
296 ++flagResetViewChangeDate;
271 //mFlagShowNextxDays = false; 297 //mFlagShowNextxDays = false;
272 //if(view == mCurrentView) return; 298 //if(view == mCurrentView) return;
273 if ( view == 0 ) { 299 if ( view == 0 ) {
274 view = mCurrentView; 300 view = mCurrentView;
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 1d565a6..8dc03e0 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -100,8 +100,11 @@ class KOViewManager : public QObject
100 void showJournalView(); 100 void showJournalView();
101 void showTimeSpanView(); 101 void showTimeSpanView();
102 102
103 private: 103 private:
104 void resetDateSilent( QDate date , int days );
105 int flagResetViewChangeDate;
106 QDate currentViewChangeDate;
104 void createMonthView(); 107 void createMonthView();
105 CalendarView *mMainView; 108 CalendarView *mMainView;
106 109
107 int mCurrentAgendaView; 110 int mCurrentAgendaView;