2 // configuredialog_p.h: classes internal to ConfigureDialog
3 // see configuredialog.h for details.
5 #ifndef _CONFIGURE_DIALOG_PRIVATE_H_
6 #define _CONFIGURE_DIALOG_PRIVATE_H_
8 #include <config-enterprise.h>
10 #include "kmail_export.h"
11 #include "configmodule.h"
14 #include <QStringList>
19 #include <QSharedPointer>
21 #include <klineedit.h>
22 #include <kcombobox.h>
27 #include <akonadi/agentinstance.h>
29 #include "ui_composercryptoconfiguration.h"
30 #include "ui_warningconfiguration.h"
31 #include "ui_smimeconfiguration.h"
32 #include "ui_customtemplates_base.h"
33 #include "ui_miscpagemaintab.h"
34 #include "ui_securitypagegeneraltab.h"
35 #include "ui_accountspagereceivingtab.h"
41 class QRegExpValidator
;
53 class ConfigureDialog
;
55 class SimpleStringListEditor
;
57 class SMimeConfiguration
;
58 class TemplatesConfiguration
;
59 class CustomTemplates
;
63 class KKeySequenceWidget
;
67 namespace MessageList
{
69 class AggregationComboBox
;
74 namespace MessageViewer
{
75 class ConfigureWidget
;
76 class InvitationSettings
;
81 typedef QSharedPointer
<Tag
> TagPtr
;
84 namespace MailCommon
{
85 class FolderRequester
;
92 class WarningConfiguration
: public QWidget
, public Ui::WarningConfiguration
95 WarningConfiguration( QWidget
*parent
) : QWidget( parent
) {
100 class SMimeConfiguration
: public QWidget
, public Ui::SMimeConfiguration
103 SMimeConfiguration( QWidget
*parent
) : QWidget( parent
) {
109 class ComposerCryptoConfiguration
: public QWidget
, public Ui::ComposerCryptoConfiguration
112 ComposerCryptoConfiguration( QWidget
*parent
) : QWidget( parent
) {
118 // Individual tab of a ConfigModuleWithTabs
119 class ConfigModuleTab
: public QWidget
{
122 ConfigModuleTab( QWidget
*parent
=0 )
126 ~ConfigModuleTab() {}
127 virtual void save() = 0;
130 // forwarded to the ConfigModule
133 void slotEmitChanged();
138 // reimplement this for loading values of settings which are available
139 // via GlobalSettings
140 virtual void doLoadFromGlobalSettings() {}
141 // reimplement this for loading values of settings which are not available
142 // via GlobalSettings
143 virtual void doLoadOther() {}
144 // reimplement this for loading default values of settings which are
145 // not available via GlobalSettings (KConfigXT).
146 virtual void doResetToDefaultsOther() {}
151 * ConfigModuleWithTabs represents a kcm with several tabs.
152 * It simply forwards load and save operations to all tabs.
154 class KMAIL_EXPORT ConfigModuleWithTabs
: public ConfigModule
{
157 explicit ConfigModuleWithTabs( const KComponentData
&instance
, QWidget
*parent
=0 );
158 ~ConfigModuleWithTabs() {}
160 // don't reimplement any of those methods
163 virtual void defaults();
166 void addTab( ConfigModuleTab
* tab
, const QString
& title
);
169 KTabWidget
*mTabWidget
;
180 // subclasses: one class per tab:
181 class AccountsPageSendingTab
: public ConfigModuleTab
{
184 AccountsPageSendingTab( QWidget
* parent
=0 );
185 virtual ~AccountsPageSendingTab();
186 QString
helpAnchor() const;
190 virtual void doLoadFromGlobalSettings();
191 virtual void doLoadOther();
192 //FIXME virtual void doResetToDefaultsOther();
195 QCheckBox
*mConfirmSendCheck
;
196 KComboBox
*mSendOnCheckCombo
;
197 KComboBox
*mSendMethodCombo
;
198 KLineEdit
*mDefaultDomainEdit
;
202 class AccountsPageReceivingTab
: public ConfigModuleTab
{
205 AccountsPageReceivingTab( QWidget
* parent
=0 );
206 ~AccountsPageReceivingTab();
207 QString
helpAnchor() const;
211 void accountListChanged( const QStringList
& );
214 void slotAccountSelected(const Akonadi::AgentInstance
&);
215 void slotAddAccount();
216 void slotModifySelectedAccount();
217 void slotRemoveSelectedAccount();
218 void slotEditNotifications();
219 void slotShowMailCheckMenu( const QString
&, const QPoint
& );
220 void slotIncludeInCheckChanged( bool checked
);
221 void slotOfflineOnShutdownChanged( bool checked
);
222 void slotCheckOnStatupChanged( bool checked
);
225 virtual void doLoadFromGlobalSettings();
226 virtual void doLoadOther();
228 struct RetrievalOptions
{
229 RetrievalOptions( bool manualCheck
, bool offline
, bool checkOnStartup
)
230 : IncludeInManualChecks( manualCheck
)
231 , OfflineOnShutdown( offline
)
232 ,CheckOnStartup( checkOnStartup
) {}
233 bool IncludeInManualChecks
;
234 bool OfflineOnShutdown
;
238 QHash
<QString
, QSharedPointer
<RetrievalOptions
> > mRetrievalHash
;
239 //FIXME virtual void doResetToDefaultsOther();
242 Ui_AccountsPageReceivingTab mAccountsReceiving
;
245 class KMAIL_EXPORT AccountsPage
: public ConfigModuleWithTabs
{
248 explicit AccountsPage( const KComponentData
&instance
, QWidget
*parent
=0 );
249 QString
helpAnchor() const;
252 // hrmpf. moc doesn't like nested classes with slots/signals...:
253 typedef AccountsPageSendingTab SendingTab
;
254 typedef AccountsPageReceivingTab ReceivingTab
;
257 void accountListChanged( const QStringList
& );
260 SendingTab
*mSendingTab
;
261 ReceivingTab
*mReceivingTab
;
271 class AppearancePageFontsTab
: public ConfigModuleTab
{
274 AppearancePageFontsTab( QWidget
* parent
=0 );
275 QString
helpAnchor() const;
279 void slotFontSelectorChanged( int );
282 //virtual void doLoadFromGlobalSettings();
283 virtual void doLoadOther();
284 void updateFontSelector();
285 virtual void doResetToDefaultsOther();
288 QCheckBox
*mCustomFontCheck
;
289 KComboBox
*mFontLocationCombo
;
290 KFontChooser
*mFontChooser
;
292 int mActiveFontIndex
;
296 class AppearancePageColorsTab
: public ConfigModuleTab
{
299 AppearancePageColorsTab( QWidget
* parent
=0 );
300 QString
helpAnchor() const;
304 //virtual void doLoadFromGlobalSettings();
305 virtual void doLoadOther();
306 virtual void doResetToDefaultsOther();
307 void loadColor( bool loadFromConfig
);
310 QCheckBox
*mCustomColorCheck
;
311 ColorListBox
*mColorList
;
312 QCheckBox
*mRecycleColorCheck
;
313 QSpinBox
*mCloseToQuotaThreshold
;
316 class AppearancePageLayoutTab
: public ConfigModuleTab
{
319 AppearancePageLayoutTab( QWidget
* parent
=0 );
320 QString
helpAnchor() const;
325 //virtual void doLoadFromGlobalSettings();
326 virtual void doLoadOther();
327 //FIXME virtual void doResetToDefaultsOther();
330 QButtonGroup
*mFolderListGroup
;
331 QGroupBox
*mFolderListGroupBox
;
332 QButtonGroup
*mReaderWindowModeGroup
;
333 QGroupBox
*mReaderWindowModeGroupBox
;
334 QCheckBox
*mFavoriteFolderViewCB
;
335 QCheckBox
*mFolderQuickSearchCB
;
336 QButtonGroup
*mFolderToolTipsGroup
;
337 QGroupBox
*mFolderToolTipsGroupBox
;
340 class AppearancePageHeadersTab
: public ConfigModuleTab
{
343 AppearancePageHeadersTab( QWidget
* parent
=0 );
345 QString
helpAnchor() const;
350 virtual void doLoadFromGlobalSettings();
351 virtual void doLoadOther();
352 // virtual void doResetToDefaultsOther();
353 void setDateDisplay( int id
, const QString
& format
);
356 QCheckBox
*mDisplayMessageToolTips
;
357 QCheckBox
*mHideTabBarWithSingleTab
;
358 MessageList::Utils::AggregationComboBox
*mAggregationComboBox
;
359 MessageList::Utils::ThemeComboBox
*mThemeComboBox
;
360 KButtonGroup
*mDateDisplay
;
361 KLineEdit
*mCustomDateFormatEdit
;
362 QString mCustomDateWhatsThis
;
365 void slotLinkClicked( const QString
& link
);
366 void slotSelectDefaultAggregation();
367 void slotSelectDefaultTheme();
370 class AppearancePageReaderTab
: public ConfigModuleTab
{
373 AppearancePageReaderTab( QWidget
* parent
=0 );
375 QString
helpAnchor() const;
380 virtual void doLoadOther();
381 //FIXME virtual void doResetToDefaultsOther();
384 QCheckBox
*mCloseAfterReplyOrForwardCheck
;
385 MessageViewer::ConfigureWidget
*mViewerSettings
;
389 class AppearancePageSystemTrayTab
: public ConfigModuleTab
{
392 AppearancePageSystemTrayTab( QWidget
* parent
=0 );
394 QString
helpAnchor() const;
399 virtual void doLoadFromGlobalSettings();
402 QCheckBox
*mSystemTrayCheck
;
403 KButtonGroup
*mSystemTrayGroup
;
406 /**Configuration tab in the appearance page for modifying the available set of
408 class AppearancePageMessageTagTab
: public ConfigModuleTab
{
411 AppearancePageMessageTagTab( QWidget
* parent
=0);
412 ~AppearancePageMessageTagTab();
414 QString
helpAnchor() const;
419 /**Enables/disables Add button according to whether @p aText is empty.
420 Connected to signal of the line edit widget for adding tags
421 @param aText String to change add button according to
423 void slotAddLineTextChanged( const QString
&aText
);
424 /**Creates a generic tag with the visible name from the line edit widget for
425 adding tags. Adds it to the end of the list and selects. Empties the line
427 void slotAddNewTag();
428 /**Removes the currently selected text in the list box.*/
429 void slotRemoveTag();
430 /**Increases the currently selected tag's priority and handles related visual
432 void slotMoveTagUp();
433 /**Decreases the currently selected tag's priority and handles related visual
435 void slotMoveTagDown();
438 /*Handles necessary processing when the selection in the edit box changes.
439 Records the unselected tag's information, and applies visual changes
440 necessary depending on the description of the new tag. Private since doesn't
441 change the selection of the edit box itself*/
442 void slotSelectionChanged();
443 /*This slot is necessary so that apply button is not activated when we are
444 only applying visual changes after selecting a new tag in the list box*/
445 void slotEmitChangeCheck();
446 /*Transfers the tag settings from the widgets to the internal data structures.
447 Private since passing a wrong parameter modifies another tag's data*/
448 void slotRecordTagSettings( int aIndex
);
449 /*Transfers the tag settings from the internal data structures to the widgets.
450 Private since passing a wrong parameter visualizes another tag's data*/
451 void slotUpdateTagSettingWidgets( int aIndex
);
452 /*Transfers changes in the tag name edit box to the list box for tags. Private
453 since calling externally decouples the name in the list box from name edit box*/
454 void slotNameLineTextChanged( const QString
& );
455 void slotIconNameChanged( const QString
&iconName
);
458 virtual void doLoadFromGlobalSettings();
459 void swapTagsInListBox( const int first
, const int second
);
463 KLineEdit
*mTagNameLineEdit
, *mTagAddLineEdit
;
464 QPushButton
*mTagAddButton
, *mTagRemoveButton
,
465 *mTagUpButton
, *mTagDownButton
;
467 QListWidget
*mTagListBox
;
469 QCheckBox
*mTextColorCheck
, *mBackgroundColorCheck
,
470 *mTextFontCheck
, *mInToolbarCheck
;
472 QGroupBox
*mTagsGroupBox
, *mTagSettingGroupBox
;
474 KColorCombo
*mTextColorCombo
, *mBackgroundColorCombo
;
476 KFontRequester
*mFontRequester
;
478 KIconButton
*mIconButton
;
480 KKeySequenceWidget
*mKeySequenceWidget
;
482 // Maps Nepomuk::Tag resource URIs to Tags
483 QHash
<QString
,KMail::TagPtr
> mMsgTagDict
;
485 // List of all Tags currently in the list
486 QList
<KMail::TagPtr
> mMsgTagList
;
488 // So we can compare to mMsgTagList and see if the user changed tags
489 QList
<KMail::TagPtr
> mOriginalMsgTagList
;
491 /*Used to safely call slotRecordTagSettings when the selection in
495 class KMAIL_EXPORT AppearancePage
: public ConfigModuleWithTabs
{
498 explicit AppearancePage( const KComponentData
&instance
, QWidget
*parent
=0 );
500 QString
helpAnchor() const;
502 // hrmpf. moc doesn't like nested classes with slots/signals...:
503 typedef AppearancePageFontsTab FontsTab
;
504 typedef AppearancePageColorsTab ColorsTab
;
505 typedef AppearancePageLayoutTab LayoutTab
;
506 typedef AppearancePageHeadersTab HeadersTab
;
507 typedef AppearancePageReaderTab ReaderTab
;
508 typedef AppearancePageSystemTrayTab SystemTrayTab
;
509 typedef AppearancePageMessageTagTab MessageTagTab
;
513 ColorsTab
*mColorsTab
;
514 LayoutTab
*mLayoutTab
;
515 HeadersTab
*mHeadersTab
;
516 ReaderTab
*mReaderTab
;
517 SystemTrayTab
*mSystemTrayTab
;
518 MessageTagTab
*mMessageTagTab
;
527 class ComposerPageGeneralTab
: public ConfigModuleTab
{
530 ComposerPageGeneralTab( QWidget
* parent
=0 );
531 QString
helpAnchor() const;
535 void slotConfigureRecentAddresses();
536 void slotConfigureCompletionOrder();
539 virtual void doLoadFromGlobalSettings();
542 QCheckBox
*mAutoAppSignFileCheck
;
543 QCheckBox
*mTopQuoteCheck
;
544 QCheckBox
*mDashDashCheck
;
545 QCheckBox
*mSmartQuoteCheck
;
546 QCheckBox
*mStripSignatureCheck
;
547 QCheckBox
*mQuoteSelectionOnlyCheck
;
548 QCheckBox
*mAutoRequestMDNCheck
;
549 QCheckBox
*mShowRecentAddressesInComposer
;
550 QCheckBox
*mWordWrapCheck
;
551 KIntSpinBox
*mWrapColumnSpin
;
552 KIntSpinBox
*mAutoSave
;
553 QCheckBox
*mExternalEditorCheck
;
554 KUrlRequester
*mEditorRequester
;
555 #ifdef KDEPIM_ENTERPRISE_BUILD
556 KComboBox
*mForwardTypeCombo
;
557 QCheckBox
*mRecipientCheck
;
558 KIntSpinBox
*mRecipientSpin
;
562 class ComposerPageTemplatesTab
: public ConfigModuleTab
{
565 ComposerPageTemplatesTab( QWidget
* parent
= 0 );
566 QString
helpAnchor() const;
573 virtual void doLoadFromGlobalSettings();
574 virtual void doResetToDefaultsOther();
576 TemplatesConfiguration
* mWidget
;
579 class ComposerPageCustomTemplatesTab
: public ConfigModuleTab
{
582 ComposerPageCustomTemplatesTab( QWidget
* parent
= 0 );
583 QString
helpAnchor() const;
590 virtual void doLoadFromGlobalSettings();
593 CustomTemplates
* mWidget
;
596 class ComposerPageSubjectTab
: public ConfigModuleTab
{
599 ComposerPageSubjectTab( QWidget
* parent
= 0 );
600 QString
helpAnchor() const;
605 virtual void doLoadFromGlobalSettings();
606 virtual void doResetToDefaultsOther();
609 SimpleStringListEditor
*mReplyListEditor
;
610 QCheckBox
*mReplaceReplyPrefixCheck
;
611 SimpleStringListEditor
*mForwardListEditor
;
612 QCheckBox
*mReplaceForwardPrefixCheck
;
615 class ComposerPageCharsetTab
: public ConfigModuleTab
{
618 ComposerPageCharsetTab( QWidget
* parent
=0 );
619 QString
helpAnchor() const;
624 void slotVerifyCharset(QString
&);
627 //virtual void doLoadFromGlobalSettings();
628 virtual void doLoadOther();
629 virtual void doResetToDefaultsOther();
632 SimpleStringListEditor
*mCharsetListEditor
;
633 QCheckBox
*mKeepReplyCharsetCheck
;
636 class ComposerPageHeadersTab
: public ConfigModuleTab
{
639 ComposerPageHeadersTab( QWidget
* parent
=0 );
640 QString
helpAnchor() const;
645 void slotMimeHeaderSelectionChanged();
646 void slotMimeHeaderNameChanged( const QString
& );
647 void slotMimeHeaderValueChanged( const QString
& );
648 void slotNewMimeHeader();
649 void slotRemoveMimeHeader();
652 //virtual void doLoadFromGlobalSettings();
653 virtual void doLoadOther();
654 virtual void doResetToDefaultsOther();
657 QCheckBox
*mCreateOwnMessageIdCheck
;
658 KLineEdit
*mMessageIdSuffixEdit
;
659 QRegExpValidator
*mMessageIdSuffixValidator
;
661 QPushButton
*mRemoveHeaderButton
;
662 KLineEdit
*mTagNameEdit
;
663 KLineEdit
*mTagValueEdit
;
664 QLabel
*mTagNameLabel
;
665 QLabel
*mTagValueLabel
;
668 class ComposerPageAttachmentsTab
: public ConfigModuleTab
{
671 ComposerPageAttachmentsTab( QWidget
* parent
=0 );
672 QString
helpAnchor() const;
677 void slotOutlookCompatibleClicked();
680 virtual void doLoadFromGlobalSettings();
681 //FIXME virtual void doResetToDefaultsOther();
684 QCheckBox
*mOutlookCompatibleCheck
;
685 QCheckBox
*mMissingAttachmentDetectionCheck
;
686 SimpleStringListEditor
*mAttachWordsListEditor
;
689 class KMAIL_EXPORT ComposerPage
: public ConfigModuleWithTabs
{
692 explicit ComposerPage( const KComponentData
&instance
, QWidget
*parent
=0 );
694 QString
helpAnchor() const;
696 // hrmpf. moc doesn't like nested classes with slots/signals...:
697 typedef ComposerPageGeneralTab GeneralTab
;
698 typedef ComposerPageTemplatesTab TemplatesTab
;
699 typedef ComposerPageCustomTemplatesTab CustomTemplatesTab
;
700 typedef ComposerPageSubjectTab SubjectTab
;
701 typedef ComposerPageCharsetTab CharsetTab
;
702 typedef ComposerPageHeadersTab HeadersTab
;
703 typedef ComposerPageAttachmentsTab AttachmentsTab
;
706 GeneralTab
*mGeneralTab
;
707 TemplatesTab
*mTemplatesTab
;
708 CustomTemplatesTab
*mCustomTemplatesTab
;
709 SubjectTab
*mSubjectTab
;
710 CharsetTab
*mCharsetTab
;
711 HeadersTab
*mHeadersTab
;
712 AttachmentsTab
*mAttachmentsTab
;
721 class SecurityPageGeneralTab
: public ConfigModuleTab
{
724 SecurityPageGeneralTab( QWidget
* parent
=0 );
725 QString
helpAnchor() const;
730 //virtual void doLoadFromGlobalSettings();
731 virtual void doLoadOther();
732 //FIXME virtual void doResetToDefaultsOther();
735 QButtonGroup
*mMDNGroup
;
736 QButtonGroup
*mOrigQuoteGroup
;
737 Ui_SecurityPageGeneralTab mSGTab
;
740 void slotLinkClicked( const QString
& link
);
744 class SecurityPageComposerCryptoTab
: public ConfigModuleTab
{
747 SecurityPageComposerCryptoTab( QWidget
* parent
=0 );
749 QString
helpAnchor() const;
754 virtual void doLoadFromGlobalSettings();
755 virtual void doLoadOther();
756 //FIXME virtual void doResetToDefaultsOther();
759 ComposerCryptoConfiguration
* mWidget
;
762 class SecurityPageWarningTab
: public ConfigModuleTab
{
765 SecurityPageWarningTab( QWidget
* parent
=0 );
767 QString
helpAnchor() const;
772 void slotReenableAllWarningsClicked();
773 void slotConfigureGnupg();
774 void slotConfigureChiasmus();
777 virtual void doLoadFromGlobalSettings();
778 virtual void doLoadOther();
779 //FIXME virtual void doResetToDefaultsOther();
782 WarningConfiguration
* mWidget
;
785 class SecurityPageSMimeTab
: public ConfigModuleTab
{
788 SecurityPageSMimeTab( QWidget
* parent
=0 );
789 ~SecurityPageSMimeTab();
791 QString
helpAnchor() const;
796 void slotUpdateHTTPActions();
799 //virtual void doLoadFromGlobalSettings();
800 virtual void doLoadOther();
801 //FIXME virtual void doResetToDefaultsOther();
804 SMimeConfiguration
* mWidget
;
805 Kleo::CryptoConfig
* mConfig
;
808 class KMAIL_EXPORT SecurityPage
: public ConfigModuleWithTabs
{
811 explicit SecurityPage( const KComponentData
&instance
, QWidget
*parent
=0 );
813 QString
helpAnchor() const;
815 typedef SecurityPageGeneralTab GeneralTab
;
816 typedef SecurityPageComposerCryptoTab ComposerCryptoTab
;
817 typedef SecurityPageWarningTab WarningTab
;
818 typedef SecurityPageSMimeTab SMimeTab
;
821 GeneralTab
*mGeneralTab
;
822 ComposerCryptoTab
*mComposerCryptoTab
;
823 WarningTab
*mWarningTab
;
834 class MiscPageFolderTab
: public ConfigModuleTab
{
837 MiscPageFolderTab( QWidget
* parent
=0 );
840 QString
helpAnchor() const;
843 virtual void doLoadFromGlobalSettings();
844 virtual void doLoadOther();
845 //FIXME virtual void doResetToDefaultsOther();
848 Ui_MiscMainTab mMMTab
;
849 MailCommon::FolderRequester
*mOnStartupOpenFolder
;
852 class MiscPageInviteTab
: public ConfigModuleTab
{
855 MiscPageInviteTab( QWidget
* parent
=0 );
857 virtual void doResetToDefaultsOther();
860 virtual void doLoadFromGlobalSettings();
863 MessageViewer::InvitationSettings
*mInvitationUi
;
866 class KMAIL_EXPORT MiscPage
: public ConfigModuleWithTabs
{
869 explicit MiscPage( const KComponentData
&instance
, QWidget
*parent
=0 );
870 QString
helpAnchor() const;
872 typedef MiscPageFolderTab FolderTab
;
873 typedef MiscPageInviteTab InviteTab
;
876 FolderTab
* mFolderTab
;
877 InviteTab
* mInviteTab
;
880 #endif // _CONFIGURE_DIALOG_PRIVATE_H_