author | zautrix <zautrix> | 2005-02-04 17:45:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-04 17:45:57 (UTC) |
commit | f4c3a3e3da57e957b920fe4662c6decd6764f0ee (patch) (unidiff) | |
tree | 05648d7d7ac6a0e4798cad08b2993df1375d84d5 /korganizer | |
parent | b7c502a598566264e6e7129524104b6e39438f03 (diff) | |
download | kdepimpi-f4c3a3e3da57e957b920fe4662c6decd6764f0ee.zip kdepimpi-f4c3a3e3da57e957b920fe4662c6decd6764f0ee.tar.gz kdepimpi-f4c3a3e3da57e957b920fe4662c6decd6764f0ee.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/komonthview.cpp | 18 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 3 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 5 |
5 files changed, 24 insertions, 5 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index daa37fd..dfa89e2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1532 +1,1546 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #ifndef DESKTOP_VERSION | 31 | #ifndef DESKTOP_VERSION |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #else | 33 | #else |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | 42 | ||
43 | #include <kcalendarsystem.h> | 43 | #include <kcalendarsystem.h> |
44 | 44 | ||
45 | #ifndef KORG_NOPRINTER | 45 | #ifndef KORG_NOPRINTER |
46 | #include "calprinter.h" | 46 | #include "calprinter.h" |
47 | #endif | 47 | #endif |
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #ifndef KORG_NOPLUGINS | 49 | #ifndef KORG_NOPLUGINS |
50 | #include "kocore.h" | 50 | #include "kocore.h" |
51 | #endif | 51 | #endif |
52 | #include "koglobals.h" | 52 | #include "koglobals.h" |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | 54 | ||
55 | #include "komonthview.h" | 55 | #include "komonthview.h" |
56 | 56 | ||
57 | #define PIXMAP_SIZE 5 | 57 | #define PIXMAP_SIZE 5 |
58 | #ifdef DESKTOP_VERSION | 58 | #ifdef DESKTOP_VERSION |
59 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 59 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
60 | #endif | 60 | #endif |
61 | class KNOWhatsThis :public QWhatsThis | 61 | class KNOWhatsThis :public QWhatsThis |
62 | { | 62 | { |
63 | public: | 63 | public: |
64 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 64 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
65 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 65 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
66 | 66 | ||
67 | protected: | 67 | protected: |
68 | virtual QString text( const QPoint& p) | 68 | virtual QString text( const QPoint& p) |
69 | { | 69 | { |
70 | return _wid->getWhatsThisText(p) ; | 70 | return _wid->getWhatsThisText(p) ; |
71 | }; | 71 | }; |
72 | private: | 72 | private: |
73 | KNoScrollListBox* _wid; | 73 | KNoScrollListBox* _wid; |
74 | 74 | ||
75 | }; | 75 | }; |
76 | 76 | ||
77 | 77 | ||
78 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 78 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
79 | : QListBox(parent, name, WRepaintNoErase) | 79 | : QListBox(parent, name, WRepaintNoErase) |
80 | { | 80 | { |
81 | #ifndef DESKTOP_VERSION | 81 | #ifndef DESKTOP_VERSION |
82 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 82 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
83 | #endif | 83 | #endif |
84 | mWT = new KNOWhatsThis(this); | 84 | mWT = new KNOWhatsThis(this); |
85 | } | 85 | } |
86 | KNoScrollListBox::~KNoScrollListBox() | 86 | KNoScrollListBox::~KNoScrollListBox() |
87 | { | 87 | { |
88 | 88 | ||
89 | } | 89 | } |
90 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 90 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
91 | { | 91 | { |
92 | QListBoxItem* item = itemAt ( p ); | 92 | QListBoxItem* item = itemAt ( p ); |
93 | if ( ! item ) { | 93 | if ( ! item ) { |
94 | return i18n("Click in the cell\nto add an event!"); | 94 | return i18n("Click in the cell\nto add an event!"); |
95 | } | 95 | } |
96 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 96 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
97 | } | 97 | } |
98 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 98 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
99 | { | 99 | { |
100 | 100 | ||
101 | switch(e->key()) { | 101 | switch(e->key()) { |
102 | case Key_Right: | 102 | case Key_Right: |
103 | // if ( e->state() == Qt::ControlButton ) | 103 | // if ( e->state() == Qt::ControlButton ) |
104 | { | 104 | { |
105 | e->ignore(); | 105 | e->ignore(); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | scrollBy(4,0); | 108 | scrollBy(4,0); |
109 | break; | 109 | break; |
110 | case Key_Left: | 110 | case Key_Left: |
111 | // if ( e->state() == Qt::ControlButton ) | 111 | // if ( e->state() == Qt::ControlButton ) |
112 | { | 112 | { |
113 | e->ignore(); | 113 | e->ignore(); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | scrollBy(-4,0); | 116 | scrollBy(-4,0); |
117 | break; | 117 | break; |
118 | case Key_Up: | 118 | case Key_Up: |
119 | if(count() < 2) { | 119 | if(count() < 2) { |
120 | e->ignore(); | 120 | e->ignore(); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | setCurrentItem((currentItem()+count()-1)%count()); | 123 | setCurrentItem((currentItem()+count()-1)%count()); |
124 | if(!itemVisible(currentItem())) { | 124 | if(!itemVisible(currentItem())) { |
125 | if((unsigned int) currentItem() == (count()-1)) { | 125 | if((unsigned int) currentItem() == (count()-1)) { |
126 | setTopItem(currentItem()-numItemsVisible()+1); | 126 | setTopItem(currentItem()-numItemsVisible()+1); |
127 | } else { | 127 | } else { |
128 | setTopItem(topItem()-1); | 128 | setTopItem(topItem()-1); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | break; | 131 | break; |
132 | case Key_Down: | 132 | case Key_Down: |
133 | if(count() < 2) { | 133 | if(count() < 2) { |
134 | e->ignore(); | 134 | e->ignore(); |
135 | break; | 135 | break; |
136 | } | 136 | } |
137 | setCurrentItem((currentItem()+1)%count()); | 137 | setCurrentItem((currentItem()+1)%count()); |
138 | if(!itemVisible(currentItem())) { | 138 | if(!itemVisible(currentItem())) { |
139 | if(currentItem() == 0) { | 139 | if(currentItem() == 0) { |
140 | setTopItem(0); | 140 | setTopItem(0); |
141 | } else { | 141 | } else { |
142 | setTopItem(topItem()+1); | 142 | setTopItem(topItem()+1); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | break; | 145 | break; |
146 | case Key_Shift: | 146 | case Key_Shift: |
147 | emit shiftDown(); | 147 | emit shiftDown(); |
148 | break; | 148 | break; |
149 | default: | 149 | default: |
150 | e->ignore(); | 150 | e->ignore(); |
151 | break; | 151 | break; |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 155 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
156 | { | 156 | { |
157 | switch(e->key()) { | 157 | switch(e->key()) { |
158 | case Key_Shift: | 158 | case Key_Shift: |
159 | emit shiftUp(); | 159 | emit shiftUp(); |
160 | break; | 160 | break; |
161 | default: | 161 | default: |
162 | break; | 162 | break; |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 166 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
167 | { | 167 | { |
168 | QListBox::mousePressEvent(e); | 168 | QListBox::mousePressEvent(e); |
169 | 169 | ||
170 | if(e->button() == RightButton) { | 170 | if(e->button() == RightButton) { |
171 | emit rightClick(); | 171 | emit rightClick(); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 175 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
176 | : QListBoxItem() | 176 | : QListBoxItem() |
177 | { | 177 | { |
178 | setText( s ); | 178 | setText( s ); |
179 | 179 | ||
180 | mIncidence = incidence; | 180 | mIncidence = incidence; |
181 | mDate = qd; | 181 | mDate = qd; |
182 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 182 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
183 | mRecur = false; | 183 | mRecur = false; |
184 | mAlarm = false; | 184 | mAlarm = false; |
185 | mReply = false; | 185 | mReply = false; |
186 | mInfo = false; | 186 | mInfo = false; |
187 | } | 187 | } |
188 | 188 | ||
189 | void MonthViewItem::paint(QPainter *p) | 189 | void MonthViewItem::paint(QPainter *p) |
190 | { | 190 | { |
191 | #if QT_VERSION >= 0x030000 | 191 | #if QT_VERSION >= 0x030000 |
192 | bool sel = isSelected(); | 192 | bool sel = isSelected(); |
193 | #else | 193 | #else |
194 | bool sel = selected(); | 194 | bool sel = selected(); |
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | 197 | ||
198 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 198 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
199 | { | 199 | { |
200 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 200 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
201 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 201 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
202 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 202 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
203 | } | 203 | } |
204 | int x = 1; | 204 | int x = 1; |
205 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 205 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
206 | int size = PIXMAP_SIZE; | 206 | int size = PIXMAP_SIZE; |
207 | if ( QApplication::desktop()->width() < 300 ) | 207 | if ( QApplication::desktop()->width() < 300 ) |
208 | size = 3; | 208 | size = 3; |
209 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 209 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
210 | if ( mInfo ) { | 210 | if ( mInfo ) { |
211 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 211 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
212 | x += size + 1; | 212 | x += size + 1; |
213 | } | 213 | } |
214 | if ( mRecur ) { | 214 | if ( mRecur ) { |
215 | p->fillRect ( x, y,size,size, Qt::blue ); | 215 | p->fillRect ( x, y,size,size, Qt::blue ); |
216 | x += size + 1; | 216 | x += size + 1; |
217 | } | 217 | } |
218 | if ( mAlarm ) { | 218 | if ( mAlarm ) { |
219 | p->fillRect ( x, y,size,size, Qt::red ); | 219 | p->fillRect ( x, y,size,size, Qt::red ); |
220 | x += size + 1; | 220 | x += size + 1; |
221 | } | 221 | } |
222 | if ( mReply ) { | 222 | if ( mReply ) { |
223 | p->fillRect ( x, y,size,size, Qt::yellow ); | 223 | p->fillRect ( x, y,size,size, Qt::yellow ); |
224 | x += size + 1; | 224 | x += size + 1; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | QFontMetrics fm = p->fontMetrics(); | 227 | QFontMetrics fm = p->fontMetrics(); |
228 | int yPos; | 228 | int yPos; |
229 | int pmheight = size; | 229 | int pmheight = size; |
230 | if( pmheight < fm.height() ) | 230 | if( pmheight < fm.height() ) |
231 | yPos = fm.ascent() + fm.leading()/2; | 231 | yPos = fm.ascent() + fm.leading()/2; |
232 | else | 232 | else |
233 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 233 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
234 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 234 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
235 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 235 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
236 | p->drawText( x, yPos, text() ); | 236 | p->drawText( x, yPos, text() ); |
237 | if ( mIncidence->cancelled() ) { | 237 | if ( mIncidence->cancelled() ) { |
238 | int wid = fm.width( text() ); | 238 | int wid = fm.width( text() ); |
239 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); | 239 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); |
240 | } | 240 | } |
241 | 241 | ||
242 | } | 242 | } |
243 | 243 | ||
244 | int MonthViewItem::height(const QListBox *lb) const | 244 | int MonthViewItem::height(const QListBox *lb) const |
245 | { | 245 | { |
246 | return lb->fontMetrics().lineSpacing()+1; | 246 | return lb->fontMetrics().lineSpacing()+1; |
247 | } | 247 | } |
248 | 248 | ||
249 | int MonthViewItem::width(const QListBox *lb) const | 249 | int MonthViewItem::width(const QListBox *lb) const |
250 | { | 250 | { |
251 | int size = PIXMAP_SIZE; | 251 | int size = PIXMAP_SIZE; |
252 | if ( QApplication::desktop()->width() < 300 ) | 252 | if ( QApplication::desktop()->width() < 300 ) |
253 | size = 3; | 253 | size = 3; |
254 | int x = 1; | 254 | int x = 1; |
255 | if ( mInfo ) { | 255 | if ( mInfo ) { |
256 | x += size + 1; | 256 | x += size + 1; |
257 | } | 257 | } |
258 | if( mRecur ) { | 258 | if( mRecur ) { |
259 | x += size+1; | 259 | x += size+1; |
260 | } | 260 | } |
261 | if( mAlarm ) { | 261 | if( mAlarm ) { |
262 | x += size+1; | 262 | x += size+1; |
263 | } | 263 | } |
264 | if( mReply ) { | 264 | if( mReply ) { |
265 | x += size+1; | 265 | x += size+1; |
266 | } | 266 | } |
267 | 267 | ||
268 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 268 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
269 | } | 269 | } |
270 | 270 | ||
271 | 271 | ||
272 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 272 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
273 | : QWidget( par ), | 273 | : QWidget( par ), |
274 | mMonthView( parent ) | 274 | mMonthView( parent ) |
275 | { | 275 | { |
276 | 276 | ||
277 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 277 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
278 | 278 | ||
279 | // mLabel = new QLabel( this );QPushButton | 279 | // mLabel = new QLabel( this );QPushButton |
280 | mLabel = new QPushButton( this ); | 280 | mLabel = new QPushButton( this ); |
281 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 281 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
282 | //mLabel->setLineWidth( 1 ); | 282 | //mLabel->setLineWidth( 1 ); |
283 | //mLabel->setAlignment( AlignCenter ); | 283 | //mLabel->setAlignment( AlignCenter ); |
284 | mLabel->setFlat( true ); | 284 | mLabel->setFlat( true ); |
285 | mItemList = new KNoScrollListBox( this ); | 285 | mItemList = new KNoScrollListBox( this ); |
286 | mItemList->setMinimumSize( 10, 10 ); | 286 | mItemList->setMinimumSize( 10, 10 ); |
287 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 287 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
288 | mItemList->setLineWidth( 1 ); | 288 | mItemList->setLineWidth( 1 ); |
289 | topLayout->addWidget( mItemList ); | 289 | topLayout->addWidget( mItemList ); |
290 | mLabel->raise(); | 290 | mLabel->raise(); |
291 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 291 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
292 | mStandardPalette = palette(); | 292 | mStandardPalette = palette(); |
293 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 293 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
294 | 294 | ||
295 | enableScrollBars( false ); | 295 | enableScrollBars( false ); |
296 | updateConfig(); | 296 | updateConfig(); |
297 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 297 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
298 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 298 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
299 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 299 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
300 | SLOT( defaultAction( QListBoxItem * ) ) ); | 300 | SLOT( defaultAction( QListBoxItem * ) ) ); |
301 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 301 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
302 | const QPoint &) ), | 302 | const QPoint &) ), |
303 | SLOT( contextMenu( QListBoxItem * ) ) ); | 303 | SLOT( contextMenu( QListBoxItem * ) ) ); |
304 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 304 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
305 | SLOT( selection( QListBoxItem * ) ) ); | 305 | SLOT( selection( QListBoxItem * ) ) ); |
306 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 306 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
307 | SLOT( cellClicked( QListBoxItem * ) ) ); | 307 | SLOT( cellClicked( QListBoxItem * ) ) ); |
308 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 308 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
309 | SLOT( selection( QListBoxItem * ) ) ); | 309 | SLOT( selection( QListBoxItem * ) ) ); |
310 | } | 310 | } |
311 | #ifdef DESKTOP_VERSION | 311 | #ifdef DESKTOP_VERSION |
312 | QToolTipGroup *MonthViewCell::toolTipGroup() | 312 | QToolTipGroup *MonthViewCell::toolTipGroup() |
313 | { | 313 | { |
314 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 314 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
315 | return mToolTipGroup; | 315 | return mToolTipGroup; |
316 | } | 316 | } |
317 | #endif | 317 | #endif |
318 | 318 | ||
319 | void MonthViewCell::setDate( const QDate &date ) | 319 | void MonthViewCell::setDate( const QDate &date ) |
320 | { | 320 | { |
321 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 321 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
322 | mDate = date; | 322 | mDate = date; |
323 | 323 | ||
324 | 324 | ||
325 | 325 | ||
326 | //resizeEvent( 0 ); | 326 | //resizeEvent( 0 ); |
327 | } | 327 | } |
328 | 328 | ||
329 | QDate MonthViewCell::date() const | 329 | QDate MonthViewCell::date() const |
330 | { | 330 | { |
331 | return mDate; | 331 | return mDate; |
332 | } | 332 | } |
333 | 333 | ||
334 | void MonthViewCell::setPrimary( bool primary ) | 334 | void MonthViewCell::setPrimary( bool primary ) |
335 | { | 335 | { |
336 | mPrimary = primary; | 336 | mPrimary = primary; |
337 | //setMyPalette(); | 337 | //setMyPalette(); |
338 | } | 338 | } |
339 | void MonthViewCell::setMyPalette() | 339 | void MonthViewCell::setMyPalette() |
340 | { | 340 | { |
341 | 341 | ||
342 | if ( mHoliday) { | 342 | if ( mHoliday) { |
343 | setPalette( mHolidayPalette ); | 343 | setPalette( mHolidayPalette ); |
344 | } else { | 344 | } else { |
345 | if ( mPrimary ) { | 345 | if ( mPrimary ) { |
346 | setPalette( mPrimaryPalette ); | 346 | setPalette( mPrimaryPalette ); |
347 | } else { | 347 | } else { |
348 | setPalette( mNonPrimaryPalette ); | 348 | setPalette( mNonPrimaryPalette ); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | QPalette pal = palette(); | 351 | QPalette pal = palette(); |
352 | 352 | ||
353 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 353 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
354 | } | 354 | } |
355 | QPalette MonthViewCell::getPalette () | 355 | QPalette MonthViewCell::getPalette () |
356 | { | 356 | { |
357 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 357 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
358 | return mStandardPalette; | 358 | return mStandardPalette; |
359 | if ( mHoliday) { | 359 | if ( mHoliday) { |
360 | return mHolidayPalette ; | 360 | return mHolidayPalette ; |
361 | } else { | 361 | } else { |
362 | if ( mPrimary ) { | 362 | if ( mPrimary ) { |
363 | return mPrimaryPalette ; | 363 | return mPrimaryPalette ; |
364 | } | 364 | } |
365 | } | 365 | } |
366 | return mNonPrimaryPalette; | 366 | return mNonPrimaryPalette; |
367 | } | 367 | } |
368 | bool MonthViewCell::isPrimary() const | 368 | bool MonthViewCell::isPrimary() const |
369 | { | 369 | { |
370 | return mPrimary; | 370 | return mPrimary; |
371 | } | 371 | } |
372 | 372 | ||
373 | void MonthViewCell::setHoliday( bool holiday ) | 373 | void MonthViewCell::setHoliday( bool holiday ) |
374 | { | 374 | { |
375 | mHoliday = holiday; | 375 | mHoliday = holiday; |
376 | //setMyPalette(); | 376 | //setMyPalette(); |
377 | } | 377 | } |
378 | 378 | ||
379 | void MonthViewCell::setHoliday( const QString &holiday ) | 379 | void MonthViewCell::setHoliday( const QString &holiday ) |
380 | { | 380 | { |
381 | mHolidayString = holiday; | 381 | mHolidayString = holiday; |
382 | 382 | ||
383 | if ( !holiday.isEmpty() ) { | 383 | if ( !holiday.isEmpty() ) { |
384 | setHoliday( true ); | 384 | setHoliday( true ); |
385 | } | 385 | } |
386 | } | 386 | } |
387 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 387 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
388 | { | 388 | { |
389 | 389 | ||
390 | e->ignore(); | 390 | e->ignore(); |
391 | 391 | ||
392 | } | 392 | } |
393 | void MonthViewCell::clear() | 393 | void MonthViewCell::clear() |
394 | { | 394 | { |
395 | mItemList->clear(); | 395 | mItemList->clear(); |
396 | QApplication::removePostedEvents ( mItemList ); | 396 | QApplication::removePostedEvents ( mItemList ); |
397 | QApplication::removePostedEvents ( mLabel ); | 397 | QApplication::removePostedEvents ( mLabel ); |
398 | QApplication::removePostedEvents ( this ); | 398 | QApplication::removePostedEvents ( this ); |
399 | } | 399 | } |
400 | 400 | ||
401 | void MonthViewCell::startUpdateCell() | 401 | void MonthViewCell::startUpdateCell() |
402 | { | 402 | { |
403 | 403 | ||
404 | if ( !mMonthView->isUpdatePossible() ) | 404 | if ( !mMonthView->isUpdatePossible() ) |
405 | return; | 405 | return; |
406 | /* | 406 | /* |
407 | if ( !isVisible() ){ | 407 | if ( !isVisible() ){ |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | */ | 410 | */ |
411 | // qDebug("MonthViewCell::updateCell() "); | 411 | // qDebug("MonthViewCell::updateCell() "); |
412 | setPrimary( mDate.month()%2 ); | 412 | setPrimary( mDate.month()%2 ); |
413 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 413 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
414 | if ( mDate == QDate::currentDate() ) { | 414 | if ( mDate == QDate::currentDate() ) { |
415 | mItemList->setLineWidth( 3 ); | 415 | mItemList->setLineWidth( 3 ); |
416 | } else { | 416 | } else { |
417 | mItemList->setLineWidth( 1 ); | 417 | mItemList->setLineWidth( 1 ); |
418 | } | 418 | } |
419 | mItemList->clear(); | 419 | mItemList->clear(); |
420 | 420 | ||
421 | #ifdef DESKTOP_VERSION | 421 | #ifdef DESKTOP_VERSION |
422 | QToolTip::remove(this); | 422 | QToolTip::remove(this); |
423 | #endif | 423 | #endif |
424 | mToolTip = ""; | 424 | mToolTip = ""; |
425 | //qApp->processEvents(); | 425 | //qApp->processEvents(); |
426 | if ( !mHolidayString.isEmpty() ) { | 426 | if ( !mHolidayString.isEmpty() ) { |
427 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 427 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
428 | item->setPalette( mHolidayPalette ); | 428 | item->setPalette( mHolidayPalette ); |
429 | mItemList->insertItem( item ); | 429 | mItemList->insertItem( item ); |
430 | mToolTip += mHolidayString+"\n"; | 430 | mToolTip += mHolidayString+"\n"; |
431 | } | 431 | } |
432 | } | 432 | } |
433 | 433 | ||
434 | void MonthViewCell::insertEvent(Event *event) | 434 | void MonthViewCell::insertEvent(Event *event) |
435 | { | 435 | { |
436 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 436 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
437 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 437 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
438 | return; | 438 | return; |
439 | else | 439 | else |
440 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 440 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
441 | return; | 441 | return; |
442 | } | 442 | } |
443 | 443 | ||
444 | if ( event->categories().contains("Holiday") || | 444 | if ( event->categories().contains("Holiday") || |
445 | event->categories().contains(i18n("Holiday"))) { | 445 | event->categories().contains(i18n("Holiday"))) { |
446 | setHoliday( true ); | 446 | setHoliday( true ); |
447 | if ( mDate.dayOfWeek() == 7 ) | 447 | if ( mDate.dayOfWeek() == 7 ) |
448 | mItemList->setLineWidth( 3 ); | 448 | mItemList->setLineWidth( 3 ); |
449 | } | 449 | } |
450 | QString text; | 450 | QString text; |
451 | if (event->isMultiDay()) { | 451 | if (event->isMultiDay()) { |
452 | QString prefix = "<->"; | 452 | QString prefix = "<->"; |
453 | if ( event->doesRecur() ) { | 453 | if ( event->doesRecur() ) { |
454 | if ( event->recursOn( mDate) ) | 454 | if ( event->recursOn( mDate) ) |
455 | prefix ="->" ; | 455 | prefix ="->" ; |
456 | else { | 456 | else { |
457 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 457 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
458 | if ( event->recursOn( mDate.addDays( -days)) ) | 458 | if ( event->recursOn( mDate.addDays( -days)) ) |
459 | prefix ="<-" ; | 459 | prefix ="<-" ; |
460 | } | 460 | } |
461 | 461 | ||
462 | } else { | 462 | } else { |
463 | if (mDate == event->dtStart().date()) { | 463 | if (mDate == event->dtStart().date()) { |
464 | prefix ="->" ; | 464 | prefix ="->" ; |
465 | } else if (mDate == event->dtEnd().date()) { | 465 | } else if (mDate == event->dtEnd().date()) { |
466 | prefix ="<-" ; | 466 | prefix ="<-" ; |
467 | } | 467 | } |
468 | } | 468 | } |
469 | if ( !event->doesFloat() ) { | 469 | if ( !event->doesFloat() ) { |
470 | if ( mDate == event->dtStart().date () ) | 470 | if ( mDate == event->dtStart().date () ) |
471 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 471 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
472 | else if ( mDate == event->dtEnd().date () ) | 472 | else if ( mDate == event->dtEnd().date () ) |
473 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 473 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
474 | 474 | ||
475 | } | 475 | } |
476 | text = prefix + event->summary(); | 476 | text = prefix + event->summary(); |
477 | mToolTip += text; | 477 | mToolTip += text; |
478 | } else { | 478 | } else { |
479 | if (event->doesFloat()) { | 479 | if (event->doesFloat()) { |
480 | text = event->summary(); | 480 | text = event->summary(); |
481 | mToolTip += text; | 481 | mToolTip += text; |
482 | } | 482 | } |
483 | else { | 483 | else { |
484 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 484 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
485 | text += " " + event->summary(); | 485 | text += " " + event->summary(); |
486 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 486 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 490 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
491 | QPalette pal; | 491 | QPalette pal; |
492 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 492 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
493 | QStringList categories = event->categories(); | 493 | QStringList categories = event->categories(); |
494 | QString cat = categories.first(); | 494 | QString cat = categories.first(); |
495 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 495 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
496 | pal = getPalette(); | 496 | pal = getPalette(); |
497 | if (cat.isEmpty()) { | 497 | if (cat.isEmpty()) { |
498 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 498 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
499 | } else { | 499 | } else { |
500 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 500 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
501 | } | 501 | } |
502 | 502 | ||
503 | } else { | 503 | } else { |
504 | if (cat.isEmpty()) { | 504 | if (cat.isEmpty()) { |
505 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 505 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
506 | } else { | 506 | } else { |
507 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 507 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
508 | } | 508 | } |
509 | } | 509 | } |
510 | 510 | ||
511 | } else { | 511 | } else { |
512 | pal = mStandardPalette ; | 512 | pal = mStandardPalette ; |
513 | } | 513 | } |
514 | item->setPalette( pal ); | 514 | item->setPalette( pal ); |
515 | item->setRecur( event->recurrence()->doesRecur() ); | 515 | item->setRecur( event->recurrence()->doesRecur() ); |
516 | item->setAlarm( event->isAlarmEnabled() ); | 516 | item->setAlarm( event->isAlarmEnabled() ); |
517 | item->setMoreInfo( event->description().length() > 0 ); | 517 | item->setMoreInfo( event->description().length() > 0 ); |
518 | #ifdef DESKTOP_VERSION | 518 | #ifdef DESKTOP_VERSION |
519 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 519 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
520 | KOPrefs::instance()->email()); | 520 | KOPrefs::instance()->email()); |
521 | if ( me != 0 ) { | 521 | if ( me != 0 ) { |
522 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 522 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
523 | item->setReply(true); | 523 | item->setReply(true); |
524 | else | 524 | else |
525 | item->setReply(false); | 525 | item->setReply(false); |
526 | } else | 526 | } else |
527 | item->setReply(false); | 527 | item->setReply(false); |
528 | #endif | 528 | #endif |
529 | mItemList->insertItem( item ); | 529 | mItemList->insertItem( item ); |
530 | mToolTip += "\n"; | 530 | mToolTip += "\n"; |
531 | } | 531 | } |
532 | void MonthViewCell::insertTodo(Todo *todo) | 532 | void MonthViewCell::insertTodo(Todo *todo) |
533 | { | 533 | { |
534 | QString text; | 534 | QString text; |
535 | if (todo->hasDueDate()) { | 535 | if (todo->hasDueDate()) { |
536 | if (!todo->doesFloat()) { | 536 | if (!todo->doesFloat()) { |
537 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 537 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
538 | text += " "; | 538 | text += " "; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | text += i18n("To-Do: %1").arg(todo->summary()); | 541 | text += i18n("To-Do: %1").arg(todo->summary()); |
542 | 542 | ||
543 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 543 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
544 | //item->setPalette( mStandardPalette ); | 544 | //item->setPalette( mStandardPalette ); |
545 | QPalette pal; | 545 | QPalette pal; |
546 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 546 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
547 | QStringList categories = todo->categories(); | 547 | QStringList categories = todo->categories(); |
548 | QString cat = categories.first(); | 548 | QString cat = categories.first(); |
549 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 549 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
550 | pal = getPalette(); | 550 | pal = getPalette(); |
551 | if (cat.isEmpty()) { | 551 | if (cat.isEmpty()) { |
552 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 552 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
553 | } else { | 553 | } else { |
554 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 554 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
555 | } | 555 | } |
556 | 556 | ||
557 | } else { | 557 | } else { |
558 | if (cat.isEmpty()) { | 558 | if (cat.isEmpty()) { |
559 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 559 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
560 | } else { | 560 | } else { |
561 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 561 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | } else { | 565 | } else { |
566 | pal = mStandardPalette ; | 566 | pal = mStandardPalette ; |
567 | } | 567 | } |
568 | item->setPalette( pal ); | 568 | item->setPalette( pal ); |
569 | mItemList->insertItem( item ); | 569 | mItemList->insertItem( item ); |
570 | mToolTip += text+"\n"; | 570 | mToolTip += text+"\n"; |
571 | } | 571 | } |
572 | void MonthViewCell::finishUpdateCell() | 572 | void MonthViewCell::finishUpdateCell() |
573 | { | 573 | { |
574 | #ifdef DESKTOP_VERSION | 574 | #ifdef DESKTOP_VERSION |
575 | if (mToolTip != "") | 575 | if (mToolTip != "") |
576 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 576 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
577 | #endif | 577 | #endif |
578 | mItemList->sort(); | 578 | mItemList->sort(); |
579 | //setMyPalette(); | 579 | //setMyPalette(); |
580 | setMyPalette(); | 580 | setMyPalette(); |
581 | QString text; | 581 | QString text; |
582 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 582 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
583 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 583 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
584 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 584 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
585 | mLabel->resize( mLabelBigSize ); | 585 | mLabel->resize( mLabelBigSize ); |
586 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 586 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
587 | } else { | 587 | } else { |
588 | mLabel->resize( mLabelSize ); | 588 | mLabel->resize( mLabelSize ); |
589 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 589 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
590 | } | 590 | } |
591 | 591 | ||
592 | mLabel->setText( text ); | 592 | mLabel->setText( text ); |
593 | resizeEvent( 0 ); | 593 | resizeEvent( 0 ); |
594 | } | 594 | } |
595 | void MonthViewCell::updateCell() | 595 | void MonthViewCell::updateCell() |
596 | { | 596 | { |
597 | if ( !mMonthView->isUpdatePossible() ) | 597 | if ( !mMonthView->isUpdatePossible() ) |
598 | return; | 598 | return; |
599 | startUpdateCell(); | 599 | startUpdateCell(); |
600 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 600 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
601 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 601 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
602 | Event *event; | 602 | Event *event; |
603 | for( event = events.first(); event; event = events.next() ) { // for event | 603 | for( event = events.first(); event; event = events.next() ) { // for event |
604 | insertEvent(event); | 604 | insertEvent(event); |
605 | } | 605 | } |
606 | // insert due todos | 606 | // insert due todos |
607 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 607 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
608 | Todo *todo; | 608 | Todo *todo; |
609 | for(todo = todos.first(); todo; todo = todos.next()) { | 609 | for(todo = todos.first(); todo; todo = todos.next()) { |
610 | insertTodo( todo ); | 610 | insertTodo( todo ); |
611 | } | 611 | } |
612 | finishUpdateCell(); | 612 | finishUpdateCell(); |
613 | // if ( isVisible()) | 613 | // if ( isVisible()) |
614 | //qApp->processEvents(); | 614 | //qApp->processEvents(); |
615 | } | 615 | } |
616 | 616 | ||
617 | void MonthViewCell::updateConfig() | 617 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
618 | { | 618 | { |
619 | setFont( KOPrefs::instance()->mMonthViewFont ); | 619 | |
620 | if ( bigFont ) { | ||
621 | QFont fo = KOPrefs::instance()->mMonthViewFont; | ||
622 | int ps = fo.pointSize() + 2; | ||
623 | if ( ps < 18 ) | ||
624 | ps += 2; | ||
625 | fo.setPointSize( ps ); | ||
626 | setFont( fo ); | ||
627 | } else | ||
628 | setFont( KOPrefs::instance()->mMonthViewFont ); | ||
620 | 629 | ||
621 | QFontMetrics fm( font() ); | 630 | QFontMetrics fm( font() ); |
622 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 631 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
623 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 632 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
624 | mHolidayPalette = mStandardPalette; | 633 | mHolidayPalette = mStandardPalette; |
625 | mPrimaryPalette = mStandardPalette; | 634 | mPrimaryPalette = mStandardPalette; |
626 | mNonPrimaryPalette = mStandardPalette; | 635 | mNonPrimaryPalette = mStandardPalette; |
627 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 636 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
628 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 637 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
629 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 638 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
630 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 639 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
631 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 640 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
632 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 641 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
633 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 642 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
634 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 643 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
635 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 644 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
636 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 645 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
637 | } | 646 | } |
638 | //updateCell(); | 647 | //updateCell(); |
639 | } | 648 | } |
640 | 649 | ||
641 | void MonthViewCell::enableScrollBars( bool enabled ) | 650 | void MonthViewCell::enableScrollBars( bool enabled ) |
642 | { | 651 | { |
643 | if ( enabled ) { | 652 | if ( enabled ) { |
644 | mItemList->setVScrollBarMode(QScrollView::Auto); | 653 | mItemList->setVScrollBarMode(QScrollView::Auto); |
645 | mItemList->setHScrollBarMode(QScrollView::Auto); | 654 | mItemList->setHScrollBarMode(QScrollView::Auto); |
646 | } else { | 655 | } else { |
647 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 656 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
648 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 657 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
649 | } | 658 | } |
650 | } | 659 | } |
651 | 660 | ||
652 | Incidence *MonthViewCell::selectedIncidence() | 661 | Incidence *MonthViewCell::selectedIncidence() |
653 | { | 662 | { |
654 | int index = mItemList->currentItem(); | 663 | int index = mItemList->currentItem(); |
655 | if ( index < 0 ) return 0; | 664 | if ( index < 0 ) return 0; |
656 | 665 | ||
657 | MonthViewItem *item = | 666 | MonthViewItem *item = |
658 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 667 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
659 | 668 | ||
660 | if ( !item ) return 0; | 669 | if ( !item ) return 0; |
661 | 670 | ||
662 | return item->incidence(); | 671 | return item->incidence(); |
663 | } | 672 | } |
664 | 673 | ||
665 | QDate MonthViewCell::selectedIncidenceDate() | 674 | QDate MonthViewCell::selectedIncidenceDate() |
666 | { | 675 | { |
667 | QDate qd; | 676 | QDate qd; |
668 | int index = mItemList->currentItem(); | 677 | int index = mItemList->currentItem(); |
669 | if ( index < 0 ) return qd; | 678 | if ( index < 0 ) return qd; |
670 | 679 | ||
671 | MonthViewItem *item = | 680 | MonthViewItem *item = |
672 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 681 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
673 | 682 | ||
674 | if ( !item ) return qd; | 683 | if ( !item ) return qd; |
675 | 684 | ||
676 | return item->incidenceDate(); | 685 | return item->incidenceDate(); |
677 | } | 686 | } |
678 | 687 | ||
679 | void MonthViewCell::deselect() | 688 | void MonthViewCell::deselect() |
680 | { | 689 | { |
681 | mItemList->clearSelection(); | 690 | mItemList->clearSelection(); |
682 | enableScrollBars( false ); | 691 | enableScrollBars( false ); |
683 | // updateCell(); | 692 | // updateCell(); |
684 | } | 693 | } |
685 | void MonthViewCell::select() | 694 | void MonthViewCell::select() |
686 | { | 695 | { |
687 | ;// updateCell(); | 696 | ;// updateCell(); |
688 | } | 697 | } |
689 | 698 | ||
690 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 699 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
691 | { | 700 | { |
692 | if ( !mMonthView->isUpdatePossible() ) | 701 | if ( !mMonthView->isUpdatePossible() ) |
693 | return; | 702 | return; |
694 | 703 | ||
695 | int size = height() - mLabel->height() - 2; | 704 | int size = height() - mLabel->height() - 2; |
696 | if ( size > 0 ) | 705 | if ( size > 0 ) |
697 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 706 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
698 | size = width() - mLabel->width() -2; | 707 | size = width() - mLabel->width() -2; |
699 | if ( size > 0 ) | 708 | if ( size > 0 ) |
700 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 709 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
701 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 710 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
702 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 711 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
703 | } | 712 | } |
704 | 713 | ||
705 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 714 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
706 | { | 715 | { |
707 | if ( !item ) return; | 716 | if ( !item ) return; |
708 | 717 | ||
709 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 718 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
710 | Incidence *incidence = eventItem->incidence(); | 719 | Incidence *incidence = eventItem->incidence(); |
711 | if ( incidence ) mMonthView->defaultAction( incidence ); | 720 | if ( incidence ) mMonthView->defaultAction( incidence ); |
712 | } | 721 | } |
713 | void MonthViewCell::showDay() | 722 | void MonthViewCell::showDay() |
714 | { | 723 | { |
715 | emit showDaySignal( date() ); | 724 | emit showDaySignal( date() ); |
716 | } | 725 | } |
717 | void MonthViewCell::newEvent() | 726 | void MonthViewCell::newEvent() |
718 | { | 727 | { |
719 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 728 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
720 | emit newEventSignal( dt ); | 729 | emit newEventSignal( dt ); |
721 | } | 730 | } |
722 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 731 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
723 | { | 732 | { |
724 | static QListBoxItem * lastClicked = 0; | 733 | static QListBoxItem * lastClicked = 0; |
725 | if ( item == 0 ) { | 734 | if ( item == 0 ) { |
726 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 735 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
727 | emit newEventSignal( dt ); | 736 | emit newEventSignal( dt ); |
728 | return; | 737 | return; |
729 | } | 738 | } |
730 | /* | 739 | /* |
731 | if ( lastClicked ) | 740 | if ( lastClicked ) |
732 | if ( ! item ) { | 741 | if ( ! item ) { |
733 | if ( lastClicked->listBox() != item->listBox() ) | 742 | if ( lastClicked->listBox() != item->listBox() ) |
734 | lastClicked->listBox()->clearSelection(); | 743 | lastClicked->listBox()->clearSelection(); |
735 | } | 744 | } |
736 | */ | 745 | */ |
737 | 746 | ||
738 | mMonthView->setSelectedCell( this ); | 747 | mMonthView->setSelectedCell( this ); |
739 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 748 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
740 | select(); | 749 | select(); |
741 | } | 750 | } |
742 | 751 | ||
743 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 752 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
744 | { | 753 | { |
745 | if ( !item ) return; | 754 | if ( !item ) return; |
746 | 755 | ||
747 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 756 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
748 | Incidence *incidence = eventItem->incidence(); | 757 | Incidence *incidence = eventItem->incidence(); |
749 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 758 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
750 | } | 759 | } |
751 | 760 | ||
752 | void MonthViewCell::selection( QListBoxItem *item ) | 761 | void MonthViewCell::selection( QListBoxItem *item ) |
753 | { | 762 | { |
754 | if ( !item ) return; | 763 | if ( !item ) return; |
755 | 764 | ||
756 | mMonthView->setSelectedCell( this ); | 765 | mMonthView->setSelectedCell( this ); |
757 | } | 766 | } |
758 | 767 | ||
759 | 768 | ||
760 | // ******************************************************************************* | 769 | // ******************************************************************************* |
761 | // ******************************************************************************* | 770 | // ******************************************************************************* |
762 | // ******************************************************************************* | 771 | // ******************************************************************************* |
763 | 772 | ||
764 | 773 | ||
765 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 774 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
766 | : KOEventView( calendar, parent, name ), | 775 | : KOEventView( calendar, parent, name ), |
767 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 776 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
768 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 777 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
769 | { | 778 | { |
770 | 779 | ||
771 | clPending = true; | 780 | clPending = true; |
772 | mWidStack = new QWidgetStack( this ); | 781 | mWidStack = new QWidgetStack( this ); |
773 | QHBoxLayout* hb = new QHBoxLayout( this ); | 782 | QHBoxLayout* hb = new QHBoxLayout( this ); |
774 | mMonthView = new QWidget( mWidStack ); | 783 | mMonthView = new QWidget( mWidStack ); |
775 | mWeekView = new QWidget( mWidStack ); | 784 | mWeekView = new QWidget( mWidStack ); |
776 | #if QT_VERSION >= 0x030000 | 785 | #if QT_VERSION >= 0x030000 |
777 | mWidStack->addWidget(mMonthView ); | 786 | mWidStack->addWidget(mMonthView ); |
778 | mWidStack->addWidget(mWeekView ); | 787 | mWidStack->addWidget(mWeekView ); |
779 | #else | 788 | #else |
780 | mWidStack->addWidget( mMonthView, 1 ); | 789 | mWidStack->addWidget( mMonthView, 1 ); |
781 | mWidStack->addWidget( mWeekView , 1 ); | 790 | mWidStack->addWidget( mWeekView , 1 ); |
782 | #endif | 791 | #endif |
783 | hb->addWidget( mWidStack ); | 792 | hb->addWidget( mWidStack ); |
784 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 793 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
785 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 794 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
786 | if ( mShowWeekView ) | 795 | if ( mShowWeekView ) |
787 | mWeekStartsMonday = true; | 796 | mWeekStartsMonday = true; |
788 | updatePossible = false; | 797 | updatePossible = false; |
789 | mCells.setAutoDelete( true ); | 798 | mCells.setAutoDelete( true ); |
790 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 799 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
791 | mDayLabels.resize( mDaysPerWeek ); | 800 | mDayLabels.resize( mDaysPerWeek ); |
792 | mDayLabelsW.resize( mDaysPerWeek ); | 801 | mDayLabelsW.resize( mDaysPerWeek ); |
793 | QFont bfont = font(); | 802 | QFont bfont = font(); |
794 | if ( QApplication::desktop()->width() < 650 ) { | 803 | if ( QApplication::desktop()->width() < 650 ) { |
795 | bfont.setPointSize( bfont.pointSize() - 2 ); | 804 | bfont.setPointSize( bfont.pointSize() - 2 ); |
796 | } | 805 | } |
797 | bfont.setBold( true ); | 806 | bfont.setBold( true ); |
798 | int i; | 807 | int i; |
799 | 808 | ||
800 | for( i = 0; i < mDaysPerWeek; i++ ) { | 809 | for( i = 0; i < mDaysPerWeek; i++ ) { |
801 | QLabel *label = new QLabel( mMonthView ); | 810 | QLabel *label = new QLabel( mMonthView ); |
802 | label->setFont(bfont); | 811 | label->setFont(bfont); |
803 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 812 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
804 | label->setLineWidth(1); | 813 | label->setLineWidth(1); |
805 | label->setAlignment(AlignCenter); | 814 | label->setAlignment(AlignCenter); |
806 | mDayLabels.insert( i, label ); | 815 | mDayLabels.insert( i, label ); |
807 | label = new QLabel( mWeekView ); | 816 | label = new QLabel( mWeekView ); |
808 | label->setFont(bfont); | 817 | label->setFont(bfont); |
809 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 818 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
810 | label->setLineWidth(1); | 819 | label->setLineWidth(1); |
811 | label->setAlignment(AlignCenter); | 820 | label->setAlignment(AlignCenter); |
812 | mDayLabelsW.insert( i, label ); | 821 | mDayLabelsW.insert( i, label ); |
813 | } | 822 | } |
814 | 823 | ||
815 | bfont.setBold( false ); | 824 | bfont.setBold( false ); |
816 | mWeekLabels.resize( mNumWeeks+1 ); | 825 | mWeekLabels.resize( mNumWeeks+1 ); |
817 | mWeekLabelsW.resize( 2 ); | 826 | mWeekLabelsW.resize( 2 ); |
818 | for( i = 0; i < mNumWeeks+1; i++ ) { | 827 | for( i = 0; i < mNumWeeks+1; i++ ) { |
819 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 828 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
820 | label->setFont(bfont); | 829 | label->setFont(bfont); |
821 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 830 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
822 | label->setFlat(true); | 831 | label->setFlat(true); |
823 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 832 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
824 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 833 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
825 | //label->setLineWidth(1); | 834 | //label->setLineWidth(1); |
826 | //label->setAlignment(AlignCenter); | 835 | //label->setAlignment(AlignCenter); |
827 | mWeekLabels.insert( i, label ); | 836 | mWeekLabels.insert( i, label ); |
828 | } | 837 | } |
829 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 838 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
830 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 839 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
831 | 840 | ||
832 | for( i = 0; i < 1+1; i++ ) { | 841 | for( i = 0; i < 1+1; i++ ) { |
833 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 842 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
834 | label->setFont(bfont); | 843 | label->setFont(bfont); |
835 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 844 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
836 | label->setFlat(true); | 845 | label->setFlat(true); |
837 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 846 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
838 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 847 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
839 | //label->setLineWidth(1); | 848 | //label->setLineWidth(1); |
840 | //label->setAlignment(AlignCenter); | 849 | //label->setAlignment(AlignCenter); |
841 | mWeekLabelsW.insert( i, label ); | 850 | mWeekLabelsW.insert( i, label ); |
842 | } | 851 | } |
843 | mWeekLabelsW[1]->setText( i18n("W")); | 852 | mWeekLabelsW[1]->setText( i18n("W")); |
844 | 853 | ||
845 | 854 | ||
846 | int row, col; | 855 | int row, col; |
847 | mCells.resize( mNumCells ); | 856 | mCells.resize( mNumCells ); |
848 | for( row = 0; row < mNumWeeks; ++row ) { | 857 | for( row = 0; row < mNumWeeks; ++row ) { |
849 | for( col = 0; col < mDaysPerWeek; ++col ) { | 858 | for( col = 0; col < mDaysPerWeek; ++col ) { |
850 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 859 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
851 | mCells.insert( row * mDaysPerWeek + col, cell ); | 860 | mCells.insert( row * mDaysPerWeek + col, cell ); |
852 | 861 | ||
853 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 862 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
854 | SLOT( defaultAction( Incidence * ) ) ); | 863 | SLOT( defaultAction( Incidence * ) ) ); |
855 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 864 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
856 | SIGNAL( newEventSignal( QDateTime ) ) ); | 865 | SIGNAL( newEventSignal( QDateTime ) ) ); |
857 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 866 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
858 | SIGNAL( showDaySignal( QDate ) ) ); | 867 | SIGNAL( showDaySignal( QDate ) ) ); |
859 | } | 868 | } |
860 | } | 869 | } |
861 | mCellsW.resize( mDaysPerWeek ); | 870 | mCellsW.resize( mDaysPerWeek ); |
862 | for( col = 0; col < mDaysPerWeek; ++col ) { | 871 | for( col = 0; col < mDaysPerWeek; ++col ) { |
863 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 872 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
864 | mCellsW.insert( col, cell ); | 873 | mCellsW.insert( col, cell ); |
865 | 874 | ||
866 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 875 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
867 | SLOT( defaultAction( Incidence * ) ) ); | 876 | SLOT( defaultAction( Incidence * ) ) ); |
868 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 877 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
869 | SIGNAL( newEventSignal( QDateTime ) ) ); | 878 | SIGNAL( newEventSignal( QDateTime ) ) ); |
870 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 879 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
871 | SIGNAL( showDaySignal( QDate ) ) ); | 880 | SIGNAL( showDaySignal( QDate ) ) ); |
881 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | ||
872 | } | 882 | } |
873 | 883 | ||
874 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 884 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
875 | mContextMenu = eventPopup(); | 885 | mContextMenu = eventPopup(); |
876 | // updateConfig(); //useless here | 886 | // updateConfig(); //useless here |
877 | 887 | ||
878 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 888 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
879 | #if 0 | 889 | #if 0 |
880 | mWidStack = new QWidgetStack( this ); | 890 | mWidStack = new QWidgetStack( this ); |
881 | mMonthView = new QWidget( mWidStack ); | 891 | mMonthView = new QWidget( mWidStack ); |
882 | mWeekView = new QWidget( mWidStack ); | 892 | mWeekView = new QWidget( mWidStack ); |
883 | #endif | 893 | #endif |
884 | if ( mShowWeekView ) | 894 | if ( mShowWeekView ) |
885 | mWidStack->raiseWidget( mWeekView ); | 895 | mWidStack->raiseWidget( mWeekView ); |
886 | else | 896 | else |
887 | mWidStack->raiseWidget( mMonthView ); | 897 | mWidStack->raiseWidget( mMonthView ); |
888 | 898 | ||
889 | emit incidenceSelected( 0 ); | 899 | emit incidenceSelected( 0 ); |
890 | } | 900 | } |
891 | 901 | ||
892 | KOMonthView::~KOMonthView() | 902 | KOMonthView::~KOMonthView() |
893 | { | 903 | { |
894 | delete mContextMenu; | 904 | delete mContextMenu; |
895 | } | 905 | } |
896 | void KOMonthView::selectDateWeekNum ( int ) | 906 | void KOMonthView::selectDateWeekNum ( int ) |
897 | { | 907 | { |
898 | 908 | ||
899 | } | 909 | } |
900 | void KOMonthView::selectInternalWeekNum ( int n ) | 910 | void KOMonthView::selectInternalWeekNum ( int n ) |
901 | { | 911 | { |
902 | switchView(); | 912 | switchView(); |
903 | emit selectWeekNum ( n ); | 913 | emit selectWeekNum ( n ); |
904 | } | 914 | } |
905 | 915 | ||
906 | void KOMonthView::switchView() | 916 | void KOMonthView::switchView() |
907 | { | 917 | { |
908 | 918 | ||
909 | if ( selectedCell( ) ) | 919 | if ( selectedCell( ) ) |
910 | selectedCell()->deselect(); | 920 | selectedCell()->deselect(); |
911 | mShowWeekView = !mShowWeekView; | 921 | mShowWeekView = !mShowWeekView; |
912 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 922 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
913 | //emit showNavigator( !mShowWeekView ); | 923 | //emit showNavigator( !mShowWeekView ); |
914 | if ( clPending ) { | 924 | if ( clPending ) { |
915 | computeLayout(); | 925 | computeLayout(); |
916 | updateConfig(); | 926 | updateConfig(); |
917 | } | 927 | } |
918 | if ( mShowWeekView ) | 928 | if ( mShowWeekView ) |
919 | mWidStack->raiseWidget( mWeekView ); | 929 | mWidStack->raiseWidget( mWeekView ); |
920 | else | 930 | else |
921 | mWidStack->raiseWidget( mMonthView ); | 931 | mWidStack->raiseWidget( mMonthView ); |
922 | clPending = false; | 932 | clPending = false; |
923 | } | 933 | } |
924 | 934 | ||
925 | int KOMonthView::maxDatesHint() | 935 | int KOMonthView::maxDatesHint() |
926 | { | 936 | { |
927 | return mNumCells; | 937 | return mNumCells; |
928 | } | 938 | } |
929 | 939 | ||
930 | int KOMonthView::currentDateCount() | 940 | int KOMonthView::currentDateCount() |
931 | { | 941 | { |
932 | return mNumCells; | 942 | return mNumCells; |
933 | } | 943 | } |
934 | 944 | ||
935 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 945 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
936 | { | 946 | { |
937 | QPtrList<Incidence> selected; | 947 | QPtrList<Incidence> selected; |
938 | 948 | ||
939 | if ( mSelectedCell ) { | 949 | if ( mSelectedCell ) { |
940 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 950 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
941 | if ( incidence ) selected.append( incidence ); | 951 | if ( incidence ) selected.append( incidence ); |
942 | } | 952 | } |
943 | 953 | ||
944 | return selected; | 954 | return selected; |
945 | } | 955 | } |
946 | 956 | ||
947 | DateList KOMonthView::selectedDates() | 957 | DateList KOMonthView::selectedDates() |
948 | { | 958 | { |
949 | DateList selected; | 959 | DateList selected; |
950 | 960 | ||
951 | if ( mSelectedCell ) { | 961 | if ( mSelectedCell ) { |
952 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 962 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
953 | if ( qd.isValid() ) selected.append( qd ); | 963 | if ( qd.isValid() ) selected.append( qd ); |
954 | } | 964 | } |
955 | 965 | ||
956 | return selected; | 966 | return selected; |
957 | } | 967 | } |
958 | 968 | ||
959 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 969 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
960 | const QDate &td) | 970 | const QDate &td) |
961 | { | 971 | { |
962 | #ifndef KORG_NOPRINTER | 972 | #ifndef KORG_NOPRINTER |
963 | calPrinter->preview(CalPrinter::Month, fd, td); | 973 | calPrinter->preview(CalPrinter::Month, fd, td); |
964 | #endif | 974 | #endif |
965 | } | 975 | } |
966 | 976 | ||
967 | void KOMonthView::updateConfig() | 977 | void KOMonthView::updateConfig() |
968 | { | 978 | { |
969 | 979 | ||
970 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 980 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
971 | 981 | ||
972 | if ( mShowWeekView ) { | 982 | if ( mShowWeekView ) { |
973 | mWeekStartsMonday = true; | 983 | mWeekStartsMonday = true; |
974 | } | 984 | } |
975 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 985 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
976 | mWidthLongDayLabel = 0; | 986 | mWidthLongDayLabel = 0; |
977 | 987 | ||
978 | for (int i = 0; i < 7; i++) { | 988 | for (int i = 0; i < 7; i++) { |
979 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 989 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
980 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 990 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
981 | } | 991 | } |
982 | bool temp = mShowSatSunComp ; | 992 | bool temp = mShowSatSunComp ; |
983 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 993 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
984 | if ( ! mShowWeekView ) { | 994 | if ( ! mShowWeekView ) { |
985 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 995 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
986 | computeLayout(); | 996 | computeLayout(); |
987 | } | 997 | } |
988 | updateDayLabels(); | 998 | updateDayLabels(); |
989 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 999 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
990 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1000 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
991 | //resizeEvent( 0 ); | 1001 | //resizeEvent( 0 ); |
992 | for (uint i = 0; i < mCells.count(); ++i) { | 1002 | for (uint i = 0; i < mCells.count(); ++i) { |
993 | mCells[i]->updateConfig(); | 1003 | mCells[i]->updateConfig(); |
994 | } | 1004 | } |
1005 | |||
1006 | for (uint i = 0; i < mCellsW.count(); ++i) { | ||
1007 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | ||
1008 | } | ||
995 | #ifdef DESKTOP_VERSION | 1009 | #ifdef DESKTOP_VERSION |
996 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1010 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
997 | #endif | 1011 | #endif |
998 | updateView(); | 1012 | updateView(); |
999 | } | 1013 | } |
1000 | 1014 | ||
1001 | void KOMonthView::updateDayLabels() | 1015 | void KOMonthView::updateDayLabels() |
1002 | { | 1016 | { |
1003 | 1017 | ||
1004 | QPtrVector<QLabel> *mDayLabelsT; | 1018 | QPtrVector<QLabel> *mDayLabelsT; |
1005 | #if 0 | 1019 | #if 0 |
1006 | if (mShowWeekView ) | 1020 | if (mShowWeekView ) |
1007 | mDayLabelsT = &mDayLabelsW; | 1021 | mDayLabelsT = &mDayLabelsW; |
1008 | else | 1022 | else |
1009 | mDayLabelsT = &mDayLabels; | 1023 | mDayLabelsT = &mDayLabels; |
1010 | #endif | 1024 | #endif |
1011 | 1025 | ||
1012 | mDayLabelsT = &mDayLabelsW; | 1026 | mDayLabelsT = &mDayLabelsW; |
1013 | for (int i = 0; i < 7; i++) { | 1027 | for (int i = 0; i < 7; i++) { |
1014 | if (mWeekStartsMonday) { | 1028 | if (mWeekStartsMonday) { |
1015 | bool show = mShortDayLabels; | 1029 | bool show = mShortDayLabels; |
1016 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1030 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1017 | show = true; | 1031 | show = true; |
1018 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1032 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1019 | } else { | 1033 | } else { |
1020 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 1034 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
1021 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 1035 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
1022 | 1036 | ||
1023 | } | 1037 | } |
1024 | } | 1038 | } |
1025 | mDayLabelsT = &mDayLabels; | 1039 | mDayLabelsT = &mDayLabels; |
1026 | for (int i = 0; i < 7; i++) { | 1040 | for (int i = 0; i < 7; i++) { |
1027 | if (mWeekStartsMonday) { | 1041 | if (mWeekStartsMonday) { |
1028 | bool show = mShortDayLabels; | 1042 | bool show = mShortDayLabels; |
1029 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1043 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1030 | show = true; | 1044 | show = true; |
1031 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1045 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1032 | } else { | 1046 | } else { |
1033 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 1047 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
1034 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 1048 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
1035 | 1049 | ||
1036 | } | 1050 | } |
1037 | } | 1051 | } |
1038 | 1052 | ||
1039 | } | 1053 | } |
1040 | 1054 | ||
1041 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1055 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1042 | { | 1056 | { |
1043 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1057 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1044 | 1058 | ||
1045 | QPtrVector<MonthViewCell> *cells; | 1059 | QPtrVector<MonthViewCell> *cells; |
1046 | QPtrVector<QLabel> *dayLabels; | 1060 | QPtrVector<QLabel> *dayLabels; |
1047 | QPtrVector<KOWeekButton> *weekLabels; | 1061 | QPtrVector<KOWeekButton> *weekLabels; |
1048 | int weekNum = 6; | 1062 | int weekNum = 6; |
1049 | if ( mShowWeekView ) { | 1063 | if ( mShowWeekView ) { |
1050 | weekNum = 1; | 1064 | weekNum = 1; |
1051 | cells = &mCellsW; | 1065 | cells = &mCellsW; |
1052 | dayLabels = &mDayLabelsW; | 1066 | dayLabels = &mDayLabelsW; |
1053 | weekLabels = &mWeekLabelsW; | 1067 | weekLabels = &mWeekLabelsW; |
1054 | } else { | 1068 | } else { |
1055 | cells = &mCells; | 1069 | cells = &mCells; |
1056 | dayLabels = &mDayLabels; | 1070 | dayLabels = &mDayLabels; |
1057 | weekLabels = &mWeekLabels; | 1071 | weekLabels = &mWeekLabels; |
1058 | } | 1072 | } |
1059 | 1073 | ||
1060 | mStartDate = start; | 1074 | mStartDate = start; |
1061 | 1075 | ||
1062 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1076 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1063 | 1077 | ||
1064 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1078 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1065 | mStartDate = mStartDate.addDays( -1 ); | 1079 | mStartDate = mStartDate.addDays( -1 ); |
1066 | } | 1080 | } |
1067 | 1081 | ||
1068 | bool primary = false; | 1082 | bool primary = false; |
1069 | uint i; | 1083 | uint i; |
1070 | for( i = 0; i < (*cells).size(); ++i ) { | 1084 | for( i = 0; i < (*cells).size(); ++i ) { |
1071 | QDate date = mStartDate.addDays( i ); | 1085 | QDate date = mStartDate.addDays( i ); |
1072 | (*cells)[i]->setDate( date ); | 1086 | (*cells)[i]->setDate( date ); |
1073 | 1087 | ||
1074 | #ifndef KORG_NOPLUGINS | 1088 | #ifndef KORG_NOPLUGINS |
1075 | // add holiday, if present | 1089 | // add holiday, if present |
1076 | QString hstring(KOCore::self()->holiday(date)); | 1090 | QString hstring(KOCore::self()->holiday(date)); |
1077 | (*cells)[i]->setHoliday( hstring ); | 1091 | (*cells)[i]->setHoliday( hstring ); |
1078 | #endif | 1092 | #endif |
1079 | 1093 | ||
1080 | } | 1094 | } |
1081 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1095 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1082 | for( i = 0; i < weekNum; ++i ) { | 1096 | for( i = 0; i < weekNum; ++i ) { |
1083 | int wno; | 1097 | int wno; |
1084 | // remember, according to ISO 8601, the first week of the year is the | 1098 | // remember, according to ISO 8601, the first week of the year is the |
1085 | // first week that contains a thursday. Thus we must subtract off 4, | 1099 | // first week that contains a thursday. Thus we must subtract off 4, |
1086 | // not just 1. | 1100 | // not just 1. |
1087 | int dayOfYear = date.dayOfYear(); | 1101 | int dayOfYear = date.dayOfYear(); |
1088 | if (dayOfYear % 7 != 0) | 1102 | if (dayOfYear % 7 != 0) |
1089 | wno = dayOfYear / 7 + 1; | 1103 | wno = dayOfYear / 7 + 1; |
1090 | else | 1104 | else |
1091 | wno =dayOfYear / 7; | 1105 | wno =dayOfYear / 7; |
1092 | (*weekLabels)[i]->setWeekNum( wno ); | 1106 | (*weekLabels)[i]->setWeekNum( wno ); |
1093 | date = date.addDays( 7 ); | 1107 | date = date.addDays( 7 ); |
1094 | } | 1108 | } |
1095 | updateView(); | 1109 | updateView(); |
1096 | } | 1110 | } |
1097 | 1111 | ||
1098 | void KOMonthView::showEvents(QPtrList<Event>) | 1112 | void KOMonthView::showEvents(QPtrList<Event>) |
1099 | { | 1113 | { |
1100 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1114 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1101 | } | 1115 | } |
1102 | 1116 | ||
1103 | void KOMonthView::changeEventDisplay(Event *, int) | 1117 | void KOMonthView::changeEventDisplay(Event *, int) |
1104 | { | 1118 | { |
1105 | // this should be re-written to be much more efficient, but this | 1119 | // this should be re-written to be much more efficient, but this |
1106 | // quick-and-dirty-hack gets the job done for right now. | 1120 | // quick-and-dirty-hack gets the job done for right now. |
1107 | updateView(); | 1121 | updateView(); |
1108 | } | 1122 | } |
1109 | 1123 | ||
1110 | void KOMonthView::updateView() | 1124 | void KOMonthView::updateView() |
1111 | { | 1125 | { |
1112 | 1126 | ||
1113 | if ( !updatePossible ) | 1127 | if ( !updatePossible ) |
1114 | return; | 1128 | return; |
1115 | //QTime ti; | 1129 | //QTime ti; |
1116 | //ti.start(); | 1130 | //ti.start(); |
1117 | QPtrVector<MonthViewCell> *cells; | 1131 | QPtrVector<MonthViewCell> *cells; |
1118 | if ( mShowWeekView ) { | 1132 | if ( mShowWeekView ) { |
1119 | cells = &mCellsW; | 1133 | cells = &mCellsW; |
1120 | } else { | 1134 | } else { |
1121 | cells = &mCells; | 1135 | cells = &mCells; |
1122 | } | 1136 | } |
1123 | #if 1 | 1137 | #if 1 |
1124 | int i; | 1138 | int i; |
1125 | int timeSpan = (*cells).size()-1; | 1139 | int timeSpan = (*cells).size()-1; |
1126 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1140 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1127 | timeSpan = 6; | 1141 | timeSpan = 6; |
1128 | for( i = 0; i < timeSpan + 1; ++i ) { | 1142 | for( i = 0; i < timeSpan + 1; ++i ) { |
1129 | (*cells)[i]->startUpdateCell(); | 1143 | (*cells)[i]->startUpdateCell(); |
1130 | } | 1144 | } |
1131 | 1145 | ||
1132 | QPtrList<Event> events = calendar()->events(); | 1146 | QPtrList<Event> events = calendar()->events(); |
1133 | Event *event; | 1147 | Event *event; |
1134 | QDateTime dt; | 1148 | QDateTime dt; |
1135 | bool ok; | 1149 | bool ok; |
1136 | QDate endDate = mStartDate.addDays( timeSpan ); | 1150 | QDate endDate = mStartDate.addDays( timeSpan ); |
1137 | for( event = events.first(); event; event = events.next() ) { // for event | 1151 | for( event = events.first(); event; event = events.next() ) { // for event |
1138 | if ( event->doesRecur() ) { | 1152 | if ( event->doesRecur() ) { |
1139 | bool last; | 1153 | bool last; |
1140 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1154 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1141 | QDateTime incidenceEnd; | 1155 | QDateTime incidenceEnd; |
1142 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1156 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1143 | bool invalid = false; | 1157 | bool invalid = false; |
1144 | while( true ) { | 1158 | while( true ) { |
1145 | if ( incidenceStart.isValid() ) { | 1159 | if ( incidenceStart.isValid() ) { |
1146 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1160 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1147 | int st = incidenceStart.date().daysTo( endDate ); | 1161 | int st = incidenceStart.date().daysTo( endDate ); |
1148 | if ( st >= 0 ) { // start before timeend | 1162 | if ( st >= 0 ) { // start before timeend |
1149 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1163 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1150 | if ( end >= 0 ) { // end after timestart --- got one! | 1164 | if ( end >= 0 ) { // end after timestart --- got one! |
1151 | //normalize | 1165 | //normalize |
1152 | st = timeSpan - st; | 1166 | st = timeSpan - st; |
1153 | if ( st < 0 ) st = 0; | 1167 | if ( st < 0 ) st = 0; |
1154 | if ( end > timeSpan ) end = timeSpan; | 1168 | if ( end > timeSpan ) end = timeSpan; |
1155 | int iii; | 1169 | int iii; |
1156 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1170 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1157 | for ( iii = st;iii<= end;++iii) | 1171 | for ( iii = st;iii<= end;++iii) |
1158 | (*cells)[iii]->insertEvent( event ); | 1172 | (*cells)[iii]->insertEvent( event ); |
1159 | } | 1173 | } |
1160 | } | 1174 | } |
1161 | } else { | 1175 | } else { |
1162 | if ( invalid ) | 1176 | if ( invalid ) |
1163 | break; | 1177 | break; |
1164 | invalid = true; | 1178 | invalid = true; |
1165 | //qDebug("invalid %s", event->summary().latin1()); | 1179 | //qDebug("invalid %s", event->summary().latin1()); |
1166 | incidenceStart = QDateTime( mStartDate ); | 1180 | incidenceStart = QDateTime( mStartDate ); |
1167 | } | 1181 | } |
1168 | if ( last ) | 1182 | if ( last ) |
1169 | break; | 1183 | break; |
1170 | bool ok; | 1184 | bool ok; |
1171 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1185 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1172 | if ( ! ok ) | 1186 | if ( ! ok ) |
1173 | break; | 1187 | break; |
1174 | if ( incidenceStart.date() > endDate ) | 1188 | if ( incidenceStart.date() > endDate ) |
1175 | break; | 1189 | break; |
1176 | } | 1190 | } |
1177 | } else { // no recur | 1191 | } else { // no recur |
1178 | int st = event->dtStart().date().daysTo( endDate ); | 1192 | int st = event->dtStart().date().daysTo( endDate ); |
1179 | if ( st >= 0 ) { // start before timeend | 1193 | if ( st >= 0 ) { // start before timeend |
1180 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1194 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1181 | if ( end >= 0 ) { // end after timestart --- got one! | 1195 | if ( end >= 0 ) { // end after timestart --- got one! |
1182 | //normalize | 1196 | //normalize |
1183 | st = timeSpan - st; | 1197 | st = timeSpan - st; |
1184 | if ( st < 0 ) st = 0; | 1198 | if ( st < 0 ) st = 0; |
1185 | if ( end > timeSpan ) end = timeSpan; | 1199 | if ( end > timeSpan ) end = timeSpan; |
1186 | int iii; | 1200 | int iii; |
1187 | for ( iii = st;iii<= end;++iii) | 1201 | for ( iii = st;iii<= end;++iii) |
1188 | (*cells)[iii]->insertEvent( event ); | 1202 | (*cells)[iii]->insertEvent( event ); |
1189 | } | 1203 | } |
1190 | } | 1204 | } |
1191 | } | 1205 | } |
1192 | } | 1206 | } |
1193 | // insert due todos | 1207 | // insert due todos |
1194 | QPtrList<Todo> todos = calendar()->todos( ); | 1208 | QPtrList<Todo> todos = calendar()->todos( ); |
1195 | Todo *todo; | 1209 | Todo *todo; |
1196 | for(todo = todos.first(); todo; todo = todos.next()) { | 1210 | for(todo = todos.first(); todo; todo = todos.next()) { |
1197 | //insertTodo( todo ); | 1211 | //insertTodo( todo ); |
1198 | if ( todo->hasDueDate() ) { | 1212 | if ( todo->hasDueDate() ) { |
1199 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1213 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1200 | if ( day >= 0 && day < timeSpan + 1) { | 1214 | if ( day >= 0 && day < timeSpan + 1) { |
1201 | (*cells)[day]->insertTodo( todo ); | 1215 | (*cells)[day]->insertTodo( todo ); |
1202 | } | 1216 | } |
1203 | } | 1217 | } |
1204 | } | 1218 | } |
1205 | 1219 | ||
1206 | for( i = 0; i < timeSpan+1; ++i ) { | 1220 | for( i = 0; i < timeSpan+1; ++i ) { |
1207 | (*cells)[i]->finishUpdateCell(); | 1221 | (*cells)[i]->finishUpdateCell(); |
1208 | } | 1222 | } |
1209 | processSelectionChange(); | 1223 | processSelectionChange(); |
1210 | (*cells)[0]->setFocus(); | 1224 | (*cells)[0]->setFocus(); |
1211 | 1225 | ||
1212 | 1226 | ||
1213 | #else | 1227 | #else |
1214 | // old code | 1228 | // old code |
1215 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1229 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1216 | int i; | 1230 | int i; |
1217 | for( i = 0; i < (*cells).count(); ++i ) { | 1231 | for( i = 0; i < (*cells).count(); ++i ) { |
1218 | (*cells)[i]->updateCell(); | 1232 | (*cells)[i]->updateCell(); |
1219 | } | 1233 | } |
1220 | 1234 | ||
1221 | //qDebug("KOMonthView::updateView() "); | 1235 | //qDebug("KOMonthView::updateView() "); |
1222 | processSelectionChange(); | 1236 | processSelectionChange(); |
1223 | // qDebug("---------------------------------------------------------------------+ "); | 1237 | // qDebug("---------------------------------------------------------------------+ "); |
1224 | (*cells)[0]->setFocus(); | 1238 | (*cells)[0]->setFocus(); |
1225 | #endif | 1239 | #endif |
1226 | 1240 | ||
1227 | //qDebug("update time %d ", ti.elapsed()); | 1241 | //qDebug("update time %d ", ti.elapsed()); |
1228 | } | 1242 | } |
1229 | 1243 | ||
1230 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1244 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1231 | { | 1245 | { |
1232 | computeLayout(); | 1246 | computeLayout(); |
1233 | clPending = true; | 1247 | clPending = true; |
1234 | if ( mShowWeekView ) | 1248 | if ( mShowWeekView ) |
1235 | mCellsW[0]->setFocus(); | 1249 | mCellsW[0]->setFocus(); |
1236 | else | 1250 | else |
1237 | mCells[0]->setFocus(); | 1251 | mCells[0]->setFocus(); |
1238 | } | 1252 | } |
1239 | void KOMonthView::computeLayoutWeek() | 1253 | void KOMonthView::computeLayoutWeek() |
1240 | { | 1254 | { |
1241 | 1255 | ||
1242 | int daysToShow; | 1256 | int daysToShow; |
1243 | bool combinedSatSun = false; | 1257 | bool combinedSatSun = false; |
1244 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1258 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1245 | daysToShow = 6; | 1259 | daysToShow = 6; |
1246 | combinedSatSun = true; | 1260 | combinedSatSun = true; |
1247 | } | 1261 | } |
1248 | int tWid = topLevelWidget()->size().width(); | 1262 | int tWid = topLevelWidget()->size().width(); |
1249 | int tHei = topLevelWidget()->size().height(); | 1263 | int tHei = topLevelWidget()->size().height(); |
1250 | 1264 | ||
1251 | int wid = size().width();//e | 1265 | int wid = size().width();//e |
1252 | int hei = size().height()-1; | 1266 | int hei = size().height()-1; |
1253 | 1267 | ||
1254 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1268 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1255 | return; | 1269 | return; |
1256 | 1270 | ||
1257 | if ( wid < hei ) | 1271 | if ( wid < hei ) |
1258 | daysToShow = 2; | 1272 | daysToShow = 2; |
1259 | else | 1273 | else |
1260 | daysToShow = 3; | 1274 | daysToShow = 3; |
1261 | mShowSatSunComp = true; | 1275 | mShowSatSunComp = true; |
1262 | combinedSatSun = true; | 1276 | combinedSatSun = true; |
1263 | 1277 | ||
1264 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1278 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1265 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1279 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1266 | int weeklabelwid = fm.width( "888" ); | 1280 | int weeklabelwid = fm.width( "888" ); |
1267 | wid -= weeklabelwid; | 1281 | wid -= weeklabelwid; |
1268 | 1282 | ||
1269 | int colWid = wid / daysToShow; | 1283 | int colWid = wid / daysToShow; |
1270 | int lastCol = wid - ( colWid*6 ); | 1284 | int lastCol = wid - ( colWid*6 ); |
1271 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1285 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1272 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1286 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1273 | int colModulo = wid % daysToShow; | 1287 | int colModulo = wid % daysToShow; |
1274 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1288 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1275 | //qDebug("rowmod %d ", rowModulo); | 1289 | //qDebug("rowmod %d ", rowModulo); |
1276 | int i; | 1290 | int i; |
1277 | int x,y,w,h; | 1291 | int x,y,w,h; |
1278 | x= 0; | 1292 | x= 0; |
1279 | y= 0; | 1293 | y= 0; |
1280 | w = colWid; | 1294 | w = colWid; |
1281 | h = dayLabelHei ; | 1295 | h = dayLabelHei ; |
1282 | for ( i = 0; i < 7; i++) { | 1296 | for ( i = 0; i < 7; i++) { |
1283 | if ( i && !( i % daysToShow) && i < 6) { | 1297 | if ( i && !( i % daysToShow) && i < 6) { |
1284 | y += hei/(5-daysToShow); | 1298 | y += hei/(5-daysToShow); |
1285 | x = 0; | 1299 | x = 0; |
1286 | w = colWid; | 1300 | w = colWid; |
1287 | } | 1301 | } |
1288 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1302 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1289 | ++w; | 1303 | ++w; |
1290 | } | 1304 | } |
1291 | if ( i >= 5 ) { | 1305 | if ( i >= 5 ) { |
1292 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1306 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1293 | x -= (w/2 ); | 1307 | x -= (w/2 ); |
1294 | } | 1308 | } |
1295 | else | 1309 | else |
1296 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1310 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1297 | x += w; | 1311 | x += w; |
1298 | } | 1312 | } |
1299 | x= 0; | 1313 | x= 0; |
1300 | y= dayLabelHei; | 1314 | y= dayLabelHei; |
1301 | w = colWid; | 1315 | w = colWid; |
1302 | h = cellHei; | 1316 | h = cellHei; |
1303 | for ( i = 0; i < mCellsW.count(); ++i) { | 1317 | for ( i = 0; i < mCellsW.count(); ++i) { |
1304 | if ( i > 6 ) { | 1318 | if ( i > 6 ) { |
1305 | mCellsW[i]->hide(); | 1319 | mCellsW[i]->hide(); |
1306 | continue; | 1320 | continue; |
1307 | } | 1321 | } |
1308 | 1322 | ||
1309 | w = colWid; | 1323 | w = colWid; |
1310 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1324 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1311 | ++w; | 1325 | ++w; |
1312 | } | 1326 | } |
1313 | if ( i == (daysToShow-1-rowModulo)*7) | 1327 | if ( i == (daysToShow-1-rowModulo)*7) |
1314 | ++h; | 1328 | ++h; |
1315 | 1329 | ||
1316 | if ( i >= 5 ) { | 1330 | if ( i >= 5 ) { |
1317 | if ( i ==5 ) { | 1331 | if ( i ==5 ) { |
1318 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1332 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1319 | x -= w ;y += h/2; | 1333 | x -= w ;y += h/2; |
1320 | } else { | 1334 | } else { |
1321 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1335 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1322 | ++w; | 1336 | ++w; |
1323 | } | 1337 | } |
1324 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1338 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1325 | y -= h/2; | 1339 | y -= h/2; |
1326 | } | 1340 | } |
1327 | } else | 1341 | } else |
1328 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1342 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1329 | 1343 | ||
1330 | 1344 | ||
1331 | x += w; | 1345 | x += w; |
1332 | if ( x + w/2 > wid ) { | 1346 | if ( x + w/2 > wid ) { |
1333 | x = 0; | 1347 | x = 0; |
1334 | y += h+dayLabelHei ; | 1348 | y += h+dayLabelHei ; |
1335 | } | 1349 | } |
1336 | } | 1350 | } |
1337 | y= dayLabelHei; | 1351 | y= dayLabelHei; |
1338 | h = cellHei ; | 1352 | h = cellHei ; |
1339 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1353 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1340 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1354 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1341 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1355 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1342 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1356 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1343 | mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1357 | mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
1344 | updateDayLabels(); | 1358 | updateDayLabels(); |
1345 | bool forceUpdate = !updatePossible; | 1359 | bool forceUpdate = !updatePossible; |
1346 | updatePossible = true; | 1360 | updatePossible = true; |
1347 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1361 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1348 | if ( forceUpdate ) | 1362 | if ( forceUpdate ) |
1349 | updateView(); | 1363 | updateView(); |
1350 | } | 1364 | } |
1351 | void KOMonthView::computeLayout() | 1365 | void KOMonthView::computeLayout() |
1352 | { | 1366 | { |
1353 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1367 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1354 | // note this only changes the text if the requested size crosses the | 1368 | // note this only changes the text if the requested size crosses the |
1355 | // threshold between big enough to support the full name and not big | 1369 | // threshold between big enough to support the full name and not big |
1356 | // enough. | 1370 | // enough. |
1357 | if ( mShowWeekView ){ | 1371 | if ( mShowWeekView ){ |
1358 | computeLayoutWeek(); | 1372 | computeLayoutWeek(); |
1359 | return; | 1373 | return; |
1360 | } | 1374 | } |
1361 | int daysToShow = 7; | 1375 | int daysToShow = 7; |
1362 | bool combinedSatSun = false; | 1376 | bool combinedSatSun = false; |
1363 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1377 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1364 | daysToShow = 6; | 1378 | daysToShow = 6; |
1365 | combinedSatSun = true; | 1379 | combinedSatSun = true; |
1366 | } | 1380 | } |
1367 | int tWid = topLevelWidget()->size().width(); | 1381 | int tWid = topLevelWidget()->size().width(); |
1368 | int tHei = topLevelWidget()->size().height(); | 1382 | int tHei = topLevelWidget()->size().height(); |
1369 | 1383 | ||
1370 | int wid = size().width();//e | 1384 | int wid = size().width();//e |
1371 | int hei = size().height()-1; | 1385 | int hei = size().height()-1; |
1372 | 1386 | ||
1373 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1387 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1374 | return; | 1388 | return; |
1375 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1389 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1376 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1390 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1377 | int weeklabelwid = fm.width( "888" ); | 1391 | int weeklabelwid = fm.width( "888" ); |
1378 | wid -= weeklabelwid; | 1392 | wid -= weeklabelwid; |
1379 | 1393 | ||
1380 | int colWid = wid / daysToShow; | 1394 | int colWid = wid / daysToShow; |
1381 | int lastCol = wid - ( colWid*6 ); | 1395 | int lastCol = wid - ( colWid*6 ); |
1382 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1396 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1383 | int cellHei = (hei - dayLabelHei) /6; | 1397 | int cellHei = (hei - dayLabelHei) /6; |
1384 | int colModulo = wid % daysToShow; | 1398 | int colModulo = wid % daysToShow; |
1385 | int rowModulo = (hei- dayLabelHei) % 6; | 1399 | int rowModulo = (hei- dayLabelHei) % 6; |
1386 | //qDebug("rowmod %d ", rowModulo); | 1400 | //qDebug("rowmod %d ", rowModulo); |
1387 | int i; | 1401 | int i; |
1388 | int x,y,w,h; | 1402 | int x,y,w,h; |
1389 | x= 0; | 1403 | x= 0; |
1390 | y= 0; | 1404 | y= 0; |
1391 | w = colWid; | 1405 | w = colWid; |
1392 | h = dayLabelHei ; | 1406 | h = dayLabelHei ; |
1393 | for ( i = 0; i < 7; i++) { | 1407 | for ( i = 0; i < 7; i++) { |
1394 | if ( i == daysToShow-colModulo ) | 1408 | if ( i == daysToShow-colModulo ) |
1395 | ++w; | 1409 | ++w; |
1396 | if ( combinedSatSun ) { | 1410 | if ( combinedSatSun ) { |
1397 | if ( i >= daysToShow-1 ) { | 1411 | if ( i >= daysToShow-1 ) { |
1398 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1412 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1399 | x -= w/2 ; | 1413 | x -= w/2 ; |
1400 | } | 1414 | } |
1401 | else | 1415 | else |
1402 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1416 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1403 | } else | 1417 | } else |
1404 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1418 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1405 | x += w; | 1419 | x += w; |
1406 | } | 1420 | } |
1407 | x= 0; | 1421 | x= 0; |
1408 | y= dayLabelHei; | 1422 | y= dayLabelHei; |
1409 | w = colWid; | 1423 | w = colWid; |
1410 | h = cellHei ; | 1424 | h = cellHei ; |
1411 | for ( i = 0; i < mCells.count(); ++i) { | 1425 | for ( i = 0; i < mCells.count(); ++i) { |
1412 | w = colWid; | 1426 | w = colWid; |
1413 | if ( ((i) % 7) >= 7-colModulo ) { | 1427 | if ( ((i) % 7) >= 7-colModulo ) { |
1414 | ++w; | 1428 | ++w; |
1415 | } | 1429 | } |
1416 | if ( i == (6-rowModulo)*7) | 1430 | if ( i == (6-rowModulo)*7) |
1417 | ++h; | 1431 | ++h; |
1418 | if ( combinedSatSun ) { | 1432 | if ( combinedSatSun ) { |
1419 | if ( (i)%7 >= daysToShow-1 ) { | 1433 | if ( (i)%7 >= daysToShow-1 ) { |
1420 | if ( (i)%7 == daysToShow-1 ) { | 1434 | if ( (i)%7 == daysToShow-1 ) { |
1421 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1435 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1422 | x -= w ;y += h/2; | 1436 | x -= w ;y += h/2; |
1423 | } else { | 1437 | } else { |
1424 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1438 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1425 | y -= h/2; | 1439 | y -= h/2; |
1426 | } | 1440 | } |
1427 | } else | 1441 | } else |
1428 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1442 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1429 | 1443 | ||
1430 | } | 1444 | } |
1431 | else | 1445 | else |
1432 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1446 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1433 | x += w; | 1447 | x += w; |
1434 | if ( x + w/2 > wid ) { | 1448 | if ( x + w/2 > wid ) { |
1435 | x = 0; | 1449 | x = 0; |
1436 | y += h; | 1450 | y += h; |
1437 | } | 1451 | } |
1438 | } | 1452 | } |
1439 | y= dayLabelHei; | 1453 | y= dayLabelHei; |
1440 | h = cellHei ; | 1454 | h = cellHei ; |
1441 | for ( i = 0; i < 6; i++) { | 1455 | for ( i = 0; i < 6; i++) { |
1442 | if ( i == (6-rowModulo)) | 1456 | if ( i == (6-rowModulo)) |
1443 | ++h; | 1457 | ++h; |
1444 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1458 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1445 | y += h; | 1459 | y += h; |
1446 | } | 1460 | } |
1447 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1461 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1448 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1462 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1449 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1463 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1450 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1464 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1451 | updateDayLabels(); | 1465 | updateDayLabels(); |
1452 | bool forceUpdate = !updatePossible; | 1466 | bool forceUpdate = !updatePossible; |
1453 | updatePossible = true; | 1467 | updatePossible = true; |
1454 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1468 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1455 | if ( forceUpdate ) | 1469 | if ( forceUpdate ) |
1456 | updateView(); | 1470 | updateView(); |
1457 | } | 1471 | } |
1458 | 1472 | ||
1459 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1473 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1460 | { | 1474 | { |
1461 | mContextMenu->showIncidencePopup(incidence); | 1475 | mContextMenu->showIncidencePopup(incidence); |
1462 | /* | 1476 | /* |
1463 | if( incidence && incidence->type() == "Event" ) { | 1477 | if( incidence && incidence->type() == "Event" ) { |
1464 | Event *event = static_cast<Event *>(incidence); | 1478 | Event *event = static_cast<Event *>(incidence); |
1465 | mContextMenu->showEventPopup(event); | 1479 | mContextMenu->showEventPopup(event); |
1466 | } else { | 1480 | } else { |
1467 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1481 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1468 | } | 1482 | } |
1469 | */ | 1483 | */ |
1470 | } | 1484 | } |
1471 | MonthViewCell * KOMonthView::selectedCell( ) | 1485 | MonthViewCell * KOMonthView::selectedCell( ) |
1472 | { | 1486 | { |
1473 | return mSelectedCell; | 1487 | return mSelectedCell; |
1474 | } | 1488 | } |
1475 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1489 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1476 | { | 1490 | { |
1477 | // qDebug("KOMonthView::setSelectedCell "); | 1491 | // qDebug("KOMonthView::setSelectedCell "); |
1478 | if ( mSelectedCell && mSelectedCell != cell ) { | 1492 | if ( mSelectedCell && mSelectedCell != cell ) { |
1479 | MonthViewCell * mvc = mSelectedCell; | 1493 | MonthViewCell * mvc = mSelectedCell; |
1480 | mSelectedCell = cell; | 1494 | mSelectedCell = cell; |
1481 | mvc->deselect(); | 1495 | mvc->deselect(); |
1482 | } else | 1496 | } else |
1483 | mSelectedCell = cell; | 1497 | mSelectedCell = cell; |
1484 | // if ( mSelectedCell ) | 1498 | // if ( mSelectedCell ) |
1485 | // mSelectedCell->select(); | 1499 | // mSelectedCell->select(); |
1486 | if ( !mSelectedCell ) | 1500 | if ( !mSelectedCell ) |
1487 | emit incidenceSelected( 0 ); | 1501 | emit incidenceSelected( 0 ); |
1488 | else | 1502 | else |
1489 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1503 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1490 | } | 1504 | } |
1491 | 1505 | ||
1492 | void KOMonthView::processSelectionChange() | 1506 | void KOMonthView::processSelectionChange() |
1493 | { | 1507 | { |
1494 | QPtrList<Incidence> incidences = selectedIncidences(); | 1508 | QPtrList<Incidence> incidences = selectedIncidences(); |
1495 | if (incidences.count() > 0) { | 1509 | if (incidences.count() > 0) { |
1496 | emit incidenceSelected( incidences.first() ); | 1510 | emit incidenceSelected( incidences.first() ); |
1497 | } else { | 1511 | } else { |
1498 | emit incidenceSelected( 0 ); | 1512 | emit incidenceSelected( 0 ); |
1499 | } | 1513 | } |
1500 | } | 1514 | } |
1501 | 1515 | ||
1502 | void KOMonthView::clearSelection() | 1516 | void KOMonthView::clearSelection() |
1503 | { | 1517 | { |
1504 | if ( mSelectedCell ) { | 1518 | if ( mSelectedCell ) { |
1505 | mSelectedCell->deselect(); | 1519 | mSelectedCell->deselect(); |
1506 | mSelectedCell = 0; | 1520 | mSelectedCell = 0; |
1507 | } | 1521 | } |
1508 | } | 1522 | } |
1509 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1523 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1510 | { | 1524 | { |
1511 | //qDebug("KOMonthView::keyPressEvent "); | 1525 | //qDebug("KOMonthView::keyPressEvent "); |
1512 | switch(e->key()) { | 1526 | switch(e->key()) { |
1513 | case Key_Up: | 1527 | case Key_Up: |
1514 | { | 1528 | { |
1515 | emit prevMonth(); | 1529 | emit prevMonth(); |
1516 | mCells[0]->setFocus(); | 1530 | mCells[0]->setFocus(); |
1517 | } | 1531 | } |
1518 | e->accept(); | 1532 | e->accept(); |
1519 | break; | 1533 | break; |
1520 | case Key_Down: | 1534 | case Key_Down: |
1521 | { | 1535 | { |
1522 | emit nextMonth(); | 1536 | emit nextMonth(); |
1523 | mCells[0]->setFocus(); | 1537 | mCells[0]->setFocus(); |
1524 | 1538 | ||
1525 | } | 1539 | } |
1526 | e->accept(); | 1540 | e->accept(); |
1527 | break; | 1541 | break; |
1528 | default: | 1542 | default: |
1529 | e->ignore(); | 1543 | e->ignore(); |
1530 | break; | 1544 | break; |
1531 | } | 1545 | } |
1532 | } | 1546 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index b89b2bc..700f098 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,293 +1,293 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
34 | 34 | ||
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
37 | 37 | ||
38 | #include "koeventview.h" | 38 | #include "koeventview.h" |
39 | 39 | ||
40 | #ifdef DESKTOP_VERSION | 40 | #ifdef DESKTOP_VERSION |
41 | class QToolTipGroup; | 41 | class QToolTipGroup; |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | class KNOWhatsThis; | 44 | class KNOWhatsThis; |
45 | class KOWeekButton : public QPushButton | 45 | class KOWeekButton : public QPushButton |
46 | { | 46 | { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | public: | 48 | public: |
49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
50 | QPushButton( parent, name) | 50 | QPushButton( parent, name) |
51 | { | 51 | { |
52 | connect( this, SIGNAL( clicked() ), | 52 | connect( this, SIGNAL( clicked() ), |
53 | SLOT( bottonClicked() )); | 53 | SLOT( bottonClicked() )); |
54 | mNumber = -1; | 54 | mNumber = -1; |
55 | } | 55 | } |
56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
57 | signals: | 57 | signals: |
58 | void selectWeekNum ( int ); | 58 | void selectWeekNum ( int ); |
59 | private: | 59 | private: |
60 | int mNumber; | 60 | int mNumber; |
61 | private slots : | 61 | private slots : |
62 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 62 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
63 | }; | 63 | }; |
64 | 64 | ||
65 | class KNoScrollListBox: public QListBox | 65 | class KNoScrollListBox: public QListBox |
66 | { | 66 | { |
67 | Q_OBJECT | 67 | Q_OBJECT |
68 | public: | 68 | public: |
69 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 69 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
70 | ~KNoScrollListBox(); | 70 | ~KNoScrollListBox(); |
71 | QString getWhatsThisText(QPoint p) ; | 71 | QString getWhatsThisText(QPoint p) ; |
72 | 72 | ||
73 | signals: | 73 | signals: |
74 | void shiftDown(); | 74 | void shiftDown(); |
75 | void shiftUp(); | 75 | void shiftUp(); |
76 | void rightClick(); | 76 | void rightClick(); |
77 | 77 | ||
78 | protected slots: | 78 | protected slots: |
79 | void keyPressEvent(QKeyEvent *); | 79 | void keyPressEvent(QKeyEvent *); |
80 | void keyReleaseEvent(QKeyEvent *); | 80 | void keyReleaseEvent(QKeyEvent *); |
81 | void mousePressEvent(QMouseEvent *); | 81 | void mousePressEvent(QMouseEvent *); |
82 | 82 | ||
83 | private: | 83 | private: |
84 | KNOWhatsThis * mWT; | 84 | KNOWhatsThis * mWT; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | 87 | ||
88 | class MonthViewItem: public QListBoxItem | 88 | class MonthViewItem: public QListBoxItem |
89 | { | 89 | { |
90 | public: | 90 | public: |
91 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 91 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
92 | 92 | ||
93 | void setRecur(bool on) { mRecur = on; } | 93 | void setRecur(bool on) { mRecur = on; } |
94 | void setAlarm(bool on) { mAlarm = on; } | 94 | void setAlarm(bool on) { mAlarm = on; } |
95 | void setReply(bool on) { mReply = on; } | 95 | void setReply(bool on) { mReply = on; } |
96 | void setMoreInfo(bool on) { mInfo = on; } | 96 | void setMoreInfo(bool on) { mInfo = on; } |
97 | 97 | ||
98 | 98 | ||
99 | void setPalette(const QPalette &p) { mPalette = p; } | 99 | void setPalette(const QPalette &p) { mPalette = p; } |
100 | QPalette palette() const { return mPalette; } | 100 | QPalette palette() const { return mPalette; } |
101 | 101 | ||
102 | Incidence *incidence() const { return mIncidence; } | 102 | Incidence *incidence() const { return mIncidence; } |
103 | QDate incidenceDate() { return mDate; } | 103 | QDate incidenceDate() { return mDate; } |
104 | 104 | ||
105 | protected: | 105 | protected: |
106 | virtual void paint(QPainter *); | 106 | virtual void paint(QPainter *); |
107 | virtual int height(const QListBox *) const; | 107 | virtual int height(const QListBox *) const; |
108 | virtual int width(const QListBox *) const; | 108 | virtual int width(const QListBox *) const; |
109 | 109 | ||
110 | private: | 110 | private: |
111 | bool mRecur; | 111 | bool mRecur; |
112 | bool mAlarm; | 112 | bool mAlarm; |
113 | bool mReply; | 113 | bool mReply; |
114 | bool mInfo; | 114 | bool mInfo; |
115 | 115 | ||
116 | QPalette mPalette; | 116 | QPalette mPalette; |
117 | QDate mDate; | 117 | QDate mDate; |
118 | 118 | ||
119 | Incidence *mIncidence; | 119 | Incidence *mIncidence; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | 122 | ||
123 | class KOMonthView; | 123 | class KOMonthView; |
124 | 124 | ||
125 | class MonthViewCell : public QWidget | 125 | class MonthViewCell : public QWidget |
126 | { | 126 | { |
127 | Q_OBJECT | 127 | Q_OBJECT |
128 | public: | 128 | public: |
129 | MonthViewCell(KOMonthView *,QWidget* ); | 129 | MonthViewCell(KOMonthView *,QWidget* ); |
130 | 130 | ||
131 | void setDate( const QDate & ); | 131 | void setDate( const QDate & ); |
132 | QDate date() const; | 132 | QDate date() const; |
133 | 133 | ||
134 | void setPrimary( bool ); | 134 | void setPrimary( bool ); |
135 | bool isPrimary() const; | 135 | bool isPrimary() const; |
136 | 136 | ||
137 | void setHoliday( bool ); | 137 | void setHoliday( bool ); |
138 | void setHoliday( const QString & ); | 138 | void setHoliday( const QString & ); |
139 | 139 | ||
140 | void updateCell(); | 140 | void updateCell(); |
141 | void startUpdateCell(); | 141 | void startUpdateCell(); |
142 | void finishUpdateCell(); | 142 | void finishUpdateCell(); |
143 | void insertEvent(Event *); | 143 | void insertEvent(Event *); |
144 | void insertTodo(Todo *); | 144 | void insertTodo(Todo *); |
145 | 145 | ||
146 | void updateConfig(); | 146 | void updateConfig( bool bigFont = false ); |
147 | 147 | ||
148 | void enableScrollBars( bool ); | 148 | void enableScrollBars( bool ); |
149 | 149 | ||
150 | Incidence *selectedIncidence(); | 150 | Incidence *selectedIncidence(); |
151 | QDate selectedIncidenceDate(); | 151 | QDate selectedIncidenceDate(); |
152 | 152 | ||
153 | void deselect(); | 153 | void deselect(); |
154 | void select(); | 154 | void select(); |
155 | void clear(); | 155 | void clear(); |
156 | 156 | ||
157 | #ifdef DESKTOP_VERSION | 157 | #ifdef DESKTOP_VERSION |
158 | static QToolTipGroup *toolTipGroup(); | 158 | static QToolTipGroup *toolTipGroup(); |
159 | #endif | 159 | #endif |
160 | signals: | 160 | signals: |
161 | void defaultAction( Incidence * ); | 161 | void defaultAction( Incidence * ); |
162 | void newEventSignal( QDateTime ); | 162 | void newEventSignal( QDateTime ); |
163 | void showDaySignal( QDate ); | 163 | void showDaySignal( QDate ); |
164 | 164 | ||
165 | protected: | 165 | protected: |
166 | QString mToolTip; | 166 | QString mToolTip; |
167 | void resizeEvent( QResizeEvent * ); | 167 | void resizeEvent( QResizeEvent * ); |
168 | 168 | ||
169 | protected slots: | 169 | protected slots: |
170 | void defaultAction( QListBoxItem * ); | 170 | void defaultAction( QListBoxItem * ); |
171 | void contextMenu( QListBoxItem * ); | 171 | void contextMenu( QListBoxItem * ); |
172 | void selection( QListBoxItem * ); | 172 | void selection( QListBoxItem * ); |
173 | void cellClicked( QListBoxItem * ); | 173 | void cellClicked( QListBoxItem * ); |
174 | void newEvent(); | 174 | void newEvent(); |
175 | void showDay(); | 175 | void showDay(); |
176 | 176 | ||
177 | private: | 177 | private: |
178 | KOMonthView *mMonthView; | 178 | KOMonthView *mMonthView; |
179 | 179 | ||
180 | QDate mDate; | 180 | QDate mDate; |
181 | bool mPrimary; | 181 | bool mPrimary; |
182 | bool mHoliday; | 182 | bool mHoliday; |
183 | QString mHolidayString; | 183 | QString mHolidayString; |
184 | 184 | ||
185 | //QLabel *mLabel; | 185 | //QLabel *mLabel; |
186 | QPushButton *mLabel; | 186 | QPushButton *mLabel; |
187 | QListBox *mItemList; | 187 | QListBox *mItemList; |
188 | #ifdef DESKTOP_VERSION | 188 | #ifdef DESKTOP_VERSION |
189 | static QToolTipGroup *mToolTipGroup; | 189 | static QToolTipGroup *mToolTipGroup; |
190 | #endif | 190 | #endif |
191 | QSize mLabelSize; | 191 | QSize mLabelSize; |
192 | QSize mLabelBigSize; | 192 | QSize mLabelBigSize; |
193 | QPalette mHolidayPalette; | 193 | QPalette mHolidayPalette; |
194 | QPalette mStandardPalette; | 194 | QPalette mStandardPalette; |
195 | QPalette mPrimaryPalette; | 195 | QPalette mPrimaryPalette; |
196 | QPalette mNonPrimaryPalette; | 196 | QPalette mNonPrimaryPalette; |
197 | void setMyPalette(); | 197 | void setMyPalette(); |
198 | QPalette getPalette (); | 198 | QPalette getPalette (); |
199 | void keyPressEvent ( QKeyEvent * ) ; | 199 | void keyPressEvent ( QKeyEvent * ) ; |
200 | 200 | ||
201 | }; | 201 | }; |
202 | 202 | ||
203 | 203 | ||
204 | class KOMonthView: public KOEventView | 204 | class KOMonthView: public KOEventView |
205 | { | 205 | { |
206 | Q_OBJECT | 206 | Q_OBJECT |
207 | public: | 207 | public: |
208 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 208 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
209 | ~KOMonthView(); | 209 | ~KOMonthView(); |
210 | 210 | ||
211 | /** Returns maximum number of days supported by the komonthview */ | 211 | /** Returns maximum number of days supported by the komonthview */ |
212 | virtual int maxDatesHint(); | 212 | virtual int maxDatesHint(); |
213 | 213 | ||
214 | /** Returns number of currently shown dates. */ | 214 | /** Returns number of currently shown dates. */ |
215 | virtual int currentDateCount(); | 215 | virtual int currentDateCount(); |
216 | 216 | ||
217 | /** returns the currently selected events */ | 217 | /** returns the currently selected events */ |
218 | virtual QPtrList<Incidence> selectedIncidences(); | 218 | virtual QPtrList<Incidence> selectedIncidences(); |
219 | 219 | ||
220 | /** returns dates of the currently selected events */ | 220 | /** returns dates of the currently selected events */ |
221 | virtual DateList selectedDates(); | 221 | virtual DateList selectedDates(); |
222 | 222 | ||
223 | virtual void printPreview(CalPrinter *calPrinter, | 223 | virtual void printPreview(CalPrinter *calPrinter, |
224 | const QDate &, const QDate &); | 224 | const QDate &, const QDate &); |
225 | bool isMonthView() { return true; } | 225 | bool isMonthView() { return true; } |
226 | bool isUpdatePossible() { return updatePossible; } | 226 | bool isUpdatePossible() { return updatePossible; } |
227 | 227 | ||
228 | MonthViewCell * selectedCell(); | 228 | MonthViewCell * selectedCell(); |
229 | public slots: | 229 | public slots: |
230 | virtual void updateView(); | 230 | virtual void updateView(); |
231 | virtual void updateConfig(); | 231 | virtual void updateConfig(); |
232 | virtual void showDates(const QDate &start, const QDate &end); | 232 | virtual void showDates(const QDate &start, const QDate &end); |
233 | virtual void showEvents(QPtrList<Event> eventList); | 233 | virtual void showEvents(QPtrList<Event> eventList); |
234 | 234 | ||
235 | void changeEventDisplay(Event *, int); | 235 | void changeEventDisplay(Event *, int); |
236 | 236 | ||
237 | void clearSelection(); | 237 | void clearSelection(); |
238 | 238 | ||
239 | void showContextMenu( Incidence * ); | 239 | void showContextMenu( Incidence * ); |
240 | 240 | ||
241 | void setSelectedCell( MonthViewCell * ); | 241 | void setSelectedCell( MonthViewCell * ); |
242 | 242 | ||
243 | protected slots: | 243 | protected slots: |
244 | void selectDateWeekNum ( int ); | 244 | void selectDateWeekNum ( int ); |
245 | void selectInternalWeekNum ( int ); | 245 | void selectInternalWeekNum ( int ); |
246 | void switchView(); | 246 | void switchView(); |
247 | void processSelectionChange(); | 247 | void processSelectionChange(); |
248 | signals: | 248 | signals: |
249 | void nextMonth(); | 249 | void nextMonth(); |
250 | void prevMonth(); | 250 | void prevMonth(); |
251 | void showNavigator( bool ); | 251 | void showNavigator( bool ); |
252 | void selectWeekNum ( int ); | 252 | void selectWeekNum ( int ); |
253 | void showDaySignal( QDate ); | 253 | void showDaySignal( QDate ); |
254 | protected: | 254 | protected: |
255 | void resizeEvent(QResizeEvent *); | 255 | void resizeEvent(QResizeEvent *); |
256 | void viewChanged(); | 256 | void viewChanged(); |
257 | void updateDayLabels(); | 257 | void updateDayLabels(); |
258 | 258 | ||
259 | private: | 259 | private: |
260 | bool clPending; | 260 | bool clPending; |
261 | QWidgetStack * mWidStack; | 261 | QWidgetStack * mWidStack; |
262 | QWidget* mMonthView; | 262 | QWidget* mMonthView; |
263 | QWidget* mWeekView; | 263 | QWidget* mWeekView; |
264 | bool mShowWeekView; | 264 | bool mShowWeekView; |
265 | bool updatePossible; | 265 | bool updatePossible; |
266 | int mDaysPerWeek; | 266 | int mDaysPerWeek; |
267 | int mNumWeeks; | 267 | int mNumWeeks; |
268 | int mNumCells; | 268 | int mNumCells; |
269 | bool mWeekStartsMonday; | 269 | bool mWeekStartsMonday; |
270 | bool mShowSatSunComp; | 270 | bool mShowSatSunComp; |
271 | void computeLayout(); | 271 | void computeLayout(); |
272 | void computeLayoutWeek(); | 272 | void computeLayoutWeek(); |
273 | 273 | ||
274 | QPtrVector<MonthViewCell> mCells; | 274 | QPtrVector<MonthViewCell> mCells; |
275 | QPtrVector<QLabel> mDayLabels; | 275 | QPtrVector<QLabel> mDayLabels; |
276 | QPtrVector<KOWeekButton> mWeekLabels; | 276 | QPtrVector<KOWeekButton> mWeekLabels; |
277 | QPtrVector<MonthViewCell> mCellsW; | 277 | QPtrVector<MonthViewCell> mCellsW; |
278 | QPtrVector<QLabel> mDayLabelsW; | 278 | QPtrVector<QLabel> mDayLabelsW; |
279 | QPtrVector<KOWeekButton> mWeekLabelsW; | 279 | QPtrVector<KOWeekButton> mWeekLabelsW; |
280 | 280 | ||
281 | bool mShortDayLabels; | 281 | bool mShortDayLabels; |
282 | int mWidthLongDayLabel; | 282 | int mWidthLongDayLabel; |
283 | 283 | ||
284 | QDate mStartDate; | 284 | QDate mStartDate; |
285 | 285 | ||
286 | MonthViewCell *mSelectedCell; | 286 | MonthViewCell *mSelectedCell; |
287 | 287 | ||
288 | KOEventPopupMenu *mContextMenu; | 288 | KOEventPopupMenu *mContextMenu; |
289 | void keyPressEvent ( QKeyEvent * ) ; | 289 | void keyPressEvent ( QKeyEvent * ) ; |
290 | 290 | ||
291 | }; | 291 | }; |
292 | 292 | ||
293 | #endif | 293 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 2fb7c36..ea5aaa1 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,477 +1,478 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
48 | 48 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
51 | 51 | ||
52 | KOPrefs::KOPrefs() : | 52 | KOPrefs::KOPrefs() : |
53 | KPimPrefs("korganizerrc") | 53 | KPimPrefs("korganizerrc") |
54 | { | 54 | { |
55 | mCategoryColors.setAutoDelete(true); | 55 | mCategoryColors.setAutoDelete(true); |
56 | fillMailDefaults(); | 56 | fillMailDefaults(); |
57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
58 | QColor defaultHolidayColor = QColor(255,0,0); | 58 | QColor defaultHolidayColor = QColor(255,0,0); |
59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
63 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 63 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
64 | 64 | ||
65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | 65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); |
66 | mDefaultViewFont = QFont("helvetica",10); | 66 | mDefaultViewFont = QFont("helvetica",10); |
67 | mDefaultMonthViewFont = QFont("helvetica",8); | 67 | mDefaultMonthViewFont = QFont("helvetica",8); |
68 | mMarcusBainsFont= QFont("helvetica",10); | 68 | mMarcusBainsFont= QFont("helvetica",10); |
69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
70 | mEditBoxFont = QFont("helvetica",12); | 70 | mEditBoxFont = QFont("helvetica",12); |
71 | mJornalViewFont = QFont("helvetica",12); | 71 | mJornalViewFont = QFont("helvetica",12); |
72 | 72 | ||
73 | KPrefs::setCurrentGroup("General"); | 73 | KPrefs::setCurrentGroup("General"); |
74 | 74 | ||
75 | 75 | ||
76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
77 | 77 | ||
78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
81 | addItemBool("ShowIconList",&mShowIconList,true); | 81 | addItemBool("ShowIconList",&mShowIconList,true); |
82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
88 | addItemBool("ShowIconBack",&mShowIconBack,true); | 88 | addItemBool("ShowIconBack",&mShowIconBack,true); |
89 | addItemBool("ShowIconToday",&mShowIconToday,true); | 89 | addItemBool("ShowIconToday",&mShowIconToday,true); |
90 | addItemBool("ShowIconForward",&mShowIconForward,true); | 90 | addItemBool("ShowIconForward",&mShowIconForward,true); |
91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
94 | addItemBool("ShowIconNext",&mShowIconNext,true); | 94 | addItemBool("ShowIconNext",&mShowIconNext,true); |
95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
98 | 98 | ||
99 | addItemBool("AskForQuit",&mAskForQuit,false); | 99 | addItemBool("AskForQuit",&mAskForQuit,false); |
100 | 100 | ||
101 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
103 | #else | 103 | #else |
104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
105 | #endif | 105 | #endif |
106 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 106 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
107 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 107 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
111 | 111 | ||
112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 113 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 114 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 115 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
116 | addItemInt("AllDay Size",&mAllDaySize,28); | 116 | addItemInt("AllDay Size",&mAllDaySize,28); |
117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 117 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 118 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
119 | 119 | ||
120 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 120 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
121 | addItemStringList("EventSummary User",&mEventSummaryUser); | 121 | addItemStringList("EventSummary User",&mEventSummaryUser); |
122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 122 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
123 | 123 | ||
124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 124 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
125 | addItemBool("Enable Project View",&mEnableProjectView,false); | 125 | addItemBool("Enable Project View",&mEnableProjectView,false); |
126 | addItemBool("Auto Save",&mAutoSave,false); | 126 | addItemBool("Auto Save",&mAutoSave,false); |
127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 127 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
128 | addItemBool("Confirm Deletes",&mConfirm,true); | 128 | addItemBool("Confirm Deletes",&mConfirm,true); |
129 | addItemString("Archive File",&mArchiveFile); | 129 | addItemString("Archive File",&mArchiveFile); |
130 | addItemString("Html Export File",&mHtmlExportFile, | 130 | addItemString("Html Export File",&mHtmlExportFile, |
131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 131 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
132 | addItemBool("Html With Save",&mHtmlWithSave,false); | 132 | addItemBool("Html With Save",&mHtmlWithSave,false); |
133 | 133 | ||
134 | KPrefs::setCurrentGroup("Personal Settings"); | 134 | KPrefs::setCurrentGroup("Personal Settings"); |
135 | 135 | ||
136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 136 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 137 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
138 | addItemBool("Bcc",&mBcc,false); | 138 | addItemBool("Bcc",&mBcc,false); |
139 | 139 | ||
140 | KPrefs::setCurrentGroup("Time & Date"); | 140 | KPrefs::setCurrentGroup("Time & Date"); |
141 | 141 | ||
142 | 142 | ||
143 | addItemInt("Default Start Time",&mStartTime,10); | 143 | addItemInt("Default Start Time",&mStartTime,10); |
144 | addItemInt("Default Duration",&mDefaultDuration,2); | 144 | addItemInt("Default Duration",&mDefaultDuration,2); |
145 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 145 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
146 | KPrefs::setCurrentGroup("AlarmSettings"); | 146 | KPrefs::setCurrentGroup("AlarmSettings"); |
147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 147 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 148 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 149 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 150 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
151 | 151 | ||
152 | 152 | ||
153 | KPrefs::setCurrentGroup("Calendar"); | 153 | KPrefs::setCurrentGroup("Calendar"); |
154 | 154 | ||
155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 155 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
156 | 156 | ||
157 | KPrefs::setCurrentGroup("Fonts"); | 157 | KPrefs::setCurrentGroup("Fonts"); |
158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 158 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
159 | addItemFont("TimeBar Font",&mTimeBarFont); | 159 | addItemFont("TimeBar Font",&mTimeBarFont); |
160 | addItemFont("MonthView Font",&mMonthViewFont); | 160 | addItemFont("MonthView Font",&mMonthViewFont); |
161 | addItemFont("AgendaView Font",&mAgendaViewFont); | 161 | addItemFont("AgendaView Font",&mAgendaViewFont); |
162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 162 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 163 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
164 | addItemFont("TodoView Font",&mTodoViewFont); | 164 | addItemFont("TodoView Font",&mTodoViewFont); |
165 | addItemFont("ListView Font",&mListViewFont); | 165 | addItemFont("ListView Font",&mListViewFont); |
166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 166 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
167 | addItemFont("EditBox Font",&mEditBoxFont); | 167 | addItemFont("EditBox Font",&mEditBoxFont); |
168 | addItemFont("JournalView Font",&mJornalViewFont); | 168 | addItemFont("JournalView Font",&mJornalViewFont); |
169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 169 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
170 | addItemFont("EventView Font",&mEventViewFont); | 170 | addItemFont("EventView Font",&mEventViewFont); |
171 | 171 | ||
172 | KPrefs::setCurrentGroup("RemoteSyncing"); | 172 | KPrefs::setCurrentGroup("RemoteSyncing"); |
173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 173 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 174 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 175 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
176 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 176 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
177 | 177 | ||
178 | #ifdef _WIN32_ | 178 | #ifdef _WIN32_ |
179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 179 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
180 | #else | 180 | #else |
181 | QString hdp= locateLocal("data","korganizer")+"/"; | 181 | QString hdp= locateLocal("data","korganizer")+"/"; |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 184 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
185 | 185 | ||
186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 186 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 187 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 188 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 189 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
190 | 190 | ||
191 | 191 | ||
192 | KPrefs::setCurrentGroup("Locale"); | 192 | KPrefs::setCurrentGroup("Locale"); |
193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 193 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
194 | 194 | ||
195 | 195 | ||
196 | KPrefs::setCurrentGroup("Colors"); | 196 | KPrefs::setCurrentGroup("Colors"); |
197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 197 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 198 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 199 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 200 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 201 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 202 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 203 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 204 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 205 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 206 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 207 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 208 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 209 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
210 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 210 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
211 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 211 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
212 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 212 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
213 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 213 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
214 | addItemBool("UseAppColors",&mUseAppColors,false); | 214 | addItemBool("UseAppColors",&mUseAppColors,false); |
215 | 215 | ||
216 | 216 | ||
217 | 217 | ||
218 | KPrefs::setCurrentGroup("Views"); | 218 | KPrefs::setCurrentGroup("Views"); |
219 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 219 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
220 | addItemInt("Hour Size",&mHourSize,8); | 220 | addItemInt("Hour Size",&mHourSize,8); |
221 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 221 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
222 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 222 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
223 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 223 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
224 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 224 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
225 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 225 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
226 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 226 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
227 | #ifdef DESKTOP_VERION | 227 | #ifdef DESKTOP_VERION |
228 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 228 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
229 | #else | 229 | #else |
230 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 230 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
231 | #endif | 231 | #endif |
232 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 232 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
233 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 233 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
234 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 234 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
235 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 235 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
236 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 236 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
237 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 237 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
238 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 238 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
239 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 239 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
240 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 240 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
241 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 241 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
242 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 242 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | 248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
249 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | ||
249 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 250 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
250 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 251 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
251 | #ifdef DESKTOP_VERSION | 252 | #ifdef DESKTOP_VERSION |
252 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 253 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
253 | #else | 254 | #else |
254 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 255 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
255 | #endif | 256 | #endif |
256 | addItemInt("Day Begins",&mDayBegins,7); | 257 | addItemInt("Day Begins",&mDayBegins,7); |
257 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 258 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
258 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 259 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
259 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 260 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
260 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 261 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
261 | 262 | ||
262 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 263 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
263 | addItemBool("Full View Month",&mFullViewMonth,true); | 264 | addItemBool("Full View Month",&mFullViewMonth,true); |
264 | addItemBool("Full View Todo",&mFullViewTodo,true); | 265 | addItemBool("Full View Todo",&mFullViewTodo,true); |
265 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 266 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
266 | 267 | ||
267 | addItemInt("Next X Days",&mNextXDays,3); | 268 | addItemInt("Next X Days",&mNextXDays,3); |
268 | 269 | ||
269 | KPrefs::setCurrentGroup("Printer"); | 270 | KPrefs::setCurrentGroup("Printer"); |
270 | 271 | ||
271 | KPrefs::setCurrentGroup("Layout"); | 272 | KPrefs::setCurrentGroup("Layout"); |
272 | 273 | ||
273 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 274 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
274 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 275 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
275 | 276 | ||
276 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 277 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
277 | 278 | ||
278 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 279 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
279 | 280 | ||
280 | KPrefs::setCurrentGroup("Group Scheduling"); | 281 | KPrefs::setCurrentGroup("Group Scheduling"); |
281 | 282 | ||
282 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 283 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
283 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 284 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
284 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 285 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
285 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 286 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
286 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 287 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
287 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 288 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
288 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 289 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
289 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 290 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
290 | 291 | ||
291 | KPrefs::setCurrentGroup( "Editors" ); | 292 | KPrefs::setCurrentGroup( "Editors" ); |
292 | 293 | ||
293 | addItemStringList( "EventTemplates", &mEventTemplates ); | 294 | addItemStringList( "EventTemplates", &mEventTemplates ); |
294 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 295 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
295 | 296 | ||
296 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 297 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
297 | 298 | ||
298 | 299 | ||
299 | 300 | ||
300 | } | 301 | } |
301 | 302 | ||
302 | 303 | ||
303 | KOPrefs::~KOPrefs() | 304 | KOPrefs::~KOPrefs() |
304 | { | 305 | { |
305 | if (mInstance == this) | 306 | if (mInstance == this) |
306 | mInstance = insd.setObject(0); | 307 | mInstance = insd.setObject(0); |
307 | 308 | ||
308 | //qDebug("KOPrefs::~KOPrefs() "); | 309 | //qDebug("KOPrefs::~KOPrefs() "); |
309 | } | 310 | } |
310 | 311 | ||
311 | 312 | ||
312 | KOPrefs *KOPrefs::instance() | 313 | KOPrefs *KOPrefs::instance() |
313 | { | 314 | { |
314 | if (!mInstance) { | 315 | if (!mInstance) { |
315 | mInstance = insd.setObject(new KOPrefs()); | 316 | mInstance = insd.setObject(new KOPrefs()); |
316 | mInstance->readConfig(); | 317 | mInstance->readConfig(); |
317 | } | 318 | } |
318 | 319 | ||
319 | return mInstance; | 320 | return mInstance; |
320 | } | 321 | } |
321 | 322 | ||
322 | void KOPrefs::usrSetDefaults() | 323 | void KOPrefs::usrSetDefaults() |
323 | { | 324 | { |
324 | 325 | ||
325 | } | 326 | } |
326 | 327 | ||
327 | void KOPrefs::fillMailDefaults() | 328 | void KOPrefs::fillMailDefaults() |
328 | { | 329 | { |
329 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 330 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
330 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 331 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
331 | } | 332 | } |
332 | 333 | ||
333 | void KOPrefs::setTimeZoneIdDefault() | 334 | void KOPrefs::setTimeZoneIdDefault() |
334 | { | 335 | { |
335 | ; | 336 | ; |
336 | } | 337 | } |
337 | 338 | ||
338 | void KOPrefs::setCategoryDefaults() | 339 | void KOPrefs::setCategoryDefaults() |
339 | { | 340 | { |
340 | mCustomCategories.clear(); | 341 | mCustomCategories.clear(); |
341 | mCustomCategories = getDefaultList(); | 342 | mCustomCategories = getDefaultList(); |
342 | 343 | ||
343 | QStringList::Iterator it; | 344 | QStringList::Iterator it; |
344 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 345 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
345 | setCategoryColor(*it,mDefaultCategoryColor); | 346 | setCategoryColor(*it,mDefaultCategoryColor); |
346 | } | 347 | } |
347 | } | 348 | } |
348 | 349 | ||
349 | QStringList KOPrefs::getDefaultList() | 350 | QStringList KOPrefs::getDefaultList() |
350 | { | 351 | { |
351 | QStringList retval ; | 352 | QStringList retval ; |
352 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 353 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
353 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 354 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
354 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 355 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
355 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 356 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
356 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 357 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
357 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 358 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
358 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 359 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
359 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 360 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
360 | retval.sort(); | 361 | retval.sort(); |
361 | return retval; | 362 | return retval; |
362 | } | 363 | } |
363 | 364 | ||
364 | void KOPrefs::usrReadConfig() | 365 | void KOPrefs::usrReadConfig() |
365 | { | 366 | { |
366 | config()->setGroup("General"); | 367 | config()->setGroup("General"); |
367 | 368 | ||
368 | mCustomCategories = config()->readListEntry("Custom Categories"); | 369 | mCustomCategories = config()->readListEntry("Custom Categories"); |
369 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { | 370 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { |
370 | mLocationDefaults.clear(); | 371 | mLocationDefaults.clear(); |
371 | mEventSummaryUser.clear(); | 372 | mEventSummaryUser.clear(); |
372 | mTodoSummaryUser.clear(); | 373 | mTodoSummaryUser.clear(); |
373 | } | 374 | } |
374 | mOldLoadedLanguage = mOldLanguage ; | 375 | mOldLoadedLanguage = mOldLanguage ; |
375 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 376 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
376 | if (mLocationDefaults.isEmpty()) { | 377 | if (mLocationDefaults.isEmpty()) { |
377 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 378 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
378 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 379 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
379 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 380 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
380 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 381 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
381 | mLocationDefaults.sort(); | 382 | mLocationDefaults.sort(); |
382 | } | 383 | } |
383 | 384 | ||
384 | if (mEventSummaryUser.isEmpty()) { | 385 | if (mEventSummaryUser.isEmpty()) { |
385 | mEventSummaryUser = getDefaultList() ; | 386 | mEventSummaryUser = getDefaultList() ; |
386 | } | 387 | } |
387 | if (mTodoSummaryUser.isEmpty()) { | 388 | if (mTodoSummaryUser.isEmpty()) { |
388 | mTodoSummaryUser = getDefaultList() ; | 389 | mTodoSummaryUser = getDefaultList() ; |
389 | } | 390 | } |
390 | 391 | ||
391 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 392 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
392 | 393 | ||
393 | config()->setGroup("Personal Settings"); | 394 | config()->setGroup("Personal Settings"); |
394 | mName = config()->readEntry("user_name",""); | 395 | mName = config()->readEntry("user_name",""); |
395 | mEmail = config()->readEntry("user_email",""); | 396 | mEmail = config()->readEntry("user_email",""); |
396 | fillMailDefaults(); | 397 | fillMailDefaults(); |
397 | 398 | ||
398 | config()->setGroup("Category Colors"); | 399 | config()->setGroup("Category Colors"); |
399 | QStringList::Iterator it; | 400 | QStringList::Iterator it; |
400 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 401 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
401 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 402 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
402 | 403 | ||
403 | } | 404 | } |
404 | 405 | ||
405 | KPimPrefs::usrReadConfig(); | 406 | KPimPrefs::usrReadConfig(); |
406 | } | 407 | } |
407 | 408 | ||
408 | 409 | ||
409 | void KOPrefs::usrWriteConfig() | 410 | void KOPrefs::usrWriteConfig() |
410 | { | 411 | { |
411 | config()->setGroup("General"); | 412 | config()->setGroup("General"); |
412 | config()->writeEntry("Custom Categories",mCustomCategories); | 413 | config()->writeEntry("Custom Categories",mCustomCategories); |
413 | 414 | ||
414 | config()->setGroup("Personal Settings"); | 415 | config()->setGroup("Personal Settings"); |
415 | config()->writeEntry("user_name",mName); | 416 | config()->writeEntry("user_name",mName); |
416 | config()->writeEntry("user_email",mEmail); | 417 | config()->writeEntry("user_email",mEmail); |
417 | 418 | ||
418 | config()->setGroup("Category Colors"); | 419 | config()->setGroup("Category Colors"); |
419 | QDictIterator<QColor> it(mCategoryColors); | 420 | QDictIterator<QColor> it(mCategoryColors); |
420 | while (it.current()) { | 421 | while (it.current()) { |
421 | config()->writeEntry(it.currentKey(),*(it.current())); | 422 | config()->writeEntry(it.currentKey(),*(it.current())); |
422 | ++it; | 423 | ++it; |
423 | } | 424 | } |
424 | 425 | ||
425 | 426 | ||
426 | KPimPrefs::usrWriteConfig(); | 427 | KPimPrefs::usrWriteConfig(); |
427 | } | 428 | } |
428 | 429 | ||
429 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 430 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
430 | { | 431 | { |
431 | mCategoryColors.replace(cat,new QColor(color)); | 432 | mCategoryColors.replace(cat,new QColor(color)); |
432 | } | 433 | } |
433 | 434 | ||
434 | QColor *KOPrefs::categoryColor(QString cat) | 435 | QColor *KOPrefs::categoryColor(QString cat) |
435 | { | 436 | { |
436 | QColor *color = 0; | 437 | QColor *color = 0; |
437 | 438 | ||
438 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 439 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
439 | 440 | ||
440 | if (color) return color; | 441 | if (color) return color; |
441 | else return &mDefaultCategoryColor; | 442 | else return &mDefaultCategoryColor; |
442 | } | 443 | } |
443 | 444 | ||
444 | void KOPrefs::setFullName(const QString &name) | 445 | void KOPrefs::setFullName(const QString &name) |
445 | { | 446 | { |
446 | mName = name; | 447 | mName = name; |
447 | } | 448 | } |
448 | 449 | ||
449 | void KOPrefs::setEmail(const QString &email) | 450 | void KOPrefs::setEmail(const QString &email) |
450 | { | 451 | { |
451 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 452 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
452 | mEmail = email; | 453 | mEmail = email; |
453 | } | 454 | } |
454 | 455 | ||
455 | QString KOPrefs::fullName() | 456 | QString KOPrefs::fullName() |
456 | { | 457 | { |
457 | if (mEmailControlCenter) { | 458 | if (mEmailControlCenter) { |
458 | KEMailSettings settings; | 459 | KEMailSettings settings; |
459 | return settings.getSetting(KEMailSettings::RealName); | 460 | return settings.getSetting(KEMailSettings::RealName); |
460 | } else { | 461 | } else { |
461 | return mName; | 462 | return mName; |
462 | } | 463 | } |
463 | } | 464 | } |
464 | 465 | ||
465 | QString KOPrefs::email() | 466 | QString KOPrefs::email() |
466 | { | 467 | { |
467 | if (mEmailControlCenter) { | 468 | if (mEmailControlCenter) { |
468 | KEMailSettings settings; | 469 | KEMailSettings settings; |
469 | return settings.getSetting(KEMailSettings::EmailAddress); | 470 | return settings.getSetting(KEMailSettings::EmailAddress); |
470 | } else { | 471 | } else { |
471 | return mEmail; | 472 | return mEmail; |
472 | } | 473 | } |
473 | } | 474 | } |
474 | KConfig* KOPrefs::getConfig() | 475 | KConfig* KOPrefs::getConfig() |
475 | { | 476 | { |
476 | return config(); | 477 | return config(); |
477 | } | 478 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 6541af2..dddcdca 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,280 +1,281 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | 60 | ||
61 | protected: | 61 | protected: |
62 | void setTimeZoneIdDefault(); | 62 | void setTimeZoneIdDefault(); |
63 | 63 | ||
64 | /** Fill empty mail fields with default values. */ | 64 | /** Fill empty mail fields with default values. */ |
65 | void fillMailDefaults(); | 65 | void fillMailDefaults(); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 68 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
69 | object. */ | 69 | object. */ |
70 | KOPrefs(); | 70 | KOPrefs(); |
71 | 71 | ||
72 | static KOPrefs *mInstance; | 72 | static KOPrefs *mInstance; |
73 | QStringList getDefaultList(); | 73 | QStringList getDefaultList(); |
74 | public: | 74 | public: |
75 | // preferences data | 75 | // preferences data |
76 | KConfig* getConfig(); | 76 | KConfig* getConfig(); |
77 | void setFullName(const QString &); | 77 | void setFullName(const QString &); |
78 | QString fullName(); | 78 | QString fullName(); |
79 | void setEmail(const QString &); | 79 | void setEmail(const QString &); |
80 | QString email(); | 80 | QString email(); |
81 | 81 | ||
82 | QString mAdditional; | 82 | QString mAdditional; |
83 | 83 | ||
84 | bool mEmailControlCenter; | 84 | bool mEmailControlCenter; |
85 | 85 | ||
86 | bool mBcc; | 86 | bool mBcc; |
87 | bool mAutoSave; | 87 | bool mAutoSave; |
88 | int mAutoSaveInterval; | 88 | int mAutoSaveInterval; |
89 | bool mConfirm; | 89 | bool mConfirm; |
90 | 90 | ||
91 | bool mEnableGroupScheduling; | 91 | bool mEnableGroupScheduling; |
92 | bool mEnableProjectView; | 92 | bool mEnableProjectView; |
93 | 93 | ||
94 | int mDefaultFormat; | 94 | int mDefaultFormat; |
95 | int mMailClient; | 95 | int mMailClient; |
96 | 96 | ||
97 | int mStartTime; | 97 | int mStartTime; |
98 | int mDefaultDuration; | 98 | int mDefaultDuration; |
99 | int mAlarmTime; | 99 | int mAlarmTime; |
100 | 100 | ||
101 | int mWorkingHoursStart; | 101 | int mWorkingHoursStart; |
102 | int mWorkingHoursEnd; | 102 | int mWorkingHoursEnd; |
103 | bool mExcludeHolidays; | 103 | bool mExcludeHolidays; |
104 | bool mExcludeSaturdays; | 104 | bool mExcludeSaturdays; |
105 | bool mMarcusBainsShowSeconds; | 105 | bool mMarcusBainsShowSeconds; |
106 | 106 | ||
107 | QFont mTimeBarFont; | 107 | QFont mTimeBarFont; |
108 | QFont mMonthViewFont; | 108 | QFont mMonthViewFont; |
109 | QFont mAgendaViewFont; | 109 | QFont mAgendaViewFont; |
110 | QFont mMarcusBainsFont; | 110 | QFont mMarcusBainsFont; |
111 | QFont mTimeLabelsFont; | 111 | QFont mTimeLabelsFont; |
112 | QFont mTodoViewFont; | 112 | QFont mTodoViewFont; |
113 | QFont mListViewFont; | 113 | QFont mListViewFont; |
114 | QFont mDateNavigatorFont; | 114 | QFont mDateNavigatorFont; |
115 | QFont mEditBoxFont; | 115 | QFont mEditBoxFont; |
116 | QFont mJornalViewFont; | 116 | QFont mJornalViewFont; |
117 | QFont mWhatsNextFont; | 117 | QFont mWhatsNextFont; |
118 | QFont mEventViewFont; | 118 | QFont mEventViewFont; |
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | QColor mHolidayColor; | 123 | QColor mHolidayColor; |
124 | QColor mHighlightColor; | 124 | QColor mHighlightColor; |
125 | QColor mEventColor; | 125 | QColor mEventColor; |
126 | QColor mTodoDoneColor; | 126 | QColor mTodoDoneColor; |
127 | QColor mAgendaBgColor; | 127 | QColor mAgendaBgColor; |
128 | QColor mWorkingHoursColor; | 128 | QColor mWorkingHoursColor; |
129 | QColor mTodoDueTodayColor; | 129 | QColor mTodoDueTodayColor; |
130 | QColor mTodoOverdueColor; | 130 | QColor mTodoOverdueColor; |
131 | QColor mMonthViewEvenColor; | 131 | QColor mMonthViewEvenColor; |
132 | QColor mMonthViewOddColor; | 132 | QColor mMonthViewOddColor; |
133 | QColor mMonthViewHolidayColor; | 133 | QColor mMonthViewHolidayColor; |
134 | bool mMonthViewUsesDayColors; | 134 | bool mMonthViewUsesDayColors; |
135 | bool mMonthViewSatSunTog; | 135 | bool mMonthViewSatSunTog; |
136 | bool mMonthViewWeek; | 136 | bool mMonthViewWeek; |
137 | QColor mAppColor1; | 137 | QColor mAppColor1; |
138 | QColor mAppColor2; | 138 | QColor mAppColor2; |
139 | bool mUseAppColors; | 139 | bool mUseAppColors; |
140 | 140 | ||
141 | int mDayBegins; | 141 | int mDayBegins; |
142 | int mHourSize; | 142 | int mHourSize; |
143 | int mAllDaySize; | 143 | int mAllDaySize; |
144 | bool mShowFullMenu; | 144 | bool mShowFullMenu; |
145 | bool mDailyRecur; | 145 | bool mDailyRecur; |
146 | bool mWeeklyRecur; | 146 | bool mWeeklyRecur; |
147 | bool mMonthDailyRecur; | 147 | bool mMonthDailyRecur; |
148 | bool mMonthWeeklyRecur; | 148 | bool mMonthWeeklyRecur; |
149 | bool mMonthShowIcons; | 149 | bool mMonthShowIcons; |
150 | bool mMonthShowShort; | 150 | bool mMonthShowShort; |
151 | bool mEnableToolTips; | 151 | bool mEnableToolTips; |
152 | bool mEnableMonthScroll; | 152 | bool mEnableMonthScroll; |
153 | bool mFullViewMonth; | 153 | bool mFullViewMonth; |
154 | bool mMonthViewUsesCategoryColor; | 154 | bool mMonthViewUsesCategoryColor; |
155 | bool mFullViewTodo; | 155 | bool mFullViewTodo; |
156 | bool mShowCompletedTodo; | 156 | bool mShowCompletedTodo; |
157 | bool mMarcusBainsEnabled; | 157 | bool mMarcusBainsEnabled; |
158 | int mNextXDays; | 158 | int mNextXDays; |
159 | int mWhatsNextDays; | 159 | int mWhatsNextDays; |
160 | int mWhatsNextPrios; | 160 | int mWhatsNextPrios; |
161 | bool mEnableQuickTodo; | 161 | bool mEnableQuickTodo; |
162 | 162 | ||
163 | bool mCompactDialogs; | 163 | bool mCompactDialogs; |
164 | bool mVerticalScreen; | 164 | bool mVerticalScreen; |
165 | 165 | ||
166 | bool mShowIconNewTodo; | 166 | bool mShowIconNewTodo; |
167 | bool mShowIconNewEvent; | 167 | bool mShowIconNewEvent; |
168 | bool mShowIconSearch; | 168 | bool mShowIconSearch; |
169 | bool mShowIconList; | 169 | bool mShowIconList; |
170 | bool mShowIconDay1; | 170 | bool mShowIconDay1; |
171 | bool mShowIconDay5; | 171 | bool mShowIconDay5; |
172 | bool mShowIconDay7; | 172 | bool mShowIconDay7; |
173 | bool mShowIconMonth; | 173 | bool mShowIconMonth; |
174 | bool mShowIconTodoview; | 174 | bool mShowIconTodoview; |
175 | bool mShowIconBackFast; | 175 | bool mShowIconBackFast; |
176 | bool mShowIconBack; | 176 | bool mShowIconBack; |
177 | bool mShowIconToday; | 177 | bool mShowIconToday; |
178 | bool mShowIconForward; | 178 | bool mShowIconForward; |
179 | bool mShowIconForwardFast; | 179 | bool mShowIconForwardFast; |
180 | bool mShowIconWhatsThis; | 180 | bool mShowIconWhatsThis; |
181 | bool mShowIconNextDays; | 181 | bool mShowIconNextDays; |
182 | bool mShowIconNext; | 182 | bool mShowIconNext; |
183 | bool mShowIconJournal; | 183 | bool mShowIconJournal; |
184 | 184 | ||
185 | bool mShowIconStretch; | 185 | bool mShowIconStretch; |
186 | 186 | ||
187 | bool mToolBarHor; | 187 | bool mToolBarHor; |
188 | bool mToolBarUp; | 188 | bool mToolBarUp; |
189 | bool mToolBarMiniIcons; | 189 | bool mToolBarMiniIcons; |
190 | 190 | ||
191 | bool mAskForQuit; | 191 | bool mAskForQuit; |
192 | bool mUsePassWd; | 192 | bool mUsePassWd; |
193 | bool mShowSyncEvents; | 193 | bool mShowSyncEvents; |
194 | bool mShowTodoInAgenda; | 194 | bool mShowTodoInAgenda; |
195 | bool mShowTimeInAgenda; | 195 | bool mShowTimeInAgenda; |
196 | bool mHideNonStartedTodos; | 196 | bool mHideNonStartedTodos; |
197 | 197 | ||
198 | int mLastSyncTime; | 198 | int mLastSyncTime; |
199 | void setCategoryColor(QString cat,const QColor & color); | 199 | void setCategoryColor(QString cat,const QColor & color); |
200 | QColor *categoryColor(QString cat); | 200 | QColor *categoryColor(QString cat); |
201 | 201 | ||
202 | QString mArchiveFile; | 202 | QString mArchiveFile; |
203 | QString mHtmlExportFile; | 203 | QString mHtmlExportFile; |
204 | bool mHtmlWithSave; | 204 | bool mHtmlWithSave; |
205 | 205 | ||
206 | QStringList mSelectedPlugins; | 206 | QStringList mSelectedPlugins; |
207 | 207 | ||
208 | QString mLastImportFile; | 208 | QString mLastImportFile; |
209 | QString mLastVcalFile; | 209 | QString mLastVcalFile; |
210 | QString mLastSaveFile; | 210 | QString mLastSaveFile; |
211 | QString mLastLoadFile; | 211 | QString mLastLoadFile; |
212 | 212 | ||
213 | 213 | ||
214 | QString mDefaultAlarmFile; | 214 | QString mDefaultAlarmFile; |
215 | int mIMIPScheduler; | 215 | int mIMIPScheduler; |
216 | int mIMIPSend; | 216 | int mIMIPSend; |
217 | QStringList mAdditionalMails; | 217 | QStringList mAdditionalMails; |
218 | int mIMIPAutoRefresh; | 218 | int mIMIPAutoRefresh; |
219 | int mIMIPAutoInsertReply; | 219 | int mIMIPAutoInsertReply; |
220 | int mIMIPAutoInsertRequest; | 220 | int mIMIPAutoInsertRequest; |
221 | int mIMIPAutoFreeBusy; | 221 | int mIMIPAutoFreeBusy; |
222 | int mIMIPAutoFreeBusyReply; | 222 | int mIMIPAutoFreeBusyReply; |
223 | 223 | ||
224 | QStringList mTodoTemplates; | 224 | QStringList mTodoTemplates; |
225 | QStringList mEventTemplates; | 225 | QStringList mEventTemplates; |
226 | 226 | ||
227 | int mDestination; | 227 | int mDestination; |
228 | 228 | ||
229 | 229 | ||
230 | bool mEditOnDoubleClick; | 230 | bool mEditOnDoubleClick; |
231 | bool mViewChangeHoldFullscreen; | 231 | bool mViewChangeHoldFullscreen; |
232 | bool mViewChangeHoldNonFullscreen; | 232 | bool mViewChangeHoldNonFullscreen; |
233 | bool mCenterOnCurrentTime; | 233 | bool mCenterOnCurrentTime; |
234 | bool mSetTimeToDayStartAt; | 234 | bool mSetTimeToDayStartAt; |
235 | bool mHighlightCurrentDay; | 235 | bool mHighlightCurrentDay; |
236 | bool mUseHighlightLightColor; | 236 | bool mUseHighlightLightColor; |
237 | bool mListViewMonthTimespan; | 237 | bool mListViewMonthTimespan; |
238 | bool mWNViewShowsParents; | 238 | bool mWNViewShowsParents; |
239 | bool mWNViewShowsPast; | 239 | bool mWNViewShowsPast; |
240 | bool mWNViewShowLocation; | 240 | bool mWNViewShowLocation; |
241 | bool mTodoViewShowsPercentage; | 241 | bool mTodoViewShowsPercentage; |
242 | bool mTodoViewUsesCatColors; | 242 | bool mTodoViewUsesCatColors; |
243 | bool mMonthViewUsesBigFont; | ||
243 | bool mTodoViewUsesSmallFont; | 244 | bool mTodoViewUsesSmallFont; |
244 | bool mTodoViewUsesForegroundColor; | 245 | bool mTodoViewUsesForegroundColor; |
245 | bool mMonthViewUsesForegroundColor; | 246 | bool mMonthViewUsesForegroundColor; |
246 | 247 | ||
247 | bool mHightlightDateTimeEdit; | 248 | bool mHightlightDateTimeEdit; |
248 | bool mShortDateInViewer; | 249 | bool mShortDateInViewer; |
249 | 250 | ||
250 | bool mShowDateNavigator; | 251 | bool mShowDateNavigator; |
251 | 252 | ||
252 | QStringList mLocationDefaults; | 253 | QStringList mLocationDefaults; |
253 | QStringList mEventSummaryUser; | 254 | QStringList mEventSummaryUser; |
254 | QStringList mTodoSummaryUser; | 255 | QStringList mTodoSummaryUser; |
255 | 256 | ||
256 | bool mUseInternalAlarmNotification; | 257 | bool mUseInternalAlarmNotification; |
257 | int mAlarmPlayBeeps; | 258 | int mAlarmPlayBeeps; |
258 | int mAlarmSuspendTime; | 259 | int mAlarmSuspendTime; |
259 | int mAlarmSuspendCount; | 260 | int mAlarmSuspendCount; |
260 | int mAlarmBeepInterval; | 261 | int mAlarmBeepInterval; |
261 | int mOldLanguage; | 262 | int mOldLanguage; |
262 | int mOldLoadedLanguage; | 263 | int mOldLoadedLanguage; |
263 | 264 | ||
264 | 265 | ||
265 | QString mActiveSyncPort; | 266 | QString mActiveSyncPort; |
266 | QString mActiveSyncIP; | 267 | QString mActiveSyncIP; |
267 | 268 | ||
268 | private: | 269 | private: |
269 | QDict<QColor> mCategoryColors; | 270 | QDict<QColor> mCategoryColors; |
270 | QColor mDefaultCategoryColor; | 271 | QColor mDefaultCategoryColor; |
271 | 272 | ||
272 | QFont mDefaultTimeBarFont; | 273 | QFont mDefaultTimeBarFont; |
273 | QFont mDefaultViewFont; | 274 | QFont mDefaultViewFont; |
274 | QFont mDefaultMonthViewFont; | 275 | QFont mDefaultMonthViewFont; |
275 | 276 | ||
276 | QString mName; | 277 | QString mName; |
277 | QString mEmail; | 278 | QString mEmail; |
278 | }; | 279 | }; |
279 | 280 | ||
280 | #endif | 281 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 580dff2..452d019 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -1,1665 +1,1668 @@ | |||
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 | 56 | ||
57 | #include <kurlrequester.h> | 57 | #include <kurlrequester.h> |
58 | #include <klineedit.h> | 58 | #include <klineedit.h> |
59 | 59 | ||
60 | #if defined(USE_SOLARIS) | 60 | #if defined(USE_SOLARIS) |
61 | #include <sys/param.h> | 61 | #include <sys/param.h> |
62 | 62 | ||
63 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | 63 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" |
64 | #define INITFILE "/etc/default/init" | 64 | #define INITFILE "/etc/default/init" |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | #include "koprefs.h" | 67 | #include "koprefs.h" |
68 | 68 | ||
69 | #include "koprefsdialog.h" | 69 | #include "koprefsdialog.h" |
70 | #include "kpimglobalprefs.h" | 70 | #include "kpimglobalprefs.h" |
71 | 71 | ||
72 | 72 | ||
73 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 73 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
74 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 74 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
75 | { | 75 | { |
76 | 76 | ||
77 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | 77 | setCaption( i18n("Preferences - some settings need a restart (nr)")); |
78 | mCategoryDict.setAutoDelete(true); | 78 | mCategoryDict.setAutoDelete(true); |
79 | 79 | ||
80 | KGlobal::locale()->insertCatalogue("timezones"); | 80 | KGlobal::locale()->insertCatalogue("timezones"); |
81 | 81 | ||
82 | setupGlobalTab(); | 82 | setupGlobalTab(); |
83 | setupMainTab(); | 83 | setupMainTab(); |
84 | // setupLocaleTab(); | 84 | // setupLocaleTab(); |
85 | //setupTimeZoneTab(); | 85 | //setupTimeZoneTab(); |
86 | setupTimeTab(); | 86 | setupTimeTab(); |
87 | //setupLocaleDateTab(); | 87 | //setupLocaleDateTab(); |
88 | setupFontsTab(); | 88 | setupFontsTab(); |
89 | setupColorsTab(); | 89 | setupColorsTab(); |
90 | setupViewsTab(); | 90 | setupViewsTab(); |
91 | //setupSyncTab(); | 91 | //setupSyncTab(); |
92 | //setupSyncAlgTab(); | 92 | //setupSyncAlgTab(); |
93 | //setupPrinterTab(); | 93 | //setupPrinterTab(); |
94 | //setupGroupSchedulingTab(); | 94 | //setupGroupSchedulingTab(); |
95 | //setupGroupAutomationTab(); | 95 | //setupGroupAutomationTab(); |
96 | 96 | ||
97 | #ifndef DESKTOP_VERSION | 97 | #ifndef DESKTOP_VERSION |
98 | if ( QApplication::desktop()->height() == 480 ) | 98 | if ( QApplication::desktop()->height() == 480 ) |
99 | hideButtons(); | 99 | hideButtons(); |
100 | #endif | 100 | #endif |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | KOPrefsDialog::~KOPrefsDialog() | 104 | KOPrefsDialog::~KOPrefsDialog() |
105 | { | 105 | { |
106 | } | 106 | } |
107 | void KOPrefsDialog::setupGlobalTab() | 107 | void KOPrefsDialog::setupGlobalTab() |
108 | { | 108 | { |
109 | QFrame *topFrame = addPage(i18n("Global"),0,0); | 109 | QFrame *topFrame = addPage(i18n("Global"),0,0); |
110 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); | 110 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); |
111 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 111 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
112 | topLayout->addWidget( kdelibcfg ); | 112 | topLayout->addWidget( kdelibcfg ); |
113 | 113 | ||
114 | 114 | ||
115 | } | 115 | } |
116 | void KOPrefsDialog::setupLocaleDateTab() | 116 | void KOPrefsDialog::setupLocaleDateTab() |
117 | { | 117 | { |
118 | #if 0 | 118 | #if 0 |
119 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 119 | QFrame *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(spacingHint()); | 121 | topLayout->setSpacing(spacingHint()); |
122 | topLayout->setMargin(marginHint()); | 122 | topLayout->setMargin(marginHint()); |
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 | ||
172 | void KOPrefsDialog::setupLocaleTab() | 172 | void 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(spacingHint()); | 177 | topLayout->setSpacing(spacingHint()); |
178 | topLayout->setMargin(marginHint()); | 178 | topLayout->setMargin(marginHint()); |
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 | void KOPrefsDialog::showSyncPage() | 236 | void KOPrefsDialog::showSyncPage() |
237 | { | 237 | { |
238 | showPage ( 0 ) ; | 238 | showPage ( 0 ) ; |
239 | kdelibcfg->showTimeZoneTab() ; | 239 | kdelibcfg->showTimeZoneTab() ; |
240 | 240 | ||
241 | } | 241 | } |
242 | void KOPrefsDialog::setupSyncAlgTab() | 242 | void KOPrefsDialog::setupSyncAlgTab() |
243 | { | 243 | { |
244 | #if 0 | 244 | #if 0 |
245 | QLabel * lab; | 245 | QLabel * lab; |
246 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | 246 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); |
247 | mSetupSyncAlgTab = topFrame; | 247 | mSetupSyncAlgTab = topFrame; |
248 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 248 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
249 | topLayout->setSpacing(spacingHint()); | 249 | topLayout->setSpacing(spacingHint()); |
250 | topLayout->setMargin(marginHint()); | 250 | topLayout->setMargin(marginHint()); |
251 | int iii = 0; | 251 | int iii = 0; |
252 | 252 | ||
253 | KPrefsDialogWidBool *sb = | 253 | KPrefsDialogWidBool *sb = |
254 | addWidBool(i18n("Ask for preferences before syncing"), | 254 | addWidBool(i18n("Ask for preferences before syncing"), |
255 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | 255 | &(KOPrefs::instance()->mAskForPreferences),topFrame); |
256 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 256 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
257 | 257 | ||
258 | ++iii; | 258 | ++iii; |
259 | 259 | ||
260 | KPrefsDialogWidRadios *syncPrefsGroup = | 260 | KPrefsDialogWidRadios *syncPrefsGroup = |
261 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | 261 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), |
262 | topFrame); | 262 | topFrame); |
263 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 263 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
264 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 264 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
265 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 265 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
266 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 266 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
267 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 267 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
268 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 268 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
269 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 269 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
270 | ++iii; | 270 | ++iii; |
271 | sb = | 271 | sb = |
272 | addWidBool(i18n("Show summary after syncing"), | 272 | addWidBool(i18n("Show summary after syncing"), |
273 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | 273 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); |
274 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 274 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
275 | 275 | ||
276 | ++iii; | 276 | ++iii; |
277 | #endif | 277 | #endif |
278 | 278 | ||
279 | 279 | ||
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void KOPrefsDialog::setupSyncTab() | 284 | void KOPrefsDialog::setupSyncTab() |
285 | { | 285 | { |
286 | #if 0 | 286 | #if 0 |
287 | QLabel * lab; | 287 | QLabel * lab; |
288 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | 288 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); |
289 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 289 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
290 | topLayout->setSpacing(spacingHint()); | 290 | topLayout->setSpacing(spacingHint()); |
291 | topLayout->setMargin(marginHint()); | 291 | topLayout->setMargin(marginHint()); |
292 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | 292 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); |
293 | int iii = 0; | 293 | int iii = 0; |
294 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 294 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
295 | ++iii; | 295 | ++iii; |
296 | 296 | ||
297 | mRemoteIPEdit = new QLineEdit(topFrame); | 297 | mRemoteIPEdit = new QLineEdit(topFrame); |
298 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | 298 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); |
299 | topLayout->addWidget(lab ,iii,0); | 299 | topLayout->addWidget(lab ,iii,0); |
300 | topLayout->addWidget(mRemoteIPEdit,iii,1); | 300 | topLayout->addWidget(mRemoteIPEdit,iii,1); |
301 | ++iii; | 301 | ++iii; |
302 | mRemoteUser = new QLineEdit(topFrame); | 302 | mRemoteUser = new QLineEdit(topFrame); |
303 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | 303 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); |
304 | topLayout->addWidget(lab ,iii,0); | 304 | topLayout->addWidget(lab ,iii,0); |
305 | topLayout->addWidget(mRemoteUser, iii,1); | 305 | topLayout->addWidget(mRemoteUser, iii,1); |
306 | ++iii; | 306 | ++iii; |
307 | 307 | ||
308 | mRemoteFile = new QLineEdit(topFrame); | 308 | mRemoteFile = new QLineEdit(topFrame); |
309 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | 309 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); |
310 | topLayout->addWidget(lab ,iii,0); | 310 | topLayout->addWidget(lab ,iii,0); |
311 | topLayout->addWidget(mRemoteFile,iii,1); | 311 | topLayout->addWidget(mRemoteFile,iii,1); |
312 | ++iii; | 312 | ++iii; |
313 | 313 | ||
314 | mLocalTempFile = new QLineEdit(topFrame); | 314 | mLocalTempFile = new QLineEdit(topFrame); |
315 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | 315 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); |
316 | topLayout->addWidget(lab ,iii,0); | 316 | topLayout->addWidget(lab ,iii,0); |
317 | topLayout->addWidget(mLocalTempFile,iii,1); | 317 | topLayout->addWidget(mLocalTempFile,iii,1); |
318 | ++iii; | 318 | ++iii; |
319 | 319 | ||
320 | KPrefsDialogWidBool *wb = | 320 | KPrefsDialogWidBool *wb = |
321 | addWidBool(i18n("Write back synced file"), | 321 | addWidBool(i18n("Write back synced file"), |
322 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | 322 | &(KOPrefs::instance()->mWriteBackFile),topFrame); |
323 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 323 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
324 | ++iii; | 324 | ++iii; |
325 | wb = | 325 | wb = |
326 | addWidBool(i18n("Write back existing entries only"), | 326 | addWidBool(i18n("Write back existing entries only"), |
327 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | 327 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); |
328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | 328 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); |
329 | ++iii; | 329 | ++iii; |
330 | 330 | ||
331 | #endif | 331 | #endif |
332 | } | 332 | } |
333 | 333 | ||
334 | void KOPrefsDialog::setupMainTab() | 334 | void KOPrefsDialog::setupMainTab() |
335 | { | 335 | { |
336 | QFrame *topFrame = addPage(i18n("General"),0,0); | 336 | QFrame *topFrame = addPage(i18n("General"),0,0); |
337 | // DesktopIcon("identity",KIcon::SizeMedium)); | 337 | // DesktopIcon("identity",KIcon::SizeMedium)); |
338 | 338 | ||
339 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 339 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
340 | topLayout->setSpacing(spacingHint()); | 340 | topLayout->setSpacing(spacingHint()); |
341 | topLayout->setMargin(marginHint()); | 341 | topLayout->setMargin(marginHint()); |
342 | 342 | ||
343 | // KPrefsDialogWidBool *emailControlCenter = | 343 | // KPrefsDialogWidBool *emailControlCenter = |
344 | // addWidBool(i18n("&Use email settings from Control Center"), | 344 | // addWidBool(i18n("&Use email settings from Control Center"), |
345 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 345 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
346 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 346 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
347 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 347 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
348 | // SLOT(toggleEmailSettings(bool))); | 348 | // SLOT(toggleEmailSettings(bool))); |
349 | 349 | ||
350 | mNameEdit = new QLineEdit(topFrame); | 350 | mNameEdit = new QLineEdit(topFrame); |
351 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 351 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
352 | topLayout->addWidget(mNameLabel,0,0); | 352 | topLayout->addWidget(mNameLabel,0,0); |
353 | topLayout->addWidget(mNameEdit,0,1); | 353 | topLayout->addWidget(mNameEdit,0,1); |
354 | 354 | ||
355 | mEmailEdit = new QLineEdit(topFrame); | 355 | mEmailEdit = new QLineEdit(topFrame); |
356 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 356 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
357 | topLayout->addWidget(mEmailLabel,1,0); | 357 | topLayout->addWidget(mEmailLabel,1,0); |
358 | topLayout->addWidget(mEmailEdit,1,1); | 358 | topLayout->addWidget(mEmailEdit,1,1); |
359 | KPrefsDialogWidBool *wb; | 359 | KPrefsDialogWidBool *wb; |
360 | QHBox *dummy; | 360 | QHBox *dummy; |
361 | if ( QApplication::desktop()->width() > 480 ) { | 361 | if ( QApplication::desktop()->width() > 480 ) { |
362 | dummy = new QHBox(topFrame); | 362 | dummy = new QHBox(topFrame); |
363 | } else { | 363 | } else { |
364 | dummy = new QVBox(topFrame); | 364 | dummy = new QVBox(topFrame); |
365 | } | 365 | } |
366 | 366 | ||
367 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); | 367 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); |
368 | addWidBool(i18n("Full menu bar(nr)"), | 368 | addWidBool(i18n("Full menu bar(nr)"), |
369 | &(KOPrefs::instance()->mShowFullMenu),dummy); | 369 | &(KOPrefs::instance()->mShowFullMenu),dummy); |
370 | 370 | ||
371 | 371 | ||
372 | addWidBool(i18n("Mini icons in toolbar(nr)"), | 372 | addWidBool(i18n("Mini icons in toolbar(nr)"), |
373 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); | 373 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); |
374 | 374 | ||
375 | 375 | ||
376 | dummy = new QHBox(topFrame); | 376 | dummy = new QHBox(topFrame); |
377 | new QLabel(i18n("Days in What's Next:"),dummy); | 377 | new QLabel(i18n("Days in What's Next:"),dummy); |
378 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); | 378 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); |
379 | 379 | ||
380 | topLayout->addMultiCellWidget(dummy,3,3,0,1); | 380 | topLayout->addMultiCellWidget(dummy,3,3,0,1); |
381 | 381 | ||
382 | 382 | ||
383 | 383 | ||
384 | dummy = new QHBox(topFrame); | 384 | dummy = new QHBox(topFrame); |
385 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 385 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
386 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 386 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
387 | 387 | ||
388 | topLayout->addMultiCellWidget(dummy,4,4,0,1); | 388 | topLayout->addMultiCellWidget(dummy,4,4,0,1); |
389 | 389 | ||
390 | QHBox *prioBox = new QHBox(topFrame); | 390 | QHBox *prioBox = new QHBox(topFrame); |
391 | // intervalBox->setSpacing(spacingHint()); | 391 | // intervalBox->setSpacing(spacingHint()); |
392 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); | 392 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); |
393 | QString messa = i18n("Show topmost todo prios in What's Next:"); | 393 | QString messa = i18n("Show topmost todo prios in What's Next:"); |
394 | 394 | ||
395 | if ( QApplication::desktop()->width() < 300 ) | 395 | if ( QApplication::desktop()->width() < 300 ) |
396 | messa = i18n("Show topmost todo prios in What's N.:"); | 396 | messa = i18n("Show topmost todo prios in What's N.:"); |
397 | QLabel *prioLabel = new QLabel(messa, prioBox); | 397 | QLabel *prioLabel = new QLabel(messa, prioBox); |
398 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 398 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
399 | if ( QApplication::desktop()->width() < 300 ) | 399 | if ( QApplication::desktop()->width() < 300 ) |
400 | mPrioSpin->setFixedWidth( 40 ); | 400 | mPrioSpin->setFixedWidth( 40 ); |
401 | 401 | ||
402 | // KPrefsDialogWidBool *bcc = | 402 | // KPrefsDialogWidBool *bcc = |
403 | // addWidBool(i18n("Send copy to owner when mailing events"), | 403 | // addWidBool(i18n("Send copy to owner when mailing events"), |
404 | // &(KOPrefs::instance()->mBcc),topFrame); | 404 | // &(KOPrefs::instance()->mBcc),topFrame); |
405 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 405 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
406 | 406 | ||
407 | 407 | ||
408 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 408 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
409 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 409 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
410 | 410 | ||
411 | // addWidBool(i18n("Enable automatic saving of calendar"), | 411 | // addWidBool(i18n("Enable automatic saving of calendar"), |
412 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 412 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
413 | 413 | ||
414 | QHBox *intervalBox = new QHBox(topFrame); | 414 | QHBox *intervalBox = new QHBox(topFrame); |
415 | // intervalBox->setSpacing(spacingHint()); | 415 | // intervalBox->setSpacing(spacingHint()); |
416 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | 416 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); |
417 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 417 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
418 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 418 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
419 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 419 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
420 | /* | 420 | /* |
421 | QHBox * agendasize = new QHBox ( topFrame ); | 421 | QHBox * agendasize = new QHBox ( topFrame ); |
422 | 422 | ||
423 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 423 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
424 | 424 | ||
425 | 425 | ||
426 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 426 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
427 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 427 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
428 | */ | 428 | */ |
429 | KPrefsDialogWidBool *verticalScreen = | 429 | KPrefsDialogWidBool *verticalScreen = |
430 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 430 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
431 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 431 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
432 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 432 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
433 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); | 433 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); |
434 | 434 | ||
435 | KPrefsDialogWidBool *ask = | 435 | KPrefsDialogWidBool *ask = |
436 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 436 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
437 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 437 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
438 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); | 438 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); |
439 | 439 | ||
440 | 440 | ||
441 | /* | 441 | /* |
442 | KPrefsDialogWidBool *confirmCheck = | 442 | KPrefsDialogWidBool *confirmCheck = |
443 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 443 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
444 | topFrame); | 444 | topFrame); |
445 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 445 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
446 | 446 | ||
447 | 447 | ||
448 | mEnableGroupScheduling = | 448 | mEnableGroupScheduling = |
449 | addWidBool(i18n("Enable group scheduling"), | 449 | addWidBool(i18n("Enable group scheduling"), |
450 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | 450 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); |
451 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | 451 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); |
452 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | 452 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), |
453 | SLOT(warningGroupScheduling())); | 453 | SLOT(warningGroupScheduling())); |
454 | 454 | ||
455 | mEnableProjectView = | 455 | mEnableProjectView = |
456 | addWidBool(i18n("Enable project view"), | 456 | addWidBool(i18n("Enable project view"), |
457 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | 457 | &(KOPrefs::instance()->mEnableProjectView),topFrame); |
458 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | 458 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); |
459 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | 459 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), |
460 | SLOT(warningProjectView())); | 460 | SLOT(warningProjectView())); |
461 | 461 | ||
462 | // Can't be disabled anymore | 462 | // Can't be disabled anymore |
463 | mEnableGroupScheduling->checkBox()->hide(); | 463 | mEnableGroupScheduling->checkBox()->hide(); |
464 | 464 | ||
465 | // Disable setting, because this feature now becomes stable | 465 | // Disable setting, because this feature now becomes stable |
466 | mEnableProjectView->checkBox()->hide(); | 466 | mEnableProjectView->checkBox()->hide(); |
467 | 467 | ||
468 | KPrefsDialogWidRadios *defaultFormatGroup = | 468 | KPrefsDialogWidRadios *defaultFormatGroup = |
469 | addWidRadios(i18n("Default Calendar Format"), | 469 | addWidRadios(i18n("Default Calendar Format"), |
470 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | 470 | &(KOPrefs::instance()->mDefaultFormat),topFrame); |
471 | defaultFormatGroup->addRadio(i18n("vCalendar")); | 471 | defaultFormatGroup->addRadio(i18n("vCalendar")); |
472 | defaultFormatGroup->addRadio(i18n("iCalendar")); | 472 | defaultFormatGroup->addRadio(i18n("iCalendar")); |
473 | 473 | ||
474 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 474 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
475 | 475 | ||
476 | // Default format unconditionally is iCalendar | 476 | // Default format unconditionally is iCalendar |
477 | defaultFormatGroup->groupBox()->hide(); | 477 | defaultFormatGroup->groupBox()->hide(); |
478 | 478 | ||
479 | KPrefsDialogWidRadios *mailClientGroup = | 479 | KPrefsDialogWidRadios *mailClientGroup = |
480 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 480 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
481 | topFrame); | 481 | topFrame); |
482 | mailClientGroup->addRadio(i18n("KMail")); | 482 | mailClientGroup->addRadio(i18n("KMail")); |
483 | mailClientGroup->addRadio(i18n("Sendmail")); | 483 | mailClientGroup->addRadio(i18n("Sendmail")); |
484 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 484 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
485 | 485 | ||
486 | KPrefsDialogWidBool *htmlsave = | 486 | KPrefsDialogWidBool *htmlsave = |
487 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 487 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
488 | topFrame); | 488 | topFrame); |
489 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 489 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
490 | 490 | ||
491 | KPrefsDialogWidRadios *destinationGroup = | 491 | KPrefsDialogWidRadios *destinationGroup = |
492 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 492 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
493 | topFrame); | 493 | topFrame); |
494 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 494 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
495 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 495 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
496 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 496 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
497 | 497 | ||
498 | topLayout->setRowStretch(14,1); | 498 | topLayout->setRowStretch(14,1); |
499 | */ | 499 | */ |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | void KOPrefsDialog::setupTimeTab() | 503 | void KOPrefsDialog::setupTimeTab() |
504 | { | 504 | { |
505 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 505 | QFrame *topFrame = addPage(i18n("Time"),0,0); |
506 | // DesktopIcon("clock",KIcon::SizeMedium)); | 506 | // DesktopIcon("clock",KIcon::SizeMedium)); |
507 | 507 | ||
508 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 508 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
509 | topLayout->setSpacing(spacingHint()); | 509 | topLayout->setSpacing(spacingHint()); |
510 | topLayout->setMargin(marginHint()); | 510 | topLayout->setMargin(marginHint()); |
511 | 511 | ||
512 | QHBox *dummy = new QHBox(topFrame); | 512 | QHBox *dummy = new QHBox(topFrame); |
513 | KPrefsDialogWidTime *dayBegins = | 513 | KPrefsDialogWidTime *dayBegins = |
514 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 514 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
515 | dummy); | 515 | dummy); |
516 | //topLayout->addWidget(dayBegins->label(),2,0); | 516 | //topLayout->addWidget(dayBegins->label(),2,0); |
517 | 517 | ||
518 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 518 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
519 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 519 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
520 | 520 | ||
521 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 521 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
522 | topFrame),1,0); | 522 | topFrame),1,0); |
523 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 523 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
524 | mStartTimeSpin->setSuffix(":00"); | 524 | mStartTimeSpin->setSuffix(":00"); |
525 | topLayout->addWidget(mStartTimeSpin,1,1); | 525 | topLayout->addWidget(mStartTimeSpin,1,1); |
526 | 526 | ||
527 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 527 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
528 | topFrame),2,0); | 528 | topFrame),2,0); |
529 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 529 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
530 | mDefaultDurationSpin->setSuffix(":00"); | 530 | mDefaultDurationSpin->setSuffix(":00"); |
531 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 531 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
532 | 532 | ||
533 | QStringList alarmList; | 533 | QStringList alarmList; |
534 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 534 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
535 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 535 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
536 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 536 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
537 | 3,0); | 537 | 3,0); |
538 | mAlarmTimeCombo = new QComboBox(topFrame); | 538 | mAlarmTimeCombo = new QComboBox(topFrame); |
539 | mAlarmTimeCombo->insertStringList(alarmList); | 539 | mAlarmTimeCombo->insertStringList(alarmList); |
540 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 540 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
541 | 541 | ||
542 | 542 | ||
543 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 543 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, |
544 | i18n("Working Hours"), | 544 | i18n("Working Hours"), |
545 | topFrame); | 545 | topFrame); |
546 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 546 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
547 | workingHoursGroup->layout()->setSpacing( 0 ); | 547 | workingHoursGroup->layout()->setSpacing( 0 ); |
548 | workingHoursGroup->layout()->setMargin( 4 ); | 548 | workingHoursGroup->layout()->setMargin( 4 ); |
549 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 549 | QHBox *workStartBox = new QHBox(workingHoursGroup); |
550 | // workStartBox->setMargin( 0 ); | 550 | // workStartBox->setMargin( 0 ); |
551 | addWidTime(i18n("Daily starting hour:"), | 551 | addWidTime(i18n("Daily starting hour:"), |
552 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 552 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
553 | 553 | ||
554 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 554 | QHBox *workEndBox = new QHBox(workingHoursGroup); |
555 | //workEndBox->setMargin( 0 ); | 555 | //workEndBox->setMargin( 0 ); |
556 | addWidTime(i18n("Daily ending hour:"), | 556 | addWidTime(i18n("Daily ending hour:"), |
557 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 557 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
558 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 558 | QVBox *excludeBox = new QVBox(workingHoursGroup); |
559 | //excludeBox->setMargin( 0 ); | 559 | //excludeBox->setMargin( 0 ); |
560 | addWidBool(i18n("Exclude holidays"), | 560 | addWidBool(i18n("Exclude holidays"), |
561 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 561 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
562 | 562 | ||
563 | addWidBool(i18n("Exclude Saturdays"), | 563 | addWidBool(i18n("Exclude Saturdays"), |
564 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 564 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
565 | 565 | ||
566 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 566 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
567 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 567 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
568 | // topFrame); | 568 | // topFrame); |
569 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 569 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
570 | 570 | ||
571 | // topLayout->setRowStretch(6,1); | 571 | // topLayout->setRowStretch(6,1); |
572 | } | 572 | } |
573 | 573 | ||
574 | 574 | ||
575 | void KOPrefsDialog::setupViewsTab() | 575 | void KOPrefsDialog::setupViewsTab() |
576 | { | 576 | { |
577 | 577 | ||
578 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 578 | QFrame *topFrame = addPage(i18n("Views"),0,0); |
579 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 579 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
580 | 580 | ||
581 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 581 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); |
582 | topLayout->setSpacing(spacingHint()); | 582 | topLayout->setSpacing(spacingHint()); |
583 | topLayout->setMargin(marginHint()); | 583 | topLayout->setMargin(marginHint()); |
584 | 584 | ||
585 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 585 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
586 | // topLayout->addLayout(dayBeginsLayout,0,0); | 586 | // topLayout->addLayout(dayBeginsLayout,0,0); |
587 | 587 | ||
588 | // KPrefsDialogWidTime *dayBegins = | 588 | // KPrefsDialogWidTime *dayBegins = |
589 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 589 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
590 | // topFrame); | 590 | // topFrame); |
591 | // dayBeginsLayout->addWidget(dayBegins->label()); | 591 | // dayBeginsLayout->addWidget(dayBegins->label()); |
592 | // dayBeginsLayout->addStretch(1); | 592 | // dayBeginsLayout->addStretch(1); |
593 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 593 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
594 | 594 | ||
595 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 595 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
596 | // topLayout->addLayout(nextDaysLayout,1,0); | 596 | // topLayout->addLayout(nextDaysLayout,1,0); |
597 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | 597 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); |
598 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 598 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
599 | // nextDaysLayout->addStretch(1); | 599 | // nextDaysLayout->addStretch(1); |
600 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 600 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
601 | 601 | ||
602 | 602 | ||
603 | int ii = 0; | 603 | int ii = 0; |
604 | KPrefsDialogWidBool *dummy = | 604 | KPrefsDialogWidBool *dummy = |
605 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 605 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
606 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 606 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
607 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 607 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
608 | 608 | ||
609 | dummy = | 609 | dummy = |
610 | addWidBool(i18n("Show time in agenda items"), | 610 | addWidBool(i18n("Show time in agenda items"), |
611 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 611 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
612 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 612 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
613 | 613 | ||
614 | dummy = | 614 | dummy = |
615 | addWidBool(i18n("Highlight current day in agenda"), | 615 | addWidBool(i18n("Highlight current day in agenda"), |
616 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 616 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
617 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 617 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
618 | 618 | ||
619 | dummy = | 619 | dummy = |
620 | addWidBool(i18n("Use light color for highlight current day"), | 620 | addWidBool(i18n("Use light color for highlight current day"), |
621 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 621 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
622 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 622 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
623 | 623 | ||
624 | KPrefsDialogWidBool *dailyRecur = | 624 | KPrefsDialogWidBool *dailyRecur = |
625 | addWidBool(i18n("Show events that recur daily in date nav."), | 625 | addWidBool(i18n("Show events that recur daily in date nav."), |
626 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 626 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
627 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 627 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
628 | 628 | ||
629 | KPrefsDialogWidBool *weeklyRecur = | 629 | KPrefsDialogWidBool *weeklyRecur = |
630 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 630 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
631 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 631 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
632 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 632 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
633 | if ( QApplication::desktop()->width() > 640 ) { | 633 | if ( QApplication::desktop()->width() > 640 ) { |
634 | 634 | ||
635 | KPrefsDialogWidBool *enableToolTips = | 635 | KPrefsDialogWidBool *enableToolTips = |
636 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 636 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
637 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 637 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
638 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 638 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
639 | 639 | ||
640 | } | 640 | } |
641 | 641 | ||
642 | KPrefsDialogWidBool *marcusBainsEnabled = | 642 | KPrefsDialogWidBool *marcusBainsEnabled = |
643 | addWidBool(i18n("Show Marcus Bains line"), | 643 | addWidBool(i18n("Show Marcus Bains line"), |
644 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 644 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
645 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 645 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
646 | 646 | ||
647 | 647 | ||
648 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 648 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
649 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 649 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
650 | //topLayout->setRowStretch(11,1); | 650 | //topLayout->setRowStretch(11,1); |
651 | 651 | ||
652 | 652 | ||
653 | 653 | ||
654 | 654 | ||
655 | 655 | ||
656 | 656 | ||
657 | topFrame = addPage(i18n("ViewChange"),0,0); | 657 | topFrame = addPage(i18n("ViewChange"),0,0); |
658 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 658 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
659 | 659 | ||
660 | topLayout = new QGridLayout(topFrame,6,1); | 660 | topLayout = new QGridLayout(topFrame,6,1); |
661 | topLayout->setSpacing(spacingHint()); | 661 | topLayout->setSpacing(spacingHint()); |
662 | topLayout->setMargin(marginHint()); | 662 | topLayout->setMargin(marginHint()); |
663 | ii = 0; | 663 | ii = 0; |
664 | 664 | ||
665 | 665 | ||
666 | dummy = | 666 | dummy = |
667 | addWidBool(i18n("Hold fullscreen on view change"), | 667 | addWidBool(i18n("Hold fullscreen on view change"), |
668 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 668 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
669 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 669 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
670 | 670 | ||
671 | dummy = | 671 | dummy = |
672 | addWidBool(i18n("Hold non-fullscreen on view change"), | 672 | addWidBool(i18n("Hold non-fullscreen on view change"), |
673 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 673 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
674 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 674 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
675 | 675 | ||
676 | 676 | ||
677 | KPrefsDialogWidBool *fullViewTodo = | 677 | KPrefsDialogWidBool *fullViewTodo = |
678 | addWidBool(i18n("Event list view uses full window"), | 678 | addWidBool(i18n("Event list view uses full window"), |
679 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 679 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
680 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 680 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
681 | 681 | ||
682 | KPrefsDialogWidBool *fullViewMonth = | 682 | KPrefsDialogWidBool *fullViewMonth = |
683 | addWidBool(i18n("Next days view uses full window"), | 683 | addWidBool(i18n("Next days view uses full window"), |
684 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 684 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
685 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 685 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
686 | 686 | ||
687 | dummy = | 687 | dummy = |
688 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 688 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
689 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 689 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
690 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 690 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
691 | 691 | ||
692 | dummy = | 692 | dummy = |
693 | addWidBool(i18n("Set agenda to current time on change"), | 693 | addWidBool(i18n("Set agenda to current time on change"), |
694 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 694 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
695 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 695 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
696 | 696 | ||
697 | dummy = | 697 | dummy = |
698 | addWidBool(i18n("Listview uses monthly timespan"), | 698 | addWidBool(i18n("Listview uses monthly timespan"), |
699 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 699 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
700 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 700 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
701 | dummy = | 701 | dummy = |
702 | addWidBool(i18n("Highlight selection in Time Edit"), | 702 | addWidBool(i18n("Highlight selection in Time Edit"), |
703 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 703 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
704 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 704 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
705 | 705 | ||
706 | 706 | ||
707 | 707 | ||
708 | 708 | ||
709 | 709 | ||
710 | topFrame = addPage(i18n("Month View"),0,0); | 710 | topFrame = addPage(i18n("Month View"),0,0); |
711 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 711 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
712 | 712 | ||
713 | topLayout = new QGridLayout(topFrame,5,1); | 713 | topLayout = new QGridLayout(topFrame,5,1); |
714 | topLayout->setSpacing(spacingHint()); | 714 | topLayout->setSpacing(spacingHint()); |
715 | topLayout->setMargin(marginHint()); | 715 | topLayout->setMargin(marginHint()); |
716 | ii = 0; | 716 | ii = 0; |
717 | QLabel *lab; | 717 | QLabel *lab; |
718 | QHBox *habo = new QHBox( topFrame ); | 718 | QHBox *habo = new QHBox( topFrame ); |
719 | if ( QApplication::desktop()->width() <= 480 ) { | 719 | if ( QApplication::desktop()->width() <= 480 ) { |
720 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 720 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
721 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 721 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
722 | ii++; | 722 | ii++; |
723 | } else { | 723 | } else { |
724 | new QLabel ( i18n("Show events that recur "), habo ); | 724 | new QLabel ( i18n("Show events that recur "), habo ); |
725 | } | 725 | } |
726 | dailyRecur = | 726 | dailyRecur = |
727 | addWidBool(i18n("daily"), | 727 | addWidBool(i18n("daily"), |
728 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 728 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
729 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 729 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
730 | 730 | ||
731 | weeklyRecur = | 731 | weeklyRecur = |
732 | addWidBool(i18n("weekly"), | 732 | addWidBool(i18n("weekly"), |
733 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 733 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
734 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 734 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
735 | ii++; | 735 | ii++; |
736 | 736 | ||
737 | 737 | ||
738 | habo = new QHBox( topFrame ); | 738 | habo = new QHBox( topFrame ); |
739 | if ( QApplication::desktop()->width() <= 480 ) { | 739 | if ( QApplication::desktop()->width() <= 480 ) { |
740 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 740 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
741 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 741 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
742 | ii++; | 742 | ii++; |
743 | 743 | ||
744 | } else { | 744 | } else { |
745 | new QLabel ( i18n("Show in every cell "), habo ); | 745 | new QLabel ( i18n("Show in every cell "), habo ); |
746 | } | 746 | } |
747 | weeklyRecur = | 747 | weeklyRecur = |
748 | addWidBool(i18n("short month"), | 748 | addWidBool(i18n("short month"), |
749 | &(KOPrefs::instance()->mMonthShowShort),habo); | 749 | &(KOPrefs::instance()->mMonthShowShort),habo); |
750 | weeklyRecur = | 750 | weeklyRecur = |
751 | addWidBool(i18n("icons"), | 751 | addWidBool(i18n("icons"), |
752 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 752 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
753 | 753 | ||
754 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 754 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
755 | ii++; | 755 | ii++; |
756 | #ifdef DESKTOP_VERSION | 756 | #ifdef DESKTOP_VERSION |
757 | KPrefsDialogWidBool *enableMonthScroll = | 757 | KPrefsDialogWidBool *enableMonthScroll = |
758 | addWidBool(i18n("Enable scrollbars in month view cells"), | 758 | addWidBool(i18n("Enable scrollbars in month view cells"), |
759 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 759 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
760 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 760 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
761 | #endif | 761 | #endif |
762 | 762 | dummy = | |
763 | addWidBool(i18n("Week view mode uses bigger font"), | ||
764 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | ||
765 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
763 | dummy = | 766 | dummy = |
764 | addWidBool(i18n("Show Sat/Sun together"), | 767 | addWidBool(i18n("Show Sat/Sun together"), |
765 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 768 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
766 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 769 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
767 | 770 | ||
768 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 771 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
769 | addWidBool(i18n("Month view uses category colors"), | 772 | addWidBool(i18n("Month view uses category colors"), |
770 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 773 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
771 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 774 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
772 | 775 | ||
773 | dummy = | 776 | dummy = |
774 | addWidBool(i18n("Categorie colors are applied to text"), | 777 | addWidBool(i18n("Categorie colors are applied to text"), |
775 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 778 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
776 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 779 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
777 | coloredCategoriesInMonthView = | 780 | coloredCategoriesInMonthView = |
778 | addWidBool(i18n("Month view uses day colors"), | 781 | addWidBool(i18n("Month view uses day colors"), |
779 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 782 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
780 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 783 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
781 | 784 | ||
782 | KPrefsDialogWidColor *holidayColor = | 785 | KPrefsDialogWidColor *holidayColor = |
783 | addWidColor(i18n("Day color odd months"), | 786 | addWidColor(i18n("Day color odd months"), |
784 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 787 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
785 | topLayout->addWidget(holidayColor->label(),ii,0); | 788 | topLayout->addWidget(holidayColor->label(),ii,0); |
786 | topLayout->addWidget(holidayColor->button(),ii++,1); | 789 | topLayout->addWidget(holidayColor->button(),ii++,1); |
787 | 790 | ||
788 | holidayColor = | 791 | holidayColor = |
789 | addWidColor(i18n("Day color even months"), | 792 | addWidColor(i18n("Day color even months"), |
790 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 793 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
791 | topLayout->addWidget(holidayColor->label(),ii,0); | 794 | topLayout->addWidget(holidayColor->label(),ii,0); |
792 | topLayout->addWidget(holidayColor->button(),ii++,1); | 795 | topLayout->addWidget(holidayColor->button(),ii++,1); |
793 | 796 | ||
794 | 797 | ||
795 | holidayColor = | 798 | holidayColor = |
796 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 799 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
797 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 800 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
798 | topLayout->addWidget(holidayColor->label(),ii,0); | 801 | topLayout->addWidget(holidayColor->label(),ii,0); |
799 | topLayout->addWidget(holidayColor->button(),ii++,1); | 802 | topLayout->addWidget(holidayColor->button(),ii++,1); |
800 | // *********************** What'sNext View | 803 | // *********************** What'sNext View |
801 | topFrame = addPage(i18n("What's Next View"),0,0); | 804 | topFrame = addPage(i18n("What's Next View"),0,0); |
802 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 805 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
803 | 806 | ||
804 | topLayout = new QGridLayout(topFrame,4,1); | 807 | topLayout = new QGridLayout(topFrame,4,1); |
805 | topLayout->setSpacing(spacingHint()); | 808 | topLayout->setSpacing(spacingHint()); |
806 | topLayout->setMargin(marginHint()); | 809 | topLayout->setMargin(marginHint()); |
807 | ii = 0; | 810 | ii = 0; |
808 | KPrefsDialogWidBool *passwdk = | 811 | KPrefsDialogWidBool *passwdk = |
809 | 812 | ||
810 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), | 813 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), |
811 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 814 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
812 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 815 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
813 | passwdk = | 816 | passwdk = |
814 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | 817 | addWidBool(i18n("Show parent To-Do's in What's Next view"), |
815 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 818 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
816 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 819 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
817 | 820 | ||
818 | passwdk = | 821 | passwdk = |
819 | addWidBool(i18n("Show location in What's Next view"), | 822 | addWidBool(i18n("Show location in What's Next view"), |
820 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 823 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
821 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 824 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
822 | 825 | ||
823 | passwdk = | 826 | passwdk = |
824 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), | 827 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), |
825 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 828 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
826 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 829 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
827 | passwdk = | 830 | passwdk = |
828 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), | 831 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), |
829 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 832 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
830 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 833 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
831 | 834 | ||
832 | 835 | ||
833 | 836 | ||
834 | 837 | ||
835 | // *********************** Todo View | 838 | // *********************** Todo View |
836 | 839 | ||
837 | topFrame = addPage(i18n("Todo View"),0,0); | 840 | topFrame = addPage(i18n("Todo View"),0,0); |
838 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 841 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
839 | 842 | ||
840 | topLayout = new QGridLayout(topFrame,4,1); | 843 | topLayout = new QGridLayout(topFrame,4,1); |
841 | topLayout->setSpacing(spacingHint()); | 844 | topLayout->setSpacing(spacingHint()); |
842 | topLayout->setMargin(marginHint()); | 845 | topLayout->setMargin(marginHint()); |
843 | ii = 0; | 846 | ii = 0; |
844 | dummy = | 847 | dummy = |
845 | addWidBool(i18n("Hide not running Todos in To-do view"), | 848 | addWidBool(i18n("Hide not running Todos in To-do view"), |
846 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 849 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
847 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 850 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
848 | 851 | ||
849 | 852 | ||
850 | KPrefsDialogWidBool *showCompletedTodo = | 853 | KPrefsDialogWidBool *showCompletedTodo = |
851 | addWidBool(i18n("To-do view shows completed Todos"), | 854 | addWidBool(i18n("To-do view shows completed Todos"), |
852 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 855 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
853 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 856 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
854 | dummy = | 857 | dummy = |
855 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 858 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
856 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 859 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
857 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 860 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
858 | 861 | ||
859 | dummy = | 862 | dummy = |
860 | addWidBool(i18n("Small To-do view uses smaller font"), | 863 | addWidBool(i18n("Small To-do view uses smaller font"), |
861 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 864 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
862 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 865 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
863 | 866 | ||
864 | 867 | ||
865 | 868 | ||
866 | dummy = | 869 | dummy = |
867 | addWidBool(i18n("Todo view uses category colors"), | 870 | addWidBool(i18n("Todo view uses category colors"), |
868 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 871 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
869 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 872 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
870 | 873 | ||
871 | 874 | ||
872 | QWidget* wid = new QWidget( topFrame ); | 875 | QWidget* wid = new QWidget( topFrame ); |
873 | // Todo due today color | 876 | // Todo due today color |
874 | KPrefsDialogWidColor *todoDueTodayColor = | 877 | KPrefsDialogWidColor *todoDueTodayColor = |
875 | addWidColor(i18n("Todo due today color:"), | 878 | addWidColor(i18n("Todo due today color:"), |
876 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 879 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
877 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 880 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
878 | widLayout->addWidget( todoDueTodayColor->label() ); | 881 | widLayout->addWidget( todoDueTodayColor->label() ); |
879 | widLayout->addWidget( todoDueTodayColor->button() ); | 882 | widLayout->addWidget( todoDueTodayColor->button() ); |
880 | topLayout->addWidget(wid,ii++,0); | 883 | topLayout->addWidget(wid,ii++,0); |
881 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 884 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
882 | 885 | ||
883 | // Todo overdue color | 886 | // Todo overdue color |
884 | wid = new QWidget( topFrame ); | 887 | wid = new QWidget( topFrame ); |
885 | widLayout = new QHBoxLayout(wid); | 888 | widLayout = new QHBoxLayout(wid); |
886 | KPrefsDialogWidColor *todoOverdueColor = | 889 | KPrefsDialogWidColor *todoOverdueColor = |
887 | addWidColor(i18n("Todo overdue color:"), | 890 | addWidColor(i18n("Todo overdue color:"), |
888 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 891 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
889 | widLayout->addWidget(todoOverdueColor->label()); | 892 | widLayout->addWidget(todoOverdueColor->label()); |
890 | widLayout->addWidget(todoOverdueColor->button()); | 893 | widLayout->addWidget(todoOverdueColor->button()); |
891 | topLayout->addWidget(wid,ii++,0); | 894 | topLayout->addWidget(wid,ii++,0); |
892 | 895 | ||
893 | dummy = | 896 | dummy = |
894 | addWidBool(i18n("Colors are applied to text"), | 897 | addWidBool(i18n("Colors are applied to text"), |
895 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 898 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
896 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 899 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
897 | 900 | ||
898 | dummy = | 901 | dummy = |
899 | addWidBool(i18n("Allday Agenda view shows todos"), | 902 | addWidBool(i18n("Allday Agenda view shows todos"), |
900 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 903 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
901 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 904 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
902 | 905 | ||
903 | 906 | ||
904 | 907 | ||
905 | 908 | ||
906 | topFrame = addPage(i18n("Alarm"),0,0); | 909 | topFrame = addPage(i18n("Alarm"),0,0); |
907 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 910 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
908 | 911 | ||
909 | topLayout = new QGridLayout(topFrame,2,1); | 912 | topLayout = new QGridLayout(topFrame,2,1); |
910 | topLayout->setSpacing(spacingHint()); | 913 | topLayout->setSpacing(spacingHint()); |
911 | topLayout->setMargin(marginHint()); | 914 | topLayout->setMargin(marginHint()); |
912 | int iii = 0; | 915 | int iii = 0; |
913 | 916 | ||
914 | dummy = | 917 | dummy = |
915 | addWidBool(i18n("Use internal alarm notification"), | 918 | addWidBool(i18n("Use internal alarm notification"), |
916 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 919 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
917 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 920 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
918 | 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); | 921 | 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); |
919 | 922 | ||
920 | topLayout->addWidget(lab ,iii++,0); | 923 | topLayout->addWidget(lab ,iii++,0); |
921 | #ifndef DESKTOP_VERSION | 924 | #ifndef DESKTOP_VERSION |
922 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 925 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
923 | #else | 926 | #else |
924 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 927 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
925 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 928 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
926 | #endif | 929 | #endif |
927 | 930 | ||
928 | QHBox* dummyBox = new QHBox(topFrame); | 931 | QHBox* dummyBox = new QHBox(topFrame); |
929 | new QLabel(i18n("Play beeps count:"),dummyBox); | 932 | new QLabel(i18n("Play beeps count:"),dummyBox); |
930 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 933 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
931 | topLayout->addWidget(dummyBox,iii++,0); | 934 | topLayout->addWidget(dummyBox,iii++,0); |
932 | 935 | ||
933 | dummyBox = new QHBox(topFrame); | 936 | dummyBox = new QHBox(topFrame); |
934 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 937 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
935 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 938 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
936 | topLayout->addWidget(dummyBox,iii++,0); | 939 | topLayout->addWidget(dummyBox,iii++,0); |
937 | 940 | ||
938 | dummyBox = new QHBox(topFrame); | 941 | dummyBox = new QHBox(topFrame); |
939 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 942 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
940 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 943 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
941 | topLayout->addWidget(dummyBox,iii++,0); | 944 | topLayout->addWidget(dummyBox,iii++,0); |
942 | 945 | ||
943 | dummyBox = new QHBox(topFrame); | 946 | dummyBox = new QHBox(topFrame); |
944 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 947 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
945 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 948 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
946 | topLayout->addWidget(dummyBox,iii++,0); | 949 | topLayout->addWidget(dummyBox,iii++,0); |
947 | 950 | ||
948 | 951 | ||
949 | 952 | ||
950 | 953 | ||
951 | 954 | ||
952 | 955 | ||
953 | 956 | ||
954 | QHBox* hbo = new QHBox ( topFrame ); | 957 | QHBox* hbo = new QHBox ( topFrame ); |
955 | mDefaultAlarmFile = new QLineEdit(hbo); | 958 | mDefaultAlarmFile = new QLineEdit(hbo); |
956 | QPushButton * loadTemplate = new QPushButton(hbo); | 959 | QPushButton * loadTemplate = new QPushButton(hbo); |
957 | QPixmap icon; | 960 | QPixmap icon; |
958 | if ( QApplication::desktop()->width() < 321 ) | 961 | if ( QApplication::desktop()->width() < 321 ) |
959 | icon = SmallIcon("fileimport16"); | 962 | icon = SmallIcon("fileimport16"); |
960 | else | 963 | else |
961 | icon = SmallIcon("fileimport"); | 964 | icon = SmallIcon("fileimport"); |
962 | loadTemplate->setIconSet (icon ) ; | 965 | loadTemplate->setIconSet (icon ) ; |
963 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 966 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
964 | int size = loadTemplate->sizeHint().height(); | 967 | int size = loadTemplate->sizeHint().height(); |
965 | loadTemplate->setFixedSize( size, size ); | 968 | loadTemplate->setFixedSize( size, size ); |
966 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 969 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
967 | // topLayout->addWidget(lab ,iii++,0); | 970 | // topLayout->addWidget(lab ,iii++,0); |
968 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 971 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
969 | topLayout->addWidget(lab ,iii++,0); | 972 | topLayout->addWidget(lab ,iii++,0); |
970 | topLayout->addWidget(hbo,iii++,0); | 973 | topLayout->addWidget(hbo,iii++,0); |
971 | // 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); | 974 | // 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); |
972 | 975 | ||
973 | // topLayout->addWidget(lab ,iii++,0); | 976 | // topLayout->addWidget(lab ,iii++,0); |
974 | // #ifndef DESKTOP_VERSION | 977 | // #ifndef DESKTOP_VERSION |
975 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 978 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
976 | // #else | 979 | // #else |
977 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 980 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
978 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 981 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
979 | // #endif | 982 | // #endif |
980 | 983 | ||
981 | 984 | ||
982 | } | 985 | } |
983 | 986 | ||
984 | void KOPrefsDialog::selectSoundFile() | 987 | void KOPrefsDialog::selectSoundFile() |
985 | { | 988 | { |
986 | QString fileName = mDefaultAlarmFile->text(); | 989 | QString fileName = mDefaultAlarmFile->text(); |
987 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 990 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
988 | if ( fileName.length() > 0 ) | 991 | if ( fileName.length() > 0 ) |
989 | mDefaultAlarmFile->setText( fileName ); | 992 | mDefaultAlarmFile->setText( fileName ); |
990 | } | 993 | } |
991 | void KOPrefsDialog::setupFontsTab() | 994 | void KOPrefsDialog::setupFontsTab() |
992 | { | 995 | { |
993 | 996 | ||
994 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 997 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
995 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 998 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
996 | 999 | ||
997 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1000 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
998 | topLayout->setSpacing(1); | 1001 | topLayout->setSpacing(1); |
999 | topLayout->setMargin(3); | 1002 | topLayout->setMargin(3); |
1000 | KPrefsDialogWidFont * tVFont; | 1003 | KPrefsDialogWidFont * tVFont; |
1001 | int i = 0; | 1004 | int i = 0; |
1002 | KPrefsDialogWidFont *timeLabelsFont = | 1005 | KPrefsDialogWidFont *timeLabelsFont = |
1003 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1006 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1004 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1007 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1005 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1008 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1006 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1009 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1007 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1010 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1008 | ++i; | 1011 | ++i; |
1009 | 1012 | ||
1010 | 1013 | ||
1011 | timeLabelsFont = | 1014 | timeLabelsFont = |
1012 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1015 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1013 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1016 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1014 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1017 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1015 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1018 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1016 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1019 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1017 | ++i; | 1020 | ++i; |
1018 | 1021 | ||
1019 | KPrefsDialogWidFont *timeBarFont = | 1022 | KPrefsDialogWidFont *timeBarFont = |
1020 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1023 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1021 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1024 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1022 | topLayout->addWidget(timeBarFont->label(),i,0); | 1025 | topLayout->addWidget(timeBarFont->label(),i,0); |
1023 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1026 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1024 | topLayout->addWidget(timeBarFont->button(),i,2); | 1027 | topLayout->addWidget(timeBarFont->button(),i,2); |
1025 | ++i; | 1028 | ++i; |
1026 | 1029 | ||
1027 | 1030 | ||
1028 | KPrefsDialogWidFont *marcusBainsFont = | 1031 | KPrefsDialogWidFont *marcusBainsFont = |
1029 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1032 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1030 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1033 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1031 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1034 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1032 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1035 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1033 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1036 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1034 | ++i; | 1037 | ++i; |
1035 | 1038 | ||
1036 | tVFont = | 1039 | tVFont = |
1037 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1040 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1038 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1041 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1039 | topLayout->addWidget(tVFont->label(),i,0); | 1042 | topLayout->addWidget(tVFont->label(),i,0); |
1040 | topLayout->addWidget(tVFont->preview(),i,1); | 1043 | topLayout->addWidget(tVFont->preview(),i,1); |
1041 | topLayout->addWidget(tVFont->button(),i,2); | 1044 | topLayout->addWidget(tVFont->button(),i,2); |
1042 | ++i; | 1045 | ++i; |
1043 | 1046 | ||
1044 | 1047 | ||
1045 | 1048 | ||
1046 | tVFont = | 1049 | tVFont = |
1047 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1050 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1048 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1051 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1049 | topLayout->addWidget(tVFont->label(),i,0); | 1052 | topLayout->addWidget(tVFont->label(),i,0); |
1050 | topLayout->addWidget(tVFont->preview(),i,1); | 1053 | topLayout->addWidget(tVFont->preview(),i,1); |
1051 | topLayout->addWidget(tVFont->button(),i,2); | 1054 | topLayout->addWidget(tVFont->button(),i,2); |
1052 | ++i; | 1055 | ++i; |
1053 | 1056 | ||
1054 | 1057 | ||
1055 | 1058 | ||
1056 | topLayout->setColStretch(1,1); | 1059 | topLayout->setColStretch(1,1); |
1057 | topLayout->setRowStretch(4,1); | 1060 | topLayout->setRowStretch(4,1); |
1058 | 1061 | ||
1059 | 1062 | ||
1060 | i = 0; | 1063 | i = 0; |
1061 | topFrame = addPage(i18n("View Fonts"),0, | 1064 | topFrame = addPage(i18n("View Fonts"),0, |
1062 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1065 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1063 | 1066 | ||
1064 | topLayout = new QGridLayout(topFrame,7,3); | 1067 | topLayout = new QGridLayout(topFrame,7,3); |
1065 | topLayout->setSpacing(1); | 1068 | topLayout->setSpacing(1); |
1066 | topLayout->setMargin(3); | 1069 | topLayout->setMargin(3); |
1067 | 1070 | ||
1068 | tVFont = | 1071 | tVFont = |
1069 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1072 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1070 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1073 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1071 | topLayout->addWidget(tVFont->label(),i,0); | 1074 | topLayout->addWidget(tVFont->label(),i,0); |
1072 | topLayout->addWidget(tVFont->preview(),i,1); | 1075 | topLayout->addWidget(tVFont->preview(),i,1); |
1073 | topLayout->addWidget(tVFont->button(),i,2); | 1076 | topLayout->addWidget(tVFont->button(),i,2); |
1074 | ++i; | 1077 | ++i; |
1075 | KPrefsDialogWidFont *agendaViewFont = | 1078 | KPrefsDialogWidFont *agendaViewFont = |
1076 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1079 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1077 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1080 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1078 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1081 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1079 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1082 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1080 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1083 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1081 | ++i; | 1084 | ++i; |
1082 | 1085 | ||
1083 | 1086 | ||
1084 | KPrefsDialogWidFont *monthViewFont = | 1087 | KPrefsDialogWidFont *monthViewFont = |
1085 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1088 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1086 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1089 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1087 | topLayout->addWidget(monthViewFont->label(),i,0); | 1090 | topLayout->addWidget(monthViewFont->label(),i,0); |
1088 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1091 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1089 | topLayout->addWidget(monthViewFont->button(),i,2); | 1092 | topLayout->addWidget(monthViewFont->button(),i,2); |
1090 | ++i; | 1093 | ++i; |
1091 | 1094 | ||
1092 | 1095 | ||
1093 | KPrefsDialogWidFont *lVFont = | 1096 | KPrefsDialogWidFont *lVFont = |
1094 | addWidFont(i18n("Event"),i18n("List View:"), | 1097 | addWidFont(i18n("Event"),i18n("List View:"), |
1095 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1098 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1096 | topLayout->addWidget(lVFont->label(),i,0); | 1099 | topLayout->addWidget(lVFont->label(),i,0); |
1097 | topLayout->addWidget(lVFont->preview(),i,1); | 1100 | topLayout->addWidget(lVFont->preview(),i,1); |
1098 | topLayout->addWidget(lVFont->button(),i,2); | 1101 | topLayout->addWidget(lVFont->button(),i,2); |
1099 | ++i; | 1102 | ++i; |
1100 | 1103 | ||
1101 | 1104 | ||
1102 | tVFont = | 1105 | tVFont = |
1103 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1106 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1104 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1107 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1105 | topLayout->addWidget(tVFont->label(),i,0); | 1108 | topLayout->addWidget(tVFont->label(),i,0); |
1106 | topLayout->addWidget(tVFont->preview(),i,1); | 1109 | topLayout->addWidget(tVFont->preview(),i,1); |
1107 | topLayout->addWidget(tVFont->button(),i,2); | 1110 | topLayout->addWidget(tVFont->button(),i,2); |
1108 | ++i; | 1111 | ++i; |
1109 | 1112 | ||
1110 | 1113 | ||
1111 | tVFont = | 1114 | tVFont = |
1112 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1115 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1113 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1116 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1114 | topLayout->addWidget(tVFont->label(),i,0); | 1117 | topLayout->addWidget(tVFont->label(),i,0); |
1115 | topLayout->addWidget(tVFont->preview(),i,1); | 1118 | topLayout->addWidget(tVFont->preview(),i,1); |
1116 | topLayout->addWidget(tVFont->button(),i,2); | 1119 | topLayout->addWidget(tVFont->button(),i,2); |
1117 | ++i; | 1120 | ++i; |
1118 | 1121 | ||
1119 | 1122 | ||
1120 | 1123 | ||
1121 | 1124 | ||
1122 | topLayout->setColStretch(1,1); | 1125 | topLayout->setColStretch(1,1); |
1123 | topLayout->setRowStretch(4,1); | 1126 | topLayout->setRowStretch(4,1); |
1124 | 1127 | ||
1125 | 1128 | ||
1126 | 1129 | ||
1127 | 1130 | ||
1128 | } | 1131 | } |
1129 | 1132 | ||
1130 | void KOPrefsDialog::setupColorsTab() | 1133 | void KOPrefsDialog::setupColorsTab() |
1131 | { | 1134 | { |
1132 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1135 | QFrame *topFrame = addPage(i18n("Colors"),0,0); |
1133 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1136 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1134 | 1137 | ||
1135 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1138 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1136 | // topLayout->setSpacing(spacingHint()); | 1139 | // topLayout->setSpacing(spacingHint()); |
1137 | // topLayout->setMargin(marginHint()); | 1140 | // topLayout->setMargin(marginHint()); |
1138 | 1141 | ||
1139 | topLayout->setSpacing(2); | 1142 | topLayout->setSpacing(2); |
1140 | topLayout->setMargin(3); | 1143 | topLayout->setMargin(3); |
1141 | 1144 | ||
1142 | int ii = 1; | 1145 | int ii = 1; |
1143 | QGroupBox *categoryGroup ; | 1146 | QGroupBox *categoryGroup ; |
1144 | 1147 | ||
1145 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1148 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), |
1146 | topFrame); | 1149 | topFrame); |
1147 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1150 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1148 | 1151 | ||
1149 | mCategoryCombo = new QComboBox(categoryGroup); | 1152 | mCategoryCombo = new QComboBox(categoryGroup); |
1150 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1153 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1151 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1154 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1152 | 1155 | ||
1153 | mCategoryButton = new KColorButton(categoryGroup); | 1156 | mCategoryButton = new KColorButton(categoryGroup); |
1154 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1157 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1155 | updateCategoryColor(); | 1158 | updateCategoryColor(); |
1156 | 1159 | ||
1157 | 1160 | ||
1158 | // Holiday Color | 1161 | // Holiday Color |
1159 | 1162 | ||
1160 | KPrefsDialogWidColor *holidayColor = | 1163 | KPrefsDialogWidColor *holidayColor = |
1161 | addWidColor(i18n("Holiday color:"), | 1164 | addWidColor(i18n("Holiday color:"), |
1162 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1165 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1163 | topLayout->addWidget(holidayColor->label(),ii,0); | 1166 | topLayout->addWidget(holidayColor->label(),ii,0); |
1164 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1167 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1165 | 1168 | ||
1166 | // Highlight Color | 1169 | // Highlight Color |
1167 | KPrefsDialogWidColor *highlightColor = | 1170 | KPrefsDialogWidColor *highlightColor = |
1168 | addWidColor(i18n("Highlight color:"), | 1171 | addWidColor(i18n("Highlight color:"), |
1169 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1172 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1170 | topLayout->addWidget(highlightColor->label(),ii,0); | 1173 | topLayout->addWidget(highlightColor->label(),ii,0); |
1171 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1174 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1172 | 1175 | ||
1173 | // Event color | 1176 | // Event color |
1174 | KPrefsDialogWidColor *eventColor = | 1177 | KPrefsDialogWidColor *eventColor = |
1175 | addWidColor(i18n("Default event color:"), | 1178 | addWidColor(i18n("Default event color:"), |
1176 | &(KOPrefs::instance()->mEventColor),topFrame); | 1179 | &(KOPrefs::instance()->mEventColor),topFrame); |
1177 | topLayout->addWidget(eventColor->label(),ii,0); | 1180 | topLayout->addWidget(eventColor->label(),ii,0); |
1178 | topLayout->addWidget(eventColor->button(),ii++,1); | 1181 | topLayout->addWidget(eventColor->button(),ii++,1); |
1179 | eventColor = | 1182 | eventColor = |
1180 | addWidColor(i18n("Default todo done color:"), | 1183 | addWidColor(i18n("Default todo done color:"), |
1181 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); | 1184 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); |
1182 | topLayout->addWidget(eventColor->label(),ii,0); | 1185 | topLayout->addWidget(eventColor->label(),ii,0); |
1183 | topLayout->addWidget(eventColor->button(),ii++,1); | 1186 | topLayout->addWidget(eventColor->button(),ii++,1); |
1184 | 1187 | ||
1185 | 1188 | ||
1186 | // agenda view background color | 1189 | // agenda view background color |
1187 | KPrefsDialogWidColor *agendaBgColor = | 1190 | KPrefsDialogWidColor *agendaBgColor = |
1188 | addWidColor(i18n("Agenda view background color:"), | 1191 | addWidColor(i18n("Agenda view background color:"), |
1189 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | 1192 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); |
1190 | topLayout->addWidget(agendaBgColor->label(),ii,0); | 1193 | topLayout->addWidget(agendaBgColor->label(),ii,0); |
1191 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | 1194 | topLayout->addWidget(agendaBgColor->button(),ii++,1); |
1192 | 1195 | ||
1193 | // working hours color | 1196 | // working hours color |
1194 | KPrefsDialogWidColor *workingHoursColor = | 1197 | KPrefsDialogWidColor *workingHoursColor = |
1195 | addWidColor(i18n("Working hours color:"), | 1198 | addWidColor(i18n("Working hours color:"), |
1196 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | 1199 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); |
1197 | topLayout->addWidget(workingHoursColor->label(),ii,0); | 1200 | topLayout->addWidget(workingHoursColor->label(),ii,0); |
1198 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | 1201 | topLayout->addWidget(workingHoursColor->button(),ii++,1); |
1199 | 1202 | ||
1200 | KPrefsDialogWidBool *sb = | 1203 | KPrefsDialogWidBool *sb = |
1201 | addWidBool(i18n("Use colors for application:"), | 1204 | addWidBool(i18n("Use colors for application:"), |
1202 | &(KOPrefs::instance()->mUseAppColors),topFrame); | 1205 | &(KOPrefs::instance()->mUseAppColors),topFrame); |
1203 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | 1206 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); |
1204 | 1207 | ||
1205 | ii++; | 1208 | ii++; |
1206 | KPrefsDialogWidColor * workingHoursColor1 = | 1209 | KPrefsDialogWidColor * workingHoursColor1 = |
1207 | addWidColor(i18n("Buttons, menus, etc.:"), | 1210 | addWidColor(i18n("Buttons, menus, etc.:"), |
1208 | &(KOPrefs::instance()->mAppColor1),topFrame); | 1211 | &(KOPrefs::instance()->mAppColor1),topFrame); |
1209 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | 1212 | topLayout->addWidget(workingHoursColor1->label(),ii,0); |
1210 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | 1213 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); |
1211 | 1214 | ||
1212 | KPrefsDialogWidColor * workingHoursColor2 = | 1215 | KPrefsDialogWidColor * workingHoursColor2 = |
1213 | addWidColor(i18n("Frames, labels, etc.:"), | 1216 | addWidColor(i18n("Frames, labels, etc.:"), |
1214 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1217 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1215 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1218 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1216 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1219 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1217 | 1220 | ||
1218 | 1221 | ||
1219 | 1222 | ||
1220 | } | 1223 | } |
1221 | 1224 | ||
1222 | void KOPrefsDialog::setCategoryColor() | 1225 | void KOPrefsDialog::setCategoryColor() |
1223 | { | 1226 | { |
1224 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1227 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1225 | } | 1228 | } |
1226 | 1229 | ||
1227 | void KOPrefsDialog::updateCategoryColor() | 1230 | void KOPrefsDialog::updateCategoryColor() |
1228 | { | 1231 | { |
1229 | QString cat = mCategoryCombo->currentText(); | 1232 | QString cat = mCategoryCombo->currentText(); |
1230 | QColor *color = mCategoryDict.find(cat); | 1233 | QColor *color = mCategoryDict.find(cat); |
1231 | if (!color) { | 1234 | if (!color) { |
1232 | color = KOPrefs::instance()->categoryColor(cat); | 1235 | color = KOPrefs::instance()->categoryColor(cat); |
1233 | } | 1236 | } |
1234 | if (color) { | 1237 | if (color) { |
1235 | mCategoryButton->setColor(*color); | 1238 | mCategoryButton->setColor(*color); |
1236 | } | 1239 | } |
1237 | } | 1240 | } |
1238 | 1241 | ||
1239 | void KOPrefsDialog::setupPrinterTab() | 1242 | void KOPrefsDialog::setupPrinterTab() |
1240 | { | 1243 | { |
1241 | mPrinterTab = addPage(i18n("Printing"),0, | 1244 | mPrinterTab = addPage(i18n("Printing"),0, |
1242 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1245 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1243 | 1246 | ||
1244 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1247 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); |
1245 | topLayout->setSpacing(spacingHint()); | 1248 | topLayout->setSpacing(spacingHint()); |
1246 | topLayout->setMargin(marginHint()); | 1249 | topLayout->setMargin(marginHint()); |
1247 | 1250 | ||
1248 | topLayout->setRowStretch(4,1); | 1251 | topLayout->setRowStretch(4,1); |
1249 | } | 1252 | } |
1250 | 1253 | ||
1251 | void KOPrefsDialog::setupGroupSchedulingTab() | 1254 | void KOPrefsDialog::setupGroupSchedulingTab() |
1252 | { | 1255 | { |
1253 | #if 0 | 1256 | #if 0 |
1254 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1257 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, |
1255 | DesktopIcon("personal",KIcon::SizeMedium)); | 1258 | DesktopIcon("personal",KIcon::SizeMedium)); |
1256 | 1259 | ||
1257 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1260 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
1258 | topLayout->setSpacing(spacingHint()); | 1261 | topLayout->setSpacing(spacingHint()); |
1259 | topLayout->setMargin(marginHint()); | 1262 | topLayout->setMargin(marginHint()); |
1260 | 1263 | ||
1261 | #if 0 | 1264 | #if 0 |
1262 | KPrefsDialogWidRadios *schedulerGroup = | 1265 | KPrefsDialogWidRadios *schedulerGroup = |
1263 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1266 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1264 | topFrame); | 1267 | topFrame); |
1265 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1268 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1266 | schedulerGroup->addRadio(i18n("Mail client")); | 1269 | schedulerGroup->addRadio(i18n("Mail client")); |
1267 | 1270 | ||
1268 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1271 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1269 | #endif | 1272 | #endif |
1270 | 1273 | ||
1271 | KPrefsDialogWidRadios *sendGroup = | 1274 | KPrefsDialogWidRadios *sendGroup = |
1272 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1275 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1273 | topFrame); | 1276 | topFrame); |
1274 | sendGroup->addRadio(i18n("Send to outbox")); | 1277 | sendGroup->addRadio(i18n("Send to outbox")); |
1275 | sendGroup->addRadio(i18n("Send directly")); | 1278 | sendGroup->addRadio(i18n("Send directly")); |
1276 | 1279 | ||
1277 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1280 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1278 | 1281 | ||
1279 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1282 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1280 | mAMails = new QListView(topFrame); | 1283 | mAMails = new QListView(topFrame); |
1281 | mAMails->addColumn(i18n("Email"),300); | 1284 | mAMails->addColumn(i18n("Email"),300); |
1282 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1285 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1283 | 1286 | ||
1284 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1287 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1285 | aEmailsEdit = new QLineEdit(topFrame); | 1288 | aEmailsEdit = new QLineEdit(topFrame); |
1286 | aEmailsEdit->setEnabled(false); | 1289 | aEmailsEdit->setEnabled(false); |
1287 | topLayout->addWidget(aEmailsEdit,4,1); | 1290 | topLayout->addWidget(aEmailsEdit,4,1); |
1288 | 1291 | ||
1289 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1292 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1290 | topLayout->addWidget(add,5,0); | 1293 | topLayout->addWidget(add,5,0); |
1291 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1294 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1292 | topLayout->addWidget(del,5,1); | 1295 | topLayout->addWidget(del,5,1); |
1293 | 1296 | ||
1294 | //topLayout->setRowStretch(2,1); | 1297 | //topLayout->setRowStretch(2,1); |
1295 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1298 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1296 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1299 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1297 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1300 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1298 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1301 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); |
1299 | #endif | 1302 | #endif |
1300 | } | 1303 | } |
1301 | 1304 | ||
1302 | void KOPrefsDialog::setupGroupAutomationTab() | 1305 | void KOPrefsDialog::setupGroupAutomationTab() |
1303 | { | 1306 | { |
1304 | return; | 1307 | return; |
1305 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1308 | QFrame *topFrame = addPage(i18n("Group Automation"),0, |
1306 | DesktopIcon("personal",KIcon::SizeMedium)); | 1309 | DesktopIcon("personal",KIcon::SizeMedium)); |
1307 | 1310 | ||
1308 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1311 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); |
1309 | topLayout->setSpacing(spacingHint()); | 1312 | topLayout->setSpacing(spacingHint()); |
1310 | topLayout->setMargin(marginHint()); | 1313 | topLayout->setMargin(marginHint()); |
1311 | 1314 | ||
1312 | KPrefsDialogWidRadios *autoRefreshGroup = | 1315 | KPrefsDialogWidRadios *autoRefreshGroup = |
1313 | addWidRadios(i18n("Auto Send Refresh"), | 1316 | addWidRadios(i18n("Auto Send Refresh"), |
1314 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1317 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1315 | autoRefreshGroup->addRadio(i18n("Never")); | 1318 | autoRefreshGroup->addRadio(i18n("Never")); |
1316 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1319 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1317 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1320 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1318 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1321 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1319 | 1322 | ||
1320 | KPrefsDialogWidRadios *autoInsertGroup = | 1323 | KPrefsDialogWidRadios *autoInsertGroup = |
1321 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1324 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1322 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1325 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1323 | autoInsertGroup->addRadio(i18n("Never")); | 1326 | autoInsertGroup->addRadio(i18n("Never")); |
1324 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1327 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1325 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1328 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1326 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1329 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1327 | 1330 | ||
1328 | KPrefsDialogWidRadios *autoRequestGroup = | 1331 | KPrefsDialogWidRadios *autoRequestGroup = |
1329 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1332 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1330 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1333 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1331 | autoRequestGroup->addRadio(i18n("Never")); | 1334 | autoRequestGroup->addRadio(i18n("Never")); |
1332 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1335 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1333 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1336 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1334 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1337 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1335 | 1338 | ||
1336 | KPrefsDialogWidRadios *autoFreeBusyGroup = | 1339 | KPrefsDialogWidRadios *autoFreeBusyGroup = |
1337 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1340 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1338 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1341 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1339 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1342 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1340 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1343 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
1341 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1344 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1342 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | 1345 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); |
1343 | 1346 | ||
1344 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = | 1347 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = |
1345 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | 1348 | addWidRadios(i18n("Auto Save FreeBusy Replies"), |
1346 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | 1349 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); |
1347 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | 1350 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); |
1348 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | 1351 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); |
1349 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1352 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1350 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | 1353 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); |
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | void KOPrefsDialog::showPrinterTab() | 1356 | void KOPrefsDialog::showPrinterTab() |
1354 | { | 1357 | { |
1355 | showPage(pageIndex(mPrinterTab)); | 1358 | showPage(pageIndex(mPrinterTab)); |
1356 | } | 1359 | } |
1357 | 1360 | ||
1358 | 1361 | ||
1359 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | 1362 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, |
1360 | const QStringList *tags) | 1363 | const QStringList *tags) |
1361 | { | 1364 | { |
1362 | if (tags) { | 1365 | if (tags) { |
1363 | int i = tags->findIndex(text); | 1366 | int i = tags->findIndex(text); |
1364 | if (i > 0) combo->setCurrentItem(i); | 1367 | if (i > 0) combo->setCurrentItem(i); |
1365 | } else { | 1368 | } else { |
1366 | for(int i=0;i<combo->count();++i) { | 1369 | for(int i=0;i<combo->count();++i) { |
1367 | if (combo->text(i) == text) { | 1370 | if (combo->text(i) == text) { |
1368 | combo->setCurrentItem(i); | 1371 | combo->setCurrentItem(i); |
1369 | break; | 1372 | break; |
1370 | } | 1373 | } |
1371 | } | 1374 | } |
1372 | } | 1375 | } |
1373 | } | 1376 | } |
1374 | 1377 | ||
1375 | void KOPrefsDialog::usrReadConfig() | 1378 | void KOPrefsDialog::usrReadConfig() |
1376 | { | 1379 | { |
1377 | kdelibcfg->readConfig(); | 1380 | kdelibcfg->readConfig(); |
1378 | mNameEdit->setText(KOPrefs::instance()->fullName()); | 1381 | mNameEdit->setText(KOPrefs::instance()->fullName()); |
1379 | mEmailEdit->setText(KOPrefs::instance()->email()); | 1382 | mEmailEdit->setText(KOPrefs::instance()->email()); |
1380 | 1383 | ||
1381 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | 1384 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); |
1382 | // QDate current ( 2001, 1,1); | 1385 | // QDate current ( 2001, 1,1); |
1383 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1386 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1384 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1387 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1385 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | 1388 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); |
1386 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1389 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1387 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | 1390 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); |
1388 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | 1391 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); |
1389 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | 1392 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); |
1390 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | 1393 | // if (KOPrefs::instance()->mAllDaySize > 47 ) |
1391 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | 1394 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; |
1392 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | 1395 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); |
1393 | 1396 | ||
1394 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | 1397 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); |
1395 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | 1398 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); |
1396 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | 1399 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); |
1397 | // mAMails->clear(); | 1400 | // mAMails->clear(); |
1398 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | 1401 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); |
1399 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | 1402 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { |
1400 | // QListViewItem *item = new QListViewItem(mAMails); | 1403 | // QListViewItem *item = new QListViewItem(mAMails); |
1401 | // item->setText(0,*it); | 1404 | // item->setText(0,*it); |
1402 | // mAMails->insertItem(item); | 1405 | // mAMails->insertItem(item); |
1403 | // } | 1406 | // } |
1404 | 1407 | ||
1405 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | 1408 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); |
1406 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | 1409 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); |
1407 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | 1410 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); |
1408 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | 1411 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); |
1409 | 1412 | ||
1410 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | 1413 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); |
1411 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | 1414 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); |
1412 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1415 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1413 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1416 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1414 | //dummy = KOPrefs::instance()->mUserDateFormatShort; | 1417 | //dummy = KOPrefs::instance()->mUserDateFormatShort; |
1415 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 1418 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
1416 | updateCategories(); | 1419 | updateCategories(); |
1417 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | 1420 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); |
1418 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | 1421 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); |
1419 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | 1422 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); |
1420 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | 1423 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); |
1421 | } | 1424 | } |
1422 | 1425 | ||
1423 | 1426 | ||
1424 | void KOPrefsDialog::usrWriteConfig() | 1427 | void KOPrefsDialog::usrWriteConfig() |
1425 | { | 1428 | { |
1426 | 1429 | ||
1427 | kdelibcfg->writeConfig(); | 1430 | kdelibcfg->writeConfig(); |
1428 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | 1431 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); |
1429 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | 1432 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); |
1430 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | 1433 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); |
1431 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | 1434 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); |
1432 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | 1435 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); |
1433 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | 1436 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); |
1434 | 1437 | ||
1435 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 1438 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
1436 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 1439 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
1437 | KOPrefs::instance()->setFullName(mNameEdit->text()); | 1440 | KOPrefs::instance()->setFullName(mNameEdit->text()); |
1438 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | 1441 | KOPrefs::instance()->setEmail(mEmailEdit->text()); |
1439 | 1442 | ||
1440 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | 1443 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); |
1441 | 1444 | ||
1442 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | 1445 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); |
1443 | //QDate date; | 1446 | //QDate date; |
1444 | //date = mStartDateSavingEdit->date(); | 1447 | //date = mStartDateSavingEdit->date(); |
1445 | //int sub = 0; | 1448 | //int sub = 0; |
1446 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1449 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1447 | // sub = 1; | 1450 | // sub = 1; |
1448 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | 1451 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; |
1449 | // date = mEndDateSavingEdit->date(); | 1452 | // date = mEndDateSavingEdit->date(); |
1450 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 1453 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
1451 | // sub = 1; | 1454 | // sub = 1; |
1452 | // else | 1455 | // else |
1453 | // sub = 0; | 1456 | // sub = 0; |
1454 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | 1457 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; |
1455 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | 1458 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); |
1456 | 1459 | ||
1457 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | 1460 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); |
1458 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | 1461 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); |
1459 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | 1462 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); |
1460 | 1463 | ||
1461 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | 1464 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); |
1462 | 1465 | ||
1463 | QDictIterator<QColor> it(mCategoryDict); | 1466 | QDictIterator<QColor> it(mCategoryDict); |
1464 | while (it.current()) { | 1467 | while (it.current()) { |
1465 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | 1468 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); |
1466 | ++it; | 1469 | ++it; |
1467 | } | 1470 | } |
1468 | 1471 | ||
1469 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | 1472 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); |
1470 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | 1473 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); |
1471 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | 1474 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); |
1472 | 1475 | ||
1473 | KOPrefs::instance()->mAdditionalMails.clear(); | 1476 | KOPrefs::instance()->mAdditionalMails.clear(); |
1474 | // QListViewItem *item; | 1477 | // QListViewItem *item; |
1475 | // item = mAMails->firstChild(); | 1478 | // item = mAMails->firstChild(); |
1476 | // while (item) | 1479 | // while (item) |
1477 | // { | 1480 | // { |
1478 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | 1481 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); |
1479 | // item = item->nextSibling(); | 1482 | // item = item->nextSibling(); |
1480 | // } | 1483 | // } |
1481 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | 1484 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); |
1482 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1485 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1483 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1486 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
1484 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1487 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1485 | 1488 | ||
1486 | } | 1489 | } |
1487 | 1490 | ||
1488 | void KOPrefsDialog::updateCategories() | 1491 | void KOPrefsDialog::updateCategories() |
1489 | { | 1492 | { |
1490 | mCategoryCombo->clear(); | 1493 | mCategoryCombo->clear(); |
1491 | mCategoryDict.clear(); | 1494 | mCategoryDict.clear(); |
1492 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1495 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1493 | updateCategoryColor(); | 1496 | updateCategoryColor(); |
1494 | } | 1497 | } |
1495 | 1498 | ||
1496 | void KOPrefsDialog::warningGroupScheduling() | 1499 | void KOPrefsDialog::warningGroupScheduling() |
1497 | { | 1500 | { |
1498 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | 1501 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); |
1499 | } | 1502 | } |
1500 | 1503 | ||
1501 | void KOPrefsDialog::warningProjectView() | 1504 | void KOPrefsDialog::warningProjectView() |
1502 | { | 1505 | { |
1503 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | 1506 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); |
1504 | } | 1507 | } |
1505 | 1508 | ||
1506 | void KOPrefsDialog::warningExperimental(bool on) | 1509 | void KOPrefsDialog::warningExperimental(bool on) |
1507 | { | 1510 | { |
1508 | if (on) { | 1511 | if (on) { |
1509 | KMessageBox::information(this,i18n("This is an experimental feature. " | 1512 | KMessageBox::information(this,i18n("This is an experimental feature. " |
1510 | "It may not work, it may do nothing useful and it may cause data loss. " | 1513 | "It may not work, it may do nothing useful and it may cause data loss. " |
1511 | "Use with care.\n" | 1514 | "Use with care.\n" |
1512 | "You have to restart KOrganizer for this setting to take effect.")); | 1515 | "You have to restart KOrganizer for this setting to take effect.")); |
1513 | } else { | 1516 | } else { |
1514 | KMessageBox::information(this, | 1517 | KMessageBox::information(this, |
1515 | i18n("You have to restart KOrganizer for this setting to take effect.")); | 1518 | i18n("You have to restart KOrganizer for this setting to take effect.")); |
1516 | } | 1519 | } |
1517 | } | 1520 | } |
1518 | 1521 | ||
1519 | void KOPrefsDialog::toggleEmailSettings(bool on) | 1522 | void KOPrefsDialog::toggleEmailSettings(bool on) |
1520 | { | 1523 | { |
1521 | if (on) { | 1524 | if (on) { |
1522 | mEmailEdit->setEnabled(false); | 1525 | mEmailEdit->setEnabled(false); |
1523 | mNameEdit->setEnabled(false); | 1526 | mNameEdit->setEnabled(false); |
1524 | mEmailLabel->setEnabled(false); | 1527 | mEmailLabel->setEnabled(false); |
1525 | mNameLabel->setEnabled(false); | 1528 | mNameLabel->setEnabled(false); |
1526 | 1529 | ||
1527 | KEMailSettings settings; | 1530 | KEMailSettings settings; |
1528 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | 1531 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); |
1529 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | 1532 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); |
1530 | } else { | 1533 | } else { |
1531 | mEmailEdit->setEnabled(true); | 1534 | mEmailEdit->setEnabled(true); |
1532 | mNameEdit->setEnabled(true); | 1535 | mNameEdit->setEnabled(true); |
1533 | mEmailLabel->setEnabled(true); | 1536 | mEmailLabel->setEnabled(true); |
1534 | mNameLabel->setEnabled(true); | 1537 | mNameLabel->setEnabled(true); |
1535 | } | 1538 | } |
1536 | } | 1539 | } |
1537 | 1540 | ||
1538 | void KOPrefsDialog::addItem() | 1541 | void KOPrefsDialog::addItem() |
1539 | { | 1542 | { |
1540 | // aEmailsEdit->setEnabled(true); | 1543 | // aEmailsEdit->setEnabled(true); |
1541 | // QListViewItem *item = new QListViewItem(mAMails); | 1544 | // QListViewItem *item = new QListViewItem(mAMails); |
1542 | // mAMails->insertItem(item); | 1545 | // mAMails->insertItem(item); |
1543 | // mAMails->setSelected(item,true); | 1546 | // mAMails->setSelected(item,true); |
1544 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | 1547 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); |
1545 | } | 1548 | } |
1546 | 1549 | ||
1547 | void KOPrefsDialog::removeItem() | 1550 | void KOPrefsDialog::removeItem() |
1548 | { | 1551 | { |
1549 | // QListViewItem *item; | 1552 | // QListViewItem *item; |
1550 | // item = mAMails->selectedItem(); | 1553 | // item = mAMails->selectedItem(); |
1551 | // if (!item) return; | 1554 | // if (!item) return; |
1552 | // mAMails->takeItem(item); | 1555 | // mAMails->takeItem(item); |
1553 | // item = mAMails->selectedItem(); | 1556 | // item = mAMails->selectedItem(); |
1554 | // if (!item) { | 1557 | // if (!item) { |
1555 | // aEmailsEdit->setText(""); | 1558 | // aEmailsEdit->setText(""); |
1556 | // aEmailsEdit->setEnabled(false); | 1559 | // aEmailsEdit->setEnabled(false); |
1557 | // } | 1560 | // } |
1558 | // if (mAMails->childCount() == 0) { | 1561 | // if (mAMails->childCount() == 0) { |
1559 | // aEmailsEdit->setEnabled(false); | 1562 | // aEmailsEdit->setEnabled(false); |
1560 | // } | 1563 | // } |
1561 | } | 1564 | } |
1562 | 1565 | ||
1563 | void KOPrefsDialog::updateItem() | 1566 | void KOPrefsDialog::updateItem() |
1564 | { | 1567 | { |
1565 | // QListViewItem *item; | 1568 | // QListViewItem *item; |
1566 | // item = mAMails->selectedItem(); | 1569 | // item = mAMails->selectedItem(); |
1567 | // if (!item) return; | 1570 | // if (!item) return; |
1568 | // item->setText(0,aEmailsEdit->text()); | 1571 | // item->setText(0,aEmailsEdit->text()); |
1569 | } | 1572 | } |
1570 | 1573 | ||
1571 | void KOPrefsDialog::updateInput() | 1574 | void KOPrefsDialog::updateInput() |
1572 | { | 1575 | { |
1573 | // QListViewItem *item; | 1576 | // QListViewItem *item; |
1574 | // item = mAMails->selectedItem(); | 1577 | // item = mAMails->selectedItem(); |
1575 | // if (!item) return; | 1578 | // if (!item) return; |
1576 | // aEmailsEdit->setEnabled(true); | 1579 | // aEmailsEdit->setEnabled(true); |
1577 | // aEmailsEdit->setText(item->text(0)); | 1580 | // aEmailsEdit->setText(item->text(0)); |
1578 | } | 1581 | } |
1579 | void KOPrefsDialog::updateTimezoneOffset( int index ) | 1582 | void KOPrefsDialog::updateTimezoneOffset( int index ) |
1580 | { | 1583 | { |
1581 | /* | 1584 | /* |
1582 | qDebug("updateTimezoneOffset %d ", index); | 1585 | qDebug("updateTimezoneOffset %d ", index); |
1583 | if ( index < 24 ) { | 1586 | if ( index < 24 ) { |
1584 | mTimezoneOffsetSpin->setEnabled ( false ); | 1587 | mTimezoneOffsetSpin->setEnabled ( false ); |
1585 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | 1588 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); |
1586 | 1589 | ||
1587 | 1590 | ||
1588 | } else { | 1591 | } else { |
1589 | if ( index == 24 ) { | 1592 | if ( index == 24 ) { |
1590 | mTimezoneOffsetSpin->setEnabled ( true ); | 1593 | mTimezoneOffsetSpin->setEnabled ( true ); |
1591 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | 1594 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); |
1592 | 1595 | ||
1593 | } else { | 1596 | } else { |
1594 | mTimezoneOffsetSpin->setEnabled ( false ); | 1597 | mTimezoneOffsetSpin->setEnabled ( false ); |
1595 | mTimezoneOffsetSpin->setValue( 0 ); | 1598 | mTimezoneOffsetSpin->setValue( 0 ); |
1596 | } | 1599 | } |
1597 | } | 1600 | } |
1598 | */ | 1601 | */ |
1599 | } | 1602 | } |
1600 | 1603 | ||
1601 | void KOPrefsDialog::setupTimeZoneTab() | 1604 | void KOPrefsDialog::setupTimeZoneTab() |
1602 | { | 1605 | { |
1603 | #if 0 | 1606 | #if 0 |
1604 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | 1607 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); |
1605 | // DesktopIcon("clock",KIcon::SizeMedium)); | 1608 | // DesktopIcon("clock",KIcon::SizeMedium)); |
1606 | 1609 | ||
1607 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1610 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1608 | topLayout->setSpacing(spacingHint()); | 1611 | topLayout->setSpacing(spacingHint()); |
1609 | topLayout->setMargin(marginHint()); | 1612 | topLayout->setMargin(marginHint()); |
1610 | 1613 | ||
1611 | QHBox *timeZoneBox = new QHBox( topFrame ); | 1614 | QHBox *timeZoneBox = new QHBox( topFrame ); |
1612 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 1615 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
1613 | 1616 | ||
1614 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 1617 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
1615 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 1618 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
1616 | if ( QApplication::desktop()->width() < 300 ) { | 1619 | if ( QApplication::desktop()->width() < 300 ) { |
1617 | mTimeZoneCombo->setMaximumWidth(150); | 1620 | mTimeZoneCombo->setMaximumWidth(150); |
1618 | } | 1621 | } |
1619 | 1622 | ||
1620 | QStringList list; | 1623 | QStringList list; |
1621 | list = KGlobal::locale()->timeZoneList(); | 1624 | list = KGlobal::locale()->timeZoneList(); |
1622 | mTimeZoneCombo->insertStringList(list); | 1625 | mTimeZoneCombo->insertStringList(list); |
1623 | 1626 | ||
1624 | // find the currently set time zone and select it | 1627 | // find the currently set time zone and select it |
1625 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | 1628 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; |
1626 | int nCurrentlySet = 11; | 1629 | int nCurrentlySet = 11; |
1627 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 1630 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
1628 | { | 1631 | { |
1629 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 1632 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
1630 | { | 1633 | { |
1631 | nCurrentlySet = i; | 1634 | nCurrentlySet = i; |
1632 | break; | 1635 | break; |
1633 | } | 1636 | } |
1634 | } | 1637 | } |
1635 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 1638 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
1636 | int iii = 1; | 1639 | int iii = 1; |
1637 | KPrefsDialogWidBool *sb = | 1640 | KPrefsDialogWidBool *sb = |
1638 | addWidBool(i18n("Timezone has daylight saving"), | 1641 | addWidBool(i18n("Timezone has daylight saving"), |
1639 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | 1642 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); |
1640 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 1643 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
1641 | ++iii; | 1644 | ++iii; |
1642 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 1645 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
1643 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1646 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1644 | ++iii; | 1647 | ++iii; |
1645 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 1648 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
1646 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 1649 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
1647 | ++iii; | 1650 | ++iii; |
1648 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 1651 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
1649 | topLayout->addWidget(lab, iii,0); | 1652 | topLayout->addWidget(lab, iii,0); |
1650 | mStartDateSavingEdit = new KDateEdit(topFrame); | 1653 | mStartDateSavingEdit = new KDateEdit(topFrame); |
1651 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 1654 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
1652 | ++iii; | 1655 | ++iii; |
1653 | 1656 | ||
1654 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 1657 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
1655 | topLayout->addWidget(lab, iii,0); | 1658 | topLayout->addWidget(lab, iii,0); |
1656 | mEndDateSavingEdit = new KDateEdit(topFrame); | 1659 | mEndDateSavingEdit = new KDateEdit(topFrame); |
1657 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 1660 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
1658 | ++iii; | 1661 | ++iii; |
1659 | QDate current ( 2001, 1,1); | 1662 | QDate current ( 2001, 1,1); |
1660 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | 1663 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); |
1661 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | 1664 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); |
1662 | #endif | 1665 | #endif |
1663 | 1666 | ||
1664 | } | 1667 | } |
1665 | 1668 | ||