summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-17 10:42:07 (UTC)
committer zautrix <zautrix>2005-04-17 10:42:07 (UTC)
commitff7743ec82aa6d70325e613d0a1054c7de83a76c (patch) (unidiff)
treee6d4c46a26e120817acd5ab7e47ef41b1428700b /korganizer
parentfd67a473a94c5a3d63a89c52fb8f612cb19b5363 (diff)
downloadkdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.zip
kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.gz
kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp95
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp4
-rw-r--r--korganizer/koviewmanager.cpp7
6 files changed, 105 insertions, 11 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b175f9a..2b7e41f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,2016 +1,2091 @@
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 //qDebug("NEWWWWWWWWWWWWW "); 290 //qDebug("NEWWWWWWWWWWWWW ");
291} 291}
292void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) 292void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
293{ 293{
294 setText( s ); 294 setText( s );
295 mMultiday = 0; 295 mMultiday = 0;
296 mIncidence = incidence; 296 mIncidence = incidence;
297 mDate = qd; 297 mDate = qd;
298 mRecur = false; 298 mRecur = false;
299 mAlarm = false; 299 mAlarm = false;
300 mReply = false; 300 mReply = false;
301 mInfo = false; 301 mInfo = false;
302 mdayPos = 0; 302 mdayPos = 0;
303 //qDebug("recucleeeeeeeeeeeeeeeee "); 303 //qDebug("recucleeeeeeeeeeeeeeeee ");
304} 304}
305 305
306void MonthViewItem::paint(QPainter *p) 306void MonthViewItem::paint(QPainter *p)
307{ 307{
308 if ( mblockRepaint ) { 308 if ( mblockRepaint ) {
309 //qDebug("block "); 309 //qDebug("block ");
310 return; 310 return;
311 } 311 }
312 //qDebug("NON block "); 312 //qDebug("NON block ");
313#if QT_VERSION >= 0x030000 313#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 314 bool sel = isSelected();
315#else 315#else
316 bool sel = selected(); 316 bool sel = selected();
317#endif 317#endif
318 318
319 319
320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
321 { 321 {
322 p->setBackgroundColor( palette().color( QPalette::Normal, \ 322 p->setBackgroundColor( palette().color( QPalette::Normal, \
323 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 323 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
325 } 325 }
326 int x = 1; 326 int x = 1;
327 //int y = 3;//(height() - mRecurPixmap.height()) /2; 327 //int y = 3;//(height() - mRecurPixmap.height()) /2;
328 int size = PIXMAP_SIZE; 328 int size = PIXMAP_SIZE;
329 if ( QApplication::desktop()->width() < 300 ) 329 if ( QApplication::desktop()->width() < 300 )
330 size = 3; 330 size = 3;
331 int heihei = height( listBox () ); 331 int heihei = height( listBox () );
332 int y = (heihei - size -1 ) /2; 332 int y = (heihei - size -1 ) /2;
333 333
334 if ( KOPrefs::instance()->mMonthShowIcons ) { 334 if ( KOPrefs::instance()->mMonthShowIcons ) {
335 if ( mInfo ) { 335 if ( mInfo ) {
336 p->fillRect ( x, y,size,size, Qt::darkGreen ); 336 p->fillRect ( x, y,size,size, Qt::darkGreen );
337 x += size + 1; 337 x += size + 1;
338 } 338 }
339 if ( mRecur ) { 339 if ( mRecur ) {
340 p->fillRect ( x, y,size,size, Qt::blue ); 340 p->fillRect ( x, y,size,size, Qt::blue );
341 x += size + 1; 341 x += size + 1;
342 } 342 }
343 if ( mAlarm ) { 343 if ( mAlarm ) {
344 p->fillRect ( x, y,size,size, Qt::red ); 344 p->fillRect ( x, y,size,size, Qt::red );
345 x += size + 1; 345 x += size + 1;
346 } 346 }
347 if ( mReply ) { 347 if ( mReply ) {
348 p->fillRect ( x, y,size,size, Qt::yellow ); 348 p->fillRect ( x, y,size,size, Qt::yellow );
349 x += size + 1; 349 x += size + 1;
350 } 350 }
351 } 351 }
352 if ( mMultiday ) { 352 if ( mMultiday ) {
353 int yyy = y+(size/2); 353 int yyy = y+(size/2);
354 int sizeM = size+2; 354 int sizeM = size+2;
355 p->setBrush( QBrush::SolidPattern ); 355 p->setBrush( QBrush::SolidPattern );
356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
357 if ( mMultiday == 2 || mMultiday == 3 ) { 357 if ( mMultiday == 2 || mMultiday == 3 ) {
358 QPointArray pa ( 3 ); 358 QPointArray pa ( 3 );
359 pa.setPoint (0, x, yyy ); 359 pa.setPoint (0, x, yyy );
360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
362 p->drawPolygon( pa ); 362 p->drawPolygon( pa );
363 } 363 }
364 if ( mMultiday == 2 || mMultiday == 1 ) { 364 if ( mMultiday == 2 || mMultiday == 1 ) {
365 QPointArray pa ( 3 ); 365 QPointArray pa ( 3 );
366 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 366 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 369 p->drawPolygon( pa );
370 } 370 }
371 if ( mMultiday == 1 ) { 371 if ( mMultiday == 1 ) {
372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
373 373
374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
375 } 375 }
376 if ( mMultiday == 3 ) { 376 if ( mMultiday == 3 ) {
377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
379 379
380 } 380 }
381 x += sizeM/2 + 1; 381 x += sizeM/2 + 1;
382 x += sizeM + 1; 382 x += sizeM + 1;
383 } 383 }
384 384
385 if ( mIncidence->type() == "Todo" ){ 385 if ( mIncidence->type() == "Todo" ){
386 Todo* td = ( Todo* ) mIncidence; 386 Todo* td = ( Todo* ) mIncidence;
387 if ( td->isCompleted() ) { 387 if ( td->isCompleted() ) {
388 int half = size/2; 388 int half = size/2;
389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
391 x += half+half + 4; 391 x += half+half + 4;
392 392
393 } else { 393 } else {
394 int val = td->percentComplete()/20; 394 int val = td->percentComplete()/20;
395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
396 p->drawRect ( x, y-2,7,size+4); 396 p->drawRect ( x, y-2,7,size+4);
397 x += size + 3; 397 x += size + 3;
398 } 398 }
399 } 399 }
400 QFontMetrics fm = p->fontMetrics(); 400 QFontMetrics fm = p->fontMetrics();
401 int yPos; 401 int yPos;
402 int pmheight = size; 402 int pmheight = size;
403 if( pmheight < fm.height() ) 403 if( pmheight < fm.height() )
404 yPos = fm.ascent() + fm.leading()/2; 404 yPos = fm.ascent() + fm.leading()/2;
405 else 405 else
406 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 406 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 407 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 408 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 p->drawText( x, yPos, text() ); 409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
410 if ( mIncidence->cancelled() ) { 410 p->drawText( x, yPos, text() );
411 int wid = fm.width( text() ); 411 if ( mIncidence->cancelled() ) {
412 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 412 int wid = fm.width( text() );
413 } 413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
414 414 }
415 } else {
416 QString pText = text();
417 if( pText.mid(2,1) == ":" )
418 pText = pText.mid( 6 );
419 p->drawText( x, yPos, pText );
420 if ( mIncidence->cancelled() ) {
421 int wid = fm.width( pText );
422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
423 }
424 }
415} 425}
416 426
417int MonthViewItem::height(const QListBox *lb) const 427int MonthViewItem::height(const QListBox *lb) const
418{ 428{
419 int ret = 10; 429 int ret = 10;
420 if ( lb ) 430 if ( lb )
421 ret = lb->fontMetrics().lineSpacing()+1; 431 ret = lb->fontMetrics().lineSpacing()+1;
422 return ret; 432 return ret;
423} 433}
424 434
425int MonthViewItem::width(const QListBox *lb) const 435int MonthViewItem::width(const QListBox *lb) const
426{ 436{
427 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 437 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
428 int size = PIXMAP_SIZE; 438 int size = PIXMAP_SIZE;
429 if ( QApplication::desktop()->width() < 300 ) 439 if ( QApplication::desktop()->width() < 300 )
430 size = 3; 440 size = 3;
431 int x = 1; 441 int x = 1;
432 if ( KOPrefs::instance()->mMonthShowIcons ) { 442 if ( KOPrefs::instance()->mMonthShowIcons ) {
433 if ( mInfo ) { 443 if ( mInfo ) {
434 x += size + 1; 444 x += size + 1;
435 } 445 }
436 if( mRecur ) { 446 if( mRecur ) {
437 x += size+1; 447 x += size+1;
438 } 448 }
439 if( mAlarm ) { 449 if( mAlarm ) {
440 x += size+1; 450 x += size+1;
441 } 451 }
442 if( mReply ) { 452 if( mReply ) {
443 x += size+1; 453 x += size+1;
444 } 454 }
445 } 455 }
446 if( mMultiday ) { 456 if( mMultiday ) {
447 x += size+1+2+size/2; 457 x += size+1+2+size/2;
448 } 458 }
449 return( x + lb->fontMetrics().width( text() ) + 1 ); 459 return( x + lb->fontMetrics().width( text() ) + 1 );
450 } 460 }
451 if ( ! lb ) 461 if ( ! lb )
452 return 10; 462 return 10;
453 //qDebug("ret wid %d ", lb->width()); 463 //qDebug("ret wid %d ", lb->width());
454 return lb->width(); 464 return lb->width();
455} 465}
456 466
457 467
458MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 468MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
459 : KNoScrollListBox( par ), 469 : KNoScrollListBox( par ),
460 mMonthView( parent ) 470 mMonthView( parent )
461{ 471{
462 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 472 //QVBoxLayout *topLayout = new QVBoxLayout( this );
463 currentPalette = 0; 473 currentPalette = 0;
464 // mLabel = new QLabel( this );QPushButton 474 // mLabel = new QLabel( this );QPushButton
465 mLabel = new QPushButton( this ); 475 mLabel = new QPushButton( this );
466 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 476 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
467 //mLabel->setLineWidth( 1 ); 477 //mLabel->setLineWidth( 1 );
468 //mLabel->setAlignment( AlignCenter ); 478 //mLabel->setAlignment( AlignCenter );
469 mLabel->setFlat( true ); 479 mLabel->setFlat( true );
470 mLabel->setFocusPolicy(NoFocus); 480 mLabel->setFocusPolicy(NoFocus);
471 //mItemList = new KNoScrollListBox( this ); 481 //mItemList = new KNoScrollListBox( this );
472 setMinimumSize( 10, 10 ); 482 setMinimumSize( 10, 10 );
473 setFrameStyle( QFrame::Panel | QFrame::Plain ); 483 setFrameStyle( QFrame::Panel | QFrame::Plain );
474 setLineWidth( 1 ); 484 setLineWidth( 1 );
475 //topLayout->addWidget( mItemList ); 485 //topLayout->addWidget( mItemList );
476 mLabel->raise(); 486 mLabel->raise();
477 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 487 // QColor( 0,0,255 ) QColor( 160,1600,255 )
478 mStandardPalette = palette(); 488 mStandardPalette = palette();
479 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 489 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
480 490
481 enableScrollBars( false ); 491 enableScrollBars( false );
482 updateConfig(); 492 updateConfig();
483 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 493 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
484 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 494 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
485 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 495 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
486 SLOT( defaultAction( QListBoxItem * ) ) ); 496 SLOT( defaultAction( QListBoxItem * ) ) );
487 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 497 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
488 const QPoint &) ), 498 const QPoint &) ),
489 SLOT( contextMenu( QListBoxItem * ) ) ); 499 SLOT( contextMenu( QListBoxItem * ) ) );
490 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 500 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
491 SLOT( selection( QListBoxItem * ) ) ); 501 SLOT( selection( QListBoxItem * ) ) );
492 502
493 /* 503 /*
494 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 504 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
495 SLOT( selection( QListBoxItem * ) ) ); 505 SLOT( selection( QListBoxItem * ) ) );
496 */ 506 */
497} 507}
498#ifdef DESKTOP_VERSION 508#ifdef DESKTOP_VERSION
499QToolTipGroup *MonthViewCell::toolTipGroup() 509QToolTipGroup *MonthViewCell::toolTipGroup()
500{ 510{
501 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 511 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
502 return mToolTipGroup; 512 return mToolTipGroup;
503} 513}
504#endif 514#endif
505 515
506void MonthViewCell::setDate( const QDate &date ) 516void MonthViewCell::setDate( const QDate &date )
507{ 517{
508 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 518 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
509 mDate = date; 519 mDate = date;
510 520
511 521
512 522
513 //resizeEvent( 0 ); 523 //resizeEvent( 0 );
514} 524}
515 525
516QDate MonthViewCell::date() const 526QDate MonthViewCell::date() const
517{ 527{
518 return mDate; 528 return mDate;
519} 529}
520 530
521void MonthViewCell::setPrimary( bool primary ) 531void MonthViewCell::setPrimary( bool primary )
522{ 532{
523 mPrimary = primary; 533 mPrimary = primary;
524 //setMyPalette(); 534 //setMyPalette();
525} 535}
526void MonthViewCell::setMyPalette() 536void MonthViewCell::setMyPalette()
527{ 537{
528 538
529 if ( mHoliday) { 539 if ( mHoliday) {
530 if ( currentPalette == 1 ) return; 540 if ( currentPalette == 1 ) return;
531 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); 541 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
532 setPalette( mHolidayPalette ); 542 setPalette( mHolidayPalette );
533 //mLabel->setPalette( mHolidayPalette ); 543 //mLabel->setPalette( mHolidayPalette );
534 currentPalette = 1; 544 currentPalette = 1;
535 545
536 } else { 546 } else {
537 if ( mPrimary ) { 547 if ( mPrimary ) {
538 if ( currentPalette == 2 ) return; 548 if ( currentPalette == 2 ) return;
539 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 549 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
540 //mLabel->setPalette( mPrimaryPalette ); 550 //mLabel->setPalette( mPrimaryPalette );
541 setPalette( mPrimaryPalette ); 551 setPalette( mPrimaryPalette );
542 currentPalette = 2; 552 currentPalette = 2;
543 553
544 } else { 554 } else {
545 if ( currentPalette == 3 ) return; 555 if ( currentPalette == 3 ) return;
546 setPalette( mNonPrimaryPalette ); 556 setPalette( mNonPrimaryPalette );
547 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 557 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
548 //mLabel->setPalette( mNonPrimaryPalette );; 558 //mLabel->setPalette( mNonPrimaryPalette );;
549 currentPalette = 3; 559 currentPalette = 3;
550 } 560 }
551 } 561 }
552 //QPalette pal = palette(); 562 //QPalette pal = palette();
553 563
554 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 564 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
555} 565}
556QPalette MonthViewCell::getPalette () 566QPalette MonthViewCell::getPalette ()
557{ 567{
558 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 568 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
559 return mStandardPalette; 569 return mStandardPalette;
560 if ( mHoliday) { 570 if ( mHoliday) {
561 return mHolidayPalette ; 571 return mHolidayPalette ;
562 } else { 572 } else {
563 if ( mPrimary ) { 573 if ( mPrimary ) {
564 return mPrimaryPalette ; 574 return mPrimaryPalette ;
565 } 575 }
566 } 576 }
567 return mNonPrimaryPalette; 577 return mNonPrimaryPalette;
568} 578}
569bool MonthViewCell::isPrimary() const 579bool MonthViewCell::isPrimary() const
570{ 580{
571 return mPrimary; 581 return mPrimary;
572} 582}
573 583
574void MonthViewCell::setHoliday( bool holiday ) 584void MonthViewCell::setHoliday( bool holiday )
575{ 585{
576 mHoliday = holiday; 586 mHoliday = holiday;
577 //setMyPalette(); 587 //setMyPalette();
578} 588}
579 589
580void MonthViewCell::setHoliday( const QString &holiday ) 590void MonthViewCell::setHoliday( const QString &holiday )
581{ 591{
582 mHolidayString = holiday; 592 mHolidayString = holiday;
583 593
584 if ( !holiday.isEmpty() ) { 594 if ( !holiday.isEmpty() ) {
585 setHoliday( true ); 595 setHoliday( true );
586 } 596 }
587} 597}
588 598
589void MonthViewCell::startUpdateCell() 599void MonthViewCell::startUpdateCell()
590{ 600{
591 mdayCount = 0; 601 mdayCount = 0;
592 setFocusPolicy(NoFocus); 602 setFocusPolicy(NoFocus);
593 if ( !mMonthView->isUpdatePossible() ) 603 if ( !mMonthView->isUpdatePossible() )
594 return; 604 return;
595 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 605 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
596 while ( mitem ) { 606 while ( mitem ) {
597 mitem->setBlockRepaint( true ); 607 mitem->setBlockRepaint( true );
598 mitem = (MonthViewItem *)mitem->next(); 608 mitem = (MonthViewItem *)mitem->next();
599 } 609 }
600 if ( mAvailItemList.count() > 20 ) { 610 if ( mAvailItemList.count() > 20 ) {
601 mAvailItemList.setAutoDelete( true ); 611 mAvailItemList.setAutoDelete( true );
602 mAvailItemList.clear(); 612 mAvailItemList.clear();
603 mAvailItemList.setAutoDelete( false ); 613 mAvailItemList.setAutoDelete( false );
604 } 614 }
605 /* 615 /*
606 if ( !isVisible() ){ 616 if ( !isVisible() ){
607 return; 617 return;
608 } 618 }
609 */ 619 */
610 // qDebug("MonthViewCell::updateCell() "); 620 // qDebug("MonthViewCell::updateCell() ");
611 setPrimary( mDate.month()%2 ); 621 setPrimary( mDate.month()%2 );
612 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 622 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
613 if ( mDate == QDate::currentDate() ) { 623 if ( mDate == QDate::currentDate() ) {
614 setLineWidth( 3 ); 624 setLineWidth( 3 );
615 } else { 625 } else {
616 setLineWidth( 1 ); 626 setLineWidth( 1 );
617 } 627 }
618 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 628 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
619 //clear(); 629 //clear();
620 while ( CurrentAvailItem ) { 630 while ( CurrentAvailItem ) {
621 MonthViewItem *item = CurrentAvailItem; 631 MonthViewItem *item = CurrentAvailItem;
622 CurrentAvailItem = (MonthViewItem *)item->next(); 632 CurrentAvailItem = (MonthViewItem *)item->next();
623 mAvailItemList.append( item ); 633 mAvailItemList.append( item );
624 takeItem ( item ); 634 takeItem ( item );
625 } 635 }
626 636
627#ifdef DESKTOP_VERSION 637#ifdef DESKTOP_VERSION
628 QToolTip::remove(this); 638 QToolTip::remove(this);
629#endif 639#endif
630 mToolTip.clear(); 640 mToolTip.clear();
631 //qApp->processEvents(); 641 //qApp->processEvents();
632#if 0 642#if 0
633 if ( !mHolidayString.isEmpty() ) { 643 if ( !mHolidayString.isEmpty() ) {
634 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 644 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
635 item->setPalette( mHolidayPalette ); 645 item->setPalette( mHolidayPalette );
636 insertItem( item ); 646 insertItem( item );
637 mToolTip.append ( mHolidayString ); 647 mToolTip.append ( mHolidayString );
638 } 648 }
639#endif 649#endif
640} 650}
641 651
642int MonthViewCell::insertEvent(Event *event) 652int MonthViewCell::insertEvent(Event *event)
643{ 653{
644 bool useToolTips = true; 654 bool useToolTips = true;
645#ifndef DESKTOP_VERSION 655#ifndef DESKTOP_VERSION
646 useToolTips = false; 656 useToolTips = false;
647#endif 657#endif
648 QString mToolTipText; 658 QString mToolTipText;
649 setFocusPolicy(WheelFocus); 659 setFocusPolicy(WheelFocus);
650 if ( !(event->doesRecur() == Recurrence::rNone) ) { 660 if ( !(event->doesRecur() == Recurrence::rNone) ) {
651 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 661 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
652 return mdayCount; 662 return mdayCount;
653 else 663 else
654 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 664 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
655 return mdayCount; 665 return mdayCount;
656 } 666 }
657 667
658 if ( event->isHoliday()) { 668 if ( event->isHoliday()) {
659 setHoliday( true ); 669 setHoliday( true );
660 if ( mDate.dayOfWeek() == 7 ) 670 if ( mDate.dayOfWeek() == 7 )
661 setLineWidth( 3 ); 671 setLineWidth( 3 );
662 } 672 }
663 QString text; 673 QString text;
664 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 674 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
665 if (event->isMultiDay()) { 675 if (event->isMultiDay()) {
666 QString prefix = "<->";multiday = 2; 676 QString prefix = "<->";multiday = 2;
667 QString time; 677 QString time;
668 if ( event->doesRecur() ) { 678 if ( event->doesRecur() ) {
669 if ( event->recursOn( mDate) ) { 679 if ( event->recursOn( mDate) ) {
670 prefix ="->" ;multiday = 1; 680 prefix ="->" ;multiday = 1;
671 } 681 }
672 else { 682 else {
673 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 683 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
674 if ( event->recursOn( mDate.addDays( -days)) ) { 684 if ( event->recursOn( mDate.addDays( -days)) ) {
675 prefix ="<-" ;multiday = 3; 685 prefix ="<-" ;multiday = 3;
676 } 686 }
677 } 687 }
678 688
679 } else { 689 } else {
680 if (mDate == event->dtStart().date()) { 690 if (mDate == event->dtStart().date()) {
681 prefix ="->" ;multiday = 1; 691 prefix ="->" ;multiday = 1;
682 } else if (mDate == event->dtEnd().date()) { 692 } else if (mDate == event->dtEnd().date()) {
683 prefix ="<-" ;multiday = 3; 693 prefix ="<-" ;multiday = 3;
684 } 694 }
685 } 695 }
686 if ( !event->doesFloat() ) { 696 if ( !event->doesFloat() ) {
687 if ( mDate == event->dtStart().date () ) 697 if ( mDate == event->dtStart().date () )
688 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 698 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
689 else if ( mDate == event->dtEnd().date () ) 699 else if ( mDate == event->dtEnd().date () )
690 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 700 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
691 701
692 } 702 }
693 text = time + event->summary(); 703 text = time + event->summary();
694 if ( useToolTips ) 704 if ( useToolTips )
695 mToolTipText += prefix + text; 705 mToolTipText += prefix + text;
696 } else { 706 } else {
697 if (event->doesFloat()) { 707 if (event->doesFloat()) {
698 text = event->summary(); 708 text = event->summary();
699 if ( useToolTips ) 709 if ( useToolTips )
700 mToolTipText += text; 710 mToolTipText += text;
701 } 711 }
702 else { 712 else {
703 text = KGlobal::locale()->formatTime(event->dtStart().time()); 713 text = KGlobal::locale()->formatTime(event->dtStart().time());
704 text += " " + event->summary(); 714 text += " " + event->summary();
705 if ( useToolTips ) 715 if ( useToolTips )
706 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 716 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
707 } 717 }
708 } 718 }
709 if ( useToolTips && ! event->location().isEmpty() ) { 719 if ( useToolTips && ! event->location().isEmpty() ) {
710 mToolTipText += " (" + event->location() +")"; 720 mToolTipText += " (" + event->location() +")";
711 } 721 }
712 MonthViewItem *item ; 722 MonthViewItem *item ;
713 723
714 if ( mAvailItemList.count() ) { 724 if ( mAvailItemList.count() ) {
715 item = mAvailItemList.first(); 725 item = mAvailItemList.first();
716 mAvailItemList.remove( item ); 726 mAvailItemList.remove( item );
717 item->recycle( event, mDate, text ); 727 item->recycle( event, mDate, text );
718 } else { 728 } else {
719 item = new MonthViewItem( event, mDate, text ); 729 item = new MonthViewItem( event, mDate, text );
720 } 730 }
721 731
722 QPalette pal; 732 QPalette pal;
723 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 733 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
724 QStringList categories = event->categories(); 734 QStringList categories = event->categories();
725 QString cat = categories.first(); 735 QString cat = categories.first();
726 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 736 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
727 pal = getPalette(); 737 pal = getPalette();
728 if (cat.isEmpty()) { 738 if (cat.isEmpty()) {
729 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 739 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
730 } else { 740 } else {
731 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 741 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
732 } 742 }
733 743
734 } else { 744 } else {
735 if (cat.isEmpty()) { 745 if (cat.isEmpty()) {
736 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 746 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
737 } else { 747 } else {
738 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 748 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
739 } 749 }
740 } 750 }
741 751
742 } else { 752 } else {
743 pal = mStandardPalette ; 753 pal = mStandardPalette ;
744 } 754 }
745 item->setPalette( pal ); 755 item->setPalette( pal );
746 item->setRecur( event->recurrence()->doesRecur() ); 756 item->setRecur( event->recurrence()->doesRecur() );
747 item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); 757 item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
748 item->setMoreInfo( event->description().length() > 0 ); 758 item->setMoreInfo( event->description().length() > 0 );
749#ifdef DESKTOP_VERSION 759#ifdef DESKTOP_VERSION
750 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 760 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
751 KOPrefs::instance()->email()); 761 KOPrefs::instance()->email());
752 if ( me != 0 ) { 762 if ( me != 0 ) {
753 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 763 if ( me->status() == Attendee::NeedsAction && me->RSVP())
754 item->setReply(true && multiday < 2); 764 item->setReply(true && multiday < 2);
755 else 765 else
756 item->setReply(false); 766 item->setReply(false);
757 } else 767 } else
758 item->setReply(false); 768 item->setReply(false);
759#endif 769#endif
760 item->setMultiDay( multiday ); 770 item->setMultiDay( multiday );
761 if ( multiday ) { 771 if ( multiday ) {
762 insertItem( item ,mdayCount); 772 insertItem( item ,mdayCount);
763 ++mdayCount; 773 ++mdayCount;
764 } else { 774 } else {
765 uint i; 775 uint i;
766 int pos = mdayCount; 776 int pos = mdayCount;
767 for ( i = mdayCount; i < count();++i ) { 777 for ( i = mdayCount; i < count();++i ) {
768 QListBoxItem* it = this->item ( i ); 778 QListBoxItem* it = this->item ( i );
769 if ( text < it->text() ) { 779 if ( text < it->text() ) {
770 pos = i; 780 pos = i;
771 break; 781 break;
772 } 782 }
773 ++pos; 783 ++pos;
774 } 784 }
775 insertItem( item ,pos); 785 insertItem( item ,pos);
776 } 786 }
777 if ( useToolTips ) { 787 if ( useToolTips ) {
778 mToolTip.append( mToolTipText ); 788 mToolTip.append( mToolTipText );
779 } 789 }
780 return mdayCount; 790 return mdayCount;
781} 791}
782void MonthViewCell::insertTodo(Todo *todo) 792void MonthViewCell::insertTodo(Todo *todo)
783{ 793{
784 setFocusPolicy(WheelFocus); 794 setFocusPolicy(WheelFocus);
785 QString text; 795 QString text;
786 if (todo->hasDueDate()) { 796 if (todo->hasDueDate()) {
787 if (!todo->doesFloat()) { 797 if (!todo->doesFloat()) {
788 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 798 text += KGlobal::locale()->formatTime(todo->dtDue().time());
789 text += " "; 799 text += " ";
790 } 800 }
791 } 801 }
792 text += todo->summary(); 802 text += todo->summary();
793 MonthViewItem *item ; 803 MonthViewItem *item ;
794 if ( mAvailItemList.count() ) { 804 if ( mAvailItemList.count() ) {
795 item = mAvailItemList.first(); 805 item = mAvailItemList.first();
796 mAvailItemList.remove( item ); 806 mAvailItemList.remove( item );
797 item->recycle( todo, mDate, text ); 807 item->recycle( todo, mDate, text );
798 } else { 808 } else {
799 item = new MonthViewItem( todo, mDate, text ); 809 item = new MonthViewItem( todo, mDate, text );
800 } 810 }
801 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 811 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
802 //item->setPalette( mStandardPalette ); 812 //item->setPalette( mStandardPalette );
803 QPalette pal; 813 QPalette pal;
804 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 814 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
805 QStringList categories = todo->categories(); 815 QStringList categories = todo->categories();
806 QString cat = categories.first(); 816 QString cat = categories.first();
807 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 817 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
808 pal = getPalette(); 818 pal = getPalette();
809 if (cat.isEmpty()) { 819 if (cat.isEmpty()) {
810 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 820 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
811 } else { 821 } else {
812 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 822 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
813 } 823 }
814 824
815 } else { 825 } else {
816 if (cat.isEmpty()) { 826 if (cat.isEmpty()) {
817 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 827 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
818 } else { 828 } else {
819 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 829 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
820 } 830 }
821 } 831 }
822 832
823 } else { 833 } else {
824 pal = mStandardPalette ; 834 pal = mStandardPalette ;
825 } 835 }
826 item->setPalette( pal ); 836 item->setPalette( pal );
827 item->setRecur( todo->recurrence()->doesRecur() ); 837 item->setRecur( todo->recurrence()->doesRecur() );
828 item->setAlarm( todo->isAlarmEnabled() ); 838 item->setAlarm( todo->isAlarmEnabled() );
829 item->setMoreInfo( todo->description().length() > 0 ); 839 item->setMoreInfo( todo->description().length() > 0 );
830 insertItem( item , count()); 840 insertItem( item , count());
831#ifdef DESKTOP_VERSION 841#ifdef DESKTOP_VERSION
832 mToolTip.append( text ); 842 mToolTip.append( text );
833#endif 843#endif
834} 844}
835void MonthViewCell::repaintfinishUpdateCell() 845void MonthViewCell::repaintfinishUpdateCell()
836{ 846{
837 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 847 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
838 while ( mitem ) { 848 while ( mitem ) {
839 mitem->setBlockRepaint( false ); 849 mitem->setBlockRepaint( false );
840 updateItem ( mitem ); 850 updateItem ( mitem );
841 mitem = (MonthViewItem *)mitem->next(); 851 mitem = (MonthViewItem *)mitem->next();
842 } 852 }
843} 853}
844void MonthViewCell::finishUpdateCell() 854void MonthViewCell::finishUpdateCell()
845{ 855{
846 856
847 857
848 858
849#ifdef DESKTOP_VERSION 859#ifdef DESKTOP_VERSION
850 if (mToolTip.count() > 0 ) { 860 if (mToolTip.count() > 0 ) {
851 mToolTip.sort(); 861 mToolTip.sort();
852 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 862 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
853 } 863 }
854#endif 864#endif
855 //sort(); 865 //sort();
856 //setMyPalette(); 866 //setMyPalette();
857 setMyPalette(); 867 setMyPalette();
858 868
859 resizeEvent( 0 ); 869 resizeEvent( 0 );
860 870
861} 871}
862void MonthViewCell::updateCell() 872void MonthViewCell::updateCell()
863{ 873{
864 //qDebug("MonthViewCell::updateCell() "); 874 //qDebug("MonthViewCell::updateCell() ");
865 if ( !mMonthView->isUpdatePossible() ) 875 if ( !mMonthView->isUpdatePossible() )
866 return; 876 return;
867 startUpdateCell(); 877 startUpdateCell();
868 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 878 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
869 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 879 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
870 Event *event; 880 Event *event;
871 for( event = events.first(); event; event = events.next() ) { // for event 881 for( event = events.first(); event; event = events.next() ) { // for event
872 insertEvent(event); 882 insertEvent(event);
873 } 883 }
874 // insert due todos 884 // insert due todos
875 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 885 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
876 Todo *todo; 886 Todo *todo;
877 for(todo = todos.first(); todo; todo = todos.next()) { 887 for(todo = todos.first(); todo; todo = todos.next()) {
878 insertTodo( todo ); 888 insertTodo( todo );
879 } 889 }
880 finishUpdateCell(); 890 finishUpdateCell();
881 // if ( isVisible()) 891 // if ( isVisible())
882 //qApp->processEvents(); 892 //qApp->processEvents();
883} 893}
884 894
885void MonthViewCell::updateConfig( bool bigFont ) // = false 895void MonthViewCell::updateConfig( bool bigFont ) // = false
886{ 896{
887 897
888 if ( bigFont ) { 898 if ( bigFont ) {
889 QFont fo = KOPrefs::instance()->mMonthViewFont; 899 QFont fo = KOPrefs::instance()->mMonthViewFont;
890 int ps = fo.pointSize() + 2; 900 int ps = fo.pointSize() + 2;
891 if ( ps < 18 ) 901 if ( ps < 18 )
892 ps += 2; 902 ps += 2;
893 fo.setPointSize( ps ); 903 fo.setPointSize( ps );
894 setFont( fo ); 904 setFont( fo );
895 } else 905 } else
896 setFont( KOPrefs::instance()->mMonthViewFont ); 906 setFont( KOPrefs::instance()->mMonthViewFont );
897 907
898 QFontMetrics fm( font() ); 908 QFontMetrics fm( font() );
899 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 909 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
900 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 910 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
901 mHolidayPalette = mStandardPalette; 911 mHolidayPalette = mStandardPalette;
902 mPrimaryPalette = mStandardPalette; 912 mPrimaryPalette = mStandardPalette;
903 mNonPrimaryPalette = mStandardPalette; 913 mNonPrimaryPalette = mStandardPalette;
904 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 914 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
905 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 915 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
906 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 916 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
907 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 917 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
908 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 918 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
909 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 919 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
910 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 920 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
911 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 921 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
912 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 922 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
913 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 923 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
914 } 924 }
915 //updateCell(); 925 //updateCell();
916} 926}
917 927
918void MonthViewCell::enableScrollBars( bool enabled ) 928void MonthViewCell::enableScrollBars( bool enabled )
919{ 929{
920 930
921 return; 931 return;
922 if ( enabled ) { 932 if ( enabled ) {
923 QListBoxItem *fi = firstItem (); 933 QListBoxItem *fi = firstItem ();
924 if (fi ) { 934 if (fi ) {
925 int ihei = fi->height( this ); 935 int ihei = fi->height( this );
926 int hei = numRows () * ihei; 936 int hei = numRows () * ihei;
927 if ( hei < height() - horizontalScrollBar()->height () ) { 937 if ( hei < height() - horizontalScrollBar()->height () ) {
928 setVScrollBarMode(QScrollView::AlwaysOff); 938 setVScrollBarMode(QScrollView::AlwaysOff);
929 } 939 }
930 else 940 else
931 setVScrollBarMode(QScrollView::Auto); 941 setVScrollBarMode(QScrollView::Auto);
932 if ( ihei *3 > height() ) { 942 if ( ihei *3 > height() ) {
933 setHScrollBarMode(QScrollView::AlwaysOff); 943 setHScrollBarMode(QScrollView::AlwaysOff);
934 } 944 }
935 else { 945 else {
936 setHScrollBarMode(QScrollView::Auto); 946 setHScrollBarMode(QScrollView::Auto);
937 } 947 }
938 } else { 948 } else {
939 setVScrollBarMode(QScrollView::Auto); 949 setVScrollBarMode(QScrollView::Auto);
940 setHScrollBarMode(QScrollView::Auto); 950 setHScrollBarMode(QScrollView::Auto);
941 } 951 }
942 } else { 952 } else {
943 setVScrollBarMode(QScrollView::AlwaysOff); 953 setVScrollBarMode(QScrollView::AlwaysOff);
944 setHScrollBarMode(QScrollView::AlwaysOff); 954 setHScrollBarMode(QScrollView::AlwaysOff);
945 } 955 }
946} 956}
947 957
948Incidence *MonthViewCell::selectedIncidence() 958Incidence *MonthViewCell::selectedIncidence()
949{ 959{
950 int index = currentItem(); 960 int index = currentItem();
951 if ( index < 0 ) return 0; 961 if ( index < 0 ) return 0;
952 962
953 MonthViewItem *mitem = 963 MonthViewItem *mitem =
954 static_cast<MonthViewItem *>( item( index ) ); 964 static_cast<MonthViewItem *>( item( index ) );
955 965
956 if ( !mitem ) return 0; 966 if ( !mitem ) return 0;
957 967
958 return mitem->incidence(); 968 return mitem->incidence();
959} 969}
960 970
961QDate MonthViewCell::selectedIncidenceDate() 971QDate MonthViewCell::selectedIncidenceDate()
962{ 972{
963 QDate qd; 973 QDate qd;
964 int index = currentItem(); 974 int index = currentItem();
965 if ( index < 0 ) return qd; 975 if ( index < 0 ) return qd;
966 976
967 MonthViewItem *mitem = 977 MonthViewItem *mitem =
968 static_cast<MonthViewItem *>( item( index ) ); 978 static_cast<MonthViewItem *>( item( index ) );
969 979
970 if ( !mitem ) return qd; 980 if ( !mitem ) return qd;
971 981
972 return mitem->incidenceDate(); 982 return mitem->incidenceDate();
973} 983}
974 984
975void MonthViewCell::deselect() 985void MonthViewCell::deselect()
976{ 986{
977 clearSelection(); 987 clearSelection();
978 enableScrollBars( false ); 988 enableScrollBars( false );
979 // updateCell(); 989 // updateCell();
980} 990}
981void MonthViewCell::select() 991void MonthViewCell::select()
982{ 992{
983 ;// updateCell(); 993 ;// updateCell();
984} 994}
985 995
986void MonthViewCell::resizeEvent ( QResizeEvent * e ) 996void MonthViewCell::resizeEvent ( QResizeEvent * e )
987{ 997{
988 if ( !mMonthView->isUpdatePossible() ) 998 if ( !mMonthView->isUpdatePossible() )
989 return; 999 return;
990 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 1000 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
991 deselect(); 1001 deselect();
992 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 1002 mLabel->setMaximumHeight( height() - lineWidth()*2 );
993 1003
994 QString text; 1004 QString text;
995 mLabel->setText( text ); 1005 mLabel->setText( text );
996 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 1006 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
997 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 1007 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
998 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 1008 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
999 mLabel->resize( mLabelBigSize ); 1009 mLabel->resize( mLabelBigSize );
1000 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1010 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1001 } else { 1011 } else {
1002 mLabel->resize( mLabelSize ); 1012 mLabel->resize( mLabelSize );
1003 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1013 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1004 } 1014 }
1005 mLabel->setText( text ); 1015 mLabel->setText( text );
1006 1016
1007 int size = height() - mLabel->height() - lineWidth()-1; 1017 int size = height() - mLabel->height() - lineWidth()-1;
1008 //qDebug("LW %d ", lineWidth()); 1018 //qDebug("LW %d ", lineWidth());
1009 if ( size > 0 ) 1019 if ( size > 0 )
1010 verticalScrollBar()->setMaximumHeight( size ); 1020 verticalScrollBar()->setMaximumHeight( size );
1011 size = width() - mLabel->width() -lineWidth()-1; 1021 size = width() - mLabel->width() -lineWidth()-1;
1012 if ( size > 0 ) 1022 if ( size > 0 )
1013 horizontalScrollBar()->setMaximumWidth( size ); 1023 horizontalScrollBar()->setMaximumWidth( size );
1014 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1024 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1015 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1025 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1016 // mItemList->resize ( width(), height () ); 1026 // mItemList->resize ( width(), height () );
1017 if ( e ) 1027 if ( e )
1018 KNoScrollListBox::resizeEvent ( e ); 1028 KNoScrollListBox::resizeEvent ( e );
1019} 1029}
1020 1030
1021void MonthViewCell::defaultAction( QListBoxItem *item ) 1031void MonthViewCell::defaultAction( QListBoxItem *item )
1022{ 1032{
1023 1033
1024 if ( !item ) { 1034 if ( !item ) {
1025 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1035 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1026 emit newEventSignal( dt ); 1036 emit newEventSignal( dt );
1027 return; 1037 return;
1028 } 1038 }
1029 1039
1030 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1040 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1031 Incidence *incidence = eventItem->incidence(); 1041 Incidence *incidence = eventItem->incidence();
1032 if ( incidence ) mMonthView->defaultAction( incidence ); 1042 if ( incidence ) mMonthView->defaultAction( incidence );
1033} 1043}
1034void MonthViewCell::showDay() 1044void MonthViewCell::showDay()
1035{ 1045{
1036 emit showDaySignal( date() ); 1046 emit showDaySignal( date() );
1037} 1047}
1038void MonthViewCell::newEvent() 1048void MonthViewCell::newEvent()
1039{ 1049{
1040 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1050 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1041 emit newEventSignal( dt ); 1051 emit newEventSignal( dt );
1042} 1052}
1043void MonthViewCell::cellClicked( QListBoxItem *item ) 1053void MonthViewCell::cellClicked( QListBoxItem *item )
1044{ 1054{
1055 mMonthView->setSelectedCell( this );
1045 qDebug("CELL "); 1056 qDebug("CELL ");
1046 if ( item == 0 ) { 1057 if ( item == 0 ) {
1047 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1058 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1048 emit newEventSignal( dt ); 1059 emit newEventSignal( dt );
1049 return; 1060 return;
1050 } 1061 }
1051 1062
1052} 1063}
1053 1064
1054void MonthViewCell::contextMenu( QListBoxItem *item ) 1065void MonthViewCell::contextMenu( QListBoxItem *item )
1055{ 1066{
1056 if ( !item ) return; 1067 mMonthView->setPopupCell( this );
1057 1068 if ( !item ) {
1069 mMonthView->showContextMenu( 0 );
1070 return;
1071 }
1058 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1072 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1059 Incidence *incidence = eventItem->incidence(); 1073 Incidence *incidence = eventItem->incidence();
1060 if ( incidence ) mMonthView->showContextMenu( incidence ); 1074 if ( incidence ) mMonthView->showContextMenu( incidence );
1061} 1075}
1062 1076
1063void MonthViewCell::selection( QListBoxItem *item ) 1077void MonthViewCell::selection( QListBoxItem *item )
1064{ 1078{
1065 if ( !item ) return; 1079 if ( !item ) return;
1066 1080
1067 mMonthView->setSelectedCell( this ); 1081 mMonthView->setSelectedCell( this );
1068} 1082}
1069 1083
1070 1084
1071// ******************************************************************************* 1085// *******************************************************************************
1072// ******************************************************************************* 1086// *******************************************************************************
1073// ******************************************************************************* 1087// *******************************************************************************
1074 1088
1075 1089
1076KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1090KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1077 : KOEventView( calendar, parent, name ), 1091 : KOEventView( calendar, parent, name ),
1078 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1092 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1079 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1093 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1080{ 1094{
1081 mFlagKeyPressed = false; 1095 mFlagKeyPressed = false;
1082 mShortDayLabelsM = false; 1096 mShortDayLabelsM = false;
1083 mShortDayLabelsW = false; 1097 mShortDayLabelsW = false;
1084 skipResize = false; 1098 skipResize = false;
1085 clPending = true; 1099 clPending = true;
1100 mPopupCell = 0;
1086 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1101 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1087 mWidStack = new QWidgetStack( this ); 1102 mWidStack = new QWidgetStack( this );
1088 QVBoxLayout* hb = new QVBoxLayout( this ); 1103 QVBoxLayout* hb = new QVBoxLayout( this );
1089 mMonthView = new QWidget( mWidStack ); 1104 mMonthView = new QWidget( mWidStack );
1090 mWeekView = new QWidget( mWidStack ); 1105 mWeekView = new QWidget( mWidStack );
1091#if QT_VERSION >= 0x030000 1106#if QT_VERSION >= 0x030000
1092 mWidStack->addWidget(mMonthView ); 1107 mWidStack->addWidget(mMonthView );
1093 mWidStack->addWidget(mWeekView ); 1108 mWidStack->addWidget(mWeekView );
1094#else 1109#else
1095 mWidStack->addWidget( mMonthView, 1 ); 1110 mWidStack->addWidget( mMonthView, 1 );
1096 mWidStack->addWidget( mWeekView , 1 ); 1111 mWidStack->addWidget( mWeekView , 1 );
1097#endif 1112#endif
1098 hb->addWidget( mNavigatorBar ); 1113 hb->addWidget( mNavigatorBar );
1099 hb->addWidget( mWidStack ); 1114 hb->addWidget( mWidStack );
1100 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1115 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1101 updatePossible = false; 1116 updatePossible = false;
1102 //updatePossible = true; 1117 //updatePossible = true;
1103 mCells.setAutoDelete( true ); 1118 mCells.setAutoDelete( true );
1104 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1119 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1105 mDayLabels.resize( mDaysPerWeek ); 1120 mDayLabels.resize( mDaysPerWeek );
1106 mDayLabelsW.resize( mDaysPerWeek ); 1121 mDayLabelsW.resize( mDaysPerWeek );
1107 QFont bfont = font(); 1122 QFont bfont = font();
1108 if ( QApplication::desktop()->width() < 650 ) { 1123 if ( QApplication::desktop()->width() < 650 ) {
1109 bfont.setPointSize( bfont.pointSize() - 2 ); 1124 bfont.setPointSize( bfont.pointSize() - 2 );
1110 } 1125 }
1111 bfont.setBold( true ); 1126 bfont.setBold( true );
1112 int i; 1127 int i;
1113 1128
1114 for( i = 0; i < mDaysPerWeek; i++ ) { 1129 for( i = 0; i < mDaysPerWeek; i++ ) {
1115 QLabel *label = new QLabel( mMonthView ); 1130 QLabel *label = new QLabel( mMonthView );
1116 label->setFont(bfont); 1131 label->setFont(bfont);
1117 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1132 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1118 label->setLineWidth(1); 1133 label->setLineWidth(1);
1119 label->setAlignment(AlignCenter); 1134 label->setAlignment(AlignCenter);
1120 mDayLabels.insert( i, label ); 1135 mDayLabels.insert( i, label );
1121 label = new QLabel( mWeekView ); 1136 label = new QLabel( mWeekView );
1122 label->setFont(bfont); 1137 label->setFont(bfont);
1123 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1138 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1124 label->setLineWidth(1); 1139 label->setLineWidth(1);
1125 label->setAlignment(AlignCenter); 1140 label->setAlignment(AlignCenter);
1126 mDayLabelsW.insert( i, label ); 1141 mDayLabelsW.insert( i, label );
1127 } 1142 }
1128 1143
1129 bfont.setBold( false ); 1144 bfont.setBold( false );
1130 mWeekLabels.resize( mNumWeeks+1 ); 1145 mWeekLabels.resize( mNumWeeks+1 );
1131 mWeekLabelsW.resize( 2 ); 1146 mWeekLabelsW.resize( 2 );
1132 for( i = 0; i < mNumWeeks+1; i++ ) { 1147 for( i = 0; i < mNumWeeks+1; i++ ) {
1133 KOWeekButton *label = new KOWeekButton( mMonthView ); 1148 KOWeekButton *label = new KOWeekButton( mMonthView );
1134 label->setFocusPolicy(NoFocus); 1149 label->setFocusPolicy(NoFocus);
1135 label->setFont(bfont); 1150 label->setFont(bfont);
1136 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1151 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1137 label->setFlat(true); 1152 label->setFlat(true);
1138 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1153 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1139 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1154 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1140 //label->setLineWidth(1); 1155 //label->setLineWidth(1);
1141 //label->setAlignment(AlignCenter); 1156 //label->setAlignment(AlignCenter);
1142 mWeekLabels.insert( i, label ); 1157 mWeekLabels.insert( i, label );
1143 } 1158 }
1144 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1159 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1145 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1160 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1146 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1161 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1147 1162
1148 for( i = 0; i < 1+1; i++ ) { 1163 for( i = 0; i < 1+1; i++ ) {
1149 KOWeekButton *label = new KOWeekButton( mWeekView ); 1164 KOWeekButton *label = new KOWeekButton( mWeekView );
1150 label->setFocusPolicy(NoFocus); 1165 label->setFocusPolicy(NoFocus);
1151 label->setFont(bfont); 1166 label->setFont(bfont);
1152 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1167 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1153 label->setFlat(true); 1168 label->setFlat(true);
1154 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1169 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1155 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1170 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1156 //label->setLineWidth(1); 1171 //label->setLineWidth(1);
1157 //label->setAlignment(AlignCenter); 1172 //label->setAlignment(AlignCenter);
1158 mWeekLabelsW.insert( i, label ); 1173 mWeekLabelsW.insert( i, label );
1159 } 1174 }
1160 mWeekLabelsW[1]->setText( i18n("W")); 1175 mWeekLabelsW[1]->setText( i18n("W"));
1161 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1176 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1162 1177
1163 1178
1164 int row, col; 1179 int row, col;
1165 mCells.resize( mNumCells ); 1180 mCells.resize( mNumCells );
1166 for( row = 0; row < mNumWeeks; ++row ) { 1181 for( row = 0; row < mNumWeeks; ++row ) {
1167 for( col = 0; col < mDaysPerWeek; ++col ) { 1182 for( col = 0; col < mDaysPerWeek; ++col ) {
1168 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1183 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1169 mCells.insert( row * mDaysPerWeek + col, cell ); 1184 mCells.insert( row * mDaysPerWeek + col, cell );
1170 1185
1171 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1186 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1172 SLOT( defaultAction( Incidence * ) ) ); 1187 SLOT( defaultAction( Incidence * ) ) );
1173 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1188 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1174 SIGNAL( newEventSignal( QDateTime ) ) ); 1189 SIGNAL( newEventSignal( QDateTime ) ) );
1175 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1190 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1176 SIGNAL( showDaySignal( QDate ) ) ); 1191 SIGNAL( showDaySignal( QDate ) ) );
1177 connect( cell, SIGNAL( nextCell() ), 1192 connect( cell, SIGNAL( nextCell() ),
1178 SLOT( nextCell() ) ); 1193 SLOT( nextCell() ) );
1179 connect( cell, SIGNAL( prevCell() ), 1194 connect( cell, SIGNAL( prevCell() ),
1180 SLOT( prevCell() ) ); 1195 SLOT( prevCell() ) );
1181 } 1196 }
1182 } 1197 }
1183 mCellsW.resize( mDaysPerWeek ); 1198 mCellsW.resize( mDaysPerWeek );
1184 for( col = 0; col < mDaysPerWeek; ++col ) { 1199 for( col = 0; col < mDaysPerWeek; ++col ) {
1185 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1200 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1186 mCellsW.insert( col, cell ); 1201 mCellsW.insert( col, cell );
1187 1202
1188 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1203 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1189 SLOT( defaultAction( Incidence * ) ) ); 1204 SLOT( defaultAction( Incidence * ) ) );
1190 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1205 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1191 SIGNAL( newEventSignal( QDateTime ) ) ); 1206 SIGNAL( newEventSignal( QDateTime ) ) );
1192 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1207 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1193 SIGNAL( showDaySignal( QDate ) ) ); 1208 SIGNAL( showDaySignal( QDate ) ) );
1194 connect( cell, SIGNAL( nextCell() ), 1209 connect( cell, SIGNAL( nextCell() ),
1195 SLOT( nextCell() ) ); 1210 SLOT( nextCell() ) );
1196 connect( cell, SIGNAL( prevCell() ), 1211 connect( cell, SIGNAL( prevCell() ),
1197 SLOT( prevCell() ) ); 1212 SLOT( prevCell() ) );
1198 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1213 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1199 } 1214 }
1200 1215
1201 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1216 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1202 mContextMenu = eventPopup(); 1217 mContextMenu = eventPopup();
1218 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1219 i18n("New Event..."),this,
1220 SLOT(slotNewEvent()),false);
1221 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1222 i18n("New Todo..."),this,
1223 SLOT(slotNewTodo()),false);
1224 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1225 i18n("Journal"),this,
1226 SLOT(slotEditJournal()),false);
1227
1228
1229
1230 QString pathString = "";
1231 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1232 if ( QApplication::desktop()->width() < 480 )
1233 pathString += "icons16/";
1234 } else
1235 pathString += "iconsmini/";
1236 mNewItemMenu = new QPopupMenu( this );
1237 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1238 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1239 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1240
1203 // updateConfig(); //useless here... 1241 // updateConfig(); //useless here...
1204 // ... but we need mWidthLongDayLabel computed 1242 // ... but we need mWidthLongDayLabel computed
1205 QFontMetrics fontmetric(mDayLabels[0]->font()); 1243 QFontMetrics fontmetric(mDayLabels[0]->font());
1206 mWidthLongDayLabel = 0; 1244 mWidthLongDayLabel = 0;
1207 for (int i = 0; i < 7; i++) { 1245 for (int i = 0; i < 7; i++) {
1208 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1246 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1209 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1247 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1210 } 1248 }
1211 1249
1212 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1250 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1213 1251
1214#if 0 1252#if 0
1215 if ( mShowWeekView ) 1253 if ( mShowWeekView )
1216 mWidStack->raiseWidget( mWeekView ); 1254 mWidStack->raiseWidget( mWeekView );
1217 else 1255 else
1218 mWidStack->raiseWidget( mMonthView ); 1256 mWidStack->raiseWidget( mMonthView );
1219#endif 1257#endif
1220 1258
1221 emit incidenceSelected( 0 ); 1259 emit incidenceSelected( 0 );
1222 1260
1223 mComputeLayoutTimer = new QTimer( this ); 1261 mComputeLayoutTimer = new QTimer( this );
1224 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1262 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1225 1263
1226 1264
1227#ifndef DESKTOP_VERSION 1265#ifndef DESKTOP_VERSION
1228 resize( QApplication::desktop()->size() ); 1266 resize( QApplication::desktop()->size() );
1229#else 1267#else
1230 resize(640, 480 ); 1268 resize(640, 480 );
1231 updatePossible = true; 1269 updatePossible = true;
1232#endif 1270#endif
1233 computeLayout(); 1271 computeLayout();
1234 1272
1235 if ( mShowWeekView ) 1273 if ( mShowWeekView )
1236 mWidStack->raiseWidget( mWeekView ); 1274 mWidStack->raiseWidget( mWeekView );
1237 else 1275 else
1238 mWidStack->raiseWidget( mMonthView ); 1276 mWidStack->raiseWidget( mMonthView );
1239} 1277}
1240 1278
1241KOMonthView::~KOMonthView() 1279KOMonthView::~KOMonthView()
1242{ 1280{
1243 delete mContextMenu; 1281 delete mContextMenu;
1244} 1282}
1245 1283
1246void KOMonthView::selectInternalWeekNum ( int n ) 1284void KOMonthView::selectInternalWeekNum ( int n )
1247{ 1285{
1248 switchView(); 1286 switchView();
1249 if ( !KOPrefs::instance()->mMonthViewWeek ) 1287 if ( !KOPrefs::instance()->mMonthViewWeek )
1250 emit selectMonth (); 1288 emit selectMonth ();
1251 else 1289 else
1252 emit selectWeekNum ( n ); 1290 emit selectWeekNum ( n );
1253} 1291}
1254 1292
1255int KOMonthView::currentWeek() 1293int KOMonthView::currentWeek()
1256{ 1294{
1257 if ( mShowWeekView ) 1295 if ( mShowWeekView )
1258 return mWeekLabelsW[0]->getWeekNum(); 1296 return mWeekLabelsW[0]->getWeekNum();
1259 return mWeekLabels[0]->getWeekNum(); 1297 return mWeekLabels[0]->getWeekNum();
1260} 1298}
1261void KOMonthView::switchView() 1299void KOMonthView::switchView()
1262{ 1300{
1263 if ( selectedCell( ) ) 1301 if ( selectedCell( ) )
1264 selectedCell()->deselect(); 1302 selectedCell()->deselect();
1265 mShowWeekView = !mShowWeekView; 1303 mShowWeekView = !mShowWeekView;
1266 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1304 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1267 if ( clPending ) { 1305 if ( clPending ) {
1268 computeLayout(); 1306 computeLayout();
1269 updateConfig(); 1307 updateConfig();
1270 } 1308 }
1271 if ( mShowWeekView ) 1309 if ( mShowWeekView )
1272 mWidStack->raiseWidget( mWeekView ); 1310 mWidStack->raiseWidget( mWeekView );
1273 else 1311 else
1274 mWidStack->raiseWidget( mMonthView ); 1312 mWidStack->raiseWidget( mMonthView );
1275 clPending = false; 1313 clPending = false;
1276} 1314}
1277 1315
1278int KOMonthView::maxDatesHint() 1316int KOMonthView::maxDatesHint()
1279{ 1317{
1280 return mNumCells; 1318 return mNumCells;
1281} 1319}
1282 1320
1283int KOMonthView::currentDateCount() 1321int KOMonthView::currentDateCount()
1284{ 1322{
1285 return mNumCells; 1323 return mNumCells;
1286} 1324}
1287 1325
1288QPtrList<Incidence> KOMonthView::selectedIncidences() 1326QPtrList<Incidence> KOMonthView::selectedIncidences()
1289{ 1327{
1290 QPtrList<Incidence> selected; 1328 QPtrList<Incidence> selected;
1291 1329
1292 if ( mSelectedCell ) { 1330 if ( mSelectedCell ) {
1293 Incidence *incidence = mSelectedCell->selectedIncidence(); 1331 Incidence *incidence = mSelectedCell->selectedIncidence();
1294 if ( incidence ) selected.append( incidence ); 1332 if ( incidence ) selected.append( incidence );
1295 } 1333 }
1296 1334
1297 return selected; 1335 return selected;
1298} 1336}
1299 1337
1300DateList KOMonthView::selectedDates() 1338DateList KOMonthView::selectedDates()
1301{ 1339{
1302 DateList selected; 1340 DateList selected;
1303 1341
1304 if ( mSelectedCell ) { 1342 if ( mSelectedCell ) {
1305 QDate qd = mSelectedCell->selectedIncidenceDate(); 1343 QDate qd = mSelectedCell->selectedIncidenceDate();
1306 if ( qd.isValid() ) selected.append( qd ); 1344 if ( qd.isValid() ) selected.append( qd );
1307 } 1345 }
1308 1346
1309 return selected; 1347 return selected;
1310} 1348}
1311 1349
1312void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1350void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1313 const QDate &td) 1351 const QDate &td)
1314{ 1352{
1315#ifndef KORG_NOPRINTER 1353#ifndef KORG_NOPRINTER
1316 calPrinter->preview(CalPrinter::Month, fd, td); 1354 calPrinter->preview(CalPrinter::Month, fd, td);
1317#endif 1355#endif
1318} 1356}
1319 1357
1320void KOMonthView::updateConfig() 1358void KOMonthView::updateConfig()
1321{ 1359{
1322 1360
1323 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1361 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1324 1362
1325 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1363 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1326 mWeekStartsMonday = true; 1364 mWeekStartsMonday = true;
1327 } 1365 }
1328 QFontMetrics fontmetric(mDayLabels[0]->font()); 1366 QFontMetrics fontmetric(mDayLabels[0]->font());
1329 mWidthLongDayLabel = 0; 1367 mWidthLongDayLabel = 0;
1330 1368
1331 for (int i = 0; i < 7; i++) { 1369 for (int i = 0; i < 7; i++) {
1332 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1370 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1333 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1371 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1334 } 1372 }
1335 bool temp = mShowSatSunComp ; 1373 bool temp = mShowSatSunComp ;
1336 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1374 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1337 if ( ! mShowWeekView ) { 1375 if ( ! mShowWeekView ) {
1338 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1376 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1339 computeLayout(); 1377 computeLayout();
1340 } 1378 }
1341 updateDayLabels(); 1379 updateDayLabels();
1342 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1380 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1343 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1381 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1344 //resizeEvent( 0 ); 1382 //resizeEvent( 0 );
1345 for (uint i = 0; i < mCells.count(); ++i) { 1383 for (uint i = 0; i < mCells.count(); ++i) {
1346 mCells[i]->updateConfig(); 1384 mCells[i]->updateConfig();
1347 } 1385 }
1348 1386
1349 for (uint i = 0; i < mCellsW.count(); ++i) { 1387 for (uint i = 0; i < mCellsW.count(); ++i) {
1350 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1388 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1351 } 1389 }
1352#ifdef DESKTOP_VERSION 1390#ifdef DESKTOP_VERSION
1353 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1391 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1354#endif 1392#endif
1355 updateView(); 1393 updateView();
1356} 1394}
1357 1395
1358void KOMonthView::updateDayLabels() 1396void KOMonthView::updateDayLabels()
1359{ 1397{
1360 1398
1361 QPtrVector<QLabel> *mDayLabelsT; 1399 QPtrVector<QLabel> *mDayLabelsT;
1362 1400
1363 mDayLabelsT = &mDayLabelsW; 1401 mDayLabelsT = &mDayLabelsW;
1364 for (int i = 0; i < 7; i++) { 1402 for (int i = 0; i < 7; i++) {
1365 { 1403 {
1366 bool show = mShortDayLabelsW; 1404 bool show = mShortDayLabelsW;
1367 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1405 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1368 show = true; 1406 show = true;
1369 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1407 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1370 } 1408 }
1371 } 1409 }
1372 mDayLabelsT = &mDayLabels; 1410 mDayLabelsT = &mDayLabels;
1373 for (int i = 0; i < 7; i++) { 1411 for (int i = 0; i < 7; i++) {
1374 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { 1412 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1375 bool show = mShortDayLabelsM; 1413 bool show = mShortDayLabelsM;
1376 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1414 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1377 show = true; 1415 show = true;
1378 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1416 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1379 } else { 1417 } else {
1380 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1418 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1381 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1419 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1382 1420
1383 } 1421 }
1384 } 1422 }
1385 1423
1386} 1424}
1387 1425
1388void KOMonthView::showDates(const QDate &start, const QDate &) 1426void KOMonthView::showDates(const QDate &start, const QDate &)
1389{ 1427{
1390 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1428 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1391 1429
1392 QPtrVector<MonthViewCell> *cells; 1430 QPtrVector<MonthViewCell> *cells;
1393 QPtrVector<QLabel> *dayLabels; 1431 QPtrVector<QLabel> *dayLabels;
1394 QPtrVector<KOWeekButton> *weekLabels; 1432 QPtrVector<KOWeekButton> *weekLabels;
1395 int weekNum = 6; 1433 int weekNum = 6;
1396 mStartDate = start; 1434 mStartDate = start;
1397 if ( mShowWeekView ) { 1435 if ( mShowWeekView ) {
1398 weekNum = 1; 1436 weekNum = 1;
1399 cells = &mCellsW; 1437 cells = &mCellsW;
1400 dayLabels = &mDayLabelsW; 1438 dayLabels = &mDayLabelsW;
1401 weekLabels = &mWeekLabelsW; 1439 weekLabels = &mWeekLabelsW;
1402 if ( !KGlobal::locale()->weekStartsMonday() ) { 1440 if ( !KGlobal::locale()->weekStartsMonday() ) {
1403 mStartDate = mStartDate.addDays( 1 ); 1441 mStartDate = mStartDate.addDays( 1 );
1404 } 1442 }
1405 } else { 1443 } else {
1406 cells = &mCells; 1444 cells = &mCells;
1407 dayLabels = &mDayLabels; 1445 dayLabels = &mDayLabels;
1408 weekLabels = &mWeekLabels; 1446 weekLabels = &mWeekLabels;
1409 } 1447 }
1410 1448
1411 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1449 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1412 1450
1413 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1451 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1414 mWeekStartsMonday = true; 1452 mWeekStartsMonday = true;
1415 } 1453 }
1416 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1454 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1417 1455
1418 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1456 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1419 mStartDate = mStartDate.addDays( -1 ); 1457 mStartDate = mStartDate.addDays( -1 );
1420 } 1458 }
1421 bool primary = false; 1459 bool primary = false;
1422 uint i; 1460 uint i;
1423 for( i = 0; i < (*cells).size(); ++i ) { 1461 for( i = 0; i < (*cells).size(); ++i ) {
1424 QDate date = mStartDate.addDays( i ); 1462 QDate date = mStartDate.addDays( i );
1425 (*cells)[i]->setDate( date ); 1463 (*cells)[i]->setDate( date );
1426 1464
1427#ifndef KORG_NOPLUGINS 1465#ifndef KORG_NOPLUGINS
1428 // add holiday, if present 1466 // add holiday, if present
1429 QString hstring(KOCore::self()->holiday(date)); 1467 QString hstring(KOCore::self()->holiday(date));
1430 (*cells)[i]->setHoliday( hstring ); 1468 (*cells)[i]->setHoliday( hstring );
1431#endif 1469#endif
1432 1470
1433 } 1471 }
1434 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1472 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1435 for( i = 0; i < weekNum; ++i ) { 1473 for( i = 0; i < weekNum; ++i ) {
1436 int wno; 1474 int wno;
1437 // remember, according to ISO 8601, the first week of the year is the 1475 // remember, according to ISO 8601, the first week of the year is the
1438 // first week that contains a thursday. Thus we must subtract off 4, 1476 // first week that contains a thursday. Thus we must subtract off 4,
1439 // not just 1. 1477 // not just 1.
1440 int dayOfYear = date.dayOfYear(); 1478 int dayOfYear = date.dayOfYear();
1441 if (dayOfYear % 7 != 0) 1479 if (dayOfYear % 7 != 0)
1442 wno = dayOfYear / 7 + 1; 1480 wno = dayOfYear / 7 + 1;
1443 else 1481 else
1444 wno =dayOfYear / 7; 1482 wno =dayOfYear / 7;
1445 (*weekLabels)[i]->setWeekNum( wno ); 1483 (*weekLabels)[i]->setWeekNum( wno );
1446 date = date.addDays( 7 ); 1484 date = date.addDays( 7 );
1447 } 1485 }
1448 updateView(); 1486 updateView();
1449} 1487}
1450 1488
1451void KOMonthView::showEvents(QPtrList<Event>) 1489void KOMonthView::showEvents(QPtrList<Event>)
1452{ 1490{
1453 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1491 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1454} 1492}
1455 1493
1456void KOMonthView::changeEventDisplay(Event *, int) 1494void KOMonthView::changeEventDisplay(Event *, int)
1457{ 1495{
1458 // this should be re-written to be much more efficient, but this 1496 // this should be re-written to be much more efficient, but this
1459 // quick-and-dirty-hack gets the job done for right now. 1497 // quick-and-dirty-hack gets the job done for right now.
1460 //qDebug("KOMonthView::changeEventDisplay "); 1498 //qDebug("KOMonthView::changeEventDisplay ");
1461 updateView(); 1499 updateView();
1462} 1500}
1463 1501
1464void KOMonthView::updateView() 1502void KOMonthView::updateView()
1465{ 1503{
1466 1504
1467 if ( !updatePossible ) 1505 if ( !updatePossible )
1468 return; 1506 return;
1469 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1507 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1470 //QTime ti; 1508 //QTime ti;
1471 //ti.start(); 1509 //ti.start();
1472 clearSelection(); 1510 clearSelection();
1473 QPtrVector<MonthViewCell> *cells; 1511 QPtrVector<MonthViewCell> *cells;
1474 if ( mShowWeekView ) { 1512 if ( mShowWeekView ) {
1475 cells = &mCellsW; 1513 cells = &mCellsW;
1476 } else { 1514 } else {
1477 cells = &mCells; 1515 cells = &mCells;
1478 } 1516 }
1479#if 1 1517#if 1
1480 int i; 1518 int i;
1481 int timeSpan = (*cells).size()-1; 1519 int timeSpan = (*cells).size()-1;
1482 if ( KOPrefs::instance()->mMonthViewWeek ) 1520 if ( KOPrefs::instance()->mMonthViewWeek )
1483 timeSpan = 6; 1521 timeSpan = 6;
1484 for( i = 0; i < timeSpan + 1; ++i ) { 1522 for( i = 0; i < timeSpan + 1; ++i ) {
1485 (*cells)[i]->startUpdateCell(); 1523 (*cells)[i]->startUpdateCell();
1486 } 1524 }
1487 1525
1488 QPtrList<Event> events = calendar()->events(); 1526 QPtrList<Event> events = calendar()->events();
1489 Event *event; 1527 Event *event;
1490 QDateTime dt; 1528 QDateTime dt;
1491 bool ok; 1529 bool ok;
1492 QDate endDate = mStartDate.addDays( timeSpan ); 1530 QDate endDate = mStartDate.addDays( timeSpan );
1493 for( event = events.first(); event; event = events.next() ) { // for event 1531 for( event = events.first(); event; event = events.next() ) { // for event
1494 if ( event->doesRecur() ) { 1532 if ( event->doesRecur() ) {
1495 bool last; 1533 bool last;
1496 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1534 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1497 QDateTime incidenceEnd; 1535 QDateTime incidenceEnd;
1498 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1536 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1499 bool invalid = false; 1537 bool invalid = false;
1500 while( true ) { 1538 while( true ) {
1501 if ( incidenceStart.isValid() ) { 1539 if ( incidenceStart.isValid() ) {
1502 incidenceEnd = incidenceStart.addDays( eventlen ); 1540 incidenceEnd = incidenceStart.addDays( eventlen );
1503 int st = incidenceStart.date().daysTo( endDate ); 1541 int st = incidenceStart.date().daysTo( endDate );
1504 if ( st >= 0 ) { // start before timeend 1542 if ( st >= 0 ) { // start before timeend
1505 int end = mStartDate.daysTo( incidenceEnd.date() ); 1543 int end = mStartDate.daysTo( incidenceEnd.date() );
1506 if ( end >= 0 ) { // end after timestart --- got one! 1544 if ( end >= 0 ) { // end after timestart --- got one!
1507 //normalize 1545 //normalize
1508 st = timeSpan - st; 1546 st = timeSpan - st;
1509 if ( st < 0 ) st = 0; 1547 if ( st < 0 ) st = 0;
1510 if ( end > timeSpan ) end = timeSpan; 1548 if ( end > timeSpan ) end = timeSpan;
1511 int iii; 1549 int iii;
1512 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1550 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1513 for ( iii = st;iii<= end;++iii) 1551 for ( iii = st;iii<= end;++iii)
1514 (*cells)[iii]->insertEvent( event ); 1552 (*cells)[iii]->insertEvent( event );
1515 } 1553 }
1516 } 1554 }
1517 } else { 1555 } else {
1518 if ( invalid ) 1556 if ( invalid )
1519 break; 1557 break;
1520 invalid = true; 1558 invalid = true;
1521 //qDebug("invalid %s", event->summary().latin1()); 1559 //qDebug("invalid %s", event->summary().latin1());
1522 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1560 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1523 } 1561 }
1524 if ( last ) 1562 if ( last )
1525 break; 1563 break;
1526 bool ok; 1564 bool ok;
1527 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1565 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1528 if ( ! ok ) 1566 if ( ! ok )
1529 break; 1567 break;
1530 if ( incidenceStart.date() > endDate ) 1568 if ( incidenceStart.date() > endDate )
1531 break; 1569 break;
1532 } 1570 }
1533 } else { // no recur 1571 } else { // no recur
1534 int st = event->dtStart().date().daysTo( endDate ); 1572 int st = event->dtStart().date().daysTo( endDate );
1535 if ( st >= 0 ) { // start before timeend 1573 if ( st >= 0 ) { // start before timeend
1536 int end = mStartDate.daysTo( event->dtEnd().date() ); 1574 int end = mStartDate.daysTo( event->dtEnd().date() );
1537 if ( end >= 0 ) { // end after timestart --- got one! 1575 if ( end >= 0 ) { // end after timestart --- got one!
1538 //normalize 1576 //normalize
1539 st = timeSpan - st; 1577 st = timeSpan - st;
1540 if ( st < 0 ) st = 0; 1578 if ( st < 0 ) st = 0;
1541 if ( end > timeSpan ) end = timeSpan; 1579 if ( end > timeSpan ) end = timeSpan;
1542 int iii; 1580 int iii;
1543 for ( iii = st;iii<= end;++iii) 1581 for ( iii = st;iii<= end;++iii)
1544 (*cells)[iii]->insertEvent( event ); 1582 (*cells)[iii]->insertEvent( event );
1545 } 1583 }
1546 } 1584 }
1547 } 1585 }
1548 } 1586 }
1549 // insert due todos 1587 // insert due todos
1550 QPtrList<Todo> todos = calendar()->todos( ); 1588 QPtrList<Todo> todos = calendar()->todos( );
1551 Todo *todo; 1589 Todo *todo;
1552 for(todo = todos.first(); todo; todo = todos.next()) { 1590 for(todo = todos.first(); todo; todo = todos.next()) {
1553 //insertTodo( todo ); 1591 //insertTodo( todo );
1554 if ( todo->hasDueDate() ) { 1592 if ( todo->hasDueDate() ) {
1555 int day = mStartDate.daysTo( todo->dtDue().date() ); 1593 int day = mStartDate.daysTo( todo->dtDue().date() );
1556 if ( day >= 0 && day < timeSpan + 1) { 1594 if ( day >= 0 && day < timeSpan + 1) {
1557 (*cells)[day]->insertTodo( todo ); 1595 (*cells)[day]->insertTodo( todo );
1558 } 1596 }
1559 } 1597 }
1560 } 1598 }
1561 1599
1562 for( i = 0; i < timeSpan+1; ++i ) { 1600 for( i = 0; i < timeSpan+1; ++i ) {
1563 (*cells)[i]->finishUpdateCell(); 1601 (*cells)[i]->finishUpdateCell();
1564 } 1602 }
1565 processSelectionChange(); 1603 processSelectionChange();
1566 //qApp->processEvents(); 1604 //qApp->processEvents();
1567 for( i = 0; i < timeSpan+1; ++i ) { 1605 for( i = 0; i < timeSpan+1; ++i ) {
1568 (*cells)[i]->repaintfinishUpdateCell(); 1606 (*cells)[i]->repaintfinishUpdateCell();
1569 } 1607 }
1570 setKeyBFocus(); 1608 setKeyBFocus();
1571#else 1609#else
1572 // old code 1610 // old code
1573 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1611 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1574 int i; 1612 int i;
1575 for( i = 0; i < (*cells).count(); ++i ) { 1613 for( i = 0; i < (*cells).count(); ++i ) {
1576 (*cells)[i]->updateCell(); 1614 (*cells)[i]->updateCell();
1577 } 1615 }
1578 1616
1579 //qDebug("KOMonthView::updateView() "); 1617 //qDebug("KOMonthView::updateView() ");
1580 processSelectionChange(); 1618 processSelectionChange();
1581 // qDebug("---------------------------------------------------------------------+ "); 1619 // qDebug("---------------------------------------------------------------------+ ");
1582 (*cells)[0]->setFocus(); 1620 (*cells)[0]->setFocus();
1583#endif 1621#endif
1584 1622
1585 //qDebug("update time %d ", ti.elapsed()); 1623 //qDebug("update time %d ", ti.elapsed());
1586} 1624}
1587 1625
1588void KOMonthView::setKeyBoardFocus() 1626void KOMonthView::setKeyBoardFocus()
1589{ 1627{
1590 //qDebug("KOMonthView::setKeyBoardFocus() "); 1628 //qDebug("KOMonthView::setKeyBoardFocus() ");
1591 bool shootAgain = false; 1629 bool shootAgain = false;
1592 if ( mShowWeekView ) { 1630 if ( mShowWeekView ) {
1593 shootAgain = !mWeekLabelsW[1]->hasFocus(); 1631 shootAgain = !mWeekLabelsW[1]->hasFocus();
1594 mWeekLabelsW[1]->setFocus(); 1632 mWeekLabelsW[1]->setFocus();
1595 } 1633 }
1596 else { 1634 else {
1597 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); 1635 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
1598 mWeekLabels[mNumWeeks]->setFocus(); 1636 mWeekLabels[mNumWeeks]->setFocus();
1599 } 1637 }
1600 if ( shootAgain ) { 1638 if ( shootAgain ) {
1601 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); 1639 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
1602 } 1640 }
1603} 1641}
1604void KOMonthView::setKeyBFocus() 1642void KOMonthView::setKeyBFocus()
1605{ 1643{
1606 //qDebug("KOMonthView::setKeyBFocus() "); 1644 //qDebug("KOMonthView::setKeyBFocus() ");
1607 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); 1645 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1608} 1646}
1609void KOMonthView::resizeEvent(QResizeEvent * e) 1647void KOMonthView::resizeEvent(QResizeEvent * e)
1610{ 1648{
1611 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1649 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1612 if ( isVisible() ) { 1650 if ( isVisible() ) {
1613 //qDebug("KOMonthView::isVisible "); 1651 //qDebug("KOMonthView::isVisible ");
1614 slotComputeLayout(); 1652 slotComputeLayout();
1615 } else 1653 } else
1616 mComputeLayoutTimer->start( 100 ); 1654 mComputeLayoutTimer->start( 100 );
1617} 1655}
1618 1656
1619void KOMonthView::slotComputeLayout() 1657void KOMonthView::slotComputeLayout()
1620{ 1658{
1621 mComputeLayoutTimer->stop(); 1659 mComputeLayoutTimer->stop();
1622 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1660 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1623 computeLayout(); 1661 computeLayout();
1624 clPending = true; 1662 clPending = true;
1625 setKeyBFocus(); 1663 setKeyBFocus();
1626} 1664}
1627void KOMonthView::computeLayoutWeek() 1665void KOMonthView::computeLayoutWeek()
1628{ 1666{
1629 static int lastWid = 0; 1667 static int lastWid = 0;
1630 static int lastHei = 0; 1668 static int lastHei = 0;
1631 int daysToShow; 1669 int daysToShow;
1632 bool combinedSatSun = false; 1670 bool combinedSatSun = false;
1633 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1671 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1634 daysToShow = 6; 1672 daysToShow = 6;
1635 combinedSatSun = true; 1673 combinedSatSun = true;
1636 } 1674 }
1637 int tWid = topLevelWidget()->size().width(); 1675 int tWid = topLevelWidget()->size().width();
1638 int tHei = topLevelWidget()->size().height(); 1676 int tHei = topLevelWidget()->size().height();
1639 1677
1640 int wid = width();//e 1678 int wid = width();//e
1641 int hei = height()-1-mNavigatorBar->height(); 1679 int hei = height()-1-mNavigatorBar->height();
1642 1680
1643 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1681 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1644 return; 1682 return;
1645 1683
1646 if ( lastWid == width() && lastHei == height() ) { 1684 if ( lastWid == width() && lastHei == height() ) {
1647 //qDebug("KOListWeekView::No compute layout needed "); 1685 //qDebug("KOListWeekView::No compute layout needed ");
1648 return; 1686 return;
1649 } 1687 }
1650 lastWid = width(); 1688 lastWid = width();
1651 lastHei = height(); 1689 lastHei = height();
1652 1690
1653 1691
1654 if ( wid < hei ) 1692 if ( wid < hei )
1655 daysToShow = 2; 1693 daysToShow = 2;
1656 else 1694 else
1657 daysToShow = 3; 1695 daysToShow = 3;
1658 mShowSatSunComp = true; 1696 mShowSatSunComp = true;
1659 combinedSatSun = true; 1697 combinedSatSun = true;
1660 1698
1661 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1699 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1662 QFontMetrics fm ( mWeekLabels[0]->font() ); 1700 QFontMetrics fm ( mWeekLabels[0]->font() );
1663 int weeklabelwid = fm.width( "888" ); 1701 int weeklabelwid = fm.width( "888" );
1664 wid -= weeklabelwid; 1702 wid -= weeklabelwid;
1665 1703
1666 int colWid = wid / daysToShow; 1704 int colWid = wid / daysToShow;
1667 int lastCol = wid - ( colWid*6 ); 1705 int lastCol = wid - ( colWid*6 );
1668 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1706 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1669 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1707 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1670 int colModulo = wid % daysToShow; 1708 int colModulo = wid % daysToShow;
1671 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1709 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1672 //qDebug("rowmod %d ", rowModulo); 1710 //qDebug("rowmod %d ", rowModulo);
1673 int i; 1711 int i;
1674 int x,y,w,h; 1712 int x,y,w,h;
1675 x= 0; 1713 x= 0;
1676 y= 0; 1714 y= 0;
1677 w = colWid; 1715 w = colWid;
1678 h = dayLabelHei ; 1716 h = dayLabelHei ;
1679 for ( i = 0; i < 7; i++) { 1717 for ( i = 0; i < 7; i++) {
1680 if ( i && !( i % daysToShow) && i < 6) { 1718 if ( i && !( i % daysToShow) && i < 6) {
1681 y += hei/(5-daysToShow); 1719 y += hei/(5-daysToShow);
1682 x = 0; 1720 x = 0;
1683 w = colWid; 1721 w = colWid;
1684 } 1722 }
1685 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1723 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1686 ++w; 1724 ++w;
1687 } 1725 }
1688 if ( i >= 5 ) { 1726 if ( i >= 5 ) {
1689 int wi = width() - x - weeklabelwid; 1727 int wi = width() - x - weeklabelwid;
1690 if ( i == 5 ) { 1728 if ( i == 5 ) {
1691 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); 1729 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h);
1692 } else { 1730 } else {
1693 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1731 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1694 } 1732 }
1695 x = x - w + wi - (wi/2 ); 1733 x = x - w + wi - (wi/2 );
1696 } 1734 }
1697 else { 1735 else {
1698 int wi = w; 1736 int wi = w;
1699 if ( !(( i+1) % daysToShow)) { 1737 if ( !(( i+1) % daysToShow)) {
1700 wi = width() - x - weeklabelwid; 1738 wi = width() - x - weeklabelwid;
1701 } 1739 }
1702 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1740 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1703 } 1741 }
1704 x += w; 1742 x += w;
1705 } 1743 }
1706 x= 0; 1744 x= 0;
1707 y= dayLabelHei; 1745 y= dayLabelHei;
1708 w = colWid; 1746 w = colWid;
1709 h = cellHei; 1747 h = cellHei;
1710 int max = 0; 1748 int max = 0;
1711 for ( i = 0; i < mCellsW.count(); ++i) { 1749 for ( i = 0; i < mCellsW.count(); ++i) {
1712 if ( i > 6 ) { 1750 if ( i > 6 ) {
1713 mCellsW[i]->hide(); 1751 mCellsW[i]->hide();
1714 continue; 1752 continue;
1715 } 1753 }
1716 1754
1717 w = colWid; 1755 w = colWid;
1718 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1756 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1719 ++w; 1757 ++w;
1720 } 1758 }
1721 if ( i == (daysToShow-1-rowModulo)*7) 1759 if ( i == (daysToShow-1-rowModulo)*7)
1722 ++h; 1760 ++h;
1723 1761
1724 if ( i >= 5 ) { 1762 if ( i >= 5 ) {
1725 if ( i ==5 ) { 1763 if ( i ==5 ) {
1726 max = h/2; 1764 max = h/2;
1727 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1765 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1728 x -= w ;y += h/2; 1766 x -= w ;y += h/2;
1729 } else { 1767 } else {
1730 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1768 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1731 ++w; 1769 ++w;
1732 } 1770 }
1733 max = h-h/2; 1771 max = h-h/2;
1734 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1772 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1735 y -= h/2; 1773 y -= h/2;
1736 } 1774 }
1737 } else { 1775 } else {
1738 max = h; 1776 max = h;
1739 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1777 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1740 } 1778 }
1741 1779
1742 1780
1743 x += w; 1781 x += w;
1744 if ( x + w/2 > wid ) { 1782 if ( x + w/2 > wid ) {
1745 x = 0; 1783 x = 0;
1746 y += h+dayLabelHei ; 1784 y += h+dayLabelHei ;
1747 } 1785 }
1748 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); 1786 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
1749 } 1787 }
1750 y= dayLabelHei; 1788 y= dayLabelHei;
1751 h = cellHei ; 1789 h = cellHei ;
1752 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1790 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1753 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1791 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1754 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1792 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1755 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1793 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1756 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; 1794 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
1757 updateDayLabels(); 1795 updateDayLabels();
1758 //bool forceUpdate = !updatePossible; 1796 //bool forceUpdate = !updatePossible;
1759 updatePossible = true; 1797 updatePossible = true;
1760 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1798 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1761 //if ( forceUpdate ) 1799 //if ( forceUpdate )
1762 // updateView(); 1800 // updateView();
1763} 1801}
1764void KOMonthView::computeLayout() 1802void KOMonthView::computeLayout()
1765{ 1803{
1766 1804
1767 1805
1768 static int lastWid = 0; 1806 static int lastWid = 0;
1769 static int lastHei = 0; 1807 static int lastHei = 0;
1770 1808
1771 if ( mShowWeekView ){ 1809 if ( mShowWeekView ){
1772 computeLayoutWeek(); 1810 computeLayoutWeek();
1773 return; 1811 return;
1774 } 1812 }
1775 int daysToShow = 7; 1813 int daysToShow = 7;
1776 bool combinedSatSun = false; 1814 bool combinedSatSun = false;
1777 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1815 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1778 daysToShow = 6; 1816 daysToShow = 6;
1779 combinedSatSun = true; 1817 combinedSatSun = true;
1780 } 1818 }
1781 int tWid = topLevelWidget()->size().width(); 1819 int tWid = topLevelWidget()->size().width();
1782 int tHei = topLevelWidget()->size().height(); 1820 int tHei = topLevelWidget()->size().height();
1783 1821
1784 int wid = width();//e 1822 int wid = width();//e
1785 int hei = height()-1-mNavigatorBar->height(); 1823 int hei = height()-1-mNavigatorBar->height();
1786 1824
1787 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1825 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1788 return; 1826 return;
1789 } 1827 }
1790 if ( lastWid == width() && lastHei == height() ){ 1828 if ( lastWid == width() && lastHei == height() ){
1791 //qDebug("KOMonthview::No compute layout needed "); 1829 //qDebug("KOMonthview::No compute layout needed ");
1792 return; 1830 return;
1793 } 1831 }
1794 1832
1795 lastWid = width(); 1833 lastWid = width();
1796 lastHei = height(); 1834 lastHei = height();
1797 //qDebug("KOMonthView::computeLayout() MMM ------------------- "); 1835 //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1798 QFontMetrics fm ( mWeekLabels[0]->font() ); 1836 QFontMetrics fm ( mWeekLabels[0]->font() );
1799 int weeklabelwid = fm.width( "888" ); 1837 int weeklabelwid = fm.width( "888" );
1800 wid -= weeklabelwid; 1838 wid -= weeklabelwid;
1801 1839
1802 int colWid = wid / daysToShow; 1840 int colWid = wid / daysToShow;
1803 int lastCol = wid - ( colWid*6 ); 1841 int lastCol = wid - ( colWid*6 );
1804 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1842 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1805 int cellHei = (hei - dayLabelHei) /6; 1843 int cellHei = (hei - dayLabelHei) /6;
1806 int colModulo = wid % daysToShow; 1844 int colModulo = wid % daysToShow;
1807 int rowModulo = (hei- dayLabelHei) % 6; 1845 int rowModulo = (hei- dayLabelHei) % 6;
1808 //qDebug("rowmod %d ", rowModulo); 1846 //qDebug("rowmod %d ", rowModulo);
1809 int i; 1847 int i;
1810 int x,y,w,h; 1848 int x,y,w,h;
1811 x= 0; 1849 x= 0;
1812 y= 0; 1850 y= 0;
1813 w = colWid; 1851 w = colWid;
1814 h = dayLabelHei ; 1852 h = dayLabelHei ;
1815 for ( i = 0; i < 7; i++) { 1853 for ( i = 0; i < 7; i++) {
1816 if ( i == daysToShow-colModulo ) 1854 if ( i == daysToShow-colModulo )
1817 ++w; 1855 ++w;
1818 if ( combinedSatSun ) { 1856 if ( combinedSatSun ) {
1819 if ( i >= daysToShow-1 ) { 1857 if ( i >= daysToShow-1 ) {
1820 1858
1821 if ( i == 6 ) 1859 if ( i == 6 )
1822 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); 1860 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h);
1823 else 1861 else
1824 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1862 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1825 x -= w/2 ; 1863 x -= w/2 ;
1826 } 1864 }
1827 else 1865 else
1828 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1866 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1829 } else 1867 } else
1830 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1868 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1831 x += w; 1869 x += w;
1832 } 1870 }
1833 x= 0; 1871 x= 0;
1834 y= dayLabelHei; 1872 y= dayLabelHei;
1835 w = colWid; 1873 w = colWid;
1836 h = cellHei ; 1874 h = cellHei ;
1837 int max = 0; 1875 int max = 0;
1838 for ( i = 0; i < mCells.count(); ++i) { 1876 for ( i = 0; i < mCells.count(); ++i) {
1839 //qDebug("iii %d ", i); 1877 //qDebug("iii %d ", i);
1840 w = colWid; 1878 w = colWid;
1841 if ( ((i) % 7) >= 7-colModulo ) { 1879 if ( ((i) % 7) >= 7-colModulo ) {
1842 ++w; 1880 ++w;
1843 } 1881 }
1844 if ( i == (6-rowModulo)*7) 1882 if ( i == (6-rowModulo)*7)
1845 ++h; 1883 ++h;
1846 if ( combinedSatSun ) { 1884 if ( combinedSatSun ) {
1847 if ( (i)%7 >= daysToShow-1 ) { 1885 if ( (i)%7 >= daysToShow-1 ) {
1848 if ( (i)%7 == daysToShow-1 ) { 1886 if ( (i)%7 == daysToShow-1 ) {
1849 w = width()-x-weeklabelwid; 1887 w = width()-x-weeklabelwid;
1850 max = h/2; 1888 max = h/2;
1851 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1889 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1852 x -= w ;y += h/2; 1890 x -= w ;y += h/2;
1853 } else { 1891 } else {
1854 w = width()-x-weeklabelwid; 1892 w = width()-x-weeklabelwid;
1855 max = h-h/2; 1893 max = h-h/2;
1856 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1894 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1857 y -= h/2; 1895 y -= h/2;
1858 } 1896 }
1859 } else { 1897 } else {
1860 max = h; 1898 max = h;
1861 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1899 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1862 } 1900 }
1863 1901
1864 } 1902 }
1865 else { 1903 else {
1866 max = h; 1904 max = h;
1867 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1905 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1868 } 1906 }
1869 x += w; 1907 x += w;
1870 if ( x + w/2 > wid ) { 1908 if ( x + w/2 > wid ) {
1871 x = 0; 1909 x = 0;
1872 y += h; 1910 y += h;
1873 } 1911 }
1874 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); 1912 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
1875 } 1913 }
1876 y= dayLabelHei; 1914 y= dayLabelHei;
1877 h = cellHei ; 1915 h = cellHei ;
1878 for ( i = 0; i < 6; i++) { 1916 for ( i = 0; i < 6; i++) {
1879 if ( i == (6-rowModulo)) 1917 if ( i == (6-rowModulo))
1880 ++h; 1918 ++h;
1881 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1919 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1882 y += h; 1920 y += h;
1883 } 1921 }
1884 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1922 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1885 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1923 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1886 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1924 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1887 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; 1925 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ;
1888 updateDayLabels(); 1926 updateDayLabels();
1889 //bool forceUpdate = !updatePossible; 1927 //bool forceUpdate = !updatePossible;
1890 updatePossible = true; 1928 updatePossible = true;
1891 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1929 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1892} 1930}
1893 1931
1894void KOMonthView::showContextMenu( Incidence *incidence ) 1932void KOMonthView::showContextMenu( Incidence *incidence )
1895{ 1933{
1896 mContextMenu->showIncidencePopup(incidence); 1934 if( incidence )
1935 mContextMenu->showIncidencePopup(incidence);
1936 else {
1937 //qDebug("KOMonthView::showContextMenu ");
1938 mNewItemMenu->popup(QCursor::pos());
1939 }
1897 /* 1940 /*
1898 if( incidence && incidence->type() == "Event" ) { 1941 if( incidence && incidence->type() == "Event" ) {
1899 Event *event = static_cast<Event *>(incidence); 1942 Event *event = static_cast<Event *>(incidence);
1900 mContextMenu->showEventPopup(event); 1943 mContextMenu->showEventPopup(event);
1901 } else { 1944 } else {
1902 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1945 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1903 } 1946 }
1904 */ 1947 */
1905} 1948}
1906MonthViewCell * KOMonthView::selectedCell( ) 1949MonthViewCell * KOMonthView::selectedCell( )
1907{ 1950{
1908 return mSelectedCell; 1951 return mSelectedCell;
1909} 1952}
1910void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1953void KOMonthView::setSelectedCell( MonthViewCell *cell )
1911{ 1954{
1912 //qDebug("KOMonthView::setSelectedCell "); 1955 //qDebug("KOMonthView::setSelectedCell %d", cell);
1913 if ( mSelectedCell && mSelectedCell != cell ) { 1956 if ( mSelectedCell && mSelectedCell != cell ) {
1914 MonthViewCell * mvc = mSelectedCell; 1957 MonthViewCell * mvc = mSelectedCell;
1915 mSelectedCell = cell; 1958 mSelectedCell = cell;
1916 mvc->deselect(); 1959 mvc->deselect();
1917 } else 1960 } else
1918 mSelectedCell = cell; 1961 mSelectedCell = cell;
1919 // if ( mSelectedCell ) 1962 // if ( mSelectedCell )
1920 // mSelectedCell->select(); 1963 // mSelectedCell->select();
1921 if ( !mSelectedCell ) 1964 if ( !mSelectedCell )
1922 emit incidenceSelected( 0 ); 1965 emit incidenceSelected( 0 );
1923 else 1966 else
1924 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1967 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1925} 1968}
1926 1969
1927void KOMonthView::processSelectionChange() 1970void KOMonthView::processSelectionChange()
1928{ 1971{
1929 QPtrList<Incidence> incidences = selectedIncidences(); 1972 QPtrList<Incidence> incidences = selectedIncidences();
1930 if (incidences.count() > 0) { 1973 if (incidences.count() > 0) {
1931 emit incidenceSelected( incidences.first() ); 1974 emit incidenceSelected( incidences.first() );
1932 } else { 1975 } else {
1933 emit incidenceSelected( 0 ); 1976 emit incidenceSelected( 0 );
1934 clearSelection(); 1977 clearSelection();
1935 } 1978 }
1936} 1979}
1937 1980
1938void KOMonthView::clearSelection() 1981void KOMonthView::clearSelection()
1939{ 1982{
1940 if ( mSelectedCell ) { 1983 if ( mSelectedCell ) {
1941 mSelectedCell->deselect(); 1984 mSelectedCell->deselect();
1942 mSelectedCell = 0; 1985 mSelectedCell = 0;
1943 } 1986 }
1944} 1987}
1945 1988
1946void KOMonthView::keyReleaseEvent ( QKeyEvent * e) 1989void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
1947{ 1990{
1948 if ( !e->isAutoRepeat() ) { 1991 if ( !e->isAutoRepeat() ) {
1949 mFlagKeyPressed = false; 1992 mFlagKeyPressed = false;
1950 } 1993 }
1951} 1994}
1952 1995
1953void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1996void KOMonthView::keyPressEvent ( QKeyEvent * e )
1954{ 1997{
1955 1998
1956 qApp->processEvents(); 1999 qApp->processEvents();
1957 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2000 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1958 //e->ignore(); 2001 //e->ignore();
1959 e->accept(); 2002 e->accept();
1960 return; 2003 return;
1961 } 2004 }
1962 if (! e->isAutoRepeat() ) 2005 if (! e->isAutoRepeat() )
1963 mFlagKeyPressed = true; 2006 mFlagKeyPressed = true;
1964 switch(e->key()) { 2007 switch(e->key()) {
1965 case Key_Up: 2008 case Key_Up:
1966 { 2009 {
1967 if ( mShowWeekView ) { 2010 if ( mShowWeekView ) {
1968 emit selectWeekNum ( currentWeek() - 1 ); 2011 emit selectWeekNum ( currentWeek() - 1 );
1969 } 2012 }
1970 else { 2013 else {
1971 emit prevMonth(); 2014 emit prevMonth();
1972 } 2015 }
1973 } 2016 }
1974 e->accept(); 2017 e->accept();
1975 break; 2018 break;
1976 case Key_Down: 2019 case Key_Down:
1977 { 2020 {
1978 if ( mShowWeekView ) { 2021 if ( mShowWeekView ) {
1979 emit selectWeekNum ( currentWeek() +1); 2022 emit selectWeekNum ( currentWeek() +1);
1980 } 2023 }
1981 else { 2024 else {
1982 emit nextMonth(); 2025 emit nextMonth();
1983 } 2026 }
1984 2027
1985 } 2028 }
1986 e->accept(); 2029 e->accept();
1987 break; 2030 break;
1988 case Key_Return: 2031 case Key_Return:
1989 case Key_Enter: 2032 case Key_Enter:
1990 { 2033 {
1991 selectInternalWeekNum ( currentWeek() ); 2034 selectInternalWeekNum ( currentWeek() );
1992 } 2035 }
1993 e->accept(); 2036 e->accept();
1994 break; 2037 break;
1995 case Key_D: 2038 case Key_D:
1996 if ( mSelectedCell ) { 2039 if ( mSelectedCell ) {
1997 mSelectedCell->showDay(); 2040 mSelectedCell->showDay();
1998 e->accept(); 2041 e->accept();
1999 } else { 2042 } else {
2000 e->ignore(); 2043 e->ignore();
2001 } 2044 }
2002 break; 2045 break;
2003 default: 2046 default:
2004 e->ignore(); 2047 e->ignore();
2005 break; 2048 break;
2006 } 2049 }
2007} 2050}
2008 2051
2009void KOMonthView::nextCell() 2052void KOMonthView::nextCell()
2010{ 2053{
2011 bool res = focusNextPrevChild ( true ); 2054 bool res = focusNextPrevChild ( true );
2012} 2055}
2013void KOMonthView::prevCell() 2056void KOMonthView::prevCell()
2014{ 2057{
2015 focusNextPrevChild ( false ); 2058 focusNextPrevChild ( false );
2016} 2059}
2060
2061void KOMonthView::slotNewTodo()
2062{
2063 //qDebug("KOMonthView::slotNewTodo() ");
2064 if ( mPopupCell ){
2065 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2066 emit newTodoSignal(dt,true);
2067 }
2068 mPopupCell = 0;
2069}
2070void KOMonthView::slotNewEvent()
2071{
2072 if ( mPopupCell ) {
2073 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2074 emit newEventSignal( dt );
2075 }
2076 //qDebug("KOMonthView::slotNewEvent() ");
2077 mPopupCell = 0;
2078}
2079
2080void KOMonthView::slotEditJournal()
2081{
2082 if ( mPopupCell )
2083 emit showJournalSignal( 7, mPopupCell->date() );
2084 //qDebug("KOMonthView::slotEditJournal() ");
2085 mPopupCell = 0;
2086}
2087
2088void KOMonthView::setPopupCell( MonthViewCell * c)
2089{
2090 mPopupCell = c;
2091}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index c6b6b5e..de5c014 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,332 +1,340 @@
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#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qintdict.h> 31#include <qintdict.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qvaluelist.h> 33#include <qvaluelist.h>
34#include <qptrvector.h> 34#include <qptrvector.h>
35 35
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37#include <libkcal/event.h> 37#include <libkcal/event.h>
38 38
39#include "koeventview.h" 39#include "koeventview.h"
40#include "navigatorbar.h" 40#include "navigatorbar.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43class QToolTipGroup; 43class QToolTipGroup;
44#endif 44#endif
45 45
46class KNOWhatsThis; 46class KNOWhatsThis;
47class KOWeekButton : public QPushButton 47class KOWeekButton : public QPushButton
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 51 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
52 QPushButton( parent, name) 52 QPushButton( parent, name)
53 { 53 {
54 connect( this, SIGNAL( clicked() ), 54 connect( this, SIGNAL( clicked() ),
55 SLOT( bottonClicked() )); 55 SLOT( bottonClicked() ));
56 mNumber = -1; 56 mNumber = -1;
57 } 57 }
58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
59 int getWeekNum() { return mNumber;} 59 int getWeekNum() { return mNumber;}
60 signals: 60 signals:
61 void selectWeekNum ( int ); 61 void selectWeekNum ( int );
62private: 62private:
63 void focusInEvent ( QFocusEvent * ){;} 63 void focusInEvent ( QFocusEvent * ){;}
64 int mNumber; 64 int mNumber;
65 void keyPressEvent ( QKeyEvent * e ) 65 void keyPressEvent ( QKeyEvent * e )
66 { 66 {
67 e->ignore(); 67 e->ignore();
68 } 68 }
69 69
70private slots : 70private slots :
71 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 71 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
72}; 72};
73 73
74class KNoScrollListBox: public QListBox 74class KNoScrollListBox: public QListBox
75{ 75{
76 Q_OBJECT 76 Q_OBJECT
77 public: 77 public:
78 KNoScrollListBox(QWidget *parent=0, const char *name=0); 78 KNoScrollListBox(QWidget *parent=0, const char *name=0);
79 ~KNoScrollListBox(); 79 ~KNoScrollListBox();
80 QString getWhatsThisText(QPoint p) ; 80 QString getWhatsThisText(QPoint p) ;
81 81
82 signals: 82 signals:
83 void shiftDown(); 83 void shiftDown();
84 void shiftUp(); 84 void shiftUp();
85 void rightClick(); 85 void rightClick();
86 void nextCell(); 86 void nextCell();
87 void prevCell(); 87 void prevCell();
88 88
89 protected slots: 89 protected slots:
90 void oneDown(); 90 void oneDown();
91 void keyPressEvent(QKeyEvent *); 91 void keyPressEvent(QKeyEvent *);
92 void keyReleaseEvent(QKeyEvent *); 92 void keyReleaseEvent(QKeyEvent *);
93 void mousePressEvent(QMouseEvent *); 93 void mousePressEvent(QMouseEvent *);
94 void focusInEvent ( QFocusEvent * ); 94 void focusInEvent ( QFocusEvent * );
95 void focusOutEvent ( QFocusEvent * ); 95 void focusOutEvent ( QFocusEvent * );
96 96
97 private: 97 private:
98 bool resetOnFocusIn; 98 bool resetOnFocusIn;
99 KNOWhatsThis * mWT; 99 KNOWhatsThis * mWT;
100}; 100};
101 101
102 102
103class MonthViewItem: public QListBoxItem 103class MonthViewItem: public QListBoxItem
104{ 104{
105 public: 105 public:
106 MonthViewItem( Incidence *, QDate qd, const QString & title ); 106 MonthViewItem( Incidence *, QDate qd, const QString & title );
107 void recycle( Incidence *incidence, QDate qd, const QString & s); 107 void recycle( Incidence *incidence, QDate qd, const QString & s);
108 void setRecur(bool on) { mRecur = on; } 108 void setRecur(bool on) { mRecur = on; }
109 void setAlarm(bool on) { mAlarm = on; } 109 void setAlarm(bool on) { mAlarm = on; }
110 void setReply(bool on) { mReply = on; } 110 void setReply(bool on) { mReply = on; }
111 void setMoreInfo(bool on) { mInfo = on; } 111 void setMoreInfo(bool on) { mInfo = on; }
112 void setMultiDay(int type) { mMultiday = type; } 112 void setMultiDay(int type) { mMultiday = type; }
113 void setMultiDayPos(int type) { mdayPos = type; } 113 void setMultiDayPos(int type) { mdayPos = type; }
114 int gettMultiDayPos() { return mdayPos; } 114 int gettMultiDayPos() { return mdayPos; }
115 void setBlockRepaint(bool on) { mblockRepaint = on; } 115 void setBlockRepaint(bool on) { mblockRepaint = on; }
116 116
117 117
118 void setPalette(const QPalette &p) { mPalette = p; } 118 void setPalette(const QPalette &p) { mPalette = p; }
119 QPalette palette() const { return mPalette; } 119 QPalette palette() const { return mPalette; }
120 120
121 Incidence *incidence() const { return mIncidence; } 121 Incidence *incidence() const { return mIncidence; }
122 QDate incidenceDate() { return mDate; } 122 QDate incidenceDate() { return mDate; }
123 123
124 protected: 124 protected:
125 virtual void paint(QPainter *); 125 virtual void paint(QPainter *);
126 virtual int height(const QListBox *) const; 126 virtual int height(const QListBox *) const;
127 virtual int width(const QListBox *) const; 127 virtual int width(const QListBox *) const;
128 128
129 private: 129 private:
130 int mdayPos; 130 int mdayPos;
131 bool isWeekItem; 131 bool isWeekItem;
132 bool mblockRepaint; 132 bool mblockRepaint;
133 int mMultiday; 133 int mMultiday;
134 bool mRecur; 134 bool mRecur;
135 bool mAlarm; 135 bool mAlarm;
136 bool mReply; 136 bool mReply;
137 bool mInfo; 137 bool mInfo;
138 138
139 QPalette mPalette; 139 QPalette mPalette;
140 QDate mDate; 140 QDate mDate;
141 141
142 Incidence *mIncidence; 142 Incidence *mIncidence;
143}; 143};
144 144
145 145
146class KOMonthView; 146class KOMonthView;
147 147
148class MonthViewCell : public KNoScrollListBox 148class MonthViewCell : public KNoScrollListBox
149{ 149{
150 Q_OBJECT 150 Q_OBJECT
151 public: 151 public:
152 MonthViewCell(KOMonthView *,QWidget* ); 152 MonthViewCell(KOMonthView *,QWidget* );
153 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} 153 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
154 154
155 void setDate( const QDate & ); 155 void setDate( const QDate & );
156 QDate date() const; 156 QDate date() const;
157 157
158 void setPrimary( bool ); 158 void setPrimary( bool );
159 bool isPrimary() const; 159 bool isPrimary() const;
160 160
161 void setHoliday( bool ); 161 void setHoliday( bool );
162 void setHoliday( const QString & ); 162 void setHoliday( const QString & );
163 163
164 void updateCell(); 164 void updateCell();
165 void startUpdateCell(); 165 void startUpdateCell();
166 void finishUpdateCell(); 166 void finishUpdateCell();
167 void repaintfinishUpdateCell(); 167 void repaintfinishUpdateCell();
168 int insertEvent(Event *); 168 int insertEvent(Event *);
169 void insertTodo(Todo *); 169 void insertTodo(Todo *);
170 170
171 void updateConfig( bool bigFont = false ); 171 void updateConfig( bool bigFont = false );
172 172
173 void enableScrollBars( bool ); 173 void enableScrollBars( bool );
174 174
175 Incidence *selectedIncidence(); 175 Incidence *selectedIncidence();
176 QDate selectedIncidenceDate(); 176 QDate selectedIncidenceDate();
177 QPushButton * dateLabel() { return mLabel; } 177 QPushButton * dateLabel() { return mLabel; }
178 178
179 void deselect(); 179 void deselect();
180 void select(); 180 void select();
181#ifdef DESKTOP_VERSION 181#ifdef DESKTOP_VERSION
182 static QToolTipGroup *toolTipGroup(); 182 static QToolTipGroup *toolTipGroup();
183#endif 183#endif
184 signals: 184 signals:
185 void defaultAction( Incidence * ); 185 void defaultAction( Incidence * );
186 void newEventSignal( QDateTime ); 186 void newEventSignal( QDateTime );
187 void showDaySignal( QDate ); 187 void showDaySignal( QDate );
188 188
189 protected: 189 protected:
190 QStringList mToolTip; 190 QStringList mToolTip;
191 void resizeEvent( QResizeEvent * ); 191 void resizeEvent( QResizeEvent * );
192 192
193public slots: 193public slots:
194 void showDay(); 194 void showDay();
195 195
196 protected slots: 196 protected slots:
197 void defaultAction( QListBoxItem * ); 197 void defaultAction( QListBoxItem * );
198 void contextMenu( QListBoxItem * ); 198 void contextMenu( QListBoxItem * );
199 void selection( QListBoxItem * ); 199 void selection( QListBoxItem * );
200 void cellClicked( QListBoxItem * ); 200 void cellClicked( QListBoxItem * );
201 void newEvent(); 201 void newEvent();
202 202
203 private: 203 private:
204 int mdayCount; 204 int mdayCount;
205 QPtrList <MonthViewItem> mAvailItemList; 205 QPtrList <MonthViewItem> mAvailItemList;
206 KOMonthView *mMonthView; 206 KOMonthView *mMonthView;
207 int currentPalette; 207 int currentPalette;
208 208
209 QDate mDate; 209 QDate mDate;
210 bool mPrimary; 210 bool mPrimary;
211 bool mHoliday; 211 bool mHoliday;
212 QString mHolidayString; 212 QString mHolidayString;
213 213
214 //QLabel *mLabel; 214 //QLabel *mLabel;
215 QPushButton *mLabel; 215 QPushButton *mLabel;
216 //QListBox *mItemList; 216 //QListBox *mItemList;
217#ifdef DESKTOP_VERSION 217#ifdef DESKTOP_VERSION
218 static QToolTipGroup *mToolTipGroup; 218 static QToolTipGroup *mToolTipGroup;
219#endif 219#endif
220 QSize mLabelSize; 220 QSize mLabelSize;
221 QSize mLabelBigSize; 221 QSize mLabelBigSize;
222 QPalette mHolidayPalette; 222 QPalette mHolidayPalette;
223 QPalette mStandardPalette; 223 QPalette mStandardPalette;
224 QPalette mPrimaryPalette; 224 QPalette mPrimaryPalette;
225 QPalette mNonPrimaryPalette; 225 QPalette mNonPrimaryPalette;
226 void setMyPalette(); 226 void setMyPalette();
227 QPalette getPalette (); 227 QPalette getPalette ();
228 228
229}; 229};
230 230
231 231
232class KOMonthView: public KOEventView 232class KOMonthView: public KOEventView
233{ 233{
234 Q_OBJECT 234 Q_OBJECT
235 public: 235 public:
236 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 236 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
237 ~KOMonthView(); 237 ~KOMonthView();
238 238
239 /** Returns maximum number of days supported by the komonthview */ 239 /** Returns maximum number of days supported by the komonthview */
240 virtual int maxDatesHint(); 240 virtual int maxDatesHint();
241 241
242 /** Returns number of currently shown dates. */ 242 /** Returns number of currently shown dates. */
243 virtual int currentDateCount(); 243 virtual int currentDateCount();
244 244
245 /** returns the currently selected events */ 245 /** returns the currently selected events */
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 247
248 /** returns dates of the currently selected events */ 248 /** returns dates of the currently selected events */
249 virtual DateList selectedDates(); 249 virtual DateList selectedDates();
250 250
251 virtual void printPreview(CalPrinter *calPrinter, 251 virtual void printPreview(CalPrinter *calPrinter,
252 const QDate &, const QDate &); 252 const QDate &, const QDate &);
253 bool isMonthView() { return !mShowWeekView; } 253 bool isMonthView() { return !mShowWeekView; }
254 bool isUpdatePossible() { return updatePossible; } 254 bool isUpdatePossible() { return updatePossible; }
255 255
256 MonthViewCell * selectedCell(); 256 MonthViewCell * selectedCell();
257 bool skipResize; 257 bool skipResize;
258 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 258 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
259 public slots: 259 public slots:
260 void nextCell(); 260 void nextCell();
261 void prevCell(); 261 void prevCell();
262 virtual void updateView(); 262 virtual void updateView();
263 virtual void updateConfig(); 263 virtual void updateConfig();
264 virtual void showDates(const QDate &start, const QDate &end); 264 virtual void showDates(const QDate &start, const QDate &end);
265 virtual void showEvents(QPtrList<Event> eventList); 265 virtual void showEvents(QPtrList<Event> eventList);
266 266
267 void changeEventDisplay(Event *, int); 267 void changeEventDisplay(Event *, int);
268 268
269 void clearSelection(); 269 void clearSelection();
270 270
271 void showContextMenu( Incidence * ); 271 void showContextMenu( Incidence * );
272 272
273 void setSelectedCell( MonthViewCell * ); 273 void setSelectedCell( MonthViewCell * );
274 void setPopupCell( MonthViewCell * );
274 void switchView(); 275 void switchView();
275 void setKeyBoardFocus(); 276 void setKeyBoardFocus();
276 void setKeyBFocus(); 277 void setKeyBFocus();
277 278
278 protected slots: 279 protected slots:
280 void slotNewTodo();
281 void slotNewEvent();
282 void slotEditJournal();
279 void slotComputeLayout(); 283 void slotComputeLayout();
280 void selectInternalWeekNum ( int ); 284 void selectInternalWeekNum ( int );
281 void processSelectionChange(); 285 void processSelectionChange();
282 signals: 286 signals:
283 void nextMonth(); 287 void nextMonth();
284 void prevMonth(); 288 void prevMonth();
285 void selectWeekNum ( int ); 289 void selectWeekNum ( int );
286 void selectMonth (); 290 void selectMonth ();
287 void showDaySignal( QDate ); 291 void showDaySignal( QDate );
292 void newTodoSignal( QDateTime, bool );
293 void showJournalSignal( int,QDate );
288 protected: 294 protected:
289 void resizeEvent(QResizeEvent *); 295 void resizeEvent(QResizeEvent *);
290 void viewChanged(); 296 void viewChanged();
291 void updateDayLabels(); 297 void updateDayLabels();
292 298
293 private: 299 private:
294 QTimer* mComputeLayoutTimer; 300 QTimer* mComputeLayoutTimer;
295 NavigatorBar* mNavigatorBar; 301 NavigatorBar* mNavigatorBar;
296 int currentWeek(); 302 int currentWeek();
297 bool clPending; 303 bool clPending;
298 QWidgetStack * mWidStack; 304 QWidgetStack * mWidStack;
299 QWidget* mMonthView; 305 QWidget* mMonthView;
300 QWidget* mWeekView; 306 QWidget* mWeekView;
301 bool mShowWeekView; 307 bool mShowWeekView;
302 bool updatePossible; 308 bool updatePossible;
303 int mDaysPerWeek; 309 int mDaysPerWeek;
304 int mNumWeeks; 310 int mNumWeeks;
305 int mNumCells; 311 int mNumCells;
306 //bool mWeekStartsMonday; 312 //bool mWeekStartsMonday;
307 bool mShowSatSunComp; 313 bool mShowSatSunComp;
308 void computeLayout(); 314 void computeLayout();
309 void computeLayoutWeek(); 315 void computeLayoutWeek();
310 316
311 QPtrVector<MonthViewCell> mCells; 317 QPtrVector<MonthViewCell> mCells;
312 QPtrVector<QLabel> mDayLabels; 318 QPtrVector<QLabel> mDayLabels;
313 QPtrVector<KOWeekButton> mWeekLabels; 319 QPtrVector<KOWeekButton> mWeekLabels;
314 QPtrVector<MonthViewCell> mCellsW; 320 QPtrVector<MonthViewCell> mCellsW;
315 QPtrVector<QLabel> mDayLabelsW; 321 QPtrVector<QLabel> mDayLabelsW;
316 QPtrVector<KOWeekButton> mWeekLabelsW; 322 QPtrVector<KOWeekButton> mWeekLabelsW;
317 323
318 bool mShortDayLabelsM; 324 bool mShortDayLabelsM;
319 bool mShortDayLabelsW; 325 bool mShortDayLabelsW;
320 int mWidthLongDayLabel; 326 int mWidthLongDayLabel;
321 327
322 QDate mStartDate; 328 QDate mStartDate;
323 329
324 MonthViewCell *mSelectedCell; 330 MonthViewCell *mSelectedCell;
331 MonthViewCell *mPopupCell;
325 bool mFlagKeyPressed; 332 bool mFlagKeyPressed;
326 KOEventPopupMenu *mContextMenu; 333 KOEventPopupMenu *mContextMenu;
334 QPopupMenu *mNewItemMenu;
327 void keyPressEvent ( QKeyEvent * ) ; 335 void keyPressEvent ( QKeyEvent * ) ;
328 void keyReleaseEvent ( QKeyEvent * ) ; 336 void keyReleaseEvent ( QKeyEvent * ) ;
329 337
330}; 338};
331 339
332#endif 340#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a571ed4..34044ab 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,509 +1,510 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 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 <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kglobalsettings.h> 39#include <kglobalsettings.h>
40#include <kconfig.h> 40#include <kconfig.h>
41#include <klocale.h> 41#include <klocale.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kemailsettings.h> 43#include <kemailsettings.h>
44#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
45#include <libkdepim/kpimglobalprefs.h> 45#include <libkdepim/kpimglobalprefs.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "mainwindow.h" 48#include "mainwindow.h"
49 49
50KOPrefs *KOPrefs::mInstance = 0; 50KOPrefs *KOPrefs::mInstance = 0;
51static KStaticDeleter<KOPrefs> insd; 51static KStaticDeleter<KOPrefs> insd;
52 52
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 QColor defaultTodoRunColor = QColor(99,194,30); 65 QColor defaultTodoRunColor = QColor(99,194,30);
66 KPrefs::setCurrentGroup("General"); 66 KPrefs::setCurrentGroup("General");
67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
70 addItemBool("ShowIconSearch",&mShowIconSearch,true); 70 addItemBool("ShowIconSearch",&mShowIconSearch,true);
71 addItemBool("ShowIconList",&mShowIconList,true); 71 addItemBool("ShowIconList",&mShowIconList,true);
72 addItemBool("ShowIconDay1",&mShowIconDay1,true); 72 addItemBool("ShowIconDay1",&mShowIconDay1,true);
73 addItemBool("ShowIconDay5",&mShowIconDay5,true); 73 addItemBool("ShowIconDay5",&mShowIconDay5,true);
74 addItemBool("ShowIconDay6",&mShowIconDay6,true); 74 addItemBool("ShowIconDay6",&mShowIconDay6,true);
75 addItemBool("ShowIconDay7",&mShowIconDay7,true); 75 addItemBool("ShowIconDay7",&mShowIconDay7,true);
76 addItemBool("ShowIconMonth",&mShowIconMonth,true); 76 addItemBool("ShowIconMonth",&mShowIconMonth,true);
77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
79 addItemBool("ShowIconBack",&mShowIconBack,true); 79 addItemBool("ShowIconBack",&mShowIconBack,true);
80 addItemBool("ShowIconToday",&mShowIconToday,true); 80 addItemBool("ShowIconToday",&mShowIconToday,true);
81 addItemBool("ShowIconForward",&mShowIconForward,true); 81 addItemBool("ShowIconForward",&mShowIconForward,true);
82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 82 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); 83 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true);
84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); 84 addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true);
85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 85 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
86 addItemBool("ShowIconNext",&mShowIconNext,true); 86 addItemBool("ShowIconNext",&mShowIconNext,true);
87 addItemBool("ShowIconJournal",&mShowIconJournal,true); 87 addItemBool("ShowIconJournal",&mShowIconJournal,true);
88 addItemBool("ShowIconStretch",&mShowIconStretch,true); 88 addItemBool("ShowIconStretch",&mShowIconStretch,true);
89 addItemBool("ShowIconFilter",&mShowIconFilter,false); 89 addItemBool("ShowIconFilter",&mShowIconFilter,false);
90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); 90 addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true);
91 91
92 bool addIcons = false; 92 bool addIcons = false;
93#ifdef DESKTOP_VERSION 93#ifdef DESKTOP_VERSION
94 addIcons = true; 94 addIcons = true;
95#endif 95#endif
96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); 96 addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons);
97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); 97 addItemBool("ShowIconAllday",&mShowIconAllday,addIcons);
98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); 98 addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons);
99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); 99 addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons);
100 100
101 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 101 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
102 102
103 addItemBool("AskForQuit",&mAskForQuit,false); 103 addItemBool("AskForQuit",&mAskForQuit,false);
104 104
105#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
106 addItemBool("ShowFullMenu",&mShowFullMenu,false); 106 addItemBool("ShowFullMenu",&mShowFullMenu,false);
107#else 107#else
108 addItemBool("ShowFullMenu",&mShowFullMenu,true); 108 addItemBool("ShowFullMenu",&mShowFullMenu,true);
109#endif 109#endif
110 addItemBool("ToolBarHor",&mToolBarHor, true ); 110 addItemBool("ToolBarHor",&mToolBarHor, true );
111 addItemBool("ToolBarUp",&mToolBarUp, false ); 111 addItemBool("ToolBarUp",&mToolBarUp, false );
112 addItemBool("ToolBarHorV",&mToolBarHorV, true ); 112 addItemBool("ToolBarHorV",&mToolBarHorV, true );
113 addItemBool("ToolBarUpV",&mToolBarUpV, false ); 113 addItemBool("ToolBarUpV",&mToolBarUpV, false );
114 addItemBool("ToolBarHorN",&mToolBarHorN, true ); 114 addItemBool("ToolBarHorN",&mToolBarHorN, true );
115 addItemBool("ToolBarUpN",&mToolBarUpN, false ); 115 addItemBool("ToolBarUpN",&mToolBarUpN, false );
116 addItemBool("ToolBarHorF",&mToolBarHorF, true ); 116 addItemBool("ToolBarHorF",&mToolBarHorF, true );
117 addItemBool("ToolBarUpF",&mToolBarUpF, false ); 117 addItemBool("ToolBarUpF",&mToolBarUpF, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 119 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 121
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 123 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
124 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 124 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
125 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 125 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
126 addItemInt("AllDay Size",&mAllDaySize,28); 126 addItemInt("AllDay Size",&mAllDaySize,28);
127 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 127 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
128 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 128 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
129 129
130 addItemStringList("LocationDefaults",&mLocationDefaults ); 130 addItemStringList("LocationDefaults",&mLocationDefaults );
131 addItemStringList("EventSummary User",&mEventSummaryUser); 131 addItemStringList("EventSummary User",&mEventSummaryUser);
132 addItemStringList("TodoSummary User",&mTodoSummaryUser); 132 addItemStringList("TodoSummary User",&mTodoSummaryUser);
133 133
134 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 134 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
135 addItemBool("Enable Project View",&mEnableProjectView,false); 135 addItemBool("Enable Project View",&mEnableProjectView,false);
136 addItemBool("Auto Save",&mAutoSave,false); 136 addItemBool("Auto Save",&mAutoSave,false);
137 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 137 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
138 addItemBool("Confirm Deletes",&mConfirm,true); 138 addItemBool("Confirm Deletes",&mConfirm,true);
139 addItemString("Archive File",&mArchiveFile); 139 addItemString("Archive File",&mArchiveFile);
140 addItemString("Html Export File",&mHtmlExportFile, 140 addItemString("Html Export File",&mHtmlExportFile,
141 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 141 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
142 addItemBool("Html With Save",&mHtmlWithSave,false); 142 addItemBool("Html With Save",&mHtmlWithSave,false);
143 143
144 KPrefs::setCurrentGroup("Personal Settings"); 144 KPrefs::setCurrentGroup("Personal Settings");
145 145
146 addItemInt("Mail Client",&mMailClient,MailClientKMail); 146 addItemInt("Mail Client",&mMailClient,MailClientKMail);
147 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 147 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
148 addItemBool("Bcc",&mBcc,false); 148 addItemBool("Bcc",&mBcc,false);
149 149
150 KPrefs::setCurrentGroup("Time & Date"); 150 KPrefs::setCurrentGroup("Time & Date");
151 151
152 152
153 addItemInt("Default Start Time",&mStartTime,10); 153 addItemInt("Default Start Time",&mStartTime,10);
154 addItemInt("Default Duration",&mDefaultDuration,2); 154 addItemInt("Default Duration",&mDefaultDuration,2);
155 addItemInt("Default Alarm Time",&mAlarmTime,3); 155 addItemInt("Default Alarm Time",&mAlarmTime,3);
156 KPrefs::setCurrentGroup("AlarmSettings"); 156 KPrefs::setCurrentGroup("AlarmSettings");
157 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 157 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
158 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 158 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
159 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 159 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
160 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 160 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
161 161
162 162
163 KPrefs::setCurrentGroup("Calendar"); 163 KPrefs::setCurrentGroup("Calendar");
164 164
165 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 165 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
166 166
167 KPrefs::setCurrentGroup("Fonts"); 167 KPrefs::setCurrentGroup("Fonts");
168 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 168 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
169 QFont fon = KGlobalSettings::generalFont(); 169 QFont fon = KGlobalSettings::generalFont();
170 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 170 addItemFont("TimeBar Font",&mTimeBarFont,fon );
171 addItemFont("MonthView Font",&mMonthViewFont,fon); 171 addItemFont("MonthView Font",&mMonthViewFont,fon);
172 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 172 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
173 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 173 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
174 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 174 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
175 addItemFont("TodoView Font",&mTodoViewFont,fon); 175 addItemFont("TodoView Font",&mTodoViewFont,fon);
176 addItemFont("ListView Font",&mListViewFont,fon); 176 addItemFont("ListView Font",&mListViewFont,fon);
177 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 177 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
178 addItemFont("EditBox Font",&mEditBoxFont,fon); 178 addItemFont("EditBox Font",&mEditBoxFont,fon);
179 addItemFont("JournalView Font",&mJornalViewFont,fon); 179 addItemFont("JournalView Font",&mJornalViewFont,fon);
180 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 180 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
181 addItemFont("EventView Font",&mEventViewFont,fon); 181 addItemFont("EventView Font",&mEventViewFont,fon);
182 182
183 KPrefs::setCurrentGroup("RemoteSyncing"); 183 KPrefs::setCurrentGroup("RemoteSyncing");
184 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 184 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
185 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 185 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
186 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 186 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
187 addItemInt("LastSyncTime",&mLastSyncTime,0); 187 addItemInt("LastSyncTime",&mLastSyncTime,0);
188 188
189#ifdef _WIN32_ 189#ifdef _WIN32_
190 QString hdp= locateLocal("data","korganizer")+"\\\\"; 190 QString hdp= locateLocal("data","korganizer")+"\\\\";
191#else 191#else
192 QString hdp= locateLocal("data","korganizer")+"/"; 192 QString hdp= locateLocal("data","korganizer")+"/";
193#endif 193#endif
194 194
195 KPrefs::setCurrentGroup("LoadSaveFileNames"); 195 KPrefs::setCurrentGroup("LoadSaveFileNames");
196 196
197 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 197 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
198 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 198 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
199 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 199 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
200 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 200 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
201 201
202 202
203 KPrefs::setCurrentGroup("Locale"); 203 KPrefs::setCurrentGroup("Locale");
204 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 204 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
205 205
206 206
207 KPrefs::setCurrentGroup("Colors"); 207 KPrefs::setCurrentGroup("Colors");
208 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 208 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
209 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 209 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
210 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 210 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
211 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 211 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
212 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 212 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
220 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 220 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
221 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 221 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
222 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 222 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
223 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 223 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
224 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 224 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
225 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 225 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
226 addItemBool("UseAppColors",&mUseAppColors,false); 226 addItemBool("UseAppColors",&mUseAppColors,false);
227 227
228 228
229 229
230 KPrefs::setCurrentGroup("Views"); 230 KPrefs::setCurrentGroup("Views");
231 addItemBool("Block Popup Menu",&mBlockPopupMenu,true); 231 addItemBool("Block Popup Menu",&mBlockPopupMenu,true);
232 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 232 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
233 addItemInt("Hour Size",&mHourSize,8); 233 addItemInt("Hour Size",&mHourSize,8);
234 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 234 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
238 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 238 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
240 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
240#ifdef DESKTOP_VERION 241#ifdef DESKTOP_VERION
241 addItemBool("Enable ToolTips",&mEnableToolTips,true); 242 addItemBool("Enable ToolTips",&mEnableToolTips,true);
242#else 243#else
243 addItemBool("Enable ToolTips",&mEnableToolTips,false); 244 addItemBool("Enable ToolTips",&mEnableToolTips,false);
244#endif 245#endif
245 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 246 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
246 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 247 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
247 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 248 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
248 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 249 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
249 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 250 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
250 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 251 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
251 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 252 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
252 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 253 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
253 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 254 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
254 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 255 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
255 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 256 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
256 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 257 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
257 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 258 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
258 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 259 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
259 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 260 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
260 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 261 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
261 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 262 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
262 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 263 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
263 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 264 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
264 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 265 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
265#ifdef DESKTOP_VERSION 266#ifdef DESKTOP_VERSION
266 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 267 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
267#else 268#else
268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
269#endif 270#endif
270 addItemInt("Day Begins",&mDayBegins,7); 271 addItemInt("Day Begins",&mDayBegins,7);
271 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 272 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
272 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 273 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
273 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 274 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
274 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 275 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
275 276
276 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 277 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
277 addItemBool("Full View Month",&mFullViewMonth,true); 278 addItemBool("Full View Month",&mFullViewMonth,true);
278 addItemBool("Full View Todo",&mFullViewTodo,true); 279 addItemBool("Full View Todo",&mFullViewTodo,true);
279 addItemBool("Quick Todo",&mEnableQuickTodo,false); 280 addItemBool("Quick Todo",&mEnableQuickTodo,false);
280 281
281 addItemInt("Next X Days",&mNextXDays,3); 282 addItemInt("Next X Days",&mNextXDays,3);
282 283
283 KPrefs::setCurrentGroup("Printer"); 284 KPrefs::setCurrentGroup("Printer");
284 285
285 KPrefs::setCurrentGroup("Layout"); 286 KPrefs::setCurrentGroup("Layout");
286 287
287 addItemBool("CompactDialogs",&mCompactDialogs,false); 288 addItemBool("CompactDialogs",&mCompactDialogs,false);
288 addItemBool("VerticalScreen",&mVerticalScreen,true); 289 addItemBool("VerticalScreen",&mVerticalScreen,true);
289 290
290 KPrefs::setCurrentGroup("KOrganizer Plugins"); 291 KPrefs::setCurrentGroup("KOrganizer Plugins");
291 292
292 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 293 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
293 294
294 KPrefs::setCurrentGroup("Group Scheduling"); 295 KPrefs::setCurrentGroup("Group Scheduling");
295 296
296 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 297 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
297 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 298 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
298 addItemStringList("AdditionalMails",&mAdditionalMails,""); 299 addItemStringList("AdditionalMails",&mAdditionalMails,"");
299 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 300 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
300 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 301 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
301 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 302 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
302 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 303 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
303 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 304 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
304 305
305 KPrefs::setCurrentGroup( "Editors" ); 306 KPrefs::setCurrentGroup( "Editors" );
306 307
307 addItemStringList( "EventTemplates", &mEventTemplates ); 308 addItemStringList( "EventTemplates", &mEventTemplates );
308 addItemStringList( "TodoTemplates", &mTodoTemplates ); 309 addItemStringList( "TodoTemplates", &mTodoTemplates );
309 310
310 addItemInt("DestinationPolicy",&mDestination,standardDestination); 311 addItemInt("DestinationPolicy",&mDestination,standardDestination);
311 312
312 KPrefs::setCurrentGroup( "ViewOptions" ); 313 KPrefs::setCurrentGroup( "ViewOptions" );
313 addItemBool("EVshowDetails",&mEVshowDetails,true); 314 addItemBool("EVshowDetails",&mEVshowDetails,true);
314 addItemBool("EVshowCreated",&mEVshowCreated,true); 315 addItemBool("EVshowCreated",&mEVshowCreated,true);
315 addItemBool("EVshowChanged",&mEVshowChanged,true); 316 addItemBool("EVshowChanged",&mEVshowChanged,true);
316 addItemBool("WTshowDetails",&mWTshowDetails,false); 317 addItemBool("WTshowDetails",&mWTshowDetails,false);
317 addItemBool("WTshowCreated",&mWTshowCreated,false); 318 addItemBool("WTshowCreated",&mWTshowCreated,false);
318 addItemBool("WTshowChanged",&mWTshowChanged,false); 319 addItemBool("WTshowChanged",&mWTshowChanged,false);
319 320
320} 321}
321 322
322 323
323KOPrefs::~KOPrefs() 324KOPrefs::~KOPrefs()
324{ 325{
325 if (mInstance == this) 326 if (mInstance == this)
326 mInstance = insd.setObject(0); 327 mInstance = insd.setObject(0);
327 328
328 //qDebug("KOPrefs::~KOPrefs() "); 329 //qDebug("KOPrefs::~KOPrefs() ");
329} 330}
330 331
331 332
332KOPrefs *KOPrefs::instance() 333KOPrefs *KOPrefs::instance()
333{ 334{
334 if (!mInstance) { 335 if (!mInstance) {
335 mInstance = insd.setObject(new KOPrefs()); 336 mInstance = insd.setObject(new KOPrefs());
336 mInstance->readConfig(); 337 mInstance->readConfig();
337 } 338 }
338 339
339 return mInstance; 340 return mInstance;
340} 341}
341 342
342void KOPrefs::usrSetDefaults() 343void KOPrefs::usrSetDefaults()
343{ 344{
344 345
345} 346}
346 347
347void KOPrefs::fillMailDefaults() 348void KOPrefs::fillMailDefaults()
348{ 349{
349 if (mName.isEmpty()) mName = i18n("Anonymous"); 350 if (mName.isEmpty()) mName = i18n("Anonymous");
350 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 351 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
351} 352}
352 353
353void KOPrefs::setTimeZoneIdDefault() 354void KOPrefs::setTimeZoneIdDefault()
354{ 355{
355 ; 356 ;
356} 357}
357 358
358void KOPrefs::setAllDefaults() 359void KOPrefs::setAllDefaults()
359{ 360{
360 setCategoryDefaults(); 361 setCategoryDefaults();
361 mEventSummaryUser = getDefaultList() ; 362 mEventSummaryUser = getDefaultList() ;
362 mTodoSummaryUser = getDefaultList() ; 363 mTodoSummaryUser = getDefaultList() ;
363 mLocationDefaults = getLocationDefaultList(); 364 mLocationDefaults = getLocationDefaultList();
364} 365}
365 366
366void KOPrefs::setCategoryDefaults() 367void KOPrefs::setCategoryDefaults()
367{ 368{
368 mCustomCategories.clear(); 369 mCustomCategories.clear();
369 mCustomCategories = getDefaultList(); 370 mCustomCategories = getDefaultList();
370 371
371 QStringList::Iterator it; 372 QStringList::Iterator it;
372 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 373 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
373 setCategoryColor(*it,mDefaultCategoryColor); 374 setCategoryColor(*it,mDefaultCategoryColor);
374 } 375 }
375} 376}
376QStringList KOPrefs::getLocationDefaultList() 377QStringList KOPrefs::getLocationDefaultList()
377{ 378{
378 QStringList retval ; 379 QStringList retval ;
379 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 380 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
380 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 381 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
381 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 382 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
382 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 383 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
383 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 384 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
384 385
385 retval.sort(); 386 retval.sort();
386 return retval; 387 return retval;
387} 388}
388QStringList KOPrefs::getDefaultList() 389QStringList KOPrefs::getDefaultList()
389{ 390{
390 QStringList retval ; 391 QStringList retval ;
391 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 392 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
392 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 393 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
393 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 394 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
394 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 395 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
395 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 396 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
396 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 397 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
397 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 398 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
398 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 399 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
399 retval.sort(); 400 retval.sort();
400 //qDebug("cat %s ", retval.join("-").latin1()); 401 //qDebug("cat %s ", retval.join("-").latin1());
401 return retval; 402 return retval;
402} 403}
403 404
404void KOPrefs::usrReadConfig() 405void KOPrefs::usrReadConfig()
405{ 406{
406 config()->setGroup("General"); 407 config()->setGroup("General");
407 408
408 //qDebug("KOPrefs::usrReadConfig() "); 409 //qDebug("KOPrefs::usrReadConfig() ");
409 mCustomCategories = config()->readListEntry("Custom Categories"); 410 mCustomCategories = config()->readListEntry("Custom Categories");
410 mOldLoadedLanguage = mOldLanguage ; 411 mOldLoadedLanguage = mOldLanguage ;
411 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 412 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
412 if (mLocationDefaults.isEmpty()) { 413 if (mLocationDefaults.isEmpty()) {
413 mLocationDefaults = getLocationDefaultList(); 414 mLocationDefaults = getLocationDefaultList();
414 } 415 }
415 416
416 if (mEventSummaryUser.isEmpty()) { 417 if (mEventSummaryUser.isEmpty()) {
417 mEventSummaryUser = getDefaultList() ; 418 mEventSummaryUser = getDefaultList() ;
418 } 419 }
419 if (mTodoSummaryUser.isEmpty()) { 420 if (mTodoSummaryUser.isEmpty()) {
420 mTodoSummaryUser = getDefaultList() ; 421 mTodoSummaryUser = getDefaultList() ;
421 } 422 }
422 423
423 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 424 if (mCustomCategories.isEmpty()) setCategoryDefaults();
424 425
425 config()->setGroup("Personal Settings"); 426 config()->setGroup("Personal Settings");
426 mName = config()->readEntry("user_name",""); 427 mName = config()->readEntry("user_name","");
427 mEmail = config()->readEntry("user_email",""); 428 mEmail = config()->readEntry("user_email","");
428 fillMailDefaults(); 429 fillMailDefaults();
429 430
430 config()->setGroup("Category Colors"); 431 config()->setGroup("Category Colors");
431 QStringList::Iterator it; 432 QStringList::Iterator it;
432 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 433 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
433 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 434 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
434 435
435 } 436 }
436 437
437 KPimPrefs::usrReadConfig(); 438 KPimPrefs::usrReadConfig();
438} 439}
439 440
440 441
441void KOPrefs::usrWriteConfig() 442void KOPrefs::usrWriteConfig()
442{ 443{
443 config()->setGroup("General"); 444 config()->setGroup("General");
444 config()->writeEntry("Custom Categories",mCustomCategories); 445 config()->writeEntry("Custom Categories",mCustomCategories);
445 446
446 config()->setGroup("Personal Settings"); 447 config()->setGroup("Personal Settings");
447 config()->writeEntry("user_name",mName); 448 config()->writeEntry("user_name",mName);
448 config()->writeEntry("user_email",mEmail); 449 config()->writeEntry("user_email",mEmail);
449 450
450 config()->setGroup("Category Colors"); 451 config()->setGroup("Category Colors");
451 QDictIterator<QColor> it(mCategoryColors); 452 QDictIterator<QColor> it(mCategoryColors);
452 while (it.current()) { 453 while (it.current()) {
453 config()->writeEntry(it.currentKey(),*(it.current())); 454 config()->writeEntry(it.currentKey(),*(it.current()));
454 ++it; 455 ++it;
455 } 456 }
456 457
457 458
458 KPimPrefs::usrWriteConfig(); 459 KPimPrefs::usrWriteConfig();
459} 460}
460 461
461void KOPrefs::setCategoryColor(QString cat,const QColor & color) 462void KOPrefs::setCategoryColor(QString cat,const QColor & color)
462{ 463{
463 mCategoryColors.replace(cat,new QColor(color)); 464 mCategoryColors.replace(cat,new QColor(color));
464} 465}
465 466
466QColor *KOPrefs::categoryColor(QString cat) 467QColor *KOPrefs::categoryColor(QString cat)
467{ 468{
468 QColor *color = 0; 469 QColor *color = 0;
469 470
470 if (!cat.isEmpty()) color = mCategoryColors[cat]; 471 if (!cat.isEmpty()) color = mCategoryColors[cat];
471 472
472 if (color) return color; 473 if (color) return color;
473 else return &mDefaultCategoryColor; 474 else return &mDefaultCategoryColor;
474} 475}
475 476
476void KOPrefs::setFullName(const QString &name) 477void KOPrefs::setFullName(const QString &name)
477{ 478{
478 mName = name; 479 mName = name;
479} 480}
480 481
481void KOPrefs::setEmail(const QString &email) 482void KOPrefs::setEmail(const QString &email)
482{ 483{
483 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 484 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
484 mEmail = email; 485 mEmail = email;
485} 486}
486 487
487QString KOPrefs::fullName() 488QString KOPrefs::fullName()
488{ 489{
489 if (mEmailControlCenter) { 490 if (mEmailControlCenter) {
490 KEMailSettings settings; 491 KEMailSettings settings;
491 return settings.getSetting(KEMailSettings::RealName); 492 return settings.getSetting(KEMailSettings::RealName);
492 } else { 493 } else {
493 return mName; 494 return mName;
494 } 495 }
495} 496}
496 497
497QString KOPrefs::email() 498QString KOPrefs::email()
498{ 499{
499 if (mEmailControlCenter) { 500 if (mEmailControlCenter) {
500 KEMailSettings settings; 501 KEMailSettings settings;
501 return settings.getSetting(KEMailSettings::EmailAddress); 502 return settings.getSetting(KEMailSettings::EmailAddress);
502 } else { 503 } else {
503 return mEmail; 504 return mEmail;
504 } 505 }
505} 506}
506KConfig* KOPrefs::getConfig() 507KConfig* KOPrefs::getConfig()
507{ 508{
508 return config(); 509 return config();
509} 510}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 2a0ee64..e06df1c 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,319 +1,320 @@
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#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <qdict.h>
29 29
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35#define VIEW_WN_VIEW 1 35#define VIEW_WN_VIEW 1
36#define VIEW_NX_VIEW 2 36#define VIEW_NX_VIEW 2
37#define VIEW_J_VIEW 3 37#define VIEW_J_VIEW 3
38#define VIEW_A_VIEW 4 38#define VIEW_A_VIEW 4
39#define VIEW_ML_VIEW 5 39#define VIEW_ML_VIEW 5
40#define VIEW_M_VIEW 6 40#define VIEW_M_VIEW 6
41#define VIEW_L_VIEW 7 41#define VIEW_L_VIEW 7
42#define VIEW_T_VIEW 8 42#define VIEW_T_VIEW 8
43 43
44class KOPrefs : public KPimPrefs 44class KOPrefs : public KPimPrefs
45{ 45{
46 public: 46 public:
47 enum { FormatVCalendar, FormatICalendar }; 47 enum { FormatVCalendar, FormatICalendar };
48 enum { MailClientKMail, MailClientSendmail }; 48 enum { MailClientKMail, MailClientSendmail };
49 enum { IMIPDummy, IMIPKMail }; 49 enum { IMIPDummy, IMIPKMail };
50 enum { IMIPOutbox, IMIPdirectsend }; 50 enum { IMIPOutbox, IMIPdirectsend };
51 enum { neverAuto, addressbookAuto, selectedAuto }; 51 enum { neverAuto, addressbookAuto, selectedAuto };
52 enum { standardDestination, askDestination }; 52 enum { standardDestination, askDestination };
53 53
54 virtual ~KOPrefs(); 54 virtual ~KOPrefs();
55 55
56 /** Get instance of KOPrefs. It is made sure that there is only one 56 /** Get instance of KOPrefs. It is made sure that there is only one
57 instance. */ 57 instance. */
58 static KOPrefs *instance(); 58 static KOPrefs *instance();
59 59
60 /** Set preferences to default values */ 60 /** Set preferences to default values */
61 void usrSetDefaults(); 61 void usrSetDefaults();
62 62
63 /** Read preferences from config file */ 63 /** Read preferences from config file */
64 void usrReadConfig(); 64 void usrReadConfig();
65 65
66 /** Write preferences to config file */ 66 /** Write preferences to config file */
67 void usrWriteConfig(); 67 void usrWriteConfig();
68 void setCategoryDefaults(); 68 void setCategoryDefaults();
69 void setAllDefaults(); 69 void setAllDefaults();
70 70
71 protected: 71 protected:
72 void setTimeZoneIdDefault(); 72 void setTimeZoneIdDefault();
73 73
74 /** Fill empty mail fields with default values. */ 74 /** Fill empty mail fields with default values. */
75 void fillMailDefaults(); 75 void fillMailDefaults();
76 76
77 private: 77 private:
78 /** Constructor disabled for public. Use instance() to create a KOPrefs 78 /** Constructor disabled for public. Use instance() to create a KOPrefs
79 object. */ 79 object. */
80 KOPrefs(); 80 KOPrefs();
81 81
82 static KOPrefs *mInstance; 82 static KOPrefs *mInstance;
83 QStringList getDefaultList(); 83 QStringList getDefaultList();
84 QStringList getLocationDefaultList(); 84 QStringList getLocationDefaultList();
85 public: 85 public:
86 // preferences data 86 // preferences data
87 KConfig* getConfig(); 87 KConfig* getConfig();
88 void setFullName(const QString &); 88 void setFullName(const QString &);
89 QString fullName(); 89 QString fullName();
90 void setEmail(const QString &); 90 void setEmail(const QString &);
91 QString email(); 91 QString email();
92 92
93 QString mAdditional; 93 QString mAdditional;
94 94
95 bool mEmailControlCenter; 95 bool mEmailControlCenter;
96 96
97 bool mBcc; 97 bool mBcc;
98 bool mAutoSave; 98 bool mAutoSave;
99 int mAutoSaveInterval; 99 int mAutoSaveInterval;
100 bool mConfirm; 100 bool mConfirm;
101 101
102 bool mEnableGroupScheduling; 102 bool mEnableGroupScheduling;
103 bool mEnableProjectView; 103 bool mEnableProjectView;
104 104
105 int mDefaultFormat; 105 int mDefaultFormat;
106 int mMailClient; 106 int mMailClient;
107 107
108 int mStartTime; 108 int mStartTime;
109 int mDefaultDuration; 109 int mDefaultDuration;
110 int mAlarmTime; 110 int mAlarmTime;
111 111
112 int mWorkingHoursStart; 112 int mWorkingHoursStart;
113 int mWorkingHoursEnd; 113 int mWorkingHoursEnd;
114 bool mExcludeHolidays; 114 bool mExcludeHolidays;
115 bool mExcludeSaturdays; 115 bool mExcludeSaturdays;
116 bool mMarcusBainsShowSeconds; 116 bool mMarcusBainsShowSeconds;
117 117
118 QFont mTimeBarFont; 118 QFont mTimeBarFont;
119 QFont mMonthViewFont; 119 QFont mMonthViewFont;
120 QFont mAgendaViewFont; 120 QFont mAgendaViewFont;
121 QFont mMarcusBainsFont; 121 QFont mMarcusBainsFont;
122 QFont mTimeLabelsFont; 122 QFont mTimeLabelsFont;
123 QFont mTodoViewFont; 123 QFont mTodoViewFont;
124 QFont mListViewFont; 124 QFont mListViewFont;
125 QFont mDateNavigatorFont; 125 QFont mDateNavigatorFont;
126 QFont mEditBoxFont; 126 QFont mEditBoxFont;
127 QFont mJornalViewFont; 127 QFont mJornalViewFont;
128 QFont mWhatsNextFont; 128 QFont mWhatsNextFont;
129 QFont mEventViewFont; 129 QFont mEventViewFont;
130 130
131 131
132 132
133 133
134 QColor mHolidayColor; 134 QColor mHolidayColor;
135 QColor mHighlightColor; 135 QColor mHighlightColor;
136 QColor mEventColor; 136 QColor mEventColor;
137 QColor mTodoDoneColor; 137 QColor mTodoDoneColor;
138 QColor mAgendaBgColor; 138 QColor mAgendaBgColor;
139 QColor mWorkingHoursColor; 139 QColor mWorkingHoursColor;
140 QColor mTodoDueTodayColor; 140 QColor mTodoDueTodayColor;
141 QColor mTodoOverdueColor; 141 QColor mTodoOverdueColor;
142 QColor mTodoRunColor; 142 QColor mTodoRunColor;
143 QColor mMonthViewEvenColor; 143 QColor mMonthViewEvenColor;
144 QColor mMonthViewOddColor; 144 QColor mMonthViewOddColor;
145 QColor mMonthViewHolidayColor; 145 QColor mMonthViewHolidayColor;
146 bool mMonthViewUsesDayColors; 146 bool mMonthViewUsesDayColors;
147 bool mMonthViewSatSunTog; 147 bool mMonthViewSatSunTog;
148 bool mMonthViewWeek; 148 bool mMonthViewWeek;
149 QColor mAppColor1; 149 QColor mAppColor1;
150 QColor mAppColor2; 150 QColor mAppColor2;
151 bool mUseAppColors; 151 bool mUseAppColors;
152 152
153 int mDayBegins; 153 int mDayBegins;
154 int mHourSize; 154 int mHourSize;
155 int mAllDaySize; 155 int mAllDaySize;
156 bool mShowFullMenu; 156 bool mShowFullMenu;
157 bool mDailyRecur; 157 bool mDailyRecur;
158 bool mWeeklyRecur; 158 bool mWeeklyRecur;
159 bool mMonthDailyRecur; 159 bool mMonthDailyRecur;
160 bool mMonthWeeklyRecur; 160 bool mMonthWeeklyRecur;
161 bool mMonthShowIcons; 161 bool mMonthShowIcons;
162 bool mMonthShowTimes;
162 bool mMonthShowShort; 163 bool mMonthShowShort;
163 bool mEnableToolTips; 164 bool mEnableToolTips;
164 bool mEnableMonthScroll; 165 bool mEnableMonthScroll;
165 bool mFullViewMonth; 166 bool mFullViewMonth;
166 bool mMonthViewUsesCategoryColor; 167 bool mMonthViewUsesCategoryColor;
167 bool mFullViewTodo; 168 bool mFullViewTodo;
168 bool mShowCompletedTodo; 169 bool mShowCompletedTodo;
169 bool mMarcusBainsEnabled; 170 bool mMarcusBainsEnabled;
170 int mNextXDays; 171 int mNextXDays;
171 int mWhatsNextDays; 172 int mWhatsNextDays;
172 int mWhatsNextPrios; 173 int mWhatsNextPrios;
173 bool mEnableQuickTodo; 174 bool mEnableQuickTodo;
174 175
175 bool mCompactDialogs; 176 bool mCompactDialogs;
176 bool mVerticalScreen; 177 bool mVerticalScreen;
177 178
178 bool mShowIconNewTodo; 179 bool mShowIconNewTodo;
179 bool mShowIconNewEvent; 180 bool mShowIconNewEvent;
180 bool mShowIconSearch; 181 bool mShowIconSearch;
181 bool mShowIconList; 182 bool mShowIconList;
182 bool mShowIconDay1; 183 bool mShowIconDay1;
183 bool mShowIconDay5; 184 bool mShowIconDay5;
184 bool mShowIconDay6; 185 bool mShowIconDay6;
185 bool mShowIconDay7; 186 bool mShowIconDay7;
186 bool mShowIconMonth; 187 bool mShowIconMonth;
187 bool mShowIconTodoview; 188 bool mShowIconTodoview;
188 bool mShowIconBackFast; 189 bool mShowIconBackFast;
189 bool mShowIconBack; 190 bool mShowIconBack;
190 bool mShowIconToday; 191 bool mShowIconToday;
191 bool mShowIconForward; 192 bool mShowIconForward;
192 bool mShowIconForwardFast; 193 bool mShowIconForwardFast;
193 bool mShowIconWhatsThis; 194 bool mShowIconWhatsThis;
194 bool mShowIconWeekNum; 195 bool mShowIconWeekNum;
195 bool mShowIconNextDays; 196 bool mShowIconNextDays;
196 bool mShowIconNext; 197 bool mShowIconNext;
197 bool mShowIconJournal; 198 bool mShowIconJournal;
198 bool mShowIconFilter; 199 bool mShowIconFilter;
199 bool mShowIconOnetoolbar; 200 bool mShowIconOnetoolbar;
200 bool mShowIconNavigator; 201 bool mShowIconNavigator;
201 bool mShowIconAllday; 202 bool mShowIconAllday;
202 bool mShowIconFilterview; 203 bool mShowIconFilterview;
203 bool mShowIconToggleFull; 204 bool mShowIconToggleFull;
204 205
205 bool mShowIconStretch; 206 bool mShowIconStretch;
206 207
207 bool mToolBarHor; 208 bool mToolBarHor;
208 bool mToolBarUp; 209 bool mToolBarUp;
209 bool mToolBarHorV; 210 bool mToolBarHorV;
210 bool mToolBarUpV; 211 bool mToolBarUpV;
211 bool mToolBarHorN; 212 bool mToolBarHorN;
212 bool mToolBarUpN; 213 bool mToolBarUpN;
213 bool mToolBarHorF; 214 bool mToolBarHorF;
214 bool mToolBarUpF; 215 bool mToolBarUpF;
215 bool mToolBarMiniIcons; 216 bool mToolBarMiniIcons;
216 217
217 bool mAskForQuit; 218 bool mAskForQuit;
218 bool mUsePassWd; 219 bool mUsePassWd;
219 bool mShowSyncEvents; 220 bool mShowSyncEvents;
220 bool mShowTodoInAgenda; 221 bool mShowTodoInAgenda;
221 bool mShowTimeInAgenda; 222 bool mShowTimeInAgenda;
222 bool mHideNonStartedTodos; 223 bool mHideNonStartedTodos;
223 224
224 bool mBlockPopupMenu; 225 bool mBlockPopupMenu;
225 226
226 int mLastSyncTime; 227 int mLastSyncTime;
227 void setCategoryColor(QString cat,const QColor & color); 228 void setCategoryColor(QString cat,const QColor & color);
228 QColor *categoryColor(QString cat); 229 QColor *categoryColor(QString cat);
229 230
230 QString mArchiveFile; 231 QString mArchiveFile;
231 QString mHtmlExportFile; 232 QString mHtmlExportFile;
232 bool mHtmlWithSave; 233 bool mHtmlWithSave;
233 234
234 QStringList mSelectedPlugins; 235 QStringList mSelectedPlugins;
235 236
236 QString mLastImportFile; 237 QString mLastImportFile;
237 QString mLastVcalFile; 238 QString mLastVcalFile;
238 QString mLastSaveFile; 239 QString mLastSaveFile;
239 QString mLastLoadFile; 240 QString mLastLoadFile;
240 241
241 242
242 QString mDefaultAlarmFile; 243 QString mDefaultAlarmFile;
243 int mIMIPScheduler; 244 int mIMIPScheduler;
244 int mIMIPSend; 245 int mIMIPSend;
245 QStringList mAdditionalMails; 246 QStringList mAdditionalMails;
246 int mIMIPAutoRefresh; 247 int mIMIPAutoRefresh;
247 int mIMIPAutoInsertReply; 248 int mIMIPAutoInsertReply;
248 int mIMIPAutoInsertRequest; 249 int mIMIPAutoInsertRequest;
249 int mIMIPAutoFreeBusy; 250 int mIMIPAutoFreeBusy;
250 int mIMIPAutoFreeBusyReply; 251 int mIMIPAutoFreeBusyReply;
251 252
252 QStringList mTodoTemplates; 253 QStringList mTodoTemplates;
253 QStringList mEventTemplates; 254 QStringList mEventTemplates;
254 255
255 int mDestination; 256 int mDestination;
256 257
257 258
258 bool mEditOnDoubleClick; 259 bool mEditOnDoubleClick;
259 bool mViewChangeHoldFullscreen; 260 bool mViewChangeHoldFullscreen;
260 bool mViewChangeHoldNonFullscreen; 261 bool mViewChangeHoldNonFullscreen;
261 bool mCenterOnCurrentTime; 262 bool mCenterOnCurrentTime;
262 bool mSetTimeToDayStartAt; 263 bool mSetTimeToDayStartAt;
263 bool mHighlightCurrentDay; 264 bool mHighlightCurrentDay;
264 bool mUseHighlightLightColor; 265 bool mUseHighlightLightColor;
265 bool mListViewMonthTimespan; 266 bool mListViewMonthTimespan;
266 bool mWNViewShowsParents; 267 bool mWNViewShowsParents;
267 bool mWNViewShowsPast; 268 bool mWNViewShowsPast;
268 bool mWNViewShowLocation; 269 bool mWNViewShowLocation;
269 bool mTodoViewShowsPercentage; 270 bool mTodoViewShowsPercentage;
270 bool mTodoViewUsesCatColors; 271 bool mTodoViewUsesCatColors;
271 bool mMonthViewUsesBigFont; 272 bool mMonthViewUsesBigFont;
272 bool mTodoViewUsesSmallFont; 273 bool mTodoViewUsesSmallFont;
273 bool mTodoViewUsesForegroundColor; 274 bool mTodoViewUsesForegroundColor;
274 bool mMonthViewUsesForegroundColor; 275 bool mMonthViewUsesForegroundColor;
275 276
276 bool mHightlightDateTimeEdit; 277 bool mHightlightDateTimeEdit;
277 bool mShortDateInViewer; 278 bool mShortDateInViewer;
278 279
279 bool mShowDateNavigator; 280 bool mShowDateNavigator;
280 281
281 QStringList mLocationDefaults; 282 QStringList mLocationDefaults;
282 QStringList mEventSummaryUser; 283 QStringList mEventSummaryUser;
283 QStringList mTodoSummaryUser; 284 QStringList mTodoSummaryUser;
284 285
285 bool mUseInternalAlarmNotification; 286 bool mUseInternalAlarmNotification;
286 int mAlarmPlayBeeps; 287 int mAlarmPlayBeeps;
287 int mAlarmSuspendTime; 288 int mAlarmSuspendTime;
288 int mAlarmSuspendCount; 289 int mAlarmSuspendCount;
289 int mAlarmBeepInterval; 290 int mAlarmBeepInterval;
290 int mOldLanguage; 291 int mOldLanguage;
291 int mOldLoadedLanguage; 292 int mOldLoadedLanguage;
292 293
293 294
294 QString mActiveSyncPort; 295 QString mActiveSyncPort;
295 QString mActiveSyncIP; 296 QString mActiveSyncIP;
296 297
297 // settings for eventviewer 298 // settings for eventviewer
298 bool mEVshowDetails; 299 bool mEVshowDetails;
299 bool mEVshowCreated; 300 bool mEVshowCreated;
300 bool mEVshowChanged; 301 bool mEVshowChanged;
301 bool mWTshowDetails; 302 bool mWTshowDetails;
302 bool mWTshowCreated; 303 bool mWTshowCreated;
303 bool mWTshowChanged; 304 bool mWTshowChanged;
304 305
305 int mCurrentDisplayedView; 306 int mCurrentDisplayedView;
306 307
307 private: 308 private:
308 QDict<QColor> mCategoryColors; 309 QDict<QColor> mCategoryColors;
309 QColor mDefaultCategoryColor; 310 QColor mDefaultCategoryColor;
310 311
311 QFont mDefaultTimeBarFont; 312 QFont mDefaultTimeBarFont;
312 QFont mDefaultViewFont; 313 QFont mDefaultViewFont;
313 QFont mDefaultMonthViewFont; 314 QFont mDefaultMonthViewFont;
314 315
315 QString mName; 316 QString mName;
316 QString mEmail; 317 QString mEmail;
317}; 318};
318 319
319#endif 320#endif
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index ad3c61c..cb9c272 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -255,1025 +255,1027 @@ void KOPrefsDialog::setupSyncAlgTab()
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 767 weeklyRecur =
768 addWidBool(i18n("times"),
769 &(KOPrefs::instance()->mMonthShowTimes),habo);
768 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 770 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
769 ii++; 771 ii++;
770#ifdef DESKTOP_VERSION 772#ifdef DESKTOP_VERSION
771 KPrefsDialogWidBool *enableMonthScroll = 773 KPrefsDialogWidBool *enableMonthScroll =
772 addWidBool(i18n("Enable scrollbars in month view cells"), 774 addWidBool(i18n("Enable scrollbars in month view cells"),
773 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
774 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
775#endif 777#endif
776 dummy = 778 dummy =
777 addWidBool(i18n("Week view mode uses bigger font"), 779 addWidBool(i18n("Week view mode uses bigger font"),
778 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
779 topLayout->addWidget(dummy->checkBox(),ii++,0); 781 topLayout->addWidget(dummy->checkBox(),ii++,0);
780 dummy = 782 dummy =
781 addWidBool(i18n("Show Sat/Sun together"), 783 addWidBool(i18n("Show Sat/Sun together"),
782 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
783 topLayout->addWidget(dummy->checkBox(),ii++,0); 785 topLayout->addWidget(dummy->checkBox(),ii++,0);
784 786
785 KPrefsDialogWidBool *coloredCategoriesInMonthView = 787 KPrefsDialogWidBool *coloredCategoriesInMonthView =
786 addWidBool(i18n("Month view uses category colors"), 788 addWidBool(i18n("Month view uses category colors"),
787 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
788 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
789 791
790 dummy = 792 dummy =
791 addWidBool(i18n("Categorie colors are applied to text"), 793 addWidBool(i18n("Categorie colors are applied to text"),
792 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
793 topLayout->addWidget(dummy->checkBox(),ii++,0); 795 topLayout->addWidget(dummy->checkBox(),ii++,0);
794 coloredCategoriesInMonthView = 796 coloredCategoriesInMonthView =
795 addWidBool(i18n("Month view uses day colors"), 797 addWidBool(i18n("Month view uses day colors"),
796 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
797 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
798 800
799 KPrefsDialogWidColor *holidayColor = 801 KPrefsDialogWidColor *holidayColor =
800 addWidColor(i18n("Day color odd months"), 802 addWidColor(i18n("Day color odd months"),
801 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
802 topLayout->addWidget(holidayColor->label(),ii,0); 804 topLayout->addWidget(holidayColor->label(),ii,0);
803 topLayout->addWidget(holidayColor->button(),ii++,1); 805 topLayout->addWidget(holidayColor->button(),ii++,1);
804 806
805 holidayColor = 807 holidayColor =
806 addWidColor(i18n("Day color even months"), 808 addWidColor(i18n("Day color even months"),
807 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
808 topLayout->addWidget(holidayColor->label(),ii,0); 810 topLayout->addWidget(holidayColor->label(),ii,0);
809 topLayout->addWidget(holidayColor->button(),ii++,1); 811 topLayout->addWidget(holidayColor->button(),ii++,1);
810 812
811 813
812 holidayColor = 814 holidayColor =
813 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 815 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
814 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
815 topLayout->addWidget(holidayColor->label(),ii,0); 817 topLayout->addWidget(holidayColor->label(),ii,0);
816 topLayout->addWidget(holidayColor->button(),ii++,1); 818 topLayout->addWidget(holidayColor->button(),ii++,1);
817 // *********************** What'sNext View 819 // *********************** What'sNext View
818 topFrame = addPage(i18n("What's Next View"),0,0); 820 topFrame = addPage(i18n("What's Next View"),0,0);
819 // DesktopIcon("viewmag",KIcon::SizeMedium)); 821 // DesktopIcon("viewmag",KIcon::SizeMedium));
820 822
821 topLayout = new QGridLayout(topFrame,4,1); 823 topLayout = new QGridLayout(topFrame,4,1);
822 topLayout->setSpacing(mSpacingHint); 824 topLayout->setSpacing(mSpacingHint);
823 topLayout->setMargin(mMarginHint); 825 topLayout->setMargin(mMarginHint);
824 ii = 0; 826 ii = 0;
825 827
826 828
827 QHBox* hdummy = new QHBox(topFrame); 829 QHBox* hdummy = new QHBox(topFrame);
828 new QLabel(i18n("Days in What's Next:"),hdummy); 830 new QLabel(i18n("Days in What's Next:"),hdummy);
829 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
830 832
831 topLayout->addWidget(hdummy,ii++,0); 833 topLayout->addWidget(hdummy,ii++,0);
832 834
833 QHBox *prioBox = new QHBox(topFrame); 835 QHBox *prioBox = new QHBox(topFrame);
834 // intervalBox->setSpacing(mSpacingHint); 836 // intervalBox->setSpacing(mSpacingHint);
835 topLayout->addWidget(prioBox,ii++,0); 837 topLayout->addWidget(prioBox,ii++,0);
836 838
837 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);
838 mPrioSpin = new QSpinBox(0,5,1,prioBox); 840 mPrioSpin = new QSpinBox(0,5,1,prioBox);
839 if ( QApplication::desktop()->width() < 300 ) 841 if ( QApplication::desktop()->width() < 300 )
840 mPrioSpin->setFixedWidth( 40 ); 842 mPrioSpin->setFixedWidth( 40 );
841 843
842 KPrefsDialogWidBool *passwdk = 844 KPrefsDialogWidBool *passwdk =
843 845
844 addWidBool(i18n("Show events, that are done"), 846 addWidBool(i18n("Show events, that are done"),
845 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
846 topLayout->addWidget(passwdk->checkBox(), ii++,0); 848 topLayout->addWidget(passwdk->checkBox(), ii++,0);
847 passwdk = 849 passwdk =
848 addWidBool(i18n("Show parent To-Do's"), 850 addWidBool(i18n("Show parent To-Do's"),
849 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
850 topLayout->addWidget(passwdk->checkBox(), ii++,0); 852 topLayout->addWidget(passwdk->checkBox(), ii++,0);
851 853
852 passwdk = 854 passwdk =
853 addWidBool(i18n("Show location"), 855 addWidBool(i18n("Show location"),
854 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
855 topLayout->addWidget(passwdk->checkBox(), ii++,0); 857 topLayout->addWidget(passwdk->checkBox(), ii++,0);
856 858
857 passwdk = 859 passwdk =
858 addWidBool(i18n("Show Sync Events in WN+Agenda"), 860 addWidBool(i18n("Show Sync Events in WN+Agenda"),
859 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 861 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
860 topLayout->addWidget(passwdk->checkBox(), ii++,0); 862 topLayout->addWidget(passwdk->checkBox(), ii++,0);
861 passwdk = 863 passwdk =
862 addWidBool(i18n("Use short date in WN+Event view"), 864 addWidBool(i18n("Use short date in WN+Event view"),
863 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 865 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
864 topLayout->addWidget(passwdk->checkBox(), ii++,0); 866 topLayout->addWidget(passwdk->checkBox(), ii++,0);
865 867
866 868
867 869
868 870
869 // *********************** Todo View 871 // *********************** Todo View
870 872
871 topFrame = addPage(i18n("Todo View"),0,0); 873 topFrame = addPage(i18n("Todo View"),0,0);
872 // DesktopIcon("viewmag",KIcon::SizeMedium)); 874 // DesktopIcon("viewmag",KIcon::SizeMedium));
873 875
874 topLayout = new QGridLayout(topFrame,4,1); 876 topLayout = new QGridLayout(topFrame,4,1);
875 topLayout->setSpacing(mSpacingHint); 877 topLayout->setSpacing(mSpacingHint);
876 topLayout->setMargin(mMarginHint); 878 topLayout->setMargin(mMarginHint);
877 ii = 0; 879 ii = 0;
878dummy = 880dummy =
879 addWidBool(i18n("Hide not running Todos in To-do view"), 881 addWidBool(i18n("Hide not running Todos in To-do view"),
880 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 882 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
881 topLayout->addWidget(dummy->checkBox(),ii++,0); 883 topLayout->addWidget(dummy->checkBox(),ii++,0);
882 884
883 885
884 KPrefsDialogWidBool *showCompletedTodo = 886 KPrefsDialogWidBool *showCompletedTodo =
885 addWidBool(i18n("To-do view shows completed Todos"), 887 addWidBool(i18n("To-do view shows completed Todos"),
886 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 888 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
887 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 889 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
888 dummy = 890 dummy =
889 addWidBool(i18n("To-do view shows complete as 'xx %'"), 891 addWidBool(i18n("To-do view shows complete as 'xx %'"),
890 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 892 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
891 topLayout->addWidget(dummy->checkBox(),ii++,0); 893 topLayout->addWidget(dummy->checkBox(),ii++,0);
892 894
893 dummy = 895 dummy =
894 addWidBool(i18n("Small To-do view uses smaller font"), 896 addWidBool(i18n("Small To-do view uses smaller font"),
895 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 897 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
896 topLayout->addWidget(dummy->checkBox(),ii++,0); 898 topLayout->addWidget(dummy->checkBox(),ii++,0);
897 899
898 900
899 901
900 dummy = 902 dummy =
901 addWidBool(i18n("Todo view uses category colors"), 903 addWidBool(i18n("Todo view uses category colors"),
902 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 904 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
903 topLayout->addWidget(dummy->checkBox(),ii++,0); 905 topLayout->addWidget(dummy->checkBox(),ii++,0);
904 906
905 907
906 QWidget* wid = new QWidget( topFrame ); 908 QWidget* wid = new QWidget( topFrame );
907 // Todo run today color 909 // Todo run today color
908 KPrefsDialogWidColor *todoRunColor = 910 KPrefsDialogWidColor *todoRunColor =
909 addWidColor(i18n("Color for running todos:"), 911 addWidColor(i18n("Color for running todos:"),
910 &(KOPrefs::instance()->mTodoRunColor),wid); 912 &(KOPrefs::instance()->mTodoRunColor),wid);
911 QHBoxLayout *widLayout = new QHBoxLayout(wid); 913 QHBoxLayout *widLayout = new QHBoxLayout(wid);
912 widLayout->addWidget( todoRunColor->label() ); 914 widLayout->addWidget( todoRunColor->label() );
913 widLayout->addWidget( todoRunColor->button() ); 915 widLayout->addWidget( todoRunColor->button() );
914 topLayout->addWidget(wid,ii++,0); 916 topLayout->addWidget(wid,ii++,0);
915 917
916 wid = new QWidget( topFrame ); 918 wid = new QWidget( topFrame );
917 // Todo due today color 919 // Todo due today color
918 KPrefsDialogWidColor *todoDueTodayColor = 920 KPrefsDialogWidColor *todoDueTodayColor =
919 addWidColor(i18n("Todo due today color:"), 921 addWidColor(i18n("Todo due today color:"),
920 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 922 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
921 widLayout = new QHBoxLayout(wid); 923 widLayout = new QHBoxLayout(wid);
922 widLayout->addWidget( todoDueTodayColor->label() ); 924 widLayout->addWidget( todoDueTodayColor->label() );
923 widLayout->addWidget( todoDueTodayColor->button() ); 925 widLayout->addWidget( todoDueTodayColor->button() );
924 topLayout->addWidget(wid,ii++,0); 926 topLayout->addWidget(wid,ii++,0);
925 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 927 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
926 928
927 // Todo overdue color 929 // Todo overdue color
928 wid = new QWidget( topFrame ); 930 wid = new QWidget( topFrame );
929 widLayout = new QHBoxLayout(wid); 931 widLayout = new QHBoxLayout(wid);
930 KPrefsDialogWidColor *todoOverdueColor = 932 KPrefsDialogWidColor *todoOverdueColor =
931 addWidColor(i18n("Todo overdue color:"), 933 addWidColor(i18n("Todo overdue color:"),
932 &(KOPrefs::instance()->mTodoOverdueColor),wid); 934 &(KOPrefs::instance()->mTodoOverdueColor),wid);
933 widLayout->addWidget(todoOverdueColor->label()); 935 widLayout->addWidget(todoOverdueColor->label());
934 widLayout->addWidget(todoOverdueColor->button()); 936 widLayout->addWidget(todoOverdueColor->button());
935 topLayout->addWidget(wid,ii++,0); 937 topLayout->addWidget(wid,ii++,0);
936 938
937 dummy = 939 dummy =
938 addWidBool(i18n("Colors are applied to text"), 940 addWidBool(i18n("Colors are applied to text"),
939 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 941 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
940 topLayout->addWidget(dummy->checkBox(),ii++,0); 942 topLayout->addWidget(dummy->checkBox(),ii++,0);
941 943
942 dummy = 944 dummy =
943 addWidBool(i18n("Allday Agenda view shows todos"), 945 addWidBool(i18n("Allday Agenda view shows todos"),
944 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 946 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
945 topLayout->addWidget(dummy->checkBox(),ii++,0); 947 topLayout->addWidget(dummy->checkBox(),ii++,0);
946 948
947 949
948 topFrame = addPage(i18n("View Options"),0,0); 950 topFrame = addPage(i18n("View Options"),0,0);
949 951
950 topLayout = new QGridLayout(topFrame,4,1); 952 topLayout = new QGridLayout(topFrame,4,1);
951 topLayout->setSpacing(mSpacingHint); 953 topLayout->setSpacing(mSpacingHint);
952 topLayout->setMargin(mMarginHint); 954 topLayout->setMargin(mMarginHint);
953 ii = 0; 955 ii = 0;
954 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 956 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
955 topLayout->addWidget(lab ,ii++,0); 957 topLayout->addWidget(lab ,ii++,0);
956 958
957 dummy = addWidBool(i18n("Details"), 959 dummy = addWidBool(i18n("Details"),
958 &(KOPrefs::instance()->mEVshowDetails),topFrame); 960 &(KOPrefs::instance()->mEVshowDetails),topFrame);
959 topLayout->addWidget(dummy->checkBox(),ii++,0); 961 topLayout->addWidget(dummy->checkBox(),ii++,0);
960 dummy = addWidBool(i18n("Created time"), 962 dummy = addWidBool(i18n("Created time"),
961 &(KOPrefs::instance()->mEVshowCreated),topFrame); 963 &(KOPrefs::instance()->mEVshowCreated),topFrame);
962 topLayout->addWidget(dummy->checkBox(),ii++,0); 964 topLayout->addWidget(dummy->checkBox(),ii++,0);
963 dummy = addWidBool(i18n("Last modified time"), 965 dummy = addWidBool(i18n("Last modified time"),
964 &(KOPrefs::instance()->mEVshowChanged),topFrame); 966 &(KOPrefs::instance()->mEVshowChanged),topFrame);
965 topLayout->addWidget(dummy->checkBox(),ii++,0); 967 topLayout->addWidget(dummy->checkBox(),ii++,0);
966 968
967 969
968 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 970 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
969 topLayout->addWidget(lab ,ii++,0); 971 topLayout->addWidget(lab ,ii++,0);
970 972
971 dummy = addWidBool(i18n("Details"), 973 dummy = addWidBool(i18n("Details"),
972 &(KOPrefs::instance()->mWTshowDetails),topFrame); 974 &(KOPrefs::instance()->mWTshowDetails),topFrame);
973 topLayout->addWidget(dummy->checkBox(),ii++,0); 975 topLayout->addWidget(dummy->checkBox(),ii++,0);
974 dummy = addWidBool(i18n("Created time"), 976 dummy = addWidBool(i18n("Created time"),
975 &(KOPrefs::instance()->mWTshowCreated),topFrame); 977 &(KOPrefs::instance()->mWTshowCreated),topFrame);
976 topLayout->addWidget(dummy->checkBox(),ii++,0); 978 topLayout->addWidget(dummy->checkBox(),ii++,0);
977 dummy = addWidBool(i18n("Last modified time"), 979 dummy = addWidBool(i18n("Last modified time"),
978 &(KOPrefs::instance()->mWTshowChanged),topFrame); 980 &(KOPrefs::instance()->mWTshowChanged),topFrame);
979 topLayout->addWidget(dummy->checkBox(),ii++,0); 981 topLayout->addWidget(dummy->checkBox(),ii++,0);
980 982
981 983
982 topFrame = addPage(i18n("Alarm"),0,0); 984 topFrame = addPage(i18n("Alarm"),0,0);
983 // DesktopIcon("viewmag",KIcon::SizeMedium)); 985 // DesktopIcon("viewmag",KIcon::SizeMedium));
984 986
985 topLayout = new QGridLayout(topFrame,2,1); 987 topLayout = new QGridLayout(topFrame,2,1);
986 topLayout->setSpacing(mSpacingHint); 988 topLayout->setSpacing(mSpacingHint);
987 topLayout->setMargin(mMarginHint); 989 topLayout->setMargin(mMarginHint);
988 int iii = 0; 990 int iii = 0;
989 991
990 dummy = 992 dummy =
991 addWidBool(i18n("Use internal alarm notification"), 993 addWidBool(i18n("Use internal alarm notification"),
992 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 994 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
993 topLayout->addWidget(dummy->checkBox(),iii++,0); 995 topLayout->addWidget(dummy->checkBox(),iii++,0);
994 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); 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);
995 997
996 topLayout->addWidget(lab ,iii++,0); 998 topLayout->addWidget(lab ,iii++,0);
997#ifndef DESKTOP_VERSION 999#ifndef DESKTOP_VERSION
998 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1000 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
999#else 1001#else
1000 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1002 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1001 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1003 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1002#endif 1004#endif
1003 1005
1004 QHBox* dummyBox = new QHBox(topFrame); 1006 QHBox* dummyBox = new QHBox(topFrame);
1005 new QLabel(i18n("Play beeps count:"),dummyBox); 1007 new QLabel(i18n("Play beeps count:"),dummyBox);
1006 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 1008 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
1007 topLayout->addWidget(dummyBox,iii++,0); 1009 topLayout->addWidget(dummyBox,iii++,0);
1008 1010
1009 dummyBox = new QHBox(topFrame); 1011 dummyBox = new QHBox(topFrame);
1010 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 1012 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
1011 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 1013 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
1012 topLayout->addWidget(dummyBox,iii++,0); 1014 topLayout->addWidget(dummyBox,iii++,0);
1013 1015
1014 dummyBox = new QHBox(topFrame); 1016 dummyBox = new QHBox(topFrame);
1015 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1017 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1016 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1018 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1017 topLayout->addWidget(dummyBox,iii++,0); 1019 topLayout->addWidget(dummyBox,iii++,0);
1018 1020
1019 dummyBox = new QHBox(topFrame); 1021 dummyBox = new QHBox(topFrame);
1020 new QLabel(i18n("Auto suspend count:"),dummyBox); 1022 new QLabel(i18n("Auto suspend count:"),dummyBox);
1021 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1023 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1022 topLayout->addWidget(dummyBox,iii++,0); 1024 topLayout->addWidget(dummyBox,iii++,0);
1023 1025
1024 1026
1025 1027
1026 1028
1027 1029
1028 1030
1029 1031
1030 QHBox* hbo = new QHBox ( topFrame ); 1032 QHBox* hbo = new QHBox ( topFrame );
1031 mDefaultAlarmFile = new QLineEdit(hbo); 1033 mDefaultAlarmFile = new QLineEdit(hbo);
1032 QPushButton * loadTemplate = new QPushButton(hbo); 1034 QPushButton * loadTemplate = new QPushButton(hbo);
1033 QPixmap icon; 1035 QPixmap icon;
1034 if ( QApplication::desktop()->width() < 321 ) 1036 if ( QApplication::desktop()->width() < 321 )
1035 icon = SmallIcon("fileimport16"); 1037 icon = SmallIcon("fileimport16");
1036 else 1038 else
1037 icon = SmallIcon("fileimport"); 1039 icon = SmallIcon("fileimport");
1038 loadTemplate->setIconSet (icon ) ; 1040 loadTemplate->setIconSet (icon ) ;
1039 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1041 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1040 int size = loadTemplate->sizeHint().height(); 1042 int size = loadTemplate->sizeHint().height();
1041 loadTemplate->setFixedSize( size, size ); 1043 loadTemplate->setFixedSize( size, size );
1042 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1044 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1043 // topLayout->addWidget(lab ,iii++,0); 1045 // topLayout->addWidget(lab ,iii++,0);
1044 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1046 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1045 topLayout->addWidget(lab ,iii++,0); 1047 topLayout->addWidget(lab ,iii++,0);
1046 topLayout->addWidget(hbo,iii++,0); 1048 topLayout->addWidget(hbo,iii++,0);
1047 // 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); 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);
1048 1050
1049// topLayout->addWidget(lab ,iii++,0); 1051// topLayout->addWidget(lab ,iii++,0);
1050// #ifndef DESKTOP_VERSION 1052// #ifndef DESKTOP_VERSION
1051// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1053// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1052// #else 1054// #else
1053// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1055// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1054// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1056// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1055// #endif 1057// #endif
1056 1058
1057 1059
1058} 1060}
1059 1061
1060void KOPrefsDialog::selectSoundFile() 1062void KOPrefsDialog::selectSoundFile()
1061{ 1063{
1062 QString fileName = mDefaultAlarmFile->text(); 1064 QString fileName = mDefaultAlarmFile->text();
1063 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1065 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1064 if ( fileName.length() > 0 ) 1066 if ( fileName.length() > 0 )
1065 mDefaultAlarmFile->setText( fileName ); 1067 mDefaultAlarmFile->setText( fileName );
1066} 1068}
1067void KOPrefsDialog::setupFontsTab() 1069void KOPrefsDialog::setupFontsTab()
1068{ 1070{
1069 1071
1070 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1072 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1071 // DesktopIcon("fonts",KIcon::SizeMedium)); 1073 // DesktopIcon("fonts",KIcon::SizeMedium));
1072 1074
1073 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1075 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1074 topLayout->setSpacing(1); 1076 topLayout->setSpacing(1);
1075 topLayout->setMargin(3); 1077 topLayout->setMargin(3);
1076 KPrefsDialogWidFont * tVFont; 1078 KPrefsDialogWidFont * tVFont;
1077 int i = 0; 1079 int i = 0;
1078 KPrefsDialogWidFont *timeLabelsFont = 1080 KPrefsDialogWidFont *timeLabelsFont =
1079 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1081 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1080 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1082 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1081 topLayout->addWidget(timeLabelsFont->label(),i,0); 1083 topLayout->addWidget(timeLabelsFont->label(),i,0);
1082 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1084 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1083 topLayout->addWidget(timeLabelsFont->button(),i,2); 1085 topLayout->addWidget(timeLabelsFont->button(),i,2);
1084 ++i; 1086 ++i;
1085 1087
1086 1088
1087 timeLabelsFont = 1089 timeLabelsFont =
1088 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1090 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1089 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1091 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1090 topLayout->addWidget(timeLabelsFont->label(),i,0); 1092 topLayout->addWidget(timeLabelsFont->label(),i,0);
1091 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1093 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1092 topLayout->addWidget(timeLabelsFont->button(),i,2); 1094 topLayout->addWidget(timeLabelsFont->button(),i,2);
1093 ++i; 1095 ++i;
1094 1096
1095 KPrefsDialogWidFont *timeBarFont = 1097 KPrefsDialogWidFont *timeBarFont =
1096 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1098 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1097 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1099 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1098 topLayout->addWidget(timeBarFont->label(),i,0); 1100 topLayout->addWidget(timeBarFont->label(),i,0);
1099 topLayout->addWidget(timeBarFont->preview(),i,1); 1101 topLayout->addWidget(timeBarFont->preview(),i,1);
1100 topLayout->addWidget(timeBarFont->button(),i,2); 1102 topLayout->addWidget(timeBarFont->button(),i,2);
1101 ++i; 1103 ++i;
1102 1104
1103 1105
1104 KPrefsDialogWidFont *marcusBainsFont = 1106 KPrefsDialogWidFont *marcusBainsFont =
1105 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1107 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1106 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1108 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1107 topLayout->addWidget(marcusBainsFont->label(),i,0); 1109 topLayout->addWidget(marcusBainsFont->label(),i,0);
1108 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1110 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1109 topLayout->addWidget(marcusBainsFont->button(),i,2); 1111 topLayout->addWidget(marcusBainsFont->button(),i,2);
1110 ++i; 1112 ++i;
1111 1113
1112 tVFont = 1114 tVFont =
1113 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1115 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1114 &(KOPrefs::instance()->mEventViewFont),topFrame); 1116 &(KOPrefs::instance()->mEventViewFont),topFrame);
1115 topLayout->addWidget(tVFont->label(),i,0); 1117 topLayout->addWidget(tVFont->label(),i,0);
1116 topLayout->addWidget(tVFont->preview(),i,1); 1118 topLayout->addWidget(tVFont->preview(),i,1);
1117 topLayout->addWidget(tVFont->button(),i,2); 1119 topLayout->addWidget(tVFont->button(),i,2);
1118 ++i; 1120 ++i;
1119 1121
1120 1122
1121 1123
1122 tVFont = 1124 tVFont =
1123 addWidFont(i18n("Details"),i18n("EditorBox:"), 1125 addWidFont(i18n("Details"),i18n("EditorBox:"),
1124 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1126 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1125 topLayout->addWidget(tVFont->label(),i,0); 1127 topLayout->addWidget(tVFont->label(),i,0);
1126 topLayout->addWidget(tVFont->preview(),i,1); 1128 topLayout->addWidget(tVFont->preview(),i,1);
1127 topLayout->addWidget(tVFont->button(),i,2); 1129 topLayout->addWidget(tVFont->button(),i,2);
1128 ++i; 1130 ++i;
1129 1131
1130 1132
1131 1133
1132 topLayout->setColStretch(1,1); 1134 topLayout->setColStretch(1,1);
1133 topLayout->setRowStretch(4,1); 1135 topLayout->setRowStretch(4,1);
1134 1136
1135 1137
1136 i = 0; 1138 i = 0;
1137 topFrame = addPage(i18n("View Fonts"),0, 1139 topFrame = addPage(i18n("View Fonts"),0,
1138 DesktopIcon("fonts",KIcon::SizeMedium)); 1140 DesktopIcon("fonts",KIcon::SizeMedium));
1139 1141
1140 topLayout = new QGridLayout(topFrame,7,3); 1142 topLayout = new QGridLayout(topFrame,7,3);
1141 topLayout->setSpacing(1); 1143 topLayout->setSpacing(1);
1142 topLayout->setMargin(3); 1144 topLayout->setMargin(3);
1143 1145
1144 tVFont = 1146 tVFont =
1145 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1147 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1146 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1148 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1147 topLayout->addWidget(tVFont->label(),i,0); 1149 topLayout->addWidget(tVFont->label(),i,0);
1148 topLayout->addWidget(tVFont->preview(),i,1); 1150 topLayout->addWidget(tVFont->preview(),i,1);
1149 topLayout->addWidget(tVFont->button(),i,2); 1151 topLayout->addWidget(tVFont->button(),i,2);
1150 ++i; 1152 ++i;
1151 KPrefsDialogWidFont *agendaViewFont = 1153 KPrefsDialogWidFont *agendaViewFont =
1152 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1154 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1153 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1155 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1154 topLayout->addWidget(agendaViewFont->label(),i,0); 1156 topLayout->addWidget(agendaViewFont->label(),i,0);
1155 topLayout->addWidget(agendaViewFont->preview(),i,1); 1157 topLayout->addWidget(agendaViewFont->preview(),i,1);
1156 topLayout->addWidget(agendaViewFont->button(),i,2); 1158 topLayout->addWidget(agendaViewFont->button(),i,2);
1157 ++i; 1159 ++i;
1158 1160
1159 1161
1160 KPrefsDialogWidFont *monthViewFont = 1162 KPrefsDialogWidFont *monthViewFont =
1161 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1163 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1162 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1164 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1163 topLayout->addWidget(monthViewFont->label(),i,0); 1165 topLayout->addWidget(monthViewFont->label(),i,0);
1164 topLayout->addWidget(monthViewFont->preview(),i,1); 1166 topLayout->addWidget(monthViewFont->preview(),i,1);
1165 topLayout->addWidget(monthViewFont->button(),i,2); 1167 topLayout->addWidget(monthViewFont->button(),i,2);
1166 ++i; 1168 ++i;
1167 1169
1168 1170
1169 KPrefsDialogWidFont *lVFont = 1171 KPrefsDialogWidFont *lVFont =
1170 addWidFont(i18n("Event"),i18n("List View:"), 1172 addWidFont(i18n("Event"),i18n("List View:"),
1171 &(KOPrefs::instance()->mListViewFont),topFrame); 1173 &(KOPrefs::instance()->mListViewFont),topFrame);
1172 topLayout->addWidget(lVFont->label(),i,0); 1174 topLayout->addWidget(lVFont->label(),i,0);
1173 topLayout->addWidget(lVFont->preview(),i,1); 1175 topLayout->addWidget(lVFont->preview(),i,1);
1174 topLayout->addWidget(lVFont->button(),i,2); 1176 topLayout->addWidget(lVFont->button(),i,2);
1175 ++i; 1177 ++i;
1176 1178
1177 1179
1178 tVFont = 1180 tVFont =
1179 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1181 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1180 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1182 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1181 topLayout->addWidget(tVFont->label(),i,0); 1183 topLayout->addWidget(tVFont->label(),i,0);
1182 topLayout->addWidget(tVFont->preview(),i,1); 1184 topLayout->addWidget(tVFont->preview(),i,1);
1183 topLayout->addWidget(tVFont->button(),i,2); 1185 topLayout->addWidget(tVFont->button(),i,2);
1184 ++i; 1186 ++i;
1185 1187
1186 1188
1187 tVFont = 1189 tVFont =
1188 addWidFont(i18n("Today"),i18n("JournalView:"), 1190 addWidFont(i18n("Today"),i18n("JournalView:"),
1189 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1191 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1190 topLayout->addWidget(tVFont->label(),i,0); 1192 topLayout->addWidget(tVFont->label(),i,0);
1191 topLayout->addWidget(tVFont->preview(),i,1); 1193 topLayout->addWidget(tVFont->preview(),i,1);
1192 topLayout->addWidget(tVFont->button(),i,2); 1194 topLayout->addWidget(tVFont->button(),i,2);
1193 ++i; 1195 ++i;
1194 1196
1195 1197
1196 1198
1197 1199
1198 topLayout->setColStretch(1,1); 1200 topLayout->setColStretch(1,1);
1199 topLayout->setRowStretch(4,1); 1201 topLayout->setRowStretch(4,1);
1200 1202
1201 1203
1202 1204
1203 1205
1204} 1206}
1205 1207
1206void KOPrefsDialog::setupColorsTab() 1208void KOPrefsDialog::setupColorsTab()
1207{ 1209{
1208 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1210 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1209 // DesktopIcon("colorize",KIcon::SizeMedium)); 1211 // DesktopIcon("colorize",KIcon::SizeMedium));
1210 1212
1211 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1213 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1212 // topLayout->setSpacing(mSpacingHint); 1214 // topLayout->setSpacing(mSpacingHint);
1213 // topLayout->setMargin(mMarginHint); 1215 // topLayout->setMargin(mMarginHint);
1214 1216
1215 topLayout->setSpacing(2); 1217 topLayout->setSpacing(2);
1216 topLayout->setMargin(3); 1218 topLayout->setMargin(3);
1217 1219
1218 int ii = 1; 1220 int ii = 1;
1219 QGroupBox *categoryGroup ; 1221 QGroupBox *categoryGroup ;
1220 1222
1221 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1223 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1222 topFrame); 1224 topFrame);
1223 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1225 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1224 1226
1225 mCategoryCombo = new QComboBox(categoryGroup); 1227 mCategoryCombo = new QComboBox(categoryGroup);
1226 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1228 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1227 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1229 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1228 1230
1229 mCategoryButton = new KColorButton(categoryGroup); 1231 mCategoryButton = new KColorButton(categoryGroup);
1230 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1232 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1231 updateCategoryColor(); 1233 updateCategoryColor();
1232 1234
1233 1235
1234 // Holiday Color 1236 // Holiday Color
1235 1237
1236 KPrefsDialogWidColor *holidayColor = 1238 KPrefsDialogWidColor *holidayColor =
1237 addWidColor(i18n("Holiday color:"), 1239 addWidColor(i18n("Holiday color:"),
1238 &(KOPrefs::instance()->mHolidayColor),topFrame); 1240 &(KOPrefs::instance()->mHolidayColor),topFrame);
1239 topLayout->addWidget(holidayColor->label(),ii,0); 1241 topLayout->addWidget(holidayColor->label(),ii,0);
1240 topLayout->addWidget(holidayColor->button(),ii++,1); 1242 topLayout->addWidget(holidayColor->button(),ii++,1);
1241 1243
1242 // Highlight Color 1244 // Highlight Color
1243 KPrefsDialogWidColor *highlightColor = 1245 KPrefsDialogWidColor *highlightColor =
1244 addWidColor(i18n("Highlight color:"), 1246 addWidColor(i18n("Highlight color:"),
1245 &(KOPrefs::instance()->mHighlightColor),topFrame); 1247 &(KOPrefs::instance()->mHighlightColor),topFrame);
1246 topLayout->addWidget(highlightColor->label(),ii,0); 1248 topLayout->addWidget(highlightColor->label(),ii,0);
1247 topLayout->addWidget(highlightColor->button(),ii++,1); 1249 topLayout->addWidget(highlightColor->button(),ii++,1);
1248 1250
1249 // Event color 1251 // Event color
1250 KPrefsDialogWidColor *eventColor = 1252 KPrefsDialogWidColor *eventColor =
1251 addWidColor(i18n("Default event color:"), 1253 addWidColor(i18n("Default event color:"),
1252 &(KOPrefs::instance()->mEventColor),topFrame); 1254 &(KOPrefs::instance()->mEventColor),topFrame);
1253 topLayout->addWidget(eventColor->label(),ii,0); 1255 topLayout->addWidget(eventColor->label(),ii,0);
1254 topLayout->addWidget(eventColor->button(),ii++,1); 1256 topLayout->addWidget(eventColor->button(),ii++,1);
1255 eventColor = 1257 eventColor =
1256 addWidColor(i18n("Default todo done color:"), 1258 addWidColor(i18n("Default todo done color:"),
1257 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1259 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1258 topLayout->addWidget(eventColor->label(),ii,0); 1260 topLayout->addWidget(eventColor->label(),ii,0);
1259 topLayout->addWidget(eventColor->button(),ii++,1); 1261 topLayout->addWidget(eventColor->button(),ii++,1);
1260 1262
1261 1263
1262 // agenda view background color 1264 // agenda view background color
1263 KPrefsDialogWidColor *agendaBgColor = 1265 KPrefsDialogWidColor *agendaBgColor =
1264 addWidColor(i18n("Agenda view background color:"), 1266 addWidColor(i18n("Agenda view background color:"),
1265 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1267 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1266 topLayout->addWidget(agendaBgColor->label(),ii,0); 1268 topLayout->addWidget(agendaBgColor->label(),ii,0);
1267 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1269 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1268 1270
1269 // working hours color 1271 // working hours color
1270 KPrefsDialogWidColor *workingHoursColor = 1272 KPrefsDialogWidColor *workingHoursColor =
1271 addWidColor(i18n("Working hours color:"), 1273 addWidColor(i18n("Working hours color:"),
1272 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1274 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1273 topLayout->addWidget(workingHoursColor->label(),ii,0); 1275 topLayout->addWidget(workingHoursColor->label(),ii,0);
1274 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1276 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1275 1277
1276 KPrefsDialogWidBool *sb = 1278 KPrefsDialogWidBool *sb =
1277 addWidBool(i18n("Use colors for application:"), 1279 addWidBool(i18n("Use colors for application:"),
1278 &(KOPrefs::instance()->mUseAppColors),topFrame); 1280 &(KOPrefs::instance()->mUseAppColors),topFrame);
1279 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1281 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 406e741..f1f2dd2 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -90,738 +90,745 @@ void KOViewManager::readSettings(KConfig *config)
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} 320}
321 321
322void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 322void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
323{ 323{
324 mCurrentAgendaView = 0; 324 mCurrentAgendaView = 0;
325 if ( fullScreen ) { 325 if ( fullScreen ) {
326 mMainView->leftFrame()->hide(); 326 mMainView->leftFrame()->hide();
327 } else { 327 } else {
328 mMainView->leftFrame()->show(); 328 mMainView->leftFrame()->show();
329 } 329 }
330 //if ( mCurrentView == mMonthView ) qApp->processEvents(); 330 //if ( mCurrentView == mMonthView ) qApp->processEvents();
331 emit signalFullScreen( !fullScreen ); 331 emit signalFullScreen( !fullScreen );
332 if ( callUpdateView ) 332 if ( callUpdateView )
333 mMainView->updateView(); 333 mMainView->updateView();
334 334
335 if ( globalFlagBlockAgenda == 5 ) { 335 if ( globalFlagBlockAgenda == 5 ) {
336 globalFlagBlockAgenda = 4; 336 globalFlagBlockAgenda = 4;
337 globalFlagBlockAgendaItemPaint = 1; 337 globalFlagBlockAgendaItemPaint = 1;
338 } 338 }
339 mMainView->viewStack()->raiseWidget(mCurrentView); 339 mMainView->viewStack()->raiseWidget(mCurrentView);
340 if ( globalFlagBlockAgenda == 4 ) { 340 if ( globalFlagBlockAgenda == 4 ) {
341 if ( mCurrentView == mAgendaView ) { 341 if ( mCurrentView == mAgendaView ) {
342 //globalFlagBlockAgenda =1 ; 342 //globalFlagBlockAgenda =1 ;
343 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 343 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
344 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 344 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
345 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 345 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
346 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 346 mAgendaView->setStartHour( QTime::currentTime ().hour() );
347 qApp->processEvents(); 347 qApp->processEvents();
348 //qDebug("qApp->processEvents() "); 348 //qDebug("qApp->processEvents() ");
349 globalFlagBlockAgenda = 0; 349 globalFlagBlockAgenda = 0;
350 mAgendaView->repaintAgenda(); 350 mAgendaView->repaintAgenda();
351 351
352 } 352 }
353 globalFlagBlockAgenda = 0; 353 globalFlagBlockAgenda = 0;
354 } 354 }
355 emit signalAgendaView( mCurrentView == mAgendaView ); 355 emit signalAgendaView( mCurrentView == mAgendaView );
356 //qDebug("raiseCurrentView ende "); 356 //qDebug("raiseCurrentView ende ");
357 357
358} 358}
359 359
360void KOViewManager::updateView() 360void KOViewManager::updateView()
361{ 361{
362 // qDebug("KOViewManager::updateView() "); 362 // qDebug("KOViewManager::updateView() ");
363 // if we are updating mTodoView, we get endless recursion 363 // if we are updating mTodoView, we get endless recursion
364 if ( mTodoView == mCurrentView ) 364 if ( mTodoView == mCurrentView )
365 return; 365 return;
366 if ( mCurrentView ) mCurrentView->updateView(); 366 if ( mCurrentView ) mCurrentView->updateView();
367 367
368} 368}
369 369
370void KOViewManager::updateView(const QDate &start, const QDate &end) 370void KOViewManager::updateView(const QDate &start, const QDate &end)
371{ 371{
372 // kdDebug() << "KOViewManager::updateView()" << endl; 372 // kdDebug() << "KOViewManager::updateView()" << endl;
373 373
374 if (mCurrentView) mCurrentView->showDates(start, end); 374 if (mCurrentView) mCurrentView->showDates(start, end);
375 375
376 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 376 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
377} 377}
378 378
379 379
380void KOViewManager::updateWNview() 380void KOViewManager::updateWNview()
381{ 381{
382 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 382 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
383 mWhatsNextView->updateView(); 383 mWhatsNextView->updateView();
384 if ( mCurrentView == mMonthView && mMonthView ) 384 if ( mCurrentView == mMonthView && mMonthView )
385 mMonthView->updateView(); 385 mMonthView->updateView();
386 386
387} 387}
388void KOViewManager::showWhatsNextView() 388void KOViewManager::showWhatsNextView()
389{ 389{
390 if (!mWhatsNextView) { 390 if (!mWhatsNextView) {
391 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 391 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
392 "KOViewManager::WhatsNextView"); 392 "KOViewManager::WhatsNextView");
393 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 393 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
394 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 394 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
395 addView(mWhatsNextView); 395 addView(mWhatsNextView);
396 connect(this, SIGNAL( printWNV() ), 396 connect(this, SIGNAL( printWNV() ),
397 mWhatsNextView, SLOT( printMe() ) ); 397 mWhatsNextView, SLOT( printMe() ) );
398 } 398 }
399 globalFlagBlockAgenda = 1; 399 globalFlagBlockAgenda = 1;
400 showView(mWhatsNextView, true ); 400 showView(mWhatsNextView, true );
401 //mWhatsNextView->updateView(); 401 //mWhatsNextView->updateView();
402 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW; 402 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
403} 403}
404 404
405void KOViewManager::slotprintWNV() 405void KOViewManager::slotprintWNV()
406{ 406{
407 if (!mWhatsNextView) 407 if (!mWhatsNextView)
408 showWhatsNextView(); 408 showWhatsNextView();
409 emit printWNV(); 409 emit printWNV();
410 410
411} 411}
412void KOViewManager::showListView() 412void KOViewManager::showListView()
413{ 413{
414 if (!mListView) { 414 if (!mListView) {
415 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 415 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
416 addView(mListView); 416 addView(mListView);
417 417
418 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 418 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
419 mMainView, SLOT(showIncidence(Incidence *))); 419 mMainView, SLOT(showIncidence(Incidence *)));
420 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 420 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
421 mMainView, SLOT(editIncidence(Incidence *))); 421 mMainView, SLOT(editIncidence(Incidence *)));
422 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 422 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
423 mMainView, SLOT(deleteIncidence(Incidence *))); 423 mMainView, SLOT(deleteIncidence(Incidence *)));
424 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 424 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
425 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 425 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
426 connect( mListView, SIGNAL( signalNewEvent() ), 426 connect( mListView, SIGNAL( signalNewEvent() ),
427 mMainView, SLOT( newEvent() ) ); 427 mMainView, SLOT( newEvent() ) );
428 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 428 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
429 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 429 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
430 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 430 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
431 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 431 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
432 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 432 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
433 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 433 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
434 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 434 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
435 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 435 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
436 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 436 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
437 } 437 }
438 // bool temp = mFlagShowNextxDays; 438 // bool temp = mFlagShowNextxDays;
439 //globalFlagBlockPainting = true; 439 //globalFlagBlockPainting = true;
440 globalFlagBlockAgenda = 1; 440 globalFlagBlockAgenda = 1;
441 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 441 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
442 mMainView->setBlockShowDates( true ); 442 mMainView->setBlockShowDates( true );
443 mMainView->dateNavigator()->selectMonth(); 443 mMainView->dateNavigator()->selectMonth();
444 mMainView->setBlockShowDates( false ); 444 mMainView->setBlockShowDates( false );
445 } 445 }
446 showView(mListView, KOPrefs::instance()->mFullViewTodo); 446 showView(mListView, KOPrefs::instance()->mFullViewTodo);
447 //mFlagShowNextxDays = temp; 447 //mFlagShowNextxDays = temp;
448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
449} 449}
450 450
451void KOViewManager::showAgendaView( bool fullScreen ) 451void KOViewManager::showAgendaView( bool fullScreen )
452{ 452{
453 453
454 mMainView->dialogManager()->hideSearchDialog(); 454 mMainView->dialogManager()->hideSearchDialog();
455 // qDebug("KOViewManager::showAgendaView "); 455 // qDebug("KOViewManager::showAgendaView ");
456 bool full; 456 bool full;
457 full = fullScreen; 457 full = fullScreen;
458 if (!mAgendaView) { 458 if (!mAgendaView) {
459 full = false; 459 full = false;
460 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 460 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
461 addView(mAgendaView); 461 addView(mAgendaView);
462#ifndef DESKTOP_VERSION 462#ifndef DESKTOP_VERSION
463 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 463 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
464#endif 464#endif
465 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 465 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
466 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 466 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
467 467
468 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 468 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
469 469
470 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 470 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
471 471
472 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 472 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
473 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 473 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
474 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 474 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
475 mMainView, SLOT(newEvent(QDateTime))); 475 mMainView, SLOT(newEvent(QDateTime)));
476 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 476 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
477 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 477 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
478 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 478 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
479 mMainView, SLOT(newEvent(QDate))); 479 mMainView, SLOT(newEvent(QDate)));
480 480
481 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 481 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
482 mMainView, SLOT(editIncidence(Incidence *))); 482 mMainView, SLOT(editIncidence(Incidence *)));
483 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 483 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
484 mMainView, SLOT(showIncidence(Incidence *))); 484 mMainView, SLOT(showIncidence(Incidence *)));
485 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 485 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
486 mMainView, SLOT(deleteIncidence(Incidence *))); 486 mMainView, SLOT(deleteIncidence(Incidence *)));
487 487
488 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 488 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
489 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 489 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
490 490
491 connect(mAgendaView, SIGNAL( toggleExpand() ), 491 connect(mAgendaView, SIGNAL( toggleExpand() ),
492 mMainView, SLOT( toggleExpand() ) ); 492 mMainView, SLOT( toggleExpand() ) );
493 493
494 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 494 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
495 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 495 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
496 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 496 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
497 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 497 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
498 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 498 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
499 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 499 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
500 SLOT( updateTodo( Todo *, int ) ) ); 500 SLOT( updateTodo( Todo *, int ) ) );
501 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 501 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
502 mMainView, SIGNAL( todoModified( Todo *, int ))); 502 mMainView, SIGNAL( todoModified( Todo *, int )));
503 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 503 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
504 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 504 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
505 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 505 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
506 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
509 mAgendaView->readSettings(); 509 mAgendaView->readSettings();
510 mAgendaView->updateConfig(); 510 mAgendaView->updateConfig();
511 } 511 }
512 512
513 showView( mAgendaView, full); 513 showView( mAgendaView, full);
514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
515} 515}
516 516
517void KOViewManager::showDayView() 517void KOViewManager::showDayView()
518{ 518{
519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
520 mFlagShowNextxDays = false; 520 mFlagShowNextxDays = false;
521 globalFlagBlockLabel = 1; 521 globalFlagBlockLabel = 1;
522 globalFlagBlockAgenda = 1; 522 globalFlagBlockAgenda = 1;
523 if ( mCurrentAgendaView != 1 ) 523 if ( mCurrentAgendaView != 1 )
524 mCurrentAgendaView = -1; 524 mCurrentAgendaView = -1;
525 showAgendaView(); 525 showAgendaView();
526 qApp->processEvents(); 526 qApp->processEvents();
527 globalFlagBlockAgenda = 2; 527 globalFlagBlockAgenda = 2;
528 globalFlagBlockLabel = 0; 528 globalFlagBlockLabel = 0;
529 mMainView->dateNavigator()->selectDates( 1 ); 529 mMainView->dateNavigator()->selectDates( 1 );
530 mCurrentAgendaView = 1 ; 530 mCurrentAgendaView = 1 ;
531 531
532} 532}
533 533
534void KOViewManager::showWorkWeekView() 534void KOViewManager::showWorkWeekView()
535{ 535{
536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
537 mFlagShowNextxDays = false; 537 mFlagShowNextxDays = false;
538 globalFlagBlockAgenda = 1; 538 globalFlagBlockAgenda = 1;
539 globalFlagBlockLabel = 1; 539 globalFlagBlockLabel = 1;
540 if ( mCurrentAgendaView != 5 ) 540 if ( mCurrentAgendaView != 5 )
541 mCurrentAgendaView = -1; 541 mCurrentAgendaView = -1;
542 showAgendaView(); 542 showAgendaView();
543 qApp->processEvents(); 543 qApp->processEvents();
544 globalFlagBlockAgenda = 2; 544 globalFlagBlockAgenda = 2;
545 globalFlagBlockLabel = 0; 545 globalFlagBlockLabel = 0;
546 mMainView->dateNavigator()->selectWorkWeek(); 546 mMainView->dateNavigator()->selectWorkWeek();
547 mCurrentAgendaView = 5 ; 547 mCurrentAgendaView = 5 ;
548 548
549} 549}
550 550
551void KOViewManager::showWeekView() 551void KOViewManager::showWeekView()
552{ 552{
553 /* 553 /*
554 globalFlagBlockAgenda = 2; 554 globalFlagBlockAgenda = 2;
555 qDebug("4globalFlagBlockAgenda = 2; "); 555 qDebug("4globalFlagBlockAgenda = 2; ");
556 //globalFlagBlockPainting = true; 556 //globalFlagBlockPainting = true;
557 mMainView->dateNavigator()->selectWeek(); 557 mMainView->dateNavigator()->selectWeek();
558 showAgendaView(); 558 showAgendaView();
559 */ 559 */
560 560
561 561
562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
563 mFlagShowNextxDays = false; 563 mFlagShowNextxDays = false;
564 globalFlagBlockAgenda = 1; 564 globalFlagBlockAgenda = 1;
565 globalFlagBlockLabel = 1; 565 globalFlagBlockLabel = 1;
566 if ( mCurrentAgendaView != 7 ) 566 if ( mCurrentAgendaView != 7 )
567 mCurrentAgendaView = -1; 567 mCurrentAgendaView = -1;
568 showAgendaView(); 568 showAgendaView();
569 qApp->processEvents(); 569 qApp->processEvents();
570 globalFlagBlockAgenda = 2; 570 globalFlagBlockAgenda = 2;
571 globalFlagBlockLabel = 0; 571 globalFlagBlockLabel = 0;
572 mMainView->dateNavigator()->selectWeek(); 572 mMainView->dateNavigator()->selectWeek();
573 mCurrentAgendaView = 7 ; 573 mCurrentAgendaView = 7 ;
574} 574}
575 575
576void KOViewManager::showNextXView() 576void KOViewManager::showNextXView()
577{ 577{
578 578
579 globalFlagBlockAgenda = 1; 579 globalFlagBlockAgenda = 1;
580 if ( mCurrentAgendaView != 3 ) 580 if ( mCurrentAgendaView != 3 )
581 mCurrentAgendaView = -1; 581 mCurrentAgendaView = -1;
582 showAgendaView(KOPrefs::instance()->mFullViewMonth); 582 showAgendaView(KOPrefs::instance()->mFullViewMonth);
583 globalFlagBlockAgenda = 2; 583 globalFlagBlockAgenda = 2;
584 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 584 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
585 KOPrefs::instance()->mNextXDays ); 585 KOPrefs::instance()->mNextXDays );
586 mFlagShowNextxDays = true; 586 mFlagShowNextxDays = true;
587 mCurrentAgendaView = 3 ; 587 mCurrentAgendaView = 3 ;
588 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 588 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
589} 589}
590bool KOViewManager::showsNextDays() 590bool KOViewManager::showsNextDays()
591{ 591{
592 return mFlagShowNextxDays; 592 return mFlagShowNextxDays;
593} 593}
594void KOViewManager::createMonthView() 594void KOViewManager::createMonthView()
595{ 595{
596if (!mMonthView) { 596if (!mMonthView) {
597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
598 598
599 addView(mMonthView); 599 addView(mMonthView);
600 // mMonthView->show(); 600 // mMonthView->show();
601 // SIGNALS/SLOTS FOR MONTH VIEW 601 // SIGNALS/SLOTS FOR MONTH VIEW
602
603 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
604
605 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
606 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
607
608
602 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 609 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
603 mMainView, SLOT(newEvent(QDateTime))); 610 mMainView, SLOT(newEvent(QDateTime)));
604 611
605 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 612 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
606 mMainView, SLOT(showIncidence(Incidence *))); 613 mMainView, SLOT(showIncidence(Incidence *)));
607 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 614 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
608 mMainView, SLOT(editIncidence(Incidence *))); 615 mMainView, SLOT(editIncidence(Incidence *)));
609 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 616 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
610 mMainView, SLOT(deleteIncidence(Incidence *))); 617 mMainView, SLOT(deleteIncidence(Incidence *)));
611 618
612 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 619 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
613 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 620 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
614 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 621 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
615 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 622 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
616 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 623 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
617 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 624 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
618 625
619 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 626 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
620 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 627 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
621 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 628 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
622 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 629 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
623 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 630 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
624 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 631 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
625 connect( mMonthView, SIGNAL( selectMonth() ), 632 connect( mMonthView, SIGNAL( selectMonth() ),
626 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 633 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
627 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 634 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
628 mMainView, SLOT ( showDay( QDate ) ) ); 635 mMainView, SLOT ( showDay( QDate ) ) );
629 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 636 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
630 connect( mMonthView, SIGNAL(nextMonth() ), 637 connect( mMonthView, SIGNAL(nextMonth() ),
631 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 638 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
632 connect( mMonthView, SIGNAL(prevMonth() ), 639 connect( mMonthView, SIGNAL(prevMonth() ),
633 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 640 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
634 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 641 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
635 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 642 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
636 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 643 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
637 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 644 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
638 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 645 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
639 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 646 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
640 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 647 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
641 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 648 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
642 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 649 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
643 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 650 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
644 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 651 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
645 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 652 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
646 653
647 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 654 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
648 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 655 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
649 656
650 657
651 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 658 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
652 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 659 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
653 660
654 } 661 }
655} 662}
656void KOViewManager::showMonthViewWeek() 663void KOViewManager::showMonthViewWeek()
657{ 664{
658 createMonthView(); 665 createMonthView();
659 globalFlagBlockAgenda = 1; 666 globalFlagBlockAgenda = 1;
660 bool full = true; 667 bool full = true;
661 if ( mCurrentView == mMonthView) 668 if ( mCurrentView == mMonthView)
662 full = mMainView->leftFrame()->isVisible(); 669 full = mMainView->leftFrame()->isVisible();
663 if ( !KOPrefs::instance()->mMonthViewWeek ) { 670 if ( !KOPrefs::instance()->mMonthViewWeek ) {
664 mMonthView->switchView(); 671 mMonthView->switchView();
665 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 672 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
666 full = false; 673 full = false;
667 else 674 else
668 full = true; 675 full = true;
669 } 676 }
670 mMainView->dateNavigator()->selectWeek(); 677 mMainView->dateNavigator()->selectWeek();
671 showView(mMonthView, full ); 678 showView(mMonthView, full );
672 mMonthView->setKeyBFocus(); 679 mMonthView->setKeyBFocus();
673 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 680 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
674} 681}
675 682
676void KOViewManager::showMonth( const QDate & date ) 683void KOViewManager::showMonth( const QDate & date )
677{ 684{
678 mMainView->dateNavigator()->blockSignals( true ); 685 mMainView->dateNavigator()->blockSignals( true );
679 mMainView->dateNavigator()->selectDate( date ); 686 mMainView->dateNavigator()->selectDate( date );
680 mMainView->dateNavigator()->blockSignals( false ); 687 mMainView->dateNavigator()->blockSignals( false );
681 showMonthView(); 688 showMonthView();
682} 689}
683void KOViewManager::showMonthView() 690void KOViewManager::showMonthView()
684 { 691 {
685 692
686 createMonthView(); 693 createMonthView();
687 globalFlagBlockAgenda = 1; 694 globalFlagBlockAgenda = 1;
688 //mFlagShowNextxDays = false; 695 //mFlagShowNextxDays = false;
689 bool full = true; 696 bool full = true;
690 if ( mCurrentView == mMonthView) 697 if ( mCurrentView == mMonthView)
691 full = mMainView->leftFrame()->isVisible(); 698 full = mMainView->leftFrame()->isVisible();
692 // if(mMonthView == mCurrentView) return; 699 // if(mMonthView == mCurrentView) return;
693 if ( KOPrefs::instance()->mMonthViewWeek ) { 700 if ( KOPrefs::instance()->mMonthViewWeek ) {
694 mMonthView->switchView(); 701 mMonthView->switchView();
695 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 702 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
696 full = false; 703 full = false;
697 else 704 else
698 full = true; 705 full = true;
699 } 706 }
700 mMainView->dateNavigator()->selectMonth(); 707 mMainView->dateNavigator()->selectMonth();
701 708
702 showView(mMonthView, full ); 709 showView(mMonthView, full );
703 mMonthView->setKeyBFocus(); 710 mMonthView->setKeyBFocus();
704 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 711 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
705 712
706} 713}
707 714
708void KOViewManager::showTodoView() 715void KOViewManager::showTodoView()
709{ 716{
710 //mFlagShowNextxDays = false; 717 //mFlagShowNextxDays = false;
711 if ( !mTodoView ) { 718 if ( !mTodoView ) {
712 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 719 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
713 "KOViewManager::TodoView" ); 720 "KOViewManager::TodoView" );
714 721
715 addView( mTodoView ); 722 addView( mTodoView );
716 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 723 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
717 724
718 // SIGNALS/SLOTS FOR TODO VIEW 725 // SIGNALS/SLOTS FOR TODO VIEW
719 connect( mTodoView, SIGNAL( newTodoSignal() ), 726 connect( mTodoView, SIGNAL( newTodoSignal() ),
720 mMainView, SLOT( newTodo() ) ); 727 mMainView, SLOT( newTodo() ) );
721 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 728 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
722 mMainView, SLOT( newSubTodo( Todo *) ) ); 729 mMainView, SLOT( newSubTodo( Todo *) ) );
723 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 730 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
724 mMainView, SLOT( showTodo( Todo * ) ) ); 731 mMainView, SLOT( showTodo( Todo * ) ) );
725 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 732 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
726 mMainView, SLOT( editTodo( Todo * ) ) ); 733 mMainView, SLOT( editTodo( Todo * ) ) );
727 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 734 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
728 mMainView, SLOT( deleteTodo( Todo * ) ) ); 735 mMainView, SLOT( deleteTodo( Todo * ) ) );
729 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 736 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
730 mMainView, SLOT( purgeCompleted() ) ); 737 mMainView, SLOT( purgeCompleted() ) );
731 738
732 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 739 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
733 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 740 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
734 741
735 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 742 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
736 SLOT( updateConfig() ) ); 743 SLOT( updateConfig() ) );
737 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 744 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
738 SLOT( updateTodo( Todo *, int ) ) ); 745 SLOT( updateTodo( Todo *, int ) ) );
739 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 746 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
740 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 747 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
741 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 748 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
742 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 749 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
743 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 750 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
744 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 751 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
745 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 752 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
746 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 753 mMainView, SLOT ( todo_unsub( Todo * ) ) );
747 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 754 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
748 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 755 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
749 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 756 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
750 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 757 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
751 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 758 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
752 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 759 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
753 KConfig *config = KOGlobals::config(); 760 KConfig *config = KOGlobals::config();
754 mTodoView->restoreLayout(config,"Todo View"); 761 mTodoView->restoreLayout(config,"Todo View");
755 mTodoView->setNavigator( mMainView->dateNavigator() ); 762 mTodoView->setNavigator( mMainView->dateNavigator() );
756 } 763 }
757 764
758 globalFlagBlockAgenda = 1; 765 globalFlagBlockAgenda = 1;
759 showView( mTodoView, true ); 766 showView( mTodoView, true );
760 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 767 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
761 768
762} 769}
763 770
764void KOViewManager::showJournalView() 771void KOViewManager::showJournalView()
765{ 772{
766 //mFlagShowNextxDays = false; 773 //mFlagShowNextxDays = false;
767 if (!mJournalView) { 774 if (!mJournalView) {
768 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 775 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
769 "KOViewManager::JournalView"); 776 "KOViewManager::JournalView");
770 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 777 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
771 SLOT( updateConfig() ) ); 778 SLOT( updateConfig() ) );
772 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 779 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
773 addView(mJournalView); 780 addView(mJournalView);
774 } 781 }
775 782
776 showView(mJournalView); 783 showView(mJournalView);
777 mMainView->dateNavigator()->selectDates( 1 ); 784 mMainView->dateNavigator()->selectDates( 1 );
778 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 785 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
779} 786}
780 787
781void KOViewManager::showTimeSpanView() 788void KOViewManager::showTimeSpanView()
782{ 789{
783 //mFlagShowNextxDays = false; 790 //mFlagShowNextxDays = false;
784 if (!mTimeSpanView) { 791 if (!mTimeSpanView) {
785 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 792 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
786 "KOViewManager::TimeSpanView"); 793 "KOViewManager::TimeSpanView");
787 addView(mTimeSpanView); 794 addView(mTimeSpanView);
788 795
789 mTimeSpanView->readSettings(); 796 mTimeSpanView->readSettings();
790 } 797 }
791 798
792 showView(mTimeSpanView); 799 showView(mTimeSpanView);
793} 800}
794 801
795Incidence *KOViewManager::currentSelection() 802Incidence *KOViewManager::currentSelection()
796{ 803{
797 if (!mCurrentView) return 0; 804 if (!mCurrentView) return 0;
798 if ( mCurrentView == mListView ) { 805 if ( mCurrentView == mListView ) {
799 if ( mListView->currentItem() ) 806 if ( mListView->currentItem() )
800 return mListView->currentItem(); 807 return mListView->currentItem();
801 } 808 }
802 return mCurrentView->selectedIncidences().first(); 809 return mCurrentView->selectedIncidences().first();
803} 810}
804 811
805QDate KOViewManager::currentSelectionDate() 812QDate KOViewManager::currentSelectionDate()
806{ 813{
807 QDate qd; 814 QDate qd;
808 if (mCurrentView) { 815 if (mCurrentView) {
809 DateList qvl = mCurrentView->selectedDates(); 816 DateList qvl = mCurrentView->selectedDates();
810 if (!qvl.isEmpty()) qd = qvl.first(); 817 if (!qvl.isEmpty()) qd = qvl.first();
811 } 818 }
812 return qd; 819 return qd;
813} 820}
814 821
815void KOViewManager::addView(KOrg::BaseView *view) 822void KOViewManager::addView(KOrg::BaseView *view)
816{ 823{
817#if QT_VERSION >= 0x030000 824#if QT_VERSION >= 0x030000
818 mMainView->viewStack()->addWidget( view ); 825 mMainView->viewStack()->addWidget( view );
819#else 826#else
820 mMainView->viewStack()->addWidget( view, 1 ); 827 mMainView->viewStack()->addWidget( view, 1 );
821#endif 828#endif
822} 829}
823 830
824void KOViewManager::setDocumentId( const QString &id ) 831void KOViewManager::setDocumentId( const QString &id )
825{ 832{
826 if (mTodoView) mTodoView->setDocumentId( id ); 833 if (mTodoView) mTodoView->setDocumentId( id );
827} 834}