summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-30 20:15:13 (UTC)
committer zautrix <zautrix>2005-03-30 20:15:13 (UTC)
commit28ac86e2efbc10f210dbd2d5ac0053f4e6198d57 (patch) (unidiff)
treefce7d5a7d9f834f0df1f76a206537b976981cbbf /korganizer
parentb9ec42913b1dc7fc39848f245e55c7b36d7c2fa6 (diff)
downloadkdepimpi-28ac86e2efbc10f210dbd2d5ac0053f4e6198d57.zip
kdepimpi-28ac86e2efbc10f210dbd2d5ac0053f4e6198d57.tar.gz
kdepimpi-28ac86e2efbc10f210dbd2d5ac0053f4e6198d57.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp120
-rw-r--r--korganizer/koviewmanager.h3
2 files changed, 76 insertions, 47 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 548ffd3..f97aa98 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,654 +1,680 @@
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 flagResetViewChangeDate = 0;
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
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 static int selecteddatescount = 0;
204 static QDate selecteddate = QDate ( 2000, 1, 1 );
205 static QDate baseCycleDate = QDate ( 2000, 1, 1 );
206 int newCount = mMainView->dateNavigator()->selectedDates().count();
207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) {
208 flagResetViewChangeDate = 1;
209 }
210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() )
211 flagResetViewChangeDate = 1;
212 if ( flagResetViewChangeDate > 0 ) {
213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first();
214 //qDebug("newCycle ");
215 }
203 if (mCurrentView == mWhatsNextView) goto NEXT_X; 216 if (mCurrentView == mWhatsNextView) goto NEXT_X;
204
205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
206
207 if (mCurrentView == mJournalView ) goto DAY_1; 218 if (mCurrentView == mJournalView ) goto DAY_1;
208
209 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
210
211 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
212
213 if (mCurrentView == mAgendaView ) goto DAY_6; 221 if (mCurrentView == mAgendaView ) goto DAY_6;
214
215 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
216
217 if (mCurrentView == mMonthView ) goto LIST; 223 if (mCurrentView == mMonthView ) goto LIST;
218
219 if (mCurrentView == mListView ) goto TODO; 224 if (mCurrentView == mListView ) goto TODO;
220 225 // if (mCurrentView == mTodoView ) goto NEXT;
221 // if (mCurrentView == mTodoView ) goto LIST;
222
223
224 NEXT: 226 NEXT:
225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;}
226 NEXT_X: 228 NEXT_X:
227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 229 if ( KOPrefs::instance()->mShowIconNextDays ) {
230 globalFlagBlockAgenda = 1;
231 if ( mCurrentAgendaView != 3 )
232 mCurrentAgendaView = -1;
233 showAgendaView(KOPrefs::instance()->mFullViewMonth);
234 globalFlagBlockAgenda = 2;
235 mMainView->dateNavigator()->selectDates( baseCycleDate ,
236 KOPrefs::instance()->mNextXDays );
237 mFlagShowNextxDays = true;
238 mCurrentAgendaView = 3 ;
239 goto ENTE ;
240 }
228 JOURNAL: 241 JOURNAL:
229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 242 if ( KOPrefs::instance()->mShowIconJournal ) {
243 resetDateSilent( baseCycleDate , 1 );
244 showJournalView() ;goto ENTE ;}
230 DAY_1: 245 DAY_1:
231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 246 if ( KOPrefs::instance()->mShowIconDay1 ) {
247 resetDateSilent( baseCycleDate , 2 );
248 showDayView() ;goto ENTE ;}
232 DAY_5: 249 DAY_5:
233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 250 if ( KOPrefs::instance()->mShowIconDay5 ) {
251 resetDateSilent( baseCycleDate , 2 );
252 showWorkWeekView() ;goto ENTE ;}
234 DAY_7: 253 DAY_7:
235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 254 if ( KOPrefs::instance()->mShowIconDay7 ) {
255 resetDateSilent( baseCycleDate , 2 );
256 showWeekView();goto ENTE ;}
236 DAY_6: 257 DAY_6:
237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 258 if ( KOPrefs::instance()->mShowIconDay6 ) {
259 resetDateSilent( baseCycleDate , 2 );
260 showMonthViewWeek();goto ENTE ;}
238 MONTH: 261 MONTH:
239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 262 if ( KOPrefs::instance()->mShowIconMonth ) {
263 resetDateSilent( baseCycleDate , 2 );
264 showMonthView();goto ENTE ;}
240 LIST: 265 LIST:
241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 266 if ( KOPrefs::instance()->mShowIconList ) {
267 resetDateSilent( baseCycleDate , 2 );
268 showListView() ;goto ENTE ;}
242 TODO: 269 TODO:
243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 270 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
244 271 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;}
245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 272 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;}
246 273 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;}
247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 274 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;}
248 275 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;}
249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 276 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;}
250 277 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;}
251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 278 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;}
252 279 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;}
253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 280 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
254 281 ENTE:
255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 282 flagResetViewChangeDate = 0;
256 283 selecteddatescount = mMainView->dateNavigator()->selectedDates().count();
257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 284 selecteddate = mMainView->dateNavigator()->selectedDates().first();
258 285
259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 286}
260 287void KOViewManager::resetDateSilent( QDate date , int days )
261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 288{
262 289 mMainView->dateNavigator()->blockSignals( true );
263 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 290 mMainView->dateNavigator()->selectDates( date , days );
264 291 mMainView->dateNavigator()->blockSignals( false );
265
266
267} 292}
268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 293void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
269{ 294{
270 295 if ( flagResetViewChangeDate < 10 )
296 ++flagResetViewChangeDate;
271 //mFlagShowNextxDays = false; 297 //mFlagShowNextxDays = false;
272 //if(view == mCurrentView) return; 298 //if(view == mCurrentView) return;
273 if ( view == 0 ) { 299 if ( view == 0 ) {
274 view = mCurrentView; 300 view = mCurrentView;
275 if ( view == 0 ) 301 if ( view == 0 )
276 return; 302 return;
277 } 303 }
278 bool callupdate = !(view == mCurrentView); 304 bool callupdate = !(view == mCurrentView);
279 bool full = fullScreen; 305 bool full = fullScreen;
280 if(view == mCurrentView && view != mWhatsNextView ) { 306 if(view == mCurrentView && view != mWhatsNextView ) {
281 if ( mCurrentAgendaView < 0 ) 307 if ( mCurrentAgendaView < 0 )
282 return; 308 return;
283 if ( view != mMonthView ) 309 if ( view != mMonthView )
284 full = mMainView->leftFrame()->isVisible(); 310 full = mMainView->leftFrame()->isVisible();
285 } else { 311 } else {
286 if ( view == mMonthView && mMonthView) 312 if ( view == mMonthView && mMonthView)
287 ;//mMonthView->skipResize = true ; 313 ;//mMonthView->skipResize = true ;
288 mCurrentView = view; 314 mCurrentView = view;
289 // bool full = fullScreen; 315 // bool full = fullScreen;
290 bool isFull = !mMainView->leftFrame()->isVisible(); 316 bool isFull = !mMainView->leftFrame()->isVisible();
291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 317 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
292 full = true; 318 full = true;
293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 319 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
294 full = false; 320 full = false;
295 } 321 }
296 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 322 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
297 //raiseCurrentView( full ); 323 //raiseCurrentView( full );
298 mMainView->processIncidenceSelection( 0 ); 324 mMainView->processIncidenceSelection( 0 );
299 //mMainView->updateView(); 325 //mMainView->updateView();
300 raiseCurrentView( full, callupdate ); 326 raiseCurrentView( full, callupdate );
301 mMainView->adaptNavigationUnits(); 327 mMainView->adaptNavigationUnits();
302} 328}
303 329
304void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 330void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
305{ 331{
306 mCurrentAgendaView = 0; 332 mCurrentAgendaView = 0;
307 if ( fullScreen ) { 333 if ( fullScreen ) {
308 mMainView->leftFrame()->hide(); 334 mMainView->leftFrame()->hide();
309 } else { 335 } else {
310 mMainView->leftFrame()->show(); 336 mMainView->leftFrame()->show();
311 } 337 }
312 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 338 //if ( mCurrentView == mMonthView ) qApp->processEvents();
313 emit signalFullScreen( !fullScreen ); 339 emit signalFullScreen( !fullScreen );
314 if ( callUpdateView ) 340 if ( callUpdateView )
315 mMainView->updateView(); 341 mMainView->updateView();
316 342
317 if ( globalFlagBlockAgenda == 5 ) { 343 if ( globalFlagBlockAgenda == 5 ) {
318 globalFlagBlockAgenda = 4; 344 globalFlagBlockAgenda = 4;
319 globalFlagBlockAgendaItemPaint = 1; 345 globalFlagBlockAgendaItemPaint = 1;
320 } 346 }
321 mMainView->viewStack()->raiseWidget(mCurrentView); 347 mMainView->viewStack()->raiseWidget(mCurrentView);
322 if ( globalFlagBlockAgenda == 4 ) { 348 if ( globalFlagBlockAgenda == 4 ) {
323 if ( mCurrentView == mAgendaView ) { 349 if ( mCurrentView == mAgendaView ) {
324 //globalFlagBlockAgenda =1 ; 350 //globalFlagBlockAgenda =1 ;
325 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 351 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
326 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 352 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
327 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 353 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
328 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 354 mAgendaView->setStartHour( QTime::currentTime ().hour() );
329 qApp->processEvents(); 355 qApp->processEvents();
330 //qDebug("qApp->processEvents() "); 356 //qDebug("qApp->processEvents() ");
331 globalFlagBlockAgenda = 0; 357 globalFlagBlockAgenda = 0;
332 mAgendaView->repaintAgenda(); 358 mAgendaView->repaintAgenda();
333 359
334 } 360 }
335 globalFlagBlockAgenda = 0; 361 globalFlagBlockAgenda = 0;
336 } 362 }
337 emit signalAgendaView( mCurrentView == mAgendaView ); 363 emit signalAgendaView( mCurrentView == mAgendaView );
338 //qDebug("raiseCurrentView ende "); 364 //qDebug("raiseCurrentView ende ");
339 365
340} 366}
341 367
342void KOViewManager::updateView() 368void KOViewManager::updateView()
343{ 369{
344 // qDebug("KOViewManager::updateView() "); 370 // qDebug("KOViewManager::updateView() ");
345 // if we are updating mTodoView, we get endless recursion 371 // if we are updating mTodoView, we get endless recursion
346 if ( mTodoView == mCurrentView ) 372 if ( mTodoView == mCurrentView )
347 return; 373 return;
348 if ( mCurrentView ) mCurrentView->updateView(); 374 if ( mCurrentView ) mCurrentView->updateView();
349 375
350} 376}
351 377
352void KOViewManager::updateView(const QDate &start, const QDate &end) 378void KOViewManager::updateView(const QDate &start, const QDate &end)
353{ 379{
354 // kdDebug() << "KOViewManager::updateView()" << endl; 380 // kdDebug() << "KOViewManager::updateView()" << endl;
355 381
356 if (mCurrentView) mCurrentView->showDates(start, end); 382 if (mCurrentView) mCurrentView->showDates(start, end);
357 383
358 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 384 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
359} 385}
360 386
361 387
362void KOViewManager::updateWNview() 388void KOViewManager::updateWNview()
363{ 389{
364 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 390 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
365 mWhatsNextView->updateView(); 391 mWhatsNextView->updateView();
366 392
367} 393}
368void KOViewManager::showWhatsNextView() 394void KOViewManager::showWhatsNextView()
369{ 395{
370 if (!mWhatsNextView) { 396 if (!mWhatsNextView) {
371 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 397 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
372 "KOViewManager::WhatsNextView"); 398 "KOViewManager::WhatsNextView");
373 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 399 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
374 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 400 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
375 addView(mWhatsNextView); 401 addView(mWhatsNextView);
376 connect(this, SIGNAL( printWNV() ), 402 connect(this, SIGNAL( printWNV() ),
377 mWhatsNextView, SLOT( printMe() ) ); 403 mWhatsNextView, SLOT( printMe() ) );
378 } 404 }
379 globalFlagBlockAgenda = 1; 405 globalFlagBlockAgenda = 1;
380 showView(mWhatsNextView, true ); 406 showView(mWhatsNextView, true );
381 //mWhatsNextView->updateView(); 407 //mWhatsNextView->updateView();
382 408
383} 409}
384 410
385void KOViewManager::slotprintWNV() 411void KOViewManager::slotprintWNV()
386{ 412{
387 if (!mWhatsNextView) 413 if (!mWhatsNextView)
388 showWhatsNextView(); 414 showWhatsNextView();
389 emit printWNV(); 415 emit printWNV();
390 416
391} 417}
392void KOViewManager::showListView() 418void KOViewManager::showListView()
393{ 419{
394 if (!mListView) { 420 if (!mListView) {
395 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 421 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
396 addView(mListView); 422 addView(mListView);
397 423
398 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 424 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
399 mMainView, SLOT(showIncidence(Incidence *))); 425 mMainView, SLOT(showIncidence(Incidence *)));
400 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 426 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
401 mMainView, SLOT(editIncidence(Incidence *))); 427 mMainView, SLOT(editIncidence(Incidence *)));
402 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 428 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
403 mMainView, SLOT(deleteIncidence(Incidence *))); 429 mMainView, SLOT(deleteIncidence(Incidence *)));
404 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 430 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
405 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 431 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
406 connect( mListView, SIGNAL( signalNewEvent() ), 432 connect( mListView, SIGNAL( signalNewEvent() ),
407 mMainView, SLOT( newEvent() ) ); 433 mMainView, SLOT( newEvent() ) );
408 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 434 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
409 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 435 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
410 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 436 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 437 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
412 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 438 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
413 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 439 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
414 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 440 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
415 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 441 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
416 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 442 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
417 } 443 }
418 // bool temp = mFlagShowNextxDays; 444 // bool temp = mFlagShowNextxDays;
419 //globalFlagBlockPainting = true; 445 //globalFlagBlockPainting = true;
420 globalFlagBlockAgenda = 1; 446 globalFlagBlockAgenda = 1;
421 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 447 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
422 mMainView->setBlockShowDates( true ); 448 mMainView->setBlockShowDates( true );
423 mMainView->dateNavigator()->selectMonth(); 449 mMainView->dateNavigator()->selectMonth();
424 mMainView->setBlockShowDates( false ); 450 mMainView->setBlockShowDates( false );
425 } 451 }
426 showView(mListView, KOPrefs::instance()->mFullViewTodo); 452 showView(mListView, KOPrefs::instance()->mFullViewTodo);
427 //mFlagShowNextxDays = temp; 453 //mFlagShowNextxDays = temp;
428} 454}
429 455
430void KOViewManager::showAgendaView( bool fullScreen ) 456void KOViewManager::showAgendaView( bool fullScreen )
431{ 457{
432 458
433 mMainView->dialogManager()->hideSearchDialog(); 459 mMainView->dialogManager()->hideSearchDialog();
434 // qDebug("KOViewManager::showAgendaView "); 460 // qDebug("KOViewManager::showAgendaView ");
435 bool full; 461 bool full;
436 full = fullScreen; 462 full = fullScreen;
437 if (!mAgendaView) { 463 if (!mAgendaView) {
438 full = false; 464 full = false;
439 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 465 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
440 addView(mAgendaView); 466 addView(mAgendaView);
441#ifndef DESKTOP_VERSION 467#ifndef DESKTOP_VERSION
442 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 468 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
443#endif 469#endif
444 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 470 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
445 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 471 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
446 472
447 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 473 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
448 474
449 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 475 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
450 476
451 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 477 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
452 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 478 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
453 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 479 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
454 mMainView, SLOT(newEvent(QDateTime))); 480 mMainView, SLOT(newEvent(QDateTime)));
455 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 481 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
456 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 482 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
457 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 483 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
458 mMainView, SLOT(newEvent(QDate))); 484 mMainView, SLOT(newEvent(QDate)));
459 485
460 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 486 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
461 mMainView, SLOT(editIncidence(Incidence *))); 487 mMainView, SLOT(editIncidence(Incidence *)));
462 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 488 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
463 mMainView, SLOT(showIncidence(Incidence *))); 489 mMainView, SLOT(showIncidence(Incidence *)));
464 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 490 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
465 mMainView, SLOT(deleteIncidence(Incidence *))); 491 mMainView, SLOT(deleteIncidence(Incidence *)));
466 492
467 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 493 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
468 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 494 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
469 495
470 connect(mAgendaView, SIGNAL( toggleExpand() ), 496 connect(mAgendaView, SIGNAL( toggleExpand() ),
471 mMainView, SLOT( toggleExpand() ) ); 497 mMainView, SLOT( toggleExpand() ) );
472 498
473 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 499 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
474 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 500 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
475 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 501 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
476 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 502 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
477 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 503 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
478 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 504 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
479 SLOT( updateTodo( Todo *, int ) ) ); 505 SLOT( updateTodo( Todo *, int ) ) );
480 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 506 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
481 mMainView, SIGNAL( todoModified( Todo *, int ))); 507 mMainView, SIGNAL( todoModified( Todo *, int )));
482 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 508 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
483 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 509 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
484 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 510 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
485 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 511 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
486 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 512 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
487 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 513 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
488 mAgendaView->readSettings(); 514 mAgendaView->readSettings();
489 mAgendaView->updateConfig(); 515 mAgendaView->updateConfig();
490 } 516 }
491 517
492 showView( mAgendaView, full); 518 showView( mAgendaView, full);
493 519
494} 520}
495 521
496void KOViewManager::showDayView() 522void KOViewManager::showDayView()
497{ 523{
498 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 524 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
499 mFlagShowNextxDays = false; 525 mFlagShowNextxDays = false;
500 globalFlagBlockLabel = 1; 526 globalFlagBlockLabel = 1;
501 globalFlagBlockAgenda = 1; 527 globalFlagBlockAgenda = 1;
502 if ( mCurrentAgendaView != 1 ) 528 if ( mCurrentAgendaView != 1 )
503 mCurrentAgendaView = -1; 529 mCurrentAgendaView = -1;
504 showAgendaView(); 530 showAgendaView();
505 qApp->processEvents(); 531 qApp->processEvents();
506 globalFlagBlockAgenda = 2; 532 globalFlagBlockAgenda = 2;
507 globalFlagBlockLabel = 0; 533 globalFlagBlockLabel = 0;
508 mMainView->dateNavigator()->selectDates( 1 ); 534 mMainView->dateNavigator()->selectDates( 1 );
509 mCurrentAgendaView = 1 ; 535 mCurrentAgendaView = 1 ;
510 536
511} 537}
512 538
513void KOViewManager::showWorkWeekView() 539void KOViewManager::showWorkWeekView()
514{ 540{
515 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 541 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
516 mFlagShowNextxDays = false; 542 mFlagShowNextxDays = false;
517 globalFlagBlockAgenda = 1; 543 globalFlagBlockAgenda = 1;
518 globalFlagBlockLabel = 1; 544 globalFlagBlockLabel = 1;
519 if ( mCurrentAgendaView != 5 ) 545 if ( mCurrentAgendaView != 5 )
520 mCurrentAgendaView = -1; 546 mCurrentAgendaView = -1;
521 showAgendaView(); 547 showAgendaView();
522 qApp->processEvents(); 548 qApp->processEvents();
523 globalFlagBlockAgenda = 2; 549 globalFlagBlockAgenda = 2;
524 globalFlagBlockLabel = 0; 550 globalFlagBlockLabel = 0;
525 mMainView->dateNavigator()->selectWorkWeek(); 551 mMainView->dateNavigator()->selectWorkWeek();
526 mCurrentAgendaView = 5 ; 552 mCurrentAgendaView = 5 ;
527 553
528} 554}
529 555
530void KOViewManager::showWeekView() 556void KOViewManager::showWeekView()
531{ 557{
532 /* 558 /*
533 globalFlagBlockAgenda = 2; 559 globalFlagBlockAgenda = 2;
534 qDebug("4globalFlagBlockAgenda = 2; "); 560 qDebug("4globalFlagBlockAgenda = 2; ");
535 //globalFlagBlockPainting = true; 561 //globalFlagBlockPainting = true;
536 mMainView->dateNavigator()->selectWeek(); 562 mMainView->dateNavigator()->selectWeek();
537 showAgendaView(); 563 showAgendaView();
538 */ 564 */
539 565
540 566
541 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 567 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
542 mFlagShowNextxDays = false; 568 mFlagShowNextxDays = false;
543 globalFlagBlockAgenda = 1; 569 globalFlagBlockAgenda = 1;
544 globalFlagBlockLabel = 1; 570 globalFlagBlockLabel = 1;
545 if ( mCurrentAgendaView != 7 ) 571 if ( mCurrentAgendaView != 7 )
546 mCurrentAgendaView = -1; 572 mCurrentAgendaView = -1;
547 showAgendaView(); 573 showAgendaView();
548 qApp->processEvents(); 574 qApp->processEvents();
549 globalFlagBlockAgenda = 2; 575 globalFlagBlockAgenda = 2;
550 globalFlagBlockLabel = 0; 576 globalFlagBlockLabel = 0;
551 mMainView->dateNavigator()->selectWeek(); 577 mMainView->dateNavigator()->selectWeek();
552 mCurrentAgendaView = 7 ; 578 mCurrentAgendaView = 7 ;
553} 579}
554 580
555void KOViewManager::showNextXView() 581void KOViewManager::showNextXView()
556{ 582{
557 583
558 globalFlagBlockAgenda = 1; 584 globalFlagBlockAgenda = 1;
559 if ( mCurrentAgendaView != 3 ) 585 if ( mCurrentAgendaView != 3 )
560 mCurrentAgendaView = -1; 586 mCurrentAgendaView = -1;
561 showAgendaView(KOPrefs::instance()->mFullViewMonth); 587 showAgendaView(KOPrefs::instance()->mFullViewMonth);
562 globalFlagBlockAgenda = 2; 588 globalFlagBlockAgenda = 2;
563 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 589 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
564 KOPrefs::instance()->mNextXDays ); 590 KOPrefs::instance()->mNextXDays );
565 mFlagShowNextxDays = true; 591 mFlagShowNextxDays = true;
566 mCurrentAgendaView = 3 ; 592 mCurrentAgendaView = 3 ;
567} 593}
568bool KOViewManager::showsNextDays() 594bool KOViewManager::showsNextDays()
569{ 595{
570 return mFlagShowNextxDays; 596 return mFlagShowNextxDays;
571} 597}
572void KOViewManager::createMonthView() 598void KOViewManager::createMonthView()
573{ 599{
574if (!mMonthView) { 600if (!mMonthView) {
575 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 601 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
576 602
577 addView(mMonthView); 603 addView(mMonthView);
578 // mMonthView->show(); 604 // mMonthView->show();
579 // SIGNALS/SLOTS FOR MONTH VIEW 605 // SIGNALS/SLOTS FOR MONTH VIEW
580 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 606 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
581 mMainView, SLOT(newEvent(QDateTime))); 607 mMainView, SLOT(newEvent(QDateTime)));
582 608
583 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 609 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
584 mMainView, SLOT(showIncidence(Incidence *))); 610 mMainView, SLOT(showIncidence(Incidence *)));
585 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 611 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
586 mMainView, SLOT(editIncidence(Incidence *))); 612 mMainView, SLOT(editIncidence(Incidence *)));
587 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 613 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
588 mMainView, SLOT(deleteIncidence(Incidence *))); 614 mMainView, SLOT(deleteIncidence(Incidence *)));
589 615
590 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 616 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
591 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 617 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
592 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 618 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
593 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 619 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
594 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 620 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
595 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 621 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
596 622
597 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 623 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
598 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 624 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
599 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 625 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
600 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 626 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
601 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 627 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
602 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 628 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
603 connect( mMonthView, SIGNAL( selectMonth() ), 629 connect( mMonthView, SIGNAL( selectMonth() ),
604 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 630 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
605 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 631 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
606 mMainView, SLOT ( showDay( QDate ) ) ); 632 mMainView, SLOT ( showDay( QDate ) ) );
607 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 633 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
608 connect( mMonthView, SIGNAL(nextMonth() ), 634 connect( mMonthView, SIGNAL(nextMonth() ),
609 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 635 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
610 connect( mMonthView, SIGNAL(prevMonth() ), 636 connect( mMonthView, SIGNAL(prevMonth() ),
611 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 637 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
612 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 638 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
613 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 639 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
614 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 640 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
615 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 641 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
616 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 642 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
617 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 643 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
618 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 644 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
619 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 645 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
620 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 646 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
621 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 647 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
622 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 648 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
623 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 649 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
624 650
625 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 651 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
626 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 652 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
627 653
628 654
629 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 655 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
630 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 656 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
631 657
632 } 658 }
633} 659}
634void KOViewManager::showMonthViewWeek() 660void KOViewManager::showMonthViewWeek()
635{ 661{
636 createMonthView(); 662 createMonthView();
637 globalFlagBlockAgenda = 1; 663 globalFlagBlockAgenda = 1;
638 bool full = true; 664 bool full = true;
639 if ( mCurrentView == mMonthView) 665 if ( mCurrentView == mMonthView)
640 full = mMainView->leftFrame()->isVisible(); 666 full = mMainView->leftFrame()->isVisible();
641 if ( !KOPrefs::instance()->mMonthViewWeek ) { 667 if ( !KOPrefs::instance()->mMonthViewWeek ) {
642 mMonthView->switchView(); 668 mMonthView->switchView();
643 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 669 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
644 full = false; 670 full = false;
645 else 671 else
646 full = true; 672 full = true;
647 } 673 }
648 mMainView->dateNavigator()->selectWeek(); 674 mMainView->dateNavigator()->selectWeek();
649 showView(mMonthView, full ); 675 showView(mMonthView, full );
650 mMonthView->setKeyBFocus(); 676 mMonthView->setKeyBFocus();
651} 677}
652 678
653void KOViewManager::showMonth( const QDate & date ) 679void KOViewManager::showMonth( const QDate & date )
654{ 680{
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 1d565a6..8dc03e0 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -1,123 +1,126 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 3 Copyright (c) 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KOVIEWMANAGER_H 24#ifndef KOVIEWMANAGER_H
25#define KOVIEWMANAGER_H 25#define KOVIEWMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28 28
29#include <korganizer/baseview.h> 29#include <korganizer/baseview.h>
30 30
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 void updateWNview(); 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView( const QDate &start, const QDate &end ); 69 void updateView( const QDate &start, const QDate &end );
70 70
71 void raiseCurrentView( bool fullScreen = false , bool updateView = false); 71 void raiseCurrentView( bool fullScreen = false , bool updateView = false);
72 72
73 void addView(KOrg::BaseView *); 73 void addView(KOrg::BaseView *);
74 74
75 Incidence *currentSelection(); 75 Incidence *currentSelection();
76 QDate currentSelectionDate(); 76 QDate currentSelectionDate();
77 77
78 KOAgendaView *agendaView() const { return mAgendaView; } 78 KOAgendaView *agendaView() const { return mAgendaView; }
79 79
80 signals: 80 signals:
81 void printWNV(); 81 void printWNV();
82 void signalFullScreen( bool ); 82 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 83 void signalAgendaView( bool );
84 public slots: 84 public slots:
85 void slotprintWNV(); 85 void slotprintWNV();
86 void showNextView(); 86 void showNextView();
87 void showMonth( const QDate & ); 87 void showMonth( const QDate & );
88 void showDateView( int, QDate ); 88 void showDateView( int, QDate );
89 void updateView(); 89 void updateView();
90 void showWhatsNextView(); 90 void showWhatsNextView();
91 void showListView(); 91 void showListView();
92 void showAgendaView( bool fullScreen = false ); 92 void showAgendaView( bool fullScreen = false );
93 void showDayView(); 93 void showDayView();
94 void showWorkWeekView(); 94 void showWorkWeekView();
95 void showWeekView(); 95 void showWeekView();
96 void showNextXView(); 96 void showNextXView();
97 void showMonthView(); 97 void showMonthView();
98 void showMonthViewWeek(); 98 void showMonthViewWeek();
99 void showTodoView(); 99 void showTodoView();
100 void showJournalView(); 100 void showJournalView();
101 void showTimeSpanView(); 101 void showTimeSpanView();
102 102
103 private: 103 private:
104 void resetDateSilent( QDate date , int days );
105 int flagResetViewChangeDate;
106 QDate currentViewChangeDate;
104 void createMonthView(); 107 void createMonthView();
105 CalendarView *mMainView; 108 CalendarView *mMainView;
106 109
107 int mCurrentAgendaView; 110 int mCurrentAgendaView;
108 KOAgendaView *mAgendaView; 111 KOAgendaView *mAgendaView;
109 KOListView *mListView; 112 KOListView *mListView;
110 KOMonthView *mMonthView; 113 KOMonthView *mMonthView;
111 KOTodoView *mTodoView; 114 KOTodoView *mTodoView;
112 KOWhatsNextView *mWhatsNextView; 115 KOWhatsNextView *mWhatsNextView;
113 KOJournalView *mJournalView; 116 KOJournalView *mJournalView;
114 KOTimeSpanView *mTimeSpanView; 117 KOTimeSpanView *mTimeSpanView;
115 118
116 KOrg::BaseView *mCurrentView; // currently active event view 119 KOrg::BaseView *mCurrentView; // currently active event view
117 120
118 int mAgendaViewMode; 121 int mAgendaViewMode;
119 bool mFlagShowNextxDays; 122 bool mFlagShowNextxDays;
120 123
121}; 124};
122 125
123#endif 126#endif