summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-10-26 08:06:05 +0200
committerMontel Laurent <[email protected]>2017-10-26 08:06:05 +0200
commit1d1e727faba5852f044416cb92b12499e5d1ed81 (patch)
tree2833fa609da58fedc596ad9267ef999f19fb3904
parente5dc3a18418e508479a541240715bd2dd6788c80 (diff)
initialize value
-rw-r--r--src/ksieveui/vacation/vacationmailactionwidget.cpp37
-rw-r--r--src/ksieveui/vacation/vacationmailactionwidget.h4
2 files changed, 40 insertions, 1 deletions
diff --git a/src/ksieveui/vacation/vacationmailactionwidget.cpp b/src/ksieveui/vacation/vacationmailactionwidget.cpp
index aa7aded..bda77f9 100644
--- a/src/ksieveui/vacation/vacationmailactionwidget.cpp
+++ b/src/ksieveui/vacation/vacationmailactionwidget.cpp
@@ -66,5 +66,40 @@ void VacationMailActionWidget::setSieveImapAccountSettings(const KSieveUi::Sieve
void VacationMailActionWidget::mailActionChanged(KSieveUi::VacationUtils::MailAction action)
{
- //TODO
+ bool enable = (action == VacationUtils::CopyTo || action == VacationUtils::Sendto);
+ setEnabled(enable);
+ selectMailActionWidget(action);
+}
+
+void VacationMailActionWidget::selectMailActionWidget(VacationUtils::MailAction action)
+{
+ if (action == VacationUtils::CopyTo) {
+ mStackedWidget->setCurrentWidget(mMoveImapFolderWidget);
+ } else {
+ mStackedWidget->setCurrentWidget(mMailActionRecipient);
+ }
+}
+
+void VacationMailActionWidget::setMailAction(VacationUtils::MailAction action, const QString &recipient)
+{
+ selectMailActionWidget(action);
+ mMailActionRecipient->setText(recipient);
+}
+
+void VacationMailActionWidget::setText(const QString &recipient)
+{
+ if (mStackedWidget->currentWidget() == mMoveImapFolderWidget) {
+ mMoveImapFolderWidget->setText(recipient);
+ } else {
+ mMailActionRecipient->setText(recipient);
+ }
+}
+
+QString VacationMailActionWidget::mailActionRecipient() const
+{
+ if (mStackedWidget->currentWidget() == mMoveImapFolderWidget) {
+ return mMoveImapFolderWidget->text();
+ } else {
+ return mMailActionRecipient->text();
+ }
}
diff --git a/src/ksieveui/vacation/vacationmailactionwidget.h b/src/ksieveui/vacation/vacationmailactionwidget.h
index 8539280..491d034 100644
--- a/src/ksieveui/vacation/vacationmailactionwidget.h
+++ b/src/ksieveui/vacation/vacationmailactionwidget.h
@@ -35,7 +35,11 @@ public:
~VacationMailActionWidget();
void setSieveImapAccountSettings(const KSieveUi::SieveImapAccountSettings &account);
void mailActionChanged(KSieveUi::VacationUtils::MailAction action);
+ QString mailActionRecipient() const;
+ void setMailAction(VacationUtils::MailAction action, const QString &recipient);
private:
+ void selectMailActionWidget(VacationUtils::MailAction action);
+ void setText(const QString &recipient);
QStackedWidget *mStackedWidget = nullptr;
AbstractMoveImapFolderWidget *mMoveImapFolderWidget = nullptr;
QLineEdit *mMailActionRecipient = nullptr;