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 slotRestartSelectedAccount();
219 void slotEditNotifications();
220 void slotShowMailCheckMenu( const QString
&, const QPoint
& );
221 void slotIncludeInCheckChanged( bool checked
);
222 void slotOfflineOnShutdownChanged( bool checked
);
223 void slotCheckOnStatupChanged( bool checked
);
226 virtual void doLoadFromGlobalSettings();
227 virtual void doLoadOther();
229 struct RetrievalOptions
{
230 RetrievalOptions( bool manualCheck
, bool offline
, bool checkOnStartup
)
231 : IncludeInManualChecks( manualCheck
)
232 , OfflineOnShutdown( offline
)
233 ,CheckOnStartup( checkOnStartup
) {}
234 bool IncludeInManualChecks
;
235 bool OfflineOnShutdown
;
239 QHash
<QString
, QSharedPointer
<RetrievalOptions
> > mRetrievalHash
;
240 //FIXME virtual void doResetToDefaultsOther();
243 Ui_AccountsPageReceivingTab mAccountsReceiving
;
246 class KMAIL_EXPORT AccountsPage
: public ConfigModuleWithTabs
{
249 explicit AccountsPage( const KComponentData
&instance
, QWidget
*parent
=0 );
250 QString
helpAnchor() const;
253 // hrmpf. moc doesn't like nested classes with slots/signals...:
254 typedef AccountsPageSendingTab SendingTab
;
255 typedef AccountsPageReceivingTab ReceivingTab
;
258 void accountListChanged( const QStringList
& );
261 SendingTab
*mSendingTab
;
262 ReceivingTab
*mReceivingTab
;
272 class AppearancePageFontsTab
: public ConfigModuleTab
{
275 AppearancePageFontsTab( QWidget
* parent
=0 );
276 QString
helpAnchor() const;
280 void slotFontSelectorChanged( int );
283 //virtual void doLoadFromGlobalSettings();
284 virtual void doLoadOther();
285 void updateFontSelector();
286 virtual void doResetToDefaultsOther();
289 QCheckBox
*mCustomFontCheck
;
290 KComboBox
*mFontLocationCombo
;
291 KFontChooser
*mFontChooser
;
293 int mActiveFontIndex
;
297 class AppearancePageColorsTab
: public ConfigModuleTab
{
300 AppearancePageColorsTab( QWidget
* parent
=0 );
301 QString
helpAnchor() const;
305 //virtual void doLoadFromGlobalSettings();
306 virtual void doLoadOther();
307 virtual void doResetToDefaultsOther();
308 void loadColor( bool loadFromConfig
);
311 QCheckBox
*mCustomColorCheck
;
312 ColorListBox
*mColorList
;
313 QCheckBox
*mRecycleColorCheck
;
314 QSpinBox
*mCloseToQuotaThreshold
;
317 class AppearancePageLayoutTab
: public ConfigModuleTab
{
320 AppearancePageLayoutTab( QWidget
* parent
=0 );
321 QString
helpAnchor() const;
326 //virtual void doLoadFromGlobalSettings();
327 virtual void doLoadOther();
328 //FIXME virtual void doResetToDefaultsOther();
331 QButtonGroup
*mFolderListGroup
;
332 QGroupBox
*mFolderListGroupBox
;
333 QButtonGroup
*mReaderWindowModeGroup
;
334 QGroupBox
*mReaderWindowModeGroupBox
;
335 QCheckBox
*mFavoriteFolderViewCB
;
336 QCheckBox
*mFolderQuickSearchCB
;
337 QButtonGroup
*mFolderToolTipsGroup
;
338 QGroupBox
*mFolderToolTipsGroupBox
;
341 class AppearancePageHeadersTab
: public ConfigModuleTab
{
344 AppearancePageHeadersTab( QWidget
* parent
=0 );
346 QString
helpAnchor() const;
351 virtual void doLoadFromGlobalSettings();
352 virtual void doLoadOther();
353 // virtual void doResetToDefaultsOther();
354 void setDateDisplay( int id
, const QString
& format
);
357 QCheckBox
*mDisplayMessageToolTips
;
358 QCheckBox
*mHideTabBarWithSingleTab
;
359 MessageList::Utils::AggregationComboBox
*mAggregationComboBox
;
360 MessageList::Utils::ThemeComboBox
*mThemeComboBox
;
361 KButtonGroup
*mDateDisplay
;
362 KLineEdit
*mCustomDateFormatEdit
;
363 QString mCustomDateWhatsThis
;
366 void slotLinkClicked( const QString
& link
);
367 void slotSelectDefaultAggregation();
368 void slotSelectDefaultTheme();
371 class AppearancePageReaderTab
: public ConfigModuleTab
{
374 AppearancePageReaderTab( QWidget
* parent
=0 );
376 QString
helpAnchor() const;
381 virtual void doLoadOther();
382 //FIXME virtual void doResetToDefaultsOther();
385 QCheckBox
*mCloseAfterReplyOrForwardCheck
;
386 MessageViewer::ConfigureWidget
*mViewerSettings
;
390 class AppearancePageSystemTrayTab
: public ConfigModuleTab
{
393 AppearancePageSystemTrayTab( QWidget
* parent
=0 );
395 QString
helpAnchor() const;
400 virtual void doLoadFromGlobalSettings();
403 QCheckBox
*mSystemTrayCheck
;
404 KButtonGroup
*mSystemTrayGroup
;
407 /**Configuration tab in the appearance page for modifying the available set of
409 class AppearancePageMessageTagTab
: public ConfigModuleTab
{
412 AppearancePageMessageTagTab( QWidget
* parent
=0);
413 ~AppearancePageMessageTagTab();
415 QString
helpAnchor() const;
420 /**Enables/disables Add button according to whether @p aText is empty.
421 Connected to signal of the line edit widget for adding tags
422 @param aText String to change add button according to
424 void slotAddLineTextChanged( const QString
&aText
);
425 /**Creates a generic tag with the visible name from the line edit widget for
426 adding tags. Adds it to the end of the list and selects. Empties the line
428 void slotAddNewTag();
429 /**Removes the currently selected text in the list box.*/
430 void slotRemoveTag();
431 /**Increases the currently selected tag's priority and handles related visual
433 void slotMoveTagUp();
434 /**Decreases the currently selected tag's priority and handles related visual
436 void slotMoveTagDown();
439 /*Handles necessary processing when the selection in the edit box changes.
440 Records the unselected tag's information, and applies visual changes
441 necessary depending on the description of the new tag. Private since doesn't
442 change the selection of the edit box itself*/
443 void slotSelectionChanged();
444 /*This slot is necessary so that apply button is not activated when we are
445 only applying visual changes after selecting a new tag in the list box*/
446 void slotEmitChangeCheck();
447 /*Transfers the tag settings from the widgets to the internal data structures.
448 Private since passing a wrong parameter modifies another tag's data*/
449 void slotRecordTagSettings( int aIndex
);
450 /*Transfers the tag settings from the internal data structures to the widgets.
451 Private since passing a wrong parameter visualizes another tag's data*/
452 void slotUpdateTagSettingWidgets( int aIndex
);
453 /*Transfers changes in the tag name edit box to the list box for tags. Private
454 since calling externally decouples the name in the list box from name edit box*/
455 void slotNameLineTextChanged( const QString
& );
456 void slotIconNameChanged( const QString
&iconName
);
459 virtual void doLoadFromGlobalSettings();
460 void swapTagsInListBox( const int first
, const int second
);
464 KLineEdit
*mTagNameLineEdit
, *mTagAddLineEdit
;
465 QPushButton
*mTagAddButton
, *mTagRemoveButton
,
466 *mTagUpButton
, *mTagDownButton
;
468 QListWidget
*mTagListBox
;
470 QCheckBox
*mTextColorCheck
, *mBackgroundColorCheck
,
471 *mTextFontCheck
, *mInToolbarCheck
;
473 QGroupBox
*mTagsGroupBox
, *mTagSettingGroupBox
;
475 KColorCombo
*mTextColorCombo
, *mBackgroundColorCombo
;
477 KFontRequester
*mFontRequester
;
479 KIconButton
*mIconButton
;
481 KKeySequenceWidget
*mKeySequenceWidget
;
483 // Maps Nepomuk::Tag resource URIs to Tags
484 QHash
<QString
,KMail::TagPtr
> mMsgTagDict
;
486 // List of all Tags currently in the list
487 QList
<KMail::TagPtr
> mMsgTagList
;
489 // So we can compare to mMsgTagList and see if the user changed tags
490 QList
<KMail::TagPtr
> mOriginalMsgTagList
;
492 /*Used to safely call slotRecordTagSettings when the selection in
496 class KMAIL_EXPORT AppearancePage
: public ConfigModuleWithTabs
{
499 explicit AppearancePage( const KComponentData
&instance
, QWidget
*parent
=0 );
501 QString
helpAnchor() const;
503 // hrmpf. moc doesn't like nested classes with slots/signals...:
504 typedef AppearancePageFontsTab FontsTab
;
505 typedef AppearancePageColorsTab ColorsTab
;
506 typedef AppearancePageLayoutTab LayoutTab
;
507 typedef AppearancePageHeadersTab HeadersTab
;
508 typedef AppearancePageReaderTab ReaderTab
;
509 typedef AppearancePageSystemTrayTab SystemTrayTab
;
510 typedef AppearancePageMessageTagTab MessageTagTab
;
514 ColorsTab
*mColorsTab
;
515 LayoutTab
*mLayoutTab
;
516 HeadersTab
*mHeadersTab
;
517 ReaderTab
*mReaderTab
;
518 SystemTrayTab
*mSystemTrayTab
;
519 MessageTagTab
*mMessageTagTab
;
528 class ComposerPageGeneralTab
: public ConfigModuleTab
{
531 ComposerPageGeneralTab( QWidget
* parent
=0 );
532 QString
helpAnchor() const;
536 void slotConfigureRecentAddresses();
537 void slotConfigureCompletionOrder();
540 virtual void doLoadFromGlobalSettings();
543 QCheckBox
*mAutoAppSignFileCheck
;
544 QCheckBox
*mTopQuoteCheck
;
545 QCheckBox
*mDashDashCheck
;
546 QCheckBox
*mSmartQuoteCheck
;
547 QCheckBox
*mStripSignatureCheck
;
548 QCheckBox
*mQuoteSelectionOnlyCheck
;
549 QCheckBox
*mAutoRequestMDNCheck
;
550 QCheckBox
*mShowRecentAddressesInComposer
;
551 QCheckBox
*mWordWrapCheck
;
552 KIntSpinBox
*mWrapColumnSpin
;
553 KIntSpinBox
*mAutoSave
;
554 QCheckBox
*mExternalEditorCheck
;
555 KUrlRequester
*mEditorRequester
;
556 KIntSpinBox
*mMaximumRecipients
;
557 #ifdef KDEPIM_ENTERPRISE_BUILD
558 KComboBox
*mForwardTypeCombo
;
559 QCheckBox
*mRecipientCheck
;
560 KIntSpinBox
*mRecipientSpin
;
564 class ComposerPageTemplatesTab
: public ConfigModuleTab
{
567 ComposerPageTemplatesTab( QWidget
* parent
= 0 );
568 QString
helpAnchor() const;
575 virtual void doLoadFromGlobalSettings();
576 virtual void doResetToDefaultsOther();
578 TemplatesConfiguration
* mWidget
;
581 class ComposerPageCustomTemplatesTab
: public ConfigModuleTab
{
584 ComposerPageCustomTemplatesTab( QWidget
* parent
= 0 );
585 QString
helpAnchor() const;
592 virtual void doLoadFromGlobalSettings();
595 CustomTemplates
* mWidget
;
598 class ComposerPageSubjectTab
: public ConfigModuleTab
{
601 ComposerPageSubjectTab( QWidget
* parent
= 0 );
602 QString
helpAnchor() const;
607 virtual void doLoadFromGlobalSettings();
608 virtual void doResetToDefaultsOther();
611 SimpleStringListEditor
*mReplyListEditor
;
612 QCheckBox
*mReplaceReplyPrefixCheck
;
613 SimpleStringListEditor
*mForwardListEditor
;
614 QCheckBox
*mReplaceForwardPrefixCheck
;
617 class ComposerPageCharsetTab
: public ConfigModuleTab
{
620 ComposerPageCharsetTab( QWidget
* parent
=0 );
621 QString
helpAnchor() const;
626 void slotVerifyCharset(QString
&);
629 //virtual void doLoadFromGlobalSettings();
630 virtual void doLoadOther();
631 virtual void doResetToDefaultsOther();
634 SimpleStringListEditor
*mCharsetListEditor
;
635 QCheckBox
*mKeepReplyCharsetCheck
;
638 class ComposerPageHeadersTab
: public ConfigModuleTab
{
641 ComposerPageHeadersTab( QWidget
* parent
=0 );
642 QString
helpAnchor() const;
647 void slotMimeHeaderSelectionChanged();
648 void slotMimeHeaderNameChanged( const QString
& );
649 void slotMimeHeaderValueChanged( const QString
& );
650 void slotNewMimeHeader();
651 void slotRemoveMimeHeader();
654 //virtual void doLoadFromGlobalSettings();
655 virtual void doLoadOther();
656 virtual void doResetToDefaultsOther();
659 QCheckBox
*mCreateOwnMessageIdCheck
;
660 KLineEdit
*mMessageIdSuffixEdit
;
661 QRegExpValidator
*mMessageIdSuffixValidator
;
663 QPushButton
*mRemoveHeaderButton
;
664 KLineEdit
*mTagNameEdit
;
665 KLineEdit
*mTagValueEdit
;
666 QLabel
*mTagNameLabel
;
667 QLabel
*mTagValueLabel
;
670 class ComposerPageAttachmentsTab
: public ConfigModuleTab
{
673 ComposerPageAttachmentsTab( QWidget
* parent
=0 );
674 QString
helpAnchor() const;
679 void slotOutlookCompatibleClicked();
682 virtual void doLoadFromGlobalSettings();
683 //FIXME virtual void doResetToDefaultsOther();
686 QCheckBox
*mOutlookCompatibleCheck
;
687 QCheckBox
*mMissingAttachmentDetectionCheck
;
688 SimpleStringListEditor
*mAttachWordsListEditor
;
691 class KMAIL_EXPORT ComposerPage
: public ConfigModuleWithTabs
{
694 explicit ComposerPage( const KComponentData
&instance
, QWidget
*parent
=0 );
696 QString
helpAnchor() const;
698 // hrmpf. moc doesn't like nested classes with slots/signals...:
699 typedef ComposerPageGeneralTab GeneralTab
;
700 typedef ComposerPageTemplatesTab TemplatesTab
;
701 typedef ComposerPageCustomTemplatesTab CustomTemplatesTab
;
702 typedef ComposerPageSubjectTab SubjectTab
;
703 typedef ComposerPageCharsetTab CharsetTab
;
704 typedef ComposerPageHeadersTab HeadersTab
;
705 typedef ComposerPageAttachmentsTab AttachmentsTab
;
708 GeneralTab
*mGeneralTab
;
709 TemplatesTab
*mTemplatesTab
;
710 CustomTemplatesTab
*mCustomTemplatesTab
;
711 SubjectTab
*mSubjectTab
;
712 CharsetTab
*mCharsetTab
;
713 HeadersTab
*mHeadersTab
;
714 AttachmentsTab
*mAttachmentsTab
;
723 class SecurityPageGeneralTab
: public ConfigModuleTab
{
726 SecurityPageGeneralTab( QWidget
* parent
=0 );
727 QString
helpAnchor() const;
732 //virtual void doLoadFromGlobalSettings();
733 virtual void doLoadOther();
734 //FIXME virtual void doResetToDefaultsOther();
737 QButtonGroup
*mMDNGroup
;
738 QButtonGroup
*mOrigQuoteGroup
;
739 Ui_SecurityPageGeneralTab mSGTab
;
742 void slotLinkClicked( const QString
& link
);
746 class SecurityPageComposerCryptoTab
: public ConfigModuleTab
{
749 SecurityPageComposerCryptoTab( QWidget
* parent
=0 );
751 QString
helpAnchor() const;
756 virtual void doLoadFromGlobalSettings();
757 virtual void doLoadOther();
758 //FIXME virtual void doResetToDefaultsOther();
761 ComposerCryptoConfiguration
* mWidget
;
764 class SecurityPageWarningTab
: public ConfigModuleTab
{
767 SecurityPageWarningTab( QWidget
* parent
=0 );
769 QString
helpAnchor() const;
774 void slotReenableAllWarningsClicked();
775 void slotConfigureGnupg();
776 void slotConfigureChiasmus();
779 virtual void doLoadFromGlobalSettings();
780 virtual void doLoadOther();
781 //FIXME virtual void doResetToDefaultsOther();
784 WarningConfiguration
* mWidget
;
787 class SecurityPageSMimeTab
: public ConfigModuleTab
{
790 SecurityPageSMimeTab( QWidget
* parent
=0 );
791 ~SecurityPageSMimeTab();
793 QString
helpAnchor() const;
798 void slotUpdateHTTPActions();
801 //virtual void doLoadFromGlobalSettings();
802 virtual void doLoadOther();
803 //FIXME virtual void doResetToDefaultsOther();
806 SMimeConfiguration
* mWidget
;
807 Kleo::CryptoConfig
* mConfig
;
810 class KMAIL_EXPORT SecurityPage
: public ConfigModuleWithTabs
{
813 explicit SecurityPage( const KComponentData
&instance
, QWidget
*parent
=0 );
815 QString
helpAnchor() const;
817 typedef SecurityPageGeneralTab GeneralTab
;
818 typedef SecurityPageComposerCryptoTab ComposerCryptoTab
;
819 typedef SecurityPageWarningTab WarningTab
;
820 typedef SecurityPageSMimeTab SMimeTab
;
823 GeneralTab
*mGeneralTab
;
824 ComposerCryptoTab
*mComposerCryptoTab
;
825 WarningTab
*mWarningTab
;
836 class MiscPageFolderTab
: public ConfigModuleTab
{
839 MiscPageFolderTab( QWidget
* parent
=0 );
842 QString
helpAnchor() const;
845 virtual void doLoadFromGlobalSettings();
846 virtual void doLoadOther();
847 //FIXME virtual void doResetToDefaultsOther();
850 Ui_MiscMainTab mMMTab
;
851 MailCommon::FolderRequester
*mOnStartupOpenFolder
;
854 class MiscPageInviteTab
: public ConfigModuleTab
{
857 MiscPageInviteTab( QWidget
* parent
=0 );
859 virtual void doResetToDefaultsOther();
862 virtual void doLoadFromGlobalSettings();
865 MessageViewer::InvitationSettings
*mInvitationUi
;
868 class KMAIL_EXPORT MiscPage
: public ConfigModuleWithTabs
{
871 explicit MiscPage( const KComponentData
&instance
, QWidget
*parent
=0 );
872 QString
helpAnchor() const;
874 typedef MiscPageFolderTab FolderTab
;
875 typedef MiscPageInviteTab InviteTab
;
878 FolderTab
* mFolderTab
;
879 InviteTab
* mInviteTab
;
882 #endif // _CONFIGURE_DIALOG_PRIVATE_H_