summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-09 10:16:08 (UTC)
committer zautrix <zautrix>2005-04-09 10:16:08 (UTC)
commitab7957df1a71a392d71cb898b59a35c32461ec6a (patch) (unidiff)
treef25cfbfdd831f98de0f3a63d63f657064a71f68e
parentd17feddd8fb61dc68c4c3ea57daaee6b8bb4d1fe (diff)
downloadkdepimpi-ab7957df1a71a392d71cb898b59a35c32461ec6a.zip
kdepimpi-ab7957df1a71a392d71cb898b59a35c32461ec6a.tar.gz
kdepimpi-ab7957df1a71a392d71cb898b59a35c32461ec6a.tar.bz2
rec rule dialog fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorrecurrence.cpp83
-rw-r--r--microkde/kdialog.cpp12
2 files changed, 32 insertions, 63 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index bedc75a..bf81b01 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -62,141 +62,148 @@ RecurBase::RecurBase( QWidget *parent, const char *name ) :
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 87
87 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 88 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
88 topLayout->addWidget( preLabel ); 89 topLayout->addWidget( preLabel );
89 90
90 topLayout->addWidget( frequencyEdit() ); 91 topLayout->addWidget( frequencyEdit() );
91 92
92 QLabel *postLabel = new QLabel( i18n("day(s)"), this ); 93 QLabel *postLabel = new QLabel( i18n("day(s)"), this );
93 topLayout->addWidget( postLabel ); 94 topLayout->addWidget( postLabel );
94} 95}
95 96
96 97
97/////////////////////////// RecurWeekly /////////////////////////////// 98/////////////////////////// RecurWeekly ///////////////////////////////
98 99
99RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : 100RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
100 RecurBase( parent, name ) 101 RecurBase( parent, name )
101{ 102{
102 QBoxLayout *topLayout = new QVBoxLayout( this ); 103 QBoxLayout *topLayout = new QVBoxLayout( this );
103 topLayout->setSpacing( KDialog::spacingHint() ); 104 topLayout->setSpacing( KDialog::spacingHint() );
105 topLayout->setMargin( KDialog::marginHintSmall() );
104 106
105 topLayout->addStretch( 1 ); 107 //topLayout->addStretch( 1 );
106 108
107 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); 109 QBoxLayout *weeksLayout = new QHBoxLayout( topLayout );
108 110
109 QLabel *preLabel = new QLabel( i18n("Recur every"), this ); 111 QLabel *preLabel = new QLabel( i18n("Recur every"), this );
110 weeksLayout->addWidget( preLabel ); 112 weeksLayout->addWidget( preLabel );
111 113
112 weeksLayout->addWidget( frequencyEdit() ); 114 weeksLayout->addWidget( frequencyEdit() );
113 115
114 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); 116 QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
115 weeksLayout->addWidget( postLabel ); 117 weeksLayout->addWidget( postLabel );
116 118
117 QHBox *dayBox = new QHBox( this ); 119 QHBox *dayBox = new QHBox( this );
118 topLayout->addWidget( dayBox, 1, AlignVCenter ); 120 topLayout->addWidget( dayBox, 1, AlignVCenter );
119 // TODO: Respect start of week setting 121 // TODO: Respect start of week setting
120 for ( int i = 0; i < 7; ++i ) { 122 for ( int i = 0; i < 7; ++i ) {
121 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); 123 QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
122 if ( KOPrefs::instance()->mCompactDialogs ) { 124 int left = 1;
123 weekDayName = weekDayName.left( 1 ); 125 if ( QApplication::desktop()->width() > 480 ) {
126 ++left;
127 if ( QApplication::desktop()->width() > 640 )
128 ++left;
124 } 129 }
125 mDayBoxes[ i ] = new QCheckBox( weekDayName, dayBox ); 130 mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox );
126 } 131 }
127 132
128 topLayout->addStretch( 1 ); 133 topLayout->addStretch( );
129} 134}
130 135
131void RecurWeekly::setDays( const QBitArray &days ) 136void RecurWeekly::setDays( const QBitArray &days )
132{ 137{
133 for ( int i = 0; i < 7; ++i ) { 138 for ( int i = 0; i < 7; ++i ) {
134 mDayBoxes[ i ]->setChecked( days.testBit( i ) ); 139 mDayBoxes[ i ]->setChecked( days.testBit( i ) );
135 } 140 }
136} 141}
137 142
138QBitArray RecurWeekly::days() 143QBitArray RecurWeekly::days()
139{ 144{
140 QBitArray days( 7 ); 145 QBitArray days( 7 );
141 146
142 for ( int i = 0; i < 7; ++i ) { 147 for ( int i = 0; i < 7; ++i ) {
143 days.setBit( i, mDayBoxes[ i ]->isChecked() ); 148 days.setBit( i, mDayBoxes[ i ]->isChecked() );
144 } 149 }
145 150
146 return days; 151 return days;
147} 152}
148 153
149/////////////////////////// RecurMonthly /////////////////////////////// 154/////////////////////////// RecurMonthly ///////////////////////////////
150 155
151RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : 156RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
152 RecurBase( parent, name ) 157 RecurBase( parent, name )
153{ 158{
154 QBoxLayout *topLayout = new QVBoxLayout( this ); 159 QBoxLayout *topLayout = new QVBoxLayout( this );
155 topLayout->setSpacing( KDialog::spacingHint() ); 160 topLayout->setSpacing( KDialog::spacingHint() );
161 topLayout->setMargin( KDialog::marginHintSmall() );
156 162
157 163
158 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 164 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
159 165
160 QLabel *preLabel = new QLabel( i18n("every"), this ); 166 QLabel *preLabel = new QLabel( i18n("every"), this );
161 freqLayout->addWidget( preLabel ); 167 freqLayout->addWidget( preLabel );
162 168
163 freqLayout->addWidget( frequencyEdit() ); 169 freqLayout->addWidget( frequencyEdit() );
164 170
165 QLabel *postLabel = new QLabel( i18n("month(s)"), this ); 171 QLabel *postLabel = new QLabel( i18n("month(s)"), this );
166 freqLayout->addWidget( postLabel ); 172 freqLayout->addWidget( postLabel );
167 173
168 174
169 QButtonGroup *buttonGroup = new QButtonGroup( this ); 175 QButtonGroup *buttonGroup = new QButtonGroup( this );
170 buttonGroup->setFrameStyle( QFrame::NoFrame ); 176 buttonGroup->setFrameStyle( QFrame::NoFrame );
171 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 177 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
172 178
173 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); 179 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 );
174 buttonLayout->setSpacing( KDialog::spacingHint() ); 180 buttonLayout->setSpacing( KDialog::spacingHint() );
181 buttonLayout->setMargin( KDialog::marginHintSmall() );
175 182
176 183
177 QString recurOnText; 184 QString recurOnText;
178 if ( !KOPrefs::instance()->mCompactDialogs ) { 185 if ( QApplication::desktop()->width() > 320 ) {
179 recurOnText = i18n("Recur on the"); 186 recurOnText = i18n("Recur on the");
180 } 187 }
181 188
182 mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); 189 mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
183 buttonLayout->addWidget( mByDayRadio, 0, 0 ); 190 buttonLayout->addWidget( mByDayRadio, 0, 0 );
184 191
185 mByDayCombo = new QComboBox( buttonGroup ); 192 mByDayCombo = new QComboBox( buttonGroup );
186 mByDayCombo->setSizeLimit( 7 ); 193 mByDayCombo->setSizeLimit( 7 );
187 mByDayCombo->insertItem( i18n("1st") ); 194 mByDayCombo->insertItem( i18n("1st") );
188 mByDayCombo->insertItem( i18n("2nd") ); 195 mByDayCombo->insertItem( i18n("2nd") );
189 mByDayCombo->insertItem( i18n("3rd") ); 196 mByDayCombo->insertItem( i18n("3rd") );
190 mByDayCombo->insertItem( i18n("4th") ); 197 mByDayCombo->insertItem( i18n("4th") );
191 mByDayCombo->insertItem( i18n("5th") ); 198 mByDayCombo->insertItem( i18n("5th") );
192 mByDayCombo->insertItem( i18n("6th") ); 199 mByDayCombo->insertItem( i18n("6th") );
193 mByDayCombo->insertItem( i18n("7th") ); 200 mByDayCombo->insertItem( i18n("7th") );
194 mByDayCombo->insertItem( i18n("8th") ); 201 mByDayCombo->insertItem( i18n("8th") );
195 mByDayCombo->insertItem( i18n("9th") ); 202 mByDayCombo->insertItem( i18n("9th") );
196 mByDayCombo->insertItem( i18n("10th") ); 203 mByDayCombo->insertItem( i18n("10th") );
197 mByDayCombo->insertItem( i18n("11th") ); 204 mByDayCombo->insertItem( i18n("11th") );
198 mByDayCombo->insertItem( i18n("12th") ); 205 mByDayCombo->insertItem( i18n("12th") );
199 mByDayCombo->insertItem( i18n("13th") ); 206 mByDayCombo->insertItem( i18n("13th") );
200 mByDayCombo->insertItem( i18n("14th") ); 207 mByDayCombo->insertItem( i18n("14th") );
201 mByDayCombo->insertItem( i18n("15th") ); 208 mByDayCombo->insertItem( i18n("15th") );
202 mByDayCombo->insertItem( i18n("16th") ); 209 mByDayCombo->insertItem( i18n("16th") );
@@ -267,48 +274,49 @@ bool RecurMonthly::byPos()
267} 274}
268 275
269int RecurMonthly::day() 276int RecurMonthly::day()
270{ 277{
271 return mByDayCombo->currentItem() + 1; 278 return mByDayCombo->currentItem() + 1;
272} 279}
273 280
274int RecurMonthly::count() 281int RecurMonthly::count()
275{ 282{
276 return mByPosCountCombo->currentItem() + 1; 283 return mByPosCountCombo->currentItem() + 1;
277} 284}
278 285
279int RecurMonthly::weekday() 286int RecurMonthly::weekday()
280{ 287{
281 return mByPosWeekdayCombo->currentItem(); 288 return mByPosWeekdayCombo->currentItem();
282} 289}
283 290
284/////////////////////////// RecurYearly /////////////////////////////// 291/////////////////////////// RecurYearly ///////////////////////////////
285 292
286RecurYearly::RecurYearly( QWidget *parent, const char *name ) : 293RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
287 RecurBase( parent, name ) 294 RecurBase( parent, name )
288{ 295{
289 QBoxLayout *topLayout = new QVBoxLayout( this ); 296 QBoxLayout *topLayout = new QVBoxLayout( this );
290 topLayout->setSpacing( KDialog::spacingHint() ); 297 topLayout->setSpacing( KDialog::spacingHint() );
298 topLayout->setMargin( KDialog::marginHintSmall() );
291 299
292 300
293 QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); 301 QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
294 302
295 QLabel *preLabel = new QLabel( i18n("every"), this ); 303 QLabel *preLabel = new QLabel( i18n("every"), this );
296 freqLayout->addWidget( preLabel ); 304 freqLayout->addWidget( preLabel );
297 305
298 freqLayout->addWidget( frequencyEdit() ); 306 freqLayout->addWidget( frequencyEdit() );
299 307
300 QLabel *postLabel = new QLabel( i18n("year(s)"), this ); 308 QLabel *postLabel = new QLabel( i18n("year(s)"), this );
301 freqLayout->addWidget( postLabel ); 309 freqLayout->addWidget( postLabel );
302 310
303 311
304 QButtonGroup *buttonGroup = new QButtonGroup( this ); 312 QButtonGroup *buttonGroup = new QButtonGroup( this );
305 buttonGroup->setFrameStyle( QFrame::NoFrame ); 313 buttonGroup->setFrameStyle( QFrame::NoFrame );
306 topLayout->addWidget( buttonGroup, 1, AlignVCenter ); 314 topLayout->addWidget( buttonGroup, 1, AlignVCenter );
307 315
308 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); 316 QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 );
309 317
310 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); 318 mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
311 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); 319 buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
312 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); 320 mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
313 321
314 buttonLayout->addWidget( mByDayLabel, 0, 1 ); 322 buttonLayout->addWidget( mByDayLabel, 0, 1 );
@@ -484,82 +492,83 @@ void ExceptionsDialog::setDates( const DateList &dates )
484{ 492{
485 mExceptions->setDates( dates ); 493 mExceptions->setDates( dates );
486} 494}
487 495
488DateList ExceptionsDialog::dates() 496DateList ExceptionsDialog::dates()
489{ 497{
490 return mExceptions->dates(); 498 return mExceptions->dates();
491} 499}
492 500
493///////////////////////// RecurrenceRangeWidget /////////////////////////// 501///////////////////////// RecurrenceRangeWidget ///////////////////////////
494 502
495RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
496 const char *name ) 504 const char *name )
497 : QWidget( parent, name ) 505 : QWidget( parent, name )
498{ 506{
499 QBoxLayout *topLayout = new QVBoxLayout( this ); 507 QBoxLayout *topLayout = new QVBoxLayout( this );
500 508
501 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
502 this ); 510 this );
503 topLayout->addWidget( mRangeGroupBox ); 511 topLayout->addWidget( mRangeGroupBox );
504 512
505 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 513 QWidget *rangeBox = new QWidget( mRangeGroupBox );
506 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
507 rangeLayout->setSpacing( KDialog::spacingHint() ); 515 rangeLayout->setSpacing( KDialog::spacingHint() );
516 rangeLayout->setMargin( KDialog::marginHintSmall() );
508 517
509 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
510 rangeLayout->addWidget( mStartDateLabel ); 519 rangeLayout->addWidget( mStartDateLabel );
511 520
512 QButtonGroup *rangeButtonGroup = new QButtonGroup; 521 QButtonGroup *rangeButtonGroup = new QButtonGroup;
513 522
514 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
515 rangeButtonGroup->insert( mNoEndDateButton ); 524 rangeButtonGroup->insert( mNoEndDateButton );
516 rangeLayout->addWidget( mNoEndDateButton ); 525 rangeLayout->addWidget( mNoEndDateButton );
517 526
518 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
519 durationLayout->setSpacing( KDialog::spacingHint() ); 528 durationLayout->setSpacing( KDialog::spacingHint() );
520 529
521 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
522 rangeButtonGroup->insert( mEndDurationButton ); 531 rangeButtonGroup->insert( mEndDurationButton );
523 durationLayout->addWidget( mEndDurationButton ); 532 durationLayout->addWidget( mEndDurationButton );
524 533
525 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
526 durationLayout->addWidget( mEndDurationEdit ); 535 durationLayout->addWidget( mEndDurationEdit );
527 536
528 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
529 durationLayout ->addWidget( endDurationLabel ); 538 durationLayout ->addWidget( endDurationLabel );
530 539
531 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
532 endDateLayout->setSpacing( KDialog::spacingHint() ); 541 endDateLayout->setSpacing( KDialog::spacingHint() );
533 542
534 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
535 rangeButtonGroup->insert( mEndDateButton ); 544 rangeButtonGroup->insert( mEndDateButton );
536 endDateLayout->addWidget( mEndDateButton ); 545 endDateLayout->addWidget( mEndDateButton );
537 546
538 mEndDateEdit = new KDateEdit( rangeBox ); 547 mEndDateEdit = new KDateEdit( rangeBox );
539 endDateLayout->addWidget( mEndDateEdit ); 548 endDateLayout->addWidget( mEndDateEdit );
540 549
541 endDateLayout->addStretch( 1 ); 550 //endDateLayout->addStretch( 1 );
542 551
543 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
544 SLOT( showCurrentRange() ) ); 553 SLOT( showCurrentRange() ) );
545 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
546 SLOT( showCurrentRange() ) ); 555 SLOT( showCurrentRange() ) );
547 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 556 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
548 SLOT( showCurrentRange() ) ); 557 SLOT( showCurrentRange() ) );
549} 558}
550 559
551void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) 560void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
552{ 561{
553 mNoEndDateButton->setChecked( true ); 562 mNoEndDateButton->setChecked( true );
554 563
555 setDateTimes( from ); 564 setDateTimes( from );
556 mEndDateEdit->setDate( from.date() ); 565 mEndDateEdit->setDate( from.date() );
557} 566}
558 567
559void RecurrenceRangeWidget::setDuration( int duration ) 568void RecurrenceRangeWidget::setDuration( int duration )
560{ 569{
561 if ( duration == -1 ) { 570 if ( duration == -1 ) {
562 mNoEndDateButton->setChecked( true ); 571 mNoEndDateButton->setChecked( true );
563 } else if ( duration == 0 ) { 572 } else if ( duration == 0 ) {
564 mEndDateButton->setChecked( true ); 573 mEndDateButton->setChecked( true );
565 } else { 574 } else {
@@ -630,81 +639,60 @@ int RecurrenceRangeDialog::duration()
630 return mRecurrenceRangeWidget->duration(); 639 return mRecurrenceRangeWidget->duration();
631} 640}
632 641
633void RecurrenceRangeDialog::setEndDate( const QDate &date ) 642void RecurrenceRangeDialog::setEndDate( const QDate &date )
634{ 643{
635 mRecurrenceRangeWidget->setEndDate( date ); 644 mRecurrenceRangeWidget->setEndDate( date );
636} 645}
637 646
638QDate RecurrenceRangeDialog::endDate() 647QDate RecurrenceRangeDialog::endDate()
639{ 648{
640 return mRecurrenceRangeWidget->endDate(); 649 return mRecurrenceRangeWidget->endDate();
641} 650}
642 651
643void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, 652void RecurrenceRangeDialog::setDateTimes( const QDateTime &start,
644 const QDateTime &end ) 653 const QDateTime &end )
645{ 654{
646 mRecurrenceRangeWidget->setDateTimes( start, end ); 655 mRecurrenceRangeWidget->setDateTimes( start, end );
647} 656}
648 657
649//////////////////////////// RecurrenceChooser //////////////////////// 658//////////////////////////// RecurrenceChooser ////////////////////////
650 659
651RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : 660RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) :
652 QWidget( parent, name ) 661 QWidget( parent, name )
653{ 662{
654 QBoxLayout *topLayout = new QVBoxLayout( this ); 663 QBoxLayout *topLayout = new QVBoxLayout( this );
655 664
656 if ( KOPrefs::instance()->mCompactDialogs ) {
657 mTypeCombo = new QComboBox( this ); 665 mTypeCombo = new QComboBox( this );
658 mTypeCombo->insertItem( i18n("Daily") ); 666 mTypeCombo->insertItem( i18n("Daily") );
659 mTypeCombo->insertItem( i18n("Weekly") ); 667 mTypeCombo->insertItem( i18n("Weekly") );
660 mTypeCombo->insertItem( i18n("Monthly") ); 668 mTypeCombo->insertItem( i18n("Monthly") );
661 mTypeCombo->insertItem( i18n("Yearly") ); 669 mTypeCombo->insertItem( i18n("Yearly") );
662 670
663 topLayout->addWidget( mTypeCombo ); 671 topLayout->addWidget( mTypeCombo );
664 672
665 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) ); 673 connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) );
666 } else { 674
667 mTypeCombo = 0;
668
669 QButtonGroup *ruleButtonGroup = new QButtonGroup( 1, Horizontal, this );
670 ruleButtonGroup->setFrameStyle( QFrame::NoFrame );
671 topLayout->addWidget( ruleButtonGroup );
672
673 mDailyButton = new QRadioButton( i18n("Daily"), ruleButtonGroup );
674 mWeeklyButton = new QRadioButton( i18n("Weekly"), ruleButtonGroup );
675 mMonthlyButton = new QRadioButton( i18n("Monthly"), ruleButtonGroup );
676 mYearlyButton = new QRadioButton( i18n("Yearly"), ruleButtonGroup );
677
678 connect( mDailyButton, SIGNAL( toggled( bool ) ),
679 SLOT( emitChoice() ) );
680 connect( mWeeklyButton, SIGNAL( toggled( bool ) ),
681 SLOT( emitChoice() ) );
682 connect( mMonthlyButton, SIGNAL( toggled( bool ) ),
683 SLOT( emitChoice() ) );
684 connect( mYearlyButton, SIGNAL( toggled( bool ) ),
685 SLOT( emitChoice() ) );
686 }
687} 675}
688 676
689int RecurrenceChooser::type() 677int RecurrenceChooser::type()
690{ 678{
691 if ( mTypeCombo ) { 679 if ( mTypeCombo ) {
692 return mTypeCombo->currentItem(); 680 return mTypeCombo->currentItem();
693 } else { 681 } else {
694 if ( mDailyButton->isChecked() ) return Daily; 682 if ( mDailyButton->isChecked() ) return Daily;
695 else if ( mWeeklyButton->isChecked() ) return Weekly; 683 else if ( mWeeklyButton->isChecked() ) return Weekly;
696 else if ( mMonthlyButton->isChecked() ) return Monthly; 684 else if ( mMonthlyButton->isChecked() ) return Monthly;
697 else return Yearly; 685 else return Yearly;
698 } 686 }
699} 687}
700 688
701void RecurrenceChooser::setType( int type ) 689void RecurrenceChooser::setType( int type )
702{ 690{
703 if ( mTypeCombo ) { 691 if ( mTypeCombo ) {
704 mTypeCombo->setCurrentItem( type ); 692 mTypeCombo->setCurrentItem( type );
705 } else { 693 } else {
706 switch ( type ) { 694 switch ( type ) {
707 case Daily: 695 case Daily:
708 mDailyButton->setChecked( true ); 696 mDailyButton->setChecked( true );
709 break; 697 break;
710 case Weekly: 698 case Weekly:
@@ -712,144 +700,117 @@ void RecurrenceChooser::setType( int type )
712 break; 700 break;
713 case Monthly: 701 case Monthly:
714 mMonthlyButton->setChecked( true ); 702 mMonthlyButton->setChecked( true );
715 break; 703 break;
716 case Yearly: 704 case Yearly:
717 default: 705 default:
718 mYearlyButton->setChecked( true ); 706 mYearlyButton->setChecked( true );
719 break; 707 break;
720 } 708 }
721 } 709 }
722} 710}
723 711
724void RecurrenceChooser::emitChoice() 712void RecurrenceChooser::emitChoice()
725{ 713{
726 emit chosen ( type() ); 714 emit chosen ( type() );
727} 715}
728 716
729/////////////////////////////// Main Widget ///////////////////////////// 717/////////////////////////////// Main Widget /////////////////////////////
730 718
731KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : 719KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
732 QWidget( parent, name ) 720 QWidget( parent, name )
733{ 721{
734 QGridLayout *topLayout = new QGridLayout( this, 2,2 ); 722 QGridLayout *topLayout = new QGridLayout( this, 2,2 );
735 topLayout->setSpacing( KDialog::spacingHint() ); 723 topLayout->setSpacing( KDialog::spacingHint() );
724 topLayout->setMargin( KDialog::marginHintSmall() );
736 725
737 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); 726 mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
738 connect( mEnabledCheck, SIGNAL( toggled( bool ) ), 727 connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
739 SLOT( setEnabled( bool ) ) ); 728 SLOT( setEnabled( bool ) ) );
740 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); 729 topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
741 730
742 731
743 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "), 732 mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "),
744 this ); 733 this );
745 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); 734 topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
746 735
747 if ( KOPrefs::instance()->mCompactDialogs ) { 736 if ( QApplication::desktop()->width() <= 320) {
748 mTimeGroupBox->hide(); 737 mTimeGroupBox->hide();
749 } 738 }
750 739
751// QFrame *timeFrame = new QFrame( mTimeGroupBox ); 740// QFrame *timeFrame = new QFrame( mTimeGroupBox );
752// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame ); 741// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
753// layoutTimeFrame->setSpacing( KDialog::spacingHint() ); 742// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
754 743
755 mDateTimeLabel = new QLabel( mTimeGroupBox ); 744 mDateTimeLabel = new QLabel( mTimeGroupBox );
756// mDateTimeLabel = new QLabel( timeFrame ); 745// mDateTimeLabel = new QLabel( timeFrame );
757// layoutTimeFrame->addWidget( mDateTimeLabel ); 746// layoutTimeFrame->addWidget( mDateTimeLabel );
758 747
759 Qt::Orientation orientation;
760 if ( KOPrefs::instance()->mCompactDialogs ) orientation = Horizontal;
761 else orientation = Vertical;
762
763 mRuleBox = new QGroupBox( 1, orientation, i18n("Recurrence Rule"), this );
764 if ( KOPrefs::instance()->mCompactDialogs ) {
765 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
766 } else {
767 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
768 }
769 748
749 mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this );
750 topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
770 mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); 751 mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
771 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), 752 connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
772 SLOT( showCurrentRule( int ) ) ); 753 SLOT( showCurrentRule( int ) ) );
773 754
774 if ( !KOPrefs::instance()->mCompactDialogs ) {
775 QFrame *ruleSepFrame = new QFrame( mRuleBox );
776 ruleSepFrame->setFrameStyle( QFrame::VLine | QFrame::Sunken );
777 }
778 755
779 mRuleStack = new QWidgetStack( mRuleBox ); 756 mRuleStack = new QWidgetStack( mRuleBox );
780 757
781 mDaily = new RecurDaily( mRuleStack ); 758 mDaily = new RecurDaily( mRuleStack );
782 mRuleStack->addWidget( mDaily, 0 ); 759 mRuleStack->addWidget( mDaily, 0 );
783 760
784 mWeekly = new RecurWeekly( mRuleStack ); 761 mWeekly = new RecurWeekly( mRuleStack );
785 mRuleStack->addWidget( mWeekly, 0 ); 762 mRuleStack->addWidget( mWeekly, 0 );
786 763
787 mMonthly = new RecurMonthly( mRuleStack ); 764 mMonthly = new RecurMonthly( mRuleStack );
788 mRuleStack->addWidget( mMonthly, 0 ); 765 mRuleStack->addWidget( mMonthly, 0 );
789 766
790 mYearly = new RecurYearly( mRuleStack ); 767 mYearly = new RecurYearly( mRuleStack );
791 mRuleStack->addWidget( mYearly, 0 ); 768 mRuleStack->addWidget( mYearly, 0 );
792 769
793 showCurrentRule( mRecurrenceChooser->type() ); 770 showCurrentRule( mRecurrenceChooser->type() );
794
795 if ( KOPrefs::instance()->mCompactDialogs ) {
796 mRecurrenceRangeWidget = 0; 771 mRecurrenceRangeWidget = 0;
797 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this ); 772 mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
798 mRecurrenceRange = mRecurrenceRangeDialog; 773 mRecurrenceRange = mRecurrenceRangeDialog;
799 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."), 774 mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."),
800 this ); 775 this );
801 776
802 connect( mRecurrenceRangeButton, SIGNAL( clicked() ), 777 connect( mRecurrenceRangeButton, SIGNAL( clicked() ),
803 SLOT( showRecurrenceRangeDialog() ) ); 778 SLOT( showRecurrenceRangeDialog() ) );
804 779
805 mExceptionsWidget = 0; 780 mExceptionsWidget = 0;
806 mExceptionsDialog = new ExceptionsDialog( this ); 781 mExceptionsDialog = new ExceptionsDialog( this );
807 mExceptions = mExceptionsDialog; 782 mExceptions = mExceptionsDialog;
808 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this ); 783 mExceptionsButton = new QPushButton( i18n("Exceptions..."), this );
809 if ( QApplication::desktop()->width() < 320 ) { 784 if ( QApplication::desktop()->width() < 320 ) {
810 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 ); 785 topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 );
811 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 ); 786 topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 );
812 } else { 787 } else {
813 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 ); 788 topLayout->addWidget( mRecurrenceRangeButton, 3, 0 );
814 topLayout->addWidget( mExceptionsButton, 3, 1 ); 789 topLayout->addWidget( mExceptionsButton, 3, 1 );
815 } 790 }
816 connect( mExceptionsButton, SIGNAL( clicked() ), 791 connect( mExceptionsButton, SIGNAL( clicked() ),
817 SLOT( showExceptionsDialog() ) ); 792 SLOT( showExceptionsDialog() ) );
818
819 } else {
820 mRecurrenceRangeWidget = new RecurrenceRangeWidget( this );
821 mRecurrenceRangeDialog = 0;
822 mRecurrenceRange = mRecurrenceRangeWidget;
823 mRecurrenceRangeButton = 0;
824 topLayout->addWidget( mRecurrenceRangeWidget, 3, 0 );
825
826 mExceptionsWidget = new ExceptionsWidget( this );
827 mExceptionsDialog = 0;
828 mExceptions = mExceptionsWidget;
829 mExceptionsButton = 0;
830 topLayout->addWidget( mExceptionsWidget, 3, 1 );
831 }
832} 793}
833 794
834KOEditorRecurrence::~KOEditorRecurrence() 795KOEditorRecurrence::~KOEditorRecurrence()
835{ 796{
836} 797}
837 798
838void KOEditorRecurrence::setEnabled( bool enabled ) 799void KOEditorRecurrence::setEnabled( bool enabled )
839{ 800{
840// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl; 801// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl;
841 802
842 mTimeGroupBox->setEnabled( enabled ); 803 mTimeGroupBox->setEnabled( enabled );
843 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled ); 804 if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled );
844 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled ); 805 if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled );
845 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled ); 806 if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled );
846 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled ); 807 if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled );
847 mRuleBox->setEnabled( enabled ); 808 mRuleBox->setEnabled( enabled );
848} 809}
849 810
850void KOEditorRecurrence::showCurrentRule( int current ) 811void KOEditorRecurrence::showCurrentRule( int current )
851{ 812{
852 switch ( current ) { 813 switch ( current ) {
853 case Daily: 814 case Daily:
854 mRuleStack->raiseWidget( mDaily ); 815 mRuleStack->raiseWidget( mDaily );
855 break; 816 break;
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp
index 3d62cdd..961631e 100644
--- a/microkde/kdialog.cpp
+++ b/microkde/kdialog.cpp
@@ -1,17 +1,25 @@
1 1
2#include <kdialog.h> 2#include <kdialog.h>
3#include <qapp.h> 3#include <qapp.h>
4 4
5 5
6KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : 6KDialog::KDialog( QWidget *parent, const char *name, bool modal ) :
7 QDialog( parent, name, modal ) 7 QDialog( parent, name, modal )
8{ 8{
9 ; 9 ;
10 10
11} 11}
12#ifdef DESKTOP_VERSION
13int KDialog::spacingHint() { return 7; }
14int KDialog::marginHint() { return 7; }
12 15
16int KDialog::spacingHintSmall() { return 4; }
17int KDialog::marginHintSmall() { return 4; }
18
19#else
13int KDialog::spacingHint() { return 3; } 20int KDialog::spacingHint() { return 3; }
14int KDialog::marginHint() { return 3; } 21int KDialog::marginHint() { return 3; }
15 22
16int KDialog::spacingHintSmall() { if (QApplication::desktop()->width() < 700 ) return 1;else return 3; } 23int KDialog::spacingHintSmall() { return 1; }
17int KDialog::marginHintSmall() { if (QApplication::desktop()->width() < 700 ) return 1;else return 3; } 24int KDialog::marginHintSmall() { return 1; }
25#endif