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 | |||
@@ -1,652 +1,649 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
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 | 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(); |
250 | //qDebug("qApp->processEvents() "); | 251 | //qDebug("qApp->processEvents() "); |
251 | globalFlagBlockAgenda = 0; | 252 | globalFlagBlockAgenda = 0; |
252 | mAgendaView->repaintAgenda(); | 253 | mAgendaView->repaintAgenda(); |
253 | 254 | ||
254 | } | 255 | } |
255 | globalFlagBlockAgenda = 0; | 256 | globalFlagBlockAgenda = 0; |
256 | } | 257 | } |
257 | emit signalAgendaView( mCurrentView == mAgendaView ); | 258 | emit signalAgendaView( mCurrentView == mAgendaView ); |
258 | //qDebug("raiseCurrentView ende "); | 259 | //qDebug("raiseCurrentView ende "); |
259 | 260 | ||
260 | } | 261 | } |
261 | 262 | ||
262 | void KOViewManager::updateView() | 263 | void KOViewManager::updateView() |
263 | { | 264 | { |
264 | // qDebug("KOViewManager::updateView() "); | 265 | // qDebug("KOViewManager::updateView() "); |
265 | // if we are updating mTodoView, we get endless recursion | 266 | // if we are updating mTodoView, we get endless recursion |
266 | if ( mTodoView == mCurrentView ) | 267 | if ( mTodoView == mCurrentView ) |
267 | return; | 268 | return; |
268 | if ( mCurrentView ) mCurrentView->updateView(); | 269 | if ( mCurrentView ) mCurrentView->updateView(); |
269 | 270 | ||
270 | } | 271 | } |
271 | 272 | ||
272 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 273 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
273 | { | 274 | { |
274 | // kdDebug() << "KOViewManager::updateView()" << endl; | 275 | // kdDebug() << "KOViewManager::updateView()" << endl; |
275 | 276 | ||
276 | if (mCurrentView) mCurrentView->showDates(start, end); | 277 | if (mCurrentView) mCurrentView->showDates(start, end); |
277 | 278 | ||
278 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 279 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
279 | } | 280 | } |
280 | 281 | ||
281 | 282 | ||
282 | void KOViewManager::updateWNview() | 283 | void KOViewManager::updateWNview() |
283 | { | 284 | { |
284 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 285 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
285 | mWhatsNextView->updateView(); | 286 | mWhatsNextView->updateView(); |
286 | 287 | ||
287 | } | 288 | } |
288 | void KOViewManager::showWhatsNextView() | 289 | void KOViewManager::showWhatsNextView() |
289 | { | 290 | { |
290 | if (!mWhatsNextView) { | 291 | if (!mWhatsNextView) { |
291 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 292 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
292 | "KOViewManager::WhatsNextView"); | 293 | "KOViewManager::WhatsNextView"); |
293 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 294 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
294 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 295 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
295 | addView(mWhatsNextView); | 296 | addView(mWhatsNextView); |
296 | connect(this, SIGNAL( printWNV() ), | 297 | connect(this, SIGNAL( printWNV() ), |
297 | mWhatsNextView, SLOT( printMe() ) ); | 298 | mWhatsNextView, SLOT( printMe() ) ); |
298 | } | 299 | } |
299 | globalFlagBlockAgenda = 1; | 300 | globalFlagBlockAgenda = 1; |
300 | showView(mWhatsNextView, true ); | 301 | showView(mWhatsNextView, true ); |
301 | //mWhatsNextView->updateView(); | 302 | //mWhatsNextView->updateView(); |
302 | 303 | ||
303 | } | 304 | } |
304 | 305 | ||
305 | void KOViewManager::showListView() | 306 | void KOViewManager::showListView() |
306 | { | 307 | { |
307 | if (!mListView) { | 308 | if (!mListView) { |
308 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 309 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
309 | addView(mListView); | 310 | addView(mListView); |
310 | 311 | ||
311 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 312 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
312 | mMainView, SLOT(showIncidence(Incidence *))); | 313 | mMainView, SLOT(showIncidence(Incidence *))); |
313 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 314 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
314 | mMainView, SLOT(editIncidence(Incidence *))); | 315 | mMainView, SLOT(editIncidence(Incidence *))); |
315 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 316 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
316 | mMainView, SLOT(deleteIncidence(Incidence *))); | 317 | mMainView, SLOT(deleteIncidence(Incidence *))); |
317 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 318 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
318 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 319 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
319 | connect( mListView, SIGNAL( signalNewEvent() ), | 320 | connect( mListView, SIGNAL( signalNewEvent() ), |
320 | mMainView, SLOT( newEvent() ) ); | 321 | mMainView, SLOT( newEvent() ) ); |
321 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 322 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
322 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 323 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
323 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 324 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
324 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 325 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
325 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 326 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
326 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 327 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
327 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 328 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
328 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 329 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
329 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 330 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
330 | } | 331 | } |
331 | // bool temp = mFlagShowNextxDays; | 332 | // bool temp = mFlagShowNextxDays; |
332 | //globalFlagBlockPainting = true; | 333 | //globalFlagBlockPainting = true; |
333 | globalFlagBlockAgenda = 1; | 334 | globalFlagBlockAgenda = 1; |
334 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 335 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
335 | mMainView->setBlockShowDates( true ); | 336 | mMainView->setBlockShowDates( true ); |
336 | mMainView->dateNavigator()->selectMonth(); | 337 | mMainView->dateNavigator()->selectMonth(); |
337 | mMainView->setBlockShowDates( false ); | 338 | mMainView->setBlockShowDates( false ); |
338 | } | 339 | } |
339 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 340 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
340 | //mFlagShowNextxDays = temp; | 341 | //mFlagShowNextxDays = temp; |
341 | } | 342 | } |
342 | 343 | ||
343 | void KOViewManager::showAgendaView( bool fullScreen ) | 344 | void KOViewManager::showAgendaView( bool fullScreen ) |
344 | { | 345 | { |
345 | 346 | ||
346 | mMainView->dialogManager()->hideSearchDialog(); | 347 | mMainView->dialogManager()->hideSearchDialog(); |
347 | // qDebug("KOViewManager::showAgendaView "); | 348 | // qDebug("KOViewManager::showAgendaView "); |
348 | bool full; | 349 | bool full; |
349 | full = fullScreen; | 350 | full = fullScreen; |
350 | if (!mAgendaView) { | 351 | if (!mAgendaView) { |
351 | full = false; | 352 | full = false; |
352 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 353 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
353 | addView(mAgendaView); | 354 | addView(mAgendaView); |
354 | #ifndef DESKTOP_VERSION | 355 | #ifndef DESKTOP_VERSION |
355 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 356 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
356 | #endif | 357 | #endif |
357 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 358 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
358 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 359 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
359 | 360 | ||
360 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 361 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
361 | 362 | ||
362 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 363 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
363 | 364 | ||
364 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 365 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
365 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 366 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
366 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 367 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
367 | mMainView, SLOT(newEvent(QDateTime))); | 368 | mMainView, SLOT(newEvent(QDateTime))); |
368 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 369 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
369 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 370 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
370 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 371 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
371 | mMainView, SLOT(newEvent(QDate))); | 372 | mMainView, SLOT(newEvent(QDate))); |
372 | 373 | ||
373 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 374 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
374 | mMainView, SLOT(editIncidence(Incidence *))); | 375 | mMainView, SLOT(editIncidence(Incidence *))); |
375 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 376 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
376 | mMainView, SLOT(showIncidence(Incidence *))); | 377 | mMainView, SLOT(showIncidence(Incidence *))); |
377 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 378 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
378 | mMainView, SLOT(deleteIncidence(Incidence *))); | 379 | mMainView, SLOT(deleteIncidence(Incidence *))); |
379 | 380 | ||
380 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 381 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
381 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 382 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
382 | 383 | ||
383 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 384 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
384 | mMainView, SLOT( toggleExpand() ) ); | 385 | mMainView, SLOT( toggleExpand() ) ); |
385 | 386 | ||
386 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 387 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
387 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 388 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
388 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 389 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
389 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 390 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
390 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 391 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
391 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 392 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
392 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 393 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
393 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 394 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
394 | SLOT( updateTodo( Todo *, int ) ) ); | 395 | SLOT( updateTodo( Todo *, int ) ) ); |
395 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 396 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
396 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 397 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
397 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 398 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
398 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 399 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
399 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 400 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
400 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 401 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
401 | mAgendaView->readSettings(); | 402 | mAgendaView->readSettings(); |
402 | mAgendaView->updateConfig(); | 403 | mAgendaView->updateConfig(); |
403 | } | 404 | } |
404 | 405 | ||
405 | showView( mAgendaView, full); | 406 | showView( mAgendaView, full); |
406 | 407 | ||
407 | } | 408 | } |
408 | 409 | ||
409 | void KOViewManager::showDayView() | 410 | void KOViewManager::showDayView() |
410 | { | 411 | { |
411 | mFlagShowNextxDays = false; | 412 | mFlagShowNextxDays = false; |
412 | globalFlagBlockLabel = 1; | 413 | globalFlagBlockLabel = 1; |
413 | globalFlagBlockAgenda = 1; | 414 | globalFlagBlockAgenda = 1; |
414 | if ( mCurrentAgendaView != 1 ) | 415 | if ( mCurrentAgendaView != 1 ) |
415 | mCurrentAgendaView = -1; | 416 | mCurrentAgendaView = -1; |
416 | showAgendaView(); | 417 | showAgendaView(); |
417 | qApp->processEvents(); | 418 | qApp->processEvents(); |
418 | globalFlagBlockAgenda = 2; | 419 | globalFlagBlockAgenda = 2; |
419 | globalFlagBlockLabel = 0; | 420 | globalFlagBlockLabel = 0; |
420 | mMainView->dateNavigator()->selectDates( 1 ); | 421 | mMainView->dateNavigator()->selectDates( 1 ); |
421 | mCurrentAgendaView = 1 ; | 422 | mCurrentAgendaView = 1 ; |
422 | 423 | ||
423 | } | 424 | } |
424 | 425 | ||
425 | void KOViewManager::showWorkWeekView() | 426 | void KOViewManager::showWorkWeekView() |
426 | { | 427 | { |
427 | mFlagShowNextxDays = false; | 428 | mFlagShowNextxDays = false; |
428 | globalFlagBlockAgenda = 1; | 429 | globalFlagBlockAgenda = 1; |
429 | globalFlagBlockLabel = 1; | 430 | globalFlagBlockLabel = 1; |
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 | } |
627 | return mCurrentView->selectedIncidences().first(); | 624 | return mCurrentView->selectedIncidences().first(); |
628 | } | 625 | } |
629 | 626 | ||
630 | QDate KOViewManager::currentSelectionDate() | 627 | QDate KOViewManager::currentSelectionDate() |
631 | { | 628 | { |
632 | QDate qd; | 629 | QDate qd; |
633 | if (mCurrentView) { | 630 | if (mCurrentView) { |
634 | DateList qvl = mCurrentView->selectedDates(); | 631 | DateList qvl = mCurrentView->selectedDates(); |
635 | if (!qvl.isEmpty()) qd = qvl.first(); | 632 | if (!qvl.isEmpty()) qd = qvl.first(); |
636 | } | 633 | } |
637 | return qd; | 634 | return qd; |
638 | } | 635 | } |
639 | 636 | ||
640 | void KOViewManager::addView(KOrg::BaseView *view) | 637 | void KOViewManager::addView(KOrg::BaseView *view) |
641 | { | 638 | { |
642 | #if QT_VERSION >= 0x030000 | 639 | #if QT_VERSION >= 0x030000 |
643 | mMainView->viewStack()->addWidget( view ); | 640 | mMainView->viewStack()->addWidget( view ); |
644 | #else | 641 | #else |
645 | mMainView->viewStack()->addWidget( view, 1 ); | 642 | mMainView->viewStack()->addWidget( view, 1 ); |
646 | #endif | 643 | #endif |
647 | } | 644 | } |
648 | 645 | ||
649 | void KOViewManager::setDocumentId( const QString &id ) | 646 | void KOViewManager::setDocumentId( const QString &id ) |
650 | { | 647 | { |
651 | if (mTodoView) mTodoView->setDocumentId( id ); | 648 | if (mTodoView) mTodoView->setDocumentId( id ); |
652 | } | 649 | } |