From 6b4aa38bcd16267ee69e06ecbf2f58bffeed4dc5 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Wed, 24 Mar 2010 23:32:20 +0000 Subject: [PATCH] replace numPendingOperations() with operationStack().size() svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1107160 --- src/gui/mainwindow.cpp | 25 ++++++++++--------------- src/gui/mainwindow.h | 2 -- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index f50f6ac..2eb229f 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -143,11 +143,11 @@ void MainWindow::closeEvent(QCloseEvent* event) return; } - if (numPendingOperations() > 0) + if (operationStack().size() > 0) { if (KMessageBox::warningContinueCancel(this, i18ncp("@info", "Do you really want to quit the application?There is still an operation pending.", - "Do you really want to quit the application?There are still %1 operations pending.", numPendingOperations()), + "Do you really want to quit the application?There are still %1 operations pending.", operationStack().size()), i18nc("@title:window", "Discard Pending Operations and Quit?"), KGuiItem(i18nc("@action:button", "Quit %1", KGlobal::mainComponent().aboutData()->programName())), KStandardGuiItem::cancel(), "reallyQuit") == KMessageBox::Cancel) @@ -398,13 +398,13 @@ void MainWindow::saveConfig() const void MainWindow::enableActions() { actionCollection()->action("createNewPartitionTable")->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice())); - actionCollection()->action("exportPartitionTable")->setEnabled(pmWidget().selectedDevice() && pmWidget().selectedDevice()->partitionTable() && numPendingOperations() == 0); + actionCollection()->action("exportPartitionTable")->setEnabled(pmWidget().selectedDevice() && pmWidget().selectedDevice()->partitionTable() && operationStack().size() == 0); actionCollection()->action("importPartitionTable")->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice())); actionCollection()->action("propertiesDevice")->setEnabled(pmWidget().selectedDevice() != NULL); - actionCollection()->action("undoOperation")->setEnabled(numPendingOperations() > 0); - actionCollection()->action("clearAllOperations")->setEnabled(numPendingOperations() > 0); - actionCollection()->action("applyAllOperations")->setEnabled(numPendingOperations() > 0 && (geteuid() == 0 || Config::allowApplyOperationsAsNonRoot())); + actionCollection()->action("undoOperation")->setEnabled(operationStack().size() > 0); + actionCollection()->action("clearAllOperations")->setEnabled(operationStack().size() > 0); + actionCollection()->action("applyAllOperations")->setEnabled(operationStack().size() > 0 && (geteuid() == 0 || Config::allowApplyOperationsAsNonRoot())); const bool readOnly = pmWidget().selectedDevice() == NULL || pmWidget().selectedDevice()->partitionTable() == NULL || @@ -448,7 +448,7 @@ void MainWindow::on_m_OperationStack_operationsChanged() on_m_PartitionManagerWidget_selectedPartitionChanged(pmWidget().selectedPartition()); if (!isKPart()) - statusText().setText(i18ncp("@info:status", "One pending operation", "%1 pending operations", numPendingOperations())); + statusText().setText(i18ncp("@info:status", "One pending operation", "%1 pending operations", operationStack().size())); } void MainWindow::on_m_OperationStack_devicesChanged() @@ -619,7 +619,7 @@ void MainWindow::on_m_DeviceScanner_finished() void MainWindow::onRefreshDevices() { - if (numPendingOperations() == 0 || KMessageBox::warningContinueCancel(this, + if (operationStack().size() == 0 || KMessageBox::warningContinueCancel(this, i18nc("@info", "Do you really want to rescan the devices?" "This will also clear the list of pending operations."), @@ -667,9 +667,9 @@ void MainWindow::onApplyAllOperations() void MainWindow::onUndoOperation() { - Q_ASSERT(numPendingOperations() > 0); + Q_ASSERT(operationStack().size() > 0); - if (numPendingOperations() == 0) + if (operationStack().size() == 0) return; Log() << i18nc("@info/plain", "Undoing operation: %1", operationStack().operations().last()->description()); @@ -695,11 +695,6 @@ void MainWindow::onClearAllOperations() } } -quint32 MainWindow::numPendingOperations() const -{ - return operationStack().size(); -} - void MainWindow::onCreateNewPartitionTable() { Q_ASSERT(pmWidget().selectedDevice()); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 9413a2c..d98cdf0 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -66,8 +66,6 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi void saveConfig() const; void updateWindowTitle(); - quint32 numPendingOperations() const; - void enableActions(); void closeEvent(QCloseEvent*);