Changeset View
Changeset View
Standalone View
Standalone View
libksieve/ksieveui/vacation/vacationeditwidget.cpp
Show All 27 Lines | |||||
#include <pimcommon/texteditor/richtexteditor/richtexteditorwidget.h> | #include <pimcommon/texteditor/richtexteditor/richtexteditorwidget.h> | ||||
#include <kmime/kmime_header_parsing.h> | #include <kmime/kmime_header_parsing.h> | ||||
#include <QCheckBox> | #include <QCheckBox> | ||||
#include <QGridLayout> | #include <QGridLayout> | ||||
#include <QLabel> | #include <QLabel> | ||||
#include <QVBoxLayout> | |||||
#include <KDateComboBox> | #include <KDateComboBox> | ||||
#include <KTimeComboBox> | |||||
#include <kdialog.h> | #include <kdialog.h> | ||||
using KMime::Types::AddrSpecList; | using KMime::Types::AddrSpecList; | ||||
using KMime::Types::AddressList; | using KMime::Types::AddressList; | ||||
using KMime::Types::MailboxList; | using KMime::Types::MailboxList; | ||||
using KMime::HeaderParsing::parseAddressList; | using KMime::HeaderParsing::parseAddressList; | ||||
Show All 33 Lines | VacationEditWidget::VacationEditWidget(QWidget *parent) | ||||
mSubject->setObjectName(QLatin1String("mSubject")); | mSubject->setObjectName(QLatin1String("mSubject")); | ||||
mSubject->setClearButtonShown(true); | mSubject->setClearButtonShown(true); | ||||
QLabel *tmpLabel = new QLabel(i18n("&Subject of the vacation mail:"), this); | QLabel *tmpLabel = new QLabel(i18n("&Subject of the vacation mail:"), this); | ||||
tmpLabel->setBuddy(mSubject); | tmpLabel->setBuddy(mSubject); | ||||
glay->addWidget(tmpLabel, row, 0); | glay->addWidget(tmpLabel, row, 0); | ||||
glay->addWidget(mSubject, row, 1); | glay->addWidget(mSubject, row, 1); | ||||
// From date | // From date | ||||
++row; | |||||
QHBoxLayout *timeLayout = new QHBoxLayout(this); | |||||
mStartDate = new KDateComboBox( this ); | mStartDate = new KDateComboBox( this ); | ||||
mStartDate->setObjectName( QLatin1String( "mStartDate" ) ); | mStartDate->setObjectName( QLatin1String( "mStartDate" ) ); | ||||
mStartDate->setOptions( KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords | KDateComboBox::WarnOnInvalid ); | mStartDate->setOptions( KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords | KDateComboBox::WarnOnInvalid ); | ||||
mStartDate->setEnabled( false ); // Disable by default - we need an extension to support this | mStartDate->setEnabled( false ); // Disable by default - we need an extension to support this | ||||
mStartTime = new KTimeComboBox( this ); | |||||
mStartTime->setObjectName( QLatin1String( "mStartTime" ) ); | |||||
mStartTime->setOptions( KTimeComboBox::EditTime | KTimeComboBox::SelectTime | KTimeComboBox::EditTime | KTimeComboBox::WarnOnInvalid ); | |||||
mStartTime->setEnabled( false ); // Disable by default - we need an extension to support this | |||||
mStartTimeActive = new QCheckBox(this); | |||||
connect(mStartTimeActive,SIGNAL(toggled(bool)), mStartTime, SLOT(setEnabled(bool))); | |||||
timeLayout->addWidget(mStartDate); | |||||
timeLayout->addWidget(mStartTimeActive); | |||||
timeLayout->addWidget(mStartTime); | |||||
++row; | |||||
QLabel *label = new QLabel( i18n("&Start:"), this ); | QLabel *label = new QLabel( i18n("&Start:"), this ); | ||||
label->setBuddy( mStartDate ); | label->setBuddy( mStartDate ); | ||||
glay->addWidget( label, row, 0 ); | glay->addWidget( label, row, 0 ); | ||||
glay->addWidget( mStartDate, row, 1 ); | glay->addLayout(timeLayout, row, 1); | ||||
// End date | // End date | ||||
++row; | timeLayout = new QHBoxLayout(this); | ||||
mEndDate = new KDateComboBox( this ); | mEndDate = new KDateComboBox( this ); | ||||
mEndDate->setObjectName( QLatin1String( "mEndDate" ) ); | mEndDate->setObjectName( QLatin1String( "mEndDate" ) ); | ||||
mEndDate->setOptions( KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords | KDateComboBox::WarnOnInvalid ); | mEndDate->setOptions( KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords | KDateComboBox::WarnOnInvalid ); | ||||
mEndDate->setEnabled( false ); // Disable by default - we need an extension to support this | mEndDate->setEnabled( false ); // Disable by default - we need an extension to support this | ||||
mEndTime = new KTimeComboBox( this ); | |||||
mEndTime->setObjectName( QLatin1String( "mEndTime" ) ); | |||||
mEndTime->setOptions( KTimeComboBox::EditTime | KTimeComboBox::SelectTime | KTimeComboBox::EditTime | KTimeComboBox::WarnOnInvalid ); | |||||
mEndTime->setEnabled( false ); // Disable by default - we need an extension to support this | |||||
mEndTimeActive = new QCheckBox(this); | |||||
connect(mEndTimeActive,SIGNAL(toggled(bool)), mEndTime, SLOT(setEnabled(bool))); | |||||
timeLayout->addWidget(mEndDate); | |||||
timeLayout->addWidget(mEndTimeActive); | |||||
timeLayout->addWidget(mEndTime); | |||||
++row; | |||||
label = new QLabel( i18n("&End:"), this ); | label = new QLabel( i18n("&End:"), this ); | ||||
label->setBuddy( mEndDate ); | label->setBuddy( mEndDate ); | ||||
glay->addWidget( label, row, 0 ); | glay->addWidget( label, row, 0 ); | ||||
glay->addWidget( mEndDate, row, 1 ); | glay->addLayout(timeLayout, row, 1); | ||||
// "Resent only after" spinbox and label: | // "Resent only after" spinbox and label: | ||||
++row; | ++row; | ||||
int defDayInterval = 7; //default day interval | int defDayInterval = 7; //default day interval | ||||
mIntervalSpin = new KIntSpinBox( 0, 356, 1, defDayInterval, this ); | mIntervalSpin = new KIntSpinBox( 0, 356, 1, defDayInterval, this ); | ||||
mIntervalSpin->setObjectName( QLatin1String("mIntervalSpin") ); | mIntervalSpin->setObjectName( QLatin1String("mIntervalSpin") ); | ||||
mIntervalSpin->setSuffix( i18np(" day", " days", defDayInterval) ); | mIntervalSpin->setSuffix( i18np(" day", " days", defDayInterval) ); | ||||
connect(mIntervalSpin, SIGNAL(valueChanged(int)), SLOT(slotIntervalSpinChanged(int)) ); | connect(mIntervalSpin, SIGNAL(valueChanged(int)), SLOT(slotIntervalSpinChanged(int)) ); | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | bool VacationEditWidget::sendForSpam() const | ||||
return !mSpamCheck->isChecked(); | return !mSpamCheck->isChecked(); | ||||
} | } | ||||
void VacationEditWidget::setSendForSpam( bool enable ) | void VacationEditWidget::setSendForSpam( bool enable ) | ||||
{ | { | ||||
mSpamCheck->setChecked( !enable ); | mSpamCheck->setChecked( !enable ); | ||||
} | } | ||||
QDate VacationEditWidget::endDate() | QDate VacationEditWidget::endDate() const | ||||
{ | { | ||||
if ( mEndDate->isEnabled() ) { | if ( mEndDate->isEnabled() ) { | ||||
return mEndDate->date(); | return mEndDate->date(); | ||||
} else { | } else { | ||||
return QDate(); | return QDate(); | ||||
} | } | ||||
} | } | ||||
void VacationEditWidget::setEndDate( const QDate &endDate ) | void VacationEditWidget::setEndDate( const QDate &endDate ) | ||||
{ | { | ||||
mEndDate->setDate( endDate ); | mEndDate->setDate( endDate ); | ||||
} | } | ||||
QTime VacationEditWidget::endTime() const | |||||
{ | |||||
if ( mEndTime->isEnabled() ) { | |||||
return mEndTime->time(); | |||||
} else { | |||||
return QTime(); | |||||
} | |||||
} | |||||
void VacationEditWidget::setEndTime( const QTime &endTime ) | |||||
{ | |||||
mEndTimeActive->setChecked(endTime.isValid()); | |||||
mEndTime->setEnabled(endTime.isValid()); | |||||
mEndTime->setTime( endTime ); | |||||
} | |||||
QDate VacationEditWidget::startDate() const | QDate VacationEditWidget::startDate() const | ||||
{ | { | ||||
if ( mStartDate->isEnabled() ) { | if ( mStartDate->isEnabled() ) { | ||||
return mStartDate->date(); | return mStartDate->date(); | ||||
} else { | } else { | ||||
return QDate(); | return QDate(); | ||||
} | } | ||||
} | } | ||||
void VacationEditWidget::setStartDate( const QDate &startDate ) | void VacationEditWidget::setStartDate( const QDate &startDate ) | ||||
{ | { | ||||
mStartDate->setDate( startDate ); | mStartDate->setDate( startDate ); | ||||
} | } | ||||
QTime VacationEditWidget::startTime() const | |||||
{ | |||||
if ( mStartTime->isEnabled() ) { | |||||
return mStartTime->time(); | |||||
} else { | |||||
return QTime(); | |||||
} | |||||
} | |||||
void VacationEditWidget::setStartTime( const QTime &startTime ) | |||||
{ | |||||
mStartTimeActive->setChecked(startTime.isValid()); | |||||
mStartTime->setEnabled(startTime.isValid()); | |||||
mStartTime->setTime( startTime ); | |||||
} | |||||
void VacationEditWidget::setSubject(const QString &subject) | void VacationEditWidget::setSubject(const QString &subject) | ||||
{ | { | ||||
mSubject->setText(subject); | mSubject->setText(subject); | ||||
} | } | ||||
QString VacationEditWidget::subject() const | QString VacationEditWidget::subject() const | ||||
{ | { | ||||
if (mSubject->isEnabled()) { | if (mSubject->isEnabled()) { | ||||
Show All 30 Lines |