Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koviewmanager.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 35774d6..2cd8792 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -15,633 +15,638 @@ | |||
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 | mMainView->dateNavigator()->selectMonthByDate( date ); | 121 | mMainView->dateNavigator()->selectMonthByDate( date ); |
122 | mMainView->dateNavigator()->selectDate( date ); | 122 | mMainView->dateNavigator()->selectDate( date ); |
123 | mMainView->dateNavigator()->blockSignals( false ); | 123 | mMainView->dateNavigator()->blockSignals( false ); |
124 | showMonthView(); | 124 | showMonthView(); |
125 | } else if (view == 7 ) { | 125 | } else if (view == 7 ) { |
126 | mMainView->dateNavigator()->selectDate( date ); | 126 | mMainView->dateNavigator()->selectDate( date ); |
127 | showJournalView(); | 127 | showJournalView(); |
128 | } else if (view == 8 ) { | 128 | } else if (view == 8 ) { |
129 | globalFlagBlockAgenda = 1; | 129 | globalFlagBlockAgenda = 1; |
130 | if ( mCurrentAgendaView != 3 ) | 130 | if ( mCurrentAgendaView != 3 ) |
131 | mCurrentAgendaView = -1; | 131 | mCurrentAgendaView = -1; |
132 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 132 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
133 | globalFlagBlockAgenda = 2; | 133 | globalFlagBlockAgenda = 2; |
134 | mMainView->dateNavigator()->selectDates( date , | 134 | mMainView->dateNavigator()->selectDates( date , |
135 | KOPrefs::instance()->mNextXDays ); | 135 | KOPrefs::instance()->mNextXDays ); |
136 | mFlagShowNextxDays = true; | 136 | mFlagShowNextxDays = true; |
137 | mCurrentAgendaView = 3 ; | 137 | mCurrentAgendaView = 3 ; |
138 | } | 138 | } |
139 | 139 | ||
140 | #if 0 | 140 | #if 0 |
141 | dateNavigator()->blockSignals( true ); | 141 | dateNavigator()->blockSignals( true ); |
142 | dateNavigator()->selectDate( d ); | 142 | dateNavigator()->selectDate( d ); |
143 | dateNavigator()->blockSignals( false ); | 143 | dateNavigator()->blockSignals( false ); |
144 | mViewManager->showDayView(); | 144 | mViewManager->showDayView(); |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | 150 | ||
151 | void KOViewManager::writeSettings(KConfig *config) | 151 | void KOViewManager::writeSettings(KConfig *config) |
152 | { | 152 | { |
153 | config->setGroup("General"); | 153 | config->setGroup("General"); |
154 | 154 | ||
155 | QString view; | 155 | QString view; |
156 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 156 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
157 | else if (mCurrentView == mMonthView) view = "Month"; | 157 | else if (mCurrentView == mMonthView) view = "Month"; |
158 | else if (mCurrentView == mListView) view = "List"; | 158 | else if (mCurrentView == mListView) view = "List"; |
159 | else if (mCurrentView == mJournalView) view = "Journal"; | 159 | else if (mCurrentView == mJournalView) view = "Journal"; |
160 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 160 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
161 | else if (mCurrentView == mTodoView) view = "Todo"; | 161 | else if (mCurrentView == mTodoView) view = "Todo"; |
162 | else view = "Agenda"; | 162 | else view = "Agenda"; |
163 | 163 | ||
164 | config->writeEntry("Current View",view); | 164 | config->writeEntry("Current View",view); |
165 | 165 | ||
166 | if (mAgendaView) { | 166 | if (mAgendaView) { |
167 | mAgendaView->writeSettings(config); | 167 | mAgendaView->writeSettings(config); |
168 | } | 168 | } |
169 | if (mTimeSpanView) { | 169 | if (mTimeSpanView) { |
170 | mTimeSpanView->writeSettings(config); | 170 | mTimeSpanView->writeSettings(config); |
171 | } | 171 | } |
172 | if (mListView) { | 172 | if (mListView) { |
173 | mListView->writeSettings(config); | 173 | mListView->writeSettings(config); |
174 | } | 174 | } |
175 | if (mTodoView) { | 175 | if (mTodoView) { |
176 | mTodoView->saveLayout(config,"Todo View"); | 176 | mTodoView->saveLayout(config,"Todo View"); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 180 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
181 | { | 181 | { |
182 | 182 | ||
183 | //mFlagShowNextxDays = false; | 183 | //mFlagShowNextxDays = false; |
184 | //if(view == mCurrentView) return; | 184 | //if(view == mCurrentView) return; |
185 | if ( view == 0 ) { | 185 | if ( view == 0 ) { |
186 | view = mCurrentView; | 186 | view = mCurrentView; |
187 | if ( view == 0 ) | 187 | if ( view == 0 ) |
188 | return; | 188 | return; |
189 | } | 189 | } |
190 | bool full = fullScreen; | 190 | bool full = fullScreen; |
191 | if(view == mCurrentView && view != mWhatsNextView ) { | 191 | if(view == mCurrentView && view != mWhatsNextView ) { |
192 | if ( mCurrentAgendaView < 0 ) | 192 | if ( mCurrentAgendaView < 0 ) |
193 | return; | 193 | return; |
194 | full = mMainView->leftFrame()->isVisible(); | 194 | full = mMainView->leftFrame()->isVisible(); |
195 | } else { | 195 | } else { |
196 | mCurrentView = view; | 196 | mCurrentView = view; |
197 | // bool full = fullScreen; | 197 | // bool full = fullScreen; |
198 | bool isFull = !mMainView->leftFrame()->isVisible(); | 198 | bool isFull = !mMainView->leftFrame()->isVisible(); |
199 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 199 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
200 | full = true; | 200 | full = true; |
201 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 201 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
202 | full = false; | 202 | full = false; |
203 | } | 203 | } |
204 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 204 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
205 | //raiseCurrentView( full ); | 205 | //raiseCurrentView( full ); |
206 | mMainView->processIncidenceSelection( 0 ); | 206 | mMainView->processIncidenceSelection( 0 ); |
207 | mMainView->updateView(); | 207 | //mMainView->updateView(); |
208 | raiseCurrentView( full ); | 208 | raiseCurrentView( full, true ); |
209 | mMainView->adaptNavigationUnits(); | 209 | mMainView->adaptNavigationUnits(); |
210 | } | 210 | } |
211 | 211 | ||
212 | void KOViewManager::raiseCurrentView( bool fullScreen ) | 212 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
213 | { | 213 | { |
214 | mCurrentAgendaView = 0; | 214 | mCurrentAgendaView = 0; |
215 | int wid = mMainView->width() ; | 215 | int wid = mMainView->width() ; |
216 | int hei = mMainView->height(); | 216 | int hei = mMainView->height(); |
217 | if ( mCurrentView == mMonthView ) { | 217 | if ( mCurrentView == mMonthView ) { |
218 | mMainView->navigatorBar()->show(); | 218 | mMainView->navigatorBar()->show(); |
219 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 219 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
220 | //mMainView->navigatorBar()->hide(); | 220 | //mMainView->navigatorBar()->hide(); |
221 | } else { | 221 | } else { |
222 | mMainView->navigatorBar()->hide(); | 222 | mMainView->navigatorBar()->hide(); |
223 | } | 223 | } |
224 | if ( fullScreen ) { | 224 | if ( fullScreen ) { |
225 | mMainView->leftFrame()->hide(); | 225 | mMainView->leftFrame()->hide(); |
226 | } else { | 226 | } else { |
227 | mMainView->leftFrame()->show(); | 227 | mMainView->leftFrame()->show(); |
228 | if ( KOPrefs::instance()->mVerticalScreen ) | 228 | if ( KOPrefs::instance()->mVerticalScreen ) |
229 | hei -= mMainView->leftFrame()->height(); | 229 | hei -= mMainView->leftFrame()->height(); |
230 | else | 230 | else |
231 | wid -= mMainView->leftFrame()->width(); | 231 | wid -= mMainView->leftFrame()->width(); |
232 | } | 232 | } |
233 | emit signalFullScreen( !fullScreen ); | 233 | emit signalFullScreen( !fullScreen ); |
234 | if ( callUpdateView ) | ||
235 | mMainView->updateView(); | ||
236 | |||
234 | if ( globalFlagBlockAgenda == 5 ) { | 237 | if ( globalFlagBlockAgenda == 5 ) { |
235 | globalFlagBlockAgenda = 4; | 238 | globalFlagBlockAgenda = 4; |
236 | globalFlagBlockAgendaItemPaint = 1; | 239 | globalFlagBlockAgendaItemPaint = 1; |
237 | } | 240 | } |
238 | mMainView->viewStack()->raiseWidget(mCurrentView); | 241 | mMainView->viewStack()->raiseWidget(mCurrentView); |
239 | if ( globalFlagBlockAgenda == 4 ) { | 242 | if ( globalFlagBlockAgenda == 4 ) { |
240 | if ( mCurrentView == mAgendaView ) { | 243 | if ( mCurrentView == mAgendaView ) { |
241 | //globalFlagBlockAgenda =1 ; | 244 | //globalFlagBlockAgenda =1 ; |
242 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 245 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
243 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 246 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
244 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 247 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
245 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 248 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
246 | qApp->processEvents(); | 249 | qApp->processEvents(); |
247 | //qDebug("qApp->processEvents() "); | 250 | //qDebug("qApp->processEvents() "); |
248 | globalFlagBlockAgenda = 0; | 251 | globalFlagBlockAgenda = 0; |
249 | mAgendaView->repaintAgenda(); | 252 | mAgendaView->repaintAgenda(); |
250 | 253 | ||
251 | } | 254 | } |
252 | globalFlagBlockAgenda = 0; | 255 | globalFlagBlockAgenda = 0; |
253 | } | 256 | } |
254 | emit signalAgendaView( mCurrentView == mAgendaView ); | 257 | emit signalAgendaView( mCurrentView == mAgendaView ); |
255 | //qDebug("raiseCurrentView ende "); | 258 | //qDebug("raiseCurrentView ende "); |
256 | 259 | ||
257 | } | 260 | } |
258 | 261 | ||
259 | void KOViewManager::updateView() | 262 | void KOViewManager::updateView() |
260 | { | 263 | { |
261 | // qDebug("KOViewManager::updateView() "); | 264 | // qDebug("KOViewManager::updateView() "); |
262 | // if we are updating mTodoView, we get endless recursion | 265 | // if we are updating mTodoView, we get endless recursion |
263 | if ( mTodoView == mCurrentView ) | 266 | if ( mTodoView == mCurrentView ) |
264 | return; | 267 | return; |
265 | if ( mCurrentView ) mCurrentView->updateView(); | 268 | if ( mCurrentView ) mCurrentView->updateView(); |
266 | 269 | ||
267 | } | 270 | } |
268 | 271 | ||
269 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 272 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
270 | { | 273 | { |
271 | // kdDebug() << "KOViewManager::updateView()" << endl; | 274 | // kdDebug() << "KOViewManager::updateView()" << endl; |
272 | 275 | ||
273 | if (mCurrentView) mCurrentView->showDates(start, end); | 276 | if (mCurrentView) mCurrentView->showDates(start, end); |
274 | 277 | ||
275 | if (mTodoView) mTodoView->updateView(); | 278 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
276 | } | 279 | } |
277 | 280 | ||
278 | 281 | ||
279 | void KOViewManager::updateWNview() | 282 | void KOViewManager::updateWNview() |
280 | { | 283 | { |
281 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 284 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
282 | mWhatsNextView->updateView(); | 285 | mWhatsNextView->updateView(); |
283 | 286 | ||
284 | } | 287 | } |
285 | void KOViewManager::showWhatsNextView() | 288 | void KOViewManager::showWhatsNextView() |
286 | { | 289 | { |
287 | if (!mWhatsNextView) { | 290 | if (!mWhatsNextView) { |
288 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 291 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
289 | "KOViewManager::WhatsNextView"); | 292 | "KOViewManager::WhatsNextView"); |
290 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 293 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
291 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 294 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
292 | addView(mWhatsNextView); | 295 | addView(mWhatsNextView); |
293 | connect(this, SIGNAL( printWNV() ), | 296 | connect(this, SIGNAL( printWNV() ), |
294 | mWhatsNextView, SLOT( printMe() ) ); | 297 | mWhatsNextView, SLOT( printMe() ) ); |
295 | } | 298 | } |
296 | globalFlagBlockAgenda = 1; | 299 | globalFlagBlockAgenda = 1; |
297 | showView(mWhatsNextView, true ); | 300 | showView(mWhatsNextView, true ); |
298 | //mWhatsNextView->updateView(); | 301 | //mWhatsNextView->updateView(); |
299 | 302 | ||
300 | } | 303 | } |
301 | 304 | ||
302 | void KOViewManager::showListView() | 305 | void KOViewManager::showListView() |
303 | { | 306 | { |
304 | if (!mListView) { | 307 | if (!mListView) { |
305 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 308 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
306 | addView(mListView); | 309 | addView(mListView); |
307 | 310 | ||
308 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 311 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
309 | mMainView, SLOT(showIncidence(Incidence *))); | 312 | mMainView, SLOT(showIncidence(Incidence *))); |
310 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 313 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
311 | mMainView, SLOT(editIncidence(Incidence *))); | 314 | mMainView, SLOT(editIncidence(Incidence *))); |
312 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 315 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
313 | mMainView, SLOT(deleteIncidence(Incidence *))); | 316 | mMainView, SLOT(deleteIncidence(Incidence *))); |
314 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 317 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
315 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 318 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
316 | connect( mListView, SIGNAL( signalNewEvent() ), | 319 | connect( mListView, SIGNAL( signalNewEvent() ), |
317 | mMainView, SLOT( newEvent() ) ); | 320 | mMainView, SLOT( newEvent() ) ); |
318 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 321 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
319 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 322 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
320 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 323 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
321 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 324 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
322 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 325 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
323 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 326 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
324 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 327 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
325 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 328 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
326 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 329 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
327 | } | 330 | } |
328 | // bool temp = mFlagShowNextxDays; | 331 | // bool temp = mFlagShowNextxDays; |
329 | //globalFlagBlockPainting = true; | 332 | //globalFlagBlockPainting = true; |
330 | globalFlagBlockAgenda = 1; | 333 | globalFlagBlockAgenda = 1; |
331 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 334 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
332 | mMainView->setBlockShowDates( true ); | 335 | mMainView->setBlockShowDates( true ); |
333 | mMainView->dateNavigator()->selectMonth(); | 336 | mMainView->dateNavigator()->selectMonth(); |
334 | mMainView->setBlockShowDates( false ); | 337 | mMainView->setBlockShowDates( false ); |
335 | } | 338 | } |
336 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 339 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
337 | //mFlagShowNextxDays = temp; | 340 | //mFlagShowNextxDays = temp; |
338 | } | 341 | } |
339 | 342 | ||
340 | void KOViewManager::showAgendaView( bool fullScreen ) | 343 | void KOViewManager::showAgendaView( bool fullScreen ) |
341 | { | 344 | { |
342 | 345 | ||
343 | mMainView->dialogManager()->hideSearchDialog(); | 346 | mMainView->dialogManager()->hideSearchDialog(); |
344 | // qDebug("KOViewManager::showAgendaView "); | 347 | // qDebug("KOViewManager::showAgendaView "); |
345 | bool full; | 348 | bool full; |
346 | full = fullScreen; | 349 | full = fullScreen; |
347 | if (!mAgendaView) { | 350 | if (!mAgendaView) { |
348 | full = false; | 351 | full = false; |
349 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 352 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
350 | addView(mAgendaView); | 353 | addView(mAgendaView); |
351 | #ifndef DESKTOP_VERSION | 354 | #ifndef DESKTOP_VERSION |
352 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 355 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
353 | #endif | 356 | #endif |
354 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 357 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
355 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 358 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
356 | 359 | ||
357 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 360 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
358 | 361 | ||
359 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 362 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
360 | 363 | ||
361 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 364 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
362 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 365 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
363 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 366 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
364 | mMainView, SLOT(newEvent(QDateTime))); | 367 | mMainView, SLOT(newEvent(QDateTime))); |
365 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 368 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
366 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 369 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
367 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 370 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
368 | mMainView, SLOT(newEvent(QDate))); | 371 | mMainView, SLOT(newEvent(QDate))); |
369 | 372 | ||
370 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 373 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
371 | mMainView, SLOT(editIncidence(Incidence *))); | 374 | mMainView, SLOT(editIncidence(Incidence *))); |
372 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 375 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
373 | mMainView, SLOT(showIncidence(Incidence *))); | 376 | mMainView, SLOT(showIncidence(Incidence *))); |
374 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 377 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
375 | mMainView, SLOT(deleteIncidence(Incidence *))); | 378 | mMainView, SLOT(deleteIncidence(Incidence *))); |
376 | 379 | ||
377 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 380 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
378 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 381 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
379 | 382 | ||
380 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 383 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
381 | mMainView, SLOT( toggleExpand() ) ); | 384 | mMainView, SLOT( toggleExpand() ) ); |
382 | 385 | ||
383 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 386 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
384 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 387 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
385 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 388 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
386 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 389 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
387 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 390 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
388 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 391 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
389 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 392 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
390 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 393 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
391 | SLOT( updateTodo( Todo *, int ) ) ); | 394 | SLOT( updateTodo( Todo *, int ) ) ); |
392 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 395 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
393 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 396 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
394 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 397 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
395 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 398 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
396 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 399 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
397 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 400 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
398 | mAgendaView->readSettings(); | 401 | mAgendaView->readSettings(); |
399 | mAgendaView->updateConfig(); | 402 | mAgendaView->updateConfig(); |
400 | } | 403 | } |
401 | 404 | ||
402 | showView( mAgendaView, full); | 405 | showView( mAgendaView, full); |
403 | 406 | ||
404 | } | 407 | } |
405 | 408 | ||
406 | void KOViewManager::showDayView() | 409 | void KOViewManager::showDayView() |
407 | { | 410 | { |
408 | mFlagShowNextxDays = false; | 411 | mFlagShowNextxDays = false; |
409 | globalFlagBlockLabel = 1; | 412 | globalFlagBlockLabel = 1; |
410 | globalFlagBlockAgenda = 1; | 413 | globalFlagBlockAgenda = 1; |
411 | if ( mCurrentAgendaView != 1 ) | 414 | if ( mCurrentAgendaView != 1 ) |
412 | mCurrentAgendaView = -1; | 415 | mCurrentAgendaView = -1; |
413 | showAgendaView(); | 416 | showAgendaView(); |
414 | qApp->processEvents(); | 417 | qApp->processEvents(); |
415 | globalFlagBlockAgenda = 2; | 418 | globalFlagBlockAgenda = 2; |
416 | globalFlagBlockLabel = 0; | 419 | globalFlagBlockLabel = 0; |
417 | mMainView->dateNavigator()->selectDates( 1 ); | 420 | mMainView->dateNavigator()->selectDates( 1 ); |
418 | mCurrentAgendaView = 1 ; | 421 | mCurrentAgendaView = 1 ; |
419 | 422 | ||
420 | } | 423 | } |
421 | 424 | ||
422 | void KOViewManager::showWorkWeekView() | 425 | void KOViewManager::showWorkWeekView() |
423 | { | 426 | { |
424 | mFlagShowNextxDays = false; | 427 | mFlagShowNextxDays = false; |
425 | globalFlagBlockAgenda = 1; | 428 | globalFlagBlockAgenda = 1; |
426 | globalFlagBlockLabel = 1; | 429 | globalFlagBlockLabel = 1; |
427 | if ( mCurrentAgendaView != 5 ) | 430 | if ( mCurrentAgendaView != 5 ) |
428 | mCurrentAgendaView = -1; | 431 | mCurrentAgendaView = -1; |
429 | showAgendaView(); | 432 | showAgendaView(); |
430 | qApp->processEvents(); | 433 | qApp->processEvents(); |
431 | globalFlagBlockAgenda = 2; | 434 | globalFlagBlockAgenda = 2; |
432 | globalFlagBlockLabel = 0; | 435 | globalFlagBlockLabel = 0; |
433 | mMainView->dateNavigator()->selectWorkWeek(); | 436 | mMainView->dateNavigator()->selectWorkWeek(); |
434 | mCurrentAgendaView = 5 ; | 437 | mCurrentAgendaView = 5 ; |
435 | 438 | ||
436 | } | 439 | } |
437 | 440 | ||
438 | void KOViewManager::showWeekView() | 441 | void KOViewManager::showWeekView() |
439 | { | 442 | { |
440 | /* | 443 | /* |
441 | globalFlagBlockAgenda = 2; | 444 | globalFlagBlockAgenda = 2; |
442 | qDebug("4globalFlagBlockAgenda = 2; "); | 445 | qDebug("4globalFlagBlockAgenda = 2; "); |
443 | //globalFlagBlockPainting = true; | 446 | //globalFlagBlockPainting = true; |
444 | mMainView->dateNavigator()->selectWeek(); | 447 | mMainView->dateNavigator()->selectWeek(); |
445 | showAgendaView(); | 448 | showAgendaView(); |
446 | */ | 449 | */ |
447 | 450 | ||
448 | 451 | ||
449 | mFlagShowNextxDays = false; | 452 | mFlagShowNextxDays = false; |
450 | globalFlagBlockAgenda = 1; | 453 | globalFlagBlockAgenda = 1; |
451 | globalFlagBlockLabel = 1; | 454 | globalFlagBlockLabel = 1; |
452 | if ( mCurrentAgendaView != 7 ) | 455 | if ( mCurrentAgendaView != 7 ) |
453 | mCurrentAgendaView = -1; | 456 | mCurrentAgendaView = -1; |
454 | showAgendaView(); | 457 | showAgendaView(); |
455 | qApp->processEvents(); | 458 | qApp->processEvents(); |
456 | globalFlagBlockAgenda = 2; | 459 | globalFlagBlockAgenda = 2; |
457 | globalFlagBlockLabel = 0; | 460 | globalFlagBlockLabel = 0; |
458 | mMainView->dateNavigator()->selectWeek(); | 461 | mMainView->dateNavigator()->selectWeek(); |
459 | mCurrentAgendaView = 7 ; | 462 | mCurrentAgendaView = 7 ; |
460 | } | 463 | } |
461 | 464 | ||
462 | void KOViewManager::showNextXView() | 465 | void KOViewManager::showNextXView() |
463 | { | 466 | { |
464 | 467 | ||
465 | globalFlagBlockAgenda = 1; | 468 | globalFlagBlockAgenda = 1; |
466 | if ( mCurrentAgendaView != 3 ) | 469 | if ( mCurrentAgendaView != 3 ) |
467 | mCurrentAgendaView = -1; | 470 | mCurrentAgendaView = -1; |
468 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 471 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
469 | globalFlagBlockAgenda = 2; | 472 | globalFlagBlockAgenda = 2; |
470 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 473 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
471 | KOPrefs::instance()->mNextXDays ); | 474 | KOPrefs::instance()->mNextXDays ); |
472 | mFlagShowNextxDays = true; | 475 | mFlagShowNextxDays = true; |
473 | mCurrentAgendaView = 3 ; | 476 | mCurrentAgendaView = 3 ; |
474 | } | 477 | } |
475 | bool KOViewManager::showsNextDays() | 478 | bool KOViewManager::showsNextDays() |
476 | { | 479 | { |
477 | return mFlagShowNextxDays; | 480 | return mFlagShowNextxDays; |
478 | } | 481 | } |
479 | void KOViewManager::showMonthView() | 482 | void KOViewManager::showMonthView() |
480 | { | 483 | { |
481 | if (!mMonthView) { | 484 | if (!mMonthView) { |
482 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 485 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
483 | 486 | ||
484 | addView(mMonthView); | 487 | addView(mMonthView); |
485 | // mMonthView->show(); | 488 | // mMonthView->show(); |
486 | // SIGNALS/SLOTS FOR MONTH VIEW | 489 | // SIGNALS/SLOTS FOR MONTH VIEW |
487 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 490 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
488 | mMainView, SLOT(newEvent(QDateTime))); | 491 | mMainView, SLOT(newEvent(QDateTime))); |
489 | 492 | ||
490 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 493 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
491 | mMainView, SLOT(showIncidence(Incidence *))); | 494 | mMainView, SLOT(showIncidence(Incidence *))); |
492 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 495 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
493 | mMainView, SLOT(editIncidence(Incidence *))); | 496 | mMainView, SLOT(editIncidence(Incidence *))); |
494 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 497 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
495 | mMainView, SLOT(deleteIncidence(Incidence *))); | 498 | mMainView, SLOT(deleteIncidence(Incidence *))); |
496 | 499 | ||
497 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 500 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
498 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 501 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
499 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 502 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
500 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 503 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
501 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 504 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
502 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 505 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
503 | 506 | ||
504 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 507 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
505 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 508 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
506 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 509 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
507 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 510 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
508 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 511 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
509 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 512 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
510 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 513 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
511 | mMainView, SLOT ( showDay( QDate ) ) ); | 514 | mMainView, SLOT ( showDay( QDate ) ) ); |
512 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 515 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
513 | connect( mMonthView, SIGNAL(nextMonth() ), | 516 | connect( mMonthView, SIGNAL(nextMonth() ), |
514 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 517 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
515 | connect( mMonthView, SIGNAL(prevMonth() ), | 518 | connect( mMonthView, SIGNAL(prevMonth() ), |
516 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 519 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
517 | mMonthView->updateConfig(); | 520 | mMonthView->updateConfig(); |
518 | } | 521 | } |
519 | 522 | ||
520 | globalFlagBlockAgenda = 1; | 523 | globalFlagBlockAgenda = 1; |
521 | //mFlagShowNextxDays = false; | 524 | //mFlagShowNextxDays = false; |
522 | // if(mMonthView == mCurrentView) return; | 525 | // if(mMonthView == mCurrentView) return; |
526 | mMainView->dateNavigator()->blockSignals( true ); | ||
523 | mMainView->dateNavigator()->selectMonth(); | 527 | mMainView->dateNavigator()->selectMonth(); |
528 | mMainView->dateNavigator()->blockSignals( false); | ||
524 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); | 529 | // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); |
525 | //mMonthView->showDates(tmpList.first(), tmpList.last()); | 530 | //mMonthView->showDates(tmpList.first(), tmpList.last()); |
526 | 531 | ||
527 | showView(mMonthView, true ); | 532 | showView(mMonthView, true ); |
528 | 533 | ||
529 | } | 534 | } |
530 | 535 | ||
531 | void KOViewManager::showTodoView() | 536 | void KOViewManager::showTodoView() |
532 | { | 537 | { |
533 | //mFlagShowNextxDays = false; | 538 | //mFlagShowNextxDays = false; |
534 | if ( !mTodoView ) { | 539 | if ( !mTodoView ) { |
535 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 540 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
536 | "KOViewManager::TodoView" ); | 541 | "KOViewManager::TodoView" ); |
537 | 542 | ||
538 | addView( mTodoView ); | 543 | addView( mTodoView ); |
539 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 544 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
540 | 545 | ||
541 | // SIGNALS/SLOTS FOR TODO VIEW | 546 | // SIGNALS/SLOTS FOR TODO VIEW |
542 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 547 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
543 | mMainView, SLOT( newTodo() ) ); | 548 | mMainView, SLOT( newTodo() ) ); |
544 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 549 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
545 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 550 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
546 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 551 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
547 | mMainView, SLOT( showTodo( Todo * ) ) ); | 552 | mMainView, SLOT( showTodo( Todo * ) ) ); |
548 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 553 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
549 | mMainView, SLOT( editTodo( Todo * ) ) ); | 554 | mMainView, SLOT( editTodo( Todo * ) ) ); |
550 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 555 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
551 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 556 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
552 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 557 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
553 | mMainView, SLOT( purgeCompleted() ) ); | 558 | mMainView, SLOT( purgeCompleted() ) ); |
554 | 559 | ||
555 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 560 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
556 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 561 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
557 | 562 | ||
558 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 563 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
559 | SLOT( updateConfig() ) ); | 564 | SLOT( updateConfig() ) ); |
560 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 565 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
561 | SLOT( updateTodo( Todo *, int ) ) ); | 566 | SLOT( updateTodo( Todo *, int ) ) ); |
562 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 567 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
563 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 568 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
564 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 569 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
565 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 570 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
566 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 571 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
567 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 572 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
568 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 573 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
569 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 574 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
570 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 575 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
571 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 576 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
572 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 577 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
573 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 578 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
574 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 579 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
575 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 580 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
576 | KConfig *config = KOGlobals::config(); | 581 | KConfig *config = KOGlobals::config(); |
577 | mTodoView->restoreLayout(config,"Todo View"); | 582 | mTodoView->restoreLayout(config,"Todo View"); |
578 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 583 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
579 | } | 584 | } |
580 | 585 | ||
581 | globalFlagBlockAgenda = 1; | 586 | globalFlagBlockAgenda = 1; |
582 | showView( mTodoView, true ); | 587 | showView( mTodoView, true ); |
583 | 588 | ||
584 | } | 589 | } |
585 | 590 | ||
586 | void KOViewManager::showJournalView() | 591 | void KOViewManager::showJournalView() |
587 | { | 592 | { |
588 | //mFlagShowNextxDays = false; | 593 | //mFlagShowNextxDays = false; |
589 | if (!mJournalView) { | 594 | if (!mJournalView) { |
590 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 595 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
591 | "KOViewManager::JournalView"); | 596 | "KOViewManager::JournalView"); |
592 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 597 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
593 | SLOT( updateConfig() ) ); | 598 | SLOT( updateConfig() ) ); |
594 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 599 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
595 | addView(mJournalView); | 600 | addView(mJournalView); |
596 | } | 601 | } |
597 | 602 | ||
598 | showView(mJournalView); | 603 | showView(mJournalView); |
599 | } | 604 | } |
600 | 605 | ||
601 | void KOViewManager::showTimeSpanView() | 606 | void KOViewManager::showTimeSpanView() |
602 | { | 607 | { |
603 | //mFlagShowNextxDays = false; | 608 | //mFlagShowNextxDays = false; |
604 | if (!mTimeSpanView) { | 609 | if (!mTimeSpanView) { |
605 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 610 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
606 | "KOViewManager::TimeSpanView"); | 611 | "KOViewManager::TimeSpanView"); |
607 | addView(mTimeSpanView); | 612 | addView(mTimeSpanView); |
608 | 613 | ||
609 | mTimeSpanView->readSettings(); | 614 | mTimeSpanView->readSettings(); |
610 | } | 615 | } |
611 | 616 | ||
612 | showView(mTimeSpanView); | 617 | showView(mTimeSpanView); |
613 | } | 618 | } |
614 | 619 | ||
615 | Incidence *KOViewManager::currentSelection() | 620 | Incidence *KOViewManager::currentSelection() |
616 | { | 621 | { |
617 | if (!mCurrentView) return 0; | 622 | if (!mCurrentView) return 0; |
618 | if ( mCurrentView == mListView ) { | 623 | if ( mCurrentView == mListView ) { |
619 | if ( mListView->currentItem() ) | 624 | if ( mListView->currentItem() ) |
620 | return mListView->currentItem(); | 625 | return mListView->currentItem(); |
621 | } | 626 | } |
622 | return mCurrentView->selectedIncidences().first(); | 627 | return mCurrentView->selectedIncidences().first(); |
623 | } | 628 | } |
624 | 629 | ||
625 | QDate KOViewManager::currentSelectionDate() | 630 | QDate KOViewManager::currentSelectionDate() |
626 | { | 631 | { |
627 | QDate qd; | 632 | QDate qd; |
628 | if (mCurrentView) { | 633 | if (mCurrentView) { |
629 | DateList qvl = mCurrentView->selectedDates(); | 634 | DateList qvl = mCurrentView->selectedDates(); |
630 | if (!qvl.isEmpty()) qd = qvl.first(); | 635 | if (!qvl.isEmpty()) qd = qvl.first(); |
631 | } | 636 | } |
632 | return qd; | 637 | return qd; |
633 | } | 638 | } |
634 | 639 | ||
635 | void KOViewManager::addView(KOrg::BaseView *view) | 640 | void KOViewManager::addView(KOrg::BaseView *view) |
636 | { | 641 | { |
637 | #if QT_VERSION >= 0x030000 | 642 | #if QT_VERSION >= 0x030000 |
638 | mMainView->viewStack()->addWidget( view ); | 643 | mMainView->viewStack()->addWidget( view ); |
639 | #else | 644 | #else |
640 | mMainView->viewStack()->addWidget( view, 1 ); | 645 | mMainView->viewStack()->addWidget( view, 1 ); |
641 | #endif | 646 | #endif |
642 | } | 647 | } |
643 | 648 | ||
644 | void KOViewManager::setDocumentId( const QString &id ) | 649 | void KOViewManager::setDocumentId( const QString &id ) |
645 | { | 650 | { |
646 | if (mTodoView) mTodoView->setDocumentId( id ); | 651 | if (mTodoView) mTodoView->setDocumentId( id ); |
647 | } | 652 | } |