Okular

chooseenginedialog.cpp
1/*
2 SPDX-FileCopyrightText: 2006 Pino Toscano <toscano.pino@tiscali.it>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "chooseenginedialog_p.h"
8
9#include <QComboBox>
10#include <QLabel>
11
12#include <KLocalizedString>
13#include <QDialogButtonBox>
14#include <QPushButton>
15#include <QVBoxLayout>
16
17#include "ui_chooseenginewidget.h"
18
19ChooseEngineDialog::ChooseEngineDialog(const QStringList &generators, const QMimeType &mime, QWidget *parent)
20 : QDialog(parent)
21{
22 setWindowTitle(i18n("Backend Selection"));
24 QVBoxLayout *mainLayout = new QVBoxLayout;
25 setLayout(mainLayout);
26 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
27 okButton->setDefault(true);
28 okButton->setShortcut(Qt::CTRL | Qt::Key_Return); // NOLINT(bugprone-suspicious-enum-usage)
29 connect(buttonBox, &QDialogButtonBox::accepted, this, &ChooseEngineDialog::accept);
30 connect(buttonBox, &QDialogButtonBox::rejected, this, &ChooseEngineDialog::reject);
31 okButton->setDefault(true);
32 QWidget *main = new QWidget(this);
33 m_widget = new Ui_ChooseEngineWidget();
34 m_widget->setupUi(main);
35 mainLayout->addWidget(main);
36 mainLayout->addWidget(buttonBox);
37 m_widget->engineList->addItems(generators);
38
39 m_widget->description->setText(
40 i18n("<qt>More than one backend found for the MIME type:<br />"
41 "<b>%1</b> (%2).<br /><br />"
42 "Please select which one to use:</qt>",
43 mime.comment(),
44 mime.name()));
45}
46
47ChooseEngineDialog::~ChooseEngineDialog()
48{
49 delete m_widget;
50}
51
52int ChooseEngineDialog::selectedGenerator() const
53{
54 return m_widget->engineList->currentIndex();
55}
QString i18n(const char *text, const TYPE &arg...)
void setShortcut(const QKeySequence &key)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
QPushButton * button(StandardButton which) const const
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 Fri Nov 8 2024 11:49:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.