2015-02-07 00:32:25 +00:00
|
|
|
/*************************************************************************
|
|
|
|
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
|
|
|
* *
|
|
|
|
* 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 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
|
|
|
*************************************************************************/
|
2010-06-02 15:35:02 +01:00
|
|
|
|
|
|
|
#include "config/advancedpagewidget.h"
|
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <backend/corebackendmanager.h>
|
2010-06-02 15:35:02 +01:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <util/helpers.h>
|
2010-06-02 15:35:02 +01:00
|
|
|
|
2014-05-14 01:01:34 +01:00
|
|
|
#include <QComboBox>
|
|
|
|
|
2010-06-02 15:35:02 +01:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
AdvancedPageWidget::AdvancedPageWidget(QWidget* parent) :
|
2015-07-13 15:17:41 +01:00
|
|
|
QWidget(parent)
|
2010-06-02 15:35:02 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
setupUi(this);
|
|
|
|
setupDialog();
|
2010-06-02 15:35:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString AdvancedPageWidget::backend() const
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
KService::List services = CoreBackendManager::self()->list();
|
2010-06-02 15:35:02 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
foreach(KService::Ptr p, services)
|
|
|
|
if (p->name() == comboBackend().currentText())
|
|
|
|
return p->library();
|
2010-06-02 15:35:02 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
return QString();
|
2010-06-02 15:35:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AdvancedPageWidget::setBackend(const QString& name)
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
KService::List services = CoreBackendManager::self()->list();
|
2010-06-02 15:35:02 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
foreach(KService::Ptr p, services)
|
|
|
|
if (p->library() == name)
|
|
|
|
comboBackend().setCurrentIndex(comboBackend().findText(p->name()));
|
2010-06-02 15:35:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AdvancedPageWidget::setupDialog()
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
KService::List services = CoreBackendManager::self()->list();
|
|
|
|
foreach(KService::Ptr p, services)
|
|
|
|
comboBackend().addItem(p->name());
|
2010-06-02 15:35:02 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
setBackend(Config::backend());
|
2010-06-02 15:35:02 +01:00
|
|
|
}
|