File indexing completed on 2024-12-22 05:01:02

0001 /*
0002   SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #pragma once
0008 
0009 #include "configuredialog_p.h"
0010 #include "kmail_export.h"
0011 #include <config-enterprise.h>
0012 class QCheckBox;
0013 class QSpinBox;
0014 class QSpinBox;
0015 class QComboBox;
0016 class QLineEdit;
0017 class ListView;
0018 class QPushButton;
0019 class QLabel;
0020 class KPluralHandlingSpinBox;
0021 namespace TemplateParser
0022 {
0023 class CustomTemplates;
0024 class TemplatesConfiguration;
0025 }
0026 namespace TextAutoCorrectionWidgets
0027 {
0028 class AutoCorrectionWidget;
0029 }
0030 namespace PimCommon
0031 {
0032 class SimpleStringListEditor;
0033 }
0034 namespace MessageComposer
0035 {
0036 class ImageScalingWidget;
0037 }
0038 
0039 class ComposerPageGeneralTab : public ConfigModuleTab
0040 {
0041     Q_OBJECT
0042 public:
0043     explicit ComposerPageGeneralTab(QWidget *parent = nullptr);
0044     [[nodiscard]] QString helpAnchor() const;
0045 
0046     void save() override;
0047 
0048 private:
0049     void slotConfigureAddressCompletion();
0050     void doLoadFromGlobalSettings() override;
0051     void doResetToDefaultsOther() override;
0052 
0053 private:
0054     QCheckBox *mShowAkonadiSearchAddressesInComposer = nullptr;
0055     QCheckBox *mAutoAppSignFileCheck = nullptr;
0056     QCheckBox *mTopQuoteCheck = nullptr;
0057     QCheckBox *mDashDashCheck = nullptr;
0058     QCheckBox *mReplyUsingVisualFormat = nullptr;
0059     QCheckBox *mSmartQuoteCheck = nullptr;
0060     QCheckBox *mStripSignatureCheck = nullptr;
0061     QCheckBox *mQuoteSelectionOnlyCheck = nullptr;
0062     QCheckBox *mAutoRequestMDNCheck = nullptr;
0063     QCheckBox *mShowRecentAddressesInComposer = nullptr;
0064     QCheckBox *mWordWrapCheck = nullptr;
0065     QSpinBox *mWrapColumnSpin = nullptr;
0066     KPluralHandlingSpinBox *mAutoSave = nullptr;
0067     QSpinBox *mMaximumRecipients = nullptr;
0068     QCheckBox *mImprovePlainTextOfHtmlMessage = nullptr;
0069     QSpinBox *mMaximumRecentAddress = nullptr;
0070 #if KDEPIM_ENTERPRISE_BUILD
0071     QComboBox *mForwardTypeCombo = nullptr;
0072     QCheckBox *mRecipientCheck = nullptr;
0073     QSpinBox *mRecipientSpin = nullptr;
0074 #endif
0075 };
0076 
0077 class ComposerPageTemplatesTab : public ConfigModuleTab
0078 {
0079     Q_OBJECT
0080 public:
0081     explicit ComposerPageTemplatesTab(QWidget *parent = nullptr);
0082     [[nodiscard]] QString helpAnchor() const;
0083 
0084     void save() override;
0085 
0086 private:
0087     void doLoadFromGlobalSettings() override;
0088     void doResetToDefaultsOther() override;
0089 
0090 private:
0091     TemplateParser::TemplatesConfiguration *const mWidget;
0092 };
0093 
0094 class ComposerPageCustomTemplatesTab : public ConfigModuleTab
0095 {
0096     Q_OBJECT
0097 public:
0098     explicit ComposerPageCustomTemplatesTab(QWidget *parent = nullptr);
0099     [[nodiscard]] QString helpAnchor() const;
0100 
0101     void save() override;
0102 
0103 private:
0104     void doLoadFromGlobalSettings() override;
0105 
0106 private:
0107     TemplateParser::CustomTemplates *mWidget = nullptr;
0108 };
0109 
0110 class ComposerPageSubjectTab : public ConfigModuleTab
0111 {
0112     Q_OBJECT
0113 public:
0114     explicit ComposerPageSubjectTab(QWidget *parent = nullptr);
0115     [[nodiscard]] QString helpAnchor() const;
0116 
0117     void save() override;
0118 
0119 private:
0120     void doLoadFromGlobalSettings() override;
0121     void doResetToDefaultsOther() override;
0122 
0123 private:
0124     PimCommon::SimpleStringListEditor *mReplyListEditor = nullptr;
0125     QCheckBox *mReplaceReplyPrefixCheck = nullptr;
0126     PimCommon::SimpleStringListEditor *mForwardListEditor = nullptr;
0127     QCheckBox *mReplaceForwardPrefixCheck = nullptr;
0128 };
0129 
0130 class ComposerPageHeadersTab : public ConfigModuleTab
0131 {
0132     Q_OBJECT
0133 public:
0134     explicit ComposerPageHeadersTab(QWidget *parent = nullptr);
0135     [[nodiscard]] QString helpAnchor() const;
0136 
0137     void save() override;
0138 
0139 private:
0140     void slotMimeHeaderSelectionChanged();
0141     void slotMimeHeaderNameChanged(const QString &);
0142     void slotMimeHeaderValueChanged(const QString &);
0143     void slotNewMimeHeader();
0144     void slotRemoveMimeHeader();
0145     void doLoadOther() override;
0146     void doResetToDefaultsOther() override;
0147 
0148 private:
0149     QCheckBox *mCreateOwnMessageIdCheck = nullptr;
0150     QLineEdit *mMessageIdSuffixEdit = nullptr;
0151     ListView *mHeaderList = nullptr;
0152     QPushButton *mRemoveHeaderButton = nullptr;
0153     QLineEdit *mTagNameEdit = nullptr;
0154     QLineEdit *mTagValueEdit = nullptr;
0155     QLabel *mTagNameLabel = nullptr;
0156     QLabel *mTagValueLabel = nullptr;
0157 };
0158 
0159 class ComposerPageAttachmentsTab : public ConfigModuleTab
0160 {
0161     Q_OBJECT
0162 public:
0163     explicit ComposerPageAttachmentsTab(QWidget *parent = nullptr);
0164     QString helpAnchor() const;
0165 
0166     void save() override;
0167 
0168 private:
0169     void doLoadFromGlobalSettings() override;
0170 
0171 private:
0172     QCheckBox *mMissingAttachmentDetectionCheck = nullptr;
0173     PimCommon::SimpleStringListEditor *mAttachWordsListEditor = nullptr;
0174     QSpinBox *mMaximumAttachmentSize = nullptr;
0175 };
0176 
0177 class ComposerPageAutoCorrectionTab : public ConfigModuleTab
0178 {
0179     Q_OBJECT
0180 public:
0181     explicit ComposerPageAutoCorrectionTab(QWidget *parent = nullptr);
0182     QString helpAnchor() const;
0183 
0184     void save() override;
0185 
0186 private:
0187     void doLoadFromGlobalSettings() override;
0188     void doResetToDefaultsOther() override;
0189 
0190 private:
0191     TextAutoCorrectionWidgets::AutoCorrectionWidget *autocorrectionWidget = nullptr;
0192 };
0193 
0194 class ComposerPageAutoImageResizeTab : public ConfigModuleTab
0195 {
0196     Q_OBJECT
0197 public:
0198     explicit ComposerPageAutoImageResizeTab(QWidget *parent = nullptr);
0199     QString helpAnchor() const;
0200 
0201     void save() override;
0202 
0203 private:
0204     void doLoadFromGlobalSettings() override;
0205     void doResetToDefaultsOther() override;
0206 
0207 private:
0208     MessageComposer::ImageScalingWidget *autoResizeWidget = nullptr;
0209 };
0210 
0211 class KMAIL_EXPORT ComposerPage : public ConfigModuleWithTabs
0212 {
0213     Q_OBJECT
0214 public:
0215     explicit ComposerPage(QObject *parent, const KPluginMetaData &data);
0216 
0217     QString helpAnchor() const override;
0218 };