Commit 4428d8c3 authored by dt's avatar dt
Browse files

Session Manager: Fix crashes after renaming

Some of the buttons weren't disabled.

Reviewed-By: Leandro Melo
parent ce3ad3ba
......@@ -189,16 +189,17 @@ void SessionDialog::markItems()
void SessionDialog::updateActions()
{
bool isDefault = false;
bool isActive = false;
if (m_ui.sessionList->currentItem()) {
isDefault = (m_ui.sessionList->currentItem()->text() == QLatin1String("default"));
isActive = (m_ui.sessionList->currentItem()->text() == m_sessionManager->activeSession());
bool isDefault = (m_ui.sessionList->currentItem()->text() == QLatin1String("default"));
bool isActive = (m_ui.sessionList->currentItem()->text() == m_sessionManager->activeSession());
m_ui.btDelete->setEnabled(!isActive && !isDefault);
m_ui.btRename->setEnabled(!isDefault);
} else {
m_ui.btDelete->setEnabled(false);
m_ui.btRename->setEnabled(false);
m_ui.btClone->setEnabled(false);
m_ui.btSwitch->setEnabled(false);
}
m_ui.btDelete->setDisabled(isActive || isDefault);
m_ui.btRename->setDisabled(isDefault);
}
void SessionDialog::createNew()
......@@ -262,11 +263,9 @@ void SessionDialog::rename()
void SessionDialog::switchToSession()
{
if (m_ui.sessionList->currentItem()) {
QString session = m_ui.sessionList->currentItem()->text();
m_sessionManager->loadSession(session);
markItems();
}
QString session = m_ui.sessionList->currentItem()->text();
m_sessionManager->loadSession(session);
markItems();
updateActions();
}
......
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