• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
  • configuredialog
configuremiscpage.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "configuremiscpage.h"
19 #include "pimcommon/widgets/configureimmutablewidgetutils.h"
20 using namespace PimCommon::ConfigureImmutableWidgetUtils;
21 #include "configureagentswidget.h"
22 #include "settings/globalsettings.h"
23 
24 #include <mailcommon/folder/folderrequester.h>
25 #include "messageviewer/widgets/invitationsettings.h"
26 #include "messageviewer/widgets/printingsettings.h"
27 #include "messageviewer/settings/globalsettings.h"
28 
29 #include <KCModuleProxy>
30 #include <KCModuleInfo>
31 #include <KLocalizedString>
32 using namespace MailCommon;
33 QString MiscPage::helpAnchor() const
34 {
35  return QString::fromLatin1("configure-misc");
36 }
37 
38 MiscPage::MiscPage( const KComponentData &instance, QWidget *parent )
39  : ConfigModuleWithTabs( instance, parent )
40 {
41  mFolderTab = new FolderTab();
42  addTab( mFolderTab, i18n("Folders") );
43 
44  mInviteTab = new InviteTab();
45  addTab( mInviteTab, i18n("Invitations" ) );
46 
47  mProxyTab = new ProxyTab();
48  addTab( mProxyTab, i18n("Proxy" ) );
49 
50  mAgentSettingsTab = new MiscPageAgentSettingsTab();
51  addTab( mAgentSettingsTab, i18n("Plugins Settings" ) );
52 
53  mPrintingTab = new MiscPagePrintingTab();
54  addTab( mPrintingTab, i18n("Printing" ) );
55 }
56 
57 QString MiscPageFolderTab::helpAnchor() const
58 {
59  return QString::fromLatin1("configure-misc-folders");
60 }
61 
62 MiscPageFolderTab::MiscPageFolderTab( QWidget * parent )
63  : ConfigModuleTab( parent )
64 {
65  mMMTab.setupUi( this );
66  //replace QWidget with FolderRequester. Promote to doesn't work due to the custom constructor
67  QHBoxLayout* layout = new QHBoxLayout;
68  layout->setContentsMargins(0, 0, 0, 0);
69  mMMTab.mOnStartupOpenFolder->setLayout( layout );
70  mOnStartupOpenFolder = new FolderRequester( mMMTab.mOnStartupOpenFolder );
71  layout->addWidget( mOnStartupOpenFolder );
72 
73  mMMTab.gridLayout->setSpacing( KDialog::spacingHint() );
74  mMMTab.gridLayout->setMargin( KDialog::marginHint() );
75  mMMTab.mExcludeImportantFromExpiry->setWhatsThis(
76  i18n( GlobalSettings::self()->excludeImportantMailFromExpiryItem()->whatsThis().toUtf8() ) );
77 
78  connect( mMMTab.mEmptyFolderConfirmCheck, SIGNAL(stateChanged(int)),
79  this, SLOT(slotEmitChanged()) );
80  connect( mMMTab.mExcludeImportantFromExpiry, SIGNAL(stateChanged(int)),
81  this, SLOT(slotEmitChanged()) );
82  connect( mMMTab.mLoopOnGotoUnread, SIGNAL(activated(int)),
83  this, SLOT(slotEmitChanged()) );
84  connect( mMMTab.mActionEnterFolder, SIGNAL(activated(int)),
85  this, SLOT(slotEmitChanged()) );
86  connect( mMMTab.mDelayedMarkTime, SIGNAL(valueChanged(int)),
87  this, SLOT(slotEmitChanged()) );
88  connect( mMMTab.mDelayedMarkAsRead, SIGNAL(toggled(bool)),
89  mMMTab.mDelayedMarkTime, SLOT(setEnabled(bool)));
90  connect( mMMTab.mDelayedMarkAsRead, SIGNAL(toggled(bool)),
91  this , SLOT(slotEmitChanged()) );
92  connect( mMMTab.mShowPopupAfterDnD, SIGNAL(stateChanged(int)),
93  this, SLOT(slotEmitChanged()) );
94  connect( mOnStartupOpenFolder, SIGNAL(folderChanged(Akonadi::Collection)),
95  this, SLOT(slotEmitChanged()) );
96  connect( mMMTab.mEmptyTrashCheck, SIGNAL(stateChanged(int)),
97  this, SLOT(slotEmitChanged()) );
98  connect( mMMTab.mStartUpFolderCheck, SIGNAL(toggled(bool)),
99  this, SLOT(slotEmitChanged()) );
100  connect( mMMTab.mStartUpFolderCheck, SIGNAL(toggled(bool)),
101  mOnStartupOpenFolder, SLOT(setEnabled(bool)) );
102 }
103 
104 void MiscPage::FolderTab::doLoadFromGlobalSettings()
105 {
106  loadWidget(mMMTab.mExcludeImportantFromExpiry, GlobalSettings::self()->excludeImportantMailFromExpiryItem());
107  // default = "Loop in current folder"
108  loadWidget(mMMTab.mLoopOnGotoUnread, GlobalSettings::self()->loopOnGotoUnreadItem() );
109  loadWidget(mMMTab.mActionEnterFolder, GlobalSettings::self()->actionEnterFolderItem() );
110  loadWidget(mMMTab.mDelayedMarkAsRead, MessageViewer::GlobalSettings::self()->delayedMarkAsReadItem() );
111  loadWidget(mMMTab.mDelayedMarkTime, MessageViewer::GlobalSettings::self()->delayedMarkTimeItem());
112  loadWidget(mMMTab.mShowPopupAfterDnD, GlobalSettings::self()->showPopupAfterDnDItem());
113  loadWidget(mMMTab.mStartUpFolderCheck, GlobalSettings::self()->startSpecificFolderAtStartupItem());
114  mOnStartupOpenFolder->setEnabled(GlobalSettings::self()->startSpecificFolderAtStartup());
115  doLoadOther();
116 }
117 
118 void MiscPage::FolderTab::doLoadOther()
119 {
120  loadWidget(mMMTab.mEmptyTrashCheck, GlobalSettings::self()->emptyTrashOnExitItem());
121  mOnStartupOpenFolder->setCollection( Akonadi::Collection( GlobalSettings::self()->startupFolder() ) );
122  loadWidget(mMMTab.mEmptyFolderConfirmCheck, GlobalSettings::self()->confirmBeforeEmptyItem());
123 }
124 
125 void MiscPage::FolderTab::save()
126 {
127  saveCheckBox(mMMTab.mEmptyTrashCheck, GlobalSettings::self()->emptyTrashOnExitItem());
128  saveCheckBox(mMMTab.mEmptyFolderConfirmCheck, GlobalSettings::self()->confirmBeforeEmptyItem());
129  saveComboBox(mMMTab.mActionEnterFolder, GlobalSettings::self()->actionEnterFolderItem() );
130  GlobalSettings::self()->setStartupFolder( mOnStartupOpenFolder->collection().id() );
131 
132  saveCheckBox(mMMTab.mDelayedMarkAsRead, MessageViewer::GlobalSettings::self()->delayedMarkAsReadItem() );
133  saveSpinBox(mMMTab.mDelayedMarkTime, MessageViewer::GlobalSettings::self()->delayedMarkTimeItem());
134  saveComboBox(mMMTab.mLoopOnGotoUnread, GlobalSettings::self()->loopOnGotoUnreadItem() );
135 
136  saveCheckBox(mMMTab.mExcludeImportantFromExpiry, GlobalSettings::self()->excludeImportantMailFromExpiryItem());
137  saveCheckBox(mMMTab.mShowPopupAfterDnD, GlobalSettings::self()->showPopupAfterDnDItem());
138  saveCheckBox(mMMTab.mStartUpFolderCheck, GlobalSettings::self()->startSpecificFolderAtStartupItem());
139 }
140 
141 MiscPageAgentSettingsTab::MiscPageAgentSettingsTab( QWidget* parent )
142  : ConfigModuleTab( parent )
143 {
144  QHBoxLayout *l = new QHBoxLayout( this );
145  l->setContentsMargins( 0 , 0, 0, 0 );
146  mConfigureAgent = new ConfigureAgentsWidget;
147  l->addWidget( mConfigureAgent );
148 
149  connect( mConfigureAgent, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
150 }
151 
152 void MiscPageAgentSettingsTab::doLoadFromGlobalSettings()
153 {
154  mConfigureAgent->doLoadFromGlobalSettings();
155 }
156 
157 void MiscPageAgentSettingsTab::save()
158 {
159  mConfigureAgent->save();
160 }
161 
162 void MiscPageAgentSettingsTab::doResetToDefaultsOther()
163 {
164  mConfigureAgent->doResetToDefaultsOther();
165 }
166 
167 QString MiscPageAgentSettingsTab::helpAnchor() const
168 {
169  return mConfigureAgent->helpAnchor();
170 }
171 
172 MiscPageInviteTab::MiscPageInviteTab( QWidget* parent )
173  : ConfigModuleTab( parent )
174 {
175  mInvitationUi = new MessageViewer::InvitationSettings( this );
176  QHBoxLayout *l = new QHBoxLayout( this );
177  l->setContentsMargins( 0 , 0, 0, 0 );
178  l->addWidget( mInvitationUi );
179  connect( mInvitationUi, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
180 }
181 
182 void MiscPage::InviteTab::doLoadFromGlobalSettings()
183 {
184  mInvitationUi->doLoadFromGlobalSettings();
185 }
186 
187 void MiscPage::InviteTab::save()
188 {
189  mInvitationUi->save();
190 }
191 
192 void MiscPage::InviteTab::doResetToDefaultsOther()
193 {
194  mInvitationUi->doResetToDefaultsOther();
195 }
196 
197 
198 MiscPageProxyTab::MiscPageProxyTab( QWidget* parent )
199  : ConfigModuleTab( parent )
200 {
201  KCModuleInfo proxyInfo(QLatin1String("proxy.desktop"));
202  mProxyModule = new KCModuleProxy(proxyInfo, parent);
203  QHBoxLayout *l = new QHBoxLayout( this );
204  l->addWidget( mProxyModule );
205  connect(mProxyModule,SIGNAL(changed(bool)), this, SLOT(slotEmitChanged()));
206 }
207 
208 void MiscPage::ProxyTab::save()
209 {
210  mProxyModule->save();
211 }
212 
213 MiscPagePrintingTab::MiscPagePrintingTab( QWidget * parent )
214  : ConfigModuleTab( parent )
215 {
216  mPrintingUi = new MessageViewer::PrintingSettings( this );
217  QHBoxLayout *l = new QHBoxLayout( this );
218  l->setContentsMargins( 0 , 0, 0, 0 );
219  l->addWidget( mPrintingUi );
220  connect( mPrintingUi, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
221 }
222 
223 void MiscPagePrintingTab::doLoadFromGlobalSettings()
224 {
225  mPrintingUi->doLoadFromGlobalSettings();
226 }
227 
228 void MiscPagePrintingTab::doResetToDefaultsOther()
229 {
230  mPrintingUi->doResetToDefaultsOther();
231 }
232 
233 
234 void MiscPagePrintingTab::save()
235 {
236  mPrintingUi->save();
237 }
238 
239 //----------------------------
QWidget::layout
QLayout * layout() const
globalsettings.h
QWidget
QLayout::setContentsMargins
void setContentsMargins(int left, int top, int right, int bottom)
MiscPagePrintingTab::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configuremiscpage.cpp:228
ConfigModuleTab
Definition: configuredialog_p.h:19
ConfigureAgentsWidget::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configureagentswidget.cpp:156
MiscPageFolderTab::MiscPageFolderTab
MiscPageFolderTab(QWidget *parent=0)
Definition: configuremiscpage.cpp:62
MiscPageFolderTab::save
void save()
Definition: configuremiscpage.cpp:125
QHBoxLayout
MiscPageAgentSettingsTab::MiscPageAgentSettingsTab
MiscPageAgentSettingsTab(QWidget *parent=0)
Definition: configuremiscpage.cpp:141
ConfigureAgentsWidget::doLoadFromGlobalSettings
void doLoadFromGlobalSettings()
Definition: configureagentswidget.cpp:151
MiscPageInviteTab::MiscPageInviteTab
MiscPageInviteTab(QWidget *parent=0)
Definition: configuremiscpage.cpp:172
ConfigureAgentsWidget::helpAnchor
QString helpAnchor() const
Definition: configureagentswidget.cpp:146
QWidget::setEnabled
void setEnabled(bool)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
MiscPageFolderTab::helpAnchor
QString helpAnchor() const
Definition: configuremiscpage.cpp:57
MiscPagePrintingTab::save
void save()
Definition: configuremiscpage.cpp:234
MiscPageInviteTab::save
void save()
Definition: configuremiscpage.cpp:187
configureagentswidget.h
ConfigModuleTab::slotEmitChanged
void slotEmitChanged()
MiscPageProxyTab::MiscPageProxyTab
MiscPageProxyTab(QWidget *parent=0)
Definition: configuremiscpage.cpp:198
ConfigModuleWithTabs::addTab
void addTab(ConfigModuleTab *tab, const QString &title)
MiscPage::FolderTab
MiscPageFolderTab FolderTab
Definition: configuremiscpage.h:115
MiscPagePrintingTab::MiscPagePrintingTab
MiscPagePrintingTab(QWidget *parent=0)
Definition: configuremiscpage.cpp:213
ConfigureAgentsWidget::save
void save()
Definition: configureagentswidget.cpp:140
QString
MiscPageAgentSettingsTab
Definition: configuremiscpage.h:78
MiscPage::InviteTab
MiscPageInviteTab InviteTab
Definition: configuremiscpage.h:116
MiscPageProxyTab::save
void save()
Definition: configuremiscpage.cpp:208
MiscPage::helpAnchor
QString helpAnchor() const
Should return the help anchor for this page or tab.
Definition: configuremiscpage.cpp:33
ConfigModuleTab::changed
void changed(bool)
MiscPageAgentSettingsTab::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configuremiscpage.cpp:162
GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:30
ConfigureAgentsWidget
Definition: configureagentswidget.h:27
QWidget::whatsThis
QString whatsThis() const
MiscPageInviteTab::doResetToDefaultsOther
void doResetToDefaultsOther()
Definition: configuremiscpage.cpp:192
QLatin1String
MiscPage::MiscPage
MiscPage(const KComponentData &instance, QWidget *parent=0)
Definition: configuremiscpage.cpp:38
MiscPageAgentSettingsTab::helpAnchor
QString helpAnchor() const
Definition: configuremiscpage.cpp:167
MiscPageAgentSettingsTab::save
void save()
Definition: configuremiscpage.cpp:157
configuremiscpage.h
QString::fromLatin1
QString fromLatin1(const char *str, int size)
MiscPagePrintingTab
Definition: configuremiscpage.h:94
MiscPage::ProxyTab
MiscPageProxyTab ProxyTab
Definition: configuremiscpage.h:117
ConfigModuleWithTabs
Definition: configuredialog_p.h:54
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal