summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp87
-rw-r--r--korganizer/kodaymatrix.h1
-rw-r--r--korganizer/komonthview.cpp3
-rw-r--r--korganizer/koprefsdialog.cpp13
-rw-r--r--korganizer/koviewmanager.cpp9
-rw-r--r--korganizer/mainwindow.cpp13
-rw-r--r--korganizer/mainwindow.h2
7 files changed, 92 insertions, 36 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 17a1d13..df606d0 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,1129 +1,1166 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 Parts of the source code have been copied from kdpdatebutton.cpp 4 Parts of the source code have been copied from kdpdatebutton.cpp
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source ode for Qt in the source distribution. 22 without including the source ode for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <libkcal/vcaldrag.h> 35#include <libkcal/vcaldrag.h>
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/dndfactory.h> 37#include <libkcal/dndfactory.h>
38#include <libkcal/calendarresources.h> 38#include <libkcal/calendarresources.h>
39#include <libkcal/resourcecalendar.h> 39#include <libkcal/resourcecalendar.h>
40#include <kresources/resourceselectdialog.h> 40#include <kresources/resourceselectdialog.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPLUGINS 44#ifndef KORG_NOPLUGINS
45#include "kocore.h" 45#include "kocore.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#include "koglobals.h" 48#include "koglobals.h"
49 49
50#include "kodaymatrix.h" 50#include "kodaymatrix.h"
51 51
52// ============================================================================ 52// ============================================================================
53// D Y N A M I C T I P 53// D Y N A M I C T I P
54// ============================================================================ 54// ============================================================================
55 55
56DynamicTip::DynamicTip( QWidget * parent ) 56DynamicTip::DynamicTip( QWidget * parent )
57 : QToolTip( parent ) 57 : QToolTip( parent )
58{ 58{
59 matrix = (KODayMatrix*)parent; 59 matrix = (KODayMatrix*)parent;
60} 60}
61 61
62class KODaymatrixWhatsThis :public QWhatsThis 62class KODaymatrixWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; 65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;};
66 ~KODaymatrixWhatsThis() { ; }; 66 ~KODaymatrixWhatsThis() { ; };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p ) 69 virtual QString text( const QPoint& p )
70 { 70 {
71 return _view->getWhatsThisText( p ) ; 71 return _view->getWhatsThisText( p ) ;
72 } 72 }
73private: 73private:
74 KODayMatrix * _view; 74 KODayMatrix * _view;
75}; 75};
76 76
77void DynamicTip::maybeTip( const QPoint &pos ) 77void DynamicTip::maybeTip( const QPoint &pos )
78{ 78{
79 //calculate which cell of the matrix the mouse is in 79 //calculate which cell of the matrix the mouse is in
80 QRect sz = matrix->frameRect(); 80 QRect sz = matrix->frameRect();
81 int dheight = sz.height()*7 / 42; 81 int dheight = sz.height()*7 / 42;
82 int dwidth = sz.width() / 7; 82 int dwidth = sz.width() / 7;
83 int row = pos.y()/dheight; 83 int row = pos.y()/dheight;
84 int col = pos.x()/dwidth; 84 int col = pos.x()/dwidth;
85 85
86 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 86 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
87 87
88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
89// col << "][" << row << "] => " <<(col+row*7) << endl; 89// col << "][" << row << "] => " <<(col+row*7) << endl;
90 90
91 //show holiday names only 91 //show holiday names only
92 QString str = matrix->getHolidayLabel(col+row*7); 92 QString str = matrix->getHolidayLabel(col+row*7);
93 if (str.isEmpty()) return; 93 if (str.isEmpty()) return;
94 tip(rct, str); 94 tip(rct, str);
95} 95}
96 96
97 97
98// ============================================================================ 98// ============================================================================
99// K O D A Y M A T R I X 99// K O D A Y M A T R I X
100// ============================================================================ 100// ============================================================================
101 101
102const int KODayMatrix::NOSELECTION = -1000; 102const int KODayMatrix::NOSELECTION = -1000;
103const int KODayMatrix::NUMDAYS = 42; 103const int KODayMatrix::NUMDAYS = 42;
104 104
105KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) 105KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) 106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
107 107
108#if 0 108#if 0
109KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : 109KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
110 QFrame(parent, name) 110 QFrame(parent, name)
111#endif 111#endif
112{ 112{
113 oldW = 0; 113 oldW = 0;
114 oldH = 0; 114 oldH = 0;
115 myPix.resize( 150, 120 ); 115 myPix.resize( 150, 120 );
116 mRedrawNeeded = true; 116 mRedrawNeeded = true;
117 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 117 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
118 mPendingUpdateBeforeRepaint = false; 118 mPendingUpdateBeforeRepaint = false;
119 mouseDown = false; 119 mouseDown = false;
120 // initialize dynamic arrays 120 // initialize dynamic arrays
121 bDays.resize ( NUMDAYS ); 121 bDays.resize ( NUMDAYS );
122 pDays.resize ( NUMDAYS ); 122 pDays.resize ( NUMDAYS );
123 hDays.resize ( NUMDAYS ); 123 hDays.resize ( NUMDAYS );
124 eDays.resize ( NUMDAYS ); 124 eDays.resize ( NUMDAYS );
125 days = new QDate[NUMDAYS]; 125 days = new QDate[NUMDAYS];
126 daylbls = new QString[NUMDAYS]; 126 daylbls = new QString[NUMDAYS];
127 //events = new int[NUMDAYS]; 127 //events = new int[NUMDAYS];
128 mToolTip = new DynamicTip(this); 128 mToolTip = new DynamicTip(this);
129 129
130 // set default values used for drawing the matrix 130 // set default values used for drawing the matrix
131 mDefaultBackColor = palette().active().base(); 131 mDefaultBackColor = palette().active().base();
132 mDefaultTextColor = palette().active().foreground(); 132 mDefaultTextColor = palette().active().foreground();
133 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 133 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
134 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 134 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
135 mSelectedDaysColor = QColor("white"); 135 mSelectedDaysColor = QColor("white");
136 mTodayMarginWidth = 2; 136 mTodayMarginWidth = 2;
137 mSelEnd = mSelStart = NOSELECTION; 137 mSelEnd = mSelStart = NOSELECTION;
138 138
139 setAcceptDrops(true); 139 setAcceptDrops(true);
140 //setFont( QFont("Arial", 10) ); 140 //setFont( QFont("Arial", 10) );
141 141
142 mUpdateTimer = new QTimer( this ); 142 mUpdateTimer = new QTimer( this );
143 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 143 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
144 mRepaintTimer = new QTimer( this ); 144 mRepaintTimer = new QTimer( this );
145 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 145 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
146 mDayChanged = false; 146 mDayChanged = false;
147 updateView(); 147 updateView();
148} 148}
149QString KODayMatrix::getWhatsThisText( QPoint p ) 149QString KODayMatrix::getWhatsThisText( QPoint p )
150{ 150{
151 151
152 int tmp = getDayIndexFrom(p.x(), p.y()); 152 int tmp = getDayIndexFrom(p.x(), p.y());
153 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 153 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
154 return QString(); 154 return QString();
155 QDate mDate = days[tmp]; 155 QDate mDate = days[tmp];
156 QPtrList<Event> eventlist = mCalendar->events(mDate); 156 QPtrList<Event> eventlist = mCalendar->events(mDate);
157 Event *event; 157 Event *event;
158 QStringList mToolTip; 158 QStringList mToolTip;
159 for(event=eventlist.first();event != 0;event=eventlist.next()) { 159 for(event=eventlist.first();event != 0;event=eventlist.next()) {
160 QString mToolTipText; 160 QString mToolTipText;
161 QString text; 161 QString text;
162 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 162 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
163 if (event->isMultiDay()) { 163 if (event->isMultiDay()) {
164 QString prefix = "<->";multiday = 2; 164 QString prefix = "<->";multiday = 2;
165 QString time; 165 QString time;
166 if ( event->doesRecur() ) { 166 if ( event->doesRecur() ) {
167 if ( event->recursOn( mDate) ) { 167 if ( event->recursOn( mDate) ) {
168 prefix ="->" ;multiday = 1; 168 prefix ="->" ;multiday = 1;
169 } 169 }
170 else { 170 else {
171 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 171 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
172 if ( event->recursOn( mDate.addDays( -days)) ) { 172 if ( event->recursOn( mDate.addDays( -days)) ) {
173 prefix ="<-" ;multiday = 3; 173 prefix ="<-" ;multiday = 3;
174 } 174 }
175 } 175 }
176 } else { 176 } else {
177 if (mDate == event->dtStart().date()) { 177 if (mDate == event->dtStart().date()) {
178 prefix ="->" ;multiday = 1; 178 prefix ="->" ;multiday = 1;
179 } else if (mDate == event->dtEnd().date()) { 179 } else if (mDate == event->dtEnd().date()) {
180 prefix ="<-" ;multiday = 3; 180 prefix ="<-" ;multiday = 3;
181 } 181 }
182 } 182 }
183 if ( !event->doesFloat() ) { 183 if ( !event->doesFloat() ) {
184 if ( mDate == event->dtStart().date () ) 184 if ( mDate == event->dtStart().date () )
185 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
186 else if ( mDate == event->dtEnd().date () ) 186 else if ( mDate == event->dtEnd().date () )
187 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 187 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
188 188
189 } 189 }
190 text = time + event->summary(); 190 text = time + event->summary();
191 mToolTipText += prefix + text; 191 mToolTipText += prefix + text;
192 } else { 192 } else {
193 if (event->doesFloat()) { 193 if (event->doesFloat()) {
194 text = event->summary(); 194 text = event->summary();
195 mToolTipText += text; 195 mToolTipText += text;
196 } 196 }
197 else { 197 else {
198 text = KGlobal::locale()->formatTime(event->dtStart().time()); 198 text = KGlobal::locale()->formatTime(event->dtStart().time());
199 text += " " + event->summary(); 199 text += " " + event->summary();
200 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 200 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
201 } 201 }
202 } 202 }
203 if ( !event->location().isEmpty() ) 203 if ( !event->location().isEmpty() )
204 mToolTipText += " (" + event->location() + ")"; 204 mToolTipText += " (" + event->location() + ")";
205#if QT_VERSION >= 0x030000 205#if QT_VERSION >= 0x030000
206 mToolTipText.replace( '<' , "&lt;" ); 206 mToolTipText.replace( '<' , "&lt;" );
207 mToolTipText.replace( '>' , "&gt;" ); 207 mToolTipText.replace( '>' , "&gt;" );
208#else 208#else
209 if ( mToolTipText.find ('<') >= 0 ) { 209 if ( mToolTipText.find ('<') >= 0 ) {
210 mToolTipText.replace( QRegExp("<") , "&lt;" ); 210 mToolTipText.replace( QRegExp("<") , "&lt;" );
211 } 211 }
212 if ( mToolTipText.find ('>') >= 0 ) { 212 if ( mToolTipText.find ('>') >= 0 ) {
213 mToolTipText.replace( QRegExp(">") , "&gt;" ); 213 mToolTipText.replace( QRegExp(">") , "&gt;" );
214 } 214 }
215#endif 215#endif
216 //qDebug("TTT: %s ", mToolTipText.latin1()); 216 //qDebug("TTT: %s ", mToolTipText.latin1());
217 mToolTip.append( mToolTipText ); 217 mToolTip.append( mToolTipText );
218 } 218 }
219 mToolTip.sort(); 219 mToolTip.sort();
220 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 220 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
221} 221}
222void KODayMatrix::setCalendar( Calendar *cal ) 222void KODayMatrix::setCalendar( Calendar *cal )
223{ 223{
224 mCalendar = cal; 224 mCalendar = cal;
225 225
226 setAcceptDrops( mCalendar ); 226 setAcceptDrops( mCalendar );
227 227
228 updateEvents(); 228 updateEvents();
229} 229}
230 230
231QColor KODayMatrix::getShadedColor(QColor color) 231QColor KODayMatrix::getShadedColor(QColor color)
232{ 232{
233 QColor shaded; 233 QColor shaded;
234 int h=0; 234 int h=0;
235 int s=0; 235 int s=0;
236 int v=0; 236 int v=0;
237 color.hsv(&h,&s,&v); 237 color.hsv(&h,&s,&v);
238 s = s/4; 238 s = s/4;
239 v = 192+v/4; 239 v = 192+v/4;
240 shaded.setHsv(h,s,v); 240 shaded.setHsv(h,s,v);
241 241
242 return shaded; 242 return shaded;
243} 243}
244 244
245KODayMatrix::~KODayMatrix() 245KODayMatrix::~KODayMatrix()
246{ 246{
247 // delete mKODaymatrixWhatsThis; 247 // delete mKODaymatrixWhatsThis;
248 delete [] days; 248 delete [] days;
249 delete [] daylbls; 249 delete [] daylbls;
250 //delete [] events; 250 //delete [] events;
251 delete mToolTip; 251 delete mToolTip;
252} 252}
253 253
254/* 254/*
255void KODayMatrix::setStartDate(QDate start) 255void KODayMatrix::setStartDate(QDate start)
256{ 256{
257 updateView(start); 257 updateView(start);
258} 258}
259*/ 259*/
260 260
261void KODayMatrix::addSelectedDaysTo(DateList& selDays) 261void KODayMatrix::addSelectedDaysTo(DateList& selDays)
262{ 262{
263 263
264 if (mSelStart == NOSELECTION) { 264 if (mSelStart == NOSELECTION) {
265 return; 265 return;
266 } 266 }
267 267
268 //cope with selection being out of matrix limits at top (< 0) 268 //cope with selection being out of matrix limits at top (< 0)
269 int i0 = mSelStart; 269 int i0 = mSelStart;
270 if (i0 < 0) { 270 if (i0 < 0) {
271 for (int i = i0; i < 0; i++) { 271 for (int i = i0; i < 0; i++) {
272 selDays.append(days[0].addDays(i)); 272 selDays.append(days[0].addDays(i));
273 } 273 }
274 i0 = 0; 274 i0 = 0;
275 } 275 }
276 276
277 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 277 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
278 if (mSelEnd > NUMDAYS-1) { 278 if (mSelEnd > NUMDAYS-1) {
279 for (int i = i0; i <= NUMDAYS-1; i++) { 279 for (int i = i0; i <= NUMDAYS-1; i++) {
280 selDays.append(days[i]); 280 selDays.append(days[i]);
281 } 281 }
282 for (int i = NUMDAYS; i < mSelEnd; i++) { 282 for (int i = NUMDAYS; i < mSelEnd; i++) {
283 selDays.append(days[0].addDays(i)); 283 selDays.append(days[0].addDays(i));
284 } 284 }
285 285
286 // apply normal routine to selection being entirely within matrix limits 286 // apply normal routine to selection being entirely within matrix limits
287 } else { 287 } else {
288 for (int i = i0; i <= mSelEnd; i++) { 288 for (int i = i0; i <= mSelEnd; i++) {
289 selDays.append(days[i]); 289 selDays.append(days[i]);
290 } 290 }
291 } 291 }
292} 292}
293 293
294bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 294bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
295{ 295{
296 mRedrawNeeded = true; 296 mRedrawNeeded = true;
297 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); 297 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION );
298 mSelStart = startdate.daysTo(start); 298 mSelStart = startdate.daysTo(start);
299 if ( mSelStart < 0 ) 299 if ( mSelStart < 0 )
300 mSelStart = 0; 300 mSelStart = 0;
301 mSelEnd = startdate.daysTo(end); 301 mSelEnd = startdate.daysTo(end);
302 if ( mSelEnd > NUMDAYS-1 ) 302 if ( mSelEnd > NUMDAYS-1 )
303 mSelEnd = NUMDAYS-1; 303 mSelEnd = NUMDAYS-1;
304 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { 304 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
305 clearSelection(); 305 clearSelection();
306 if ( noSel ) 306 if ( noSel )
307 return false; 307 return false;
308 } 308 }
309 309
310 return true; 310 return true;
311} 311}
312void KODayMatrix::clearSelection() 312void KODayMatrix::clearSelection()
313{ 313{
314 mSelEnd = mSelStart = NOSELECTION; 314 mSelEnd = mSelStart = NOSELECTION;
315} 315}
316 316
317 317
318void KODayMatrix::recalculateToday() 318void KODayMatrix::recalculateToday()
319{ 319{
320 today = -1; 320 today = -1;
321 for (int i=0; i<NUMDAYS; i++) { 321 for (int i=0; i<NUMDAYS; i++) {
322 //events[i] = 0; 322 //events[i] = 0;
323 days[i] = startdate.addDays(i); 323 days[i] = startdate.addDays(i);
324 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 324 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
325 325
326 // if today is in the currently displayed month, hilight today 326 // if today is in the currently displayed month, hilight today
327 if (days[i].year() == QDate::currentDate().year() && 327 if (days[i].year() == QDate::currentDate().year() &&
328 days[i].month() == QDate::currentDate().month() && 328 days[i].month() == QDate::currentDate().month() &&
329 days[i].day() == QDate::currentDate().day()) { 329 days[i].day() == QDate::currentDate().day()) {
330 today = i; 330 today = i;
331 } 331 }
332 } 332 }
333 // qDebug(QString("Today is visible at %1.").arg(today)); 333 // qDebug(QString("Today is visible at %1.").arg(today));
334} 334}
335 335
336void KODayMatrix::updateView() 336void KODayMatrix::updateView()
337{ 337{
338 updateView(startdate); 338 updateView(startdate);
339} 339}
340void KODayMatrix::repaintViewTimed() 340void KODayMatrix::repaintViewTimed()
341{ 341{
342 mRedrawNeeded = true; 342 mRedrawNeeded = true;
343 // bDays.fill( false); 343 // bDays.fill( false);
344 //pDays.fill( false); 344 //pDays.fill( false);
345 //hDays.fill( false); 345 //hDays.fill( false);
346 //eDays.fill( false); 346 //eDays.fill( false);
347 mRepaintTimer->stop(); 347 mRepaintTimer->stop();
348 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 348 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
349 int i; 349 int i;
350 for(i = 0; i < NUMDAYS; i++) { 350 for(i = 0; i < NUMDAYS; i++) {
351 if ( ( (i+startDay) % 7 == 0 ) ) { 351 if ( ( (i+startDay) % 7 == 0 ) ) {
352 pDays.setBit(i); 352 pDays.setBit(i);
353 } 353 }
354 } 354 }
355 repaint(false); 355 repaint(false);
356} 356}
357void KODayMatrix::computeEvent(Event *event, int i ) 357void KODayMatrix::computeEvent(Event *event, int i )
358{ 358{
359 QString holiStr = mHolidays[i]; 359 QString holiStr = mHolidays[i];
360 if ( event->isHoliday()) { 360 if ( event->isHoliday()) {
361 pDays.setBit(i); 361 pDays.setBit(i);
362 hDays.setBit(i); 362 hDays.setBit(i);
363 if ( !holiStr.isEmpty() ) 363 if ( !holiStr.isEmpty() )
364 holiStr += "\n"; 364 holiStr += "\n";
365 holiStr += event->summary(); 365 holiStr += event->summary();
366 if ( !event->location().isEmpty() ) 366 if ( !event->location().isEmpty() )
367 holiStr += " (" + event->location() + ")"; 367 holiStr += " (" + event->location() + ")";
368 mHolidays[i] =holiStr ; 368 mHolidays[i] =holiStr ;
369 eDays.setBit(i);
369 } 370 }
370 if ( event->isBirthday()) { 371 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) {
371 pDays.setBit(i); 372 if ( event->isBirthday()) {
372 if ( !holiStr.isEmpty() ) 373 pDays.setBit(i);
373 holiStr += "\n"; 374 if ( !holiStr.isEmpty() )
374 holiStr += i18n("Birthday") + ": "+event->summary(); 375 holiStr += "\n";
375 if ( !event->location().isEmpty() ) 376 holiStr += i18n("Birthday") + ": "+event->summary();
376 holiStr += " (" + event->location() + ")"; 377 if ( !event->location().isEmpty() )
377 bDays.setBit(i); 378 holiStr += " (" + event->location() + ")";
378 mHolidays[i] =holiStr ; 379 bDays.setBit(i);
380 mHolidays[i] =holiStr ;
381 }
379 } 382 }
380 eDays.setBit(i); 383 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW )
384 eDays.setBit(i);
381} 385}
382void KODayMatrix::updateViewTimed() 386void KODayMatrix::updateViewTimed()
383{ 387{
384 mUpdateTimer->stop(); 388 mUpdateTimer->stop();
385 if ( !mCalendar ) { 389 if ( !mCalendar ) {
386 qDebug("NOT CAL "); 390 qDebug("NOT CAL ");
387 return; 391 return;
388 } 392 }
389#if 1 393#if 1
390 394
395
391 int i; 396 int i;
392 int timeSpan = NUMDAYS-1; 397 int timeSpan = NUMDAYS-1;
393 QPtrList<Event> events = mCalendar->events(); 398 QPtrList<Event> events = mCalendar->events();
394 Event *event; 399 Event *event;
395 QDateTime dt; 400 QDateTime dt;
396 bool ok; 401 bool ok;
397 bDays.fill( false); 402 bDays.fill( false);
398 pDays.fill( false); 403 pDays.fill( false);
399 hDays.fill( false); 404 hDays.fill( false);
400 eDays.fill( false); 405 eDays.fill( false);
401 mHolidays.clear(); 406 mHolidays.clear();
402 QDate mStartDate = days[0]; 407 QDate mStartDate = days[0];
403 QDate endDate = mStartDate.addDays( timeSpan ); 408 QDate endDate = mStartDate.addDays( timeSpan );
404 for( event = events.first(); event; event = events.next() ) { // for event 409 for( event = events.first(); event; event = events.next() ) { // for event
405 ushort recurType = event->recurrence()->doesRecur(); 410 ushort recurType = event->recurrence()->doesRecur();
406 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 411 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
407 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 412 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
408 continue; 413 continue;
409 } 414 }
410 if ( event->doesRecur() ) { 415 if ( event->doesRecur() ) {
411 bool last; 416 bool last;
412 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 417 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
413 QDateTime incidenceEnd; 418 QDateTime incidenceEnd;
414 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 419 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
415 bool invalid = false; 420 bool invalid = false;
416 while( true ) { 421 while( true ) {
417 if ( incidenceStart.isValid() ) { 422 if ( incidenceStart.isValid() ) {
418 incidenceEnd = incidenceStart.addDays( eventlen ); 423 incidenceEnd = incidenceStart.addDays( eventlen );
419 int st = incidenceStart.date().daysTo( endDate ); 424 int st = incidenceStart.date().daysTo( endDate );
420 if ( st >= 0 ) { // start before timeend 425 if ( st >= 0 ) { // start before timeend
421 int end = mStartDate.daysTo( incidenceEnd.date() ); 426 int end = mStartDate.daysTo( incidenceEnd.date() );
422 if ( end >= 0 ) { // end after timestart --- got one! 427 if ( end >= 0 ) { // end after timestart --- got one!
423 //normalize 428 //normalize
424 st = timeSpan - st; 429 st = timeSpan - st;
425 if ( st < 0 ) st = 0; 430 if ( st < 0 ) st = 0;
426 if ( end > timeSpan ) end = timeSpan; 431 if ( end > timeSpan ) end = timeSpan;
427 int iii; 432 int iii;
428 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 433 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
429 for ( iii = st;iii<= end;++iii) { 434 for ( iii = st;iii<= end;++iii) {
430 computeEvent( event, iii ); 435 computeEvent( event, iii );
431 } 436 }
432 } 437 }
433 } 438 }
434 } else { 439 } else {
435 if ( invalid ) 440 if ( invalid )
436 break; 441 break;
437 invalid = true; 442 invalid = true;
438 //qDebug("invalid %s", event->summary().latin1()); 443 //qDebug("invalid %s", event->summary().latin1());
439 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 444 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
440 } 445 }
441 if ( last ) 446 if ( last )
442 break; 447 break;
443 bool ok; 448 bool ok;
444 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 449 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
445 if ( ! ok ) 450 if ( ! ok )
446 break; 451 break;
447 if ( incidenceStart.date() > endDate ) 452 if ( incidenceStart.date() > endDate )
448 break; 453 break;
449 } 454 }
450 } else { // no recur 455 } else { // no recur
451 int st = event->dtStart().date().daysTo( endDate ); 456 int st = event->dtStart().date().daysTo( endDate );
452 if ( st >= 0 ) { // start before timeend 457 if ( st >= 0 ) { // start before timeend
453 int end = mStartDate.daysTo( event->dtEnd().date() ); 458 int end = mStartDate.daysTo( event->dtEnd().date() );
454 if ( end >= 0 ) { // end after timestart --- got one! 459 if ( end >= 0 ) { // end after timestart --- got one!
455 //normalize 460 //normalize
456 st = timeSpan - st; 461 st = timeSpan - st;
457 if ( st < 0 ) st = 0; 462 if ( st < 0 ) st = 0;
458 if ( end > timeSpan ) end = timeSpan; 463 if ( end > timeSpan ) end = timeSpan;
459 int iii; 464 int iii;
460 for ( iii = st;iii<= end;++iii) 465 for ( iii = st;iii<= end;++iii)
461 computeEvent( event, iii ); 466 computeEvent( event, iii );
462 } 467 }
463 } 468 }
464 } 469 }
465 } 470 }
466 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 471 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
467 for(i = 0; i < NUMDAYS; i++) { 472 for(i = 0; i < NUMDAYS; i++) {
468 if ( ( (i+startDay) % 7 == 0 ) ) { 473 if ( ( (i+startDay) % 7 == 0 ) ) {
469 pDays.setBit(i); 474 pDays.setBit(i);
470 } 475 }
471 } 476 }
472 477 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
473#if 0 478 bDays.fill( false);
474 // insert due todos 479 // insert due todos
475 QPtrList<Todo> todos = calendar()->todos( ); 480 QPtrList<Todo> todos = mCalendar->todos( );
476 Todo *todo; 481 Todo *todo;
477 for(todo = todos.first(); todo; todo = todos.next()) { 482 for(todo = todos.first(); todo; todo = todos.next()) {
478 //insertTodo( todo ); 483 //insertTodo( todo );
479 if ( todo->hasDueDate() ) { 484 if ( todo->hasDueDate() ) {
480 int day = mStartDate.daysTo( todo->dtDue().date() ); 485 int day = mStartDate.daysTo( todo->dtDue().date() );
486 if ( day >= 0 && day < timeSpan + 1) {
487 int i = day;
488 QString holiStr = mHolidays[i];
489 pDays.setBit(i);
490 if ( !holiStr.isEmpty() )
491 holiStr += "\n";
492 holiStr += i18n("Todo") + ": "+todo->summary();
493 if ( !todo->location().isEmpty() )
494 holiStr += " (" + todo->location() + ")";
495 bDays.setBit(i);
496 mHolidays[i] =holiStr ;
497 eDays.setBit(i);
498 }
499 }
500 }
501 }
502 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
503 bDays.fill( false);
504 // insert due todos
505 QPtrList<Journal> todos = mCalendar->journals( );
506 Journal *todo;
507 for(todo = todos.first(); todo; todo = todos.next()) {
508 int day = mStartDate.daysTo( todo->dtStart().date() );
481 if ( day >= 0 && day < timeSpan + 1) { 509 if ( day >= 0 && day < timeSpan + 1) {
482 (*cells)[day]->insertTodo( todo ); 510 int i = day;
511 QString holiStr = mHolidays[i];
512 pDays.setBit(i);
513 if ( !holiStr.isEmpty() )
514 holiStr += "\n";
515 holiStr += i18n("Journal");
516 bDays.setBit(i);
517 mHolidays[i] =holiStr ;
518 eDays.setBit(i);
519
483 } 520 }
484 } 521 }
485 } 522 }
486#endif
487
488#else 523#else
489 //qDebug("KODayMatrix::updateViewTimed "); 524 //qDebug("KODayMatrix::updateViewTimed ");
490 for(int i = 0; i < NUMDAYS; i++) { 525 for(int i = 0; i < NUMDAYS; i++) {
491 // if events are set for the day then remember to draw it bold 526 // if events are set for the day then remember to draw it bold
492 QPtrList<Event> eventlist = mCalendar->events(days[i]); 527 QPtrList<Event> eventlist = mCalendar->events(days[i]);
493 Event *event; 528 Event *event;
494 int numEvents = eventlist.count(); 529 int numEvents = eventlist.count();
495 QString holiStr = ""; 530 QString holiStr = "";
496 bDays.clearBit(i); 531 bDays.clearBit(i);
497 hDays.clearBit(i); 532 hDays.clearBit(i);
498 eDays.clearBit(i); 533 eDays.clearBit(i);
499 for(event=eventlist.first();event != 0;event=eventlist.next()) { 534 for(event=eventlist.first();event != 0;event=eventlist.next()) {
500 ushort recurType = event->recurrence()->doesRecur(); 535 ushort recurType = event->recurrence()->doesRecur();
501 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 536 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
502 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 537 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
503 numEvents--; 538 numEvents--;
504 } 539 }
505 if ( event->isHoliday()) { 540 if ( event->isHoliday()) {
506 hDays.setBit(i); 541 hDays.setBit(i);
507 if ( !holiStr.isEmpty() ) 542 if ( !holiStr.isEmpty() )
508 holiStr += "\n"; 543 holiStr += "\n";
509 holiStr += event->summary(); 544 holiStr += event->summary();
510 if ( !event->location().isEmpty() ) 545 if ( !event->location().isEmpty() )
511 holiStr += " (" + event->location() + ")"; 546 holiStr += " (" + event->location() + ")";
512 } 547 }
513 if ( event->isBirthday()) { 548 if ( event->isBirthday()) {
514 if ( !holiStr.isEmpty() ) 549 if ( !holiStr.isEmpty() )
515 holiStr += "\n"; 550 holiStr += "\n";
516 holiStr += i18n("Birthday") + ": "+event->summary(); 551 holiStr += i18n("Birthday") + ": "+event->summary();
517 if ( !event->location().isEmpty() ) 552 if ( !event->location().isEmpty() )
518 holiStr += " (" + event->location() + ")"; 553 holiStr += " (" + event->location() + ")";
519 bDays.setBit(i); 554 bDays.setBit(i);
520 } 555 }
521 } 556 }
522 if ( numEvents ) 557 if ( numEvents )
523 eDays.setBit(i); 558 eDays.setBit(i);
524 //if it is a holy day then draw it red. Sundays are consider holidays, too 559 //if it is a holy day then draw it red. Sundays are consider holidays, too
525 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 560 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
526 !holiStr.isEmpty()) { 561 !holiStr.isEmpty()) {
527 mHolidays[i] = holiStr; 562 mHolidays[i] = holiStr;
528 } else { 563 } else {
529 mHolidays[i] = QString::null; 564 mHolidays[i] = QString::null;
530 } 565 }
531 } 566 }
532#endif 567#endif
533 mRedrawNeeded = true; 568 mRedrawNeeded = true;
534 if ( ! mPendingUpdateBeforeRepaint ) 569 if ( ! mPendingUpdateBeforeRepaint )
535 repaint(false); 570 repaint(false);
536} 571}
537void KODayMatrix::updateView(QDate actdate) 572void KODayMatrix::updateView(QDate actdate)
538{ 573{
539 574 if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView )
575 mRedrawNeeded = true;
576 mLastView = KOPrefs::instance()->mCurrentDisplayedView;
540 if ( ! actdate.isValid() ) { 577 if ( ! actdate.isValid() ) {
541 //qDebug("date not valid "); 578 //qDebug("date not valid ");
542 return; 579 return;
543 } 580 }
544 mDayChanged = false; 581 mDayChanged = false;
545 //flag to indicate if the starting day of the matrix has changed by this call 582 //flag to indicate if the starting day of the matrix has changed by this call
546 //mDayChanged = false; 583 //mDayChanged = false;
547 // if a new startdate is to be set then apply Cornelius's calculation 584 // if a new startdate is to be set then apply Cornelius's calculation
548 // of the first day to be shown 585 // of the first day to be shown
549 if (actdate != startdate) { 586 if (actdate != startdate) {
550 // reset index of selection according to shift of starting date from startdate to actdate 587 // reset index of selection according to shift of starting date from startdate to actdate
551 if (mSelStart != NOSELECTION) { 588 if (mSelStart != NOSELECTION) {
552 int tmp = actdate.daysTo(startdate); 589 int tmp = actdate.daysTo(startdate);
553 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 590 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
554 // shift selection if new one would be visible at least partly ! 591 // shift selection if new one would be visible at least partly !
555 592
556 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 593 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
557 // nested if is required for next X display pushed from a different month - correction required 594 // nested if is required for next X display pushed from a different month - correction required
558 // otherwise, for month forward and backward, it must be avoided 595 // otherwise, for month forward and backward, it must be avoided
559 if( mSelStart > NUMDAYS || mSelStart < 0 ) 596 if( mSelStart > NUMDAYS || mSelStart < 0 )
560 mSelStart = mSelStart + tmp; 597 mSelStart = mSelStart + tmp;
561 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 598 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
562 mSelEnd = mSelEnd + tmp; 599 mSelEnd = mSelEnd + tmp;
563 } 600 }
564 } 601 }
565 startdate = actdate; 602 startdate = actdate;
566 mDayChanged = true; 603 mDayChanged = true;
567 recalculateToday(); 604 recalculateToday();
568 mRedrawNeeded = true; 605 mRedrawNeeded = true;
569 } 606 }
570 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 607 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
571 if ( !isVisible() ) { 608 if ( !isVisible() ) {
572 mPendingUpdateBeforeRepaint = true; 609 mPendingUpdateBeforeRepaint = true;
573 } else { 610 } else {
574#ifdef DESKTOP_VERSION 611#ifdef DESKTOP_VERSION
575 //mRepaintTimer->start( 100 ); 612 //mRepaintTimer->start( 100 );
576 //updateViewTimed(); 613 //updateViewTimed();
577 mUpdateTimer->start( 50 ); 614 mUpdateTimer->start( 50 );
578#else 615#else
579 mRepaintTimer->start( 350 ); 616 mRepaintTimer->start( 350 );
580 mUpdateTimer->start( 800 ); 617 mUpdateTimer->start( 800 );
581#endif 618#endif
582 } 619 }
583} 620}
584void KODayMatrix::updateEvents() 621void KODayMatrix::updateEvents()
585{ 622{
586 if ( !mCalendar ) return; 623 if ( !mCalendar ) return;
587 624
588 for( int i = 0; i < NUMDAYS; i++ ) { 625 for( int i = 0; i < NUMDAYS; i++ ) {
589 // if events are set for the day then remember to draw it bold 626 // if events are set for the day then remember to draw it bold
590 QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); 627 QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
591 int numEvents = eventlist.count(); 628 int numEvents = eventlist.count();
592 Event *event; 629 Event *event;
593 for( event = eventlist.first(); event != 0;event=eventlist.next()) { 630 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
594 ushort recurType = event->doesRecur(); 631 ushort recurType = event->doesRecur();
595 632
596 if ( ( recurType == Recurrence::rDaily && 633 if ( ( recurType == Recurrence::rDaily &&
597 !KOPrefs::instance()->mDailyRecur ) || 634 !KOPrefs::instance()->mDailyRecur ) ||
598 ( recurType == Recurrence::rWeekly && 635 ( recurType == Recurrence::rWeekly &&
599 !KOPrefs::instance()->mWeeklyRecur ) ) { 636 !KOPrefs::instance()->mWeeklyRecur ) ) {
600 numEvents--; 637 numEvents--;
601 } 638 }
602 } 639 }
603 if ( numEvents ) 640 if ( numEvents )
604 eDays.setBit(i); 641 eDays.setBit(i);
605 else 642 else
606 eDays.clearBit(i); 643 eDays.clearBit(i);
607 } 644 }
608} 645}
609 646
610const QDate& KODayMatrix::getDate(int offset) 647const QDate& KODayMatrix::getDate(int offset)
611{ 648{
612 if (offset < 0 || offset > NUMDAYS-1) { 649 if (offset < 0 || offset > NUMDAYS-1) {
613 qDebug("Wrong offset2 %d", offset); 650 qDebug("Wrong offset2 %d", offset);
614 return days[0]; 651 return days[0];
615 } 652 }
616 return days[offset]; 653 return days[offset];
617} 654}
618 655
619QString KODayMatrix::getHolidayLabel(int offset) 656QString KODayMatrix::getHolidayLabel(int offset)
620{ 657{
621 if (offset < 0 || offset > NUMDAYS-1) { 658 if (offset < 0 || offset > NUMDAYS-1) {
622 qDebug("Wrong offset1 %d", offset); 659 qDebug("Wrong offset1 %d", offset);
623 return QString(); 660 return QString();
624 } 661 }
625 return mHolidays[offset]; 662 return mHolidays[offset];
626} 663}
627 664
628int KODayMatrix::getDayIndexFrom(int x, int y) 665int KODayMatrix::getDayIndexFrom(int x, int y)
629{ 666{
630 int colModulo = (width()-2) % 7; 667 int colModulo = (width()-2) % 7;
631 int rowModulo = (height()-2) % 6; 668 int rowModulo = (height()-2) % 6;
632#if 0 669#if 0
633 return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? 670 return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ?
634 6 - x/daysize.width() : x/daysize.width()); 671 6 - x/daysize.width() : x/daysize.width());
635#endif 672#endif
636 int xVal = (x-colModulo/2-2)/daysize.width(); 673 int xVal = (x-colModulo/2-2)/daysize.width();
637 int yVal = (y-rowModulo/2-2)/daysize.height(); 674 int yVal = (y-rowModulo/2-2)/daysize.height();
638 675
639 676
640 return 7*(yVal) + xVal; 677 return 7*(yVal) + xVal;
641 678
642} 679}
643 680
644// ---------------------------------------------------------------------------- 681// ----------------------------------------------------------------------------
645// M O U S E E V E N T H A N D L I N G 682// M O U S E E V E N T H A N D L I N G
646// ---------------------------------------------------------------------------- 683// ----------------------------------------------------------------------------
647 684
648void KODayMatrix::mousePressEvent (QMouseEvent* e) 685void KODayMatrix::mousePressEvent (QMouseEvent* e)
649{ 686{
650 687
651 if ( e->button() == LeftButton ) 688 if ( e->button() == LeftButton )
652 mouseDown = true; 689 mouseDown = true;
653 mSelStart = getDayIndexFrom(e->x(), e->y()); 690 mSelStart = getDayIndexFrom(e->x(), e->y());
654 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; 691 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1;
655 mSelInit = mSelStart; 692 mSelInit = mSelStart;
656 mSelEnd = mSelStart; 693 mSelEnd = mSelStart;
657 mRedrawNeeded = true; 694 mRedrawNeeded = true;
658 repaint(false); 695 repaint(false);
659} 696}
660 697
661void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) 698void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
662{ 699{
663 mRedrawNeeded = true; 700 mRedrawNeeded = true;
664 if ( e->button() == LeftButton ) 701 if ( e->button() == LeftButton )
665 if ( ! mouseDown ) { 702 if ( ! mouseDown ) {
666 return; 703 return;
667 } 704 }
668 else 705 else
669 mouseDown = false; 706 mouseDown = false;
670 int tmp = getDayIndexFrom(e->x(), e->y()); 707 int tmp = getDayIndexFrom(e->x(), e->y());
671 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 708 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
672 709
673 if (mSelInit > tmp) { 710 if (mSelInit > tmp) {
674 mSelEnd = mSelInit; 711 mSelEnd = mSelInit;
675 if (tmp != mSelStart) { 712 if (tmp != mSelStart) {
676 mSelStart = tmp; 713 mSelStart = tmp;
677 repaint(false); 714 repaint(false);
678 } 715 }
679 } else { 716 } else {
680 mSelStart = mSelInit; 717 mSelStart = mSelInit;
681 718
682 //repaint only if selection has changed 719 //repaint only if selection has changed
683 if (tmp != mSelEnd) { 720 if (tmp != mSelEnd) {
684 mSelEnd = tmp; 721 mSelEnd = tmp;
685 repaint(false); 722 repaint(false);
686 } 723 }
687 } 724 }
688 725
689 DateList daylist; 726 DateList daylist;
690 if ( mSelStart < 0 ) 727 if ( mSelStart < 0 )
691 mSelStart = 0; 728 mSelStart = 0;
692 for (int i = mSelStart; i <= mSelEnd; i++) { 729 for (int i = mSelStart; i <= mSelEnd; i++) {
693 daylist.append(days[i]); 730 daylist.append(days[i]);
694 } 731 }
695 emit selected((const DateList)daylist); 732 emit selected((const DateList)daylist);
696 733
697} 734}
698 735
699void KODayMatrix::mouseMoveEvent (QMouseEvent* e) 736void KODayMatrix::mouseMoveEvent (QMouseEvent* e)
700{ 737{
701 if ( ! mouseDown ) { 738 if ( ! mouseDown ) {
702 return; 739 return;
703 } 740 }
704 mRedrawNeeded = true; 741 mRedrawNeeded = true;
705 int tmp = getDayIndexFrom(e->x(), e->y()); 742 int tmp = getDayIndexFrom(e->x(), e->y());
706 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 743 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
707 744
708 if (mSelInit > tmp) { 745 if (mSelInit > tmp) {
709 mSelEnd = mSelInit; 746 mSelEnd = mSelInit;
710 if (tmp != mSelStart) { 747 if (tmp != mSelStart) {
711 mSelStart = tmp; 748 mSelStart = tmp;
712 repaint(false); 749 repaint(false);
713 } 750 }
714 } else { 751 } else {
715 mSelStart = mSelInit; 752 mSelStart = mSelInit;
716 753
717 //repaint only if selection has changed 754 //repaint only if selection has changed
718 if (tmp != mSelEnd) { 755 if (tmp != mSelEnd) {
719 mSelEnd = tmp; 756 mSelEnd = tmp;
720 repaint(false); 757 repaint(false);
721 } 758 }
722 } 759 }
723} 760}
724 761
725// ---------------------------------------------------------------------------- 762// ----------------------------------------------------------------------------
726// D R A G ' N D R O P H A N D L I N G 763// D R A G ' N D R O P H A N D L I N G
727// ---------------------------------------------------------------------------- 764// ----------------------------------------------------------------------------
728 765
729void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) 766void KODayMatrix::dragEnterEvent(QDragEnterEvent *e)
730{ 767{
731#ifndef KORG_NODND 768#ifndef KORG_NODND
732 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 769 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
733 e->ignore(); 770 e->ignore();
734 return; 771 return;
735 } 772 }
736 773
737 // some visual feedback 774 // some visual feedback
738// oldPalette = palette(); 775// oldPalette = palette();
739// setPalette(my_HilitePalette); 776// setPalette(my_HilitePalette);
740// update(); 777// update();
741#endif 778#endif
742} 779}
743 780
744void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) 781void KODayMatrix::dragMoveEvent(QDragMoveEvent *e)
745{ 782{
746#ifndef KORG_NODND 783#ifndef KORG_NODND
747 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 784 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
748 e->ignore(); 785 e->ignore();
749 return; 786 return;
750 } 787 }
751 788
752 e->accept(); 789 e->accept();
753#endif 790#endif
754} 791}
755 792
756void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) 793void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/)
757{ 794{
758#ifndef KORG_NODND 795#ifndef KORG_NODND
759// setPalette(oldPalette); 796// setPalette(oldPalette);
760// update(); 797// update();
761#endif 798#endif
762} 799}
763 800
764void KODayMatrix::dropEvent(QDropEvent *e) 801void KODayMatrix::dropEvent(QDropEvent *e)
765{ 802{
766#ifndef KORG_NODND 803#ifndef KORG_NODND
767// kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; 804// kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl;
768 805
769 if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 806 if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
770 e->ignore(); 807 e->ignore();
771 return; 808 return;
772 } 809 }
773 810
774 DndFactory factory( mCalendar ); 811 DndFactory factory( mCalendar );
775 Event *event = factory.createDrop(e); 812 Event *event = factory.createDrop(e);
776 813
777 if (event) { 814 if (event) {
778 e->acceptAction(); 815 e->acceptAction();
779 816
780 Event *existingEvent = mCalendar->event(event->uid()); 817 Event *existingEvent = mCalendar->event(event->uid());
781 818
782 if(existingEvent) { 819 if(existingEvent) {
783 // uniquify event 820 // uniquify event
784 event->recreate(); 821 event->recreate();
785/* 822/*
786 KMessageBox::sorry(this, 823 KMessageBox::sorry(this,
787 i18n("Event already exists in this calendar."), 824 i18n("Event already exists in this calendar."),
788 i18n("Drop Event")); 825 i18n("Drop Event"));
789 delete event; 826 delete event;
790 return; 827 return;
791*/ 828*/
792 } 829 }
793// kdDebug() << "Drop new Event" << endl; 830// kdDebug() << "Drop new Event" << endl;
794 // Adjust date 831 // Adjust date
795 QDateTime start = event->dtStart(); 832 QDateTime start = event->dtStart();
796 QDateTime end = event->dtEnd(); 833 QDateTime end = event->dtEnd();
797 int duration = start.daysTo(end); 834 int duration = start.daysTo(end);
798 int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); 835 int idx = getDayIndexFrom(e->pos().x(), e->pos().y());
799 836
800 start.setDate(days[idx]); 837 start.setDate(days[idx]);
801 end.setDate(days[idx].addDays(duration)); 838 end.setDate(days[idx].addDays(duration));
802 839
803 event->setDtStart(start); 840 event->setDtStart(start);
804 event->setDtEnd(end); 841 event->setDtEnd(end);
805 mCalendar->addEvent(event); 842 mCalendar->addEvent(event);
806 843
807 emit eventDropped(event); 844 emit eventDropped(event);
808 } else { 845 } else {
809// kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; 846// kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl;
810 e->ignore(); 847 e->ignore();
811 } 848 }
812#endif 849#endif
813} 850}
814 851
815// ---------------------------------------------------------------------------- 852// ----------------------------------------------------------------------------
816// P A I N T E V E N T H A N D L I N G 853// P A I N T E V E N T H A N D L I N G
817// ---------------------------------------------------------------------------- 854// ----------------------------------------------------------------------------
818 855
819void KODayMatrix::paintEvent(QPaintEvent * pevent) 856void KODayMatrix::paintEvent(QPaintEvent * pevent)
820{ 857{
821 858
822 if ( width() <= 0 || height() <= 0 ) 859 if ( width() <= 0 || height() <= 0 )
823 return; 860 return;
824 if ( mPendingUpdateBeforeRepaint ) { 861 if ( mPendingUpdateBeforeRepaint ) {
825 updateViewTimed(); 862 updateViewTimed();
826 mPendingUpdateBeforeRepaint = false; 863 mPendingUpdateBeforeRepaint = false;
827 } 864 }
828#if 0 865#if 0
829 if ( myPix.width() != width() || myPix.height()!=height() ) { 866 if ( myPix.width() != width() || myPix.height()!=height() ) {
830 myPix.resize(size() ); 867 myPix.resize(size() );
831 mRedrawNeeded = true; 868 mRedrawNeeded = true;
832 } 869 }
833#endif 870#endif
834 if ( oldW != width() || oldH !=height() ) 871 if ( oldW != width() || oldH !=height() )
835 mRedrawNeeded = true; 872 mRedrawNeeded = true;
836 873
837 oldH = height() ; 874 oldH = height() ;
838 oldW = width(); 875 oldW = width();
839 if ( myPix.width() < width() || myPix.height() < height() ) { 876 if ( myPix.width() < width() || myPix.height() < height() ) {
840 myPix.resize(size() ); 877 myPix.resize(size() );
841 mRedrawNeeded = true; 878 mRedrawNeeded = true;
842 879
843 } 880 }
844 881
845 if ( mRedrawNeeded ) { 882 if ( mRedrawNeeded ) {
846 //qDebug("REDRAW "); 883 //qDebug("REDRAW ");
847 QPainter p(&myPix); 884 QPainter p(&myPix);
848 p.setFont(font()); 885 p.setFont(font());
849 886
850 887
851 int dheight = daysize.height(); 888 int dheight = daysize.height();
852 int dwidth = daysize.width(); 889 int dwidth = daysize.width();
853 int row,col; 890 int row,col;
854 int selw, selh; 891 int selw, selh;
855 int xyOff = frameWidth(); 892 int xyOff = frameWidth();
856 int colModulo = (width()-2) % 7; 893 int colModulo = (width()-2) % 7;
857 int rowModulo = (height()-2) % 6; 894 int rowModulo = (height()-2) % 6;
858 //qDebug("col %d row %d ",colModulo,rowModulo ); 895 //qDebug("col %d row %d ",colModulo,rowModulo );
859 896
860 bool isRTL = KOGlobals::self()->reverseLayout(); 897 bool isRTL = KOGlobals::self()->reverseLayout();
861 898
862 // draw background and topleft frame 899 // draw background and topleft frame
863 p.fillRect(0,0,width(),height(), mDefaultBackColor); 900 p.fillRect(0,0,width(),height(), mDefaultBackColor);
864 p.setPen(mDefaultTextColor); 901 p.setPen(mDefaultTextColor);
865 p.drawRect(0, 0, width(), height()); 902 p.drawRect(0, 0, width(), height());
866 int mSelStartT = mSelStart; 903 int mSelStartT = mSelStart;
867 int mSelEndT = mSelEnd; 904 int mSelEndT = mSelEnd;
868 if ( mSelEndT >= NUMDAYS ) 905 if ( mSelEndT >= NUMDAYS )
869 mSelEndT = NUMDAYS-1; 906 mSelEndT = NUMDAYS-1;
870 // draw selected days with highlighted background color 907 // draw selected days with highlighted background color
871 if (mSelStart != NOSELECTION) { 908 if (mSelStart != NOSELECTION) {
872 bool skip = false; 909 bool skip = false;
873 if ( ! mouseDown ) { 910 if ( ! mouseDown ) {
874 int mo = days[20].month(); 911 int mo = days[20].month();
875 //qDebug("-- %d %d ", mSelStartT, mSelEndT); 912 //qDebug("-- %d %d ", mSelStartT, mSelEndT);
876 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); 913 //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() );
877 int startMo = days[mSelStartT].month(); 914 int startMo = days[mSelStartT].month();
878 int endMo = days[mSelEndT].month(); 915 int endMo = days[mSelEndT].month();
879 if ( startMo == 12 && mo == 1 && endMo <= 2 ) 916 if ( startMo == 12 && mo == 1 && endMo <= 2 )
880 startMo = 1; 917 startMo = 1;
881 if ( endMo == 1 && mo == 12 ) 918 if ( endMo == 1 && mo == 12 )
882 endMo = 12; 919 endMo = 12;
883 if ( mo == 12 && startMo == 1 ) 920 if ( mo == 12 && startMo == 1 )
884 startMo = 13; 921 startMo = 13;
885 if ( (startMo > mo || endMo < mo) ) { 922 if ( (startMo > mo || endMo < mo) ) {
886 skip = true; 923 skip = true;
887 } else { 924 } else {
888 if ( days[mSelStartT].month() != mo ) { 925 if ( days[mSelStartT].month() != mo ) {
889 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); 926 int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day();
890 mSelStartT += add +1; 927 mSelStartT += add +1;
891 } 928 }
892 if ( days[mSelEndT].month() != mo ) { 929 if ( days[mSelEndT].month() != mo ) {
893 int sub = days[mSelEndT].day(); 930 int sub = days[mSelEndT].day();
894 mSelEndT -= sub ; 931 mSelEndT -= sub ;
895 } 932 }
896 } 933 }
897 } 934 }
898 //qDebug("SKIP %d ", skip); 935 //qDebug("SKIP %d ", skip);
899 if ( ! skip ) { 936 if ( ! skip ) {
900 row = mSelStartT/7; 937 row = mSelStartT/7;
901 col = mSelStartT -row*7; 938 col = mSelStartT -row*7;
902 QColor selcol = KOPrefs::instance()->mHighlightColor; 939 QColor selcol = KOPrefs::instance()->mHighlightColor;
903 int addCol = 0; 940 int addCol = 0;
904 int addRow = 0; 941 int addRow = 0;
905 int addRow2 = 0; 942 int addRow2 = 0;
906 int addCol2 = 0; 943 int addCol2 = 0;
907 if (row == mSelEndT/7) { 944 if (row == mSelEndT/7) {
908 if ( rowModulo ) { 945 if ( rowModulo ) {
909 if ( row >= 6 - rowModulo ) 946 if ( row >= 6 - rowModulo )
910 addRow = row - 5 + rowModulo; 947 addRow = row - 5 + rowModulo;
911 } 948 }
912 if ( colModulo ) { 949 if ( colModulo ) {
913 int colt1 = mSelEndT%7; 950 int colt1 = mSelEndT%7;
914 //qDebug("colt1 %d ", colt1 ); 951 //qDebug("colt1 %d ", colt1 );
915 if ( colt1 >= 7 - colModulo ) 952 if ( colt1 >= 7 - colModulo )
916 addCol = colt1 - 7 + colModulo+1; 953 addCol = colt1 - 7 + colModulo+1;
917 int colt = mSelStartT%7; 954 int colt = mSelStartT%7;
918 if ( colt >= 7 - colModulo ) 955 if ( colt >= 7 - colModulo )
919 addCol2 = colt - 7 + colModulo; 956 addCol2 = colt - 7 + colModulo;
920 addCol -= addCol2; 957 addCol -= addCol2;
921 //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); 958 //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 );
922 } 959 }
923 // Single row selection 960 // Single row selection
924 //if ( row == 0) 961 //if ( row == 0)
925 // addRow = 1; 962 // addRow = 1;
926 p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, 963 p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2,
927 row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); 964 row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol);
928 } else { 965 } else {
929 // draw first row to the right 966 // draw first row to the right
930 if ( colModulo ) { 967 if ( colModulo ) {
931 if ( col >= 7 - colModulo ) 968 if ( col >= 7 - colModulo )
932 addCol2 = col - 7 + colModulo; 969 addCol2 = col - 7 + colModulo;
933 } 970 }
934 if ( rowModulo ) { 971 if ( rowModulo ) {
935 if ( row >= 6 - rowModulo ) 972 if ( row >= 6 - rowModulo )
936 addRow = row - 5 + rowModulo; 973 addRow = row - 5 + rowModulo;
937 } 974 }
938 //if ( row == 0) 975 //if ( row == 0)
939 // addRow = 1; 976 // addRow = 1;
940 int drawWid = width()-(col*dwidth+1+addCol2)-1; 977 int drawWid = width()-(col*dwidth+1+addCol2)-1;
941 p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, 978 p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid,
942 dheight+1, selcol); 979 dheight+1, selcol);
943 // draw full block till last line 980 // draw full block till last line
944 selh = mSelEndT/7-row; 981 selh = mSelEndT/7-row;
945 addRow = 0; 982 addRow = 0;
946 if ( rowModulo ) { 983 if ( rowModulo ) {
947 if ( mSelEndT/7 >= 6 - rowModulo ) 984 if ( mSelEndT/7 >= 6 - rowModulo )
948 addRow = mSelEndT/7 - 5 + rowModulo; 985 addRow = mSelEndT/7 - 5 + rowModulo;
949 } 986 }
950 //qDebug("%d %d %d ",selh, row, addRow ); 987 //qDebug("%d %d %d ",selh, row, addRow );
951 int addrow2 = addRow-selh+1; 988 int addrow2 = addRow-selh+1;
952 if ( addrow2 < 0 ) 989 if ( addrow2 < 0 )
953 addrow2 = 0; 990 addrow2 = 0;
954 if (selh > 1) { 991 if (selh > 1) {
955 p.fillRect(1, (row+1)*dheight+addrow2, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); 992 p.fillRect(1, (row+1)*dheight+addrow2, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol);
956 } 993 }
957 // draw last block from left to mSelEndT 994 // draw last block from left to mSelEndT
958 selw = mSelEndT-7*(mSelEndT/7)+1; 995 selw = mSelEndT-7*(mSelEndT/7)+1;
959 //qDebug("esl %d ",selw ); 996 //qDebug("esl %d ",selw );
960 int add = 0; 997 int add = 0;
961 if ( colModulo ) { 998 if ( colModulo ) {
962 add = 7 - colModulo; 999 add = 7 - colModulo;
963 if ( selw > add ) 1000 if ( selw > add )
964 add = selw - add; 1001 add = selw - add;
965 else 1002 else
966 add = 0; 1003 add = 0;
967 } 1004 }
968 //qDebug("add %d ", add); 1005 //qDebug("add %d ", add);
969 p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, 1006 p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow,
970 selw*dwidth+add, dheight+1, selcol); 1007 selw*dwidth+add, dheight+1, selcol);
971 } 1008 }
972 } 1009 }
973 } 1010 }
974 1011
975 // iterate over all days in the matrix and draw the day label in appropriate colors 1012 // iterate over all days in the matrix and draw the day label in appropriate colors
976 QColor actcol = mDefaultTextColorShaded; 1013 QColor actcol = mDefaultTextColorShaded;
977 p.setPen(actcol); 1014 p.setPen(actcol);
978 QPen tmppen; 1015 QPen tmppen;
979 for(int i = 0; i < NUMDAYS; i++) { 1016 for(int i = 0; i < NUMDAYS; i++) {
980 row = i/7; 1017 row = i/7;
981 col = isRTL ? 6-(i-row*7) : i-row*7; 1018 col = isRTL ? 6-(i-row*7) : i-row*7;
982 1019
983 // if it is the first day of a month switch color from normal to shaded and vice versa 1020 // if it is the first day of a month switch color from normal to shaded and vice versa
984 if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { 1021 if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) {
985 if (actcol == mDefaultTextColorShaded) { 1022 if (actcol == mDefaultTextColorShaded) {
986 actcol = mDefaultTextColor; 1023 actcol = mDefaultTextColor;
987 } else { 1024 } else {
988 actcol = mDefaultTextColorShaded; 1025 actcol = mDefaultTextColorShaded;
989 } 1026 }
990 p.setPen(actcol); 1027 p.setPen(actcol);
991 } 1028 }
992 if (actcol == mDefaultTextColorShaded) { 1029 if (actcol == mDefaultTextColorShaded) {
993 if ( ! mouseDown ) { 1030 if ( ! mouseDown ) {
994 continue; 1031 continue;
995 } 1032 }
996 } 1033 }
997 //Reset pen color after selected days block 1034 //Reset pen color after selected days block
998 if (i == mSelEndT+1) { 1035 if (i == mSelEndT+1) {
999 p.setPen(actcol); 1036 p.setPen(actcol);
1000 } 1037 }
1001 1038
1002 // if today then draw rectangle around day 1039 // if today then draw rectangle around day
1003 if (today == i) { 1040 if (today == i) {
1004 tmppen = p.pen(); 1041 tmppen = p.pen();
1005 QPen mTodayPen(p.pen()); 1042 QPen mTodayPen(p.pen());
1006 if ( daysize.width() < 20 ) 1043 if ( daysize.width() < 20 )
1007 mTodayPen.setWidth(1); 1044 mTodayPen.setWidth(1);
1008 else 1045 else
1009 mTodayPen.setWidth(mTodayMarginWidth); 1046 mTodayPen.setWidth(mTodayMarginWidth);
1010 //draw red rectangle for holidays 1047 //draw red rectangle for holidays
1011 if (pDays.testBit(i)) { 1048 if (pDays.testBit(i)) {
1012 if (actcol == mDefaultTextColor) { 1049 if (actcol == mDefaultTextColor) {
1013 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); 1050 mTodayPen.setColor(KOPrefs::instance()->mHolidayColor);
1014 } else { 1051 } else {
1015 mTodayPen.setColor(mHolidayColorShaded); 1052 mTodayPen.setColor(mHolidayColorShaded);
1016 } 1053 }
1017 } 1054 }
1018 //draw gray rectangle for today if in selection 1055 //draw gray rectangle for today if in selection
1019 if (i >= mSelStartT && i <= mSelEndT) { 1056 if (i >= mSelStartT && i <= mSelEndT) {
1020 QColor grey("grey"); 1057 QColor grey("grey");
1021 mTodayPen.setColor(grey); 1058 mTodayPen.setColor(grey);
1022 } 1059 }
1023 p.setPen(mTodayPen); 1060 p.setPen(mTodayPen);
1024 1061
1025 1062
1026 int addCol = 0; 1063 int addCol = 0;
1027 int addRow = 0; 1064 int addRow = 0;
1028 if (rowModulo) { 1065 if (rowModulo) {
1029 if ( row >= 6 - rowModulo ) 1066 if ( row >= 6 - rowModulo )
1030 addRow = row - 5 + rowModulo; 1067 addRow = row - 5 + rowModulo;
1031 } 1068 }
1032 if ( colModulo ) { 1069 if ( colModulo ) {
1033 if ( col >= 7 - colModulo ) 1070 if ( col >= 7 - colModulo )
1034 addCol = col - 6 + colModulo-1; 1071 addCol = col - 6 + colModulo-1;
1035 } 1072 }
1036 1073
1037 addCol += 1; 1074 addCol += 1;
1038 if ( row == 0 ) 1075 if ( row == 0 )
1039 addRow = 1; 1076 addRow = 1;
1040 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1); 1077 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth+1, dheight+1);
1041 p.setPen(tmppen); 1078 p.setPen(tmppen);
1042 } 1079 }
1043 1080
1044 // if any events are on that day then draw it using a bold font 1081 // if any events are on that day then draw it using a bold font
1045 if ( eDays.testBit(i) ) { 1082 if ( eDays.testBit(i) ) {
1046 QFont myFont = font(); 1083 QFont myFont = font();
1047 myFont.setBold(true); 1084 myFont.setBold(true);
1048 p.setFont(myFont); 1085 p.setFont(myFont);
1049 } 1086 }
1050 1087
1051 // if it is a holiday then use the default holiday color 1088 // if it is a holiday then use the default holiday color
1052 if ( pDays.testBit(i)) { 1089 if ( pDays.testBit(i)) {
1053 if ( bDays.testBit(i) ) { 1090 if ( bDays.testBit(i) ) {
1054 if ( hDays.testBit(i) ) 1091 if ( hDays.testBit(i) )
1055 p.setPen(QColor(Qt::green)); 1092 p.setPen(QColor(0,200,0));
1056 else 1093 else
1057 p.setPen(QColor(Qt::green).dark()); 1094 p.setPen(QColor(Qt::blue));
1058 } else { 1095 } else {
1059 if (actcol == mDefaultTextColor ) { 1096 if (actcol == mDefaultTextColor ) {
1060 p.setPen(KOPrefs::instance()->mHolidayColor); 1097 p.setPen(KOPrefs::instance()->mHolidayColor);
1061 } else { 1098 } else {
1062 p.setPen(mHolidayColorShaded); 1099 p.setPen(mHolidayColorShaded);
1063 } 1100 }
1064 } 1101 }
1065 } 1102 }
1066 1103
1067 // draw selected days with special color 1104 // draw selected days with special color
1068 // DO NOT specially highlight holidays in selection ! 1105 // DO NOT specially highlight holidays in selection !
1069 if (i >= mSelStartT && i <= mSelEndT) { 1106 if (i >= mSelStartT && i <= mSelEndT) {
1070 ;//p.setPen(mSelectedDaysColor); 1107 ;//p.setPen(mSelectedDaysColor);
1071 } 1108 }
1072 1109
1073 int addCol = 0; 1110 int addCol = 0;
1074 int addRow = 0; 1111 int addRow = 0;
1075 if ( colModulo ) { 1112 if ( colModulo ) {
1076 if ( col >= 7 - colModulo ) 1113 if ( col >= 7 - colModulo )
1077 addCol = col - 7 + colModulo; 1114 addCol = col - 7 + colModulo;
1078 } 1115 }
1079 if ( rowModulo ) { 1116 if ( rowModulo ) {
1080 if ( row >= 6 - rowModulo ) 1117 if ( row >= 6 - rowModulo )
1081 addRow = row - 5 + rowModulo; 1118 addRow = row - 5 + rowModulo;
1082 } 1119 }
1083 //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); 1120 //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow);
1084 ++addCol;//++addCol; 1121 ++addCol;//++addCol;
1085 if ( row == 0) 1122 if ( row == 0)
1086 addRow = 1; 1123 addRow = 1;
1087 p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, 1124 p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight,
1088 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); 1125 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]);
1089 1126
1090 // reset color to actual color 1127 // reset color to actual color
1091 if (pDays.testBit(i)) { 1128 if (pDays.testBit(i)) {
1092 p.setPen(actcol); 1129 p.setPen(actcol);
1093 } 1130 }
1094 // reset bold font to plain font 1131 // reset bold font to plain font
1095 if ( eDays.testBit(i)) { 1132 if ( eDays.testBit(i)) {
1096 QFont myFont = font(); 1133 QFont myFont = font();
1097 myFont.setBold(false); 1134 myFont.setBold(false);
1098 p.setFont(myFont); 1135 p.setFont(myFont);
1099 } 1136 }
1100 } 1137 }
1101 } else { 1138 } else {
1102 //qDebug("NO redraw "); 1139 //qDebug("NO redraw ");
1103 } 1140 }
1104 1141
1105 bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP); 1142 bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP);
1106 mRedrawNeeded = false; 1143 mRedrawNeeded = false;
1107} 1144}
1108 1145
1109// ---------------------------------------------------------------------------- 1146// ----------------------------------------------------------------------------
1110// R E SI Z E E V E N T H A N D L I N G 1147// R E SI Z E E V E N T H A N D L I N G
1111// ---------------------------------------------------------------------------- 1148// ----------------------------------------------------------------------------
1112 1149
1113void KODayMatrix::resizeEvent(QResizeEvent *) 1150void KODayMatrix::resizeEvent(QResizeEvent *)
1114{ 1151{
1115 QRect sz = frameRect(); 1152 QRect sz = frameRect();
1116 daysize.setHeight(sz.height()*7 / NUMDAYS); 1153 daysize.setHeight(sz.height()*7 / NUMDAYS);
1117 daysize.setWidth(sz.width() / 7); 1154 daysize.setWidth(sz.width() / 7);
1118} 1155}
1119 1156
1120QSize KODayMatrix::sizeHint() const 1157QSize KODayMatrix::sizeHint() const
1121{ 1158{
1122 1159
1123 QFontMetrics fm ( font() ); 1160 QFontMetrics fm ( font() );
1124 int wid = fm.width( "30") *7+3; 1161 int wid = fm.width( "30") *7+3;
1125 int hei = fm.height() * 6+3; 1162 int hei = fm.height() * 6+3;
1126 //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); 1163 //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei);
1127 return QSize ( wid, hei ); 1164 return QSize ( wid, hei );
1128 1165
1129} 1166}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index b686bd7..a3216d6 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -1,330 +1,331 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef _KODAYMAT_H 23#ifndef _KODAYMAT_H
24#define _KODAYMAT_H 24#define _KODAYMAT_H
25 25
26#include <libkcal/calendar.h> 26#include <libkcal/calendar.h>
27 27
28#include <qstring.h> 28#include <qstring.h>
29#include <qframe.h> 29#include <qframe.h>
30#include <qcolor.h> 30#include <qcolor.h>
31#include <qpen.h> 31#include <qpen.h>
32#include <qdatetime.h> 32#include <qdatetime.h>
33#include <qtooltip.h> 33#include <qtooltip.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qbitarray.h> 35#include <qbitarray.h>
36#include <qmap.h> 36#include <qmap.h>
37 37
38class QDragEnterEvent; 38class QDragEnterEvent;
39class QDragMoveEvent; 39class QDragMoveEvent;
40class QDragLeaveEvent; 40class QDragLeaveEvent;
41class QDropEvent; 41class QDropEvent;
42 42
43class KODayMatrix; 43class KODayMatrix;
44class KODaymatrixWhatsThis; 44class KODaymatrixWhatsThis;
45 45
46using namespace KCal; 46using namespace KCal;
47 47
48 48
49/** 49/**
50 * small helper class to dynamically show tooltips inside the day matrix. 50 * small helper class to dynamically show tooltips inside the day matrix.
51 * This class asks the day matrix object for a appropriate label which 51 * This class asks the day matrix object for a appropriate label which
52 * is in our special case the name of the holiday or null if this day is no holiday. 52 * is in our special case the name of the holiday or null if this day is no holiday.
53 */ 53 */
54class DynamicTip : public QToolTip 54class DynamicTip : public QToolTip
55{ 55{
56public: 56public:
57 57
58 /** 58 /**
59 * Constructor that expects a KODayMatrix object as parent. 59 * Constructor that expects a KODayMatrix object as parent.
60 * 60 *
61 * @param parent the parent KODayMatrix control. 61 * @param parent the parent KODayMatrix control.
62 */ 62 */
63 DynamicTip(QWidget* parent ); 63 DynamicTip(QWidget* parent );
64 64
65protected: 65protected:
66 66
67 /** 67 /**
68 * Qt's callback to ask the object to provide an approrpiate text for the 68 * Qt's callback to ask the object to provide an approrpiate text for the
69 * tooltip to be shown. 69 * tooltip to be shown.
70 * 70 *
71 * @param pos coordinates of the mouse. 71 * @param pos coordinates of the mouse.
72 */ 72 */
73 void maybeTip( const QPoint & pos); 73 void maybeTip( const QPoint & pos);
74 74
75private: 75private:
76 76
77 /** the parent control this tooltip is designed for. */ 77 /** the parent control this tooltip is designed for. */
78 KODayMatrix* matrix; 78 KODayMatrix* matrix;
79}; 79};
80 80
81/** 81/**
82 * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. 82 * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed.
83 * Cornelius thought this was a waste of memory and a lot of overhead. 83 * Cornelius thought this was a waste of memory and a lot of overhead.
84 * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame 84 * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame
85 * that draws the labels and allows for dragging selection while maintaining nearly full 85 * that draws the labels and allows for dragging selection while maintaining nearly full
86 * compatibility in behaviour with its predecessor. 86 * compatibility in behaviour with its predecessor.
87 * 87 *
88 * The following functionality has been changed: 88 * The following functionality has been changed:
89 * 89 *
90 * o when shifting events in the agenda view from one day to another the day matrix is updated now 90 * o when shifting events in the agenda view from one day to another the day matrix is updated now
91 * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. 91 * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date.
92 * o no support for Ctrl+click to create groups of dates 92 * o no support for Ctrl+click to create groups of dates
93 * (This has not really been supported in the predecessor. It was not very intuitive nor was it 93 * (This has not really been supported in the predecessor. It was not very intuitive nor was it
94 * user friendly.) 94 * user friendly.)
95 * This feature has been replaced with dragging a selection on the matrix. The matrix will 95 * This feature has been replaced with dragging a selection on the matrix. The matrix will
96 * automatically choose the appropriate selection (e.g. you are not any longer able to select 96 * automatically choose the appropriate selection (e.g. you are not any longer able to select
97 * two distinct groups of date selections as in the old class) 97 * two distinct groups of date selections as in the old class)
98 * o now that you can select more then a week it can happen that not all selected days are 98 * o now that you can select more then a week it can happen that not all selected days are
99 * displayed in the matrix. However this is preferred to the alternative which would mean to 99 * displayed in the matrix. However this is preferred to the alternative which would mean to
100 * adjust the selection and leave some days undisplayed while scrolling through the months 100 * adjust the selection and leave some days undisplayed while scrolling through the months
101 * 101 *
102 * @short day matrix widget of the KDateNavigator 102 * @short day matrix widget of the KDateNavigator
103 * 103 *
104 * @author Eitzenberger Thomas 104 * @author Eitzenberger Thomas
105 */ 105 */
106class KODayMatrix: public QFrame { 106class KODayMatrix: public QFrame {
107 107
108 Q_OBJECT 108 Q_OBJECT
109 109
110public: 110public:
111 111
112 /** constructor to create a day matrix widget. 112 /** constructor to create a day matrix widget.
113 * 113 *
114 * @param parent widget that is the parent of the day matrix. Normally this should 114 * @param parent widget that is the parent of the day matrix. Normally this should
115 * be a KDateNavigator 115 * be a KDateNavigator
116 * @param calendar instance of a calendar on which all calculations are based 116 * @param calendar instance of a calendar on which all calculations are based
117 * @param date start date of the matrix (is expected to be already fixed). It is 117 * @param date start date of the matrix (is expected to be already fixed). It is
118 * assumed that this date is the first week day to be shown in the matrix. 118 * assumed that this date is the first week day to be shown in the matrix.
119 * @param name name of the widget 119 * @param name name of the widget
120 */ 120 */
121 KODayMatrix( QWidget *parent, const char *name ); 121 KODayMatrix( QWidget *parent, const char *name );
122 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); 122 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
123 123
124 /** destructor that deallocates all dynamically allocated private members. 124 /** destructor that deallocates all dynamically allocated private members.
125 */ 125 */
126 ~KODayMatrix(); 126 ~KODayMatrix();
127 127
128 /** updates the day matrix to start with the given date. Does all the necessary 128 /** updates the day matrix to start with the given date. Does all the necessary
129 * checks for holidays or events on a day and stores them for display later on. 129 * checks for holidays or events on a day and stores them for display later on.
130 * Does NOT update the view visually. Call repaint() for this. 130 * Does NOT update the view visually. Call repaint() for this.
131 * 131 *
132 * @param actdate recalculates the day matrix to show NUMDAYS starting from this 132 * @param actdate recalculates the day matrix to show NUMDAYS starting from this
133 * date. 133 * date.
134 */ 134 */
135 void updateView(QDate actdate); 135 void updateView(QDate actdate);
136 void updateEvents(); 136 void updateEvents();
137 137
138 /** returns the QDate object associated with day indexed by the 138 /** returns the QDate object associated with day indexed by the
139 * supplied offset. 139 * supplied offset.
140 */ 140 */
141 const QDate& getDate(int offset); 141 const QDate& getDate(int offset);
142 void setCalendar( Calendar * ); 142 void setCalendar( Calendar * );
143 /** returns the official name of this holy day or 0 if there is no label 143 /** returns the official name of this holy day or 0 if there is no label
144 * for this day. 144 * for this day.
145 */ 145 */
146 QString getHolidayLabel(int offset); 146 QString getHolidayLabel(int offset);
147 147
148 /** adds all actual selected days from mSelStart to mSelEnd to the supplied 148 /** adds all actual selected days from mSelStart to mSelEnd to the supplied
149 * DateList. 149 * DateList.
150 */ 150 */
151 void addSelectedDaysTo(DateList&); 151 void addSelectedDaysTo(DateList&);
152 152
153 /** sets the actual to be displayed selection in the day matrix starting from 153 /** sets the actual to be displayed selection in the day matrix starting from
154 * start and ending with end. Theview must be manually updated by calling 154 * start and ending with end. Theview must be manually updated by calling
155 * repaint. (?) 155 * repaint. (?)
156 */ 156 */
157 bool setSelectedDaysFrom(const QDate& start, const QDate& end); 157 bool setSelectedDaysFrom(const QDate& start, const QDate& end);
158 void clearSelection(); 158 void clearSelection();
159 159
160 /** Is today visible in the view? Keep this in sync with 160 /** Is today visible in the view? Keep this in sync with
161 * the values today (below) can take. 161 * the values today (below) can take.
162 */ 162 */
163 bool isTodayVisible() const { return today>=0; } ; 163 bool isTodayVisible() const { return today>=0; } ;
164 164
165 /** If today is visible, then we can find out if today is 165 /** If today is visible, then we can find out if today is
166 * near the beginning or the end of the month. 166 * near the beginning or the end of the month.
167 * This is dependent on today remaining the index 167 * This is dependent on today remaining the index
168 * in the array of visible dates and going from 168 * in the array of visible dates and going from
169 * top left (0) to bottom right (41). 169 * top left (0) to bottom right (41).
170 */ 170 */
171 bool isBeginningOfMonth() const { return today<=8; } ; 171 bool isBeginningOfMonth() const { return today<=8; } ;
172 bool isEndOfMonth() const { return today>=27; } ; 172 bool isEndOfMonth() const { return today>=27; } ;
173 QString getWhatsThisText( QPoint ) ; 173 QString getWhatsThisText( QPoint ) ;
174 QSize sizeHint() const; 174 QSize sizeHint() const;
175 QRect frameRect () const { int wid = frameWidth(); return QRect(0+wid,0+wid,width()-wid-wid,height()-wid-wid);} 175 QRect frameRect () const { int wid = frameWidth(); return QRect(0+wid,0+wid,width()-wid-wid,height()-wid-wid);}
176public slots: 176public slots:
177 /** Recalculates all the flags of the days in the matrix like holidays or events 177 /** Recalculates all the flags of the days in the matrix like holidays or events
178 * on a day (Actually calls above method with the actual startdate). 178 * on a day (Actually calls above method with the actual startdate).
179 */ 179 */
180 void updateView(); 180 void updateView();
181 void updateViewTimed(); 181 void updateViewTimed();
182 void repaintViewTimed(); 182 void repaintViewTimed();
183 183
184 /** 184 /**
185 * Calculate which square in the matrix should be 185 * Calculate which square in the matrix should be
186 * hilighted to indicate it's today. 186 * hilighted to indicate it's today.
187 */ 187 */
188 void recalculateToday(); 188 void recalculateToday();
189 189
190/* 190/*
191 void setStartDate(QDate); 191 void setStartDate(QDate);
192*/ 192*/
193 193
194signals: 194signals:
195 195
196 /** emitted if the user selects a block of days with the mouse by dragging a rectangle 196 /** emitted if the user selects a block of days with the mouse by dragging a rectangle
197 * inside the matrix 197 * inside the matrix
198 * 198 *
199 * @param daylist list of days that have been selected by the user 199 * @param daylist list of days that have been selected by the user
200 */ 200 */
201 void selected( const KCal::DateList &daylist ); 201 void selected( const KCal::DateList &daylist );
202 202
203 /** emitted if the user has dropped an event inside the matrix 203 /** emitted if the user has dropped an event inside the matrix
204 * 204 *
205 * @param event the dropped calendar event 205 * @param event the dropped calendar event
206 */ 206 */
207 void eventDropped(Event *event); 207 void eventDropped(Event *event);
208 208
209protected: 209protected:
210 210
211 void paintEvent(QPaintEvent *ev); 211 void paintEvent(QPaintEvent *ev);
212 212
213 void mousePressEvent (QMouseEvent* e); 213 void mousePressEvent (QMouseEvent* e);
214 214
215 void mouseReleaseEvent (QMouseEvent* e); 215 void mouseReleaseEvent (QMouseEvent* e);
216 216
217 void mouseMoveEvent (QMouseEvent* e); 217 void mouseMoveEvent (QMouseEvent* e);
218 218
219 void dragEnterEvent(QDragEnterEvent *); 219 void dragEnterEvent(QDragEnterEvent *);
220 220
221 void dragMoveEvent(QDragMoveEvent *); 221 void dragMoveEvent(QDragMoveEvent *);
222 222
223 void dragLeaveEvent(QDragLeaveEvent *); 223 void dragLeaveEvent(QDragLeaveEvent *);
224 224
225 void dropEvent(QDropEvent *); 225 void dropEvent(QDropEvent *);
226 226
227 void resizeEvent(QResizeEvent *); 227 void resizeEvent(QResizeEvent *);
228 228
229private: 229private:
230 int mLastView;
230 void computeEvent(Event *even, int dayindex ); 231 void computeEvent(Event *even, int dayindex );
231 int oldW, oldH; 232 int oldW, oldH;
232 bool mRedrawNeeded; 233 bool mRedrawNeeded;
233 KODaymatrixWhatsThis* mKODaymatrixWhatsThis; 234 KODaymatrixWhatsThis* mKODaymatrixWhatsThis;
234 bool mouseDown; 235 bool mouseDown;
235 QBitArray bDays; 236 QBitArray bDays;
236 QBitArray hDays; 237 QBitArray hDays;
237 QBitArray eDays; 238 QBitArray eDays;
238 QBitArray pDays; 239 QBitArray pDays;
239 QPixmap myPix; 240 QPixmap myPix;
240 QTimer* mUpdateTimer; 241 QTimer* mUpdateTimer;
241 QTimer* mRepaintTimer; 242 QTimer* mRepaintTimer;
242 bool mDayChanged; 243 bool mDayChanged;
243 bool mPendingUpdateBeforeRepaint; 244 bool mPendingUpdateBeforeRepaint;
244 245
245 /** returns the index of the day located at the matrix's widget (x,y) position. 246 /** returns the index of the day located at the matrix's widget (x,y) position.
246 * 247 *
247 * @param x horizontal coordinate 248 * @param x horizontal coordinate
248 * @param y vertical coordinate 249 * @param y vertical coordinate
249 */ 250 */
250 int getDayIndexFrom(int x, int y); 251 int getDayIndexFrom(int x, int y);
251 252
252 /** calculates a "shaded" color from the supplied color object. 253 /** calculates a "shaded" color from the supplied color object.
253 * (Copied from Cornelius's kdpdatebutton.cpp) 254 * (Copied from Cornelius's kdpdatebutton.cpp)
254 * 255 *
255 * @param color source based on which a shaded color should be calculated. 256 * @param color source based on which a shaded color should be calculated.
256 */ 257 */
257 QColor getShadedColor(QColor color); 258 QColor getShadedColor(QColor color);
258 259
259 /** number of days to be displayed. For now there is no support for any other number then 42. 260 /** number of days to be displayed. For now there is no support for any other number then 42.
260 so change it at your own risk :o) */ 261 so change it at your own risk :o) */
261 static const int NUMDAYS; 262 static const int NUMDAYS;
262 263
263 /** calendar instance to be queried for holidays, events, ... */ 264 /** calendar instance to be queried for holidays, events, ... */
264 Calendar *mCalendar; 265 Calendar *mCalendar;
265 266
266 /** starting date of the matrix */ 267 /** starting date of the matrix */
267 QDate startdate; 268 QDate startdate;
268 269
269 /** array of day labels to optimeize drawing performance. */ 270 /** array of day labels to optimeize drawing performance. */
270 QString *daylbls; 271 QString *daylbls;
271 272
272 /** array of days displayed to reduce memory consumption by 273 /** array of days displayed to reduce memory consumption by
273 subsequently calling QDate::addDays(). */ 274 subsequently calling QDate::addDays(). */
274 QDate *days; 275 QDate *days;
275 276
276 /** array of storing the number of events on a given day. 277 /** array of storing the number of events on a given day.
277 * used for drawing a bold font if there is at least one event on that day. 278 * used for drawing a bold font if there is at least one event on that day.
278 */ 279 */
279 //int *events; 280 //int *events;
280 281
281 /** stores holiday names of the days shown in the matrix. */ 282 /** stores holiday names of the days shown in the matrix. */
282 QMap<int,QString> mHolidays; 283 QMap<int,QString> mHolidays;
283 284
284 /** indey of today or -1 if today is not visible in the matrix. */ 285 /** indey of today or -1 if today is not visible in the matrix. */
285 int today; 286 int today;
286 287
287 /** index of day where dragged selection was initiated. 288 /** index of day where dragged selection was initiated.
288 used to detect "negative" timely selections */ 289 used to detect "negative" timely selections */
289 int mSelInit; 290 int mSelInit;
290 291
291 /** if mSelStart has this value it indicates that there is no 292 /** if mSelStart has this value it indicates that there is no
292 actual selection in the matrix. */ 293 actual selection in the matrix. */
293 static const int NOSELECTION; 294 static const int NOSELECTION;
294 295
295 /** index of first selected day. */ 296 /** index of first selected day. */
296 int mSelStart; 297 int mSelStart;
297 298
298 /** index of last selected day. */ 299 /** index of last selected day. */
299 int mSelEnd; 300 int mSelEnd;
300 301
301 /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ 302 /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */
302 DynamicTip* mToolTip; 303 DynamicTip* mToolTip;
303 304
304 305
305 /** default background colour of the matrix. */ 306 /** default background colour of the matrix. */
306 QColor mDefaultBackColor; 307 QColor mDefaultBackColor;
307 308
308 /** default text color of the matrix. */ 309 /** default text color of the matrix. */
309 QColor mDefaultTextColor; 310 QColor mDefaultTextColor;
310 311
311 /** default text color for days not in the actual month. */ 312 /** default text color for days not in the actual month. */
312 QColor mDefaultTextColorShaded; 313 QColor mDefaultTextColorShaded;
313 314
314 /** default text color for holidays not in the actual month. */ 315 /** default text color for holidays not in the actual month. */
315 QColor mHolidayColorShaded; 316 QColor mHolidayColorShaded;
316 317
317 /** text color for selected days. */ 318 /** text color for selected days. */
318 QColor mSelectedDaysColor; 319 QColor mSelectedDaysColor;
319 320
320 /** default width of the frame drawn around today if it is visible in the matrix. */ 321 /** default width of the frame drawn around today if it is visible in the matrix. */
321 int mTodayMarginWidth; 322 int mTodayMarginWidth;
322 323
323 /** stores actual size of each day in the widget so that I dont need to ask this data 324 /** stores actual size of each day in the widget so that I dont need to ask this data
324 * on every repaint. 325 * on every repaint.
325 */ 326 */
326 QRect daysize; 327 QRect daysize;
327 328
328}; 329};
329 330
330#endif 331#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 843526d..ae61db6 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,2079 +1,2082 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#endif 36#endif
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43 43
44#include <kcalendarsystem.h> 44#include <kcalendarsystem.h>
45 45
46#ifndef KORG_NOPRINTER 46#ifndef KORG_NOPRINTER
47#include "calprinter.h" 47#include "calprinter.h"
48#endif 48#endif
49#include "koprefs.h" 49#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 50#ifndef KORG_NOPLUGINS
51#include "kocore.h" 51#include "kocore.h"
52#endif 52#endif
53#include "koglobals.h" 53#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 54#include <libkcal/kincidenceformatter.h>
55 55
56#include "komonthview.h" 56#include "komonthview.h"
57 57
58#define PIXMAP_SIZE 5 58#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 59#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 60QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 61#endif
62class KNOWhatsThis :public QWhatsThis 62class KNOWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p) 69 virtual QString text( const QPoint& p)
70 { 70 {
71 return _wid->getWhatsThisText(p) ; 71 return _wid->getWhatsThisText(p) ;
72 }; 72 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mWT = new KNOWhatsThis(this); 85 mWT = new KNOWhatsThis(this);
86 resetOnFocusIn = true; 86 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff); 87 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff); 88 setHScrollBarMode(QScrollView::AlwaysOff);
89} 89}
90KNoScrollListBox::~KNoScrollListBox() 90KNoScrollListBox::~KNoScrollListBox()
91{ 91{
92 92
93} 93}
94 94
95 95
96void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 96void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
97{ 97{
98 QListBox::focusInEvent ( e ); 98 QListBox::focusInEvent ( e );
99 if ( count() ){ 99 if ( count() ){
100 int ci = currentItem(); 100 int ci = currentItem();
101 if ( ci < 0 ) ci = 0; 101 if ( ci < 0 ) ci = 0;
102 102
103 setCurrentItem( ci ); 103 setCurrentItem( ci );
104 setSelected ( ci, true ); 104 setSelected ( ci, true );
105 emit highlighted( item ( ci ) ); 105 emit highlighted( item ( ci ) );
106 106
107 resetOnFocusIn = true; 107 resetOnFocusIn = true;
108 108
109 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 109 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
110 QListBoxItem *fi = firstItem (); 110 QListBoxItem *fi = firstItem ();
111 if (fi ) { 111 if (fi ) {
112 int ihei = fi->height( this ); 112 int ihei = fi->height( this );
113 int hei = numRows () * ihei; 113 int hei = numRows () * ihei;
114 if ( hei < height() - horizontalScrollBar()->height () ) { 114 if ( hei < height() - horizontalScrollBar()->height () ) {
115 setVScrollBarMode(QScrollView::AlwaysOff); 115 setVScrollBarMode(QScrollView::AlwaysOff);
116 } 116 }
117 else 117 else
118 setVScrollBarMode(QScrollView::Auto); 118 setVScrollBarMode(QScrollView::Auto);
119 if ( ihei *3 > height() ) { 119 if ( ihei *3 > height() ) {
120 setHScrollBarMode(QScrollView::AlwaysOff); 120 setHScrollBarMode(QScrollView::AlwaysOff);
121 } 121 }
122 else { 122 else {
123 setHScrollBarMode(QScrollView::Auto); 123 setHScrollBarMode(QScrollView::Auto);
124 } 124 }
125 } else { 125 } else {
126 setVScrollBarMode(QScrollView::Auto); 126 setVScrollBarMode(QScrollView::Auto);
127 setHScrollBarMode(QScrollView::Auto); 127 setHScrollBarMode(QScrollView::Auto);
128 } 128 }
129 } 129 }
130 } 130 }
131} 131}
132void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 132void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
133{ 133{
134 int i = currentItem (); 134 int i = currentItem ();
135 if ( i >= 0 ) { 135 if ( i >= 0 ) {
136 setSelected ( i, false ); 136 setSelected ( i, false );
137 } 137 }
138 QListBox::focusOutEvent ( e ); 138 QListBox::focusOutEvent ( e );
139 setVScrollBarMode(QScrollView::AlwaysOff); 139 setVScrollBarMode(QScrollView::AlwaysOff);
140 setHScrollBarMode(QScrollView::AlwaysOff); 140 setHScrollBarMode(QScrollView::AlwaysOff);
141} 141}
142 142
143QString KNoScrollListBox::getWhatsThisText(QPoint p) 143QString KNoScrollListBox::getWhatsThisText(QPoint p)
144{ 144{
145 QListBoxItem* item = itemAt ( p ); 145 QListBoxItem* item = itemAt ( p );
146 if ( ! item ) { 146 if ( ! item ) {
147 return i18n("Click in the cell\nto add an event!"); 147 return i18n("Click in the cell\nto add an event!");
148 } 148 }
149 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 149 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
150 KOPrefs::instance()->mWTshowDetails, 150 KOPrefs::instance()->mWTshowDetails,
151 KOPrefs::instance()->mWTshowCreated, 151 KOPrefs::instance()->mWTshowCreated,
152 KOPrefs::instance()->mWTshowChanged); 152 KOPrefs::instance()->mWTshowChanged);
153} 153}
154void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 154void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
155{ 155{
156 //qDebug("KNoScrollListBox::keyPressEvent "); 156 //qDebug("KNoScrollListBox::keyPressEvent ");
157 switch(e->key()) { 157 switch(e->key()) {
158 case Key_Right: 158 case Key_Right:
159 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 159 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
160 { 160 {
161 e->ignore(); 161 e->ignore();
162 return; 162 return;
163 } 163 }
164 scrollBy(10,0); 164 scrollBy(10,0);
165 break; 165 break;
166 case Key_Left: 166 case Key_Left:
167 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 167 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
168 { 168 {
169 e->ignore(); 169 e->ignore();
170 return; 170 return;
171 } 171 }
172 scrollBy(-10,0); 172 scrollBy(-10,0);
173 break; 173 break;
174 case Key_Up: 174 case Key_Up:
175 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 175 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
176 e->ignore(); 176 e->ignore();
177 break; 177 break;
178 } 178 }
179 if ( count() ) { 179 if ( count() ) {
180 if ( currentItem() == 0 ) { 180 if ( currentItem() == 0 ) {
181 emit prevCell(); 181 emit prevCell();
182 } else { 182 } else {
183 setCurrentItem((currentItem()+count()-1)%count()); 183 setCurrentItem((currentItem()+count()-1)%count());
184 if(!itemVisible(currentItem())) { 184 if(!itemVisible(currentItem())) {
185 if((unsigned int) currentItem() == (count()-1)) { 185 if((unsigned int) currentItem() == (count()-1)) {
186 setTopItem(currentItem()-numItemsVisible()+1); 186 setTopItem(currentItem()-numItemsVisible()+1);
187 } else { 187 } else {
188 setTopItem(topItem()-1); 188 setTopItem(topItem()-1);
189 } 189 }
190 } 190 }
191 } 191 }
192 } 192 }
193 break; 193 break;
194 case Key_Down: 194 case Key_Down:
195 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 195 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
196 e->ignore(); 196 e->ignore();
197 break; 197 break;
198 } 198 }
199 if ( count () ) { 199 if ( count () ) {
200 if ( currentItem()+1 == count () ) { 200 if ( currentItem()+1 == count () ) {
201 emit nextCell(); 201 emit nextCell();
202 } else { 202 } else {
203 setCurrentItem((currentItem()+1)%count()); 203 setCurrentItem((currentItem()+1)%count());
204 if(!itemVisible(currentItem())) { 204 if(!itemVisible(currentItem())) {
205 if(currentItem() == 0) { 205 if(currentItem() == 0) {
206 setTopItem(0); 206 setTopItem(0);
207 } else { 207 } else {
208 setTopItem(topItem()+1); 208 setTopItem(topItem()+1);
209 } 209 }
210 } 210 }
211 } 211 }
212 } 212 }
213 break; 213 break;
214 case Key_I: 214 case Key_I:
215 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 215 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
216 e->ignore(); 216 e->ignore();
217 break; 217 break;
218 case Key_Return: 218 case Key_Return:
219 case Key_Enter: 219 case Key_Enter:
220 { 220 {
221 if ( currentItem() >= 0 ) { 221 if ( currentItem() >= 0 ) {
222 emit doubleClicked( item( currentItem() ) ); 222 emit doubleClicked( item( currentItem() ) );
223 e->accept(); 223 e->accept();
224 } else { 224 } else {
225 e->ignore(); 225 e->ignore();
226 } 226 }
227 } 227 }
228 break; 228 break;
229 case Key_Shift: 229 case Key_Shift:
230 emit shiftDown(); 230 emit shiftDown();
231 break; 231 break;
232 default: 232 default:
233 e->ignore(); 233 e->ignore();
234 break; 234 break;
235 } 235 }
236} 236}
237 237
238void KNoScrollListBox::oneDown() 238void KNoScrollListBox::oneDown()
239{ 239{
240 if ( count () ) { 240 if ( count () ) {
241 if ( currentItem()+1 == count () ) { 241 if ( currentItem()+1 == count () ) {
242 emit nextCell(); 242 emit nextCell();
243 } else { 243 } else {
244 resetOnFocusIn = false; 244 resetOnFocusIn = false;
245 setCurrentItem((currentItem()+1)%count()); 245 setCurrentItem((currentItem()+1)%count());
246 if(!itemVisible(currentItem())) { 246 if(!itemVisible(currentItem())) {
247 if(currentItem() == 0) { 247 if(currentItem() == 0) {
248 setTopItem(0); 248 setTopItem(0);
249 } else { 249 } else {
250 setTopItem(topItem()+1); 250 setTopItem(topItem()+1);
251 } 251 }
252 } 252 }
253 } 253 }
254 } 254 }
255} 255}
256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
257{ 257{
258 switch(e->key()) { 258 switch(e->key()) {
259 case Key_Shift: 259 case Key_Shift:
260 emit shiftUp(); 260 emit shiftUp();
261 break; 261 break;
262 default: 262 default:
263 break; 263 break;
264 } 264 }
265} 265}
266 266
267void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 267void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
268{ 268{
269 QListBox::mousePressEvent(e); 269 QListBox::mousePressEvent(e);
270 270
271 if(e->button() == RightButton) { 271 if(e->button() == RightButton) {
272 emit rightClick(); 272 emit rightClick();
273 } 273 }
274} 274}
275 275
276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
277 : QListBoxItem() 277 : QListBoxItem()
278{ 278{
279 mblockRepaint = true; 279 mblockRepaint = true;
280 setText( s ); 280 setText( s );
281 mMultiday = 0; 281 mMultiday = 0;
282 mIncidence = incidence; 282 mIncidence = incidence;
283 mDate = qd; 283 mDate = qd;
284 mRecur = false; 284 mRecur = false;
285 mAlarm = false; 285 mAlarm = false;
286 mReply = false; 286 mReply = false;
287 mInfo = false; 287 mInfo = false;
288 mdayPos = 0; 288 mdayPos = 0;
289 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 289 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
290} 290}
291void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 291void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
292{ 292{
293 setText( s ); 293 setText( s );
294 mMultiday = 0; 294 mMultiday = 0;
295 mIncidence = incidence; 295 mIncidence = incidence;
296 mDate = qd; 296 mDate = qd;
297 mRecur = false; 297 mRecur = false;
298 mAlarm = false; 298 mAlarm = false;
299 mReply = false; 299 mReply = false;
300 mInfo = false; 300 mInfo = false;
301 mdayPos = 0; 301 mdayPos = 0;
302} 302}
303 303
304void MonthViewItem::paint(QPainter *p) 304void MonthViewItem::paint(QPainter *p)
305{ 305{
306 if ( mblockRepaint ) { 306 if ( mblockRepaint ) {
307 return; 307 return;
308 } 308 }
309#if QT_VERSION >= 0x030000 309#if QT_VERSION >= 0x030000
310 bool sel = isSelected(); 310 bool sel = isSelected();
311#else 311#else
312 bool sel = selected(); 312 bool sel = selected();
313#endif 313#endif
314 314
315 315
316 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 316 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
317 { 317 {
318 p->setBackgroundColor( palette().color( QPalette::Normal, \ 318 p->setBackgroundColor( palette().color( QPalette::Normal, \
319 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 319 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
320 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 320 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
321 } 321 }
322 int x = 1; 322 int x = 1;
323 //int y = 3;//(height() - mRecurPixmap.height()) /2; 323 //int y = 3;//(height() - mRecurPixmap.height()) /2;
324 int size = PIXMAP_SIZE; 324 int size = PIXMAP_SIZE;
325 if ( QApplication::desktop()->width() < 300 ) 325 if ( QApplication::desktop()->width() < 300 )
326 size = 3; 326 size = 3;
327 int heihei = height( listBox () ); 327 int heihei = height( listBox () );
328 int y = (heihei - size -1 ) /2; 328 int y = (heihei - size -1 ) /2;
329 329
330 if ( KOPrefs::instance()->mMonthShowIcons ) { 330 if ( KOPrefs::instance()->mMonthShowIcons ) {
331 if ( mInfo ) { 331 if ( mInfo ) {
332 p->fillRect ( x, y,size,size, Qt::darkGreen ); 332 p->fillRect ( x, y,size,size, Qt::darkGreen );
333 x += size + 1; 333 x += size + 1;
334 } 334 }
335 if ( mRecur ) { 335 if ( mRecur ) {
336 p->fillRect ( x, y,size,size, Qt::blue ); 336 p->fillRect ( x, y,size,size, Qt::blue );
337 x += size + 1; 337 x += size + 1;
338 } 338 }
339 if ( mAlarm ) { 339 if ( mAlarm ) {
340 p->fillRect ( x, y,size,size, Qt::red ); 340 p->fillRect ( x, y,size,size, Qt::red );
341 x += size + 1; 341 x += size + 1;
342 } 342 }
343 if ( mReply ) { 343 if ( mReply ) {
344 p->fillRect ( x, y,size,size, Qt::yellow ); 344 p->fillRect ( x, y,size,size, Qt::yellow );
345 x += size + 1; 345 x += size + 1;
346 } 346 }
347 } 347 }
348 if ( mMultiday ) { 348 if ( mMultiday ) {
349 int yyy = y+(size/2); 349 int yyy = y+(size/2);
350 int sizeM = size+2; 350 int sizeM = size+2;
351 p->setBrush( QBrush::SolidPattern ); 351 p->setBrush( QBrush::SolidPattern );
352 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 352 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
353 if ( mMultiday == 2 || mMultiday == 3 ) { 353 if ( mMultiday == 2 || mMultiday == 3 ) {
354 QPointArray pa ( 3 ); 354 QPointArray pa ( 3 );
355 pa.setPoint (0, x, yyy ); 355 pa.setPoint (0, x, yyy );
356 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 356 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
357 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 357 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
358 p->drawPolygon( pa ); 358 p->drawPolygon( pa );
359 } 359 }
360 if ( mMultiday == 2 || mMultiday == 1 ) { 360 if ( mMultiday == 2 || mMultiday == 1 ) {
361 QPointArray pa ( 3 ); 361 QPointArray pa ( 3 );
362 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 362 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
363 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 363 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
364 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 364 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
365 p->drawPolygon( pa ); 365 p->drawPolygon( pa );
366 } 366 }
367 if ( mMultiday == 1 ) { 367 if ( mMultiday == 1 ) {
368 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 368 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
369 369
370 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 370 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
371 } 371 }
372 if ( mMultiday == 3 ) { 372 if ( mMultiday == 3 ) {
373 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 373 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
374 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 374 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
375 375
376 } 376 }
377 x += sizeM/2 + 1; 377 x += sizeM/2 + 1;
378 x += sizeM + 1; 378 x += sizeM + 1;
379 } 379 }
380 380
381 if ( mIncidence->type() == "Todo" ){ 381 if ( mIncidence->type() == "Todo" ){
382 Todo* td = ( Todo* ) mIncidence; 382 Todo* td = ( Todo* ) mIncidence;
383 if ( td->isCompleted() ) { 383 if ( td->isCompleted() ) {
384 int half = size/2; 384 int half = size/2;
385 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 385 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
386 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 386 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
387 x += half+half + 4; 387 x += half+half + 4;
388 388
389 } else { 389 } else {
390 int val = td->percentComplete()/20; 390 int val = td->percentComplete()/20;
391 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 391 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
392 p->drawRect ( x, y-2,7,size+4); 392 p->drawRect ( x, y-2,7,size+4);
393 x += size + 3; 393 x += size + 3;
394 } 394 }
395 } 395 }
396 QFontMetrics fm = p->fontMetrics(); 396 QFontMetrics fm = p->fontMetrics();
397 int yPos; 397 int yPos;
398 int pmheight = size; 398 int pmheight = size;
399 if( pmheight < fm.height() ) 399 if( pmheight < fm.height() )
400 yPos = fm.ascent() + fm.leading()/2; 400 yPos = fm.ascent() + fm.leading()/2;
401 else 401 else
402 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 402 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
403 p->setPen( palette().color( QPalette::Normal, sel ? \ 403 p->setPen( palette().color( QPalette::Normal, sel ? \
404 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 404 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
405 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { 405 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
406 p->drawText( x, yPos, text() ); 406 p->drawText( x, yPos, text() );
407 if ( mIncidence->cancelled() ) { 407 if ( mIncidence->cancelled() ) {
408 int wid = fm.width( text() ); 408 int wid = fm.width( text() );
409 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 409 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
410 } 410 }
411 } else { 411 } else {
412 QString pText = text(); 412 QString pText = text();
413 if( pText.mid(2,1) == ":" ) 413 if( pText.mid(2,1) == ":" )
414 pText = pText.mid( 6 ); 414 pText = pText.mid( 6 );
415 p->drawText( x, yPos, pText ); 415 p->drawText( x, yPos, pText );
416 if ( mIncidence->cancelled() ) { 416 if ( mIncidence->cancelled() ) {
417 int wid = fm.width( pText ); 417 int wid = fm.width( pText );
418 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 418 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
419 } 419 }
420 } 420 }
421} 421}
422 422
423int MonthViewItem::height(const QListBox *lb) const 423int MonthViewItem::height(const QListBox *lb) const
424{ 424{
425 int ret = 10; 425 int ret = 10;
426 if ( lb ) 426 if ( lb )
427 ret = lb->fontMetrics().lineSpacing()+1; 427 ret = lb->fontMetrics().lineSpacing()+1;
428 return ret; 428 return ret;
429} 429}
430 430
431int MonthViewItem::width(const QListBox *lb) const 431int MonthViewItem::width(const QListBox *lb) const
432{ 432{
433 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 433 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
434 int size = PIXMAP_SIZE; 434 int size = PIXMAP_SIZE;
435 if ( QApplication::desktop()->width() < 300 ) 435 if ( QApplication::desktop()->width() < 300 )
436 size = 3; 436 size = 3;
437 int x = 1; 437 int x = 1;
438 if ( KOPrefs::instance()->mMonthShowIcons ) { 438 if ( KOPrefs::instance()->mMonthShowIcons ) {
439 if ( mInfo ) { 439 if ( mInfo ) {
440 x += size + 1; 440 x += size + 1;
441 } 441 }
442 if( mRecur ) { 442 if( mRecur ) {
443 x += size+1; 443 x += size+1;
444 } 444 }
445 if( mAlarm ) { 445 if( mAlarm ) {
446 x += size+1; 446 x += size+1;
447 } 447 }
448 if( mReply ) { 448 if( mReply ) {
449 x += size+1; 449 x += size+1;
450 } 450 }
451 } 451 }
452 if( mMultiday ) { 452 if( mMultiday ) {
453 x += size+1+2+size/2; 453 x += size+1+2+size/2;
454 } 454 }
455 return( x + lb->fontMetrics().width( text() ) + 1 ); 455 return( x + lb->fontMetrics().width( text() ) + 1 );
456 } 456 }
457 if ( ! lb ) 457 if ( ! lb )
458 return 10; 458 return 10;
459 return lb->width(); 459 return lb->width();
460} 460}
461 461
462 462
463MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 463MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
464 : KNoScrollListBox( par ), 464 : KNoScrollListBox( par ),
465 mMonthView( parent ) 465 mMonthView( parent )
466{ 466{
467 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 467 //QVBoxLayout *topLayout = new QVBoxLayout( this );
468 currentPalette = 0; 468 currentPalette = 0;
469 // mLabel = new QLabel( this );QPushButton 469 // mLabel = new QLabel( this );QPushButton
470 mLabel = new QPushButton( this ); 470 mLabel = new QPushButton( this );
471 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 471 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
472 //mLabel->setLineWidth( 1 ); 472 //mLabel->setLineWidth( 1 );
473 //mLabel->setAlignment( AlignCenter ); 473 //mLabel->setAlignment( AlignCenter );
474 mLabel->setFlat( true ); 474 mLabel->setFlat( true );
475 mLabel->setFocusPolicy(NoFocus); 475 mLabel->setFocusPolicy(NoFocus);
476 //mItemList = new KNoScrollListBox( this ); 476 //mItemList = new KNoScrollListBox( this );
477 setMinimumSize( 10, 10 ); 477 setMinimumSize( 10, 10 );
478 setFrameStyle( QFrame::Panel | QFrame::Plain ); 478 setFrameStyle( QFrame::Panel | QFrame::Plain );
479 setLineWidth( 1 ); 479 setLineWidth( 1 );
480 //topLayout->addWidget( mItemList ); 480 //topLayout->addWidget( mItemList );
481 mLabel->raise(); 481 mLabel->raise();
482 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 482 // QColor( 0,0,255 ) QColor( 160,1600,255 )
483 mStandardPalette = palette(); 483 mStandardPalette = palette();
484 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 484 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
485 485
486 enableScrollBars( false ); 486 enableScrollBars( false );
487 updateConfig(); 487 updateConfig();
488 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 488 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
489 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 489 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
490 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 490 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
491 SLOT( defaultAction( QListBoxItem * ) ) ); 491 SLOT( defaultAction( QListBoxItem * ) ) );
492 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 492 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
493 const QPoint &) ), 493 const QPoint &) ),
494 SLOT( contextMenu( QListBoxItem * ) ) ); 494 SLOT( contextMenu( QListBoxItem * ) ) );
495 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 495 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
496 SLOT( selection( QListBoxItem * ) ) ); 496 SLOT( selection( QListBoxItem * ) ) );
497 497
498 /* 498 /*
499 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 499 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
500 SLOT( selection( QListBoxItem * ) ) ); 500 SLOT( selection( QListBoxItem * ) ) );
501 */ 501 */
502} 502}
503#ifdef DESKTOP_VERSION 503#ifdef DESKTOP_VERSION
504QToolTipGroup *MonthViewCell::toolTipGroup() 504QToolTipGroup *MonthViewCell::toolTipGroup()
505{ 505{
506 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 506 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
507 return mToolTipGroup; 507 return mToolTipGroup;
508} 508}
509#endif 509#endif
510 510
511void MonthViewCell::setDate( const QDate &date ) 511void MonthViewCell::setDate( const QDate &date )
512{ 512{
513 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 513 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
514 mDate = date; 514 mDate = date;
515 515
516 516
517 517
518 //resizeEvent( 0 ); 518 //resizeEvent( 0 );
519} 519}
520 520
521QDate MonthViewCell::date() const 521QDate MonthViewCell::date() const
522{ 522{
523 return mDate; 523 return mDate;
524} 524}
525 525
526void MonthViewCell::setPrimary( bool primary ) 526void MonthViewCell::setPrimary( bool primary )
527{ 527{
528 mPrimary = primary; 528 mPrimary = primary;
529 //setMyPalette(); 529 //setMyPalette();
530} 530}
531void MonthViewCell::setMyPalette() 531void MonthViewCell::setMyPalette()
532{ 532{
533 533
534 if ( mHoliday) { 534 if ( mHoliday) {
535 if ( currentPalette == 1 ) return; 535 if ( currentPalette == 1 ) return;
536 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); 536 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
537 setPalette( mHolidayPalette ); 537 setPalette( mHolidayPalette );
538 //mLabel->setPalette( mHolidayPalette ); 538 //mLabel->setPalette( mHolidayPalette );
539 currentPalette = 1; 539 currentPalette = 1;
540 540
541 } else { 541 } else {
542 if ( mPrimary ) { 542 if ( mPrimary ) {
543 if ( currentPalette == 2 ) return; 543 if ( currentPalette == 2 ) return;
544 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 544 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
545 //mLabel->setPalette( mPrimaryPalette ); 545 //mLabel->setPalette( mPrimaryPalette );
546 setPalette( mPrimaryPalette ); 546 setPalette( mPrimaryPalette );
547 currentPalette = 2; 547 currentPalette = 2;
548 548
549 } else { 549 } else {
550 if ( currentPalette == 3 ) return; 550 if ( currentPalette == 3 ) return;
551 setPalette( mNonPrimaryPalette ); 551 setPalette( mNonPrimaryPalette );
552 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 552 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
553 //mLabel->setPalette( mNonPrimaryPalette );; 553 //mLabel->setPalette( mNonPrimaryPalette );;
554 currentPalette = 3; 554 currentPalette = 3;
555 } 555 }
556 } 556 }
557 //QPalette pal = palette(); 557 //QPalette pal = palette();
558 558
559 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 559 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
560} 560}
561QPalette MonthViewCell::getPalette () 561QPalette MonthViewCell::getPalette ()
562{ 562{
563 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 563 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
564 return mStandardPalette; 564 return mStandardPalette;
565 if ( mHoliday) { 565 if ( mHoliday) {
566 return mHolidayPalette ; 566 return mHolidayPalette ;
567 } else { 567 } else {
568 if ( mPrimary ) { 568 if ( mPrimary ) {
569 return mPrimaryPalette ; 569 return mPrimaryPalette ;
570 } 570 }
571 } 571 }
572 return mNonPrimaryPalette; 572 return mNonPrimaryPalette;
573} 573}
574bool MonthViewCell::isPrimary() const 574bool MonthViewCell::isPrimary() const
575{ 575{
576 return mPrimary; 576 return mPrimary;
577} 577}
578 578
579void MonthViewCell::setHoliday( bool holiday ) 579void MonthViewCell::setHoliday( bool holiday )
580{ 580{
581 mHoliday = holiday; 581 mHoliday = holiday;
582 //setMyPalette(); 582 //setMyPalette();
583} 583}
584 584
585void MonthViewCell::setHoliday( const QString &holiday ) 585void MonthViewCell::setHoliday( const QString &holiday )
586{ 586{
587 mHolidayString = holiday; 587 mHolidayString = holiday;
588 588
589 if ( !holiday.isEmpty() ) { 589 if ( !holiday.isEmpty() ) {
590 setHoliday( true ); 590 setHoliday( true );
591 } 591 }
592} 592}
593 593
594void MonthViewCell::startUpdateCell() 594void MonthViewCell::startUpdateCell()
595{ 595{
596 mdayCount = 0; 596 mdayCount = 0;
597 setFocusPolicy(NoFocus); 597 setFocusPolicy(NoFocus);
598 if ( !mMonthView->isUpdatePossible() ) 598 if ( !mMonthView->isUpdatePossible() )
599 return; 599 return;
600 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 600 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
601 while ( mitem ) { 601 while ( mitem ) {
602 mitem->setBlockRepaint( true ); 602 mitem->setBlockRepaint( true );
603 mitem = (MonthViewItem *)mitem->next(); 603 mitem = (MonthViewItem *)mitem->next();
604 } 604 }
605 if ( mAvailItemList.count() > 20 ) { 605 if ( mAvailItemList.count() > 20 ) {
606 mAvailItemList.setAutoDelete( true ); 606 mAvailItemList.setAutoDelete( true );
607 mAvailItemList.clear(); 607 mAvailItemList.clear();
608 mAvailItemList.setAutoDelete( false ); 608 mAvailItemList.setAutoDelete( false );
609 } 609 }
610 610
611 setPrimary( mDate.month()%2 ); 611 setPrimary( mDate.month()%2 );
612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
613 if ( mDate == QDate::currentDate() ) { 613 if ( mDate == QDate::currentDate() ) {
614 setLineWidth( 3 ); 614 setLineWidth( 3 );
615 } else { 615 } else {
616 setLineWidth( 1 ); 616 setLineWidth( 1 );
617 } 617 }
618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
619 //clear(); 619 //clear();
620 while ( CurrentAvailItem ) { 620 while ( CurrentAvailItem ) {
621 MonthViewItem *item = CurrentAvailItem; 621 MonthViewItem *item = CurrentAvailItem;
622 CurrentAvailItem = (MonthViewItem *)item->next(); 622 CurrentAvailItem = (MonthViewItem *)item->next();
623 mAvailItemList.append( item ); 623 mAvailItemList.append( item );
624 takeItem ( item ); 624 takeItem ( item );
625 } 625 }
626 626
627#ifdef DESKTOP_VERSION 627#ifdef DESKTOP_VERSION
628 QToolTip::remove(this); 628 QToolTip::remove(this);
629#endif 629#endif
630 mToolTip.clear(); 630 mToolTip.clear();
631 //qApp->processEvents(); 631 //qApp->processEvents();
632#if 0 632#if 0
633 if ( !mHolidayString.isEmpty() ) { 633 if ( !mHolidayString.isEmpty() ) {
634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
635 item->setPalette( mHolidayPalette ); 635 item->setPalette( mHolidayPalette );
636 insertItem( item ); 636 insertItem( item );
637 mToolTip.append ( mHolidayString ); 637 mToolTip.append ( mHolidayString );
638 } 638 }
639#endif 639#endif
640} 640}
641 641
642int MonthViewCell::insertEvent(Event *event) 642int MonthViewCell::insertEvent(Event *event)
643{ 643{
644 bool useToolTips = true; 644 bool useToolTips = true;
645#ifndef DESKTOP_VERSION 645#ifndef DESKTOP_VERSION
646 useToolTips = false; 646 useToolTips = false;
647#endif 647#endif
648 QString mToolTipText; 648 QString mToolTipText;
649 setFocusPolicy(WheelFocus); 649 setFocusPolicy(WheelFocus);
650 if ( !(event->doesRecur() == Recurrence::rNone) ) { 650 if ( !(event->doesRecur() == Recurrence::rNone) ) {
651 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 651 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
652 return mdayCount; 652 return mdayCount;
653 else 653 else
654 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 654 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
655 return mdayCount; 655 return mdayCount;
656 } 656 }
657 657
658 if ( event->isHoliday()) { 658 if ( event->isHoliday()) {
659 setHoliday( true ); 659 setHoliday( true );
660 if ( mDate.dayOfWeek() == 7 ) 660 if ( mDate.dayOfWeek() == 7 )
661 setLineWidth( 3 ); 661 setLineWidth( 3 );
662 } 662 }
663 QString text; 663 QString text;
664 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 664 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
665 if (event->isMultiDay()) { 665 if (event->isMultiDay()) {
666 QString prefix = "<->";multiday = 2; 666 QString prefix = "<->";multiday = 2;
667 QString time; 667 QString time;
668 if ( event->doesRecur() ) { 668 if ( event->doesRecur() ) {
669 if ( event->recursOn( mDate) ) { 669 if ( event->recursOn( mDate) ) {
670 prefix ="->" ;multiday = 1; 670 prefix ="->" ;multiday = 1;
671 } 671 }
672 else { 672 else {
673 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 673 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
674 if ( event->recursOn( mDate.addDays( -days)) ) { 674 if ( event->recursOn( mDate.addDays( -days)) ) {
675 prefix ="<-" ;multiday = 3; 675 prefix ="<-" ;multiday = 3;
676 } 676 }
677 } 677 }
678 678
679 } else { 679 } else {
680 if (mDate == event->dtStart().date()) { 680 if (mDate == event->dtStart().date()) {
681 prefix ="->" ;multiday = 1; 681 prefix ="->" ;multiday = 1;
682 } else if (mDate == event->dtEnd().date()) { 682 } else if (mDate == event->dtEnd().date()) {
683 prefix ="<-" ;multiday = 3; 683 prefix ="<-" ;multiday = 3;
684 } 684 }
685 } 685 }
686 if ( !event->doesFloat() ) { 686 if ( !event->doesFloat() ) {
687 if ( mDate == event->dtStart().date () ) 687 if ( mDate == event->dtStart().date () )
688 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 688 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
689 else if ( mDate == event->dtEnd().date () ) 689 else if ( mDate == event->dtEnd().date () )
690 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 690 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
691 691
692 } 692 }
693 text = time + event->summary(); 693 text = time + event->summary();
694 if ( useToolTips ) 694 if ( useToolTips )
695 mToolTipText += prefix + text; 695 mToolTipText += prefix + text;
696 } else { 696 } else {
697 if (event->doesFloat()) { 697 if (event->doesFloat()) {
698 text = event->summary(); 698 text = event->summary();
699 if ( useToolTips ) 699 if ( useToolTips )
700 mToolTipText += text; 700 mToolTipText += text;
701 } 701 }
702 else { 702 else {
703 text = KGlobal::locale()->formatTime(event->dtStart().time()); 703 text = KGlobal::locale()->formatTime(event->dtStart().time());
704 text += " " + event->summary(); 704 text += " " + event->summary();
705 if ( useToolTips ) 705 if ( useToolTips )
706 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 706 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
707 } 707 }
708 } 708 }
709 if ( useToolTips && ! event->location().isEmpty() ) { 709 if ( useToolTips && ! event->location().isEmpty() ) {
710 mToolTipText += " (" + event->location() +")"; 710 mToolTipText += " (" + event->location() +")";
711 } 711 }
712 MonthViewItem *item ; 712 MonthViewItem *item ;
713 713
714 if ( mAvailItemList.count() ) { 714 if ( mAvailItemList.count() ) {
715 item = mAvailItemList.first(); 715 item = mAvailItemList.first();
716 mAvailItemList.remove( item ); 716 mAvailItemList.remove( item );
717 item->recycle( event, mDate, text ); 717 item->recycle( event, mDate, text );
718 } else { 718 } else {
719 item = new MonthViewItem( event, mDate, text ); 719 item = new MonthViewItem( event, mDate, text );
720 } 720 }
721 721
722 QPalette pal; 722 QPalette pal;
723 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 723 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
724 QStringList categories = event->categories(); 724 QStringList categories = event->categories();
725 QString cat = categories.first(); 725 QString cat = categories.first();
726 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 726 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
727 pal = getPalette(); 727 pal = getPalette();
728 if (cat.isEmpty()) { 728 if (cat.isEmpty()) {
729 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 729 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
730 } else { 730 } else {
731 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 731 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
732 } 732 }
733 733
734 } else { 734 } else {
735 if (cat.isEmpty()) { 735 if (cat.isEmpty()) {
736 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 736 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
737 } else { 737 } else {
738 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 738 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
739 } 739 }
740 } 740 }
741 741
742 } else { 742 } else {
743 pal = mStandardPalette ; 743 pal = mStandardPalette ;
744 } 744 }
745 item->setPalette( pal ); 745 item->setPalette( pal );
746 item->setRecur( event->recurrence()->doesRecur() ); 746 item->setRecur( event->recurrence()->doesRecur() );
747 item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); 747 item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
748 item->setMoreInfo( event->description().length() > 0 ); 748 item->setMoreInfo( event->description().length() > 0 );
749#ifdef DESKTOP_VERSION 749#ifdef DESKTOP_VERSION
750 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 750 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
751 KOPrefs::instance()->email()); 751 KOPrefs::instance()->email());
752 if ( me != 0 ) { 752 if ( me != 0 ) {
753 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 753 if ( me->status() == Attendee::NeedsAction && me->RSVP())
754 item->setReply(true && multiday < 2); 754 item->setReply(true && multiday < 2);
755 else 755 else
756 item->setReply(false); 756 item->setReply(false);
757 } else 757 } else
758 item->setReply(false); 758 item->setReply(false);
759#endif 759#endif
760 item->setMultiDay( multiday ); 760 item->setMultiDay( multiday );
761 if ( multiday ) { 761 if ( multiday ) {
762 insertItem( item ,mdayCount); 762 insertItem( item ,mdayCount);
763 ++mdayCount; 763 ++mdayCount;
764 } else { 764 } else {
765 uint i; 765 uint i;
766 int pos = mdayCount; 766 int pos = mdayCount;
767 for ( i = mdayCount; i < count();++i ) { 767 for ( i = mdayCount; i < count();++i ) {
768 QListBoxItem* it = this->item ( i ); 768 QListBoxItem* it = this->item ( i );
769 if ( text < it->text() ) { 769 if ( text < it->text() ) {
770 pos = i; 770 pos = i;
771 break; 771 break;
772 } 772 }
773 ++pos; 773 ++pos;
774 } 774 }
775 insertItem( item ,pos); 775 insertItem( item ,pos);
776 } 776 }
777 if ( useToolTips ) { 777 if ( useToolTips ) {
778 mToolTip.append( mToolTipText ); 778 mToolTip.append( mToolTipText );
779 } 779 }
780 return mdayCount; 780 return mdayCount;
781} 781}
782void MonthViewCell::insertTodo(Todo *todo) 782void MonthViewCell::insertTodo(Todo *todo)
783{ 783{
784 setFocusPolicy(WheelFocus); 784 setFocusPolicy(WheelFocus);
785 QString text; 785 QString text;
786 if (todo->hasDueDate()) { 786 if (todo->hasDueDate()) {
787 if (!todo->doesFloat()) { 787 if (!todo->doesFloat()) {
788 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 788 text += KGlobal::locale()->formatTime(todo->dtDue().time());
789 text += " "; 789 text += " ";
790 } 790 }
791 } 791 }
792 text += todo->summary(); 792 text += todo->summary();
793 MonthViewItem *item ; 793 MonthViewItem *item ;
794 if ( mAvailItemList.count() ) { 794 if ( mAvailItemList.count() ) {
795 item = mAvailItemList.first(); 795 item = mAvailItemList.first();
796 mAvailItemList.remove( item ); 796 mAvailItemList.remove( item );
797 item->recycle( todo, mDate, text ); 797 item->recycle( todo, mDate, text );
798 } else { 798 } else {
799 item = new MonthViewItem( todo, mDate, text ); 799 item = new MonthViewItem( todo, mDate, text );
800 } 800 }
801 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 801 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
802 //item->setPalette( mStandardPalette ); 802 //item->setPalette( mStandardPalette );
803 QPalette pal; 803 QPalette pal;
804 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 804 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
805 QStringList categories = todo->categories(); 805 QStringList categories = todo->categories();
806 QString cat = categories.first(); 806 QString cat = categories.first();
807 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 807 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
808 pal = getPalette(); 808 pal = getPalette();
809 if (cat.isEmpty()) { 809 if (cat.isEmpty()) {
810 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 810 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
811 } else { 811 } else {
812 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 812 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
813 } 813 }
814 814
815 } else { 815 } else {
816 if (cat.isEmpty()) { 816 if (cat.isEmpty()) {
817 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 817 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
818 } else { 818 } else {
819 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 819 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
820 } 820 }
821 } 821 }
822 822
823 } else { 823 } else {
824 pal = mStandardPalette ; 824 pal = mStandardPalette ;
825 } 825 }
826 item->setPalette( pal ); 826 item->setPalette( pal );
827 item->setRecur( todo->recurrence()->doesRecur() ); 827 item->setRecur( todo->recurrence()->doesRecur() );
828 item->setAlarm( todo->isAlarmEnabled() ); 828 item->setAlarm( todo->isAlarmEnabled() );
829 item->setMoreInfo( todo->description().length() > 0 ); 829 item->setMoreInfo( todo->description().length() > 0 );
830 insertItem( item , count()); 830 insertItem( item , count());
831#ifdef DESKTOP_VERSION 831#ifdef DESKTOP_VERSION
832 mToolTip.append( text ); 832 mToolTip.append( text );
833#endif 833#endif
834} 834}
835void MonthViewCell::repaintfinishUpdateCell() 835void MonthViewCell::repaintfinishUpdateCell()
836{ 836{
837 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 837 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
838 while ( mitem ) { 838 while ( mitem ) {
839 mitem->setBlockRepaint( false ); 839 mitem->setBlockRepaint( false );
840 updateItem ( mitem ); 840 updateItem ( mitem );
841 mitem = (MonthViewItem *)mitem->next(); 841 mitem = (MonthViewItem *)mitem->next();
842 } 842 }
843} 843}
844void MonthViewCell::finishUpdateCell() 844void MonthViewCell::finishUpdateCell()
845{ 845{
846 846
847 847
848 848
849#ifdef DESKTOP_VERSION 849#ifdef DESKTOP_VERSION
850 if (mToolTip.count() > 0 ) { 850 if (mToolTip.count() > 0 ) {
851 mToolTip.sort(); 851 mToolTip.sort();
852 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 852 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
853 } 853 }
854#endif 854#endif
855 //sort(); 855 //sort();
856 //setMyPalette(); 856 //setMyPalette();
857 setMyPalette(); 857 setMyPalette();
858 858
859 resizeEvent( 0 ); 859 resizeEvent( 0 );
860 860
861} 861}
862void MonthViewCell::updateCell() 862void MonthViewCell::updateCell()
863{ 863{
864 if ( !mMonthView->isUpdatePossible() ) 864 if ( !mMonthView->isUpdatePossible() )
865 return; 865 return;
866 startUpdateCell(); 866 startUpdateCell();
867 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 867 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
868 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 868 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
869 Event *event; 869 Event *event;
870 for( event = events.first(); event; event = events.next() ) { // for event 870 for( event = events.first(); event; event = events.next() ) { // for event
871 insertEvent(event); 871 insertEvent(event);
872 } 872 }
873 // insert due todos 873 // insert due todos
874 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 874 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
875 Todo *todo; 875 Todo *todo;
876 for(todo = todos.first(); todo; todo = todos.next()) { 876 for(todo = todos.first(); todo; todo = todos.next()) {
877 insertTodo( todo ); 877 insertTodo( todo );
878 } 878 }
879 finishUpdateCell(); 879 finishUpdateCell();
880 // if ( isVisible()) 880 // if ( isVisible())
881 //qApp->processEvents(); 881 //qApp->processEvents();
882} 882}
883 883
884void MonthViewCell::updateConfig( bool bigFont ) // = false 884void MonthViewCell::updateConfig( bool bigFont ) // = false
885{ 885{
886 886
887 if ( bigFont ) { 887 if ( bigFont ) {
888 QFont fo = KOPrefs::instance()->mMonthViewFont; 888 QFont fo = KOPrefs::instance()->mMonthViewFont;
889 int ps = fo.pointSize() + 2; 889 int ps = fo.pointSize() + 2;
890 if ( ps < 18 ) 890 if ( ps < 18 )
891 ps += 2; 891 ps += 2;
892 fo.setPointSize( ps ); 892 fo.setPointSize( ps );
893 setFont( fo ); 893 setFont( fo );
894 } else 894 } else
895 setFont( KOPrefs::instance()->mMonthViewFont ); 895 setFont( KOPrefs::instance()->mMonthViewFont );
896 896
897 QFontMetrics fm( font() ); 897 QFontMetrics fm( font() );
898 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 898 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
899 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 899 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
900 mHolidayPalette = mStandardPalette; 900 mHolidayPalette = mStandardPalette;
901 mPrimaryPalette = mStandardPalette; 901 mPrimaryPalette = mStandardPalette;
902 mNonPrimaryPalette = mStandardPalette; 902 mNonPrimaryPalette = mStandardPalette;
903 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 903 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
904 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 904 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
905 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 905 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
906 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 906 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
907 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 907 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
908 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 908 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
909 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 909 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
910 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 910 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
911 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 911 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
912 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 912 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
913 } 913 }
914 //updateCell(); 914 //updateCell();
915} 915}
916 916
917void MonthViewCell::enableScrollBars( bool enabled ) 917void MonthViewCell::enableScrollBars( bool enabled )
918{ 918{
919 919
920 return; 920 return;
921 if ( enabled ) { 921 if ( enabled ) {
922 QListBoxItem *fi = firstItem (); 922 QListBoxItem *fi = firstItem ();
923 if (fi ) { 923 if (fi ) {
924 int ihei = fi->height( this ); 924 int ihei = fi->height( this );
925 int hei = numRows () * ihei; 925 int hei = numRows () * ihei;
926 if ( hei < height() - horizontalScrollBar()->height () ) { 926 if ( hei < height() - horizontalScrollBar()->height () ) {
927 setVScrollBarMode(QScrollView::AlwaysOff); 927 setVScrollBarMode(QScrollView::AlwaysOff);
928 } 928 }
929 else 929 else
930 setVScrollBarMode(QScrollView::Auto); 930 setVScrollBarMode(QScrollView::Auto);
931 if ( ihei *3 > height() ) { 931 if ( ihei *3 > height() ) {
932 setHScrollBarMode(QScrollView::AlwaysOff); 932 setHScrollBarMode(QScrollView::AlwaysOff);
933 } 933 }
934 else { 934 else {
935 setHScrollBarMode(QScrollView::Auto); 935 setHScrollBarMode(QScrollView::Auto);
936 } 936 }
937 } else { 937 } else {
938 setVScrollBarMode(QScrollView::Auto); 938 setVScrollBarMode(QScrollView::Auto);
939 setHScrollBarMode(QScrollView::Auto); 939 setHScrollBarMode(QScrollView::Auto);
940 } 940 }
941 } else { 941 } else {
942 setVScrollBarMode(QScrollView::AlwaysOff); 942 setVScrollBarMode(QScrollView::AlwaysOff);
943 setHScrollBarMode(QScrollView::AlwaysOff); 943 setHScrollBarMode(QScrollView::AlwaysOff);
944 } 944 }
945} 945}
946 946
947Incidence *MonthViewCell::selectedIncidence() 947Incidence *MonthViewCell::selectedIncidence()
948{ 948{
949 int index = currentItem(); 949 int index = currentItem();
950 if ( index < 0 ) return 0; 950 if ( index < 0 ) return 0;
951 951
952 MonthViewItem *mitem = 952 MonthViewItem *mitem =
953 static_cast<MonthViewItem *>( item( index ) ); 953 static_cast<MonthViewItem *>( item( index ) );
954 954
955 if ( !mitem ) return 0; 955 if ( !mitem ) return 0;
956 956
957 return mitem->incidence(); 957 return mitem->incidence();
958} 958}
959 959
960QDate MonthViewCell::selectedIncidenceDate() 960QDate MonthViewCell::selectedIncidenceDate()
961{ 961{
962 QDate qd; 962 QDate qd;
963 int index = currentItem(); 963 int index = currentItem();
964 if ( index < 0 ) return qd; 964 if ( index < 0 ) return qd;
965 965
966 MonthViewItem *mitem = 966 MonthViewItem *mitem =
967 static_cast<MonthViewItem *>( item( index ) ); 967 static_cast<MonthViewItem *>( item( index ) );
968 968
969 if ( !mitem ) return qd; 969 if ( !mitem ) return qd;
970 970
971 return mitem->incidenceDate(); 971 return mitem->incidenceDate();
972} 972}
973 973
974void MonthViewCell::deselect() 974void MonthViewCell::deselect()
975{ 975{
976 clearSelection(); 976 clearSelection();
977 enableScrollBars( false ); 977 enableScrollBars( false );
978 // updateCell(); 978 // updateCell();
979} 979}
980void MonthViewCell::select() 980void MonthViewCell::select()
981{ 981{
982 ;// updateCell(); 982 ;// updateCell();
983} 983}
984 984
985void MonthViewCell::resizeEvent ( QResizeEvent * e ) 985void MonthViewCell::resizeEvent ( QResizeEvent * e )
986{ 986{
987 if ( !mMonthView->isUpdatePossible() ) 987 if ( !mMonthView->isUpdatePossible() )
988 return; 988 return;
989 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 989 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
990 deselect(); 990 deselect();
991 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 991 mLabel->setMaximumHeight( height() - lineWidth()*2 );
992 992
993 QString text; 993 QString text;
994 mLabel->setText( text ); 994 mLabel->setText( text );
995 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 995 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
996 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 996 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
997 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 997 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
998 mLabel->resize( mLabelBigSize ); 998 mLabel->resize( mLabelBigSize );
999 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 999 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1000 } else { 1000 } else {
1001 mLabel->resize( mLabelSize ); 1001 mLabel->resize( mLabelSize );
1002 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1002 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1003 } 1003 }
1004 mLabel->setText( text ); 1004 mLabel->setText( text );
1005 1005
1006 int size = height() - mLabel->height() - lineWidth()-1; 1006 int size = height() - mLabel->height() - lineWidth()-1;
1007 //qDebug("LW %d ", lineWidth()); 1007 //qDebug("LW %d ", lineWidth());
1008 if ( size > 0 ) 1008 if ( size > 0 )
1009 verticalScrollBar()->setMaximumHeight( size ); 1009 verticalScrollBar()->setMaximumHeight( size );
1010 size = width() - mLabel->width() -lineWidth()-1; 1010 size = width() - mLabel->width() -lineWidth()-1;
1011 if ( size > 0 ) 1011 if ( size > 0 )
1012 horizontalScrollBar()->setMaximumWidth( size ); 1012 horizontalScrollBar()->setMaximumWidth( size );
1013 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1013 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1014 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1014 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1015 // mItemList->resize ( width(), height () ); 1015 // mItemList->resize ( width(), height () );
1016 if ( e ) 1016 if ( e )
1017 KNoScrollListBox::resizeEvent ( e ); 1017 KNoScrollListBox::resizeEvent ( e );
1018} 1018}
1019 1019
1020void MonthViewCell::defaultAction( QListBoxItem *item ) 1020void MonthViewCell::defaultAction( QListBoxItem *item )
1021{ 1021{
1022 1022
1023 if ( !item ) { 1023 if ( !item ) {
1024 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1024 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1025 emit newEventSignal( dt ); 1025 emit newEventSignal( dt );
1026 return; 1026 return;
1027 } 1027 }
1028 1028
1029 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1029 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1030 Incidence *incidence = eventItem->incidence(); 1030 Incidence *incidence = eventItem->incidence();
1031 if ( incidence ) mMonthView->defaultAction( incidence ); 1031 if ( incidence ) mMonthView->defaultAction( incidence );
1032} 1032}
1033void MonthViewCell::showDay() 1033void MonthViewCell::showDay()
1034{ 1034{
1035 emit showDaySignal( date() ); 1035 emit showDaySignal( date() );
1036} 1036}
1037void MonthViewCell::newEvent() 1037void MonthViewCell::newEvent()
1038{ 1038{
1039 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1039 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1040 emit newEventSignal( dt ); 1040 emit newEventSignal( dt );
1041} 1041}
1042void MonthViewCell::cellClicked( QListBoxItem *item ) 1042void MonthViewCell::cellClicked( QListBoxItem *item )
1043{ 1043{
1044 mMonthView->setSelectedCell( this ); 1044 mMonthView->setSelectedCell( this );
1045 if ( item == 0 ) { 1045 if ( item == 0 ) {
1046 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1046 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1047 emit newEventSignal( dt ); 1047 emit newEventSignal( dt );
1048 return; 1048 return;
1049 } 1049 }
1050 1050
1051} 1051}
1052 1052
1053void MonthViewCell::contextMenu( QListBoxItem *item ) 1053void MonthViewCell::contextMenu( QListBoxItem *item )
1054{ 1054{
1055 mMonthView->setPopupCell( this ); 1055 mMonthView->setPopupCell( this );
1056 if ( !item ) { 1056 if ( !item ) {
1057 mMonthView->showContextMenu( 0 ); 1057 mMonthView->showContextMenu( 0 );
1058 return; 1058 return;
1059 } 1059 }
1060 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1060 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1061 Incidence *incidence = eventItem->incidence(); 1061 Incidence *incidence = eventItem->incidence();
1062 if ( incidence ) mMonthView->showContextMenu( incidence ); 1062 if ( incidence ) mMonthView->showContextMenu( incidence );
1063} 1063}
1064 1064
1065void MonthViewCell::selection( QListBoxItem *item ) 1065void MonthViewCell::selection( QListBoxItem *item )
1066{ 1066{
1067 if ( !item ) return; 1067 if ( !item ) return;
1068 1068
1069 mMonthView->setSelectedCell( this ); 1069 mMonthView->setSelectedCell( this );
1070} 1070}
1071 1071
1072 1072
1073// ******************************************************************************* 1073// *******************************************************************************
1074// ******************************************************************************* 1074// *******************************************************************************
1075// ******************************************************************************* 1075// *******************************************************************************
1076 1076
1077 1077
1078KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1078KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1079 : KOEventView( calendar, parent, name ), 1079 : KOEventView( calendar, parent, name ),
1080 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1080 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1081 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1081 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1082{ 1082{
1083 mFlagKeyPressed = false; 1083 mFlagKeyPressed = false;
1084 mShortDayLabelsM = false; 1084 mShortDayLabelsM = false;
1085 mShortDayLabelsW = false; 1085 mShortDayLabelsW = false;
1086 skipResize = false; 1086 skipResize = false;
1087 clPending = true; 1087 clPending = true;
1088 mPopupCell = 0; 1088 mPopupCell = 0;
1089 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1089 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1090 mWidStack = new QWidgetStack( this ); 1090 mWidStack = new QWidgetStack( this );
1091 QVBoxLayout* hb = new QVBoxLayout( this ); 1091 QVBoxLayout* hb = new QVBoxLayout( this );
1092 mMonthView = new QWidget( mWidStack ); 1092 mMonthView = new QWidget( mWidStack );
1093 mWeekView = new QWidget( mWidStack ); 1093 mWeekView = new QWidget( mWidStack );
1094#if QT_VERSION >= 0x030000 1094#if QT_VERSION >= 0x030000
1095 mWidStack->addWidget(mMonthView ); 1095 mWidStack->addWidget(mMonthView );
1096 mWidStack->addWidget(mWeekView ); 1096 mWidStack->addWidget(mWeekView );
1097#else 1097#else
1098 mWidStack->addWidget( mMonthView, 1 ); 1098 mWidStack->addWidget( mMonthView, 1 );
1099 mWidStack->addWidget( mWeekView , 1 ); 1099 mWidStack->addWidget( mWeekView , 1 );
1100#endif 1100#endif
1101 hb->addWidget( mNavigatorBar ); 1101 hb->addWidget( mNavigatorBar );
1102 hb->addWidget( mWidStack ); 1102 hb->addWidget( mWidStack );
1103 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1103 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1104 updatePossible = false; 1104 updatePossible = false;
1105 //updatePossible = true; 1105 //updatePossible = true;
1106 mCells.setAutoDelete( true ); 1106 mCells.setAutoDelete( true );
1107 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1107 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1108 mDayLabels.resize( mDaysPerWeek ); 1108 mDayLabels.resize( mDaysPerWeek );
1109 mDayLabelsW.resize( mDaysPerWeek ); 1109 mDayLabelsW.resize( mDaysPerWeek );
1110 QFont bfont = font(); 1110 QFont bfont = font();
1111 if ( QApplication::desktop()->width() < 650 ) { 1111 if ( QApplication::desktop()->width() < 650 ) {
1112 bfont.setPointSize( bfont.pointSize() - 2 ); 1112 bfont.setPointSize( bfont.pointSize() - 2 );
1113 } 1113 }
1114 bfont.setBold( true ); 1114 bfont.setBold( true );
1115 int i; 1115 int i;
1116 1116
1117 for( i = 0; i < mDaysPerWeek; i++ ) { 1117 for( i = 0; i < mDaysPerWeek; i++ ) {
1118 QLabel *label = new QLabel( mMonthView ); 1118 QLabel *label = new QLabel( mMonthView );
1119 label->setFont(bfont); 1119 label->setFont(bfont);
1120 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1120 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1121 label->setLineWidth(1); 1121 label->setLineWidth(1);
1122 label->setAlignment(AlignCenter); 1122 label->setAlignment(AlignCenter);
1123 mDayLabels.insert( i, label ); 1123 mDayLabels.insert( i, label );
1124 label = new QLabel( mWeekView ); 1124 label = new QLabel( mWeekView );
1125 label->setFont(bfont); 1125 label->setFont(bfont);
1126 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1126 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1127 label->setLineWidth(1); 1127 label->setLineWidth(1);
1128 label->setAlignment(AlignCenter); 1128 label->setAlignment(AlignCenter);
1129 mDayLabelsW.insert( i, label ); 1129 mDayLabelsW.insert( i, label );
1130 } 1130 }
1131 1131
1132 bfont.setBold( false ); 1132 bfont.setBold( false );
1133 mWeekLabels.resize( mNumWeeks+1 ); 1133 mWeekLabels.resize( mNumWeeks+1 );
1134 mWeekLabelsW.resize( 2 ); 1134 mWeekLabelsW.resize( 2 );
1135 for( i = 0; i < mNumWeeks+1; i++ ) { 1135 for( i = 0; i < mNumWeeks+1; i++ ) {
1136 KOWeekButton *label = new KOWeekButton( mMonthView ); 1136 KOWeekButton *label = new KOWeekButton( mMonthView );
1137 label->setFocusPolicy(NoFocus); 1137 label->setFocusPolicy(NoFocus);
1138 label->setFont(bfont); 1138 label->setFont(bfont);
1139 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1139 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1140 label->setFlat(true); 1140 label->setFlat(true);
1141 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1141 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1142 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1142 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1143 //label->setLineWidth(1); 1143 //label->setLineWidth(1);
1144 //label->setAlignment(AlignCenter); 1144 //label->setAlignment(AlignCenter);
1145 mWeekLabels.insert( i, label ); 1145 mWeekLabels.insert( i, label );
1146 } 1146 }
1147 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1147 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1148 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1148 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1149 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1149 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1150 1150
1151 for( i = 0; i < 1+1; i++ ) { 1151 for( i = 0; i < 1+1; i++ ) {
1152 KOWeekButton *label = new KOWeekButton( mWeekView ); 1152 KOWeekButton *label = new KOWeekButton( mWeekView );
1153 label->setFocusPolicy(NoFocus); 1153 label->setFocusPolicy(NoFocus);
1154 label->setFont(bfont); 1154 label->setFont(bfont);
1155 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1155 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1156 label->setFlat(true); 1156 label->setFlat(true);
1157 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1157 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1158 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1158 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1159 //label->setLineWidth(1); 1159 //label->setLineWidth(1);
1160 //label->setAlignment(AlignCenter); 1160 //label->setAlignment(AlignCenter);
1161 mWeekLabelsW.insert( i, label ); 1161 mWeekLabelsW.insert( i, label );
1162 } 1162 }
1163 mWeekLabelsW[1]->setText( i18n("W")); 1163 mWeekLabelsW[1]->setText( i18n("W"));
1164 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1164 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1165 1165
1166 1166
1167 int row, col; 1167 int row, col;
1168 mCells.resize( mNumCells ); 1168 mCells.resize( mNumCells );
1169 for( row = 0; row < mNumWeeks; ++row ) { 1169 for( row = 0; row < mNumWeeks; ++row ) {
1170 for( col = 0; col < mDaysPerWeek; ++col ) { 1170 for( col = 0; col < mDaysPerWeek; ++col ) {
1171 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1171 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1172 mCells.insert( row * mDaysPerWeek + col, cell ); 1172 mCells.insert( row * mDaysPerWeek + col, cell );
1173 1173
1174 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1174 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1175 SLOT( defaultAction( Incidence * ) ) ); 1175 SLOT( defaultAction( Incidence * ) ) );
1176 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1176 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1177 SIGNAL( newEventSignal( QDateTime ) ) ); 1177 SIGNAL( newEventSignal( QDateTime ) ) );
1178 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1178 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1179 SIGNAL( showDaySignal( QDate ) ) ); 1179 SIGNAL( showDaySignal( QDate ) ) );
1180 connect( cell, SIGNAL( nextCell() ), 1180 connect( cell, SIGNAL( nextCell() ),
1181 SLOT( nextCell() ) ); 1181 SLOT( nextCell() ) );
1182 connect( cell, SIGNAL( prevCell() ), 1182 connect( cell, SIGNAL( prevCell() ),
1183 SLOT( prevCell() ) ); 1183 SLOT( prevCell() ) );
1184 } 1184 }
1185 } 1185 }
1186 mCellsW.resize( mDaysPerWeek ); 1186 mCellsW.resize( mDaysPerWeek );
1187 for( col = 0; col < mDaysPerWeek; ++col ) { 1187 for( col = 0; col < mDaysPerWeek; ++col ) {
1188 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1188 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1189 mCellsW.insert( col, cell ); 1189 mCellsW.insert( col, cell );
1190 1190
1191 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1191 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1192 SLOT( defaultAction( Incidence * ) ) ); 1192 SLOT( defaultAction( Incidence * ) ) );
1193 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1193 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1194 SIGNAL( newEventSignal( QDateTime ) ) ); 1194 SIGNAL( newEventSignal( QDateTime ) ) );
1195 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1195 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1196 SIGNAL( showDaySignal( QDate ) ) ); 1196 SIGNAL( showDaySignal( QDate ) ) );
1197 connect( cell, SIGNAL( nextCell() ), 1197 connect( cell, SIGNAL( nextCell() ),
1198 SLOT( nextCell() ) ); 1198 SLOT( nextCell() ) );
1199 connect( cell, SIGNAL( prevCell() ), 1199 connect( cell, SIGNAL( prevCell() ),
1200 SLOT( prevCell() ) ); 1200 SLOT( prevCell() ) );
1201 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1201 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1202 } 1202 }
1203 1203
1204 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1204 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1205 mContextMenu = eventPopup(); 1205 mContextMenu = eventPopup();
1206 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1206 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1207 i18n("New Event..."),this, 1207 i18n("New Event..."),this,
1208 SLOT(slotNewEvent()),false); 1208 SLOT(slotNewEvent()),false);
1209 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1209 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1210 i18n("New Todo..."),this, 1210 i18n("New Todo..."),this,
1211 SLOT(slotNewTodo()),false); 1211 SLOT(slotNewTodo()),false);
1212 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1212 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1213 i18n("Journal"),this, 1213 i18n("Journal"),this,
1214 SLOT(slotEditJournal()),false); 1214 SLOT(slotEditJournal()),false);
1215 1215
1216 1216
1217 1217
1218 QString pathString = ""; 1218 QString pathString = "";
1219 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 1219 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1220 if ( QApplication::desktop()->width() < 480 ) 1220 if ( QApplication::desktop()->width() < 480 )
1221 pathString += "icons16/"; 1221 pathString += "icons16/";
1222 } else 1222 } else
1223 pathString += "iconsmini/"; 1223 pathString += "iconsmini/";
1224 mNewItemMenu = new QPopupMenu( this ); 1224 mNewItemMenu = new QPopupMenu( this );
1225 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); 1225 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1226 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); 1226 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1227 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); 1227 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1228 1228
1229 // updateConfig(); //useless here... 1229 // updateConfig(); //useless here...
1230 // ... but we need mWidthLongDayLabel computed 1230 // ... but we need mWidthLongDayLabel computed
1231 QFontMetrics fontmetric(mDayLabels[0]->font()); 1231 QFontMetrics fontmetric(mDayLabels[0]->font());
1232 mWidthLongDayLabel = 0; 1232 mWidthLongDayLabel = 0;
1233 for (int i = 0; i < 7; i++) { 1233 for (int i = 0; i < 7; i++) {
1234 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1234 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1235 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1235 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1236 } 1236 }
1237 1237
1238 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1238 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1239 1239
1240#if 0 1240#if 0
1241 if ( mShowWeekView ) 1241 if ( mShowWeekView )
1242 mWidStack->raiseWidget( mWeekView ); 1242 mWidStack->raiseWidget( mWeekView );
1243 else 1243 else
1244 mWidStack->raiseWidget( mMonthView ); 1244 mWidStack->raiseWidget( mMonthView );
1245#endif 1245#endif
1246 1246
1247 emit incidenceSelected( 0 ); 1247 emit incidenceSelected( 0 );
1248 1248
1249 mComputeLayoutTimer = new QTimer( this ); 1249 mComputeLayoutTimer = new QTimer( this );
1250 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1250 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1251 1251
1252 1252
1253#ifndef DESKTOP_VERSION 1253#ifndef DESKTOP_VERSION
1254 resize( QApplication::desktop()->size() ); 1254 resize( QApplication::desktop()->size() );
1255#else 1255#else
1256 resize(640, 480 ); 1256 resize(640, 480 );
1257 updatePossible = true; 1257 updatePossible = true;
1258#endif 1258#endif
1259 computeLayout(); 1259 computeLayout();
1260 1260
1261 if ( mShowWeekView ) 1261 if ( mShowWeekView )
1262 mWidStack->raiseWidget( mWeekView ); 1262 mWidStack->raiseWidget( mWeekView );
1263 else 1263 else
1264 mWidStack->raiseWidget( mMonthView ); 1264 mWidStack->raiseWidget( mMonthView );
1265} 1265}
1266 1266
1267KOMonthView::~KOMonthView() 1267KOMonthView::~KOMonthView()
1268{ 1268{
1269 delete mContextMenu; 1269 delete mContextMenu;
1270} 1270}
1271 1271
1272void KOMonthView::selectInternalWeekNum ( int n ) 1272void KOMonthView::selectInternalWeekNum ( int n )
1273{ 1273{
1274 switchView(); 1274 switchView();
1275 if ( !KOPrefs::instance()->mMonthViewWeek ) 1275 if ( !KOPrefs::instance()->mMonthViewWeek )
1276 emit selectMonth (); 1276 emit selectMonth ();
1277 else 1277 else
1278 emit selectWeekNum ( n ); 1278 emit selectWeekNum ( n );
1279} 1279}
1280 1280
1281int KOMonthView::currentWeek() 1281int KOMonthView::currentWeek()
1282{ 1282{
1283 if ( mShowWeekView ) 1283 if ( mShowWeekView )
1284 return mWeekLabelsW[0]->getWeekNum(); 1284 return mWeekLabelsW[0]->getWeekNum();
1285 return mWeekLabels[0]->getWeekNum(); 1285 return mWeekLabels[0]->getWeekNum();
1286} 1286}
1287void KOMonthView::switchView() 1287void KOMonthView::switchView()
1288{ 1288{
1289 if ( selectedCell( ) ) 1289 if ( selectedCell( ) )
1290 selectedCell()->deselect(); 1290 selectedCell()->deselect();
1291 mShowWeekView = !mShowWeekView; 1291 mShowWeekView = !mShowWeekView;
1292 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1292 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1293 if ( clPending ) { 1293 if ( clPending ) {
1294 computeLayout(); 1294 computeLayout();
1295 updateConfig(); 1295 updateConfig();
1296 } 1296 }
1297 if ( mShowWeekView ) 1297 if ( mShowWeekView )
1298 mWidStack->raiseWidget( mWeekView ); 1298 mWidStack->raiseWidget( mWeekView );
1299 else 1299 else
1300 mWidStack->raiseWidget( mMonthView ); 1300 mWidStack->raiseWidget( mMonthView );
1301 clPending = false; 1301 clPending = false;
1302} 1302}
1303 1303
1304int KOMonthView::maxDatesHint() 1304int KOMonthView::maxDatesHint()
1305{ 1305{
1306 return mNumCells; 1306 return mNumCells;
1307} 1307}
1308 1308
1309int KOMonthView::currentDateCount() 1309int KOMonthView::currentDateCount()
1310{ 1310{
1311 return mNumCells; 1311 return mNumCells;
1312} 1312}
1313 1313
1314QPtrList<Incidence> KOMonthView::selectedIncidences() 1314QPtrList<Incidence> KOMonthView::selectedIncidences()
1315{ 1315{
1316 QPtrList<Incidence> selected; 1316 QPtrList<Incidence> selected;
1317 1317
1318 if ( mSelectedCell ) { 1318 if ( mSelectedCell ) {
1319 Incidence *incidence = mSelectedCell->selectedIncidence(); 1319 Incidence *incidence = mSelectedCell->selectedIncidence();
1320 if ( incidence ) selected.append( incidence ); 1320 if ( incidence ) selected.append( incidence );
1321 } 1321 }
1322 1322
1323 return selected; 1323 return selected;
1324} 1324}
1325 1325
1326DateList KOMonthView::selectedDates() 1326DateList KOMonthView::selectedDates()
1327{ 1327{
1328 DateList selected; 1328 DateList selected;
1329 1329
1330 if ( mSelectedCell ) { 1330 if ( mSelectedCell ) {
1331 QDate qd = mSelectedCell->selectedIncidenceDate(); 1331 QDate qd = mSelectedCell->selectedIncidenceDate();
1332 if ( qd.isValid() ) selected.append( qd ); 1332 if ( qd.isValid() ) selected.append( qd );
1333 } 1333 }
1334 1334
1335 return selected; 1335 return selected;
1336} 1336}
1337 1337
1338void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1338void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1339 const QDate &td) 1339 const QDate &td)
1340{ 1340{
1341#ifndef KORG_NOPRINTER 1341#ifndef KORG_NOPRINTER
1342 calPrinter->preview(CalPrinter::Month, fd, td); 1342 calPrinter->preview(CalPrinter::Month, fd, td);
1343#endif 1343#endif
1344} 1344}
1345 1345
1346void KOMonthView::updateConfig() 1346void KOMonthView::updateConfig()
1347{ 1347{
1348 1348
1349 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1349 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1350 1350
1351 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1351 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1352 mWeekStartsMonday = true; 1352 mWeekStartsMonday = true;
1353 } 1353 }
1354 QFontMetrics fontmetric(mDayLabels[0]->font()); 1354 QFontMetrics fontmetric(mDayLabels[0]->font());
1355 mWidthLongDayLabel = 0; 1355 mWidthLongDayLabel = 0;
1356 1356
1357 for (int i = 0; i < 7; i++) { 1357 for (int i = 0; i < 7; i++) {
1358 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1358 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1359 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1359 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1360 } 1360 }
1361 bool temp = mShowSatSunComp ; 1361 bool temp = mShowSatSunComp ;
1362 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1362 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1363 if ( ! mShowWeekView ) { 1363 if ( ! mShowWeekView ) {
1364 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1364 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1365 computeLayout(); 1365 computeLayout();
1366 } 1366 }
1367 updateDayLabels(); 1367 updateDayLabels();
1368 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1368 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1369 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1369 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1370 //resizeEvent( 0 ); 1370 //resizeEvent( 0 );
1371 for (uint i = 0; i < mCells.count(); ++i) { 1371 for (uint i = 0; i < mCells.count(); ++i) {
1372 mCells[i]->updateConfig(); 1372 mCells[i]->updateConfig();
1373 } 1373 }
1374 1374
1375 for (uint i = 0; i < mCellsW.count(); ++i) { 1375 for (uint i = 0; i < mCellsW.count(); ++i) {
1376 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1376 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1377 } 1377 }
1378#ifdef DESKTOP_VERSION 1378#ifdef DESKTOP_VERSION
1379 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1379 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1380#endif 1380#endif
1381 updateView(); 1381 updateView();
1382} 1382}
1383 1383
1384void KOMonthView::updateDayLabels() 1384void KOMonthView::updateDayLabels()
1385{ 1385{
1386 1386
1387 QPtrVector<QLabel> *mDayLabelsT; 1387 QPtrVector<QLabel> *mDayLabelsT;
1388 1388
1389 mDayLabelsT = &mDayLabelsW; 1389 mDayLabelsT = &mDayLabelsW;
1390 for (int i = 0; i < 7; i++) { 1390 for (int i = 0; i < 7; i++) {
1391 { 1391 {
1392 bool show = mShortDayLabelsW; 1392 bool show = mShortDayLabelsW;
1393 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1393 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1394 show = true; 1394 show = true;
1395 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1395 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1396 } 1396 }
1397 } 1397 }
1398 mDayLabelsT = &mDayLabels; 1398 mDayLabelsT = &mDayLabels;
1399 for (int i = 0; i < 7; i++) { 1399 for (int i = 0; i < 7; i++) {
1400 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { 1400 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1401 bool show = mShortDayLabelsM; 1401 bool show = mShortDayLabelsM;
1402 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1402 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1403 show = true; 1403 show = true;
1404 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1404 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1405 } else { 1405 } else {
1406 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1406 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1407 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1407 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1408 1408
1409 } 1409 }
1410 } 1410 }
1411 1411
1412} 1412}
1413 1413
1414void KOMonthView::showDates(const QDate &start, const QDate &) 1414void KOMonthView::showDates(const QDate &start, const QDate &)
1415{ 1415{
1416 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1416 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1417 1417
1418 QPtrVector<MonthViewCell> *cells; 1418 QPtrVector<MonthViewCell> *cells;
1419 QPtrVector<QLabel> *dayLabels; 1419 QPtrVector<QLabel> *dayLabels;
1420 QPtrVector<KOWeekButton> *weekLabels; 1420 QPtrVector<KOWeekButton> *weekLabels;
1421 int weekNum = 6; 1421 int weekNum = 6;
1422 mStartDate = start; 1422 mStartDate = start;
1423 if ( mShowWeekView ) { 1423 if ( mShowWeekView ) {
1424 weekNum = 1; 1424 weekNum = 1;
1425 cells = &mCellsW; 1425 cells = &mCellsW;
1426 dayLabels = &mDayLabelsW; 1426 dayLabels = &mDayLabelsW;
1427 weekLabels = &mWeekLabelsW; 1427 weekLabels = &mWeekLabelsW;
1428 if ( !KGlobal::locale()->weekStartsMonday() ) { 1428 if ( !KGlobal::locale()->weekStartsMonday() ) {
1429 mStartDate = mStartDate.addDays( 1 ); 1429 mStartDate = mStartDate.addDays( 1 );
1430 } 1430 }
1431 } else { 1431 } else {
1432 cells = &mCells; 1432 cells = &mCells;
1433 dayLabels = &mDayLabels; 1433 dayLabels = &mDayLabels;
1434 weekLabels = &mWeekLabels; 1434 weekLabels = &mWeekLabels;
1435 } 1435 }
1436 1436
1437 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1437 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1438 1438
1439 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1439 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1440 mWeekStartsMonday = true; 1440 mWeekStartsMonday = true;
1441 } 1441 }
1442 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1442 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1443 1443
1444 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1444 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1445 mStartDate = mStartDate.addDays( -1 ); 1445 mStartDate = mStartDate.addDays( -1 );
1446 } 1446 }
1447 bool primary = false; 1447 bool primary = false;
1448 uint i; 1448 uint i;
1449 for( i = 0; i < (*cells).size(); ++i ) { 1449 for( i = 0; i < (*cells).size(); ++i ) {
1450 QDate date = mStartDate.addDays( i ); 1450 QDate date = mStartDate.addDays( i );
1451 (*cells)[i]->setDate( date ); 1451 (*cells)[i]->setDate( date );
1452 1452
1453#ifndef KORG_NOPLUGINS 1453#ifndef KORG_NOPLUGINS
1454 // add holiday, if present 1454 // add holiday, if present
1455 QString hstring(KOCore::self()->holiday(date)); 1455 QString hstring(KOCore::self()->holiday(date));
1456 (*cells)[i]->setHoliday( hstring ); 1456 (*cells)[i]->setHoliday( hstring );
1457#endif 1457#endif
1458 1458
1459 } 1459 }
1460 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1460 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1461 for( i = 0; i < weekNum; ++i ) { 1461 for( i = 0; i < weekNum; ++i ) {
1462 int wno; 1462 int wno;
1463 // remember, according to ISO 8601, the first week of the year is the 1463 // remember, according to ISO 8601, the first week of the year is the
1464 // first week that contains a thursday. Thus we must subtract off 4, 1464 // first week that contains a thursday. Thus we must subtract off 4,
1465 // not just 1. 1465 // not just 1.
1466 int dayOfYear = date.dayOfYear(); 1466 int dayOfYear = date.dayOfYear();
1467 if (dayOfYear % 7 != 0) 1467 if (dayOfYear % 7 != 0)
1468 wno = dayOfYear / 7 + 1; 1468 wno = dayOfYear / 7 + 1;
1469 else 1469 else
1470 wno =dayOfYear / 7; 1470 wno =dayOfYear / 7;
1471 (*weekLabels)[i]->setWeekNum( wno ); 1471 (*weekLabels)[i]->setWeekNum( wno );
1472 date = date.addDays( 7 ); 1472 date = date.addDays( 7 );
1473 } 1473 }
1474 updateView(); 1474 updateView();
1475} 1475}
1476 1476
1477void KOMonthView::showEvents(QPtrList<Event>) 1477void KOMonthView::showEvents(QPtrList<Event>)
1478{ 1478{
1479 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1479 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1480} 1480}
1481 1481
1482void KOMonthView::changeEventDisplay(Event *, int) 1482void KOMonthView::changeEventDisplay(Event *, int)
1483{ 1483{
1484 // this should be re-written to be much more efficient, but this 1484 // this should be re-written to be much more efficient, but this
1485 // quick-and-dirty-hack gets the job done for right now. 1485 // quick-and-dirty-hack gets the job done for right now.
1486 //qDebug("KOMonthView::changeEventDisplay "); 1486 //qDebug("KOMonthView::changeEventDisplay ");
1487 updateView(); 1487 updateView();
1488} 1488}
1489 1489
1490void KOMonthView::updateView() 1490void KOMonthView::updateView()
1491{ 1491{
1492 1492
1493 if ( !updatePossible ) 1493 if ( !updatePossible )
1494 return; 1494 return;
1495 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1495 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1496 //QTime ti; 1496 //QTime ti;
1497 //ti.start(); 1497 //ti.start();
1498 clearSelection(); 1498 clearSelection();
1499 QPtrVector<MonthViewCell> *cells; 1499 QPtrVector<MonthViewCell> *cells;
1500 if ( mShowWeekView ) { 1500 if ( mShowWeekView ) {
1501 cells = &mCellsW; 1501 cells = &mCellsW;
1502 } else { 1502 } else {
1503 cells = &mCells; 1503 cells = &mCells;
1504 } 1504 }
1505#if 1 1505#if 1
1506 int i; 1506 int i;
1507 int timeSpan = (*cells).size()-1; 1507 int timeSpan = (*cells).size()-1;
1508 if ( KOPrefs::instance()->mMonthViewWeek ) 1508 if ( KOPrefs::instance()->mMonthViewWeek )
1509 timeSpan = 6; 1509 timeSpan = 6;
1510 for( i = 0; i < timeSpan + 1; ++i ) { 1510 for( i = 0; i < timeSpan + 1; ++i ) {
1511 (*cells)[i]->startUpdateCell(); 1511 (*cells)[i]->startUpdateCell();
1512 } 1512 }
1513 1513
1514 QPtrList<Event> events = calendar()->events(); 1514 QPtrList<Event> events = calendar()->events();
1515 Event *event; 1515 Event *event;
1516 QDateTime dt; 1516 QDateTime dt;
1517 bool ok; 1517 bool ok;
1518 QDate endDate = mStartDate.addDays( timeSpan ); 1518 QDate endDate = mStartDate.addDays( timeSpan );
1519 for( event = events.first(); event; event = events.next() ) { // for event 1519 for( event = events.first(); event; event = events.next() ) { // for event
1520 if ( event->doesRecur() ) { 1520 if ( event->doesRecur() ) {
1521 bool last; 1521 bool last;
1522 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1522 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1523 QDateTime incidenceEnd; 1523 QDateTime incidenceEnd;
1524 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1524 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1525 bool invalid = false; 1525 bool invalid = false;
1526 while( true ) { 1526 while( true ) {
1527 if ( incidenceStart.isValid() ) { 1527 if ( incidenceStart.isValid() ) {
1528 incidenceEnd = incidenceStart.addDays( eventlen ); 1528 incidenceEnd = incidenceStart.addDays( eventlen );
1529 int st = incidenceStart.date().daysTo( endDate ); 1529 int st = incidenceStart.date().daysTo( endDate );
1530 if ( st >= 0 ) { // start before timeend 1530 if ( st >= 0 ) { // start before timeend
1531 int end = mStartDate.daysTo( incidenceEnd.date() ); 1531 int end = mStartDate.daysTo( incidenceEnd.date() );
1532 if ( end >= 0 ) { // end after timestart --- got one! 1532 if ( end >= 0 ) { // end after timestart --- got one!
1533 //normalize 1533 //normalize
1534 st = timeSpan - st; 1534 st = timeSpan - st;
1535 if ( st < 0 ) st = 0; 1535 if ( st < 0 ) st = 0;
1536 if ( end > timeSpan ) end = timeSpan; 1536 if ( end > timeSpan ) end = timeSpan;
1537 int iii; 1537 int iii;
1538 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1538 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1539 for ( iii = st;iii<= end;++iii) 1539 for ( iii = st;iii<= end;++iii)
1540 (*cells)[iii]->insertEvent( event ); 1540 (*cells)[iii]->insertEvent( event );
1541 } 1541 }
1542 } 1542 }
1543 } else { 1543 } else {
1544 if ( invalid ) 1544 if ( invalid )
1545 break; 1545 break;
1546 invalid = true; 1546 invalid = true;
1547 //qDebug("invalid %s", event->summary().latin1()); 1547 //qDebug("invalid %s", event->summary().latin1());
1548 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1548 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1549 } 1549 }
1550 if ( last ) 1550 if ( last )
1551 break; 1551 break;
1552 bool ok; 1552 bool ok;
1553 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1553 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1554 if ( ! ok ) 1554 if ( ! ok )
1555 break; 1555 break;
1556 if ( incidenceStart.date() > endDate ) 1556 if ( incidenceStart.date() > endDate )
1557 break; 1557 break;
1558 } 1558 }
1559 } else { // no recur 1559 } else { // no recur
1560 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1561 if ( event->uid().left(15) == QString("last-syncEvent-") )
1562 continue;
1560 int st = event->dtStart().date().daysTo( endDate ); 1563 int st = event->dtStart().date().daysTo( endDate );
1561 if ( st >= 0 ) { // start before timeend 1564 if ( st >= 0 ) { // start before timeend
1562 int end = mStartDate.daysTo( event->dtEnd().date() ); 1565 int end = mStartDate.daysTo( event->dtEnd().date() );
1563 if ( end >= 0 ) { // end after timestart --- got one! 1566 if ( end >= 0 ) { // end after timestart --- got one!
1564 //normalize 1567 //normalize
1565 st = timeSpan - st; 1568 st = timeSpan - st;
1566 if ( st < 0 ) st = 0; 1569 if ( st < 0 ) st = 0;
1567 if ( end > timeSpan ) end = timeSpan; 1570 if ( end > timeSpan ) end = timeSpan;
1568 int iii; 1571 int iii;
1569 for ( iii = st;iii<= end;++iii) 1572 for ( iii = st;iii<= end;++iii)
1570 (*cells)[iii]->insertEvent( event ); 1573 (*cells)[iii]->insertEvent( event );
1571 } 1574 }
1572 } 1575 }
1573 } 1576 }
1574 } 1577 }
1575 // insert due todos 1578 // insert due todos
1576 QPtrList<Todo> todos = calendar()->todos( ); 1579 QPtrList<Todo> todos = calendar()->todos( );
1577 Todo *todo; 1580 Todo *todo;
1578 for(todo = todos.first(); todo; todo = todos.next()) { 1581 for(todo = todos.first(); todo; todo = todos.next()) {
1579 //insertTodo( todo ); 1582 //insertTodo( todo );
1580 if ( todo->hasDueDate() ) { 1583 if ( todo->hasDueDate() ) {
1581 int day = mStartDate.daysTo( todo->dtDue().date() ); 1584 int day = mStartDate.daysTo( todo->dtDue().date() );
1582 if ( day >= 0 && day < timeSpan + 1) { 1585 if ( day >= 0 && day < timeSpan + 1) {
1583 (*cells)[day]->insertTodo( todo ); 1586 (*cells)[day]->insertTodo( todo );
1584 } 1587 }
1585 } 1588 }
1586 } 1589 }
1587 1590
1588 for( i = 0; i < timeSpan+1; ++i ) { 1591 for( i = 0; i < timeSpan+1; ++i ) {
1589 (*cells)[i]->finishUpdateCell(); 1592 (*cells)[i]->finishUpdateCell();
1590 } 1593 }
1591 processSelectionChange(); 1594 processSelectionChange();
1592 //qApp->processEvents(); 1595 //qApp->processEvents();
1593 for( i = 0; i < timeSpan+1; ++i ) { 1596 for( i = 0; i < timeSpan+1; ++i ) {
1594 (*cells)[i]->repaintfinishUpdateCell(); 1597 (*cells)[i]->repaintfinishUpdateCell();
1595 } 1598 }
1596 setKeyBFocus(); 1599 setKeyBFocus();
1597#else 1600#else
1598 // old code 1601 // old code
1599 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1602 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1600 int i; 1603 int i;
1601 for( i = 0; i < (*cells).count(); ++i ) { 1604 for( i = 0; i < (*cells).count(); ++i ) {
1602 (*cells)[i]->updateCell(); 1605 (*cells)[i]->updateCell();
1603 } 1606 }
1604 1607
1605 //qDebug("KOMonthView::updateView() "); 1608 //qDebug("KOMonthView::updateView() ");
1606 processSelectionChange(); 1609 processSelectionChange();
1607 // qDebug("---------------------------------------------------------------------+ "); 1610 // qDebug("---------------------------------------------------------------------+ ");
1608 (*cells)[0]->setFocus(); 1611 (*cells)[0]->setFocus();
1609#endif 1612#endif
1610 1613
1611 //qDebug("update time %d ", ti.elapsed()); 1614 //qDebug("update time %d ", ti.elapsed());
1612} 1615}
1613 1616
1614void KOMonthView::setKeyBoardFocus() 1617void KOMonthView::setKeyBoardFocus()
1615{ 1618{
1616 //qDebug("KOMonthView::setKeyBoardFocus() "); 1619 //qDebug("KOMonthView::setKeyBoardFocus() ");
1617 bool shootAgain = false; 1620 bool shootAgain = false;
1618 if ( mShowWeekView ) { 1621 if ( mShowWeekView ) {
1619 shootAgain = !mWeekLabelsW[1]->hasFocus(); 1622 shootAgain = !mWeekLabelsW[1]->hasFocus();
1620 mWeekLabelsW[1]->setFocus(); 1623 mWeekLabelsW[1]->setFocus();
1621 } 1624 }
1622 else { 1625 else {
1623 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); 1626 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
1624 mWeekLabels[mNumWeeks]->setFocus(); 1627 mWeekLabels[mNumWeeks]->setFocus();
1625 } 1628 }
1626 if ( shootAgain ) { 1629 if ( shootAgain ) {
1627 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); 1630 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
1628 } 1631 }
1629} 1632}
1630void KOMonthView::setKeyBFocus() 1633void KOMonthView::setKeyBFocus()
1631{ 1634{
1632 //qDebug("KOMonthView::setKeyBFocus() "); 1635 //qDebug("KOMonthView::setKeyBFocus() ");
1633 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); 1636 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1634} 1637}
1635void KOMonthView::resizeEvent(QResizeEvent * e) 1638void KOMonthView::resizeEvent(QResizeEvent * e)
1636{ 1639{
1637 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1640 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1638 if ( isVisible() ) { 1641 if ( isVisible() ) {
1639 //qDebug("KOMonthView::isVisible "); 1642 //qDebug("KOMonthView::isVisible ");
1640 slotComputeLayout(); 1643 slotComputeLayout();
1641 } else 1644 } else
1642 mComputeLayoutTimer->start( 100 ); 1645 mComputeLayoutTimer->start( 100 );
1643} 1646}
1644 1647
1645void KOMonthView::slotComputeLayout() 1648void KOMonthView::slotComputeLayout()
1646{ 1649{
1647 mComputeLayoutTimer->stop(); 1650 mComputeLayoutTimer->stop();
1648 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1651 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1649 computeLayout(); 1652 computeLayout();
1650 clPending = true; 1653 clPending = true;
1651 setKeyBFocus(); 1654 setKeyBFocus();
1652} 1655}
1653void KOMonthView::computeLayoutWeek() 1656void KOMonthView::computeLayoutWeek()
1654{ 1657{
1655 static int lastWid = 0; 1658 static int lastWid = 0;
1656 static int lastHei = 0; 1659 static int lastHei = 0;
1657 int daysToShow; 1660 int daysToShow;
1658 bool combinedSatSun = false; 1661 bool combinedSatSun = false;
1659 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1662 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1660 daysToShow = 6; 1663 daysToShow = 6;
1661 combinedSatSun = true; 1664 combinedSatSun = true;
1662 } 1665 }
1663 int tWid = topLevelWidget()->size().width(); 1666 int tWid = topLevelWidget()->size().width();
1664 int tHei = topLevelWidget()->size().height(); 1667 int tHei = topLevelWidget()->size().height();
1665 1668
1666 int wid = width();//e 1669 int wid = width();//e
1667 int hei = height()-1-mNavigatorBar->height(); 1670 int hei = height()-1-mNavigatorBar->height();
1668 1671
1669 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1672 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1670 return; 1673 return;
1671 1674
1672 if ( lastWid == width() && lastHei == height() ) { 1675 if ( lastWid == width() && lastHei == height() ) {
1673 //qDebug("KOListWeekView::No compute layout needed "); 1676 //qDebug("KOListWeekView::No compute layout needed ");
1674 return; 1677 return;
1675 } 1678 }
1676 lastWid = width(); 1679 lastWid = width();
1677 lastHei = height(); 1680 lastHei = height();
1678 1681
1679 1682
1680 if ( wid < hei ) 1683 if ( wid < hei )
1681 daysToShow = 2; 1684 daysToShow = 2;
1682 else 1685 else
1683 daysToShow = 3; 1686 daysToShow = 3;
1684 mShowSatSunComp = true; 1687 mShowSatSunComp = true;
1685 combinedSatSun = true; 1688 combinedSatSun = true;
1686 1689
1687 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1690 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1688 QFontMetrics fm ( mWeekLabels[0]->font() ); 1691 QFontMetrics fm ( mWeekLabels[0]->font() );
1689 int weeklabelwid = fm.width( "888" ); 1692 int weeklabelwid = fm.width( "888" );
1690 wid -= weeklabelwid; 1693 wid -= weeklabelwid;
1691 1694
1692 int colWid = wid / daysToShow; 1695 int colWid = wid / daysToShow;
1693 int lastCol = wid - ( colWid*6 ); 1696 int lastCol = wid - ( colWid*6 );
1694 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1697 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1695 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1698 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1696 int colModulo = wid % daysToShow; 1699 int colModulo = wid % daysToShow;
1697 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1700 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1698 //qDebug("rowmod %d ", rowModulo); 1701 //qDebug("rowmod %d ", rowModulo);
1699 int i; 1702 int i;
1700 int x,y,w,h; 1703 int x,y,w,h;
1701 x= 0; 1704 x= 0;
1702 y= 0; 1705 y= 0;
1703 w = colWid; 1706 w = colWid;
1704 h = dayLabelHei ; 1707 h = dayLabelHei ;
1705 for ( i = 0; i < 7; i++) { 1708 for ( i = 0; i < 7; i++) {
1706 if ( i && !( i % daysToShow) && i < 6) { 1709 if ( i && !( i % daysToShow) && i < 6) {
1707 y += hei/(5-daysToShow); 1710 y += hei/(5-daysToShow);
1708 x = 0; 1711 x = 0;
1709 w = colWid; 1712 w = colWid;
1710 } 1713 }
1711 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1714 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1712 ++w; 1715 ++w;
1713 } 1716 }
1714 if ( i >= 5 ) { 1717 if ( i >= 5 ) {
1715 int wi = width() - x - weeklabelwid; 1718 int wi = width() - x - weeklabelwid;
1716 if ( i == 5 ) { 1719 if ( i == 5 ) {
1717 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); 1720 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h);
1718 } else { 1721 } else {
1719 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1722 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1720 } 1723 }
1721 x = x - w + wi - (wi/2 ); 1724 x = x - w + wi - (wi/2 );
1722 } 1725 }
1723 else { 1726 else {
1724 int wi = w; 1727 int wi = w;
1725 if ( !(( i+1) % daysToShow)) { 1728 if ( !(( i+1) % daysToShow)) {
1726 wi = width() - x - weeklabelwid; 1729 wi = width() - x - weeklabelwid;
1727 } 1730 }
1728 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1731 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1729 } 1732 }
1730 x += w; 1733 x += w;
1731 } 1734 }
1732 x= 0; 1735 x= 0;
1733 y= dayLabelHei; 1736 y= dayLabelHei;
1734 w = colWid; 1737 w = colWid;
1735 h = cellHei; 1738 h = cellHei;
1736 int max = 0; 1739 int max = 0;
1737 for ( i = 0; i < mCellsW.count(); ++i) { 1740 for ( i = 0; i < mCellsW.count(); ++i) {
1738 if ( i > 6 ) { 1741 if ( i > 6 ) {
1739 mCellsW[i]->hide(); 1742 mCellsW[i]->hide();
1740 continue; 1743 continue;
1741 } 1744 }
1742 1745
1743 w = colWid; 1746 w = colWid;
1744 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1747 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1745 ++w; 1748 ++w;
1746 } 1749 }
1747 if ( i == (daysToShow-1-rowModulo)*7) 1750 if ( i == (daysToShow-1-rowModulo)*7)
1748 ++h; 1751 ++h;
1749 1752
1750 if ( i >= 5 ) { 1753 if ( i >= 5 ) {
1751 if ( i ==5 ) { 1754 if ( i ==5 ) {
1752 max = h/2; 1755 max = h/2;
1753 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1756 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1754 x -= w ;y += h/2; 1757 x -= w ;y += h/2;
1755 } else { 1758 } else {
1756 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1759 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1757 ++w; 1760 ++w;
1758 } 1761 }
1759 max = h-h/2; 1762 max = h-h/2;
1760 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1763 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1761 y -= h/2; 1764 y -= h/2;
1762 } 1765 }
1763 } else { 1766 } else {
1764 max = h; 1767 max = h;
1765 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1768 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1766 } 1769 }
1767 1770
1768 1771
1769 x += w; 1772 x += w;
1770 if ( x + w/2 > wid ) { 1773 if ( x + w/2 > wid ) {
1771 x = 0; 1774 x = 0;
1772 y += h+dayLabelHei ; 1775 y += h+dayLabelHei ;
1773 } 1776 }
1774 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); 1777 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
1775 } 1778 }
1776 y= dayLabelHei; 1779 y= dayLabelHei;
1777 h = cellHei ; 1780 h = cellHei ;
1778 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1781 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1779 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1782 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1780 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1783 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1781 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1784 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1782 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; 1785 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
1783 updateDayLabels(); 1786 updateDayLabels();
1784 //bool forceUpdate = !updatePossible; 1787 //bool forceUpdate = !updatePossible;
1785 updatePossible = true; 1788 updatePossible = true;
1786 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1789 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1787 //if ( forceUpdate ) 1790 //if ( forceUpdate )
1788 // updateView(); 1791 // updateView();
1789} 1792}
1790void KOMonthView::computeLayout() 1793void KOMonthView::computeLayout()
1791{ 1794{
1792 1795
1793 1796
1794 static int lastWid = 0; 1797 static int lastWid = 0;
1795 static int lastHei = 0; 1798 static int lastHei = 0;
1796 1799
1797 if ( mShowWeekView ){ 1800 if ( mShowWeekView ){
1798 computeLayoutWeek(); 1801 computeLayoutWeek();
1799 return; 1802 return;
1800 } 1803 }
1801 int daysToShow = 7; 1804 int daysToShow = 7;
1802 bool combinedSatSun = false; 1805 bool combinedSatSun = false;
1803 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1806 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1804 daysToShow = 6; 1807 daysToShow = 6;
1805 combinedSatSun = true; 1808 combinedSatSun = true;
1806 } 1809 }
1807 int tWid = topLevelWidget()->size().width(); 1810 int tWid = topLevelWidget()->size().width();
1808 int tHei = topLevelWidget()->size().height(); 1811 int tHei = topLevelWidget()->size().height();
1809 1812
1810 int wid = width();//e 1813 int wid = width();//e
1811 int hei = height()-1-mNavigatorBar->height(); 1814 int hei = height()-1-mNavigatorBar->height();
1812 1815
1813 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1816 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1814 return; 1817 return;
1815 } 1818 }
1816 if ( lastWid == width() && lastHei == height() ){ 1819 if ( lastWid == width() && lastHei == height() ){
1817 //qDebug("KOMonthview::No compute layout needed "); 1820 //qDebug("KOMonthview::No compute layout needed ");
1818 return; 1821 return;
1819 } 1822 }
1820 1823
1821 lastWid = width(); 1824 lastWid = width();
1822 lastHei = height(); 1825 lastHei = height();
1823 //qDebug("KOMonthView::computeLayout() MMM ------------------- "); 1826 //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1824 QFontMetrics fm ( mWeekLabels[0]->font() ); 1827 QFontMetrics fm ( mWeekLabels[0]->font() );
1825 int weeklabelwid = fm.width( "888" ); 1828 int weeklabelwid = fm.width( "888" );
1826 wid -= weeklabelwid; 1829 wid -= weeklabelwid;
1827 1830
1828 int colWid = wid / daysToShow; 1831 int colWid = wid / daysToShow;
1829 int lastCol = wid - ( colWid*6 ); 1832 int lastCol = wid - ( colWid*6 );
1830 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1833 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1831 int cellHei = (hei - dayLabelHei) /6; 1834 int cellHei = (hei - dayLabelHei) /6;
1832 int colModulo = wid % daysToShow; 1835 int colModulo = wid % daysToShow;
1833 int rowModulo = (hei- dayLabelHei) % 6; 1836 int rowModulo = (hei- dayLabelHei) % 6;
1834 //qDebug("rowmod %d ", rowModulo); 1837 //qDebug("rowmod %d ", rowModulo);
1835 int i; 1838 int i;
1836 int x,y,w,h; 1839 int x,y,w,h;
1837 x= 0; 1840 x= 0;
1838 y= 0; 1841 y= 0;
1839 w = colWid; 1842 w = colWid;
1840 h = dayLabelHei ; 1843 h = dayLabelHei ;
1841 for ( i = 0; i < 7; i++) { 1844 for ( i = 0; i < 7; i++) {
1842 if ( i == daysToShow-colModulo ) 1845 if ( i == daysToShow-colModulo )
1843 ++w; 1846 ++w;
1844 if ( combinedSatSun ) { 1847 if ( combinedSatSun ) {
1845 if ( i >= daysToShow-1 ) { 1848 if ( i >= daysToShow-1 ) {
1846 1849
1847 if ( i == 6 ) 1850 if ( i == 6 )
1848 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); 1851 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h);
1849 else 1852 else
1850 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1853 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1851 x -= w/2 ; 1854 x -= w/2 ;
1852 } 1855 }
1853 else 1856 else
1854 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1857 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1855 } else 1858 } else
1856 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1859 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1857 x += w; 1860 x += w;
1858 } 1861 }
1859 x= 0; 1862 x= 0;
1860 y= dayLabelHei; 1863 y= dayLabelHei;
1861 w = colWid; 1864 w = colWid;
1862 h = cellHei ; 1865 h = cellHei ;
1863 int max = 0; 1866 int max = 0;
1864 for ( i = 0; i < mCells.count(); ++i) { 1867 for ( i = 0; i < mCells.count(); ++i) {
1865 //qDebug("iii %d ", i); 1868 //qDebug("iii %d ", i);
1866 w = colWid; 1869 w = colWid;
1867 if ( ((i) % 7) >= 7-colModulo ) { 1870 if ( ((i) % 7) >= 7-colModulo ) {
1868 ++w; 1871 ++w;
1869 } 1872 }
1870 if ( i == (6-rowModulo)*7) 1873 if ( i == (6-rowModulo)*7)
1871 ++h; 1874 ++h;
1872 if ( combinedSatSun ) { 1875 if ( combinedSatSun ) {
1873 if ( (i)%7 >= daysToShow-1 ) { 1876 if ( (i)%7 >= daysToShow-1 ) {
1874 if ( (i)%7 == daysToShow-1 ) { 1877 if ( (i)%7 == daysToShow-1 ) {
1875 w = width()-x-weeklabelwid; 1878 w = width()-x-weeklabelwid;
1876 max = h/2; 1879 max = h/2;
1877 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1880 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1878 x -= w ;y += h/2; 1881 x -= w ;y += h/2;
1879 } else { 1882 } else {
1880 w = width()-x-weeklabelwid; 1883 w = width()-x-weeklabelwid;
1881 max = h-h/2; 1884 max = h-h/2;
1882 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1885 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1883 y -= h/2; 1886 y -= h/2;
1884 } 1887 }
1885 } else { 1888 } else {
1886 max = h; 1889 max = h;
1887 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1890 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1888 } 1891 }
1889 1892
1890 } 1893 }
1891 else { 1894 else {
1892 max = h; 1895 max = h;
1893 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1896 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1894 } 1897 }
1895 x += w; 1898 x += w;
1896 if ( x + w/2 > wid ) { 1899 if ( x + w/2 > wid ) {
1897 x = 0; 1900 x = 0;
1898 y += h; 1901 y += h;
1899 } 1902 }
1900 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); 1903 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
1901 } 1904 }
1902 y= dayLabelHei; 1905 y= dayLabelHei;
1903 h = cellHei ; 1906 h = cellHei ;
1904 for ( i = 0; i < 6; i++) { 1907 for ( i = 0; i < 6; i++) {
1905 if ( i == (6-rowModulo)) 1908 if ( i == (6-rowModulo))
1906 ++h; 1909 ++h;
1907 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1910 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1908 y += h; 1911 y += h;
1909 } 1912 }
1910 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1913 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1911 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1914 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1912 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1915 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1913 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; 1916 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ;
1914 updateDayLabels(); 1917 updateDayLabels();
1915 //bool forceUpdate = !updatePossible; 1918 //bool forceUpdate = !updatePossible;
1916 updatePossible = true; 1919 updatePossible = true;
1917 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1920 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1918} 1921}
1919 1922
1920void KOMonthView::showContextMenu( Incidence *incidence ) 1923void KOMonthView::showContextMenu( Incidence *incidence )
1921{ 1924{
1922 if( incidence ) 1925 if( incidence )
1923 mContextMenu->showIncidencePopup(incidence); 1926 mContextMenu->showIncidencePopup(incidence);
1924 else { 1927 else {
1925 //qDebug("KOMonthView::showContextMenu "); 1928 //qDebug("KOMonthView::showContextMenu ");
1926 mNewItemMenu->popup(QCursor::pos()); 1929 mNewItemMenu->popup(QCursor::pos());
1927 } 1930 }
1928 /* 1931 /*
1929 if( incidence && incidence->type() == "Event" ) { 1932 if( incidence && incidence->type() == "Event" ) {
1930 Event *event = static_cast<Event *>(incidence); 1933 Event *event = static_cast<Event *>(incidence);
1931 mContextMenu->showEventPopup(event); 1934 mContextMenu->showEventPopup(event);
1932 } else { 1935 } else {
1933 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1936 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1934 } 1937 }
1935 */ 1938 */
1936} 1939}
1937MonthViewCell * KOMonthView::selectedCell( ) 1940MonthViewCell * KOMonthView::selectedCell( )
1938{ 1941{
1939 return mSelectedCell; 1942 return mSelectedCell;
1940} 1943}
1941void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1944void KOMonthView::setSelectedCell( MonthViewCell *cell )
1942{ 1945{
1943 //qDebug("KOMonthView::setSelectedCell %d", cell); 1946 //qDebug("KOMonthView::setSelectedCell %d", cell);
1944 if ( mSelectedCell && mSelectedCell != cell ) { 1947 if ( mSelectedCell && mSelectedCell != cell ) {
1945 MonthViewCell * mvc = mSelectedCell; 1948 MonthViewCell * mvc = mSelectedCell;
1946 mSelectedCell = cell; 1949 mSelectedCell = cell;
1947 mvc->deselect(); 1950 mvc->deselect();
1948 } else 1951 } else
1949 mSelectedCell = cell; 1952 mSelectedCell = cell;
1950 // if ( mSelectedCell ) 1953 // if ( mSelectedCell )
1951 // mSelectedCell->select(); 1954 // mSelectedCell->select();
1952 if ( !mSelectedCell ) 1955 if ( !mSelectedCell )
1953 emit incidenceSelected( 0 ); 1956 emit incidenceSelected( 0 );
1954 else 1957 else
1955 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1958 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1956} 1959}
1957 1960
1958void KOMonthView::processSelectionChange() 1961void KOMonthView::processSelectionChange()
1959{ 1962{
1960 QPtrList<Incidence> incidences = selectedIncidences(); 1963 QPtrList<Incidence> incidences = selectedIncidences();
1961 if (incidences.count() > 0) { 1964 if (incidences.count() > 0) {
1962 emit incidenceSelected( incidences.first() ); 1965 emit incidenceSelected( incidences.first() );
1963 } else { 1966 } else {
1964 emit incidenceSelected( 0 ); 1967 emit incidenceSelected( 0 );
1965 clearSelection(); 1968 clearSelection();
1966 } 1969 }
1967} 1970}
1968 1971
1969void KOMonthView::clearSelection() 1972void KOMonthView::clearSelection()
1970{ 1973{
1971 if ( mSelectedCell ) { 1974 if ( mSelectedCell ) {
1972 mSelectedCell->deselect(); 1975 mSelectedCell->deselect();
1973 mSelectedCell = 0; 1976 mSelectedCell = 0;
1974 } 1977 }
1975} 1978}
1976 1979
1977void KOMonthView::keyReleaseEvent ( QKeyEvent * e) 1980void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
1978{ 1981{
1979 if ( !e->isAutoRepeat() ) { 1982 if ( !e->isAutoRepeat() ) {
1980 mFlagKeyPressed = false; 1983 mFlagKeyPressed = false;
1981 } 1984 }
1982} 1985}
1983 1986
1984void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1987void KOMonthView::keyPressEvent ( QKeyEvent * e )
1985{ 1988{
1986 1989
1987 qApp->processEvents(); 1990 qApp->processEvents();
1988 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1991 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1989 //e->ignore(); 1992 //e->ignore();
1990 e->accept(); 1993 e->accept();
1991 return; 1994 return;
1992 } 1995 }
1993 if (! e->isAutoRepeat() ) 1996 if (! e->isAutoRepeat() )
1994 mFlagKeyPressed = true; 1997 mFlagKeyPressed = true;
1995 switch(e->key()) { 1998 switch(e->key()) {
1996 case Key_Up: 1999 case Key_Up:
1997 { 2000 {
1998 if ( mShowWeekView ) { 2001 if ( mShowWeekView ) {
1999 emit selectWeekNum ( currentWeek() - 1 ); 2002 emit selectWeekNum ( currentWeek() - 1 );
2000 } 2003 }
2001 else { 2004 else {
2002 emit prevMonth(); 2005 emit prevMonth();
2003 } 2006 }
2004 } 2007 }
2005 e->accept(); 2008 e->accept();
2006 break; 2009 break;
2007 case Key_Down: 2010 case Key_Down:
2008 { 2011 {
2009 if ( mShowWeekView ) { 2012 if ( mShowWeekView ) {
2010 emit selectWeekNum ( currentWeek() +1); 2013 emit selectWeekNum ( currentWeek() +1);
2011 } 2014 }
2012 else { 2015 else {
2013 emit nextMonth(); 2016 emit nextMonth();
2014 } 2017 }
2015 2018
2016 } 2019 }
2017 e->accept(); 2020 e->accept();
2018 break; 2021 break;
2019 case Key_Return: 2022 case Key_Return:
2020 case Key_Enter: 2023 case Key_Enter:
2021 { 2024 {
2022 selectInternalWeekNum ( currentWeek() ); 2025 selectInternalWeekNum ( currentWeek() );
2023 } 2026 }
2024 e->accept(); 2027 e->accept();
2025 break; 2028 break;
2026 case Key_D: 2029 case Key_D:
2027 if ( mSelectedCell ) { 2030 if ( mSelectedCell ) {
2028 mSelectedCell->showDay(); 2031 mSelectedCell->showDay();
2029 e->accept(); 2032 e->accept();
2030 } else { 2033 } else {
2031 e->ignore(); 2034 e->ignore();
2032 } 2035 }
2033 break; 2036 break;
2034 default: 2037 default:
2035 e->ignore(); 2038 e->ignore();
2036 break; 2039 break;
2037 } 2040 }
2038} 2041}
2039 2042
2040void KOMonthView::nextCell() 2043void KOMonthView::nextCell()
2041{ 2044{
2042 bool res = focusNextPrevChild ( true ); 2045 bool res = focusNextPrevChild ( true );
2043} 2046}
2044void KOMonthView::prevCell() 2047void KOMonthView::prevCell()
2045{ 2048{
2046 focusNextPrevChild ( false ); 2049 focusNextPrevChild ( false );
2047} 2050}
2048 2051
2049void KOMonthView::slotNewTodo() 2052void KOMonthView::slotNewTodo()
2050{ 2053{
2051 //qDebug("KOMonthView::slotNewTodo() "); 2054 //qDebug("KOMonthView::slotNewTodo() ");
2052 if ( mPopupCell ){ 2055 if ( mPopupCell ){
2053 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 2056 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2054 emit newTodoSignal(dt,true); 2057 emit newTodoSignal(dt,true);
2055 } 2058 }
2056 mPopupCell = 0; 2059 mPopupCell = 0;
2057} 2060}
2058void KOMonthView::slotNewEvent() 2061void KOMonthView::slotNewEvent()
2059{ 2062{
2060 if ( mPopupCell ) { 2063 if ( mPopupCell ) {
2061 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 2064 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2062 emit newEventSignal( dt ); 2065 emit newEventSignal( dt );
2063 } 2066 }
2064 //qDebug("KOMonthView::slotNewEvent() "); 2067 //qDebug("KOMonthView::slotNewEvent() ");
2065 mPopupCell = 0; 2068 mPopupCell = 0;
2066} 2069}
2067 2070
2068void KOMonthView::slotEditJournal() 2071void KOMonthView::slotEditJournal()
2069{ 2072{
2070 if ( mPopupCell ) 2073 if ( mPopupCell )
2071 emit showJournalSignal( 7, mPopupCell->date() ); 2074 emit showJournalSignal( 7, mPopupCell->date() );
2072 //qDebug("KOMonthView::slotEditJournal() "); 2075 //qDebug("KOMonthView::slotEditJournal() ");
2073 mPopupCell = 0; 2076 mPopupCell = 0;
2074} 2077}
2075 2078
2076void KOMonthView::setPopupCell( MonthViewCell * c) 2079void KOMonthView::setPopupCell( MonthViewCell * c)
2077{ 2080{
2078 mPopupCell = c; 2081 mPopupCell = c;
2079} 2082}
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index cb9c272..d9d7924 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,1743 +1,1746 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kglobalsettings.h> 56#include <kglobalsettings.h>
57 57
58#include <kurlrequester.h> 58#include <kurlrequester.h>
59#include <klineedit.h> 59#include <klineedit.h>
60 60
61#if defined(USE_SOLARIS) 61#if defined(USE_SOLARIS)
62#include <sys/param.h> 62#include <sys/param.h>
63 63
64#define ZONEINFODIR "/usr/share/lib/zoneinfo" 64#define ZONEINFODIR "/usr/share/lib/zoneinfo"
65#define INITFILE "/etc/default/init" 65#define INITFILE "/etc/default/init"
66#endif 66#endif
67 67
68#include "koprefs.h" 68#include "koprefs.h"
69 69
70#include "koprefsdialog.h" 70#include "koprefsdialog.h"
71#include "kpimglobalprefs.h" 71#include "kpimglobalprefs.h"
72 72
73 73
74KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 74KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
75 KPrefsDialog(KOPrefs::instance(),parent,name,true) 75 KPrefsDialog(KOPrefs::instance(),parent,name,true)
76{ 76{
77 77
78 setFont( KGlobalSettings::generalMaxFont() ); 78 setFont( KGlobalSettings::generalMaxFont() );
79 setCaption( i18n("Preferences - some settings need a restart (nr)")); 79 setCaption( i18n("Preferences - some settings need a restart (nr)"));
80 mCategoryDict.setAutoDelete(true); 80 mCategoryDict.setAutoDelete(true);
81 81
82 KGlobal::locale()->insertCatalogue("timezones"); 82 KGlobal::locale()->insertCatalogue("timezones");
83 mSpacingHint = spacingHintSmall(); 83 mSpacingHint = spacingHintSmall();
84 mMarginHint = marginHintSmall(); 84 mMarginHint = marginHintSmall();
85#ifndef DESKTOP_VERSION 85#ifndef DESKTOP_VERSION
86 if ( QApplication::desktop()->height() == 480 ) 86 if ( QApplication::desktop()->height() == 480 )
87 hideButtons(); 87 hideButtons();
88#endif 88#endif
89 89
90 setupGlobalTab(); 90 setupGlobalTab();
91 setupMainTab(); 91 setupMainTab();
92 // setupLocaleTab(); 92 // setupLocaleTab();
93 //setupTimeZoneTab(); 93 //setupTimeZoneTab();
94 setupTimeTab(); 94 setupTimeTab();
95 //setupLocaleDateTab(); 95 //setupLocaleDateTab();
96 setupFontsTab(); 96 setupFontsTab();
97 setupColorsTab(); 97 setupColorsTab();
98 setupViewsTab(); 98 setupViewsTab();
99 //setupSyncTab(); 99 //setupSyncTab();
100 //setupSyncAlgTab(); 100 //setupSyncAlgTab();
101 //setupPrinterTab(); 101 //setupPrinterTab();
102 //setupGroupSchedulingTab(); 102 //setupGroupSchedulingTab();
103 //setupGroupAutomationTab(); 103 //setupGroupAutomationTab();
104 104
105 105
106} 106}
107 107
108 108
109KOPrefsDialog::~KOPrefsDialog() 109KOPrefsDialog::~KOPrefsDialog()
110{ 110{
111} 111}
112void KOPrefsDialog::setupGlobalTab() 112void KOPrefsDialog::setupGlobalTab()
113{ 113{
114 QFrame *topFrame = addPage(i18n("Global"),0,0); 114 QFrame *topFrame = addPage(i18n("Global"),0,0);
115 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 115 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
116 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 116 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
117 topLayout->addWidget( kdelibcfg ); 117 topLayout->addWidget( kdelibcfg );
118 118
119 119
120} 120}
121void KOPrefsDialog::setupLocaleDateTab() 121void KOPrefsDialog::setupLocaleDateTab()
122{ 122{
123#if 0 123#if 0
124QFrame *topFrame = addPage(i18n("Date Format"),0,0); 124QFrame *topFrame = addPage(i18n("Date Format"),0,0);
125 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 125 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
126 topLayout->setSpacing(mSpacingHint); 126 topLayout->setSpacing(mSpacingHint);
127 topLayout->setMargin(mMarginHint); 127 topLayout->setMargin(mMarginHint);
128 int iii = 0; 128 int iii = 0;
129 129
130 130
131 KPrefsDialogWidRadios *syncPrefsGroup = 131 KPrefsDialogWidRadios *syncPrefsGroup =
132 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 132 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
133 QString format; 133 QString format;
134 if ( QApplication::desktop()->width() < 480 ) 134 if ( QApplication::desktop()->width() < 480 )
135 format = "(%d.%m.%Y)"; 135 format = "(%d.%m.%Y)";
136 else 136 else
137 format = "(%d.%m.%Y|%A %d %B %Y)"; 137 format = "(%d.%m.%Y|%A %d %B %Y)";
138 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 138 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
139 if ( QApplication::desktop()->width() < 480 ) 139 if ( QApplication::desktop()->width() < 480 )
140 format = "(%m.%d.%Y)"; 140 format = "(%m.%d.%Y)";
141 else 141 else
142 format = "(%m.%d.%Y|%A %B %d %Y)"; 142 format = "(%m.%d.%Y|%A %B %d %Y)";
143 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 143 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
144 if ( QApplication::desktop()->width() < 480 ) 144 if ( QApplication::desktop()->width() < 480 )
145 format = "(%Y-%m-%d)"; 145 format = "(%Y-%m-%d)";
146 else 146 else
147 format = "(%Y-%m-%d|%A %Y %B %d)"; 147 format = "(%Y-%m-%d|%A %Y %B %d)";
148 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 148 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
149 syncPrefsGroup->addRadio(i18n("User defined")); 149 syncPrefsGroup->addRadio(i18n("User defined"));
150 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 150 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
151 ++iii; 151 ++iii;
152 ++iii; 152 ++iii;
153 QLabel * lab; 153 QLabel * lab;
154 mUserDateFormatLong = new QLineEdit(topFrame); 154 mUserDateFormatLong = new QLineEdit(topFrame);
155 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 155 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
156 topLayout->addWidget(lab ,iii,0); 156 topLayout->addWidget(lab ,iii,0);
157 topLayout->addWidget(mUserDateFormatLong,iii,1); 157 topLayout->addWidget(mUserDateFormatLong,iii,1);
158 ++iii; 158 ++iii;
159 mUserDateFormatShort = new QLineEdit(topFrame); 159 mUserDateFormatShort = new QLineEdit(topFrame);
160 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 160 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
161 topLayout->addWidget(lab ,iii,0); 161 topLayout->addWidget(lab ,iii,0);
162 topLayout->addWidget(mUserDateFormatShort,iii,1); 162 topLayout->addWidget(mUserDateFormatShort,iii,1);
163 ++iii; 163 ++iii;
164 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 164 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
165 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 165 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
166 ++iii; 166 ++iii;
167 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 167 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
168 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 168 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
169 ++iii; 169 ++iii;
170 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 170 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
171 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 171 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
172 ++iii; 172 ++iii;
173#endif 173#endif
174 174
175} 175}
176 176
177void KOPrefsDialog::setupLocaleTab() 177void KOPrefsDialog::setupLocaleTab()
178{ 178{
179#if 0 179#if 0
180 QFrame *topFrame = addPage(i18n("Locale"),0,0); 180 QFrame *topFrame = addPage(i18n("Locale"),0,0);
181 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 181 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
182 topLayout->setSpacing(mSpacingHint); 182 topLayout->setSpacing(mSpacingHint);
183 topLayout->setMargin(mMarginHint); 183 topLayout->setMargin(mMarginHint);
184 int iii = 0; 184 int iii = 0;
185 KPrefsDialogWidRadios *syncPrefsGroup = 185 KPrefsDialogWidRadios *syncPrefsGroup =
186 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 186 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
187 syncPrefsGroup->addRadio(i18n("English")); 187 syncPrefsGroup->addRadio(i18n("English"));
188 syncPrefsGroup->addRadio(i18n("German")); 188 syncPrefsGroup->addRadio(i18n("German"));
189 syncPrefsGroup->addRadio(i18n("French")); 189 syncPrefsGroup->addRadio(i18n("French"));
190 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 190 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
191 if ( QApplication::desktop()->width() < 300 ) 191 if ( QApplication::desktop()->width() < 300 )
192 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 192 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
193 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 193 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
194 ++iii; 194 ++iii;
195 195
196 syncPrefsGroup = 196 syncPrefsGroup =
197 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 197 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
198 if ( QApplication::desktop()->width() > 300 ) 198 if ( QApplication::desktop()->width() > 300 )
199 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 199 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
200 syncPrefsGroup->addRadio(i18n("24:00")); 200 syncPrefsGroup->addRadio(i18n("24:00"));
201 syncPrefsGroup->addRadio(i18n("12:00am")); 201 syncPrefsGroup->addRadio(i18n("12:00am"));
202 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 202 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
203 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 203 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
204 ++iii; 204 ++iii;
205 KPrefsDialogWidBool *sb; 205 KPrefsDialogWidBool *sb;
206 if ( QApplication::desktop()->width() < 300 ) { 206 if ( QApplication::desktop()->width() < 300 ) {
207 sb = 207 sb =
208 addWidBool(i18n("Week starts on Sunday"), 208 addWidBool(i18n("Week starts on Sunday"),
209 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 209 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
211 ++iii; 211 ++iii;
212 sb = 212 sb =
213 addWidBool(i18n("Use short date in (WN/E) view"), 213 addWidBool(i18n("Use short date in (WN/E) view"),
214 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 214 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
215 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 215 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
216 } 216 }
217 else { 217 else {
218 QWidget * hb = new QWidget( topFrame ); 218 QWidget * hb = new QWidget( topFrame );
219 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 219 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
220 sb = 220 sb =
221 addWidBool(i18n("Week starts on Sunday"), 221 addWidBool(i18n("Week starts on Sunday"),
222 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 222 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
223 hbLayout->addWidget(sb->checkBox() ); 223 hbLayout->addWidget(sb->checkBox() );
224 sb = 224 sb =
225 addWidBool(i18n("Use short date in (WN/E) view"), 225 addWidBool(i18n("Use short date in (WN/E) view"),
226 &(KOPrefs::instance()->mShortDateInViewer),hb); 226 &(KOPrefs::instance()->mShortDateInViewer),hb);
227 hbLayout->addWidget(sb->checkBox() ); 227 hbLayout->addWidget(sb->checkBox() );
228 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 228 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
229 229
230 } 230 }
231 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 231 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
232#if 0 232#if 0
233 ++iii; 233 ++iii;
234 sb = 234 sb =
235 addWidBool(i18n("Quick load/save (w/o Unicode)"), 235 addWidBool(i18n("Quick load/save (w/o Unicode)"),
236 &(KOPrefs::instance()->mUseQuicksave),topFrame); 236 &(KOPrefs::instance()->mUseQuicksave),topFrame);
237 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 237 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
238#endif 238#endif
239#endif 239#endif
240} 240}
241void KOPrefsDialog::showSyncPage() 241void KOPrefsDialog::showSyncPage()
242{ 242{
243 showPage ( 0 ) ; 243 showPage ( 0 ) ;
244 kdelibcfg->showTimeZoneTab() ; 244 kdelibcfg->showTimeZoneTab() ;
245 245
246} 246}
247void KOPrefsDialog::setupSyncAlgTab() 247void KOPrefsDialog::setupSyncAlgTab()
248{ 248{
249#if 0 249#if 0
250 QLabel * lab; 250 QLabel * lab;
251 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 251 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
252 mSetupSyncAlgTab = topFrame; 252 mSetupSyncAlgTab = topFrame;
253 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 253 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
254 topLayout->setSpacing(mSpacingHint); 254 topLayout->setSpacing(mSpacingHint);
255 topLayout->setMargin(mMarginHint); 255 topLayout->setMargin(mMarginHint);
256 int iii = 0; 256 int iii = 0;
257 257
258 KPrefsDialogWidBool *sb = 258 KPrefsDialogWidBool *sb =
259 addWidBool(i18n("Ask for preferences before syncing"), 259 addWidBool(i18n("Ask for preferences before syncing"),
260 &(KOPrefs::instance()->mAskForPreferences),topFrame); 260 &(KOPrefs::instance()->mAskForPreferences),topFrame);
261 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 261 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
262 262
263 ++iii; 263 ++iii;
264 264
265 KPrefsDialogWidRadios *syncPrefsGroup = 265 KPrefsDialogWidRadios *syncPrefsGroup =
266 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 266 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
267 topFrame); 267 topFrame);
268 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 268 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
269 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 269 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
270 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 270 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
271 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 271 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
272 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 272 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
273 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 273 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
274 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 274 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
275 ++iii; 275 ++iii;
276 sb = 276 sb =
277 addWidBool(i18n("Show summary after syncing"), 277 addWidBool(i18n("Show summary after syncing"),
278 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 278 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
279 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 279 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
280 280
281 ++iii; 281 ++iii;
282#endif 282#endif
283 283
284 284
285 285
286} 286}
287 287
288 288
289void KOPrefsDialog::setupSyncTab() 289void KOPrefsDialog::setupSyncTab()
290{ 290{
291#if 0 291#if 0
292 QLabel * lab; 292 QLabel * lab;
293 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 293 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
294 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 294 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
295 topLayout->setSpacing(mSpacingHint); 295 topLayout->setSpacing(mSpacingHint);
296 topLayout->setMargin(mMarginHint); 296 topLayout->setMargin(mMarginHint);
297 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 297 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
298 int iii = 0; 298 int iii = 0;
299 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 299 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
300 ++iii; 300 ++iii;
301 301
302 mRemoteIPEdit = new QLineEdit(topFrame); 302 mRemoteIPEdit = new QLineEdit(topFrame);
303 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 303 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
304 topLayout->addWidget(lab ,iii,0); 304 topLayout->addWidget(lab ,iii,0);
305 topLayout->addWidget(mRemoteIPEdit,iii,1); 305 topLayout->addWidget(mRemoteIPEdit,iii,1);
306 ++iii; 306 ++iii;
307 mRemoteUser = new QLineEdit(topFrame); 307 mRemoteUser = new QLineEdit(topFrame);
308 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 308 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
309 topLayout->addWidget(lab ,iii,0); 309 topLayout->addWidget(lab ,iii,0);
310 topLayout->addWidget(mRemoteUser, iii,1); 310 topLayout->addWidget(mRemoteUser, iii,1);
311 ++iii; 311 ++iii;
312 312
313 mRemoteFile = new QLineEdit(topFrame); 313 mRemoteFile = new QLineEdit(topFrame);
314 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 314 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
315 topLayout->addWidget(lab ,iii,0); 315 topLayout->addWidget(lab ,iii,0);
316 topLayout->addWidget(mRemoteFile,iii,1); 316 topLayout->addWidget(mRemoteFile,iii,1);
317 ++iii; 317 ++iii;
318 318
319 mLocalTempFile = new QLineEdit(topFrame); 319 mLocalTempFile = new QLineEdit(topFrame);
320 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 320 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
321 topLayout->addWidget(lab ,iii,0); 321 topLayout->addWidget(lab ,iii,0);
322 topLayout->addWidget(mLocalTempFile,iii,1); 322 topLayout->addWidget(mLocalTempFile,iii,1);
323 ++iii; 323 ++iii;
324 324
325 KPrefsDialogWidBool *wb = 325 KPrefsDialogWidBool *wb =
326 addWidBool(i18n("Write back synced file"), 326 addWidBool(i18n("Write back synced file"),
327 &(KOPrefs::instance()->mWriteBackFile),topFrame); 327 &(KOPrefs::instance()->mWriteBackFile),topFrame);
328 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 328 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
329 ++iii; 329 ++iii;
330 wb = 330 wb =
331 addWidBool(i18n("Write back existing entries only"), 331 addWidBool(i18n("Write back existing entries only"),
332 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 332 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
333 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 333 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
334 ++iii; 334 ++iii;
335 335
336#endif 336#endif
337} 337}
338 338
339void KOPrefsDialog::setupMainTab() 339void KOPrefsDialog::setupMainTab()
340{ 340{
341 QFrame *topFrame = addPage(i18n("General"),0,0); 341 QFrame *topFrame = addPage(i18n("General"),0,0);
342 // DesktopIcon("identity",KIcon::SizeMedium)); 342 // DesktopIcon("identity",KIcon::SizeMedium));
343 343
344 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 344 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
345 topLayout->setSpacing(mSpacingHint); 345 topLayout->setSpacing(mSpacingHint);
346 topLayout->setMargin(mMarginHint); 346 topLayout->setMargin(mMarginHint);
347 347
348 // KPrefsDialogWidBool *emailControlCenter = 348 // KPrefsDialogWidBool *emailControlCenter =
349// addWidBool(i18n("&Use email settings from Control Center"), 349// addWidBool(i18n("&Use email settings from Control Center"),
350// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 350// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
351// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 351// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
352 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 352 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
353 // SLOT(toggleEmailSettings(bool))); 353 // SLOT(toggleEmailSettings(bool)));
354 354
355 mNameEdit = new QLineEdit(topFrame); 355 mNameEdit = new QLineEdit(topFrame);
356 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 356 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
357 topLayout->addWidget(mNameLabel,0,0); 357 topLayout->addWidget(mNameLabel,0,0);
358 topLayout->addWidget(mNameEdit,0,1); 358 topLayout->addWidget(mNameEdit,0,1);
359 359
360 mEmailEdit = new QLineEdit(topFrame); 360 mEmailEdit = new QLineEdit(topFrame);
361 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 361 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
362 topLayout->addWidget(mEmailLabel,1,0); 362 topLayout->addWidget(mEmailLabel,1,0);
363 topLayout->addWidget(mEmailEdit,1,1); 363 topLayout->addWidget(mEmailEdit,1,1);
364 KPrefsDialogWidBool *wb; 364 KPrefsDialogWidBool *wb;
365 365
366 366
367 367
368 KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), 368 KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"),
369 &(KOPrefs::instance()->mShowFullMenu),topFrame); 369 &(KOPrefs::instance()->mShowFullMenu),topFrame);
370 topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); 370 topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1);
371 371
372 372
373 widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), 373 widbool = addWidBool(i18n("Mini icons in toolbar(nr)"),
374 &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); 374 &(KOPrefs::instance()->mToolBarMiniIcons),topFrame);
375 topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); 375 topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1);
376 376
377 377
378 KPrefsDialogWidBool *verticalScreen = 378 KPrefsDialogWidBool *verticalScreen =
379 addWidBool(i18n("Show vertical screen (Needs restart)"), 379 addWidBool(i18n("Show vertical screen (Needs restart)"),
380 &(KOPrefs::instance()->mVerticalScreen),topFrame); 380 &(KOPrefs::instance()->mVerticalScreen),topFrame);
381 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 381 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
382 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); 382 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1);
383 383
384 384
385 int iii = 5; 385 int iii = 5;
386 widbool = addWidBool(i18n("Block popup until mouse button release"), 386 widbool = addWidBool(i18n("Block popup until mouse button release"),
387 &(KOPrefs::instance()->mBlockPopupMenu),topFrame); 387 &(KOPrefs::instance()->mBlockPopupMenu),topFrame);
388 topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1); 388 topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1);
389 ++iii; 389 ++iii;
390 QHBox *dummy = new QHBox(topFrame); 390 QHBox *dummy = new QHBox(topFrame);
391 new QLabel(i18n("Days in Next-X-Days:"),dummy); 391 new QLabel(i18n("Days in Next-X-Days:"),dummy);
392 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 392 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
393 393
394 topLayout->addMultiCellWidget(dummy,iii,iii,0,1); 394 topLayout->addMultiCellWidget(dummy,iii,iii,0,1);
395 395
396 ++iii; 396 ++iii;
397 397
398 398
399 // KPrefsDialogWidBool *bcc = 399 // KPrefsDialogWidBool *bcc =
400// addWidBool(i18n("Send copy to owner when mailing events"), 400// addWidBool(i18n("Send copy to owner when mailing events"),
401// &(KOPrefs::instance()->mBcc),topFrame); 401// &(KOPrefs::instance()->mBcc),topFrame);
402// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 402// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
403 403
404 404
405 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 405 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
406 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 406 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
407 407
408 // addWidBool(i18n("Enable automatic saving of calendar"), 408 // addWidBool(i18n("Enable automatic saving of calendar"),
409 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 409 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
410 410
411 QHBox *intervalBox = new QHBox(topFrame); 411 QHBox *intervalBox = new QHBox(topFrame);
412 // intervalBox->setSpacing(mSpacingHint); 412 // intervalBox->setSpacing(mSpacingHint);
413 topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1); 413 topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1);
414 ++iii; 414 ++iii;
415 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 415 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
416 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 416 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
417 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 417 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
418 /* 418 /*
419 QHBox * agendasize = new QHBox ( topFrame ); 419 QHBox * agendasize = new QHBox ( topFrame );
420 420
421 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 421 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
422 422
423 423
424 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 424 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
425 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 425 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
426 */ 426 */
427 427
428 428
429 KPrefsDialogWidBool *ask = 429 KPrefsDialogWidBool *ask =
430 addWidBool(i18n("Ask for quit when closing KO/Pi"), 430 addWidBool(i18n("Ask for quit when closing KO/Pi"),
431 &(KOPrefs::instance()->mAskForQuit),topFrame); 431 &(KOPrefs::instance()->mAskForQuit),topFrame);
432 topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1); 432 topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1);
433 ++iii; 433 ++iii;
434 434
435 435
436 /* 436 /*
437 KPrefsDialogWidBool *confirmCheck = 437 KPrefsDialogWidBool *confirmCheck =
438 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 438 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
439 topFrame); 439 topFrame);
440 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 440 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
441 441
442 442
443 mEnableGroupScheduling = 443 mEnableGroupScheduling =
444 addWidBool(i18n("Enable group scheduling"), 444 addWidBool(i18n("Enable group scheduling"),
445 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 445 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
446 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 446 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
447 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 447 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
448 SLOT(warningGroupScheduling())); 448 SLOT(warningGroupScheduling()));
449 449
450 mEnableProjectView = 450 mEnableProjectView =
451 addWidBool(i18n("Enable project view"), 451 addWidBool(i18n("Enable project view"),
452 &(KOPrefs::instance()->mEnableProjectView),topFrame); 452 &(KOPrefs::instance()->mEnableProjectView),topFrame);
453 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 453 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
454 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 454 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
455 SLOT(warningProjectView())); 455 SLOT(warningProjectView()));
456 456
457 // Can't be disabled anymore 457 // Can't be disabled anymore
458 mEnableGroupScheduling->checkBox()->hide(); 458 mEnableGroupScheduling->checkBox()->hide();
459 459
460 // Disable setting, because this feature now becomes stable 460 // Disable setting, because this feature now becomes stable
461 mEnableProjectView->checkBox()->hide(); 461 mEnableProjectView->checkBox()->hide();
462 462
463 KPrefsDialogWidRadios *defaultFormatGroup = 463 KPrefsDialogWidRadios *defaultFormatGroup =
464 addWidRadios(i18n("Default Calendar Format"), 464 addWidRadios(i18n("Default Calendar Format"),
465 &(KOPrefs::instance()->mDefaultFormat),topFrame); 465 &(KOPrefs::instance()->mDefaultFormat),topFrame);
466 defaultFormatGroup->addRadio(i18n("vCalendar")); 466 defaultFormatGroup->addRadio(i18n("vCalendar"));
467 defaultFormatGroup->addRadio(i18n("iCalendar")); 467 defaultFormatGroup->addRadio(i18n("iCalendar"));
468 468
469 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 469 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
470 470
471 // Default format unconditionally is iCalendar 471 // Default format unconditionally is iCalendar
472 defaultFormatGroup->groupBox()->hide(); 472 defaultFormatGroup->groupBox()->hide();
473 473
474 KPrefsDialogWidRadios *mailClientGroup = 474 KPrefsDialogWidRadios *mailClientGroup =
475 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 475 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
476 topFrame); 476 topFrame);
477 mailClientGroup->addRadio(i18n("KMail")); 477 mailClientGroup->addRadio(i18n("KMail"));
478 mailClientGroup->addRadio(i18n("Sendmail")); 478 mailClientGroup->addRadio(i18n("Sendmail"));
479 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 479 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
480 480
481 KPrefsDialogWidBool *htmlsave = 481 KPrefsDialogWidBool *htmlsave =
482 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 482 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
483 topFrame); 483 topFrame);
484 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 484 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
485 485
486 KPrefsDialogWidRadios *destinationGroup = 486 KPrefsDialogWidRadios *destinationGroup =
487 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 487 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
488 topFrame); 488 topFrame);
489 destinationGroup->addRadio(i18n("be added to the standard resource")); 489 destinationGroup->addRadio(i18n("be added to the standard resource"));
490 destinationGroup->addRadio(i18n("be asked which resource to use")); 490 destinationGroup->addRadio(i18n("be asked which resource to use"));
491 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 491 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
492 492
493 topLayout->setRowStretch(14,1); 493 topLayout->setRowStretch(14,1);
494 */ 494 */
495} 495}
496 496
497 497
498void KOPrefsDialog::setupTimeTab() 498void KOPrefsDialog::setupTimeTab()
499{ 499{
500 QFrame *topFrame = addPage(i18n("Time"),0,0); 500 QFrame *topFrame = addPage(i18n("Time"),0,0);
501 // DesktopIcon("clock",KIcon::SizeMedium)); 501 // DesktopIcon("clock",KIcon::SizeMedium));
502 502
503 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 503 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
504 topLayout->setSpacing(mSpacingHint); 504 topLayout->setSpacing(mSpacingHint);
505 topLayout->setMargin(mMarginHint); 505 topLayout->setMargin(mMarginHint);
506 506
507 QHBox *dummy = new QHBox(topFrame); 507 QHBox *dummy = new QHBox(topFrame);
508 KPrefsDialogWidTime *dayBegins = 508 KPrefsDialogWidTime *dayBegins =
509 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 509 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
510 dummy); 510 dummy);
511 //topLayout->addWidget(dayBegins->label(),2,0); 511 //topLayout->addWidget(dayBegins->label(),2,0);
512 512
513 //topLayout->addWidget(dayBegins->spinBox(),2,1); 513 //topLayout->addWidget(dayBegins->spinBox(),2,1);
514 topLayout->addMultiCellWidget(dummy,0,0,0,1); 514 topLayout->addMultiCellWidget(dummy,0,0,0,1);
515 515
516 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 516 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
517 topFrame),1,0); 517 topFrame),1,0);
518 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 518 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
519 mStartTimeSpin->setSuffix(":00"); 519 mStartTimeSpin->setSuffix(":00");
520 topLayout->addWidget(mStartTimeSpin,1,1); 520 topLayout->addWidget(mStartTimeSpin,1,1);
521 521
522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
523 topFrame),2,0); 523 topFrame),2,0);
524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
525 mDefaultDurationSpin->setSuffix(":00"); 525 mDefaultDurationSpin->setSuffix(":00");
526 topLayout->addWidget(mDefaultDurationSpin,2,1); 526 topLayout->addWidget(mDefaultDurationSpin,2,1);
527 527
528 QStringList alarmList; 528 QStringList alarmList;
529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
532 3,0); 532 3,0);
533 mAlarmTimeCombo = new QComboBox(topFrame); 533 mAlarmTimeCombo = new QComboBox(topFrame);
534 mAlarmTimeCombo->insertStringList(alarmList); 534 mAlarmTimeCombo->insertStringList(alarmList);
535 topLayout->addWidget(mAlarmTimeCombo,3,1); 535 topLayout->addWidget(mAlarmTimeCombo,3,1);
536 536
537 537
538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
539 i18n("Working Hours"), 539 i18n("Working Hours"),
540 topFrame); 540 topFrame);
541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
542 workingHoursGroup->layout()->setSpacing( 0 ); 542 workingHoursGroup->layout()->setSpacing( 0 );
543 workingHoursGroup->layout()->setMargin( 4 ); 543 workingHoursGroup->layout()->setMargin( 4 );
544 QHBox *workStartBox = new QHBox(workingHoursGroup); 544 QHBox *workStartBox = new QHBox(workingHoursGroup);
545 // workStartBox->setMargin( 0 ); 545 // workStartBox->setMargin( 0 );
546 addWidTime(i18n("Daily starting hour:"), 546 addWidTime(i18n("Daily starting hour:"),
547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
548 548
549 QHBox *workEndBox = new QHBox(workingHoursGroup); 549 QHBox *workEndBox = new QHBox(workingHoursGroup);
550 //workEndBox->setMargin( 0 ); 550 //workEndBox->setMargin( 0 );
551 addWidTime(i18n("Daily ending hour:"), 551 addWidTime(i18n("Daily ending hour:"),
552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
553 QVBox *excludeBox = new QVBox(workingHoursGroup); 553 QVBox *excludeBox = new QVBox(workingHoursGroup);
554 //excludeBox->setMargin( 0 ); 554 //excludeBox->setMargin( 0 );
555 addWidBool(i18n("Exclude holidays"), 555 addWidBool(i18n("Exclude holidays"),
556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
557 557
558 addWidBool(i18n("Exclude Saturdays"), 558 addWidBool(i18n("Exclude Saturdays"),
559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
560 560
561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
563 // topFrame); 563 // topFrame);
564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
565 565
566 // topLayout->setRowStretch(6,1); 566 // topLayout->setRowStretch(6,1);
567} 567}
568 568
569 569
570void KOPrefsDialog::setupViewsTab() 570void KOPrefsDialog::setupViewsTab()
571{ 571{
572 572
573 QFrame *topFrame = addPage(i18n("Views"),0,0); 573 QFrame *topFrame = addPage(i18n("Views"),0,0);
574 // DesktopIcon("viewmag",KIcon::SizeMedium)); 574 // DesktopIcon("viewmag",KIcon::SizeMedium));
575 575
576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
577 topLayout->setSpacing(mSpacingHint); 577 topLayout->setSpacing(mSpacingHint);
578 topLayout->setMargin(mMarginHint); 578 topLayout->setMargin(mMarginHint);
579 579
580// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 580// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
581// topLayout->addLayout(dayBeginsLayout,0,0); 581// topLayout->addLayout(dayBeginsLayout,0,0);
582 582
583// KPrefsDialogWidTime *dayBegins = 583// KPrefsDialogWidTime *dayBegins =
584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
585// topFrame); 585// topFrame);
586// dayBeginsLayout->addWidget(dayBegins->label()); 586// dayBeginsLayout->addWidget(dayBegins->label());
587// dayBeginsLayout->addStretch(1); 587// dayBeginsLayout->addStretch(1);
588// dayBeginsLayout->addWidget(dayBegins->spinBox()); 588// dayBeginsLayout->addWidget(dayBegins->spinBox());
589 589
590// QBoxLayout *nextDaysLayout = new QHBoxLayout; 590// QBoxLayout *nextDaysLayout = new QHBoxLayout;
591// topLayout->addLayout(nextDaysLayout,1,0); 591// topLayout->addLayout(nextDaysLayout,1,0);
592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
594// nextDaysLayout->addStretch(1); 594// nextDaysLayout->addStretch(1);
595// nextDaysLayout->addWidget(mNextXDaysSpin); 595// nextDaysLayout->addWidget(mNextXDaysSpin);
596 596
597 597
598 int ii = 0; 598 int ii = 0;
599 KPrefsDialogWidBool *dummy = 599 KPrefsDialogWidBool *dummy =
600 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 600 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
602 topLayout->addWidget(dummy->checkBox(),ii++,0); 602 topLayout->addWidget(dummy->checkBox(),ii++,0);
603 603
604 604
605 605
606 606
607 607
608 608
609 // topLayout->addWidget(hourSizeGroup,ii++,0); 609 // topLayout->addWidget(hourSizeGroup,ii++,0);
610 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 610 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
611 //topLayout->setRowStretch(11,1); 611 //topLayout->setRowStretch(11,1);
612 612
613 613
614 614
615 615
616#if 0 616#if 0
617 617
618 topFrame = addPage(i18n("ViewChange"),0,0); 618 topFrame = addPage(i18n("ViewChange"),0,0);
619 // DesktopIcon("viewmag",KIcon::SizeMedium)); 619 // DesktopIcon("viewmag",KIcon::SizeMedium));
620 620
621 topLayout = new QGridLayout(topFrame,6,1); 621 topLayout = new QGridLayout(topFrame,6,1);
622 topLayout->setSpacing(mSpacingHint); 622 topLayout->setSpacing(mSpacingHint);
623 topLayout->setMargin(mMarginHint); 623 topLayout->setMargin(mMarginHint);
624 ii = 0; 624 ii = 0;
625 625
626#endif 626#endif
627 627
628 dummy = 628 dummy =
629 addWidBool(i18n("Hold fullscreen on view change"), 629 addWidBool(i18n("Hold fullscreen on view change"),
630 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 630 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
631 topLayout->addWidget(dummy->checkBox(),ii++,0); 631 topLayout->addWidget(dummy->checkBox(),ii++,0);
632 632
633 dummy = 633 dummy =
634 addWidBool(i18n("Hold non-fullscreen on view change"), 634 addWidBool(i18n("Hold non-fullscreen on view change"),
635 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 635 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
636 topLayout->addWidget(dummy->checkBox(),ii++,0); 636 topLayout->addWidget(dummy->checkBox(),ii++,0);
637 637
638 638
639 639
640 KPrefsDialogWidBool *fullViewMonth = 640 KPrefsDialogWidBool *fullViewMonth =
641 addWidBool(i18n("Next days view uses full window"), 641 addWidBool(i18n("Next days view uses full window"),
642 &(KOPrefs::instance()->mFullViewMonth),topFrame); 642 &(KOPrefs::instance()->mFullViewMonth),topFrame);
643 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 643 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
644 644
645 645
646 KPrefsDialogWidBool *fullViewTodo = 646 KPrefsDialogWidBool *fullViewTodo =
647 addWidBool(i18n("Event list view uses full window"), 647 addWidBool(i18n("Event list view uses full window"),
648 &(KOPrefs::instance()->mFullViewTodo),topFrame); 648 &(KOPrefs::instance()->mFullViewTodo),topFrame);
649 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 649 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
650 dummy = 650 dummy =
651 addWidBool(i18n("Listview uses monthly timespan"), 651 addWidBool(i18n("Listview uses monthly timespan"),
652 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 652 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
653 topLayout->addWidget(dummy->checkBox(),ii++,0); 653 topLayout->addWidget(dummy->checkBox(),ii++,0);
654 dummy = 654 dummy =
655 addWidBool(i18n("Highlight selection in Time Edit"), 655 addWidBool(i18n("Highlight selection in Time Edit"),
656 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 656 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
657 topLayout->addWidget( dummy->checkBox(), ii++,0); 657 topLayout->addWidget( dummy->checkBox(), ii++,0);
658 658
659 KPrefsDialogWidBool *dailyRecur = 659 KPrefsDialogWidBool *dailyRecur =
660 addWidBool(i18n("Show events that recur daily in date nav."), 660 addWidBool(i18n("Show events that recur daily in date nav."),
661 &(KOPrefs::instance()->mDailyRecur),topFrame); 661 &(KOPrefs::instance()->mDailyRecur),topFrame);
662 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 662 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
663 663
664 KPrefsDialogWidBool *weeklyRecur = 664 KPrefsDialogWidBool *weeklyRecur =
665 addWidBool(i18n("Show ev. that recur weekly in date nav."), 665 addWidBool(i18n("Show ev. that recur weekly in date nav."),
666 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 666 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
667 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 667 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
668 668
669#ifdef DESKTOP_VERSION 669#ifdef DESKTOP_VERSION
670 KPrefsDialogWidBool *enableToolTips = 670 KPrefsDialogWidBool *enableToolTips =
671 addWidBool(i18n("Enable tooltips displaying summary of ev."), 671 addWidBool(i18n("Enable tooltips displaying summary of ev."),
672 &(KOPrefs::instance()->mEnableToolTips),topFrame); 672 &(KOPrefs::instance()->mEnableToolTips),topFrame);
673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
674#endif 674#endif
675 // ********************************************************* 675 // *********************************************************
676 676
677 topFrame = addPage(i18n("Agenda View"),0,0); 677 topFrame = addPage(i18n("Agenda View"),0,0);
678 // DesktopIcon("viewmag",KIcon::SizeMedium)); 678 // DesktopIcon("viewmag",KIcon::SizeMedium));
679 679
680 topLayout = new QGridLayout(topFrame,5,1); 680 topLayout = new QGridLayout(topFrame,5,1);
681 topLayout->setSpacing(mSpacingHint); 681 topLayout->setSpacing(mSpacingHint);
682 topLayout->setMargin(mMarginHint); 682 topLayout->setMargin(mMarginHint);
683 ii = 0; 683 ii = 0;
684 684
685 685
686 dummy = 686 dummy =
687 addWidBool(i18n("Show time in agenda items"), 687 addWidBool(i18n("Show time in agenda items"),
688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
689 topLayout->addWidget(dummy->checkBox(),ii++,0); 689 topLayout->addWidget(dummy->checkBox(),ii++,0);
690 690
691 dummy = 691 dummy =
692 addWidBool(i18n("Highlight current day in agenda"), 692 addWidBool(i18n("Highlight current day in agenda"),
693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
694 topLayout->addWidget(dummy->checkBox(),ii++,0); 694 topLayout->addWidget(dummy->checkBox(),ii++,0);
695 695
696 dummy = 696 dummy =
697 addWidBool(i18n("Use light color for highlight current day"), 697 addWidBool(i18n("Use light color for highlight current day"),
698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
699 topLayout->addWidget(dummy->checkBox(),ii++,0); 699 topLayout->addWidget(dummy->checkBox(),ii++,0);
700 700
701 701
702 KPrefsDialogWidBool *marcusBainsEnabled = 702 KPrefsDialogWidBool *marcusBainsEnabled =
703 addWidBool(i18n("Show current time"), 703 addWidBool(i18n("Show current time"),
704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
706 706
707 707
708 dummy = 708 dummy =
709 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 709 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
711 topLayout->addWidget(dummy->checkBox(),ii++,0); 711 topLayout->addWidget(dummy->checkBox(),ii++,0);
712 712
713 dummy = 713 dummy =
714 addWidBool(i18n("Set agenda to current time on change"), 714 addWidBool(i18n("Set agenda to current time on change"),
715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
716 topLayout->addWidget(dummy->checkBox(),ii++,0); 716 topLayout->addWidget(dummy->checkBox(),ii++,0);
717 717
718 718
719 719
720 720
721 721
722 722
723 723
724 topFrame = addPage(i18n("Month View"),0,0); 724 topFrame = addPage(i18n("Month View"),0,0);
725 // DesktopIcon("viewmag",KIcon::SizeMedium)); 725 // DesktopIcon("viewmag",KIcon::SizeMedium));
726 726
727 topLayout = new QGridLayout(topFrame,5,1); 727 topLayout = new QGridLayout(topFrame,5,1);
728 topLayout->setSpacing(mSpacingHint); 728 topLayout->setSpacing(mSpacingHint);
729 topLayout->setMargin(mMarginHint); 729 topLayout->setMargin(mMarginHint);
730 ii = 0; 730 ii = 0;
731 QLabel *lab; 731 QLabel *lab;
732 QHBox *habo = new QHBox( topFrame ); 732 QHBox *habo = new QHBox( topFrame );
733 if ( QApplication::desktop()->width() <= 480 ) { 733 if ( QApplication::desktop()->width() <= 480 ) {
734 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 734 lab = new QLabel ( i18n("Show events that recur "), topFrame );
735 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 735 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
736 ii++; 736 ii++;
737 } else { 737 } else {
738 new QLabel ( i18n("Show events that recur "), habo ); 738 new QLabel ( i18n("Show events that recur "), habo );
739 } 739 }
740 dailyRecur = 740 dailyRecur =
741 addWidBool(i18n("daily"), 741 addWidBool(i18n("daily"),
742 &(KOPrefs::instance()->mMonthDailyRecur),habo); 742 &(KOPrefs::instance()->mMonthDailyRecur),habo);
743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
744 744
745 weeklyRecur = 745 weeklyRecur =
746 addWidBool(i18n("weekly"), 746 addWidBool(i18n("weekly"),
747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
748 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 748 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
749 ii++; 749 ii++;
750 750
751 751
752 habo = new QHBox( topFrame ); 752 habo = new QHBox( topFrame );
753 if ( QApplication::desktop()->width() <= 480 ) { 753 if ( QApplication::desktop()->width() <= 480 ) {
754 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 754 lab = new QLabel (i18n("Show in every cell ") , topFrame );
755 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 755 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
756 ii++; 756 ii++;
757 757
758 } else { 758 } else {
759 new QLabel ( i18n("Show in every cell "), habo ); 759 new QLabel ( i18n("Show in every cell "), habo );
760 } 760 }
761 weeklyRecur = 761 weeklyRecur =
762 addWidBool(i18n("short month"), 762 addWidBool(i18n("short month"),
763 &(KOPrefs::instance()->mMonthShowShort),habo); 763 &(KOPrefs::instance()->mMonthShowShort),habo);
764 weeklyRecur = 764 weeklyRecur =
765 addWidBool(i18n("icons"), 765 addWidBool(i18n("icons"),
766 &(KOPrefs::instance()->mMonthShowIcons),habo); 766 &(KOPrefs::instance()->mMonthShowIcons),habo);
767 weeklyRecur = 767 weeklyRecur =
768 addWidBool(i18n("times"), 768 addWidBool(i18n("times"),
769 &(KOPrefs::instance()->mMonthShowTimes),habo); 769 &(KOPrefs::instance()->mMonthShowTimes),habo);
770 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 770 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
771 ii++; 771 ii++;
772#ifdef DESKTOP_VERSION 772#ifdef DESKTOP_VERSION
773 KPrefsDialogWidBool *enableMonthScroll = 773 KPrefsDialogWidBool *enableMonthScroll =
774 addWidBool(i18n("Enable scrollbars in month view cells"), 774 addWidBool(i18n("Enable scrollbars in month view cells"),
775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
777#endif 777#endif
778 dummy = 778 dummy =
779 addWidBool(i18n("Week view mode uses bigger font"), 779 addWidBool(i18n("Week view mode uses bigger font"),
780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
781 topLayout->addWidget(dummy->checkBox(),ii++,0); 781 topLayout->addWidget(dummy->checkBox(),ii++,0);
782 dummy = 782 dummy =
783 addWidBool(i18n("Show Sat/Sun together"), 783 addWidBool(i18n("Show Sat/Sun together"),
784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
785 topLayout->addWidget(dummy->checkBox(),ii++,0); 785 topLayout->addWidget(dummy->checkBox(),ii++,0);
786 786
787 KPrefsDialogWidBool *coloredCategoriesInMonthView = 787 KPrefsDialogWidBool *coloredCategoriesInMonthView =
788 addWidBool(i18n("Month view uses category colors"), 788 addWidBool(i18n("Month view uses category colors"),
789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
791 791
792 dummy = 792 dummy =
793 addWidBool(i18n("Categorie colors are applied to text"), 793 addWidBool(i18n("Categorie colors are applied to text"),
794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
795 topLayout->addWidget(dummy->checkBox(),ii++,0); 795 topLayout->addWidget(dummy->checkBox(),ii++,0);
796 coloredCategoriesInMonthView = 796 coloredCategoriesInMonthView =
797 addWidBool(i18n("Month view uses day colors"), 797 addWidBool(i18n("Month view uses day colors"),
798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
800 800
801 KPrefsDialogWidColor *holidayColor = 801 KPrefsDialogWidColor *holidayColor =
802 addWidColor(i18n("Day color odd months"), 802 addWidColor(i18n("Day color odd months"),
803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
804 topLayout->addWidget(holidayColor->label(),ii,0); 804 topLayout->addWidget(holidayColor->label(),ii,0);
805 topLayout->addWidget(holidayColor->button(),ii++,1); 805 topLayout->addWidget(holidayColor->button(),ii++,1);
806 806
807 holidayColor = 807 holidayColor =
808 addWidColor(i18n("Day color even months"), 808 addWidColor(i18n("Day color even months"),
809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
810 topLayout->addWidget(holidayColor->label(),ii,0); 810 topLayout->addWidget(holidayColor->label(),ii,0);
811 topLayout->addWidget(holidayColor->button(),ii++,1); 811 topLayout->addWidget(holidayColor->button(),ii++,1);
812 812
813 813
814 holidayColor = 814 holidayColor =
815 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 815 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
817 topLayout->addWidget(holidayColor->label(),ii,0); 817 topLayout->addWidget(holidayColor->label(),ii,0);
818 topLayout->addWidget(holidayColor->button(),ii++,1); 818 topLayout->addWidget(holidayColor->button(),ii++,1);
819 // *********************** What'sNext View 819 // *********************** What'sNext View
820 topFrame = addPage(i18n("What's Next View"),0,0); 820 topFrame = addPage(i18n("What's Next View"),0,0);
821 // DesktopIcon("viewmag",KIcon::SizeMedium)); 821 // DesktopIcon("viewmag",KIcon::SizeMedium));
822 822
823 topLayout = new QGridLayout(topFrame,4,1); 823 topLayout = new QGridLayout(topFrame,4,1);
824 topLayout->setSpacing(mSpacingHint); 824 topLayout->setSpacing(mSpacingHint);
825 topLayout->setMargin(mMarginHint); 825 topLayout->setMargin(mMarginHint);
826 ii = 0; 826 ii = 0;
827 827
828 828
829 QHBox* hdummy = new QHBox(topFrame); 829 QHBox* hdummy = new QHBox(topFrame);
830 new QLabel(i18n("Days in What's Next:"),hdummy); 830 new QLabel(i18n("Days in What's Next:"),hdummy);
831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
832 832
833 topLayout->addWidget(hdummy,ii++,0); 833 topLayout->addWidget(hdummy,ii++,0);
834 834
835 QHBox *prioBox = new QHBox(topFrame); 835 QHBox *prioBox = new QHBox(topFrame);
836 // intervalBox->setSpacing(mSpacingHint); 836 // intervalBox->setSpacing(mSpacingHint);
837 topLayout->addWidget(prioBox,ii++,0); 837 topLayout->addWidget(prioBox,ii++,0);
838 838
839 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); 839 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
840 mPrioSpin = new QSpinBox(0,5,1,prioBox); 840 mPrioSpin = new QSpinBox(0,5,1,prioBox);
841 if ( QApplication::desktop()->width() < 300 ) 841 if ( QApplication::desktop()->width() < 300 )
842 mPrioSpin->setFixedWidth( 40 ); 842 mPrioSpin->setFixedWidth( 40 );
843 843
844 KPrefsDialogWidBool *passwdk = 844 KPrefsDialogWidBool *passwdk =
845 845
846 addWidBool(i18n("Show events, that are done"), 846 addWidBool(i18n("Show events, that are done"),
847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
848 topLayout->addWidget(passwdk->checkBox(), ii++,0); 848 topLayout->addWidget(passwdk->checkBox(), ii++,0);
849 passwdk = 849 passwdk =
850 addWidBool(i18n("Show parent To-Do's"), 850 addWidBool(i18n("Show parent To-Do's"),
851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
852 topLayout->addWidget(passwdk->checkBox(), ii++,0); 852 topLayout->addWidget(passwdk->checkBox(), ii++,0);
853 853
854 passwdk = 854 passwdk =
855 addWidBool(i18n("Show location"), 855 addWidBool(i18n("Show location"),
856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
857 topLayout->addWidget(passwdk->checkBox(), ii++,0); 857 topLayout->addWidget(passwdk->checkBox(), ii++,0);
858 858
859 passwdk = 859
860 addWidBool(i18n("Show Sync Events in WN+Agenda"),
861 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
862 topLayout->addWidget(passwdk->checkBox(), ii++,0);
863 passwdk = 860 passwdk =
864 addWidBool(i18n("Use short date in WN+Event view"), 861 addWidBool(i18n("Use short date in WN+Event view"),
865 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 862 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
866 topLayout->addWidget(passwdk->checkBox(), ii++,0); 863 topLayout->addWidget(passwdk->checkBox(), ii++,0);
867 864
868 865
869 866
870 867
871 // *********************** Todo View 868 // *********************** Todo View
872 869
873 topFrame = addPage(i18n("Todo View"),0,0); 870 topFrame = addPage(i18n("Todo View"),0,0);
874 // DesktopIcon("viewmag",KIcon::SizeMedium)); 871 // DesktopIcon("viewmag",KIcon::SizeMedium));
875 872
876 topLayout = new QGridLayout(topFrame,4,1); 873 topLayout = new QGridLayout(topFrame,4,1);
877 topLayout->setSpacing(mSpacingHint); 874 topLayout->setSpacing(mSpacingHint);
878 topLayout->setMargin(mMarginHint); 875 topLayout->setMargin(mMarginHint);
879 ii = 0; 876 ii = 0;
880dummy = 877dummy =
881 addWidBool(i18n("Hide not running Todos in To-do view"), 878 addWidBool(i18n("Hide not running Todos in To-do view"),
882 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 879 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
883 topLayout->addWidget(dummy->checkBox(),ii++,0); 880 topLayout->addWidget(dummy->checkBox(),ii++,0);
884 881
885 882
886 KPrefsDialogWidBool *showCompletedTodo = 883 KPrefsDialogWidBool *showCompletedTodo =
887 addWidBool(i18n("To-do view shows completed Todos"), 884 addWidBool(i18n("To-do view shows completed Todos"),
888 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 885 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
889 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 886 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
890 dummy = 887 dummy =
891 addWidBool(i18n("To-do view shows complete as 'xx %'"), 888 addWidBool(i18n("To-do view shows complete as 'xx %'"),
892 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 889 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
893 topLayout->addWidget(dummy->checkBox(),ii++,0); 890 topLayout->addWidget(dummy->checkBox(),ii++,0);
894 891
895 dummy = 892 dummy =
896 addWidBool(i18n("Small To-do view uses smaller font"), 893 addWidBool(i18n("Small To-do view uses smaller font"),
897 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 894 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
898 topLayout->addWidget(dummy->checkBox(),ii++,0); 895 topLayout->addWidget(dummy->checkBox(),ii++,0);
899 896
900 897
901 898
902 dummy = 899 dummy =
903 addWidBool(i18n("Todo view uses category colors"), 900 addWidBool(i18n("Todo view uses category colors"),
904 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 901 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
905 topLayout->addWidget(dummy->checkBox(),ii++,0); 902 topLayout->addWidget(dummy->checkBox(),ii++,0);
906 903
907 904
908 QWidget* wid = new QWidget( topFrame ); 905 QWidget* wid = new QWidget( topFrame );
909 // Todo run today color 906 // Todo run today color
910 KPrefsDialogWidColor *todoRunColor = 907 KPrefsDialogWidColor *todoRunColor =
911 addWidColor(i18n("Color for running todos:"), 908 addWidColor(i18n("Color for running todos:"),
912 &(KOPrefs::instance()->mTodoRunColor),wid); 909 &(KOPrefs::instance()->mTodoRunColor),wid);
913 QHBoxLayout *widLayout = new QHBoxLayout(wid); 910 QHBoxLayout *widLayout = new QHBoxLayout(wid);
914 widLayout->addWidget( todoRunColor->label() ); 911 widLayout->addWidget( todoRunColor->label() );
915 widLayout->addWidget( todoRunColor->button() ); 912 widLayout->addWidget( todoRunColor->button() );
916 topLayout->addWidget(wid,ii++,0); 913 topLayout->addWidget(wid,ii++,0);
917 914
918 wid = new QWidget( topFrame ); 915 wid = new QWidget( topFrame );
919 // Todo due today color 916 // Todo due today color
920 KPrefsDialogWidColor *todoDueTodayColor = 917 KPrefsDialogWidColor *todoDueTodayColor =
921 addWidColor(i18n("Todo due today color:"), 918 addWidColor(i18n("Todo due today color:"),
922 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 919 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
923 widLayout = new QHBoxLayout(wid); 920 widLayout = new QHBoxLayout(wid);
924 widLayout->addWidget( todoDueTodayColor->label() ); 921 widLayout->addWidget( todoDueTodayColor->label() );
925 widLayout->addWidget( todoDueTodayColor->button() ); 922 widLayout->addWidget( todoDueTodayColor->button() );
926 topLayout->addWidget(wid,ii++,0); 923 topLayout->addWidget(wid,ii++,0);
927 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 924 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
928 925
929 // Todo overdue color 926 // Todo overdue color
930 wid = new QWidget( topFrame ); 927 wid = new QWidget( topFrame );
931 widLayout = new QHBoxLayout(wid); 928 widLayout = new QHBoxLayout(wid);
932 KPrefsDialogWidColor *todoOverdueColor = 929 KPrefsDialogWidColor *todoOverdueColor =
933 addWidColor(i18n("Todo overdue color:"), 930 addWidColor(i18n("Todo overdue color:"),
934 &(KOPrefs::instance()->mTodoOverdueColor),wid); 931 &(KOPrefs::instance()->mTodoOverdueColor),wid);
935 widLayout->addWidget(todoOverdueColor->label()); 932 widLayout->addWidget(todoOverdueColor->label());
936 widLayout->addWidget(todoOverdueColor->button()); 933 widLayout->addWidget(todoOverdueColor->button());
937 topLayout->addWidget(wid,ii++,0); 934 topLayout->addWidget(wid,ii++,0);
938 935
939 dummy = 936 dummy =
940 addWidBool(i18n("Colors are applied to text"), 937 addWidBool(i18n("Colors are applied to text"),
941 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 938 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
942 topLayout->addWidget(dummy->checkBox(),ii++,0); 939 topLayout->addWidget(dummy->checkBox(),ii++,0);
943 940
944 dummy = 941 dummy =
945 addWidBool(i18n("Allday Agenda view shows todos"), 942 addWidBool(i18n("Allday Agenda view shows todos"),
946 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 943 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
947 topLayout->addWidget(dummy->checkBox(),ii++,0); 944 topLayout->addWidget(dummy->checkBox(),ii++,0);
948 945
949 946
950 topFrame = addPage(i18n("View Options"),0,0); 947 topFrame = addPage(i18n("View Options"),0,0);
951 948
952 topLayout = new QGridLayout(topFrame,4,1); 949 topLayout = new QGridLayout(topFrame,4,1);
953 topLayout->setSpacing(mSpacingHint); 950 topLayout->setSpacing(mSpacingHint);
954 topLayout->setMargin(mMarginHint); 951 topLayout->setMargin(mMarginHint);
955 ii = 0; 952 ii = 0;
953
954 dummy =
955 addWidBool(i18n("Show Sync Events"),
956 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
957 topLayout->addWidget(dummy->checkBox(), ii++,0);
958
956 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 959 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
957 topLayout->addWidget(lab ,ii++,0); 960 topLayout->addWidget(lab ,ii++,0);
958 961
959 dummy = addWidBool(i18n("Details"), 962 dummy = addWidBool(i18n("Details"),
960 &(KOPrefs::instance()->mEVshowDetails),topFrame); 963 &(KOPrefs::instance()->mEVshowDetails),topFrame);
961 topLayout->addWidget(dummy->checkBox(),ii++,0); 964 topLayout->addWidget(dummy->checkBox(),ii++,0);
962 dummy = addWidBool(i18n("Created time"), 965 dummy = addWidBool(i18n("Created time"),
963 &(KOPrefs::instance()->mEVshowCreated),topFrame); 966 &(KOPrefs::instance()->mEVshowCreated),topFrame);
964 topLayout->addWidget(dummy->checkBox(),ii++,0); 967 topLayout->addWidget(dummy->checkBox(),ii++,0);
965 dummy = addWidBool(i18n("Last modified time"), 968 dummy = addWidBool(i18n("Last modified time"),
966 &(KOPrefs::instance()->mEVshowChanged),topFrame); 969 &(KOPrefs::instance()->mEVshowChanged),topFrame);
967 topLayout->addWidget(dummy->checkBox(),ii++,0); 970 topLayout->addWidget(dummy->checkBox(),ii++,0);
968 971
969 972
970 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 973 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
971 topLayout->addWidget(lab ,ii++,0); 974 topLayout->addWidget(lab ,ii++,0);
972 975
973 dummy = addWidBool(i18n("Details"), 976 dummy = addWidBool(i18n("Details"),
974 &(KOPrefs::instance()->mWTshowDetails),topFrame); 977 &(KOPrefs::instance()->mWTshowDetails),topFrame);
975 topLayout->addWidget(dummy->checkBox(),ii++,0); 978 topLayout->addWidget(dummy->checkBox(),ii++,0);
976 dummy = addWidBool(i18n("Created time"), 979 dummy = addWidBool(i18n("Created time"),
977 &(KOPrefs::instance()->mWTshowCreated),topFrame); 980 &(KOPrefs::instance()->mWTshowCreated),topFrame);
978 topLayout->addWidget(dummy->checkBox(),ii++,0); 981 topLayout->addWidget(dummy->checkBox(),ii++,0);
979 dummy = addWidBool(i18n("Last modified time"), 982 dummy = addWidBool(i18n("Last modified time"),
980 &(KOPrefs::instance()->mWTshowChanged),topFrame); 983 &(KOPrefs::instance()->mWTshowChanged),topFrame);
981 topLayout->addWidget(dummy->checkBox(),ii++,0); 984 topLayout->addWidget(dummy->checkBox(),ii++,0);
982 985
983 986
984 topFrame = addPage(i18n("Alarm"),0,0); 987 topFrame = addPage(i18n("Alarm"),0,0);
985 // DesktopIcon("viewmag",KIcon::SizeMedium)); 988 // DesktopIcon("viewmag",KIcon::SizeMedium));
986 989
987 topLayout = new QGridLayout(topFrame,2,1); 990 topLayout = new QGridLayout(topFrame,2,1);
988 topLayout->setSpacing(mSpacingHint); 991 topLayout->setSpacing(mSpacingHint);
989 topLayout->setMargin(mMarginHint); 992 topLayout->setMargin(mMarginHint);
990 int iii = 0; 993 int iii = 0;
991 994
992 dummy = 995 dummy =
993 addWidBool(i18n("Use internal alarm notification"), 996 addWidBool(i18n("Use internal alarm notification"),
994 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 997 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
995 topLayout->addWidget(dummy->checkBox(),iii++,0); 998 topLayout->addWidget(dummy->checkBox(),iii++,0);
996 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 999 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
997 1000
998 topLayout->addWidget(lab ,iii++,0); 1001 topLayout->addWidget(lab ,iii++,0);
999#ifndef DESKTOP_VERSION 1002#ifndef DESKTOP_VERSION
1000 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1003 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1001#else 1004#else
1002 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1005 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1003 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1006 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1004#endif 1007#endif
1005 1008
1006 QHBox* dummyBox = new QHBox(topFrame); 1009 QHBox* dummyBox = new QHBox(topFrame);
1007 new QLabel(i18n("Play beeps count:"),dummyBox); 1010 new QLabel(i18n("Play beeps count:"),dummyBox);
1008 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 1011 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
1009 topLayout->addWidget(dummyBox,iii++,0); 1012 topLayout->addWidget(dummyBox,iii++,0);
1010 1013
1011 dummyBox = new QHBox(topFrame); 1014 dummyBox = new QHBox(topFrame);
1012 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 1015 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
1013 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 1016 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
1014 topLayout->addWidget(dummyBox,iii++,0); 1017 topLayout->addWidget(dummyBox,iii++,0);
1015 1018
1016 dummyBox = new QHBox(topFrame); 1019 dummyBox = new QHBox(topFrame);
1017 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1020 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1018 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1021 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1019 topLayout->addWidget(dummyBox,iii++,0); 1022 topLayout->addWidget(dummyBox,iii++,0);
1020 1023
1021 dummyBox = new QHBox(topFrame); 1024 dummyBox = new QHBox(topFrame);
1022 new QLabel(i18n("Auto suspend count:"),dummyBox); 1025 new QLabel(i18n("Auto suspend count:"),dummyBox);
1023 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1026 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1024 topLayout->addWidget(dummyBox,iii++,0); 1027 topLayout->addWidget(dummyBox,iii++,0);
1025 1028
1026 1029
1027 1030
1028 1031
1029 1032
1030 1033
1031 1034
1032 QHBox* hbo = new QHBox ( topFrame ); 1035 QHBox* hbo = new QHBox ( topFrame );
1033 mDefaultAlarmFile = new QLineEdit(hbo); 1036 mDefaultAlarmFile = new QLineEdit(hbo);
1034 QPushButton * loadTemplate = new QPushButton(hbo); 1037 QPushButton * loadTemplate = new QPushButton(hbo);
1035 QPixmap icon; 1038 QPixmap icon;
1036 if ( QApplication::desktop()->width() < 321 ) 1039 if ( QApplication::desktop()->width() < 321 )
1037 icon = SmallIcon("fileimport16"); 1040 icon = SmallIcon("fileimport16");
1038 else 1041 else
1039 icon = SmallIcon("fileimport"); 1042 icon = SmallIcon("fileimport");
1040 loadTemplate->setIconSet (icon ) ; 1043 loadTemplate->setIconSet (icon ) ;
1041 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1044 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1042 int size = loadTemplate->sizeHint().height(); 1045 int size = loadTemplate->sizeHint().height();
1043 loadTemplate->setFixedSize( size, size ); 1046 loadTemplate->setFixedSize( size, size );
1044 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1047 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1045 // topLayout->addWidget(lab ,iii++,0); 1048 // topLayout->addWidget(lab ,iii++,0);
1046 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1049 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1047 topLayout->addWidget(lab ,iii++,0); 1050 topLayout->addWidget(lab ,iii++,0);
1048 topLayout->addWidget(hbo,iii++,0); 1051 topLayout->addWidget(hbo,iii++,0);
1049 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 1052 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
1050 1053
1051// topLayout->addWidget(lab ,iii++,0); 1054// topLayout->addWidget(lab ,iii++,0);
1052// #ifndef DESKTOP_VERSION 1055// #ifndef DESKTOP_VERSION
1053// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1056// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1054// #else 1057// #else
1055// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1058// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1056// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1059// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1057// #endif 1060// #endif
1058 1061
1059 1062
1060} 1063}
1061 1064
1062void KOPrefsDialog::selectSoundFile() 1065void KOPrefsDialog::selectSoundFile()
1063{ 1066{
1064 QString fileName = mDefaultAlarmFile->text(); 1067 QString fileName = mDefaultAlarmFile->text();
1065 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1068 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1066 if ( fileName.length() > 0 ) 1069 if ( fileName.length() > 0 )
1067 mDefaultAlarmFile->setText( fileName ); 1070 mDefaultAlarmFile->setText( fileName );
1068} 1071}
1069void KOPrefsDialog::setupFontsTab() 1072void KOPrefsDialog::setupFontsTab()
1070{ 1073{
1071 1074
1072 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1075 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1073 // DesktopIcon("fonts",KIcon::SizeMedium)); 1076 // DesktopIcon("fonts",KIcon::SizeMedium));
1074 1077
1075 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1078 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1076 topLayout->setSpacing(1); 1079 topLayout->setSpacing(1);
1077 topLayout->setMargin(3); 1080 topLayout->setMargin(3);
1078 KPrefsDialogWidFont * tVFont; 1081 KPrefsDialogWidFont * tVFont;
1079 int i = 0; 1082 int i = 0;
1080 KPrefsDialogWidFont *timeLabelsFont = 1083 KPrefsDialogWidFont *timeLabelsFont =
1081 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1084 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1082 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1085 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1083 topLayout->addWidget(timeLabelsFont->label(),i,0); 1086 topLayout->addWidget(timeLabelsFont->label(),i,0);
1084 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1087 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1085 topLayout->addWidget(timeLabelsFont->button(),i,2); 1088 topLayout->addWidget(timeLabelsFont->button(),i,2);
1086 ++i; 1089 ++i;
1087 1090
1088 1091
1089 timeLabelsFont = 1092 timeLabelsFont =
1090 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1093 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1091 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1094 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1092 topLayout->addWidget(timeLabelsFont->label(),i,0); 1095 topLayout->addWidget(timeLabelsFont->label(),i,0);
1093 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1096 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1094 topLayout->addWidget(timeLabelsFont->button(),i,2); 1097 topLayout->addWidget(timeLabelsFont->button(),i,2);
1095 ++i; 1098 ++i;
1096 1099
1097 KPrefsDialogWidFont *timeBarFont = 1100 KPrefsDialogWidFont *timeBarFont =
1098 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1101 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1099 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1102 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1100 topLayout->addWidget(timeBarFont->label(),i,0); 1103 topLayout->addWidget(timeBarFont->label(),i,0);
1101 topLayout->addWidget(timeBarFont->preview(),i,1); 1104 topLayout->addWidget(timeBarFont->preview(),i,1);
1102 topLayout->addWidget(timeBarFont->button(),i,2); 1105 topLayout->addWidget(timeBarFont->button(),i,2);
1103 ++i; 1106 ++i;
1104 1107
1105 1108
1106 KPrefsDialogWidFont *marcusBainsFont = 1109 KPrefsDialogWidFont *marcusBainsFont =
1107 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1110 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1108 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1111 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1109 topLayout->addWidget(marcusBainsFont->label(),i,0); 1112 topLayout->addWidget(marcusBainsFont->label(),i,0);
1110 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1113 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1111 topLayout->addWidget(marcusBainsFont->button(),i,2); 1114 topLayout->addWidget(marcusBainsFont->button(),i,2);
1112 ++i; 1115 ++i;
1113 1116
1114 tVFont = 1117 tVFont =
1115 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1118 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1116 &(KOPrefs::instance()->mEventViewFont),topFrame); 1119 &(KOPrefs::instance()->mEventViewFont),topFrame);
1117 topLayout->addWidget(tVFont->label(),i,0); 1120 topLayout->addWidget(tVFont->label(),i,0);
1118 topLayout->addWidget(tVFont->preview(),i,1); 1121 topLayout->addWidget(tVFont->preview(),i,1);
1119 topLayout->addWidget(tVFont->button(),i,2); 1122 topLayout->addWidget(tVFont->button(),i,2);
1120 ++i; 1123 ++i;
1121 1124
1122 1125
1123 1126
1124 tVFont = 1127 tVFont =
1125 addWidFont(i18n("Details"),i18n("EditorBox:"), 1128 addWidFont(i18n("Details"),i18n("EditorBox:"),
1126 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1129 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1127 topLayout->addWidget(tVFont->label(),i,0); 1130 topLayout->addWidget(tVFont->label(),i,0);
1128 topLayout->addWidget(tVFont->preview(),i,1); 1131 topLayout->addWidget(tVFont->preview(),i,1);
1129 topLayout->addWidget(tVFont->button(),i,2); 1132 topLayout->addWidget(tVFont->button(),i,2);
1130 ++i; 1133 ++i;
1131 1134
1132 1135
1133 1136
1134 topLayout->setColStretch(1,1); 1137 topLayout->setColStretch(1,1);
1135 topLayout->setRowStretch(4,1); 1138 topLayout->setRowStretch(4,1);
1136 1139
1137 1140
1138 i = 0; 1141 i = 0;
1139 topFrame = addPage(i18n("View Fonts"),0, 1142 topFrame = addPage(i18n("View Fonts"),0,
1140 DesktopIcon("fonts",KIcon::SizeMedium)); 1143 DesktopIcon("fonts",KIcon::SizeMedium));
1141 1144
1142 topLayout = new QGridLayout(topFrame,7,3); 1145 topLayout = new QGridLayout(topFrame,7,3);
1143 topLayout->setSpacing(1); 1146 topLayout->setSpacing(1);
1144 topLayout->setMargin(3); 1147 topLayout->setMargin(3);
1145 1148
1146 tVFont = 1149 tVFont =
1147 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1150 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1148 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1151 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1149 topLayout->addWidget(tVFont->label(),i,0); 1152 topLayout->addWidget(tVFont->label(),i,0);
1150 topLayout->addWidget(tVFont->preview(),i,1); 1153 topLayout->addWidget(tVFont->preview(),i,1);
1151 topLayout->addWidget(tVFont->button(),i,2); 1154 topLayout->addWidget(tVFont->button(),i,2);
1152 ++i; 1155 ++i;
1153 KPrefsDialogWidFont *agendaViewFont = 1156 KPrefsDialogWidFont *agendaViewFont =
1154 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1157 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1155 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1158 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1156 topLayout->addWidget(agendaViewFont->label(),i,0); 1159 topLayout->addWidget(agendaViewFont->label(),i,0);
1157 topLayout->addWidget(agendaViewFont->preview(),i,1); 1160 topLayout->addWidget(agendaViewFont->preview(),i,1);
1158 topLayout->addWidget(agendaViewFont->button(),i,2); 1161 topLayout->addWidget(agendaViewFont->button(),i,2);
1159 ++i; 1162 ++i;
1160 1163
1161 1164
1162 KPrefsDialogWidFont *monthViewFont = 1165 KPrefsDialogWidFont *monthViewFont =
1163 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1166 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1164 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1167 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1165 topLayout->addWidget(monthViewFont->label(),i,0); 1168 topLayout->addWidget(monthViewFont->label(),i,0);
1166 topLayout->addWidget(monthViewFont->preview(),i,1); 1169 topLayout->addWidget(monthViewFont->preview(),i,1);
1167 topLayout->addWidget(monthViewFont->button(),i,2); 1170 topLayout->addWidget(monthViewFont->button(),i,2);
1168 ++i; 1171 ++i;
1169 1172
1170 1173
1171 KPrefsDialogWidFont *lVFont = 1174 KPrefsDialogWidFont *lVFont =
1172 addWidFont(i18n("Event"),i18n("List View:"), 1175 addWidFont(i18n("Event"),i18n("List View:"),
1173 &(KOPrefs::instance()->mListViewFont),topFrame); 1176 &(KOPrefs::instance()->mListViewFont),topFrame);
1174 topLayout->addWidget(lVFont->label(),i,0); 1177 topLayout->addWidget(lVFont->label(),i,0);
1175 topLayout->addWidget(lVFont->preview(),i,1); 1178 topLayout->addWidget(lVFont->preview(),i,1);
1176 topLayout->addWidget(lVFont->button(),i,2); 1179 topLayout->addWidget(lVFont->button(),i,2);
1177 ++i; 1180 ++i;
1178 1181
1179 1182
1180 tVFont = 1183 tVFont =
1181 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1184 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1182 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1185 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1183 topLayout->addWidget(tVFont->label(),i,0); 1186 topLayout->addWidget(tVFont->label(),i,0);
1184 topLayout->addWidget(tVFont->preview(),i,1); 1187 topLayout->addWidget(tVFont->preview(),i,1);
1185 topLayout->addWidget(tVFont->button(),i,2); 1188 topLayout->addWidget(tVFont->button(),i,2);
1186 ++i; 1189 ++i;
1187 1190
1188 1191
1189 tVFont = 1192 tVFont =
1190 addWidFont(i18n("Today"),i18n("JournalView:"), 1193 addWidFont(i18n("Today"),i18n("JournalView:"),
1191 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1194 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1192 topLayout->addWidget(tVFont->label(),i,0); 1195 topLayout->addWidget(tVFont->label(),i,0);
1193 topLayout->addWidget(tVFont->preview(),i,1); 1196 topLayout->addWidget(tVFont->preview(),i,1);
1194 topLayout->addWidget(tVFont->button(),i,2); 1197 topLayout->addWidget(tVFont->button(),i,2);
1195 ++i; 1198 ++i;
1196 1199
1197 1200
1198 1201
1199 1202
1200 topLayout->setColStretch(1,1); 1203 topLayout->setColStretch(1,1);
1201 topLayout->setRowStretch(4,1); 1204 topLayout->setRowStretch(4,1);
1202 1205
1203 1206
1204 1207
1205 1208
1206} 1209}
1207 1210
1208void KOPrefsDialog::setupColorsTab() 1211void KOPrefsDialog::setupColorsTab()
1209{ 1212{
1210 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1213 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1211 // DesktopIcon("colorize",KIcon::SizeMedium)); 1214 // DesktopIcon("colorize",KIcon::SizeMedium));
1212 1215
1213 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1216 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1214 // topLayout->setSpacing(mSpacingHint); 1217 // topLayout->setSpacing(mSpacingHint);
1215 // topLayout->setMargin(mMarginHint); 1218 // topLayout->setMargin(mMarginHint);
1216 1219
1217 topLayout->setSpacing(2); 1220 topLayout->setSpacing(2);
1218 topLayout->setMargin(3); 1221 topLayout->setMargin(3);
1219 1222
1220 int ii = 1; 1223 int ii = 1;
1221 QGroupBox *categoryGroup ; 1224 QGroupBox *categoryGroup ;
1222 1225
1223 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1226 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1224 topFrame); 1227 topFrame);
1225 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1228 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1226 1229
1227 mCategoryCombo = new QComboBox(categoryGroup); 1230 mCategoryCombo = new QComboBox(categoryGroup);
1228 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1231 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1229 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1232 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1230 1233
1231 mCategoryButton = new KColorButton(categoryGroup); 1234 mCategoryButton = new KColorButton(categoryGroup);
1232 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1235 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1233 updateCategoryColor(); 1236 updateCategoryColor();
1234 1237
1235 1238
1236 // Holiday Color 1239 // Holiday Color
1237 1240
1238 KPrefsDialogWidColor *holidayColor = 1241 KPrefsDialogWidColor *holidayColor =
1239 addWidColor(i18n("Holiday color:"), 1242 addWidColor(i18n("Holiday color:"),
1240 &(KOPrefs::instance()->mHolidayColor),topFrame); 1243 &(KOPrefs::instance()->mHolidayColor),topFrame);
1241 topLayout->addWidget(holidayColor->label(),ii,0); 1244 topLayout->addWidget(holidayColor->label(),ii,0);
1242 topLayout->addWidget(holidayColor->button(),ii++,1); 1245 topLayout->addWidget(holidayColor->button(),ii++,1);
1243 1246
1244 // Highlight Color 1247 // Highlight Color
1245 KPrefsDialogWidColor *highlightColor = 1248 KPrefsDialogWidColor *highlightColor =
1246 addWidColor(i18n("Highlight color:"), 1249 addWidColor(i18n("Highlight color:"),
1247 &(KOPrefs::instance()->mHighlightColor),topFrame); 1250 &(KOPrefs::instance()->mHighlightColor),topFrame);
1248 topLayout->addWidget(highlightColor->label(),ii,0); 1251 topLayout->addWidget(highlightColor->label(),ii,0);
1249 topLayout->addWidget(highlightColor->button(),ii++,1); 1252 topLayout->addWidget(highlightColor->button(),ii++,1);
1250 1253
1251 // Event color 1254 // Event color
1252 KPrefsDialogWidColor *eventColor = 1255 KPrefsDialogWidColor *eventColor =
1253 addWidColor(i18n("Default event color:"), 1256 addWidColor(i18n("Default event color:"),
1254 &(KOPrefs::instance()->mEventColor),topFrame); 1257 &(KOPrefs::instance()->mEventColor),topFrame);
1255 topLayout->addWidget(eventColor->label(),ii,0); 1258 topLayout->addWidget(eventColor->label(),ii,0);
1256 topLayout->addWidget(eventColor->button(),ii++,1); 1259 topLayout->addWidget(eventColor->button(),ii++,1);
1257 eventColor = 1260 eventColor =
1258 addWidColor(i18n("Default todo done color:"), 1261 addWidColor(i18n("Default todo done color:"),
1259 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1262 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1260 topLayout->addWidget(eventColor->label(),ii,0); 1263 topLayout->addWidget(eventColor->label(),ii,0);
1261 topLayout->addWidget(eventColor->button(),ii++,1); 1264 topLayout->addWidget(eventColor->button(),ii++,1);
1262 1265
1263 1266
1264 // agenda view background color 1267 // agenda view background color
1265 KPrefsDialogWidColor *agendaBgColor = 1268 KPrefsDialogWidColor *agendaBgColor =
1266 addWidColor(i18n("Agenda view background color:"), 1269 addWidColor(i18n("Agenda view background color:"),
1267 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1270 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1268 topLayout->addWidget(agendaBgColor->label(),ii,0); 1271 topLayout->addWidget(agendaBgColor->label(),ii,0);
1269 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1272 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1270 1273
1271 // working hours color 1274 // working hours color
1272 KPrefsDialogWidColor *workingHoursColor = 1275 KPrefsDialogWidColor *workingHoursColor =
1273 addWidColor(i18n("Working hours color:"), 1276 addWidColor(i18n("Working hours color:"),
1274 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1277 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1275 topLayout->addWidget(workingHoursColor->label(),ii,0); 1278 topLayout->addWidget(workingHoursColor->label(),ii,0);
1276 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1279 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1277 1280
1278 KPrefsDialogWidBool *sb = 1281 KPrefsDialogWidBool *sb =
1279 addWidBool(i18n("Use colors for application:"), 1282 addWidBool(i18n("Use colors for application:"),
1280 &(KOPrefs::instance()->mUseAppColors),topFrame); 1283 &(KOPrefs::instance()->mUseAppColors),topFrame);
1281 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1284 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1282 1285
1283 ii++; 1286 ii++;
1284 KPrefsDialogWidColor * workingHoursColor1 = 1287 KPrefsDialogWidColor * workingHoursColor1 =
1285 addWidColor(i18n("Buttons, menus, etc.:"), 1288 addWidColor(i18n("Buttons, menus, etc.:"),
1286 &(KOPrefs::instance()->mAppColor1),topFrame); 1289 &(KOPrefs::instance()->mAppColor1),topFrame);
1287 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1290 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1288 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1291 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1289 1292
1290 KPrefsDialogWidColor * workingHoursColor2 = 1293 KPrefsDialogWidColor * workingHoursColor2 =
1291 addWidColor(i18n("Frames, labels, etc.:"), 1294 addWidColor(i18n("Frames, labels, etc.:"),
1292 &(KOPrefs::instance()->mAppColor2),topFrame); 1295 &(KOPrefs::instance()->mAppColor2),topFrame);
1293 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1296 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1294 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1297 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1295 1298
1296 1299
1297 1300
1298} 1301}
1299 1302
1300void KOPrefsDialog::setCategoryColor() 1303void KOPrefsDialog::setCategoryColor()
1301{ 1304{
1302 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1305 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1303} 1306}
1304 1307
1305void KOPrefsDialog::updateCategoryColor() 1308void KOPrefsDialog::updateCategoryColor()
1306{ 1309{
1307 QString cat = mCategoryCombo->currentText(); 1310 QString cat = mCategoryCombo->currentText();
1308 QColor *color = mCategoryDict.find(cat); 1311 QColor *color = mCategoryDict.find(cat);
1309 if (!color) { 1312 if (!color) {
1310 color = KOPrefs::instance()->categoryColor(cat); 1313 color = KOPrefs::instance()->categoryColor(cat);
1311 } 1314 }
1312 if (color) { 1315 if (color) {
1313 mCategoryButton->setColor(*color); 1316 mCategoryButton->setColor(*color);
1314 } 1317 }
1315} 1318}
1316 1319
1317void KOPrefsDialog::setupPrinterTab() 1320void KOPrefsDialog::setupPrinterTab()
1318{ 1321{
1319 mPrinterTab = addPage(i18n("Printing"),0, 1322 mPrinterTab = addPage(i18n("Printing"),0,
1320 DesktopIcon("fileprint",KIcon::SizeMedium)); 1323 DesktopIcon("fileprint",KIcon::SizeMedium));
1321 1324
1322 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1325 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1323 topLayout->setSpacing(mSpacingHint); 1326 topLayout->setSpacing(mSpacingHint);
1324 topLayout->setMargin(mMarginHint); 1327 topLayout->setMargin(mMarginHint);
1325 1328
1326 topLayout->setRowStretch(4,1); 1329 topLayout->setRowStretch(4,1);
1327} 1330}
1328 1331
1329void KOPrefsDialog::setupGroupSchedulingTab() 1332void KOPrefsDialog::setupGroupSchedulingTab()
1330{ 1333{
1331#if 0 1334#if 0
1332 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1335 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1333 DesktopIcon("personal",KIcon::SizeMedium)); 1336 DesktopIcon("personal",KIcon::SizeMedium));
1334 1337
1335 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1338 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1336 topLayout->setSpacing(mSpacingHint); 1339 topLayout->setSpacing(mSpacingHint);
1337 topLayout->setMargin(mMarginHint); 1340 topLayout->setMargin(mMarginHint);
1338 1341
1339#if 0 1342#if 0
1340 KPrefsDialogWidRadios *schedulerGroup = 1343 KPrefsDialogWidRadios *schedulerGroup =
1341 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1344 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1342 topFrame); 1345 topFrame);
1343 schedulerGroup->addRadio("Dummy"); // Only for debugging 1346 schedulerGroup->addRadio("Dummy"); // Only for debugging
1344 schedulerGroup->addRadio(i18n("Mail client")); 1347 schedulerGroup->addRadio(i18n("Mail client"));
1345 1348
1346 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1349 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1347#endif 1350#endif
1348 1351
1349 KPrefsDialogWidRadios *sendGroup = 1352 KPrefsDialogWidRadios *sendGroup =
1350 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1353 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1351 topFrame); 1354 topFrame);
1352 sendGroup->addRadio(i18n("Send to outbox")); 1355 sendGroup->addRadio(i18n("Send to outbox"));
1353 sendGroup->addRadio(i18n("Send directly")); 1356 sendGroup->addRadio(i18n("Send directly"));
1354 1357
1355 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1358 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1356 1359
1357 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1360 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1358 mAMails = new QListView(topFrame); 1361 mAMails = new QListView(topFrame);
1359 mAMails->addColumn(i18n("Email"),300); 1362 mAMails->addColumn(i18n("Email"),300);
1360 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1363 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1361 1364
1362 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1365 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1363 aEmailsEdit = new QLineEdit(topFrame); 1366 aEmailsEdit = new QLineEdit(topFrame);
1364 aEmailsEdit->setEnabled(false); 1367 aEmailsEdit->setEnabled(false);
1365 topLayout->addWidget(aEmailsEdit,4,1); 1368 topLayout->addWidget(aEmailsEdit,4,1);
1366 1369
1367 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1370 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1368 topLayout->addWidget(add,5,0); 1371 topLayout->addWidget(add,5,0);
1369 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1372 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1370 topLayout->addWidget(del,5,1); 1373 topLayout->addWidget(del,5,1);
1371 1374
1372 //topLayout->setRowStretch(2,1); 1375 //topLayout->setRowStretch(2,1);
1373 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1376 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1374 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1377 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1375 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1378 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1376 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1379 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1377#endif 1380#endif
1378} 1381}
1379 1382
1380void KOPrefsDialog::setupGroupAutomationTab() 1383void KOPrefsDialog::setupGroupAutomationTab()
1381{ 1384{
1382 return; 1385 return;
1383 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1386 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1384 DesktopIcon("personal",KIcon::SizeMedium)); 1387 DesktopIcon("personal",KIcon::SizeMedium));
1385 1388
1386 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1389 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1387 topLayout->setSpacing(mSpacingHint); 1390 topLayout->setSpacing(mSpacingHint);
1388 topLayout->setMargin(mMarginHint); 1391 topLayout->setMargin(mMarginHint);
1389 1392
1390 KPrefsDialogWidRadios *autoRefreshGroup = 1393 KPrefsDialogWidRadios *autoRefreshGroup =
1391 addWidRadios(i18n("Auto Send Refresh"), 1394 addWidRadios(i18n("Auto Send Refresh"),
1392 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1395 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1393 autoRefreshGroup->addRadio(i18n("Never")); 1396 autoRefreshGroup->addRadio(i18n("Never"));
1394 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1397 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1395 //autoRefreshGroup->addRadio(i18n("selected emails")); 1398 //autoRefreshGroup->addRadio(i18n("selected emails"));
1396 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1399 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1397 1400
1398 KPrefsDialogWidRadios *autoInsertGroup = 1401 KPrefsDialogWidRadios *autoInsertGroup =
1399 addWidRadios(i18n("Auto Insert IMIP Replies"), 1402 addWidRadios(i18n("Auto Insert IMIP Replies"),
1400 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1403 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1401 autoInsertGroup->addRadio(i18n("Never")); 1404 autoInsertGroup->addRadio(i18n("Never"));
1402 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1405 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1403 //autoInsertGroup->addRadio(i18n("selected emails")); 1406 //autoInsertGroup->addRadio(i18n("selected emails"));
1404 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1407 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1405 1408
1406 KPrefsDialogWidRadios *autoRequestGroup = 1409 KPrefsDialogWidRadios *autoRequestGroup =
1407 addWidRadios(i18n("Auto Insert IMIP Requests"), 1410 addWidRadios(i18n("Auto Insert IMIP Requests"),
1408 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1411 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1409 autoRequestGroup->addRadio(i18n("Never")); 1412 autoRequestGroup->addRadio(i18n("Never"));
1410 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1413 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1411 //autoInsertGroup->addRadio(i18n("selected emails")); 1414 //autoInsertGroup->addRadio(i18n("selected emails"));
1412 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1415 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1413 1416
1414 KPrefsDialogWidRadios *autoFreeBusyGroup = 1417 KPrefsDialogWidRadios *autoFreeBusyGroup =
1415 addWidRadios(i18n("Auto Send FreeBusy Information"), 1418 addWidRadios(i18n("Auto Send FreeBusy Information"),
1416 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1419 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1417 autoFreeBusyGroup->addRadio(i18n("Never")); 1420 autoFreeBusyGroup->addRadio(i18n("Never"));
1418 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1421 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1419 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1422 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1420 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1423 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1421 1424
1422 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1425 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1423 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1426 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1424 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1427 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1425 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1428 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1426 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1429 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1427 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1430 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1428 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1431 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1429} 1432}
1430 1433
1431void KOPrefsDialog::showPrinterTab() 1434void KOPrefsDialog::showPrinterTab()
1432{ 1435{
1433 showPage(pageIndex(mPrinterTab)); 1436 showPage(pageIndex(mPrinterTab));
1434} 1437}
1435 1438
1436 1439
1437void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1440void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1438 const QStringList *tags) 1441 const QStringList *tags)
1439{ 1442{
1440 if (tags) { 1443 if (tags) {
1441 int i = tags->findIndex(text); 1444 int i = tags->findIndex(text);
1442 if (i > 0) combo->setCurrentItem(i); 1445 if (i > 0) combo->setCurrentItem(i);
1443 } else { 1446 } else {
1444 for(int i=0;i<combo->count();++i) { 1447 for(int i=0;i<combo->count();++i) {
1445 if (combo->text(i) == text) { 1448 if (combo->text(i) == text) {
1446 combo->setCurrentItem(i); 1449 combo->setCurrentItem(i);
1447 break; 1450 break;
1448 } 1451 }
1449 } 1452 }
1450 } 1453 }
1451} 1454}
1452 1455
1453void KOPrefsDialog::usrReadConfig() 1456void KOPrefsDialog::usrReadConfig()
1454{ 1457{
1455 kdelibcfg->readConfig(); 1458 kdelibcfg->readConfig();
1456 mNameEdit->setText(KOPrefs::instance()->fullName()); 1459 mNameEdit->setText(KOPrefs::instance()->fullName());
1457 mEmailEdit->setText(KOPrefs::instance()->email()); 1460 mEmailEdit->setText(KOPrefs::instance()->email());
1458 1461
1459 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1462 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1460 // QDate current ( 2001, 1,1); 1463 // QDate current ( 2001, 1,1);
1461 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1464 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1462 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1465 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1463 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1466 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1464 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1467 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1465 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1468 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1466 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1469 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1467 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1470 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1468 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1471 // if (KOPrefs::instance()->mAllDaySize > 47 )
1469 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1472 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1470 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1473 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1471 1474
1472 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1475 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1473 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1476 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1474 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1477 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1475 // mAMails->clear(); 1478 // mAMails->clear();
1476 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1479 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1477// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1480// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1478// QListViewItem *item = new QListViewItem(mAMails); 1481// QListViewItem *item = new QListViewItem(mAMails);
1479// item->setText(0,*it); 1482// item->setText(0,*it);
1480// mAMails->insertItem(item); 1483// mAMails->insertItem(item);
1481// } 1484// }
1482 1485
1483 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1486 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1484 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1487 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1485 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1488 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1486 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1489 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1487 1490
1488 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1491 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1489 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1492 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1490 //QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1493 //QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1491 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1494 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1492 //dummy = KOPrefs::instance()->mUserDateFormatShort; 1495 //dummy = KOPrefs::instance()->mUserDateFormatShort;
1493 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1496 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1494 updateCategories(); 1497 updateCategories();
1495 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1498 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1496 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1499 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1497 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1500 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1498 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1501 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1499} 1502}
1500 1503
1501 1504
1502void KOPrefsDialog::usrWriteConfig() 1505void KOPrefsDialog::usrWriteConfig()
1503{ 1506{
1504 1507
1505 kdelibcfg->writeConfig(); 1508 kdelibcfg->writeConfig();
1506 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1509 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1507 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1510 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1508 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1511 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1509 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1512 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1510 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1513 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1511 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1514 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1512 1515
1513 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1516 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1514 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1517 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1515 KOPrefs::instance()->setFullName(mNameEdit->text()); 1518 KOPrefs::instance()->setFullName(mNameEdit->text());
1516 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1519 KOPrefs::instance()->setEmail(mEmailEdit->text());
1517 1520
1518 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1521 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1519 1522
1520 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1523 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1521 //QDate date; 1524 //QDate date;
1522 //date = mStartDateSavingEdit->date(); 1525 //date = mStartDateSavingEdit->date();
1523 //int sub = 0; 1526 //int sub = 0;
1524 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1527 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1525 // sub = 1; 1528 // sub = 1;
1526// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1529// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1527// date = mEndDateSavingEdit->date(); 1530// date = mEndDateSavingEdit->date();
1528// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1531// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1529// sub = 1; 1532// sub = 1;
1530// else 1533// else
1531// sub = 0; 1534// sub = 0;
1532// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1535// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1533// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1536// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1534 1537
1535 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1538 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1536 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1539 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1537 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1540 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1538 1541
1539 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1542 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1540 1543
1541 QDictIterator<QColor> it(mCategoryDict); 1544 QDictIterator<QColor> it(mCategoryDict);
1542 while (it.current()) { 1545 while (it.current()) {
1543 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1546 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1544 ++it; 1547 ++it;
1545 } 1548 }
1546 1549
1547 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1550 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1548 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1551 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1549 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1552 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1550 1553
1551 KOPrefs::instance()->mAdditionalMails.clear(); 1554 KOPrefs::instance()->mAdditionalMails.clear();
1552 // QListViewItem *item; 1555 // QListViewItem *item;
1553 // item = mAMails->firstChild(); 1556 // item = mAMails->firstChild();
1554 // while (item) 1557 // while (item)
1555 // { 1558 // {
1556 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1559 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1557 // item = item->nextSibling(); 1560 // item = item->nextSibling();
1558 // } 1561 // }
1559 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1562 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1560 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1563 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1561 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1564 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1562 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1565 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1563 1566
1564} 1567}
1565 1568
1566void KOPrefsDialog::updateCategories() 1569void KOPrefsDialog::updateCategories()
1567{ 1570{
1568 mCategoryCombo->clear(); 1571 mCategoryCombo->clear();
1569 mCategoryDict.clear(); 1572 mCategoryDict.clear();
1570 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1573 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1571 updateCategoryColor(); 1574 updateCategoryColor();
1572} 1575}
1573 1576
1574void KOPrefsDialog::warningGroupScheduling() 1577void KOPrefsDialog::warningGroupScheduling()
1575{ 1578{
1576 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); 1579 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
1577} 1580}
1578 1581
1579void KOPrefsDialog::warningProjectView() 1582void KOPrefsDialog::warningProjectView()
1580{ 1583{
1581 warningExperimental(mEnableProjectView->checkBox()->isChecked()); 1584 warningExperimental(mEnableProjectView->checkBox()->isChecked());
1582} 1585}
1583 1586
1584void KOPrefsDialog::warningExperimental(bool on) 1587void KOPrefsDialog::warningExperimental(bool on)
1585{ 1588{
1586 if (on) { 1589 if (on) {
1587 KMessageBox::information(this,i18n("This is an experimental feature. " 1590 KMessageBox::information(this,i18n("This is an experimental feature. "
1588 "It may not work, it may do nothing useful and it may cause data loss. " 1591 "It may not work, it may do nothing useful and it may cause data loss. "
1589 "Use with care.\n" 1592 "Use with care.\n"
1590 "You have to restart KOrganizer for this setting to take effect.")); 1593 "You have to restart KOrganizer for this setting to take effect."));
1591 } else { 1594 } else {
1592 KMessageBox::information(this, 1595 KMessageBox::information(this,
1593 i18n("You have to restart KOrganizer for this setting to take effect.")); 1596 i18n("You have to restart KOrganizer for this setting to take effect."));
1594 } 1597 }
1595} 1598}
1596 1599
1597void KOPrefsDialog::toggleEmailSettings(bool on) 1600void KOPrefsDialog::toggleEmailSettings(bool on)
1598{ 1601{
1599 if (on) { 1602 if (on) {
1600 mEmailEdit->setEnabled(false); 1603 mEmailEdit->setEnabled(false);
1601 mNameEdit->setEnabled(false); 1604 mNameEdit->setEnabled(false);
1602 mEmailLabel->setEnabled(false); 1605 mEmailLabel->setEnabled(false);
1603 mNameLabel->setEnabled(false); 1606 mNameLabel->setEnabled(false);
1604 1607
1605 KEMailSettings settings; 1608 KEMailSettings settings;
1606 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1609 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1607 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1610 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1608 } else { 1611 } else {
1609 mEmailEdit->setEnabled(true); 1612 mEmailEdit->setEnabled(true);
1610 mNameEdit->setEnabled(true); 1613 mNameEdit->setEnabled(true);
1611 mEmailLabel->setEnabled(true); 1614 mEmailLabel->setEnabled(true);
1612 mNameLabel->setEnabled(true); 1615 mNameLabel->setEnabled(true);
1613 } 1616 }
1614} 1617}
1615 1618
1616void KOPrefsDialog::addItem() 1619void KOPrefsDialog::addItem()
1617{ 1620{
1618 // aEmailsEdit->setEnabled(true); 1621 // aEmailsEdit->setEnabled(true);
1619// QListViewItem *item = new QListViewItem(mAMails); 1622// QListViewItem *item = new QListViewItem(mAMails);
1620// mAMails->insertItem(item); 1623// mAMails->insertItem(item);
1621// mAMails->setSelected(item,true); 1624// mAMails->setSelected(item,true);
1622// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1625// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1623} 1626}
1624 1627
1625void KOPrefsDialog::removeItem() 1628void KOPrefsDialog::removeItem()
1626{ 1629{
1627// QListViewItem *item; 1630// QListViewItem *item;
1628// item = mAMails->selectedItem(); 1631// item = mAMails->selectedItem();
1629// if (!item) return; 1632// if (!item) return;
1630// mAMails->takeItem(item); 1633// mAMails->takeItem(item);
1631// item = mAMails->selectedItem(); 1634// item = mAMails->selectedItem();
1632// if (!item) { 1635// if (!item) {
1633// aEmailsEdit->setText(""); 1636// aEmailsEdit->setText("");
1634// aEmailsEdit->setEnabled(false); 1637// aEmailsEdit->setEnabled(false);
1635// } 1638// }
1636// if (mAMails->childCount() == 0) { 1639// if (mAMails->childCount() == 0) {
1637// aEmailsEdit->setEnabled(false); 1640// aEmailsEdit->setEnabled(false);
1638// } 1641// }
1639} 1642}
1640 1643
1641void KOPrefsDialog::updateItem() 1644void KOPrefsDialog::updateItem()
1642{ 1645{
1643 // QListViewItem *item; 1646 // QListViewItem *item;
1644// item = mAMails->selectedItem(); 1647// item = mAMails->selectedItem();
1645// if (!item) return; 1648// if (!item) return;
1646// item->setText(0,aEmailsEdit->text()); 1649// item->setText(0,aEmailsEdit->text());
1647} 1650}
1648 1651
1649void KOPrefsDialog::updateInput() 1652void KOPrefsDialog::updateInput()
1650{ 1653{
1651// QListViewItem *item; 1654// QListViewItem *item;
1652// item = mAMails->selectedItem(); 1655// item = mAMails->selectedItem();
1653// if (!item) return; 1656// if (!item) return;
1654// aEmailsEdit->setEnabled(true); 1657// aEmailsEdit->setEnabled(true);
1655// aEmailsEdit->setText(item->text(0)); 1658// aEmailsEdit->setText(item->text(0));
1656} 1659}
1657void KOPrefsDialog::updateTimezoneOffset( int index ) 1660void KOPrefsDialog::updateTimezoneOffset( int index )
1658{ 1661{
1659 /* 1662 /*
1660 qDebug("updateTimezoneOffset %d ", index); 1663 qDebug("updateTimezoneOffset %d ", index);
1661 if ( index < 24 ) { 1664 if ( index < 24 ) {
1662 mTimezoneOffsetSpin->setEnabled ( false ); 1665 mTimezoneOffsetSpin->setEnabled ( false );
1663 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); 1666 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
1664 1667
1665 1668
1666 } else { 1669 } else {
1667 if ( index == 24 ) { 1670 if ( index == 24 ) {
1668 mTimezoneOffsetSpin->setEnabled ( true ); 1671 mTimezoneOffsetSpin->setEnabled ( true );
1669 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1672 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1670 1673
1671 } else { 1674 } else {
1672 mTimezoneOffsetSpin->setEnabled ( false ); 1675 mTimezoneOffsetSpin->setEnabled ( false );
1673 mTimezoneOffsetSpin->setValue( 0 ); 1676 mTimezoneOffsetSpin->setValue( 0 );
1674 } 1677 }
1675 } 1678 }
1676 */ 1679 */
1677} 1680}
1678 1681
1679void KOPrefsDialog::setupTimeZoneTab() 1682void KOPrefsDialog::setupTimeZoneTab()
1680{ 1683{
1681#if 0 1684#if 0
1682 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); 1685 QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
1683 // DesktopIcon("clock",KIcon::SizeMedium)); 1686 // DesktopIcon("clock",KIcon::SizeMedium));
1684 1687
1685 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1688 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1686 topLayout->setSpacing(mSpacingHint); 1689 topLayout->setSpacing(mSpacingHint);
1687 topLayout->setMargin(mMarginHint); 1690 topLayout->setMargin(mMarginHint);
1688 1691
1689 QHBox *timeZoneBox = new QHBox( topFrame ); 1692 QHBox *timeZoneBox = new QHBox( topFrame );
1690 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 1693 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
1691 1694
1692 new QLabel( i18n("Timezone:"), timeZoneBox ); 1695 new QLabel( i18n("Timezone:"), timeZoneBox );
1693 mTimeZoneCombo = new QComboBox( timeZoneBox ); 1696 mTimeZoneCombo = new QComboBox( timeZoneBox );
1694 if ( QApplication::desktop()->width() < 300 ) { 1697 if ( QApplication::desktop()->width() < 300 ) {
1695 mTimeZoneCombo->setMaximumWidth(150); 1698 mTimeZoneCombo->setMaximumWidth(150);
1696 } 1699 }
1697 1700
1698 QStringList list; 1701 QStringList list;
1699 list = KGlobal::locale()->timeZoneList(); 1702 list = KGlobal::locale()->timeZoneList();
1700 mTimeZoneCombo->insertStringList(list); 1703 mTimeZoneCombo->insertStringList(list);
1701 1704
1702 // find the currently set time zone and select it 1705 // find the currently set time zone and select it
1703 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; 1706 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
1704 int nCurrentlySet = 11; 1707 int nCurrentlySet = 11;
1705 for (int i = 0; i < mTimeZoneCombo->count(); i++) 1708 for (int i = 0; i < mTimeZoneCombo->count(); i++)
1706 { 1709 {
1707 if (mTimeZoneCombo->text(i) == sCurrentlySet) 1710 if (mTimeZoneCombo->text(i) == sCurrentlySet)
1708 { 1711 {
1709 nCurrentlySet = i; 1712 nCurrentlySet = i;
1710 break; 1713 break;
1711 } 1714 }
1712 } 1715 }
1713 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 1716 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
1714 int iii = 1; 1717 int iii = 1;
1715 KPrefsDialogWidBool *sb = 1718 KPrefsDialogWidBool *sb =
1716 addWidBool(i18n("Timezone has daylight saving"), 1719 addWidBool(i18n("Timezone has daylight saving"),
1717 &(KOPrefs::instance()->mUseDaylightsaving),topFrame); 1720 &(KOPrefs::instance()->mUseDaylightsaving),topFrame);
1718 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 1721 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
1719 ++iii; 1722 ++iii;
1720 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 1723 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
1721 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1724 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1722 ++iii; 1725 ++iii;
1723 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 1726 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
1724 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1727 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1725 ++iii; 1728 ++iii;
1726 lab = new QLabel( i18n("Daylight start:"), topFrame ); 1729 lab = new QLabel( i18n("Daylight start:"), topFrame );
1727 topLayout->addWidget(lab, iii,0); 1730 topLayout->addWidget(lab, iii,0);
1728 mStartDateSavingEdit = new KDateEdit(topFrame); 1731 mStartDateSavingEdit = new KDateEdit(topFrame);
1729 topLayout->addWidget(mStartDateSavingEdit, iii,1); 1732 topLayout->addWidget(mStartDateSavingEdit, iii,1);
1730 ++iii; 1733 ++iii;
1731 1734
1732 lab = new QLabel( i18n("Daylight end:"), topFrame ); 1735 lab = new QLabel( i18n("Daylight end:"), topFrame );
1733 topLayout->addWidget(lab, iii,0); 1736 topLayout->addWidget(lab, iii,0);
1734 mEndDateSavingEdit = new KDateEdit(topFrame); 1737 mEndDateSavingEdit = new KDateEdit(topFrame);
1735 topLayout->addWidget(mEndDateSavingEdit, iii,1); 1738 topLayout->addWidget(mEndDateSavingEdit, iii,1);
1736 ++iii; 1739 ++iii;
1737 QDate current ( 2001, 1,1); 1740 QDate current ( 2001, 1,1);
1738 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1741 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1739 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1742 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1740#endif 1743#endif
1741 1744
1742} 1745}
1743 1746
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 3aa9b6c..2e5a943 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,826 +1,835 @@
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 flagResetViewChangeDate = 0; 64 flagResetViewChangeDate = 0;
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") { 91 else if (view == "Month") {
92 if ( !KOPrefs::instance()->mMonthViewWeek ) 92 if ( !KOPrefs::instance()->mMonthViewWeek )
93 showMonthView(); 93 showMonthView();
94 else 94 else
95 showMonthViewWeek(); 95 showMonthViewWeek();
96 } 96 }
97 else if (view == "List") showListView(); 97 else if (view == "List") showListView();
98 else if (view == "Journal") showJournalView(); 98 else if (view == "Journal") showJournalView();
99 else if (view == "TimeSpan") showTimeSpanView(); 99 else if (view == "TimeSpan") showTimeSpanView();
100 else if (view == "Todo") showTodoView(); 100 else if (view == "Todo") showTodoView();
101 else { 101 else {
102 config->setGroup( "Views" ); 102 config->setGroup( "Views" );
103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
104 mCurrentAgendaView = dateCount; 104 mCurrentAgendaView = dateCount;
105 showAgendaView(); 105 showAgendaView();
106 mCurrentAgendaView = dateCount; 106 mCurrentAgendaView = dateCount;
107#ifdef DESKTOP_VERSION 107#ifdef DESKTOP_VERSION
108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
109#endif 109#endif
110 } 110 }
111} 111}
112 112
113void KOViewManager::showDateView( int view, QDate date) 113void KOViewManager::showDateView( int view, QDate date)
114{ 114{
115 static int lastMode = 0; 115 static int lastMode = 0;
116 static int lastCount = 0; 116 static int lastCount = 0;
117 static bool lastNDMode = false; 117 static bool lastNDMode = false;
118 static QDate lastDate; 118 static QDate lastDate;
119 //qDebug("date %d %s", view, date.toString().latin1()); 119 //qDebug("date %d %s", view, date.toString().latin1());
120 120
121 if (view != 9) 121 if (view != 9)
122 lastMode = 0; 122 lastMode = 0;
123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 123 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
124 bool savemFlagShowNextxDays = mFlagShowNextxDays; 124 bool savemFlagShowNextxDays = mFlagShowNextxDays;
125 mFlagShowNextxDays = false; 125 mFlagShowNextxDays = false;
126 if ( view == 3 ) { 126 if ( view == 3 ) {
127 //mCurrentAgendaView = 1 ; 127 //mCurrentAgendaView = 1 ;
128 lastDate = mMainView->dateNavigator()->selectedDates().first(); 128 lastDate = mMainView->dateNavigator()->selectedDates().first();
129 lastCount = mMainView->dateNavigator()->selectedDates().count(); 129 lastCount = mMainView->dateNavigator()->selectedDates().count();
130 lastNDMode = savemFlagShowNextxDays; 130 lastNDMode = savemFlagShowNextxDays;
131 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
132 lastMode = 1; 132 lastMode = 1;
133 mCurrentAgendaView = 1 ; 133 mCurrentAgendaView = 1 ;
134 } else if (view == 4 ) { 134 } else if (view == 4 ) {
135 mCurrentAgendaView = 7 ; 135 mCurrentAgendaView = 7 ;
136 mMainView->dateNavigator()->selectDates( date, 7 ); 136 mMainView->dateNavigator()->selectDates( date, 7 );
137 } else if (view == 5 ) { 137 } else if (view == 5 ) {
138 mCurrentAgendaView = 14 ; 138 mCurrentAgendaView = 14 ;
139 mMainView->dateNavigator()->selectDates( date, 14); 139 mMainView->dateNavigator()->selectDates( date, 14);
140 } else if (view == 6 ) { 140 } else if (view == 6 ) {
141 resetDateSilent( date,1); 141 resetDateSilent( date,1);
142 showMonthView(); 142 showMonthView();
143 } else if (view == 7 ) { 143 } else if (view == 7 ) {
144 mMainView->dateNavigator()->selectDate( date ); 144 mMainView->dateNavigator()->selectDate( date );
145 showJournalView(); 145 showJournalView();
146 } else if (view == 8 ) { 146 } else if (view == 8 ) {
147 globalFlagBlockAgenda = 1; 147 globalFlagBlockAgenda = 1;
148 if ( mCurrentAgendaView != 3 ) 148 if ( mCurrentAgendaView != 3 )
149 mCurrentAgendaView = -1; 149 mCurrentAgendaView = -1;
150 showAgendaView(KOPrefs::instance()->mFullViewMonth); 150 showAgendaView(KOPrefs::instance()->mFullViewMonth);
151 globalFlagBlockAgenda = 2; 151 globalFlagBlockAgenda = 2;
152 mMainView->dateNavigator()->selectDates( date , 152 mMainView->dateNavigator()->selectDates( date ,
153 KOPrefs::instance()->mNextXDays ); 153 KOPrefs::instance()->mNextXDays );
154 mFlagShowNextxDays = true; 154 mFlagShowNextxDays = true;
155 mCurrentAgendaView = 3 ; 155 mCurrentAgendaView = 3 ;
156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 156 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
157 if ( lastMode ) { 157 if ( lastMode ) {
158 mCurrentAgendaView = lastCount ; 158 mCurrentAgendaView = lastCount ;
159 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 159 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
160 mFlagShowNextxDays = lastNDMode; 160 mFlagShowNextxDays = lastNDMode;
161 if ( mFlagShowNextxDays ) { 161 if ( mFlagShowNextxDays ) {
162 mCurrentAgendaView = 3 ; 162 mCurrentAgendaView = 3 ;
163 } 163 }
164 } else 164 } else
165 showWeekView(); 165 showWeekView();
166 } else if (view == 10) { 166 } else if (view == 10) {
167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 167 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
168 } 168 }
169} 169}
170 170
171 171
172 172
173void KOViewManager::writeSettings(KConfig *config) 173void KOViewManager::writeSettings(KConfig *config)
174{ 174{
175 config->setGroup("General"); 175 config->setGroup("General");
176 176
177 QString view; 177 QString view;
178 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 178 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
179 else if (mCurrentView == mMonthView) view = "Month"; 179 else if (mCurrentView == mMonthView) view = "Month";
180 else if (mCurrentView == mListView) view = "List"; 180 else if (mCurrentView == mListView) view = "List";
181 else if (mCurrentView == mJournalView) view = "Journal"; 181 else if (mCurrentView == mJournalView) view = "Journal";
182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 182 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
183 else if (mCurrentView == mTodoView) view = "Todo"; 183 else if (mCurrentView == mTodoView) view = "Todo";
184 else view = "Agenda"; 184 else view = "Agenda";
185 185
186 config->writeEntry("Current View",view); 186 config->writeEntry("Current View",view);
187 187
188 if (mAgendaView) { 188 if (mAgendaView) {
189 mAgendaView->writeSettings(config); 189 mAgendaView->writeSettings(config);
190 } 190 }
191 if (mTimeSpanView) { 191 if (mTimeSpanView) {
192 mTimeSpanView->writeSettings(config); 192 mTimeSpanView->writeSettings(config);
193 } 193 }
194 if (mListView) { 194 if (mListView) {
195 mListView->writeSettings(config); 195 mListView->writeSettings(config);
196 } 196 }
197 if (mTodoView) { 197 if (mTodoView) {
198 mTodoView->saveLayout(config,"Todo View"); 198 mTodoView->saveLayout(config,"Todo View");
199 } 199 }
200} 200}
201void KOViewManager::showNextView() 201void KOViewManager::showNextView()
202{ 202{
203 static int selecteddatescount = 0; 203 static int selecteddatescount = 0;
204 static QDate selecteddate = QDate ( 2000, 1, 1 ); 204 static QDate selecteddate = QDate ( 2000, 1, 1 );
205 static QDate baseCycleDate = QDate ( 2000, 1, 1 ); 205 static QDate baseCycleDate = QDate ( 2000, 1, 1 );
206 int newCount = mMainView->dateNavigator()->selectedDates().count(); 206 int newCount = mMainView->dateNavigator()->selectedDates().count();
207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { 207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) {
208 flagResetViewChangeDate = 1; 208 flagResetViewChangeDate = 1;
209 } 209 }
210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) 210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() )
211 flagResetViewChangeDate = 1; 211 flagResetViewChangeDate = 1;
212 if ( flagResetViewChangeDate > 0 ) { 212 if ( flagResetViewChangeDate > 0 ) {
213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); 213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first();
214 //qDebug("newCycle "); 214 //qDebug("newCycle ");
215 } 215 }
216 if (mCurrentView == mWhatsNextView) goto NEXT_X; 216 if (mCurrentView == mWhatsNextView) goto NEXT_X;
217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
218 if (mCurrentView == mJournalView ) goto DAY_1; 218 if (mCurrentView == mJournalView ) goto DAY_1;
219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
221 if (mCurrentView == mAgendaView ) goto DAY_6; 221 if (mCurrentView == mAgendaView ) goto DAY_6;
222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
223 if (mCurrentView == mMonthView ) goto LIST; 223 if (mCurrentView == mMonthView ) goto LIST;
224 if (mCurrentView == mListView ) goto TODO; 224 if (mCurrentView == mListView ) goto TODO;
225 // if (mCurrentView == mTodoView ) goto NEXT; 225 // if (mCurrentView == mTodoView ) goto NEXT;
226 NEXT: 226 NEXT:
227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} 227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;}
228 NEXT_X: 228 NEXT_X:
229 if ( KOPrefs::instance()->mShowIconNextDays ) { 229 if ( KOPrefs::instance()->mShowIconNextDays ) {
230 showNextXView(); 230 showNextXView();
231 goto ENTE ; 231 goto ENTE ;
232 } 232 }
233 JOURNAL: 233 JOURNAL:
234 if ( KOPrefs::instance()->mShowIconJournal ) { 234 if ( KOPrefs::instance()->mShowIconJournal ) {
235 resetDateSilent( baseCycleDate , 1 ); 235 resetDateSilent( baseCycleDate , 1 );
236 showJournalView() ;goto ENTE ;} 236 showJournalView() ;goto ENTE ;}
237 DAY_1: 237 DAY_1:
238 if ( KOPrefs::instance()->mShowIconDay1 ) { 238 if ( KOPrefs::instance()->mShowIconDay1 ) {
239 resetDateSilent( baseCycleDate , 2 ); 239 resetDateSilent( baseCycleDate , 2 );
240 showDayView() ;goto ENTE ;} 240 showDayView() ;goto ENTE ;}
241 DAY_5: 241 DAY_5:
242 if ( KOPrefs::instance()->mShowIconDay5 ) { 242 if ( KOPrefs::instance()->mShowIconDay5 ) {
243 resetDateSilent( baseCycleDate , 2 ); 243 resetDateSilent( baseCycleDate , 2 );
244 showWorkWeekView() ;goto ENTE ;} 244 showWorkWeekView() ;goto ENTE ;}
245 DAY_7: 245 DAY_7:
246 if ( KOPrefs::instance()->mShowIconDay7 ) { 246 if ( KOPrefs::instance()->mShowIconDay7 ) {
247 resetDateSilent( baseCycleDate , 2 ); 247 resetDateSilent( baseCycleDate , 2 );
248 showWeekView();goto ENTE ;} 248 showWeekView();goto ENTE ;}
249 DAY_6: 249 DAY_6:
250 if ( KOPrefs::instance()->mShowIconDay6 ) { 250 if ( KOPrefs::instance()->mShowIconDay6 ) {
251 resetDateSilent( baseCycleDate , 2 ); 251 resetDateSilent( baseCycleDate , 2 );
252 showMonthViewWeek();goto ENTE ;} 252 showMonthViewWeek();goto ENTE ;}
253 MONTH: 253 MONTH:
254 if ( KOPrefs::instance()->mShowIconMonth ) { 254 if ( KOPrefs::instance()->mShowIconMonth ) {
255 resetDateSilent( baseCycleDate , 2 ); 255 resetDateSilent( baseCycleDate , 2 );
256 showMonthView();goto ENTE ;} 256 showMonthView();goto ENTE ;}
257 LIST: 257 LIST:
258 if ( KOPrefs::instance()->mShowIconList ) { 258 if ( KOPrefs::instance()->mShowIconList ) {
259 resetDateSilent( baseCycleDate , 2 ); 259 resetDateSilent( baseCycleDate , 2 );
260 showListView() ;goto ENTE ;} 260 showListView() ;goto ENTE ;}
261 TODO: 261 TODO:
262 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} 262 if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
263 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;} 263 if ( KOPrefs::instance()->mShowIconNext ) { goto NEXT ;}
264 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;} 264 if ( KOPrefs::instance()->mShowIconNextDays ) { goto NEXT_X ;}
265 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;} 265 if ( KOPrefs::instance()->mShowIconJournal ) { goto JOURNAL;}
266 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;} 266 if ( KOPrefs::instance()->mShowIconDay1 ) { goto DAY_1 ;}
267 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;} 267 if ( KOPrefs::instance()->mShowIconDay5 ) { goto DAY_5 ;}
268 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;} 268 if ( KOPrefs::instance()->mShowIconDay7 ) { goto DAY_7 ;}
269 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;} 269 if ( KOPrefs::instance()->mShowIconDay6 ) { goto DAY_6 ;}
270 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;} 270 if ( KOPrefs::instance()->mShowIconMonth ) {goto MONTH ;}
271 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;} 271 if ( KOPrefs::instance()->mShowIconList ) { goto LIST ;}
272 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;} 272 //if ( KOPrefs::instance()->mShowIconTodoview ) { showTodoView() ;goto ENTE ;}
273 ENTE: 273 ENTE:
274 flagResetViewChangeDate = 0; 274 flagResetViewChangeDate = 0;
275 selecteddatescount = mMainView->dateNavigator()->selectedDates().count(); 275 selecteddatescount = mMainView->dateNavigator()->selectedDates().count();
276 selecteddate = mMainView->dateNavigator()->selectedDates().first(); 276 selecteddate = mMainView->dateNavigator()->selectedDates().first();
277 277
278} 278}
279void KOViewManager::resetDateSilent( QDate date , int days ) 279void KOViewManager::resetDateSilent( QDate date , int days )
280{ 280{
281 mMainView->dateNavigator()->blockSignals( true ); 281 mMainView->dateNavigator()->blockSignals( true );
282 mMainView->dateNavigator()->selectDates( date , days ); 282 mMainView->dateNavigator()->selectDates( date , days );
283 mMainView->dateNavigator()->blockSignals( false ); 283 mMainView->dateNavigator()->blockSignals( false );
284} 284}
285void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 285void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
286{ 286{
287 if ( flagResetViewChangeDate < 10 ) 287 if ( flagResetViewChangeDate < 10 )
288 ++flagResetViewChangeDate; 288 ++flagResetViewChangeDate;
289 //mFlagShowNextxDays = false; 289 //mFlagShowNextxDays = false;
290 //if(view == mCurrentView) return; 290 //if(view == mCurrentView) return;
291 if ( view == 0 ) { 291 if ( view == 0 ) {
292 view = mCurrentView; 292 view = mCurrentView;
293 if ( view == 0 ) 293 if ( view == 0 )
294 return; 294 return;
295 } 295 }
296 bool callupdate = !(view == mCurrentView); 296 bool callupdate = !(view == mCurrentView);
297 bool full = fullScreen; 297 bool full = fullScreen;
298 if(view == mCurrentView && view != mWhatsNextView ) { 298 if(view == mCurrentView && view != mWhatsNextView ) {
299 if ( mCurrentAgendaView < 0 ) 299 if ( mCurrentAgendaView < 0 )
300 return; 300 return;
301 if ( view != mMonthView ) 301 if ( view != mMonthView )
302 full = mMainView->leftFrame()->isVisible(); 302 full = mMainView->leftFrame()->isVisible();
303 } else { 303 } else {
304 if ( view == mMonthView && mMonthView) 304 if ( view == mMonthView && mMonthView)
305 ;//mMonthView->skipResize = true ; 305 ;//mMonthView->skipResize = true ;
306 mCurrentView = view; 306 mCurrentView = view;
307 // bool full = fullScreen; 307 // bool full = fullScreen;
308 bool isFull = !mMainView->leftFrame()->isVisible(); 308 bool isFull = !mMainView->leftFrame()->isVisible();
309 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 309 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
310 full = true; 310 full = true;
311 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 311 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
312 full = false; 312 full = false;
313 } 313 }
314 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 314 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
315 //raiseCurrentView( full ); 315 //raiseCurrentView( full );
316 mMainView->processIncidenceSelection( 0 ); 316 mMainView->processIncidenceSelection( 0 );
317 //mMainView->updateView(); 317 //mMainView->updateView();
318 raiseCurrentView( full, callupdate ); 318 raiseCurrentView( full, callupdate );
319 mMainView->adaptNavigationUnits(); 319 mMainView->adaptNavigationUnits();
320 mMainView->updateUnmanagedViews();
320} 321}
321 322
322void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 323void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
323{ 324{
324 mCurrentAgendaView = 0; 325 mCurrentAgendaView = 0;
325 if ( fullScreen ) { 326 if ( fullScreen ) {
326 mMainView->leftFrame()->hide(); 327 mMainView->leftFrame()->hide();
327 } else { 328 } else {
328 mMainView->leftFrame()->show(); 329 mMainView->leftFrame()->show();
329 } 330 }
330 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 331 //if ( mCurrentView == mMonthView ) qApp->processEvents();
331 emit signalFullScreen( !fullScreen ); 332 emit signalFullScreen( !fullScreen );
332 if ( callUpdateView ) 333 if ( callUpdateView )
333 mMainView->updateView(); 334 mMainView->updateView();
334 335
335 if ( globalFlagBlockAgenda == 5 ) { 336 if ( globalFlagBlockAgenda == 5 ) {
336 globalFlagBlockAgenda = 4; 337 globalFlagBlockAgenda = 4;
337 globalFlagBlockAgendaItemPaint = 1; 338 globalFlagBlockAgendaItemPaint = 1;
338 } 339 }
339 mMainView->viewStack()->raiseWidget(mCurrentView); 340 mMainView->viewStack()->raiseWidget(mCurrentView);
340 if ( globalFlagBlockAgenda == 4 ) { 341 if ( globalFlagBlockAgenda == 4 ) {
341 if ( mCurrentView == mAgendaView ) { 342 if ( mCurrentView == mAgendaView ) {
342 //globalFlagBlockAgenda =1 ; 343 //globalFlagBlockAgenda =1 ;
343 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 344 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
344 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 345 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
345 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 346 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
346 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 347 mAgendaView->setStartHour( QTime::currentTime ().hour() );
347 qApp->processEvents(); 348 qApp->processEvents();
348 //qDebug("qApp->processEvents() "); 349 //qDebug("qApp->processEvents() ");
349 globalFlagBlockAgenda = 0; 350 globalFlagBlockAgenda = 0;
350 mAgendaView->repaintAgenda(); 351 mAgendaView->repaintAgenda();
351 352
352 } 353 }
353 globalFlagBlockAgenda = 0; 354 globalFlagBlockAgenda = 0;
354 } 355 }
355 emit signalAgendaView( mCurrentView == mAgendaView ); 356 emit signalAgendaView( mCurrentView == mAgendaView );
356 //qDebug("raiseCurrentView ende "); 357 //qDebug("raiseCurrentView ende ");
357 358
358} 359}
359 360
360void KOViewManager::updateView() 361void KOViewManager::updateView()
361{ 362{
362 // qDebug("KOViewManager::updateView() "); 363 // qDebug("KOViewManager::updateView() ");
363 // if we are updating mTodoView, we get endless recursion 364 // if we are updating mTodoView, we get endless recursion
364 if ( mTodoView == mCurrentView ) 365 if ( mTodoView == mCurrentView )
365 return; 366 return;
366 if ( mCurrentView ) mCurrentView->updateView(); 367 if ( mCurrentView ) mCurrentView->updateView();
367 368
368} 369}
369 370
370void KOViewManager::updateView(const QDate &start, const QDate &end) 371void KOViewManager::updateView(const QDate &start, const QDate &end)
371{ 372{
372 // kdDebug() << "KOViewManager::updateView()" << endl; 373 // kdDebug() << "KOViewManager::updateView()" << endl;
373 374
374 if (mCurrentView) mCurrentView->showDates(start, end); 375 if (mCurrentView) mCurrentView->showDates(start, end);
375 376
376 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 377 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
377} 378}
378 379
379 380
380void KOViewManager::updateWNview() 381void KOViewManager::updateWNview()
381{ 382{
382 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 383 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
383 mWhatsNextView->updateView(); 384 mWhatsNextView->updateView();
384 if ( mCurrentView == mMonthView && mMonthView ) 385 if ( mCurrentView == mMonthView && mMonthView )
385 mMonthView->updateView(); 386 mMonthView->updateView();
386 387
387} 388}
388void KOViewManager::showWhatsNextView() 389void KOViewManager::showWhatsNextView()
389{ 390{
390 if (!mWhatsNextView) { 391 if (!mWhatsNextView) {
391 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 392 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
392 "KOViewManager::WhatsNextView"); 393 "KOViewManager::WhatsNextView");
393 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 394 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
394 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 395 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
395 addView(mWhatsNextView); 396 addView(mWhatsNextView);
396 connect(this, SIGNAL( printWNV() ), 397 connect(this, SIGNAL( printWNV() ),
397 mWhatsNextView, SLOT( printMe() ) ); 398 mWhatsNextView, SLOT( printMe() ) );
398 } 399 }
399 globalFlagBlockAgenda = 1; 400 globalFlagBlockAgenda = 1;
401 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
400 showView(mWhatsNextView, true ); 402 showView(mWhatsNextView, true );
401 //mWhatsNextView->updateView(); 403 //mWhatsNextView->updateView();
402 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; 404 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
403} 405}
404 406
405void KOViewManager::slotprintWNV() 407void KOViewManager::slotprintWNV()
406{ 408{
407 if (!mWhatsNextView) 409 if (!mWhatsNextView)
408 showWhatsNextView(); 410 showWhatsNextView();
409 emit printWNV(); 411 emit printWNV();
410 412
411} 413}
412void KOViewManager::showListView() 414void KOViewManager::showListView()
413{ 415{
414 if (!mListView) { 416 if (!mListView) {
415 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 417 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
416 addView(mListView); 418 addView(mListView);
417 419
418 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 420 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
419 mMainView, SLOT(showIncidence(Incidence *))); 421 mMainView, SLOT(showIncidence(Incidence *)));
420 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 422 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
421 mMainView, SLOT(editIncidence(Incidence *))); 423 mMainView, SLOT(editIncidence(Incidence *)));
422 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 424 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
423 mMainView, SLOT(deleteIncidence(Incidence *))); 425 mMainView, SLOT(deleteIncidence(Incidence *)));
424 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 426 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
425 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 427 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
426 connect( mListView, SIGNAL( signalNewEvent() ), 428 connect( mListView, SIGNAL( signalNewEvent() ),
427 mMainView, SLOT( newEvent() ) ); 429 mMainView, SLOT( newEvent() ) );
428 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 430 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
429 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 431 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
430 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 432 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
431 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 433 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
432 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 434 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
433 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 435 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
434 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 436 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
435 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 437 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
436 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 438 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
437 } 439 }
438 // bool temp = mFlagShowNextxDays; 440 // bool temp = mFlagShowNextxDays;
439 //globalFlagBlockPainting = true; 441 //globalFlagBlockPainting = true;
440 globalFlagBlockAgenda = 1; 442 globalFlagBlockAgenda = 1;
441 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 443 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
442 mMainView->setBlockShowDates( true ); 444 mMainView->setBlockShowDates( true );
443 mMainView->dateNavigator()->selectMonth(); 445 mMainView->dateNavigator()->selectMonth();
444 mMainView->setBlockShowDates( false ); 446 mMainView->setBlockShowDates( false );
445 } 447 }
448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
446 showView(mListView, KOPrefs::instance()->mFullViewTodo); 449 showView(mListView, KOPrefs::instance()->mFullViewTodo);
447 //mFlagShowNextxDays = temp; 450 //mFlagShowNextxDays = temp;
448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 451 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
449} 452}
450 453
451void KOViewManager::showAgendaView( bool fullScreen ) 454void KOViewManager::showAgendaView( bool fullScreen )
452{ 455{
453 456
454 mMainView->dialogManager()->hideSearchDialog(); 457 mMainView->dialogManager()->hideSearchDialog();
455 // qDebug("KOViewManager::showAgendaView "); 458 // qDebug("KOViewManager::showAgendaView ");
456 bool full; 459 bool full;
457 full = fullScreen; 460 full = fullScreen;
458 if (!mAgendaView) { 461 if (!mAgendaView) {
459 full = false; 462 full = false;
460 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 463 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
461 addView(mAgendaView); 464 addView(mAgendaView);
462#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
463 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 466 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
464#endif 467#endif
465 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 468 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
466 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 469 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
467 470
468 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 471 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
469 472
470 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 473 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
471 474
472 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 475 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
473 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 476 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
474 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 477 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
475 mMainView, SLOT(newEvent(QDateTime))); 478 mMainView, SLOT(newEvent(QDateTime)));
476 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 479 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
477 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 480 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
478 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 481 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
479 mMainView, SLOT(newEvent(QDate))); 482 mMainView, SLOT(newEvent(QDate)));
480 483
481 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 484 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
482 mMainView, SLOT(editIncidence(Incidence *))); 485 mMainView, SLOT(editIncidence(Incidence *)));
483 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 486 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
484 mMainView, SLOT(showIncidence(Incidence *))); 487 mMainView, SLOT(showIncidence(Incidence *)));
485 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 488 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
486 mMainView, SLOT(deleteIncidence(Incidence *))); 489 mMainView, SLOT(deleteIncidence(Incidence *)));
487 490
488 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 491 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
489 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 492 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
490 493
491 connect(mAgendaView, SIGNAL( toggleExpand() ), 494 connect(mAgendaView, SIGNAL( toggleExpand() ),
492 mMainView, SLOT( toggleExpand() ) ); 495 mMainView, SLOT( toggleExpand() ) );
493 496
494 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 497 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
495 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 498 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
496 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 499 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
497 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 500 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
498 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 501 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
499 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 502 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
500 SLOT( updateTodo( Todo *, int ) ) ); 503 SLOT( updateTodo( Todo *, int ) ) );
501 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 504 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
502 mMainView, SIGNAL( todoModified( Todo *, int ))); 505 mMainView, SIGNAL( todoModified( Todo *, int )));
503 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 506 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
504 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 507 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
505 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 508 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
506 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 509 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 510 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 511 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
509 mAgendaView->readSettings(); 512 mAgendaView->readSettings();
510 mAgendaView->updateConfig(); 513 mAgendaView->updateConfig();
511 } 514 }
512 515
516 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
513 showView( mAgendaView, full); 517 showView( mAgendaView, full);
514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 518 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
515} 519}
516 520
517void KOViewManager::showDayView() 521void KOViewManager::showDayView()
518{ 522{
519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 523 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
520 mFlagShowNextxDays = false; 524 mFlagShowNextxDays = false;
521 globalFlagBlockLabel = 1; 525 globalFlagBlockLabel = 1;
522 globalFlagBlockAgenda = 1; 526 globalFlagBlockAgenda = 1;
523 if ( mCurrentAgendaView != 1 ) 527 if ( mCurrentAgendaView != 1 )
524 mCurrentAgendaView = -1; 528 mCurrentAgendaView = -1;
525 showAgendaView(); 529 showAgendaView();
526 qApp->processEvents(); 530 qApp->processEvents();
527 globalFlagBlockAgenda = 2; 531 globalFlagBlockAgenda = 2;
528 globalFlagBlockLabel = 0; 532 globalFlagBlockLabel = 0;
529 mMainView->dateNavigator()->selectDates( 1 ); 533 mMainView->dateNavigator()->selectDates( 1 );
530 mCurrentAgendaView = 1 ; 534 mCurrentAgendaView = 1 ;
531 535
532} 536}
533 537
534void KOViewManager::showWorkWeekView() 538void KOViewManager::showWorkWeekView()
535{ 539{
536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 540 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
537 mFlagShowNextxDays = false; 541 mFlagShowNextxDays = false;
538 globalFlagBlockAgenda = 1; 542 globalFlagBlockAgenda = 1;
539 globalFlagBlockLabel = 1; 543 globalFlagBlockLabel = 1;
540 if ( mCurrentAgendaView != 5 ) 544 if ( mCurrentAgendaView != 5 )
541 mCurrentAgendaView = -1; 545 mCurrentAgendaView = -1;
542 showAgendaView(); 546 showAgendaView();
543 qApp->processEvents(); 547 qApp->processEvents();
544 globalFlagBlockAgenda = 2; 548 globalFlagBlockAgenda = 2;
545 globalFlagBlockLabel = 0; 549 globalFlagBlockLabel = 0;
546 mMainView->dateNavigator()->selectWorkWeek(); 550 mMainView->dateNavigator()->selectWorkWeek();
547 mCurrentAgendaView = 5 ; 551 mCurrentAgendaView = 5 ;
548 552
549} 553}
550 554
551void KOViewManager::showWeekView() 555void KOViewManager::showWeekView()
552{ 556{
553 557
554 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 558 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
555 mFlagShowNextxDays = false; 559 mFlagShowNextxDays = false;
556 globalFlagBlockAgenda = 1; 560 globalFlagBlockAgenda = 1;
557 globalFlagBlockLabel = 1; 561 globalFlagBlockLabel = 1;
558 if ( mCurrentAgendaView != 7 ) 562 if ( mCurrentAgendaView != 7 )
559 mCurrentAgendaView = -1; 563 mCurrentAgendaView = -1;
560 showAgendaView(); 564 showAgendaView();
561 qApp->processEvents(); 565 qApp->processEvents();
562 globalFlagBlockAgenda = 2; 566 globalFlagBlockAgenda = 2;
563 globalFlagBlockLabel = 0; 567 globalFlagBlockLabel = 0;
564 mMainView->dateNavigator()->selectWeek(); 568 mMainView->dateNavigator()->selectWeek();
565 mCurrentAgendaView = 7 ; 569 mCurrentAgendaView = 7 ;
566} 570}
567 571
568void KOViewManager::showNextXView() 572void KOViewManager::showNextXView()
569{ 573{
570 574
575 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
571 globalFlagBlockAgenda = 1; 576 globalFlagBlockAgenda = 1;
572 if ( mCurrentAgendaView != 3 ) 577 if ( mCurrentAgendaView != 3 )
573 mCurrentAgendaView = -1; 578 mCurrentAgendaView = -1;
574 showAgendaView(KOPrefs::instance()->mFullViewMonth); 579 showAgendaView(KOPrefs::instance()->mFullViewMonth);
575 globalFlagBlockAgenda = 2; 580 globalFlagBlockAgenda = 2;
576 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 581 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
577 KOPrefs::instance()->mNextXDays ); 582 KOPrefs::instance()->mNextXDays );
578 mFlagShowNextxDays = true; 583 mFlagShowNextxDays = true;
579 mCurrentAgendaView = 3 ; 584 mCurrentAgendaView = 3 ;
580 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 585 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
581} 586}
582bool KOViewManager::showsNextDays() 587bool KOViewManager::showsNextDays()
583{ 588{
584 return mFlagShowNextxDays; 589 return mFlagShowNextxDays;
585} 590}
586void KOViewManager::createMonthView() 591void KOViewManager::createMonthView()
587{ 592{
588if (!mMonthView) { 593if (!mMonthView) {
589 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 594 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
590 595
591 addView(mMonthView); 596 addView(mMonthView);
592 // mMonthView->show(); 597 // mMonthView->show();
593 // SIGNALS/SLOTS FOR MONTH VIEW 598 // SIGNALS/SLOTS FOR MONTH VIEW
594 599
595 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); 600 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
596 601
597 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)), 602 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
598 mMainView, SLOT(newTodoDateTime(QDateTime, bool))); 603 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
599 604
600 605
601 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 606 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
602 mMainView, SLOT(newEvent(QDateTime))); 607 mMainView, SLOT(newEvent(QDateTime)));
603 608
604 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 609 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
605 mMainView, SLOT(showIncidence(Incidence *))); 610 mMainView, SLOT(showIncidence(Incidence *)));
606 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 611 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
607 mMainView, SLOT(editIncidence(Incidence *))); 612 mMainView, SLOT(editIncidence(Incidence *)));
608 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 613 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
609 mMainView, SLOT(deleteIncidence(Incidence *))); 614 mMainView, SLOT(deleteIncidence(Incidence *)));
610 615
611 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 616 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
612 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 617 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
613 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 618 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
614 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 619 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
615 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 620 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
616 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 621 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
617 622
618 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 623 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
619 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 624 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
620 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 625 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
621 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 626 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
622 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 627 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
623 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 628 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
624 connect( mMonthView, SIGNAL( selectMonth() ), 629 connect( mMonthView, SIGNAL( selectMonth() ),
625 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 630 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
626 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 631 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
627 mMainView, SLOT ( showDay( QDate ) ) ); 632 mMainView, SLOT ( showDay( QDate ) ) );
628 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 633 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
629 connect( mMonthView, SIGNAL(nextMonth() ), 634 connect( mMonthView, SIGNAL(nextMonth() ),
630 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 635 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
631 connect( mMonthView, SIGNAL(prevMonth() ), 636 connect( mMonthView, SIGNAL(prevMonth() ),
632 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 637 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
633 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 638 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
634 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 639 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
635 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 640 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
636 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 641 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
637 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 642 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
638 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 643 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
639 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 644 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
640 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 645 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
641 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 646 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
642 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 647 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
643 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 648 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
644 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 649 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
645 650
646 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 651 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
647 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 652 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
648 653
649 654
650 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 655 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
651 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 656 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
652 657
653 } 658 }
654} 659}
655void KOViewManager::showMonthViewWeek() 660void KOViewManager::showMonthViewWeek()
656{ 661{
657 createMonthView(); 662 createMonthView();
663 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
658 globalFlagBlockAgenda = 1; 664 globalFlagBlockAgenda = 1;
659 bool full = true; 665 bool full = true;
660 if ( mCurrentView == mMonthView) 666 if ( mCurrentView == mMonthView)
661 full = mMainView->leftFrame()->isVisible(); 667 full = mMainView->leftFrame()->isVisible();
662 if ( !KOPrefs::instance()->mMonthViewWeek ) { 668 if ( !KOPrefs::instance()->mMonthViewWeek ) {
663 mMonthView->switchView(); 669 mMonthView->switchView();
664 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 670 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
665 full = false; 671 full = false;
666 else 672 else
667 full = true; 673 full = true;
668 } 674 }
669 mMainView->dateNavigator()->selectWeek(); 675 mMainView->dateNavigator()->selectWeek();
670 showView(mMonthView, full ); 676 showView(mMonthView, full );
671 mMonthView->setKeyBFocus(); 677 mMonthView->setKeyBFocus();
672 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 678 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
673} 679}
674 680
675void KOViewManager::showMonth( const QDate & date ) 681void KOViewManager::showMonth( const QDate & date )
676{ 682{
677 mMainView->dateNavigator()->blockSignals( true ); 683 mMainView->dateNavigator()->blockSignals( true );
678 mMainView->dateNavigator()->selectDate( date ); 684 mMainView->dateNavigator()->selectDate( date );
679 mMainView->dateNavigator()->blockSignals( false ); 685 mMainView->dateNavigator()->blockSignals( false );
680 showMonthView(); 686 showMonthView();
681} 687}
682void KOViewManager::showMonthView() 688void KOViewManager::showMonthView()
683 { 689 {
684 690
685 createMonthView(); 691 createMonthView();
692 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
686 globalFlagBlockAgenda = 1; 693 globalFlagBlockAgenda = 1;
687 //mFlagShowNextxDays = false; 694 //mFlagShowNextxDays = false;
688 bool full = true; 695 bool full = true;
689 if ( mCurrentView == mMonthView) 696 if ( mCurrentView == mMonthView)
690 full = mMainView->leftFrame()->isVisible(); 697 full = mMainView->leftFrame()->isVisible();
691 // if(mMonthView == mCurrentView) return; 698 // if(mMonthView == mCurrentView) return;
692 if ( KOPrefs::instance()->mMonthViewWeek ) { 699 if ( KOPrefs::instance()->mMonthViewWeek ) {
693 mMonthView->switchView(); 700 mMonthView->switchView();
694 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 701 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
695 full = false; 702 full = false;
696 else 703 else
697 full = true; 704 full = true;
698 } 705 }
699 mMainView->dateNavigator()->selectMonth(); 706 mMainView->dateNavigator()->selectMonth();
700 707
701 showView(mMonthView, full ); 708 showView(mMonthView, full );
702 mMonthView->setKeyBFocus(); 709 mMonthView->setKeyBFocus();
703 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 710 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
704 711
705} 712}
706 713
707void KOViewManager::showTodoView() 714void KOViewManager::showTodoView()
708{ 715{
709 //mFlagShowNextxDays = false; 716 //mFlagShowNextxDays = false;
710 if ( !mTodoView ) { 717 if ( !mTodoView ) {
711 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 718 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
712 "KOViewManager::TodoView" ); 719 "KOViewManager::TodoView" );
713 720
714 addView( mTodoView ); 721 addView( mTodoView );
715 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 722 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
716 723
717 // SIGNALS/SLOTS FOR TODO VIEW 724 // SIGNALS/SLOTS FOR TODO VIEW
718 connect( mTodoView, SIGNAL( newTodoSignal() ), 725 connect( mTodoView, SIGNAL( newTodoSignal() ),
719 mMainView, SLOT( newTodo() ) ); 726 mMainView, SLOT( newTodo() ) );
720 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 727 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
721 mMainView, SLOT( newSubTodo( Todo *) ) ); 728 mMainView, SLOT( newSubTodo( Todo *) ) );
722 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 729 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
723 mMainView, SLOT( showTodo( Todo * ) ) ); 730 mMainView, SLOT( showTodo( Todo * ) ) );
724 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 731 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
725 mMainView, SLOT( editTodo( Todo * ) ) ); 732 mMainView, SLOT( editTodo( Todo * ) ) );
726 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 733 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
727 mMainView, SLOT( deleteTodo( Todo * ) ) ); 734 mMainView, SLOT( deleteTodo( Todo * ) ) );
728 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 735 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
729 mMainView, SLOT( purgeCompleted() ) ); 736 mMainView, SLOT( purgeCompleted() ) );
730 737
731 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 738 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
732 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 739 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
733 740
734 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 741 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
735 SLOT( updateConfig() ) ); 742 SLOT( updateConfig() ) );
736 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 743 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
737 SLOT( updateTodo( Todo *, int ) ) ); 744 SLOT( updateTodo( Todo *, int ) ) );
738 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 745 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
739 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 746 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
740 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 747 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
741 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 748 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
742 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 749 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
743 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 750 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
744 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 751 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
745 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 752 mMainView, SLOT ( todo_unsub( Todo * ) ) );
746 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 753 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
747 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 754 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
748 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 755 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
749 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 756 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
750 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 757 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
751 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 758 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
752 KConfig *config = KOGlobals::config(); 759 KConfig *config = KOGlobals::config();
753 mTodoView->restoreLayout(config,"Todo View"); 760 mTodoView->restoreLayout(config,"Todo View");
754 mTodoView->setNavigator( mMainView->dateNavigator() ); 761 mTodoView->setNavigator( mMainView->dateNavigator() );
755 } 762 }
756 763
764 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
757 globalFlagBlockAgenda = 1; 765 globalFlagBlockAgenda = 1;
758 showView( mTodoView, true ); 766 showView( mTodoView, true );
759 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 767 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
760 768
761} 769}
762 770
763void KOViewManager::showJournalView() 771void KOViewManager::showJournalView()
764{ 772{
765 //mFlagShowNextxDays = false; 773 //mFlagShowNextxDays = false;
766 if (!mJournalView) { 774 if (!mJournalView) {
767 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 775 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
768 "KOViewManager::JournalView"); 776 "KOViewManager::JournalView");
769 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 777 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
770 SLOT( updateConfig() ) ); 778 SLOT( updateConfig() ) );
771 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 779 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
772 addView(mJournalView); 780 addView(mJournalView);
773 } 781 }
774 782
783 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
775 showView(mJournalView); 784 showView(mJournalView);
776 mMainView->dateNavigator()->selectDates( 1 ); 785 mMainView->dateNavigator()->selectDates( 1 );
777 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 786 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
778} 787}
779 788
780void KOViewManager::showTimeSpanView() 789void KOViewManager::showTimeSpanView()
781{ 790{
782 //mFlagShowNextxDays = false; 791 //mFlagShowNextxDays = false;
783 if (!mTimeSpanView) { 792 if (!mTimeSpanView) {
784 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 793 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
785 "KOViewManager::TimeSpanView"); 794 "KOViewManager::TimeSpanView");
786 addView(mTimeSpanView); 795 addView(mTimeSpanView);
787 796
788 mTimeSpanView->readSettings(); 797 mTimeSpanView->readSettings();
789 } 798 }
790 799
791 showView(mTimeSpanView); 800 showView(mTimeSpanView);
792} 801}
793 802
794Incidence *KOViewManager::currentSelection() 803Incidence *KOViewManager::currentSelection()
795{ 804{
796 if (!mCurrentView) return 0; 805 if (!mCurrentView) return 0;
797 if ( mCurrentView == mListView ) { 806 if ( mCurrentView == mListView ) {
798 if ( mListView->currentItem() ) 807 if ( mListView->currentItem() )
799 return mListView->currentItem(); 808 return mListView->currentItem();
800 } 809 }
801 return mCurrentView->selectedIncidences().first(); 810 return mCurrentView->selectedIncidences().first();
802} 811}
803 812
804QDate KOViewManager::currentSelectionDate() 813QDate KOViewManager::currentSelectionDate()
805{ 814{
806 QDate qd; 815 QDate qd;
807 if (mCurrentView) { 816 if (mCurrentView) {
808 DateList qvl = mCurrentView->selectedDates(); 817 DateList qvl = mCurrentView->selectedDates();
809 if (!qvl.isEmpty()) qd = qvl.first(); 818 if (!qvl.isEmpty()) qd = qvl.first();
810 } 819 }
811 return qd; 820 return qd;
812} 821}
813 822
814void KOViewManager::addView(KOrg::BaseView *view) 823void KOViewManager::addView(KOrg::BaseView *view)
815{ 824{
816#if QT_VERSION >= 0x030000 825#if QT_VERSION >= 0x030000
817 mMainView->viewStack()->addWidget( view ); 826 mMainView->viewStack()->addWidget( view );
818#else 827#else
819 mMainView->viewStack()->addWidget( view, 1 ); 828 mMainView->viewStack()->addWidget( view, 1 );
820#endif 829#endif
821} 830}
822 831
823void KOViewManager::setDocumentId( const QString &id ) 832void KOViewManager::setDocumentId( const QString &id )
824{ 833{
825 if (mTodoView) mTodoView->setDocumentId( id ); 834 if (mTodoView) mTodoView->setDocumentId( id );
826} 835}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 95bef66..87cef20 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2450 +1,2453 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136 mClosed = false; 136 mClosed = false;
137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
138 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
139 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
140 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
141 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
142 mBlockAtStartup = true; 142 mBlockAtStartup = true;
143 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
144 setCaption("KO/Pi"); 144 setCaption("KO/Pi");
145 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
146 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
147 p->mCurrentDisplayedView = 0; 147 p->mCurrentDisplayedView = 0;
148 if ( p->mHourSize > 22 ) 148 if ( p->mHourSize > 22 )
149 p->mHourSize = 22; 149 p->mHourSize = 22;
150 QMainWindow::ToolBarDock tbd; 150 QMainWindow::ToolBarDock tbd;
151 if ( p->mToolBarHor ) { 151 if ( p->mToolBarHor ) {
152 if ( p->mToolBarUp ) 152 if ( p->mToolBarUp )
153 tbd = Bottom; 153 tbd = Bottom;
154 else 154 else
155 tbd = Top; 155 tbd = Top;
156 } 156 }
157 else { 157 else {
158 if ( p->mToolBarUp ) 158 if ( p->mToolBarUp )
159 tbd = Right; 159 tbd = Right;
160 else 160 else
161 tbd = Left; 161 tbd = Left;
162 } 162 }
163 if ( KOPrefs::instance()->mUseAppColors ) 163 if ( KOPrefs::instance()->mUseAppColors )
164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
165 globalFlagBlockStartup = 1; 165 globalFlagBlockStartup = 1;
166 iconToolBar = new QPEToolBar( this ); 166 iconToolBar = new QPEToolBar( this );
167 addToolBar (iconToolBar , tbd ); 167 addToolBar (iconToolBar , tbd );
168 168
169#ifdef DESKTOP_VERSION 169#ifdef DESKTOP_VERSION
170 if ( KOPrefs::instance()->mShowIconFilter ) 170 if ( KOPrefs::instance()->mShowIconFilter )
171#else 171#else
172 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 172 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
173#endif 173#endif
174 174
175{ 175{
176 if ( p->mToolBarHorF ) { 176 if ( p->mToolBarHorF ) {
177 if ( p->mToolBarUpF ) 177 if ( p->mToolBarUpF )
178 tbd = Bottom; 178 tbd = Bottom;
179 else 179 else
180 tbd = Top; 180 tbd = Top;
181 } 181 }
182 else { 182 else {
183 if ( p->mToolBarUpF ) 183 if ( p->mToolBarUpF )
184 tbd = Right; 184 tbd = Right;
185 else 185 else
186 tbd = Left; 186 tbd = Left;
187 } 187 }
188 filterToolBar = new QPEToolBar ( this ); 188 filterToolBar = new QPEToolBar ( this );
189 filterMenubar = new QPEMenuBar( filterToolBar ); 189 filterMenubar = new QMenuBar( filterToolBar );
190 QFontMetrics fm ( filterMenubar->font() ); 190 QFontMetrics fm ( filterMenubar->font() );
191 191
192 filterPopupMenu = new QPopupMenu( this ); 192 filterPopupMenu = new QPopupMenu( this );
193 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 193 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
194 QString addTest = "Ax"; 194 QString addTest = "A";
195 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
195#ifdef DESKTOP_VERSION 196#ifdef DESKTOP_VERSION
196 addTest = "AAAx"; 197 addTest = "AAABBBCCCx";
197#endif 198#else
198 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); 199 addTest = "AAx";
200#endif
201 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
199 addToolBar (filterToolBar , tbd ); 202 addToolBar (filterToolBar , tbd );
200 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 203 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
201 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 204 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
202 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 205 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
203 filterToolBar->hide(); 206 filterToolBar->hide();
204 } else { 207 } else {
205 filterToolBar = 0; 208 filterToolBar = 0;
206 filterMenubar = 0; 209 filterMenubar = 0;
207 filterPopupMenu = 0; 210 filterPopupMenu = 0;
208 } 211 }
209 if ( p->mShowIconOnetoolbar ) { 212 if ( p->mShowIconOnetoolbar ) {
210 viewToolBar = iconToolBar ; 213 viewToolBar = iconToolBar ;
211 navigatorToolBar = iconToolBar ; 214 navigatorToolBar = iconToolBar ;
212 } else { 215 } else {
213#ifndef DESKTOP_VERSION 216#ifndef DESKTOP_VERSION
214 setToolBarsMovable( false ); 217 setToolBarsMovable( false );
215#endif 218#endif
216 if ( p->mToolBarHorV ) { 219 if ( p->mToolBarHorV ) {
217 if ( p->mToolBarUpV ) 220 if ( p->mToolBarUpV )
218 tbd = Bottom; 221 tbd = Bottom;
219 else 222 else
220 tbd = Top; 223 tbd = Top;
221 } 224 }
222 else { 225 else {
223 if ( p->mToolBarUpV ) 226 if ( p->mToolBarUpV )
224 tbd = Right; 227 tbd = Right;
225 else 228 else
226 tbd = Left; 229 tbd = Left;
227 } 230 }
228 viewToolBar = new QPEToolBar( this ); 231 viewToolBar = new QPEToolBar( this );
229 addToolBar (viewToolBar , tbd ); 232 addToolBar (viewToolBar , tbd );
230 if ( p->mToolBarHorN ) { 233 if ( p->mToolBarHorN ) {
231 if ( p->mToolBarUpN ) 234 if ( p->mToolBarUpN )
232 tbd = Bottom; 235 tbd = Bottom;
233 else 236 else
234 tbd = Top; 237 tbd = Top;
235 } 238 }
236 else { 239 else {
237 if ( p->mToolBarUpN ) 240 if ( p->mToolBarUpN )
238 tbd = Right; 241 tbd = Right;
239 else 242 else
240 tbd = Left; 243 tbd = Left;
241 } 244 }
242 navigatorToolBar = new QPEToolBar( this ); 245 navigatorToolBar = new QPEToolBar( this );
243 addToolBar (navigatorToolBar , tbd ); 246 addToolBar (navigatorToolBar , tbd );
244 } 247 }
245 248
246 249
247 250
248 mCalendarModifiedFlag = false; 251 mCalendarModifiedFlag = false;
249 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 252 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
250 splash->setAlignment ( AlignCenter ); 253 splash->setAlignment ( AlignCenter );
251 setCentralWidget( splash ); 254 setCentralWidget( splash );
252#ifndef DESKTOP_VERSION 255#ifndef DESKTOP_VERSION
253 showMaximized(); 256 showMaximized();
254#endif 257#endif
255 258
256 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 259 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
257 setDefaultPreferences(); 260 setDefaultPreferences();
258 mCalendar = new CalendarLocal(); 261 mCalendar = new CalendarLocal();
259 mView = new CalendarView( mCalendar, this,"mCalendar " ); 262 mView = new CalendarView( mCalendar, this,"mCalendar " );
260 mView->hide(); 263 mView->hide();
261 //mView->resize(splash->size() ); 264 //mView->resize(splash->size() );
262 initActions(); 265 initActions();
263 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 266 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
264 mSyncManager->setBlockSave(false); 267 mSyncManager->setBlockSave(false);
265 mView->setSyncManager(mSyncManager); 268 mView->setSyncManager(mSyncManager);
266#ifndef DESKTOP_VERSION 269#ifndef DESKTOP_VERSION
267 iconToolBar->show(); 270 iconToolBar->show();
268 qApp->processEvents(); 271 qApp->processEvents();
269#endif 272#endif
270 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 273 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
271 int vh = height() ; 274 int vh = height() ;
272 int vw = width(); 275 int vw = width();
273 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 276 //qDebug("Toolbar hei %d ",iconToolBar->height() );
274 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 277 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
275 vh -= iconToolBar->height(); 278 vh -= iconToolBar->height();
276 } else { 279 } else {
277 vw -= iconToolBar->height(); 280 vw -= iconToolBar->height();
278 } 281 }
279 //mView->setMaximumSize( splash->size() ); 282 //mView->setMaximumSize( splash->size() );
280 //mView->resize( splash->size() ); 283 //mView->resize( splash->size() );
281 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 284 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
282 mView->readSettings(); 285 mView->readSettings();
283 bool newFile = false; 286 bool newFile = false;
284 if( !QFile::exists( defaultFileName() ) ) { 287 if( !QFile::exists( defaultFileName() ) ) {
285 QFileInfo finfo ( defaultFileName() ); 288 QFileInfo finfo ( defaultFileName() );
286 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 289 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
287 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 290 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
288 finfo.setFile( oldFile ); 291 finfo.setFile( oldFile );
289 if (finfo.exists() ) { 292 if (finfo.exists() ) {
290 KMessageBox::information( this, message); 293 KMessageBox::information( this, message);
291 mView->openCalendar( oldFile ); 294 mView->openCalendar( oldFile );
292 qApp->processEvents(); 295 qApp->processEvents();
293 } else { 296 } else {
294 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 297 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
295 finfo.setFile( oldFile ); 298 finfo.setFile( oldFile );
296 if (finfo.exists() ) { 299 if (finfo.exists() ) {
297 KMessageBox::information( this, message); 300 KMessageBox::information( this, message);
298 mView->openCalendar( oldFile ); 301 mView->openCalendar( oldFile );
299 qApp->processEvents(); 302 qApp->processEvents();
300 } 303 }
301 } 304 }
302 mView->saveCalendar( defaultFileName() ); 305 mView->saveCalendar( defaultFileName() );
303 newFile = true; 306 newFile = true;
304 } 307 }
305 308
306 QTime neededSaveTime = QDateTime::currentDateTime().time(); 309 QTime neededSaveTime = QDateTime::currentDateTime().time();
307 mView->openCalendar( defaultFileName() ); 310 mView->openCalendar( defaultFileName() );
308 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 311 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
309 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 312 qDebug("KO: Calendar loading time: %d ms",msNeeded );
310 313
311 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 314 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
312 KOPrefs::instance()->setAllDefaults(); 315 KOPrefs::instance()->setAllDefaults();
313 int count = mView->addCategories(); 316 int count = mView->addCategories();
314 } 317 }
315 processIncidenceSelection( 0 ); 318 processIncidenceSelection( 0 );
316 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 319 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
317 SLOT( processIncidenceSelection( Incidence * ) ) ); 320 SLOT( processIncidenceSelection( Incidence * ) ) );
318 connect( mView, SIGNAL( modifiedChanged( bool ) ), 321 connect( mView, SIGNAL( modifiedChanged( bool ) ),
319 SLOT( slotModifiedChanged( bool ) ) ); 322 SLOT( slotModifiedChanged( bool ) ) );
320 323
321 324
322 connect( mView, SIGNAL( tempDisableBR(bool) ), 325 connect( mView, SIGNAL( tempDisableBR(bool) ),
323 SLOT( disableBR(bool) ) ); 326 SLOT( disableBR(bool) ) );
324 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 327 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
325 mView->setModified( false ); 328 mView->setModified( false );
326 mBlockAtStartup = false; 329 mBlockAtStartup = false;
327 mView->setModified( false ); 330 mView->setModified( false );
328 setCentralWidget( mView ); 331 setCentralWidget( mView );
329 globalFlagBlockStartup = 0; 332 globalFlagBlockStartup = 0;
330 mView->show(); 333 mView->show();
331 delete splash; 334 delete splash;
332 if ( newFile ) 335 if ( newFile )
333 mView->updateConfig(); 336 mView->updateConfig();
334 // qApp->processEvents(); 337 // qApp->processEvents();
335 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 338 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
336 //fillSyncMenu(); 339 //fillSyncMenu();
337 340
338 341
339 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 342 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
340 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 343 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
341 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 344 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
342 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 345 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
343 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 346 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
344 mSyncManager->setDefaultFileName( sentSyncFile()); 347 mSyncManager->setDefaultFileName( sentSyncFile());
345 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 348 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
346 mSyncManager->fillSyncMenu(); 349 mSyncManager->fillSyncMenu();
347 350
348 351
349 352
350 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 353 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
351 if ( showWarning ) { 354 if ( showWarning ) {
352 KMessageBox::information( this, 355 KMessageBox::information( this,
353 "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"); 356 "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");
354 qApp->processEvents(); 357 qApp->processEvents();
355 mView->dialogManager()->showSyncOptions(); 358 mView->dialogManager()->showSyncOptions();
356 } 359 }
357 360
358 //US listen for result adressed from Ka/Pi 361 //US listen for result adressed from Ka/Pi
359#ifndef DESKTOP_VERSION 362#ifndef DESKTOP_VERSION
360 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 363 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
361#endif 364#endif
362#ifndef DESKTOP_VERSION 365#ifndef DESKTOP_VERSION
363 infrared = 0; 366 infrared = 0;
364#endif 367#endif
365 updateFilterToolbar(); 368 updateFilterToolbar();
366 updateWeek( mView->startDate() ); 369 updateWeek( mView->startDate() );
367 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 370 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
368 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 371 SLOT( updateWeekNum( const KCal::DateList & ) ) );
369 mBRdisabled = false; 372 mBRdisabled = false;
370 //toggleBeamReceive(); 373 //toggleBeamReceive();
371} 374}
372MainWindow::~MainWindow() 375MainWindow::~MainWindow()
373{ 376{
374 //qDebug("MainWindow::~MainWindow() "); 377 //qDebug("MainWindow::~MainWindow() ");
375 //save toolbar location 378 //save toolbar location
376 delete mCalendar; 379 delete mCalendar;
377 delete mSyncManager; 380 delete mSyncManager;
378#ifndef DESKTOP_VERSION 381#ifndef DESKTOP_VERSION
379 if ( infrared ) 382 if ( infrared )
380 delete infrared; 383 delete infrared;
381#endif 384#endif
382 385
383 386
384} 387}
385 388
386void MainWindow::disableBR(bool b) 389void MainWindow::disableBR(bool b)
387{ 390{
388#ifndef DESKTOP_VERSION 391#ifndef DESKTOP_VERSION
389 if ( b ) { 392 if ( b ) {
390 if ( infrared ) { 393 if ( infrared ) {
391 toggleBeamReceive(); 394 toggleBeamReceive();
392 mBRdisabled = true; 395 mBRdisabled = true;
393 } 396 }
394 mBRdisabled = true; 397 mBRdisabled = true;
395 } else { 398 } else {
396 if ( mBRdisabled ) { 399 if ( mBRdisabled ) {
397 mBRdisabled = false; 400 mBRdisabled = false;
398 //makes no sense,because other cal ap is probably running 401 //makes no sense,because other cal ap is probably running
399 // toggleBeamReceive(); 402 // toggleBeamReceive();
400 } 403 }
401 } 404 }
402#endif 405#endif
403 406
404} 407}
405bool MainWindow::beamReceiveEnabled() 408bool MainWindow::beamReceiveEnabled()
406{ 409{
407#ifndef DESKTOP_VERSION 410#ifndef DESKTOP_VERSION
408 return ( infrared != 0 ); 411 return ( infrared != 0 );
409#endif 412#endif
410 return false; 413 return false;
411} 414}
412 415
413void MainWindow::toggleBeamReceive() 416void MainWindow::toggleBeamReceive()
414{ 417{
415 if ( mBRdisabled ) 418 if ( mBRdisabled )
416 return; 419 return;
417#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
418 if ( infrared ) { 421 if ( infrared ) {
419 qDebug("KO: Disable BeamReceive "); 422 qDebug("KO: Disable BeamReceive ");
420 delete infrared; 423 delete infrared;
421 infrared = 0; 424 infrared = 0;
422 brAction->setOn(false); 425 brAction->setOn(false);
423 return; 426 return;
424 } 427 }
425 qDebug("KO: Enable BeamReceive "); 428 qDebug("KO: Enable BeamReceive ");
426 brAction->setOn(true); 429 brAction->setOn(true);
427 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 430 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
428 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 431 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
429#endif 432#endif
430} 433}
431void MainWindow::showMaximized () 434void MainWindow::showMaximized ()
432{ 435{
433#ifndef DESKTOP_VERSION 436#ifndef DESKTOP_VERSION
434 if ( ! globalFlagBlockStartup ) 437 if ( ! globalFlagBlockStartup )
435 if ( mClosed ) 438 if ( mClosed )
436 mView->goToday(); 439 mView->goToday();
437#endif 440#endif
438 QWidget::showMaximized () ; 441 QWidget::showMaximized () ;
439 mClosed = false; 442 mClosed = false;
440} 443}
441void MainWindow::closeEvent( QCloseEvent* ce ) 444void MainWindow::closeEvent( QCloseEvent* ce )
442{ 445{
443 446
444 447
445 448
446 if ( ! KOPrefs::instance()->mAskForQuit ) { 449 if ( ! KOPrefs::instance()->mAskForQuit ) {
447 saveOnClose(); 450 saveOnClose();
448 mClosed = true; 451 mClosed = true;
449 ce->accept(); 452 ce->accept();
450 return; 453 return;
451 454
452 } 455 }
453 456
454 switch( QMessageBox::information( this, "KO/Pi", 457 switch( QMessageBox::information( this, "KO/Pi",
455 i18n("Do you really want\nto close KO/Pi?"), 458 i18n("Do you really want\nto close KO/Pi?"),
456 i18n("Close"), i18n("No"), 459 i18n("Close"), i18n("No"),
457 0, 0 ) ) { 460 0, 0 ) ) {
458 case 0: 461 case 0:
459 saveOnClose(); 462 saveOnClose();
460 mClosed = true; 463 mClosed = true;
461 ce->accept(); 464 ce->accept();
462 break; 465 break;
463 case 1: 466 case 1:
464 ce->ignore(); 467 ce->ignore();
465 break; 468 break;
466 case 2: 469 case 2:
467 470
468 default: 471 default:
469 break; 472 break;
470 } 473 }
471 474
472 475
473} 476}
474 477
475void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 478void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
476{ 479{
477 QDataStream stream( data, IO_ReadOnly ); 480 QDataStream stream( data, IO_ReadOnly );
478 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 481 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
479 //QString datamess; 482 //QString datamess;
480 //qDebug("message "); 483 //qDebug("message ");
481 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 484 qDebug("KO: QCOP message received: %s ", cmsg.data() );
482 485
483 if ( cmsg == "setDocument(QString)" ) { 486 if ( cmsg == "setDocument(QString)" ) {
484 QDataStream stream( data, IO_ReadOnly ); 487 QDataStream stream( data, IO_ReadOnly );
485 QString fileName; 488 QString fileName;
486 stream >> fileName; 489 stream >> fileName;
487 //qDebug("filename %s ", fileName.latin1()); 490 //qDebug("filename %s ", fileName.latin1());
488 showMaximized(); 491 showMaximized();
489 raise(); 492 raise();
490 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 493 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
491 mSyncManager->slotSyncMenu( 1002 ); 494 mSyncManager->slotSyncMenu( 1002 );
492 return; 495 return;
493 } 496 }
494 497
495 if ( cmsg == "-writeFile" ) { 498 if ( cmsg == "-writeFile" ) {
496 // I made from the "-writeFile" an "-writeAlarm" 499 // I made from the "-writeFile" an "-writeAlarm"
497 mView->viewManager()->showWhatsNextView(); 500 mView->viewManager()->showWhatsNextView();
498 mCalendar->checkAlarmForIncidence( 0, true); 501 mCalendar->checkAlarmForIncidence( 0, true);
499 showMaximized(); 502 showMaximized();
500 raise(); 503 raise();
501 return; 504 return;
502 505
503 } 506 }
504 if ( cmsg == "-writeFileSilent" ) { 507 if ( cmsg == "-writeFileSilent" ) {
505 // I made from the "-writeFile" an "-writeAlarm" 508 // I made from the "-writeFile" an "-writeAlarm"
506 // mView->viewManager()->showWhatsNextView(); 509 // mView->viewManager()->showWhatsNextView();
507 mCalendar->checkAlarmForIncidence( 0, true); 510 mCalendar->checkAlarmForIncidence( 0, true);
508 //showMaximized(); 511 //showMaximized();
509 //raise(); 512 //raise();
510 hide(); 513 hide();
511 return; 514 return;
512 } 515 }
513 if ( cmsg == "-newCountdown" ) { 516 if ( cmsg == "-newCountdown" ) {
514 qDebug("newCountdown "); 517 qDebug("newCountdown ");
515 518
516 } 519 }
517 QString msg ; 520 QString msg ;
518 QString allmsg = cmsg; 521 QString allmsg = cmsg;
519 while ( allmsg.length() > 0 ) { 522 while ( allmsg.length() > 0 ) {
520 int nextC = allmsg.find( "-", 1 ); 523 int nextC = allmsg.find( "-", 1 );
521 if ( nextC == -1 ) { 524 if ( nextC == -1 ) {
522 msg = allmsg; 525 msg = allmsg;
523 allmsg = ""; 526 allmsg = "";
524 } else{ 527 } else{
525 msg = allmsg.left( nextC ); 528 msg = allmsg.left( nextC );
526 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 529 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
527 } 530 }
528 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 531 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
529 if ( msg == "-newEvent" ) { 532 if ( msg == "-newEvent" ) {
530 mView->newEvent(); 533 mView->newEvent();
531 } 534 }
532 if ( msg == "-newTodo" ) { 535 if ( msg == "-newTodo" ) {
533 mView->newTodo(); 536 mView->newTodo();
534 537
535 } 538 }
536 if ( msg == "-showWN" ) { 539 if ( msg == "-showWN" ) {
537 mView->viewManager()->showWhatsNextView(); 540 mView->viewManager()->showWhatsNextView();
538 } 541 }
539 if ( msg == "-showTodo" ) { 542 if ( msg == "-showTodo" ) {
540 mView->viewManager()->showTodoView(); 543 mView->viewManager()->showTodoView();
541 } 544 }
542 if ( msg == "-showList" ) { 545 if ( msg == "-showList" ) {
543 mView->viewManager()->showListView(); 546 mView->viewManager()->showListView();
544 } 547 }
545 else if ( msg == "-showDay" ) { 548 else if ( msg == "-showDay" ) {
546 mView->viewManager()->showDayView(); 549 mView->viewManager()->showDayView();
547 } 550 }
548 else if ( msg == "-showWWeek" ) { 551 else if ( msg == "-showWWeek" ) {
549 mView->viewManager()->showWorkWeekView(); 552 mView->viewManager()->showWorkWeekView();
550 } 553 }
551 else if ( msg == "-ringSync" ) { 554 else if ( msg == "-ringSync" ) {
552 mSyncManager->multiSync( false ); 555 mSyncManager->multiSync( false );
553 } 556 }
554 else if ( msg == "-showWeek" ) { 557 else if ( msg == "-showWeek" ) {
555 mView->viewManager()->showWeekView(); 558 mView->viewManager()->showWeekView();
556 } 559 }
557 else if ( msg == "-showTodo" ) { 560 else if ( msg == "-showTodo" ) {
558 mView->viewManager()->showTodoView(); 561 mView->viewManager()->showTodoView();
559 } 562 }
560 else if ( msg == "-showJournal" ) { 563 else if ( msg == "-showJournal" ) {
561 mView->dateNavigator()->selectDates( 1 ); 564 mView->dateNavigator()->selectDates( 1 );
562 mView->dateNavigator()->selectToday(); 565 mView->dateNavigator()->selectToday();
563 mView->viewManager()->showJournalView(); 566 mView->viewManager()->showJournalView();
564 } 567 }
565 else if ( msg == "-showKO" ) { 568 else if ( msg == "-showKO" ) {
566 mView->viewManager()->showNextXView(); 569 mView->viewManager()->showNextXView();
567 } 570 }
568 else if ( msg == "-showWNext" ) { 571 else if ( msg == "-showWNext" ) {
569 mView->viewManager()->showWhatsNextView(); 572 mView->viewManager()->showWhatsNextView();
570 } 573 }
571 else if ( msg == "nextView()" ) { 574 else if ( msg == "nextView()" ) {
572 mView->viewManager()->showNextView(); 575 mView->viewManager()->showNextView();
573 } 576 }
574 else if ( msg == "-showNextXView" ) { 577 else if ( msg == "-showNextXView" ) {
575 mView->viewManager()->showNextXView(); 578 mView->viewManager()->showNextXView();
576 } 579 }
577 580
578 581
579 } 582 }
580 583
581 showMaximized(); 584 showMaximized();
582 raise(); 585 raise();
583} 586}
584 587
585QPixmap MainWindow::loadPixmap( QString name ) 588QPixmap MainWindow::loadPixmap( QString name )
586{ 589{
587 return SmallIcon( name ); 590 return SmallIcon( name );
588 591
589} 592}
590void MainWindow::initActions() 593void MainWindow::initActions()
591{ 594{
592 //KOPrefs::instance()->mShowFullMenu 595 //KOPrefs::instance()->mShowFullMenu
593 iconToolBar->clear(); 596 iconToolBar->clear();
594 KOPrefs *p = KOPrefs::instance(); 597 KOPrefs *p = KOPrefs::instance();
595 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 598 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
596 599
597 QPopupMenu *viewMenu = new QPopupMenu( this ); 600 QPopupMenu *viewMenu = new QPopupMenu( this );
598 QPopupMenu *actionMenu = new QPopupMenu( this ); 601 QPopupMenu *actionMenu = new QPopupMenu( this );
599 QPopupMenu *importMenu = new QPopupMenu( this ); 602 QPopupMenu *importMenu = new QPopupMenu( this );
600 QPopupMenu *importMenu_X = new QPopupMenu( this ); 603 QPopupMenu *importMenu_X = new QPopupMenu( this );
601 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 604 QPopupMenu *exportMenu_X = new QPopupMenu( this );
602 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 605 QPopupMenu *beamMenu_X = new QPopupMenu( this );
603 selectFilterMenu = new QPopupMenu( this ); 606 selectFilterMenu = new QPopupMenu( this );
604 selectFilterMenu->setCheckable( true ); 607 selectFilterMenu->setCheckable( true );
605 syncMenu = new QPopupMenu( this ); 608 syncMenu = new QPopupMenu( this );
606 configureAgendaMenu = new QPopupMenu( this ); 609 configureAgendaMenu = new QPopupMenu( this );
607 configureToolBarMenu = new QPopupMenu( this ); 610 configureToolBarMenu = new QPopupMenu( this );
608 QPopupMenu *helpMenu = new QPopupMenu( this ); 611 QPopupMenu *helpMenu = new QPopupMenu( this );
609 QIconSet icon; 612 QIconSet icon;
610 int pixWid = 22, pixHei = 22; 613 int pixWid = 22, pixHei = 22;
611 QString pathString = ""; 614 QString pathString = "";
612 if ( !p->mToolBarMiniIcons ) { 615 if ( !p->mToolBarMiniIcons ) {
613 if ( QApplication::desktop()->width() < 480 ) { 616 if ( QApplication::desktop()->width() < 480 ) {
614 pathString += "icons16/"; 617 pathString += "icons16/";
615 pixWid = 18; pixHei = 16; 618 pixWid = 18; pixHei = 16;
616 } 619 }
617 } else { 620 } else {
618 pathString += "iconsmini/"; 621 pathString += "iconsmini/";
619 pixWid = 18; pixHei = 16; 622 pixWid = 18; pixHei = 16;
620 } 623 }
621 if ( KOPrefs::instance()->mShowFullMenu ) { 624 if ( KOPrefs::instance()->mShowFullMenu ) {
622 QMenuBar *menuBar1; 625 QMenuBar *menuBar1;
623 menuBar1 = menuBar(); 626 menuBar1 = menuBar();
624 menuBar1->insertItem( i18n("File"), importMenu ); 627 menuBar1->insertItem( i18n("File"), importMenu );
625 menuBar1->insertItem( i18n("View"), viewMenu ); 628 menuBar1->insertItem( i18n("View"), viewMenu );
626 menuBar1->insertItem( i18n("Actions"), actionMenu ); 629 menuBar1->insertItem( i18n("Actions"), actionMenu );
627#ifdef DESKTOP_VERSION 630#ifdef DESKTOP_VERSION
628 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 631 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
629 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 632 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
630#else 633#else
631 menuBar1->insertItem( i18n("Sync"), syncMenu ); 634 menuBar1->insertItem( i18n("Sync"), syncMenu );
632 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 635 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
633#endif 636#endif
634 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 637 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
635 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 638 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
636 menuBar1->insertItem( i18n("Help"), helpMenu ); 639 menuBar1->insertItem( i18n("Help"), helpMenu );
637 } else { 640 } else {
638 QPEMenuBar *menuBar1; 641 QPEMenuBar *menuBar1;
639 menuBar1 = new QPEMenuBar( iconToolBar ); 642 menuBar1 = new QPEMenuBar( iconToolBar );
640 QPopupMenu *menuBar = new QPopupMenu( this ); 643 QPopupMenu *menuBar = new QPopupMenu( this );
641 icon = loadPixmap( pathString + "z_menu" ); 644 icon = loadPixmap( pathString + "z_menu" );
642 menuBar1->insertItem( icon.pixmap(), menuBar); 645 menuBar1->insertItem( icon.pixmap(), menuBar);
643 //menuBar1->insertItem( i18n("ME"), menuBar); 646 //menuBar1->insertItem( i18n("ME"), menuBar);
644 menuBar->insertItem( i18n("File"), importMenu ); 647 menuBar->insertItem( i18n("File"), importMenu );
645 menuBar->insertItem( i18n("View"), viewMenu ); 648 menuBar->insertItem( i18n("View"), viewMenu );
646 menuBar->insertItem( i18n("Actions"), actionMenu ); 649 menuBar->insertItem( i18n("Actions"), actionMenu );
647 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 650 menuBar->insertItem( i18n("Synchronize"), syncMenu );
648 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 651 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
649 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 652 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
650 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 653 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
651 menuBar->insertItem( i18n("Help"), helpMenu ); 654 menuBar->insertItem( i18n("Help"), helpMenu );
652 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 655 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
653 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 656 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
654 } 657 }
655 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 658 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
656 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 659 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
657 660
658 661
659 mWeekBgColor = iconToolBar->backgroundColor(); 662 mWeekBgColor = iconToolBar->backgroundColor();
660 mWeekPixmap.resize( pixWid , pixHei ); 663 mWeekPixmap.resize( pixWid , pixHei );
661 mWeekPixmap.fill( mWeekBgColor ); 664 mWeekPixmap.fill( mWeekBgColor );
662 icon = mWeekPixmap; 665 icon = mWeekPixmap;
663 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 666 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
664 if ( p-> mShowIconWeekNum ) 667 if ( p-> mShowIconWeekNum )
665 mWeekAction->addTo( iconToolBar ); 668 mWeekAction->addTo( iconToolBar );
666 mWeekFont = font(); 669 mWeekFont = font();
667 670
668 int fontPoint = mWeekFont.pointSize(); 671 int fontPoint = mWeekFont.pointSize();
669 QFontMetrics f( mWeekFont ); 672 QFontMetrics f( mWeekFont );
670 int fontWid = f.width( "30" ); 673 int fontWid = f.width( "30" );
671 while ( fontWid > pixWid ) { 674 while ( fontWid > pixWid ) {
672 --fontPoint; 675 --fontPoint;
673 mWeekFont.setPointSize( fontPoint ); 676 mWeekFont.setPointSize( fontPoint );
674 QFontMetrics f( mWeekFont ); 677 QFontMetrics f( mWeekFont );
675 fontWid = f.width( "30" ); 678 fontWid = f.width( "30" );
676 //qDebug("dec-- "); 679 //qDebug("dec-- ");
677 } 680 }
678 681
679 connect( mWeekAction, SIGNAL( activated() ), 682 connect( mWeekAction, SIGNAL( activated() ),
680 this, SLOT( weekAction() ) ); 683 this, SLOT( weekAction() ) );
681 684
682 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 685 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
683 if ( p->mShowIconFilterview ) { 686 if ( p->mShowIconFilterview ) {
684 icon = loadPixmap( pathString + "filter" ); 687 icon = loadPixmap( pathString + "filter" );
685 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 688 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
686 connect( actionFilterMenuTB, SIGNAL( activated() ), 689 connect( actionFilterMenuTB, SIGNAL( activated() ),
687 this, SLOT( fillFilterMenuTB() ) ); 690 this, SLOT( fillFilterMenuTB() ) );
688 actionFilterMenuTB->addTo( iconToolBar ); 691 actionFilterMenuTB->addTo( iconToolBar );
689 selectFilterMenuTB = new QPopupMenu( this ); 692 selectFilterMenuTB = new QPopupMenu( this );
690 selectFilterMenuTB->setCheckable( true ); 693 selectFilterMenuTB->setCheckable( true );
691 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 694 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
692 } 695 }
693 696
694 //#endif 697 //#endif
695 // ****************** 698 // ******************
696 QAction *action; 699 QAction *action;
697 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 700 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
698 configureToolBarMenu->setCheckable( true ); 701 configureToolBarMenu->setCheckable( true );
699 702
700 703
701 configureAgendaMenu->setCheckable( true ); 704 configureAgendaMenu->setCheckable( true );
702 int iii ; 705 int iii ;
703 for ( iii = 1;iii<= 10 ;++iii ){ 706 for ( iii = 1;iii<= 10 ;++iii ){
704 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 707 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
705 } 708 }
706 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 709 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
707 710
708 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 711 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
709 this, SLOT( showConfigureAgenda( ) ) ); 712 this, SLOT( showConfigureAgenda( ) ) );
710 713
711 icon = loadPixmap( pathString + "configure" ); 714 icon = loadPixmap( pathString + "configure" );
712 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 715 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
713 action->addTo( actionMenu ); 716 action->addTo( actionMenu );
714 connect( action, SIGNAL( activated() ), 717 connect( action, SIGNAL( activated() ),
715 mView, SLOT( edit_options() ) ); 718 mView, SLOT( edit_options() ) );
716 actionMenu->insertSeparator(); 719 actionMenu->insertSeparator();
717 720
718 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 721 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
719 action->addTo( actionMenu ); 722 action->addTo( actionMenu );
720 connect( action, SIGNAL( activated() ), 723 connect( action, SIGNAL( activated() ),
721 mView, SLOT( undo_delete() ) ); 724 mView, SLOT( undo_delete() ) );
722 actionMenu->insertSeparator(); 725 actionMenu->insertSeparator();
723 726
724 icon = loadPixmap( pathString + "newevent" ); 727 icon = loadPixmap( pathString + "newevent" );
725 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 728 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
726 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 729 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
727 configureToolBarMenu->insertSeparator(); 730 configureToolBarMenu->insertSeparator();
728 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 731 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
729 configureToolBarMenu->insertSeparator(); 732 configureToolBarMenu->insertSeparator();
730 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 733 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
731 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 734 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
732 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 735 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
733 ne_action->addTo( actionMenu ); 736 ne_action->addTo( actionMenu );
734 connect( ne_action, SIGNAL( activated() ), 737 connect( ne_action, SIGNAL( activated() ),
735 mView, SLOT( newEvent() ) ); 738 mView, SLOT( newEvent() ) );
736 icon = loadPixmap( pathString + "newtodo" ); 739 icon = loadPixmap( pathString + "newtodo" );
737 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 740 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
738 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 741 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
739 nt_action->addTo( actionMenu ); 742 nt_action->addTo( actionMenu );
740 connect( nt_action, SIGNAL( activated() ), 743 connect( nt_action, SIGNAL( activated() ),
741 mView, SLOT( newTodo() ) ); 744 mView, SLOT( newTodo() ) );
742 745
743 icon = loadPixmap( pathString + "today" ); 746 icon = loadPixmap( pathString + "today" );
744 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 747 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
745 today_action->addTo( viewMenu ); 748 today_action->addTo( viewMenu );
746 connect( today_action, SIGNAL( activated() ), 749 connect( today_action, SIGNAL( activated() ),
747 mView, SLOT( goToday() ) ); 750 mView, SLOT( goToday() ) );
748 viewMenu->insertSeparator(); 751 viewMenu->insertSeparator();
749 752
750 // *********************** 753 // ***********************
751 if ( KOPrefs::instance()->mVerticalScreen ) { 754 if ( KOPrefs::instance()->mVerticalScreen ) {
752 icon = SmallIcon( "1updownarrow" ); 755 icon = SmallIcon( "1updownarrow" );
753 } else { 756 } else {
754 icon = SmallIcon("1leftrightarrow" ); 757 icon = SmallIcon("1leftrightarrow" );
755 } 758 }
756 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 759 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
757 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 760 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
758 FSaction->addTo( viewMenu ); 761 FSaction->addTo( viewMenu );
759 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 762 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
760 763
761 icon = loadPixmap( pathString + "navi" ); 764 icon = loadPixmap( pathString + "navi" );
762 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 765 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
763 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 766 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
764 action->addTo( viewMenu ); 767 action->addTo( viewMenu );
765 connect( action, SIGNAL( activated() ), 768 connect( action, SIGNAL( activated() ),
766 mView, SLOT( toggleDateNavigatorWidget() ) ); 769 mView, SLOT( toggleDateNavigatorWidget() ) );
767 mToggleNav = action ; 770 mToggleNav = action ;
768 icon = loadPixmap( pathString + "filter" ); 771 icon = loadPixmap( pathString + "filter" );
769 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 772 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
770 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 773 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
771 action->addTo( viewMenu ); 774 action->addTo( viewMenu );
772 connect( action, SIGNAL( activated() ), 775 connect( action, SIGNAL( activated() ),
773 mView, SLOT( toggleFilter() ) ); 776 mView, SLOT( toggleFilter() ) );
774 mToggleFilter = action; 777 mToggleFilter = action;
775 icon = loadPixmap( pathString + "allday" ); 778 icon = loadPixmap( pathString + "allday" );
776 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 779 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
777 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 780 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
778 action->addTo( viewMenu ); 781 action->addTo( viewMenu );
779 connect( action, SIGNAL( activated() ), 782 connect( action, SIGNAL( activated() ),
780 mView, SLOT( toggleAllDaySize() ) ); 783 mView, SLOT( toggleAllDaySize() ) );
781 mToggleAllday = action; 784 mToggleAllday = action;
782 785
783 786
784 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 787 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
785 mToggleNav, SLOT( setEnabled ( bool ) ) ); 788 mToggleNav, SLOT( setEnabled ( bool ) ) );
786 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 789 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
787 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 790 mToggleFilter, SLOT( setEnabled ( bool ) ) );
788 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 791 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
789 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 792 mToggleAllday, SLOT( setEnabled ( bool ) ) );
790 793
791 viewMenu->insertSeparator(); 794 viewMenu->insertSeparator();
792 icon = loadPixmap( pathString + "picker" ); 795 icon = loadPixmap( pathString + "picker" );
793 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 796 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
794 action->addTo( viewMenu ); 797 action->addTo( viewMenu );
795 connect( action, SIGNAL( activated() ), 798 connect( action, SIGNAL( activated() ),
796 mView, SLOT( showDatePicker() ) ); 799 mView, SLOT( showDatePicker() ) );
797 action->addTo( iconToolBar ); 800 action->addTo( iconToolBar );
798 viewMenu->insertSeparator(); 801 viewMenu->insertSeparator();
799 802
800 if ( p-> mShowIconToggleFull ) 803 if ( p-> mShowIconToggleFull )
801 FSaction->addTo( iconToolBar ); 804 FSaction->addTo( iconToolBar );
802 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 805 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
803 806
804 //******************** 807 //********************
805 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 808 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
806 809
807 810
808 icon = loadPixmap( pathString + "whatsnext" ); 811 icon = loadPixmap( pathString + "whatsnext" );
809 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 812 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
810 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 813 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
811 whatsnext_action->addTo( viewMenu ); 814 whatsnext_action->addTo( viewMenu );
812 connect( whatsnext_action, SIGNAL( activated() ), 815 connect( whatsnext_action, SIGNAL( activated() ),
813 mView->viewManager(), SLOT( showWhatsNextView() ) ); 816 mView->viewManager(), SLOT( showWhatsNextView() ) );
814 817
815 icon = loadPixmap( pathString + "xdays" ); 818 icon = loadPixmap( pathString + "xdays" );
816 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 819 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
817 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 820 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
818 xdays_action->addTo( viewMenu ); 821 xdays_action->addTo( viewMenu );
819 connect( xdays_action, SIGNAL( activated() ), 822 connect( xdays_action, SIGNAL( activated() ),
820 mView->viewManager(), SLOT( showNextXView() ) ); 823 mView->viewManager(), SLOT( showNextXView() ) );
821 824
822 825
823 icon = loadPixmap( pathString + "journal" ); 826 icon = loadPixmap( pathString + "journal" );
824 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 827 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
825 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 828 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
826 viewjournal_action->addTo( viewMenu ); 829 viewjournal_action->addTo( viewMenu );
827 connect( viewjournal_action, SIGNAL( activated() ), 830 connect( viewjournal_action, SIGNAL( activated() ),
828 mView->viewManager(), SLOT( showJournalView() ) ); 831 mView->viewManager(), SLOT( showJournalView() ) );
829 832
830 833
831 icon = loadPixmap( pathString + "day" ); 834 icon = loadPixmap( pathString + "day" );
832 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 835 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
833 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 836 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
834 day1_action->addTo( viewMenu ); 837 day1_action->addTo( viewMenu );
835 // action->addTo( toolBar ); 838 // action->addTo( toolBar );
836 connect( day1_action, SIGNAL( activated() ), 839 connect( day1_action, SIGNAL( activated() ),
837 mView->viewManager(), SLOT( showDayView() ) ); 840 mView->viewManager(), SLOT( showDayView() ) );
838 841
839 icon = loadPixmap( pathString + "workweek" ); 842 icon = loadPixmap( pathString + "workweek" );
840 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 843 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
841 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 844 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
842 day5_action->addTo( viewMenu ); 845 day5_action->addTo( viewMenu );
843 connect( day5_action, SIGNAL( activated() ), 846 connect( day5_action, SIGNAL( activated() ),
844 mView->viewManager(), SLOT( showWorkWeekView() ) ); 847 mView->viewManager(), SLOT( showWorkWeekView() ) );
845 848
846 icon = loadPixmap( pathString + "week" ); 849 icon = loadPixmap( pathString + "week" );
847 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 850 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
848 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 851 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
849 day7_action->addTo( viewMenu ); 852 day7_action->addTo( viewMenu );
850 connect( day7_action, SIGNAL( activated() ), 853 connect( day7_action, SIGNAL( activated() ),
851 mView->viewManager(), SLOT( showWeekView() ) ); 854 mView->viewManager(), SLOT( showWeekView() ) );
852 855
853 icon = loadPixmap( pathString + "workweek2" ); 856 icon = loadPixmap( pathString + "workweek2" );
854 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 857 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
855 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 858 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
856 day6_action->addTo( viewMenu ); 859 day6_action->addTo( viewMenu );
857 connect( day6_action, SIGNAL( activated() ), 860 connect( day6_action, SIGNAL( activated() ),
858 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 861 mView->viewManager(), SLOT( showMonthViewWeek() ) );
859 862
860 icon = loadPixmap( pathString + "month" ); 863 icon = loadPixmap( pathString + "month" );
861 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 864 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
862 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 865 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
863 month_action->addTo( viewMenu ); 866 month_action->addTo( viewMenu );
864 connect( month_action, SIGNAL( activated() ), 867 connect( month_action, SIGNAL( activated() ),
865 mView->viewManager(), SLOT( showMonthView() ) ); 868 mView->viewManager(), SLOT( showMonthView() ) );
866 869
867 icon = loadPixmap( pathString + "list" ); 870 icon = loadPixmap( pathString + "list" );
868 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 871 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
869 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 872 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
870 showlist_action->addTo( viewMenu ); 873 showlist_action->addTo( viewMenu );
871 connect( showlist_action, SIGNAL( activated() ), 874 connect( showlist_action, SIGNAL( activated() ),
872 mView->viewManager(), SLOT( showListView() ) ); 875 mView->viewManager(), SLOT( showListView() ) );
873 876
874 icon = loadPixmap( pathString + "todo" ); 877 icon = loadPixmap( pathString + "todo" );
875 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 878 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
876 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 879 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
877 todoview_action->addTo( viewMenu ); 880 todoview_action->addTo( viewMenu );
878 connect( todoview_action, SIGNAL( activated() ), 881 connect( todoview_action, SIGNAL( activated() ),
879 mView->viewManager(), SLOT( showTodoView() ) ); 882 mView->viewManager(), SLOT( showTodoView() ) );
880 883
881 884
882 885
883#if 0 886#if 0
884 action = new QAction( "view_timespan", "Time Span", 0, this ); 887 action = new QAction( "view_timespan", "Time Span", 0, this );
885 action->addTo( viewMenu ); 888 action->addTo( viewMenu );
886 connect( action, SIGNAL( activated() ), 889 connect( action, SIGNAL( activated() ),
887 mView->viewManager(), SLOT( showTimeSpanView() ) ); 890 mView->viewManager(), SLOT( showTimeSpanView() ) );
888#endif 891#endif
889 892
890 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 893 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
891 this ); 894 this );
892 mNewSubTodoAction->addTo( actionMenu ); 895 mNewSubTodoAction->addTo( actionMenu );
893 connect( mNewSubTodoAction, SIGNAL( activated() ), 896 connect( mNewSubTodoAction, SIGNAL( activated() ),
894 mView, SLOT( newSubTodo() ) ); 897 mView, SLOT( newSubTodo() ) );
895 898
896 actionMenu->insertSeparator(); 899 actionMenu->insertSeparator();
897 900
898 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 901 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
899 mShowAction->addTo( actionMenu ); 902 mShowAction->addTo( actionMenu );
900 connect( mShowAction, SIGNAL( activated() ), 903 connect( mShowAction, SIGNAL( activated() ),
901 mView, SLOT( showIncidence() ) ); 904 mView, SLOT( showIncidence() ) );
902 905
903 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 906 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
904 mEditAction->addTo( actionMenu ); 907 mEditAction->addTo( actionMenu );
905 connect( mEditAction, SIGNAL( activated() ), 908 connect( mEditAction, SIGNAL( activated() ),
906 mView, SLOT( editIncidence() ) ); 909 mView, SLOT( editIncidence() ) );
907 910
908 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 911 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
909 mDeleteAction->addTo( actionMenu ); 912 mDeleteAction->addTo( actionMenu );
910 connect( mDeleteAction, SIGNAL( activated() ), 913 connect( mDeleteAction, SIGNAL( activated() ),
911 mView, SLOT( deleteIncidence() ) ); 914 mView, SLOT( deleteIncidence() ) );
912 915
913 916
914 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 917 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
915 mCloneAction->addTo( actionMenu ); 918 mCloneAction->addTo( actionMenu );
916 connect( mCloneAction, SIGNAL( activated() ), 919 connect( mCloneAction, SIGNAL( activated() ),
917 mView, SLOT( cloneIncidence() ) ); 920 mView, SLOT( cloneIncidence() ) );
918 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 921 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
919 mMoveAction->addTo( actionMenu ); 922 mMoveAction->addTo( actionMenu );
920 connect( mMoveAction, SIGNAL( activated() ), 923 connect( mMoveAction, SIGNAL( activated() ),
921 mView, SLOT( moveIncidence() ) ); 924 mView, SLOT( moveIncidence() ) );
922 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 925 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
923 mBeamAction->addTo( actionMenu ); 926 mBeamAction->addTo( actionMenu );
924 connect( mBeamAction, SIGNAL( activated() ), 927 connect( mBeamAction, SIGNAL( activated() ),
925 mView, SLOT( beamIncidence() ) ); 928 mView, SLOT( beamIncidence() ) );
926 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 929 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
927 mCancelAction->addTo( actionMenu ); 930 mCancelAction->addTo( actionMenu );
928 connect( mCancelAction, SIGNAL( activated() ), 931 connect( mCancelAction, SIGNAL( activated() ),
929 mView, SLOT( toggleCancelIncidence() ) ); 932 mView, SLOT( toggleCancelIncidence() ) );
930 933
931 actionMenu->insertSeparator(); 934 actionMenu->insertSeparator();
932 935
933 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 936 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
934 this ); 937 this );
935 action->addTo( actionMenu ); 938 action->addTo( actionMenu );
936 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 939 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
937 940
938 icon = loadPixmap( pathString + "search" ); 941 icon = loadPixmap( pathString + "search" );
939 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 942 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
940 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 943 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
941 search_action->addTo( actionMenu ); 944 search_action->addTo( actionMenu );
942 connect( search_action, SIGNAL( activated() ), 945 connect( search_action, SIGNAL( activated() ),
943 mView->dialogManager(), SLOT( showSearchDialog() ) ); 946 mView->dialogManager(), SLOT( showSearchDialog() ) );
944 947
945 948
946 949
947 if ( KOPrefs::instance()->mShowFullMenu ) { 950 if ( KOPrefs::instance()->mShowFullMenu ) {
948 actionMenu->insertSeparator(); 951 actionMenu->insertSeparator();
949 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 952 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
950 953
951 } 954 }
952 // actionMenu->insertSeparator(); 955 // actionMenu->insertSeparator();
953 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 956 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
954 this ); 957 this );
955 action->addTo( importMenu_X ); 958 action->addTo( importMenu_X );
956 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 959 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
957 action = new QAction( "import_quick", i18n("Import last file"), 0, 960 action = new QAction( "import_quick", i18n("Import last file"), 0,
958 this ); 961 this );
959 action->addTo( importMenu_X ); 962 action->addTo( importMenu_X );
960 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 963 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
961 importMenu_X->insertSeparator(); 964 importMenu_X->insertSeparator();
962 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 965 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
963 this ); 966 this );
964 action->addTo( importMenu_X ); 967 action->addTo( importMenu_X );
965 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 968 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
966 //#ifndef DESKTOP_VERSION 969 //#ifndef DESKTOP_VERSION
967 importMenu_X->insertSeparator(); 970 importMenu_X->insertSeparator();
968 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 971 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
969 this ); 972 this );
970 action->addTo( importMenu_X ); 973 action->addTo( importMenu_X );
971 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 974 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
972 //#else 975 //#else
973#ifdef _OL_IMPORT_ 976#ifdef _OL_IMPORT_
974 importMenu_X->insertSeparator(); 977 importMenu_X->insertSeparator();
975 action = new QAction( "import_ol", i18n("Import from OL"), 0, 978 action = new QAction( "import_ol", i18n("Import from OL"), 0,
976 this ); 979 this );
977 action->addTo( importMenu_X ); 980 action->addTo( importMenu_X );
978 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 981 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
979#endif 982#endif
980 //#endif 983 //#endif
981 984
982 //importMenu->insertSeparator(); 985 //importMenu->insertSeparator();
983 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 986 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
984 this ); 987 this );
985 action->addTo( importMenu ); 988 action->addTo( importMenu );
986 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 989 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
987 990
988 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 991 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
989 this ); 992 this );
990 action->addTo( importMenu ); 993 action->addTo( importMenu );
991 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 994 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
992 importMenu->insertSeparator(); 995 importMenu->insertSeparator();
993 importMenu->insertItem( i18n("Import"), importMenu_X ); 996 importMenu->insertItem( i18n("Import"), importMenu_X );
994 //importMenu->insertSeparator(); 997 //importMenu->insertSeparator();
995 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 998 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
996 this ); 999 this );
997 action->addTo( exportMenu_X ); 1000 action->addTo( exportMenu_X );
998 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1001 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
999 1002
1000 1003
1001 //LR 1004 //LR
1002 QPopupMenu *ex2phone = new QPopupMenu( this ); 1005 QPopupMenu *ex2phone = new QPopupMenu( this );
1003 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1006 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1004 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1007 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1005 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1008 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1006 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1009 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1007 1010
1008 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1011 importMenu->insertItem( i18n("Export"), exportMenu_X );
1009#ifndef DESKTOP_VERSION 1012#ifndef DESKTOP_VERSION
1010 //importMenu->insertSeparator(); 1013 //importMenu->insertSeparator();
1011 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1014 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1012 this ); 1015 this );
1013 brAction->addTo( beamMenu_X ); 1016 brAction->addTo( beamMenu_X );
1014 brAction->setToggleAction (true ) ; 1017 brAction->setToggleAction (true ) ;
1015 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1018 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1016 1019
1017 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1020 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1018 this ); 1021 this );
1019 action->addTo( beamMenu_X ); 1022 action->addTo( beamMenu_X );
1020 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1023 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1021 1024
1022 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1025 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1023 this ); 1026 this );
1024 action->addTo( beamMenu_X ); 1027 action->addTo( beamMenu_X );
1025 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1028 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1026 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1029 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1027#else 1030#else
1028 //importMenu->insertSeparator(); 1031 //importMenu->insertSeparator();
1029 icon = loadPixmap( pathString + "print" ); 1032 icon = loadPixmap( pathString + "print" );
1030 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1033 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1031 action->addTo( beamMenu_X ); 1034 action->addTo( beamMenu_X );
1032 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
1033 this, SLOT( printCal() ) ); 1036 this, SLOT( printCal() ) );
1034 1037
1035 icon = loadPixmap( pathString + "print" ); 1038 icon = loadPixmap( pathString + "print" );
1036 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1039 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1037 action->addTo( beamMenu_X ); 1040 action->addTo( beamMenu_X );
1038 connect( action, SIGNAL( activated() ), 1041 connect( action, SIGNAL( activated() ),
1039 this, SLOT( printSel() ) ); 1042 this, SLOT( printSel() ) );
1040 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1043 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1041 action->addTo( beamMenu_X ); 1044 action->addTo( beamMenu_X );
1042 connect( action, SIGNAL( activated() ), 1045 connect( action, SIGNAL( activated() ),
1043 mView->viewManager(), SLOT( slotprintWNV() ) ); 1046 mView->viewManager(), SLOT( slotprintWNV() ) );
1044 1047
1045 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1048 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1046 action->addTo( beamMenu_X ); 1049 action->addTo( beamMenu_X );
1047 connect( action, SIGNAL( activated() ), 1050 connect( action, SIGNAL( activated() ),
1048 mView, SLOT( slotprintSelInc() ) ); 1051 mView, SLOT( slotprintSelInc() ) );
1049 1052
1050 1053
1051 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1054 importMenu->insertItem( i18n("Print"), beamMenu_X );
1052#endif 1055#endif
1053 importMenu->insertSeparator(); 1056 importMenu->insertSeparator();
1054 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1057 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1055 this ); 1058 this );
1056 action->addTo( importMenu ); 1059 action->addTo( importMenu );
1057 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1060 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1058 importMenu->insertSeparator(); 1061 importMenu->insertSeparator();
1059 action = new QAction( "beam all", i18n("Save"), 0, 1062 action = new QAction( "beam all", i18n("Save"), 0,
1060 this ); 1063 this );
1061 action->addTo( importMenu ); 1064 action->addTo( importMenu );
1062 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1065 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1063 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1066 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1064 this ); 1067 this );
1065 action->addTo( importMenu ); 1068 action->addTo( importMenu );
1066 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1069 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1067 1070
1068 //menuBar->insertItem( "Configure",configureMenu ); 1071 //menuBar->insertItem( "Configure",configureMenu );
1069 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1072 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1070 icon = loadPixmap( "korganizer/korganizer" ); 1073 icon = loadPixmap( "korganizer/korganizer" );
1071 1074
1072 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1075 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1073 action->addTo( helpMenu ); 1076 action->addTo( helpMenu );
1074 connect( action, SIGNAL( activated() ), 1077 connect( action, SIGNAL( activated() ),
1075 SLOT( whatsNew() ) ); 1078 SLOT( whatsNew() ) );
1076 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1079 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1077 action->addTo( helpMenu ); 1080 action->addTo( helpMenu );
1078 connect( action, SIGNAL( activated() ), 1081 connect( action, SIGNAL( activated() ),
1079 SLOT( features() ) ); 1082 SLOT( features() ) );
1080 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1083 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1081 action->addTo( helpMenu ); 1084 action->addTo( helpMenu );
1082 connect( action, SIGNAL( activated() ), 1085 connect( action, SIGNAL( activated() ),
1083 SLOT( keyBindings() ) ); 1086 SLOT( keyBindings() ) );
1084 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1087 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1085 action->addTo( helpMenu ); 1088 action->addTo( helpMenu );
1086 connect( action, SIGNAL( activated() ), 1089 connect( action, SIGNAL( activated() ),
1087 SLOT( storagehowto() ) ); 1090 SLOT( storagehowto() ) );
1088 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1091 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1089 action->addTo( helpMenu ); 1092 action->addTo( helpMenu );
1090 connect( action, SIGNAL( activated() ), 1093 connect( action, SIGNAL( activated() ),
1091 SLOT( timetrackinghowto() ) ); 1094 SLOT( timetrackinghowto() ) );
1092 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1095 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1093 action->addTo( helpMenu ); 1096 action->addTo( helpMenu );
1094 connect( action, SIGNAL( activated() ), 1097 connect( action, SIGNAL( activated() ),
1095 SLOT( synchowto() ) ); 1098 SLOT( synchowto() ) );
1096 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1099 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1097 action->addTo( helpMenu ); 1100 action->addTo( helpMenu );
1098 connect( action, SIGNAL( activated() ), 1101 connect( action, SIGNAL( activated() ),
1099 SLOT( kdesynchowto() ) ); 1102 SLOT( kdesynchowto() ) );
1100 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1103 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1101 action->addTo( helpMenu ); 1104 action->addTo( helpMenu );
1102 connect( action, SIGNAL( activated() ), 1105 connect( action, SIGNAL( activated() ),
1103 SLOT( multisynchowto() ) ); 1106 SLOT( multisynchowto() ) );
1104 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1107 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1105 action->addTo( helpMenu ); 1108 action->addTo( helpMenu );
1106 connect( action, SIGNAL( activated() ), 1109 connect( action, SIGNAL( activated() ),
1107 SLOT( aboutAutoSaving() ) ); 1110 SLOT( aboutAutoSaving() ) );
1108 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1111 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1109 action->addTo( helpMenu ); 1112 action->addTo( helpMenu );
1110 connect( action, SIGNAL( activated() ), 1113 connect( action, SIGNAL( activated() ),
1111 SLOT( aboutKnownBugs() ) ); 1114 SLOT( aboutKnownBugs() ) );
1112 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1115 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1113 action->addTo( helpMenu ); 1116 action->addTo( helpMenu );
1114 connect( action, SIGNAL( activated() ), 1117 connect( action, SIGNAL( activated() ),
1115 SLOT( usertrans() ) ); 1118 SLOT( usertrans() ) );
1116 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1119 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1117 action->addTo( helpMenu ); 1120 action->addTo( helpMenu );
1118 connect( action, SIGNAL( activated() ), 1121 connect( action, SIGNAL( activated() ),
1119 SLOT( faq() ) ); 1122 SLOT( faq() ) );
1120 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1123 action = new QAction( "licence", i18n("Licence..."), 0, this );
1121 action->addTo( helpMenu ); 1124 action->addTo( helpMenu );
1122 connect( action, SIGNAL( activated() ), 1125 connect( action, SIGNAL( activated() ),
1123 SLOT( licence() ) ); 1126 SLOT( licence() ) );
1124 action = new QAction( "about", i18n("About..."), 0, this ); 1127 action = new QAction( "about", i18n("About..."), 0, this );
1125 action->addTo( helpMenu ); 1128 action->addTo( helpMenu );
1126 connect( action, SIGNAL( activated() ), 1129 connect( action, SIGNAL( activated() ),
1127 SLOT( about() ) ); 1130 SLOT( about() ) );
1128 //menuBar->insertSeparator(); 1131 //menuBar->insertSeparator();
1129 1132
1130 // ****************************************************** 1133 // ******************************************************
1131 // menubar icons 1134 // menubar icons
1132 1135
1133 1136
1134 1137
1135 //menuBar->insertItem( iconToolBar ); 1138 //menuBar->insertItem( iconToolBar );
1136 //xdays_action 1139 //xdays_action
1137 if (p-> mShowIconNewEvent) 1140 if (p-> mShowIconNewEvent)
1138 ne_action->addTo( iconToolBar ); 1141 ne_action->addTo( iconToolBar );
1139 if (p->mShowIconNewTodo ) 1142 if (p->mShowIconNewTodo )
1140 nt_action->addTo( iconToolBar ); 1143 nt_action->addTo( iconToolBar );
1141 if (p-> mShowIconSearch) 1144 if (p-> mShowIconSearch)
1142 search_action->addTo( iconToolBar ); 1145 search_action->addTo( iconToolBar );
1143 if (p-> mShowIconWhatsThis) 1146 if (p-> mShowIconWhatsThis)
1144 QWhatsThis::whatsThisButton ( iconToolBar ); 1147 QWhatsThis::whatsThisButton ( iconToolBar );
1145 if (p-> mShowIconNext) 1148 if (p-> mShowIconNext)
1146 whatsnext_action->addTo( viewToolBar ); 1149 whatsnext_action->addTo( viewToolBar );
1147 if (p-> mShowIconNextDays) 1150 if (p-> mShowIconNextDays)
1148 xdays_action->addTo( viewToolBar ); 1151 xdays_action->addTo( viewToolBar );
1149 if (p-> mShowIconJournal) 1152 if (p-> mShowIconJournal)
1150 viewjournal_action->addTo( viewToolBar ); 1153 viewjournal_action->addTo( viewToolBar );
1151 if (p-> mShowIconDay1) 1154 if (p-> mShowIconDay1)
1152 day1_action->addTo( viewToolBar ); 1155 day1_action->addTo( viewToolBar );
1153 if (p-> mShowIconDay5) 1156 if (p-> mShowIconDay5)
1154 day5_action->addTo( viewToolBar ); 1157 day5_action->addTo( viewToolBar );
1155 if (p-> mShowIconDay7) 1158 if (p-> mShowIconDay7)
1156 day7_action->addTo( viewToolBar ); 1159 day7_action->addTo( viewToolBar );
1157 if (p-> mShowIconDay6) 1160 if (p-> mShowIconDay6)
1158 day6_action->addTo( viewToolBar ); 1161 day6_action->addTo( viewToolBar );
1159 if (p-> mShowIconMonth) 1162 if (p-> mShowIconMonth)
1160 month_action->addTo( viewToolBar ); 1163 month_action->addTo( viewToolBar );
1161 if (p-> mShowIconList) 1164 if (p-> mShowIconList)
1162 showlist_action->addTo( viewToolBar ); 1165 showlist_action->addTo( viewToolBar );
1163 if (p-> mShowIconTodoview) 1166 if (p-> mShowIconTodoview)
1164 todoview_action->addTo( viewToolBar ); 1167 todoview_action->addTo( viewToolBar );
1165 1168
1166 icon = loadPixmap( pathString + "2leftarrowB" ); 1169 icon = loadPixmap( pathString + "2leftarrowB" );
1167 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1170 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1168 if (p-> mShowIconBackFast) { 1171 if (p-> mShowIconBackFast) {
1169 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1172 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1170 connect( action, SIGNAL( activated() ), 1173 connect( action, SIGNAL( activated() ),
1171 mView, SLOT( goPreviousMonth() ) ); 1174 mView, SLOT( goPreviousMonth() ) );
1172 action->addTo( navigatorToolBar ); 1175 action->addTo( navigatorToolBar );
1173 } 1176 }
1174 icon = loadPixmap( pathString + "1leftarrowB" ); 1177 icon = loadPixmap( pathString + "1leftarrowB" );
1175 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1178 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1176 if (p-> mShowIconBack) { 1179 if (p-> mShowIconBack) {
1177 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1180 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1178 connect( action, SIGNAL( activated() ), 1181 connect( action, SIGNAL( activated() ),
1179 mView, SLOT( goPrevious() ) ); 1182 mView, SLOT( goPrevious() ) );
1180 action->addTo( navigatorToolBar ); 1183 action->addTo( navigatorToolBar );
1181 } 1184 }
1182 icon = loadPixmap( pathString + "today" ); 1185 icon = loadPixmap( pathString + "today" );
1183 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1186 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1184 if (p-> mShowIconToday) 1187 if (p-> mShowIconToday)
1185 today_action->addTo( navigatorToolBar ); 1188 today_action->addTo( navigatorToolBar );
1186 icon = loadPixmap( pathString + "1rightarrowB" ); 1189 icon = loadPixmap( pathString + "1rightarrowB" );
1187 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1190 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1188 if (p-> mShowIconForward) { 1191 if (p-> mShowIconForward) {
1189 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1192 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1190 connect( action, SIGNAL( activated() ), 1193 connect( action, SIGNAL( activated() ),
1191 mView, SLOT( goNext() ) ); 1194 mView, SLOT( goNext() ) );
1192 action->addTo( navigatorToolBar ); 1195 action->addTo( navigatorToolBar );
1193 } 1196 }
1194 icon = loadPixmap( pathString + "2rightarrowB" ); 1197 icon = loadPixmap( pathString + "2rightarrowB" );
1195 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1198 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1196 if (p-> mShowIconForwardFast) { 1199 if (p-> mShowIconForwardFast) {
1197 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1200 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1198 connect( action, SIGNAL( activated() ), 1201 connect( action, SIGNAL( activated() ),
1199 mView, SLOT( goNextMonth() ) ); 1202 mView, SLOT( goNextMonth() ) );
1200 action->addTo( navigatorToolBar ); 1203 action->addTo( navigatorToolBar );
1201 } 1204 }
1202 1205
1203 1206
1204 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1207 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1205 1208
1206 1209
1207 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1210 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1208 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1211 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1209 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1212 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1210 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1213 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1211 1214
1212 if (p-> mShowIconNewEvent) 1215 if (p-> mShowIconNewEvent)
1213 configureToolBarMenu->setItemChecked( 10, true ); 1216 configureToolBarMenu->setItemChecked( 10, true );
1214 if (p->mShowIconNewTodo ) 1217 if (p->mShowIconNewTodo )
1215 configureToolBarMenu->setItemChecked( 20, true ); 1218 configureToolBarMenu->setItemChecked( 20, true );
1216 if (p-> mShowIconSearch) 1219 if (p-> mShowIconSearch)
1217 configureToolBarMenu->setItemChecked( 120, true ); 1220 configureToolBarMenu->setItemChecked( 120, true );
1218 if (p-> mShowIconList) 1221 if (p-> mShowIconList)
1219 configureToolBarMenu->setItemChecked( 30, true ); 1222 configureToolBarMenu->setItemChecked( 30, true );
1220 if (p-> mShowIconDay1) 1223 if (p-> mShowIconDay1)
1221 configureToolBarMenu->setItemChecked( 40, true ); 1224 configureToolBarMenu->setItemChecked( 40, true );
1222 if (p-> mShowIconDay5) 1225 if (p-> mShowIconDay5)
1223 configureToolBarMenu->setItemChecked( 50, true ); 1226 configureToolBarMenu->setItemChecked( 50, true );
1224 if (p-> mShowIconDay6) 1227 if (p-> mShowIconDay6)
1225 configureToolBarMenu->setItemChecked( 75, true ); 1228 configureToolBarMenu->setItemChecked( 75, true );
1226 if (p-> mShowIconDay7) 1229 if (p-> mShowIconDay7)
1227 configureToolBarMenu->setItemChecked( 60, true ); 1230 configureToolBarMenu->setItemChecked( 60, true );
1228 if (p-> mShowIconMonth) 1231 if (p-> mShowIconMonth)
1229 configureToolBarMenu->setItemChecked( 70, true ); 1232 configureToolBarMenu->setItemChecked( 70, true );
1230 if (p-> mShowIconTodoview) 1233 if (p-> mShowIconTodoview)
1231 configureToolBarMenu->setItemChecked( 80, true ); 1234 configureToolBarMenu->setItemChecked( 80, true );
1232 if (p-> mShowIconBackFast) 1235 if (p-> mShowIconBackFast)
1233 configureToolBarMenu->setItemChecked( 200, true ); 1236 configureToolBarMenu->setItemChecked( 200, true );
1234 if (p-> mShowIconBack) 1237 if (p-> mShowIconBack)
1235 configureToolBarMenu->setItemChecked( 210, true ); 1238 configureToolBarMenu->setItemChecked( 210, true );
1236 if (p-> mShowIconToday) 1239 if (p-> mShowIconToday)
1237 configureToolBarMenu->setItemChecked( 130, true ); 1240 configureToolBarMenu->setItemChecked( 130, true );
1238 if (p-> mShowIconForward) 1241 if (p-> mShowIconForward)
1239 configureToolBarMenu->setItemChecked( 220, true ); 1242 configureToolBarMenu->setItemChecked( 220, true );
1240 if (p-> mShowIconForwardFast) 1243 if (p-> mShowIconForwardFast)
1241 configureToolBarMenu->setItemChecked( 230, true ); 1244 configureToolBarMenu->setItemChecked( 230, true );
1242 if (p-> mShowIconNextDays) 1245 if (p-> mShowIconNextDays)
1243 configureToolBarMenu->setItemChecked( 100, true ); 1246 configureToolBarMenu->setItemChecked( 100, true );
1244 if (p-> mShowIconNext) 1247 if (p-> mShowIconNext)
1245 configureToolBarMenu->setItemChecked( 110, true ); 1248 configureToolBarMenu->setItemChecked( 110, true );
1246 if (p-> mShowIconJournal) 1249 if (p-> mShowIconJournal)
1247 configureToolBarMenu->setItemChecked( 90, true ); 1250 configureToolBarMenu->setItemChecked( 90, true );
1248 if (p-> mShowIconWhatsThis) 1251 if (p-> mShowIconWhatsThis)
1249 configureToolBarMenu->setItemChecked( 300, true ); 1252 configureToolBarMenu->setItemChecked( 300, true );
1250 if (p-> mShowIconWeekNum) 1253 if (p-> mShowIconWeekNum)
1251 configureToolBarMenu->setItemChecked( 400, true ); 1254 configureToolBarMenu->setItemChecked( 400, true );
1252 if (!p-> mShowIconStretch) { 1255 if (!p-> mShowIconStretch) {
1253 QLabel* dummy = new QLabel( iconToolBar ); 1256 QLabel* dummy = new QLabel( iconToolBar );
1254 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1257 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1255 dummy->setMinimumWidth( 0 ); 1258 dummy->setMinimumWidth( 0 );
1256 iconToolBar->setStretchableWidget ( dummy ) ; 1259 iconToolBar->setStretchableWidget ( dummy ) ;
1257 } 1260 }
1258 else { 1261 else {
1259 iconToolBar->setHorizontalStretchable (true ); 1262 iconToolBar->setHorizontalStretchable (true );
1260 viewToolBar->setHorizontalStretchable (true ); 1263 viewToolBar->setHorizontalStretchable (true );
1261 navigatorToolBar->setHorizontalStretchable (true ); 1264 navigatorToolBar->setHorizontalStretchable (true );
1262 iconToolBar->setVerticalStretchable (true ); 1265 iconToolBar->setVerticalStretchable (true );
1263 viewToolBar->setVerticalStretchable (true ); 1266 viewToolBar->setVerticalStretchable (true );
1264 navigatorToolBar->setVerticalStretchable (true ); 1267 navigatorToolBar->setVerticalStretchable (true );
1265 configureToolBarMenu->setItemChecked( 5, true ); 1268 configureToolBarMenu->setItemChecked( 5, true );
1266 } 1269 }
1267 if (p-> mShowIconFilter) 1270 if (p-> mShowIconFilter)
1268 configureToolBarMenu->setItemChecked( 7, true ); 1271 configureToolBarMenu->setItemChecked( 7, true );
1269 if (p-> mShowIconOnetoolbar) 1272 if (p-> mShowIconOnetoolbar)
1270 configureToolBarMenu->setItemChecked( 6, true ); 1273 configureToolBarMenu->setItemChecked( 6, true );
1271 1274
1272 1275
1273 if ( filterMenubar ) 1276 if ( filterMenubar )
1274 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1277 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1275 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1278 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1276 configureAgenda( p->mHourSize ); 1279 configureAgenda( p->mHourSize );
1277 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1280 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1278} 1281}
1279 1282
1280void MainWindow::exportToPhone( int mode ) 1283void MainWindow::exportToPhone( int mode )
1281{ 1284{
1282 1285
1283 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1286 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1284 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1287 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1285 KOex2phonePrefs ex2phone; 1288 KOex2phonePrefs ex2phone;
1286 1289
1287 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1290 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1288 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1291 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1289 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1292 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1290 if ( mode == 1 ) 1293 if ( mode == 1 )
1291 ex2phone.setCaption(i18n("Export complete calendar")); 1294 ex2phone.setCaption(i18n("Export complete calendar"));
1292 if ( mode == 2 ) 1295 if ( mode == 2 )
1293 ex2phone.setCaption(i18n("Export filtered calendar")); 1296 ex2phone.setCaption(i18n("Export filtered calendar"));
1294 1297
1295 if ( !ex2phone.exec() ) { 1298 if ( !ex2phone.exec() ) {
1296 return; 1299 return;
1297 } 1300 }
1298 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1301 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1299 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1302 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1300 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1303 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1301 1304
1302 int inFuture = 0; 1305 int inFuture = 0;
1303 if ( ex2phone.mWriteBackFuture->isChecked() ) 1306 if ( ex2phone.mWriteBackFuture->isChecked() )
1304 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1307 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1305 QPtrList<Incidence> delSel; 1308 QPtrList<Incidence> delSel;
1306 if ( mode == 1 ) 1309 if ( mode == 1 )
1307 delSel = mCalendar->rawIncidences(); 1310 delSel = mCalendar->rawIncidences();
1308 if ( mode == 2 ) 1311 if ( mode == 2 )
1309 delSel = mCalendar->incidences(); 1312 delSel = mCalendar->incidences();
1310 CalendarLocal* cal = new CalendarLocal(); 1313 CalendarLocal* cal = new CalendarLocal();
1311 cal->setLocalTime(); 1314 cal->setLocalTime();
1312 Incidence *incidence = delSel.first(); 1315 Incidence *incidence = delSel.first();
1313 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1316 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1314 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1317 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1315 while ( incidence ) { 1318 while ( incidence ) {
1316 if ( incidence->type() != "Journal" ) { 1319 if ( incidence->type() != "Journal" ) {
1317 bool add = true; 1320 bool add = true;
1318 if ( inFuture ) { 1321 if ( inFuture ) {
1319 QDateTime dt; 1322 QDateTime dt;
1320 if ( incidence->type() == "Todo" ) { 1323 if ( incidence->type() == "Todo" ) {
1321 Todo * t = (Todo*)incidence; 1324 Todo * t = (Todo*)incidence;
1322 if ( t->hasDueDate() ) 1325 if ( t->hasDueDate() )
1323 dt = t->dtDue(); 1326 dt = t->dtDue();
1324 else 1327 else
1325 dt = cur.addSecs( 62 ); 1328 dt = cur.addSecs( 62 );
1326 } 1329 }
1327 else { 1330 else {
1328 bool ok; 1331 bool ok;
1329 dt = incidence->getNextOccurence( cur, &ok ); 1332 dt = incidence->getNextOccurence( cur, &ok );
1330 if ( !ok ) 1333 if ( !ok )
1331 dt = cur.addSecs( -62 ); 1334 dt = cur.addSecs( -62 );
1332 } 1335 }
1333 if ( dt < cur || dt > end ) { 1336 if ( dt < cur || dt > end ) {
1334 add = false; 1337 add = false;
1335 } 1338 }
1336 } 1339 }
1337 if ( add ) { 1340 if ( add ) {
1338 Incidence *in = incidence->clone(); 1341 Incidence *in = incidence->clone();
1339 cal->addIncidence( in ); 1342 cal->addIncidence( in );
1340 } 1343 }
1341 } 1344 }
1342 incidence = delSel.next(); 1345 incidence = delSel.next();
1343 } 1346 }
1344 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1347 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1345 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1348 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1346 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1349 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1347 1350
1348 setCaption( i18n("Writing to phone...")); 1351 setCaption( i18n("Writing to phone..."));
1349 if ( PhoneFormat::writeToPhone( cal ) ) 1352 if ( PhoneFormat::writeToPhone( cal ) )
1350 setCaption( i18n("Export to phone successful!")); 1353 setCaption( i18n("Export to phone successful!"));
1351 else 1354 else
1352 setCaption( i18n("Error exporting to phone!")); 1355 setCaption( i18n("Error exporting to phone!"));
1353 delete cal; 1356 delete cal;
1354} 1357}
1355 1358
1356 1359
1357void MainWindow::setDefaultPreferences() 1360void MainWindow::setDefaultPreferences()
1358{ 1361{
1359 KOPrefs *p = KOPrefs::instance(); 1362 KOPrefs *p = KOPrefs::instance();
1360 1363
1361 p->mCompactDialogs = true; 1364 p->mCompactDialogs = true;
1362 p->mConfirm = true; 1365 p->mConfirm = true;
1363 // p->mEnableQuickTodo = false; 1366 // p->mEnableQuickTodo = false;
1364 1367
1365} 1368}
1366 1369
1367QString MainWindow::resourcePath() 1370QString MainWindow::resourcePath()
1368{ 1371{
1369 return KGlobal::iconLoader()->iconPath(); 1372 return KGlobal::iconLoader()->iconPath();
1370} 1373}
1371 1374
1372void MainWindow::displayText( QString text ,QString cap ) 1375void MainWindow::displayText( QString text ,QString cap )
1373{ 1376{
1374 QDialog dia( this, "name", true ); ; 1377 QDialog dia( this, "name", true ); ;
1375 dia.setCaption( cap ); 1378 dia.setCaption( cap );
1376 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1379 QVBoxLayout* lay = new QVBoxLayout( &dia );
1377 lay->setSpacing( 3 ); 1380 lay->setSpacing( 3 );
1378 lay->setMargin( 3 ); 1381 lay->setMargin( 3 );
1379 QTextBrowser tb ( &dia ); 1382 QTextBrowser tb ( &dia );
1380 lay->addWidget( &tb ); 1383 lay->addWidget( &tb );
1381 tb.setText( text ); 1384 tb.setText( text );
1382#ifdef DESKTOP_VERSION 1385#ifdef DESKTOP_VERSION
1383 dia.resize( 640, 480); 1386 dia.resize( 640, 480);
1384#else 1387#else
1385 dia.showMaximized(); 1388 dia.showMaximized();
1386#endif 1389#endif
1387 dia.exec(); 1390 dia.exec();
1388} 1391}
1389 1392
1390void MainWindow::features() 1393void MainWindow::features()
1391{ 1394{
1392 1395
1393 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1396 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1394} 1397}
1395 1398
1396void MainWindow::usertrans() 1399void MainWindow::usertrans()
1397{ 1400{
1398 1401
1399 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1402 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1400} 1403}
1401 1404
1402void MainWindow::storagehowto() 1405void MainWindow::storagehowto()
1403{ 1406{
1404 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1407 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1405} 1408}
1406void MainWindow::timetrackinghowto() 1409void MainWindow::timetrackinghowto()
1407{ 1410{
1408 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1411 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1409} 1412}
1410void MainWindow::kdesynchowto() 1413void MainWindow::kdesynchowto()
1411{ 1414{
1412 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1415 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1413} 1416}
1414void MainWindow::multisynchowto() 1417void MainWindow::multisynchowto()
1415{ 1418{
1416 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1419 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1417} 1420}
1418void MainWindow::synchowto() 1421void MainWindow::synchowto()
1419{ 1422{
1420 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1423 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1421} 1424}
1422void MainWindow::faq() 1425void MainWindow::faq()
1423{ 1426{
1424 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1427 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1425 1428
1426} 1429}
1427void MainWindow::whatsNew() 1430void MainWindow::whatsNew()
1428{ 1431{
1429 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1432 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1430 1433
1431} 1434}
1432void MainWindow::licence() 1435void MainWindow::licence()
1433{ 1436{
1434 KApplication::showLicence(); 1437 KApplication::showLicence();
1435 1438
1436} 1439}
1437void MainWindow::about() 1440void MainWindow::about()
1438{ 1441{
1439 QString version; 1442 QString version;
1440#include <../version> 1443#include <../version>
1441 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1444 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1442 i18n("KOrganizer/Platform-independent\n") + 1445 i18n("KOrganizer/Platform-independent\n") +
1443 "(KO/Pi) " + version + " - " + 1446 "(KO/Pi) " + version + " - " +
1444 1447
1445#ifdef DESKTOP_VERSION 1448#ifdef DESKTOP_VERSION
1446 i18n("Desktop Edition\n") + 1449 i18n("Desktop Edition\n") +
1447#else 1450#else
1448 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1451 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1449#endif 1452#endif
1450 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!") ); 1453 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!") );
1451} 1454}
1452void MainWindow::keyBindings() 1455void MainWindow::keyBindings()
1453{ 1456{
1454 QString cap = i18n("KO/Pi Keys + Colors"); 1457 QString cap = i18n("KO/Pi Keys + Colors");
1455 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1458 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1456 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1459 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1457 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1460 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1458 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1461 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1459 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1462 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1460 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1463 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1461 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1464 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1462 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1465 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1463 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1466 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1464 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1467 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1465 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1468 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1466 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1469 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1467 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1470 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1468 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1471 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1469 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1472 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1470 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1473 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1471 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1474 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1472 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1475 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1473 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1476 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1474 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1477 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1475 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1478 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1476 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1479 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1477 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1480 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1478 i18n("<p><h3>In agenda view:</h3></p>\n") + 1481 i18n("<p><h3>In agenda view:</h3></p>\n") +
1479 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1482 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1480 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1483 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1481 i18n("<p><h3>In todo view:</h3></p>\n") + 1484 i18n("<p><h3>In todo view:</h3></p>\n") +
1482 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1485 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1483 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1486 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1484 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1487 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1485 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1488 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1486 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1489 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1487 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1490 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1488 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1491 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1489 i18n("<p><h3>In list view:</h3></p>\n") + 1492 i18n("<p><h3>In list view:</h3></p>\n") +
1490 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1493 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1491 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1494 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1492 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1495 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1493 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1496 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1494 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1497 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1495 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1498 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1496 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1499 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1497 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1500 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1498 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1501 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1499 i18n("<p><b>E</b>: Edit item</p>\n") + 1502 i18n("<p><b>E</b>: Edit item</p>\n") +
1500 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1503 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1501 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1504 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1502 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1505 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1503 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1506 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1504 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1507 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1505 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1508 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1506 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1509 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1507 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1510 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1508 i18n("<p><b>White</b>: Item readonly</p>\n"); 1511 i18n("<p><b>White</b>: Item readonly</p>\n");
1509 displayText( text, cap); 1512 displayText( text, cap);
1510} 1513}
1511void MainWindow::aboutAutoSaving() 1514void MainWindow::aboutAutoSaving()
1512{ 1515{
1513 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"); 1516 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");
1514 1517
1515 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1518 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1516 1519
1517} 1520}
1518void MainWindow::aboutKnownBugs() 1521void MainWindow::aboutKnownBugs()
1519{ 1522{
1520 QMessageBox* msg; 1523 QMessageBox* msg;
1521 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1524 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1522 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")+ 1525 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")+
1523 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1526 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1524 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1527 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1525 i18n("\nor report them in the bugtracker on\n") + 1528 i18n("\nor report them in the bugtracker on\n") +
1526 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1529 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1527 QMessageBox::NoIcon, 1530 QMessageBox::NoIcon,
1528 QMessageBox::Ok, 1531 QMessageBox::Ok,
1529 QMessageBox::NoButton, 1532 QMessageBox::NoButton,
1530 QMessageBox::NoButton); 1533 QMessageBox::NoButton);
1531 msg->exec(); 1534 msg->exec();
1532 delete msg; 1535 delete msg;
1533 1536
1534} 1537}
1535 1538
1536QString MainWindow::defaultFileName() 1539QString MainWindow::defaultFileName()
1537{ 1540{
1538 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1541 return locateLocal( "data", "korganizer/mycalendar.ics" );
1539} 1542}
1540QString MainWindow::syncFileName() 1543QString MainWindow::syncFileName()
1541{ 1544{
1542#ifdef DESKTOP_VERSION 1545#ifdef DESKTOP_VERSION
1543 return locateLocal( "tmp", "synccalendar.ics" ); 1546 return locateLocal( "tmp", "synccalendar.ics" );
1544#else 1547#else
1545 return QString( "/tmp/synccalendar.ics" ); 1548 return QString( "/tmp/synccalendar.ics" );
1546#endif 1549#endif
1547} 1550}
1548#include "koglobals.h" 1551#include "koglobals.h"
1549#include <kcalendarsystem.h> 1552#include <kcalendarsystem.h>
1550void MainWindow::updateWeek(QDate seda) 1553void MainWindow::updateWeek(QDate seda)
1551{ 1554{
1552 int weekNum = KGlobal::locale()->weekNum ( seda ); 1555 int weekNum = KGlobal::locale()->weekNum ( seda );
1553 mWeekPixmap.fill( mWeekBgColor ); 1556 mWeekPixmap.fill( mWeekBgColor );
1554 QPainter p ( &mWeekPixmap ); 1557 QPainter p ( &mWeekPixmap );
1555 p.setFont( mWeekFont ); 1558 p.setFont( mWeekFont );
1556 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1559 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1557 p.end(); 1560 p.end();
1558 QIconSet icon3 ( mWeekPixmap ); 1561 QIconSet icon3 ( mWeekPixmap );
1559 mWeekAction->setIconSet ( icon3 ); 1562 mWeekAction->setIconSet ( icon3 );
1560 1563
1561} 1564}
1562void MainWindow::updateWeekNum(const DateList &selectedDates) 1565void MainWindow::updateWeekNum(const DateList &selectedDates)
1563{ 1566{
1564 updateWeek( selectedDates.first() ); 1567 updateWeek( selectedDates.first() );
1565} 1568}
1566void MainWindow::processIncidenceSelection( Incidence *incidence ) 1569void MainWindow::processIncidenceSelection( Incidence *incidence )
1567{ 1570{
1568 1571
1569 if ( !incidence ) { 1572 if ( !incidence ) {
1570 enableIncidenceActions( false ); 1573 enableIncidenceActions( false );
1571 1574
1572 mNewSubTodoAction->setEnabled( false ); 1575 mNewSubTodoAction->setEnabled( false );
1573 setCaptionToDates(); 1576 setCaptionToDates();
1574 return; 1577 return;
1575 1578
1576 } 1579 }
1577 1580
1578 //KGlobal::locale()->formatDateTime(nextA, true); 1581 //KGlobal::locale()->formatDateTime(nextA, true);
1579 QString startString = ""; 1582 QString startString = "";
1580 if ( incidence->type() != "Todo" ) { 1583 if ( incidence->type() != "Todo" ) {
1581 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1584 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1582 if ( incidence->doesFloat() ) { 1585 if ( incidence->doesFloat() ) {
1583 startString += ": "+incidence->dtStartDateStr( true ); 1586 startString += ": "+incidence->dtStartDateStr( true );
1584 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1587 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1585 1588
1586 } else { 1589 } else {
1587 startString = ": "+incidence->dtStartStr(true); 1590 startString = ": "+incidence->dtStartStr(true);
1588 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1591 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1589 1592
1590 } 1593 }
1591 1594
1592 } else { 1595 } else {
1593 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1596 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1594 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1597 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1595 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1598 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1596 1599
1597 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1600 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1598 bool ok; 1601 bool ok;
1599 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1602 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1600 if ( ok ) { 1603 if ( ok ) {
1601 int years = noc.date().year() - incidence->dtStart().date().year(); 1604 int years = noc.date().year() - incidence->dtStart().date().year();
1602 startString += i18n(" (%1 y.)"). arg( years ); 1605 startString += i18n(" (%1 y.)"). arg( years );
1603 } 1606 }
1604 } 1607 }
1605 else 1608 else
1606 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1609 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1607 } 1610 }
1608 1611
1609 } 1612 }
1610 else 1613 else
1611 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1614 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1612 if ( !incidence->location().isEmpty() ) 1615 if ( !incidence->location().isEmpty() )
1613 startString += " (" +incidence->location()+")"; 1616 startString += " (" +incidence->location()+")";
1614 setCaption( incidence->summary()+startString); 1617 setCaption( incidence->summary()+startString);
1615 1618
1616 enableIncidenceActions( true ); 1619 enableIncidenceActions( true );
1617 1620
1618 if ( incidence->type() == "Event" ) { 1621 if ( incidence->type() == "Event" ) {
1619 mShowAction->setText( i18n("Show Event...") ); 1622 mShowAction->setText( i18n("Show Event...") );
1620 mEditAction->setText( i18n("Edit Event...") ); 1623 mEditAction->setText( i18n("Edit Event...") );
1621 mDeleteAction->setText( i18n("Delete Event...") ); 1624 mDeleteAction->setText( i18n("Delete Event...") );
1622 1625
1623 mNewSubTodoAction->setEnabled( false ); 1626 mNewSubTodoAction->setEnabled( false );
1624 } else if ( incidence->type() == "Todo" ) { 1627 } else if ( incidence->type() == "Todo" ) {
1625 mShowAction->setText( i18n("Show Todo...") ); 1628 mShowAction->setText( i18n("Show Todo...") );
1626 mEditAction->setText( i18n("Edit Todo...") ); 1629 mEditAction->setText( i18n("Edit Todo...") );
1627 mDeleteAction->setText( i18n("Delete Todo...") ); 1630 mDeleteAction->setText( i18n("Delete Todo...") );
1628 1631
1629 mNewSubTodoAction->setEnabled( true ); 1632 mNewSubTodoAction->setEnabled( true );
1630 } else { 1633 } else {
1631 mShowAction->setText( i18n("Show...") ); 1634 mShowAction->setText( i18n("Show...") );
1632 mShowAction->setText( i18n("Edit...") ); 1635 mShowAction->setText( i18n("Edit...") );
1633 mShowAction->setText( i18n("Delete...") ); 1636 mShowAction->setText( i18n("Delete...") );
1634 1637
1635 mNewSubTodoAction->setEnabled( false ); 1638 mNewSubTodoAction->setEnabled( false );
1636 } 1639 }
1637} 1640}
1638 1641
1639void MainWindow::enableIncidenceActions( bool enabled ) 1642void MainWindow::enableIncidenceActions( bool enabled )
1640{ 1643{
1641 mShowAction->setEnabled( enabled ); 1644 mShowAction->setEnabled( enabled );
1642 mEditAction->setEnabled( enabled ); 1645 mEditAction->setEnabled( enabled );
1643 mDeleteAction->setEnabled( enabled ); 1646 mDeleteAction->setEnabled( enabled );
1644 1647
1645 mCloneAction->setEnabled( enabled ); 1648 mCloneAction->setEnabled( enabled );
1646 mMoveAction->setEnabled( enabled ); 1649 mMoveAction->setEnabled( enabled );
1647 mBeamAction->setEnabled( enabled ); 1650 mBeamAction->setEnabled( enabled );
1648 mCancelAction->setEnabled( enabled ); 1651 mCancelAction->setEnabled( enabled );
1649} 1652}
1650 1653
1651void MainWindow::importOL() 1654void MainWindow::importOL()
1652{ 1655{
1653#ifdef _OL_IMPORT_ 1656#ifdef _OL_IMPORT_
1654 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1657 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1655 id->exec(); 1658 id->exec();
1656 delete id; 1659 delete id;
1657 mView->updateView(); 1660 mView->updateView();
1658#endif 1661#endif
1659} 1662}
1660void MainWindow::importBday() 1663void MainWindow::importBday()
1661{ 1664{
1662 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1665 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1663 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1666 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1664 i18n("Import!"), i18n("Cancel"), 0, 1667 i18n("Import!"), i18n("Cancel"), 0,
1665 0, 1 ); 1668 0, 1 );
1666 if ( result == 0 ) { 1669 if ( result == 0 ) {
1667 mView->importBday(); 1670 mView->importBday();
1668 1671
1669 } 1672 }
1670 1673
1671 1674
1672} 1675}
1673void MainWindow::importQtopia() 1676void MainWindow::importQtopia()
1674{ 1677{
1675 //#ifndef DESKTOP_VERSION 1678 //#ifndef DESKTOP_VERSION
1676 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"); 1679 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");
1677#ifdef DESKTOP_VERSION 1680#ifdef DESKTOP_VERSION
1678 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"); 1681 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");
1679#endif 1682#endif
1680 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1683 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1681 i18n("Import!"), i18n("Cancel"), 0, 1684 i18n("Import!"), i18n("Cancel"), 0,
1682 0, 1 ); 1685 0, 1 );
1683 if ( result == 0 ) { 1686 if ( result == 0 ) {
1684#ifndef DESKTOP_VERSION 1687#ifndef DESKTOP_VERSION
1685 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1688 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1686 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1689 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1687 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1690 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1688#else 1691#else
1689 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1692 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1690 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1693 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1691 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1694 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1692#endif 1695#endif
1693 mView->importQtopia( categories, datebook, todolist ); 1696 mView->importQtopia( categories, datebook, todolist );
1694 } 1697 }
1695#if 0 1698#if 0
1696 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1699 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1697 i18n("Not supported \non desktop!\n"), 1700 i18n("Not supported \non desktop!\n"),
1698 i18n("Ok"), i18n("Cancel"), 0, 1701 i18n("Ok"), i18n("Cancel"), 0,
1699 0, 1 ); 1702 0, 1 );
1700 1703
1701#endif 1704#endif
1702} 1705}
1703 1706
1704void MainWindow::saveOnClose() 1707void MainWindow::saveOnClose()
1705{ 1708{
1706 KOPrefs *p = KOPrefs::instance(); 1709 KOPrefs *p = KOPrefs::instance();
1707 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1710 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1708 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1711 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1709 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1712 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1710 if ( filterToolBar ) { 1713 if ( filterToolBar ) {
1711 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1714 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1712 } 1715 }
1713#ifdef DESKTOP_VERSION 1716#ifdef DESKTOP_VERSION
1714 1717
1715 QPoint myP; 1718 QPoint myP;
1716 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1719 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1717 if ( p->mToolBarHor ) 1720 if ( p->mToolBarHor )
1718 p->mToolBarUp = myP.y() > height()/2; 1721 p->mToolBarUp = myP.y() > height()/2;
1719 else 1722 else
1720 p->mToolBarUp = myP.x() > width()/2; 1723 p->mToolBarUp = myP.x() > width()/2;
1721 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1724 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1722 if ( p->mToolBarHorV ) 1725 if ( p->mToolBarHorV )
1723 p->mToolBarUpV = myP.y() > height()/2; 1726 p->mToolBarUpV = myP.y() > height()/2;
1724 else 1727 else
1725 p->mToolBarUpV = myP.x() > width()/2 ; 1728 p->mToolBarUpV = myP.x() > width()/2 ;
1726 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1729 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1727 if ( p->mToolBarHorN ) 1730 if ( p->mToolBarHorN )
1728 p->mToolBarUpN = myP.y() > height()/2; 1731 p->mToolBarUpN = myP.y() > height()/2;
1729 else 1732 else
1730 p->mToolBarUpN = myP.x() > width()/2 ; 1733 p->mToolBarUpN = myP.x() > width()/2 ;
1731 if ( filterToolBar ) { 1734 if ( filterToolBar ) {
1732 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1735 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1733 if ( p->mToolBarHorF ) 1736 if ( p->mToolBarHorF )
1734 p->mToolBarUpF = myP.y() > height()/2; 1737 p->mToolBarUpF = myP.y() > height()/2;
1735 else 1738 else
1736 p->mToolBarUpF = myP.x() > width()/2 ; 1739 p->mToolBarUpF = myP.x() > width()/2 ;
1737 } 1740 }
1738#else 1741#else
1739 if ( p->mToolBarHor ) 1742 if ( p->mToolBarHor )
1740 p->mToolBarUp = iconToolBar->y() > height()/2; 1743 p->mToolBarUp = iconToolBar->y() > height()/2;
1741 else 1744 else
1742 p->mToolBarUp = iconToolBar->x() > width()/2; 1745 p->mToolBarUp = iconToolBar->x() > width()/2;
1743 if ( p->mToolBarHorV ) 1746 if ( p->mToolBarHorV )
1744 p->mToolBarUpV = viewToolBar->y() > height()/2; 1747 p->mToolBarUpV = viewToolBar->y() > height()/2;
1745 else 1748 else
1746 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1749 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1747 1750
1748 if ( p->mToolBarHorN ) 1751 if ( p->mToolBarHorN )
1749 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1752 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1750 else 1753 else
1751 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1754 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1752 if ( filterToolBar ) { 1755 if ( filterToolBar ) {
1753 if ( p->mToolBarHorF ) 1756 if ( p->mToolBarHorF )
1754 p->mToolBarUpF = filterToolBar->y() > height()/2; 1757 p->mToolBarUpF = filterToolBar->y() > height()/2;
1755 else 1758 else
1756 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1759 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1757 } 1760 }
1758#endif 1761#endif
1759 1762
1760 1763
1761 mView->writeSettings(); 1764 mView->writeSettings();
1762 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1765 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1763 save(); 1766 save();
1764} 1767}
1765void MainWindow::slotModifiedChanged( bool changed ) 1768void MainWindow::slotModifiedChanged( bool changed )
1766{ 1769{
1767 if ( mBlockAtStartup ) 1770 if ( mBlockAtStartup )
1768 return; 1771 return;
1769 1772
1770 int msec; 1773 int msec;
1771 // we store the changes after 1 minute, 1774 // we store the changes after 1 minute,
1772 // and for safety reasons after 10 minutes again 1775 // and for safety reasons after 10 minutes again
1773 if ( !mSyncManager->blockSave() ) 1776 if ( !mSyncManager->blockSave() )
1774 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1777 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1775 else 1778 else
1776 msec = 1000 * 600; 1779 msec = 1000 * 600;
1777 mSaveTimer.start( msec, true ); // 1 minute 1780 mSaveTimer.start( msec, true ); // 1 minute
1778 qDebug("KO: Saving File in %d secs!", msec/1000); 1781 qDebug("KO: Saving File in %d secs!", msec/1000);
1779 mCalendarModifiedFlag = true; 1782 mCalendarModifiedFlag = true;
1780} 1783}
1781void MainWindow::saveStopTimer() 1784void MainWindow::saveStopTimer()
1782{ 1785{
1783 mSaveTimer.stop(); 1786 mSaveTimer.stop();
1784} 1787}
1785void MainWindow::save() 1788void MainWindow::save()
1786{ 1789{
1787 if ( !mCalendarModifiedFlag ) { 1790 if ( !mCalendarModifiedFlag ) {
1788 qDebug("KO: Calendar not modified. Nothing saved."); 1791 qDebug("KO: Calendar not modified. Nothing saved.");
1789 return; 1792 return;
1790 } 1793 }
1791 if ( mSyncManager->blockSave() ) 1794 if ( mSyncManager->blockSave() )
1792 return; 1795 return;
1793 mSyncManager->setBlockSave(true); 1796 mSyncManager->setBlockSave(true);
1794 if ( mView->checkFileVersion( defaultFileName()) ) { 1797 if ( mView->checkFileVersion( defaultFileName()) ) {
1795 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1798 QTime neededSaveTime = QDateTime::currentDateTime().time();
1796 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1799 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1797 qDebug("KO: Start saving data to file!"); 1800 qDebug("KO: Start saving data to file!");
1798 mView->saveCalendar( defaultFileName() ); 1801 mView->saveCalendar( defaultFileName() );
1799 mCalendarModifiedFlag = false; 1802 mCalendarModifiedFlag = false;
1800 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1803 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1801 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1804 qDebug("KO: Needed %d ms for saving.",msNeeded );
1802 QString savemes; 1805 QString savemes;
1803 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1806 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1804 setCaption(savemes); 1807 setCaption(savemes);
1805 } else 1808 } else
1806 setCaption(i18n("Saving cancelled!")); 1809 setCaption(i18n("Saving cancelled!"));
1807 mSyncManager->setBlockSave( false ); 1810 mSyncManager->setBlockSave( false );
1808} 1811}
1809 1812
1810void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1813void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1811{ 1814{
1812 if ( !e->isAutoRepeat() ) { 1815 if ( !e->isAutoRepeat() ) {
1813 mFlagKeyPressed = false; 1816 mFlagKeyPressed = false;
1814 } 1817 }
1815} 1818}
1816void MainWindow::keyPressEvent ( QKeyEvent * e ) 1819void MainWindow::keyPressEvent ( QKeyEvent * e )
1817{ 1820{
1818 qApp->processEvents(); 1821 qApp->processEvents();
1819 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1822 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1820 e->ignore(); 1823 e->ignore();
1821 // qDebug(" ignore %d",e->isAutoRepeat() ); 1824 // qDebug(" ignore %d",e->isAutoRepeat() );
1822 return; 1825 return;
1823 } 1826 }
1824 if (! e->isAutoRepeat() ) 1827 if (! e->isAutoRepeat() )
1825 mFlagKeyPressed = true; 1828 mFlagKeyPressed = true;
1826 KOPrefs *p = KOPrefs::instance(); 1829 KOPrefs *p = KOPrefs::instance();
1827 bool showSelectedDates = false; 1830 bool showSelectedDates = false;
1828 int size; 1831 int size;
1829 int pro = 0; 1832 int pro = 0;
1830 //qDebug("MainWindow::keyPressEvent "); 1833 //qDebug("MainWindow::keyPressEvent ");
1831 switch ( e->key() ) { 1834 switch ( e->key() ) {
1832 case Qt::Key_Right: 1835 case Qt::Key_Right:
1833 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1836 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1834 mView->goNextMonth(); 1837 mView->goNextMonth();
1835 else 1838 else
1836 mView->goNext(); 1839 mView->goNext();
1837 showSelectedDates = true; 1840 showSelectedDates = true;
1838 break; 1841 break;
1839 case Qt::Key_Left: 1842 case Qt::Key_Left:
1840 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1843 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1841 mView->goPreviousMonth(); 1844 mView->goPreviousMonth();
1842 else 1845 else
1843 mView->goPrevious(); 1846 mView->goPrevious();
1844 showSelectedDates = true; 1847 showSelectedDates = true;
1845 break; 1848 break;
1846 case Qt::Key_Down: 1849 case Qt::Key_Down:
1847 mView->viewManager()->agendaView()->scrollOneHourDown(); 1850 mView->viewManager()->agendaView()->scrollOneHourDown();
1848 break; 1851 break;
1849 case Qt::Key_Up: 1852 case Qt::Key_Up:
1850 mView->viewManager()->agendaView()->scrollOneHourUp(); 1853 mView->viewManager()->agendaView()->scrollOneHourUp();
1851 break; 1854 break;
1852 case Qt::Key_K: 1855 case Qt::Key_K:
1853 mView->viewManager()->showMonthViewWeek(); 1856 mView->viewManager()->showMonthViewWeek();
1854 break; 1857 break;
1855 case Qt::Key_I: 1858 case Qt::Key_I:
1856 mView->showIncidence(); 1859 mView->showIncidence();
1857 break; 1860 break;
1858 case Qt::Key_Delete: 1861 case Qt::Key_Delete:
1859 case Qt::Key_Backspace: 1862 case Qt::Key_Backspace:
1860 mView->deleteIncidence(); 1863 mView->deleteIncidence();
1861 break; 1864 break;
1862 case Qt::Key_D: 1865 case Qt::Key_D:
1863 mView->viewManager()->showDayView(); 1866 mView->viewManager()->showDayView();
1864 showSelectedDates = true; 1867 showSelectedDates = true;
1865 break; 1868 break;
1866 case Qt::Key_O: 1869 case Qt::Key_O:
1867 mView->toggleFilerEnabled( ); 1870 mView->toggleFilerEnabled( );
1868 break; 1871 break;
1869 case Qt::Key_0: 1872 case Qt::Key_0:
1870 case Qt::Key_1: 1873 case Qt::Key_1:
1871 case Qt::Key_2: 1874 case Qt::Key_2:
1872 case Qt::Key_3: 1875 case Qt::Key_3:
1873 case Qt::Key_4: 1876 case Qt::Key_4:
1874 case Qt::Key_5: 1877 case Qt::Key_5:
1875 case Qt::Key_6: 1878 case Qt::Key_6:
1876 case Qt::Key_7: 1879 case Qt::Key_7:
1877 case Qt::Key_8: 1880 case Qt::Key_8:
1878 case Qt::Key_9: 1881 case Qt::Key_9:
1879 pro = e->key()-48; 1882 pro = e->key()-48;
1880 if ( pro == 0 ) 1883 if ( pro == 0 )
1881 pro = 10; 1884 pro = 10;
1882 if ( e->state() == Qt::ControlButton) 1885 if ( e->state() == Qt::ControlButton)
1883 pro += 10; 1886 pro += 10;
1884 break; 1887 break;
1885 case Qt::Key_M: 1888 case Qt::Key_M:
1886 mView->viewManager()->showMonthView(); 1889 mView->viewManager()->showMonthView();
1887 showSelectedDates = true; 1890 showSelectedDates = true;
1888 break; 1891 break;
1889 case Qt::Key_Insert: 1892 case Qt::Key_Insert:
1890 mView->newEvent(); 1893 mView->newEvent();
1891 break; 1894 break;
1892 case Qt::Key_S : 1895 case Qt::Key_S :
1893 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1896 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1894 mView->newSubTodo(); 1897 mView->newSubTodo();
1895 else 1898 else
1896 mView->dialogManager()->showSearchDialog(); 1899 mView->dialogManager()->showSearchDialog();
1897 break; 1900 break;
1898 case Qt::Key_Y : 1901 case Qt::Key_Y :
1899 case Qt::Key_Z : 1902 case Qt::Key_Z :
1900 mView->viewManager()->showWorkWeekView(); 1903 mView->viewManager()->showWorkWeekView();
1901 showSelectedDates = true; 1904 showSelectedDates = true;
1902 break; 1905 break;
1903 case Qt::Key_U : 1906 case Qt::Key_U :
1904 mView->viewManager()->showWeekView(); 1907 mView->viewManager()->showWeekView();
1905 showSelectedDates = true; 1908 showSelectedDates = true;
1906 break; 1909 break;
1907 case Qt::Key_H : 1910 case Qt::Key_H :
1908 keyBindings(); 1911 keyBindings();
1909 break; 1912 break;
1910 case Qt::Key_W: 1913 case Qt::Key_W:
1911 mView->viewManager()->showWhatsNextView(); 1914 mView->viewManager()->showWhatsNextView();
1912 break; 1915 break;
1913 case Qt::Key_L: 1916 case Qt::Key_L:
1914 mView->viewManager()->showListView(); 1917 mView->viewManager()->showListView();
1915 break; 1918 break;
1916 case Qt::Key_N: 1919 case Qt::Key_N:
1917 mView->viewManager()->showNextView(); 1920 mView->viewManager()->showNextView();
1918 break; 1921 break;
1919 case Qt::Key_V: 1922 case Qt::Key_V:
1920 mView->viewManager()->showTodoView(); 1923 mView->viewManager()->showTodoView();
1921 break; 1924 break;
1922 case Qt::Key_C: 1925 case Qt::Key_C:
1923 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1926 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1924 break; 1927 break;
1925 case Qt::Key_P: 1928 case Qt::Key_P:
1926 mView->showDatePicker( ); 1929 mView->showDatePicker( );
1927 break; 1930 break;
1928 case Qt::Key_F: 1931 case Qt::Key_F:
1929 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1932 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1930 mView->editFilters(); 1933 mView->editFilters();
1931 else 1934 else
1932 mView->toggleFilter(); 1935 mView->toggleFilter();
1933 break; 1936 break;
1934 case Qt::Key_X: 1937 case Qt::Key_X:
1935 if ( e->state() == Qt::ControlButton ) 1938 if ( e->state() == Qt::ControlButton )
1936 mView->toggleDateNavigatorWidget(); 1939 mView->toggleDateNavigatorWidget();
1937 else { 1940 else {
1938 mView->viewManager()->showNextXView(); 1941 mView->viewManager()->showNextXView();
1939 showSelectedDates = true; 1942 showSelectedDates = true;
1940 } 1943 }
1941 break; 1944 break;
1942 case Qt::Key_Space: 1945 case Qt::Key_Space:
1943 mView->toggleExpand(); 1946 mView->toggleExpand();
1944 break; 1947 break;
1945 case Qt::Key_A: 1948 case Qt::Key_A:
1946 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1949 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1947 mView->showNextAlarms(); 1950 mView->showNextAlarms();
1948 else 1951 else
1949 mView->toggleAllDaySize(); 1952 mView->toggleAllDaySize();
1950 break; 1953 break;
1951 case Qt::Key_T: 1954 case Qt::Key_T:
1952 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1955 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1953 mView->newTodo(); 1956 mView->newTodo();
1954 else { 1957 else {
1955 mView->goToday(); 1958 mView->goToday();
1956 showSelectedDates = true; 1959 showSelectedDates = true;
1957 } 1960 }
1958 break; 1961 break;
1959 case Qt::Key_J: 1962 case Qt::Key_J:
1960 mView->viewManager()->showJournalView(); 1963 mView->viewManager()->showJournalView();
1961 break; 1964 break;
1962 case Qt::Key_B: 1965 case Qt::Key_B:
1963 mView->editIncidenceDescription();; 1966 mView->editIncidenceDescription();;
1964 break; 1967 break;
1965 // case Qt::Key_Return: 1968 // case Qt::Key_Return:
1966 case Qt::Key_E: 1969 case Qt::Key_E:
1967 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1970 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1968 mView->newEvent(); 1971 mView->newEvent();
1969 else 1972 else
1970 mView->editIncidence(); 1973 mView->editIncidence();
1971 break; 1974 break;
1972 case Qt::Key_Plus: 1975 case Qt::Key_Plus:
1973 size = p->mHourSize +2; 1976 size = p->mHourSize +2;
1974 if ( size <= 22 ) 1977 if ( size <= 22 )
1975 configureAgenda( size ); 1978 configureAgenda( size );
1976 break; 1979 break;
1977 case Qt::Key_Minus: 1980 case Qt::Key_Minus:
1978 size = p->mHourSize - 2; 1981 size = p->mHourSize - 2;
1979 if ( size >= 4 ) 1982 if ( size >= 4 )
1980 configureAgenda( size ); 1983 configureAgenda( size );
1981 break; 1984 break;
1982 1985
1983 1986
1984 default: 1987 default:
1985 e->ignore(); 1988 e->ignore();
1986 } 1989 }
1987 if ( pro > 0 ) { 1990 if ( pro > 0 ) {
1988 mView->selectFilter( pro-1 ); 1991 mView->selectFilter( pro-1 );
1989 } 1992 }
1990 if ( showSelectedDates ) { 1993 if ( showSelectedDates ) {
1991 ;// setCaptionToDates(); 1994 ;// setCaptionToDates();
1992 } 1995 }
1993 1996
1994} 1997}
1995void MainWindow::fillFilterMenuTB() 1998void MainWindow::fillFilterMenuTB()
1996{ 1999{
1997 selectFilterMenuTB->clear(); 2000 selectFilterMenuTB->clear();
1998 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2001 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
1999 selectFilterMenuTB->insertSeparator(); 2002 selectFilterMenuTB->insertSeparator();
2000 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2003 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2001 2004
2002 selectFilterMenuTB->insertSeparator(); 2005 selectFilterMenuTB->insertSeparator();
2003 QPtrList<CalFilter> fili = mView->filters(); 2006 QPtrList<CalFilter> fili = mView->filters();
2004 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2007 CalFilter *curfilter = mView->filterView()->selectedFilter();
2005 CalFilter *filter = fili.first(); 2008 CalFilter *filter = fili.first();
2006 int iii = 2; 2009 int iii = 2;
2007 bool checkitem = mView->filterView()->filtersEnabled(); 2010 bool checkitem = mView->filterView()->filtersEnabled();
2008 while(filter) { 2011 while(filter) {
2009 selectFilterMenuTB->insertItem( filter->name(), iii ); 2012 selectFilterMenuTB->insertItem( filter->name(), iii );
2010 if ( filter == curfilter) 2013 if ( filter == curfilter)
2011 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2014 selectFilterMenuTB->setItemChecked( iii, checkitem );
2012 filter = fili.next(); 2015 filter = fili.next();
2013 ++iii; 2016 ++iii;
2014 } 2017 }
2015 if ( !checkitem ) 2018 if ( !checkitem )
2016 selectFilterMenuTB->setItemChecked( 1, true ); 2019 selectFilterMenuTB->setItemChecked( 1, true );
2017 2020
2018 int x = 0; 2021 int x = 0;
2019 int y = iconToolBar->height(); 2022 int y = iconToolBar->height();
2020 int dX = 0; 2023 int dX = 0;
2021 int dY = 0; 2024 int dY = 0;
2022 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2025 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2023 if ( iconToolBar->y() > height()/2 ) { 2026 if ( iconToolBar->y() > height()/2 ) {
2024 dY = selectFilterMenuTB->sizeHint().height()+8; 2027 dY = selectFilterMenuTB->sizeHint().height()+8;
2025 y = 0; 2028 y = 0;
2026 } 2029 }
2027 } else { 2030 } else {
2028 if ( iconToolBar->x() > width()/2 ) { // right side 2031 if ( iconToolBar->x() > width()/2 ) { // right side
2029 x=0; 2032 x=0;
2030 dX= selectFilterMenuTB->sizeHint().width()+8; 2033 dX= selectFilterMenuTB->sizeHint().width()+8;
2031 y = 0; 2034 y = 0;
2032 } else { 2035 } else {
2033 x= iconToolBar->width(); 2036 x= iconToolBar->width();
2034 y = 0; 2037 y = 0;
2035 } 2038 }
2036 } 2039 }
2037 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2040 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2038 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2041 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2039} 2042}
2040void MainWindow::fillFilterMenu() 2043void MainWindow::fillFilterMenu()
2041{ 2044{
2042 selectFilterMenu->clear(); 2045 selectFilterMenu->clear();
2043 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2046 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2044 selectFilterMenu->insertSeparator(); 2047 selectFilterMenu->insertSeparator();
2045 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2048 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2046 2049
2047 selectFilterMenu->insertSeparator(); 2050 selectFilterMenu->insertSeparator();
2048 QPtrList<CalFilter> fili = mView->filters(); 2051 QPtrList<CalFilter> fili = mView->filters();
2049 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2052 CalFilter *curfilter = mView->filterView()->selectedFilter();
2050 CalFilter *filter = fili.first(); 2053 CalFilter *filter = fili.first();
2051 int iii = 2; 2054 int iii = 2;
2052 bool checkitem = mView->filterView()->filtersEnabled(); 2055 bool checkitem = mView->filterView()->filtersEnabled();
2053 while(filter) { 2056 while(filter) {
2054 selectFilterMenu->insertItem( filter->name(), iii ); 2057 selectFilterMenu->insertItem( filter->name(), iii );
2055 if ( filter == curfilter) 2058 if ( filter == curfilter)
2056 selectFilterMenu->setItemChecked( iii, checkitem ); 2059 selectFilterMenu->setItemChecked( iii, checkitem );
2057 filter = fili.next(); 2060 filter = fili.next();
2058 ++iii; 2061 ++iii;
2059 } 2062 }
2060 if ( !checkitem ) 2063 if ( !checkitem )
2061 selectFilterMenu->setItemChecked( 1, true ); 2064 selectFilterMenu->setItemChecked( 1, true );
2062} 2065}
2063void MainWindow::fillFilterMenuPopup() 2066void MainWindow::fillFilterMenuPopup()
2064{ 2067{
2065 filterPopupMenu->clear(); 2068 filterPopupMenu->clear();
2066 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2069 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2067 2070
2068 filterPopupMenu->insertSeparator(); 2071 filterPopupMenu->insertSeparator();
2069 QPtrList<CalFilter> fili = mView->filters(); 2072 QPtrList<CalFilter> fili = mView->filters();
2070 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2073 CalFilter *curfilter = mView->filterView()->selectedFilter();
2071 CalFilter *filter = fili.first(); 2074 CalFilter *filter = fili.first();
2072 int iii = 1; 2075 int iii = 1;
2073 bool checkitem = mView->filterView()->filtersEnabled(); 2076 bool checkitem = mView->filterView()->filtersEnabled();
2074 while(filter) { 2077 while(filter) {
2075 filterPopupMenu->insertItem( filter->name(), iii ); 2078 filterPopupMenu->insertItem( filter->name(), iii );
2076 if ( filter == curfilter) 2079 if ( filter == curfilter)
2077 filterPopupMenu->setItemChecked( iii, checkitem ); 2080 filterPopupMenu->setItemChecked( iii, checkitem );
2078 filter = fili.next(); 2081 filter = fili.next();
2079 ++iii; 2082 ++iii;
2080 } 2083 }
2081 if ( !checkitem ) 2084 if ( !checkitem )
2082 filterPopupMenu->setItemChecked( 0, true ); 2085 filterPopupMenu->setItemChecked( 0, true );
2083} 2086}
2084void MainWindow::selectFilter( int fil ) 2087void MainWindow::selectFilter( int fil )
2085{ 2088{
2086 2089
2087 if ( fil == 0 ) { 2090 if ( fil == 0 ) {
2088 mView->editFilters( ); 2091 mView->editFilters( );
2089 } else if ( fil == 1 ){ 2092 } else if ( fil == 1 ){
2090 if ( mView->filterView()->filtersEnabled() ) 2093 if ( mView->filterView()->filtersEnabled() )
2091 mView->toggleFilerEnabled( ); 2094 mView->toggleFilerEnabled( );
2092 } else { 2095 } else {
2093 if ( !mView->filterView()->filtersEnabled() ) { 2096 if ( !mView->filterView()->filtersEnabled() ) {
2094 mView->filterView()->blockSignals( true ); 2097 mView->filterView()->blockSignals( true );
2095 mView->toggleFilerEnabled( ); 2098 mView->toggleFilerEnabled( );
2096 mView->filterView()->blockSignals( false ); 2099 mView->filterView()->blockSignals( false );
2097 } 2100 }
2098 mView->selectFilter( fil-2 ); 2101 mView->selectFilter( fil-2 );
2099 } 2102 }
2100} 2103}
2101void MainWindow::updateFilterToolbar() 2104void MainWindow::updateFilterToolbar()
2102{ 2105{
2103 if ( filterMenubar ) { 2106 if ( filterMenubar ) {
2104 if ( !mView->filterView()->filtersEnabled() ) { 2107 if ( !mView->filterView()->filtersEnabled() ) {
2105 filterMenubar->changeItem( 0, i18n("No Filter") ); 2108 filterMenubar->changeItem( 0, i18n("No Filter") );
2106 } else { 2109 } else {
2107 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2110 CalFilter *curfilter = mView->filterView()->selectedFilter();
2108 if ( curfilter ) { 2111 if ( curfilter ) {
2109 filterMenubar->changeItem( 0, curfilter->name() ); 2112 filterMenubar->changeItem( 0, curfilter->name() );
2110 } 2113 }
2111 } 2114 }
2112 } 2115 }
2113} 2116}
2114void MainWindow::selectFilterPopup( int fil ) 2117void MainWindow::selectFilterPopup( int fil )
2115{ 2118{
2116 selectFilter( fil + 1 ); 2119 selectFilter( fil + 1 );
2117 2120
2118} 2121}
2119void MainWindow::configureToolBar( int item ) 2122void MainWindow::configureToolBar( int item )
2120{ 2123{
2121 2124
2122 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2125 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2123 KOPrefs *p = KOPrefs::instance(); 2126 KOPrefs *p = KOPrefs::instance();
2124 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2127 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2125 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2128 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2126 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2129 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2127 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2130 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2128 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2131 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2129 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2132 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2130 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2133 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2131 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2134 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2132 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2135 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2133 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2136 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2134 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2137 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2135 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2138 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2136 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2139 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2137 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2140 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2138 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2141 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2139 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2142 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2140 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2143 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2141 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2144 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2142 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2145 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2143 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2146 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2144 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2147 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2145 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2148 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2146 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2149 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2147 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2150 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2148 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2151 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2149 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2152 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2150 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2153 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2151 // initActions(); 2154 // initActions();
2152} 2155}
2153void MainWindow::setCaption ( const QString & c ) 2156void MainWindow::setCaption ( const QString & c )
2154{ 2157{
2155 QString cap = c; 2158 QString cap = c;
2156 cap.replace( QRegExp("\n"), " " ); 2159 cap.replace( QRegExp("\n"), " " );
2157 cap = cap.stripWhiteSpace(); 2160 cap = cap.stripWhiteSpace();
2158 if ( cap.isEmpty() ) 2161 if ( cap.isEmpty() )
2159 cap = "KO/Pi"; 2162 cap = "KO/Pi";
2160 QWidget::setCaption( cap ); 2163 QWidget::setCaption( cap );
2161} 2164}
2162void MainWindow::setCaptionToDates() 2165void MainWindow::setCaptionToDates()
2163{ 2166{
2164 QString selDates; 2167 QString selDates;
2165 QDate date = mView->startDate(); 2168 QDate date = mView->startDate();
2166 if ( ! date.isValid() ) { 2169 if ( ! date.isValid() ) {
2167 setCaption(""); 2170 setCaption("");
2168 return; 2171 return;
2169 } 2172 }
2170 selDates = KGlobal::locale()->formatDate( date, true); 2173 selDates = KGlobal::locale()->formatDate( date, true);
2171 if (mView->startDate() < mView->endDate() ) 2174 if (mView->startDate() < mView->endDate() )
2172 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2175 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2173 else { 2176 else {
2174 QString addString; 2177 QString addString;
2175 if ( date == QDateTime::currentDateTime().date() ) 2178 if ( date == QDateTime::currentDateTime().date() )
2176 addString = i18n("Today"); 2179 addString = i18n("Today");
2177 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2180 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2178 addString = i18n("Tomorrow"); 2181 addString = i18n("Tomorrow");
2179 if ( !addString.isEmpty() ) 2182 if ( !addString.isEmpty() )
2180 selDates = addString+", "+selDates ; 2183 selDates = addString+", "+selDates ;
2181 } 2184 }
2182 setCaption( i18n("Dates: ") + selDates ); 2185 setCaption( i18n("Dates: ") + selDates );
2183 2186
2184} 2187}
2185void MainWindow::showConfigureAgenda( ) 2188void MainWindow::showConfigureAgenda( )
2186{ 2189{
2187 int iii; 2190 int iii;
2188 for ( iii = 1;iii<= 10 ;++iii ){ 2191 for ( iii = 1;iii<= 10 ;++iii ){
2189 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2192 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2190 } 2193 }
2191 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2194 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2192} 2195}
2193void MainWindow::configureAgenda( int item ) 2196void MainWindow::configureAgenda( int item )
2194{ 2197{
2195 if ( KOPrefs::instance()->mHourSize == item ) 2198 if ( KOPrefs::instance()->mHourSize == item )
2196 return; 2199 return;
2197 KOPrefs::instance()->mHourSize=item; 2200 KOPrefs::instance()->mHourSize=item;
2198 mView->viewManager()->agendaView()->updateConfig(); 2201 mView->viewManager()->agendaView()->updateConfig();
2199} 2202}
2200 2203
2201void MainWindow::saveCalendar() 2204void MainWindow::saveCalendar()
2202{ 2205{
2203 QString fn = KOPrefs::instance()->mLastSaveFile; 2206 QString fn = KOPrefs::instance()->mLastSaveFile;
2204 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2207 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2205 2208
2206 if ( fn == "" ) 2209 if ( fn == "" )
2207 return; 2210 return;
2208 QFileInfo info; 2211 QFileInfo info;
2209 info.setFile( fn ); 2212 info.setFile( fn );
2210 QString mes; 2213 QString mes;
2211 bool createbup = true; 2214 bool createbup = true;
2212 if ( info. exists() ) { 2215 if ( info. exists() ) {
2213 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2216 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2214 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2217 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2215 i18n("Overwrite!"), i18n("Cancel"), 0, 2218 i18n("Overwrite!"), i18n("Cancel"), 0,
2216 0, 1 ); 2219 0, 1 );
2217 if ( result != 0 ) { 2220 if ( result != 0 ) {
2218 createbup = false; 2221 createbup = false;
2219 } 2222 }
2220 } 2223 }
2221 if ( createbup ) { 2224 if ( createbup ) {
2222 mView->saveCalendar( fn ); 2225 mView->saveCalendar( fn );
2223 mes = i18n("KO/Pi:Saved %1").arg(fn); 2226 mes = i18n("KO/Pi:Saved %1").arg(fn);
2224 KOPrefs::instance()->mLastSaveFile = fn; 2227 KOPrefs::instance()->mLastSaveFile = fn;
2225 setCaption(mes); 2228 setCaption(mes);
2226 } 2229 }
2227} 2230}
2228void MainWindow::loadCalendar() 2231void MainWindow::loadCalendar()
2229{ 2232{
2230 2233
2231 QString fn = KOPrefs::instance()->mLastLoadFile; 2234 QString fn = KOPrefs::instance()->mLastLoadFile;
2232 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2235 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2233 2236
2234 if ( fn == "" ) 2237 if ( fn == "" )
2235 return; 2238 return;
2236 QFileInfo info; 2239 QFileInfo info;
2237 info.setFile( fn ); 2240 info.setFile( fn );
2238 QString mess; 2241 QString mess;
2239 bool loadbup = true; 2242 bool loadbup = true;
2240 if ( info. exists() ) { 2243 if ( info. exists() ) {
2241 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2244 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2242 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2245 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2243 mess, 2246 mess,
2244 i18n("Load!"), i18n("Cancel"), 0, 2247 i18n("Load!"), i18n("Cancel"), 0,
2245 0, 1 ); 2248 0, 1 );
2246 if ( result != 0 ) { 2249 if ( result != 0 ) {
2247 loadbup = false; 2250 loadbup = false;
2248 } 2251 }
2249 } else { 2252 } else {
2250 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2253 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2251 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2254 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2252 0, 1 ); 2255 0, 1 );
2253 2256
2254 return; 2257 return;
2255 } 2258 }
2256 if ( loadbup ) { 2259 if ( loadbup ) {
2257 mView->openCalendar( fn ); 2260 mView->openCalendar( fn );
2258 KOPrefs::instance()->mLastLoadFile = fn; 2261 KOPrefs::instance()->mLastLoadFile = fn;
2259 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2262 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2260 setCaption(mess); 2263 setCaption(mess);
2261 } 2264 }
2262 2265
2263} 2266}
2264void MainWindow::quickImportIcal() 2267void MainWindow::quickImportIcal()
2265{ 2268{
2266 importFile( KOPrefs::instance()->mLastImportFile, false ); 2269 importFile( KOPrefs::instance()->mLastImportFile, false );
2267} 2270}
2268void MainWindow::importFile( QString fn, bool quick ) 2271void MainWindow::importFile( QString fn, bool quick )
2269{ 2272{
2270 QFileInfo info; 2273 QFileInfo info;
2271 info.setFile( fn ); 2274 info.setFile( fn );
2272 QString mess; 2275 QString mess;
2273 bool loadbup = true; 2276 bool loadbup = true;
2274 if ( !info. exists() ) { 2277 if ( !info. exists() ) {
2275 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2278 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2276 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2279 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2277 mess ); 2280 mess );
2278 return; 2281 return;
2279 } 2282 }
2280 int result = 0; 2283 int result = 0;
2281 if ( !quick ) { 2284 if ( !quick ) {
2282 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2285 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2283 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2286 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2284 mess, 2287 mess,
2285 "Import", "Cancel", 0, 2288 "Import", "Cancel", 0,
2286 0, 1 ); 2289 0, 1 );
2287 } 2290 }
2288 if ( result == 0 ) { 2291 if ( result == 0 ) {
2289 if ( mView->openCalendar( fn, true )) { 2292 if ( mView->openCalendar( fn, true )) {
2290 KOPrefs::instance()->mLastImportFile = fn; 2293 KOPrefs::instance()->mLastImportFile = fn;
2291 setCaption(i18n("Imported file successfully")); 2294 setCaption(i18n("Imported file successfully"));
2292 } else { 2295 } else {
2293 setCaption(i18n("Error importing file")); 2296 setCaption(i18n("Error importing file"));
2294 } 2297 }
2295 } 2298 }
2296} 2299}
2297 2300
2298void MainWindow::importIcal() 2301void MainWindow::importIcal()
2299{ 2302{
2300 2303
2301 QString fn =KOPrefs::instance()->mLastImportFile; 2304 QString fn =KOPrefs::instance()->mLastImportFile;
2302 2305
2303 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2306 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2304 if ( fn == "" ) 2307 if ( fn == "" )
2305 return; 2308 return;
2306 importFile( fn, true ); 2309 importFile( fn, true );
2307 2310
2308} 2311}
2309 2312
2310void MainWindow::exportVCalendar() 2313void MainWindow::exportVCalendar()
2311{ 2314{
2312 QString fn = KOPrefs::instance()->mLastVcalFile; 2315 QString fn = KOPrefs::instance()->mLastVcalFile;
2313 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2316 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2314 if ( fn == "" ) 2317 if ( fn == "" )
2315 return; 2318 return;
2316 QFileInfo info; 2319 QFileInfo info;
2317 info.setFile( fn ); 2320 info.setFile( fn );
2318 QString mes; 2321 QString mes;
2319 bool createbup = true; 2322 bool createbup = true;
2320 if ( info. exists() ) { 2323 if ( info. exists() ) {
2321 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2324 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2322 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2325 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2323 i18n("Overwrite!"), i18n("Cancel"), 0, 2326 i18n("Overwrite!"), i18n("Cancel"), 0,
2324 0, 1 ); 2327 0, 1 );
2325 if ( result != 0 ) { 2328 if ( result != 0 ) {
2326 createbup = false; 2329 createbup = false;
2327 } 2330 }
2328 } 2331 }
2329 if ( createbup ) { 2332 if ( createbup ) {
2330 if ( mView->exportVCalendar( fn ) ) { 2333 if ( mView->exportVCalendar( fn ) ) {
2331 KOPrefs::instance()->mLastVcalFile = fn; 2334 KOPrefs::instance()->mLastVcalFile = fn;
2332 if ( fn.length() > 20 ) 2335 if ( fn.length() > 20 )
2333 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2336 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2334 else 2337 else
2335 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2338 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2336 setCaption(mes); 2339 setCaption(mes);
2337 } 2340 }
2338 } 2341 }
2339 2342
2340} 2343}
2341QString MainWindow::sentSyncFile() 2344QString MainWindow::sentSyncFile()
2342{ 2345{
2343#ifdef DESKTOP_VERSION 2346#ifdef DESKTOP_VERSION
2344 return locateLocal( "tmp", "copysynccal.ics" ); 2347 return locateLocal( "tmp", "copysynccal.ics" );
2345#else 2348#else
2346 return QString( "/tmp/copysynccal.ics" ); 2349 return QString( "/tmp/copysynccal.ics" );
2347#endif 2350#endif
2348} 2351}
2349 2352
2350void MainWindow::syncFileRequest() 2353void MainWindow::syncFileRequest()
2351{ 2354{
2352 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2355 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2353 mSyncManager->slotSyncMenu( 999 ); 2356 mSyncManager->slotSyncMenu( 999 );
2354 } 2357 }
2355 2358
2356 setCaption(i18n("Saving Data to temp file ..." )); 2359 setCaption(i18n("Saving Data to temp file ..." ));
2357 mView->saveCalendar( sentSyncFile() ); 2360 mView->saveCalendar( sentSyncFile() );
2358 setCaption(i18n("Data saved to temp file!" )); 2361 setCaption(i18n("Data saved to temp file!" ));
2359 2362
2360} 2363}
2361void MainWindow::getFile( bool success ) 2364void MainWindow::getFile( bool success )
2362{ 2365{
2363 if ( ! success ) { 2366 if ( ! success ) {
2364 setCaption( i18n("Error receiving file. Nothing changed!") ); 2367 setCaption( i18n("Error receiving file. Nothing changed!") );
2365 return; 2368 return;
2366 } 2369 }
2367 mView->openCalendar( sentSyncFile() ); 2370 mView->openCalendar( sentSyncFile() );
2368 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2371 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2369 mSyncManager->slotSyncMenu( 999 ); 2372 mSyncManager->slotSyncMenu( 999 );
2370 } 2373 }
2371 setCaption( i18n("Pi-Sync successful!") ); 2374 setCaption( i18n("Pi-Sync successful!") );
2372} 2375}
2373 2376
2374void MainWindow::printSel( ) 2377void MainWindow::printSel( )
2375{ 2378{
2376 mView->viewManager()->agendaView()->agenda()->printSelection(); 2379 mView->viewManager()->agendaView()->agenda()->printSelection();
2377} 2380}
2378 2381
2379void MainWindow::printCal() 2382void MainWindow::printCal()
2380{ 2383{
2381 mView->print();//mCp->showDialog(); 2384 mView->print();//mCp->showDialog();
2382} 2385}
2383 2386
2384 2387
2385#include "libkdepim/kdatepicker.h" 2388#include "libkdepim/kdatepicker.h"
2386#include <kdatetbl.h> 2389#include <kdatetbl.h>
2387 2390
2388void MainWindow::weekAction() 2391void MainWindow::weekAction()
2389{ 2392{
2390 int month; 2393 int month;
2391 KPopupFrame* popup = new KPopupFrame(this); 2394 KPopupFrame* popup = new KPopupFrame(this);
2392 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2395 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2393 // ----- 2396 // -----
2394 picker->resize(picker->sizeHint()); 2397 picker->resize(picker->sizeHint());
2395 popup->setMainWidget(picker); 2398 popup->setMainWidget(picker);
2396 picker->setFocus(); 2399 picker->setFocus();
2397 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2400 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2398 int x = 0; 2401 int x = 0;
2399 int y = iconToolBar->height(); 2402 int y = iconToolBar->height();
2400 int dX = 0; 2403 int dX = 0;
2401 int dY = 0; 2404 int dY = 0;
2402 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2405 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2403 if ( iconToolBar->y() > height()/2 ) { 2406 if ( iconToolBar->y() > height()/2 ) {
2404 dY = picker->sizeHint().height()+8; 2407 dY = picker->sizeHint().height()+8;
2405 y = 0; 2408 y = 0;
2406 } 2409 }
2407 } else { 2410 } else {
2408 if ( iconToolBar->x() > width()/2 ) { // right side 2411 if ( iconToolBar->x() > width()/2 ) { // right side
2409 x=0; 2412 x=0;
2410 dX= picker->sizeHint().width()+8; 2413 dX= picker->sizeHint().width()+8;
2411 y = 0; 2414 y = 0;
2412 } else { 2415 } else {
2413 x= iconToolBar->width(); 2416 x= iconToolBar->width();
2414 y = 0; 2417 y = 0;
2415 } 2418 }
2416 } 2419 }
2417 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2420 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2418 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2421 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2419 { 2422 {
2420 month = picker->getResult(); 2423 month = picker->getResult();
2421 emit selectWeek ( month ); 2424 emit selectWeek ( month );
2422 //qDebug("weekSelected %d ", month); 2425 //qDebug("weekSelected %d ", month);
2423 } 2426 }
2424 delete popup; 2427 delete popup;
2425} 2428}
2426 2429
2427void MainWindow::hideEvent ( QHideEvent * ) 2430void MainWindow::hideEvent ( QHideEvent * )
2428{ 2431{
2429 QString message; 2432 QString message;
2430 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2433 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2431 if ( nextA.isValid() ) { 2434 if ( nextA.isValid() ) {
2432 QString sum = mCalendar->nextSummary(); 2435 QString sum = mCalendar->nextSummary();
2433 2436
2434 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2437 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2435 setCaption( message ); 2438 setCaption( message );
2436 } 2439 }
2437} 2440}
2438 2441
2439void MainWindow::resizeEvent( QResizeEvent* e) 2442void MainWindow::resizeEvent( QResizeEvent* e)
2440{ 2443{
2441#ifndef DESKTOP_VERSION 2444#ifndef DESKTOP_VERSION
2442 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2445 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2443 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2446 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2444 filterToolBar->hide(); 2447 filterToolBar->hide();
2445 else 2448 else
2446 filterToolBar->show(); 2449 filterToolBar->show();
2447 } 2450 }
2448#endif 2451#endif
2449 QMainWindow::resizeEvent( e); 2452 QMainWindow::resizeEvent( e);
2450} 2453}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 45ed04d..8fd3d24 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,166 +1,166 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setCaption ( const QString & ); 46 void setCaption ( const QString & );
47 void updateWeekNum(const KCal::DateList &); 47 void updateWeekNum(const KCal::DateList &);
48 void updateWeek(QDate); 48 void updateWeek(QDate);
49 void updateFilterToolbar(); 49 void updateFilterToolbar();
50 virtual void showMaximized (); 50 virtual void showMaximized ();
51 void configureAgenda( int ); 51 void configureAgenda( int );
52 void recieve( const QCString& msg, const QByteArray& data ); 52 void recieve( const QCString& msg, const QByteArray& data );
53 protected slots: 53 protected slots:
54 void setCaptionToDates(); 54 void setCaptionToDates();
55 void weekAction(); 55 void weekAction();
56 void about(); 56 void about();
57 void licence(); 57 void licence();
58 void faq(); 58 void faq();
59 void usertrans(); 59 void usertrans();
60 void features(); 60 void features();
61 void synchowto(); 61 void synchowto();
62 void storagehowto(); 62 void storagehowto();
63 void timetrackinghowto(); 63 void timetrackinghowto();
64 void kdesynchowto(); 64 void kdesynchowto();
65 void multisynchowto(); 65 void multisynchowto();
66 void whatsNew(); 66 void whatsNew();
67 void keyBindings(); 67 void keyBindings();
68 void aboutAutoSaving();; 68 void aboutAutoSaving();;
69 void aboutKnownBugs(); 69 void aboutKnownBugs();
70 70
71 void processIncidenceSelection( Incidence * ); 71 void processIncidenceSelection( Incidence * );
72 72
73 void importQtopia(); 73 void importQtopia();
74 void importBday(); 74 void importBday();
75 void importOL(); 75 void importOL();
76 void importIcal(); 76 void importIcal();
77 void importFile( QString, bool ); 77 void importFile( QString, bool );
78 void quickImportIcal(); 78 void quickImportIcal();
79 79
80 void slotModifiedChanged( bool ); 80 void slotModifiedChanged( bool );
81 81
82 void save(); 82 void save();
83 void saveStopTimer(); 83 void saveStopTimer();
84 void configureToolBar( int ); 84 void configureToolBar( int );
85 void printSel(); 85 void printSel();
86 void printCal(); 86 void printCal();
87 void saveCalendar(); 87 void saveCalendar();
88 void loadCalendar(); 88 void loadCalendar();
89 void exportVCalendar(); 89 void exportVCalendar();
90 void fillFilterMenu(); 90 void fillFilterMenu();
91 void fillFilterMenuTB(); 91 void fillFilterMenuTB();
92 void selectFilter( int ); 92 void selectFilter( int );
93 void fillFilterMenuPopup(); 93 void fillFilterMenuPopup();
94 void selectFilterPopup( int ); 94 void selectFilterPopup( int );
95 void exportToPhone( int ); 95 void exportToPhone( int );
96 void toggleBeamReceive(); 96 void toggleBeamReceive();
97 void disableBR(bool); 97 void disableBR(bool);
98 signals: 98 signals:
99 void selectWeek ( int ); 99 void selectWeek ( int );
100 private slots: 100 private slots:
101 void showConfigureAgenda(); 101 void showConfigureAgenda();
102 void getFile( bool ); 102 void getFile( bool );
103 void syncFileRequest(); 103 void syncFileRequest();
104 104
105 protected: 105 protected:
106 void hideEvent ( QHideEvent * ); 106 void hideEvent ( QHideEvent * );
107 QString sentSyncFile(); 107 QString sentSyncFile();
108 void displayText( QString, QString); 108 void displayText( QString, QString);
109 void enableIncidenceActions( bool ); 109 void enableIncidenceActions( bool );
110 110
111 private: 111 private:
112 bool mBRdisabled; 112 bool mBRdisabled;
113#ifndef DESKTOP_VERSION 113#ifndef DESKTOP_VERSION
114 QCopChannel* infrared; 114 QCopChannel* infrared;
115#endif 115#endif
116 QAction* brAction; 116 QAction* brAction;
117 KSyncManager* mSyncManager; 117 KSyncManager* mSyncManager;
118 bool mClosed; 118 bool mClosed;
119 void saveOnClose(); 119 void saveOnClose();
120 bool mFlagKeyPressed; 120 bool mFlagKeyPressed;
121 bool mBlockAtStartup; 121 bool mBlockAtStartup;
122 QPEToolBar *iconToolBar; 122 QPEToolBar *iconToolBar;
123 QPEToolBar *viewToolBar; 123 QPEToolBar *viewToolBar;
124 QPEToolBar *navigatorToolBar; 124 QPEToolBar *navigatorToolBar;
125 QPEToolBar *filterToolBar; 125 QPEToolBar *filterToolBar;
126 QPEMenuBar *filterMenubar; 126 QMenuBar *filterMenubar;
127 QPopupMenu * filterPopupMenu; 127 QPopupMenu * filterPopupMenu;
128 void initActions(); 128 void initActions();
129 void setDefaultPreferences(); 129 void setDefaultPreferences();
130 void resizeEvent( QResizeEvent* e); 130 void resizeEvent( QResizeEvent* e);
131 void keyPressEvent ( QKeyEvent * ) ; 131 void keyPressEvent ( QKeyEvent * ) ;
132 void keyReleaseEvent ( QKeyEvent * ) ; 132 void keyReleaseEvent ( QKeyEvent * ) ;
133 QPopupMenu *configureToolBarMenu; 133 QPopupMenu *configureToolBarMenu;
134 QPopupMenu *selectFilterMenu; 134 QPopupMenu *selectFilterMenu;
135 QPopupMenu *selectFilterMenuTB; 135 QPopupMenu *selectFilterMenuTB;
136 QPopupMenu *configureAgendaMenu, *syncMenu; 136 QPopupMenu *configureAgendaMenu, *syncMenu;
137 CalendarLocal *mCalendar; 137 CalendarLocal *mCalendar;
138 CalendarView *mView; 138 CalendarView *mView;
139 QAction *mNewSubTodoAction; 139 QAction *mNewSubTodoAction;
140 QAction *mWeekAction; 140 QAction *mWeekAction;
141 QFont mWeekFont; 141 QFont mWeekFont;
142 QPixmap mWeekPixmap; 142 QPixmap mWeekPixmap;
143 QColor mWeekBgColor; 143 QColor mWeekBgColor;
144 144
145 QAction *mShowAction; 145 QAction *mShowAction;
146 QAction *mEditAction; 146 QAction *mEditAction;
147 QAction *mDeleteAction; 147 QAction *mDeleteAction;
148 QAction *mCloneAction; 148 QAction *mCloneAction;
149 QAction *mMoveAction; 149 QAction *mMoveAction;
150 QAction *mBeamAction; 150 QAction *mBeamAction;
151 QAction *mCancelAction; 151 QAction *mCancelAction;
152 152
153 QAction *mToggleNav; 153 QAction *mToggleNav;
154 QAction *mToggleFilter; 154 QAction *mToggleFilter;
155 QAction *mToggleAllday; 155 QAction *mToggleAllday;
156 QAction *actionFilterMenuTB; 156 QAction *actionFilterMenuTB;
157 157
158 void closeEvent( QCloseEvent* ce ); 158 void closeEvent( QCloseEvent* ce );
159 QTimer mSaveTimer; 159 QTimer mSaveTimer;
160 //bool mBlockSaveFlag; 160 //bool mBlockSaveFlag;
161 bool mCalendarModifiedFlag; 161 bool mCalendarModifiedFlag;
162 QPixmap loadPixmap( QString ); 162 QPixmap loadPixmap( QString );
163}; 163};
164 164
165 165
166#endif 166#endif