Commit ac8aedb3 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Add Q_ASSERT/returns for _actionCollection

KXMLGUIClient->actionCollection() only returns a non NULL value so I
don't think these checks are needed but for now add Q_ASSERTs and
returns.  Previously, the if() didn't cover all the assignments.
parent 3148c0d9
......@@ -122,6 +122,11 @@ QWidget* ViewManager::widget() const
void ViewManager::setupActions()
{
Q_ASSERT(_actionCollection);
if (!_actionCollection) {
return;
}
KActionCollection* collection = _actionCollection;
QAction* nextViewAction = new QAction(i18nc("@action Shortcut entry", "Next Tab") , this);
......@@ -137,7 +142,6 @@ void ViewManager::setupActions()
QList<QAction*> multiViewOnlyActions;
multiViewOnlyActions << nextContainerAction;
if (collection) {
QAction* splitLeftRightAction = new QAction(QIcon::fromTheme(QStringLiteral("view-split-left-right")),
i18nc("@action:inmenu", "Split View Left/Right"),
this);
......@@ -215,7 +219,6 @@ void ViewManager::setupActions()
connect(switchToTabAction, &QAction::triggered, switchToTabMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map));
collection->addAction(QString("switch-to-tab-%1").arg(i), switchToTabAction);
}
}
foreach(QAction* action, multiViewOnlyActions) {
connect(this , &Konsole::ViewManager::splitViewToggle , action , &QAction::setEnabled);
......@@ -265,6 +268,7 @@ void ViewManager::switchToView(int index)
}
void ViewManager::updateDetachViewState()
{
Q_ASSERT(_actionCollection);
if (!_actionCollection)
return;
......@@ -667,11 +671,14 @@ void ViewManager::containerMoveViewRequest(int index, int id, bool& moved, Tabbe
void ViewManager::setNavigationMethod(NavigationMethod method)
{
Q_ASSERT(_actionCollection);
if (!_actionCollection) {
return;
}
_navigationMethod = method;
KActionCollection* collection = _actionCollection;
if (collection) {
// FIXME: The following disables certain actions for the KPart that it
// doesn't actually have a use for, to avoid polluting the action/shortcut
// namespace of an application using the KPart (otherwise, a shortcut may
......@@ -707,7 +714,6 @@ void ViewManager::setNavigationMethod(NavigationMethod method)
action = collection->action("move-view-right");
if (action) action->setEnabled(enable);
}
}
ViewManager::NavigationMethod ViewManager::navigationMethod() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment