summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-25 02:23:09 (UTC)
committer zautrix <zautrix>2005-06-25 02:23:09 (UTC)
commit1d0b53abc70e66708d93b7081a21a7689b1a1303 (patch) (unidiff)
tree2a79eab02c3560af43af16162e2004adf507fb0f /korganizer
parentab93fa0a7cd97beada9475f6099bf6083547f0d6 (diff)
downloadkdepimpi-1d0b53abc70e66708d93b7081a21a7689b1a1303.zip
kdepimpi-1d0b53abc70e66708d93b7081a21a7689b1a1303.tar.gz
kdepimpi-1d0b53abc70e66708d93b7081a21a7689b1a1303.tar.bz2
fixx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp8
-rw-r--r--korganizer/koprefsdialog.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 93ff55e..c851ab5 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,1654 +1,1656 @@
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 <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#ifndef KORG_NOSPLITTER 29#ifndef KORG_NOSPLITTER
30#include <qsplitter.h> 30#include <qsplitter.h>
31#endif 31#endif
32#include <qfont.h> 32#include <qfont.h>
33#include <qfontmetrics.h> 33#include <qfontmetrics.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include <kapplication.h> 40#include <kapplication.h>
41#include <KDGanttMinimizeSplitter.h> 41#include <KDGanttMinimizeSplitter.h>
42#include <kdebug.h> 42#include <kdebug.h>
43#include <kstandarddirs.h> 43#include <kstandarddirs.h>
44#include <kiconloader.h> 44#include <kiconloader.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kconfig.h> 46#include <kconfig.h>
47#include <kglobal.h> 47#include <kglobal.h>
48#include "calendarview.h" 48#include "calendarview.h"
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50 50
51#include <libkcal/calendar.h> 51#include <libkcal/calendar.h>
52#include <libkcal/icaldrag.h> 52#include <libkcal/icaldrag.h>
53#include <libkcal/dndfactory.h> 53#include <libkcal/dndfactory.h>
54 54
55#include <kcalendarsystem.h> 55#include <kcalendarsystem.h>
56 56
57#include "koglobals.h" 57#include "koglobals.h"
58#ifndef KORG_NOPLUGINS 58#ifndef KORG_NOPLUGINS
59#include "kocore.h" 59#include "kocore.h"
60#endif 60#endif
61#include "koprefs.h" 61#include "koprefs.h"
62#include "koagenda.h" 62#include "koagenda.h"
63#include "koagendaitem.h" 63#include "koagendaitem.h"
64#ifndef KORG_NOPRINTER 64#ifndef KORG_NOPRINTER
65#include "calprinter.h" 65#include "calprinter.h"
66#endif 66#endif
67 67
68#include "koagendaview.h" 68#include "koagendaview.h"
69//#include "koagendaview.moc" 69//#include "koagendaview.moc"
70 70
71//extern bool globalFlagBlockPainting; 71//extern bool globalFlagBlockPainting;
72extern int globalFlagBlockAgenda; 72extern int globalFlagBlockAgenda;
73extern int globalFlagBlockStartup; 73extern int globalFlagBlockStartup;
74extern int globalFlagBlockAgendaItemPaint; 74extern int globalFlagBlockAgendaItemPaint;
75extern int globalFlagBlockAgendaItemUpdate; 75extern int globalFlagBlockAgendaItemUpdate;
76extern int globalFlagBlockLabel; 76extern int globalFlagBlockLabel;
77using namespace KOrg; 77using namespace KOrg;
78 78
79 79
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 myPix.resize( 1, 1 ); 84 myPix.resize( 1, 1 );
85 mRows = rows; 85 mRows = rows;
86 86
87 mRedrawNeeded = true; 87 mRedrawNeeded = true;
88 setMinimumHeight( 20 ); 88 setMinimumHeight( 20 );
89 mCellHeight = KOPrefs::instance()->mHourSize*4; 89 mCellHeight = KOPrefs::instance()->mHourSize*4;
90 90
91 enableClipper(true); 91 enableClipper(true);
92 92
93 setHScrollBarMode(AlwaysOff); 93 setHScrollBarMode(AlwaysOff);
94 setVScrollBarMode(AlwaysOff); 94 setVScrollBarMode(AlwaysOff);
95 95
96 resizeContents(50,mRows * mCellHeight); 96 resizeContents(50,mRows * mCellHeight);
97 97
98 viewport()->setBackgroundMode( PaletteBackground ); 98 viewport()->setBackgroundMode( PaletteBackground );
99} 99}
100 100
101void TimeLabels::setCellHeight(int height) 101void TimeLabels::setCellHeight(int height)
102{ 102{
103 mCellHeight = height; 103 mCellHeight = height;
104} 104}
105 105
106/* 106/*
107 Optimization so that only the "dirty" portion of the scroll view 107 Optimization so that only the "dirty" portion of the scroll view
108 is redrawn. Unfortunately, this is not called by default paintEvent() method. 108 is redrawn. Unfortunately, this is not called by default paintEvent() method.
109*/ 109*/
110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 110void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
111{ 111{
112 112
113 cx = contentsX() + frameWidth()*2; 113 cx = contentsX() + frameWidth()*2;
114 cw = contentsWidth() ; 114 cw = contentsWidth() ;
115 // end of workaround 115 // end of workaround
116 116
117 int cell = ((int)(cy/mCellHeight)); 117 int cell = ((int)(cy/mCellHeight));
118 int y = cell * mCellHeight; 118 int y = cell * mCellHeight;
119 QFontMetrics fm = fontMetrics(); 119 QFontMetrics fm = fontMetrics();
120 QString hour; 120 QString hour;
121 QString suffix = "am"; 121 QString suffix = "am";
122 int timeHeight = fm.ascent(); 122 int timeHeight = fm.ascent();
123 QFont nFont = font(); 123 QFont nFont = font();
124 p->setFont( font()); 124 p->setFont( font());
125 125
126 if (!KGlobal::locale()->use12Clock()) { 126 if (!KGlobal::locale()->use12Clock()) {
127 suffix = "00"; 127 suffix = "00";
128 } else 128 } else
129 if (cell > 11) suffix = "pm"; 129 if (cell > 11) suffix = "pm";
130 130
131 if ( timeHeight > mCellHeight ) { 131 if ( timeHeight > mCellHeight ) {
132 timeHeight = mCellHeight-1; 132 timeHeight = mCellHeight-1;
133 int pointS = nFont.pointSize(); 133 int pointS = nFont.pointSize();
134 while ( pointS > 4 ) { 134 while ( pointS > 4 ) {
135 nFont.setPointSize( pointS ); 135 nFont.setPointSize( pointS );
136 fm = QFontMetrics( nFont ); 136 fm = QFontMetrics( nFont );
137 if ( fm.ascent() < mCellHeight ) 137 if ( fm.ascent() < mCellHeight )
138 break; 138 break;
139 -- pointS; 139 -- pointS;
140 } 140 }
141 fm = QFontMetrics( nFont ); 141 fm = QFontMetrics( nFont );
142 timeHeight = fm.ascent(); 142 timeHeight = fm.ascent();
143 } 143 }
144 //timeHeight -= (timeHeight/4-2); 144 //timeHeight -= (timeHeight/4-2);
145 QFont sFont = nFont; 145 QFont sFont = nFont;
146 sFont.setPointSize( sFont.pointSize()/2 ); 146 sFont.setPointSize( sFont.pointSize()/2 );
147 QFontMetrics fmS( sFont ); 147 QFontMetrics fmS( sFont );
148 int sHei = fmS.ascent() ; 148 int sHei = fmS.ascent() ;
149 //sHei -= (sHei/4-2); 149 //sHei -= (sHei/4-2);
150 int startW = mMiniWidth - frameWidth()-2 ; 150 int startW = mMiniWidth - frameWidth()-2 ;
151 int tw2 = fmS.width(suffix); 151 int tw2 = fmS.width(suffix);
152 timeHeight = (timeHeight-1) /2 -1; 152 timeHeight = (timeHeight-1) /2 -1;
153 //testline 153 //testline
154 //p->drawLine(0,0,0,contentsHeight()); 154 //p->drawLine(0,0,0,contentsHeight());
155 while (y < cy + ch+mCellHeight) { 155 while (y < cy + ch+mCellHeight) {
156 p->drawLine(startW-tw2+1 ,y,cw+2,y); 156 p->drawLine(startW-tw2+1 ,y,cw+2,y);
157 hour.setNum(cell); 157 hour.setNum(cell);
158 // handle 24h and am/pm time formats 158 // handle 24h and am/pm time formats
159 if (KGlobal::locale()->use12Clock()) { 159 if (KGlobal::locale()->use12Clock()) {
160 if (cell == 12) suffix = "pm"; 160 if (cell == 12) suffix = "pm";
161 if (cell == 0) hour.setNum(12); 161 if (cell == 0) hour.setNum(12);
162 if (cell > 12) hour.setNum(cell - 12); 162 if (cell > 12) hour.setNum(cell - 12);
163 } 163 }
164 164
165 // center and draw the time label 165 // center and draw the time label
166 int timeWidth = fm.width(hour); 166 int timeWidth = fm.width(hour);
167 int offset = startW - timeWidth - tw2 -1 ; 167 int offset = startW - timeWidth - tw2 -1 ;
168 p->setFont( nFont ); 168 p->setFont( nFont );
169 p->drawText( offset, y+ timeHeight, hour); 169 p->drawText( offset, y+ timeHeight, hour);
170 p->setFont( sFont ); 170 p->setFont( sFont );
171 offset = startW - tw2; 171 offset = startW - tw2;
172 p->drawText( offset, y -1, suffix); 172 p->drawText( offset, y -1, suffix);
173 173
174 // increment indices 174 // increment indices
175 y += mCellHeight; 175 y += mCellHeight;
176 cell++; 176 cell++;
177 } 177 }
178 178
179 179
180 180
181 181
182} 182}
183 183
184/** 184/**
185 Calculates the minimum width. 185 Calculates the minimum width.
186*/ 186*/
187int TimeLabels::minimumWidth() const 187int TimeLabels::minimumWidth() const
188{ 188{
189 return mMiniWidth; 189 return mMiniWidth;
190} 190}
191 191
192/** updates widget's internal state */ 192/** updates widget's internal state */
193void TimeLabels::updateConfig() 193void TimeLabels::updateConfig()
194{ 194{
195 mRedrawNeeded = true; 195 mRedrawNeeded = true;
196 // set the font 196 // set the font
197 // config->setGroup("Fonts"); 197 // config->setGroup("Fonts");
198 // QFont font = config->readFontEntry("TimeBar Font"); 198 // QFont font = config->readFontEntry("TimeBar Font");
199 setFont(KOPrefs::instance()->mTimeBarFont); 199 setFont(KOPrefs::instance()->mTimeBarFont);
200 QString test = "20"; 200 QString test = "20";
201 if (KGlobal::locale()->use12Clock()) 201 if (KGlobal::locale()->use12Clock())
202 test = "12"; 202 test = "12";
203 mMiniWidth = fontMetrics().width(test); 203 mMiniWidth = fontMetrics().width(test);
204 if (KGlobal::locale()->use12Clock()) 204 if (KGlobal::locale()->use12Clock())
205 test = "pm"; 205 test = "pm";
206 else { 206 else {
207 test = "00"; 207 test = "00";
208 } 208 }
209 QFont sFont = font(); 209 QFont sFont = font();
210 sFont.setPointSize( sFont.pointSize()/2 ); 210 sFont.setPointSize( sFont.pointSize()/2 );
211 QFontMetrics fmS( sFont ); 211 QFontMetrics fmS( sFont );
212 mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ; 212 mMiniWidth += fmS.width( test ) + frameWidth()*2+4 ;
213 // update geometry restrictions based on new settings 213 // update geometry restrictions based on new settings
214 setFixedWidth( mMiniWidth ); 214 setFixedWidth( mMiniWidth );
215 215
216 // update HourSize 216 // update HourSize
217 mCellHeight = KOPrefs::instance()->mHourSize*4; 217 mCellHeight = KOPrefs::instance()->mHourSize*4;
218 resizeContents(mMiniWidth,mRows * mCellHeight+1); 218 resizeContents(mMiniWidth,mRows * mCellHeight+1);
219} 219}
220 220
221/** update time label positions */ 221/** update time label positions */
222void TimeLabels::positionChanged() 222void TimeLabels::positionChanged()
223{ 223{
224 int adjustment = mAgenda->contentsY(); 224 int adjustment = mAgenda->contentsY();
225 setContentsPos(0, adjustment); 225 setContentsPos(0, adjustment);
226} 226}
227 227
228/** */ 228/** */
229void TimeLabels::setAgenda(KOAgenda* agenda) 229void TimeLabels::setAgenda(KOAgenda* agenda)
230{ 230{
231 mAgenda = agenda; 231 mAgenda = agenda;
232} 232}
233 233
234void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 234void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
235{ 235{
236 mMouseDownY = e->pos().y(); 236 mMouseDownY = e->pos().y();
237 mOrgCap = topLevelWidget()->caption(); 237 mOrgCap = topLevelWidget()->caption();
238} 238}
239 239
240void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 240void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
241{ 241{
242 int diff = mMouseDownY - e->pos().y(); 242 int diff = mMouseDownY - e->pos().y();
243 if ( diff < 10 && diff > -10 ) 243 if ( diff < 10 && diff > -10 )
244 return; 244 return;
245 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 245 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
246 if ( tSize < 4 ) 246 if ( tSize < 4 )
247 tSize = 4; 247 tSize = 4;
248 if ( tSize > 22 ) 248 if ( tSize > 22 )
249 tSize = 22; 249 tSize = 22;
250 tSize = (tSize-2)/2; 250 tSize = (tSize-2)/2;
251 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 251 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
252 252
253} 253}
254void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 254void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
255{ 255{
256 topLevelWidget()->setCaption( mOrgCap ); 256 topLevelWidget()->setCaption( mOrgCap );
257 int diff = mMouseDownY - e->pos().y(); 257 int diff = mMouseDownY - e->pos().y();
258 if ( diff < 10 && diff > -10 ) 258 if ( diff < 10 && diff > -10 )
259 return; 259 return;
260 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 260 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
261 if ( tSize < 4 ) 261 if ( tSize < 4 )
262 tSize = 4; 262 tSize = 4;
263 if ( tSize > 22 ) 263 if ( tSize > 22 )
264 tSize = 22; 264 tSize = 22;
265 tSize = (tSize/2)*2; 265 tSize = (tSize/2)*2;
266 if ( tSize == KOPrefs::instance()->mHourSize ) 266 if ( tSize == KOPrefs::instance()->mHourSize )
267 return; 267 return;
268 KOPrefs::instance()->mHourSize = tSize; 268 KOPrefs::instance()->mHourSize = tSize;
269 emit scaleChanged(); 269 emit scaleChanged();
270} 270}
271 271
272/** This is called in response to repaint() */ 272/** This is called in response to repaint() */
273void TimeLabels::paintEvent(QPaintEvent*) 273void TimeLabels::paintEvent(QPaintEvent*)
274{ 274{
275 275
276 // kdDebug() << "paintevent..." << endl; 276 // kdDebug() << "paintevent..." << endl;
277 // this is another hack! 277 // this is another hack!
278 // QPainter painter(this); 278 // QPainter painter(this);
279 //QString c 279 //QString c
280 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 280 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
281} 281}
282 282
283//////////////////////////////////////////////////////////////////////////// 283////////////////////////////////////////////////////////////////////////////
284 284
285EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 285EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
286 : QFrame(parent,name) 286 : QFrame(parent,name)
287{ 287{
288 mColumns = 1; 288 mColumns = 1;
289 mTopBox = 0; 289 mTopBox = 0;
290 mLocation = loc; 290 mLocation = loc;
291 mTopLayout = 0; 291 mTopLayout = 0;
292 mPaintWidget = 0; 292 mPaintWidget = 0;
293 mXOffset = 0; 293 mXOffset = 0;
294 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 294 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
295 else mPixmap = SmallIcon("1downarrow"); 295 else mPixmap = SmallIcon("1downarrow");
296 mEnabled.resize(mColumns); 296 mEnabled.resize(mColumns);
297 mEnabled.fill( false ); 297 mEnabled.fill( false );
298 setMinimumHeight(mPixmap.height()); 298 setMinimumHeight(mPixmap.height());
299} 299}
300 300
301EventIndicator::~EventIndicator() 301EventIndicator::~EventIndicator()
302{ 302{
303} 303}
304 304
305void EventIndicator::drawContents(QPainter *p) 305void EventIndicator::drawContents(QPainter *p)
306{ 306{
307 307
308 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 308 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
309 KDGanttSplitterHandle* han = 0; 309 KDGanttSplitterHandle* han = 0;
310 if ( mPaintWidget ) 310 if ( mPaintWidget )
311 han = mPaintWidget->firstHandle(); 311 han = mPaintWidget->firstHandle();
312 if ( ! han ) { 312 if ( ! han ) {
313 int i; 313 int i;
314 for(i=0;i<mColumns;++i) { 314 for(i=0;i<mColumns;++i) {
315 if (mEnabled[i]) { 315 if (mEnabled[i]) {
316 int cellWidth = contentsRect().right()/mColumns; 316 int cellWidth = contentsRect().right()/mColumns;
317 int xOffset = KOGlobals::self()->reverseLayout() ? 317 int xOffset = KOGlobals::self()->reverseLayout() ?
318 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : 318 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 :
319 i*cellWidth + (cellWidth -mPixmap.width()) /2; 319 i*cellWidth + (cellWidth -mPixmap.width()) /2;
320 p->drawPixmap(QPoint(1+xOffset,0),mPixmap); 320 p->drawPixmap(QPoint(1+xOffset,0),mPixmap);
321 } 321 }
322 } 322 }
323 } else { 323 } else {
324 han->repaint(); 324 han->repaint();
325 //mPaintWidget->setBackgroundColor( red ); 325 //mPaintWidget->setBackgroundColor( red );
326 326
327 QPainter pa( han ); 327 QPainter pa( han );
328 int i; 328 int i;
329 bool setColor = false; 329 bool setColor = false;
330 for(i=0;i<mColumns;++i) { 330 for(i=0;i<mColumns;++i) {
331 if (mEnabled[i]) { 331 if (mEnabled[i]) {
332 setColor = true; 332 setColor = true;
333 333
334 int cellWidth = contentsRect().right()/mColumns; 334 int cellWidth = contentsRect().right()/mColumns;
335 int xOffset = KOGlobals::self()->reverseLayout() ? 335 int xOffset = KOGlobals::self()->reverseLayout() ?
336 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 336 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
337 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 337 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
338 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 338 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
339 //qDebug("222draw pix %d ",xOffset ); 339 //qDebug("222draw pix %d ",xOffset );
340 340
341 } 341 }
342 342
343 } 343 }
344 pa.end(); 344 pa.end();
345 345
346 } 346 }
347} 347}
348 348
349void EventIndicator::setXOffset( int x ) 349void EventIndicator::setXOffset( int x )
350{ 350{
351 mXOffset = x; 351 mXOffset = x;
352} 352}
353void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 353void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
354{ 354{
355 mPaintWidget = w; 355 mPaintWidget = w;
356 setMaximumHeight(0); 356 setMaximumHeight(0);
357 setMinimumHeight(0); 357 setMinimumHeight(0);
358} 358}
359void EventIndicator::changeColumns(int columns) 359void EventIndicator::changeColumns(int columns)
360{ 360{
361 mColumns = columns; 361 mColumns = columns;
362 mEnabled.resize(mColumns); 362 mEnabled.resize(mColumns);
363 363
364 update(); 364 update();
365} 365}
366 366
367void EventIndicator::enableColumn(int column, bool enable) 367void EventIndicator::enableColumn(int column, bool enable)
368{ 368{
369 mEnabled[column] = enable; 369 mEnabled[column] = enable;
370} 370}
371 371
372 372
373//////////////////////////////////////////////////////////////////////////// 373////////////////////////////////////////////////////////////////////////////
374//////////////////////////////////////////////////////////////////////////// 374////////////////////////////////////////////////////////////////////////////
375//////////////////////////////////////////////////////////////////////////// 375////////////////////////////////////////////////////////////////////////////
376 376
377KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 377KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
378 KOEventView (cal,parent,name) 378 KOEventView (cal,parent,name)
379{ 379{
380 mBlockUpdating = true; 380 mBlockUpdating = true;
381 mStartHour = 8; 381 mStartHour = 8;
382 mSelectedDates.append(QDate::currentDate()); 382 mSelectedDates.append(QDate::currentDate());
383 383
384 mLayoutDayLabels = 0; 384 mLayoutDayLabels = 0;
385 mDayLabelsFrame = 0; 385 mDayLabelsFrame = 0;
386 mDayLabels = 0; 386 mDayLabels = 0;
387 bool isRTL = KOGlobals::self()->reverseLayout(); 387 bool isRTL = KOGlobals::self()->reverseLayout();
388 QPixmap expandPix; 388 QPixmap expandPix;
389 if ( KOPrefs::instance()->mVerticalScreen ) { 389 if ( KOPrefs::instance()->mVerticalScreen ) {
390 expandPix = SmallIcon( "1updownarrow" ); 390 expandPix = SmallIcon( "1updownarrow" );
391 } else { 391 } else {
392 expandPix = SmallIcon("1leftrightarrow" ); 392 expandPix = SmallIcon("1leftrightarrow" );
393 } 393 }
394 394
395 QBoxLayout *topLayout = new QVBoxLayout(this); 395 QBoxLayout *topLayout = new QVBoxLayout(this);
396 396
397 // Create day name labels for agenda columns 397 // Create day name labels for agenda columns
398 // Create agenda splitter 398 // Create agenda splitter
399 399
400 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 400 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
401 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 401 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
402 topLayout->addWidget( mSplitterAgenda ); 402 topLayout->addWidget( mSplitterAgenda );
403 mAllDayFrame = new QHBox(mSplitterAgenda); 403 mAllDayFrame = new QHBox(mSplitterAgenda);
404 mAllDayFrame->setFocusPolicy(NoFocus); 404 mAllDayFrame->setFocusPolicy(NoFocus);
405 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 405 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
406 agendaFrame->setFocusPolicy(NoFocus); 406 agendaFrame->setFocusPolicy(NoFocus);
407 407
408 // Create all-day agenda widget 408 // Create all-day agenda widget
409 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 409 mDummyAllDayLeft = new QVBox( mAllDayFrame );
410 410
411 mExpandButton = new QPushButton(mDummyAllDayLeft); 411 mExpandButton = new QPushButton(mDummyAllDayLeft);
412 mExpandButton->setPixmap( expandPix ); 412 mExpandButton->setPixmap( expandPix );
413 int widebut = mExpandButton->sizeHint().width()+4; 413 int widebut = mExpandButton->sizeHint().width()+4;
414 int heibut = mExpandButton->sizeHint().height()+4; 414 int heibut = mExpandButton->sizeHint().height()+4;
415 if ( heibut > widebut ) 415 if ( heibut > widebut )
416 widebut = heibut ; 416 widebut = heibut ;
417 417
418 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 418 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
419 // QSizePolicy::Fixed ) ); 419 // QSizePolicy::Fixed ) );
420 mExpandButton->setFixedSize( widebut, widebut); 420 mExpandButton->setFixedSize( widebut, widebut);
421 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 421 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
422 mExpandButton->setFocusPolicy(NoFocus); 422 mExpandButton->setFocusPolicy(NoFocus);
423 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 423 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
424 mAllDayAgenda->setFocusPolicy(NoFocus); 424 mAllDayAgenda->setFocusPolicy(NoFocus);
425 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); 425 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
426 426
427 // Create event context menu for all day agenda 427 // Create event context menu for all day agenda
428 //mAllDayAgendaPopup = eventPopup(); 428 //mAllDayAgendaPopup = eventPopup();
429 429
430 // Create agenda frame 430 // Create agenda frame
431 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); 431 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
432 // QHBox *agendaFrame = new QHBox(splitterAgenda); 432 // QHBox *agendaFrame = new QHBox(splitterAgenda);
433 433
434 // create event indicator bars 434 // create event indicator bars
435 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 435 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
436#ifndef DESKTOP_VERSION 436#ifndef DESKTOP_VERSION
437 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 437 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
438#endif 438#endif
439 mDayLabelsFrame = new QHBox(agendaFrame); 439 mDayLabelsFrame = new QHBox(agendaFrame);
440 //topLayout->addWidget(mDayLabelsFrame); 440 //topLayout->addWidget(mDayLabelsFrame);
441 mDayLabels = new QFrame (mDayLabelsFrame); 441 mDayLabels = new QFrame (mDayLabelsFrame);
442 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 442 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
443 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); 443 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2);
444 agendaLayout->addWidget(mEventIndicatorTop,1,1); 444 agendaLayout->addWidget(mEventIndicatorTop,1,1);
445 445
446 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 446 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
447 agendaFrame); 447 agendaFrame);
448 agendaLayout->addWidget(mEventIndicatorBottom,3,1); 448 agendaLayout->addWidget(mEventIndicatorBottom,3,1);
449 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 449 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
450 agendaLayout->addWidget(dummyAgendaRight,1,2); 450 agendaLayout->addWidget(dummyAgendaRight,1,2);
451 451
452 // Create time labels 452 // Create time labels
453 mTimeLabels = new TimeLabels(24,agendaFrame); 453 mTimeLabels = new TimeLabels(24,agendaFrame);
454 agendaLayout->addWidget(mTimeLabels,2,0); 454 agendaLayout->addWidget(mTimeLabels,2,0);
455 connect(mTimeLabels,SIGNAL( scaleChanged()), 455 connect(mTimeLabels,SIGNAL( scaleChanged()),
456 this,SLOT(updateConfig())); 456 this,SLOT(updateConfig()));
457 457
458 // Create agenda 458 // Create agenda
459 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 459 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
460 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); 460 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
461 agendaLayout->setColStretch(1,1); 461 agendaLayout->setColStretch(1,1);
462 mAgenda->setFocusPolicy(NoFocus); 462 mAgenda->setFocusPolicy(NoFocus);
463 // Create event context menu for agenda 463 // Create event context menu for agenda
464 mAllAgendaPopup = eventPopup(); 464 mAllAgendaPopup = eventPopup();
465 465
466#if 0 466#if 0
467 mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 467 mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
468 i18n("Toggle Alarm"),mAgenda, 468 i18n("Toggle Alarm"),mAgenda,
469 SLOT(popupAlarm()),true); 469 SLOT(popupAlarm()),true);
470 470
471#endif 471#endif
472 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 472 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
473 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 473 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
474 474
475 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 475 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
476 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 476 mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
477 mAgenda->setPopup( mAllAgendaPopup ); 477 mAgenda->setPopup( mAllAgendaPopup );
478 mAllDayAgenda->setPopup( mAllAgendaPopup ); 478 mAllDayAgenda->setPopup( mAllAgendaPopup );
479 // make connections between dependent widgets 479 // make connections between dependent widgets
480 mTimeLabels->setAgenda(mAgenda); 480 mTimeLabels->setAgenda(mAgenda);
481 481
482 // Update widgets to reflect user preferences 482 // Update widgets to reflect user preferences
483 // updateConfig(); 483 // updateConfig();
484 484
485 // createDayLabels(); 485 // createDayLabels();
486 486
487 // these blank widgets make the All Day Event box line up with the agenda 487 // these blank widgets make the All Day Event box line up with the agenda
488 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 488 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
489 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 489 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
490 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 490 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
491 491
492 // Scrolling 492 // Scrolling
493 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 493 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
494 mTimeLabels, SLOT(positionChanged())); 494 mTimeLabels, SLOT(positionChanged()));
495 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 495 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
496 SLOT(setContentsPos(int))); 496 SLOT(setContentsPos(int)));
497 497
498 connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int ))); 498 connect(mAgenda,SIGNAL(showDateView( int, int)),SLOT(slotShowDateView( int, int )));
499 connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) )); 499 connect(mAllDayAgenda,SIGNAL(showDateView( int, int )), SLOT(slotShowDateView( int, int ) ));
500 500
501 // Create/Show/Edit/Delete Event 501 // Create/Show/Edit/Delete Event
502 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 502 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
503 SLOT(newEvent(int,int))); 503 SLOT(newEvent(int,int)));
504 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 504 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
505 SLOT(newTodo(int,int))); 505 SLOT(newTodo(int,int)));
506 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 506 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
507 SLOT(newEvent(int,int,int,int))); 507 SLOT(newEvent(int,int,int,int)));
508 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 508 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
509 SLOT(newEventAllDay(int,int))); 509 SLOT(newEventAllDay(int,int)));
510 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 510 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
511 SLOT(newTodoAllDay(int,int))); 511 SLOT(newTodoAllDay(int,int)));
512 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 512 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
513 SLOT(newEventAllDay(int,int))); 513 SLOT(newEventAllDay(int,int)));
514 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 514 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
515 SLOT(newTimeSpanSelected(int,int,int,int))); 515 SLOT(newTimeSpanSelected(int,int,int,int)));
516 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 516 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
517 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 517 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
518 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 518 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
519 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 519 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
520 520
521 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 521 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
522 SIGNAL(editIncidenceSignal(Incidence *))); 522 SIGNAL(editIncidenceSignal(Incidence *)));
523 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 523 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
524 SIGNAL(editIncidenceSignal(Incidence *))); 524 SIGNAL(editIncidenceSignal(Incidence *)));
525 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 525 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
526 SIGNAL(showIncidenceSignal(Incidence *))); 526 SIGNAL(showIncidenceSignal(Incidence *)));
527 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 527 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
528 SIGNAL(showIncidenceSignal(Incidence *))); 528 SIGNAL(showIncidenceSignal(Incidence *)));
529 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 529 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
530 SIGNAL(deleteIncidenceSignal(Incidence *))); 530 SIGNAL(deleteIncidenceSignal(Incidence *)));
531 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 531 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
532 SIGNAL(deleteIncidenceSignal(Incidence *))); 532 SIGNAL(deleteIncidenceSignal(Incidence *)));
533 533
534 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 534 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
535 SLOT(updateEventDates(KOAgendaItem *, int ))); 535 SLOT(updateEventDates(KOAgendaItem *, int )));
536 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 536 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
537 SLOT(updateEventDates(KOAgendaItem *, int))); 537 SLOT(updateEventDates(KOAgendaItem *, int)));
538 538
539 // event indicator update 539 // event indicator update
540 connect(mAgenda,SIGNAL(lowerYChanged(int)), 540 connect(mAgenda,SIGNAL(lowerYChanged(int)),
541 SLOT(updateEventIndicatorTop(int))); 541 SLOT(updateEventIndicatorTop(int)));
542 connect(mAgenda,SIGNAL(upperYChanged(int)), 542 connect(mAgenda,SIGNAL(upperYChanged(int)),
543 SLOT(updateEventIndicatorBottom(int))); 543 SLOT(updateEventIndicatorBottom(int)));
544 // drag signals 544 // drag signals
545 /* 545 /*
546 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 546 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
547 SLOT(startDrag(Event *))); 547 SLOT(startDrag(Event *)));
548 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 548 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
549 SLOT(startDrag(Event *))); 549 SLOT(startDrag(Event *)));
550 */ 550 */
551 // synchronize selections 551 // synchronize selections
552 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 552 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
553 mAllDayAgenda, SLOT( deselectItem() ) ); 553 mAllDayAgenda, SLOT( deselectItem() ) );
554 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 554 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
555 mAgenda, SLOT( deselectItem() ) ); 555 mAgenda, SLOT( deselectItem() ) );
556 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 556 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
557 SIGNAL( incidenceSelected( Incidence * ) ) ); 557 SIGNAL( incidenceSelected( Incidence * ) ) );
558 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 558 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
559 SIGNAL( incidenceSelected( Incidence * ) ) ); 559 SIGNAL( incidenceSelected( Incidence * ) ) );
560 connect( mAgenda, SIGNAL( resizedSignal() ), 560 connect( mAgenda, SIGNAL( resizedSignal() ),
561 SLOT( updateConfig( ) ) ); 561 SLOT( updateConfig( ) ) );
562 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 562 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
563 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 563 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
564 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 564 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
565 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 565 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
566 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 566 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
567 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 567 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
568 568
569 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); 569 connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) );
570 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); 570 connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) );
571 571
572} 572}
573 573
574void KOAgendaView::toggleAllDay() 574void KOAgendaView::toggleAllDay()
575{ 575{
576 if ( mSplitterAgenda->firstHandle() ) 576 if ( mSplitterAgenda->firstHandle() )
577 mSplitterAgenda->firstHandle()->toggle(); 577 mSplitterAgenda->firstHandle()->toggle();
578} 578}
579void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 579void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
580{ 580{
581 calendar()->addIncidence( inc ); 581 calendar()->addIncidence( inc );
582 582
583 if ( incOld ) { 583 if ( incOld ) {
584 if ( incOld->typeID() == todoID ) 584 if ( incOld->typeID() == todoID )
585 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 585 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
586 else 586 else
587 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 587 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
588 } 588 }
589 589
590} 590}
591 591
592KOAgendaView::~KOAgendaView() 592KOAgendaView::~KOAgendaView()
593{ 593{
594 delete mAllAgendaPopup; 594 delete mAllAgendaPopup;
595 //delete mAllDayAgendaPopup; 595 //delete mAllDayAgendaPopup;
596 delete KOAgendaItem::paintPix(); 596 delete KOAgendaItem::paintPix();
597 delete KOAgendaItem::paintPixSel(); 597 delete KOAgendaItem::paintPixSel();
598} 598}
599void KOAgendaView::resizeEvent( QResizeEvent* e ) 599void KOAgendaView::resizeEvent( QResizeEvent* e )
600{ 600{
601 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 601 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
602 bool uc = false; 602 bool uc = false;
603 int ow = e->oldSize().width(); 603 int ow = e->oldSize().width();
604 int oh = e->oldSize().height(); 604 int oh = e->oldSize().height();
605 int w = e->size().width(); 605 int w = e->size().width();
606 int h = e->size().height(); 606 int h = e->size().height();
607 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 607 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
608 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 608 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
609 uc = true; 609 uc = true;
610 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 610 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
611 } 611 }
612 mUpcomingWidth = e->size().width() ; 612 mUpcomingWidth = e->size().width() ;
613 if ( mBlockUpdating || uc ) { 613 if ( mBlockUpdating || uc ) {
614 mBlockUpdating = false; 614 mBlockUpdating = false;
615 //mAgenda->setMinimumSize(800 , 600 ); 615 //mAgenda->setMinimumSize(800 , 600 );
616 //qDebug("mAgenda->resize+++++++++++++++ "); 616 //qDebug("mAgenda->resize+++++++++++++++ ");
617 updateConfig(); 617 updateConfig();
618 //qDebug("KOAgendaView::Updating now possible "); 618 //qDebug("KOAgendaView::Updating now possible ");
619 } else 619 } else
620 createDayLabels(); 620 createDayLabels();
621 //qDebug("resizeEvent end "); 621 //qDebug("resizeEvent end ");
622 622
623} 623}
624void KOAgendaView::slotDaylabelClicked( int num ) 624void KOAgendaView::slotDaylabelClicked( int num )
625{ 625{
626 626
627 QDate firstDate = mSelectedDates.first(); 627 QDate firstDate = mSelectedDates.first();
628 if ( num == -1 ) 628 if ( num == -1 )
629 emit showDateView( 6, firstDate ); 629 emit showDateView( 6, firstDate );
630 else if (num >= 0 ) { 630 else if (num >= 0 ) {
631 if ( mSelectedDates.count() == 1) 631 if ( mSelectedDates.count() == 1)
632 emit showDateView( 9, firstDate.addDays( num ) ); 632 emit showDateView( 9, firstDate.addDays( num ) );
633 else 633 else
634 emit showDateView( 3, firstDate.addDays( num ) ); 634 emit showDateView( 3, firstDate.addDays( num ) );
635 } 635 }
636 else 636 else
637 showDateView( 10, firstDate.addDays(1) ); 637 showDateView( 10, firstDate.addDays(1) );
638} 638}
639 639
640KOAgendaButton* KOAgendaView::getNewDaylabel() 640KOAgendaButton* KOAgendaView::getNewDaylabel()
641{ 641{
642 642
643 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); 643 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
644 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); 644 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
645 mDayLabelsList.append( dayLabel ); 645 mDayLabelsList.append( dayLabel );
646 mLayoutDayLabels->addWidget(dayLabel); 646 mLayoutDayLabels->addWidget(dayLabel);
647 return dayLabel ; 647 return dayLabel ;
648} 648}
649 649
650void KOAgendaView::createDayLabels() 650void KOAgendaView::createDayLabels()
651{ 651{
652 652
653 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 653 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
654 // qDebug(" KOAgendaView::createDayLabels() blocked "); 654 // qDebug(" KOAgendaView::createDayLabels() blocked ");
655 return; 655 return;
656 656
657 } 657 }
658 int newHight; 658 int newHight;
659 if ( !mSelectedDates.count()) 659 if ( !mSelectedDates.count())
660 return; 660 return;
661 661
662 // ### Before deleting and recreating we could check if mSelectedDates changed... 662 // ### Before deleting and recreating we could check if mSelectedDates changed...
663 // It would remove some flickering and gain speed (since this is called by 663 // It would remove some flickering and gain speed (since this is called by
664 // each updateView() call) 664 // each updateView() call)
665 665
666 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; 666 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2;
667 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 667 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
668 if ( maxWid < 20 ) 668 if ( maxWid < 20 )
669 maxWid = 20; 669 maxWid = 20;
670 670
671 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 671 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
672 QFontMetrics fm ( dlf ); 672 QFontMetrics fm ( dlf );
673 dlf.setBold( true );
673 int selCount = mSelectedDates.count(); 674 int selCount = mSelectedDates.count();
674 int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; 675 int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1;
675 QString dayTest = "Mon 20"; 676 QString dayTest = "Mon 20";
676 //QString dayTest = "Mon 20"; 677 //QString dayTest = "Mon 20";
677 int wid = fm.width( dayTest ); 678 int wid = fm.width( dayTest );
678 //maxWid -= ( selCount * 3 ); //working for QLabels 679 //maxWid -= ( selCount * 3 ); //working for QLabels
679 if ( QApplication::desktop()->width() <= 320 ) 680 if ( QApplication::desktop()->width() <= 320 )
680 maxWid -= ( selCount * 3 ); //working for QPushButton 681 maxWid -= ( selCount * 3 ); //working for QPushButton
681 else 682 else
682 maxWid -= ( selCount * 3 ); //working for QPushButton 683 maxWid -= ( selCount * 4 ); //working for QPushButton
683 if ( maxWid < 0 ) 684 if ( maxWid < 0 )
684 maxWid = 20; 685 maxWid = 20;
685 int needWid = wid * selCount; 686 int needWid = wid * selCount;
686 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 687 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
687 //if ( needWid > maxWid ) 688 //if ( needWid > maxWid )
688 // qDebug("DAYLABELS TOOOOOOO BIG "); 689 // qDebug("DAYLABELS TOOOOOOO BIG ");
689 while ( needWid > maxWid ) { 690 while ( needWid > maxWid ) {
690 dayTest = dayTest.left( dayTest.length() - 1 ); 691 dayTest = dayTest.left( dayTest.length() - 1 );
691 wid = fm.width( dayTest ); 692 wid = fm.width( dayTest );
692 needWid = wid * selCount; 693 needWid = wid * selCount;
693 } 694 }
694 int maxLen = dayTest.length(); 695 int maxLen = dayTest.length();
695 int fontPoint = dlf.pointSize(); 696 int fontPoint = dlf.pointSize();
696 if ( maxLen < 2 ) { 697 if ( maxLen < 2 ) {
697 int fontPoint = dlf.pointSize(); 698 int fontPoint = dlf.pointSize();
698 while ( fontPoint > 4 ) { 699 while ( fontPoint > 4 ) {
699 --fontPoint; 700 --fontPoint;
700 dlf.setPointSize( fontPoint ); 701 dlf.setPointSize( fontPoint );
701 QFontMetrics f( dlf ); 702 QFontMetrics f( dlf );
702 wid = f.width( "30" ); 703 wid = f.width( "30" );
703 needWid = wid * selCount; 704 needWid = wid * selCount;
704 if ( needWid < maxWid ) 705 if ( needWid < maxWid )
705 break; 706 break;
706 } 707 }
707 maxLen = 2; 708 maxLen = 2;
708 } 709 }
709 //qDebug("Max len %d ", dayTest.length() ); 710 //qDebug("Max len %d ", dayTest.length() );
710 711 if ( !KOPrefs::instance()->mTimeLabelsFont.bold() )
712 dlf.setBold( false );
711 QFontMetrics tempF( dlf ); 713 QFontMetrics tempF( dlf );
712 newHight = tempF.height(); 714 newHight = tempF.height();
713 mDayLabels->setFont( dlf ); 715 mDayLabels->setFont( dlf );
714 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; 716 // mLayoutDayLabels = new QHBoxLayout(mDayLabels);;
715 // mLayoutDayLabels->addSpacing(mTimeLabels->width()); 717 // mLayoutDayLabels->addSpacing(mTimeLabels->width());
716 //mLayoutDayLabels->addSpacing( 2 ); 718 //mLayoutDayLabels->addSpacing( 2 );
717 // QFont lFont = dlf; 719 // QFont lFont = dlf;
718 bool appendLabels = false; 720 bool appendLabels = false;
719 KOAgendaButton *dayLabel; 721 KOAgendaButton *dayLabel;
720 dayLabel = mDayLabelsList.first(); 722 dayLabel = mDayLabelsList.first();
721 if ( !dayLabel ) { 723 if ( !dayLabel ) {
722 appendLabels = true; 724 appendLabels = true;
723 dayLabel = getNewDaylabel(); 725 dayLabel = getNewDaylabel();
724 } 726 }
725 dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); 727 dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() );
726 dayLabel->setFont( dlf ); 728 dayLabel->setFont( dlf );
727 dayLabel->setNum( -1 ); 729 dayLabel->setNum( -1 );
728 //dayLabel->setAlignment(QLabel::AlignHCenter); 730 //dayLabel->setAlignment(QLabel::AlignHCenter);
729 731
730 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); 732 dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
731 dayLabel->show(); 733 dayLabel->show();
732 DateList::ConstIterator dit; 734 DateList::ConstIterator dit;
733 bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); 735 bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
734 int counter = -1; 736 int counter = -1;
735 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 737 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
736 ++counter; 738 ++counter;
737 QDate date = *dit; 739 QDate date = *dit;
738 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); 740 // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
739 if ( ! appendLabels ) { 741 if ( ! appendLabels ) {
740 dayLabel = mDayLabelsList.next(); 742 dayLabel = mDayLabelsList.next();
741 if ( !dayLabel ) 743 if ( !dayLabel )
742 appendLabels = true; 744 appendLabels = true;
743 } 745 }
744 if ( appendLabels ) { 746 if ( appendLabels ) {
745 dayLabel = getNewDaylabel(); 747 dayLabel = getNewDaylabel();
746 } 748 }
747 dayLabel->setMinimumWidth( 1 ); 749 dayLabel->setMinimumWidth( 1 );
748 dayLabel->setMaximumWidth( 10240 ); 750 dayLabel->setMaximumWidth( 10240 );
749 dayLabel->setFont( dlf ); 751 dayLabel->setFont( dlf );
750 dayLabel->show(); 752 dayLabel->show();
751 dayLabel->setAutoRepeat( false ); 753 dayLabel->setAutoRepeat( false );
752 dayLabel->setNum( counter ); 754 dayLabel->setNum( counter );
753 QString str; 755 QString str;
754 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); 756 int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
755 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); 757 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true );
756 switch ( maxLen ) { 758 switch ( maxLen ) {
757 case 2: 759 case 2:
758 str = QString::number( date.day() ); 760 str = QString::number( date.day() );
759 break; 761 break;
760 762
761 case 3: 763 case 3:
762 str = dayName.left( 1 ) +QString::number( date.day()); 764 str = dayName.left( 1 ) +QString::number( date.day());
763 765
764 break; 766 break;
765 case 4: 767 case 4:
766 str = dayName.left( 1 ) + " " +QString::number( date.day()); 768 str = dayName.left( 1 ) + " " +QString::number( date.day());
767 769
768 break; 770 break;
769 case 5: 771 case 5:
770 str = dayName.left( 2 ) + " " +QString::number( date.day()); 772 str = dayName.left( 2 ) + " " +QString::number( date.day());
771 773
772 break; 774 break;
773 case 6: 775 case 6:
774 str = dayName.left( 3 ) + " " +QString::number( date.day()); 776 str = dayName.left( 3 ) + " " +QString::number( date.day());
775 break; 777 break;
776 778
777 default: 779 default:
778 break; 780 break;
779 } 781 }
780 if ( oneday ) { 782 if ( oneday ) {
781 QString addString; 783 QString addString;
782 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) 784 if ( mSelectedDates.first() == QDateTime::currentDateTime().date() )
783 addString = i18n("Today"); 785 addString = i18n("Today");
784 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) 786 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
785 addString = i18n("Tomorrow"); 787 addString = i18n("Tomorrow");
786 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) 788 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
787 addString = i18n("Yesterday"); 789 addString = i18n("Yesterday");
788 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) 790 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
789 addString = i18n("Day before yesterday"); 791 addString = i18n("Day before yesterday");
790 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) 792 else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
791 addString = i18n("Day after tomorrow"); 793 addString = i18n("Day after tomorrow");
792 if ( !addString.isEmpty() ) { 794 if ( !addString.isEmpty() ) {
793 str = addString+", " + str; 795 str = addString+", " + str;
794 } else { 796 } else {
795 str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); 797 str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer);
796 } 798 }
797 } 799 }
798 dayLabel->setText(str); 800 dayLabel->setText(str);
799 //dayLabel->setAlignment(QLabel::AlignHCenter); 801 //dayLabel->setAlignment(QLabel::AlignHCenter);
800 if (date == QDate::currentDate()) { 802 if (date == QDate::currentDate()) {
801 QFont bFont = dlf; 803 QFont bFont = dlf;
802 bFont.setBold( true ); 804 bFont.setBold( true );
803 dayLabel->setFont(bFont); 805 dayLabel->setFont(bFont);
804 } 806 }
805 //dayLayout->addWidget(dayLabel); 807 //dayLayout->addWidget(dayLabel);
806 808
807#ifndef KORG_NOPLUGINS 809#ifndef KORG_NOPLUGINS
808 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 810 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
809 CalendarDecoration *it; 811 CalendarDecoration *it;
810 for(it = cds.first(); it; it = cds.next()) { 812 for(it = cds.first(); it; it = cds.next()) {
811 QString text = it->shortText( date ); 813 QString text = it->shortText( date );
812 if ( !text.isEmpty() ) { 814 if ( !text.isEmpty() ) {
813 QLabel *label = new QLabel(text,mDayLabels); 815 QLabel *label = new QLabel(text,mDayLabels);
814 label->setAlignment(AlignCenter); 816 label->setAlignment(AlignCenter);
815 dayLayout->addWidget(label); 817 dayLayout->addWidget(label);
816 } 818 }
817 } 819 }
818 820
819 for(it = cds.first(); it; it = cds.next()) { 821 for(it = cds.first(); it; it = cds.next()) {
820 QWidget *wid = it->smallWidget(mDayLabels,date); 822 QWidget *wid = it->smallWidget(mDayLabels,date);
821 if ( wid ) { 823 if ( wid ) {
822 // wid->setHeight(20); 824 // wid->setHeight(20);
823 dayLayout->addWidget(wid); 825 dayLayout->addWidget(wid);
824 } 826 }
825 } 827 }
826#endif 828#endif
827 } 829 }
828 if ( ! appendLabels ) { 830 if ( ! appendLabels ) {
829 dayLabel = mDayLabelsList.next(); 831 dayLabel = mDayLabelsList.next();
830 if ( !dayLabel ) 832 if ( !dayLabel )
831 appendLabels = true; 833 appendLabels = true;
832 } 834 }
833 if ( appendLabels ) { 835 if ( appendLabels ) {
834 dayLabel = getNewDaylabel(); 836 dayLabel = getNewDaylabel();
835 } 837 }
836 //dayLabel->hide();//test only 838 //dayLabel->hide();//test only
837 839
838 dayLabel->setText(">"); 840 dayLabel->setText(">");
839 dayLabel->setFont( dlf ); 841 dayLabel->setFont( dlf );
840 dayLabel->setAutoRepeat( true ); 842 dayLabel->setAutoRepeat( true );
841 dayLabel->show(); 843 dayLabel->show();
842 dayLabel->setNum( -2 ); 844 dayLabel->setNum( -2 );
843 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ widModulo ); 845 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ widModulo );
844 846
845 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 847 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
846 if ( !appendLabels ) { 848 if ( !appendLabels ) {
847 dayLabel = mDayLabelsList.next(); 849 dayLabel = mDayLabelsList.next();
848 while ( dayLabel ) { 850 while ( dayLabel ) {
849 //qDebug("!dayLabel %d",dayLabel ); 851 //qDebug("!dayLabel %d",dayLabel );
850 dayLabel->hide(); 852 dayLabel->hide();
851 dayLabel = mDayLabelsList.next(); 853 dayLabel = mDayLabelsList.next();
852 } 854 }
853 } 855 }
854 856
855 mDayLabelsFrame->setFixedHeight( newHight + 4 ); 857 mDayLabelsFrame->setFixedHeight( newHight + 4 );
856} 858}
857 859
858int KOAgendaView::maxDatesHint() 860int KOAgendaView::maxDatesHint()
859{ 861{
860 // Not sure about the max number of events, so return 0 for now. 862 // Not sure about the max number of events, so return 0 for now.
861 return 0; 863 return 0;
862} 864}
863 865
864int KOAgendaView::currentDateCount() 866int KOAgendaView::currentDateCount()
865{ 867{
866 return mSelectedDates.count(); 868 return mSelectedDates.count();
867} 869}
868 870
869QPtrList<Incidence> KOAgendaView::selectedIncidences() 871QPtrList<Incidence> KOAgendaView::selectedIncidences()
870{ 872{
871 QPtrList<Incidence> selected; 873 QPtrList<Incidence> selected;
872 Incidence *incidence; 874 Incidence *incidence;
873 875
874 incidence = mAgenda->selectedIncidence(); 876 incidence = mAgenda->selectedIncidence();
875 if (incidence) selected.append(incidence); 877 if (incidence) selected.append(incidence);
876 878
877 incidence = mAllDayAgenda->selectedIncidence(); 879 incidence = mAllDayAgenda->selectedIncidence();
878 if (incidence) selected.append(incidence); 880 if (incidence) selected.append(incidence);
879 881
880 return selected; 882 return selected;
881} 883}
882 884
883DateList KOAgendaView::selectedDates() 885DateList KOAgendaView::selectedDates()
884{ 886{
885 DateList selected; 887 DateList selected;
886 QDate qd; 888 QDate qd;
887 889
888 qd = mAgenda->selectedIncidenceDate(); 890 qd = mAgenda->selectedIncidenceDate();
889 if (qd.isValid()) selected.append(qd); 891 if (qd.isValid()) selected.append(qd);
890 892
891 qd = mAllDayAgenda->selectedIncidenceDate(); 893 qd = mAllDayAgenda->selectedIncidenceDate();
892 if (qd.isValid()) selected.append(qd); 894 if (qd.isValid()) selected.append(qd);
893 895
894 return selected; 896 return selected;
895} 897}
896 898
897 899
898void KOAgendaView::updateView() 900void KOAgendaView::updateView()
899{ 901{
900 if ( mBlockUpdating ) 902 if ( mBlockUpdating )
901 return; 903 return;
902 // kdDebug() << "KOAgendaView::updateView()" << endl; 904 // kdDebug() << "KOAgendaView::updateView()" << endl;
903 fillAgenda(); 905 fillAgenda();
904 906
905} 907}
906 908
907 909
908/* 910/*
909 Update configuration settings for the agenda view. This method is not 911 Update configuration settings for the agenda view. This method is not
910 complete. 912 complete.
911*/ 913*/
912void KOAgendaView::updateConfig() 914void KOAgendaView::updateConfig()
913{ 915{
914 if ( mBlockUpdating ) 916 if ( mBlockUpdating )
915 return; 917 return;
916 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { 918 if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) {
917 int old = KOPrefs::instance()->mHourSize; 919 int old = KOPrefs::instance()->mHourSize;
918 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; 920 KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1;
919 //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); 921 //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize );
920 } 922 }
921 923
922 924
923 // update config for children 925 // update config for children
924 mTimeLabels->updateConfig(); 926 mTimeLabels->updateConfig();
925 mAgenda->storePosition(); 927 mAgenda->storePosition();
926 mAgenda->updateConfig(); 928 mAgenda->updateConfig();
927 mAllDayAgenda->updateConfig(); 929 mAllDayAgenda->updateConfig();
928 // widget synchronization 930 // widget synchronization
929 //TODO: find a better way, maybe signal/slot 931 //TODO: find a better way, maybe signal/slot
930 mTimeLabels->positionChanged(); 932 mTimeLabels->positionChanged();
931 933
932 // for some reason, this needs to be called explicitly 934 // for some reason, this needs to be called explicitly
933 mTimeLabels->repaint(); 935 mTimeLabels->repaint();
934 936
935 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 937 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
936 938
937 // ToolTips displaying summary of events 939 // ToolTips displaying summary of events
938 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() 940 KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
939 ->mEnableToolTips); 941 ->mEnableToolTips);
940 942
941 //setHolidayMasks(); 943 //setHolidayMasks();
942 944
943 //createDayLabels(); called by via updateView(); 945 //createDayLabels(); called by via updateView();
944 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); 946 mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
945 updateView(); 947 updateView();
946 mAgenda->restorePosition(); 948 mAgenda->restorePosition();
947} 949}
948 950
949 951
950void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) 952void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
951{ 953{
952 954
953 955
954 int xxx = item->cellX(); 956 int xxx = item->cellX();
955 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); 957 //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() );
956 if ( mMinY.at(xxx) > item->cellYTop() ) 958 if ( mMinY.at(xxx) > item->cellYTop() )
957 mMinY.at(xxx) = item->cellYTop(); 959 mMinY.at(xxx) = item->cellYTop();
958 if ( mMaxY.at(xxx) < item->cellYBottom() ) 960 if ( mMaxY.at(xxx) < item->cellYBottom() )
959 mMaxY.at(xxx) = item->cellYBottom(); 961 mMaxY.at(xxx) = item->cellYBottom();
960 962
961 QDateTime startDt,endDt; 963 QDateTime startDt,endDt;
962 QDate startDate; 964 QDate startDate;
963 int lenInSecs; 965 int lenInSecs;
964 // if ( type == KOAgenda::RESIZETOP ) 966 // if ( type == KOAgenda::RESIZETOP )
965 // qDebug("RESIZETOP "); 967 // qDebug("RESIZETOP ");
966 // if ( type == KOAgenda::RESIZEBOTTOM ) 968 // if ( type == KOAgenda::RESIZEBOTTOM )
967 // qDebug("RESIZEBOTTOM "); 969 // qDebug("RESIZEBOTTOM ");
968 // if ( type == KOAgenda::MOVE ) 970 // if ( type == KOAgenda::MOVE )
969 // qDebug("MOVE "); 971 // qDebug("MOVE ");
970 if ( item->incidence()->typeID() == eventID ) { 972 if ( item->incidence()->typeID() == eventID ) {
971 startDt =item->incidence()->dtStart(); 973 startDt =item->incidence()->dtStart();
972 endDt = item->incidence()->dtEnd(); 974 endDt = item->incidence()->dtEnd();
973 lenInSecs = startDt.secsTo( endDt ); 975 lenInSecs = startDt.secsTo( endDt );
974 } 976 }
975 977
976 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); 978 // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED );
977 979
978 if ( item->incidence()->typeID()== todoID && item->mLastMoveXPos > 0 ) { 980 if ( item->incidence()->typeID()== todoID && item->mLastMoveXPos > 0 ) {
979 startDate = mSelectedDates[item->mLastMoveXPos]; 981 startDate = mSelectedDates[item->mLastMoveXPos];
980 } else { 982 } else {
981 if (item->cellX() < 0) { 983 if (item->cellX() < 0) {
982 startDate = (mSelectedDates.first()).addDays(item->cellX()); 984 startDate = (mSelectedDates.first()).addDays(item->cellX());
983 } else { 985 } else {
984 startDate = mSelectedDates[item->cellX()]; 986 startDate = mSelectedDates[item->cellX()];
985 } 987 }
986 } 988 }
987 startDt.setDate(startDate); 989 startDt.setDate(startDate);
988 990
989 if (item->incidence()->doesFloat()) { 991 if (item->incidence()->doesFloat()) {
990 endDt.setDate(startDate.addDays(item->cellWidth() - 1)); 992 endDt.setDate(startDate.addDays(item->cellWidth() - 1));
991 } else { 993 } else {
992 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) 994 if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE )
993 startDt.setTime(mAgenda->gyToTime(item->cellYTop())); 995 startDt.setTime(mAgenda->gyToTime(item->cellYTop()));
994 if ( item->incidence()->typeID() == eventID ) { 996 if ( item->incidence()->typeID() == eventID ) {
995 if ( type == KOAgenda::MOVE ) { 997 if ( type == KOAgenda::MOVE ) {
996 endDt = startDt.addSecs(lenInSecs); 998 endDt = startDt.addSecs(lenInSecs);
997 999
998 } else if ( type == KOAgenda::RESIZEBOTTOM ) { 1000 } else if ( type == KOAgenda::RESIZEBOTTOM ) {
999 if (item->lastMultiItem()) { 1001 if (item->lastMultiItem()) {
1000 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1002 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1001 endDt.setDate(startDate. 1003 endDt.setDate(startDate.
1002 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1004 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1003 } else { 1005 } else {
1004 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1006 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1005 endDt.setDate(startDate); 1007 endDt.setDate(startDate);
1006 } 1008 }
1007 } 1009 }
1008 } else { 1010 } else {
1009 // todo 1011 // todo
1010 if (item->lastMultiItem()) { 1012 if (item->lastMultiItem()) {
1011 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 1013 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1012 endDt.setDate(startDate. 1014 endDt.setDate(startDate.
1013 addDays(item->lastMultiItem()->cellX() - item->cellX())); 1015 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1014 } else { 1016 } else {
1015 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 1017 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
1016 if ( item->cellYBottom() > 0 ) 1018 if ( item->cellYBottom() > 0 )
1017 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 1019 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1018 else 1020 else
1019 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 1021 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
1020 endDt.setDate(startDate); 1022 endDt.setDate(startDate);
1021 } 1023 }
1022 } 1024 }
1023 } 1025 }
1024 if ( item->incidence()->typeID() == eventID ) { 1026 if ( item->incidence()->typeID() == eventID ) {
1025 item->incidence()->setDtStart(startDt); 1027 item->incidence()->setDtStart(startDt);
1026 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1028 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1027 } else if ( item->incidence()->typeID() == todoID ) { 1029 } else if ( item->incidence()->typeID() == todoID ) {
1028 Todo* to = static_cast<Todo*>(item->incidence()); 1030 Todo* to = static_cast<Todo*>(item->incidence());
1029 1031
1030 to->setDtDue(endDt); 1032 to->setDtDue(endDt);
1031 if ( to->hasStartDate() ) { 1033 if ( to->hasStartDate() ) {
1032 if (to->dtStart() >= to->dtDue() ) 1034 if (to->dtStart() >= to->dtDue() )
1033 to->setDtStart(to->dtDue().addDays( -2 )); 1035 to->setDtStart(to->dtDue().addDays( -2 ));
1034 } 1036 }
1035 1037
1036 } 1038 }
1037 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1039 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1038 item->incidence()->setRevision(item->incidence()->revision()+1); 1040 item->incidence()->setRevision(item->incidence()->revision()+1);
1039 item->setItemDate(startDt.date()); 1041 item->setItemDate(startDt.date());
1040 //item->updateItem(); 1042 //item->updateItem();
1041 if ( item->incidence()->typeID() == todoID ) { 1043 if ( item->incidence()->typeID() == todoID ) {
1042 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1044 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1043 1045
1044 } 1046 }
1045 else 1047 else
1046 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1048 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1047 item->updateItem(); 1049 item->updateItem();
1048} 1050}
1049 1051
1050void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1052void KOAgendaView::showDates( const QDate &start, const QDate &end )
1051{ 1053{
1052 // kdDebug() << "KOAgendaView::selectDates" << endl; 1054 // kdDebug() << "KOAgendaView::selectDates" << endl;
1053 1055
1054 mSelectedDates.clear(); 1056 mSelectedDates.clear();
1055 // qDebug("KOAgendaView::showDates "); 1057 // qDebug("KOAgendaView::showDates ");
1056 QDate d = start; 1058 QDate d = start;
1057 while (d <= end) { 1059 while (d <= end) {
1058 mSelectedDates.append(d); 1060 mSelectedDates.append(d);
1059 d = d.addDays( 1 ); 1061 d = d.addDays( 1 );
1060 } 1062 }
1061 1063
1062 // and update the view 1064 // and update the view
1063 fillAgenda(); 1065 fillAgenda();
1064} 1066}
1065 1067
1066 1068
1067void KOAgendaView::showEvents(QPtrList<Event>) 1069void KOAgendaView::showEvents(QPtrList<Event>)
1068{ 1070{
1069 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1071 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1070} 1072}
1071 1073
1072void KOAgendaView::changeEventDisplay(Event *, int) 1074void KOAgendaView::changeEventDisplay(Event *, int)
1073{ 1075{
1074 // qDebug("KOAgendaView::changeEventDisplay "); 1076 // qDebug("KOAgendaView::changeEventDisplay ");
1075 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1077 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1076 // this should be re-written to be MUCH smarter. Right now we 1078 // this should be re-written to be MUCH smarter. Right now we
1077 // are just playing dumb. 1079 // are just playing dumb.
1078 fillAgenda(); 1080 fillAgenda();
1079} 1081}
1080 1082
1081void KOAgendaView::fillAgenda(const QDate &) 1083void KOAgendaView::fillAgenda(const QDate &)
1082{ 1084{
1083 // qDebug("KOAgendaView::fillAgenda "); 1085 // qDebug("KOAgendaView::fillAgenda ");
1084 fillAgenda(); 1086 fillAgenda();
1085} 1087}
1086 1088
1087void KOAgendaView::fillAgenda() 1089void KOAgendaView::fillAgenda()
1088{ 1090{
1089 if ( globalFlagBlockStartup ) 1091 if ( globalFlagBlockStartup )
1090 return; 1092 return;
1091 if ( globalFlagBlockAgenda == 1 ) 1093 if ( globalFlagBlockAgenda == 1 )
1092 return; 1094 return;
1093 static bool onlyOne = false; 1095 static bool onlyOne = false;
1094 if ( onlyOne ) 1096 if ( onlyOne )
1095 return; 1097 return;
1096 onlyOne = true; 1098 onlyOne = true;
1097 //if ( globalFlagBlockAgenda == 2 ) 1099 //if ( globalFlagBlockAgenda == 2 )
1098 //globalFlagBlockAgenda = 0; 1100 //globalFlagBlockAgenda = 0;
1099 // globalFlagBlockPainting = false; 1101 // globalFlagBlockPainting = false;
1100 if ( globalFlagBlockAgenda == 0 ) 1102 if ( globalFlagBlockAgenda == 0 )
1101 globalFlagBlockAgenda = 1; 1103 globalFlagBlockAgenda = 1;
1102 // clearView(); 1104 // clearView();
1103 //qDebug("fillAgenda()++++ "); 1105 //qDebug("fillAgenda()++++ ");
1104 globalFlagBlockAgendaItemPaint = 1; 1106 globalFlagBlockAgendaItemPaint = 1;
1105 1107
1106 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1108 mAllDayAgenda->changeColumns(mSelectedDates.count());
1107 mAgenda->changeColumns(mSelectedDates.count()); 1109 mAgenda->changeColumns(mSelectedDates.count());
1108 qApp->processEvents(); 1110 qApp->processEvents();
1109 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1111 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1110 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1112 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1111 setHolidayMasks(); 1113 setHolidayMasks();
1112 1114
1113 //mAgenda->hideUnused(); 1115 //mAgenda->hideUnused();
1114 //mAllDayAgenda->hideUnused(); 1116 //mAllDayAgenda->hideUnused();
1115 1117
1116 // mAgenda->blockNextRepaint( false ); 1118 // mAgenda->blockNextRepaint( false );
1117 // mAgenda->viewport()->repaint(); 1119 // mAgenda->viewport()->repaint();
1118 // mAgenda->blockNextRepaint( true ); 1120 // mAgenda->blockNextRepaint( true );
1119 mMinY.resize(mSelectedDates.count()); 1121 mMinY.resize(mSelectedDates.count());
1120 mMaxY.resize(mSelectedDates.count()); 1122 mMaxY.resize(mSelectedDates.count());
1121 1123
1122 QPtrList<Event> dayEvents; 1124 QPtrList<Event> dayEvents;
1123 1125
1124 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1126 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1125 // Therefore, gtodoset all of them. 1127 // Therefore, gtodoset all of them.
1126 QPtrList<Todo> todos = calendar()->todos(); 1128 QPtrList<Todo> todos = calendar()->todos();
1127 1129
1128 mAgenda->setDateList(mSelectedDates); 1130 mAgenda->setDateList(mSelectedDates);
1129 1131
1130 QDate today = QDate::currentDate(); 1132 QDate today = QDate::currentDate();
1131 1133
1132 DateList::ConstIterator dit; 1134 DateList::ConstIterator dit;
1133 int curCol = 0; 1135 int curCol = 0;
1134 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1136 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1135 QDate currentDate = *dit; 1137 QDate currentDate = *dit;
1136 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1138 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1137 // << endl; 1139 // << endl;
1138 1140
1139 dayEvents = calendar()->events(currentDate,true); 1141 dayEvents = calendar()->events(currentDate,true);
1140 1142
1141 // Default values, which can never be reached 1143 // Default values, which can never be reached
1142 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1144 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1143 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1145 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1144 1146
1145 unsigned int numEvent; 1147 unsigned int numEvent;
1146 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1148 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1147 Event *event = dayEvents.at(numEvent); 1149 Event *event = dayEvents.at(numEvent);
1148 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1150 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1149 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1151 if ( event->uid().left(15) == QString("last-syncEvent-") )
1150 continue; 1152 continue;
1151 // kdDebug() << " Event: " << event->summary() << endl; 1153 // kdDebug() << " Event: " << event->summary() << endl;
1152 1154
1153 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1155 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1154 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1156 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1155 1157
1156 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1158 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1157 1159
1158 if (event->doesFloat()) { 1160 if (event->doesFloat()) {
1159 if (event->recurrence()->doesRecur()) { 1161 if (event->recurrence()->doesRecur()) {
1160 if (event->isMultiDay() ) { 1162 if (event->isMultiDay() ) {
1161 endX = endX - beginX;// endX is now number of days 1163 endX = endX - beginX;// endX is now number of days
1162 if ( event->recursOn( currentDate ) ) { 1164 if ( event->recursOn( currentDate ) ) {
1163 endX += curCol; 1165 endX += curCol;
1164 beginX = curCol; 1166 beginX = curCol;
1165 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1167 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1166 } else { 1168 } else {
1167 //qDebug("days %d %s",endX , currentDate.toString().latin1()); 1169 //qDebug("days %d %s",endX , currentDate.toString().latin1());
1168 QDate dateit = currentDate.addDays( -endX ); 1170 QDate dateit = currentDate.addDays( -endX );
1169 if ( event->recursOn( dateit ) ) { 1171 if ( event->recursOn( dateit ) ) {
1170 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); 1172 //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() );
1171 if ( curCol-endX < 0 ) { 1173 if ( curCol-endX < 0 ) {
1172 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); 1174 mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol);
1173 } 1175 }
1174 } 1176 }
1175 } 1177 }
1176 } else { 1178 } else {
1177 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1179 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1178 } 1180 }
1179 1181
1180 } else { 1182 } else {
1181 if (beginX <= 0 && curCol == 0) { 1183 if (beginX <= 0 && curCol == 0) {
1182 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1183 } else if (beginX == curCol) { 1185 } else if (beginX == curCol) {
1184 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1186 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1185 } 1187 }
1186 } 1188 }
1187 } else if (event->isMultiDay()) { 1189 } else if (event->isMultiDay()) {
1188 if ( event->doesRecur () ) { 1190 if ( event->doesRecur () ) {
1189 QDate dateit = currentDate; 1191 QDate dateit = currentDate;
1190 int count = 0; 1192 int count = 0;
1191 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1193 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1192 while (! event->recursOn( dateit ) && count <= max ) { 1194 while (! event->recursOn( dateit ) && count <= max ) {
1193 ++count; 1195 ++count;
1194 dateit = dateit.addDays( -1 ); 1196 dateit = dateit.addDays( -1 );
1195 } 1197 }
1196 bool ok; 1198 bool ok;
1197 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1199 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1198 if ( ok ) 1200 if ( ok )
1199 { 1201 {
1200 int secs = event->dtStart().secsTo( event->dtEnd() ); 1202 int secs = event->dtStart().secsTo( event->dtEnd() );
1201 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1203 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1202 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1204 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1203 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1205 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1204 1206
1205 } 1207 }
1206 } 1208 }
1207 int startY = mAgenda->timeToY(event->dtStart().time()); 1209 int startY = mAgenda->timeToY(event->dtStart().time());
1208 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1210 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1209 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1211 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1210 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1212 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1211 //qDebug("insert!!! "); 1213 //qDebug("insert!!! ");
1212 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1214 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1213 } 1215 }
1214 if (beginX == curCol) { 1216 if (beginX == curCol) {
1215 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1217 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1216 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1218 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1217 } else if (endX == curCol) { 1219 } else if (endX == curCol) {
1218 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1220 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1219 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1221 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1220 } else { 1222 } else {
1221 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1223 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1222 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1224 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1223 } 1225 }
1224 } else { 1226 } else {
1225 int startY = mAgenda->timeToY(event->dtStart().time()); 1227 int startY = mAgenda->timeToY(event->dtStart().time());
1226 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1228 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1227 if (endY < startY) endY = startY; 1229 if (endY < startY) endY = startY;
1228 mAgenda->insertItem(event,currentDate,curCol,startY,endY); 1230 mAgenda->insertItem(event,currentDate,curCol,startY,endY);
1229 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1231 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1230 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1232 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1231 } 1233 }
1232 } 1234 }
1233 // ---------- [display Todos -------------- 1235 // ---------- [display Todos --------------
1234 unsigned int numTodo; 1236 unsigned int numTodo;
1235 for (numTodo = 0; numTodo < todos.count(); ++numTodo) { 1237 for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
1236 Todo *todo = todos.at(numTodo); 1238 Todo *todo = todos.at(numTodo);
1237 1239
1238 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date 1240 if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
1239 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue; 1241 if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue;
1240 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1242 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1241 // Already completed items can be displayed on their original due date 1243 // Already completed items can be displayed on their original due date
1242 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda 1244 //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
1243 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; 1245 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
1244 bool fillIn = false; 1246 bool fillIn = false;
1245 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) 1247 if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
1246 fillIn = true; 1248 fillIn = true;
1247 if ( ! fillIn && !todo->hasCompletedDate() ) 1249 if ( ! fillIn && !todo->hasCompletedDate() )
1248 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); 1250 fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
1249 if ( fillIn ) { 1251 if ( fillIn ) {
1250 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue 1252 if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
1251 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1253 if ( KOPrefs::instance()->mShowTodoInAgenda )
1252 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); 1254 mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
1253 } 1255 }
1254 else { 1256 else {
1255 QDateTime dt; 1257 QDateTime dt;
1256 if ( todo->hasCompletedDate() ) 1258 if ( todo->hasCompletedDate() )
1257 dt = todo->completed(); 1259 dt = todo->completed();
1258 else 1260 else
1259 dt = todo->dtDue();; 1261 dt = todo->dtDue();;
1260 1262
1261 1263
1262 int endY = mAgenda->timeToY(dt.time()) - 1; 1264 int endY = mAgenda->timeToY(dt.time()) - 1;
1263 int hi = (18/KOPrefs::instance()->mHourSize); 1265 int hi = (18/KOPrefs::instance()->mHourSize);
1264 //qDebug("hei %d ",KOPrefs::instance()->mHourSize); 1266 //qDebug("hei %d ",KOPrefs::instance()->mHourSize);
1265 int startY = endY -hi; 1267 int startY = endY -hi;
1266 1268
1267 mAgenda->insertItem(todo,currentDate,curCol,startY,endY); 1269 mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
1268 1270
1269 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1271 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1270 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1272 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1271 } 1273 }
1272 } 1274 }
1273 } 1275 }
1274 // ---------- display Todos] -------------- 1276 // ---------- display Todos] --------------
1275 1277
1276 ++curCol; 1278 ++curCol;
1277 } 1279 }
1278 mAgenda->hideUnused(); 1280 mAgenda->hideUnused();
1279 mAllDayAgenda->hideUnused(); 1281 mAllDayAgenda->hideUnused();
1280 mAgenda->checkScrollBoundaries(); 1282 mAgenda->checkScrollBoundaries();
1281 1283
1282 deleteSelectedDateTime(); 1284 deleteSelectedDateTime();
1283 1285
1284 createDayLabels(); 1286 createDayLabels();
1285 emit incidenceSelected( 0 ); 1287 emit incidenceSelected( 0 );
1286 1288
1287 if ( globalFlagBlockAgenda == 2 ) { 1289 if ( globalFlagBlockAgenda == 2 ) {
1288 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1290 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1289 setStartHour( KOPrefs::instance()->mDayBegins ); 1291 setStartHour( KOPrefs::instance()->mDayBegins );
1290 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1292 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1291 setStartHour( QTime::currentTime ().hour() ); 1293 setStartHour( QTime::currentTime ().hour() );
1292 // qApp->processEvents(); 1294 // qApp->processEvents();
1293 } 1295 }
1294 qApp->processEvents(); 1296 qApp->processEvents();
1295 //qDebug("qApp->processEvents(); END "); 1297 //qDebug("qApp->processEvents(); END ");
1296 globalFlagBlockAgenda = 0; 1298 globalFlagBlockAgenda = 0;
1297 1299
1298 // mAgenda->hideUnused(); 1300 // mAgenda->hideUnused();
1299 //mAllDayAgenda->hideUnused(); 1301 //mAllDayAgenda->hideUnused();
1300 mAllDayAgenda->drawContentsToPainter(); 1302 mAllDayAgenda->drawContentsToPainter();
1301 mAgenda->drawContentsToPainter(); 1303 mAgenda->drawContentsToPainter();
1302 repaintAgenda(); 1304 repaintAgenda();
1303 onlyOne = false; 1305 onlyOne = false;
1304 // mAgenda->finishUpdate(); 1306 // mAgenda->finishUpdate();
1305 //mAllDayAgenda->finishUpdate(); 1307 //mAllDayAgenda->finishUpdate();
1306 1308
1307 // repaintAgenda(); 1309 // repaintAgenda();
1308 //qApp->processEvents(); 1310 //qApp->processEvents();
1309 // globalFlagBlockAgenda = 0; 1311 // globalFlagBlockAgenda = 0;
1310} 1312}
1311void KOAgendaView::repaintAgenda() 1313void KOAgendaView::repaintAgenda()
1312{ 1314{
1313 // mAllDayAgenda->drawContentsToPainter(); 1315 // mAllDayAgenda->drawContentsToPainter();
1314// mAllDayAgenda->viewport()->repaint( false ); 1316// mAllDayAgenda->viewport()->repaint( false );
1315// mAgenda->drawContentsToPainter(); 1317// mAgenda->drawContentsToPainter();
1316// mAgenda->viewport()->repaint( false ); 1318// mAgenda->viewport()->repaint( false );
1317// qApp->processEvents(); 1319// qApp->processEvents();
1318 1320
1319 //qDebug("KOAgendaView::repaintAgenda() "); 1321 //qDebug("KOAgendaView::repaintAgenda() ");
1320 //qApp->processEvents(); 1322 //qApp->processEvents();
1321 mAgenda->viewport()->repaint( false ); 1323 mAgenda->viewport()->repaint( false );
1322 mAllDayAgenda->viewport()->repaint( false ); 1324 mAllDayAgenda->viewport()->repaint( false );
1323 mAgenda->finishUpdate(); 1325 mAgenda->finishUpdate();
1324 mAllDayAgenda->finishUpdate(); 1326 mAllDayAgenda->finishUpdate();
1325} 1327}
1326 1328
1327 1329
1328void KOAgendaView::clearView() 1330void KOAgendaView::clearView()
1329{ 1331{
1330 // kdDebug() << "ClearView" << endl; 1332 // kdDebug() << "ClearView" << endl;
1331 mAllDayAgenda->clear(); 1333 mAllDayAgenda->clear();
1332 mAgenda->clear(); 1334 mAgenda->clear();
1333} 1335}
1334void KOAgendaView::clearList() 1336void KOAgendaView::clearList()
1335{ 1337{
1336 // kdDebug() << "ClearView" << endl; 1338 // kdDebug() << "ClearView" << endl;
1337 clearView(); 1339 clearView();
1338 mAllDayAgenda->hideUnused(); 1340 mAllDayAgenda->hideUnused();
1339 mAgenda->hideUnused(); 1341 mAgenda->hideUnused();
1340} 1342}
1341 1343
1342void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1344void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1343 const QDate &td) 1345 const QDate &td)
1344{ 1346{
1345#ifndef KORG_NOPRINTER 1347#ifndef KORG_NOPRINTER
1346 if (fd == td) 1348 if (fd == td)
1347 calPrinter->preview(CalPrinter::Day, fd, td); 1349 calPrinter->preview(CalPrinter::Day, fd, td);
1348 else 1350 else
1349 calPrinter->preview(CalPrinter::Week, fd, td); 1351 calPrinter->preview(CalPrinter::Week, fd, td);
1350#endif 1352#endif
1351} 1353}
1352 1354
1353// void KOAgendaView::updateMovedTodo() 1355// void KOAgendaView::updateMovedTodo()
1354// { 1356// {
1355// // updateConfig(); 1357// // updateConfig();
1356// // emit updateTodoViews(); 1358// // emit updateTodoViews();
1357// } 1359// }
1358 1360
1359void KOAgendaView::slotShowDateView( int mode , int d ) 1361void KOAgendaView::slotShowDateView( int mode , int d )
1360{ 1362{
1361 if ( d >= mSelectedDates.count() ) { 1363 if ( d >= mSelectedDates.count() ) {
1362 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() ); 1364 qDebug("KOAgendaView::slotShowDateView datecounterror %d d ", d, mSelectedDates.count() );
1363 1365
1364 } else { 1366 } else {
1365 QDate day = mSelectedDates[d]; 1367 QDate day = mSelectedDates[d];
1366 emit showDateView(mode , day ); 1368 emit showDateView(mode , day );
1367 } 1369 }
1368 1370
1369} 1371}
1370void KOAgendaView::newEvent(int gx, int gy) 1372void KOAgendaView::newEvent(int gx, int gy)
1371{ 1373{
1372 if (!mSelectedDates.count()) return; 1374 if (!mSelectedDates.count()) return;
1373 1375
1374 QDate day = mSelectedDates[gx]; 1376 QDate day = mSelectedDates[gx];
1375 1377
1376 QTime time = mAgenda->gyToTime(gy); 1378 QTime time = mAgenda->gyToTime(gy);
1377 QDateTime dt(day,time); 1379 QDateTime dt(day,time);
1378 // if ( dt < QDateTime::currentDateTime () ) 1380 // if ( dt < QDateTime::currentDateTime () )
1379 // dt = QDateTime::currentDateTime ().addSecs( 3600 ); 1381 // dt = QDateTime::currentDateTime ().addSecs( 3600 );
1380 emit newEventSignal(dt); 1382 emit newEventSignal(dt);
1381} 1383}
1382 1384
1383void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) 1385void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd)
1384{ 1386{
1385 if (!mSelectedDates.count()) return; 1387 if (!mSelectedDates.count()) return;
1386 1388
1387 QDate dayStart = mSelectedDates[gxStart]; 1389 QDate dayStart = mSelectedDates[gxStart];
1388 QDate dayEnd = mSelectedDates[gxEnd]; 1390 QDate dayEnd = mSelectedDates[gxEnd];
1389 1391
1390 QTime timeStart = mAgenda->gyToTime(gyStart); 1392 QTime timeStart = mAgenda->gyToTime(gyStart);
1391 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1393 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1392 1394
1393 QDateTime dtStart(dayStart,timeStart); 1395 QDateTime dtStart(dayStart,timeStart);
1394 QDateTime dtEnd(dayEnd,timeEnd); 1396 QDateTime dtEnd(dayEnd,timeEnd);
1395 1397
1396 emit newEventSignal(dtStart,dtEnd); 1398 emit newEventSignal(dtStart,dtEnd);
1397} 1399}
1398 1400
1399void KOAgendaView::newEventAllDay(int gx, int ) 1401void KOAgendaView::newEventAllDay(int gx, int )
1400{ 1402{
1401 if (!mSelectedDates.count()) return; 1403 if (!mSelectedDates.count()) return;
1402 1404
1403 QDate day = mSelectedDates[gx]; 1405 QDate day = mSelectedDates[gx];
1404 1406
1405 emit newEventSignal(day); 1407 emit newEventSignal(day);
1406} 1408}
1407void KOAgendaView::newTodoAllDay(int gx, int ) 1409void KOAgendaView::newTodoAllDay(int gx, int )
1408{ 1410{
1409 if (!mSelectedDates.count()) return; 1411 if (!mSelectedDates.count()) return;
1410 1412
1411 QDateTime day (mSelectedDates[gx] ); 1413 QDateTime day (mSelectedDates[gx] );
1412 emit newTodoSignal(day, true); 1414 emit newTodoSignal(day, true);
1413} 1415}
1414void KOAgendaView::newTodo(int gx, int gy ) 1416void KOAgendaView::newTodo(int gx, int gy )
1415{ 1417{
1416 if (!mSelectedDates.count()) return; 1418 if (!mSelectedDates.count()) return;
1417 QDate dayStart = mSelectedDates[gx]; 1419 QDate dayStart = mSelectedDates[gx];
1418 QTime timeStart = mAgenda->gyToTime(gy); 1420 QTime timeStart = mAgenda->gyToTime(gy);
1419 QDateTime dt (dayStart,timeStart); 1421 QDateTime dt (dayStart,timeStart);
1420 emit newTodoSignal( dt, false ); 1422 emit newTodoSignal( dt, false );
1421} 1423}
1422 1424
1423void KOAgendaView::updateEventIndicatorTop(int newY) 1425void KOAgendaView::updateEventIndicatorTop(int newY)
1424{ 1426{
1425 uint i; 1427 uint i;
1426 for(i=0;i<mMinY.size();++i) { 1428 for(i=0;i<mMinY.size();++i) {
1427 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true); 1429 if (newY >= mMinY.at(i)) mEventIndicatorTop->enableColumn(i,true);
1428 else mEventIndicatorTop->enableColumn(i,false); 1430 else mEventIndicatorTop->enableColumn(i,false);
1429 } 1431 }
1430 1432
1431 mEventIndicatorTop->update(); 1433 mEventIndicatorTop->update();
1432} 1434}
1433 1435
1434void KOAgendaView::updateEventIndicatorBottom(int newY) 1436void KOAgendaView::updateEventIndicatorBottom(int newY)
1435{ 1437{
1436 uint i; 1438 uint i;
1437 for(i=0;i<mMaxY.size();++i) { 1439 for(i=0;i<mMaxY.size();++i) {
1438 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true); 1440 if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
1439 else mEventIndicatorBottom->enableColumn(i,false); 1441 else mEventIndicatorBottom->enableColumn(i,false);
1440 } 1442 }
1441 1443
1442 mEventIndicatorBottom->update(); 1444 mEventIndicatorBottom->update();
1443} 1445}
1444 1446
1445void KOAgendaView::startDrag(Event *event) 1447void KOAgendaView::startDrag(Event *event)
1446{ 1448{
1447#ifndef KORG_NODND 1449#ifndef KORG_NODND
1448 DndFactory factory( calendar() ); 1450 DndFactory factory( calendar() );
1449 ICalDrag *vd = factory.createDrag(event,this); 1451 ICalDrag *vd = factory.createDrag(event,this);
1450 if (vd->drag()) { 1452 if (vd->drag()) {
1451 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl; 1453 kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
1452 } 1454 }
1453#endif 1455#endif
1454} 1456}
1455 1457
1456void KOAgendaView::readSettings() 1458void KOAgendaView::readSettings()
1457{ 1459{
1458 readSettings(KOGlobals::config()); 1460 readSettings(KOGlobals::config());
1459} 1461}
1460 1462
1461void KOAgendaView::readSettings(KConfig *config) 1463void KOAgendaView::readSettings(KConfig *config)
1462{ 1464{
1463 // kdDebug() << "KOAgendaView::readSettings()" << endl; 1465 // kdDebug() << "KOAgendaView::readSettings()" << endl;
1464 1466
1465 config->setGroup("Views"); 1467 config->setGroup("Views");
1466 1468
1467 //#ifndef KORG_NOSPLITTER 1469 //#ifndef KORG_NOSPLITTER
1468 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView"); 1470 QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
1469 if (sizes.count() == 2) { 1471 if (sizes.count() == 2) {
1470 if ( sizes[0] < 20 ) { 1472 if ( sizes[0] < 20 ) {
1471 sizes[1] = sizes[1] +20 - sizes[0]; 1473 sizes[1] = sizes[1] +20 - sizes[0];
1472 sizes[0] = 20; 1474 sizes[0] = 20;
1473 } 1475 }
1474 mSplitterAgenda->setSizes(sizes); 1476 mSplitterAgenda->setSizes(sizes);
1475 // qDebug("read %d %d ",sizes[0],sizes[1] ); 1477 // qDebug("read %d %d ",sizes[0],sizes[1] );
1476 } 1478 }
1477 //#endif 1479 //#endif
1478 1480
1479 // updateConfig(); 1481 // updateConfig();
1480} 1482}
1481 1483
1482void KOAgendaView::writeSettings(KConfig *config) 1484void KOAgendaView::writeSettings(KConfig *config)
1483{ 1485{
1484 // kdDebug() << "KOAgendaView::writeSettings()" << endl; 1486 // kdDebug() << "KOAgendaView::writeSettings()" << endl;
1485 1487
1486 config->setGroup("Views"); 1488 config->setGroup("Views");
1487 1489
1488 //#ifndef KORG_NOSPLITTER 1490 //#ifndef KORG_NOSPLITTER
1489 QValueList<int> list = mSplitterAgenda->sizes(); 1491 QValueList<int> list = mSplitterAgenda->sizes();
1490 config->writeEntry("Separator AgendaView",list); 1492 config->writeEntry("Separator AgendaView",list);
1491 //qDebug("write %d %d ", list[0],list[1] ); 1493 //qDebug("write %d %d ", list[0],list[1] );
1492 //#endif 1494 //#endif
1493} 1495}
1494 1496
1495void KOAgendaView::setHolidayMasks() 1497void KOAgendaView::setHolidayMasks()
1496{ 1498{
1497 mHolidayMask.resize(mSelectedDates.count()); 1499 mHolidayMask.resize(mSelectedDates.count());
1498 1500
1499 uint i; 1501 uint i;
1500 for(i=0;i<mSelectedDates.count();++i) { 1502 for(i=0;i<mSelectedDates.count();++i) {
1501 QDate date = mSelectedDates[i]; 1503 QDate date = mSelectedDates[i];
1502 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6); 1504 bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
1503 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7); 1505 bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
1504 bool showHoliday = false; 1506 bool showHoliday = false;
1505 if ( KOPrefs::instance()->mExcludeHolidays ) { 1507 if ( KOPrefs::instance()->mExcludeHolidays ) {
1506 QPtrList<Event> events = calendar()->events( date, true ); 1508 QPtrList<Event> events = calendar()->events( date, true );
1507 Event *event; 1509 Event *event;
1508 for( event = events.first(); event; event = events.next() ) { 1510 for( event = events.first(); event; event = events.next() ) {
1509 if ( event->isHoliday()) { 1511 if ( event->isHoliday()) {
1510 showHoliday = true; 1512 showHoliday = true;
1511 break; 1513 break;
1512 } 1514 }
1513 } 1515 }
1514 1516
1515 } 1517 }
1516 1518
1517#ifndef KORG_NOPLUGINS 1519#ifndef KORG_NOPLUGINS
1518 bool showHoliday = KOPrefs::instance()->mExcludeHolidays && 1520 bool showHoliday = KOPrefs::instance()->mExcludeHolidays &&
1519 !KOCore::self()->holiday(date).isEmpty(); 1521 !KOCore::self()->holiday(date).isEmpty();
1520#endif 1522#endif
1521 bool showDay = showSaturday || showSunday || showHoliday; 1523 bool showDay = showSaturday || showSunday || showHoliday;
1522 1524
1523 if (showDay) { 1525 if (showDay) {
1524 mHolidayMask.at(i) = true; 1526 mHolidayMask.at(i) = true;
1525 } else { 1527 } else {
1526 mHolidayMask.at(i) = false; 1528 mHolidayMask.at(i) = false;
1527 } 1529 }
1528 } 1530 }
1529 1531
1530 mAgenda->setHolidayMask(&mHolidayMask); 1532 mAgenda->setHolidayMask(&mHolidayMask);
1531 mAllDayAgenda->setHolidayMask(&mHolidayMask); 1533 mAllDayAgenda->setHolidayMask(&mHolidayMask);
1532} 1534}
1533 1535
1534void KOAgendaView::setContentsPos(int y) 1536void KOAgendaView::setContentsPos(int y)
1535{ 1537{
1536 mAgenda->setContentsPos(0,y); 1538 mAgenda->setContentsPos(0,y);
1537} 1539}
1538 1540
1539void KOAgendaView::clearSelection() 1541void KOAgendaView::clearSelection()
1540{ 1542{
1541 mAgenda->deselectItem(); 1543 mAgenda->deselectItem();
1542 mAllDayAgenda->deselectItem(); 1544 mAllDayAgenda->deselectItem();
1543} 1545}
1544 1546
1545void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart, 1547void KOAgendaView::newTimeSpanSelectedAllDay(int gxStart, int gyStart,
1546 int gxEnd, int gyEnd) 1548 int gxEnd, int gyEnd)
1547{ 1549{
1548 mTimeSpanInAllDay = true; 1550 mTimeSpanInAllDay = true;
1549 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd); 1551 newTimeSpanSelected(gxStart,gyStart,gxEnd,gyEnd);
1550} 1552}
1551 1553
1552 1554
1553 1555
1554 1556
1555void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart, 1557void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart,
1556 int gxEnd, int gyEnd) 1558 int gxEnd, int gyEnd)
1557{ 1559{
1558 if (!mSelectedDates.count()) return; 1560 if (!mSelectedDates.count()) return;
1559 1561
1560 QDate dayStart = mSelectedDates[gxStart]; 1562 QDate dayStart = mSelectedDates[gxStart];
1561 QDate dayEnd = mSelectedDates[gxEnd]; 1563 QDate dayEnd = mSelectedDates[gxEnd];
1562 1564
1563 QTime timeStart = mAgenda->gyToTime(gyStart); 1565 QTime timeStart = mAgenda->gyToTime(gyStart);
1564 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); 1566 QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 );
1565 1567
1566 QDateTime dtStart(dayStart,timeStart); 1568 QDateTime dtStart(dayStart,timeStart);
1567 QDateTime dtEnd(dayEnd,timeEnd); 1569 QDateTime dtEnd(dayEnd,timeEnd);
1568 1570
1569 mTimeSpanBegin = dtStart; 1571 mTimeSpanBegin = dtStart;
1570 mTimeSpanEnd = dtEnd; 1572 mTimeSpanEnd = dtEnd;
1571 1573
1572} 1574}
1573 1575
1574void KOAgendaView::deleteSelectedDateTime() 1576void KOAgendaView::deleteSelectedDateTime()
1575{ 1577{
1576 mTimeSpanBegin.setDate(QDate()); 1578 mTimeSpanBegin.setDate(QDate());
1577 mTimeSpanEnd.setDate(QDate()); 1579 mTimeSpanEnd.setDate(QDate());
1578 mTimeSpanInAllDay = false; 1580 mTimeSpanInAllDay = false;
1579} 1581}
1580 1582
1581void KOAgendaView::keyPressEvent ( QKeyEvent * e ) 1583void KOAgendaView::keyPressEvent ( QKeyEvent * e )
1582{ 1584{
1583 e->ignore(); 1585 e->ignore();
1584} 1586}
1585 1587
1586void KOAgendaView::scrollOneHourUp() 1588void KOAgendaView::scrollOneHourUp()
1587{ 1589{
1588 1590
1589 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); 1591 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 );
1590} 1592}
1591void KOAgendaView::scrollOneHourDown() 1593void KOAgendaView::scrollOneHourDown()
1592{ 1594{
1593 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); 1595 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 );
1594} 1596}
1595 1597
1596void KOAgendaView::setStartHour( int h ) 1598void KOAgendaView::setStartHour( int h )
1597{ 1599{
1598 mAgenda->setStartHour( h ); 1600 mAgenda->setStartHour( h );
1599 1601
1600} 1602}
1601void KOAgendaView::setInitStartHour() 1603void KOAgendaView::setInitStartHour()
1602{ 1604{
1603 1605
1604 if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1606 if ( KOPrefs::instance()->mCenterOnCurrentTime )
1605 setStartHour( QTime::currentTime ().hour() ); 1607 setStartHour( QTime::currentTime ().hour() );
1606 else 1608 else
1607 setStartHour( KOPrefs::instance()->mDayBegins ); 1609 setStartHour( KOPrefs::instance()->mDayBegins );
1608 1610
1609} 1611}
1610 1612
1611 1613
1612void KOAgendaView::updateTodo( Todo * t, int ) 1614void KOAgendaView::updateTodo( Todo * t, int )
1613{ 1615{
1614 if ( !isVisible() ) 1616 if ( !isVisible() )
1615 return; 1617 return;
1616 bool remove = false; 1618 bool remove = false;
1617 bool removeAD = false; 1619 bool removeAD = false;
1618 QDate da; 1620 QDate da;
1619 if ( t->hasCompletedDate() ) 1621 if ( t->hasCompletedDate() )
1620 da = t->completed().date(); 1622 da = t->completed().date();
1621 else 1623 else
1622 da = t->dtDue().date(); 1624 da = t->dtDue().date();
1623 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { 1625 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
1624 remove = true; 1626 remove = true;
1625 removeAD = true; 1627 removeAD = true;
1626 } 1628 }
1627 else { 1629 else {
1628 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; 1630 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
1629 if ( overdue && 1631 if ( overdue &&
1630 QDate::currentDate() >= mSelectedDates.first() && 1632 QDate::currentDate() >= mSelectedDates.first() &&
1631 QDate::currentDate() <= mSelectedDates.last()) { 1633 QDate::currentDate() <= mSelectedDates.last()) {
1632 removeAD = false; 1634 removeAD = false;
1633 remove = true; 1635 remove = true;
1634 } 1636 }
1635 else { 1637 else {
1636 1638
1637 if ( da < mSelectedDates.first() || 1639 if ( da < mSelectedDates.first() ||
1638 da > mSelectedDates.last() ) { 1640 da > mSelectedDates.last() ) {
1639 remove = true; 1641 remove = true;
1640 removeAD = true; 1642 removeAD = true;
1641 } else { 1643 } else {
1642 remove = t->doesFloat() && !t->hasCompletedDate(); 1644 remove = t->doesFloat() && !t->hasCompletedDate();
1643 removeAD = !remove; 1645 removeAD = !remove;
1644 } 1646 }
1645 } 1647 }
1646 } 1648 }
1647 int days = mSelectedDates.first().daysTo( da ); 1649 int days = mSelectedDates.first().daysTo( da );
1648 //qDebug("daysto %d %d %d", days, remove,removeAD ); 1650 //qDebug("daysto %d %d %d", days, remove,removeAD );
1649 mAgenda->updateTodo( t , days, remove); 1651 mAgenda->updateTodo( t , days, remove);
1650 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1652 if ( KOPrefs::instance()->mShowTodoInAgenda )
1651 mAllDayAgenda->updateTodo( t , days, removeAD); 1653 mAllDayAgenda->updateTodo( t , days, removeAD);
1652 //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); 1654 //qDebug("KOAgendaView::updateTodo( Todo *, int ) ");
1653 1655
1654} 1656}
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 35a56ca..7ba1392 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,1538 +1,1538 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kglobalsettings.h> 56#include <kglobalsettings.h>
57 57
58#include <kurlrequester.h> 58#include <kurlrequester.h>
59#include <klineedit.h> 59#include <klineedit.h>
60 60
61#if defined(USE_SOLARIS) 61#if defined(USE_SOLARIS)
62#include <sys/param.h> 62#include <sys/param.h>
63 63
64#define ZONEINFODIR "/usr/share/lib/zoneinfo" 64#define ZONEINFODIR "/usr/share/lib/zoneinfo"
65#define INITFILE "/etc/default/init" 65#define INITFILE "/etc/default/init"
66#endif 66#endif
67 67
68#include "koprefs.h" 68#include "koprefs.h"
69 69
70#include "koprefsdialog.h" 70#include "koprefsdialog.h"
71#include "kpimglobalprefs.h" 71#include "kpimglobalprefs.h"
72 72
73 73
74KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 74KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
75 KPrefsDialog(KOPrefs::instance(),parent,name,true) 75 KPrefsDialog(KOPrefs::instance(),parent,name,true)
76{ 76{
77 77
78 setFont( KGlobalSettings::generalMaxFont() ); 78 setFont( KGlobalSettings::generalMaxFont() );
79 setCaption( i18n("Preferences - some settings need a restart (nr)")); 79 setCaption( i18n("Preferences - some settings need a restart (nr)"));
80 mCategoryDict.setAutoDelete(true); 80 mCategoryDict.setAutoDelete(true);
81 81
82 KGlobal::locale()->insertCatalogue("timezones"); 82 KGlobal::locale()->insertCatalogue("timezones");
83 mSpacingHint = spacingHintSmall(); 83 mSpacingHint = spacingHintSmall();
84 mMarginHint = marginHintSmall(); 84 mMarginHint = marginHintSmall();
85#ifndef DESKTOP_VERSION 85#ifndef DESKTOP_VERSION
86 if ( QApplication::desktop()->height() == 480 ) 86 if ( QApplication::desktop()->height() == 480 )
87 hideButtons(); 87 hideButtons();
88#endif 88#endif
89 89
90 setupMainTab(); 90 setupMainTab();
91 // setupLocaleTab(); 91 // setupLocaleTab();
92 //setupTimeZoneTab(); 92 //setupTimeZoneTab();
93 setupTimeTab(); 93 setupTimeTab();
94 //setupLocaleDateTab(); 94 //setupLocaleDateTab();
95 setupFontsTab(); 95 setupFontsTab();
96 setupColorsTab(); 96 setupColorsTab();
97 setupViewsTab(); 97 setupViewsTab();
98 //setupSyncTab(); 98 //setupSyncTab();
99 //setupSyncAlgTab(); 99 //setupSyncAlgTab();
100 //setupPrinterTab(); 100 //setupPrinterTab();
101 //setupGroupSchedulingTab(); 101 //setupGroupSchedulingTab();
102 //setupGroupAutomationTab(); 102 //setupGroupAutomationTab();
103 103
104 104
105} 105}
106 106
107 107
108KOPrefsDialog::~KOPrefsDialog() 108KOPrefsDialog::~KOPrefsDialog()
109{ 109{
110} 110}
111void KOPrefsDialog::setupGlobalTab() 111void KOPrefsDialog::setupGlobalTab()
112{ 112{
113 113
114 114
115} 115}
116void KOPrefsDialog::setupLocaleDateTab() 116void KOPrefsDialog::setupLocaleDateTab()
117{ 117{
118#if 0 118#if 0
119QFrame *topFrame = addPage(i18n("Date Format"),0,0); 119QFrame *topFrame = addPage(i18n("Date Format"),0,0);
120 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 120 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
121 topLayout->setSpacing(mSpacingHint); 121 topLayout->setSpacing(mSpacingHint);
122 topLayout->setMargin(mMarginHint); 122 topLayout->setMargin(mMarginHint);
123 int iii = 0; 123 int iii = 0;
124 124
125 125
126 KPrefsDialogWidRadios *syncPrefsGroup = 126 KPrefsDialogWidRadios *syncPrefsGroup =
127 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 127 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
128 QString format; 128 QString format;
129 if ( QApplication::desktop()->width() < 480 ) 129 if ( QApplication::desktop()->width() < 480 )
130 format = "(%d.%m.%Y)"; 130 format = "(%d.%m.%Y)";
131 else 131 else
132 format = "(%d.%m.%Y|%A %d %B %Y)"; 132 format = "(%d.%m.%Y|%A %d %B %Y)";
133 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 133 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
134 if ( QApplication::desktop()->width() < 480 ) 134 if ( QApplication::desktop()->width() < 480 )
135 format = "(%m.%d.%Y)"; 135 format = "(%m.%d.%Y)";
136 else 136 else
137 format = "(%m.%d.%Y|%A %B %d %Y)"; 137 format = "(%m.%d.%Y|%A %B %d %Y)";
138 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 138 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
139 if ( QApplication::desktop()->width() < 480 ) 139 if ( QApplication::desktop()->width() < 480 )
140 format = "(%Y-%m-%d)"; 140 format = "(%Y-%m-%d)";
141 else 141 else
142 format = "(%Y-%m-%d|%A %Y %B %d)"; 142 format = "(%Y-%m-%d|%A %Y %B %d)";
143 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 143 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
144 syncPrefsGroup->addRadio(i18n("User defined")); 144 syncPrefsGroup->addRadio(i18n("User defined"));
145 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 145 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
146 ++iii; 146 ++iii;
147 ++iii; 147 ++iii;
148 QLabel * lab; 148 QLabel * lab;
149 mUserDateFormatLong = new QLineEdit(topFrame); 149 mUserDateFormatLong = new QLineEdit(topFrame);
150 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 150 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
151 topLayout->addWidget(lab ,iii,0); 151 topLayout->addWidget(lab ,iii,0);
152 topLayout->addWidget(mUserDateFormatLong,iii,1); 152 topLayout->addWidget(mUserDateFormatLong,iii,1);
153 ++iii; 153 ++iii;
154 mUserDateFormatShort = new QLineEdit(topFrame); 154 mUserDateFormatShort = new QLineEdit(topFrame);
155 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 155 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
156 topLayout->addWidget(lab ,iii,0); 156 topLayout->addWidget(lab ,iii,0);
157 topLayout->addWidget(mUserDateFormatShort,iii,1); 157 topLayout->addWidget(mUserDateFormatShort,iii,1);
158 ++iii; 158 ++iii;
159 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 159 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
160 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 160 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
161 ++iii; 161 ++iii;
162 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 162 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
163 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 163 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
164 ++iii; 164 ++iii;
165 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 165 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
166 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 166 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
167 ++iii; 167 ++iii;
168#endif 168#endif
169 169
170} 170}
171 171
172void KOPrefsDialog::setupLocaleTab() 172void KOPrefsDialog::setupLocaleTab()
173{ 173{
174#if 0 174#if 0
175 QFrame *topFrame = addPage(i18n("Locale"),0,0); 175 QFrame *topFrame = addPage(i18n("Locale"),0,0);
176 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 176 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
177 topLayout->setSpacing(mSpacingHint); 177 topLayout->setSpacing(mSpacingHint);
178 topLayout->setMargin(mMarginHint); 178 topLayout->setMargin(mMarginHint);
179 int iii = 0; 179 int iii = 0;
180 KPrefsDialogWidRadios *syncPrefsGroup = 180 KPrefsDialogWidRadios *syncPrefsGroup =
181 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 181 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
182 syncPrefsGroup->addRadio(i18n("English")); 182 syncPrefsGroup->addRadio(i18n("English"));
183 syncPrefsGroup->addRadio(i18n("German")); 183 syncPrefsGroup->addRadio(i18n("German"));
184 syncPrefsGroup->addRadio(i18n("French")); 184 syncPrefsGroup->addRadio(i18n("French"));
185 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 185 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
186 if ( QApplication::desktop()->width() < 300 ) 186 if ( QApplication::desktop()->width() < 300 )
187 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 187 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
188 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 188 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
189 ++iii; 189 ++iii;
190 190
191 syncPrefsGroup = 191 syncPrefsGroup =
192 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 192 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
193 if ( QApplication::desktop()->width() > 300 ) 193 if ( QApplication::desktop()->width() > 300 )
194 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 194 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
195 syncPrefsGroup->addRadio(i18n("24:00")); 195 syncPrefsGroup->addRadio(i18n("24:00"));
196 syncPrefsGroup->addRadio(i18n("12:00am")); 196 syncPrefsGroup->addRadio(i18n("12:00am"));
197 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 197 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
198 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 198 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
199 ++iii; 199 ++iii;
200 KPrefsDialogWidBool *sb; 200 KPrefsDialogWidBool *sb;
201 if ( QApplication::desktop()->width() < 300 ) { 201 if ( QApplication::desktop()->width() < 300 ) {
202 sb = 202 sb =
203 addWidBool(i18n("Week starts on Sunday"), 203 addWidBool(i18n("Week starts on Sunday"),
204 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 204 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
205 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 205 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
206 ++iii; 206 ++iii;
207 sb = 207 sb =
208 addWidBool(i18n("Use short date in (WN/E) view"), 208 addWidBool(i18n("Use short date in (WN/E) view"),
209 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 209 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
211 } 211 }
212 else { 212 else {
213 QWidget * hb = new QWidget( topFrame ); 213 QWidget * hb = new QWidget( topFrame );
214 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 214 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
215 sb = 215 sb =
216 addWidBool(i18n("Week starts on Sunday"), 216 addWidBool(i18n("Week starts on Sunday"),
217 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 217 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
218 hbLayout->addWidget(sb->checkBox() ); 218 hbLayout->addWidget(sb->checkBox() );
219 sb = 219 sb =
220 addWidBool(i18n("Use short date in (WN/E) view"), 220 addWidBool(i18n("Use short date in (WN/E) view"),
221 &(KOPrefs::instance()->mShortDateInViewer),hb); 221 &(KOPrefs::instance()->mShortDateInViewer),hb);
222 hbLayout->addWidget(sb->checkBox() ); 222 hbLayout->addWidget(sb->checkBox() );
223 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 223 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
224 224
225 } 225 }
226 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 226 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
227#if 0 227#if 0
228 ++iii; 228 ++iii;
229 sb = 229 sb =
230 addWidBool(i18n("Quick load/save (w/o Unicode)"), 230 addWidBool(i18n("Quick load/save (w/o Unicode)"),
231 &(KOPrefs::instance()->mUseQuicksave),topFrame); 231 &(KOPrefs::instance()->mUseQuicksave),topFrame);
232 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 232 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
233#endif 233#endif
234#endif 234#endif
235} 235}
236 236
237void KOPrefsDialog::setupMainTab() 237void KOPrefsDialog::setupMainTab()
238{ 238{
239 QFrame *topFrame = addPage(i18n("General"),0,0); 239 QFrame *topFrame = addPage(i18n("General"),0,0);
240 // DesktopIcon("identity",KIcon::SizeMedium)); 240 // DesktopIcon("identity",KIcon::SizeMedium));
241 241
242 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 242 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
243 topLayout->setSpacing(mSpacingHint); 243 topLayout->setSpacing(mSpacingHint);
244 topLayout->setMargin(mMarginHint); 244 topLayout->setMargin(mMarginHint);
245 245
246 // KPrefsDialogWidBool *emailControlCenter = 246 // KPrefsDialogWidBool *emailControlCenter =
247// addWidBool(i18n("&Use email settings from Control Center"), 247// addWidBool(i18n("&Use email settings from Control Center"),
248// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 248// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
249// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 249// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
250 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 250 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
251 // SLOT(toggleEmailSettings(bool))); 251 // SLOT(toggleEmailSettings(bool)));
252 252
253 mNameEdit = new QLineEdit(topFrame); 253 mNameEdit = new QLineEdit(topFrame);
254 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 254 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
255 topLayout->addWidget(mNameLabel,0,0); 255 topLayout->addWidget(mNameLabel,0,0);
256 topLayout->addWidget(mNameEdit,0,1); 256 topLayout->addWidget(mNameEdit,0,1);
257 257
258 mEmailEdit = new QLineEdit(topFrame); 258 mEmailEdit = new QLineEdit(topFrame);
259 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 259 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
260 topLayout->addWidget(mEmailLabel,1,0); 260 topLayout->addWidget(mEmailLabel,1,0);
261 topLayout->addWidget(mEmailEdit,1,1); 261 topLayout->addWidget(mEmailEdit,1,1);
262 KPrefsDialogWidBool *wb; 262 KPrefsDialogWidBool *wb;
263 263
264 264
265 265
266 KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), 266 KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"),
267 &(KOPrefs::instance()->mShowFullMenu),topFrame); 267 &(KOPrefs::instance()->mShowFullMenu),topFrame);
268 topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); 268 topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1);
269 269
270 270
271 widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), 271 widbool = addWidBool(i18n("Mini icons in toolbar(nr)"),
272 &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); 272 &(KOPrefs::instance()->mToolBarMiniIcons),topFrame);
273 topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); 273 topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1);
274 274
275 275
276 KPrefsDialogWidBool *verticalScreen = 276 KPrefsDialogWidBool *verticalScreen =
277 addWidBool(i18n("Show vertical screen (Needs restart)"), 277 addWidBool(i18n("Vertical screen layout(Needs restart)"),
278 &(KOPrefs::instance()->mVerticalScreen),topFrame); 278 &(KOPrefs::instance()->mVerticalScreen),topFrame);
279 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 279 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
280 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); 280 topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1);
281 281
282 282
283 int iii = 5; 283 int iii = 5;
284 widbool = addWidBool(i18n("Block popup until mouse button release"), 284 widbool = addWidBool(i18n("Block popup until mouse button release"),
285 &(KOPrefs::instance()->mBlockPopupMenu),topFrame); 285 &(KOPrefs::instance()->mBlockPopupMenu),topFrame);
286 topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1); 286 topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1);
287 ++iii; 287 ++iii;
288 if ( QApplication::desktop()->height() <= 240 ) { 288 if ( QApplication::desktop()->height() <= 240 ) {
289 topFrame = addPage(i18n("General") +" 2",0,0); 289 topFrame = addPage(i18n("General") +" 2",0,0);
290 topLayout = new QGridLayout(topFrame,4,2); 290 topLayout = new QGridLayout(topFrame,4,2);
291 topLayout->setSpacing(2); 291 topLayout->setSpacing(2);
292 topLayout->setMargin(3); 292 topLayout->setMargin(3);
293 iii = 0; 293 iii = 0;
294 } 294 }
295 QHBox *dummy = new QHBox(topFrame); 295 QHBox *dummy = new QHBox(topFrame);
296 new QLabel(i18n("Days in Next-X-Days:"),dummy); 296 new QLabel(i18n("Days in Next-X-Days:"),dummy);
297 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 297 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
298 298
299 topLayout->addMultiCellWidget(dummy,iii,iii,0,1); 299 topLayout->addMultiCellWidget(dummy,iii,iii,0,1);
300 300
301 ++iii; 301 ++iii;
302 302
303 303
304 // KPrefsDialogWidBool *bcc = 304 // KPrefsDialogWidBool *bcc =
305// addWidBool(i18n("Send copy to owner when mailing events"), 305// addWidBool(i18n("Send copy to owner when mailing events"),
306// &(KOPrefs::instance()->mBcc),topFrame); 306// &(KOPrefs::instance()->mBcc),topFrame);
307// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 307// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
308 308
309 309
310 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 310 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
311 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 311 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
312 312
313 // addWidBool(i18n("Enable automatic saving of calendar"), 313 // addWidBool(i18n("Enable automatic saving of calendar"),
314 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 314 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
315 315
316 QHBox *intervalBox = new QHBox(topFrame); 316 QHBox *intervalBox = new QHBox(topFrame);
317 // intervalBox->setSpacing(mSpacingHint); 317 // intervalBox->setSpacing(mSpacingHint);
318 topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1); 318 topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1);
319 ++iii; 319 ++iii;
320 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 320 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
321 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 321 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
322 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 322 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
323 /* 323 /*
324 QHBox * agendasize = new QHBox ( topFrame ); 324 QHBox * agendasize = new QHBox ( topFrame );
325 325
326 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 326 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
327 327
328 328
329 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 329 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
330 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 330 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
331 */ 331 */
332 332
333 333
334 KPrefsDialogWidBool *ask = 334 KPrefsDialogWidBool *ask =
335 addWidBool(i18n("Ask for quit when closing KO/Pi"), 335 addWidBool(i18n("Ask for quit when closing KO/Pi"),
336 &(KOPrefs::instance()->mAskForQuit),topFrame); 336 &(KOPrefs::instance()->mAskForQuit),topFrame);
337 topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1); 337 topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1);
338 ++iii; 338 ++iii;
339 339
340 340
341 /* 341 /*
342 KPrefsDialogWidBool *confirmCheck = 342 KPrefsDialogWidBool *confirmCheck =
343 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 343 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
344 topFrame); 344 topFrame);
345 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 345 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
346 346
347 347
348 mEnableGroupScheduling = 348 mEnableGroupScheduling =
349 addWidBool(i18n("Enable group scheduling"), 349 addWidBool(i18n("Enable group scheduling"),
350 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 350 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
351 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 351 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
352 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 352 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
353 SLOT(warningGroupScheduling())); 353 SLOT(warningGroupScheduling()));
354 354
355 mEnableProjectView = 355 mEnableProjectView =
356 addWidBool(i18n("Enable project view"), 356 addWidBool(i18n("Enable project view"),
357 &(KOPrefs::instance()->mEnableProjectView),topFrame); 357 &(KOPrefs::instance()->mEnableProjectView),topFrame);
358 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 358 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
359 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 359 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
360 SLOT(warningProjectView())); 360 SLOT(warningProjectView()));
361 361
362 // Can't be disabled anymore 362 // Can't be disabled anymore
363 mEnableGroupScheduling->checkBox()->hide(); 363 mEnableGroupScheduling->checkBox()->hide();
364 364
365 // Disable setting, because this feature now becomes stable 365 // Disable setting, because this feature now becomes stable
366 mEnableProjectView->checkBox()->hide(); 366 mEnableProjectView->checkBox()->hide();
367 367
368 KPrefsDialogWidRadios *defaultFormatGroup = 368 KPrefsDialogWidRadios *defaultFormatGroup =
369 addWidRadios(i18n("Default Calendar Format"), 369 addWidRadios(i18n("Default Calendar Format"),
370 &(KOPrefs::instance()->mDefaultFormat),topFrame); 370 &(KOPrefs::instance()->mDefaultFormat),topFrame);
371 defaultFormatGroup->addRadio(i18n("vCalendar")); 371 defaultFormatGroup->addRadio(i18n("vCalendar"));
372 defaultFormatGroup->addRadio(i18n("iCalendar")); 372 defaultFormatGroup->addRadio(i18n("iCalendar"));
373 373
374 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 374 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
375 375
376 // Default format unconditionally is iCalendar 376 // Default format unconditionally is iCalendar
377 defaultFormatGroup->groupBox()->hide(); 377 defaultFormatGroup->groupBox()->hide();
378 378
379 KPrefsDialogWidRadios *mailClientGroup = 379 KPrefsDialogWidRadios *mailClientGroup =
380 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 380 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
381 topFrame); 381 topFrame);
382 mailClientGroup->addRadio(i18n("KMail")); 382 mailClientGroup->addRadio(i18n("KMail"));
383 mailClientGroup->addRadio(i18n("Sendmail")); 383 mailClientGroup->addRadio(i18n("Sendmail"));
384 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 384 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
385 385
386 KPrefsDialogWidBool *htmlsave = 386 KPrefsDialogWidBool *htmlsave =
387 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 387 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
388 topFrame); 388 topFrame);
389 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 389 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
390 390
391 KPrefsDialogWidRadios *destinationGroup = 391 KPrefsDialogWidRadios *destinationGroup =
392 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 392 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
393 topFrame); 393 topFrame);
394 destinationGroup->addRadio(i18n("be added to the standard resource")); 394 destinationGroup->addRadio(i18n("be added to the standard resource"));
395 destinationGroup->addRadio(i18n("be asked which resource to use")); 395 destinationGroup->addRadio(i18n("be asked which resource to use"));
396 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 396 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
397 397
398 topLayout->setRowStretch(14,1); 398 topLayout->setRowStretch(14,1);
399 */ 399 */
400} 400}
401 401
402 402
403void KOPrefsDialog::setupTimeTab() 403void KOPrefsDialog::setupTimeTab()
404{ 404{
405 QFrame *topFrame = addPage(i18n("Time"),0,0); 405 QFrame *topFrame = addPage(i18n("Time"),0,0);
406 // DesktopIcon("clock",KIcon::SizeMedium)); 406 // DesktopIcon("clock",KIcon::SizeMedium));
407 407
408 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 408 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
409 topLayout->setSpacing(mSpacingHint); 409 topLayout->setSpacing(mSpacingHint);
410 topLayout->setMargin(mMarginHint); 410 topLayout->setMargin(mMarginHint);
411 411
412 QHBox *dummy = new QHBox(topFrame); 412 QHBox *dummy = new QHBox(topFrame);
413 KPrefsDialogWidTime *dayBegins = 413 KPrefsDialogWidTime *dayBegins =
414 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 414 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
415 dummy); 415 dummy);
416 //topLayout->addWidget(dayBegins->label(),2,0); 416 //topLayout->addWidget(dayBegins->label(),2,0);
417 417
418 //topLayout->addWidget(dayBegins->spinBox(),2,1); 418 //topLayout->addWidget(dayBegins->spinBox(),2,1);
419 topLayout->addMultiCellWidget(dummy,0,0,0,1); 419 topLayout->addMultiCellWidget(dummy,0,0,0,1);
420 420
421 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 421 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
422 topFrame),1,0); 422 topFrame),1,0);
423 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 423 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
424 mStartTimeSpin->setSuffix(":00"); 424 mStartTimeSpin->setSuffix(":00");
425 topLayout->addWidget(mStartTimeSpin,1,1); 425 topLayout->addWidget(mStartTimeSpin,1,1);
426 426
427 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 427 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
428 topFrame),2,0); 428 topFrame),2,0);
429 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 429 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
430 mDefaultDurationSpin->setSuffix(":00"); 430 mDefaultDurationSpin->setSuffix(":00");
431 topLayout->addWidget(mDefaultDurationSpin,2,1); 431 topLayout->addWidget(mDefaultDurationSpin,2,1);
432 432
433 QStringList alarmList; 433 QStringList alarmList;
434 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 434 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
435 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 435 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
436 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 436 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
437 3,0); 437 3,0);
438 mAlarmTimeCombo = new QComboBox(topFrame); 438 mAlarmTimeCombo = new QComboBox(topFrame);
439 mAlarmTimeCombo->insertStringList(alarmList); 439 mAlarmTimeCombo->insertStringList(alarmList);
440 topLayout->addWidget(mAlarmTimeCombo,3,1); 440 topLayout->addWidget(mAlarmTimeCombo,3,1);
441 int iii = 4; 441 int iii = 4;
442 if ( QApplication::desktop()->height() <= 240 ) { 442 if ( QApplication::desktop()->height() <= 240 ) {
443 topFrame = addPage(i18n("Time") +" 2",0,0); 443 topFrame = addPage(i18n("Time") +" 2",0,0);
444 topLayout = new QGridLayout(topFrame,1,2); 444 topLayout = new QGridLayout(topFrame,1,2);
445 topLayout->setSpacing(2); 445 topLayout->setSpacing(2);
446 topLayout->setMargin(3); 446 topLayout->setMargin(3);
447 iii = 0; 447 iii = 0;
448 } 448 }
449 449
450 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 450 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
451 i18n("Working Hours"), 451 i18n("Working Hours"),
452 topFrame); 452 topFrame);
453 topLayout->addMultiCellWidget(workingHoursGroup,iii,iii,0,1); 453 topLayout->addMultiCellWidget(workingHoursGroup,iii,iii,0,1);
454 workingHoursGroup->layout()->setSpacing( 0 ); 454 workingHoursGroup->layout()->setSpacing( 0 );
455 workingHoursGroup->layout()->setMargin( 4 ); 455 workingHoursGroup->layout()->setMargin( 4 );
456 QHBox *workStartBox = new QHBox(workingHoursGroup); 456 QHBox *workStartBox = new QHBox(workingHoursGroup);
457 // workStartBox->setMargin( 0 ); 457 // workStartBox->setMargin( 0 );
458 addWidTime(i18n("Daily starting hour:"), 458 addWidTime(i18n("Daily starting hour:"),
459 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 459 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
460 460
461 QHBox *workEndBox = new QHBox(workingHoursGroup); 461 QHBox *workEndBox = new QHBox(workingHoursGroup);
462 //workEndBox->setMargin( 0 ); 462 //workEndBox->setMargin( 0 );
463 addWidTime(i18n("Daily ending hour:"), 463 addWidTime(i18n("Daily ending hour:"),
464 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 464 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
465 QVBox *excludeBox = new QVBox(workingHoursGroup); 465 QVBox *excludeBox = new QVBox(workingHoursGroup);
466 //excludeBox->setMargin( 0 ); 466 //excludeBox->setMargin( 0 );
467 addWidBool(i18n("Exclude holidays"), 467 addWidBool(i18n("Exclude holidays"),
468 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 468 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
469 469
470 addWidBool(i18n("Exclude Saturdays"), 470 addWidBool(i18n("Exclude Saturdays"),
471 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 471 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
472 472
473// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 473// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
474 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 474 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
475 // topFrame); 475 // topFrame);
476// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 476// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
477 477
478 // topLayout->setRowStretch(6,1); 478 // topLayout->setRowStretch(6,1);
479} 479}
480 480
481 481
482void KOPrefsDialog::setupViewsTab() 482void KOPrefsDialog::setupViewsTab()
483{ 483{
484 484
485 QFrame *topFrame = addPage(i18n("Views"),0,0); 485 QFrame *topFrame = addPage(i18n("Views"),0,0);
486 // DesktopIcon("viewmag",KIcon::SizeMedium)); 486 // DesktopIcon("viewmag",KIcon::SizeMedium));
487 487
488 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 488 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
489 topLayout->setSpacing(mSpacingHint); 489 topLayout->setSpacing(mSpacingHint);
490 topLayout->setMargin(mMarginHint); 490 topLayout->setMargin(mMarginHint);
491 491
492// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 492// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
493// topLayout->addLayout(dayBeginsLayout,0,0); 493// topLayout->addLayout(dayBeginsLayout,0,0);
494 494
495// KPrefsDialogWidTime *dayBegins = 495// KPrefsDialogWidTime *dayBegins =
496// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 496// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
497// topFrame); 497// topFrame);
498// dayBeginsLayout->addWidget(dayBegins->label()); 498// dayBeginsLayout->addWidget(dayBegins->label());
499// dayBeginsLayout->addStretch(1); 499// dayBeginsLayout->addStretch(1);
500// dayBeginsLayout->addWidget(dayBegins->spinBox()); 500// dayBeginsLayout->addWidget(dayBegins->spinBox());
501 501
502// QBoxLayout *nextDaysLayout = new QHBoxLayout; 502// QBoxLayout *nextDaysLayout = new QHBoxLayout;
503// topLayout->addLayout(nextDaysLayout,1,0); 503// topLayout->addLayout(nextDaysLayout,1,0);
504// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 504// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
505// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 505// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
506// nextDaysLayout->addStretch(1); 506// nextDaysLayout->addStretch(1);
507// nextDaysLayout->addWidget(mNextXDaysSpin); 507// nextDaysLayout->addWidget(mNextXDaysSpin);
508 508
509 509
510 int ii = 0; 510 int ii = 0;
511 KPrefsDialogWidBool *dummy = 511 KPrefsDialogWidBool *dummy =
512 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 512 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
513 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 513 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
514 topLayout->addWidget(dummy->checkBox(),ii++,0); 514 topLayout->addWidget(dummy->checkBox(),ii++,0);
515 515
516 516
517 517
518 518
519 519
520 520
521 // topLayout->addWidget(hourSizeGroup,ii++,0); 521 // topLayout->addWidget(hourSizeGroup,ii++,0);
522 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 522 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
523 //topLayout->setRowStretch(11,1); 523 //topLayout->setRowStretch(11,1);
524 524
525 525
526 526
527 527
528#if 0 528#if 0
529 529
530 topFrame = addPage(i18n("ViewChange"),0,0); 530 topFrame = addPage(i18n("ViewChange"),0,0);
531 // DesktopIcon("viewmag",KIcon::SizeMedium)); 531 // DesktopIcon("viewmag",KIcon::SizeMedium));
532 532
533 topLayout = new QGridLayout(topFrame,6,1); 533 topLayout = new QGridLayout(topFrame,6,1);
534 topLayout->setSpacing(mSpacingHint); 534 topLayout->setSpacing(mSpacingHint);
535 topLayout->setMargin(mMarginHint); 535 topLayout->setMargin(mMarginHint);
536 ii = 0; 536 ii = 0;
537 537
538#endif 538#endif
539 539
540 dummy = 540 dummy =
541 addWidBool(i18n("Hold fullscreen on view change"), 541 addWidBool(i18n("Hold fullscreen on view change"),
542 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 542 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
543 topLayout->addWidget(dummy->checkBox(),ii++,0); 543 topLayout->addWidget(dummy->checkBox(),ii++,0);
544 544
545 dummy = 545 dummy =
546 addWidBool(i18n("Hold non-fullscreen on view change"), 546 addWidBool(i18n("Hold non-fullscreen on view change"),
547 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 547 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
548 topLayout->addWidget(dummy->checkBox(),ii++,0); 548 topLayout->addWidget(dummy->checkBox(),ii++,0);
549 549
550 550
551 551
552 KPrefsDialogWidBool *fullViewMonth = 552 KPrefsDialogWidBool *fullViewMonth =
553 addWidBool(i18n("Next days view uses full window"), 553 addWidBool(i18n("Next days view uses full window"),
554 &(KOPrefs::instance()->mFullViewMonth),topFrame); 554 &(KOPrefs::instance()->mFullViewMonth),topFrame);
555 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 555 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
556 556
557 557
558 KPrefsDialogWidBool *fullViewTodo = 558 KPrefsDialogWidBool *fullViewTodo =
559 addWidBool(i18n("Event list view uses full window"), 559 addWidBool(i18n("Event list view uses full window"),
560 &(KOPrefs::instance()->mFullViewTodo),topFrame); 560 &(KOPrefs::instance()->mFullViewTodo),topFrame);
561 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 561 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
562 dummy = 562 dummy =
563 addWidBool(i18n("Listview uses monthly timespan"), 563 addWidBool(i18n("Listview uses monthly timespan"),
564 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 564 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
565 topLayout->addWidget(dummy->checkBox(),ii++,0); 565 topLayout->addWidget(dummy->checkBox(),ii++,0);
566 dummy = 566 dummy =
567 addWidBool(i18n("Highlight selection in Time Edit"), 567 addWidBool(i18n("Highlight selection in Time Edit"),
568 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 568 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
569 topLayout->addWidget( dummy->checkBox(), ii++,0); 569 topLayout->addWidget( dummy->checkBox(), ii++,0);
570 570
571 KPrefsDialogWidBool *dailyRecur = 571 KPrefsDialogWidBool *dailyRecur =
572 addWidBool(i18n("Show events that recur daily in date nav."), 572 addWidBool(i18n("Show events that recur daily in date nav."),
573 &(KOPrefs::instance()->mDailyRecur),topFrame); 573 &(KOPrefs::instance()->mDailyRecur),topFrame);
574 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 574 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
575 575
576 KPrefsDialogWidBool *weeklyRecur = 576 KPrefsDialogWidBool *weeklyRecur =
577 addWidBool(i18n("Show ev. that recur weekly in date nav."), 577 addWidBool(i18n("Show ev. that recur weekly in date nav."),
578 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 578 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
579 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 579 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
580 580
581#ifdef DESKTOP_VERSION 581#ifdef DESKTOP_VERSION
582 KPrefsDialogWidBool *enableToolTips = 582 KPrefsDialogWidBool *enableToolTips =
583 addWidBool(i18n("Enable tooltips displaying summary of ev."), 583 addWidBool(i18n("Enable tooltips displaying summary of ev."),
584 &(KOPrefs::instance()->mEnableToolTips),topFrame); 584 &(KOPrefs::instance()->mEnableToolTips),topFrame);
585 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 585 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
586#endif 586#endif
587 // ********************************************************* 587 // *********************************************************
588 588
589 topFrame = addPage(i18n("Agenda View"),0,0); 589 topFrame = addPage(i18n("Agenda View"),0,0);
590 // DesktopIcon("viewmag",KIcon::SizeMedium)); 590 // DesktopIcon("viewmag",KIcon::SizeMedium));
591 591
592 topLayout = new QGridLayout(topFrame,5,1); 592 topLayout = new QGridLayout(topFrame,5,1);
593 topLayout->setSpacing(mSpacingHint); 593 topLayout->setSpacing(mSpacingHint);
594 topLayout->setMargin(mMarginHint); 594 topLayout->setMargin(mMarginHint);
595 ii = 0; 595 ii = 0;
596 596
597 597
598 dummy = 598 dummy =
599 addWidBool(i18n("Show time in agenda items"), 599 addWidBool(i18n("Show time in agenda items"),
600 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 600 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
601 topLayout->addWidget(dummy->checkBox(),ii++,0); 601 topLayout->addWidget(dummy->checkBox(),ii++,0);
602 602
603 dummy = 603 dummy =
604 addWidBool(i18n("Highlight current day in agenda"), 604 addWidBool(i18n("Highlight current day in agenda"),
605 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 605 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
606 topLayout->addWidget(dummy->checkBox(),ii++,0); 606 topLayout->addWidget(dummy->checkBox(),ii++,0);
607 607
608 dummy = 608 dummy =
609 addWidBool(i18n("Use light color for highlight current day"), 609 addWidBool(i18n("Use light color for highlight current day"),
610 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 610 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
611 topLayout->addWidget(dummy->checkBox(),ii++,0); 611 topLayout->addWidget(dummy->checkBox(),ii++,0);
612 612
613 613
614 KPrefsDialogWidBool *marcusBainsEnabled = 614 KPrefsDialogWidBool *marcusBainsEnabled =
615 addWidBool(i18n("Show current time"), 615 addWidBool(i18n("Show current time"),
616 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 616 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
617 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 617 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
618 618
619 619
620 dummy = 620 dummy =
621 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 621 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
622 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 622 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
623 topLayout->addWidget(dummy->checkBox(),ii++,0); 623 topLayout->addWidget(dummy->checkBox(),ii++,0);
624 624
625 dummy = 625 dummy =
626 addWidBool(i18n("Set agenda to current time on change"), 626 addWidBool(i18n("Set agenda to current time on change"),
627 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 627 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
628 topLayout->addWidget(dummy->checkBox(),ii++,0); 628 topLayout->addWidget(dummy->checkBox(),ii++,0);
629 629
630 630
631 dummy = 631 dummy =
632 addWidBool(i18n("Allday Agenda view shows todos"), 632 addWidBool(i18n("Allday Agenda view shows todos"),
633 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 633 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
634 topLayout->addWidget(dummy->checkBox(),ii++,0); 634 topLayout->addWidget(dummy->checkBox(),ii++,0);
635 635
636 636
637 637
638 dummy = 638 dummy =
639 addWidBool(i18n("Agenda view shows completed todos"), 639 addWidBool(i18n("Agenda view shows completed todos"),
640 &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame); 640 &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame);
641 topLayout->addWidget(dummy->checkBox(),ii++,0); 641 topLayout->addWidget(dummy->checkBox(),ii++,0);
642 642
643 643
644 644
645 645
646 646
647 topFrame = addPage(i18n("Month View"),0,0); 647 topFrame = addPage(i18n("Month View"),0,0);
648 // DesktopIcon("viewmag",KIcon::SizeMedium)); 648 // DesktopIcon("viewmag",KIcon::SizeMedium));
649 649
650 topLayout = new QGridLayout(topFrame,5,1); 650 topLayout = new QGridLayout(topFrame,5,1);
651 topLayout->setSpacing(mSpacingHint); 651 topLayout->setSpacing(mSpacingHint);
652 topLayout->setMargin(mMarginHint); 652 topLayout->setMargin(mMarginHint);
653 ii = 0; 653 ii = 0;
654 QLabel *lab; 654 QLabel *lab;
655 QHBox *habo = new QHBox( topFrame ); 655 QHBox *habo = new QHBox( topFrame );
656 if ( QApplication::desktop()->width() <= 480 ) { 656 if ( QApplication::desktop()->width() <= 480 ) {
657 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 657 lab = new QLabel ( i18n("Show events that recur "), topFrame );
658 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 658 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
659 ii++; 659 ii++;
660 } else { 660 } else {
661 new QLabel ( i18n("Show events that recur "), habo ); 661 new QLabel ( i18n("Show events that recur "), habo );
662 } 662 }
663 dailyRecur = 663 dailyRecur =
664 addWidBool(i18n("daily"), 664 addWidBool(i18n("daily"),
665 &(KOPrefs::instance()->mMonthDailyRecur),habo); 665 &(KOPrefs::instance()->mMonthDailyRecur),habo);
666 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 666 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
667 667
668 weeklyRecur = 668 weeklyRecur =
669 addWidBool(i18n("weekly"), 669 addWidBool(i18n("weekly"),
670 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 670 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
671 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 671 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
672 ii++; 672 ii++;
673 673
674 674
675 habo = new QHBox( topFrame ); 675 habo = new QHBox( topFrame );
676 if ( QApplication::desktop()->width() <= 480 ) { 676 if ( QApplication::desktop()->width() <= 480 ) {
677 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 677 lab = new QLabel (i18n("Show in every cell ") , topFrame );
678 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 678 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
679 ii++; 679 ii++;
680 680
681 } else { 681 } else {
682 new QLabel ( i18n("Show in every cell "), habo ); 682 new QLabel ( i18n("Show in every cell "), habo );
683 } 683 }
684 weeklyRecur = 684 weeklyRecur =
685 addWidBool(i18n("short month"), 685 addWidBool(i18n("short month"),
686 &(KOPrefs::instance()->mMonthShowShort),habo); 686 &(KOPrefs::instance()->mMonthShowShort),habo);
687 weeklyRecur = 687 weeklyRecur =
688 addWidBool(i18n("icons"), 688 addWidBool(i18n("icons"),
689 &(KOPrefs::instance()->mMonthShowIcons),habo); 689 &(KOPrefs::instance()->mMonthShowIcons),habo);
690 weeklyRecur = 690 weeklyRecur =
691 addWidBool(i18n("times"), 691 addWidBool(i18n("times"),
692 &(KOPrefs::instance()->mMonthShowTimes),habo); 692 &(KOPrefs::instance()->mMonthShowTimes),habo);
693 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 693 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
694 ii++; 694 ii++;
695#ifdef DESKTOP_VERSION 695#ifdef DESKTOP_VERSION
696 KPrefsDialogWidBool *enableMonthScroll = 696 KPrefsDialogWidBool *enableMonthScroll =
697 addWidBool(i18n("Enable scrollbars in month view cells"), 697 addWidBool(i18n("Enable scrollbars in month view cells"),
698 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 698 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
699 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 699 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
700#endif 700#endif
701 dummy = 701 dummy =
702 addWidBool(i18n("Week view mode uses bigger font"), 702 addWidBool(i18n("Week view mode uses bigger font"),
703 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 703 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
704 topLayout->addWidget(dummy->checkBox(),ii++,0); 704 topLayout->addWidget(dummy->checkBox(),ii++,0);
705 dummy = 705 dummy =
706 addWidBool(i18n("Show Sat/Sun together"), 706 addWidBool(i18n("Show Sat/Sun together"),
707 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 707 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
708 topLayout->addWidget(dummy->checkBox(),ii++,0); 708 topLayout->addWidget(dummy->checkBox(),ii++,0);
709 709
710 KPrefsDialogWidBool *coloredCategoriesInMonthView = 710 KPrefsDialogWidBool *coloredCategoriesInMonthView =
711 addWidBool(i18n("Month view uses category colors"), 711 addWidBool(i18n("Month view uses category colors"),
712 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 712 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
713 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 713 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
714 714
715 dummy = 715 dummy =
716 addWidBool(i18n("Category colors are applied to text"), 716 addWidBool(i18n("Category colors are applied to text"),
717 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 717 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
718 topLayout->addWidget(dummy->checkBox(),ii++,0); 718 topLayout->addWidget(dummy->checkBox(),ii++,0);
719 719
720 720
721 721
722 if ( QApplication::desktop()->height() <= 240 ) { 722 if ( QApplication::desktop()->height() <= 240 ) {
723 topFrame = addPage(i18n("Month View") +" 2",0,0); 723 topFrame = addPage(i18n("Month View") +" 2",0,0);
724 topLayout = new QGridLayout(topFrame,4,1); 724 topLayout = new QGridLayout(topFrame,4,1);
725 topLayout->setSpacing(2); 725 topLayout->setSpacing(2);
726 topLayout->setMargin(1); 726 topLayout->setMargin(1);
727 ii = 0; 727 ii = 0;
728 } 728 }
729 729
730 730
731 coloredCategoriesInMonthView = 731 coloredCategoriesInMonthView =
732 addWidBool(i18n("Month view uses day colors"), 732 addWidBool(i18n("Month view uses day colors"),
733 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 733 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
734 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 734 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
735 735
736 KPrefsDialogWidColor *holidayColor = 736 KPrefsDialogWidColor *holidayColor =
737 addWidColor(i18n("Day color odd months"), 737 addWidColor(i18n("Day color odd months"),
738 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 738 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
739 topLayout->addWidget(holidayColor->label(),ii,0); 739 topLayout->addWidget(holidayColor->label(),ii,0);
740 topLayout->addWidget(holidayColor->button(),ii++,1); 740 topLayout->addWidget(holidayColor->button(),ii++,1);
741 741
742 holidayColor = 742 holidayColor =
743 addWidColor(i18n("Day color even months"), 743 addWidColor(i18n("Day color even months"),
744 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 744 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
745 topLayout->addWidget(holidayColor->label(),ii,0); 745 topLayout->addWidget(holidayColor->label(),ii,0);
746 topLayout->addWidget(holidayColor->button(),ii++,1); 746 topLayout->addWidget(holidayColor->button(),ii++,1);
747 747
748 748
749 holidayColor = 749 holidayColor =
750 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 750 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
751 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 751 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
752 topLayout->addWidget(holidayColor->label(),ii,0); 752 topLayout->addWidget(holidayColor->label(),ii,0);
753 topLayout->addWidget(holidayColor->button(),ii++,1); 753 topLayout->addWidget(holidayColor->button(),ii++,1);
754 // *********************** What'sNext View 754 // *********************** What'sNext View
755 topFrame = addPage(i18n("What's Next View"),0,0); 755 topFrame = addPage(i18n("What's Next View"),0,0);
756 // DesktopIcon("viewmag",KIcon::SizeMedium)); 756 // DesktopIcon("viewmag",KIcon::SizeMedium));
757 757
758 topLayout = new QGridLayout(topFrame,4,1); 758 topLayout = new QGridLayout(topFrame,4,1);
759 topLayout->setSpacing(mSpacingHint); 759 topLayout->setSpacing(mSpacingHint);
760 topLayout->setMargin(mMarginHint); 760 topLayout->setMargin(mMarginHint);
761 ii = 0; 761 ii = 0;
762 762
763 763
764 QHBox* hdummy = new QHBox(topFrame); 764 QHBox* hdummy = new QHBox(topFrame);
765 new QLabel(i18n("Days in What's Next:"),hdummy); 765 new QLabel(i18n("Days in What's Next:"),hdummy);
766 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 766 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
767 767
768 topLayout->addWidget(hdummy,ii++,0); 768 topLayout->addWidget(hdummy,ii++,0);
769 769
770 QHBox *prioBox = new QHBox(topFrame); 770 QHBox *prioBox = new QHBox(topFrame);
771 // intervalBox->setSpacing(mSpacingHint); 771 // intervalBox->setSpacing(mSpacingHint);
772 topLayout->addWidget(prioBox,ii++,0); 772 topLayout->addWidget(prioBox,ii++,0);
773 773
774 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); 774 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
775 mPrioSpin = new QSpinBox(0,5,1,prioBox); 775 mPrioSpin = new QSpinBox(0,5,1,prioBox);
776 if ( QApplication::desktop()->width() < 300 ) 776 if ( QApplication::desktop()->width() < 300 )
777 mPrioSpin->setFixedWidth( 40 ); 777 mPrioSpin->setFixedWidth( 40 );
778 778
779 KPrefsDialogWidBool *passwdk = 779 KPrefsDialogWidBool *passwdk =
780 780
781 addWidBool(i18n("Show events that are done"), 781 addWidBool(i18n("Show events that are done"),
782 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 782 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
783 topLayout->addWidget(passwdk->checkBox(), ii++,0); 783 topLayout->addWidget(passwdk->checkBox(), ii++,0);
784 passwdk = 784 passwdk =
785 addWidBool(i18n("Show parent To-Do's"), 785 addWidBool(i18n("Show parent To-Do's"),
786 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 786 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
787 topLayout->addWidget(passwdk->checkBox(), ii++,0); 787 topLayout->addWidget(passwdk->checkBox(), ii++,0);
788 788
789 passwdk = 789 passwdk =
790 addWidBool(i18n("Show location"), 790 addWidBool(i18n("Show location"),
791 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 791 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
792 topLayout->addWidget(passwdk->checkBox(), ii++,0); 792 topLayout->addWidget(passwdk->checkBox(), ii++,0);
793 793
794 794
795 passwdk = 795 passwdk =
796 addWidBool(i18n("Use short date in WN+Event view"), 796 addWidBool(i18n("Use short date in WN+Event view"),
797 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 797 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
798 topLayout->addWidget(passwdk->checkBox(), ii++,0); 798 topLayout->addWidget(passwdk->checkBox(), ii++,0);
799 799
800 800
801 801
802 802
803 // *********************** Todo View 803 // *********************** Todo View
804 804
805 topFrame = addPage(i18n("Todo View"),0,0); 805 topFrame = addPage(i18n("Todo View"),0,0);
806 // DesktopIcon("viewmag",KIcon::SizeMedium)); 806 // DesktopIcon("viewmag",KIcon::SizeMedium));
807 807
808 topLayout = new QGridLayout(topFrame,4,1); 808 topLayout = new QGridLayout(topFrame,4,1);
809 topLayout->setSpacing(mSpacingHint); 809 topLayout->setSpacing(mSpacingHint);
810 topLayout->setMargin(mMarginHint); 810 topLayout->setMargin(mMarginHint);
811 ii = 0; 811 ii = 0;
812dummy = 812dummy =
813 addWidBool(i18n("Hide not running Todos in To-do view"), 813 addWidBool(i18n("Hide not running Todos in To-do view"),
814 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 814 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
815 topLayout->addWidget(dummy->checkBox(),ii++,0); 815 topLayout->addWidget(dummy->checkBox(),ii++,0);
816 816
817 817
818 KPrefsDialogWidBool *showCompletedTodo = 818 KPrefsDialogWidBool *showCompletedTodo =
819 addWidBool(i18n("To-do view shows completed Todos"), 819 addWidBool(i18n("To-do view shows completed Todos"),
820 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 820 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
821 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 821 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
822 dummy = 822 dummy =
823 addWidBool(i18n("To-do view shows complete as 'xx %'"), 823 addWidBool(i18n("To-do view shows complete as 'xx %'"),
824 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 824 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
825 topLayout->addWidget(dummy->checkBox(),ii++,0); 825 topLayout->addWidget(dummy->checkBox(),ii++,0);
826 826
827 dummy = 827 dummy =
828 addWidBool(i18n("Small To-do view uses smaller font"), 828 addWidBool(i18n("Small To-do view uses smaller font"),
829 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 829 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
830 topLayout->addWidget(dummy->checkBox(),ii++,0); 830 topLayout->addWidget(dummy->checkBox(),ii++,0);
831 831
832 832
833 833
834 dummy = 834 dummy =
835 addWidBool(i18n("Todo view uses category colors"), 835 addWidBool(i18n("Todo view uses category colors"),
836 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 836 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
837 topLayout->addWidget(dummy->checkBox(),ii++,0); 837 topLayout->addWidget(dummy->checkBox(),ii++,0);
838 838
839 839
840 QWidget* wid = new QWidget( topFrame ); 840 QWidget* wid = new QWidget( topFrame );
841 // Todo run today color 841 // Todo run today color
842 KPrefsDialogWidColor *todoRunColor = 842 KPrefsDialogWidColor *todoRunColor =
843 addWidColor(i18n("Color for running todos:"), 843 addWidColor(i18n("Color for running todos:"),
844 &(KOPrefs::instance()->mTodoRunColor),wid); 844 &(KOPrefs::instance()->mTodoRunColor),wid);
845 QHBoxLayout *widLayout = new QHBoxLayout(wid); 845 QHBoxLayout *widLayout = new QHBoxLayout(wid);
846 widLayout->addWidget( todoRunColor->label() ); 846 widLayout->addWidget( todoRunColor->label() );
847 widLayout->addWidget( todoRunColor->button() ); 847 widLayout->addWidget( todoRunColor->button() );
848 topLayout->addWidget(wid,ii++,0); 848 topLayout->addWidget(wid,ii++,0);
849 849
850 wid = new QWidget( topFrame ); 850 wid = new QWidget( topFrame );
851 // Todo due today color 851 // Todo due today color
852 KPrefsDialogWidColor *todoDueTodayColor = 852 KPrefsDialogWidColor *todoDueTodayColor =
853 addWidColor(i18n("Todo due today color:"), 853 addWidColor(i18n("Todo due today color:"),
854 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 854 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
855 widLayout = new QHBoxLayout(wid); 855 widLayout = new QHBoxLayout(wid);
856 widLayout->addWidget( todoDueTodayColor->label() ); 856 widLayout->addWidget( todoDueTodayColor->label() );
857 widLayout->addWidget( todoDueTodayColor->button() ); 857 widLayout->addWidget( todoDueTodayColor->button() );
858 topLayout->addWidget(wid,ii++,0); 858 topLayout->addWidget(wid,ii++,0);
859 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 859 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
860 860
861 // Todo overdue color 861 // Todo overdue color
862 wid = new QWidget( topFrame ); 862 wid = new QWidget( topFrame );
863 widLayout = new QHBoxLayout(wid); 863 widLayout = new QHBoxLayout(wid);
864 KPrefsDialogWidColor *todoOverdueColor = 864 KPrefsDialogWidColor *todoOverdueColor =
865 addWidColor(i18n("Todo overdue color:"), 865 addWidColor(i18n("Todo overdue color:"),
866 &(KOPrefs::instance()->mTodoOverdueColor),wid); 866 &(KOPrefs::instance()->mTodoOverdueColor),wid);
867 widLayout->addWidget(todoOverdueColor->label()); 867 widLayout->addWidget(todoOverdueColor->label());
868 widLayout->addWidget(todoOverdueColor->button()); 868 widLayout->addWidget(todoOverdueColor->button());
869 topLayout->addWidget(wid,ii++,0); 869 topLayout->addWidget(wid,ii++,0);
870 870
871 dummy = 871 dummy =
872 addWidBool(i18n("Colors are applied to text"), 872 addWidBool(i18n("Colors are applied to text"),
873 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 873 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
874 topLayout->addWidget(dummy->checkBox(),ii++,0); 874 topLayout->addWidget(dummy->checkBox(),ii++,0);
875 875
876 876
877 877
878 topFrame = addPage(i18n("View Options"),0,0); 878 topFrame = addPage(i18n("View Options"),0,0);
879 879
880 topLayout = new QGridLayout(topFrame,4,1); 880 topLayout = new QGridLayout(topFrame,4,1);
881 topLayout->setSpacing(mSpacingHint); 881 topLayout->setSpacing(mSpacingHint);
882 topLayout->setMargin(mMarginHint); 882 topLayout->setMargin(mMarginHint);
883 ii = 0; 883 ii = 0;
884 884
885 dummy = 885 dummy =
886 addWidBool(i18n("Show Sync Events"), 886 addWidBool(i18n("Show Sync Events"),
887 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 887 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
888 topLayout->addWidget(dummy->checkBox(), ii++,0); 888 topLayout->addWidget(dummy->checkBox(), ii++,0);
889 889
890 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 890 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
891 topLayout->addWidget(lab ,ii++,0); 891 topLayout->addWidget(lab ,ii++,0);
892 892
893 dummy = addWidBool(i18n("Details"), 893 dummy = addWidBool(i18n("Details"),
894 &(KOPrefs::instance()->mEVshowDetails),topFrame); 894 &(KOPrefs::instance()->mEVshowDetails),topFrame);
895 topLayout->addWidget(dummy->checkBox(),ii++,0); 895 topLayout->addWidget(dummy->checkBox(),ii++,0);
896 dummy = addWidBool(i18n("Created time"), 896 dummy = addWidBool(i18n("Created time"),
897 &(KOPrefs::instance()->mEVshowCreated),topFrame); 897 &(KOPrefs::instance()->mEVshowCreated),topFrame);
898 topLayout->addWidget(dummy->checkBox(),ii++,0); 898 topLayout->addWidget(dummy->checkBox(),ii++,0);
899 dummy = addWidBool(i18n("Last modified time"), 899 dummy = addWidBool(i18n("Last modified time"),
900 &(KOPrefs::instance()->mEVshowChanged),topFrame); 900 &(KOPrefs::instance()->mEVshowChanged),topFrame);
901 topLayout->addWidget(dummy->checkBox(),ii++,0); 901 topLayout->addWidget(dummy->checkBox(),ii++,0);
902 902
903 903
904 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 904 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
905 topLayout->addWidget(lab ,ii++,0); 905 topLayout->addWidget(lab ,ii++,0);
906 906
907 dummy = addWidBool(i18n("Details"), 907 dummy = addWidBool(i18n("Details"),
908 &(KOPrefs::instance()->mWTshowDetails),topFrame); 908 &(KOPrefs::instance()->mWTshowDetails),topFrame);
909 topLayout->addWidget(dummy->checkBox(),ii++,0); 909 topLayout->addWidget(dummy->checkBox(),ii++,0);
910 dummy = addWidBool(i18n("Created time"), 910 dummy = addWidBool(i18n("Created time"),
911 &(KOPrefs::instance()->mWTshowCreated),topFrame); 911 &(KOPrefs::instance()->mWTshowCreated),topFrame);
912 topLayout->addWidget(dummy->checkBox(),ii++,0); 912 topLayout->addWidget(dummy->checkBox(),ii++,0);
913 dummy = addWidBool(i18n("Last modified time"), 913 dummy = addWidBool(i18n("Last modified time"),
914 &(KOPrefs::instance()->mWTshowChanged),topFrame); 914 &(KOPrefs::instance()->mWTshowChanged),topFrame);
915 topLayout->addWidget(dummy->checkBox(),ii++,0); 915 topLayout->addWidget(dummy->checkBox(),ii++,0);
916 916
917 917
918 topFrame = addPage(i18n("Alarm"),0,0); 918 topFrame = addPage(i18n("Alarm"),0,0);
919 // DesktopIcon("viewmag",KIcon::SizeMedium)); 919 // DesktopIcon("viewmag",KIcon::SizeMedium));
920 920
921 topLayout = new QGridLayout(topFrame,2,1); 921 topLayout = new QGridLayout(topFrame,2,1);
922 topLayout->setSpacing(mSpacingHint); 922 topLayout->setSpacing(mSpacingHint);
923 topLayout->setMargin(mMarginHint); 923 topLayout->setMargin(mMarginHint);
924 int iii = 0; 924 int iii = 0;
925 925
926 dummy = 926 dummy =
927 addWidBool(i18n("Use internal alarm notification"), 927 addWidBool(i18n("Use internal alarm notification"),
928 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 928 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
929 topLayout->addWidget(dummy->checkBox(),iii++,0); 929 topLayout->addWidget(dummy->checkBox(),iii++,0);
930 930
931 if ( QApplication::desktop()->height() > 240 ) { 931 if ( QApplication::desktop()->height() > 240 ) {
932 932
933 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); 933 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);
934 934
935 topLayout->addWidget(lab ,iii++,0); 935 topLayout->addWidget(lab ,iii++,0);
936 } 936 }
937#ifndef DESKTOP_VERSION 937#ifndef DESKTOP_VERSION
938 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 938 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
939#else 939#else
940 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 940 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
941 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 941 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
942#endif 942#endif
943 943
944 QHBox* dummyBox = new QHBox(topFrame); 944 QHBox* dummyBox = new QHBox(topFrame);
945 new QLabel(i18n("Play beeps count:"),dummyBox); 945 new QLabel(i18n("Play beeps count:"),dummyBox);
946 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 946 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
947 topLayout->addWidget(dummyBox,iii++,0); 947 topLayout->addWidget(dummyBox,iii++,0);
948 948
949 dummyBox = new QHBox(topFrame); 949 dummyBox = new QHBox(topFrame);
950 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 950 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
951 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 951 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
952 topLayout->addWidget(dummyBox,iii++,0); 952 topLayout->addWidget(dummyBox,iii++,0);
953 953
954 dummyBox = new QHBox(topFrame); 954 dummyBox = new QHBox(topFrame);
955 new QLabel(i18n("Default suspend time in min:"),dummyBox); 955 new QLabel(i18n("Default suspend time in min:"),dummyBox);
956 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 956 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
957 topLayout->addWidget(dummyBox,iii++,0); 957 topLayout->addWidget(dummyBox,iii++,0);
958 958
959 dummyBox = new QHBox(topFrame); 959 dummyBox = new QHBox(topFrame);
960 new QLabel(i18n("Auto suspend count:"),dummyBox); 960 new QLabel(i18n("Auto suspend count:"),dummyBox);
961 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 961 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
962 topLayout->addWidget(dummyBox,iii++,0); 962 topLayout->addWidget(dummyBox,iii++,0);
963 963
964 964
965 965
966 QHBox* hbo = new QHBox ( topFrame ); 966 QHBox* hbo = new QHBox ( topFrame );
967 mDefaultAlarmFile = new QLineEdit(hbo); 967 mDefaultAlarmFile = new QLineEdit(hbo);
968 QPushButton * loadTemplate = new QPushButton(hbo); 968 QPushButton * loadTemplate = new QPushButton(hbo);
969 QPixmap icon; 969 QPixmap icon;
970 if ( QApplication::desktop()->width() < 321 ) 970 if ( QApplication::desktop()->width() < 321 )
971 icon = SmallIcon("fileimport16"); 971 icon = SmallIcon("fileimport16");
972 else 972 else
973 icon = SmallIcon("fileimport"); 973 icon = SmallIcon("fileimport");
974 loadTemplate->setIconSet (icon ) ; 974 loadTemplate->setIconSet (icon ) ;
975 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 975 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
976 int size = loadTemplate->sizeHint().height(); 976 int size = loadTemplate->sizeHint().height();
977 loadTemplate->setFixedSize( size, size ); 977 loadTemplate->setFixedSize( size, size );
978 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 978 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
979 // topLayout->addWidget(lab ,iii++,0); 979 // topLayout->addWidget(lab ,iii++,0);
980 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 980 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
981 topLayout->addWidget(lab ,iii++,0); 981 topLayout->addWidget(lab ,iii++,0);
982 topLayout->addWidget(hbo,iii++,0); 982 topLayout->addWidget(hbo,iii++,0);
983 // 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); 983 // 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);
984 984
985// topLayout->addWidget(lab ,iii++,0); 985// topLayout->addWidget(lab ,iii++,0);
986// #ifndef DESKTOP_VERSION 986// #ifndef DESKTOP_VERSION
987// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 987// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
988// #else 988// #else
989// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 989// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
990// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 990// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
991// #endif 991// #endif
992 992
993 993
994} 994}
995 995
996void KOPrefsDialog::selectSoundFile() 996void KOPrefsDialog::selectSoundFile()
997{ 997{
998 QString fileName = mDefaultAlarmFile->text(); 998 QString fileName = mDefaultAlarmFile->text();
999 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 999 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1000 if ( fileName.length() > 0 ) 1000 if ( fileName.length() > 0 )
1001 mDefaultAlarmFile->setText( fileName ); 1001 mDefaultAlarmFile->setText( fileName );
1002} 1002}
1003void KOPrefsDialog::setupFontsTab() 1003void KOPrefsDialog::setupFontsTab()
1004{ 1004{
1005 1005
1006 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1006 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1007 // DesktopIcon("fonts",KIcon::SizeMedium)); 1007 // DesktopIcon("fonts",KIcon::SizeMedium));
1008 1008
1009 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1009 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1010 topLayout->setSpacing(1); 1010 topLayout->setSpacing(1);
1011 topLayout->setMargin(3); 1011 topLayout->setMargin(3);
1012 KPrefsDialogWidFont * tVFont; 1012 KPrefsDialogWidFont * tVFont;
1013 int i = 0; 1013 int i = 0;
1014 KPrefsDialogWidFont *timeLabelsFont = 1014 KPrefsDialogWidFont *timeLabelsFont =
1015 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1015 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1016 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1016 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1017 topLayout->addWidget(timeLabelsFont->label(),i,0); 1017 topLayout->addWidget(timeLabelsFont->label(),i,0);
1018 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1018 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1019 topLayout->addWidget(timeLabelsFont->button(),i,2); 1019 topLayout->addWidget(timeLabelsFont->button(),i,2);
1020 ++i; 1020 ++i;
1021 1021
1022 1022
1023 timeLabelsFont = 1023 timeLabelsFont =
1024 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1024 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1025 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1025 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1026 topLayout->addWidget(timeLabelsFont->label(),i,0); 1026 topLayout->addWidget(timeLabelsFont->label(),i,0);
1027 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1027 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1028 topLayout->addWidget(timeLabelsFont->button(),i,2); 1028 topLayout->addWidget(timeLabelsFont->button(),i,2);
1029 ++i; 1029 ++i;
1030 1030
1031 KPrefsDialogWidFont *timeBarFont = 1031 KPrefsDialogWidFont *timeBarFont =
1032 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1032 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1033 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1033 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1034 topLayout->addWidget(timeBarFont->label(),i,0); 1034 topLayout->addWidget(timeBarFont->label(),i,0);
1035 topLayout->addWidget(timeBarFont->preview(),i,1); 1035 topLayout->addWidget(timeBarFont->preview(),i,1);
1036 topLayout->addWidget(timeBarFont->button(),i,2); 1036 topLayout->addWidget(timeBarFont->button(),i,2);
1037 ++i; 1037 ++i;
1038 1038
1039 1039
1040 KPrefsDialogWidFont *marcusBainsFont = 1040 KPrefsDialogWidFont *marcusBainsFont =
1041 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1041 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1042 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1042 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1043 topLayout->addWidget(marcusBainsFont->label(),i,0); 1043 topLayout->addWidget(marcusBainsFont->label(),i,0);
1044 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1044 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1045 topLayout->addWidget(marcusBainsFont->button(),i,2); 1045 topLayout->addWidget(marcusBainsFont->button(),i,2);
1046 ++i; 1046 ++i;
1047 1047
1048 tVFont = 1048 tVFont =
1049 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1049 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1050 &(KOPrefs::instance()->mEventViewFont),topFrame); 1050 &(KOPrefs::instance()->mEventViewFont),topFrame);
1051 topLayout->addWidget(tVFont->label(),i,0); 1051 topLayout->addWidget(tVFont->label(),i,0);
1052 topLayout->addWidget(tVFont->preview(),i,1); 1052 topLayout->addWidget(tVFont->preview(),i,1);
1053 topLayout->addWidget(tVFont->button(),i,2); 1053 topLayout->addWidget(tVFont->button(),i,2);
1054 ++i; 1054 ++i;
1055 1055
1056 1056
1057 1057
1058 tVFont = 1058 tVFont =
1059 addWidFont(i18n("Details"),i18n("EditorBox:"), 1059 addWidFont(i18n("Details"),i18n("EditorBox:"),
1060 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1060 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1061 topLayout->addWidget(tVFont->label(),i,0); 1061 topLayout->addWidget(tVFont->label(),i,0);
1062 topLayout->addWidget(tVFont->preview(),i,1); 1062 topLayout->addWidget(tVFont->preview(),i,1);
1063 topLayout->addWidget(tVFont->button(),i,2); 1063 topLayout->addWidget(tVFont->button(),i,2);
1064 ++i; 1064 ++i;
1065 1065
1066 1066
1067 1067
1068 topLayout->setColStretch(1,1); 1068 topLayout->setColStretch(1,1);
1069 topLayout->setRowStretch(4,1); 1069 topLayout->setRowStretch(4,1);
1070 1070
1071 1071
1072 i = 0; 1072 i = 0;
1073 topFrame = addPage(i18n("View Fonts"),0, 1073 topFrame = addPage(i18n("View Fonts"),0,
1074 DesktopIcon("fonts",KIcon::SizeMedium)); 1074 DesktopIcon("fonts",KIcon::SizeMedium));
1075 1075
1076 topLayout = new QGridLayout(topFrame,7,3); 1076 topLayout = new QGridLayout(topFrame,7,3);
1077 topLayout->setSpacing(1); 1077 topLayout->setSpacing(1);
1078 topLayout->setMargin(3); 1078 topLayout->setMargin(3);
1079 1079
1080 tVFont = 1080 tVFont =
1081 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1081 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1082 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1082 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1083 topLayout->addWidget(tVFont->label(),i,0); 1083 topLayout->addWidget(tVFont->label(),i,0);
1084 topLayout->addWidget(tVFont->preview(),i,1); 1084 topLayout->addWidget(tVFont->preview(),i,1);
1085 topLayout->addWidget(tVFont->button(),i,2); 1085 topLayout->addWidget(tVFont->button(),i,2);
1086 ++i; 1086 ++i;
1087 KPrefsDialogWidFont *agendaViewFont = 1087 KPrefsDialogWidFont *agendaViewFont =
1088 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1088 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1089 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1089 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1090 topLayout->addWidget(agendaViewFont->label(),i,0); 1090 topLayout->addWidget(agendaViewFont->label(),i,0);
1091 topLayout->addWidget(agendaViewFont->preview(),i,1); 1091 topLayout->addWidget(agendaViewFont->preview(),i,1);
1092 topLayout->addWidget(agendaViewFont->button(),i,2); 1092 topLayout->addWidget(agendaViewFont->button(),i,2);
1093 ++i; 1093 ++i;
1094 1094
1095 1095
1096 KPrefsDialogWidFont *monthViewFont = 1096 KPrefsDialogWidFont *monthViewFont =
1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1098 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1098 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1099 topLayout->addWidget(monthViewFont->label(),i,0); 1099 topLayout->addWidget(monthViewFont->label(),i,0);
1100 topLayout->addWidget(monthViewFont->preview(),i,1); 1100 topLayout->addWidget(monthViewFont->preview(),i,1);
1101 topLayout->addWidget(monthViewFont->button(),i,2); 1101 topLayout->addWidget(monthViewFont->button(),i,2);
1102 ++i; 1102 ++i;
1103 1103
1104 1104
1105 KPrefsDialogWidFont *lVFont = 1105 KPrefsDialogWidFont *lVFont =
1106 addWidFont(i18n("Event"),i18n("List View:"), 1106 addWidFont(i18n("Event"),i18n("List View:"),
1107 &(KOPrefs::instance()->mListViewFont),topFrame); 1107 &(KOPrefs::instance()->mListViewFont),topFrame);
1108 topLayout->addWidget(lVFont->label(),i,0); 1108 topLayout->addWidget(lVFont->label(),i,0);
1109 topLayout->addWidget(lVFont->preview(),i,1); 1109 topLayout->addWidget(lVFont->preview(),i,1);
1110 topLayout->addWidget(lVFont->button(),i,2); 1110 topLayout->addWidget(lVFont->button(),i,2);
1111 ++i; 1111 ++i;
1112 1112
1113 1113
1114 tVFont = 1114 tVFont =
1115 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1115 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1116 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1116 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1117 topLayout->addWidget(tVFont->label(),i,0); 1117 topLayout->addWidget(tVFont->label(),i,0);
1118 topLayout->addWidget(tVFont->preview(),i,1); 1118 topLayout->addWidget(tVFont->preview(),i,1);
1119 topLayout->addWidget(tVFont->button(),i,2); 1119 topLayout->addWidget(tVFont->button(),i,2);
1120 ++i; 1120 ++i;
1121 1121
1122 1122
1123 tVFont = 1123 tVFont =
1124 addWidFont(i18n("Today"),i18n("JournalView:"), 1124 addWidFont(i18n("Today"),i18n("JournalView:"),
1125 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1125 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1126 topLayout->addWidget(tVFont->label(),i,0); 1126 topLayout->addWidget(tVFont->label(),i,0);
1127 topLayout->addWidget(tVFont->preview(),i,1); 1127 topLayout->addWidget(tVFont->preview(),i,1);
1128 topLayout->addWidget(tVFont->button(),i,2); 1128 topLayout->addWidget(tVFont->button(),i,2);
1129 ++i; 1129 ++i;
1130 1130
1131 1131
1132 1132
1133 1133
1134 topLayout->setColStretch(1,1); 1134 topLayout->setColStretch(1,1);
1135 topLayout->setRowStretch(4,1); 1135 topLayout->setRowStretch(4,1);
1136 1136
1137 1137
1138 1138
1139 1139
1140} 1140}
1141 1141
1142void KOPrefsDialog::setupColorsTab() 1142void KOPrefsDialog::setupColorsTab()
1143{ 1143{
1144 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1144 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1145 // DesktopIcon("colorize",KIcon::SizeMedium)); 1145 // DesktopIcon("colorize",KIcon::SizeMedium));
1146 1146
1147 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1147 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1148 // topLayout->setSpacing(mSpacingHint); 1148 // topLayout->setSpacing(mSpacingHint);
1149 // topLayout->setMargin(mMarginHint); 1149 // topLayout->setMargin(mMarginHint);
1150 1150
1151 topLayout->setSpacing(2); 1151 topLayout->setSpacing(2);
1152 topLayout->setMargin(3); 1152 topLayout->setMargin(3);
1153 1153
1154 int ii = 1; 1154 int ii = 1;
1155 QGroupBox *categoryGroup ; 1155 QGroupBox *categoryGroup ;
1156 1156
1157 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1157 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1158 topFrame); 1158 topFrame);
1159 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1159 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1160 1160
1161 mCategoryCombo = new QComboBox(categoryGroup); 1161 mCategoryCombo = new QComboBox(categoryGroup);
1162 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1162 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1163 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1163 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1164 1164
1165 mCategoryButton = new KColorButton(categoryGroup); 1165 mCategoryButton = new KColorButton(categoryGroup);
1166 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1166 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1167 updateCategoryColor(); 1167 updateCategoryColor();
1168 1168
1169 1169
1170 // Holiday Color 1170 // Holiday Color
1171 1171
1172 KPrefsDialogWidColor *holidayColor = 1172 KPrefsDialogWidColor *holidayColor =
1173 addWidColor(i18n("Holiday color:"), 1173 addWidColor(i18n("Holiday color:"),
1174 &(KOPrefs::instance()->mHolidayColor),topFrame); 1174 &(KOPrefs::instance()->mHolidayColor),topFrame);
1175 topLayout->addWidget(holidayColor->label(),ii,0); 1175 topLayout->addWidget(holidayColor->label(),ii,0);
1176 topLayout->addWidget(holidayColor->button(),ii++,1); 1176 topLayout->addWidget(holidayColor->button(),ii++,1);
1177 1177
1178 // Highlight Color 1178 // Highlight Color
1179 KPrefsDialogWidColor *highlightColor = 1179 KPrefsDialogWidColor *highlightColor =
1180 addWidColor(i18n("Highlight color:"), 1180 addWidColor(i18n("Highlight color:"),
1181 &(KOPrefs::instance()->mHighlightColor),topFrame); 1181 &(KOPrefs::instance()->mHighlightColor),topFrame);
1182 topLayout->addWidget(highlightColor->label(),ii,0); 1182 topLayout->addWidget(highlightColor->label(),ii,0);
1183 topLayout->addWidget(highlightColor->button(),ii++,1); 1183 topLayout->addWidget(highlightColor->button(),ii++,1);
1184 1184
1185 // Event color 1185 // Event color
1186 KPrefsDialogWidColor *eventColor = 1186 KPrefsDialogWidColor *eventColor =
1187 addWidColor(i18n("Default event color:"), 1187 addWidColor(i18n("Default event color:"),
1188 &(KOPrefs::instance()->mEventColor),topFrame); 1188 &(KOPrefs::instance()->mEventColor),topFrame);
1189 topLayout->addWidget(eventColor->label(),ii,0); 1189 topLayout->addWidget(eventColor->label(),ii,0);
1190 topLayout->addWidget(eventColor->button(),ii++,1); 1190 topLayout->addWidget(eventColor->button(),ii++,1);
1191 eventColor = 1191 eventColor =
1192 addWidColor(i18n("Default todo done color:"), 1192 addWidColor(i18n("Default todo done color:"),
1193 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1193 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1194 topLayout->addWidget(eventColor->label(),ii,0); 1194 topLayout->addWidget(eventColor->label(),ii,0);
1195 topLayout->addWidget(eventColor->button(),ii++,1); 1195 topLayout->addWidget(eventColor->button(),ii++,1);
1196 1196
1197 if ( QApplication::desktop()->height() <= 240 ) { 1197 if ( QApplication::desktop()->height() <= 240 ) {
1198 topFrame = addPage(i18n("Colors") +" 2",0,0); 1198 topFrame = addPage(i18n("Colors") +" 2",0,0);
1199 // DesktopIcon("colorize",KIcon::SizeMedium)); 1199 // DesktopIcon("colorize",KIcon::SizeMedium));
1200 1200
1201 topLayout = new QGridLayout(topFrame,5,2); 1201 topLayout = new QGridLayout(topFrame,5,2);
1202 // topLayout->setSpacing(mSpacingHint); 1202 // topLayout->setSpacing(mSpacingHint);
1203 // topLayout->setMargin(mMarginHint); 1203 // topLayout->setMargin(mMarginHint);
1204 1204
1205 topLayout->setSpacing(2); 1205 topLayout->setSpacing(2);
1206 topLayout->setMargin(3); 1206 topLayout->setMargin(3);
1207 } 1207 }
1208 1208
1209 1209
1210 // agenda view background color 1210 // agenda view background color
1211 KPrefsDialogWidColor *agendaBgColor = 1211 KPrefsDialogWidColor *agendaBgColor =
1212 addWidColor(i18n("Agenda view background color:"), 1212 addWidColor(i18n("Agenda view background color:"),
1213 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1213 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1214 topLayout->addWidget(agendaBgColor->label(),ii,0); 1214 topLayout->addWidget(agendaBgColor->label(),ii,0);
1215 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1215 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1216 1216
1217 // working hours color 1217 // working hours color
1218 KPrefsDialogWidColor *workingHoursColor = 1218 KPrefsDialogWidColor *workingHoursColor =
1219 addWidColor(i18n("Working hours color:"), 1219 addWidColor(i18n("Working hours color:"),
1220 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1220 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1221 topLayout->addWidget(workingHoursColor->label(),ii,0); 1221 topLayout->addWidget(workingHoursColor->label(),ii,0);
1222 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1222 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1223 1223
1224 KPrefsDialogWidBool *sb = 1224 KPrefsDialogWidBool *sb =
1225 addWidBool(i18n("Use colors for application:"), 1225 addWidBool(i18n("Use colors for application:"),
1226 &(KOPrefs::instance()->mUseAppColors),topFrame); 1226 &(KOPrefs::instance()->mUseAppColors),topFrame);
1227 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1227 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1228 1228
1229 ii++; 1229 ii++;
1230 KPrefsDialogWidColor * workingHoursColor1 = 1230 KPrefsDialogWidColor * workingHoursColor1 =
1231 addWidColor(i18n("Buttons, menus, etc.:"), 1231 addWidColor(i18n("Buttons, menus, etc.:"),
1232 &(KOPrefs::instance()->mAppColor1),topFrame); 1232 &(KOPrefs::instance()->mAppColor1),topFrame);
1233 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1233 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1234 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1234 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1235 1235
1236 KPrefsDialogWidColor * workingHoursColor2 = 1236 KPrefsDialogWidColor * workingHoursColor2 =
1237 addWidColor(i18n("Frames, labels, etc.:"), 1237 addWidColor(i18n("Frames, labels, etc.:"),
1238 &(KOPrefs::instance()->mAppColor2),topFrame); 1238 &(KOPrefs::instance()->mAppColor2),topFrame);
1239 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1239 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1240 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1240 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1241 1241
1242 1242
1243 1243
1244} 1244}
1245 1245
1246void KOPrefsDialog::setCategoryColor() 1246void KOPrefsDialog::setCategoryColor()
1247{ 1247{
1248 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1248 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1249} 1249}
1250 1250
1251void KOPrefsDialog::updateCategoryColor() 1251void KOPrefsDialog::updateCategoryColor()
1252{ 1252{
1253 QString cat = mCategoryCombo->currentText(); 1253 QString cat = mCategoryCombo->currentText();
1254 QColor *color = mCategoryDict.find(cat); 1254 QColor *color = mCategoryDict.find(cat);
1255 if (!color) { 1255 if (!color) {
1256 color = KOPrefs::instance()->categoryColor(cat); 1256 color = KOPrefs::instance()->categoryColor(cat);
1257 } 1257 }
1258 if (color) { 1258 if (color) {
1259 mCategoryButton->setColor(*color); 1259 mCategoryButton->setColor(*color);
1260 } 1260 }
1261} 1261}
1262 1262
1263void KOPrefsDialog::setupPrinterTab() 1263void KOPrefsDialog::setupPrinterTab()
1264{ 1264{
1265 mPrinterTab = addPage(i18n("Printing"),0, 1265 mPrinterTab = addPage(i18n("Printing"),0,
1266 DesktopIcon("fileprint",KIcon::SizeMedium)); 1266 DesktopIcon("fileprint",KIcon::SizeMedium));
1267 1267
1268 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1268 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1269 topLayout->setSpacing(mSpacingHint); 1269 topLayout->setSpacing(mSpacingHint);
1270 topLayout->setMargin(mMarginHint); 1270 topLayout->setMargin(mMarginHint);
1271 1271
1272 topLayout->setRowStretch(4,1); 1272 topLayout->setRowStretch(4,1);
1273} 1273}
1274 1274
1275void KOPrefsDialog::setupGroupSchedulingTab() 1275void KOPrefsDialog::setupGroupSchedulingTab()
1276{ 1276{
1277#if 0 1277#if 0
1278 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1278 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1279 DesktopIcon("personal",KIcon::SizeMedium)); 1279 DesktopIcon("personal",KIcon::SizeMedium));
1280 1280
1281 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1281 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1282 topLayout->setSpacing(mSpacingHint); 1282 topLayout->setSpacing(mSpacingHint);
1283 topLayout->setMargin(mMarginHint); 1283 topLayout->setMargin(mMarginHint);
1284 1284
1285#if 0 1285#if 0
1286 KPrefsDialogWidRadios *schedulerGroup = 1286 KPrefsDialogWidRadios *schedulerGroup =
1287 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1287 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1288 topFrame); 1288 topFrame);
1289 schedulerGroup->addRadio("Dummy"); // Only for debugging 1289 schedulerGroup->addRadio("Dummy"); // Only for debugging
1290 schedulerGroup->addRadio(i18n("Mail client")); 1290 schedulerGroup->addRadio(i18n("Mail client"));
1291 1291
1292 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1292 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1293#endif 1293#endif
1294 1294
1295 KPrefsDialogWidRadios *sendGroup = 1295 KPrefsDialogWidRadios *sendGroup =
1296 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1296 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1297 topFrame); 1297 topFrame);
1298 sendGroup->addRadio(i18n("Send to outbox")); 1298 sendGroup->addRadio(i18n("Send to outbox"));
1299 sendGroup->addRadio(i18n("Send directly")); 1299 sendGroup->addRadio(i18n("Send directly"));
1300 1300
1301 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1301 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1302 1302
1303 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1303 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1304 mAMails = new QListView(topFrame); 1304 mAMails = new QListView(topFrame);
1305 mAMails->addColumn(i18n("Email"),300); 1305 mAMails->addColumn(i18n("Email"),300);
1306 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1306 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1307 1307
1308 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1308 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1309 aEmailsEdit = new QLineEdit(topFrame); 1309 aEmailsEdit = new QLineEdit(topFrame);
1310 aEmailsEdit->setEnabled(false); 1310 aEmailsEdit->setEnabled(false);
1311 topLayout->addWidget(aEmailsEdit,4,1); 1311 topLayout->addWidget(aEmailsEdit,4,1);
1312 1312
1313 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1313 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1314 topLayout->addWidget(add,5,0); 1314 topLayout->addWidget(add,5,0);
1315 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1315 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1316 topLayout->addWidget(del,5,1); 1316 topLayout->addWidget(del,5,1);
1317 1317
1318 //topLayout->setRowStretch(2,1); 1318 //topLayout->setRowStretch(2,1);
1319 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1319 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1320 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1320 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1321 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1321 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1322 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1322 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1323#endif 1323#endif
1324} 1324}
1325 1325
1326void KOPrefsDialog::setupGroupAutomationTab() 1326void KOPrefsDialog::setupGroupAutomationTab()
1327{ 1327{
1328 return; 1328 return;
1329 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1329 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1330 DesktopIcon("personal",KIcon::SizeMedium)); 1330 DesktopIcon("personal",KIcon::SizeMedium));
1331 1331
1332 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1332 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1333 topLayout->setSpacing(mSpacingHint); 1333 topLayout->setSpacing(mSpacingHint);
1334 topLayout->setMargin(mMarginHint); 1334 topLayout->setMargin(mMarginHint);
1335 1335
1336 KPrefsDialogWidRadios *autoRefreshGroup = 1336 KPrefsDialogWidRadios *autoRefreshGroup =
1337 addWidRadios(i18n("Auto Send Refresh"), 1337 addWidRadios(i18n("Auto Send Refresh"),
1338 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1338 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1339 autoRefreshGroup->addRadio(i18n("Never")); 1339 autoRefreshGroup->addRadio(i18n("Never"));
1340 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1340 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1341 //autoRefreshGroup->addRadio(i18n("selected emails")); 1341 //autoRefreshGroup->addRadio(i18n("selected emails"));
1342 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1342 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1343 1343
1344 KPrefsDialogWidRadios *autoInsertGroup = 1344 KPrefsDialogWidRadios *autoInsertGroup =
1345 addWidRadios(i18n("Auto Insert IMIP Replies"), 1345 addWidRadios(i18n("Auto Insert IMIP Replies"),
1346 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1346 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1347 autoInsertGroup->addRadio(i18n("Never")); 1347 autoInsertGroup->addRadio(i18n("Never"));
1348 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1348 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1349 //autoInsertGroup->addRadio(i18n("selected emails")); 1349 //autoInsertGroup->addRadio(i18n("selected emails"));
1350 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1350 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1351 1351
1352 KPrefsDialogWidRadios *autoRequestGroup = 1352 KPrefsDialogWidRadios *autoRequestGroup =
1353 addWidRadios(i18n("Auto Insert IMIP Requests"), 1353 addWidRadios(i18n("Auto Insert IMIP Requests"),
1354 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1354 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1355 autoRequestGroup->addRadio(i18n("Never")); 1355 autoRequestGroup->addRadio(i18n("Never"));
1356 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1356 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1357 //autoInsertGroup->addRadio(i18n("selected emails")); 1357 //autoInsertGroup->addRadio(i18n("selected emails"));
1358 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1358 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1359 1359
1360 KPrefsDialogWidRadios *autoFreeBusyGroup = 1360 KPrefsDialogWidRadios *autoFreeBusyGroup =
1361 addWidRadios(i18n("Auto Send FreeBusy Information"), 1361 addWidRadios(i18n("Auto Send FreeBusy Information"),
1362 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1362 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1363 autoFreeBusyGroup->addRadio(i18n("Never")); 1363 autoFreeBusyGroup->addRadio(i18n("Never"));
1364 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1364 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1365 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1365 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1366 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1366 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1367 1367
1368 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1368 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1369 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1369 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1370 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1370 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1371 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1371 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1372 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1372 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1373 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1373 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1374 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1374 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1375} 1375}
1376 1376
1377void KOPrefsDialog::showPrinterTab() 1377void KOPrefsDialog::showPrinterTab()
1378{ 1378{
1379 showPage(pageIndex(mPrinterTab)); 1379 showPage(pageIndex(mPrinterTab));
1380} 1380}
1381 1381
1382 1382
1383void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1383void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1384 const QStringList *tags) 1384 const QStringList *tags)
1385{ 1385{
1386 if (tags) { 1386 if (tags) {
1387 int i = tags->findIndex(text); 1387 int i = tags->findIndex(text);
1388 if (i > 0) combo->setCurrentItem(i); 1388 if (i > 0) combo->setCurrentItem(i);
1389 } else { 1389 } else {
1390 for(int i=0;i<combo->count();++i) { 1390 for(int i=0;i<combo->count();++i) {
1391 if (combo->text(i) == text) { 1391 if (combo->text(i) == text) {
1392 combo->setCurrentItem(i); 1392 combo->setCurrentItem(i);
1393 break; 1393 break;
1394 } 1394 }
1395 } 1395 }
1396 } 1396 }
1397} 1397}
1398 1398
1399void KOPrefsDialog::usrReadConfig() 1399void KOPrefsDialog::usrReadConfig()
1400{ 1400{
1401 1401
1402 mNameEdit->setText(KOPrefs::instance()->fullName()); 1402 mNameEdit->setText(KOPrefs::instance()->fullName());
1403 mEmailEdit->setText(KOPrefs::instance()->email()); 1403 mEmailEdit->setText(KOPrefs::instance()->email());
1404 1404
1405 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1405 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1406 1406
1407 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1407 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1408 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1408 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1409 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1409 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1410 1410
1411 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1411 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1412 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1412 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1413 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1413 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1414 // mAMails->clear(); 1414 // mAMails->clear();
1415 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1415 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1416// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1416// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1417// QListViewItem *item = new QListViewItem(mAMails); 1417// QListViewItem *item = new QListViewItem(mAMails);
1418// item->setText(0,*it); 1418// item->setText(0,*it);
1419// mAMails->insertItem(item); 1419// mAMails->insertItem(item);
1420// } 1420// }
1421 1421
1422 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1422 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1423 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1423 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1424 updateCategories(); 1424 updateCategories();
1425 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1425 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1426 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1426 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1427 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1427 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1428 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1428 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1429 1429
1430} 1430}
1431 1431
1432 1432
1433void KOPrefsDialog::usrWriteConfig() 1433void KOPrefsDialog::usrWriteConfig()
1434{ 1434{
1435 1435
1436 1436
1437 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1437 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1438 KOPrefs::instance()->setFullName(mNameEdit->text()); 1438 KOPrefs::instance()->setFullName(mNameEdit->text());
1439 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1439 KOPrefs::instance()->setEmail(mEmailEdit->text());
1440 1440
1441 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1441 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1442 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1442 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1443 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1443 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1444 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1444 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1445 1445
1446 QDictIterator<QColor> it(mCategoryDict); 1446 QDictIterator<QColor> it(mCategoryDict);
1447 while (it.current()) { 1447 while (it.current()) {
1448 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1448 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1449 ++it; 1449 ++it;
1450 } 1450 }
1451 1451
1452 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1452 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1453 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1453 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1454 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1454 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1455 1455
1456 KOPrefs::instance()->mAdditionalMails.clear(); 1456 KOPrefs::instance()->mAdditionalMails.clear();
1457 // QListViewItem *item; 1457 // QListViewItem *item;
1458 // item = mAMails->firstChild(); 1458 // item = mAMails->firstChild();
1459 // while (item) 1459 // while (item)
1460 // { 1460 // {
1461 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1461 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1462 // item = item->nextSibling(); 1462 // item = item->nextSibling();
1463 // } 1463 // }
1464 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1464 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1465 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1465 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1466 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1466 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1467 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1467 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1468} 1468}
1469 1469
1470void KOPrefsDialog::updateCategories() 1470void KOPrefsDialog::updateCategories()
1471{ 1471{
1472 mCategoryCombo->clear(); 1472 mCategoryCombo->clear();
1473 mCategoryDict.clear(); 1473 mCategoryDict.clear();
1474 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1474 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1475 updateCategoryColor(); 1475 updateCategoryColor();
1476} 1476}
1477 1477
1478void KOPrefsDialog::toggleEmailSettings(bool on) 1478void KOPrefsDialog::toggleEmailSettings(bool on)
1479{ 1479{
1480 if (on) { 1480 if (on) {
1481 mEmailEdit->setEnabled(false); 1481 mEmailEdit->setEnabled(false);
1482 mNameEdit->setEnabled(false); 1482 mNameEdit->setEnabled(false);
1483 mEmailLabel->setEnabled(false); 1483 mEmailLabel->setEnabled(false);
1484 mNameLabel->setEnabled(false); 1484 mNameLabel->setEnabled(false);
1485 1485
1486 KEMailSettings settings; 1486 KEMailSettings settings;
1487 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1487 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1488 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1488 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1489 } else { 1489 } else {
1490 mEmailEdit->setEnabled(true); 1490 mEmailEdit->setEnabled(true);
1491 mNameEdit->setEnabled(true); 1491 mNameEdit->setEnabled(true);
1492 mEmailLabel->setEnabled(true); 1492 mEmailLabel->setEnabled(true);
1493 mNameLabel->setEnabled(true); 1493 mNameLabel->setEnabled(true);
1494 } 1494 }
1495} 1495}
1496 1496
1497void KOPrefsDialog::addItem() 1497void KOPrefsDialog::addItem()
1498{ 1498{
1499 // aEmailsEdit->setEnabled(true); 1499 // aEmailsEdit->setEnabled(true);
1500// QListViewItem *item = new QListViewItem(mAMails); 1500// QListViewItem *item = new QListViewItem(mAMails);
1501// mAMails->insertItem(item); 1501// mAMails->insertItem(item);
1502// mAMails->setSelected(item,true); 1502// mAMails->setSelected(item,true);
1503// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1503// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1504} 1504}
1505 1505
1506void KOPrefsDialog::removeItem() 1506void KOPrefsDialog::removeItem()
1507{ 1507{
1508// QListViewItem *item; 1508// QListViewItem *item;
1509// item = mAMails->selectedItem(); 1509// item = mAMails->selectedItem();
1510// if (!item) return; 1510// if (!item) return;
1511// mAMails->takeItem(item); 1511// mAMails->takeItem(item);
1512// item = mAMails->selectedItem(); 1512// item = mAMails->selectedItem();
1513// if (!item) { 1513// if (!item) {
1514// aEmailsEdit->setText(""); 1514// aEmailsEdit->setText("");
1515// aEmailsEdit->setEnabled(false); 1515// aEmailsEdit->setEnabled(false);
1516// } 1516// }
1517// if (mAMails->childCount() == 0) { 1517// if (mAMails->childCount() == 0) {
1518// aEmailsEdit->setEnabled(false); 1518// aEmailsEdit->setEnabled(false);
1519// } 1519// }
1520} 1520}
1521 1521
1522void KOPrefsDialog::updateItem() 1522void KOPrefsDialog::updateItem()
1523{ 1523{
1524 // QListViewItem *item; 1524 // QListViewItem *item;
1525// item = mAMails->selectedItem(); 1525// item = mAMails->selectedItem();
1526// if (!item) return; 1526// if (!item) return;
1527// item->setText(0,aEmailsEdit->text()); 1527// item->setText(0,aEmailsEdit->text());
1528} 1528}
1529 1529
1530void KOPrefsDialog::updateInput() 1530void KOPrefsDialog::updateInput()
1531{ 1531{
1532// QListViewItem *item; 1532// QListViewItem *item;
1533// item = mAMails->selectedItem(); 1533// item = mAMails->selectedItem();
1534// if (!item) return; 1534// if (!item) return;
1535// aEmailsEdit->setEnabled(true); 1535// aEmailsEdit->setEnabled(true);
1536// aEmailsEdit->setText(item->text(0)); 1536// aEmailsEdit->setText(item->text(0));
1537} 1537}
1538 1538