Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koviewmanager.cpp | 7 |
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 | |||
@@ -17,364 +17,371 @@ | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
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 | flagResetViewChangeDate = 0; | 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 | ||
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") { | 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 | |||
113 | void KOViewManager::showDateView( int view, QDate date) | 114 | void 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; |
161 | if ( mFlagShowNextxDays ) { | 162 | if ( mFlagShowNextxDays ) { |
162 | mCurrentAgendaView = 3 ; | 163 | mCurrentAgendaView = 3 ; |
163 | } | 164 | } |
164 | } else | 165 | } else |
165 | showWeekView(); | 166 | showWeekView(); |
166 | } else if (view == 10) { | 167 | } else if (view == 10) { |
167 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 168 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
168 | } | 169 | } |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | 173 | ||
173 | void KOViewManager::writeSettings(KConfig *config) | 174 | void KOViewManager::writeSettings(KConfig *config) |
174 | { | 175 | { |
175 | config->setGroup("General"); | 176 | config->setGroup("General"); |
176 | 177 | ||
177 | QString view; | 178 | QString view; |
178 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 179 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
179 | else if (mCurrentView == mMonthView) view = "Month"; | 180 | else if (mCurrentView == mMonthView) view = "Month"; |
180 | else if (mCurrentView == mListView) view = "List"; | 181 | else if (mCurrentView == mListView) view = "List"; |
181 | else if (mCurrentView == mJournalView) view = "Journal"; | 182 | else if (mCurrentView == mJournalView) view = "Journal"; |
182 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 183 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
183 | else if (mCurrentView == mTodoView) view = "Todo"; | 184 | else if (mCurrentView == mTodoView) view = "Todo"; |
184 | else view = "Agenda"; | 185 | else view = "Agenda"; |
185 | 186 | ||
186 | config->writeEntry("Current View",view); | 187 | config->writeEntry("Current View",view); |
187 | 188 | ||
188 | if (mAgendaView) { | 189 | if (mAgendaView) { |
189 | mAgendaView->writeSettings(config); | 190 | mAgendaView->writeSettings(config); |
190 | } | 191 | } |
191 | if (mTimeSpanView) { | 192 | if (mTimeSpanView) { |
192 | mTimeSpanView->writeSettings(config); | 193 | mTimeSpanView->writeSettings(config); |
193 | } | 194 | } |
194 | if (mListView) { | 195 | if (mListView) { |
195 | mListView->writeSettings(config); | 196 | mListView->writeSettings(config); |
196 | } | 197 | } |
197 | if (mTodoView) { | 198 | if (mTodoView) { |
198 | mTodoView->saveLayout(config,"Todo View"); | 199 | mTodoView->saveLayout(config,"Todo View"); |
199 | } | 200 | } |
200 | } | 201 | } |
201 | void KOViewManager::showNextView() | 202 | void KOViewManager::showNextView() |
202 | { | 203 | { |
203 | static int selecteddatescount = 0; | 204 | static int selecteddatescount = 0; |
204 | static QDate selecteddate = QDate ( 2000, 1, 1 ); | 205 | static QDate selecteddate = QDate ( 2000, 1, 1 ); |
205 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); | 206 | static QDate baseCycleDate = QDate ( 2000, 1, 1 ); |
206 | int newCount = mMainView->dateNavigator()->selectedDates().count(); | 207 | int newCount = mMainView->dateNavigator()->selectedDates().count(); |
207 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { | 208 | if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { |
208 | flagResetViewChangeDate = 1; | 209 | flagResetViewChangeDate = 1; |
209 | } | 210 | } |
210 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) | 211 | if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) |
211 | flagResetViewChangeDate = 1; | 212 | flagResetViewChangeDate = 1; |
212 | if ( flagResetViewChangeDate > 0 ) { | 213 | if ( flagResetViewChangeDate > 0 ) { |
213 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); | 214 | baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); |
214 | //qDebug("newCycle "); | 215 | //qDebug("newCycle "); |
215 | } | 216 | } |
216 | if (mCurrentView == mWhatsNextView) goto NEXT_X; | 217 | if (mCurrentView == mWhatsNextView) goto NEXT_X; |
217 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; | 218 | if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; |
218 | if (mCurrentView == mJournalView ) goto DAY_1; | 219 | if (mCurrentView == mJournalView ) goto DAY_1; |
219 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; | 220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; |
220 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; | 221 | if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; |
221 | if (mCurrentView == mAgendaView ) goto DAY_6; | 222 | if (mCurrentView == mAgendaView ) goto DAY_6; |
222 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; | 223 | if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; |
223 | if (mCurrentView == mMonthView ) goto LIST; | 224 | if (mCurrentView == mMonthView ) goto LIST; |
224 | if (mCurrentView == mListView ) goto TODO; | 225 | if (mCurrentView == mListView ) goto TODO; |
225 | // if (mCurrentView == mTodoView ) goto NEXT; | 226 | // if (mCurrentView == mTodoView ) goto NEXT; |
226 | NEXT: | 227 | NEXT: |
227 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} | 228 | if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} |
228 | NEXT_X: | 229 | NEXT_X: |
229 | if ( KOPrefs::instance()->mShowIconNextDays ) { | 230 | if ( KOPrefs::instance()->mShowIconNextDays ) { |
230 | showNextXView(); | 231 | showNextXView(); |
231 | goto ENTE ; | 232 | goto ENTE ; |
232 | } | 233 | } |
233 | JOURNAL: | 234 | JOURNAL: |
234 | if ( KOPrefs::instance()->mShowIconJournal ) { | 235 | if ( KOPrefs::instance()->mShowIconJournal ) { |
235 | resetDateSilent( baseCycleDate , 1 ); | 236 | resetDateSilent( baseCycleDate , 1 ); |
236 | showJournalView() ;goto ENTE ;} | 237 | showJournalView() ;goto ENTE ;} |
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 | } |
279 | void KOViewManager::resetDateSilent( QDate date , int days ) | 280 | void 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 | } |
286 | void KOViewManager::setDefaultCalendar(int) | ||
287 | { | ||
288 | if ( mJournalView && mCurrentView == mJournalView ) | ||
289 | mJournalView->updateView(); | ||
290 | } | ||
291 | |||
285 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 292 | void 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 | ||
323 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 330 | void 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 ); |
333 | if ( callUpdateView ) | 340 | if ( callUpdateView ) |
334 | mMainView->updateView(); | 341 | mMainView->updateView(); |
335 | 342 | ||
336 | if ( globalFlagBlockAgenda == 5 ) { | 343 | if ( globalFlagBlockAgenda == 5 ) { |
337 | globalFlagBlockAgenda = 4; | 344 | globalFlagBlockAgenda = 4; |
338 | globalFlagBlockAgendaItemPaint = 1; | 345 | globalFlagBlockAgendaItemPaint = 1; |
339 | } | 346 | } |
340 | mMainView->viewStack()->raiseWidget(mCurrentView); | 347 | mMainView->viewStack()->raiseWidget(mCurrentView); |
341 | if ( globalFlagBlockAgenda == 4 ) { | 348 | if ( globalFlagBlockAgenda == 4 ) { |
342 | if ( mCurrentView == mAgendaView ) { | 349 | if ( mCurrentView == mAgendaView ) { |
343 | //globalFlagBlockAgenda =1 ; | 350 | //globalFlagBlockAgenda =1 ; |
344 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 351 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
345 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 352 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
346 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 353 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
347 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 354 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
348 | qApp->processEvents(); | 355 | qApp->processEvents(); |
349 | //qDebug("qApp->processEvents() "); | 356 | //qDebug("qApp->processEvents() "); |
350 | globalFlagBlockAgenda = 0; | 357 | globalFlagBlockAgenda = 0; |
351 | mAgendaView->repaintAgenda(); | 358 | mAgendaView->repaintAgenda(); |
352 | 359 | ||
353 | } | 360 | } |
354 | globalFlagBlockAgenda = 0; | 361 | globalFlagBlockAgenda = 0; |
355 | } | 362 | } |
356 | emit signalAgendaView( mCurrentView == mAgendaView ); | 363 | emit signalAgendaView( mCurrentView == mAgendaView ); |
357 | //qDebug("raiseCurrentView ende "); | 364 | //qDebug("raiseCurrentView ende "); |
358 | 365 | ||
359 | } | 366 | } |
360 | 367 | ||
361 | void KOViewManager::clearAllViews() | 368 | void KOViewManager::clearAllViews() |
362 | { | 369 | { |
363 | 370 | ||
364 | if ( mTodoView ) mTodoView->clearList(); | 371 | if ( mTodoView ) mTodoView->clearList(); |
365 | if ( mListView ) mListView->clearList(); | 372 | if ( mListView ) mListView->clearList(); |
366 | 373 | ||
367 | if ( mAgendaView ) mAgendaView->clearList(); | 374 | if ( mAgendaView ) mAgendaView->clearList(); |
368 | if ( mMonthView ) mMonthView->clearList(); | 375 | if ( mMonthView ) mMonthView->clearList(); |
369 | if ( mWhatsNextView ) mWhatsNextView->clearList(); | 376 | if ( mWhatsNextView ) mWhatsNextView->clearList(); |
370 | if ( mJournalView ) mJournalView->clearList(); | 377 | if ( mJournalView ) mJournalView->clearList(); |
371 | 378 | ||
372 | } | 379 | } |
373 | void KOViewManager::updateView() | 380 | void KOViewManager::updateView() |
374 | { | 381 | { |
375 | // qDebug("KOViewManager::updateView() "); | 382 | // qDebug("KOViewManager::updateView() "); |
376 | // if we are updating mTodoView, we get endless recursion | 383 | // if we are updating mTodoView, we get endless recursion |
377 | if ( mTodoView == mCurrentView ) | 384 | if ( mTodoView == mCurrentView ) |
378 | return; | 385 | return; |
379 | if ( mCurrentView ) mCurrentView->updateView(); | 386 | if ( mCurrentView ) mCurrentView->updateView(); |
380 | 387 | ||