summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp14
-rw-r--r--korganizer/koprefsdialog.cpp4
2 files changed, 9 insertions, 9 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index df606d0..c32a2a4 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,342 +1,346 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 Parts of the source code have been copied from kdpdatebutton.cpp 4 Parts of the source code have been copied from kdpdatebutton.cpp
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source ode for Qt in the source distribution. 22 without including the source ode for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <libkcal/vcaldrag.h> 35#include <libkcal/vcaldrag.h>
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/dndfactory.h> 37#include <libkcal/dndfactory.h>
38#include <libkcal/calendarresources.h> 38#include <libkcal/calendarresources.h>
39#include <libkcal/resourcecalendar.h> 39#include <libkcal/resourcecalendar.h>
40#include <kresources/resourceselectdialog.h> 40#include <kresources/resourceselectdialog.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPLUGINS 44#ifndef KORG_NOPLUGINS
45#include "kocore.h" 45#include "kocore.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#include "koglobals.h" 48#include "koglobals.h"
49 49
50#include "kodaymatrix.h" 50#include "kodaymatrix.h"
51 51
52// ============================================================================ 52// ============================================================================
53// D Y N A M I C T I P 53// D Y N A M I C T I P
54// ============================================================================ 54// ============================================================================
55 55
56DynamicTip::DynamicTip( QWidget * parent ) 56DynamicTip::DynamicTip( QWidget * parent )
57 : QToolTip( parent ) 57 : QToolTip( parent )
58{ 58{
59 matrix = (KODayMatrix*)parent; 59 matrix = (KODayMatrix*)parent;
60} 60}
61 61
62class KODaymatrixWhatsThis :public QWhatsThis 62class KODaymatrixWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; 65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;};
66 ~KODaymatrixWhatsThis() { ; }; 66 ~KODaymatrixWhatsThis() { qDebug("DELETE KODaymatrixWhatsThis "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p ) 69 virtual QString text( const QPoint& p )
70 { 70 {
71 return _view->getWhatsThisText( p ) ; 71 return _view->getWhatsThisText( p ) ;
72 } 72 }
73private: 73private:
74 KODayMatrix * _view; 74 KODayMatrix * _view;
75}; 75};
76 76
77void DynamicTip::maybeTip( const QPoint &pos ) 77void DynamicTip::maybeTip( const QPoint &pos )
78{ 78{
79 //calculate which cell of the matrix the mouse is in 79 //calculate which cell of the matrix the mouse is in
80 QRect sz = matrix->frameRect(); 80 QRect sz = matrix->frameRect();
81 int dheight = sz.height()*7 / 42; 81 int dheight = sz.height()*7 / 42;
82 int dwidth = sz.width() / 7; 82 int dwidth = sz.width() / 7;
83 int row = pos.y()/dheight; 83 int row = pos.y()/dheight;
84 int col = pos.x()/dwidth; 84 int col = pos.x()/dwidth;
85 85
86 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 86 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
87 87
88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
89// col << "][" << row << "] => " <<(col+row*7) << endl; 89// col << "][" << row << "] => " <<(col+row*7) << endl;
90 90
91 //show holiday names only 91 //show holiday names only
92 QString str = matrix->getHolidayLabel(col+row*7); 92 QString str = matrix->getHolidayLabel(col+row*7);
93 if (str.isEmpty()) return; 93 if (str.isEmpty()) return;
94 tip(rct, str); 94 tip(rct, str);
95} 95}
96 96
97 97
98// ============================================================================ 98// ============================================================================
99// K O D A Y M A T R I X 99// K O D A Y M A T R I X
100// ============================================================================ 100// ============================================================================
101 101
102const int KODayMatrix::NOSELECTION = -1000; 102const int KODayMatrix::NOSELECTION = -1000;
103const int KODayMatrix::NUMDAYS = 42; 103const int KODayMatrix::NUMDAYS = 42;
104 104
105KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) 105KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) 106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
107 107
108#if 0 108
109KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
110 QFrame(parent, name)
111#endif
112{ 109{
110 mLastView = -1;
113 oldW = 0; 111 oldW = 0;
114 oldH = 0; 112 oldH = 0;
115 myPix.resize( 150, 120 ); 113 myPix.resize( 150, 120 );
116 mRedrawNeeded = true; 114 mRedrawNeeded = true;
117 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
118 mPendingUpdateBeforeRepaint = false; 116 mPendingUpdateBeforeRepaint = false;
119 mouseDown = false; 117 mouseDown = false;
120 // initialize dynamic arrays 118 // initialize dynamic arrays
121 bDays.resize ( NUMDAYS ); 119 bDays.resize ( NUMDAYS );
122 pDays.resize ( NUMDAYS ); 120 pDays.resize ( NUMDAYS );
123 hDays.resize ( NUMDAYS ); 121 hDays.resize ( NUMDAYS );
124 eDays.resize ( NUMDAYS ); 122 eDays.resize ( NUMDAYS );
125 days = new QDate[NUMDAYS]; 123 days = new QDate[NUMDAYS];
126 daylbls = new QString[NUMDAYS]; 124 daylbls = new QString[NUMDAYS];
127 //events = new int[NUMDAYS]; 125 //events = new int[NUMDAYS];
128 mToolTip = new DynamicTip(this); 126 mToolTip = new DynamicTip(this);
129 127
130 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
131 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
132 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
133 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
134 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
135 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
136 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
137 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
138 136
139 setAcceptDrops(true); 137 setAcceptDrops(true);
140 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
141 139
142 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
143 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
144 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
145 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
146 mDayChanged = false; 144 mDayChanged = false;
147 updateView(); 145 updateView();
148} 146}
149QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
150{ 148{
151 149
152 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
153 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
154 return QString(); 152 return QString();
155 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
156 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
157 Event *event; 155 Event *event;
158 QStringList mToolTip; 156 QStringList mToolTip;
159 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
160 QString mToolTipText; 158 QString mToolTipText;
161 QString text; 159 QString text;
162 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
163 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
164 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
165 QString time; 163 QString time;
166 if ( event->doesRecur() ) { 164 if ( event->doesRecur() ) {
167 if ( event->recursOn( mDate) ) { 165 if ( event->recursOn( mDate) ) {
168 prefix ="->" ;multiday = 1; 166 prefix ="->" ;multiday = 1;
169 } 167 }
170 else { 168 else {
171 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
172 if ( event->recursOn( mDate.addDays( -days)) ) { 170 if ( event->recursOn( mDate.addDays( -days)) ) {
173 prefix ="<-" ;multiday = 3; 171 prefix ="<-" ;multiday = 3;
174 } 172 }
175 } 173 }
176 } else { 174 } else {
177 if (mDate == event->dtStart().date()) { 175 if (mDate == event->dtStart().date()) {
178 prefix ="->" ;multiday = 1; 176 prefix ="->" ;multiday = 1;
179 } else if (mDate == event->dtEnd().date()) { 177 } else if (mDate == event->dtEnd().date()) {
180 prefix ="<-" ;multiday = 3; 178 prefix ="<-" ;multiday = 3;
181 } 179 }
182 } 180 }
183 if ( !event->doesFloat() ) { 181 if ( !event->doesFloat() ) {
184 if ( mDate == event->dtStart().date () ) 182 if ( mDate == event->dtStart().date () )
185 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
186 else if ( mDate == event->dtEnd().date () ) 184 else if ( mDate == event->dtEnd().date () )
187 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
188 186
189 } 187 }
190 text = time + event->summary(); 188 text = time + event->summary();
191 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
192 } else { 190 } else {
193 if (event->doesFloat()) { 191 if (event->doesFloat()) {
194 text = event->summary(); 192 text = event->summary();
195 mToolTipText += text; 193 mToolTipText += text;
196 } 194 }
197 else { 195 else {
198 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
199 text += " " + event->summary(); 197 text += " " + event->summary();
200 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
201 } 199 }
202 } 200 }
203 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
204 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
205#if QT_VERSION >= 0x030000 203#if QT_VERSION >= 0x030000
206 mToolTipText.replace( '<' , "&lt;" ); 204 mToolTipText.replace( '<' , "&lt;" );
207 mToolTipText.replace( '>' , "&gt;" ); 205 mToolTipText.replace( '>' , "&gt;" );
208#else 206#else
209 if ( mToolTipText.find ('<') >= 0 ) { 207 if ( mToolTipText.find ('<') >= 0 ) {
210 mToolTipText.replace( QRegExp("<") , "&lt;" ); 208 mToolTipText.replace( QRegExp("<") , "&lt;" );
211 } 209 }
212 if ( mToolTipText.find ('>') >= 0 ) { 210 if ( mToolTipText.find ('>') >= 0 ) {
213 mToolTipText.replace( QRegExp(">") , "&gt;" ); 211 mToolTipText.replace( QRegExp(">") , "&gt;" );
214 } 212 }
215#endif 213#endif
216 //qDebug("TTT: %s ", mToolTipText.latin1()); 214 //qDebug("TTT: %s ", mToolTipText.latin1());
217 mToolTip.append( mToolTipText ); 215 mToolTip.append( mToolTipText );
218 } 216 }
219 mToolTip.sort(); 217 mToolTip.sort();
220 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 218 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
221} 219}
222void KODayMatrix::setCalendar( Calendar *cal ) 220void KODayMatrix::setCalendar( Calendar *cal )
223{ 221{
224 mCalendar = cal; 222 mCalendar = cal;
225 223
226 setAcceptDrops( mCalendar ); 224 setAcceptDrops( mCalendar );
227 225
228 updateEvents(); 226 updateEvents();
229} 227}
230 228
231QColor KODayMatrix::getShadedColor(QColor color) 229QColor KODayMatrix::getShadedColor(QColor color)
232{ 230{
233 QColor shaded; 231 QColor shaded;
234 int h=0; 232 int h=0;
235 int s=0; 233 int s=0;
236 int v=0; 234 int v=0;
237 color.hsv(&h,&s,&v); 235 color.hsv(&h,&s,&v);
238 s = s/4; 236 s = s/4;
239 v = 192+v/4; 237 v = 192+v/4;
240 shaded.setHsv(h,s,v); 238 shaded.setHsv(h,s,v);
241 239
242 return shaded; 240 return shaded;
243} 241}
244 242
245KODayMatrix::~KODayMatrix() 243KODayMatrix::~KODayMatrix()
246{ 244{
245#if QT_VERSION >= 0x030000
246
247#else
248 delete mKODaymatrixWhatsThis;
249#endif
250
247 // delete mKODaymatrixWhatsThis; 251 // delete mKODaymatrixWhatsThis;
248 delete [] days; 252 delete [] days;
249 delete [] daylbls; 253 delete [] daylbls;
250 //delete [] events; 254 //delete [] events;
251 delete mToolTip; 255 delete mToolTip;
252} 256}
253 257
254/* 258/*
255void KODayMatrix::setStartDate(QDate start) 259void KODayMatrix::setStartDate(QDate start)
256{ 260{
257 updateView(start); 261 updateView(start);
258} 262}
259*/ 263*/
260 264
261void KODayMatrix::addSelectedDaysTo(DateList& selDays) 265void KODayMatrix::addSelectedDaysTo(DateList& selDays)
262{ 266{
263 267
264 if (mSelStart == NOSELECTION) { 268 if (mSelStart == NOSELECTION) {
265 return; 269 return;
266 } 270 }
267 271
268 //cope with selection being out of matrix limits at top (< 0) 272 //cope with selection being out of matrix limits at top (< 0)
269 int i0 = mSelStart; 273 int i0 = mSelStart;
270 if (i0 < 0) { 274 if (i0 < 0) {
271 for (int i = i0; i < 0; i++) { 275 for (int i = i0; i < 0; i++) {
272 selDays.append(days[0].addDays(i)); 276 selDays.append(days[0].addDays(i));
273 } 277 }
274 i0 = 0; 278 i0 = 0;
275 } 279 }
276 280
277 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 281 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
278 if (mSelEnd > NUMDAYS-1) { 282 if (mSelEnd > NUMDAYS-1) {
279 for (int i = i0; i <= NUMDAYS-1; i++) { 283 for (int i = i0; i <= NUMDAYS-1; i++) {
280 selDays.append(days[i]); 284 selDays.append(days[i]);
281 } 285 }
282 for (int i = NUMDAYS; i < mSelEnd; i++) { 286 for (int i = NUMDAYS; i < mSelEnd; i++) {
283 selDays.append(days[0].addDays(i)); 287 selDays.append(days[0].addDays(i));
284 } 288 }
285 289
286 // apply normal routine to selection being entirely within matrix limits 290 // apply normal routine to selection being entirely within matrix limits
287 } else { 291 } else {
288 for (int i = i0; i <= mSelEnd; i++) { 292 for (int i = i0; i <= mSelEnd; i++) {
289 selDays.append(days[i]); 293 selDays.append(days[i]);
290 } 294 }
291 } 295 }
292} 296}
293 297
294bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 298bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
295{ 299{
296 mRedrawNeeded = true; 300 mRedrawNeeded = true;
297 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); 301 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION );
298 mSelStart = startdate.daysTo(start); 302 mSelStart = startdate.daysTo(start);
299 if ( mSelStart < 0 ) 303 if ( mSelStart < 0 )
300 mSelStart = 0; 304 mSelStart = 0;
301 mSelEnd = startdate.daysTo(end); 305 mSelEnd = startdate.daysTo(end);
302 if ( mSelEnd > NUMDAYS-1 ) 306 if ( mSelEnd > NUMDAYS-1 )
303 mSelEnd = NUMDAYS-1; 307 mSelEnd = NUMDAYS-1;
304 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { 308 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
305 clearSelection(); 309 clearSelection();
306 if ( noSel ) 310 if ( noSel )
307 return false; 311 return false;
308 } 312 }
309 313
310 return true; 314 return true;
311} 315}
312void KODayMatrix::clearSelection() 316void KODayMatrix::clearSelection()
313{ 317{
314 mSelEnd = mSelStart = NOSELECTION; 318 mSelEnd = mSelStart = NOSELECTION;
315} 319}
316 320
317 321
318void KODayMatrix::recalculateToday() 322void KODayMatrix::recalculateToday()
319{ 323{
320 today = -1; 324 today = -1;
321 for (int i=0; i<NUMDAYS; i++) { 325 for (int i=0; i<NUMDAYS; i++) {
322 //events[i] = 0; 326 //events[i] = 0;
323 days[i] = startdate.addDays(i); 327 days[i] = startdate.addDays(i);
324 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 328 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
325 329
326 // if today is in the currently displayed month, hilight today 330 // if today is in the currently displayed month, hilight today
327 if (days[i].year() == QDate::currentDate().year() && 331 if (days[i].year() == QDate::currentDate().year() &&
328 days[i].month() == QDate::currentDate().month() && 332 days[i].month() == QDate::currentDate().month() &&
329 days[i].day() == QDate::currentDate().day()) { 333 days[i].day() == QDate::currentDate().day()) {
330 today = i; 334 today = i;
331 } 335 }
332 } 336 }
333 // qDebug(QString("Today is visible at %1.").arg(today)); 337 // qDebug(QString("Today is visible at %1.").arg(today));
334} 338}
335 339
336void KODayMatrix::updateView() 340void KODayMatrix::updateView()
337{ 341{
338 updateView(startdate); 342 updateView(startdate);
339} 343}
340void KODayMatrix::repaintViewTimed() 344void KODayMatrix::repaintViewTimed()
341{ 345{
342 mRedrawNeeded = true; 346 mRedrawNeeded = true;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index d9d7924..e4bee63 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -935,196 +935,192 @@ dummy =
935 935
936 dummy = 936 dummy =
937 addWidBool(i18n("Colors are applied to text"), 937 addWidBool(i18n("Colors are applied to text"),
938 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 938 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
939 topLayout->addWidget(dummy->checkBox(),ii++,0); 939 topLayout->addWidget(dummy->checkBox(),ii++,0);
940 940
941 dummy = 941 dummy =
942 addWidBool(i18n("Allday Agenda view shows todos"), 942 addWidBool(i18n("Allday Agenda view shows todos"),
943 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 943 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
944 topLayout->addWidget(dummy->checkBox(),ii++,0); 944 topLayout->addWidget(dummy->checkBox(),ii++,0);
945 945
946 946
947 topFrame = addPage(i18n("View Options"),0,0); 947 topFrame = addPage(i18n("View Options"),0,0);
948 948
949 topLayout = new QGridLayout(topFrame,4,1); 949 topLayout = new QGridLayout(topFrame,4,1);
950 topLayout->setSpacing(mSpacingHint); 950 topLayout->setSpacing(mSpacingHint);
951 topLayout->setMargin(mMarginHint); 951 topLayout->setMargin(mMarginHint);
952 ii = 0; 952 ii = 0;
953 953
954 dummy = 954 dummy =
955 addWidBool(i18n("Show Sync Events"), 955 addWidBool(i18n("Show Sync Events"),
956 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 956 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
957 topLayout->addWidget(dummy->checkBox(), ii++,0); 957 topLayout->addWidget(dummy->checkBox(), ii++,0);
958 958
959 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 959 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
960 topLayout->addWidget(lab ,ii++,0); 960 topLayout->addWidget(lab ,ii++,0);
961 961
962 dummy = addWidBool(i18n("Details"), 962 dummy = addWidBool(i18n("Details"),
963 &(KOPrefs::instance()->mEVshowDetails),topFrame); 963 &(KOPrefs::instance()->mEVshowDetails),topFrame);
964 topLayout->addWidget(dummy->checkBox(),ii++,0); 964 topLayout->addWidget(dummy->checkBox(),ii++,0);
965 dummy = addWidBool(i18n("Created time"), 965 dummy = addWidBool(i18n("Created time"),
966 &(KOPrefs::instance()->mEVshowCreated),topFrame); 966 &(KOPrefs::instance()->mEVshowCreated),topFrame);
967 topLayout->addWidget(dummy->checkBox(),ii++,0); 967 topLayout->addWidget(dummy->checkBox(),ii++,0);
968 dummy = addWidBool(i18n("Last modified time"), 968 dummy = addWidBool(i18n("Last modified time"),
969 &(KOPrefs::instance()->mEVshowChanged),topFrame); 969 &(KOPrefs::instance()->mEVshowChanged),topFrame);
970 topLayout->addWidget(dummy->checkBox(),ii++,0); 970 topLayout->addWidget(dummy->checkBox(),ii++,0);
971 971
972 972
973 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 973 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
974 topLayout->addWidget(lab ,ii++,0); 974 topLayout->addWidget(lab ,ii++,0);
975 975
976 dummy = addWidBool(i18n("Details"), 976 dummy = addWidBool(i18n("Details"),
977 &(KOPrefs::instance()->mWTshowDetails),topFrame); 977 &(KOPrefs::instance()->mWTshowDetails),topFrame);
978 topLayout->addWidget(dummy->checkBox(),ii++,0); 978 topLayout->addWidget(dummy->checkBox(),ii++,0);
979 dummy = addWidBool(i18n("Created time"), 979 dummy = addWidBool(i18n("Created time"),
980 &(KOPrefs::instance()->mWTshowCreated),topFrame); 980 &(KOPrefs::instance()->mWTshowCreated),topFrame);
981 topLayout->addWidget(dummy->checkBox(),ii++,0); 981 topLayout->addWidget(dummy->checkBox(),ii++,0);
982 dummy = addWidBool(i18n("Last modified time"), 982 dummy = addWidBool(i18n("Last modified time"),
983 &(KOPrefs::instance()->mWTshowChanged),topFrame); 983 &(KOPrefs::instance()->mWTshowChanged),topFrame);
984 topLayout->addWidget(dummy->checkBox(),ii++,0); 984 topLayout->addWidget(dummy->checkBox(),ii++,0);
985 985
986 986
987 topFrame = addPage(i18n("Alarm"),0,0); 987 topFrame = addPage(i18n("Alarm"),0,0);
988 // DesktopIcon("viewmag",KIcon::SizeMedium)); 988 // DesktopIcon("viewmag",KIcon::SizeMedium));
989 989
990 topLayout = new QGridLayout(topFrame,2,1); 990 topLayout = new QGridLayout(topFrame,2,1);
991 topLayout->setSpacing(mSpacingHint); 991 topLayout->setSpacing(mSpacingHint);
992 topLayout->setMargin(mMarginHint); 992 topLayout->setMargin(mMarginHint);
993 int iii = 0; 993 int iii = 0;
994 994
995 dummy = 995 dummy =
996 addWidBool(i18n("Use internal alarm notification"), 996 addWidBool(i18n("Use internal alarm notification"),
997 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 997 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
998 topLayout->addWidget(dummy->checkBox(),iii++,0); 998 topLayout->addWidget(dummy->checkBox(),iii++,0);
999 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 999 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
1000 1000
1001 topLayout->addWidget(lab ,iii++,0); 1001 topLayout->addWidget(lab ,iii++,0);
1002#ifndef DESKTOP_VERSION 1002#ifndef DESKTOP_VERSION
1003 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1003 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1004#else 1004#else
1005 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1005 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1006 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1006 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1007#endif 1007#endif
1008 1008
1009 QHBox* dummyBox = new QHBox(topFrame); 1009 QHBox* dummyBox = new QHBox(topFrame);
1010 new QLabel(i18n("Play beeps count:"),dummyBox); 1010 new QLabel(i18n("Play beeps count:"),dummyBox);
1011 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 1011 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
1012 topLayout->addWidget(dummyBox,iii++,0); 1012 topLayout->addWidget(dummyBox,iii++,0);
1013 1013
1014 dummyBox = new QHBox(topFrame); 1014 dummyBox = new QHBox(topFrame);
1015 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 1015 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
1016 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 1016 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
1017 topLayout->addWidget(dummyBox,iii++,0); 1017 topLayout->addWidget(dummyBox,iii++,0);
1018 1018
1019 dummyBox = new QHBox(topFrame); 1019 dummyBox = new QHBox(topFrame);
1020 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1020 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1021 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1021 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1022 topLayout->addWidget(dummyBox,iii++,0); 1022 topLayout->addWidget(dummyBox,iii++,0);
1023 1023
1024 dummyBox = new QHBox(topFrame); 1024 dummyBox = new QHBox(topFrame);
1025 new QLabel(i18n("Auto suspend count:"),dummyBox); 1025 new QLabel(i18n("Auto suspend count:"),dummyBox);
1026 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1026 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1027 topLayout->addWidget(dummyBox,iii++,0); 1027 topLayout->addWidget(dummyBox,iii++,0);
1028 1028
1029 1029
1030 1030
1031
1032
1033
1034
1035 QHBox* hbo = new QHBox ( topFrame ); 1031 QHBox* hbo = new QHBox ( topFrame );
1036 mDefaultAlarmFile = new QLineEdit(hbo); 1032 mDefaultAlarmFile = new QLineEdit(hbo);
1037 QPushButton * loadTemplate = new QPushButton(hbo); 1033 QPushButton * loadTemplate = new QPushButton(hbo);
1038 QPixmap icon; 1034 QPixmap icon;
1039 if ( QApplication::desktop()->width() < 321 ) 1035 if ( QApplication::desktop()->width() < 321 )
1040 icon = SmallIcon("fileimport16"); 1036 icon = SmallIcon("fileimport16");
1041 else 1037 else
1042 icon = SmallIcon("fileimport"); 1038 icon = SmallIcon("fileimport");
1043 loadTemplate->setIconSet (icon ) ; 1039 loadTemplate->setIconSet (icon ) ;
1044 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1040 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1045 int size = loadTemplate->sizeHint().height(); 1041 int size = loadTemplate->sizeHint().height();
1046 loadTemplate->setFixedSize( size, size ); 1042 loadTemplate->setFixedSize( size, size );
1047 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1043 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1048 // topLayout->addWidget(lab ,iii++,0); 1044 // topLayout->addWidget(lab ,iii++,0);
1049 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1045 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1050 topLayout->addWidget(lab ,iii++,0); 1046 topLayout->addWidget(lab ,iii++,0);
1051 topLayout->addWidget(hbo,iii++,0); 1047 topLayout->addWidget(hbo,iii++,0);
1052 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 1048 // 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);
1053 1049
1054// topLayout->addWidget(lab ,iii++,0); 1050// topLayout->addWidget(lab ,iii++,0);
1055// #ifndef DESKTOP_VERSION 1051// #ifndef DESKTOP_VERSION
1056// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1052// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1057// #else 1053// #else
1058// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1054// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1059// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1055// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1060// #endif 1056// #endif
1061 1057
1062 1058
1063} 1059}
1064 1060
1065void KOPrefsDialog::selectSoundFile() 1061void KOPrefsDialog::selectSoundFile()
1066{ 1062{
1067 QString fileName = mDefaultAlarmFile->text(); 1063 QString fileName = mDefaultAlarmFile->text();
1068 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1064 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1069 if ( fileName.length() > 0 ) 1065 if ( fileName.length() > 0 )
1070 mDefaultAlarmFile->setText( fileName ); 1066 mDefaultAlarmFile->setText( fileName );
1071} 1067}
1072void KOPrefsDialog::setupFontsTab() 1068void KOPrefsDialog::setupFontsTab()
1073{ 1069{
1074 1070
1075 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1071 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1076 // DesktopIcon("fonts",KIcon::SizeMedium)); 1072 // DesktopIcon("fonts",KIcon::SizeMedium));
1077 1073
1078 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1074 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1079 topLayout->setSpacing(1); 1075 topLayout->setSpacing(1);
1080 topLayout->setMargin(3); 1076 topLayout->setMargin(3);
1081 KPrefsDialogWidFont * tVFont; 1077 KPrefsDialogWidFont * tVFont;
1082 int i = 0; 1078 int i = 0;
1083 KPrefsDialogWidFont *timeLabelsFont = 1079 KPrefsDialogWidFont *timeLabelsFont =
1084 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1080 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1085 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1081 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1086 topLayout->addWidget(timeLabelsFont->label(),i,0); 1082 topLayout->addWidget(timeLabelsFont->label(),i,0);
1087 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1083 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1088 topLayout->addWidget(timeLabelsFont->button(),i,2); 1084 topLayout->addWidget(timeLabelsFont->button(),i,2);
1089 ++i; 1085 ++i;
1090 1086
1091 1087
1092 timeLabelsFont = 1088 timeLabelsFont =
1093 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1089 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1094 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1090 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1095 topLayout->addWidget(timeLabelsFont->label(),i,0); 1091 topLayout->addWidget(timeLabelsFont->label(),i,0);
1096 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1092 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1097 topLayout->addWidget(timeLabelsFont->button(),i,2); 1093 topLayout->addWidget(timeLabelsFont->button(),i,2);
1098 ++i; 1094 ++i;
1099 1095
1100 KPrefsDialogWidFont *timeBarFont = 1096 KPrefsDialogWidFont *timeBarFont =
1101 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1102 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1098 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1103 topLayout->addWidget(timeBarFont->label(),i,0); 1099 topLayout->addWidget(timeBarFont->label(),i,0);
1104 topLayout->addWidget(timeBarFont->preview(),i,1); 1100 topLayout->addWidget(timeBarFont->preview(),i,1);
1105 topLayout->addWidget(timeBarFont->button(),i,2); 1101 topLayout->addWidget(timeBarFont->button(),i,2);
1106 ++i; 1102 ++i;
1107 1103
1108 1104
1109 KPrefsDialogWidFont *marcusBainsFont = 1105 KPrefsDialogWidFont *marcusBainsFont =
1110 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1106 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1111 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1107 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1112 topLayout->addWidget(marcusBainsFont->label(),i,0); 1108 topLayout->addWidget(marcusBainsFont->label(),i,0);
1113 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1109 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1114 topLayout->addWidget(marcusBainsFont->button(),i,2); 1110 topLayout->addWidget(marcusBainsFont->button(),i,2);
1115 ++i; 1111 ++i;
1116 1112
1117 tVFont = 1113 tVFont =
1118 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1114 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1119 &(KOPrefs::instance()->mEventViewFont),topFrame); 1115 &(KOPrefs::instance()->mEventViewFont),topFrame);
1120 topLayout->addWidget(tVFont->label(),i,0); 1116 topLayout->addWidget(tVFont->label(),i,0);
1121 topLayout->addWidget(tVFont->preview(),i,1); 1117 topLayout->addWidget(tVFont->preview(),i,1);
1122 topLayout->addWidget(tVFont->button(),i,2); 1118 topLayout->addWidget(tVFont->button(),i,2);
1123 ++i; 1119 ++i;
1124 1120
1125 1121
1126 1122
1127 tVFont = 1123 tVFont =
1128 addWidFont(i18n("Details"),i18n("EditorBox:"), 1124 addWidFont(i18n("Details"),i18n("EditorBox:"),
1129 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1125 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1130 topLayout->addWidget(tVFont->label(),i,0); 1126 topLayout->addWidget(tVFont->label(),i,0);