-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 94d74f1..c6e76c4 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -115,214 +115,215 @@ void KOViewManager::showDateView( int view, QDate date) | |||
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->showDay( date ); | 131 | mMainView->showDay( date ); |
132 | lastMode = 1; | 132 | lastMode = 1; |
133 | } else if (view == 4 ) { | 133 | } else if (view == 4 ) { |
134 | mCurrentAgendaView = 7 ; | 134 | mCurrentAgendaView = 7 ; |
135 | mMainView->dateNavigator()->selectDates( date, 7 ); | 135 | mMainView->dateNavigator()->selectDates( date, 7 ); |
136 | } else if (view == 5 ) { | 136 | } else if (view == 5 ) { |
137 | mCurrentAgendaView = 14 ; | 137 | mCurrentAgendaView = 14 ; |
138 | mMainView->dateNavigator()->selectDates( date, 14); | 138 | mMainView->dateNavigator()->selectDates( date, 14); |
139 | } else if (view == 6 ) { | 139 | } else if (view == 6 ) { |
140 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 140 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
141 | showMonthView(); | 141 | showMonthView(); |
142 | } else if (view == 7 ) { | 142 | } else if (view == 7 ) { |
143 | mMainView->dateNavigator()->selectDate( date ); | 143 | mMainView->dateNavigator()->selectDate( date ); |
144 | showJournalView(); | 144 | showJournalView(); |
145 | } else if (view == 8 ) { | 145 | } else if (view == 8 ) { |
146 | globalFlagBlockAgenda = 1; | 146 | globalFlagBlockAgenda = 1; |
147 | if ( mCurrentAgendaView != 3 ) | 147 | if ( mCurrentAgendaView != 3 ) |
148 | mCurrentAgendaView = -1; | 148 | mCurrentAgendaView = -1; |
149 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 149 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
150 | globalFlagBlockAgenda = 2; | 150 | globalFlagBlockAgenda = 2; |
151 | mMainView->dateNavigator()->selectDates( date , | 151 | mMainView->dateNavigator()->selectDates( date , |
152 | KOPrefs::instance()->mNextXDays ); | 152 | KOPrefs::instance()->mNextXDays ); |
153 | mFlagShowNextxDays = true; | 153 | mFlagShowNextxDays = true; |
154 | mCurrentAgendaView = 3 ; | 154 | mCurrentAgendaView = 3 ; |
155 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 155 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
156 | if ( lastMode ) { | 156 | if ( lastMode ) { |
157 | mCurrentAgendaView = lastCount ; | 157 | mCurrentAgendaView = lastCount ; |
158 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 158 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
159 | mFlagShowNextxDays = lastNDMode; | 159 | mFlagShowNextxDays = lastNDMode; |
160 | if ( mFlagShowNextxDays ) { | 160 | if ( mFlagShowNextxDays ) { |
161 | mCurrentAgendaView = 3 ; | 161 | mCurrentAgendaView = 3 ; |
162 | } | 162 | } |
163 | } else | 163 | } else |
164 | showWeekView(); | 164 | showWeekView(); |
165 | } else if (view == 10) { | 165 | } else if (view == 10) { |
166 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 166 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | 171 | ||
172 | void KOViewManager::writeSettings(KConfig *config) | 172 | void KOViewManager::writeSettings(KConfig *config) |
173 | { | 173 | { |
174 | config->setGroup("General"); | 174 | config->setGroup("General"); |
175 | 175 | ||
176 | QString view; | 176 | QString view; |
177 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 177 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
178 | else if (mCurrentView == mMonthView) view = "Month"; | 178 | else if (mCurrentView == mMonthView) view = "Month"; |
179 | else if (mCurrentView == mListView) view = "List"; | 179 | else if (mCurrentView == mListView) view = "List"; |
180 | else if (mCurrentView == mJournalView) view = "Journal"; | 180 | else if (mCurrentView == mJournalView) view = "Journal"; |
181 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 181 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
182 | else if (mCurrentView == mTodoView) view = "Todo"; | 182 | else if (mCurrentView == mTodoView) view = "Todo"; |
183 | else view = "Agenda"; | 183 | else view = "Agenda"; |
184 | 184 | ||
185 | config->writeEntry("Current View",view); | 185 | config->writeEntry("Current View",view); |
186 | 186 | ||
187 | if (mAgendaView) { | 187 | if (mAgendaView) { |
188 | mAgendaView->writeSettings(config); | 188 | mAgendaView->writeSettings(config); |
189 | } | 189 | } |
190 | if (mTimeSpanView) { | 190 | if (mTimeSpanView) { |
191 | mTimeSpanView->writeSettings(config); | 191 | mTimeSpanView->writeSettings(config); |
192 | } | 192 | } |
193 | if (mListView) { | 193 | if (mListView) { |
194 | mListView->writeSettings(config); | 194 | mListView->writeSettings(config); |
195 | } | 195 | } |
196 | if (mTodoView) { | 196 | if (mTodoView) { |
197 | mTodoView->saveLayout(config,"Todo View"); | 197 | mTodoView->saveLayout(config,"Todo View"); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 201 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
202 | { | 202 | { |
203 | 203 | ||
204 | //mFlagShowNextxDays = false; | 204 | //mFlagShowNextxDays = false; |
205 | //if(view == mCurrentView) return; | 205 | //if(view == mCurrentView) return; |
206 | if ( view == 0 ) { | 206 | if ( view == 0 ) { |
207 | view = mCurrentView; | 207 | view = mCurrentView; |
208 | if ( view == 0 ) | 208 | if ( view == 0 ) |
209 | return; | 209 | return; |
210 | } | 210 | } |
211 | bool callupdate = !(view == mCurrentView); | ||
211 | bool full = fullScreen; | 212 | bool full = fullScreen; |
212 | if(view == mCurrentView && view != mWhatsNextView ) { | 213 | if(view == mCurrentView && view != mWhatsNextView ) { |
213 | if ( mCurrentAgendaView < 0 ) | 214 | if ( mCurrentAgendaView < 0 ) |
214 | return; | 215 | return; |
215 | if ( view != mMonthView ) | 216 | if ( view != mMonthView ) |
216 | full = mMainView->leftFrame()->isVisible(); | 217 | full = mMainView->leftFrame()->isVisible(); |
217 | } else { | 218 | } else { |
218 | if ( view == mMonthView && mMonthView) | 219 | if ( view == mMonthView && mMonthView) |
219 | ;//mMonthView->skipResize = true ; | 220 | ;//mMonthView->skipResize = true ; |
220 | mCurrentView = view; | 221 | mCurrentView = view; |
221 | // bool full = fullScreen; | 222 | // bool full = fullScreen; |
222 | bool isFull = !mMainView->leftFrame()->isVisible(); | 223 | bool isFull = !mMainView->leftFrame()->isVisible(); |
223 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 224 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
224 | full = true; | 225 | full = true; |
225 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 226 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
226 | full = false; | 227 | full = false; |
227 | } | 228 | } |
228 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 229 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
229 | //raiseCurrentView( full ); | 230 | //raiseCurrentView( full ); |
230 | mMainView->processIncidenceSelection( 0 ); | 231 | mMainView->processIncidenceSelection( 0 ); |
231 | //mMainView->updateView(); | 232 | //mMainView->updateView(); |
232 | raiseCurrentView( full, true ); | 233 | raiseCurrentView( full, callupdate ); |
233 | mMainView->adaptNavigationUnits(); | 234 | mMainView->adaptNavigationUnits(); |
234 | } | 235 | } |
235 | 236 | ||
236 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 237 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
237 | { | 238 | { |
238 | mCurrentAgendaView = 0; | 239 | mCurrentAgendaView = 0; |
239 | if ( fullScreen ) { | 240 | if ( fullScreen ) { |
240 | mMainView->leftFrame()->hide(); | 241 | mMainView->leftFrame()->hide(); |
241 | } else { | 242 | } else { |
242 | mMainView->leftFrame()->show(); | 243 | mMainView->leftFrame()->show(); |
243 | } | 244 | } |
244 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); | 245 | //if ( mCurrentView == mMonthView ) qApp->processEvents(); |
245 | emit signalFullScreen( !fullScreen ); | 246 | emit signalFullScreen( !fullScreen ); |
246 | if ( callUpdateView ) | 247 | if ( callUpdateView ) |
247 | mMainView->updateView(); | 248 | mMainView->updateView(); |
248 | 249 | ||
249 | if ( globalFlagBlockAgenda == 5 ) { | 250 | if ( globalFlagBlockAgenda == 5 ) { |
250 | globalFlagBlockAgenda = 4; | 251 | globalFlagBlockAgenda = 4; |
251 | globalFlagBlockAgendaItemPaint = 1; | 252 | globalFlagBlockAgendaItemPaint = 1; |
252 | } | 253 | } |
253 | mMainView->viewStack()->raiseWidget(mCurrentView); | 254 | mMainView->viewStack()->raiseWidget(mCurrentView); |
254 | if ( globalFlagBlockAgenda == 4 ) { | 255 | if ( globalFlagBlockAgenda == 4 ) { |
255 | if ( mCurrentView == mAgendaView ) { | 256 | if ( mCurrentView == mAgendaView ) { |
256 | //globalFlagBlockAgenda =1 ; | 257 | //globalFlagBlockAgenda =1 ; |
257 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 258 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
258 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 259 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
259 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 260 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
260 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 261 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
261 | qApp->processEvents(); | 262 | qApp->processEvents(); |
262 | //qDebug("qApp->processEvents() "); | 263 | //qDebug("qApp->processEvents() "); |
263 | globalFlagBlockAgenda = 0; | 264 | globalFlagBlockAgenda = 0; |
264 | mAgendaView->repaintAgenda(); | 265 | mAgendaView->repaintAgenda(); |
265 | 266 | ||
266 | } | 267 | } |
267 | globalFlagBlockAgenda = 0; | 268 | globalFlagBlockAgenda = 0; |
268 | } | 269 | } |
269 | emit signalAgendaView( mCurrentView == mAgendaView ); | 270 | emit signalAgendaView( mCurrentView == mAgendaView ); |
270 | //qDebug("raiseCurrentView ende "); | 271 | //qDebug("raiseCurrentView ende "); |
271 | 272 | ||
272 | } | 273 | } |
273 | 274 | ||
274 | void KOViewManager::updateView() | 275 | void KOViewManager::updateView() |
275 | { | 276 | { |
276 | // qDebug("KOViewManager::updateView() "); | 277 | // qDebug("KOViewManager::updateView() "); |
277 | // if we are updating mTodoView, we get endless recursion | 278 | // if we are updating mTodoView, we get endless recursion |
278 | if ( mTodoView == mCurrentView ) | 279 | if ( mTodoView == mCurrentView ) |
279 | return; | 280 | return; |
280 | if ( mCurrentView ) mCurrentView->updateView(); | 281 | if ( mCurrentView ) mCurrentView->updateView(); |
281 | 282 | ||
282 | } | 283 | } |
283 | 284 | ||
284 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 285 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
285 | { | 286 | { |
286 | // kdDebug() << "KOViewManager::updateView()" << endl; | 287 | // kdDebug() << "KOViewManager::updateView()" << endl; |
287 | 288 | ||
288 | if (mCurrentView) mCurrentView->showDates(start, end); | 289 | if (mCurrentView) mCurrentView->showDates(start, end); |
289 | 290 | ||
290 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 291 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
291 | } | 292 | } |
292 | 293 | ||
293 | 294 | ||
294 | void KOViewManager::updateWNview() | 295 | void KOViewManager::updateWNview() |
295 | { | 296 | { |
296 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 297 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
297 | mWhatsNextView->updateView(); | 298 | mWhatsNextView->updateView(); |
298 | 299 | ||
299 | } | 300 | } |
300 | void KOViewManager::showWhatsNextView() | 301 | void KOViewManager::showWhatsNextView() |
301 | { | 302 | { |
302 | if (!mWhatsNextView) { | 303 | if (!mWhatsNextView) { |
303 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 304 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
304 | "KOViewManager::WhatsNextView"); | 305 | "KOViewManager::WhatsNextView"); |
305 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 306 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
306 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 307 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
307 | addView(mWhatsNextView); | 308 | addView(mWhatsNextView); |
308 | connect(this, SIGNAL( printWNV() ), | 309 | connect(this, SIGNAL( printWNV() ), |
309 | mWhatsNextView, SLOT( printMe() ) ); | 310 | mWhatsNextView, SLOT( printMe() ) ); |
310 | } | 311 | } |
311 | globalFlagBlockAgenda = 1; | 312 | globalFlagBlockAgenda = 1; |
312 | showView(mWhatsNextView, true ); | 313 | showView(mWhatsNextView, true ); |
313 | //mWhatsNextView->updateView(); | 314 | //mWhatsNextView->updateView(); |
314 | 315 | ||
315 | } | 316 | } |
316 | 317 | ||
317 | void KOViewManager::showListView() | 318 | void KOViewManager::showListView() |
318 | { | 319 | { |
319 | if (!mListView) { | 320 | if (!mListView) { |
320 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 321 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
321 | addView(mListView); | 322 | addView(mListView); |
322 | 323 | ||
323 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 324 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
324 | mMainView, SLOT(showIncidence(Incidence *))); | 325 | mMainView, SLOT(showIncidence(Incidence *))); |
325 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 326 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
326 | mMainView, SLOT(editIncidence(Incidence *))); | 327 | mMainView, SLOT(editIncidence(Incidence *))); |
327 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 328 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
328 | mMainView, SLOT(deleteIncidence(Incidence *))); | 329 | mMainView, SLOT(deleteIncidence(Incidence *))); |