summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp33
-rw-r--r--korganizer/mainwindow.cpp13
2 files changed, 24 insertions, 22 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index b5de4a1..e80b3fc 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,791 +1,792 @@
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 LIST; 205 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
206 206
207 if (mCurrentView == mListView ) 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 TODO; 217 if (mCurrentView == mMonthView ) goto LIST;
218
219 if (mCurrentView == mListView ) goto TODO;
220
221 // if (mCurrentView == mTodoView ) goto LIST;
218 222
219 if (mCurrentView == mTodoView ) goto JOURNAL;
220 223
221 NEXT: 224 NEXT:
222 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 225 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;}
223 NEXT_X: 226 NEXT_X:
224 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 227 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;}
225 LIST: 228 JOURNAL:
226 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;} 229 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
227 DAY_1: 230 DAY_1:
228 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 231 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;}
229 DAY_5: 232 DAY_5:
230 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 233 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;}
231 DAY_7: 234 DAY_7:
232 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 235 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;}
233 DAY_6: 236 DAY_6:
234 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 237 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;}
235 MONTH: 238 MONTH:
236 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 239 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;}
240 LIST:
241 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
237 TODO: 242 TODO:
238 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 243 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;}
239 JOURNAL:
240 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
241
242
243 244
244 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;} 245 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();return ;}
245 246
246 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;} 247 if ( KOPrefs::instance()->mShowIconNextDays ) { showNextXView() ;return ;}
247
248 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
249 248
250 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;} 249 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;}
251 250
251 if ( KOPrefs::instance()->mShowIconDay1 ) { showDayView() ;return ;}
252
252 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;} 253 if ( KOPrefs::instance()->mShowIconDay5 ) { showWorkWeekView() ;return ;}
253 254
254 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;} 255 if ( KOPrefs::instance()->mShowIconDay7 ) { showWeekView();return ;}
255 256
256 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;} 257 if ( KOPrefs::instance()->mShowIconDay6 ) { showMonthViewWeek();return ;}
257 258
258 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;} 259 if ( KOPrefs::instance()->mShowIconMonth ) { showMonthView();return ;}
259 260
260 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;} 261 if ( KOPrefs::instance()->mShowIconList ) { showListView() ;return ;}
261 262
262 if ( KOPrefs::instance()->mShowIconJournal ) { showJournalView() ;return ;} 263 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;return ;}
263 264
264 265
265 266
266} 267}
267void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 268void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
268{ 269{
269 270
270 //mFlagShowNextxDays = false; 271 //mFlagShowNextxDays = false;
271 //if(view == mCurrentView) return; 272 //if(view == mCurrentView) return;
272 if ( view == 0 ) { 273 if ( view == 0 ) {
273 view = mCurrentView; 274 view = mCurrentView;
274 if ( view == 0 ) 275 if ( view == 0 )
275 return; 276 return;
276 } 277 }
277 bool callupdate = !(view == mCurrentView); 278 bool callupdate = !(view == mCurrentView);
278 bool full = fullScreen; 279 bool full = fullScreen;
279 if(view == mCurrentView && view != mWhatsNextView ) { 280 if(view == mCurrentView && view != mWhatsNextView ) {
280 if ( mCurrentAgendaView < 0 ) 281 if ( mCurrentAgendaView < 0 )
281 return; 282 return;
282 if ( view != mMonthView ) 283 if ( view != mMonthView )
283 full = mMainView->leftFrame()->isVisible(); 284 full = mMainView->leftFrame()->isVisible();
284 } else { 285 } else {
285 if ( view == mMonthView && mMonthView) 286 if ( view == mMonthView && mMonthView)
286 ;//mMonthView->skipResize = true ; 287 ;//mMonthView->skipResize = true ;
287 mCurrentView = view; 288 mCurrentView = view;
288 // bool full = fullScreen; 289 // bool full = fullScreen;
289 bool isFull = !mMainView->leftFrame()->isVisible(); 290 bool isFull = !mMainView->leftFrame()->isVisible();
290 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 291 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
291 full = true; 292 full = true;
292 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 293 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
293 full = false; 294 full = false;
294 } 295 }
295 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 296 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
296 //raiseCurrentView( full ); 297 //raiseCurrentView( full );
297 mMainView->processIncidenceSelection( 0 ); 298 mMainView->processIncidenceSelection( 0 );
298 //mMainView->updateView(); 299 //mMainView->updateView();
299 raiseCurrentView( full, callupdate ); 300 raiseCurrentView( full, callupdate );
300 mMainView->adaptNavigationUnits(); 301 mMainView->adaptNavigationUnits();
301} 302}
302 303
303void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 304void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
304{ 305{
305 mCurrentAgendaView = 0; 306 mCurrentAgendaView = 0;
306 if ( fullScreen ) { 307 if ( fullScreen ) {
307 mMainView->leftFrame()->hide(); 308 mMainView->leftFrame()->hide();
308 } else { 309 } else {
309 mMainView->leftFrame()->show(); 310 mMainView->leftFrame()->show();
310 } 311 }
311 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 312 //if ( mCurrentView == mMonthView ) qApp->processEvents();
312 emit signalFullScreen( !fullScreen ); 313 emit signalFullScreen( !fullScreen );
313 if ( callUpdateView ) 314 if ( callUpdateView )
314 mMainView->updateView(); 315 mMainView->updateView();
315 316
316 if ( globalFlagBlockAgenda == 5 ) { 317 if ( globalFlagBlockAgenda == 5 ) {
317 globalFlagBlockAgenda = 4; 318 globalFlagBlockAgenda = 4;
318 globalFlagBlockAgendaItemPaint = 1; 319 globalFlagBlockAgendaItemPaint = 1;
319 } 320 }
320 mMainView->viewStack()->raiseWidget(mCurrentView); 321 mMainView->viewStack()->raiseWidget(mCurrentView);
321 if ( globalFlagBlockAgenda == 4 ) { 322 if ( globalFlagBlockAgenda == 4 ) {
322 if ( mCurrentView == mAgendaView ) { 323 if ( mCurrentView == mAgendaView ) {
323 //globalFlagBlockAgenda =1 ; 324 //globalFlagBlockAgenda =1 ;
324 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 325 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
325 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 326 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
326 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 327 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
327 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 328 mAgendaView->setStartHour( QTime::currentTime ().hour() );
328 qApp->processEvents(); 329 qApp->processEvents();
329 //qDebug("qApp->processEvents() "); 330 //qDebug("qApp->processEvents() ");
330 globalFlagBlockAgenda = 0; 331 globalFlagBlockAgenda = 0;
331 mAgendaView->repaintAgenda(); 332 mAgendaView->repaintAgenda();
332 333
333 } 334 }
334 globalFlagBlockAgenda = 0; 335 globalFlagBlockAgenda = 0;
335 } 336 }
336 emit signalAgendaView( mCurrentView == mAgendaView ); 337 emit signalAgendaView( mCurrentView == mAgendaView );
337 //qDebug("raiseCurrentView ende "); 338 //qDebug("raiseCurrentView ende ");
338 339
339} 340}
340 341
341void KOViewManager::updateView() 342void KOViewManager::updateView()
342{ 343{
343 // qDebug("KOViewManager::updateView() "); 344 // qDebug("KOViewManager::updateView() ");
344 // if we are updating mTodoView, we get endless recursion 345 // if we are updating mTodoView, we get endless recursion
345 if ( mTodoView == mCurrentView ) 346 if ( mTodoView == mCurrentView )
346 return; 347 return;
347 if ( mCurrentView ) mCurrentView->updateView(); 348 if ( mCurrentView ) mCurrentView->updateView();
348 349
349} 350}
350 351
351void KOViewManager::updateView(const QDate &start, const QDate &end) 352void KOViewManager::updateView(const QDate &start, const QDate &end)
352{ 353{
353 // kdDebug() << "KOViewManager::updateView()" << endl; 354 // kdDebug() << "KOViewManager::updateView()" << endl;
354 355
355 if (mCurrentView) mCurrentView->showDates(start, end); 356 if (mCurrentView) mCurrentView->showDates(start, end);
356 357
357 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 358 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
358} 359}
359 360
360 361
361void KOViewManager::updateWNview() 362void KOViewManager::updateWNview()
362{ 363{
363 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 364 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
364 mWhatsNextView->updateView(); 365 mWhatsNextView->updateView();
365 366
366} 367}
367void KOViewManager::showWhatsNextView() 368void KOViewManager::showWhatsNextView()
368{ 369{
369 if (!mWhatsNextView) { 370 if (!mWhatsNextView) {
370 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 371 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
371 "KOViewManager::WhatsNextView"); 372 "KOViewManager::WhatsNextView");
372 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 373 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
373 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 374 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
374 addView(mWhatsNextView); 375 addView(mWhatsNextView);
375 connect(this, SIGNAL( printWNV() ), 376 connect(this, SIGNAL( printWNV() ),
376 mWhatsNextView, SLOT( printMe() ) ); 377 mWhatsNextView, SLOT( printMe() ) );
377 } 378 }
378 globalFlagBlockAgenda = 1; 379 globalFlagBlockAgenda = 1;
379 showView(mWhatsNextView, true ); 380 showView(mWhatsNextView, true );
380 //mWhatsNextView->updateView(); 381 //mWhatsNextView->updateView();
381 382
382} 383}
383 384
384void KOViewManager::showListView() 385void KOViewManager::showListView()
385{ 386{
386 if (!mListView) { 387 if (!mListView) {
387 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 388 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
388 addView(mListView); 389 addView(mListView);
389 390
390 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 391 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
391 mMainView, SLOT(showIncidence(Incidence *))); 392 mMainView, SLOT(showIncidence(Incidence *)));
392 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 393 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
393 mMainView, SLOT(editIncidence(Incidence *))); 394 mMainView, SLOT(editIncidence(Incidence *)));
394 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 395 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
395 mMainView, SLOT(deleteIncidence(Incidence *))); 396 mMainView, SLOT(deleteIncidence(Incidence *)));
396 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 397 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
397 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 398 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
398 connect( mListView, SIGNAL( signalNewEvent() ), 399 connect( mListView, SIGNAL( signalNewEvent() ),
399 mMainView, SLOT( newEvent() ) ); 400 mMainView, SLOT( newEvent() ) );
400 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 401 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
401 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 402 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
402 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 403 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
403 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 404 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
404 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 405 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
405 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 406 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
406 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 407 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
407 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 408 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
408 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 409 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
409 } 410 }
410 // bool temp = mFlagShowNextxDays; 411 // bool temp = mFlagShowNextxDays;
411 //globalFlagBlockPainting = true; 412 //globalFlagBlockPainting = true;
412 globalFlagBlockAgenda = 1; 413 globalFlagBlockAgenda = 1;
413 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 414 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
414 mMainView->setBlockShowDates( true ); 415 mMainView->setBlockShowDates( true );
415 mMainView->dateNavigator()->selectMonth(); 416 mMainView->dateNavigator()->selectMonth();
416 mMainView->setBlockShowDates( false ); 417 mMainView->setBlockShowDates( false );
417 } 418 }
418 showView(mListView, KOPrefs::instance()->mFullViewTodo); 419 showView(mListView, KOPrefs::instance()->mFullViewTodo);
419 //mFlagShowNextxDays = temp; 420 //mFlagShowNextxDays = temp;
420} 421}
421 422
422void KOViewManager::showAgendaView( bool fullScreen ) 423void KOViewManager::showAgendaView( bool fullScreen )
423{ 424{
424 425
425 mMainView->dialogManager()->hideSearchDialog(); 426 mMainView->dialogManager()->hideSearchDialog();
426 // qDebug("KOViewManager::showAgendaView "); 427 // qDebug("KOViewManager::showAgendaView ");
427 bool full; 428 bool full;
428 full = fullScreen; 429 full = fullScreen;
429 if (!mAgendaView) { 430 if (!mAgendaView) {
430 full = false; 431 full = false;
431 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 432 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
432 addView(mAgendaView); 433 addView(mAgendaView);
433#ifndef DESKTOP_VERSION 434#ifndef DESKTOP_VERSION
434 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 435 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
435#endif 436#endif
436 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 437 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
437 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 438 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
438 439
439 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 440 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
440 441
441 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 442 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
442 443
443 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 444 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
444 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 445 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
445 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 446 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
446 mMainView, SLOT(newEvent(QDateTime))); 447 mMainView, SLOT(newEvent(QDateTime)));
447 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 448 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
448 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 449 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
449 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 450 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
450 mMainView, SLOT(newEvent(QDate))); 451 mMainView, SLOT(newEvent(QDate)));
451 452
452 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 453 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
453 mMainView, SLOT(editIncidence(Incidence *))); 454 mMainView, SLOT(editIncidence(Incidence *)));
454 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 455 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
455 mMainView, SLOT(showIncidence(Incidence *))); 456 mMainView, SLOT(showIncidence(Incidence *)));
456 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 457 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
457 mMainView, SLOT(deleteIncidence(Incidence *))); 458 mMainView, SLOT(deleteIncidence(Incidence *)));
458 459
459 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 460 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
460 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 461 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
461 462
462 connect(mAgendaView, SIGNAL( toggleExpand() ), 463 connect(mAgendaView, SIGNAL( toggleExpand() ),
463 mMainView, SLOT( toggleExpand() ) ); 464 mMainView, SLOT( toggleExpand() ) );
464 465
465 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 466 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
466 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 467 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
467 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 468 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
468 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 469 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
469 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 470 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
470 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 471 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
471 SLOT( updateTodo( Todo *, int ) ) ); 472 SLOT( updateTodo( Todo *, int ) ) );
472 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 473 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
473 mMainView, SIGNAL( todoModified( Todo *, int ))); 474 mMainView, SIGNAL( todoModified( Todo *, int )));
474 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 475 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
475 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 476 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
476 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 477 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
477 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 478 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
478 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 479 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
479 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 480 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
480 mAgendaView->readSettings(); 481 mAgendaView->readSettings();
481 mAgendaView->updateConfig(); 482 mAgendaView->updateConfig();
482 } 483 }
483 484
484 showView( mAgendaView, full); 485 showView( mAgendaView, full);
485 486
486} 487}
487 488
488void KOViewManager::showDayView() 489void KOViewManager::showDayView()
489{ 490{
490 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 491 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
491 mFlagShowNextxDays = false; 492 mFlagShowNextxDays = false;
492 globalFlagBlockLabel = 1; 493 globalFlagBlockLabel = 1;
493 globalFlagBlockAgenda = 1; 494 globalFlagBlockAgenda = 1;
494 if ( mCurrentAgendaView != 1 ) 495 if ( mCurrentAgendaView != 1 )
495 mCurrentAgendaView = -1; 496 mCurrentAgendaView = -1;
496 showAgendaView(); 497 showAgendaView();
497 qApp->processEvents(); 498 qApp->processEvents();
498 globalFlagBlockAgenda = 2; 499 globalFlagBlockAgenda = 2;
499 globalFlagBlockLabel = 0; 500 globalFlagBlockLabel = 0;
500 mMainView->dateNavigator()->selectDates( 1 ); 501 mMainView->dateNavigator()->selectDates( 1 );
501 mCurrentAgendaView = 1 ; 502 mCurrentAgendaView = 1 ;
502 503
503} 504}
504 505
505void KOViewManager::showWorkWeekView() 506void KOViewManager::showWorkWeekView()
506{ 507{
507 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 508 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
508 mFlagShowNextxDays = false; 509 mFlagShowNextxDays = false;
509 globalFlagBlockAgenda = 1; 510 globalFlagBlockAgenda = 1;
510 globalFlagBlockLabel = 1; 511 globalFlagBlockLabel = 1;
511 if ( mCurrentAgendaView != 5 ) 512 if ( mCurrentAgendaView != 5 )
512 mCurrentAgendaView = -1; 513 mCurrentAgendaView = -1;
513 showAgendaView(); 514 showAgendaView();
514 qApp->processEvents(); 515 qApp->processEvents();
515 globalFlagBlockAgenda = 2; 516 globalFlagBlockAgenda = 2;
516 globalFlagBlockLabel = 0; 517 globalFlagBlockLabel = 0;
517 mMainView->dateNavigator()->selectWorkWeek(); 518 mMainView->dateNavigator()->selectWorkWeek();
518 mCurrentAgendaView = 5 ; 519 mCurrentAgendaView = 5 ;
519 520
520} 521}
521 522
522void KOViewManager::showWeekView() 523void KOViewManager::showWeekView()
523{ 524{
524 /* 525 /*
525 globalFlagBlockAgenda = 2; 526 globalFlagBlockAgenda = 2;
526 qDebug("4globalFlagBlockAgenda = 2; "); 527 qDebug("4globalFlagBlockAgenda = 2; ");
527 //globalFlagBlockPainting = true; 528 //globalFlagBlockPainting = true;
528 mMainView->dateNavigator()->selectWeek(); 529 mMainView->dateNavigator()->selectWeek();
529 showAgendaView(); 530 showAgendaView();
530 */ 531 */
531 532
532 533
533 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 534 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
534 mFlagShowNextxDays = false; 535 mFlagShowNextxDays = false;
535 globalFlagBlockAgenda = 1; 536 globalFlagBlockAgenda = 1;
536 globalFlagBlockLabel = 1; 537 globalFlagBlockLabel = 1;
537 if ( mCurrentAgendaView != 7 ) 538 if ( mCurrentAgendaView != 7 )
538 mCurrentAgendaView = -1; 539 mCurrentAgendaView = -1;
539 showAgendaView(); 540 showAgendaView();
540 qApp->processEvents(); 541 qApp->processEvents();
541 globalFlagBlockAgenda = 2; 542 globalFlagBlockAgenda = 2;
542 globalFlagBlockLabel = 0; 543 globalFlagBlockLabel = 0;
543 mMainView->dateNavigator()->selectWeek(); 544 mMainView->dateNavigator()->selectWeek();
544 mCurrentAgendaView = 7 ; 545 mCurrentAgendaView = 7 ;
545} 546}
546 547
547void KOViewManager::showNextXView() 548void KOViewManager::showNextXView()
548{ 549{
549 550
550 globalFlagBlockAgenda = 1; 551 globalFlagBlockAgenda = 1;
551 if ( mCurrentAgendaView != 3 ) 552 if ( mCurrentAgendaView != 3 )
552 mCurrentAgendaView = -1; 553 mCurrentAgendaView = -1;
553 showAgendaView(KOPrefs::instance()->mFullViewMonth); 554 showAgendaView(KOPrefs::instance()->mFullViewMonth);
554 globalFlagBlockAgenda = 2; 555 globalFlagBlockAgenda = 2;
555 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 556 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
556 KOPrefs::instance()->mNextXDays ); 557 KOPrefs::instance()->mNextXDays );
557 mFlagShowNextxDays = true; 558 mFlagShowNextxDays = true;
558 mCurrentAgendaView = 3 ; 559 mCurrentAgendaView = 3 ;
559} 560}
560bool KOViewManager::showsNextDays() 561bool KOViewManager::showsNextDays()
561{ 562{
562 return mFlagShowNextxDays; 563 return mFlagShowNextxDays;
563} 564}
564void KOViewManager::createMonthView() 565void KOViewManager::createMonthView()
565{ 566{
566if (!mMonthView) { 567if (!mMonthView) {
567 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 568 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
568 569
569 addView(mMonthView); 570 addView(mMonthView);
570 // mMonthView->show(); 571 // mMonthView->show();
571 // SIGNALS/SLOTS FOR MONTH VIEW 572 // SIGNALS/SLOTS FOR MONTH VIEW
572 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 573 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
573 mMainView, SLOT(newEvent(QDateTime))); 574 mMainView, SLOT(newEvent(QDateTime)));
574 575
575 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 576 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
576 mMainView, SLOT(showIncidence(Incidence *))); 577 mMainView, SLOT(showIncidence(Incidence *)));
577 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 578 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
578 mMainView, SLOT(editIncidence(Incidence *))); 579 mMainView, SLOT(editIncidence(Incidence *)));
579 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 580 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
580 mMainView, SLOT(deleteIncidence(Incidence *))); 581 mMainView, SLOT(deleteIncidence(Incidence *)));
581 582
582 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 583 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
583 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 584 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
584 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 585 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
585 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 586 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
586 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 587 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
587 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 588 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
588 589
589 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 590 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
590 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 591 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
591 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 592 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
592 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 593 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
593 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 594 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
594 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 595 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
595 connect( mMonthView, SIGNAL( selectMonth() ), 596 connect( mMonthView, SIGNAL( selectMonth() ),
596 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 597 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
597 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 598 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
598 mMainView, SLOT ( showDay( QDate ) ) ); 599 mMainView, SLOT ( showDay( QDate ) ) );
599 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 600 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
600 connect( mMonthView, SIGNAL(nextMonth() ), 601 connect( mMonthView, SIGNAL(nextMonth() ),
601 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 602 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
602 connect( mMonthView, SIGNAL(prevMonth() ), 603 connect( mMonthView, SIGNAL(prevMonth() ),
603 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 604 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
604 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 605 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
605 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 606 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
606 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 607 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
607 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 608 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
608 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 609 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
609 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 610 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
610 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 611 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
611 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 612 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
612 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 613 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
613 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 614 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
614 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 615 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
615 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 616 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
616 617
617 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 618 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
618 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 619 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
619 620
620 621
621 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 622 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
622 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 623 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
623 624
624 } 625 }
625} 626}
626void KOViewManager::showMonthViewWeek() 627void KOViewManager::showMonthViewWeek()
627{ 628{
628 createMonthView(); 629 createMonthView();
629 globalFlagBlockAgenda = 1; 630 globalFlagBlockAgenda = 1;
630 bool full = true; 631 bool full = true;
631 if ( mCurrentView == mMonthView) 632 if ( mCurrentView == mMonthView)
632 full = mMainView->leftFrame()->isVisible(); 633 full = mMainView->leftFrame()->isVisible();
633 if ( !KOPrefs::instance()->mMonthViewWeek ) { 634 if ( !KOPrefs::instance()->mMonthViewWeek ) {
634 mMonthView->switchView(); 635 mMonthView->switchView();
635 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 636 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
636 full = false; 637 full = false;
637 else 638 else
638 full = true; 639 full = true;
639 } 640 }
640 mMainView->dateNavigator()->selectWeek(); 641 mMainView->dateNavigator()->selectWeek();
641 showView(mMonthView, full ); 642 showView(mMonthView, full );
642} 643}
643 644
644void KOViewManager::showMonth( const QDate & date ) 645void KOViewManager::showMonth( const QDate & date )
645{ 646{
646 mMainView->dateNavigator()->blockSignals( true ); 647 mMainView->dateNavigator()->blockSignals( true );
647 mMainView->dateNavigator()->selectDate( date ); 648 mMainView->dateNavigator()->selectDate( date );
648 mMainView->dateNavigator()->blockSignals( false ); 649 mMainView->dateNavigator()->blockSignals( false );
649 showMonthView(); 650 showMonthView();
650} 651}
651void KOViewManager::showMonthView() 652void KOViewManager::showMonthView()
652 { 653 {
653 654
654 createMonthView(); 655 createMonthView();
655 globalFlagBlockAgenda = 1; 656 globalFlagBlockAgenda = 1;
656 //mFlagShowNextxDays = false; 657 //mFlagShowNextxDays = false;
657 bool full = true; 658 bool full = true;
658 if ( mCurrentView == mMonthView) 659 if ( mCurrentView == mMonthView)
659 full = mMainView->leftFrame()->isVisible(); 660 full = mMainView->leftFrame()->isVisible();
660 // if(mMonthView == mCurrentView) return; 661 // if(mMonthView == mCurrentView) return;
661 if ( KOPrefs::instance()->mMonthViewWeek ) { 662 if ( KOPrefs::instance()->mMonthViewWeek ) {
662 mMonthView->switchView(); 663 mMonthView->switchView();
663 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 664 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
664 full = false; 665 full = false;
665 else 666 else
666 full = true; 667 full = true;
667 } 668 }
668 mMainView->dateNavigator()->selectMonth(); 669 mMainView->dateNavigator()->selectMonth();
669 670
670 showView(mMonthView, full ); 671 showView(mMonthView, full );
671 672
672} 673}
673 674
674void KOViewManager::showTodoView() 675void KOViewManager::showTodoView()
675{ 676{
676 //mFlagShowNextxDays = false; 677 //mFlagShowNextxDays = false;
677 if ( !mTodoView ) { 678 if ( !mTodoView ) {
678 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 679 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
679 "KOViewManager::TodoView" ); 680 "KOViewManager::TodoView" );
680 681
681 addView( mTodoView ); 682 addView( mTodoView );
682 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 683 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
683 684
684 // SIGNALS/SLOTS FOR TODO VIEW 685 // SIGNALS/SLOTS FOR TODO VIEW
685 connect( mTodoView, SIGNAL( newTodoSignal() ), 686 connect( mTodoView, SIGNAL( newTodoSignal() ),
686 mMainView, SLOT( newTodo() ) ); 687 mMainView, SLOT( newTodo() ) );
687 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 688 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
688 mMainView, SLOT( newSubTodo( Todo *) ) ); 689 mMainView, SLOT( newSubTodo( Todo *) ) );
689 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 690 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
690 mMainView, SLOT( showTodo( Todo * ) ) ); 691 mMainView, SLOT( showTodo( Todo * ) ) );
691 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 692 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
692 mMainView, SLOT( editTodo( Todo * ) ) ); 693 mMainView, SLOT( editTodo( Todo * ) ) );
693 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 694 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
694 mMainView, SLOT( deleteTodo( Todo * ) ) ); 695 mMainView, SLOT( deleteTodo( Todo * ) ) );
695 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 696 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
696 mMainView, SLOT( purgeCompleted() ) ); 697 mMainView, SLOT( purgeCompleted() ) );
697 698
698 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 699 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
699 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 700 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
700 701
701 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 702 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
702 SLOT( updateConfig() ) ); 703 SLOT( updateConfig() ) );
703 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 704 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
704 SLOT( updateTodo( Todo *, int ) ) ); 705 SLOT( updateTodo( Todo *, int ) ) );
705 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 706 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
706 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 707 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
707 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 708 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
708 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 709 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
709 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 710 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
710 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 711 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
711 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 712 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
712 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 713 mMainView, SLOT ( todo_unsub( Todo * ) ) );
713 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 714 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
714 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 715 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
715 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 716 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
716 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 717 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
717 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 718 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
718 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 719 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
719 KConfig *config = KOGlobals::config(); 720 KConfig *config = KOGlobals::config();
720 mTodoView->restoreLayout(config,"Todo View"); 721 mTodoView->restoreLayout(config,"Todo View");
721 mTodoView->setNavigator( mMainView->dateNavigator() ); 722 mTodoView->setNavigator( mMainView->dateNavigator() );
722 } 723 }
723 724
724 globalFlagBlockAgenda = 1; 725 globalFlagBlockAgenda = 1;
725 showView( mTodoView, true ); 726 showView( mTodoView, true );
726 727
727} 728}
728 729
729void KOViewManager::showJournalView() 730void KOViewManager::showJournalView()
730{ 731{
731 //mFlagShowNextxDays = false; 732 //mFlagShowNextxDays = false;
732 if (!mJournalView) { 733 if (!mJournalView) {
733 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 734 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
734 "KOViewManager::JournalView"); 735 "KOViewManager::JournalView");
735 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 736 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
736 SLOT( updateConfig() ) ); 737 SLOT( updateConfig() ) );
737 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 738 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
738 addView(mJournalView); 739 addView(mJournalView);
739 } 740 }
740 741
741 showView(mJournalView); 742 showView(mJournalView);
742 mMainView->dateNavigator()->selectDates( 1 ); 743 mMainView->dateNavigator()->selectDates( 1 );
743} 744}
744 745
745void KOViewManager::showTimeSpanView() 746void KOViewManager::showTimeSpanView()
746{ 747{
747 //mFlagShowNextxDays = false; 748 //mFlagShowNextxDays = false;
748 if (!mTimeSpanView) { 749 if (!mTimeSpanView) {
749 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 750 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
750 "KOViewManager::TimeSpanView"); 751 "KOViewManager::TimeSpanView");
751 addView(mTimeSpanView); 752 addView(mTimeSpanView);
752 753
753 mTimeSpanView->readSettings(); 754 mTimeSpanView->readSettings();
754 } 755 }
755 756
756 showView(mTimeSpanView); 757 showView(mTimeSpanView);
757} 758}
758 759
759Incidence *KOViewManager::currentSelection() 760Incidence *KOViewManager::currentSelection()
760{ 761{
761 if (!mCurrentView) return 0; 762 if (!mCurrentView) return 0;
762 if ( mCurrentView == mListView ) { 763 if ( mCurrentView == mListView ) {
763 if ( mListView->currentItem() ) 764 if ( mListView->currentItem() )
764 return mListView->currentItem(); 765 return mListView->currentItem();
765 } 766 }
766 return mCurrentView->selectedIncidences().first(); 767 return mCurrentView->selectedIncidences().first();
767} 768}
768 769
769QDate KOViewManager::currentSelectionDate() 770QDate KOViewManager::currentSelectionDate()
770{ 771{
771 QDate qd; 772 QDate qd;
772 if (mCurrentView) { 773 if (mCurrentView) {
773 DateList qvl = mCurrentView->selectedDates(); 774 DateList qvl = mCurrentView->selectedDates();
774 if (!qvl.isEmpty()) qd = qvl.first(); 775 if (!qvl.isEmpty()) qd = qvl.first();
775 } 776 }
776 return qd; 777 return qd;
777} 778}
778 779
779void KOViewManager::addView(KOrg::BaseView *view) 780void KOViewManager::addView(KOrg::BaseView *view)
780{ 781{
781#if QT_VERSION >= 0x030000 782#if QT_VERSION >= 0x030000
782 mMainView->viewStack()->addWidget( view ); 783 mMainView->viewStack()->addWidget( view );
783#else 784#else
784 mMainView->viewStack()->addWidget( view, 1 ); 785 mMainView->viewStack()->addWidget( view, 1 );
785#endif 786#endif
786} 787}
787 788
788void KOViewManager::setDocumentId( const QString &id ) 789void KOViewManager::setDocumentId( const QString &id )
789{ 790{
790 if (mTodoView) mTodoView->setDocumentId( id ); 791 if (mTodoView) mTodoView->setDocumentId( id );
791} 792}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index b947cac..24055af 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -244,1552 +244,1553 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
245 mView->setModified( false ); 245 mView->setModified( false );
246 mBlockAtStartup = false; 246 mBlockAtStartup = false;
247 mView->setModified( false ); 247 mView->setModified( false );
248 setCentralWidget( mView ); 248 setCentralWidget( mView );
249 globalFlagBlockStartup = 0; 249 globalFlagBlockStartup = 0;
250 mView->show(); 250 mView->show();
251 delete splash; 251 delete splash;
252 if ( newFile ) 252 if ( newFile )
253 mView->updateConfig(); 253 mView->updateConfig();
254 // qApp->processEvents(); 254 // qApp->processEvents();
255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
256 //fillSyncMenu(); 256 //fillSyncMenu();
257 257
258 258
259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( sentSyncFile()); 264 mSyncManager->setDefaultFileName( sentSyncFile());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 266 mSyncManager->fillSyncMenu();
267 267
268 268
269 269
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 271 if ( showWarning ) {
272 KMessageBox::information( this, 272 KMessageBox::information( this,
273 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 273 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
274 qApp->processEvents(); 274 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 275 mView->dialogManager()->showSyncOptions();
276 } 276 }
277 277
278 //US listen for result adressed from Ka/Pi 278 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 279#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 281#endif
282#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
283 infrared = 0; 283 infrared = 0;
284#endif 284#endif
285 updateWeek( mView->startDate() ); 285 updateWeek( mView->startDate() );
286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
287 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 287 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 288 mBRdisabled = false;
289 //toggleBeamReceive(); 289 //toggleBeamReceive();
290} 290}
291MainWindow::~MainWindow() 291MainWindow::~MainWindow()
292{ 292{
293 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 294 //save toolbar location
295 delete mCalendar; 295 delete mCalendar;
296 delete mSyncManager; 296 delete mSyncManager;
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 if ( infrared ) 298 if ( infrared )
299 delete infrared; 299 delete infrared;
300#endif 300#endif
301 301
302 302
303} 303}
304 304
305void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
306{ 306{
307#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
308 if ( b ) { 308 if ( b ) {
309 if ( infrared ) { 309 if ( infrared ) {
310 toggleBeamReceive(); 310 toggleBeamReceive();
311 mBRdisabled = true; 311 mBRdisabled = true;
312 } 312 }
313 mBRdisabled = true; 313 mBRdisabled = true;
314 } else { 314 } else {
315 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
316 mBRdisabled = false; 316 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 318 // toggleBeamReceive();
319 } 319 }
320 } 320 }
321#endif 321#endif
322 322
323} 323}
324bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
325{ 325{
326#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 327 return ( infrared != 0 );
328#endif 328#endif
329 return false; 329 return false;
330} 330}
331 331
332void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
333{ 333{
334 if ( mBRdisabled ) 334 if ( mBRdisabled )
335 return; 335 return;
336#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
337 if ( infrared ) { 337 if ( infrared ) {
338 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
339 delete infrared; 339 delete infrared;
340 infrared = 0; 340 infrared = 0;
341 brAction->setOn(false); 341 brAction->setOn(false);
342 return; 342 return;
343 } 343 }
344 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
345 brAction->setOn(true); 345 brAction->setOn(true);
346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
348#endif 348#endif
349} 349}
350void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
351{ 351{
352#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
353 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
354 if ( mClosed ) 354 if ( mClosed )
355 mView->goToday(); 355 mView->goToday();
356#endif 356#endif
357 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
358 mClosed = false; 358 mClosed = false;
359} 359}
360void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
361{ 361{
362 362
363 363
364 364
365 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
366 saveOnClose(); 366 saveOnClose();
367 mClosed = true; 367 mClosed = true;
368 ce->accept(); 368 ce->accept();
369 return; 369 return;
370 370
371 } 371 }
372 372
373 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
374 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
375 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
376 0, 0 ) ) { 376 0, 0 ) ) {
377 case 0: 377 case 0:
378 saveOnClose(); 378 saveOnClose();
379 mClosed = true; 379 mClosed = true;
380 ce->accept(); 380 ce->accept();
381 break; 381 break;
382 case 1: 382 case 1:
383 ce->ignore(); 383 ce->ignore();
384 break; 384 break;
385 case 2: 385 case 2:
386 386
387 default: 387 default:
388 break; 388 break;
389 } 389 }
390 390
391 391
392} 392}
393 393
394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
395{ 395{
396 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
398 //QString datamess; 398 //QString datamess;
399 //qDebug("message "); 399 //qDebug("message ");
400 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
401 401
402 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
403 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
404 QString fileName; 404 QString fileName;
405 stream >> fileName; 405 stream >> fileName;
406 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
407 showMaximized(); 407 showMaximized();
408 raise(); 408 raise();
409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
410 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
411 return; 411 return;
412 } 412 }
413 413
414 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
415 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
416 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
417 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
418 showMaximized(); 418 showMaximized();
419 raise(); 419 raise();
420 return; 420 return;
421 421
422 } 422 }
423 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
424 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
425 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
426 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
427 //showMaximized(); 427 //showMaximized();
428 //raise(); 428 //raise();
429 hide(); 429 hide();
430 return; 430 return;
431 } 431 }
432 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
433 qDebug("newCountdown "); 433 qDebug("newCountdown ");
434 434
435 } 435 }
436 QString msg ; 436 QString msg ;
437 QString allmsg = cmsg; 437 QString allmsg = cmsg;
438 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
439 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
440 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
441 msg = allmsg; 441 msg = allmsg;
442 allmsg = ""; 442 allmsg = "";
443 } else{ 443 } else{
444 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
446 } 446 }
447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
448 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
449 mView->newEvent(); 449 mView->newEvent();
450 } 450 }
451 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
452 mView->newTodo(); 452 mView->newTodo();
453 453
454 } 454 }
455 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
456 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
457 } 457 }
458 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
459 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
460 } 460 }
461 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
462 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
463 } 463 }
464 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
465 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
466 } 466 }
467 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
468 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
469 } 469 }
470 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
471 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
472 } 472 }
473 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
474 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
475 } 475 }
476 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
477 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
478 } 478 }
479 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
480 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
481 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
482 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
483 } 483 }
484 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
485 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
486 } 486 }
487 else if ( msg == "-showWNext" ) { 487 else if ( msg == "-showWNext" ) {
488 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
489 } 489 }
490 else if ( msg == "nextView()" ) { 490 else if ( msg == "nextView()" ) {
491 mView->viewManager()->showNextView(); 491 mView->viewManager()->showNextView();
492 } 492 }
493 else if ( msg == "-showNextXView" ) { 493 else if ( msg == "-showNextXView" ) {
494 mView->viewManager()->showNextXView(); 494 mView->viewManager()->showNextXView();
495 } 495 }
496 496
497 497
498 } 498 }
499 499
500 showMaximized(); 500 showMaximized();
501 raise(); 501 raise();
502} 502}
503 503
504QPixmap MainWindow::loadPixmap( QString name ) 504QPixmap MainWindow::loadPixmap( QString name )
505{ 505{
506 return SmallIcon( name ); 506 return SmallIcon( name );
507 507
508} 508}
509void MainWindow::initActions() 509void MainWindow::initActions()
510{ 510{
511 //KOPrefs::instance()->mShowFullMenu 511 //KOPrefs::instance()->mShowFullMenu
512 iconToolBar->clear(); 512 iconToolBar->clear();
513 KOPrefs *p = KOPrefs::instance(); 513 KOPrefs *p = KOPrefs::instance();
514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
515 515
516 QPopupMenu *viewMenu = new QPopupMenu( this ); 516 QPopupMenu *viewMenu = new QPopupMenu( this );
517 QPopupMenu *actionMenu = new QPopupMenu( this ); 517 QPopupMenu *actionMenu = new QPopupMenu( this );
518 QPopupMenu *importMenu = new QPopupMenu( this ); 518 QPopupMenu *importMenu = new QPopupMenu( this );
519 QPopupMenu *importMenu_X = new QPopupMenu( this ); 519 QPopupMenu *importMenu_X = new QPopupMenu( this );
520 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 520 QPopupMenu *exportMenu_X = new QPopupMenu( this );
521 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 521 QPopupMenu *beamMenu_X = new QPopupMenu( this );
522 selectFilterMenu = new QPopupMenu( this ); 522 selectFilterMenu = new QPopupMenu( this );
523 selectFilterMenu->setCheckable( true ); 523 selectFilterMenu->setCheckable( true );
524 syncMenu = new QPopupMenu( this ); 524 syncMenu = new QPopupMenu( this );
525 configureAgendaMenu = new QPopupMenu( this ); 525 configureAgendaMenu = new QPopupMenu( this );
526 configureToolBarMenu = new QPopupMenu( this ); 526 configureToolBarMenu = new QPopupMenu( this );
527 QPopupMenu *helpMenu = new QPopupMenu( this ); 527 QPopupMenu *helpMenu = new QPopupMenu( this );
528 QIconSet icon; 528 QIconSet icon;
529 int pixWid = 22, pixHei = 22; 529 int pixWid = 22, pixHei = 22;
530 QString pathString = ""; 530 QString pathString = "";
531 if ( !p->mToolBarMiniIcons ) { 531 if ( !p->mToolBarMiniIcons ) {
532 if ( QApplication::desktop()->width() < 480 ) { 532 if ( QApplication::desktop()->width() < 480 ) {
533 pathString += "icons16/"; 533 pathString += "icons16/";
534 pixWid = 18; pixHei = 16; 534 pixWid = 18; pixHei = 16;
535 } 535 }
536 } else { 536 } else {
537 pathString += "iconsmini/"; 537 pathString += "iconsmini/";
538 pixWid = 18; pixHei = 16; 538 pixWid = 18; pixHei = 16;
539 } 539 }
540 if ( KOPrefs::instance()->mShowFullMenu ) { 540 if ( KOPrefs::instance()->mShowFullMenu ) {
541 QMenuBar *menuBar1; 541 QMenuBar *menuBar1;
542 menuBar1 = menuBar(); 542 menuBar1 = menuBar();
543 menuBar1->insertItem( i18n("File"), importMenu ); 543 menuBar1->insertItem( i18n("File"), importMenu );
544 menuBar1->insertItem( i18n("View"), viewMenu ); 544 menuBar1->insertItem( i18n("View"), viewMenu );
545 menuBar1->insertItem( i18n("Actions"), actionMenu ); 545 menuBar1->insertItem( i18n("Actions"), actionMenu );
546#ifdef DESKTOP_VERSION 546#ifdef DESKTOP_VERSION
547 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 547 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
549#else 549#else
550 menuBar1->insertItem( i18n("Sync"), syncMenu ); 550 menuBar1->insertItem( i18n("Sync"), syncMenu );
551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
552#endif 552#endif
553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
555 menuBar1->insertItem( i18n("Help"), helpMenu ); 555 menuBar1->insertItem( i18n("Help"), helpMenu );
556 } else { 556 } else {
557 QPEMenuBar *menuBar1; 557 QPEMenuBar *menuBar1;
558 menuBar1 = new QPEMenuBar( iconToolBar ); 558 menuBar1 = new QPEMenuBar( iconToolBar );
559 QPopupMenu *menuBar = new QPopupMenu( this ); 559 QPopupMenu *menuBar = new QPopupMenu( this );
560 icon = loadPixmap( pathString + "z_menu" ); 560 icon = loadPixmap( pathString + "z_menu" );
561 menuBar1->insertItem( icon.pixmap(), menuBar); 561 menuBar1->insertItem( icon.pixmap(), menuBar);
562 //menuBar1->insertItem( i18n("ME"), menuBar); 562 //menuBar1->insertItem( i18n("ME"), menuBar);
563 menuBar->insertItem( i18n("File"), importMenu ); 563 menuBar->insertItem( i18n("File"), importMenu );
564 menuBar->insertItem( i18n("View"), viewMenu ); 564 menuBar->insertItem( i18n("View"), viewMenu );
565 menuBar->insertItem( i18n("Actions"), actionMenu ); 565 menuBar->insertItem( i18n("Actions"), actionMenu );
566 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 566 menuBar->insertItem( i18n("Synchronize"), syncMenu );
567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
569 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 569 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
570 menuBar->insertItem( i18n("Help"), helpMenu ); 570 menuBar->insertItem( i18n("Help"), helpMenu );
571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
572 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 572 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
573 } 573 }
574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
576 mWeekBgColor = iconToolBar->backgroundColor(); 576 mWeekBgColor = iconToolBar->backgroundColor();
577 mWeekPixmap.resize( pixWid , pixHei ); 577 mWeekPixmap.resize( pixWid , pixHei );
578 mWeekPixmap.fill( mWeekBgColor ); 578 mWeekPixmap.fill( mWeekBgColor );
579 icon = mWeekPixmap; 579 icon = mWeekPixmap;
580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
581 if ( p-> mShowIconWeekNum ) 581 if ( p-> mShowIconWeekNum )
582 mWeekAction->addTo( iconToolBar ); 582 mWeekAction->addTo( iconToolBar );
583 mWeekFont = font(); 583 mWeekFont = font();
584 584
585 int fontPoint = mWeekFont.pointSize(); 585 int fontPoint = mWeekFont.pointSize();
586 QFontMetrics f( mWeekFont ); 586 QFontMetrics f( mWeekFont );
587 int fontWid = f.width( "30" ); 587 int fontWid = f.width( "30" );
588 while ( fontWid > pixWid ) { 588 while ( fontWid > pixWid ) {
589 --fontPoint; 589 --fontPoint;
590 mWeekFont.setPointSize( fontPoint ); 590 mWeekFont.setPointSize( fontPoint );
591 QFontMetrics f( mWeekFont ); 591 QFontMetrics f( mWeekFont );
592 fontWid = f.width( "30" ); 592 fontWid = f.width( "30" );
593 qDebug("dec-- "); 593 qDebug("dec-- ");
594 } 594 }
595 595
596 connect( mWeekAction, SIGNAL( activated() ), 596 connect( mWeekAction, SIGNAL( activated() ),
597 this, SLOT( weekAction() ) ); 597 this, SLOT( weekAction() ) );
598 598
599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
600 600
601 //#endif 601 //#endif
602 // ****************** 602 // ******************
603 QAction *action; 603 QAction *action;
604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
605 configureToolBarMenu->setCheckable( true ); 605 configureToolBarMenu->setCheckable( true );
606 606
607 607
608 configureAgendaMenu->setCheckable( true ); 608 configureAgendaMenu->setCheckable( true );
609 int iii ; 609 int iii ;
610 for ( iii = 1;iii<= 10 ;++iii ){ 610 for ( iii = 1;iii<= 10 ;++iii ){
611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
612 } 612 }
613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
614 614
615 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 615 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
616 this, SLOT( showConfigureAgenda( ) ) ); 616 this, SLOT( showConfigureAgenda( ) ) );
617 617
618 icon = loadPixmap( pathString + "configure" ); 618 icon = loadPixmap( pathString + "configure" );
619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
620 action->addTo( actionMenu ); 620 action->addTo( actionMenu );
621 connect( action, SIGNAL( activated() ), 621 connect( action, SIGNAL( activated() ),
622 mView, SLOT( edit_options() ) ); 622 mView, SLOT( edit_options() ) );
623 actionMenu->insertSeparator(); 623 actionMenu->insertSeparator();
624 624
625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
626 action->addTo( actionMenu ); 626 action->addTo( actionMenu );
627 connect( action, SIGNAL( activated() ), 627 connect( action, SIGNAL( activated() ),
628 mView, SLOT( undo_delete() ) ); 628 mView, SLOT( undo_delete() ) );
629 actionMenu->insertSeparator(); 629 actionMenu->insertSeparator();
630 630
631 icon = loadPixmap( pathString + "newevent" ); 631 icon = loadPixmap( pathString + "newevent" );
632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
633 configureToolBarMenu->insertSeparator(); 633 configureToolBarMenu->insertSeparator();
634 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 634 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
637 ne_action->addTo( actionMenu ); 637 ne_action->addTo( actionMenu );
638 connect( ne_action, SIGNAL( activated() ), 638 connect( ne_action, SIGNAL( activated() ),
639 mView, SLOT( newEvent() ) ); 639 mView, SLOT( newEvent() ) );
640 icon = loadPixmap( pathString + "newtodo" ); 640 icon = loadPixmap( pathString + "newtodo" );
641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
643 nt_action->addTo( actionMenu ); 643 nt_action->addTo( actionMenu );
644 connect( nt_action, SIGNAL( activated() ), 644 connect( nt_action, SIGNAL( activated() ),
645 mView, SLOT( newTodo() ) ); 645 mView, SLOT( newTodo() ) );
646 646
647 icon = loadPixmap( pathString + "today" ); 647 icon = loadPixmap( pathString + "today" );
648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
649 today_action->addTo( viewMenu ); 649 today_action->addTo( viewMenu );
650 connect( today_action, SIGNAL( activated() ), 650 connect( today_action, SIGNAL( activated() ),
651 mView, SLOT( goToday() ) ); 651 mView, SLOT( goToday() ) );
652 viewMenu->insertSeparator(); 652 viewMenu->insertSeparator();
653 653
654 icon = loadPixmap( pathString + "navi" ); 654 icon = loadPixmap( pathString + "navi" );
655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
656 action->addTo( viewMenu ); 656 action->addTo( viewMenu );
657 connect( action, SIGNAL( activated() ), 657 connect( action, SIGNAL( activated() ),
658 mView, SLOT( toggleDateNavigatorWidget() ) ); 658 mView, SLOT( toggleDateNavigatorWidget() ) );
659 mToggleNav = action ; 659 mToggleNav = action ;
660 icon = loadPixmap( pathString + "filter" ); 660 icon = loadPixmap( pathString + "filter" );
661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
662 action->addTo( viewMenu ); 662 action->addTo( viewMenu );
663 connect( action, SIGNAL( activated() ), 663 connect( action, SIGNAL( activated() ),
664 mView, SLOT( toggleFilter() ) ); 664 mView, SLOT( toggleFilter() ) );
665 mToggleFilter = action; 665 mToggleFilter = action;
666 icon = loadPixmap( pathString + "allday" ); 666 icon = loadPixmap( pathString + "allday" );
667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
668 action->addTo( viewMenu ); 668 action->addTo( viewMenu );
669 connect( action, SIGNAL( activated() ), 669 connect( action, SIGNAL( activated() ),
670 mView, SLOT( toggleAllDaySize() ) ); 670 mView, SLOT( toggleAllDaySize() ) );
671 mToggleAllday = action; 671 mToggleAllday = action;
672 672
673 673
674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
675 mToggleNav, SLOT( setEnabled ( bool ) ) ); 675 mToggleNav, SLOT( setEnabled ( bool ) ) );
676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
677 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 677 mToggleFilter, SLOT( setEnabled ( bool ) ) );
678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
679 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 679 mToggleAllday, SLOT( setEnabled ( bool ) ) );
680 680
681 viewMenu->insertSeparator(); 681 viewMenu->insertSeparator();
682 icon = loadPixmap( pathString + "picker" ); 682 icon = loadPixmap( pathString + "picker" );
683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
684 action->addTo( viewMenu ); 684 action->addTo( viewMenu );
685 connect( action, SIGNAL( activated() ), 685 connect( action, SIGNAL( activated() ),
686 mView, SLOT( showDatePicker() ) ); 686 mView, SLOT( showDatePicker() ) );
687 action->addTo( iconToolBar ); 687 action->addTo( iconToolBar );
688 viewMenu->insertSeparator(); 688 viewMenu->insertSeparator();
689 icon = loadPixmap( pathString + "list" ); 689 icon = loadPixmap( pathString + "list" );
690 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 690 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
691 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 691 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
692 showlist_action->addTo( viewMenu ); 692 showlist_action->addTo( viewMenu );
693 connect( showlist_action, SIGNAL( activated() ), 693 connect( showlist_action, SIGNAL( activated() ),
694 mView->viewManager(), SLOT( showListView() ) ); 694 mView->viewManager(), SLOT( showListView() ) );
695 695
696 696
697 icon = loadPixmap( pathString + "day" ); 697 icon = loadPixmap( pathString + "day" );
698 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 698 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
699 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 699 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
700 day1_action->addTo( viewMenu ); 700 day1_action->addTo( viewMenu );
701 // action->addTo( toolBar ); 701 // action->addTo( toolBar );
702 connect( day1_action, SIGNAL( activated() ), 702 connect( day1_action, SIGNAL( activated() ),
703 mView->viewManager(), SLOT( showDayView() ) ); 703 mView->viewManager(), SLOT( showDayView() ) );
704 704
705 icon = loadPixmap( pathString + "workweek" ); 705 icon = loadPixmap( pathString + "workweek" );
706 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 706 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
707 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 707 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
708 day5_action->addTo( viewMenu ); 708 day5_action->addTo( viewMenu );
709 connect( day5_action, SIGNAL( activated() ), 709 connect( day5_action, SIGNAL( activated() ),
710 mView->viewManager(), SLOT( showWorkWeekView() ) ); 710 mView->viewManager(), SLOT( showWorkWeekView() ) );
711 711
712 icon = loadPixmap( pathString + "week" ); 712 icon = loadPixmap( pathString + "week" );
713 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 713 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
714 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 714 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
715 day7_action->addTo( viewMenu ); 715 day7_action->addTo( viewMenu );
716 connect( day7_action, SIGNAL( activated() ), 716 connect( day7_action, SIGNAL( activated() ),
717 mView->viewManager(), SLOT( showWeekView() ) ); 717 mView->viewManager(), SLOT( showWeekView() ) );
718 718
719 icon = loadPixmap( pathString + "workweek2" ); 719 icon = loadPixmap( pathString + "workweek2" );
720 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 720 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
721 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 721 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
722 day6_action->addTo( viewMenu ); 722 day6_action->addTo( viewMenu );
723 connect( day6_action, SIGNAL( activated() ), 723 connect( day6_action, SIGNAL( activated() ),
724 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 724 mView->viewManager(), SLOT( showMonthViewWeek() ) );
725 725
726 icon = loadPixmap( pathString + "month" ); 726 icon = loadPixmap( pathString + "month" );
727 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 727 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
728 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 728 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
729 month_action->addTo( viewMenu ); 729 month_action->addTo( viewMenu );
730 connect( month_action, SIGNAL( activated() ), 730 connect( month_action, SIGNAL( activated() ),
731 mView->viewManager(), SLOT( showMonthView() ) ); 731 mView->viewManager(), SLOT( showMonthView() ) );
732 732
733 icon = loadPixmap( pathString + "todo" ); 733 icon = loadPixmap( pathString + "todo" );
734 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 734 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
735 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 735 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
736 todoview_action->addTo( viewMenu ); 736 todoview_action->addTo( viewMenu );
737 connect( todoview_action, SIGNAL( activated() ), 737 connect( todoview_action, SIGNAL( activated() ),
738 mView->viewManager(), SLOT( showTodoView() ) ); 738 mView->viewManager(), SLOT( showTodoView() ) );
739 739
740 icon = loadPixmap( pathString + "journal" ); 740 icon = loadPixmap( pathString + "journal" );
741 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 741 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
742 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 742 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
743 viewjournal_action->addTo( viewMenu ); 743 viewjournal_action->addTo( viewMenu );
744 connect( viewjournal_action, SIGNAL( activated() ), 744 connect( viewjournal_action, SIGNAL( activated() ),
745 mView->viewManager(), SLOT( showJournalView() ) ); 745 mView->viewManager(), SLOT( showJournalView() ) );
746 746
747 icon = loadPixmap( pathString + "xdays" ); 747 icon = loadPixmap( pathString + "xdays" );
748 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 748 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
749 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 749 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
750 xdays_action->addTo( viewMenu ); 750 xdays_action->addTo( viewMenu );
751 connect( xdays_action, SIGNAL( activated() ), 751 connect( xdays_action, SIGNAL( activated() ),
752 mView->viewManager(), SLOT( showNextXView() ) ); 752 mView->viewManager(), SLOT( showNextXView() ) );
753 753
754 icon = loadPixmap( pathString + "whatsnext" ); 754 icon = loadPixmap( pathString + "whatsnext" );
755 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 755 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
756 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 756 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
757 whatsnext_action->addTo( viewMenu ); 757 whatsnext_action->addTo( viewMenu );
758 connect( whatsnext_action, SIGNAL( activated() ), 758 connect( whatsnext_action, SIGNAL( activated() ),
759 mView->viewManager(), SLOT( showWhatsNextView() ) ); 759 mView->viewManager(), SLOT( showWhatsNextView() ) );
760 760
761#if 0 761#if 0
762 action = new QAction( "view_timespan", "Time Span", 0, this ); 762 action = new QAction( "view_timespan", "Time Span", 0, this );
763 action->addTo( viewMenu ); 763 action->addTo( viewMenu );
764 connect( action, SIGNAL( activated() ), 764 connect( action, SIGNAL( activated() ),
765 mView->viewManager(), SLOT( showTimeSpanView() ) ); 765 mView->viewManager(), SLOT( showTimeSpanView() ) );
766#endif 766#endif
767 767
768 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 768 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
769 this ); 769 this );
770 mNewSubTodoAction->addTo( actionMenu ); 770 mNewSubTodoAction->addTo( actionMenu );
771 connect( mNewSubTodoAction, SIGNAL( activated() ), 771 connect( mNewSubTodoAction, SIGNAL( activated() ),
772 mView, SLOT( newSubTodo() ) ); 772 mView, SLOT( newSubTodo() ) );
773 773
774 actionMenu->insertSeparator(); 774 actionMenu->insertSeparator();
775 775
776 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 776 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
777 mShowAction->addTo( actionMenu ); 777 mShowAction->addTo( actionMenu );
778 connect( mShowAction, SIGNAL( activated() ), 778 connect( mShowAction, SIGNAL( activated() ),
779 mView, SLOT( showIncidence() ) ); 779 mView, SLOT( showIncidence() ) );
780 780
781 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 781 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
782 mEditAction->addTo( actionMenu ); 782 mEditAction->addTo( actionMenu );
783 connect( mEditAction, SIGNAL( activated() ), 783 connect( mEditAction, SIGNAL( activated() ),
784 mView, SLOT( editIncidence() ) ); 784 mView, SLOT( editIncidence() ) );
785 785
786 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 786 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
787 mDeleteAction->addTo( actionMenu ); 787 mDeleteAction->addTo( actionMenu );
788 connect( mDeleteAction, SIGNAL( activated() ), 788 connect( mDeleteAction, SIGNAL( activated() ),
789 mView, SLOT( deleteIncidence() ) ); 789 mView, SLOT( deleteIncidence() ) );
790 790
791 791
792 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 792 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
793 mCloneAction->addTo( actionMenu ); 793 mCloneAction->addTo( actionMenu );
794 connect( mCloneAction, SIGNAL( activated() ), 794 connect( mCloneAction, SIGNAL( activated() ),
795 mView, SLOT( cloneIncidence() ) ); 795 mView, SLOT( cloneIncidence() ) );
796 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 796 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
797 mMoveAction->addTo( actionMenu ); 797 mMoveAction->addTo( actionMenu );
798 connect( mMoveAction, SIGNAL( activated() ), 798 connect( mMoveAction, SIGNAL( activated() ),
799 mView, SLOT( moveIncidence() ) ); 799 mView, SLOT( moveIncidence() ) );
800 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 800 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
801 mBeamAction->addTo( actionMenu ); 801 mBeamAction->addTo( actionMenu );
802 connect( mBeamAction, SIGNAL( activated() ), 802 connect( mBeamAction, SIGNAL( activated() ),
803 mView, SLOT( beamIncidence() ) ); 803 mView, SLOT( beamIncidence() ) );
804 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 804 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
805 mCancelAction->addTo( actionMenu ); 805 mCancelAction->addTo( actionMenu );
806 connect( mCancelAction, SIGNAL( activated() ), 806 connect( mCancelAction, SIGNAL( activated() ),
807 mView, SLOT( toggleCancelIncidence() ) ); 807 mView, SLOT( toggleCancelIncidence() ) );
808 808
809 actionMenu->insertSeparator(); 809 actionMenu->insertSeparator();
810 810
811 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 811 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
812 this ); 812 this );
813 action->addTo( actionMenu ); 813 action->addTo( actionMenu );
814 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 814 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
815 815
816 icon = loadPixmap( pathString + "search" ); 816 icon = loadPixmap( pathString + "search" );
817 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 817 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
818 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 818 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
819 search_action->addTo( actionMenu ); 819 search_action->addTo( actionMenu );
820 connect( search_action, SIGNAL( activated() ), 820 connect( search_action, SIGNAL( activated() ),
821 mView->dialogManager(), SLOT( showSearchDialog() ) ); 821 mView->dialogManager(), SLOT( showSearchDialog() ) );
822 822
823 823
824 824
825 if ( KOPrefs::instance()->mShowFullMenu ) { 825 if ( KOPrefs::instance()->mShowFullMenu ) {
826 actionMenu->insertSeparator(); 826 actionMenu->insertSeparator();
827 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 827 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
828 828
829 } 829 }
830 // actionMenu->insertSeparator(); 830 // actionMenu->insertSeparator();
831 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 831 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
832 this ); 832 this );
833 action->addTo( importMenu_X ); 833 action->addTo( importMenu_X );
834 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 834 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
835 action = new QAction( "import_quick", i18n("Import last file"), 0, 835 action = new QAction( "import_quick", i18n("Import last file"), 0,
836 this ); 836 this );
837 action->addTo( importMenu_X ); 837 action->addTo( importMenu_X );
838 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 838 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
839 importMenu_X->insertSeparator(); 839 importMenu_X->insertSeparator();
840 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 840 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
841 this ); 841 this );
842 action->addTo( importMenu_X ); 842 action->addTo( importMenu_X );
843 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 843 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
844 //#ifndef DESKTOP_VERSION 844 //#ifndef DESKTOP_VERSION
845 importMenu_X->insertSeparator(); 845 importMenu_X->insertSeparator();
846 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 846 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
847 this ); 847 this );
848 action->addTo( importMenu_X ); 848 action->addTo( importMenu_X );
849 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 849 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
850 //#else 850 //#else
851#ifdef _OL_IMPORT_ 851#ifdef _OL_IMPORT_
852 importMenu_X->insertSeparator(); 852 importMenu_X->insertSeparator();
853 action = new QAction( "import_ol", i18n("Import from OL"), 0, 853 action = new QAction( "import_ol", i18n("Import from OL"), 0,
854 this ); 854 this );
855 action->addTo( importMenu_X ); 855 action->addTo( importMenu_X );
856 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 856 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
857#endif 857#endif
858 //#endif 858 //#endif
859 859
860 //importMenu->insertSeparator(); 860 //importMenu->insertSeparator();
861 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 861 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
862 this ); 862 this );
863 action->addTo( importMenu ); 863 action->addTo( importMenu );
864 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 864 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
865 865
866 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 866 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
867 this ); 867 this );
868 action->addTo( importMenu ); 868 action->addTo( importMenu );
869 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 869 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
870 importMenu->insertSeparator(); 870 importMenu->insertSeparator();
871 importMenu->insertItem( i18n("Import"), importMenu_X ); 871 importMenu->insertItem( i18n("Import"), importMenu_X );
872 //importMenu->insertSeparator(); 872 //importMenu->insertSeparator();
873 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 873 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
874 this ); 874 this );
875 action->addTo( exportMenu_X ); 875 action->addTo( exportMenu_X );
876 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 876 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
877 877
878 878
879 //LR 879 //LR
880 QPopupMenu *ex2phone = new QPopupMenu( this ); 880 QPopupMenu *ex2phone = new QPopupMenu( this );
881 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 881 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
882 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 882 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
883 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 883 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
884 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 884 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
885 885
886 importMenu->insertItem( i18n("Export"), exportMenu_X ); 886 importMenu->insertItem( i18n("Export"), exportMenu_X );
887#ifndef DESKTOP_VERSION 887#ifndef DESKTOP_VERSION
888 //importMenu->insertSeparator(); 888 //importMenu->insertSeparator();
889 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 889 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
890 this ); 890 this );
891 brAction->addTo( beamMenu_X ); 891 brAction->addTo( beamMenu_X );
892 brAction->setToggleAction (true ) ; 892 brAction->setToggleAction (true ) ;
893 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 893 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
894 894
895 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 895 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
896 this ); 896 this );
897 action->addTo( beamMenu_X ); 897 action->addTo( beamMenu_X );
898 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 898 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
899 899
900 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 900 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
901 this ); 901 this );
902 action->addTo( beamMenu_X ); 902 action->addTo( beamMenu_X );
903 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 903 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
904 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 904 importMenu->insertItem( i18n("Beam"), beamMenu_X );
905#else 905#else
906 //importMenu->insertSeparator(); 906 //importMenu->insertSeparator();
907 icon = loadPixmap( pathString + "print" ); 907 icon = loadPixmap( pathString + "print" );
908 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 908 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
909 action->addTo( beamMenu_X ); 909 action->addTo( beamMenu_X );
910 connect( action, SIGNAL( activated() ), 910 connect( action, SIGNAL( activated() ),
911 this, SLOT( printCal() ) ); 911 this, SLOT( printCal() ) );
912 912
913 icon = loadPixmap( pathString + "print" ); 913 icon = loadPixmap( pathString + "print" );
914 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 914 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
915 action->addTo( beamMenu_X ); 915 action->addTo( beamMenu_X );
916 connect( action, SIGNAL( activated() ), 916 connect( action, SIGNAL( activated() ),
917 this, SLOT( printSel() ) ); 917 this, SLOT( printSel() ) );
918 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 918 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
919 action->addTo( beamMenu_X ); 919 action->addTo( beamMenu_X );
920 connect( action, SIGNAL( activated() ), 920 connect( action, SIGNAL( activated() ),
921 mView->viewManager(), SIGNAL( printWNV() ) ); 921 mView->viewManager(), SIGNAL( printWNV() ) );
922 importMenu->insertItem( i18n("Print"), beamMenu_X ); 922 importMenu->insertItem( i18n("Print"), beamMenu_X );
923#endif 923#endif
924 importMenu->insertSeparator(); 924 importMenu->insertSeparator();
925 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 925 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
926 this ); 926 this );
927 action->addTo( importMenu ); 927 action->addTo( importMenu );
928 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 928 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
929 importMenu->insertSeparator(); 929 importMenu->insertSeparator();
930 action = new QAction( "beam all", i18n("Save"), 0, 930 action = new QAction( "beam all", i18n("Save"), 0,
931 this ); 931 this );
932 action->addTo( importMenu ); 932 action->addTo( importMenu );
933 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 933 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
934 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 934 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
935 this ); 935 this );
936 action->addTo( importMenu ); 936 action->addTo( importMenu );
937 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 937 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
938 938
939 //menuBar->insertItem( "Configure",configureMenu ); 939 //menuBar->insertItem( "Configure",configureMenu );
940 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 940 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
941 icon = loadPixmap( "korganizer/korganizer" ); 941 icon = loadPixmap( "korganizer/korganizer" );
942 942
943 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 943 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
944 action->addTo( helpMenu ); 944 action->addTo( helpMenu );
945 connect( action, SIGNAL( activated() ), 945 connect( action, SIGNAL( activated() ),
946 SLOT( whatsNew() ) ); 946 SLOT( whatsNew() ) );
947 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 947 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
948 action->addTo( helpMenu ); 948 action->addTo( helpMenu );
949 connect( action, SIGNAL( activated() ), 949 connect( action, SIGNAL( activated() ),
950 SLOT( features() ) ); 950 SLOT( features() ) );
951 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 951 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
952 action->addTo( helpMenu ); 952 action->addTo( helpMenu );
953 connect( action, SIGNAL( activated() ), 953 connect( action, SIGNAL( activated() ),
954 SLOT( keyBindings() ) ); 954 SLOT( keyBindings() ) );
955 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 955 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
956 action->addTo( helpMenu ); 956 action->addTo( helpMenu );
957 connect( action, SIGNAL( activated() ), 957 connect( action, SIGNAL( activated() ),
958 SLOT( synchowto() ) ); 958 SLOT( synchowto() ) );
959 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 959 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
960 action->addTo( helpMenu ); 960 action->addTo( helpMenu );
961 connect( action, SIGNAL( activated() ), 961 connect( action, SIGNAL( activated() ),
962 SLOT( kdesynchowto() ) ); 962 SLOT( kdesynchowto() ) );
963 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 963 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
964 action->addTo( helpMenu ); 964 action->addTo( helpMenu );
965 connect( action, SIGNAL( activated() ), 965 connect( action, SIGNAL( activated() ),
966 SLOT( multisynchowto() ) ); 966 SLOT( multisynchowto() ) );
967 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 967 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
968 action->addTo( helpMenu ); 968 action->addTo( helpMenu );
969 connect( action, SIGNAL( activated() ), 969 connect( action, SIGNAL( activated() ),
970 SLOT( aboutAutoSaving() ) ); 970 SLOT( aboutAutoSaving() ) );
971 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 971 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
972 action->addTo( helpMenu ); 972 action->addTo( helpMenu );
973 connect( action, SIGNAL( activated() ), 973 connect( action, SIGNAL( activated() ),
974 SLOT( aboutKnownBugs() ) ); 974 SLOT( aboutKnownBugs() ) );
975 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 975 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
976 action->addTo( helpMenu ); 976 action->addTo( helpMenu );
977 connect( action, SIGNAL( activated() ), 977 connect( action, SIGNAL( activated() ),
978 SLOT( usertrans() ) ); 978 SLOT( usertrans() ) );
979 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 979 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
980 action->addTo( helpMenu ); 980 action->addTo( helpMenu );
981 connect( action, SIGNAL( activated() ), 981 connect( action, SIGNAL( activated() ),
982 SLOT( faq() ) ); 982 SLOT( faq() ) );
983 action = new QAction( "licence", i18n("Licence..."), 0, this ); 983 action = new QAction( "licence", i18n("Licence..."), 0, this );
984 action->addTo( helpMenu ); 984 action->addTo( helpMenu );
985 connect( action, SIGNAL( activated() ), 985 connect( action, SIGNAL( activated() ),
986 SLOT( licence() ) ); 986 SLOT( licence() ) );
987 action = new QAction( "about", i18n("About..."), 0, this ); 987 action = new QAction( "about", i18n("About..."), 0, this );
988 action->addTo( helpMenu ); 988 action->addTo( helpMenu );
989 connect( action, SIGNAL( activated() ), 989 connect( action, SIGNAL( activated() ),
990 SLOT( about() ) ); 990 SLOT( about() ) );
991 //menuBar->insertSeparator(); 991 //menuBar->insertSeparator();
992 992
993 // ****************************************************** 993 // ******************************************************
994 // menubar icons 994 // menubar icons
995 995
996 996
997 iconToolBar->setHorizontalStretchable (true ); 997 iconToolBar->setHorizontalStretchable (true );
998 //menuBar->insertItem( iconToolBar ); 998 //menuBar->insertItem( iconToolBar );
999 //xdays_action 999 //xdays_action
1000 if (p-> mShowIconNewEvent) 1000 if (p-> mShowIconNewEvent)
1001 ne_action->addTo( iconToolBar ); 1001 ne_action->addTo( iconToolBar );
1002 if (p->mShowIconNewTodo ) 1002 if (p->mShowIconNewTodo )
1003 nt_action->addTo( iconToolBar ); 1003 nt_action->addTo( iconToolBar );
1004 if (p-> mShowIconSearch) 1004 if (p-> mShowIconSearch)
1005 search_action->addTo( iconToolBar ); 1005 search_action->addTo( iconToolBar );
1006 if (p-> mShowIconWhatsThis) 1006 if (p-> mShowIconWhatsThis)
1007 QWhatsThis::whatsThisButton ( iconToolBar ); 1007 QWhatsThis::whatsThisButton ( iconToolBar );
1008 if (p-> mShowIconNext) 1008 if (p-> mShowIconNext)
1009 whatsnext_action->addTo( iconToolBar ); 1009 whatsnext_action->addTo( iconToolBar );
1010 if (p-> mShowIconNextDays) 1010 if (p-> mShowIconNextDays)
1011 xdays_action->addTo( iconToolBar ); 1011 xdays_action->addTo( iconToolBar );
1012 if (p-> mShowIconList) 1012 if (p-> mShowIconJournal)
1013 showlist_action->addTo( iconToolBar ); 1013 viewjournal_action->addTo( iconToolBar );
1014 if (p-> mShowIconDay1) 1014 if (p-> mShowIconDay1)
1015 day1_action->addTo( iconToolBar ); 1015 day1_action->addTo( iconToolBar );
1016 if (p-> mShowIconDay5) 1016 if (p-> mShowIconDay5)
1017 day5_action->addTo( iconToolBar ); 1017 day5_action->addTo( iconToolBar );
1018 if (p-> mShowIconDay7) 1018 if (p-> mShowIconDay7)
1019 day7_action->addTo( iconToolBar ); 1019 day7_action->addTo( iconToolBar );
1020 if (p-> mShowIconDay6) 1020 if (p-> mShowIconDay6)
1021 day6_action->addTo( iconToolBar ); 1021 day6_action->addTo( iconToolBar );
1022 if (p-> mShowIconMonth) 1022 if (p-> mShowIconMonth)
1023 month_action->addTo( iconToolBar ); 1023 month_action->addTo( iconToolBar );
1024 if (p-> mShowIconList)
1025 showlist_action->addTo( iconToolBar );
1024 if (p-> mShowIconTodoview) 1026 if (p-> mShowIconTodoview)
1025 todoview_action->addTo( iconToolBar ); 1027 todoview_action->addTo( iconToolBar );
1026 if (p-> mShowIconJournal) 1028
1027 viewjournal_action->addTo( iconToolBar );
1028 icon = loadPixmap( pathString + "2leftarrowB" ); 1029 icon = loadPixmap( pathString + "2leftarrowB" );
1029 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1030 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
1030 if (p-> mShowIconBackFast) { 1031 if (p-> mShowIconBackFast) {
1031 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1032 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1032 connect( action, SIGNAL( activated() ), 1033 connect( action, SIGNAL( activated() ),
1033 mView, SLOT( goPreviousMonth() ) ); 1034 mView, SLOT( goPreviousMonth() ) );
1034 action->addTo( iconToolBar ); 1035 action->addTo( iconToolBar );
1035 } 1036 }
1036 icon = loadPixmap( pathString + "1leftarrowB" ); 1037 icon = loadPixmap( pathString + "1leftarrowB" );
1037 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1038 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
1038 if (p-> mShowIconBack) { 1039 if (p-> mShowIconBack) {
1039 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1040 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1040 connect( action, SIGNAL( activated() ), 1041 connect( action, SIGNAL( activated() ),
1041 mView, SLOT( goPrevious() ) ); 1042 mView, SLOT( goPrevious() ) );
1042 action->addTo( iconToolBar ); 1043 action->addTo( iconToolBar );
1043 } 1044 }
1044 icon = loadPixmap( pathString + "today" ); 1045 icon = loadPixmap( pathString + "today" );
1045 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1046 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1046 if (p-> mShowIconToday) 1047 if (p-> mShowIconToday)
1047 today_action->addTo( iconToolBar ); 1048 today_action->addTo( iconToolBar );
1048 icon = loadPixmap( pathString + "1rightarrowB" ); 1049 icon = loadPixmap( pathString + "1rightarrowB" );
1049 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1050 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1050 if (p-> mShowIconForward) { 1051 if (p-> mShowIconForward) {
1051 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1052 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1052 connect( action, SIGNAL( activated() ), 1053 connect( action, SIGNAL( activated() ),
1053 mView, SLOT( goNext() ) ); 1054 mView, SLOT( goNext() ) );
1054 action->addTo( iconToolBar ); 1055 action->addTo( iconToolBar );
1055 } 1056 }
1056 icon = loadPixmap( pathString + "2rightarrowB" ); 1057 icon = loadPixmap( pathString + "2rightarrowB" );
1057 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1058 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1058 if (p-> mShowIconForwardFast) { 1059 if (p-> mShowIconForwardFast) {
1059 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1060 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1060 connect( action, SIGNAL( activated() ), 1061 connect( action, SIGNAL( activated() ),
1061 mView, SLOT( goNextMonth() ) ); 1062 mView, SLOT( goNextMonth() ) );
1062 action->addTo( iconToolBar ); 1063 action->addTo( iconToolBar );
1063 } 1064 }
1064 1065
1065 1066
1066 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1067 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
1067 1068
1068 if (p-> mShowIconNewEvent) 1069 if (p-> mShowIconNewEvent)
1069 configureToolBarMenu->setItemChecked( 10, true ); 1070 configureToolBarMenu->setItemChecked( 10, true );
1070 if (p->mShowIconNewTodo ) 1071 if (p->mShowIconNewTodo )
1071 configureToolBarMenu->setItemChecked( 20, true ); 1072 configureToolBarMenu->setItemChecked( 20, true );
1072 if (p-> mShowIconSearch) 1073 if (p-> mShowIconSearch)
1073 configureToolBarMenu->setItemChecked( 120, true ); 1074 configureToolBarMenu->setItemChecked( 120, true );
1074 if (p-> mShowIconList) 1075 if (p-> mShowIconList)
1075 configureToolBarMenu->setItemChecked( 30, true ); 1076 configureToolBarMenu->setItemChecked( 30, true );
1076 if (p-> mShowIconDay1) 1077 if (p-> mShowIconDay1)
1077 configureToolBarMenu->setItemChecked( 40, true ); 1078 configureToolBarMenu->setItemChecked( 40, true );
1078 if (p-> mShowIconDay5) 1079 if (p-> mShowIconDay5)
1079 configureToolBarMenu->setItemChecked( 50, true ); 1080 configureToolBarMenu->setItemChecked( 50, true );
1080 if (p-> mShowIconDay6) 1081 if (p-> mShowIconDay6)
1081 configureToolBarMenu->setItemChecked( 75, true ); 1082 configureToolBarMenu->setItemChecked( 75, true );
1082 if (p-> mShowIconDay7) 1083 if (p-> mShowIconDay7)
1083 configureToolBarMenu->setItemChecked( 60, true ); 1084 configureToolBarMenu->setItemChecked( 60, true );
1084 if (p-> mShowIconMonth) 1085 if (p-> mShowIconMonth)
1085 configureToolBarMenu->setItemChecked( 70, true ); 1086 configureToolBarMenu->setItemChecked( 70, true );
1086 if (p-> mShowIconTodoview) 1087 if (p-> mShowIconTodoview)
1087 configureToolBarMenu->setItemChecked( 80, true ); 1088 configureToolBarMenu->setItemChecked( 80, true );
1088 if (p-> mShowIconBackFast) 1089 if (p-> mShowIconBackFast)
1089 configureToolBarMenu->setItemChecked( 200, true ); 1090 configureToolBarMenu->setItemChecked( 200, true );
1090 if (p-> mShowIconBack) 1091 if (p-> mShowIconBack)
1091 configureToolBarMenu->setItemChecked( 210, true ); 1092 configureToolBarMenu->setItemChecked( 210, true );
1092 if (p-> mShowIconToday) 1093 if (p-> mShowIconToday)
1093 configureToolBarMenu->setItemChecked( 130, true ); 1094 configureToolBarMenu->setItemChecked( 130, true );
1094 if (p-> mShowIconForward) 1095 if (p-> mShowIconForward)
1095 configureToolBarMenu->setItemChecked( 220, true ); 1096 configureToolBarMenu->setItemChecked( 220, true );
1096 if (p-> mShowIconForwardFast) 1097 if (p-> mShowIconForwardFast)
1097 configureToolBarMenu->setItemChecked( 230, true ); 1098 configureToolBarMenu->setItemChecked( 230, true );
1098 if (p-> mShowIconNextDays) 1099 if (p-> mShowIconNextDays)
1099 configureToolBarMenu->setItemChecked( 100, true ); 1100 configureToolBarMenu->setItemChecked( 100, true );
1100 if (p-> mShowIconNext) 1101 if (p-> mShowIconNext)
1101 configureToolBarMenu->setItemChecked( 110, true ); 1102 configureToolBarMenu->setItemChecked( 110, true );
1102 if (p-> mShowIconJournal) 1103 if (p-> mShowIconJournal)
1103 configureToolBarMenu->setItemChecked( 90, true ); 1104 configureToolBarMenu->setItemChecked( 90, true );
1104 if (p-> mShowIconWhatsThis) 1105 if (p-> mShowIconWhatsThis)
1105 configureToolBarMenu->setItemChecked( 300, true ); 1106 configureToolBarMenu->setItemChecked( 300, true );
1106 if (p-> mShowIconWeekNum) 1107 if (p-> mShowIconWeekNum)
1107 configureToolBarMenu->setItemChecked( 400, true ); 1108 configureToolBarMenu->setItemChecked( 400, true );
1108 QLabel* dummy = new QLabel( iconToolBar ); 1109 QLabel* dummy = new QLabel( iconToolBar );
1109 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1110 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1110 if (!p-> mShowIconStretch) 1111 if (!p-> mShowIconStretch)
1111 iconToolBar->setStretchableWidget ( dummy ) ; 1112 iconToolBar->setStretchableWidget ( dummy ) ;
1112 else 1113 else
1113 configureToolBarMenu->setItemChecked( 5, true ); 1114 configureToolBarMenu->setItemChecked( 5, true );
1114 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1115 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1115 configureAgenda( p->mHourSize ); 1116 configureAgenda( p->mHourSize );
1116 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1117 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1117} 1118}
1118 1119
1119void MainWindow::exportToPhone( int mode ) 1120void MainWindow::exportToPhone( int mode )
1120{ 1121{
1121 1122
1122 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1123 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1123 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1124 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1124 KOex2phonePrefs ex2phone; 1125 KOex2phonePrefs ex2phone;
1125 1126
1126 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1127 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1127 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1128 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1128 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1129 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1129 if ( mode == 1 ) 1130 if ( mode == 1 )
1130 ex2phone.setCaption(i18n("Export complete calendar")); 1131 ex2phone.setCaption(i18n("Export complete calendar"));
1131 if ( mode == 2 ) 1132 if ( mode == 2 )
1132 ex2phone.setCaption(i18n("Export filtered calendar")); 1133 ex2phone.setCaption(i18n("Export filtered calendar"));
1133 1134
1134 if ( !ex2phone.exec() ) { 1135 if ( !ex2phone.exec() ) {
1135 return; 1136 return;
1136 } 1137 }
1137 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1138 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1138 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1139 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1139 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1140 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1140 1141
1141 int inFuture = 0; 1142 int inFuture = 0;
1142 if ( ex2phone.mWriteBackFuture->isChecked() ) 1143 if ( ex2phone.mWriteBackFuture->isChecked() )
1143 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1144 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1144 QPtrList<Incidence> delSel; 1145 QPtrList<Incidence> delSel;
1145 if ( mode == 1 ) 1146 if ( mode == 1 )
1146 delSel = mCalendar->rawIncidences(); 1147 delSel = mCalendar->rawIncidences();
1147 if ( mode == 2 ) 1148 if ( mode == 2 )
1148 delSel = mCalendar->incidences(); 1149 delSel = mCalendar->incidences();
1149 CalendarLocal* cal = new CalendarLocal(); 1150 CalendarLocal* cal = new CalendarLocal();
1150 cal->setLocalTime(); 1151 cal->setLocalTime();
1151 Incidence *incidence = delSel.first(); 1152 Incidence *incidence = delSel.first();
1152 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1153 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1154 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1154 while ( incidence ) { 1155 while ( incidence ) {
1155 if ( incidence->type() != "Journal" ) { 1156 if ( incidence->type() != "Journal" ) {
1156 bool add = true; 1157 bool add = true;
1157 if ( inFuture ) { 1158 if ( inFuture ) {
1158 QDateTime dt; 1159 QDateTime dt;
1159 if ( incidence->type() == "Todo" ) { 1160 if ( incidence->type() == "Todo" ) {
1160 Todo * t = (Todo*)incidence; 1161 Todo * t = (Todo*)incidence;
1161 if ( t->hasDueDate() ) 1162 if ( t->hasDueDate() )
1162 dt = t->dtDue(); 1163 dt = t->dtDue();
1163 else 1164 else
1164 dt = cur.addSecs( 62 ); 1165 dt = cur.addSecs( 62 );
1165 } 1166 }
1166 else { 1167 else {
1167 bool ok; 1168 bool ok;
1168 dt = incidence->getNextOccurence( cur, &ok ); 1169 dt = incidence->getNextOccurence( cur, &ok );
1169 if ( !ok ) 1170 if ( !ok )
1170 dt = cur.addSecs( -62 ); 1171 dt = cur.addSecs( -62 );
1171 } 1172 }
1172 if ( dt < cur || dt > end ) { 1173 if ( dt < cur || dt > end ) {
1173 add = false; 1174 add = false;
1174 } 1175 }
1175 } 1176 }
1176 if ( add ) { 1177 if ( add ) {
1177 Incidence *in = incidence->clone(); 1178 Incidence *in = incidence->clone();
1178 cal->addIncidence( in ); 1179 cal->addIncidence( in );
1179 } 1180 }
1180 } 1181 }
1181 incidence = delSel.next(); 1182 incidence = delSel.next();
1182 } 1183 }
1183 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1184 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1184 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1185 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1185 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1186 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1186 1187
1187 setCaption( i18n("Writing to phone...")); 1188 setCaption( i18n("Writing to phone..."));
1188 if ( PhoneFormat::writeToPhone( cal ) ) 1189 if ( PhoneFormat::writeToPhone( cal ) )
1189 setCaption( i18n("Export to phone successful!")); 1190 setCaption( i18n("Export to phone successful!"));
1190 else 1191 else
1191 setCaption( i18n("Error exporting to phone!")); 1192 setCaption( i18n("Error exporting to phone!"));
1192 delete cal; 1193 delete cal;
1193} 1194}
1194 1195
1195 1196
1196void MainWindow::setDefaultPreferences() 1197void MainWindow::setDefaultPreferences()
1197{ 1198{
1198 KOPrefs *p = KOPrefs::instance(); 1199 KOPrefs *p = KOPrefs::instance();
1199 1200
1200 p->mCompactDialogs = true; 1201 p->mCompactDialogs = true;
1201 p->mConfirm = true; 1202 p->mConfirm = true;
1202 // p->mEnableQuickTodo = false; 1203 // p->mEnableQuickTodo = false;
1203 1204
1204} 1205}
1205 1206
1206QString MainWindow::resourcePath() 1207QString MainWindow::resourcePath()
1207{ 1208{
1208 return KGlobal::iconLoader()->iconPath(); 1209 return KGlobal::iconLoader()->iconPath();
1209} 1210}
1210 1211
1211void MainWindow::displayText( QString text ,QString cap ) 1212void MainWindow::displayText( QString text ,QString cap )
1212{ 1213{
1213 QDialog dia( this, "name", true ); ; 1214 QDialog dia( this, "name", true ); ;
1214 dia.setCaption( cap ); 1215 dia.setCaption( cap );
1215 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1216 QVBoxLayout* lay = new QVBoxLayout( &dia );
1216 lay->setSpacing( 3 ); 1217 lay->setSpacing( 3 );
1217 lay->setMargin( 3 ); 1218 lay->setMargin( 3 );
1218 QTextBrowser tb ( &dia ); 1219 QTextBrowser tb ( &dia );
1219 lay->addWidget( &tb ); 1220 lay->addWidget( &tb );
1220 tb.setText( text ); 1221 tb.setText( text );
1221#ifdef DESKTOP_VERSION 1222#ifdef DESKTOP_VERSION
1222 dia.resize( 640, 480); 1223 dia.resize( 640, 480);
1223#else 1224#else
1224 dia.showMaximized(); 1225 dia.showMaximized();
1225#endif 1226#endif
1226 dia.exec(); 1227 dia.exec();
1227} 1228}
1228 1229
1229void MainWindow::features() 1230void MainWindow::features()
1230{ 1231{
1231 1232
1232 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1233 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1233} 1234}
1234 1235
1235void MainWindow::usertrans() 1236void MainWindow::usertrans()
1236{ 1237{
1237 1238
1238 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1239 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1239} 1240}
1240 1241
1241void MainWindow::kdesynchowto() 1242void MainWindow::kdesynchowto()
1242{ 1243{
1243 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1244 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1244} 1245}
1245void MainWindow::multisynchowto() 1246void MainWindow::multisynchowto()
1246{ 1247{
1247 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1248 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1248} 1249}
1249void MainWindow::synchowto() 1250void MainWindow::synchowto()
1250{ 1251{
1251 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1252 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1252} 1253}
1253void MainWindow::faq() 1254void MainWindow::faq()
1254{ 1255{
1255 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1256 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1256 1257
1257} 1258}
1258void MainWindow::whatsNew() 1259void MainWindow::whatsNew()
1259{ 1260{
1260 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1261 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1261 1262
1262} 1263}
1263void MainWindow::licence() 1264void MainWindow::licence()
1264{ 1265{
1265 KApplication::showLicence(); 1266 KApplication::showLicence();
1266 1267
1267} 1268}
1268void MainWindow::about() 1269void MainWindow::about()
1269{ 1270{
1270 QString version; 1271 QString version;
1271#include <../version> 1272#include <../version>
1272 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1273 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1273 i18n("KOrganizer/Platform-independent\n") + 1274 i18n("KOrganizer/Platform-independent\n") +
1274 "(KO/Pi) " + version + " - " + 1275 "(KO/Pi) " + version + " - " +
1275 1276
1276#ifdef DESKTOP_VERSION 1277#ifdef DESKTOP_VERSION
1277 i18n("Desktop Edition\n") + 1278 i18n("Desktop Edition\n") +
1278#else 1279#else
1279 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1280 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1280#endif 1281#endif
1281 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1282 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1282} 1283}
1283void MainWindow::keyBindings() 1284void MainWindow::keyBindings()
1284{ 1285{
1285 QString cap = i18n("KO/Pi Keys + Colors"); 1286 QString cap = i18n("KO/Pi Keys + Colors");
1286 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1287 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1287 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1288 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1288 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1289 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1289 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1290 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1290 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1291 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1291 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1292 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1292 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1293 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1293 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1294 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1294 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1295 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1295 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1296 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1296 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1297 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1297 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1298 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1298 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1299 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1299 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1300 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1300 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1301 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1301 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1302 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1302 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1303 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1303 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1304 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1304 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1305 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1305 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1306 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1306 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1307 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1307 i18n("<p><h3>In agenda view:</h3></p>\n") + 1308 i18n("<p><h3>In agenda view:</h3></p>\n") +
1308 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1309 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1309 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1310 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1310 i18n("<p><h3>In todo view:</h3></p>\n") + 1311 i18n("<p><h3>In todo view:</h3></p>\n") +
1311 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1312 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1312 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1313 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1313 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1314 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1314 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1315 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1315 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1316 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1316 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1317 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1317 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1318 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1318 i18n("<p><h3>In list view:</h3></p>\n") + 1319 i18n("<p><h3>In list view:</h3></p>\n") +
1319 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1320 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1320 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1321 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1321 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1322 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1322 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1323 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1323 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1324 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1324 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1325 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1325 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1326 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1326 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1327 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1327 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1328 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1328 i18n("<p><b>E</b>: Edit item</p>\n") + 1329 i18n("<p><b>E</b>: Edit item</p>\n") +
1329 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1330 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1330 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1331 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1331 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1332 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1332 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1333 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1333 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1334 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1334 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1335 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1335 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1336 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1336 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1337 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1337 i18n("<p><b>White</b>: Item readonly</p>\n"); 1338 i18n("<p><b>White</b>: Item readonly</p>\n");
1338 displayText( text, cap); 1339 displayText( text, cap);
1339} 1340}
1340void MainWindow::aboutAutoSaving() 1341void MainWindow::aboutAutoSaving()
1341{ 1342{
1342 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1343 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1343 1344
1344 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1345 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1345 1346
1346} 1347}
1347void MainWindow::aboutKnownBugs() 1348void MainWindow::aboutKnownBugs()
1348{ 1349{
1349 QMessageBox* msg; 1350 QMessageBox* msg;
1350 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1351 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1351 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1352 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1352 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1353 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1353 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1354 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1354 i18n("\nor report them in the bugtracker on\n") + 1355 i18n("\nor report them in the bugtracker on\n") +
1355 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1356 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1356 QMessageBox::NoIcon, 1357 QMessageBox::NoIcon,
1357 QMessageBox::Ok, 1358 QMessageBox::Ok,
1358 QMessageBox::NoButton, 1359 QMessageBox::NoButton,
1359 QMessageBox::NoButton); 1360 QMessageBox::NoButton);
1360 msg->exec(); 1361 msg->exec();
1361 delete msg; 1362 delete msg;
1362 1363
1363} 1364}
1364 1365
1365QString MainWindow::defaultFileName() 1366QString MainWindow::defaultFileName()
1366{ 1367{
1367 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1368 return locateLocal( "data", "korganizer/mycalendar.ics" );
1368} 1369}
1369QString MainWindow::syncFileName() 1370QString MainWindow::syncFileName()
1370{ 1371{
1371#ifdef DESKTOP_VERSION 1372#ifdef DESKTOP_VERSION
1372 return locateLocal( "tmp", "synccalendar.ics" ); 1373 return locateLocal( "tmp", "synccalendar.ics" );
1373#else 1374#else
1374 return QString( "/tmp/synccalendar.ics" ); 1375 return QString( "/tmp/synccalendar.ics" );
1375#endif 1376#endif
1376} 1377}
1377void MainWindow::updateWeek(QDate seda) 1378void MainWindow::updateWeek(QDate seda)
1378{ 1379{
1379 int weekNum = 0; 1380 int weekNum = 0;
1380 QDate d = QDate ( seda.year(), 1,1); 1381 QDate d = QDate ( seda.year(), 1,1);
1381 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1382 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1382 if ( seda.addDays(6).year() != seda.year() ) { 1383 if ( seda.addDays(6).year() != seda.year() ) {
1383 if ( seda.year() != d.year() ) { 1384 if ( seda.year() != d.year() ) {
1384 if ( d.dayOfWeek() > 4 ) 1385 if ( d.dayOfWeek() > 4 )
1385 d = QDate ( seda.year(), 1,1); 1386 d = QDate ( seda.year(), 1,1);
1386 else 1387 else
1387 weekNum = 1; 1388 weekNum = 1;
1388 } else { 1389 } else {
1389 QDate dd( seda.year()+1, 1,1); 1390 QDate dd( seda.year()+1, 1,1);
1390 if ( dd.dayOfWeek() <= 4 ) 1391 if ( dd.dayOfWeek() <= 4 )
1391 weekNum = 1; 1392 weekNum = 1;
1392 } 1393 }
1393 } 1394 }
1394 if ( weekNum == 0 ){ 1395 if ( weekNum == 0 ){
1395 int dow = d.dayOfWeek(); 1396 int dow = d.dayOfWeek();
1396 if ( dow <= 4 ) 1397 if ( dow <= 4 )
1397 d = d.addDays( 1-dow ); 1398 d = d.addDays( 1-dow );
1398 else // 5,6,7 1399 else // 5,6,7
1399 d = d.addDays( 8-dow ); 1400 d = d.addDays( 8-dow );
1400 // we have the first week of the year.we are on monday 1401 // we have the first week of the year.we are on monday
1401 weekNum = d.daysTo( seda ) / 7 +1; 1402 weekNum = d.daysTo( seda ) / 7 +1;
1402 } 1403 }
1403 1404
1404 mWeekPixmap.fill( mWeekBgColor ); 1405 mWeekPixmap.fill( mWeekBgColor );
1405 QPainter p ( &mWeekPixmap ); 1406 QPainter p ( &mWeekPixmap );
1406 p.setFont( mWeekFont ); 1407 p.setFont( mWeekFont );
1407 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1408 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1408 p.end(); 1409 p.end();
1409 QIconSet icon3 ( mWeekPixmap ); 1410 QIconSet icon3 ( mWeekPixmap );
1410 mWeekAction->setIconSet ( icon3 ); 1411 mWeekAction->setIconSet ( icon3 );
1411 1412
1412} 1413}
1413void MainWindow::updateWeekNum(const DateList &selectedDates) 1414void MainWindow::updateWeekNum(const DateList &selectedDates)
1414{ 1415{
1415 updateWeek( selectedDates.first() ); 1416 updateWeek( selectedDates.first() );
1416} 1417}
1417void MainWindow::processIncidenceSelection( Incidence *incidence ) 1418void MainWindow::processIncidenceSelection( Incidence *incidence )
1418{ 1419{
1419 1420
1420 if ( !incidence ) { 1421 if ( !incidence ) {
1421 enableIncidenceActions( false ); 1422 enableIncidenceActions( false );
1422 1423
1423 mNewSubTodoAction->setEnabled( false ); 1424 mNewSubTodoAction->setEnabled( false );
1424 setCaptionToDates(); 1425 setCaptionToDates();
1425 return; 1426 return;
1426 1427
1427 } 1428 }
1428 1429
1429 //KGlobal::locale()->formatDateTime(nextA, true); 1430 //KGlobal::locale()->formatDateTime(nextA, true);
1430 QString startString = ""; 1431 QString startString = "";
1431 if ( incidence->type() != "Todo" ) { 1432 if ( incidence->type() != "Todo" ) {
1432 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1433 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1433 if ( incidence->doesFloat() ) { 1434 if ( incidence->doesFloat() ) {
1434 startString += ": "+incidence->dtStartDateStr( true ); 1435 startString += ": "+incidence->dtStartDateStr( true );
1435 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1436 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1436 1437
1437 } else { 1438 } else {
1438 startString = ": "+incidence->dtStartStr(true); 1439 startString = ": "+incidence->dtStartStr(true);
1439 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1440 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1440 1441
1441 } 1442 }
1442 1443
1443 } else { 1444 } else {
1444 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1445 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1445 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1446 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1446 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1447 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1447 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1448 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1448 bool ok; 1449 bool ok;
1449 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1450 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1450 if ( ok ) { 1451 if ( ok ) {
1451 int years = noc.date().year() - incidence->dtStart().date().year(); 1452 int years = noc.date().year() - incidence->dtStart().date().year();
1452 startString += i18n(" (%1 y.)"). arg( years ); 1453 startString += i18n(" (%1 y.)"). arg( years );
1453 } 1454 }
1454 } 1455 }
1455 else 1456 else
1456 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1457 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1457 } 1458 }
1458 1459
1459 } 1460 }
1460 else 1461 else
1461 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1462 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1462 if ( !incidence->location().isEmpty() ) 1463 if ( !incidence->location().isEmpty() )
1463 startString += " (" +incidence->location()+")"; 1464 startString += " (" +incidence->location()+")";
1464 setCaption( incidence->summary()+startString); 1465 setCaption( incidence->summary()+startString);
1465 1466
1466 enableIncidenceActions( true ); 1467 enableIncidenceActions( true );
1467 1468
1468 if ( incidence->type() == "Event" ) { 1469 if ( incidence->type() == "Event" ) {
1469 mShowAction->setText( i18n("Show Event...") ); 1470 mShowAction->setText( i18n("Show Event...") );
1470 mEditAction->setText( i18n("Edit Event...") ); 1471 mEditAction->setText( i18n("Edit Event...") );
1471 mDeleteAction->setText( i18n("Delete Event...") ); 1472 mDeleteAction->setText( i18n("Delete Event...") );
1472 1473
1473 mNewSubTodoAction->setEnabled( false ); 1474 mNewSubTodoAction->setEnabled( false );
1474 } else if ( incidence->type() == "Todo" ) { 1475 } else if ( incidence->type() == "Todo" ) {
1475 mShowAction->setText( i18n("Show Todo...") ); 1476 mShowAction->setText( i18n("Show Todo...") );
1476 mEditAction->setText( i18n("Edit Todo...") ); 1477 mEditAction->setText( i18n("Edit Todo...") );
1477 mDeleteAction->setText( i18n("Delete Todo...") ); 1478 mDeleteAction->setText( i18n("Delete Todo...") );
1478 1479
1479 mNewSubTodoAction->setEnabled( true ); 1480 mNewSubTodoAction->setEnabled( true );
1480 } else { 1481 } else {
1481 mShowAction->setText( i18n("Show...") ); 1482 mShowAction->setText( i18n("Show...") );
1482 mShowAction->setText( i18n("Edit...") ); 1483 mShowAction->setText( i18n("Edit...") );
1483 mShowAction->setText( i18n("Delete...") ); 1484 mShowAction->setText( i18n("Delete...") );
1484 1485
1485 mNewSubTodoAction->setEnabled( false ); 1486 mNewSubTodoAction->setEnabled( false );
1486 } 1487 }
1487} 1488}
1488 1489
1489void MainWindow::enableIncidenceActions( bool enabled ) 1490void MainWindow::enableIncidenceActions( bool enabled )
1490{ 1491{
1491 mShowAction->setEnabled( enabled ); 1492 mShowAction->setEnabled( enabled );
1492 mEditAction->setEnabled( enabled ); 1493 mEditAction->setEnabled( enabled );
1493 mDeleteAction->setEnabled( enabled ); 1494 mDeleteAction->setEnabled( enabled );
1494 1495
1495 mCloneAction->setEnabled( enabled ); 1496 mCloneAction->setEnabled( enabled );
1496 mMoveAction->setEnabled( enabled ); 1497 mMoveAction->setEnabled( enabled );
1497 mBeamAction->setEnabled( enabled ); 1498 mBeamAction->setEnabled( enabled );
1498 mCancelAction->setEnabled( enabled ); 1499 mCancelAction->setEnabled( enabled );
1499} 1500}
1500 1501
1501void MainWindow::importOL() 1502void MainWindow::importOL()
1502{ 1503{
1503#ifdef _OL_IMPORT_ 1504#ifdef _OL_IMPORT_
1504 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1505 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1505 id->exec(); 1506 id->exec();
1506 delete id; 1507 delete id;
1507 mView->updateView(); 1508 mView->updateView();
1508#endif 1509#endif
1509} 1510}
1510void MainWindow::importBday() 1511void MainWindow::importBday()
1511{ 1512{
1512 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1513 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1513 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1514 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1514 i18n("Import!"), i18n("Cancel"), 0, 1515 i18n("Import!"), i18n("Cancel"), 0,
1515 0, 1 ); 1516 0, 1 );
1516 if ( result == 0 ) { 1517 if ( result == 0 ) {
1517 mView->importBday(); 1518 mView->importBday();
1518 1519
1519 } 1520 }
1520 1521
1521 1522
1522} 1523}
1523void MainWindow::importQtopia() 1524void MainWindow::importQtopia()
1524{ 1525{
1525 //#ifndef DESKTOP_VERSION 1526 //#ifndef DESKTOP_VERSION
1526 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1527 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1527#ifdef DESKTOP_VERSION 1528#ifdef DESKTOP_VERSION
1528 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1529 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1529#endif 1530#endif
1530 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1531 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1531 i18n("Import!"), i18n("Cancel"), 0, 1532 i18n("Import!"), i18n("Cancel"), 0,
1532 0, 1 ); 1533 0, 1 );
1533 if ( result == 0 ) { 1534 if ( result == 0 ) {
1534#ifndef DESKTOP_VERSION 1535#ifndef DESKTOP_VERSION
1535 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1536 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1536 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1537 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1537 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1538 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1538#else 1539#else
1539 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1540 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1540 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1541 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1541 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1542 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1542#endif 1543#endif
1543 mView->importQtopia( categories, datebook, todolist ); 1544 mView->importQtopia( categories, datebook, todolist );
1544 } 1545 }
1545#if 0 1546#if 0
1546 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1547 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1547 i18n("Not supported \non desktop!\n"), 1548 i18n("Not supported \non desktop!\n"),
1548 i18n("Ok"), i18n("Cancel"), 0, 1549 i18n("Ok"), i18n("Cancel"), 0,
1549 0, 1 ); 1550 0, 1 );
1550 1551
1551#endif 1552#endif
1552} 1553}
1553 1554
1554void MainWindow::saveOnClose() 1555void MainWindow::saveOnClose()
1555{ 1556{
1556 KOPrefs *p = KOPrefs::instance(); 1557 KOPrefs *p = KOPrefs::instance();
1557 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1558 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1558 p->mToolBarUp = iconToolBar->x() > width()/2 || 1559 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1559 iconToolBar->y() > height()/2; 1560 iconToolBar->y() > height()/2;
1560 mView->writeSettings(); 1561 mView->writeSettings();
1561 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1562 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1562 save(); 1563 save();
1563} 1564}
1564void MainWindow::slotModifiedChanged( bool changed ) 1565void MainWindow::slotModifiedChanged( bool changed )
1565{ 1566{
1566 if ( mBlockAtStartup ) 1567 if ( mBlockAtStartup )
1567 return; 1568 return;
1568 1569
1569 int msec; 1570 int msec;
1570 // we store the changes after 1 minute, 1571 // we store the changes after 1 minute,
1571 // and for safety reasons after 10 minutes again 1572 // and for safety reasons after 10 minutes again
1572 if ( !mSyncManager->blockSave() ) 1573 if ( !mSyncManager->blockSave() )
1573 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1574 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1574 else 1575 else
1575 msec = 1000 * 600; 1576 msec = 1000 * 600;
1576 mSaveTimer.start( msec, true ); // 1 minute 1577 mSaveTimer.start( msec, true ); // 1 minute
1577 qDebug("KO: Saving File in %d secs!", msec/1000); 1578 qDebug("KO: Saving File in %d secs!", msec/1000);
1578 mCalendarModifiedFlag = true; 1579 mCalendarModifiedFlag = true;
1579} 1580}
1580void MainWindow::saveStopTimer() 1581void MainWindow::saveStopTimer()
1581{ 1582{
1582 mSaveTimer.stop(); 1583 mSaveTimer.stop();
1583 if (mSaveTimer.isActive() ) 1584 if (mSaveTimer.isActive() )
1584 qDebug("ti active "); 1585 qDebug("ti active ");
1585 else 1586 else
1586 qDebug("KO: Save timer stopped"); 1587 qDebug("KO: Save timer stopped");
1587} 1588}
1588void MainWindow::save() 1589void MainWindow::save()
1589{ 1590{
1590 if ( !mCalendarModifiedFlag ) { 1591 if ( !mCalendarModifiedFlag ) {
1591 qDebug("KO: Calendar not modified. Nothing saved."); 1592 qDebug("KO: Calendar not modified. Nothing saved.");
1592 return; 1593 return;
1593 } 1594 }
1594 if ( mSyncManager->blockSave() ) 1595 if ( mSyncManager->blockSave() )
1595 return; 1596 return;
1596 mSyncManager->setBlockSave(true); 1597 mSyncManager->setBlockSave(true);
1597 if ( mView->checkFileVersion( defaultFileName()) ) { 1598 if ( mView->checkFileVersion( defaultFileName()) ) {
1598 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1599 QTime neededSaveTime = QDateTime::currentDateTime().time();
1599 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1600 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1600 qDebug("KO: Start saving data to file!"); 1601 qDebug("KO: Start saving data to file!");
1601 mView->saveCalendar( defaultFileName() ); 1602 mView->saveCalendar( defaultFileName() );
1602 mCalendarModifiedFlag = false; 1603 mCalendarModifiedFlag = false;
1603 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1604 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1604 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1605 qDebug("KO: Needed %d ms for saving.",msNeeded );
1605 QString savemes; 1606 QString savemes;
1606 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1607 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1607 setCaption(savemes); 1608 setCaption(savemes);
1608 } else 1609 } else
1609 setCaption(i18n("Saving cancelled!")); 1610 setCaption(i18n("Saving cancelled!"));
1610 mSyncManager->setBlockSave( false ); 1611 mSyncManager->setBlockSave( false );
1611} 1612}
1612 1613
1613void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1614void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1614{ 1615{
1615 if ( !e->isAutoRepeat() ) { 1616 if ( !e->isAutoRepeat() ) {
1616 mFlagKeyPressed = false; 1617 mFlagKeyPressed = false;
1617 } 1618 }
1618} 1619}
1619void MainWindow::keyPressEvent ( QKeyEvent * e ) 1620void MainWindow::keyPressEvent ( QKeyEvent * e )
1620{ 1621{
1621 qApp->processEvents(); 1622 qApp->processEvents();
1622 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1623 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1623 e->ignore(); 1624 e->ignore();
1624 // qDebug(" ignore %d",e->isAutoRepeat() ); 1625 // qDebug(" ignore %d",e->isAutoRepeat() );
1625 return; 1626 return;
1626 } 1627 }
1627 if (! e->isAutoRepeat() ) 1628 if (! e->isAutoRepeat() )
1628 mFlagKeyPressed = true; 1629 mFlagKeyPressed = true;
1629 KOPrefs *p = KOPrefs::instance(); 1630 KOPrefs *p = KOPrefs::instance();
1630 bool showSelectedDates = false; 1631 bool showSelectedDates = false;
1631 int size; 1632 int size;
1632 int pro = 0; 1633 int pro = 0;
1633 //qDebug("MainWindow::keyPressEvent "); 1634 //qDebug("MainWindow::keyPressEvent ");
1634 switch ( e->key() ) { 1635 switch ( e->key() ) {
1635 case Qt::Key_Right: 1636 case Qt::Key_Right:
1636 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1637 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1637 mView->goNextMonth(); 1638 mView->goNextMonth();
1638 else 1639 else
1639 mView->goNext(); 1640 mView->goNext();
1640 showSelectedDates = true; 1641 showSelectedDates = true;
1641 break; 1642 break;
1642 case Qt::Key_Left: 1643 case Qt::Key_Left:
1643 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1644 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1644 mView->goPreviousMonth(); 1645 mView->goPreviousMonth();
1645 else 1646 else
1646 mView->goPrevious(); 1647 mView->goPrevious();
1647 showSelectedDates = true; 1648 showSelectedDates = true;
1648 break; 1649 break;
1649 case Qt::Key_Down: 1650 case Qt::Key_Down:
1650 mView->viewManager()->agendaView()->scrollOneHourDown(); 1651 mView->viewManager()->agendaView()->scrollOneHourDown();
1651 break; 1652 break;
1652 case Qt::Key_Up: 1653 case Qt::Key_Up:
1653 mView->viewManager()->agendaView()->scrollOneHourUp(); 1654 mView->viewManager()->agendaView()->scrollOneHourUp();
1654 break; 1655 break;
1655 case Qt::Key_K: 1656 case Qt::Key_K:
1656 mView->viewManager()->showMonthViewWeek(); 1657 mView->viewManager()->showMonthViewWeek();
1657 break; 1658 break;
1658 case Qt::Key_I: 1659 case Qt::Key_I:
1659 mView->showIncidence(); 1660 mView->showIncidence();
1660 break; 1661 break;
1661 case Qt::Key_Delete: 1662 case Qt::Key_Delete:
1662 case Qt::Key_Backspace: 1663 case Qt::Key_Backspace:
1663 mView->deleteIncidence(); 1664 mView->deleteIncidence();
1664 break; 1665 break;
1665 case Qt::Key_D: 1666 case Qt::Key_D:
1666 mView->viewManager()->showDayView(); 1667 mView->viewManager()->showDayView();
1667 showSelectedDates = true; 1668 showSelectedDates = true;
1668 break; 1669 break;
1669 case Qt::Key_O: 1670 case Qt::Key_O:
1670 mView->toggleFilerEnabled( ); 1671 mView->toggleFilerEnabled( );
1671 break; 1672 break;
1672 case Qt::Key_0: 1673 case Qt::Key_0:
1673 case Qt::Key_1: 1674 case Qt::Key_1:
1674 case Qt::Key_2: 1675 case Qt::Key_2:
1675 case Qt::Key_3: 1676 case Qt::Key_3:
1676 case Qt::Key_4: 1677 case Qt::Key_4:
1677 case Qt::Key_5: 1678 case Qt::Key_5:
1678 case Qt::Key_6: 1679 case Qt::Key_6:
1679 case Qt::Key_7: 1680 case Qt::Key_7:
1680 case Qt::Key_8: 1681 case Qt::Key_8:
1681 case Qt::Key_9: 1682 case Qt::Key_9:
1682 pro = e->key()-48; 1683 pro = e->key()-48;
1683 if ( pro == 0 ) 1684 if ( pro == 0 )
1684 pro = 10; 1685 pro = 10;
1685 if ( e->state() == Qt::ControlButton) 1686 if ( e->state() == Qt::ControlButton)
1686 pro += 10; 1687 pro += 10;
1687 break; 1688 break;
1688 case Qt::Key_M: 1689 case Qt::Key_M:
1689 mView->viewManager()->showMonthView(); 1690 mView->viewManager()->showMonthView();
1690 showSelectedDates = true; 1691 showSelectedDates = true;
1691 break; 1692 break;
1692 case Qt::Key_Insert: 1693 case Qt::Key_Insert:
1693 mView->newEvent(); 1694 mView->newEvent();
1694 break; 1695 break;
1695 case Qt::Key_S : 1696 case Qt::Key_S :
1696 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1697 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1697 mView->newSubTodo(); 1698 mView->newSubTodo();
1698 else 1699 else
1699 mView->dialogManager()->showSearchDialog(); 1700 mView->dialogManager()->showSearchDialog();
1700 break; 1701 break;
1701 case Qt::Key_Y : 1702 case Qt::Key_Y :
1702 case Qt::Key_Z : 1703 case Qt::Key_Z :
1703 mView->viewManager()->showWorkWeekView(); 1704 mView->viewManager()->showWorkWeekView();
1704 showSelectedDates = true; 1705 showSelectedDates = true;
1705 break; 1706 break;
1706 case Qt::Key_U : 1707 case Qt::Key_U :
1707 mView->viewManager()->showWeekView(); 1708 mView->viewManager()->showWeekView();
1708 showSelectedDates = true; 1709 showSelectedDates = true;
1709 break; 1710 break;
1710 case Qt::Key_H : 1711 case Qt::Key_H :
1711 keyBindings(); 1712 keyBindings();
1712 break; 1713 break;
1713 case Qt::Key_W: 1714 case Qt::Key_W:
1714 mView->viewManager()->showWhatsNextView(); 1715 mView->viewManager()->showWhatsNextView();
1715 break; 1716 break;
1716 case Qt::Key_L: 1717 case Qt::Key_L:
1717 mView->viewManager()->showListView(); 1718 mView->viewManager()->showListView();
1718 break; 1719 break;
1719 case Qt::Key_N: 1720 case Qt::Key_N:
1720 mView->viewManager()->showNextXView(); 1721 mView->viewManager()->showNextXView();
1721 showSelectedDates = true; 1722 showSelectedDates = true;
1722 break; 1723 break;
1723 case Qt::Key_V: 1724 case Qt::Key_V:
1724 mView->viewManager()->showTodoView(); 1725 mView->viewManager()->showTodoView();
1725 break; 1726 break;
1726 case Qt::Key_C: 1727 case Qt::Key_C:
1727 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1728 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1728 break; 1729 break;
1729 case Qt::Key_P: 1730 case Qt::Key_P:
1730 mView->showDatePicker( ); 1731 mView->showDatePicker( );
1731 break; 1732 break;
1732 case Qt::Key_F: 1733 case Qt::Key_F:
1733 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1734 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1734 mView->editFilters(); 1735 mView->editFilters();
1735 else 1736 else
1736 mView->toggleFilter(); 1737 mView->toggleFilter();
1737 break; 1738 break;
1738 case Qt::Key_X: 1739 case Qt::Key_X:
1739 mView->toggleDateNavigatorWidget(); 1740 mView->toggleDateNavigatorWidget();
1740 break; 1741 break;
1741 case Qt::Key_Space: 1742 case Qt::Key_Space:
1742 mView->toggleExpand(); 1743 mView->toggleExpand();
1743 break; 1744 break;
1744 case Qt::Key_A: 1745 case Qt::Key_A:
1745 mView->toggleAllDaySize(); 1746 mView->toggleAllDaySize();
1746 break; 1747 break;
1747 case Qt::Key_T: 1748 case Qt::Key_T:
1748 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1749 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1749 mView->newTodo(); 1750 mView->newTodo();
1750 else { 1751 else {
1751 mView->goToday(); 1752 mView->goToday();
1752 showSelectedDates = true; 1753 showSelectedDates = true;
1753 } 1754 }
1754 break; 1755 break;
1755 case Qt::Key_J: 1756 case Qt::Key_J:
1756 mView->viewManager()->showJournalView(); 1757 mView->viewManager()->showJournalView();
1757 break; 1758 break;
1758 case Qt::Key_B: 1759 case Qt::Key_B:
1759 mView->editIncidenceDescription();; 1760 mView->editIncidenceDescription();;
1760 break; 1761 break;
1761 // case Qt::Key_Return: 1762 // case Qt::Key_Return:
1762 case Qt::Key_E: 1763 case Qt::Key_E:
1763 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1764 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1764 mView->newEvent(); 1765 mView->newEvent();
1765 else 1766 else
1766 mView->editIncidence(); 1767 mView->editIncidence();
1767 break; 1768 break;
1768 case Qt::Key_Plus: 1769 case Qt::Key_Plus:
1769 size = p->mHourSize +2; 1770 size = p->mHourSize +2;
1770 if ( size <= 22 ) 1771 if ( size <= 22 )
1771 configureAgenda( size ); 1772 configureAgenda( size );
1772 break; 1773 break;
1773 case Qt::Key_Minus: 1774 case Qt::Key_Minus:
1774 size = p->mHourSize - 2; 1775 size = p->mHourSize - 2;
1775 if ( size >= 4 ) 1776 if ( size >= 4 )
1776 configureAgenda( size ); 1777 configureAgenda( size );
1777 break; 1778 break;
1778 1779
1779 1780
1780 default: 1781 default:
1781 e->ignore(); 1782 e->ignore();
1782 } 1783 }
1783 if ( pro > 0 ) { 1784 if ( pro > 0 ) {
1784 mView->selectFilter( pro-1 ); 1785 mView->selectFilter( pro-1 );
1785 } 1786 }
1786 if ( showSelectedDates ) { 1787 if ( showSelectedDates ) {
1787 ;// setCaptionToDates(); 1788 ;// setCaptionToDates();
1788 } 1789 }
1789 1790
1790} 1791}
1791 1792
1792void MainWindow::fillFilterMenu() 1793void MainWindow::fillFilterMenu()
1793{ 1794{
1794 selectFilterMenu->clear(); 1795 selectFilterMenu->clear();
1795 bool disable = false; 1796 bool disable = false;