2006-03-30 18:06:18 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Pino Toscano <toscano.pino@tiscali.it> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2007-07-10 22:52:25 +00:00
|
|
|
#include "chooseenginedialog_p.h"
|
2007-04-19 18:30:20 +00:00
|
|
|
|
2014-08-07 23:35:27 +00:00
|
|
|
#include <QtWidgets/QComboBox>
|
|
|
|
#include <QtWidgets/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);
|
|
|
|
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
|
|
|
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
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();
|
|
|
|
}
|