2 * kmail: KDE mail client
3 * Copyright (C) 2000 Espen Sand, espen@kde.org
4 * Copyright (C) 2001-2003 Marc Mutz, mutz@kde.org
5 * Contains code segments and ideas from earlier kmail dialog code.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "settings/kmailsettings.h"
26 #include "configuredialog.h"
27 #include "configuredialog_p.h"
29 #include <KWindowSystem>
30 #include <KIconLoader>
31 #include <QPushButton>
32 #include <KHelpClient>
38 ConfigureDialog::ConfigureDialog(QWidget
*parent
, bool modal
)
39 : KCMultiDialog(parent
)
42 setStandardButtons(QDialogButtonBox::Ok
| QDialogButtonBox::Help
|
43 QDialogButtonBox::RestoreDefaults
| QDialogButtonBox::Cancel
|
44 QDialogButtonBox::Apply
| QDialogButtonBox::Reset
);
46 KWindowSystem::setIcons(winId(), qApp
->windowIcon().pixmap(IconSize(KIconLoader::Desktop
), IconSize(KIconLoader::Desktop
)), qApp
->windowIcon().pixmap(IconSize(KIconLoader::Small
), IconSize(KIconLoader::Small
)));
47 addModule(QStringLiteral("kmail_config_identity"));
48 addModule(QStringLiteral("kmail_config_accounts"));
49 addModule(QStringLiteral("kmail_config_appearance"));
50 addModule(QStringLiteral("kmail_config_composer"));
51 addModule(QStringLiteral("kmail_config_security"));
52 addModule(QStringLiteral("kmail_config_misc"));
54 connect(button(QDialogButtonBox::Ok
), &QPushButton::clicked
, this, &ConfigureDialog::slotOk
);
55 connect(button(QDialogButtonBox::Apply
), &QPushButton::clicked
, this, &ConfigureDialog::slotApply
);
56 connect(button(QDialogButtonBox::Help
), &QPushButton::clicked
, this, &ConfigureDialog::slotHelp
);
57 connect(button(QDialogButtonBox::Cancel
), &QPushButton::clicked
, this, &ConfigureDialog::slotUser1Clicked
);
58 connect(button(QDialogButtonBox::RestoreDefaults
), &QPushButton::clicked
, this, &ConfigureDialog::slotDefaultClicked
);
59 connect(button(QDialogButtonBox::Reset
), &QPushButton::clicked
, this, &ConfigureDialog::slotUser1Clicked
);
60 // We store the size of the dialog on hide, because otherwise
61 // the KCMultiDialog starts with the size of the first kcm, not
62 // the largest one. This way at least after the first showing of
63 // the largest kcm the size is kept.
64 const int width
= KMailSettings::self()->configureDialogWidth();
65 const int height
= KMailSettings::self()->configureDialogHeight();
66 if (width
!= 0 && height
!= 0) {
67 resize(width
, height
);
72 void ConfigureDialog::hideEvent(QHideEvent
*ev
)
74 KMailSettings::self()->setConfigureDialogWidth(width());
75 KMailSettings::self()->setConfigureDialogHeight(height());
76 KPageDialog::hideEvent(ev
);
79 ConfigureDialog::~ConfigureDialog()
83 void ConfigureDialog::slotApply()
86 if (KMKernel::self()) {
87 KMKernel::self()->slotRequestConfigSync();
89 Q_EMIT
configChanged();
92 void ConfigureDialog::slotOk()
95 if (KMKernel::self()) {
96 KMKernel::self()->slotRequestConfigSync();
98 Q_EMIT
configChanged();
101 void ConfigureDialog::slotHelp()
103 KHelpClient::invokeHelp(QStringLiteral("configure-identity"), QStringLiteral("kmail"));