From f8b36e35b51b548b12f297ade17acf0256b3f629 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Sat, 13 Feb 2010 14:21:05 +0000 Subject: [PATCH] move the code to detect if we're a KPart to its own method svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1089609 --- src/gui/mainwindow.cpp | 9 ++++++--- src/gui/mainwindow.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 38c6f0e..f010593 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -67,9 +67,7 @@ void MainWindow::init() listOperations().setActionCollection(actionCollection()); pmWidget().init(actionCollection(), "partitionmanagerrc"); - // If we were called with an action collection we're supposed to be a KPart, so don't - // create the GUI in that case. - if (m_ActionCollection != NULL) + if (isKPart()) setupGUI(ToolBar | Keys | StatusBar | Save); else setupGUI(ToolBar | Keys | StatusBar | Save | Create); @@ -218,3 +216,8 @@ void MainWindow::on_m_PartitionManagerWidget_selectedPartitionChanged(const Part updateWindowTitle(); } +bool MainWindow::isKPart() const +{ + // If we were instantiated with an action collection we're supposed to be a KPart + return m_ActionCollection != NULL; +} diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 2322752..b6732cb 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -86,6 +86,8 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi QLabel& statusText() { Q_ASSERT(m_StatusText); return *m_StatusText; } const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; } + bool isKPart() const; + protected slots: void closeEvent(QCloseEvent*); void changeEvent(QEvent* event);