File indexing completed on 2025-01-19 04:51:22
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "knoteprintselectthemedialog.h" 0008 #include "knoteprintselectthemecombobox.h" 0009 0010 #include <KLocalizedString> 0011 0012 #include <QDialogButtonBox> 0013 #include <QHBoxLayout> 0014 #include <QLabel> 0015 #include <QPushButton> 0016 #include <QVBoxLayout> 0017 0018 KNotePrintSelectThemeDialog::KNotePrintSelectThemeDialog(QWidget *parent) 0019 : QDialog(parent) 0020 , mThemes(new KNotePrintSelectThemeComboBox(this)) 0021 { 0022 setWindowTitle(i18nc("@title:window", "Select theme")); 0023 auto mainLayout = new QVBoxLayout(this); 0024 0025 auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); 0026 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); 0027 0028 okButton->setDefault(true); 0029 okButton->setShortcut(Qt::CTRL | Qt::Key_Return); 0030 auto user1Button = new QPushButton; 0031 buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole); 0032 connect(buttonBox, &QDialogButtonBox::accepted, this, &KNotePrintSelectThemeDialog::accept); 0033 connect(buttonBox, &QDialogButtonBox::rejected, this, &KNotePrintSelectThemeDialog::reject); 0034 0035 auto w = new QWidget; 0036 auto lay = new QHBoxLayout; 0037 w->setLayout(lay); 0038 0039 auto lab = new QLabel(i18n("Themes:")); 0040 lay->addWidget(lab); 0041 0042 mThemes->loadThemes(); 0043 lay->addWidget(mThemes); 0044 mainLayout->addWidget(w); 0045 mainLayout->addWidget(buttonBox); 0046 } 0047 0048 KNotePrintSelectThemeDialog::~KNotePrintSelectThemeDialog() = default; 0049 0050 QString KNotePrintSelectThemeDialog::selectedTheme() const 0051 { 0052 return mThemes->selectedTheme(); 0053 } 0054 0055 #include "moc_knoteprintselectthemedialog.cpp"