author | zautrix <zautrix> | 2005-01-31 12:09:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 12:09:55 (UTC) |
commit | 5d52c81be9b43887c13f8534a04164d3b44b821f (patch) (unidiff) | |
tree | 79942122f3745a55fa08371970625f3e8733f5fa | |
parent | 0ee7cc932ca9c973b086f847a38d29531a815712 (diff) | |
download | kdepimpi-5d52c81be9b43887c13f8534a04164d3b44b821f.zip kdepimpi-5d52c81be9b43887c13f8534a04164d3b44b821f.tar.gz kdepimpi-5d52c81be9b43887c13f8534a04164d3b44b821f.tar.bz2 |
fix
-rw-r--r-- | korganizer/koviewmanager.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 2cd8792..c95917f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -25,225 +25,226 @@ | |||
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
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; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
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 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void 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") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void KOViewManager::showDateView( int view, QDate date) | 102 | void KOViewManager::showDateView( int view, QDate date) |
103 | { | 103 | { |
104 | 104 | ||
105 | //qDebug("date %d %s", view, date.toString().latin1()); | 105 | //qDebug("date %d %s", view, date.toString().latin1()); |
106 | #if 0 | 106 | #if 0 |
107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); | 108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); |
109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); | 109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); |
110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); | 110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); |
111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
112 | #endif | 112 | #endif |
113 | if ( view == 3 ) { | 113 | if ( view == 3 ) { |
114 | mMainView->showDay( date ); | 114 | mMainView->showDay( date ); |
115 | } else if (view == 4 ) { | 115 | } else if (view == 4 ) { |
116 | mMainView->dateNavigator()->selectDates( date, 7 ); | 116 | mMainView->dateNavigator()->selectDates( date, 7 ); |
117 | } else if (view == 5 ) { | 117 | } else if (view == 5 ) { |
118 | mMainView->dateNavigator()->selectDates( date, 14); | 118 | mMainView->dateNavigator()->selectDates( date, 14); |
119 | } else if (view == 6 ) { | 119 | } else if (view == 6 ) { |
120 | mMainView->dateNavigator()->blockSignals( true ); | 120 | mMainView->dateNavigator()->blockSignals( true ); |
121 | showMonthView(); | ||
122 | qApp->processEvents(); | ||
121 | mMainView->dateNavigator()->selectMonthByDate( date ); | 123 | mMainView->dateNavigator()->selectMonthByDate( date ); |
122 | mMainView->dateNavigator()->selectDate( date ); | ||
123 | mMainView->dateNavigator()->blockSignals( false ); | 124 | mMainView->dateNavigator()->blockSignals( false ); |
124 | showMonthView(); | 125 | mMainView->dateNavigator()->selectDate( date ); |
125 | } else if (view == 7 ) { | 126 | } else if (view == 7 ) { |
126 | mMainView->dateNavigator()->selectDate( date ); | 127 | mMainView->dateNavigator()->selectDate( date ); |
127 | showJournalView(); | 128 | showJournalView(); |
128 | } else if (view == 8 ) { | 129 | } else if (view == 8 ) { |
129 | globalFlagBlockAgenda = 1; | 130 | globalFlagBlockAgenda = 1; |
130 | if ( mCurrentAgendaView != 3 ) | 131 | if ( mCurrentAgendaView != 3 ) |
131 | mCurrentAgendaView = -1; | 132 | mCurrentAgendaView = -1; |
132 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 133 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
133 | globalFlagBlockAgenda = 2; | 134 | globalFlagBlockAgenda = 2; |
134 | mMainView->dateNavigator()->selectDates( date , | 135 | mMainView->dateNavigator()->selectDates( date , |
135 | KOPrefs::instance()->mNextXDays ); | 136 | KOPrefs::instance()->mNextXDays ); |
136 | mFlagShowNextxDays = true; | 137 | mFlagShowNextxDays = true; |
137 | mCurrentAgendaView = 3 ; | 138 | mCurrentAgendaView = 3 ; |
138 | } | 139 | } |
139 | 140 | ||
140 | #if 0 | 141 | #if 0 |
141 | dateNavigator()->blockSignals( true ); | 142 | dateNavigator()->blockSignals( true ); |
142 | dateNavigator()->selectDate( d ); | 143 | dateNavigator()->selectDate( d ); |
143 | dateNavigator()->blockSignals( false ); | 144 | dateNavigator()->blockSignals( false ); |
144 | mViewManager->showDayView(); | 145 | mViewManager->showDayView(); |
145 | #endif | 146 | #endif |
146 | 147 | ||
147 | } | 148 | } |
148 | 149 | ||
149 | 150 | ||
150 | 151 | ||
151 | void KOViewManager::writeSettings(KConfig *config) | 152 | void KOViewManager::writeSettings(KConfig *config) |
152 | { | 153 | { |
153 | config->setGroup("General"); | 154 | config->setGroup("General"); |
154 | 155 | ||
155 | QString view; | 156 | QString view; |
156 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 157 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
157 | else if (mCurrentView == mMonthView) view = "Month"; | 158 | else if (mCurrentView == mMonthView) view = "Month"; |
158 | else if (mCurrentView == mListView) view = "List"; | 159 | else if (mCurrentView == mListView) view = "List"; |
159 | else if (mCurrentView == mJournalView) view = "Journal"; | 160 | else if (mCurrentView == mJournalView) view = "Journal"; |
160 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 161 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
161 | else if (mCurrentView == mTodoView) view = "Todo"; | 162 | else if (mCurrentView == mTodoView) view = "Todo"; |
162 | else view = "Agenda"; | 163 | else view = "Agenda"; |
163 | 164 | ||
164 | config->writeEntry("Current View",view); | 165 | config->writeEntry("Current View",view); |
165 | 166 | ||
166 | if (mAgendaView) { | 167 | if (mAgendaView) { |
167 | mAgendaView->writeSettings(config); | 168 | mAgendaView->writeSettings(config); |
168 | } | 169 | } |
169 | if (mTimeSpanView) { | 170 | if (mTimeSpanView) { |
170 | mTimeSpanView->writeSettings(config); | 171 | mTimeSpanView->writeSettings(config); |
171 | } | 172 | } |
172 | if (mListView) { | 173 | if (mListView) { |
173 | mListView->writeSettings(config); | 174 | mListView->writeSettings(config); |
174 | } | 175 | } |
175 | if (mTodoView) { | 176 | if (mTodoView) { |
176 | mTodoView->saveLayout(config,"Todo View"); | 177 | mTodoView->saveLayout(config,"Todo View"); |
177 | } | 178 | } |
178 | } | 179 | } |
179 | 180 | ||
180 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 181 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
181 | { | 182 | { |
182 | 183 | ||
183 | //mFlagShowNextxDays = false; | 184 | //mFlagShowNextxDays = false; |
184 | //if(view == mCurrentView) return; | 185 | //if(view == mCurrentView) return; |
185 | if ( view == 0 ) { | 186 | if ( view == 0 ) { |
186 | view = mCurrentView; | 187 | view = mCurrentView; |
187 | if ( view == 0 ) | 188 | if ( view == 0 ) |
188 | return; | 189 | return; |
189 | } | 190 | } |
190 | bool full = fullScreen; | 191 | bool full = fullScreen; |
191 | if(view == mCurrentView && view != mWhatsNextView ) { | 192 | if(view == mCurrentView && view != mWhatsNextView ) { |
192 | if ( mCurrentAgendaView < 0 ) | 193 | if ( mCurrentAgendaView < 0 ) |
193 | return; | 194 | return; |
194 | full = mMainView->leftFrame()->isVisible(); | 195 | full = mMainView->leftFrame()->isVisible(); |
195 | } else { | 196 | } else { |
196 | mCurrentView = view; | 197 | mCurrentView = view; |
197 | // bool full = fullScreen; | 198 | // bool full = fullScreen; |
198 | bool isFull = !mMainView->leftFrame()->isVisible(); | 199 | bool isFull = !mMainView->leftFrame()->isVisible(); |
199 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 200 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
200 | full = true; | 201 | full = true; |
201 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 202 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
202 | full = false; | 203 | full = false; |
203 | } | 204 | } |
204 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 205 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
205 | //raiseCurrentView( full ); | 206 | //raiseCurrentView( full ); |
206 | mMainView->processIncidenceSelection( 0 ); | 207 | mMainView->processIncidenceSelection( 0 ); |
207 | //mMainView->updateView(); | 208 | //mMainView->updateView(); |
208 | raiseCurrentView( full, true ); | 209 | raiseCurrentView( full, true ); |
209 | mMainView->adaptNavigationUnits(); | 210 | mMainView->adaptNavigationUnits(); |
210 | } | 211 | } |
211 | 212 | ||
212 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 213 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
213 | { | 214 | { |
214 | mCurrentAgendaView = 0; | 215 | mCurrentAgendaView = 0; |
215 | int wid = mMainView->width() ; | 216 | int wid = mMainView->width() ; |
216 | int hei = mMainView->height(); | 217 | int hei = mMainView->height(); |
217 | if ( mCurrentView == mMonthView ) { | 218 | if ( mCurrentView == mMonthView ) { |
218 | mMainView->navigatorBar()->show(); | 219 | mMainView->navigatorBar()->show(); |
219 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 220 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
220 | //mMainView->navigatorBar()->hide(); | 221 | //mMainView->navigatorBar()->hide(); |
221 | } else { | 222 | } else { |
222 | mMainView->navigatorBar()->hide(); | 223 | mMainView->navigatorBar()->hide(); |
223 | } | 224 | } |
224 | if ( fullScreen ) { | 225 | if ( fullScreen ) { |
225 | mMainView->leftFrame()->hide(); | 226 | mMainView->leftFrame()->hide(); |
226 | } else { | 227 | } else { |
227 | mMainView->leftFrame()->show(); | 228 | mMainView->leftFrame()->show(); |
228 | if ( KOPrefs::instance()->mVerticalScreen ) | 229 | if ( KOPrefs::instance()->mVerticalScreen ) |
229 | hei -= mMainView->leftFrame()->height(); | 230 | hei -= mMainView->leftFrame()->height(); |
230 | else | 231 | else |
231 | wid -= mMainView->leftFrame()->width(); | 232 | wid -= mMainView->leftFrame()->width(); |
232 | } | 233 | } |
233 | emit signalFullScreen( !fullScreen ); | 234 | emit signalFullScreen( !fullScreen ); |
234 | if ( callUpdateView ) | 235 | if ( callUpdateView ) |
235 | mMainView->updateView(); | 236 | mMainView->updateView(); |
236 | 237 | ||
237 | if ( globalFlagBlockAgenda == 5 ) { | 238 | if ( globalFlagBlockAgenda == 5 ) { |
238 | globalFlagBlockAgenda = 4; | 239 | globalFlagBlockAgenda = 4; |
239 | globalFlagBlockAgendaItemPaint = 1; | 240 | globalFlagBlockAgendaItemPaint = 1; |
240 | } | 241 | } |
241 | mMainView->viewStack()->raiseWidget(mCurrentView); | 242 | mMainView->viewStack()->raiseWidget(mCurrentView); |
242 | if ( globalFlagBlockAgenda == 4 ) { | 243 | if ( globalFlagBlockAgenda == 4 ) { |
243 | if ( mCurrentView == mAgendaView ) { | 244 | if ( mCurrentView == mAgendaView ) { |
244 | //globalFlagBlockAgenda =1 ; | 245 | //globalFlagBlockAgenda =1 ; |
245 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 246 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
246 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 247 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
247 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 248 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
248 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 249 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
249 | qApp->processEvents(); | 250 | qApp->processEvents(); |
@@ -430,197 +431,193 @@ void KOViewManager::showWorkWeekView() | |||
430 | if ( mCurrentAgendaView != 5 ) | 431 | if ( mCurrentAgendaView != 5 ) |
431 | mCurrentAgendaView = -1; | 432 | mCurrentAgendaView = -1; |
432 | showAgendaView(); | 433 | showAgendaView(); |
433 | qApp->processEvents(); | 434 | qApp->processEvents(); |
434 | globalFlagBlockAgenda = 2; | 435 | globalFlagBlockAgenda = 2; |
435 | globalFlagBlockLabel = 0; | 436 | globalFlagBlockLabel = 0; |
436 | mMainView->dateNavigator()->selectWorkWeek(); | 437 | mMainView->dateNavigator()->selectWorkWeek(); |
437 | mCurrentAgendaView = 5 ; | 438 | mCurrentAgendaView = 5 ; |
438 | 439 | ||
439 | } | 440 | } |
440 | 441 | ||
441 | void KOViewManager::showWeekView() | 442 | void KOViewManager::showWeekView() |
442 | { | 443 | { |
443 | /* | 444 | /* |
444 | globalFlagBlockAgenda = 2; | 445 | globalFlagBlockAgenda = 2; |
445 | qDebug("4globalFlagBlockAgenda = 2; "); | 446 | qDebug("4globalFlagBlockAgenda = 2; "); |
446 | //globalFlagBlockPainting = true; | 447 | //globalFlagBlockPainting = true; |
447 | mMainView->dateNavigator()->selectWeek(); | 448 | mMainView->dateNavigator()->selectWeek(); |
448 | showAgendaView(); | 449 | showAgendaView(); |
449 | */ | 450 | */ |
450 | 451 | ||
451 | 452 | ||
452 | mFlagShowNextxDays = false; | 453 | mFlagShowNextxDays = false; |
453 | globalFlagBlockAgenda = 1; | 454 | globalFlagBlockAgenda = 1; |
454 | globalFlagBlockLabel = 1; | 455 | globalFlagBlockLabel = 1; |
455 | if ( mCurrentAgendaView != 7 ) | 456 | if ( mCurrentAgendaView != 7 ) |
456 | mCurrentAgendaView = -1; | 457 | mCurrentAgendaView = -1; |
457 | showAgendaView(); | 458 | showAgendaView(); |
458 | qApp->processEvents(); | 459 | qApp->processEvents(); |
459 | globalFlagBlockAgenda = 2; | 460 | globalFlagBlockAgenda = 2; |
460 | globalFlagBlockLabel = 0; | 461 | globalFlagBlockLabel = 0; |
461 | mMainView->dateNavigator()->selectWeek(); | 462 | mMainView->dateNavigator()->selectWeek(); |
462 | mCurrentAgendaView = 7 ; | 463 | mCurrentAgendaView = 7 ; |
463 | } | 464 | } |
464 | 465 | ||
465 | void KOViewManager::showNextXView() | 466 | void KOViewManager::showNextXView() |
466 | { | 467 | { |
467 | 468 | ||
468 | globalFlagBlockAgenda = 1; | 469 | globalFlagBlockAgenda = 1; |
469 | if ( mCurrentAgendaView != 3 ) | 470 | if ( mCurrentAgendaView != 3 ) |
470 | mCurrentAgendaView = -1; | 471 | mCurrentAgendaView = -1; |
471 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 472 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
472 | globalFlagBlockAgenda = 2; | 473 | globalFlagBlockAgenda = 2; |
473 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 474 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
474 | KOPrefs::instance()->mNextXDays ); | 475 | KOPrefs::instance()->mNextXDays ); |
475 | mFlagShowNextxDays = true; | 476 | mFlagShowNextxDays = true; |
476 | mCurrentAgendaView = 3 ; | 477 | mCurrentAgendaView = 3 ; |
477 | } | 478 | } |
478 | bool KOViewManager::showsNextDays() | 479 | bool KOViewManager::showsNextDays() |
479 | { | 480 | { |
480 | return mFlagShowNextxDays; | 481 | return mFlagShowNextxDays; |
481 | } | 482 | } |
482 | void KOViewManager::showMonthView() | 483 | void KOViewManager::showMonthView() |
483 | { | 484 | { |
484 | if (!mMonthView) { | 485 | if (!mMonthView) { |
485 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 486 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
486 | 487 | ||
487 | addView(mMonthView); | 488 | addView(mMonthView); |
488 | // mMonthView->show(); | 489 | // mMonthView->show(); |
489 | // SIGNALS/SLOTS FOR MONTH VIEW | 490 | // SIGNALS/SLOTS FOR MONTH VIEW |
490 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 491 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
491 | mMainView, SLOT(newEvent(QDateTime))); | 492 | mMainView, SLOT(newEvent(QDateTime))); |
492 | 493 | ||
493 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 494 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
494 | mMainView, SLOT(showIncidence(Incidence *))); | 495 | mMainView, SLOT(showIncidence(Incidence *))); |
495 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 496 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
496 | mMainView, SLOT(editIncidence(Incidence *))); | 497 | mMainView, SLOT(editIncidence(Incidence *))); |
497 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 498 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
498 | mMainView, SLOT(deleteIncidence(Incidence *))); | 499 | mMainView, SLOT(deleteIncidence(Incidence *))); |
499 | 500 | ||
500 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 501 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
501 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 502 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
502 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 503 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
503 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 504 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
504 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 505 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
505 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 506 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
506 | 507 | ||
507 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 508 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
508 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 509 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
509 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 510 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
510 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 511 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
511 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 512 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
512 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 513 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
513 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 514 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
514 | mMainView, SLOT ( showDay( QDate ) ) ); | 515 | mMainView, SLOT ( showDay( QDate ) ) ); |
515 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 516 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
516 | connect( mMonthView, SIGNAL(nextMonth() ), | 517 | connect( mMonthView, SIGNAL(nextMonth() ), |
517 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 518 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
518 | connect( mMonthView, SIGNAL(prevMonth() ), | 519 | connect( mMonthView, SIGNAL(prevMonth() ), |
519 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 520 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
520 | mMonthView->updateConfig(); | 521 | mMonthView->updateConfig(); |
521 | } | 522 | } |
522 | 523 | ||
523 | globalFlagBlockAgenda = 1; | 524 | globalFlagBlockAgenda = 1; |
524 | //mFlagShowNextxDays = false; | 525 | //mFlagShowNextxDays = false; |
525 | // if(mMonthView == mCurrentView) return; | 526 | // if(mMonthView == mCurrentView) return; |
526 | mMainView->dateNavigator()->blockSignals( true ); | ||
527 | mMainView->dateNavigator()->selectMonth(); | 527 | mMainView->dateNavigator()->selectMonth(); |
528 | mMainView->dateNavigator()->blockSignals( false); | ||
529 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | ||
530 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | ||
531 | 528 | ||
532 | showView(mMonthView, true ); | 529 | showView(mMonthView, true ); |
533 | 530 | ||
534 | } | 531 | } |
535 | 532 | ||
536 | void KOViewManager::showTodoView() | 533 | void KOViewManager::showTodoView() |
537 | { | 534 | { |
538 | //mFlagShowNextxDays = false; | 535 | //mFlagShowNextxDays = false; |
539 | if ( !mTodoView ) { | 536 | if ( !mTodoView ) { |
540 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 537 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
541 | "KOViewManager::TodoView" ); | 538 | "KOViewManager::TodoView" ); |
542 | 539 | ||
543 | addView( mTodoView ); | 540 | addView( mTodoView ); |
544 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 541 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
545 | 542 | ||
546 | // SIGNALS/SLOTS FOR TODO VIEW | 543 | // SIGNALS/SLOTS FOR TODO VIEW |
547 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 544 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
548 | mMainView, SLOT( newTodo() ) ); | 545 | mMainView, SLOT( newTodo() ) ); |
549 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 546 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
550 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 547 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
551 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 548 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
552 | mMainView, SLOT( showTodo( Todo * ) ) ); | 549 | mMainView, SLOT( showTodo( Todo * ) ) ); |
553 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 550 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
554 | mMainView, SLOT( editTodo( Todo * ) ) ); | 551 | mMainView, SLOT( editTodo( Todo * ) ) ); |
555 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 552 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
556 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 553 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
557 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 554 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
558 | mMainView, SLOT( purgeCompleted() ) ); | 555 | mMainView, SLOT( purgeCompleted() ) ); |
559 | 556 | ||
560 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 557 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
561 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 558 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
562 | 559 | ||
563 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 560 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
564 | SLOT( updateConfig() ) ); | 561 | SLOT( updateConfig() ) ); |
565 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 562 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
566 | SLOT( updateTodo( Todo *, int ) ) ); | 563 | SLOT( updateTodo( Todo *, int ) ) ); |
567 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 564 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
568 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 565 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
569 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 566 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
570 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 567 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
571 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 568 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
572 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 569 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
573 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 570 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
574 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 571 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
575 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 572 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
576 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 573 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
577 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 574 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
578 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 575 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
579 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 576 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
580 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 577 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
581 | KConfig *config = KOGlobals::config(); | 578 | KConfig *config = KOGlobals::config(); |
582 | mTodoView->restoreLayout(config,"Todo View"); | 579 | mTodoView->restoreLayout(config,"Todo View"); |
583 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 580 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
584 | } | 581 | } |
585 | 582 | ||
586 | globalFlagBlockAgenda = 1; | 583 | globalFlagBlockAgenda = 1; |
587 | showView( mTodoView, true ); | 584 | showView( mTodoView, true ); |
588 | 585 | ||
589 | } | 586 | } |
590 | 587 | ||
591 | void KOViewManager::showJournalView() | 588 | void KOViewManager::showJournalView() |
592 | { | 589 | { |
593 | //mFlagShowNextxDays = false; | 590 | //mFlagShowNextxDays = false; |
594 | if (!mJournalView) { | 591 | if (!mJournalView) { |
595 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 592 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
596 | "KOViewManager::JournalView"); | 593 | "KOViewManager::JournalView"); |
597 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 594 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
598 | SLOT( updateConfig() ) ); | 595 | SLOT( updateConfig() ) ); |
599 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 596 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
600 | addView(mJournalView); | 597 | addView(mJournalView); |
601 | } | 598 | } |
602 | 599 | ||
603 | showView(mJournalView); | 600 | showView(mJournalView); |
604 | } | 601 | } |
605 | 602 | ||
606 | void KOViewManager::showTimeSpanView() | 603 | void KOViewManager::showTimeSpanView() |
607 | { | 604 | { |
608 | //mFlagShowNextxDays = false; | 605 | //mFlagShowNextxDays = false; |
609 | if (!mTimeSpanView) { | 606 | if (!mTimeSpanView) { |
610 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 607 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
611 | "KOViewManager::TimeSpanView"); | 608 | "KOViewManager::TimeSpanView"); |
612 | addView(mTimeSpanView); | 609 | addView(mTimeSpanView); |
613 | 610 | ||
614 | mTimeSpanView->readSettings(); | 611 | mTimeSpanView->readSettings(); |
615 | } | 612 | } |
616 | 613 | ||
617 | showView(mTimeSpanView); | 614 | showView(mTimeSpanView); |
618 | } | 615 | } |
619 | 616 | ||
620 | Incidence *KOViewManager::currentSelection() | 617 | Incidence *KOViewManager::currentSelection() |
621 | { | 618 | { |
622 | if (!mCurrentView) return 0; | 619 | if (!mCurrentView) return 0; |
623 | if ( mCurrentView == mListView ) { | 620 | if ( mCurrentView == mListView ) { |
624 | if ( mListView->currentItem() ) | 621 | if ( mListView->currentItem() ) |
625 | return mListView->currentItem(); | 622 | return mListView->currentItem(); |
626 | } | 623 | } |