Diffstat (limited to 'korganizer/koeditorrecurrence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index e0380c4..e0ae3a0 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -19,23 +19,31 @@ As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> -#include <qfiledialog.h> +#include <q3filedialog.h> #include <qlayout.h> -#include <qvbox.h> -#include <qbuttongroup.h> -#include <qvgroupbox.h> -#include <qwidgetstack.h> +#include <q3vbox.h> +#include <q3buttongroup.h> +#include <q3vgroupbox.h> +#include <q3widgetstack.h> #include <qdatetime.h> -#include <qlistbox.h> +#include <q3listbox.h> #include <qspinbox.h> #include <qcheckbox.h> #include <qapplication.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <Q3HBoxLayout> +#include <QLabel> +#include <Q3GridLayout> +#include <Q3PtrList> +#include <Q3Frame> +#include <Q3VBoxLayout> #include <kdialog.h> #include <kglobal.h> #include <klocale.h> #include <kiconloader.h> #include <kdebug.h> @@ -78,13 +86,13 @@ int RecurBase::frequency() /////////////////////////// RecurDaily /////////////////////////////// RecurDaily::RecurDaily( QWidget *parent, const char *name ) : RecurBase( parent, name ) { - QBoxLayout *topLayout = new QHBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3HBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( KDialog::marginHintSmall() ); QLabel *preLabel = new QLabel( i18n("Recur every"), this ); topLayout->addWidget( preLabel ); @@ -97,30 +105,30 @@ RecurDaily::RecurDaily( QWidget *parent, const char *name ) : /////////////////////////// RecurWeekly /////////////////////////////// RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) : RecurBase( parent, name ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( KDialog::marginHintSmall() ); //topLayout->addStretch( 1 ); - QBoxLayout *weeksLayout = new QHBoxLayout( topLayout ); + Q3BoxLayout *weeksLayout = new Q3HBoxLayout( topLayout ); QLabel *preLabel = new QLabel( i18n("Recur every"), this ); weeksLayout->addWidget( preLabel ); weeksLayout->addWidget( frequencyEdit() ); QLabel *postLabel = new QLabel( i18n("week(s) on:"), this ); weeksLayout->addWidget( postLabel ); - QHBox *dayBox = new QHBox( this ); - topLayout->addWidget( dayBox, 1, AlignVCenter ); + Q3HBox *dayBox = new Q3HBox( this ); + topLayout->addWidget( dayBox, 1, Qt::AlignVCenter ); // TODO: Respect start of week setting for ( int i = 0; i < 7; ++i ) { QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true ); int left = 1; if ( QApplication::desktop()->width() > 480 ) { ++left; @@ -153,46 +161,46 @@ QBitArray RecurWeekly::days() /////////////////////////// RecurMonthly /////////////////////////////// RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) : RecurBase( parent, name ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( KDialog::marginHintSmall() ); - QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); + Q3BoxLayout *freqLayout = new Q3HBoxLayout( topLayout ); QLabel *preLabel = new QLabel( i18n("every"), this ); freqLayout->addWidget( preLabel ); freqLayout->addWidget( frequencyEdit() ); QLabel *postLabel = new QLabel( i18n("month(s)"), this ); freqLayout->addWidget( postLabel ); - QButtonGroup *buttonGroup = new QButtonGroup( this ); - buttonGroup->setFrameStyle( QFrame::NoFrame ); - topLayout->addWidget( buttonGroup, 1, AlignVCenter ); + Q3ButtonGroup *buttonGroup = new Q3ButtonGroup( this ); + buttonGroup->setFrameStyle( Q3Frame::NoFrame ); + topLayout->addWidget( buttonGroup, 1, Qt::AlignVCenter ); - QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 ); + Q3GridLayout *buttonLayout = new Q3GridLayout( buttonGroup, 3, 2 ); buttonLayout->setSpacing( KDialog::spacingHint() ); buttonLayout->setMargin( KDialog::marginHintSmall() ); QString recurOnText; if ( QApplication::desktop()->width() > 320 ) { recurOnText = i18n("Recur on the"); } mByDayRadio = new QRadioButton( recurOnText, buttonGroup ); buttonLayout->addWidget( mByDayRadio, 0, 0 ); - mByDayCombo = new QComboBox( buttonGroup ); + mByDayCombo = new Q3ComboBox( buttonGroup ); mByDayCombo->setSizeLimit( 7 ); mByDayCombo->insertItem( i18n("1st") ); mByDayCombo->insertItem( i18n("2nd") ); mByDayCombo->insertItem( i18n("3rd") ); mByDayCombo->insertItem( i18n("4th") ); mByDayCombo->insertItem( i18n("5th") ); @@ -290,40 +298,40 @@ int RecurMonthly::weekday() /////////////////////////// RecurYearly /////////////////////////////// RecurYearly::RecurYearly( QWidget *parent, const char *name ) : RecurBase( parent, name ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( KDialog::marginHintSmall() ); - QBoxLayout *freqLayout = new QHBoxLayout( topLayout ); + Q3BoxLayout *freqLayout = new Q3HBoxLayout( topLayout ); QLabel *preLabel = new QLabel( i18n("every"), this ); freqLayout->addWidget( preLabel ); freqLayout->addWidget( frequencyEdit() ); QLabel *postLabel = new QLabel( i18n("year(s)"), this ); freqLayout->addWidget( postLabel ); - QButtonGroup *buttonGroup = new QButtonGroup( this ); - buttonGroup->setFrameStyle( QFrame::NoFrame ); - topLayout->addWidget( buttonGroup, 1, AlignVCenter ); + Q3ButtonGroup *buttonGroup = new Q3ButtonGroup( this ); + buttonGroup->setFrameStyle( Q3Frame::NoFrame ); + topLayout->addWidget( buttonGroup, 1, Qt::AlignVCenter ); - QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 ); + Q3GridLayout *buttonLayout = new Q3GridLayout( buttonGroup, 2, 3 ); mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup); buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight); mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup ); buttonLayout->addWidget( mByDayLabel, 0, 1 ); - mByMonthCombo = new QComboBox( buttonGroup ); + mByMonthCombo = new Q3ComboBox( buttonGroup ); mByMonthCombo->insertItem( i18n("January") ); mByMonthCombo->insertItem( i18n("February") ); mByMonthCombo->insertItem( i18n("March") ); mByMonthCombo->insertItem( i18n("April") ); mByMonthCombo->insertItem( i18n("May") ); mByMonthCombo->insertItem( i18n("June") ); @@ -380,33 +388,33 @@ int RecurYearly::day() //////////////////////////// ExceptionsWidget ////////////////////////// ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); - QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"), + Q3GroupBox *groupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Exceptions"), this ); topLayout->addWidget( groupBox ); QWidget *box = new QWidget( groupBox ); - QGridLayout *boxLayout = new QGridLayout( box ); + Q3GridLayout *boxLayout = new Q3GridLayout( box ); mExceptionDateEdit = new KDateEdit( box ); boxLayout->addWidget( mExceptionDateEdit, 0, 0 ); QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box ); boxLayout->addWidget( addExceptionButton, 1, 0 ); QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box ); boxLayout->addWidget( changeExceptionButton, 2, 0 ); QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box ); boxLayout->addWidget( deleteExceptionButton, 3, 0 ); - mExceptionList = new QListBox( box ); + mExceptionList = new Q3ListBox( box ); boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 ); boxLayout->setRowStretch( 4, 1 ); boxLayout->setColStretch( 1, 3 ); connect( addExceptionButton, SIGNAL( clicked() ), @@ -503,46 +511,46 @@ DateList ExceptionsDialog::dates() ///////////////////////// RecurrenceRangeWidget /////////////////////////// RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); - mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), + mRangeGroupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Recurrence Range"), this ); topLayout->addWidget( mRangeGroupBox ); QWidget *rangeBox = new QWidget( mRangeGroupBox ); - QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); + Q3VBoxLayout *rangeLayout = new Q3VBoxLayout( rangeBox ); rangeLayout->setSpacing( KDialog::spacingHint() ); rangeLayout->setMargin( KDialog::marginHintSmall() ); mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); rangeLayout->addWidget( mStartDateLabel ); - mRangeButtonGroup = new QButtonGroup; + mRangeButtonGroup = new Q3ButtonGroup; mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); mRangeButtonGroup->insert( mNoEndDateButton ); rangeLayout->addWidget( mNoEndDateButton ); - QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); + Q3BoxLayout *durationLayout = new Q3HBoxLayout( rangeLayout ); durationLayout->setSpacing( KDialog::spacingHint() ); mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); mRangeButtonGroup->insert( mEndDurationButton ); durationLayout->addWidget( mEndDurationButton ); mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); durationLayout->addWidget( mEndDurationEdit ); QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); durationLayout ->addWidget( endDurationLabel ); - QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); + Q3BoxLayout *endDateLayout = new Q3HBoxLayout( rangeLayout ); endDateLayout->setSpacing( KDialog::spacingHint() ); mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); mRangeButtonGroup->insert( mEndDateButton ); endDateLayout->addWidget( mEndDateButton ); @@ -663,13 +671,13 @@ void RecurrenceRangeDialog::setDateTimes( const QDateTime &start, //////////////////////////// RecurrenceChooser //////////////////////// RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) : QWidget( parent, name ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); + Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); mTypeCombo = new QComboBox( this ); mTypeCombo->insertItem( i18n("Daily") ); mTypeCombo->insertItem( i18n("Weekly") ); mTypeCombo->insertItem( i18n("Monthly") ); mTypeCombo->insertItem( i18n("Yearly") ); @@ -722,23 +730,23 @@ void RecurrenceChooser::emitChoice() /////////////////////////////// Main Widget ///////////////////////////// KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : QWidget( parent, name ) { - QGridLayout *topLayout = new QGridLayout( this, 2,2 ); + Q3GridLayout *topLayout = new Q3GridLayout( this, 2,2 ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( KDialog::marginHintSmall() ); mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this ); connect( mEnabledCheck, SIGNAL( toggled( bool ) ), SLOT( setEnabled( bool ) ) ); topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 ); - mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"), + mTimeGroupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Time"), this ); topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 ); if ( QApplication::desktop()->width() <= 640 ) { mTimeGroupBox->hide(); } @@ -749,20 +757,20 @@ KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) : mDateTimeLabel = new QLabel( mTimeGroupBox ); // mDateTimeLabel = new QLabel( timeFrame ); // layoutTimeFrame->addWidget( mDateTimeLabel ); //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) ); - mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this ); + mRuleBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Recurrence Rule"), this ); topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 ); mRecurrenceChooser = new RecurrenceChooser( mRuleBox ); connect( mRecurrenceChooser, SIGNAL( chosen( int ) ), SLOT( showCurrentRule( int ) ) ); - mRuleStack = new QWidgetStack( mRuleBox ); + mRuleStack = new Q3WidgetStack( mRuleBox ); mDaily = new RecurDaily( mRuleStack ); mRuleStack->addWidget( mDaily, 0 ); mWeekly = new RecurWeekly( mRuleStack ); mRuleStack->addWidget( mWeekly, 0 ); @@ -893,14 +901,14 @@ void KOEditorRecurrence::readEvent(Incidence *event) dtEnd = ((Event*)event)->dtEnd(); else dtEnd = ((Todo*)event)->dtDue(); setDefaults( event->dtStart(), dtEnd ); QBitArray rDays( 7 ); - QPtrList<Recurrence::rMonthPos> rmp; - QPtrList<int> rmd; + Q3PtrList<Recurrence::rMonthPos> rmp; + Q3PtrList<int> rmd; int day = 0; int count = 0; int month = 0; setDateTimes( event->dtStart(), dtEnd ); @@ -965,13 +973,13 @@ void KOEditorRecurrence::readEvent(Incidence *event) month = *rmd.first(); else month = event->dtStart().date().month() ; mYearly->setByMonth( month, day ); #if 0 //qDebug("2day = %d ",day ); - QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); + Q3PtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); int month; if ( !monthlist.isEmpty() ) { month = monthlist.first()->rPos ; } else { month = event->dtStart().date().month() ; } |