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);