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
@@ -40,49 +40,49 @@
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
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;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
@@ -179,116 +179,142 @@ void KOViewManager::writeSettings(KConfig *config)
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);
190 } 190 }
191 if (mTimeSpanView) { 191 if (mTimeSpanView) {
192 mTimeSpanView->writeSettings(config); 192 mTimeSpanView->writeSettings(config);
193 } 193 }
194 if (mListView) { 194 if (mListView) {
195 mListView->writeSettings(config); 195 mListView->writeSettings(config);
196 } 196 }
197 if (mTodoView) { 197 if (mTodoView) {
198 mTodoView->saveLayout(config,"Todo View"); 198 mTodoView->saveLayout(config,"Todo View");
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;
275 if ( view == 0 ) 301 if ( view == 0 )
276 return; 302 return;
277 } 303 }
278 bool callupdate = !(view == mCurrentView); 304 bool callupdate = !(view == mCurrentView);
279 bool full = fullScreen; 305 bool full = fullScreen;
280 if(view == mCurrentView && view != mWhatsNextView ) { 306 if(view == mCurrentView && view != mWhatsNextView ) {
281 if ( mCurrentAgendaView < 0 ) 307 if ( mCurrentAgendaView < 0 )
282 return; 308 return;
283 if ( view != mMonthView ) 309 if ( view != mMonthView )
284 full = mMainView->leftFrame()->isVisible(); 310 full = mMainView->leftFrame()->isVisible();
285 } else { 311 } else {
286 if ( view == mMonthView && mMonthView) 312 if ( view == mMonthView && mMonthView)
287 ;//mMonthView->skipResize = true ; 313 ;//mMonthView->skipResize = true ;
288 mCurrentView = view; 314 mCurrentView = view;
289 // bool full = fullScreen; 315 // bool full = fullScreen;
290 bool isFull = !mMainView->leftFrame()->isVisible(); 316 bool isFull = !mMainView->leftFrame()->isVisible();
291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 317 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
292 full = true; 318 full = true;
293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 319 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
294 full = false; 320 full = false;
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 1d565a6..8dc03e0 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -80,44 +80,47 @@ class KOViewManager : public QObject
80 signals: 80 signals:
81 void printWNV(); 81 void printWNV();
82 void signalFullScreen( bool ); 82 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 83 void signalAgendaView( bool );
84 public slots: 84 public slots:
85 void slotprintWNV(); 85 void slotprintWNV();
86 void showNextView(); 86 void showNextView();
87 void showMonth( const QDate & ); 87 void showMonth( const QDate & );
88 void showDateView( int, QDate ); 88 void showDateView( int, QDate );
89 void updateView(); 89 void updateView();
90 void showWhatsNextView(); 90 void showWhatsNextView();
91 void showListView(); 91 void showListView();
92 void showAgendaView( bool fullScreen = false ); 92 void showAgendaView( bool fullScreen = false );
93 void showDayView(); 93 void showDayView();
94 void showWorkWeekView(); 94 void showWorkWeekView();
95 void showWeekView(); 95 void showWeekView();
96 void showNextXView(); 96 void showNextXView();
97 void showMonthView(); 97 void showMonthView();
98 void showMonthViewWeek(); 98 void showMonthViewWeek();
99 void showTodoView(); 99 void showTodoView();
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;
108 KOAgendaView *mAgendaView; 111 KOAgendaView *mAgendaView;
109 KOListView *mListView; 112 KOListView *mListView;
110 KOMonthView *mMonthView; 113 KOMonthView *mMonthView;
111 KOTodoView *mTodoView; 114 KOTodoView *mTodoView;
112 KOWhatsNextView *mWhatsNextView; 115 KOWhatsNextView *mWhatsNextView;
113 KOJournalView *mJournalView; 116 KOJournalView *mJournalView;
114 KOTimeSpanView *mTimeSpanView; 117 KOTimeSpanView *mTimeSpanView;
115 118
116 KOrg::BaseView *mCurrentView; // currently active event view 119 KOrg::BaseView *mCurrentView; // currently active event view
117 120
118 int mAgendaViewMode; 121 int mAgendaViewMode;
119 bool mFlagShowNextxDays; 122 bool mFlagShowNextxDays;
120 123
121}; 124};
122 125
123#endif 126#endif