2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2006 Pino Toscano <toscano.pino@tiscali.it>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2006-03-30 18:06:18 +00:00
|
|
|
|
2007-07-10 22:52:25 +00:00
|
|
|
#include "chooseenginedialog_p.h"
|
2007-04-19 18:30:20 +00:00
|
|
|
|
2018-08-31 09:23:45 +00:00
|
|
|
#include <QComboBox>
|
|
|
|
#include <QLabel>
|
2006-09-21 08:45:36 +00:00
|
|
|
|
2014-10-14 05:37:01 +00:00
|
|
|
#include <KLocalizedString>
|
2014-10-06 05:39:24 +00:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QVBoxLayout>
|
2006-03-30 18:06:18 +00:00
|
|
|
|
2006-04-10 19:50:00 +00:00
|
|
|
#include "ui_chooseenginewidget.h"
|
2006-03-30 18:06:18 +00:00
|
|
|
|
2014-09-11 13:18:05 +00:00
|
|
|
ChooseEngineDialog::ChooseEngineDialog(const QStringList &generators, const QMimeType &mime, QWidget *parent)
|
2014-10-06 05:39:24 +00:00
|
|
|
: QDialog(parent)
|
2006-03-30 18:06:18 +00:00
|
|
|
{
|
2014-10-06 05:39:24 +00:00
|
|
|
setWindowTitle(i18n("Backend Selection"));
|
|
|
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
|
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
|
|
setLayout(mainLayout);
|
|
|
|
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
okButton->setDefault(true);
|
2019-12-23 13:57:50 +00:00
|
|
|
okButton->setShortcut(Qt::CTRL | Qt::Key_Return); // NOLINT(bugprone-suspicious-enum-usage)
|
2015-01-30 21:06:53 +00:00
|
|
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &ChooseEngineDialog::accept);
|
|
|
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &ChooseEngineDialog::reject);
|
2014-10-06 05:39:24 +00:00
|
|
|
okButton->setDefault(true);
|
2006-03-30 18:06:18 +00:00
|
|
|
QWidget *main = new QWidget(this);
|
|
|
|
m_widget = new Ui_ChooseEngineWidget();
|
|
|
|
m_widget->setupUi(main);
|
2014-10-06 05:39:24 +00:00
|
|
|
mainLayout->addWidget(main);
|
|
|
|
mainLayout->addWidget(buttonBox);
|
2006-03-30 18:06:18 +00:00
|
|
|
m_widget->engineList->addItems(generators);
|
|
|
|
|
|
|
|
m_widget->description->setText(
|
2007-08-23 10:48:47 +00:00
|
|
|
i18n("<qt>More than one backend found for the MIME type:<br />"
|
2007-07-15 18:48:31 +00:00
|
|
|
"<b>%1</b> (%2).<br /><br />"
|
2014-09-11 13:18:05 +00:00
|
|
|
"Please select which one to use:</qt>",
|
|
|
|
mime.comment(),
|
|
|
|
mime.name()));
|
2006-03-30 18:06:18 +00:00
|
|
|
}
|
|
|
|
|
2007-03-30 15:35:01 +00:00
|
|
|
ChooseEngineDialog::~ChooseEngineDialog()
|
|
|
|
{
|
|
|
|
delete m_widget;
|
|
|
|
}
|
|
|
|
|
2006-03-30 18:06:18 +00:00
|
|
|
int ChooseEngineDialog::selectedGenerator() const
|
|
|
|
{
|
|
|
|
return m_widget->engineList->currentIndex();
|
|
|
|
}
|