summaryrefslogtreecommitdiffabout
path: root/korganizer/koviewmanager.cpp
authorzautrix <zautrix>2005-06-29 10:36:31 (UTC)
committer zautrix <zautrix>2005-06-29 10:36:31 (UTC)
commitb7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff)
treeb521090cfc8eb6c8c6a6f6f8167c83058ea1361b /korganizer/koviewmanager.cpp
parentf226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff)
downloadkdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2
journal fixxx
Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 5d9af6d..7b307f7 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -65,96 +65,97 @@ KOViewManager::KOViewManager( CalendarView *mainView ) :
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");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") { 91 else if (view == "Month") {
92 if ( !KOPrefs::instance()->mMonthViewWeek ) 92 if ( !KOPrefs::instance()->mMonthViewWeek )
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
113
113void KOViewManager::showDateView( int view, QDate date) 114void KOViewManager::showDateView( int view, QDate date)
114{ 115{
115 static int lastMode = 0; 116 static int lastMode = 0;
116 static int lastCount = 0; 117 static int lastCount = 0;
117 static bool lastNDMode = false; 118 static bool lastNDMode = false;
118 static QDate lastDate; 119 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 120 //qDebug("date %d %s", view, date.toString().latin1());
120 121
121 if (view != 9) 122 if (view != 9)
122 lastMode = 0; 123 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 124 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 125 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 126 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 127 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 128 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 129 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 130 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 131 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 132 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 133 lastMode = 1;
133 mCurrentAgendaView = 1 ; 134 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 135 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 136 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 137 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 138 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 139 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 140 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 141 } else if (view == 6 ) {
141 resetDateSilent( date,1); 142 resetDateSilent( date,1);
142 showMonthView(); 143 showMonthView();
143 } else if (view == 7 ) { 144 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 145 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 146 showJournalView();
146 } else if (view == 8 ) { 147 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 148 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 149 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 150 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 151 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 152 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 153 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 154 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 155 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 156 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 157 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 158 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 159 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 160 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 161 mFlagShowNextxDays = lastNDMode;
@@ -237,96 +238,102 @@ void KOViewManager::showNextView()
237 DAY_1: 238 DAY_1:
238 if ( KOPrefs::instance()->mShowIconDay1 ) { 239 if ( KOPrefs::instance()->mShowIconDay1 ) {
239 resetDateSilent( baseCycleDate , 2 ); 240 resetDateSilent( baseCycleDate , 2 );
240 showDayView() ;goto ENTE ;} 241 showDayView() ;goto ENTE ;}
241 DAY_5: 242 DAY_5:
242 if ( KOPrefs::instance()->mShowIconDay5 ) { 243 if ( KOPrefs::instance()->mShowIconDay5 ) {
243 resetDateSilent( baseCycleDate , 2 ); 244 resetDateSilent( baseCycleDate , 2 );
244 showWorkWeekView() ;goto ENTE ;} 245 showWorkWeekView() ;goto ENTE ;}
245 DAY_7: 246 DAY_7:
246 if ( KOPrefs::instance()->mShowIconDay7 ) { 247 if ( KOPrefs::instance()->mShowIconDay7 ) {
247 resetDateSilent( baseCycleDate , 2 ); 248 resetDateSilent( baseCycleDate , 2 );
248 showWeekView();goto ENTE ;} 249 showWeekView();goto ENTE ;}
249 DAY_6: 250 DAY_6:
250 if ( KOPrefs::instance()->mShowIconDay6 ) { 251 if ( KOPrefs::instance()->mShowIconDay6 ) {
251 resetDateSilent( baseCycleDate , 2 ); 252 resetDateSilent( baseCycleDate , 2 );
252 showMonthViewWeek();goto ENTE ;} 253 showMonthViewWeek();goto ENTE ;}
253 MONTH: 254 MONTH:
254 if ( KOPrefs::instance()->mShowIconMonth ) { 255 if ( KOPrefs::instance()->mShowIconMonth ) {
255 resetDateSilent( baseCycleDate , 2 ); 256 resetDateSilent( baseCycleDate , 2 );
256 showMonthView();goto ENTE ;} 257 showMonthView();goto ENTE ;}
257 LIST: 258 LIST:
258 if ( KOPrefs::instance()->mShowIconList ) { 259 if ( KOPrefs::instance()->mShowIconList ) {
259 resetDateSilent( baseCycleDate , 2 ); 260 resetDateSilent( baseCycleDate , 2 );
260 showListView() ;goto ENTE ;} 261 showListView() ;goto ENTE ;}
261 TODO: 262 TODO:
262 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} 263 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
263 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} 264 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;}
264 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} 265 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;}
265 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} 266 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;}
266 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} 267 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;}
267 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} 268 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;}
268 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} 269 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;}
269 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} 270 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;}
270 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} 271 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;}
271 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} 272 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;}
272 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} 273 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
273 ENTE: 274 ENTE:
274 flagResetViewChangeDate = 0; 275 flagResetViewChangeDate = 0;
275 selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); 276 selecteddatescount = mMainView->dateNavigator()->selectedDates().count();
276 selecteddate = mMainView->dateNavigator()->selectedDates().first(); 277 selecteddate = mMainView->dateNavigator()->selectedDates().first();
277 278
278} 279}
279void KOViewManager::resetDateSilent( QDate date , int days ) 280void KOViewManager::resetDateSilent( QDate date , int days )
280{ 281{
281 mMainView->dateNavigator()->blockSignals( true ); 282 mMainView->dateNavigator()->blockSignals( true );
282 mMainView->dateNavigator()->selectDates( date , days ); 283 mMainView->dateNavigator()->selectDates( date , days );
283 mMainView->dateNavigator()->blockSignals( false ); 284 mMainView->dateNavigator()->blockSignals( false );
284} 285}
286void KOViewManager::setDefaultCalendar(int)
287{
288 if ( mJournalView && mCurrentView == mJournalView )
289 mJournalView->updateView();
290}
291
285void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 292void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
286{ 293{
287 if ( flagResetViewChangeDate < 10 ) 294 if ( flagResetViewChangeDate < 10 )
288 ++flagResetViewChangeDate; 295 ++flagResetViewChangeDate;
289 //mFlagShowNextxDays = false; 296 //mFlagShowNextxDays = false;
290 //if(view == mCurrentView) return; 297 //if(view == mCurrentView) return;
291 if ( view == 0 ) { 298 if ( view == 0 ) {
292 view = mCurrentView; 299 view = mCurrentView;
293 if ( view == 0 ) 300 if ( view == 0 )
294 return; 301 return;
295 } 302 }
296 bool callupdate = !(view == mCurrentView); 303 bool callupdate = !(view == mCurrentView);
297 bool full = fullScreen; 304 bool full = fullScreen;
298 if(view == mCurrentView && view != mWhatsNextView ) { 305 if(view == mCurrentView && view != mWhatsNextView ) {
299 if ( mCurrentAgendaView < 0 ) 306 if ( mCurrentAgendaView < 0 )
300 return; 307 return;
301 if ( view != mMonthView ) 308 if ( view != mMonthView )
302 full = mMainView->leftFrame()->isVisible(); 309 full = mMainView->leftFrame()->isVisible();
303 } else { 310 } else {
304 if ( view == mMonthView && mMonthView) 311 if ( view == mMonthView && mMonthView)
305 ;//mMonthView->skipResize = true ; 312 ;//mMonthView->skipResize = true ;
306 mCurrentView = view; 313 mCurrentView = view;
307 // bool full = fullScreen; 314 // bool full = fullScreen;
308 bool isFull = !mMainView->leftFrame()->isVisible(); 315 bool isFull = !mMainView->leftFrame()->isVisible();
309 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 316 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
310 full = true; 317 full = true;
311 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 318 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
312 full = false; 319 full = false;
313 } 320 }
314 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 321 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
315 //raiseCurrentView( full ); 322 //raiseCurrentView( full );
316 mMainView->processIncidenceSelection( 0 ); 323 mMainView->processIncidenceSelection( 0 );
317 //mMainView->updateView(); 324 //mMainView->updateView();
318 raiseCurrentView( full, callupdate ); 325 raiseCurrentView( full, callupdate );
319 mMainView->adaptNavigationUnits(); 326 mMainView->adaptNavigationUnits();
320 mMainView->updateUnmanagedViews(); 327 mMainView->updateUnmanagedViews();
321} 328}
322 329
323void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 330void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
324{ 331{
325 mCurrentAgendaView = 0; 332 mCurrentAgendaView = 0;
326 if ( fullScreen ) { 333 if ( fullScreen ) {
327 mMainView->leftFrame()->hide(); 334 mMainView->leftFrame()->hide();
328 } else { 335 } else {
329 mMainView->leftFrame()->show(); 336 mMainView->leftFrame()->show();
330 } 337 }
331 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 338 //if ( mCurrentView == mMonthView ) qApp->processEvents();
332 emit signalFullScreen( !fullScreen ); 339 emit signalFullScreen( !fullScreen );