Messagelib

printingsettings.cpp
1 /*
2  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
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>
12 
13 using namespace MessageViewer;
14 
15 class MessageViewer::PrintingSettingsPrivate
16 {
17 public:
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 
31 PrintingSettings::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 
42 PrintingSettings::~PrintingSettings() = default;
43 
44 void 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 
52 void 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 
60 void PrintingSettings::doResetToDefaultsOther()
61 {
62  const bool bUseDefaults = MessageViewer::MessageViewerSettings::self()->useDefaults(true);
63  doLoadFromGlobalSettings();
64  MessageViewer::MessageViewerSettings::self()->useDefaults(bUseDefaults);
65 }
void toggled(bool checked)
QMetaObject::Connection 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-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:05:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.