Commit d477a435 authored by Daniel Teske's avatar Daniel Teske
Browse files

SessionManager: Ask the user before deleting a sesion.



Task-number: QTCREATORBUG-9272
Change-Id: I636be81544cf114405fbf70e4ee5724c4fd43685
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent b75cf968
......@@ -139,6 +139,8 @@ void SessionModel::cloneSession(const QString &session)
void SessionModel::deleteSession(const QString &session)
{
if (!m_manager->confirmSessionDelete(session))
return;
beginResetModel();
m_manager->deleteSession(session);
endResetModel();
......
......@@ -673,6 +673,18 @@ bool SessionManager::renameSession(const QString &original, const QString &newNa
return deleteSession(original);
}
/*!
\brief Shows a dialog asking the user to confirm deleting the session \p session
*/
bool SessionManager::confirmSessionDelete(const QString &session)
{
return QMessageBox::question(Core::ICore::mainWindow(),
tr("Delete Session"),
tr("Delete session %1?").arg(session),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes;
}
/*!
\brief Deletes session name from session list and file from disk.
*/
......
......@@ -73,6 +73,7 @@ public:
bool createSession(const QString &session);
bool confirmSessionDelete(const QString &session);
bool deleteSession(const QString &session);
bool cloneSession(const QString &original, const QString &clone);
......
......@@ -244,7 +244,11 @@ void SessionDialog::clone()
void SessionDialog::remove()
{
m_sessionManager->deleteSession(m_ui.sessionList->currentItem()->text());
const QString name = m_ui.sessionList->currentItem()->text();
if (!m_sessionManager->confirmSessionDelete(name))
return;
m_sessionManager->deleteSession(name);
m_ui.sessionList->clear();
addItems(false);
markItems();
......
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