* Refactor MainWindow and split it up into several classes for the central
widget and the docks. * Add a first version of a kcontrol kcm for KDE Partition Manager based on these refactored classes. Still a lot left to do, though. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=957231
This commit is contained in:
parent
485a05f2c2
commit
44eef78bc0
|
@ -26,7 +26,7 @@ file(GLOB partitionmanagerprivate_SRCS
|
|||
gui/*.cpp
|
||||
)
|
||||
|
||||
file(GLOB partitionmanagerprivate_UIFILES gui/*.ui)
|
||||
file(GLOB partitionmanagerprivate_UIFILES gui/*.ui kcm/*.ui)
|
||||
|
||||
kde4_add_ui_files(partitionmanagerprivate_SRCS ${partitionmanagerprivate_UIFILES})
|
||||
|
||||
|
@ -85,3 +85,22 @@ if(PARTMAN_KPART)
|
|||
|
||||
endif(PARTMAN_KPART)
|
||||
|
||||
############################################
|
||||
|
||||
option(PARTMAN_KCM "Build a kcm for KDE Partition Manager" ON)
|
||||
|
||||
if(PARTMAN_KCM)
|
||||
file(GLOB partitionmanagerkcm_SRCS kcm/partitionmanagerkcm.cpp)
|
||||
|
||||
kde4_add_plugin(kcm_partitionmanager ${partitionmanagerkcm_SRCS})
|
||||
|
||||
target_link_libraries(kcm_partitionmanager
|
||||
${KDE4_KDEUI_LIBS}
|
||||
partitionmanagerprivate
|
||||
)
|
||||
|
||||
install(TARGETS kcm_partitionmanager DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
install(FILES kcm/kcm_partitionmanager.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
|
||||
endif(PARTMAN_KCM)
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008,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/listdevices.h"
|
||||
|
||||
#include "gui/partitionmanagerwidget.h"
|
||||
|
||||
#include "core/device.h"
|
||||
|
||||
#include "util/globallog.h"
|
||||
#include "util/capacity.h"
|
||||
|
||||
#include <kmenu.h>
|
||||
#include <kactioncollection.h>
|
||||
|
||||
/** Creates a new ListDevices instance.
|
||||
@param parent the parent widget
|
||||
*/
|
||||
ListDevices::ListDevices(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
Ui::ListDevicesBase(),
|
||||
m_ActionCollection(NULL),
|
||||
m_PartitionManagerWidget(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
void ListDevices::updateDevices()
|
||||
{
|
||||
listDevices().clear();
|
||||
|
||||
foreach(const Device* d, pmWidget().previewDevices())
|
||||
{
|
||||
const QString shortText = d->deviceNode() + " (" + Capacity(*d).toString() + ')';
|
||||
const QString longText = d->deviceNode() + " (" + Capacity(*d).toString() + ", " + d->name() + ')';
|
||||
QListWidgetItem* item = new QListWidgetItem(SmallIcon("drive-harddisk"), shortText);
|
||||
item->setToolTip(longText);
|
||||
listDevices().addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ListDevices::on_m_ListDevices_itemSelectionChanged()
|
||||
{
|
||||
int idx = -1;
|
||||
|
||||
if (listDevices().selectedItems().size() == 1)
|
||||
idx = listDevices().row(listDevices().selectedItems()[0]);
|
||||
|
||||
Device* d = NULL;
|
||||
if (idx >= 0 && idx < pmWidget().previewDevices().size())
|
||||
d = pmWidget().previewDevices()[idx];
|
||||
|
||||
emit selectionChanged(d);
|
||||
}
|
||||
|
||||
void ListDevices::on_m_ListDevices_customContextMenuRequested(const QPoint& pos)
|
||||
{
|
||||
Q_ASSERT(actionCollection());
|
||||
|
||||
KMenu deviceMenu;
|
||||
deviceMenu.addAction(actionCollection()->action("createNewPartitionTable"));
|
||||
deviceMenu.exec(listDevices().viewport()->mapToGlobal(pos));
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008,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(LISTDEVICES__H)
|
||||
|
||||
#define LISTDEVICES__H
|
||||
|
||||
#include "util/libpartitionmanagerexport.h"
|
||||
|
||||
#include "ui_listdevicesbase.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
class Device;
|
||||
class QPoint;
|
||||
class PartitionManagerWidget;
|
||||
class KActionCollection;
|
||||
|
||||
/** @brief A list of devices.
|
||||
@author vl@fidra.de
|
||||
*/
|
||||
class LIBPARTITIONMANAGERPRIVATE_EXPORT ListDevices : public QWidget, public Ui::ListDevicesBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ListDevices(QWidget* parent);
|
||||
|
||||
signals:
|
||||
void selectionChanged(Device*);
|
||||
|
||||
public:
|
||||
void init(KActionCollection* coll, PartitionManagerWidget* pm_widget) { m_ActionCollection = coll; m_PartitionManagerWidget = pm_widget; }
|
||||
|
||||
public slots:
|
||||
void updateDevices();
|
||||
|
||||
protected:
|
||||
QListWidget& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
const QListWidget& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
|
||||
PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
const PartitionManagerWidget& pmWidget() const { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
|
||||
KActionCollection* actionCollection() { return m_ActionCollection; }
|
||||
|
||||
protected slots:
|
||||
void on_m_ListDevices_itemSelectionChanged();
|
||||
void on_m_ListDevices_customContextMenuRequested(const QPoint& pos);
|
||||
|
||||
private:
|
||||
KActionCollection* m_ActionCollection;
|
||||
PartitionManagerWidget* m_PartitionManagerWidget;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<ui version="4.0" >
|
||||
<class>ListDevicesBase</class>
|
||||
<widget class="QWidget" name="ListDevicesBase" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>255</width>
|
||||
<height>396</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QListWidget" name="m_ListDevices" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,70 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008,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/listoperations.h"
|
||||
|
||||
#include "gui/partitionmanagerwidget.h"
|
||||
|
||||
#include "ops/operation.h"
|
||||
|
||||
#include "util/globallog.h"
|
||||
#include "util/capacity.h"
|
||||
|
||||
#include <kmenu.h>
|
||||
#include <kactioncollection.h>
|
||||
|
||||
/** Creates a new ListOperations instance.
|
||||
@param parent the parent widget
|
||||
*/
|
||||
ListOperations::ListOperations(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
Ui::ListOperationsBase(),
|
||||
m_ActionCollection(NULL),
|
||||
m_PartitionManagerWidget(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
void ListOperations::updateOperations()
|
||||
{
|
||||
listOperations().clear();
|
||||
|
||||
foreach (const Operation* op, pmWidget().operations())
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem(SmallIcon(op->iconName()), op->description());
|
||||
item->setToolTip(op->description());
|
||||
listOperations().addItem(item);
|
||||
}
|
||||
|
||||
listOperations().scrollToBottom();
|
||||
}
|
||||
|
||||
void ListOperations::on_m_ListOperations_customContextMenuRequested(const QPoint& pos)
|
||||
{
|
||||
Q_ASSERT(actionCollection());
|
||||
|
||||
KMenu opsMenu;
|
||||
|
||||
opsMenu.addAction(actionCollection()->action("undoOperation"));
|
||||
opsMenu.addAction(actionCollection()->action("clearAllOperations"));
|
||||
opsMenu.addAction(actionCollection()->action("applyAllOperations"));
|
||||
|
||||
opsMenu.exec(listOperations().viewport()->mapToGlobal(pos));
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008,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(LISTOPERATIONS__H)
|
||||
|
||||
#define LISTOPERATIONS__H
|
||||
|
||||
#include "util/libpartitionmanagerexport.h"
|
||||
|
||||
#include "ui_listoperationsbase.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
class Operation;
|
||||
class QPoint;
|
||||
class PartitionManagerWidget;
|
||||
class KActionCollection;
|
||||
|
||||
/** @brief A list of pending operations.
|
||||
|
||||
@author vl@fidra.de
|
||||
*/
|
||||
class LIBPARTITIONMANAGERPRIVATE_EXPORT ListOperations : public QWidget, public Ui::ListOperationsBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ListOperations(QWidget* parent);
|
||||
|
||||
public:
|
||||
void init(KActionCollection* coll, PartitionManagerWidget* pm_widget) { m_ActionCollection = coll; m_PartitionManagerWidget = pm_widget; }
|
||||
|
||||
protected:
|
||||
KActionCollection* actionCollection() { return m_ActionCollection; }
|
||||
|
||||
PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
const PartitionManagerWidget& pmWidget() const { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
|
||||
QListWidget& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
const QListWidget& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
|
||||
protected slots:
|
||||
void on_m_ListOperations_customContextMenuRequested(const QPoint& pos);
|
||||
void updateOperations();
|
||||
|
||||
private:
|
||||
KActionCollection* m_ActionCollection;
|
||||
PartitionManagerWidget* m_PartitionManagerWidget;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<ui version="4.0" >
|
||||
<class>ListOperationsBase</class>
|
||||
<widget class="QWidget" name="ListOperationsBase" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QListWidget" name="m_ListOperations" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="autoScroll" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="resizeMode" >
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
||||
* Copyright (C) 2008,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 *
|
||||
|
@ -25,10 +25,6 @@
|
|||
|
||||
#include "ui_mainwindowbase.h"
|
||||
|
||||
#include "core/libparted.h"
|
||||
#include "core/operationrunner.h"
|
||||
#include "core/operationstack.h"
|
||||
|
||||
#include "util/globallog.h"
|
||||
|
||||
#include <kxmlguiwindow.h>
|
||||
|
@ -40,7 +36,6 @@ class InfoPane;
|
|||
class QCloseEvent;
|
||||
class QEvent;
|
||||
class Device;
|
||||
class ProgressDialog;
|
||||
class KActionCollection;
|
||||
|
||||
/** @brief The application's main window.
|
||||
|
@ -54,44 +49,26 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi
|
|||
public:
|
||||
MainWindow(QWidget* parent = NULL, KActionCollection* coll = NULL);
|
||||
|
||||
signals:
|
||||
void devicesChanged();
|
||||
|
||||
protected:
|
||||
void setupActions();
|
||||
void setupConnections();
|
||||
void setupStatusBar();
|
||||
void setupDevicesList();
|
||||
void loadConfig();
|
||||
void saveConfig() const;
|
||||
void updateWindowTitle();
|
||||
void updateStatusBar();
|
||||
void updateOperations();
|
||||
void enableActions();
|
||||
void showPartitionContextMenu(const QPoint& pos);
|
||||
void updateDevices();
|
||||
void updatePartitions();
|
||||
|
||||
bool showInsertDialog(Partition& insertPartition, qint64 sourceLength);
|
||||
|
||||
Device* selectedDevice();
|
||||
Partition* selectedPartition();
|
||||
|
||||
KActionCollection* actionCollection() const;
|
||||
KActionCollection* actionCollection() const { return m_ActionCollection != NULL ? m_ActionCollection : KXmlGuiWindow::actionCollection(); }
|
||||
|
||||
InfoPane& infoPane() { Q_ASSERT(m_InfoPane); return *m_InfoPane; }
|
||||
|
||||
PartTableWidget& partTableWidget() { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
|
||||
const PartTableWidget& partTableWidget() const { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
|
||||
PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
const PartitionManagerWidget& pmWidget() const { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
|
||||
QListWidget& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
const QListWidget& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
ListDevices& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
const ListDevices& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
|
||||
QListWidget& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
const QListWidget& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
|
||||
QTreeWidget& treePartitions() { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
|
||||
const QTreeWidget& treePartitions() const { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
|
||||
ListOperations& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
const ListOperations& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
|
||||
QDockWidget& dockInformation() { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
|
||||
const QDockWidget& dockInformation() const { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
|
||||
|
@ -108,68 +85,25 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi
|
|||
QTreeWidget& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
|
||||
const QTreeWidget& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
|
||||
|
||||
Partition* clipboardPartition() { return m_ClipboardPartition; }
|
||||
const Partition* clipboardPartition() const { return m_ClipboardPartition; }
|
||||
void setClipboardPartition(Partition* p) { m_ClipboardPartition = p; }
|
||||
|
||||
LibParted& libParted() { return m_LibParted; }
|
||||
const LibParted& libParted() const { return m_LibParted; }
|
||||
|
||||
ProgressDialog& progressDialog() { Q_ASSERT(m_ProgressDialog); return *m_ProgressDialog; }
|
||||
|
||||
OperationRunner& operationRunner() { return m_OperationRunner; }
|
||||
const OperationRunner& operationRunner() const { return m_OperationRunner; }
|
||||
|
||||
OperationStack& operationStack() { return m_OperationStack; }
|
||||
const OperationStack& operationStack() const { return m_OperationStack; }
|
||||
|
||||
QLabel& statusText() { Q_ASSERT(m_StatusText); return *m_StatusText; }
|
||||
const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; }
|
||||
|
||||
protected slots:
|
||||
void on_m_ListDevices_itemSelectionChanged();
|
||||
void on_m_ListDevices_customContextMenuRequested(const QPoint& pos);
|
||||
void on_m_ListOperations_customContextMenuRequested(const QPoint& pos);
|
||||
void on_m_TreePartitions_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
||||
void on_m_PartTableWidget_customContextMenuRequested(const QPoint& pos);
|
||||
void on_m_TreePartitions_customContextMenuRequested(const QPoint& pos);
|
||||
void on_m_TreePartitions_itemDoubleClicked(QTreeWidgetItem* item, int);
|
||||
void on_m_PartTableWidget_itemSelectionChanged(PartWidget* item);
|
||||
void on_m_ListDevices_itemClicked();
|
||||
|
||||
void onPropertiesPartition();
|
||||
void onMountPartition();
|
||||
void onNewPartition();
|
||||
void onDeletePartition();
|
||||
void onResizePartition();
|
||||
void onCopyPartition();
|
||||
void onPastePartition();
|
||||
void onCheckPartition();
|
||||
void onCreateNewPartitionTable();
|
||||
void onRefreshDevices();
|
||||
void onUndoOperation();
|
||||
void onClearAllOperations();
|
||||
void onApplyAllOperations();
|
||||
void onFileSystemSupport();
|
||||
void onBackupPartition();
|
||||
void onRestorePartition();
|
||||
void on_m_ListDevices_selectionChanged(Device* d);
|
||||
|
||||
void closeEvent(QCloseEvent*);
|
||||
void changeEvent(QEvent* event);
|
||||
|
||||
void onNewLogMessage(log::Level logLevel, const QString& s);
|
||||
void onFinished();
|
||||
void scanDevices();
|
||||
void init();
|
||||
void updateDevices();
|
||||
void updateStatusBar();
|
||||
// void updateOperations();
|
||||
void updateSelection(const Partition* p);
|
||||
|
||||
private:
|
||||
LibParted m_LibParted;
|
||||
OperationStack m_OperationStack;
|
||||
OperationRunner m_OperationRunner;
|
||||
QLabel* m_StatusText;
|
||||
InfoPane* m_InfoPane;
|
||||
Partition* m_ClipboardPartition;
|
||||
ProgressDialog* m_ProgressDialog;
|
||||
KActionCollection* m_ActionCollection;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1007</width>
|
||||
<height>696</height>
|
||||
<height>684</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -15,84 +15,7 @@
|
|||
<widget class="QWidget" name="centralwidget" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="PartTableWidget" native="1" name="m_PartTableWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="m_TreePartitions" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label">Partition</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label partition type">Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label">Mount Point</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label file system label">Label</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label total file system size">Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label space used">Used</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label partition flags">Flags</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="PartitionManagerWidget" native="1" name="m_PartitionManagerWidget" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -109,17 +32,7 @@
|
|||
<widget class="QWidget" name="m_DockDevicesContents" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QListWidget" name="m_ListDevices" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ListDevices" native="1" name="m_ListDevices" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -137,32 +50,9 @@
|
|||
<widget class="QWidget" name="m_DockOperationsContents" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QListWidget" name="m_ListOperations" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="autoScroll" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="resizeMode" >
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ListOperations" native="1" name="m_ListOperations" />
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>m_ListOperations</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="m_DockInformation" >
|
||||
|
@ -222,12 +112,12 @@
|
|||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label">Time</string>
|
||||
<string>Time</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string comment="@label">Message</string>
|
||||
<string>Message</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
|
@ -238,9 +128,21 @@
|
|||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PartTableWidget</class>
|
||||
<class>PartitionManagerWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/parttablewidget.h</header>
|
||||
<header>gui/partitionmanagerwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ListDevices</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/listdevices.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ListOperations</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/listoperations.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,151 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008,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(CENTRALWIDGET__H)
|
||||
|
||||
#define CENTRALWIDGET__H
|
||||
|
||||
#include "util/libpartitionmanagerexport.h"
|
||||
|
||||
#include "core/libparted.h"
|
||||
#include "core/operationrunner.h"
|
||||
#include "core/operationstack.h"
|
||||
|
||||
#include "ui_partitionmanagerwidgetbase.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QWidget;
|
||||
class QLabel;
|
||||
class PartWidget;
|
||||
class KActionCollection;
|
||||
class Device;
|
||||
class ProgressDialog;
|
||||
|
||||
/** @brief The central widget for the application.
|
||||
|
||||
@author vl@fidra.de
|
||||
*/
|
||||
class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionManagerWidget : public QWidget, Ui::PartitionManagerWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PartitionManagerWidget(QWidget* parent, KActionCollection* coll = NULL);
|
||||
virtual ~PartitionManagerWidget();
|
||||
|
||||
signals:
|
||||
void devicesChanged();
|
||||
void operationsChanged();
|
||||
void statusChanged();
|
||||
void selectionChanged(const Partition*);
|
||||
|
||||
public:
|
||||
void init(KActionCollection* coll);
|
||||
KActionCollection* actionCollection() const { return m_ActionCollection; }
|
||||
|
||||
void clear();
|
||||
void clearSelection();
|
||||
void setPartitionTable(const PartitionTable* ptable);
|
||||
void setSelection(const Partition* p);
|
||||
void enableActions();
|
||||
|
||||
Device* selectedDevice() { return m_SelectedDevice; }
|
||||
const Device* selectedDevice() const { return m_SelectedDevice; }
|
||||
void setSelectedDevice(Device* d);
|
||||
|
||||
Partition* selectedPartition();
|
||||
|
||||
OperationStack::Devices& previewDevices() { return operationStack().previewDevices(); }
|
||||
const OperationStack::Devices& previewDevices() const { return operationStack().previewDevices(); }
|
||||
const OperationStack::Operations& operations() const { return operationStack().operations(); }
|
||||
|
||||
void updatePartitions();
|
||||
|
||||
Partition* clipboardPartition() { return m_ClipboardPartition; }
|
||||
const Partition* clipboardPartition() const { return m_ClipboardPartition; }
|
||||
void setClipboardPartition(Partition* p) { m_ClipboardPartition = p; }
|
||||
|
||||
ProgressDialog& progressDialog() { Q_ASSERT(m_ProgressDialog); return *m_ProgressDialog; }
|
||||
const ProgressDialog& progressDialog() const { Q_ASSERT(m_ProgressDialog); return *m_ProgressDialog; }
|
||||
|
||||
quint32 numPendingOperations();
|
||||
|
||||
protected:
|
||||
void setupActions();
|
||||
void setupConnections();
|
||||
void showPartitionContextMenu(const QPoint& pos);
|
||||
void loadConfig();
|
||||
void saveConfig() const;
|
||||
bool showInsertDialog(Partition& insertPartition, qint64 sourceLength);
|
||||
|
||||
PartTableWidget& partTableWidget() { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
|
||||
const PartTableWidget& partTableWidget() const { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
|
||||
|
||||
QTreeWidget& treePartitions() { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
|
||||
const QTreeWidget& treePartitions() const { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
|
||||
|
||||
LibParted& libParted() { return m_LibParted; }
|
||||
const LibParted& libParted() const { return m_LibParted; }
|
||||
|
||||
OperationRunner& operationRunner() { return m_OperationRunner; }
|
||||
const OperationRunner& operationRunner() const { return m_OperationRunner; }
|
||||
|
||||
OperationStack& operationStack() { return m_OperationStack; }
|
||||
const OperationStack& operationStack() const { return m_OperationStack; }
|
||||
|
||||
protected slots:
|
||||
void on_m_TreePartitions_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
||||
void on_m_PartTableWidget_customContextMenuRequested(const QPoint& pos);
|
||||
void on_m_TreePartitions_customContextMenuRequested(const QPoint& pos);
|
||||
void on_m_TreePartitions_itemDoubleClicked(QTreeWidgetItem* item, int);
|
||||
void on_m_PartTableWidget_itemSelectionChanged(PartWidget* item);
|
||||
|
||||
void scanDevices();
|
||||
|
||||
void onPropertiesPartition();
|
||||
void onMountPartition();
|
||||
void onNewPartition();
|
||||
void onDeletePartition();
|
||||
void onResizePartition();
|
||||
void onCopyPartition();
|
||||
void onPastePartition();
|
||||
void onCheckPartition();
|
||||
void onCreateNewPartitionTable();
|
||||
void onRefreshDevices();
|
||||
void onUndoOperation();
|
||||
void onClearAllOperations();
|
||||
void onApplyAllOperations();
|
||||
void onFileSystemSupport();
|
||||
void onBackupPartition();
|
||||
void onRestorePartition();
|
||||
void onFinished();
|
||||
|
||||
private:
|
||||
LibParted m_LibParted;
|
||||
OperationStack m_OperationStack;
|
||||
OperationRunner m_OperationRunner;
|
||||
ProgressDialog* m_ProgressDialog;
|
||||
KActionCollection* m_ActionCollection;
|
||||
Device* m_SelectedDevice;
|
||||
Partition* m_ClipboardPartition;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<ui version="4.0" >
|
||||
<class>PartitionManagerWidgetBase</class>
|
||||
<widget class="QWidget" name="PartitionManagerWidgetBase" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>634</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string comment="@title:window" >KDE Partition Manager</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="PartTableWidget" native="1" name="m_PartTableWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="m_TreePartitions" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Partition</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Mount Point</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Label</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Used</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Flags</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PartTableWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/parttablewidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,14 @@
|
|||
[Desktop Entry]
|
||||
Exec=kcmshell4 kcm_partitionmanager
|
||||
Icon=partitionmanager
|
||||
Type=Service
|
||||
|
||||
X-KDE-Library=kcm_partitionmanager
|
||||
#X-KDE-RootOnly=true
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
X-KDE-ParentApp=kcontrol
|
||||
X-KDE-System-Settings-Parent-Category=system
|
||||
#X-KDE-SubstituteUID=true
|
||||
|
||||
Name=Partition Manager
|
||||
Comment=Manage disks, partitions and file systems
|
|
@ -0,0 +1,116 @@
|
|||
/***************************************************************************
|
||||
* 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 "kcm/partitionmanagerkcm.h"
|
||||
|
||||
#include "gui/partitionmanagerwidget.h"
|
||||
#include "gui/listdevices.h"
|
||||
|
||||
#include "util/helpers.h"
|
||||
|
||||
#include <kgenericfactory.h>
|
||||
#include <klocale.h>
|
||||
#include <kactioncollection.h>
|
||||
#include <ktoolbar.h>
|
||||
|
||||
K_PLUGIN_FACTORY(
|
||||
PartitionManagerKCMFactory,
|
||||
registerPlugin<PartitionManagerKCM>();
|
||||
)
|
||||
K_EXPORT_PLUGIN(
|
||||
PartitionManagerKCMFactory("partitionmanagerkcm")
|
||||
)
|
||||
|
||||
PartitionManagerKCM::PartitionManagerKCM(QWidget* parent, const QVariantList&) :
|
||||
KCModule(PartitionManagerKCMFactory::componentData(), parent),
|
||||
Ui::PartitionManagerKCMBase(),
|
||||
m_ActionCollection(new KActionCollection(this, PartitionManagerKCMFactory::componentData()))
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), SLOT(onNewLogMessage(log::Level, const QString&)));
|
||||
|
||||
// workaround for https://bugs.launchpad.net/kdesudo/+bug/272427
|
||||
unblockSigChild();
|
||||
registerMetaTypes();
|
||||
|
||||
setButtons(Apply);
|
||||
|
||||
setupConnections();
|
||||
|
||||
listDevices().init(actionCollection(), &pmWidget());
|
||||
listOperations().init(actionCollection(), &pmWidget());
|
||||
pmWidget().init(actionCollection());
|
||||
|
||||
const char* actionNames[] =
|
||||
{
|
||||
"applyAllOperations",
|
||||
"undoOperation",
|
||||
"clearAllOperations",
|
||||
"",
|
||||
// "refreshDevices",
|
||||
"createNewPartitionTable",
|
||||
"",
|
||||
"newPartition",
|
||||
"resizePartition",
|
||||
"deletePartition",
|
||||
"copyPartition",
|
||||
"pastePartition",
|
||||
// "mountPartition",
|
||||
"checkPartition",
|
||||
"propertiesPartition",
|
||||
"backupPartition",
|
||||
"restorePartition",
|
||||
// "",
|
||||
// "fileSystemSupport"
|
||||
};
|
||||
|
||||
for(size_t i = 0; i < sizeof(actionNames) / sizeof(actionNames[0]); i++)
|
||||
if (strlen(actionNames[i]) > 0)
|
||||
toolBar()->addAction(actionCollection()->action(actionNames[i]));
|
||||
else
|
||||
toolBar()->addSeparator();
|
||||
|
||||
toolBar()->setIconSize(QSize(22, 22));
|
||||
toolBar()->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
}
|
||||
|
||||
void PartitionManagerKCM::onNewLogMessage(log::Level, const QString& s)
|
||||
{
|
||||
kDebug() << s;
|
||||
}
|
||||
|
||||
void PartitionManagerKCM::load()
|
||||
{
|
||||
}
|
||||
|
||||
void PartitionManagerKCM::save()
|
||||
{
|
||||
}
|
||||
|
||||
void PartitionManagerKCM::setupConnections()
|
||||
{
|
||||
connect(&pmWidget(), SIGNAL(devicesChanged()), &listDevices(), SLOT(updateDevices()));
|
||||
connect(&pmWidget(), SIGNAL(operationsChanged()), &listOperations(), SLOT(updateOperations()));
|
||||
}
|
||||
|
||||
void PartitionManagerKCM::on_m_ListDevices_selectionChanged(Device* d)
|
||||
{
|
||||
pmWidget().setSelectedDevice(d);
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/***************************************************************************
|
||||
* 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(PARTMANKCM__H)
|
||||
|
||||
#define PARTMANKCM__H
|
||||
|
||||
#include "ui_partitionmanagerkcmbase.h"
|
||||
|
||||
#include "util/globallog.h"
|
||||
|
||||
#include <kcmodule.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
class PartitionManagerWidget;
|
||||
class ListDevices;
|
||||
class KActionCollection;
|
||||
class Device;
|
||||
class KToolBar;
|
||||
|
||||
class PartitionManagerKCM : public KCModule, public Ui::PartitionManagerKCMBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PartitionManagerKCM(QWidget* parent, const QVariantList& args);
|
||||
virtual ~PartitionManagerKCM() {}
|
||||
|
||||
public:
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void setupConnections();
|
||||
|
||||
PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
const PartitionManagerWidget& pmWidget() const { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
||||
|
||||
ListDevices& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
const ListDevices& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
||||
|
||||
ListOperations& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
const ListOperations& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
||||
|
||||
KActionCollection* actionCollection() { return m_ActionCollection; }
|
||||
|
||||
KToolBar* toolBar() { return m_ToolBar; }
|
||||
|
||||
protected slots:
|
||||
void on_m_ListDevices_selectionChanged(Device* d);
|
||||
void onNewLogMessage(log::Level logLevel, const QString& s);
|
||||
|
||||
private:
|
||||
KActionCollection* m_ActionCollection;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<ui version="4.0" >
|
||||
<class>PartitionManagerKCMBase</class>
|
||||
<widget class="QWidget" name="PartitionManagerKCMBase" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>684</width>
|
||||
<height>684</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter_2" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="ListDevices" native="1" name="m_ListDevices" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="ListOperations" native="1" name="m_ListOperations" />
|
||||
</widget>
|
||||
<widget class="QWidget" name="" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="KToolBar" native="1" name="m_ToolBar" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="PartitionManagerWidget" native="1" name="m_PartitionManagerWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PartitionManagerWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/partitionmanagerwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ListDevices</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/listdevices.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ListOperations</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/listoperations.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KToolBar</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global" >ktoolbar.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue