Allow to configure undo send feature

wilder
Laurent Montel 6 years ago
parent 43dda72614
commit 29c521dc2f
  1. 17
      src/configuredialog/configureaccountpage.cpp
  2. 3
      src/configuredialog/configureaccountpage.h
  3. 9
      src/settings/kmail.kcfg.cmake
  4. 6
      src/undosend/undosendcombobox.cpp
  5. 1
      src/undosend/undosendcombobox.h

@ -21,6 +21,7 @@
#include "kmkernel.h"
#include "settings/kmailsettings.h"
#include "configagentdelegate.h"
#include "undosend/undosendcombobox.h"
#include "MessageComposer/MessageComposerSettings"
#include "MailCommon/AccountConfigOrderDialog"
#include "PimCommon/ConfigureImmutableWidgetUtils"
@ -156,6 +157,18 @@ AccountsPageSendingTab::AccountsPageSendingTab(QWidget *parent)
l = new QLabel(i18n("Defa&ult send method:"), group);
l->setBuddy(mSendMethodCombo);
glay->addWidget(l, 3, 0);
mUndoSend = new QCheckBox(i18n("Enable Undo Send"), this);
glay->addWidget(mUndoSend, 4, 0);
connect(mUndoSend, &QCheckBox::toggled, this, [this](bool state) {
mUndoSendComboBox->setEnabled(state);
Q_EMIT slotEmitChanged();
});
mUndoSendComboBox = new UndoSendCombobox(this);
mUndoSendComboBox->setEnabled(false);
glay->addWidget(mUndoSendComboBox, 4, 1);
connect(mUndoSendComboBox, qOverload<int>(&QComboBox::activated), this, &AccountsPageSendingTab::slotEmitChanged);
}
void AccountsPage::SendingTab::doLoadFromGlobalSettings()
@ -168,6 +181,8 @@ void AccountsPage::SendingTab::doLoadOther()
mSendMethodCombo->setCurrentIndex(MessageComposer::MessageComposerSettings::self()->sendImmediate() ? 0 : 1);
loadWidget(mConfirmSendCheck, KMailSettings::self()->confirmBeforeSendItem());
loadWidget(mCheckSpellingBeforeSending, KMailSettings::self()->checkSpellingBeforeSendItem());
loadWidget(mUndoSend, KMailSettings::self()->enabledUndoSendItem());
mUndoSendComboBox->setDelay(KMailSettings::self()->undoSendDelay());
}
void AccountsPage::SendingTab::save()
@ -175,7 +190,9 @@ void AccountsPage::SendingTab::save()
KMailSettings::self()->setSendOnCheck(mSendOnCheckCombo->currentIndex());
saveCheckBox(mConfirmSendCheck, KMailSettings::self()->confirmBeforeSendItem());
saveCheckBox(mCheckSpellingBeforeSending, KMailSettings::self()->checkSpellingBeforeSendItem());
saveCheckBox(mUndoSend, KMailSettings::self()->enabledUndoSendItem());
MessageComposer::MessageComposerSettings::self()->setSendImmediate(mSendMethodCombo->currentIndex() == 0);
KMailSettings::self()->setUndoSendDelay(mUndoSendComboBox->delay());
}
QString AccountsPage::ReceivingTab::helpAnchor() const

@ -24,6 +24,7 @@
class QCheckBox;
class QComboBox;
class UndoSendCombobox;
class OrgFreedesktopAkonadiNewMailNotifierInterface;
namespace KLDAP {
class LdapConfigureWidget;
@ -47,6 +48,8 @@ private:
QCheckBox *mCheckSpellingBeforeSending = nullptr;
QComboBox *mSendOnCheckCombo = nullptr;
QComboBox *mSendMethodCombo = nullptr;
UndoSendCombobox *mUndoSendComboBox = nullptr;
QCheckBox *mUndoSend = nullptr;
};
// subclasses: one class per tab:

@ -430,4 +430,13 @@
<default>100</default>
</entry>
</group>
<group name="UndoSend">
<entry name="EnabledUndoSend" type="Bool">
<default>false</default>
</entry>
<entry name="UndoSendDelay" type="int">
<default>10</default>
</entry>
</group>
</kcfg>

@ -42,3 +42,9 @@ int UndoSendCombobox::delay() const
{
return currentData().toInt();
}
void UndoSendCombobox::setDelay(int val)
{
const int index = findData(val);
setCurrentIndex(index != -1 ? index : 0);
}

@ -31,6 +31,7 @@ public:
~UndoSendCombobox();
Q_REQUIRED_RESULT int delay() const;
void setDelay(int val);
private:
void initialize();
};

Loading…
Cancel
Save