move the code to detect if we're a KPart to its own method

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1089609
This commit is contained in:
Volker Lanz 2010-02-13 14:21:05 +00:00
parent d0a66f66e1
commit f8b36e35b5
2 changed files with 8 additions and 3 deletions

View File

@ -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;
}

View File

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