move allow applying as non-root and backend config to a new advanced tab
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1133813
This commit is contained in:
parent
9ff7bb2227
commit
8ce6689dd5
|
@ -0,0 +1,62 @@
|
|||
/***************************************************************************
|
||||
* 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 2 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, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include "config/advancedpagewidget.h"
|
||||
|
||||
#include "backend/corebackendmanager.h"
|
||||
|
||||
#include "util/helpers.h"
|
||||
|
||||
#include <config.h>
|
||||
|
||||
AdvancedPageWidget::AdvancedPageWidget(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
setupDialog();
|
||||
}
|
||||
|
||||
QString AdvancedPageWidget::backend() const
|
||||
{
|
||||
KService::List services = CoreBackendManager::self()->list();
|
||||
|
||||
foreach(KService::Ptr p, services)
|
||||
if (p->name() == comboBackend().currentText())
|
||||
return p->library();
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void AdvancedPageWidget::setBackend(const QString& name)
|
||||
{
|
||||
KService::List services = CoreBackendManager::self()->list();
|
||||
|
||||
foreach(KService::Ptr p, services)
|
||||
if (p->library() == name)
|
||||
comboBackend().setCurrentIndex(comboBackend().findText(p->name()));
|
||||
}
|
||||
|
||||
void AdvancedPageWidget::setupDialog()
|
||||
{
|
||||
KService::List services = CoreBackendManager::self()->list();
|
||||
foreach(KService::Ptr p, services)
|
||||
comboBackend().addItem(p->name());
|
||||
|
||||
setBackend(Config::backend());
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/***************************************************************************
|
||||
* 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 2 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, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#if !defined(ADVANCEDPAGEWIDGET__H)
|
||||
|
||||
#define ADVANCEDPAGEWIDGET__H
|
||||
|
||||
#include "ui_configurepageadvanced.h"
|
||||
|
||||
#include "fs/filesystem.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QString;
|
||||
class KComboBox;
|
||||
|
||||
class AdvancedPageWidget : public QWidget, public Ui::ConfigurePageAdvanced
|
||||
{
|
||||
public:
|
||||
AdvancedPageWidget(QWidget* parent);
|
||||
|
||||
public:
|
||||
KComboBox& comboBackend() { return *m_ComboBackend; }
|
||||
const KComboBox& comboBackend() const { return *m_ComboBackend; }
|
||||
|
||||
QString backend() const;
|
||||
void setBackend(const QString& name);
|
||||
|
||||
private:
|
||||
void setupDialog();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
#include "config/configureoptionsdialog.h"
|
||||
#include "config/generalpagewidget.h"
|
||||
#include "config/filesystemcolorspagewidget.h"
|
||||
#include "config/advancedpagewidget.h"
|
||||
|
||||
#include "backend/corebackendmanager.h"
|
||||
|
||||
|
@ -42,6 +43,7 @@ ConfigureOptionsDialog::ConfigureOptionsDialog(QWidget* parent, const OperationS
|
|||
KConfigDialog(parent, name, Config::self()),
|
||||
m_GeneralPageWidget(new GeneralPageWidget(this)),
|
||||
m_FileSystemColorsPageWidget(new FileSystemColorsPageWidget(this)),
|
||||
m_AdvancedPageWidget(new AdvancedPageWidget(this)),
|
||||
m_OperationStack(ostack)
|
||||
{
|
||||
setFaceType(List);
|
||||
|
@ -49,14 +51,19 @@ ConfigureOptionsDialog::ConfigureOptionsDialog(QWidget* parent, const OperationS
|
|||
KPageWidgetItem* item = NULL;
|
||||
|
||||
item = addPage(&generalPageWidget(), i18nc("@title:tab general application settings", "General"), QString(), i18n("General Settings"));
|
||||
item->setIcon(KIcon(DesktopIcon("configure")));
|
||||
item->setIcon(KIcon(DesktopIcon("partitionmanager")));
|
||||
|
||||
connect(&generalPageWidget().comboDefaultFileSystem(), SIGNAL(activated(int)), SLOT(onComboDefaultFileSystemActivated(int)));
|
||||
connect(&generalPageWidget().comboBackend(), SIGNAL(activated(int)), SLOT(onComboBackendActivated(int)));
|
||||
|
||||
item = addPage(&fileSystemColorsPageWidget(), i18nc("@title:tab", "File System Colors"), QString(), i18n("File System Color Settings"));
|
||||
item->setIcon(KIcon(DesktopIcon("format-fill-color")));
|
||||
|
||||
item = addPage(&advancedPageWidget(), i18nc("@title:tab advanced application settings", "Advanced"), QString(), i18n("Advanced Settings"));
|
||||
item->setIcon(KIcon(DesktopIcon("configure")));
|
||||
|
||||
connect(&advancedPageWidget().comboBackend(), SIGNAL(activated(int)), SLOT(onComboBackendActivated(int)));
|
||||
|
||||
|
||||
restoreDialogSize(KConfigGroup(KGlobal::config(), "configureOptionsDialog"));
|
||||
}
|
||||
|
||||
|
@ -79,9 +86,9 @@ void ConfigureOptionsDialog::updateSettings()
|
|||
changed = true;
|
||||
}
|
||||
|
||||
if (generalPageWidget().backend() != Config::backend())
|
||||
if (advancedPageWidget().backend() != Config::backend())
|
||||
{
|
||||
Config::setBackend(generalPageWidget().backend());
|
||||
Config::setBackend(advancedPageWidget().backend());
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@ -97,7 +104,7 @@ bool ConfigureOptionsDialog::hasChanged()
|
|||
result = result || !kcItem->isEqual(generalPageWidget().defaultFileSystem());
|
||||
|
||||
kcItem = Config::self()->findItem("backend");
|
||||
result = result || !kcItem->isEqual(generalPageWidget().backend());
|
||||
result = result || !kcItem->isEqual(advancedPageWidget().backend());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -120,7 +127,7 @@ void ConfigureOptionsDialog::updateWidgetsDefault()
|
|||
{
|
||||
bool useDefaults = Config::self()->useDefaults(true);
|
||||
generalPageWidget().setDefaultFileSystem(FileSystem::defaultFileSystem());
|
||||
generalPageWidget().setBackend(CoreBackendManager::defaultBackendName());
|
||||
advancedPageWidget().setBackend(CoreBackendManager::defaultBackendName());
|
||||
Config::self()->useDefaults(useDefaults);
|
||||
}
|
||||
|
||||
|
@ -137,5 +144,5 @@ void ConfigureOptionsDialog::onComboBackendActivated(int)
|
|||
settingsChangedSlot();
|
||||
}
|
||||
else
|
||||
generalPageWidget().setBackend(CoreBackendManager::defaultBackendName());
|
||||
advancedPageWidget().setBackend(CoreBackendManager::defaultBackendName());
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
class GeneralPageWidget;
|
||||
class FileSystemColorsPageWidget;
|
||||
class AdvancedPageWidget;
|
||||
class OperationStack;
|
||||
|
||||
class ConfigureOptionsDialog : public KConfigDialog
|
||||
|
@ -47,11 +48,14 @@ class ConfigureOptionsDialog : public KConfigDialog
|
|||
protected:
|
||||
GeneralPageWidget& generalPageWidget() { Q_ASSERT(m_GeneralPageWidget); return *m_GeneralPageWidget; }
|
||||
FileSystemColorsPageWidget& fileSystemColorsPageWidget() { Q_ASSERT(m_FileSystemColorsPageWidget); return *m_FileSystemColorsPageWidget; }
|
||||
AdvancedPageWidget& advancedPageWidget() { Q_ASSERT(m_AdvancedPageWidget); return *m_AdvancedPageWidget; }
|
||||
|
||||
const OperationStack& operationStack() const { return m_OperationStack; }
|
||||
|
||||
private:
|
||||
GeneralPageWidget* m_GeneralPageWidget;
|
||||
FileSystemColorsPageWidget* m_FileSystemColorsPageWidget;
|
||||
AdvancedPageWidget* m_AdvancedPageWidget;
|
||||
const OperationStack& m_OperationStack;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,39 +6,11 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>473</width>
|
||||
<height>575</height>
|
||||
<width>403</width>
|
||||
<height>327</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Permissions</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="kcfg_allowApplyOperationsAsNonRoot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow applying operations without administrator privileges</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="sizePolicy">
|
||||
|
@ -183,34 +155,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Backend</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Active backend:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_ComboBackend</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KComboBox" name="m_ComboBackend"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KButtonGroup" name="kcfg_shredSource">
|
||||
<property name="sizePolicy">
|
||||
|
@ -228,9 +172,6 @@
|
|||
<property name="text">
|
||||
<string>Overwrite with:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_ComboBackend</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -46,26 +46,6 @@ void GeneralPageWidget::setDefaultFileSystem(FileSystem::Type t)
|
|||
comboDefaultFileSystem().setCurrentIndex(idx != -1 ? idx : 0);
|
||||
}
|
||||
|
||||
QString GeneralPageWidget::backend() const
|
||||
{
|
||||
KService::List services = CoreBackendManager::self()->list();
|
||||
|
||||
foreach(KService::Ptr p, services)
|
||||
if (p->name() == comboBackend().currentText())
|
||||
return p->library();
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void GeneralPageWidget::setBackend(const QString& name)
|
||||
{
|
||||
KService::List services = CoreBackendManager::self()->list();
|
||||
|
||||
foreach(KService::Ptr p, services)
|
||||
if (p->library() == name)
|
||||
comboBackend().setCurrentIndex(comboBackend().findText(p->name()));
|
||||
}
|
||||
|
||||
void GeneralPageWidget::setupDialog()
|
||||
{
|
||||
QStringList fsNames;
|
||||
|
@ -79,10 +59,4 @@ void GeneralPageWidget::setupDialog()
|
|||
comboDefaultFileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
|
||||
|
||||
setDefaultFileSystem(FileSystem::defaultFileSystem());
|
||||
|
||||
KService::List services = CoreBackendManager::self()->list();
|
||||
foreach(KService::Ptr p, services)
|
||||
comboBackend().addItem(p->name());
|
||||
|
||||
setBackend(Config::backend());
|
||||
}
|
||||
|
|
|
@ -39,13 +39,8 @@ class GeneralPageWidget : public QWidget, public Ui::ConfigurePageGeneral
|
|||
KComboBox& comboDefaultFileSystem() { return *m_ComboDefaultFileSystem; }
|
||||
const KComboBox& comboDefaultFileSystem() const { return *m_ComboDefaultFileSystem; }
|
||||
|
||||
KComboBox& comboBackend() { return *m_ComboBackend; }
|
||||
const KComboBox& comboBackend() const { return *m_ComboBackend; }
|
||||
|
||||
FileSystem::Type defaultFileSystem() const;
|
||||
void setDefaultFileSystem(FileSystem::Type t);
|
||||
QString backend() const;
|
||||
void setBackend(const QString& name);
|
||||
|
||||
private:
|
||||
void setupDialog();
|
||||
|
|
Loading…
Reference in New Issue