-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 12 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.h | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index 89504db..0e74a99 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -497,87 +497,91 @@ DateList ExceptionsDialog::dates() | |||
497 | { | 497 | { |
498 | return mExceptions->dates(); | 498 | return mExceptions->dates(); |
499 | } | 499 | } |
500 | 500 | ||
501 | ///////////////////////// RecurrenceRangeWidget /////////////////////////// | 501 | ///////////////////////// RecurrenceRangeWidget /////////////////////////// |
502 | 502 | ||
503 | RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, | 503 | RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, |
504 | const char *name ) | 504 | const char *name ) |
505 | : QWidget( parent, name ) | 505 | : QWidget( parent, name ) |
506 | { | 506 | { |
507 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 507 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
508 | 508 | ||
509 | mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), | 509 | mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), |
510 | this ); | 510 | this ); |
511 | topLayout->addWidget( mRangeGroupBox ); | 511 | topLayout->addWidget( mRangeGroupBox ); |
512 | 512 | ||
513 | QWidget *rangeBox = new QWidget( mRangeGroupBox ); | 513 | QWidget *rangeBox = new QWidget( mRangeGroupBox ); |
514 | QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); | 514 | QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); |
515 | rangeLayout->setSpacing( KDialog::spacingHint() ); | 515 | rangeLayout->setSpacing( KDialog::spacingHint() ); |
516 | rangeLayout->setMargin( KDialog::marginHintSmall() ); | 516 | rangeLayout->setMargin( KDialog::marginHintSmall() ); |
517 | 517 | ||
518 | mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); | 518 | mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); |
519 | rangeLayout->addWidget( mStartDateLabel ); | 519 | rangeLayout->addWidget( mStartDateLabel ); |
520 | 520 | ||
521 | QButtonGroup *rangeButtonGroup = new QButtonGroup; | 521 | mRangeButtonGroup = new QButtonGroup; |
522 | 522 | ||
523 | mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); | 523 | mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); |
524 | rangeButtonGroup->insert( mNoEndDateButton ); | 524 | mRangeButtonGroup->insert( mNoEndDateButton ); |
525 | rangeLayout->addWidget( mNoEndDateButton ); | 525 | rangeLayout->addWidget( mNoEndDateButton ); |
526 | 526 | ||
527 | QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); | 527 | QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); |
528 | durationLayout->setSpacing( KDialog::spacingHint() ); | 528 | durationLayout->setSpacing( KDialog::spacingHint() ); |
529 | 529 | ||
530 | mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); | 530 | mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); |
531 | rangeButtonGroup->insert( mEndDurationButton ); | 531 | mRangeButtonGroup->insert( mEndDurationButton ); |
532 | durationLayout->addWidget( mEndDurationButton ); | 532 | durationLayout->addWidget( mEndDurationButton ); |
533 | 533 | ||
534 | mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); | 534 | mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); |
535 | durationLayout->addWidget( mEndDurationEdit ); | 535 | durationLayout->addWidget( mEndDurationEdit ); |
536 | 536 | ||
537 | QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); | 537 | QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); |
538 | durationLayout ->addWidget( endDurationLabel ); | 538 | durationLayout ->addWidget( endDurationLabel ); |
539 | 539 | ||
540 | QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); | 540 | QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); |
541 | endDateLayout->setSpacing( KDialog::spacingHint() ); | 541 | endDateLayout->setSpacing( KDialog::spacingHint() ); |
542 | 542 | ||
543 | mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); | 543 | mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); |
544 | rangeButtonGroup->insert( mEndDateButton ); | 544 | mRangeButtonGroup->insert( mEndDateButton ); |
545 | endDateLayout->addWidget( mEndDateButton ); | 545 | endDateLayout->addWidget( mEndDateButton ); |
546 | 546 | ||
547 | mEndDateEdit = new KDateEdit( rangeBox ); | 547 | mEndDateEdit = new KDateEdit( rangeBox ); |
548 | endDateLayout->addWidget( mEndDateEdit ); | 548 | endDateLayout->addWidget( mEndDateEdit ); |
549 | 549 | ||
550 | //endDateLayout->addStretch( 1 ); | 550 | //endDateLayout->addStretch( 1 ); |
551 | 551 | ||
552 | connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), | 552 | connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), |
553 | SLOT( showCurrentRange() ) ); | 553 | SLOT( showCurrentRange() ) ); |
554 | connect( mEndDurationButton, SIGNAL( toggled( bool ) ), | 554 | connect( mEndDurationButton, SIGNAL( toggled( bool ) ), |
555 | SLOT( showCurrentRange() ) ); | 555 | SLOT( showCurrentRange() ) ); |
556 | connect( mEndDateButton, SIGNAL( toggled( bool ) ), | 556 | connect( mEndDateButton, SIGNAL( toggled( bool ) ), |
557 | SLOT( showCurrentRange() ) ); | 557 | SLOT( showCurrentRange() ) ); |
558 | } | 558 | } |
559 | 559 | ||
560 | RecurrenceRangeWidget::~RecurrenceRangeWidget() | ||
561 | { | ||
562 | delete mRangeButtonGroup; | ||
563 | } | ||
560 | void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) | 564 | void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) |
561 | { | 565 | { |
562 | mNoEndDateButton->setChecked( true ); | 566 | mNoEndDateButton->setChecked( true ); |
563 | 567 | ||
564 | setDateTimes( from ); | 568 | setDateTimes( from ); |
565 | mEndDateEdit->setDate( from.date() ); | 569 | mEndDateEdit->setDate( from.date() ); |
566 | } | 570 | } |
567 | 571 | ||
568 | void RecurrenceRangeWidget::setDuration( int duration ) | 572 | void RecurrenceRangeWidget::setDuration( int duration ) |
569 | { | 573 | { |
570 | if ( duration == -1 ) { | 574 | if ( duration == -1 ) { |
571 | mNoEndDateButton->setChecked( true ); | 575 | mNoEndDateButton->setChecked( true ); |
572 | } else if ( duration == 0 ) { | 576 | } else if ( duration == 0 ) { |
573 | mEndDateButton->setChecked( true ); | 577 | mEndDateButton->setChecked( true ); |
574 | } else { | 578 | } else { |
575 | mEndDurationButton->setChecked( true ); | 579 | mEndDurationButton->setChecked( true ); |
576 | mEndDurationEdit->setValue( duration ); | 580 | mEndDurationEdit->setValue( duration ); |
577 | } | 581 | } |
578 | } | 582 | } |
579 | 583 | ||
580 | int RecurrenceRangeWidget::duration() | 584 | int RecurrenceRangeWidget::duration() |
581 | { | 585 | { |
582 | if ( mNoEndDateButton->isChecked() ) { | 586 | if ( mNoEndDateButton->isChecked() ) { |
583 | return -1; | 587 | return -1; |
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h index f398f62..75e0c73 100644 --- a/korganizer/koeditorrecurrence.h +++ b/korganizer/koeditorrecurrence.h | |||
@@ -12,48 +12,49 @@ | |||
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 _KOEDITORRECURRENCE_H | 23 | #ifndef _KOEDITORRECURRENCE_H |
24 | #define _KOEDITORRECURRENCE_H | 24 | #define _KOEDITORRECURRENCE_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qgroupbox.h> | 30 | #include <qgroupbox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qradiobutton.h> | 35 | #include <qradiobutton.h> |
36 | #include <qbuttongroup.h> | ||
36 | 37 | ||
37 | #include <kdialogbase.h> | 38 | #include <kdialogbase.h> |
38 | 39 | ||
39 | #include <libkcal/event.h> | 40 | #include <libkcal/event.h> |
40 | 41 | ||
41 | #include "ktimeedit.h" | 42 | #include "ktimeedit.h" |
42 | 43 | ||
43 | class QWidgetStack; | 44 | class QWidgetStack; |
44 | class QSpinBox; | 45 | class QSpinBox; |
45 | 46 | ||
46 | class KDateEdit; | 47 | class KDateEdit; |
47 | 48 | ||
48 | using namespace KCal; | 49 | using namespace KCal; |
49 | 50 | ||
50 | class RecurBase : public QWidget | 51 | class RecurBase : public QWidget |
51 | { | 52 | { |
52 | public: | 53 | public: |
53 | RecurBase( QWidget *parent = 0, const char *name = 0 ); | 54 | RecurBase( QWidget *parent = 0, const char *name = 0 ); |
54 | 55 | ||
55 | void setFrequency( int ); | 56 | void setFrequency( int ); |
56 | int frequency(); | 57 | int frequency(); |
57 | 58 | ||
58 | QWidget *frequencyEdit(); | 59 | QWidget *frequencyEdit(); |
59 | 60 | ||
@@ -196,64 +197,66 @@ class ExceptionsDialog : public KDialogBase, public ExceptionsBase | |||
196 | private: | 197 | private: |
197 | ExceptionsWidget *mExceptions; | 198 | ExceptionsWidget *mExceptions; |
198 | }; | 199 | }; |
199 | 200 | ||
200 | class RecurrenceRangeBase | 201 | class RecurrenceRangeBase |
201 | { | 202 | { |
202 | public: | 203 | public: |
203 | virtual void setDefaults( const QDateTime &from ) = 0; | 204 | virtual void setDefaults( const QDateTime &from ) = 0; |
204 | 205 | ||
205 | virtual void setDuration( int ) = 0; | 206 | virtual void setDuration( int ) = 0; |
206 | virtual int duration() = 0; | 207 | virtual int duration() = 0; |
207 | 208 | ||
208 | virtual void setEndDate( const QDate & ) = 0; | 209 | virtual void setEndDate( const QDate & ) = 0; |
209 | virtual QDate endDate() = 0; | 210 | virtual QDate endDate() = 0; |
210 | 211 | ||
211 | virtual void setDateTimes( const QDateTime &start, | 212 | virtual void setDateTimes( const QDateTime &start, |
212 | const QDateTime &end = QDateTime() ) = 0; | 213 | const QDateTime &end = QDateTime() ) = 0; |
213 | }; | 214 | }; |
214 | 215 | ||
215 | class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase | 216 | class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase |
216 | { | 217 | { |
217 | Q_OBJECT | 218 | Q_OBJECT |
218 | public: | 219 | public: |
219 | RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); | 220 | RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); |
221 | ~RecurrenceRangeWidget(); | ||
220 | 222 | ||
221 | void setDefaults( const QDateTime &from ); | 223 | void setDefaults( const QDateTime &from ); |
222 | 224 | ||
223 | void setDuration( int ); | 225 | void setDuration( int ); |
224 | int duration(); | 226 | int duration(); |
225 | 227 | ||
226 | void setEndDate( const QDate & ); | 228 | void setEndDate( const QDate & ); |
227 | QDate endDate(); | 229 | QDate endDate(); |
228 | 230 | ||
229 | void setDateTimes( const QDateTime &start, | 231 | void setDateTimes( const QDateTime &start, |
230 | const QDateTime &end = QDateTime() ); | 232 | const QDateTime &end = QDateTime() ); |
231 | 233 | ||
232 | protected slots: | 234 | protected slots: |
233 | void showCurrentRange(); | 235 | void showCurrentRange(); |
234 | 236 | ||
235 | private: | 237 | private: |
238 | QButtonGroup *mRangeButtonGroup; | ||
236 | QGroupBox *mRangeGroupBox; | 239 | QGroupBox *mRangeGroupBox; |
237 | QLabel *mStartDateLabel; | 240 | QLabel *mStartDateLabel; |
238 | QRadioButton *mNoEndDateButton; | 241 | QRadioButton *mNoEndDateButton; |
239 | QRadioButton *mEndDurationButton; | 242 | QRadioButton *mEndDurationButton; |
240 | QSpinBox *mEndDurationEdit; | 243 | QSpinBox *mEndDurationEdit; |
241 | QRadioButton *mEndDateButton; | 244 | QRadioButton *mEndDateButton; |
242 | KDateEdit *mEndDateEdit; | 245 | KDateEdit *mEndDateEdit; |
243 | }; | 246 | }; |
244 | 247 | ||
245 | class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase | 248 | class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase |
246 | { | 249 | { |
247 | public: | 250 | public: |
248 | RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); | 251 | RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); |
249 | 252 | ||
250 | void setDefaults( const QDateTime &from ); | 253 | void setDefaults( const QDateTime &from ); |
251 | 254 | ||
252 | void setDuration( int ); | 255 | void setDuration( int ); |
253 | int duration(); | 256 | int duration(); |
254 | 257 | ||
255 | void setEndDate( const QDate & ); | 258 | void setEndDate( const QDate & ); |
256 | QDate endDate(); | 259 | QDate endDate(); |
257 | 260 | ||
258 | void setDateTimes( const QDateTime &start, | 261 | void setDateTimes( const QDateTime &start, |
259 | const QDateTime &end = QDateTime() ); | 262 | const QDateTime &end = QDateTime() ); |