summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-22 10:49:00 (UTC)
committer zautrix <zautrix>2005-08-22 10:49:00 (UTC)
commitf516a558e6d18982a54152b28ca3da78fe76e3fc (patch) (unidiff)
tree231fa0bd8fe72db6cdae319def362e07945b1e2c
parent4b60cc60255c64717a2d4011d561c72b6878cdb4 (diff)
downloadkdepimpi-f516a558e6d18982a54152b28ca3da78fe76e3fc.zip
kdepimpi-f516a558e6d18982a54152b28ca3da78fe76e3fc.tar.gz
kdepimpi-f516a558e6d18982a54152b28ca3da78fe76e3fc.tar.bz2
recurrence default fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt1
-rw-r--r--korganizer/koeditorrecurrence.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 37266bf..a864f1d 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,50 +1,51 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.2.3 ************ 3********** VERSION 2.2.3 ************
4 4
5Fixed a problem with (non empty) exception dates of recurring events for newly created events.
5 6
6 7
7********** VERSION 2.2.2 ************ 8********** VERSION 2.2.2 ************
8 9
9KO/Pi: 10KO/Pi:
10Fixed a problem with the sort order of last modified date in list view. 11Fixed a problem with the sort order of last modified date in list view.
11KA/Pi: 12KA/Pi:
12Fixed a resource config read problem on windows. 13Fixed a resource config read problem on windows.
13 14
14 15
15********** VERSION 2.2.1 ************ 16********** VERSION 2.2.1 ************
16 17
17KO/Pi: 18KO/Pi:
18Fixed a problem displaying very long allday events in agenda view in single day mode. 19Fixed a problem displaying very long allday events in agenda view in single day mode.
19Fixed a problem with the default settings for new todos. 20Fixed a problem with the default settings for new todos.
20Added an error message dialog if saving of calendar files is not possible. 21Added an error message dialog if saving of calendar files is not possible.
21Made it impossible to close KO/Pi if saving fails. 22Made it impossible to close KO/Pi if saving fails.
22Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. 23Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick.
23Added config options for conflict detection. 24Added config options for conflict detection.
24 25
25KA/Pi: 26KA/Pi:
26Added a config option to turn on asking before a contact is deleted. 27Added a config option to turn on asking before a contact is deleted.
27Fixed a problem with the default view and view selection at startup. 28Fixed a problem with the default view and view selection at startup.
28Formatted name is now set on import, if formatted name is empty. 29Formatted name is now set on import, if formatted name is empty.
29Fixed a problem of displaying images in the contact details view: 30Fixed a problem of displaying images in the contact details view:
30Now the wid/hei ratio is not changed. 31Now the wid/hei ratio is not changed.
31I a picture is larger than 128 pixels in wid or hei it is downscaled to 32I a picture is larger than 128 pixels in wid or hei it is downscaled to
32max 128 pixels wid/hei. 33max 128 pixels wid/hei.
33 34
34********** VERSION 2.2.0 ************ 35********** VERSION 2.2.0 ************
35 36
36New stable release! 37New stable release!
37Fixed some minor usability problems. 38Fixed some minor usability problems.
38Added writing of next alarm to a file for usage on pdaXrom. 39Added writing of next alarm to a file for usage on pdaXrom.
39 40
40 41
41************************************* 42*************************************
42 43
43You can find the complete changelog 44You can find the complete changelog
44from version 1.7.7 to 2.2.0 45from version 1.7.7 to 2.2.0
45in the source package or on 46in the source package or on
46 47
47http://www.pi-sync.net/html/changelog.html 48http://www.pi-sync.net/html/changelog.html
48 49
49 50
50 51
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 0e74a99..e0380c4 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -44,768 +44,770 @@
44#include <libkcal/event.h> 44#include <libkcal/event.h>
45#include <libkcal/todo.h> 45#include <libkcal/todo.h>
46 46
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50 50
51#include "koeditorrecurrence.h" 51#include "koeditorrecurrence.h"
52 52
53/////////////////////////// RecurBase /////////////////////////////// 53/////////////////////////// RecurBase ///////////////////////////////
54 54
55RecurBase::RecurBase( QWidget *parent, const char *name ) : 55RecurBase::RecurBase( QWidget *parent, const char *name ) :
56 QWidget( parent, name ) 56 QWidget( parent, name )
57{ 57{
58 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this ); 58 mFrequencyEdit = new QSpinBox( 1, 9999, 1, this );
59 mFrequencyEdit->setValue( 1 ); 59 mFrequencyEdit->setValue( 1 );
60} 60}
61 61
62QWidget *RecurBase::frequencyEdit() 62QWidget *RecurBase::frequencyEdit()
63{ 63{
64 return mFrequencyEdit; 64 return mFrequencyEdit;
65} 65}
66 66
67void RecurBase::setFrequency( int f ) 67void RecurBase::setFrequency( int f )
68{ 68{
69 if ( f < 1 ) f = 1; 69 if ( f < 1 ) f = 1;
70 70
71 mFrequencyEdit->setValue( f ); 71 mFrequencyEdit->setValue( f );
72} 72}
73 73
74int RecurBase::frequency() 74int RecurBase::frequency()
75{ 75{
76 return mFrequencyEdit->value(); 76 return mFrequencyEdit->value();
77} 77}
78 78
79/////////////////////////// RecurDaily /////////////////////////////// 79/////////////////////////// RecurDaily ///////////////////////////////
80 80
81RecurDaily::RecurDaily( QWidget *parent, const char *name ) : 81RecurDaily::RecurDaily( QWidget *parent, const char *name ) :
82 RecurBase( parent, name ) 82 RecurBase( parent, name )
83{ 83{
84 QBoxLayout *topLayout = new QHBoxLayout( this ); 84 QBoxLayout *topLayout = new QHBoxLayout( this );
85 topLayout->setSpacing( KDialog::spacingHint() ); 85 topLayout->setSpacing( KDialog::spacingHint() );
86 topLayout->setMargin( KDialog::marginHintSmall() ); 86 topLayout->setMargin( KDialog::marginHintSmall() );
87 87
88 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 88 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
89 topLayout->addWidget( preLabel ); 89 topLayout->addWidget( preLabel );
90 90
91 topLayout->addWidget( frequencyEdit() ); 91 topLayout->addWidget( frequencyEdit() );
92 92
93 QLabel *postLabel = new QLabel( i18n("day(s)"), this ); 93 QLabel *postLabel = new QLabel( i18n("day(s)"), this );
94 topLayout->addWidget( postLabel ); 94 topLayout->addWidget( postLabel );
95} 95}
96 96
97 97
98/////////////////////////// RecurWeekly /////////////////////////////// 98/////////////////////////// RecurWeekly ///////////////////////////////
99 99
100RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : 100RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
101 RecurBase( parent, name ) 101 RecurBase( parent, name )
102{ 102{
103 QBoxLayout *topLayout = new QVBoxLayout( this ); 103 QBoxLayout *topLayout = new QVBoxLayout( this );
104 topLayout->setSpacing( KDialog::spacingHint() ); 104 topLayout->setSpacing( KDialog::spacingHint() );
105 topLayout->setMargin( KDialog::marginHintSmall() ); 105 topLayout->setMargin( KDialog::marginHintSmall() );
106 106
107 //topLayout->addStretch( 1 ); 107 //topLayout->addStretch( 1 );
108 108
109 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); 109 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout );
110 110
111 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 111 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
112 weeksLayout->addWidget( preLabel ); 112 weeksLayout->addWidget( preLabel );
113 113
114 weeksLayout->addWidget( frequencyEdit() ); 114 weeksLayout->addWidget( frequencyEdit() );
115 115
116 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); 116 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
117 weeksLayout->addWidget( postLabel ); 117 weeksLayout->addWidget( postLabel );
118 118
119 QHBox *dayBox = new QHBox( this ); 119 QHBox *dayBox = new QHBox( this );
120 topLayout->addWidget( dayBox, 1, AlignVCenter ); 120 topLayout->addWidget( dayBox, 1, AlignVCenter );
121 // TODO: Respect start of week setting 121 // TODO: Respect start of week setting
122 for ( int i = 0; i < 7; ++i ) { 122 for ( int i = 0; i < 7; ++i ) {
123 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); 123 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
124 int left = 1; 124 int left = 1;
125 if ( QApplication::desktop()->width() > 480 ) { 125 if ( QApplication::desktop()->width() > 480 ) {
126 ++left; 126 ++left;
127 if ( QApplication::desktop()->width() > 640 ) 127 if ( QApplication::desktop()->width() > 640 )
128 ++left; 128 ++left;
129 } 129 }
130 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox ); 130 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox );
131 } 131 }
132 132
133 topLayout->addStretch( ); 133 topLayout->addStretch( );
134} 134}
135 135
136void RecurWeekly::setDays( const QBitArray &days ) 136void RecurWeekly::setDays( const QBitArray &days )
137{ 137{
138 for ( int i = 0; i < 7; ++i ) { 138 for ( int i = 0; i < 7; ++i ) {
139 mDayBoxes[ i ]->setChecked( days.testBit( i ) ); 139 mDayBoxes[ i ]->setChecked( days.testBit( i ) );
140 } 140 }
141} 141}
142 142
143QBitArray RecurWeekly::days() 143QBitArray RecurWeekly::days()
144{ 144{
145 QBitArray days( 7 ); 145 QBitArray days( 7 );
146 146
147 for ( int i = 0; i < 7; ++i ) { 147 for ( int i = 0; i < 7; ++i ) {
148 days.setBit( i, mDayBoxes[ i ]->isChecked() ); 148 days.setBit( i, mDayBoxes[ i ]->isChecked() );
149 } 149 }
150 150
151 return days; 151 return days;
152} 152}
153 153
154/////////////////////////// RecurMonthly /////////////////////////////// 154/////////////////////////// RecurMonthly ///////////////////////////////
155 155
156RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : 156RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
157 RecurBase( parent, name ) 157 RecurBase( parent, name )
158{ 158{
159 QBoxLayout *topLayout = new QVBoxLayout( this ); 159 QBoxLayout *topLayout = new QVBoxLayout( this );
160 topLayout->setSpacing( KDialog::spacingHint() ); 160 topLayout->setSpacing( KDialog::spacingHint() );
161 topLayout->setMargin( KDialog::marginHintSmall() ); 161 topLayout->setMargin( KDialog::marginHintSmall() );
162 162
163 163
164 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 164 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
165 165
166 QLabel *preLabel = new QLabel( i18n("every"), this ); 166 QLabel *preLabel = new QLabel( i18n("every"), this );
167 freqLayout->addWidget( preLabel ); 167 freqLayout->addWidget( preLabel );
168 168
169 freqLayout->addWidget( frequencyEdit() ); 169 freqLayout->addWidget( frequencyEdit() );
170 170
171 QLabel *postLabel = new QLabel( i18n("month(s)"), this ); 171 QLabel *postLabel = new QLabel( i18n("month(s)"), this );
172 freqLayout->addWidget( postLabel ); 172 freqLayout->addWidget( postLabel );
173 173
174 174
175 QButtonGroup *buttonGroup = new QButtonGroup( this ); 175 QButtonGroup *buttonGroup = new QButtonGroup( this );
176 buttonGroup->setFrameStyle( QFrame::NoFrame ); 176 buttonGroup->setFrameStyle( QFrame::NoFrame );
177 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 177 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
178 178
179 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); 179 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 );
180 buttonLayout->setSpacing( KDialog::spacingHint() ); 180 buttonLayout->setSpacing( KDialog::spacingHint() );
181 buttonLayout->setMargin( KDialog::marginHintSmall() ); 181 buttonLayout->setMargin( KDialog::marginHintSmall() );
182 182
183 183
184 QString recurOnText; 184 QString recurOnText;
185 if ( QApplication::desktop()->width() > 320 ) { 185 if ( QApplication::desktop()->width() > 320 ) {
186 recurOnText = i18n("Recur on the"); 186 recurOnText = i18n("Recur on the");
187 } 187 }
188 188
189 mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); 189 mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
190 buttonLayout->addWidget( mByDayRadio, 0, 0 ); 190 buttonLayout->addWidget( mByDayRadio, 0, 0 );
191 191
192 mByDayCombo = new QComboBox( buttonGroup ); 192 mByDayCombo = new QComboBox( buttonGroup );
193 mByDayCombo->setSizeLimit( 7 ); 193 mByDayCombo->setSizeLimit( 7 );
194 mByDayCombo->insertItem( i18n("1st") ); 194 mByDayCombo->insertItem( i18n("1st") );
195 mByDayCombo->insertItem( i18n("2nd") ); 195 mByDayCombo->insertItem( i18n("2nd") );
196 mByDayCombo->insertItem( i18n("3rd") ); 196 mByDayCombo->insertItem( i18n("3rd") );
197 mByDayCombo->insertItem( i18n("4th") ); 197 mByDayCombo->insertItem( i18n("4th") );
198 mByDayCombo->insertItem( i18n("5th") ); 198 mByDayCombo->insertItem( i18n("5th") );
199 mByDayCombo->insertItem( i18n("6th") ); 199 mByDayCombo->insertItem( i18n("6th") );
200 mByDayCombo->insertItem( i18n("7th") ); 200 mByDayCombo->insertItem( i18n("7th") );
201 mByDayCombo->insertItem( i18n("8th") ); 201 mByDayCombo->insertItem( i18n("8th") );
202 mByDayCombo->insertItem( i18n("9th") ); 202 mByDayCombo->insertItem( i18n("9th") );
203 mByDayCombo->insertItem( i18n("10th") ); 203 mByDayCombo->insertItem( i18n("10th") );
204 mByDayCombo->insertItem( i18n("11th") ); 204 mByDayCombo->insertItem( i18n("11th") );
205 mByDayCombo->insertItem( i18n("12th") ); 205 mByDayCombo->insertItem( i18n("12th") );
206 mByDayCombo->insertItem( i18n("13th") ); 206 mByDayCombo->insertItem( i18n("13th") );
207 mByDayCombo->insertItem( i18n("14th") ); 207 mByDayCombo->insertItem( i18n("14th") );
208 mByDayCombo->insertItem( i18n("15th") ); 208 mByDayCombo->insertItem( i18n("15th") );
209 mByDayCombo->insertItem( i18n("16th") ); 209 mByDayCombo->insertItem( i18n("16th") );
210 mByDayCombo->insertItem( i18n("17th") ); 210 mByDayCombo->insertItem( i18n("17th") );
211 mByDayCombo->insertItem( i18n("18th") ); 211 mByDayCombo->insertItem( i18n("18th") );
212 mByDayCombo->insertItem( i18n("19th") ); 212 mByDayCombo->insertItem( i18n("19th") );
213 mByDayCombo->insertItem( i18n("20th") ); 213 mByDayCombo->insertItem( i18n("20th") );
214 mByDayCombo->insertItem( i18n("21st") ); 214 mByDayCombo->insertItem( i18n("21st") );
215 mByDayCombo->insertItem( i18n("22nd") ); 215 mByDayCombo->insertItem( i18n("22nd") );
216 mByDayCombo->insertItem( i18n("23rd") ); 216 mByDayCombo->insertItem( i18n("23rd") );
217 mByDayCombo->insertItem( i18n("24th") ); 217 mByDayCombo->insertItem( i18n("24th") );
218 mByDayCombo->insertItem( i18n("25th") ); 218 mByDayCombo->insertItem( i18n("25th") );
219 mByDayCombo->insertItem( i18n("26th") ); 219 mByDayCombo->insertItem( i18n("26th") );
220 mByDayCombo->insertItem( i18n("27th") ); 220 mByDayCombo->insertItem( i18n("27th") );
221 mByDayCombo->insertItem( i18n("28th") ); 221 mByDayCombo->insertItem( i18n("28th") );
222 mByDayCombo->insertItem( i18n("29th") ); 222 mByDayCombo->insertItem( i18n("29th") );
223 mByDayCombo->insertItem( i18n("30th") ); 223 mByDayCombo->insertItem( i18n("30th") );
224 mByDayCombo->insertItem( i18n("31st") ); 224 mByDayCombo->insertItem( i18n("31st") );
225 buttonLayout->addWidget( mByDayCombo, 0, 1 ); 225 buttonLayout->addWidget( mByDayCombo, 0, 1 );
226 226
227 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup ); 227 QLabel *byDayLabel = new QLabel( i18n("day"), buttonGroup );
228 buttonLayout->addWidget( byDayLabel, 0, 2 ); 228 buttonLayout->addWidget( byDayLabel, 0, 2 );
229 229
230 230
231 mByPosRadio = new QRadioButton( recurOnText, buttonGroup); 231 mByPosRadio = new QRadioButton( recurOnText, buttonGroup);
232 buttonLayout->addWidget( mByPosRadio, 1, 0 ); 232 buttonLayout->addWidget( mByPosRadio, 1, 0 );
233 233
234 mByPosCountCombo = new QComboBox( buttonGroup ); 234 mByPosCountCombo = new QComboBox( buttonGroup );
235 mByPosCountCombo->insertItem( i18n("1st") ); 235 mByPosCountCombo->insertItem( i18n("1st") );
236 mByPosCountCombo->insertItem( i18n("2nd") ); 236 mByPosCountCombo->insertItem( i18n("2nd") );
237 mByPosCountCombo->insertItem( i18n("3rd") ); 237 mByPosCountCombo->insertItem( i18n("3rd") );
238 mByPosCountCombo->insertItem( i18n("4th") ); 238 mByPosCountCombo->insertItem( i18n("4th") );
239 mByPosCountCombo->insertItem( i18n("5th") ); 239 mByPosCountCombo->insertItem( i18n("5th") );
240 buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); 240 buttonLayout->addWidget( mByPosCountCombo, 1, 1 );
241 241
242 mByPosWeekdayCombo = new QComboBox( buttonGroup ); 242 mByPosWeekdayCombo = new QComboBox( buttonGroup );
243 mByPosWeekdayCombo->insertItem( i18n("Monday") ); 243 mByPosWeekdayCombo->insertItem( i18n("Monday") );
244 mByPosWeekdayCombo->insertItem( i18n("Tuesday") ); 244 mByPosWeekdayCombo->insertItem( i18n("Tuesday") );
245 mByPosWeekdayCombo->insertItem( i18n("Wednesday") ); 245 mByPosWeekdayCombo->insertItem( i18n("Wednesday") );
246 mByPosWeekdayCombo->insertItem( i18n("Thursday") ); 246 mByPosWeekdayCombo->insertItem( i18n("Thursday") );
247 mByPosWeekdayCombo->insertItem( i18n("Friday") ); 247 mByPosWeekdayCombo->insertItem( i18n("Friday") );
248 mByPosWeekdayCombo->insertItem( i18n("Saturday") ); 248 mByPosWeekdayCombo->insertItem( i18n("Saturday") );
249 mByPosWeekdayCombo->insertItem( i18n("Sunday") ); 249 mByPosWeekdayCombo->insertItem( i18n("Sunday") );
250 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 ); 250 buttonLayout->addWidget( mByPosWeekdayCombo, 1, 2 );
251} 251}
252 252
253void RecurMonthly::setByDay( int day ) 253void RecurMonthly::setByDay( int day )
254{ 254{
255 mByDayRadio->setChecked( true ); 255 mByDayRadio->setChecked( true );
256 mByDayCombo->setCurrentItem( day ); 256 mByDayCombo->setCurrentItem( day );
257} 257}
258 258
259void RecurMonthly::setByPos( int count, int weekday ) 259void RecurMonthly::setByPos( int count, int weekday )
260{ 260{
261 mByPosRadio->setChecked( true ); 261 mByPosRadio->setChecked( true );
262 mByPosCountCombo->setCurrentItem( count ); 262 mByPosCountCombo->setCurrentItem( count );
263 mByPosWeekdayCombo->setCurrentItem( weekday ); 263 mByPosWeekdayCombo->setCurrentItem( weekday );
264} 264}
265 265
266bool RecurMonthly::byDay() 266bool RecurMonthly::byDay()
267{ 267{
268 return mByDayRadio->isChecked(); 268 return mByDayRadio->isChecked();
269} 269}
270 270
271bool RecurMonthly::byPos() 271bool RecurMonthly::byPos()
272{ 272{
273 return mByPosRadio->isChecked(); 273 return mByPosRadio->isChecked();
274} 274}
275 275
276int RecurMonthly::day() 276int RecurMonthly::day()
277{ 277{
278 return mByDayCombo->currentItem() + 1; 278 return mByDayCombo->currentItem() + 1;
279} 279}
280 280
281int RecurMonthly::count() 281int RecurMonthly::count()
282{ 282{
283 return mByPosCountCombo->currentItem() + 1; 283 return mByPosCountCombo->currentItem() + 1;
284} 284}
285 285
286int RecurMonthly::weekday() 286int RecurMonthly::weekday()
287{ 287{
288 return mByPosWeekdayCombo->currentItem(); 288 return mByPosWeekdayCombo->currentItem();
289} 289}
290 290
291/////////////////////////// RecurYearly /////////////////////////////// 291/////////////////////////// RecurYearly ///////////////////////////////
292 292
293RecurYearly::RecurYearly( QWidget *parent, const char *name ) : 293RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
294 RecurBase( parent, name ) 294 RecurBase( parent, name )
295{ 295{
296 QBoxLayout *topLayout = new QVBoxLayout( this ); 296 QBoxLayout *topLayout = new QVBoxLayout( this );
297 topLayout->setSpacing( KDialog::spacingHint() ); 297 topLayout->setSpacing( KDialog::spacingHint() );
298 topLayout->setMargin( KDialog::marginHintSmall() ); 298 topLayout->setMargin( KDialog::marginHintSmall() );
299 299
300 300
301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
302 302
303 QLabel *preLabel = new QLabel( i18n("every"), this ); 303 QLabel *preLabel = new QLabel( i18n("every"), this );
304 freqLayout->addWidget( preLabel ); 304 freqLayout->addWidget( preLabel );
305 305
306 freqLayout->addWidget( frequencyEdit() ); 306 freqLayout->addWidget( frequencyEdit() );
307 307
308 QLabel *postLabel = new QLabel( i18n("year(s)"), this ); 308 QLabel *postLabel = new QLabel( i18n("year(s)"), this );
309 freqLayout->addWidget( postLabel ); 309 freqLayout->addWidget( postLabel );
310 310
311 311
312 QButtonGroup *buttonGroup = new QButtonGroup( this ); 312 QButtonGroup *buttonGroup = new QButtonGroup( this );
313 buttonGroup->setFrameStyle( QFrame::NoFrame ); 313 buttonGroup->setFrameStyle( QFrame::NoFrame );
314 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 314 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
315 315
316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); 316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 );
317 317
318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); 318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); 319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); 320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
321 321
322 buttonLayout->addWidget( mByDayLabel, 0, 1 ); 322 buttonLayout->addWidget( mByDayLabel, 0, 1 );
323 mByMonthCombo = new QComboBox( buttonGroup ); 323 mByMonthCombo = new QComboBox( buttonGroup );
324 mByMonthCombo->insertItem( i18n("January") ); 324 mByMonthCombo->insertItem( i18n("January") );
325 mByMonthCombo->insertItem( i18n("February") ); 325 mByMonthCombo->insertItem( i18n("February") );
326 mByMonthCombo->insertItem( i18n("March") ); 326 mByMonthCombo->insertItem( i18n("March") );
327 mByMonthCombo->insertItem( i18n("April") ); 327 mByMonthCombo->insertItem( i18n("April") );
328 mByMonthCombo->insertItem( i18n("May") ); 328 mByMonthCombo->insertItem( i18n("May") );
329 mByMonthCombo->insertItem( i18n("June") ); 329 mByMonthCombo->insertItem( i18n("June") );
330 mByMonthCombo->insertItem( i18n("July") ); 330 mByMonthCombo->insertItem( i18n("July") );
331 mByMonthCombo->insertItem( i18n("August") ); 331 mByMonthCombo->insertItem( i18n("August") );
332 mByMonthCombo->insertItem( i18n("September") ); 332 mByMonthCombo->insertItem( i18n("September") );
333 mByMonthCombo->insertItem( i18n("October") ); 333 mByMonthCombo->insertItem( i18n("October") );
334 mByMonthCombo->insertItem( i18n("November") ); 334 mByMonthCombo->insertItem( i18n("November") );
335 mByMonthCombo->insertItem( i18n("December") ); 335 mByMonthCombo->insertItem( i18n("December") );
336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft ); 336 buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft );
337 if ( QApplication::desktop()->width() <= 640 ) { 337 if ( QApplication::desktop()->width() <= 640 ) {
338 mByMonthCombo->setSizeLimit( 6 ); 338 mByMonthCombo->setSizeLimit( 6 );
339 } 339 }
340 340
341 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup); 341 mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup);
342 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight); 342 buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight);
343 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup ); 343 mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup );
344 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 ); 344 buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 );
345 345
346} 346}
347 347
348void RecurYearly::setByDay( int doy ) 348void RecurYearly::setByDay( int doy )
349{ 349{
350 mByDayRadio->setChecked( true ); 350 mByDayRadio->setChecked( true );
351 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) ); 351 mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) );
352} 352}
353 353
354void RecurYearly::setByMonth( int month, int day ) 354void RecurYearly::setByMonth( int month, int day )
355{ 355{
356 mByMonthRadio->setChecked( true ); 356 mByMonthRadio->setChecked( true );
357 mByMonthCombo->setCurrentItem( month - 1 ); 357 mByMonthCombo->setCurrentItem( month - 1 );
358 mByDayLabel->setText(i18n("%1 of ").arg( day ) ); 358 mByDayLabel->setText(i18n("%1 of ").arg( day ) );
359 mDay = day; 359 mDay = day;
360} 360}
361 361
362bool RecurYearly::byMonth() 362bool RecurYearly::byMonth()
363{ 363{
364 return mByMonthRadio->isChecked(); 364 return mByMonthRadio->isChecked();
365} 365}
366 366
367bool RecurYearly::byDay() 367bool RecurYearly::byDay()
368{ 368{
369 return mByDayRadio->isChecked(); 369 return mByDayRadio->isChecked();
370} 370}
371 371
372int RecurYearly::month() 372int RecurYearly::month()
373{ 373{
374 return mByMonthCombo->currentItem() + 1; 374 return mByMonthCombo->currentItem() + 1;
375} 375}
376int RecurYearly::day() 376int RecurYearly::day()
377{ 377{
378 return mDay;//mByDayCombo->currentItem() + 1; 378 return mDay;//mByDayCombo->currentItem() + 1;
379} 379}
380 380
381//////////////////////////// ExceptionsWidget ////////////////////////// 381//////////////////////////// ExceptionsWidget //////////////////////////
382 382
383ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : 383ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) :
384 QWidget( parent, name ) 384 QWidget( parent, name )
385{ 385{
386 QBoxLayout *topLayout = new QVBoxLayout( this ); 386 QBoxLayout *topLayout = new QVBoxLayout( this );
387 387
388 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), 388 QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"),
389 this ); 389 this );
390 topLayout->addWidget( groupBox ); 390 topLayout->addWidget( groupBox );
391 391
392 QWidget *box = new QWidget( groupBox ); 392 QWidget *box = new QWidget( groupBox );
393 393
394 QGridLayout *boxLayout = new QGridLayout( box ); 394 QGridLayout *boxLayout = new QGridLayout( box );
395 395
396 mExceptionDateEdit = new KDateEdit( box ); 396 mExceptionDateEdit = new KDateEdit( box );
397 boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); 397 boxLayout->addWidget( mExceptionDateEdit, 0, 0 );
398 398
399 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); 399 QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box );
400 boxLayout->addWidget( addExceptionButton, 1, 0 ); 400 boxLayout->addWidget( addExceptionButton, 1, 0 );
401 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); 401 QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box );
402 boxLayout->addWidget( changeExceptionButton, 2, 0 ); 402 boxLayout->addWidget( changeExceptionButton, 2, 0 );
403 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); 403 QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box );
404 boxLayout->addWidget( deleteExceptionButton, 3, 0 ); 404 boxLayout->addWidget( deleteExceptionButton, 3, 0 );
405 405
406 mExceptionList = new QListBox( box ); 406 mExceptionList = new QListBox( box );
407 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); 407 boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 );
408 408
409 boxLayout->setRowStretch( 4, 1 ); 409 boxLayout->setRowStretch( 4, 1 );
410 boxLayout->setColStretch( 1, 3 ); 410 boxLayout->setColStretch( 1, 3 );
411 411
412 connect( addExceptionButton, SIGNAL( clicked() ), 412 connect( addExceptionButton, SIGNAL( clicked() ),
413 SLOT( addException() ) ); 413 SLOT( addException() ) );
414 connect( changeExceptionButton, SIGNAL( clicked() ), 414 connect( changeExceptionButton, SIGNAL( clicked() ),
415 SLOT( changeException() ) ); 415 SLOT( changeException() ) );
416 connect( deleteExceptionButton, SIGNAL( clicked() ), 416 connect( deleteExceptionButton, SIGNAL( clicked() ),
417 SLOT( deleteException() ) ); 417 SLOT( deleteException() ) );
418 if ( QApplication::desktop()->width() < 480 ) { 418 if ( QApplication::desktop()->width() < 480 ) {
419 setMinimumWidth( 220 ); 419 setMinimumWidth( 220 );
420 } else { 420 } else {
421 setMinimumWidth( 440 ); 421 setMinimumWidth( 440 );
422 mExceptionDateEdit->setMinimumWidth( 200 ); 422 mExceptionDateEdit->setMinimumWidth( 200 );
423 } 423 }
424} 424}
425 425
426void ExceptionsWidget::setDefaults( const QDateTime &from ) 426void ExceptionsWidget::setDefaults( const QDateTime &from )
427{ 427{
428 mExceptionList->clear();
429 mExceptionDates.clear();
428 mExceptionDateEdit->setDate( from.date() ); 430 mExceptionDateEdit->setDate( from.date() );
429} 431}
430 432
431void ExceptionsWidget::addException() 433void ExceptionsWidget::addException()
432{ 434{
433 QDate date = mExceptionDateEdit->date(); 435 QDate date = mExceptionDateEdit->date();
434 QString dateStr = KGlobal::locale()->formatDate( date ); 436 QString dateStr = KGlobal::locale()->formatDate( date );
435 if( !mExceptionList->findItem( dateStr ) ) { 437 if( !mExceptionList->findItem( dateStr ) ) {
436 mExceptionDates.append( date ); 438 mExceptionDates.append( date );
437 mExceptionList->insertItem( dateStr ); 439 mExceptionList->insertItem( dateStr );
438 } 440 }
439} 441}
440 442
441void ExceptionsWidget::changeException() 443void ExceptionsWidget::changeException()
442{ 444{
443 int pos = mExceptionList->currentItem(); 445 int pos = mExceptionList->currentItem();
444 if ( pos < 0 ) return; 446 if ( pos < 0 ) return;
445 447
446 QDate date = mExceptionDateEdit->date(); 448 QDate date = mExceptionDateEdit->date();
447 mExceptionDates[ pos ] = date; 449 mExceptionDates[ pos ] = date;
448 mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos ); 450 mExceptionList->changeItem( KGlobal::locale()->formatDate( date ), pos );
449} 451}
450 452
451void ExceptionsWidget::deleteException() 453void ExceptionsWidget::deleteException()
452{ 454{
453 int pos = mExceptionList->currentItem(); 455 int pos = mExceptionList->currentItem();
454 if ( pos < 0 ) return; 456 if ( pos < 0 ) return;
455 457
456 mExceptionDates.remove( mExceptionDates.at( pos ) ); 458 mExceptionDates.remove( mExceptionDates.at( pos ) );
457 mExceptionList->removeItem( pos ); 459 mExceptionList->removeItem( pos );
458} 460}
459 461
460void ExceptionsWidget::setDates( const DateList &dates ) 462void ExceptionsWidget::setDates( const DateList &dates )
461{ 463{
462 mExceptionList->clear(); 464 mExceptionList->clear();
463 mExceptionDates.clear(); 465 mExceptionDates.clear();
464 DateList::ConstIterator dit; 466 DateList::ConstIterator dit;
465 for ( dit = dates.begin(); dit != dates.end(); ++dit ) { 467 for ( dit = dates.begin(); dit != dates.end(); ++dit ) {
466 mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) ); 468 mExceptionList->insertItem( KGlobal::locale()->formatDate(* dit ) );
467 mExceptionDates.append( *dit ); 469 mExceptionDates.append( *dit );
468 } 470 }
469} 471}
470 472
471DateList ExceptionsWidget::dates() 473DateList ExceptionsWidget::dates()
472{ 474{
473 return mExceptionDates; 475 return mExceptionDates;
474} 476}
475 477
476///////////////////////// ExceptionsDialog /////////////////////////// 478///////////////////////// ExceptionsDialog ///////////////////////////
477 479
478ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : 480ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) :
479 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) 481 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel )
480{ 482{
481 mExceptions = new ExceptionsWidget( this ); 483 mExceptions = new ExceptionsWidget( this );
482 setMainWidget( mExceptions ); 484 setMainWidget( mExceptions );
483 resize(220,10); 485 resize(220,10);
484} 486}
485 487
486void ExceptionsDialog::setDefaults( const QDateTime &from ) 488void ExceptionsDialog::setDefaults( const QDateTime &from )
487{ 489{
488 mExceptions->setDefaults( from ); 490 mExceptions->setDefaults( from );
489} 491}
490 492
491void ExceptionsDialog::setDates( const DateList &dates ) 493void ExceptionsDialog::setDates( const DateList &dates )
492{ 494{
493 mExceptions->setDates( dates ); 495 mExceptions->setDates( dates );
494} 496}
495 497
496DateList ExceptionsDialog::dates() 498DateList ExceptionsDialog::dates()
497{ 499{
498 return mExceptions->dates(); 500 return mExceptions->dates();
499} 501}
500 502
501///////////////////////// RecurrenceRangeWidget /////////////////////////// 503///////////////////////// RecurrenceRangeWidget ///////////////////////////
502 504
503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 505RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
504 const char *name ) 506 const char *name )
505 : QWidget( parent, name ) 507 : QWidget( parent, name )
506{ 508{
507 QBoxLayout *topLayout = new QVBoxLayout( this ); 509 QBoxLayout *topLayout = new QVBoxLayout( this );
508 510
509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 511 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
510 this ); 512 this );
511 topLayout->addWidget( mRangeGroupBox ); 513 topLayout->addWidget( mRangeGroupBox );
512 514
513 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 515 QWidget *rangeBox = new QWidget( mRangeGroupBox );
514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 516 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
515 rangeLayout->setSpacing( KDialog::spacingHint() ); 517 rangeLayout->setSpacing( KDialog::spacingHint() );
516 rangeLayout->setMargin( KDialog::marginHintSmall() ); 518 rangeLayout->setMargin( KDialog::marginHintSmall() );
517 519
518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 520 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
519 rangeLayout->addWidget( mStartDateLabel ); 521 rangeLayout->addWidget( mStartDateLabel );
520 522
521 mRangeButtonGroup = new QButtonGroup; 523 mRangeButtonGroup = new QButtonGroup;
522 524
523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 525 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
524 mRangeButtonGroup->insert( mNoEndDateButton ); 526 mRangeButtonGroup->insert( mNoEndDateButton );
525 rangeLayout->addWidget( mNoEndDateButton ); 527 rangeLayout->addWidget( mNoEndDateButton );
526 528
527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 529 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
528 durationLayout->setSpacing( KDialog::spacingHint() ); 530 durationLayout->setSpacing( KDialog::spacingHint() );
529 531
530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 532 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
531 mRangeButtonGroup->insert( mEndDurationButton ); 533 mRangeButtonGroup->insert( mEndDurationButton );
532 durationLayout->addWidget( mEndDurationButton ); 534 durationLayout->addWidget( mEndDurationButton );
533 535
534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 536 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
535 durationLayout->addWidget( mEndDurationEdit ); 537 durationLayout->addWidget( mEndDurationEdit );
536 538
537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 539 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
538 durationLayout ->addWidget( endDurationLabel ); 540 durationLayout ->addWidget( endDurationLabel );
539 541
540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 542 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
541 endDateLayout->setSpacing( KDialog::spacingHint() ); 543 endDateLayout->setSpacing( KDialog::spacingHint() );
542 544
543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 545 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
544 mRangeButtonGroup->insert( mEndDateButton ); 546 mRangeButtonGroup->insert( mEndDateButton );
545 endDateLayout->addWidget( mEndDateButton ); 547 endDateLayout->addWidget( mEndDateButton );
546 548
547 mEndDateEdit = new KDateEdit( rangeBox ); 549 mEndDateEdit = new KDateEdit( rangeBox );
548 endDateLayout->addWidget( mEndDateEdit ); 550 endDateLayout->addWidget( mEndDateEdit );
549 551
550 //endDateLayout->addStretch( 1 ); 552 //endDateLayout->addStretch( 1 );
551 553
552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 554 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
553 SLOT( showCurrentRange() ) ); 555 SLOT( showCurrentRange() ) );
554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 556 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
555 SLOT( showCurrentRange() ) ); 557 SLOT( showCurrentRange() ) );
556 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 558 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
557 SLOT( showCurrentRange() ) ); 559 SLOT( showCurrentRange() ) );
558} 560}
559 561
560RecurrenceRangeWidget::~RecurrenceRangeWidget() 562RecurrenceRangeWidget::~RecurrenceRangeWidget()
561{ 563{
562 delete mRangeButtonGroup; 564 delete mRangeButtonGroup;
563} 565}
564void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) 566void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
565{ 567{
566 mNoEndDateButton->setChecked( true ); 568 mNoEndDateButton->setChecked( true );
567 569
568 setDateTimes( from ); 570 setDateTimes( from );
569 mEndDateEdit->setDate( from.date() ); 571 mEndDateEdit->setDate( from.date() );
570} 572}
571 573
572void RecurrenceRangeWidget::setDuration( int duration ) 574void RecurrenceRangeWidget::setDuration( int duration )
573{ 575{
574 if ( duration == -1 ) { 576 if ( duration == -1 ) {
575 mNoEndDateButton->setChecked( true ); 577 mNoEndDateButton->setChecked( true );
576 } else if ( duration == 0 ) { 578 } else if ( duration == 0 ) {
577 mEndDateButton->setChecked( true ); 579 mEndDateButton->setChecked( true );
578 } else { 580 } else {
579 mEndDurationButton->setChecked( true ); 581 mEndDurationButton->setChecked( true );
580 mEndDurationEdit->setValue( duration ); 582 mEndDurationEdit->setValue( duration );
581 } 583 }
582} 584}
583 585
584int RecurrenceRangeWidget::duration() 586int RecurrenceRangeWidget::duration()
585{ 587{
586 if ( mNoEndDateButton->isChecked() ) { 588 if ( mNoEndDateButton->isChecked() ) {
587 return -1; 589 return -1;
588 } else if ( mEndDurationButton->isChecked() ) { 590 } else if ( mEndDurationButton->isChecked() ) {
589 return mEndDurationEdit->value(); 591 return mEndDurationEdit->value();
590 } else { 592 } else {
591 return 0; 593 return 0;
592 } 594 }
593} 595}
594 596
595void RecurrenceRangeWidget::setEndDate( const QDate &date ) 597void RecurrenceRangeWidget::setEndDate( const QDate &date )
596{ 598{
597 mEndDateEdit->setDate( date ); 599 mEndDateEdit->setDate( date );
598} 600}
599 601
600QDate RecurrenceRangeWidget::endDate() 602QDate RecurrenceRangeWidget::endDate()
601{ 603{
602 return mEndDateEdit->date(); 604 return mEndDateEdit->date();
603} 605}
604 606
605void RecurrenceRangeWidget::showCurrentRange() 607void RecurrenceRangeWidget::showCurrentRange()
606{ 608{
607 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); 609 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() );
608 mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); 610 mEndDateEdit->setEnabled( mEndDateButton->isChecked() );
609} 611}
610 612
611void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, 613void RecurrenceRangeWidget::setDateTimes( const QDateTime &start,
612 const QDateTime & ) 614 const QDateTime & )
613{ 615{
614 mStartDateLabel->setText( i18n("Start date: %1") 616 mStartDateLabel->setText( i18n("Start date: %1")
615 .arg( KGlobal::locale()->formatDate( start.date() ) ) ); 617 .arg( KGlobal::locale()->formatDate( start.date() ) ) );
616 618
617 if(!mEndDateButton->isChecked()) 619 if(!mEndDateButton->isChecked())
618 mEndDateEdit->setDate( start.date() ); 620 mEndDateEdit->setDate( start.date() );
619} 621}
620 622
621///////////////////////// RecurrenceRangeDialog /////////////////////////// 623///////////////////////// RecurrenceRangeDialog ///////////////////////////
622 624
623RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent, 625RecurrenceRangeDialog::RecurrenceRangeDialog( QWidget *parent,
624 const char *name ) : 626 const char *name ) :
625 KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel ) 627 KDialogBase( parent, name, true, i18n("Edit Recurrence Range"), Ok|Cancel )
626{ 628{
627 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this ); 629 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this );
628 setMainWidget( mRecurrenceRangeWidget ); 630 setMainWidget( mRecurrenceRangeWidget );
629} 631}
630 632
631void RecurrenceRangeDialog::setDefaults( const QDateTime &from ) 633void RecurrenceRangeDialog::setDefaults( const QDateTime &from )
632{ 634{
633 mRecurrenceRangeWidget->setDefaults( from ); 635 mRecurrenceRangeWidget->setDefaults( from );
634} 636}
635 637
636void RecurrenceRangeDialog::setDuration( int duration ) 638void RecurrenceRangeDialog::setDuration( int duration )
637{ 639{
638 mRecurrenceRangeWidget->setDuration( duration ); 640 mRecurrenceRangeWidget->setDuration( duration );
639} 641}
640 642
641int RecurrenceRangeDialog::duration() 643int RecurrenceRangeDialog::duration()
642{ 644{
643 return mRecurrenceRangeWidget->duration(); 645 return mRecurrenceRangeWidget->duration();
644} 646}
645 647
646void RecurrenceRangeDialog::setEndDate( const QDate &date ) 648void RecurrenceRangeDialog::setEndDate( const QDate &date )
647{ 649{
648 mRecurrenceRangeWidget->setEndDate( date ); 650 mRecurrenceRangeWidget->setEndDate( date );
649} 651}
650 652
651QDate RecurrenceRangeDialog::endDate() 653QDate RecurrenceRangeDialog::endDate()
652{ 654{
653 return mRecurrenceRangeWidget->endDate(); 655 return mRecurrenceRangeWidget->endDate();
654} 656}
655 657
656void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, 658void RecurrenceRangeDialog::setDateTimes( const QDateTime &start,
657 const QDateTime &end ) 659 const QDateTime &end )
658{ 660{
659 mRecurrenceRangeWidget->setDateTimes( start, end ); 661 mRecurrenceRangeWidget->setDateTimes( start, end );
660} 662}
661 663
662//////////////////////////// RecurrenceChooser //////////////////////// 664//////////////////////////// RecurrenceChooser ////////////////////////
663 665
664RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : 666RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) :
665 QWidget( parent, name ) 667 QWidget( parent, name )
666{ 668{
667 QBoxLayout *topLayout = new QVBoxLayout( this ); 669 QBoxLayout *topLayout = new QVBoxLayout( this );
668 670
669 mTypeCombo = new QComboBox( this ); 671 mTypeCombo = new QComboBox( this );
670 mTypeCombo->insertItem( i18n("Daily") ); 672 mTypeCombo->insertItem( i18n("Daily") );
671 mTypeCombo->insertItem( i18n("Weekly") ); 673 mTypeCombo->insertItem( i18n("Weekly") );
672 mTypeCombo->insertItem( i18n("Monthly") ); 674 mTypeCombo->insertItem( i18n("Monthly") );
673 mTypeCombo->insertItem( i18n("Yearly") ); 675 mTypeCombo->insertItem( i18n("Yearly") );
674 676
675 topLayout->addWidget( mTypeCombo ); 677 topLayout->addWidget( mTypeCombo );
676 678
677 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); 679 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) );
678 680
679} 681}
680 682
681int RecurrenceChooser::type() 683int RecurrenceChooser::type()
682{ 684{
683 if ( mTypeCombo ) { 685 if ( mTypeCombo ) {
684 return mTypeCombo->currentItem(); 686 return mTypeCombo->currentItem();
685 } else { 687 } else {
686 if ( mDailyButton->isChecked() ) return Daily; 688 if ( mDailyButton->isChecked() ) return Daily;
687 else if ( mWeeklyButton->isChecked() ) return Weekly; 689 else if ( mWeeklyButton->isChecked() ) return Weekly;
688 else if ( mMonthlyButton->isChecked() ) return Monthly; 690 else if ( mMonthlyButton->isChecked() ) return Monthly;
689 else return Yearly; 691 else return Yearly;
690 } 692 }
691} 693}
692 694
693void RecurrenceChooser::setType( int type ) 695void RecurrenceChooser::setType( int type )
694{ 696{
695 if ( mTypeCombo ) { 697 if ( mTypeCombo ) {
696 mTypeCombo->setCurrentItem( type ); 698 mTypeCombo->setCurrentItem( type );
697 } else { 699 } else {
698 switch ( type ) { 700 switch ( type ) {
699 case Daily: 701 case Daily:
700 mDailyButton->setChecked( true ); 702 mDailyButton->setChecked( true );
701 break; 703 break;
702 case Weekly: 704 case Weekly:
703 mWeeklyButton->setChecked( true ); 705 mWeeklyButton->setChecked( true );
704 break; 706 break;
705 case Monthly: 707 case Monthly:
706 mMonthlyButton->setChecked( true ); 708 mMonthlyButton->setChecked( true );
707 break; 709 break;
708 case Yearly: 710 case Yearly:
709 default: 711 default:
710 mYearlyButton->setChecked( true ); 712 mYearlyButton->setChecked( true );
711 break; 713 break;
712 } 714 }
713 } 715 }
714} 716}
715 717
716void RecurrenceChooser::emitChoice() 718void RecurrenceChooser::emitChoice()
717{ 719{
718 emit chosen ( type() ); 720 emit chosen ( type() );
719} 721}
720 722
721/////////////////////////////// Main Widget ///////////////////////////// 723/////////////////////////////// Main Widget /////////////////////////////
722 724
723KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : 725KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
724 QWidget( parent, name ) 726 QWidget( parent, name )
725{ 727{
726 QGridLayout *topLayout = new QGridLayout( this, 2,2 ); 728 QGridLayout *topLayout = new QGridLayout( this, 2,2 );
727 topLayout->setSpacing( KDialog::spacingHint() ); 729 topLayout->setSpacing( KDialog::spacingHint() );
728 topLayout->setMargin( KDialog::marginHintSmall() ); 730 topLayout->setMargin( KDialog::marginHintSmall() );
729 731
730 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); 732 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
731 connect( mEnabledCheck, SIGNAL( toggled( bool ) ), 733 connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
732 SLOT( setEnabled( bool ) ) ); 734 SLOT( setEnabled( bool ) ) );
733 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); 735 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
734 736
735 737
736 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"), 738 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"),
737 this ); 739 this );
738 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); 740 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
739 741
740 if ( QApplication::desktop()->width() <= 640 ) { 742 if ( QApplication::desktop()->width() <= 640 ) {
741 mTimeGroupBox->hide(); 743 mTimeGroupBox->hide();
742 } 744 }
743 745
744// QFrame *timeFrame = new QFrame( mTimeGroupBox ); 746// QFrame *timeFrame = new QFrame( mTimeGroupBox );
745// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); 747// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
746// layoutTimeFrame->setSpacing( KDialog::spacingHint() ); 748// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
747 749
748 mDateTimeLabel = new QLabel( mTimeGroupBox ); 750 mDateTimeLabel = new QLabel( mTimeGroupBox );
749// mDateTimeLabel = new QLabel( timeFrame ); 751// mDateTimeLabel = new QLabel( timeFrame );
750// layoutTimeFrame->addWidget( mDateTimeLabel ); 752// layoutTimeFrame->addWidget( mDateTimeLabel );
751 //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); 753 //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
752 //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) ); 754 //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) );
753 mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); 755 mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this );
754 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); 756 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
755 mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); 757 mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
756 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), 758 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
757 SLOT( showCurrentRule( int ) ) ); 759 SLOT( showCurrentRule( int ) ) );
758 760
759 761
760 mRuleStack = new QWidgetStack( mRuleBox ); 762 mRuleStack = new QWidgetStack( mRuleBox );
761 763
762 mDaily = new RecurDaily( mRuleStack ); 764 mDaily = new RecurDaily( mRuleStack );
763 mRuleStack->addWidget( mDaily, 0 ); 765 mRuleStack->addWidget( mDaily, 0 );
764 766
765 mWeekly = new RecurWeekly( mRuleStack ); 767 mWeekly = new RecurWeekly( mRuleStack );
766 mRuleStack->addWidget( mWeekly, 0 ); 768 mRuleStack->addWidget( mWeekly, 0 );
767 769
768 mMonthly = new RecurMonthly( mRuleStack ); 770 mMonthly = new RecurMonthly( mRuleStack );
769 mRuleStack->addWidget( mMonthly, 0 ); 771 mRuleStack->addWidget( mMonthly, 0 );
770 772
771 mYearly = new RecurYearly( mRuleStack ); 773 mYearly = new RecurYearly( mRuleStack );
772 mRuleStack->addWidget( mYearly, 0 ); 774 mRuleStack->addWidget( mYearly, 0 );
773 775
774 showCurrentRule( mRecurrenceChooser->type() ); 776 showCurrentRule( mRecurrenceChooser->type() );
775 mRecurrenceRangeWidget = 0; 777 mRecurrenceRangeWidget = 0;
776 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); 778 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
777 mRecurrenceRange = mRecurrenceRangeDialog; 779 mRecurrenceRange = mRecurrenceRangeDialog;
778 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), 780 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."),
779 this ); 781 this );
780 782
781 connect( mRecurrenceRangeButton, SIGNAL( clicked() ), 783 connect( mRecurrenceRangeButton, SIGNAL( clicked() ),
782 SLOT( showRecurrenceRangeDialog() ) ); 784 SLOT( showRecurrenceRangeDialog() ) );
783 785
784 mExceptionsWidget = 0; 786 mExceptionsWidget = 0;
785 mExceptionsDialog = new ExceptionsDialog( this ); 787 mExceptionsDialog = new ExceptionsDialog( this );
786 mExceptions = mExceptionsDialog; 788 mExceptions = mExceptionsDialog;
787 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); 789 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this );
788 if ( QApplication::desktop()->width() < 320 ) { 790 if ( QApplication::desktop()->width() < 320 ) {
789 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); 791 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 );
790 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); 792 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 );
791 } else { 793 } else {
792 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); 794 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 );
793 topLayout->addWidget( mExceptionsButton, 3, 1 ); 795 topLayout->addWidget( mExceptionsButton, 3, 1 );
794 } 796 }
795 connect( mExceptionsButton, SIGNAL( clicked() ), 797 connect( mExceptionsButton, SIGNAL( clicked() ),
796 SLOT( showExceptionsDialog() ) ); 798 SLOT( showExceptionsDialog() ) );
797} 799}
798 800
799KOEditorRecurrence::~KOEditorRecurrence() 801KOEditorRecurrence::~KOEditorRecurrence()
800{ 802{
801} 803}
802 804
803void KOEditorRecurrence::setEnabled( bool enabled ) 805void KOEditorRecurrence::setEnabled( bool enabled )
804{ 806{
805// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; 807// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl;
806 808
807 mTimeGroupBox->setEnabled( enabled ); 809 mTimeGroupBox->setEnabled( enabled );
808 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); 810 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled );
809 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); 811 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled );
810 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); 812 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled );
811 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); 813 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled );