19 #include "pimcommon/widgets/configureimmutablewidgetutils.h"
21 using namespace PimCommon::ConfigureImmutableWidgetUtils;
24 #include "pimcommon/autocorrection/autocorrectionwidget.h"
25 #include "messagecomposer/imagescaling/imagescalingwidget.h"
26 #include "messagecomposer/settings/messagecomposersettings.h"
27 #include "messagecore/settings/globalsettings.h"
30 #include "pimcommon/widgets/simplestringlisteditor.h"
31 #include "templateparser/templatesconfiguration_kfg.h"
32 #include "templateparser/templatesconfiguration.h"
33 #include "templateparser/customtemplates.h"
34 #include "templateparser/globalsettings_base.h"
35 #include "messageviewer/utils/autoqpointer.h"
43 #include <KLocalizedString>
46 #include <KUrlRequester>
48 #include <KMessageBox>
51 #include <KIntSpinBox>
52 #include <KIntNumInput>
56 #include <QVBoxLayout>
57 #include <QGridLayout>
75 addTab( mGeneralTab, i18nc(
"General settings for the composer.",
"General") );
82 addTab( mTemplatesTab, i18n(
"Standard Templates") );
88 addTab( mCustomTemplatesTab, i18n(
"Custom Templates") );
94 addTab( mSubjectTab, i18nc(
"Settings regarding the subject when composing a message.",
"Subject") );
101 addTab( mCharsetTab, i18n(
"Charset") );
107 addTab( mHeadersTab, i18n(
"Headers") );
113 addTab( mAttachmentsTab, i18nc(
"Config->Composer->Attachments",
"Attachments") );
119 addTab( mAutoCorrectionTab, i18n(
"Autocorrection") );
125 addTab( mAutoImageResizeTab, i18n(
"Auto Resize Image") );
130 addTab( mExternalEditorTab, i18n(
"External Editor") );
152 MessageComposer::MessageComposerSettings::self()->autoTextSignatureItem()->label(),
155 QString helpText = i18n(
"Automatically insert the configured signature\n"
156 "when starting to compose a message" );
157 mAutoAppSignFileCheck->
setToolTip( helpText );
160 connect( mAutoAppSignFileCheck, SIGNAL(stateChanged(
int)),
162 groupVBoxLayout->
addWidget( mAutoAppSignFileCheck );
166 MessageComposer::MessageComposerSettings::self()->prependSignatureItem()->label(),
this );
169 helpText = i18n(
"Insert the signature above any quoted text" );
173 connect( mTopQuoteCheck, SIGNAL(stateChanged(
int)),
175 connect( mAutoAppSignFileCheck, SIGNAL(toggled(
bool)),
177 groupVBoxLayout->
addWidget( mTopQuoteCheck );
181 MessageComposer::MessageComposerSettings::self()->dashDashSignatureItem()->label(),
this );
184 helpText = i18n(
"Insert the RFC-compliant signature separator\n"
185 "(two dashes and a space on a line) before the signature" );
189 connect( mDashDashCheck, SIGNAL(stateChanged(
int)),
191 connect( mAutoAppSignFileCheck, SIGNAL(toggled(
bool)),
193 groupVBoxLayout->
addWidget( mDashDashCheck);
196 mStripSignatureCheck =
new QCheckBox( TemplateParser::GlobalSettings::self()->stripSignatureItem()->label(),
199 helpText = i18n(
"When replying, do not quote any existing signature" );
203 connect( mStripSignatureCheck, SIGNAL(stateChanged(
int)),
205 groupVBoxLayout->
addWidget( mStripSignatureCheck );
211 groupBox =
new QGroupBox( i18nc(
"@title:group",
"Format" ) );
216 mQuoteSelectionOnlyCheck =
new QCheckBox( MessageComposer::MessageComposerSettings::self()->quoteSelectionOnlyItem()->label(),
218 helpText = i18n(
"When replying, only quote the selected text\n"
219 "(instead of the complete message), if\n"
220 "there is text selected in the message window." );
221 mQuoteSelectionOnlyCheck->
setToolTip( helpText );
224 connect( mQuoteSelectionOnlyCheck, SIGNAL(stateChanged(
int)),
226 groupGridLayout->
addWidget( mQuoteSelectionOnlyCheck, row, 0, 1, -1 );
231 TemplateParser::GlobalSettings::self()->smartQuoteItem()->label(),
this );
232 helpText = i18n(
"When replying, add quote signs in front of all lines of the quoted text,\n"
233 "even when the line was created by adding an additional line break while\n"
234 "word-wrapping the text." );
238 connect( mSmartQuoteCheck, SIGNAL(stateChanged(
int)),
240 groupGridLayout->
addWidget( mSmartQuoteCheck, row, 0, 1, -1 );
245 MessageComposer::MessageComposerSettings::self()->wordWrapItem()->label(),
this);
247 helpText = i18n(
"Enable automatic word wrapping at the specified width" );
251 mWrapColumnSpin =
new KIntSpinBox( 30, 78, 1,
253 mWrapColumnSpin->setEnabled(
false );
255 helpText = i18n(
"Set the text width for automatic word wrapping" );
256 mWrapColumnSpin->setToolTip( helpText );
257 mWrapColumnSpin->setWhatsThis( helpText );
259 connect( mWordWrapCheck, SIGNAL(stateChanged(
int)),
261 connect( mWrapColumnSpin, SIGNAL(valueChanged(
int)),
264 connect( mWordWrapCheck, SIGNAL(toggled(
bool)),
267 groupGridLayout->
addWidget( mWordWrapCheck, row, 0 );
268 groupGridLayout->
addWidget( mWrapColumnSpin, row, 1 );
276 mReplyUsingHtml =
new QCheckBox( TemplateParser::GlobalSettings::self()->replyUsingHtmlItem()->label(),
this );
277 helpText = i18n(
"When replying or forwarding, quote the message\n"
278 "in the original format it was received.\n"
279 "If unchecked, the reply will be as plain text by default." );
283 connect( mReplyUsingHtml, SIGNAL(stateChanged(
int)),
285 groupGridLayout->
addWidget( mReplyUsingHtml, row, 0, 1, -1 );
289 mImprovePlainTextOfHtmlMessage =
new QCheckBox( MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessageItem()->label(),
this );
292 helpText = i18n(
"Format the plain text part of a message from the HTML markup.\n"
293 "Bold, italic and underlined text, lists, and external references\n"
295 mImprovePlainTextOfHtmlMessage->
setToolTip( helpText );
296 mImprovePlainTextOfHtmlMessage->
setWhatsThis( helpText );
298 connect( mImprovePlainTextOfHtmlMessage, SIGNAL(stateChanged(
int)),
300 groupGridLayout->
addWidget( mImprovePlainTextOfHtmlMessage, row, 0, 1, -1 );
308 mAutoSave =
new KIntSpinBox( 0, 60, 1, 1,
this );
309 mAutoSave->setObjectName(
QLatin1String(
"kcfg_AutosaveInterval") );
310 mAutoSave->setSpecialValueText( i18n(
"No autosave") );
311 mAutoSave->setSuffix( ki18ncp(
"Interval suffix",
" minute",
" minutes" ) );
313 helpText = i18n(
"Automatically save the message at this specified interval" );
314 mAutoSave->setToolTip( helpText );
315 mAutoSave->setWhatsThis( helpText );
320 connect( mAutoSave, SIGNAL(valueChanged(
int)),
323 groupGridLayout->
addWidget( label, row, 0 );
324 groupGridLayout->
addWidget( mAutoSave, row, 1 );
327 #ifdef KDEPIM_ENTERPRISE_BUILD
329 mForwardTypeCombo =
new KComboBox(
false,
this );
330 mForwardTypeCombo->addItems(
QStringList() << i18nc(
"@item:inlistbox Inline mail forwarding",
332 << i18n(
"As Attachment" ) );
334 helpText = i18n(
"Set the default forwarded message format" );
335 mForwardTypeCombo->setToolTip( helpText );
336 mForwardTypeCombo->setWhatsThis( helpText );
338 label =
new QLabel( i18n(
"Default forwarding type:" ),
this );
339 label->
setBuddy( mForwardTypeCombo );
341 connect( mForwardTypeCombo, SIGNAL(activated(
int)),
344 groupGridLayout->
addWidget( label, row, 0 );
345 groupGridLayout->
addWidget( mForwardTypeCombo, row, 1 );
353 groupBox =
new QGroupBox( i18nc(
"@title:group",
"Recipients" ) );
361 helpText = i18n(
"By default, request an MDN when starting to compose a message.\n"
362 "You can select this on a per-message basis using \"Options - Request Disposition Notification\"" );
366 connect( mAutoRequestMDNCheck, SIGNAL(stateChanged(
int)),
368 groupGridLayout->
addWidget( mAutoRequestMDNCheck, row, 0, 1, -1 );
376 mShowBalooSearchAddressesInComposer =
new QCheckBox(
377 MessageComposer::MessageComposerSettings::self()->showBalooSearchInComposerItem()->label(),
380 connect( mShowBalooSearchAddressesInComposer, SIGNAL(stateChanged(
int)),
382 groupGridLayout->
addWidget( mShowBalooSearchAddressesInComposer, row, 0, 1, -1 );
386 #ifdef KDEPIM_ENTERPRISE_BUILD
390 mRecipientCheck->setObjectName(
QLatin1String(
"kcfg_TooManyRecipients") );
392 mRecipientCheck->setWhatsThis( helpText );
393 mRecipientCheck->setToolTip( i18n(
"Warn if too many recipients are specified" ) );
395 mRecipientSpin =
new KIntSpinBox( 1, 100, 1,
397 mRecipientSpin->setObjectName(
QLatin1String(
"kcfg_RecipientThreshold") );
398 mRecipientSpin->setEnabled(
false );
400 mRecipientSpin->setWhatsThis( helpText );
401 mRecipientSpin->setToolTip( i18n(
"Set the maximum number of recipients for the warning" ) );
403 connect( mRecipientCheck, SIGNAL(stateChanged(
int)),
405 connect( mRecipientSpin, SIGNAL(valueChanged(
int)),
408 connect( mRecipientCheck, SIGNAL(toggled(
bool)),
411 groupGridLayout->
addWidget( mRecipientCheck, row, 0, 1, 2);
412 groupGridLayout->
addWidget( mRecipientSpin, row, 2 );
417 mMaximumRecipients =
new KIntSpinBox( 0, 9999, 1, 1,
this );
419 helpText = i18n(
"Only allow this many recipients to be specified for the message.\n"
420 "This applies to doing a \"Reply to All\", entering recipients manually\n"
421 "or using the \"Select...\" picker. Setting this limit helps you to\n"
422 "avoid accidentally sending a message to too many people. Note,\n"
423 "however, that it does not take account of distribution lists or\n"
425 mMaximumRecipients->setToolTip( helpText );
426 mMaximumRecipients->setWhatsThis( helpText );
428 label =
new QLabel( MessageComposer::MessageComposerSettings::self()->maximumRecipientsItem()->label(),
this );
429 label->
setBuddy(mMaximumRecipients);
431 connect( mMaximumRecipients, SIGNAL(valueChanged(
int)),
434 groupGridLayout->
addWidget( label, row, 0, 1, 2 );
435 groupGridLayout->
addWidget( mMaximumRecipients, row, 2 );
443 mShowRecentAddressesInComposer =
new QCheckBox(
444 MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposerItem()->label(),
447 helpText = i18n(
"Remember recent addresses entered,\n"
448 "and offer them for recipient completion" );
449 mShowRecentAddressesInComposer->
setToolTip( helpText );
450 mShowRecentAddressesInComposer->
setWhatsThis( helpText );
452 connect( mShowRecentAddressesInComposer, SIGNAL(stateChanged(
int)),
454 groupGridLayout->
addWidget( mShowRecentAddressesInComposer, row, 0, 1, -1 );
458 mMaximumRecentAddress =
new KIntNumInput(
this );
459 mMaximumRecentAddress->setSliderEnabled(
false );
460 mMaximumRecentAddress->setMinimum( 0 );
461 mMaximumRecentAddress->setMaximum( 999 );
462 mMaximumRecentAddress->setSpecialValueText( i18nc(
"No addresses are retained",
"No save" ) );
463 mMaximumRecentAddress->setEnabled(
false );
465 label =
new QLabel( i18n(
"Maximum recent addresses retained:" ) );
466 label->
setBuddy( mMaximumRecentAddress );
469 helpText = i18n(
"The maximum number of recently entered addresses that will\n"
470 "be remembered for completion" );
471 mMaximumRecentAddress->setToolTip( helpText );
472 mMaximumRecentAddress->setWhatsThis( helpText );
474 connect( mMaximumRecentAddress, SIGNAL(valueChanged(
int)),
476 connect( mShowRecentAddressesInComposer, SIGNAL(toggled(
bool)),
477 mMaximumRecentAddress, SLOT(
setEnabled(
bool)) );
478 connect( mShowRecentAddressesInComposer, SIGNAL(toggled(
bool)),
481 groupGridLayout->
addWidget( label, row, 0, 1, 2 );
482 groupGridLayout->
addWidget( mMaximumRecentAddress, row, 2 );
487 helpText = i18n(
"Edit, add or remove recent addresses" );
491 connect( recentAddressesBtn, SIGNAL(clicked()),
492 this, SLOT(slotConfigureRecentAddresses()) );
493 groupGridLayout->
addWidget( recentAddressesBtn, row, 1, 1, 2 );
499 helpText = i18n(
"Configure the order in which address books\n"
500 "will be used when doing address completion" );
504 connect( completionOrderBtn, SIGNAL(clicked()),
505 this, SLOT(slotConfigureCompletionOrder()) );
506 groupGridLayout->
addWidget( completionOrderBtn, row, 1, 1, 2 );
512 connect( completionEmailBacklistBtn, SIGNAL(clicked()),
513 this, SLOT(slotConfigureEmailBlacklist()) );
514 groupGridLayout->
addWidget( completionEmailBacklistBtn, row, 1, 1, 2 );
533 void ComposerPage::GeneralTab::doResetToDefaultsOther()
535 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
537 const bool autoAppSignFile = MessageComposer::MessageComposerSettings::self()->autoTextSignature()==
QLatin1String(
"auto" );
538 const bool topQuoteCheck = MessageComposer::MessageComposerSettings::self()->prependSignature();
539 const bool dashDashSignature = MessageComposer::MessageComposerSettings::self()->dashDashSignature();
540 const bool smartQuoteCheck = MessageComposer::MessageComposerSettings::self()->quoteSelectionOnly();
541 const bool wordWrap = MessageComposer::MessageComposerSettings::self()->wordWrap();
542 const int wrapColumn = MessageComposer::MessageComposerSettings::self()->lineWrapWidth();
543 const bool showRecentAddress = MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposer();
544 const int maximumRecipient = MessageComposer::MessageComposerSettings::self()->maximumRecipients();
545 const bool improvePlainText = MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage();
546 const bool showBalooSearchInComposer = MessageComposer::MessageComposerSettings::self()->showBalooSearchInComposer();
547 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
549 mAutoAppSignFileCheck->
setChecked( autoAppSignFile );
551 mDashDashCheck->
setChecked( dashDashSignature );
552 mQuoteSelectionOnlyCheck->
setChecked( smartQuoteCheck );
554 mWrapColumnSpin->setValue( wrapColumn );
555 mMaximumRecipients->setValue( maximumRecipient );
556 mShowRecentAddressesInComposer->
setChecked( showRecentAddress );
557 mShowBalooSearchAddressesInComposer->
setChecked(showBalooSearchInComposer);
558 mImprovePlainTextOfHtmlMessage->
setChecked(improvePlainText);
560 mMaximumRecentAddress->setValue( 40 );
563 void ComposerPage::GeneralTab::doLoadFromGlobalSettings()
568 MessageComposer::MessageComposerSettings::self()->autoTextSignature()==
QLatin1String(
"auto" ) );
569 loadWidget(mTopQuoteCheck, MessageComposer::MessageComposerSettings::self()->prependSignatureItem() );
570 loadWidget(mDashDashCheck, MessageComposer::MessageComposerSettings::self()->dashDashSignatureItem() );
571 loadWidget(mSmartQuoteCheck,TemplateParser::GlobalSettings::self()->smartQuoteItem() );
572 loadWidget(mQuoteSelectionOnlyCheck, MessageComposer::MessageComposerSettings::self()->quoteSelectionOnlyItem() );
574 loadWidget(mReplyUsingHtml, TemplateParser::GlobalSettings::self()->replyUsingHtmlItem() );
575 loadWidget(mStripSignatureCheck, TemplateParser::GlobalSettings::self()->stripSignatureItem() );
577 loadWidget(mWordWrapCheck, MessageComposer::MessageComposerSettings::self()->wordWrapItem() );
579 loadWidget(mWrapColumnSpin, MessageComposer::MessageComposerSettings::self()->lineWrapWidthItem() );
580 loadWidget(mMaximumRecipients, MessageComposer::MessageComposerSettings::self()->maximumRecipientsItem() );
582 loadWidget(mShowRecentAddressesInComposer, MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposerItem() );
583 loadWidget(mShowBalooSearchAddressesInComposer, MessageComposer::MessageComposerSettings::self()->showBalooSearchInComposerItem() );
584 mImprovePlainTextOfHtmlMessage->
setChecked(MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage());
586 #ifdef KDEPIM_ENTERPRISE_BUILD
590 mForwardTypeCombo->setCurrentIndex( 0 );
592 mForwardTypeCombo->setCurrentIndex( 1 );
595 mMaximumRecentAddress->setValue(RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->maxCount());
600 saveCheckBox(mTopQuoteCheck, MessageComposer::MessageComposerSettings::self()->prependSignatureItem() );
601 saveCheckBox(mDashDashCheck, MessageComposer::MessageComposerSettings::self()->dashDashSignatureItem() );
602 saveCheckBox(mSmartQuoteCheck,TemplateParser::GlobalSettings::self()->smartQuoteItem() );
603 saveCheckBox(mQuoteSelectionOnlyCheck, MessageComposer::MessageComposerSettings::self()->quoteSelectionOnlyItem() );
605 saveCheckBox(mReplyUsingHtml, TemplateParser::GlobalSettings::self()->replyUsingHtmlItem() );
606 saveCheckBox(mStripSignatureCheck, TemplateParser::GlobalSettings::self()->stripSignatureItem() );
608 saveCheckBox(mWordWrapCheck, MessageComposer::MessageComposerSettings::self()->wordWrapItem() );
611 MessageComposer::MessageComposerSettings::self()->setAutoTextSignature(
613 saveSpinBox(mWrapColumnSpin, MessageComposer::MessageComposerSettings::self()->lineWrapWidthItem() );
614 saveSpinBox(mMaximumRecipients, MessageComposer::MessageComposerSettings::self()->maximumRecipientsItem() );
616 MessageComposer::MessageComposerSettings::self()->setShowRecentAddressesInComposer( mShowRecentAddressesInComposer->
isChecked() );
617 MessageComposer::MessageComposerSettings::self()->setShowBalooSearchInComposer( mShowBalooSearchAddressesInComposer->
isChecked() );
618 MessageComposer::MessageComposerSettings::self()->setImprovePlainTextOfHtmlMessage( mImprovePlainTextOfHtmlMessage->
isChecked() );
619 #ifdef KDEPIM_ENTERPRISE_BUILD
625 RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->setMaxCount( mMaximumRecentAddress->value() );
627 MessageComposer::MessageComposerSettings::self()->
requestSync();
630 void ComposerPage::GeneralTab::slotConfigureRecentAddresses()
633 dlg->setAddresses( RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->addresses() );
634 if ( dlg->exec() && dlg ) {
635 if (dlg->wasChanged()) {
636 RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->clear();
637 dlg->storeAddresses(MessageComposer::MessageComposerSettings::self()->config());
642 void ComposerPage::GeneralTab::slotConfigureEmailBlacklist()
645 KSharedConfig::Ptr config = KSharedConfig::openConfig(
QLatin1String(
"kpimbalooblacklist") );
646 KConfigGroup group( config,
"AddressLineEdit" );
648 dlg->setEmailBlackList(balooBlackList);
653 void ComposerPage::GeneralTab::slotConfigureCompletionOrder()
673 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
679 mEditorRequester =
new KUrlRequester( hbox );
682 connect( mEditorRequester, SIGNAL(urlSelected(KUrl)),
687 hbox->setStretchFactor( mEditorRequester, 1 );
688 label->
setBuddy( mEditorRequester );
691 mEditorRequester->setFilter(
QLatin1String(
"application/x-executable "
692 "application/x-shellscript "
693 "application/x-desktop") );
694 mEditorRequester->setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly);
695 mEditorRequester->setEnabled(
false );
696 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
698 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
701 label =
new QLabel( i18n(
"<b>%f</b> will be replaced with the "
702 "filename to edit.<br />"
703 "<b>%w</b> will be replaced with the window id.<br />"
704 "<b>%l</b> will be replaced with the line number."),
this );
706 connect( mExternalEditorCheck, SIGNAL(toggled(
bool)),
708 layout->
addWidget( mExternalEditorCheck );
714 void ComposerPage::ExternalEditorTab::doLoadFromGlobalSettings()
738 mWidget =
new TemplateParser::TemplatesConfiguration(
this );
745 void ComposerPage::TemplatesTab::doLoadFromGlobalSettings()
747 mWidget->loadFromGlobal();
752 mWidget->saveToGlobal();
755 void ComposerPage::TemplatesTab::doResetToDefaultsOther()
757 mWidget->resetToDefault();
781 void ComposerPage::CustomTemplatesTab::doLoadFromGlobalSettings()
801 vlay->
setMargin( KDialog::marginHint() );
808 QLabel *label =
new QLabel( i18n(
"Recognize any sequence of the following prefixes\n"
809 "(entries are case-insensitive regular expressions):"), group );
814 PimCommon::SimpleStringListEditor::ButtonCode buttonCode =
815 static_cast<PimCommon::SimpleStringListEditor::ButtonCode
>( PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify );
817 new PimCommon::SimpleStringListEditor( group, buttonCode,
818 i18n(
"A&dd..."), i18n(
"Re&move"),
820 i18n(
"Enter new reply prefix:") );
825 mReplaceReplyPrefixCheck =
new QCheckBox(
826 MessageComposer::MessageComposerSettings::self()->replaceReplyPrefixItem()->label(),
828 connect( mReplaceReplyPrefixCheck, SIGNAL(stateChanged(
int)),
832 layout->
addWidget( mReplaceReplyPrefixCheck );
837 group =
new QGroupBox( i18n(
"For&ward Subject Prefixes"),
this );
842 label=
new QLabel( i18n(
"Recognize any sequence of the following prefixes\n"
843 "(entries are case-insensitive regular expressions):"), group );
849 new PimCommon::SimpleStringListEditor( group, buttonCode,
853 i18n(
"Enter new forward prefix:") );
858 mReplaceForwardPrefixCheck =
new QCheckBox(
859 MessageComposer::MessageComposerSettings::self()->replaceForwardPrefixItem()->label(),
861 connect( mReplaceForwardPrefixCheck, SIGNAL(stateChanged(
int)),
865 layout->
addWidget( mReplaceForwardPrefixCheck );
869 void ComposerPage::SubjectTab::doLoadFromGlobalSettings()
871 loadWidget(mReplyListEditor, MessageComposer::MessageComposerSettings::self()->replyPrefixesItem() );
872 loadWidget(mForwardListEditor, MessageComposer::MessageComposerSettings::self()->forwardPrefixesItem() );
873 loadWidget(mReplaceForwardPrefixCheck, MessageComposer::MessageComposerSettings::self()->replaceForwardPrefixItem());
874 loadWidget(mReplaceReplyPrefixCheck, MessageComposer::MessageComposerSettings::self()->replaceReplyPrefixItem());
879 saveSimpleStringListEditor(mReplyListEditor, MessageComposer::MessageComposerSettings::self()->replyPrefixesItem() );
880 saveSimpleStringListEditor(mForwardListEditor, MessageComposer::MessageComposerSettings::self()->forwardPrefixesItem() );
881 saveCheckBox(mReplaceForwardPrefixCheck, MessageComposer::MessageComposerSettings::self()->replaceForwardPrefixItem());
882 saveCheckBox(mReplaceReplyPrefixCheck, MessageComposer::MessageComposerSettings::self()->replaceReplyPrefixItem());
885 void ComposerPage::SubjectTab::doResetToDefaultsOther()
887 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
888 loadWidget(mReplyListEditor, MessageComposer::MessageComposerSettings::self()->replyPrefixesItem() );
889 loadWidget(mForwardListEditor, MessageComposer::MessageComposerSettings::self()->forwardPrefixesItem() );
890 loadWidget(mReplaceForwardPrefixCheck, MessageComposer::MessageComposerSettings::self()->replaceForwardPrefixItem());
891 loadWidget(mReplaceReplyPrefixCheck, MessageComposer::MessageComposerSettings::self()->replaceReplyPrefixItem());
892 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
906 vlay->
setMargin( KDialog::marginHint() );
908 QLabel *label =
new QLabel( i18n(
"This list is checked for every outgoing message "
909 "from the top to the bottom for a charset that "
910 "contains all required characters."),
this );
915 new PimCommon::SimpleStringListEditor(
this, PimCommon::SimpleStringListEditor::All,
916 i18n(
"A&dd..."), i18n(
"Remo&ve"),
917 i18n(
"&Modify..."), i18n(
"Enter charset:") );
918 mCharsetListEditor->setUpDownAutoRepeat(
true);
922 vlay->
addWidget( mCharsetListEditor, 1 );
924 mKeepReplyCharsetCheck =
new QCheckBox( i18n(
"&Keep original charset when "
925 "replying or forwarding (if "
926 "possible)"),
this );
927 connect( mKeepReplyCharsetCheck, SIGNAL (stateChanged(
int)),
929 vlay->
addWidget( mKeepReplyCharsetCheck );
932 this, SLOT(slotVerifyCharset(
QString&)) );
936 void ComposerPage::CharsetTab::slotVerifyCharset(
QString & charset )
938 if ( charset.
isEmpty() )
return;
960 KMessageBox::sorry(
this, i18n(
"This charset is not supported.") );
964 void ComposerPage::CharsetTab::doLoadOther()
968 QStringList charsets = MessageComposer::MessageComposerSettings::preferredCharsets();
974 kAsciiToLower( cset.
data() );
978 mCharsetListEditor->setStringList( charsets );
979 loadWidget(mKeepReplyCharsetCheck, MessageComposer::MessageComposerSettings::self()->forceReplyCharsetItem());
983 void ComposerPage::CharsetTab::doResetToDefaultsOther()
985 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
986 mCharsetListEditor->setStringList( MessageComposer::MessageComposerSettings::preferredCharsets());
987 mKeepReplyCharsetCheck->
setChecked( MessageComposer::MessageComposerSettings::forceReplyCharset() );
988 saveCheckBox(mKeepReplyCharsetCheck, MessageComposer::MessageComposerSettings::self()->forceReplyCharsetItem());
990 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
998 QStringList charsetList = mCharsetListEditor->stringList();
1002 for ( ; it != end ; ++it )
1005 MessageComposer::MessageComposerSettings::setPreferredCharsets( charsetList );
1006 saveCheckBox(mKeepReplyCharsetCheck, MessageComposer::MessageComposerSettings::self()->forceReplyCharsetItem());
1019 vlay->
setMargin( KDialog::marginHint() );
1022 mCreateOwnMessageIdCheck =
1023 new QCheckBox( i18n(
"&Use custom message-id suffix"),
this );
1024 connect( mCreateOwnMessageIdCheck, SIGNAL (stateChanged(
int)),
1026 vlay->
addWidget( mCreateOwnMessageIdCheck );
1031 mMessageIdSuffixEdit =
new KLineEdit(
this );
1032 mMessageIdSuffixEdit->setClearButtonShown(
true );
1036 mMessageIdSuffixEdit->setValidator( messageIdSuffixValidator );
1037 QLabel *label =
new QLabel(i18n(
"Custom message-&id suffix:"),
this );
1038 label->
setBuddy( mMessageIdSuffixEdit );
1040 mMessageIdSuffixEdit->setEnabled(
false );
1042 hlay->
addWidget( mMessageIdSuffixEdit, 1 );
1043 connect( mCreateOwnMessageIdCheck, SIGNAL(toggled(
bool)),
1045 connect( mCreateOwnMessageIdCheck, SIGNAL(toggled(
bool)),
1046 mMessageIdSuffixEdit, SLOT(
setEnabled(
bool)) );
1051 vlay->
addWidget(
new KSeparator( Qt::Horizontal,
this ) );
1052 vlay->
addWidget(
new QLabel( i18n(
"Define custom mime header fields:"),
this) );
1059 mHeaderList =
new ListView(
this );
1061 << i18nc(
"@title:column Value of the mimeheader.",
"Value") );
1064 this, SLOT(slotMimeHeaderSelectionChanged()) );
1065 connect( mHeaderList, SIGNAL(addHeader()), SLOT(slotNewMimeHeader()));
1066 connect( mHeaderList, SIGNAL(removeHeader()), SLOT(slotRemoveMimeHeader()));
1067 glay->
addWidget( mHeaderList, 0, 0, 3, 2 );
1070 QPushButton *button =
new QPushButton( i18nc(
"@action:button Add new mime header field.",
"Ne&w"),
this );
1071 connect( button, SIGNAL(clicked()),
this, SLOT(slotNewMimeHeader()) );
1074 mRemoveHeaderButton =
new QPushButton( i18n(
"Re&move"),
this );
1075 connect( mRemoveHeaderButton, SIGNAL(clicked()),
1076 this, SLOT(slotRemoveMimeHeader()) );
1078 glay->
addWidget( mRemoveHeaderButton, 1, 2 );
1082 mTagNameEdit->setClearButtonShown(
true);
1083 mTagNameEdit->setEnabled(
false );
1084 mTagNameLabel =
new QLabel( i18nc(
"@label:textbox Name of the mime header.",
"&Name:"),
this );
1085 mTagNameLabel->
setBuddy( mTagNameEdit );
1090 this, SLOT(slotMimeHeaderNameChanged(
QString)) );
1093 mTagValueEdit->setClearButtonShown(
true);
1094 mTagValueEdit->setEnabled(
false );
1095 mTagValueLabel =
new QLabel( i18n(
"&Value:"),
this );
1096 mTagValueLabel->
setBuddy( mTagValueEdit );
1098 glay->
addWidget( mTagValueLabel, 4, 0 );
1101 this, SLOT(slotMimeHeaderValueChanged(
QString)) );
1104 void ComposerPage::HeadersTab::slotMimeHeaderSelectionChanged()
1110 mTagNameEdit->setText( item->
text( 0 ) );
1111 mTagValueEdit->setText( item->
text( 1 ) );
1113 mTagNameEdit->clear();
1114 mTagValueEdit->clear();
1117 mTagNameEdit->setEnabled( item );
1118 mTagValueEdit->setEnabled( item );
1125 void ComposerPage::HeadersTab::slotMimeHeaderNameChanged(
const QString &
text )
1136 void ComposerPage::HeadersTab::slotMimeHeaderValueChanged(
const QString & text )
1147 void ComposerPage::HeadersTab::slotNewMimeHeader()
1155 void ComposerPage::HeadersTab::slotRemoveMimeHeader()
1160 kDebug() <<
"=================================================="
1161 <<
"Error: Remove button was pressed although no custom header was selected\n"
1162 <<
"==================================================\n";
1169 kDebug() <<
"below";
1184 void ComposerPage::HeadersTab::doLoadOther()
1186 mMessageIdSuffixEdit->setText( MessageComposer::MessageComposerSettings::customMsgIDSuffix() );
1187 const bool state = ( !MessageComposer::MessageComposerSettings::customMsgIDSuffix().isEmpty() &&
1188 MessageComposer::MessageComposerSettings::useCustomMessageIdSuffix() );
1189 mCreateOwnMessageIdCheck->
setChecked( state );
1191 mHeaderList->
clear();
1192 mTagNameEdit->clear();
1193 mTagValueEdit->clear();
1198 for (
int i = 0 ; i < count ; ++i ) {
1202 const QString value = config.readEntry(
"value" );
1220 MessageComposer::MessageComposerSettings::self()->setCustomMsgIDSuffix( mMessageIdSuffixEdit->text() );
1221 MessageComposer::MessageComposerSettings::self()->setUseCustomMessageIdSuffix( mCreateOwnMessageIdCheck->
isChecked() );
1225 for (
int i = 0; i < oldHeadersCount; ++i ) {
1229 config.deleteGroup();
1234 int numValidEntries = 0;
1237 for (
int i = 0; i < numberOfEntry; ++i ) {
1241 config.writeEntry(
"name", item->
text( 0 ) );
1242 config.writeEntry(
"value", item->
text( 1 ) );
1249 void ComposerPage::HeadersTab::doResetToDefaultsOther()
1251 const bool bUseDefaults = MessageComposer::MessageComposerSettings::self()->useDefaults(
true );
1252 const QString messageIdSuffix = MessageComposer::MessageComposerSettings::customMsgIDSuffix();
1253 const bool useCustomMessageIdSuffix = MessageComposer::MessageComposerSettings::useCustomMessageIdSuffix();
1254 MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
1256 mMessageIdSuffixEdit->setText( messageIdSuffix );
1257 const bool state = ( !messageIdSuffix.
isEmpty() && useCustomMessageIdSuffix );
1258 mCreateOwnMessageIdCheck->
setChecked( state );
1260 mHeaderList->
clear();
1261 mTagNameEdit->clear();
1262 mTagValueEdit->clear();
1277 vlay->
setMargin( KDialog::marginHint() );
1280 mOutlookCompatibleCheck =
1281 new QCheckBox( i18n(
"Outlook-compatible attachment naming" ),
this );
1282 mOutlookCompatibleCheck->
setChecked(
false );
1284 "Turn this option on to make Outlook(tm) understand attachment names "
1285 "containing non-English characters" ) );
1286 connect( mOutlookCompatibleCheck, SIGNAL(stateChanged(
int)),
1288 connect( mOutlookCompatibleCheck, SIGNAL(clicked()),
1289 this, SLOT(slotOutlookCompatibleClicked()) );
1290 vlay->
addWidget( mOutlookCompatibleCheck );
1294 mMissingAttachmentDetectionCheck =
1295 new QCheckBox( i18n(
"E&nable detection of missing attachments"),
this );
1296 mMissingAttachmentDetectionCheck->
setChecked(
true );
1297 connect( mMissingAttachmentDetectionCheck, SIGNAL(stateChanged(
int)),
1299 vlay->
addWidget( mMissingAttachmentDetectionCheck );
1305 QLabel *label =
new QLabel( i18n(
"Recognize any of the following key words as "
1306 "intention to attach a file:"),
this );
1312 PimCommon::SimpleStringListEditor::ButtonCode buttonCode =
1313 static_cast<PimCommon::SimpleStringListEditor::ButtonCode
>( PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify );
1314 mAttachWordsListEditor =
1315 new PimCommon::SimpleStringListEditor(
this, buttonCode,
1316 i18n(
"A&dd..."), i18n(
"Re&move"),
1318 i18n(
"Enter new key word:") );
1321 vlay->
addWidget( mAttachWordsListEditor );
1323 connect( mMissingAttachmentDetectionCheck, SIGNAL(toggled(
bool)),
1325 connect( mMissingAttachmentDetectionCheck, SIGNAL(toggled(
bool)),
1326 mAttachWordsListEditor, SLOT(
setEnabled(
bool)) );
1330 label =
new QLabel( i18n(
"Offer to share for files larger than:"),
this );
1334 mMaximumAttachmentSize =
new KIntNumInput(
this );
1335 mMaximumAttachmentSize->setRange( -1, 99999 );
1336 mMaximumAttachmentSize->setSingleStep( 100 );
1337 mMaximumAttachmentSize->setSuffix(i18nc(
"spinbox suffix: unit for kilobyte",
" kB"));
1338 connect( mMaximumAttachmentSize, SIGNAL(valueChanged(
int)),
1340 mMaximumAttachmentSize->setSpecialValueText(i18n(
"No limit"));
1341 layAttachment->
addWidget(mMaximumAttachmentSize);
1349 void ComposerPage::AttachmentsTab::doLoadFromGlobalSettings()
1351 loadWidget(mOutlookCompatibleCheck, MessageComposer::MessageComposerSettings::self()->outlookCompatibleAttachmentsItem());
1352 loadWidget(mMissingAttachmentDetectionCheck,
GlobalSettings::self()->showForgottenAttachmentWarningItem());
1354 const int maximumAttachmentSize(MessageCore::GlobalSettings::self()->maximumAttachmentSize());
1355 mMaximumAttachmentSize->setValue(maximumAttachmentSize == -1 ? -1 : MessageCore::GlobalSettings::self()->maximumAttachmentSize()/1024);
1361 saveCheckBox(mOutlookCompatibleCheck, MessageComposer::MessageComposerSettings::self()->outlookCompatibleAttachmentsItem());
1362 saveCheckBox(mMissingAttachmentDetectionCheck,
GlobalSettings::self()->showForgottenAttachmentWarningItem());
1363 saveSimpleStringListEditor(mAttachWordsListEditor,
GlobalSettings::self()->attachmentKeywordsItem() );
1365 KMime::setUseOutlookAttachmentEncoding( mOutlookCompatibleCheck->
isChecked() );
1366 const int maximumAttachmentSize(mMaximumAttachmentSize->value());
1367 MessageCore::GlobalSettings::self()->setMaximumAttachmentSize(maximumAttachmentSize == -1 ? -1 : maximumAttachmentSize*1024);
1368 mStorageServiceWidget->
save();
1371 void ComposerPageAttachmentsTab::slotOutlookCompatibleClicked()
1373 if (mOutlookCompatibleCheck->
isChecked()) {
1374 KMessageBox::information(0,i18n(
"You have chosen to "
1375 "encode attachment names containing non-English characters in a way that "
1376 "is understood by Outlook(tm) and other mail clients that do not "
1377 "support standard-compliant encoded attachment names.\n"
1378 "Note that KMail may create non-standard compliant messages, "
1379 "and consequently it is possible that your messages will not be "
1380 "understood by standard-compliant mail clients; so, unless you have no "
1381 "other choice, you should not enable this option." ) );
1391 autocorrectionWidget =
new PimCommon::AutoCorrectionWidget(
this);
1393 autocorrectionWidget->setAutoCorrection(
KMKernel::self()->composerAutoCorrection());
1406 autocorrectionWidget->writeConfig();
1409 void ComposerPageAutoCorrectionTab::doLoadFromGlobalSettings()
1411 autocorrectionWidget->loadConfig();
1414 void ComposerPageAutoCorrectionTab::doResetToDefaultsOther()
1416 autocorrectionWidget->resetToDefault();
1426 autoResizeWidget =
new MessageComposer::ImageScalingWidget(
this);
1440 autoResizeWidget->writeConfig();
1443 void ComposerPageAutoImageResizeTab::doLoadFromGlobalSettings()
1445 autoResizeWidget->loadConfig();
1448 void ComposerPageAutoImageResizeTab::doResetToDefaultsOther()
1450 autoResizeWidget->resetToDefault();
ComposerPageCharsetTab CharsetTab
ComposerPageTemplatesTab(QWidget *parent=0)
ComposerPageSubjectTab SubjectTab
virtual QByteArray name() const =0
ComposerPageGeneralTab(QWidget *parent=0)
virtual QByteArray text(quint32 serialNumber) const =0
QString helpAnchor() const
Should return the help anchor for this page or tab.
ComposerPageSubjectTab(QWidget *parent=0)
ComposerPageCharsetTab(QWidget *parent=0)
QString helpAnchor() const
void setAlignment(QFlags< Qt::AlignmentFlag >)
QString helpAnchor() const
void addSpacing(int size)
ComposerPageExternalEditorTab ExternalEditorTab
QString helpAnchor() const
ComposerPageAttachmentsTab AttachmentsTab
static KMKernel * self()
normal control stuff
void setBuddy(QWidget *buddy)
const char * name() const
ComposerPageAutoCorrectionTab AutoCorrectionTab
QString number(int n, int base)
ComposerPageCustomTemplatesTab CustomTemplatesTab
void setRowStretch(int row, int stretch)
void setObjectName(const QString &name)
QString helpAnchor() const
void addTab(ConfigModuleTab *tab, const QString &title)
ComposerPageAutoImageResizeTab AutoImageResizeTab
void setMargin(int margin)
ComposerPageAutoImageResizeTab(QWidget *parent=0)
QString helpAnchor() const
ComposerPageExternalEditorTab(QWidget *parent=0)
void requestSync()
Call this slot instead of directly KConfig::sync() to minimize the overall config writes...
QString helpAnchor() const
static GlobalSettings * self()
ComposerPageGeneralTab GeneralTab
void setSortingEnabled(bool enable)
void addStretch(int stretch)
void setColumnStretch(int column, int stretch)
QString helpAnchor() const
QTextCodec * codecForName(const QByteArray &name)
void setText(int column, const QString &text)
ComposerPage(const KComponentData &instance, QWidget *parent=0)
ComposerPageHeadersTab HeadersTab
QString fromLatin1(const char *str, int size)
ComposerPageAttachmentsTab(QWidget *parent=0)
QString helpAnchor() const
ComposerPageAutoCorrectionTab(QWidget *parent=0)
void setRowMinimumHeight(int row, int minSize)
ComposerPageCustomTemplatesTab(QWidget *parent=0)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString helpAnchor() const
ComposerPageTemplatesTab TemplatesTab
QString text(int column) const
void setWordWrap(bool on)
void setSpacing(int spacing)
void addLayout(QLayout *layout, int stretch)