Messagelib

printingsettings.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "printingsettings.h"
8#include "settings/messageviewersettings.h"
9#include "ui_printingsettings.h"
10#include <PimCommon/ConfigureImmutableWidgetUtils>
11using namespace PimCommon::ConfigureImmutableWidgetUtils;
12
13using namespace MessageViewer;
14
15class MessageViewer::PrintingSettingsPrivate
16{
17public:
18 PrintingSettingsPrivate()
19 : mPrintingUi(new Ui_PrintingSettings)
20 {
21 }
22
23 ~PrintingSettingsPrivate()
24 {
25 delete mPrintingUi;
26 }
27
28 Ui_PrintingSettings *const mPrintingUi;
29};
30
31PrintingSettings::PrintingSettings(QWidget *parent)
32 : QWidget(parent)
33 , d(new MessageViewer::PrintingSettingsPrivate)
34{
35 d->mPrintingUi->setupUi(this);
36 connect(d->mPrintingUi->mPrintEmptySelectedText, &QCheckBox::toggled, this, &PrintingSettings::changed);
37 connect(d->mPrintingUi->respectExpandCollapseSettings, &QCheckBox::toggled, this, &PrintingSettings::changed);
38 connect(d->mPrintingUi->printBackgroundColorAndImages, &QCheckBox::toggled, this, &PrintingSettings::changed);
39 connect(d->mPrintingUi->alwaysShowEncryptionSignatureDetail, &QCheckBox::toggled, this, &PrintingSettings::changed);
40}
41
42PrintingSettings::~PrintingSettings() = default;
43
44void PrintingSettings::save()
45{
46 saveCheckBox(d->mPrintingUi->mPrintEmptySelectedText, MessageViewer::MessageViewerSettings::self()->printSelectedTextItem());
47 saveCheckBox(d->mPrintingUi->respectExpandCollapseSettings, MessageViewer::MessageViewerSettings::self()->respectExpandCollapseSettingsItem());
48 saveCheckBox(d->mPrintingUi->printBackgroundColorAndImages, MessageViewer::MessageViewerSettings::self()->printBackgroundColorImagesItem());
49 saveCheckBox(d->mPrintingUi->alwaysShowEncryptionSignatureDetail, MessageViewer::MessageViewerSettings::self()->alwaysShowEncryptionSignatureDetailsItem());
50}
51
52void PrintingSettings::doLoadFromGlobalSettings()
53{
54 loadWidget(d->mPrintingUi->mPrintEmptySelectedText, MessageViewer::MessageViewerSettings::self()->printSelectedTextItem());
55 loadWidget(d->mPrintingUi->respectExpandCollapseSettings, MessageViewer::MessageViewerSettings::self()->respectExpandCollapseSettingsItem());
56 loadWidget(d->mPrintingUi->printBackgroundColorAndImages, MessageViewer::MessageViewerSettings::self()->printBackgroundColorImagesItem());
57 loadWidget(d->mPrintingUi->alwaysShowEncryptionSignatureDetail, MessageViewer::MessageViewerSettings::self()->alwaysShowEncryptionSignatureDetailsItem());
58}
59
60void PrintingSettings::doResetToDefaultsOther()
61{
62 const bool bUseDefaults = MessageViewer::MessageViewerSettings::self()->useDefaults(true);
63 doLoadFromGlobalSettings();
64 MessageViewer::MessageViewerSettings::self()->useDefaults(bUseDefaults);
65}
66
67#include "moc_printingsettings.cpp"
void toggled(bool checked)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void setupUi(QWidget *widget)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.