Gravatar

gravatarconfiguresettingsdialog.cpp
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "gravatarconfiguresettingsdialog.h"
8using namespace Qt::Literals::StringLiterals;
9
10#include "gravatarconfiguresettingswidget.h"
11#include "misc/gravatarcache.h"
12
13#include "gravatarsettings.h"
14#include <KLocalizedString>
15#include <QDialogButtonBox>
16#include <QPushButton>
17#include <QVBoxLayout>
18using namespace Gravatar;
19
20GravatarConfigureSettingsDialog::GravatarConfigureSettingsDialog(QWidget *parent)
21 : QDialog(parent)
22{
23 setWindowTitle(i18nc("@title:window", "Configure Gravatar"));
24 auto topLayout = new QVBoxLayout(this);
25 topLayout->setObjectName("toplayout"_L1);
26
27 mGravatarConfigureSettings = new GravatarConfigureSettingsWidget(this);
28 mGravatarConfigureSettings->setObjectName("gravatarconfiguresettings"_L1);
29 topLayout->addWidget(mGravatarConfigureSettings);
30
32 buttonBox->setObjectName("buttonbox"_L1);
33 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
35 connect(buttonBox, &QDialogButtonBox::accepted, this, &GravatarConfigureSettingsDialog::save);
36 connect(buttonBox, &QDialogButtonBox::rejected, this, &GravatarConfigureSettingsDialog::reject);
37 connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &GravatarConfigureSettingsDialog::slotRestoreDefault);
38 okButton->setDefault(true);
39
40 topLayout->addWidget(buttonBox);
41 load();
42}
43
44GravatarConfigureSettingsDialog::~GravatarConfigureSettingsDialog() = default;
45
46void GravatarConfigureSettingsDialog::slotRestoreDefault()
47{
48 mGravatarConfigureSettings->load();
49}
50
51void GravatarConfigureSettingsDialog::save()
52{
53 mGravatarConfigureSettings->save();
54 accept();
55}
56
57void GravatarConfigureSettingsDialog::load()
58{
59 mGravatarConfigureSettings->load();
60}
61
62#include "moc_gravatarconfiguresettingsdialog.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QAction * load(const QObject *recvr, const char *slot, QObject *parent)
void clicked(bool checked)
void setShortcut(const QKeySequence &key)
virtual void accept()
void setDefault(bool)
Key_Return
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.