begin integration of MountManager dialogs

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1075244
This commit is contained in:
Volker Lanz 2010-01-15 18:08:01 +00:00
parent c0adc7dbf5
commit 5b7cfd7f8b
13 changed files with 861 additions and 1 deletions

View File

@ -0,0 +1,42 @@
/***************************************************************************
* Copyright (C) 2009 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 "editmountoptionsdialog.h"
#include "editmountoptionsdialogwidget.h"
#include <QString>
#include <QStringList>
#include <KDebug>
EditMountOptionsDialog::EditMountOptionsDialog(QWidget* parent, const QStringList& options) :
KDialog(parent),
m_DialogWidget(new EditMountOptionsDialogWidget(this, options))
{
setMainWidget(&widget());
}
QStringList EditMountOptionsDialog::options()
{
QStringList rval;
const QStringList lines = widget().editOptions().toPlainText().split('\n');
foreach (const QString& line, lines)
rval.append(line.simplified().toLower());
return rval;
}

View File

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2009 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(MOUNTMANEDITOPTIONSDIALOG__H)
#define MOUNTMANEDITOPTIONSDIALOG__H
#include <KDialog>
class EditMountOptionsDialogWidget;
class QStringList;
class QString;
class QWidget;
class EditMountOptionsDialog : public KDialog
{
Q_OBJECT
public:
EditMountOptionsDialog(QWidget* parent, const QStringList& options);
public:
QStringList options();
protected:
EditMountOptionsDialogWidget& widget() { return *m_DialogWidget; }
private:
EditMountOptionsDialogWidget* m_DialogWidget;
};
#endif

View File

@ -0,0 +1,32 @@
/***************************************************************************
* Copyright (C) 2009 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 "editmountoptionsdialogwidget.h"
#include <QString>
#include <QPlainTextEdit>
EditMountOptionsDialogWidget::EditMountOptionsDialogWidget(QWidget* parent, const QStringList& options) :
QWidget(parent)
{
setupUi(this);
foreach(const QString& o, options)
editOptions().appendPlainText(o);
}

View File

@ -0,0 +1,40 @@
/***************************************************************************
* Copyright (C) 2009 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(EDITOPTIONSDIALOGWIDGET__H)
#define EDITOPTIONSDIALOGWIDGET__H
#include "ui_editmountoptionsdialogwidgetbase.h"
class QStringList;
class QPlainTextEdit;
class EditMountOptionsDialogWidget : public QWidget, public Ui::EditMountOptionsDialogWidgetBase
{
public:
EditMountOptionsDialogWidget(QWidget* parent, const QStringList& options);
public:
QPlainTextEdit& editOptions() { return *m_EditOptions; }
};
#endif

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditMountOptionsDialogWidgetBase</class>
<widget class="QWidget" name="EditMountOptionsDialogWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>461</width>
<height>261</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit Mount Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="m_Label">
<property name="text">
<string>Edit the mount options for this file system:</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="m_EditOptions"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,55 @@
/***************************************************************************
* Copyright (C) 2009 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 "gui/editmountpointdialog.h"
#include "gui/editmountpointdialogwidget.h"
#include "core/partition.h"
#include <KMessageBox>
#include <KDebug>
EditMountPointDialog::EditMountPointDialog(QWidget* parent, Partition& p) :
KDialog(parent),
m_Partition(p),
m_DialogWidget(new EditMountPointDialogWidget(this, partition()))
{
setMainWidget(&widget());
}
void EditMountPointDialog::accept()
{
if (widget().editPath().text().isEmpty())
{
KMessageBox::sorry(this, i18n("The path can not be empty\n\nPlease fill in a valid path or \"none\" if the file system does not require a path to be set (e.g. swap)."), i18n("Error"));
widget().editPath().setFocus(Qt::OtherFocusReason);
return;
}
#if 0
partition().setName(widget().editName().text());
partition().setPath(widget().editPath().text());
partition().setType(widget().type());
partition().setOptions(widget().options());
partition().setDumpFreq(widget().spinDumpFreq().value());
partition().setPassNumber(widget().spinPassNumber().value());
#endif
KDialog::accept();
}

View File

@ -0,0 +1,54 @@
/***************************************************************************
* Copyright (C) 2009 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(MOUNTMANEDITDIALOG__H)
#define MOUNTMANEDITDIALOG__H
#include <KDialog>
class EditMountPointDialogWidget;
class Partition;
class QWidget;
class QString;
class EditMountPointDialog : public KDialog
{
Q_OBJECT
public:
EditMountPointDialog(QWidget* parent, Partition& p);
protected:
EditMountPointDialogWidget& widget() { return *m_DialogWidget; }
protected slots:
void accept();
private:
Partition& partition() { return m_Partition; }
private:
Partition& m_Partition;
EditMountPointDialogWidget* m_DialogWidget;
};
#endif

View File

@ -0,0 +1,121 @@
/***************************************************************************
* Copyright (C) 2009 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 "editmountpointdialogwidget.h"
#include "editmountoptionsdialog.h"
#include <KComboBox>
#include <KLocale>
#include <KFileDialog>
#include <KLineEdit>
#include <KDebug>
#include <QString>
#include <QWidget>
EditMountPointDialogWidget::EditMountPointDialogWidget(QWidget* parent, const Partition& p) :
QWidget(parent)
{
setupUi(this);
#if 0
editName().setText(fs.name());
editName().setEnabled(fs.name().isEmpty());
editPath().setText(fs.path());
spinDumpFreq().setValue(fs.dumpFreq());
spinPassNumber().setValue(fs.passNumber());
on_m_ComboType_currentIndexChanged(fs.type());
boxOptions()["ro"] = m_CheckReadOnly;
boxOptions()["users"] = m_CheckUsers;
boxOptions()["noauto"] = m_CheckNoAuto;
boxOptions()["noatime"] = m_CheckNoAtime;
boxOptions()["nodiratime"] = m_CheckNoDirAtime;
boxOptions()["sync"] = m_CheckSync;
boxOptions()["noexec"] = m_CheckNoExec;
boxOptions()["relatime"] = m_CheckRelAtime;
setupOptions(fs.options());
#endif
}
void EditMountPointDialogWidget::on_m_ComboType_currentIndexChanged(const QString& type)
{
const qint32 idx = comboType().findText(type);
if (type != i18n("other") && idx != -1)
{
comboType().setCurrentIndex(idx);
editType().setEnabled(false);
}
else
{
comboType().setCurrentIndex(comboType().findText(i18n("other")));
if (type != i18n("other"))
editType().setText(type);
editType().setEnabled(true);
}
}
void EditMountPointDialogWidget::setupOptions(const QStringList& options)
{
QStringList optTmpList;
foreach(const QString& o, options)
if (boxOptions().find(o) != boxOptions().end())
boxOptions()[o]->setChecked(true);
else
optTmpList.append(o);
m_Options = optTmpList.join(",");
}
void EditMountPointDialogWidget::on_m_ButtonSelect_clicked(bool)
{
const QString s = KFileDialog::getExistingDirectory(KUrl(editPath().text()), this);
if (!s.isEmpty())
editPath().setText(s);
}
void EditMountPointDialogWidget::on_m_ButtonMore_clicked(bool)
{
EditMountOptionsDialog dlg(this, m_Options.split(','));
if (dlg.exec() == KDialog::Accepted)
setupOptions(dlg.options());
}
QStringList EditMountPointDialogWidget::options()
{
QStringList optList = m_Options.split(',', QString::SkipEmptyParts);
foreach (const QString& s, boxOptions().keys())
if (boxOptions()[s]->isChecked())
optList.append(s);
return optList;
}
QString EditMountPointDialogWidget::type()
{
if (comboType().currentText() == i18n("other"))
return editType().text();
return comboType().currentText();
}

View File

@ -0,0 +1,74 @@
/***************************************************************************
* Copyright (C) 2009 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(MOUNTMANEDITDIALOGWIDGET__H)
#define MOUNTMANEDITDIALOGWIDGET__H
#include "ui_editmountpointdialogwidgetbase.h"
#include <QMap>
#include <QString>
class Partition;
class KPushButton;
class KLineEdit;
class KComboBox;
class QWidget;
class QSpinBox;
class QCheckBox;
class QStringList;
class EditMountPointDialogWidget : public QWidget, public Ui::EditMountPointDialogWidgetBase
{
Q_OBJECT
public:
EditMountPointDialogWidget(QWidget* parent, const Partition& p);
public:
KPushButton& buttonMore() { return *m_ButtonMore; }
KLineEdit& editName() { return *m_EditName; }
KLineEdit& editPath() { return *m_EditPath; }
QSpinBox& spinDumpFreq() { return *m_SpinDumpFreq; }
QSpinBox& spinPassNumber() { return *m_SpinPassNumber; }
KLineEdit& editType() { return *m_EditType; }
KComboBox& comboType() { return *m_ComboType; }
QStringList options();
QString type();
protected slots:
void on_m_ComboType_currentIndexChanged(const QString& type);
void on_m_ButtonSelect_clicked(bool);
void on_m_ButtonMore_clicked(bool);
private:
void setupOptions(const QStringList& options);
QMap<QString, QCheckBox*>& boxOptions() { return m_BoxOptions; }
const QMap<QString, QCheckBox*>& boxOptions() const { return m_BoxOptions; }
private:
QString m_Options;
QMap<QString, QCheckBox*> m_BoxOptions;
};
#endif

View File

@ -0,0 +1,335 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditMountPointDialogWidgetBase</class>
<widget class="QWidget" name="EditMountPointDialogWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>603</width>
<height>343</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="m_LabelName">
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_EditName</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="6">
<widget class="KLineEdit" name="m_EditName">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_LabelPath">
<property name="text">
<string>Path:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_EditPath</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="5">
<widget class="KLineEdit" name="m_EditPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="KPushButton" name="m_ButtonSelect">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Select...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_LabelType">
<property name="text">
<string>Type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_EditType</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="KComboBox" name="m_ComboType">
<item>
<property name="text">
<string>ext2</string>
</property>
</item>
<item>
<property name="text">
<string>ext3</string>
</property>
</item>
<item>
<property name="text">
<string>ext4</string>
</property>
</item>
<item>
<property name="text">
<string>swap</string>
</property>
</item>
<item>
<property name="text">
<string>vfat</string>
</property>
</item>
<item>
<property name="text">
<string>ntfs</string>
</property>
</item>
<item>
<property name="text">
<string>reiser</string>
</property>
</item>
<item>
<property name="text">
<string>reiser4</string>
</property>
</item>
<item>
<property name="text">
<string>xfs</string>
</property>
</item>
<item>
<property name="text">
<string>jfs</string>
</property>
</item>
<item>
<property name="text">
<string>hfs</string>
</property>
</item>
<item>
<property name="text">
<string>hfsplus</string>
</property>
</item>
<item>
<property name="text">
<string>ufs</string>
</property>
</item>
<item>
<property name="text">
<string>other</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3" colspan="4">
<widget class="KLineEdit" name="m_EditType">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_LabelOptions">
<property name="text">
<string>Options:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="m_CheckReadOnly">
<property name="text">
<string>Read-only</string>
</property>
</widget>
</item>
<item row="3" column="3" colspan="4">
<widget class="QCheckBox" name="m_CheckUsers">
<property name="text">
<string>Users can mount and unmount</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="m_CheckNoAuto">
<property name="text">
<string>No automatic mount</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="3">
<widget class="QCheckBox" name="m_CheckNoAtime">
<property name="text">
<string>No update of file access times</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QCheckBox" name="m_CheckSync">
<property name="text">
<string>Synchronuous access</string>
</property>
</widget>
</item>
<item row="5" column="3" colspan="4">
<widget class="QCheckBox" name="m_CheckNoDirAtime">
<property name="text">
<string>No update of directory access times</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="m_CheckNoExec">
<property name="text">
<string>No binary execution</string>
</property>
</widget>
</item>
<item row="6" column="3" colspan="4">
<widget class="QCheckBox" name="m_CheckRelAtime">
<property name="text">
<string>Update access times relative to modification</string>
</property>
</widget>
</item>
<item row="7" column="3" colspan="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>195</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="6">
<widget class="KPushButton" name="m_ButtonMore">
<property name="text">
<string>More...</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="m_LabelDumpFreq">
<property name="text">
<string>Dump Frequency:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_SpinDumpFreq</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="m_SpinDumpFreq"/>
</item>
<item row="8" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>70</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="3">
<widget class="QLabel" name="m_LabelPassNumber">
<property name="text">
<string>Pass Number:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>m_SpinPassNumber</cstring>
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QSpinBox" name="m_SpinPassNumber"/>
</item>
<item row="8" column="5" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,6 +1,6 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui name="KDE Partition Manager" version="4">
<gui name="KDE Partition Manager" version="5">
<ToolBar name="editToolBar">
<text context="@title:menu turn on and off edit toolbar">Edit Toolbar</text>
<Action name="applyAllOperations"/>
@ -54,6 +54,7 @@
<Action name="copyPartition"/>
<Action name="pastePartition"/>
<separator name="separator_3"/>
<Action name="editMountPoint"/>
<Action name="mountPartition"/>
<separator name="separator_4"/>
<Action name="checkPartition"/>

View File

@ -26,6 +26,7 @@
#include "gui/filesystemsupportdialog.h"
#include "gui/progressdialog.h"
#include "gui/insertdialog.h"
#include "gui/editmountpointdialog.h"
#include "core/partition.h"
#include "core/device.h"
@ -232,6 +233,12 @@ void PartitionManagerWidget::setupActions()
pastePartition->setShortcut(Qt::CTRL | Qt::Key_V);
pastePartition->setIcon(BarIcon("edit-paste"));
KAction* editMountPoint = actionCollection()->addAction("editMountPoint", this, SLOT(onEditMountPoint()));
editMountPoint->setEnabled(false);
editMountPoint->setText(i18nc("@action:inmenu", "Edit Mount Point"));
editMountPoint->setToolTip(i18nc("@info:tooltip", "Edit mount point"));
editMountPoint->setStatusTip(i18nc("@info:status", "Edit a partition's mount point and options."));
KAction* mountPartition = actionCollection()->addAction("mountPartition", this, SLOT(onMountPartition()));
mountPartition->setEnabled(false);
mountPartition->setText(i18nc("@action:inmenu", "Mount"));
@ -324,6 +331,7 @@ void PartitionManagerWidget::enableActions()
actionCollection()->action("pastePartition")->setEnabled(!readOnly && CopyOperation::canPaste(part, clipboardPartition()));
actionCollection()->action("propertiesPartition")->setEnabled(part != NULL);
actionCollection()->action("editMountPoint")->setEnabled(part && part->canMount());
actionCollection()->action("mountPartition")->setEnabled(part && (part->canMount() || part->canUnmount()));
if (part != NULL)
@ -485,6 +493,7 @@ void PartitionManagerWidget::showPartitionContextMenu(const QPoint& pos)
partitionMenu.addAction(actionCollection()->action("copyPartition"));
partitionMenu.addAction(actionCollection()->action("pastePartition"));
partitionMenu.addSeparator();
partitionMenu.addAction(actionCollection()->action("editMountPoint"));
partitionMenu.addAction(actionCollection()->action("mountPartition"));
partitionMenu.addSeparator();
partitionMenu.addAction(actionCollection()->action("checkPartition"));
@ -581,6 +590,22 @@ void PartitionManagerWidget::onMountPartition()
updatePartitions();
}
void PartitionManagerWidget::onEditMountPoint()
{
Partition* p = selectedPartition();
Q_ASSERT(p);
if (p == NULL)
return;
QPointer<EditMountPointDialog> dlg = new EditMountPointDialog(this, *p);
dlg->exec();
delete dlg;
}
static bool checkTooManyPartitions(QWidget* parent, const Device& d, const Partition& p)
{
Q_ASSERT(d.partitionTable());

View File

@ -124,6 +124,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionManagerWidget : public QWidget,
void onPropertiesPartition();
void onMountPartition();
void onEditMountPoint();
void onNewPartition();
void onDeletePartition();
void onResizePartition();