summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 8752636..53cd011 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,799 +1,799 @@
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;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::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
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") { 91 else if (view == "Month") {
92 if ( !KOPrefs::instance()->mMonthViewWeek ) 92 if ( !KOPrefs::instance()->mMonthViewWeek )
93 showMonthView(); 93 showMonthView();
94 else 94 else
95 showMonthViewWeek(); 95 showMonthViewWeek();
96 } 96 }
97 else if (view == "List") showListView(); 97 else if (view == "List") showListView();
98 else if (view == "Journal") showJournalView(); 98 else if (view == "Journal") showJournalView();
99 else if (view == "TimeSpan") showTimeSpanView(); 99 else if (view == "TimeSpan") showTimeSpanView();
100 else if (view == "Todo") showTodoView(); 100 else if (view == "Todo") showTodoView();
101 else { 101 else {
102 config->setGroup( "Views" ); 102 config->setGroup( "Views" );
103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
104 mCurrentAgendaView = dateCount; 104 mCurrentAgendaView = dateCount;
105 showAgendaView(); 105 showAgendaView();
106 mCurrentAgendaView = dateCount; 106 mCurrentAgendaView = dateCount;
107#ifdef DESKTOP_VERSION 107#ifdef DESKTOP_VERSION
108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
109#endif 109#endif
110 } 110 }
111} 111}
112 112
113void KOViewManager::showDateView( int view, QDate date) 113void KOViewManager::showDateView( int view, QDate date)
114{ 114{
115 static int lastMode = 0; 115 static int lastMode = 0;
116 static int lastCount = 0; 116 static int lastCount = 0;
117 static bool lastNDMode = false; 117 static bool lastNDMode = false;
118 static QDate lastDate; 118 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
120 120
121 if (view != 9) 121 if (view != 9)
122 lastMode = 0; 122 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 126 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ; 133 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 134 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 137 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 140 } else if (view == 6 ) {
141 //mMainView->dateNavigator()->selectDates( date, 7 ); 141 //mMainView->dateNavigator()->selectDates( date, 7 );
142 showMonthView(); 142 showMonthView();
143 } else if (view == 7 ) { 143 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 145 showJournalView();
146 } else if (view == 8 ) { 146 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 157 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
161 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
162 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
163 } 163 }
164 } else 164 } else
165 showWeekView(); 165 showWeekView();
166 } else if (view == 10) { 166 } else if (view == 10) {
167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
168 } 168 }
169} 169}
170 170
171 171
172 172
173void KOViewManager::writeSettings(KConfig *config) 173void KOViewManager::writeSettings(KConfig *config)
174{ 174{
175 config->setGroup("General"); 175 config->setGroup("General");
176 176
177 QString view; 177 QString view;
178 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 178 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
179 else if (mCurrentView == mMonthView) view = "Month"; 179 else if (mCurrentView == mMonthView) view = "Month";
180 else if (mCurrentView == mListView) view = "List"; 180 else if (mCurrentView == mListView) view = "List";
181 else if (mCurrentView == mJournalView) view = "Journal"; 181 else if (mCurrentView == mJournalView) view = "Journal";
182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
183 else if (mCurrentView == mTodoView) view = "Todo"; 183 else if (mCurrentView == mTodoView) view = "Todo";
184 else view = "Agenda"; 184 else view = "Agenda";
185 185
186 config->writeEntry("Current View",view); 186 config->writeEntry("Current View",view);
187 187
188 if (mAgendaView) { 188 if (mAgendaView) {
189 mAgendaView->writeSettings(config); 189 mAgendaView->writeSettings(config);
190 } 190 }
191 if (mTimeSpanView) { 191 if (mTimeSpanView) {
192 mTimeSpanView->writeSettings(config); 192 mTimeSpanView->writeSettings(config);
193 } 193 }
194 if (mListView) { 194 if (mListView) {
195 mListView->writeSettings(config); 195 mListView->writeSettings(config);
196 } 196 }
197 if (mTodoView) { 197 if (mTodoView) {
198 mTodoView->saveLayout(config,"Todo View"); 198 mTodoView->saveLayout(config,"Todo View");
199 } 199 }
200} 200}
201void KOViewManager::showNextView() 201void KOViewManager::showNextView()
202{ 202{
203 if (mCurrentView == mWhatsNextView) goto NEXT_X; 203 if (mCurrentView == mWhatsNextView) goto NEXT_X;
204 204
205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
206 206
207 if (mCurrentView == mJournalView ) goto DAY_1; 207 if (mCurrentView == mJournalView ) goto DAY_1;
208 208
209 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 209 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
210 210
211 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 211 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
212 212
213 if (mCurrentView == mAgendaView ) goto DAY_6; 213 if (mCurrentView == mAgendaView ) goto DAY_6;
214 214
215 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 215 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
216 216
217 if (mCurrentView == mMonthView ) goto LIST; 217 if (mCurrentView == mMonthView ) goto LIST;
218 218
219 if (mCurrentView == mListView ) goto TODO; 219 if (mCurrentView == mListView ) goto TODO;
220 220
221 // if (mCurrentView == mTodoView ) goto LIST; 221 // if (mCurrentView == mTodoView ) goto LIST;
222 222
223 223
224 NEXT: 224 NEXT:
225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;}
226 NEXT_X: 226 NEXT_X:
227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;}
228 JOURNAL: 228 JOURNAL:
229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
230 DAY_1: 230 DAY_1:
231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;}
232 DAY_5: 232 DAY_5:
233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;}
234 DAY_7: 234 DAY_7:
235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;}
236 DAY_6: 236 DAY_6:
237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;}
238 MONTH: 238 MONTH:
239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;}
240 LIST: 240 LIST:
241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
242 TODO: 242 TODO:
243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;}
244 244
245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;}
246 246
247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;}
248 248
249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
250 250
251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;}
252 252
253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;}
254 254
255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;}
256 256
257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;}
258 258
259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;}
260 260
261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
262 262
263 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 263 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;}
264 264
265 265
266 266
267} 267}
268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
269{ 269{
270 270
271 //mFlagShowNextxDays = false; 271 //mFlagShowNextxDays = false;
272 //if(view == mCurrentView) return; 272 //if(view == mCurrentView) return;
273 if ( view == 0 ) { 273 if ( view == 0 ) {
274 view = mCurrentView; 274 view = mCurrentView;
275 if ( view == 0 ) 275 if ( view == 0 )
276 return; 276 return;
277 } 277 }
278 bool callupdate = !(view == mCurrentView); 278 bool callupdate = !(view == mCurrentView);
279 bool full = fullScreen; 279 bool full = fullScreen;
280 if(view == mCurrentView && view != mWhatsNextView ) { 280 if(view == mCurrentView && view != mWhatsNextView ) {
281 if ( mCurrentAgendaView < 0 ) 281 if ( mCurrentAgendaView < 0 )
282 return; 282 return;
283 if ( view != mMonthView ) 283 if ( view != mMonthView )
284 full = mMainView->leftFrame()->isVisible(); 284 full = mMainView->leftFrame()->isVisible();
285 } else { 285 } else {
286 if ( view == mMonthView && mMonthView) 286 if ( view == mMonthView && mMonthView)
287 ;//mMonthView->skipResize = true ; 287 ;//mMonthView->skipResize = true ;
288 mCurrentView = view; 288 mCurrentView = view;
289 // bool full = fullScreen; 289 // bool full = fullScreen;
290 bool isFull = !mMainView->leftFrame()->isVisible(); 290 bool isFull = !mMainView->leftFrame()->isVisible();
291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
292 full = true; 292 full = true;
293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
294 full = false; 294 full = false;
295 } 295 }
296 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 296 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
297 //raiseCurrentView( full ); 297 //raiseCurrentView( full );
298 mMainView->processIncidenceSelection( 0 ); 298 mMainView->processIncidenceSelection( 0 );
299 //mMainView->updateView(); 299 //mMainView->updateView();
300 raiseCurrentView( full, callupdate ); 300 raiseCurrentView( full, callupdate );
301 mMainView->adaptNavigationUnits(); 301 mMainView->adaptNavigationUnits();
302} 302}
303 303
304void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 304void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
305{ 305{
306 mCurrentAgendaView = 0; 306 mCurrentAgendaView = 0;
307 if ( fullScreen ) { 307 if ( fullScreen ) {
308 mMainView->leftFrame()->hide(); 308 mMainView->leftFrame()->hide();
309 } else { 309 } else {
310 mMainView->leftFrame()->show(); 310 mMainView->leftFrame()->show();
311 } 311 }
312 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 312 //if ( mCurrentView == mMonthView ) qApp->processEvents();
313 emit signalFullScreen( !fullScreen ); 313 emit signalFullScreen( !fullScreen );
314 if ( callUpdateView ) 314 if ( callUpdateView )
315 mMainView->updateView(); 315 mMainView->updateView();
316 316
317 if ( globalFlagBlockAgenda == 5 ) { 317 if ( globalFlagBlockAgenda == 5 ) {
318 globalFlagBlockAgenda = 4; 318 globalFlagBlockAgenda = 4;
319 globalFlagBlockAgendaItemPaint = 1; 319 globalFlagBlockAgendaItemPaint = 1;
320 } 320 }
321 mMainView->viewStack()->raiseWidget(mCurrentView); 321 mMainView->viewStack()->raiseWidget(mCurrentView);
322 if ( globalFlagBlockAgenda == 4 ) { 322 if ( globalFlagBlockAgenda == 4 ) {
323 if ( mCurrentView == mAgendaView ) { 323 if ( mCurrentView == mAgendaView ) {
324 //globalFlagBlockAgenda =1 ; 324 //globalFlagBlockAgenda =1 ;
325 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 325 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
326 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 326 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
327 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 327 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
328 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 328 mAgendaView->setStartHour( QTime::currentTime ().hour() );
329 qApp->processEvents(); 329 qApp->processEvents();
330 //qDebug("qApp->processEvents() "); 330 //qDebug("qApp->processEvents() ");
331 globalFlagBlockAgenda = 0; 331 globalFlagBlockAgenda = 0;
332 mAgendaView->repaintAgenda(); 332 mAgendaView->repaintAgenda();
333 333
334 } 334 }
335 globalFlagBlockAgenda = 0; 335 globalFlagBlockAgenda = 0;
336 } 336 }
337 emit signalAgendaView( mCurrentView == mAgendaView ); 337 emit signalAgendaView( mCurrentView == mAgendaView );
338 //qDebug("raiseCurrentView ende "); 338 //qDebug("raiseCurrentView ende ");
339 339
340} 340}
341 341
342void KOViewManager::updateView() 342void KOViewManager::updateView()
343{ 343{
344 // qDebug("KOViewManager::updateView() "); 344 // qDebug("KOViewManager::updateView() ");
345 // if we are updating mTodoView, we get endless recursion 345 // if we are updating mTodoView, we get endless recursion
346 if ( mTodoView == mCurrentView ) 346 if ( mTodoView == mCurrentView )
347 return; 347 return;
348 if ( mCurrentView ) mCurrentView->updateView(); 348 if ( mCurrentView ) mCurrentView->updateView();
349 349
350} 350}
351 351
352void KOViewManager::updateView(const QDate &start, const QDate &end) 352void KOViewManager::updateView(const QDate &start, const QDate &end)
353{ 353{
354 // kdDebug() << "KOViewManager::updateView()" << endl; 354 // kdDebug() << "KOViewManager::updateView()" << endl;
355 355
356 if (mCurrentView) mCurrentView->showDates(start, end); 356 if (mCurrentView) mCurrentView->showDates(start, end);
357 357
358 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 358 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
359} 359}
360 360
361 361
362void KOViewManager::updateWNview() 362void KOViewManager::updateWNview()
363{ 363{
364 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 364 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
365 mWhatsNextView->updateView(); 365 mWhatsNextView->updateView();
366 366
367} 367}
368void KOViewManager::showWhatsNextView() 368void KOViewManager::showWhatsNextView()
369{ 369{
370 if (!mWhatsNextView) { 370 if (!mWhatsNextView) {
371 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 371 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
372 "KOViewManager::WhatsNextView"); 372 "KOViewManager::WhatsNextView");
373 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 373 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
374 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 374 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
375 addView(mWhatsNextView); 375 addView(mWhatsNextView);
376 connect(this, SIGNAL( printWNV() ), 376 connect(this, SIGNAL( printWNV() ),
377 mWhatsNextView, SLOT( printMe() ) ); 377 mWhatsNextView, SLOT( printMe() ) );
378 } 378 }
379 globalFlagBlockAgenda = 1; 379 globalFlagBlockAgenda = 1;
380 showView(mWhatsNextView, true ); 380 showView(mWhatsNextView, true );
381 //mWhatsNextView->updateView(); 381 //mWhatsNextView->updateView();
382 382
383} 383}
384 384
385void KOViewManager::slotprintWNV() 385void KOViewManager::slotprintWNV()
386{ 386{
387 if (!mWhatsNextView) 387 if (!mWhatsNextView)
388 showWhatsNextView(); 388 showWhatsNextView();
389 emit printWNV(); 389 emit printWNV();
390 390
391} 391}
392void KOViewManager::showListView() 392void KOViewManager::showListView()
393{ 393{
394 if (!mListView) { 394 if (!mListView) {
395 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 395 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
396 addView(mListView); 396 addView(mListView);
397 397
398 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 398 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
399 mMainView, SLOT(showIncidence(Incidence *))); 399 mMainView, SLOT(showIncidence(Incidence *)));
400 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 400 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
401 mMainView, SLOT(editIncidence(Incidence *))); 401 mMainView, SLOT(editIncidence(Incidence *)));
402 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 402 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
403 mMainView, SLOT(deleteIncidence(Incidence *))); 403 mMainView, SLOT(deleteIncidence(Incidence *)));
404 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 404 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
405 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 405 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
406 connect( mListView, SIGNAL( signalNewEvent() ), 406 connect( mListView, SIGNAL( signalNewEvent() ),
407 mMainView, SLOT( newEvent() ) ); 407 mMainView, SLOT( newEvent() ) );
408 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 408 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
409 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 409 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
410 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 410 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 411 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
412 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 412 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
413 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 413 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
414 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 414 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
415 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 415 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
416 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 416 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
417 } 417 }
418 // bool temp = mFlagShowNextxDays; 418 // bool temp = mFlagShowNextxDays;
419 //globalFlagBlockPainting = true; 419 //globalFlagBlockPainting = true;
420 globalFlagBlockAgenda = 1; 420 globalFlagBlockAgenda = 1;
421 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 421 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
422 mMainView->setBlockShowDates( true ); 422 mMainView->setBlockShowDates( true );
423 mMainView->dateNavigator()->selectMonth(); 423 mMainView->dateNavigator()->selectMonth();
424 mMainView->setBlockShowDates( false ); 424 mMainView->setBlockShowDates( false );
425 } 425 }
426 showView(mListView, KOPrefs::instance()->mFullViewTodo); 426 showView(mListView, KOPrefs::instance()->mFullViewTodo);
427 //mFlagShowNextxDays = temp; 427 //mFlagShowNextxDays = temp;
428} 428}
429 429
430void KOViewManager::showAgendaView( bool fullScreen ) 430void KOViewManager::showAgendaView( bool fullScreen )
431{ 431{
432 432
433 mMainView->dialogManager()->hideSearchDialog(); 433 mMainView->dialogManager()->hideSearchDialog();
434 // qDebug("KOViewManager::showAgendaView "); 434 // qDebug("KOViewManager::showAgendaView ");
435 bool full; 435 bool full;
436 full = fullScreen; 436 full = fullScreen;
437 if (!mAgendaView) { 437 if (!mAgendaView) {
438 full = false; 438 full = false;
439 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 439 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
440 addView(mAgendaView); 440 addView(mAgendaView);
441#ifndef DESKTOP_VERSION 441#ifndef DESKTOP_VERSION
442 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 442 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
443#endif 443#endif
444 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 444 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
445 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 445 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
446 446
447 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 447 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
448 448
449 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 449 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
450 450
451 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 451 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
452 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 452 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
453 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 453 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
454 mMainView, SLOT(newEvent(QDateTime))); 454 mMainView, SLOT(newEvent(QDateTime)));
455 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 455 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
456 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 456 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
457 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 457 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
458 mMainView, SLOT(newEvent(QDate))); 458 mMainView, SLOT(newEvent(QDate)));
459 459
460 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 460 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
461 mMainView, SLOT(editIncidence(Incidence *))); 461 mMainView, SLOT(editIncidence(Incidence *)));
462 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 462 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
463 mMainView, SLOT(showIncidence(Incidence *))); 463 mMainView, SLOT(showIncidence(Incidence *)));
464 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 464 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
465 mMainView, SLOT(deleteIncidence(Incidence *))); 465 mMainView, SLOT(deleteIncidence(Incidence *)));
466 466
467 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 467 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
468 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 468 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
469 469
470 connect(mAgendaView, SIGNAL( toggleExpand() ), 470 connect(mAgendaView, SIGNAL( toggleExpand() ),
471 mMainView, SLOT( toggleExpand() ) ); 471 mMainView, SLOT( toggleExpand() ) );
472 472
473 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 473 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
474 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 474 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
475 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 475 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
476 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 476 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
477 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 477 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
478 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 478 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
479 SLOT( updateTodo( Todo *, int ) ) ); 479 SLOT( updateTodo( Todo *, int ) ) );
480 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 480 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
481 mMainView, SIGNAL( todoModified( Todo *, int ))); 481 mMainView, SIGNAL( todoModified( Todo *, int )));
482 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 482 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
483 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 483 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
484 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 484 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
485 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 485 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
486 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 486 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
487 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 487 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
488 mAgendaView->readSettings(); 488 mAgendaView->readSettings();
489 mAgendaView->updateConfig(); 489 mAgendaView->updateConfig();
490 } 490 }
491 491
492 showView( mAgendaView, full); 492 showView( mAgendaView, full);
493 493
494} 494}
495 495
496void KOViewManager::showDayView() 496void KOViewManager::showDayView()
497{ 497{
498 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 498 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
499 mFlagShowNextxDays = false; 499 mFlagShowNextxDays = false;
500 globalFlagBlockLabel = 1; 500 globalFlagBlockLabel = 1;
501 globalFlagBlockAgenda = 1; 501 globalFlagBlockAgenda = 1;
502 if ( mCurrentAgendaView != 1 ) 502 if ( mCurrentAgendaView != 1 )
503 mCurrentAgendaView = -1; 503 mCurrentAgendaView = -1;
504 showAgendaView(); 504 showAgendaView();
505 qApp->processEvents(); 505 qApp->processEvents();
506 globalFlagBlockAgenda = 2; 506 globalFlagBlockAgenda = 2;
507 globalFlagBlockLabel = 0; 507 globalFlagBlockLabel = 0;
508 mMainView->dateNavigator()->selectDates( 1 ); 508 mMainView->dateNavigator()->selectDates( 1 );
509 mCurrentAgendaView = 1 ; 509 mCurrentAgendaView = 1 ;
510 510
511} 511}
512 512
513void KOViewManager::showWorkWeekView() 513void KOViewManager::showWorkWeekView()
514{ 514{
515 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 515 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
516 mFlagShowNextxDays = false; 516 mFlagShowNextxDays = false;
517 globalFlagBlockAgenda = 1; 517 globalFlagBlockAgenda = 1;
518 globalFlagBlockLabel = 1; 518 globalFlagBlockLabel = 1;
519 if ( mCurrentAgendaView != 5 ) 519 if ( mCurrentAgendaView != 5 )
520 mCurrentAgendaView = -1; 520 mCurrentAgendaView = -1;
521 showAgendaView(); 521 showAgendaView();
522 qApp->processEvents(); 522 qApp->processEvents();
523 globalFlagBlockAgenda = 2; 523 globalFlagBlockAgenda = 2;
524 globalFlagBlockLabel = 0; 524 globalFlagBlockLabel = 0;
525 mMainView->dateNavigator()->selectWorkWeek(); 525 mMainView->dateNavigator()->selectWorkWeek();
526 mCurrentAgendaView = 5 ; 526 mCurrentAgendaView = 5 ;
527 527
528} 528}
529 529
530void KOViewManager::showWeekView() 530void KOViewManager::showWeekView()
531{ 531{
532 /* 532 /*
533 globalFlagBlockAgenda = 2; 533 globalFlagBlockAgenda = 2;
534 qDebug("4globalFlagBlockAgenda = 2; "); 534 qDebug("4globalFlagBlockAgenda = 2; ");
535 //globalFlagBlockPainting = true; 535 //globalFlagBlockPainting = true;
536 mMainView->dateNavigator()->selectWeek(); 536 mMainView->dateNavigator()->selectWeek();
537 showAgendaView(); 537 showAgendaView();
538 */ 538 */
539 539
540 540
541 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 541 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
542 mFlagShowNextxDays = false; 542 mFlagShowNextxDays = false;
543 globalFlagBlockAgenda = 1; 543 globalFlagBlockAgenda = 1;
544 globalFlagBlockLabel = 1; 544 globalFlagBlockLabel = 1;
545 if ( mCurrentAgendaView != 7 ) 545 if ( mCurrentAgendaView != 7 )
546 mCurrentAgendaView = -1; 546 mCurrentAgendaView = -1;
547 showAgendaView(); 547 showAgendaView();
548 qApp->processEvents(); 548 qApp->processEvents();
549 globalFlagBlockAgenda = 2; 549 globalFlagBlockAgenda = 2;
550 globalFlagBlockLabel = 0; 550 globalFlagBlockLabel = 0;
551 mMainView->dateNavigator()->selectWeek(); 551 mMainView->dateNavigator()->selectWeek();
552 mCurrentAgendaView = 7 ; 552 mCurrentAgendaView = 7 ;
553} 553}
554 554
555void KOViewManager::showNextXView() 555void KOViewManager::showNextXView()
556{ 556{
557 557
558 globalFlagBlockAgenda = 1; 558 globalFlagBlockAgenda = 1;
559 if ( mCurrentAgendaView != 3 ) 559 if ( mCurrentAgendaView != 3 )
560 mCurrentAgendaView = -1; 560 mCurrentAgendaView = -1;
561 showAgendaView(KOPrefs::instance()->mFullViewMonth); 561 showAgendaView(KOPrefs::instance()->mFullViewMonth);
562 globalFlagBlockAgenda = 2; 562 globalFlagBlockAgenda = 2;
563 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 563 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
564 KOPrefs::instance()->mNextXDays ); 564 KOPrefs::instance()->mNextXDays );
565 mFlagShowNextxDays = true; 565 mFlagShowNextxDays = true;
566 mCurrentAgendaView = 3 ; 566 mCurrentAgendaView = 3 ;
567} 567}
568bool KOViewManager::showsNextDays() 568bool KOViewManager::showsNextDays()
569{ 569{
570 return mFlagShowNextxDays; 570 return mFlagShowNextxDays;
571} 571}
572void KOViewManager::createMonthView() 572void KOViewManager::createMonthView()
573{ 573{
574if (!mMonthView) { 574if (!mMonthView) {
575 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 575 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
576 576
577 addView(mMonthView); 577 addView(mMonthView);
578 // mMonthView->show(); 578 // mMonthView->show();
579 // SIGNALS/SLOTS FOR MONTH VIEW 579 // SIGNALS/SLOTS FOR MONTH VIEW
580 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 580 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
581 mMainView, SLOT(newEvent(QDateTime))); 581 mMainView, SLOT(newEvent(QDateTime)));
582 582
583 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 583 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
584 mMainView, SLOT(showIncidence(Incidence *))); 584 mMainView, SLOT(showIncidence(Incidence *)));
585 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 585 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
586 mMainView, SLOT(editIncidence(Incidence *))); 586 mMainView, SLOT(editIncidence(Incidence *)));
587 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 587 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
588 mMainView, SLOT(deleteIncidence(Incidence *))); 588 mMainView, SLOT(deleteIncidence(Incidence *)));
589 589
590 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 590 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
591 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 591 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
592 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 592 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
593 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 593 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
594 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 594 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
595 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 595 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
596 596
597 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 597 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
598 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 598 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
599 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 599 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
600 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 600 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
601 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 601 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
602 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 602 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
603 connect( mMonthView, SIGNAL( selectMonth() ), 603 connect( mMonthView, SIGNAL( selectMonth() ),
604 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 604 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
605 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 605 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
606 mMainView, SLOT ( showDay( QDate ) ) ); 606 mMainView, SLOT ( showDay( QDate ) ) );
607 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 607 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
608 connect( mMonthView, SIGNAL(nextMonth() ), 608 connect( mMonthView, SIGNAL(nextMonth() ),
609 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 609 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
610 connect( mMonthView, SIGNAL(prevMonth() ), 610 connect( mMonthView, SIGNAL(prevMonth() ),
611 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 611 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
612 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 612 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
613 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 613 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
614 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 614 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
615 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 615 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
616 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 616 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
617 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 617 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
618 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 618 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
619 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 619 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
620 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 620 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
621 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 621 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
622 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 622 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
623 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 623 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
624 624
625 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 625 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
626 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 626 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
627 627
628 628
629 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 629 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
630 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 630 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
631 631
632 } 632 }
633} 633}
634void KOViewManager::showMonthViewWeek() 634void KOViewManager::showMonthViewWeek()
635{ 635{
636 createMonthView(); 636 createMonthView();
637 globalFlagBlockAgenda = 1; 637 globalFlagBlockAgenda = 1;
638 bool full = true; 638 bool full = true;
639 if ( mCurrentView == mMonthView) 639 if ( mCurrentView == mMonthView)
640 full = mMainView->leftFrame()->isVisible(); 640 full = mMainView->leftFrame()->isVisible();
641 if ( !KOPrefs::instance()->mMonthViewWeek ) { 641 if ( !KOPrefs::instance()->mMonthViewWeek ) {
642 mMonthView->switchView(); 642 mMonthView->switchView();
643 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 643 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
644 full = false; 644 full = false;
645 else 645 else
646 full = true; 646 full = true;
647 } 647 }
648 mMainView->dateNavigator()->selectWeek(); 648 mMainView->dateNavigator()->selectWeek();
649 showView(mMonthView, full ); 649 showView(mMonthView, full );
650} 650}
651 651
652void KOViewManager::showMonth( const QDate & date ) 652void KOViewManager::showMonth( const QDate & date )
653{ 653{
654 mMainView->dateNavigator()->blockSignals( true ); 654 mMainView->dateNavigator()->blockSignals( true );
655 mMainView->dateNavigator()->selectDate( date ); 655 mMainView->dateNavigator()->selectDate( date );
656 mMainView->dateNavigator()->blockSignals( false ); 656 mMainView->dateNavigator()->blockSignals( false );
657 showMonthView(); 657 showMonthView();
658} 658}
659void KOViewManager::showMonthView() 659void KOViewManager::showMonthView()
660 { 660 {
661 661
662 createMonthView(); 662 createMonthView();
663 globalFlagBlockAgenda = 1; 663 globalFlagBlockAgenda = 1;
664 //mFlagShowNextxDays = false; 664 //mFlagShowNextxDays = false;
665 bool full = true; 665 bool full = true;
666 if ( mCurrentView == mMonthView) 666 if ( mCurrentView == mMonthView)
667 full = mMainView->leftFrame()->isVisible(); 667 full = mMainView->leftFrame()->isVisible();
668 // if(mMonthView == mCurrentView) return; 668 // if(mMonthView == mCurrentView) return;
669 if ( KOPrefs::instance()->mMonthViewWeek ) { 669 if ( KOPrefs::instance()->mMonthViewWeek ) {
670 mMonthView->switchView(); 670 mMonthView->switchView();
671 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 671 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
672 full = false; 672 full = false;
673 else 673 else
674 full = true; 674 full = true;
675 } 675 }
676 mMainView->dateNavigator()->selectMonth(); 676 mMainView->dateNavigator()->selectMonth();
677 677
678 showView(mMonthView, full ); 678 showView(mMonthView, full );
679 679
680} 680}
681 681
682void KOViewManager::showTodoView() 682void KOViewManager::showTodoView()
683{ 683{
684 //mFlagShowNextxDays = false; 684 //mFlagShowNextxDays = false;
685 if ( !mTodoView ) { 685 if ( !mTodoView ) {
686 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 686 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
687 "KOViewManager::TodoView" ); 687 "KOViewManager::TodoView" );
688 688
689 addView( mTodoView ); 689 addView( mTodoView );
690 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 690 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
691 691
692 // SIGNALS/SLOTS FOR TODO VIEW 692 // SIGNALS/SLOTS FOR TODO VIEW
693 connect( mTodoView, SIGNAL( newTodoSignal() ), 693 connect( mTodoView, SIGNAL( newTodoSignal() ),
694 mMainView, SLOT( newTodo() ) ); 694 mMainView, SLOT( newTodo() ) );
695 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 695 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
696 mMainView, SLOT( newSubTodo( Todo *) ) ); 696 mMainView, SLOT( newSubTodo( Todo *) ) );
697 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 697 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
698 mMainView, SLOT( showTodo( Todo * ) ) ); 698 mMainView, SLOT( showTodo( Todo * ) ) );
699 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 699 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
700 mMainView, SLOT( editTodo( Todo * ) ) ); 700 mMainView, SLOT( editTodo( Todo * ) ) );
701 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 701 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
702 mMainView, SLOT( deleteTodo( Todo * ) ) ); 702 mMainView, SLOT( deleteTodo( Todo * ) ) );
703 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 703 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
704 mMainView, SLOT( purgeCompleted() ) ); 704 mMainView, SLOT( purgeCompleted() ) );
705 705
706 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 706 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
707 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 707 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
708 708
709 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 709 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
710 SLOT( updateConfig() ) ); 710 SLOT( updateConfig() ) );
711 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 711 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
712 SLOT( updateTodo( Todo *, int ) ) ); 712 SLOT( updateTodo( Todo *, int ) ) );
713 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 713 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
714 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 714 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
715 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 715 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
716 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 716 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
717 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 717 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
718 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 718 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
719 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 719 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
720 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 720 mMainView, SLOT ( todo_unsub( Todo * ) ) );
721 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 721 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
722 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 722 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
723 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 723 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
724 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 724 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
725 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 725 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
726 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 726 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
727 KConfig *config = KOGlobals::config(); 727 KConfig *config = KOGlobals::config();
728 mTodoView->restoreLayout(config,"Todo View"); 728 mTodoView->restoreLayout(config,"Todo View");
729 mTodoView->setNavigator( mMainView->dateNavigator() ); 729 mTodoView->setNavigator( mMainView->dateNavigator() );
730 } 730 }
731 731
732 globalFlagBlockAgenda = 1; 732 globalFlagBlockAgenda = 1;
733 showView( mTodoView, true ); 733 showView( mTodoView, true );
734 734
735} 735}
736 736
737void KOViewManager::showJournalView() 737void KOViewManager::showJournalView()
738{ 738{
739 //mFlagShowNextxDays = false; 739 //mFlagShowNextxDays = false;
740 if (!mJournalView) { 740 if (!mJournalView) {
741 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 741 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
742 "KOViewManager::JournalView"); 742 "KOViewManager::JournalView");
743 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 743 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
744 SLOT( updateConfig() ) ); 744 SLOT( updateConfig() ) );
745 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 745 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
746 addView(mJournalView); 746 addView(mJournalView);
747 } 747 }
748 748
749 showView(mJournalView); 749 showView(mJournalView);
750 mMainView->dateNavigator()->selectDates( 1 ); 750 mMainView->dateNavigator()->selectDates( 1 );
751} 751}
752 752
753void KOViewManager::showTimeSpanView() 753void KOViewManager::showTimeSpanView()
754{ 754{
755 //mFlagShowNextxDays = false; 755 //mFlagShowNextxDays = false;
756 if (!mTimeSpanView) { 756 if (!mTimeSpanView) {
757 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 757 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
758 "KOViewManager::TimeSpanView"); 758 "KOViewManager::TimeSpanView");
759 addView(mTimeSpanView); 759 addView(mTimeSpanView);
760 760
761 mTimeSpanView->readSettings(); 761 mTimeSpanView->readSettings();
762 } 762 }
763 763
764 showView(mTimeSpanView); 764 showView(mTimeSpanView);
765} 765}
766 766
767Incidence *KOViewManager::currentSelection() 767Incidence *KOViewManager::currentSelection()
768{ 768{
769 if (!mCurrentView) return 0; 769 if (!mCurrentView) return 0;
770 if ( mCurrentView == mListView ) { 770 if ( mCurrentView == mListView ) {
771 if ( mListView->currentItem() ) 771 if ( mListView->currentItem() )
772 return mListView->currentItem(); 772 return mListView->currentItem();
773 } 773 }
774 return mCurrentView->selectedIncidences().first(); 774 return mCurrentView->selectedIncidences().first();
775} 775}
776 776
777QDate KOViewManager::currentSelectionDate() 777QDate KOViewManager::currentSelectionDate()
778{ 778{
779 QDate qd; 779 QDate qd;
780 if (mCurrentView) { 780 if (mCurrentView) {
781 DateList qvl = mCurrentView->selectedDates(); 781 DateList qvl = mCurrentView->selectedDates();
782 if (!qvl.isEmpty()) qd = qvl.first(); 782 if (!qvl.isEmpty()) qd = qvl.first();
783 } 783 }
784 return qd; 784 return qd;
785} 785}
786 786
787void KOViewManager::addView(KOrg::BaseView *view) 787void KOViewManager::addView(KOrg::BaseView *view)
788{ 788{
789#if QT_VERSION >= 0x030000 789#if QT_VERSION >= 0x030000
790 mMainView->viewStack()->addWidget( view ); 790 mMainView->viewStack()->addWidget( view );
791#else 791#else
792 mMainView->viewStack()->addWidget( view, 1 ); 792 mMainView->viewStack()->addWidget( view, 1 );
793#endif 793#endif
794} 794}
795 795
796void KOViewManager::setDocumentId( const QString &id ) 796void KOViewManager::setDocumentId( const QString &id )
797{ 797{
798 if (mTodoView) mTodoView->setDocumentId( id ); 798 if (mTodoView) mTodoView->setDocumentId( id );
799} 799}