diff --git a/src/gui/listdevices.cpp b/src/gui/listdevices.cpp deleted file mode 100644 index 2bae0f2..0000000 --- a/src/gui/listdevices.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008,2009 by Volker Lanz * - * * - * 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 -#include - -/** 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() -{ - int idx = listDevices().currentRow(); - - 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(DesktopIcon(d->iconName()), shortText); - item->setToolTip(longText); - item->setSizeHint(QSize(0, 32)); - listDevices().addItem(item); - } - - if (idx > -1 && idx < listDevices().count()) - listDevices().setCurrentRow(idx); -} - -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)); -} diff --git a/src/gui/listdevices.h b/src/gui/listdevices.h deleted file mode 100644 index 8e758f0..0000000 --- a/src/gui/listdevices.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008,2009 by Volker Lanz * - * * - * 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 - -#include - -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 - Q_DISABLE_COPY(ListDevices) - - 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 - diff --git a/src/gui/listdevicesbase.ui b/src/gui/listdevicesbase.ui deleted file mode 100644 index 81e8959..0000000 --- a/src/gui/listdevicesbase.ui +++ /dev/null @@ -1,37 +0,0 @@ - - - ListDevicesBase - - - - 0 - 0 - 255 - 396 - - - - - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - - 32 - 32 - - - - - - - - - diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index c7c9767..0e4de32 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -61,7 +61,6 @@ void MainWindow::init() setupStatusBar(); setupConnections(); - listDevices().init(actionCollection(), &pmWidget()); listOperations().init(actionCollection(), &pmWidget()); pmWidget().init(actionCollection(), "partitionmanagerrc"); @@ -124,7 +123,6 @@ void MainWindow::setupActions() KStandardAction::quit(this, SLOT(close()), actionCollection()); // View actions - actionCollection()->addAction("toggleDockDevices", dockDevices().toggleViewAction()); actionCollection()->addAction("toggleDockOperations", dockOperations().toggleViewAction()); actionCollection()->addAction("toggleDockInformation", dockInformation().toggleViewAction()); actionCollection()->addAction("toggleDockLog", dockLog().toggleViewAction()); @@ -168,8 +166,6 @@ void MainWindow::updateStatusBar() void MainWindow::updateDevices() { - listDevices().updateDevices(); - if (pmWidget().selectedDevice()) infoPane().showDevice(dockWidgetArea(&dockInformation()), *pmWidget().selectedDevice()); else @@ -178,12 +174,6 @@ void MainWindow::updateDevices() updateWindowTitle(); } -void MainWindow::on_m_ListDevices_selectionChanged(Device* d) -{ - pmWidget().setSelectedDevice(d); - updateSelection(NULL); -} - void MainWindow::onDockLocationChanged(Qt::DockWidgetArea) { updateSelection(pmWidget().selectedPartition()); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index af79f50..4953e33 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -62,9 +62,6 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi 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; } @@ -74,9 +71,6 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi QDockWidget& dockInformation() { Q_ASSERT(m_DockInformation); return *m_DockInformation; } const QDockWidget& dockInformation() const { Q_ASSERT(m_DockInformation); return *m_DockInformation; } - QDockWidget& dockDevices() { Q_ASSERT(m_DockDevices); return *m_DockDevices; } - const QDockWidget& dockDevices() const { Q_ASSERT(m_DockDevices); return *m_DockDevices; } - QDockWidget& dockOperations() { Q_ASSERT(m_DockOperations); return *m_DockOperations; } const QDockWidget& dockOperations() const { Q_ASSERT(m_DockOperations); return *m_DockOperations; } @@ -87,8 +81,6 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; } protected slots: - void on_m_ListDevices_selectionChanged(Device* d); - void onDockLocationChanged(Qt::DockWidgetArea area); void closeEvent(QCloseEvent*); diff --git a/src/gui/mainwindowbase.ui b/src/gui/mainwindowbase.ui index 65ea233..727815c 100644 --- a/src/gui/mainwindowbase.ui +++ b/src/gui/mainwindowbase.ui @@ -20,24 +20,6 @@ - - - Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea - - - Devices - - - 1 - - - - - - - - - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea @@ -93,12 +75,6 @@
gui/partitionmanagerwidget.h
1 - - ListDevices - QWidget -
gui/listdevices.h
- 1 -
ListOperations QWidget diff --git a/src/kcm/partitionmanagerkcm.cpp b/src/kcm/partitionmanagerkcm.cpp index 2824118..b869a62 100644 --- a/src/kcm/partitionmanagerkcm.cpp +++ b/src/kcm/partitionmanagerkcm.cpp @@ -20,7 +20,6 @@ #include "kcm/partitionmanagerkcm.h" #include "gui/partitionmanagerwidget.h" -#include "gui/listdevices.h" #include "util/helpers.h" @@ -59,7 +58,6 @@ PartitionManagerKCM::PartitionManagerKCM(QWidget* parent, const QVariantList&) : setButtons(Apply); setupConnections(); - listDevices().init(actionCollection(), &pmWidget()); listOperations().init(actionCollection(), &pmWidget()); pmWidget().init(actionCollection(), "kcm_partitionmanagerrc"); @@ -104,9 +102,7 @@ void PartitionManagerKCM::onNewLogMessage(log::Level, const QString& s) void PartitionManagerKCM::setupConnections() { - connect(&pmWidget(), SIGNAL(devicesChanged()), &listDevices(), SLOT(updateDevices())); connect(&pmWidget(), SIGNAL(operationsChanged()), &listOperations(), SLOT(updateOperations())); - connect(&listDevices(), SIGNAL(selectionChanged(Device*)), &pmWidget(), SLOT(setSelectedDevice(Device*))); connect(&pmWidget(), SIGNAL(statusChanged()), SLOT(onStatusChanged())); } diff --git a/src/kcm/partitionmanagerkcm.h b/src/kcm/partitionmanagerkcm.h index 6ea3da2..08d01ae 100644 --- a/src/kcm/partitionmanagerkcm.h +++ b/src/kcm/partitionmanagerkcm.h @@ -29,7 +29,6 @@ #include class PartitionManagerWidget; -class ListDevices; class KActionCollection; class Device; class KToolBar; @@ -52,7 +51,6 @@ class PartitionManagerKCM : public KCModule, public Ui::PartitionManagerKCMBase void setupKCMWorkaround(); PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; } - ListDevices& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; } ListOperations& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; } QSplitter& splitterHorizontal() { Q_ASSERT(m_SplitterHorizontal); return *m_SplitterHorizontal; } QSplitter& splitterVertical() { Q_ASSERT(m_SplitterVertical); return *m_SplitterVertical; } diff --git a/src/kcm/partitionmanagerkcmbase.ui b/src/kcm/partitionmanagerkcmbase.ui index 98a457c..d60445b 100644 --- a/src/kcm/partitionmanagerkcmbase.ui +++ b/src/kcm/partitionmanagerkcmbase.ui @@ -1,43 +1,35 @@ - + + PartitionManagerKCMBase - - + + 0 0 - 684 - 684 + 763 + 712 - + - - - Qt::Horizontal + + + Qt::Vertical - - - Qt::Vertical + + + + Qt::Horizontal - - + + - 170 + 200 0 - - - - - - - - - - - + @@ -50,12 +42,6 @@
gui/partitionmanagerwidget.h
1
- - ListDevices - QWidget -
gui/listdevices.h
- 1 -
ListOperations QWidget @@ -65,7 +51,7 @@ KToolBar QWidget -
ktoolbar.h
+
ktoolbar.h
1