Commit ebe9b2b3 authored by Eike Hein's avatar Eike Hein
Browse files

Retract after last tab closes.

Patch by A Janardhan Reddy, with minor cleanup by me.

BUG:206845
parent e02dceab
......@@ -27,6 +27,7 @@ Changes since 2.9.8:
option to also use the action to focus the window is disabled, has now
been changed to move the window to the current virtual desktop and focus
it, rather than retract it.
* Yakuake now automatically retracts after the last open tab closes.
* A number of default keyboard shortcuts have been changed to reestablish
consistency with Konsole, which introduced changed defaults in KDE Soft-
ware Compilation v4.6.
......
......@@ -83,6 +83,8 @@ MainWindow::MainWindow(QWidget* parent)
setupMenu();
connect(m_tabBar, SIGNAL(newTabRequested()), m_sessionStack, SLOT(addSession()));
connect(m_tabBar, SIGNAL(lastTabClosed()), m_tabBar, SIGNAL(newTabRequested()));
connect(m_tabBar, SIGNAL(lastTabClosed()), this, SLOT(void handleLastTabClosed()));
connect(m_tabBar, SIGNAL(tabSelected(int)), m_sessionStack, SLOT(raiseSession(int)));
connect(m_tabBar, SIGNAL(tabClosed(int)), m_sessionStack, SLOT(removeSession(int)));
connect(m_tabBar, SIGNAL(requestTerminalHighlight(int)), m_sessionStack, SLOT(handleTerminalHighlightRequest(int)));
......@@ -534,6 +536,12 @@ void MainWindow::handleTerminalSilence(Terminal* terminal)
}
}
void MainWindow::handleLastTabClosed()
{
if (isVisible())
toggleWindowState();
}
void MainWindow::handleSwitchToAction()
{
QAction* action = qobject_cast<QAction*>(QObject::sender());
......
......@@ -78,6 +78,7 @@ class MainWindow : public KMainWindow
void handleToggleTerminalMonitorSilence(bool checked);
void handleTerminalActivity(Terminal* terminal);
void handleTerminalSilence(Terminal* terminal);
void handleLastTabClosed();
signals:
......
......@@ -758,7 +758,7 @@ void TabBar::removeTab(int sessionId)
m_tabTitles.remove(sessionId);
if (m_tabs.count() == 0)
emit newTabRequested();
emit lastTabClosed();
else
emit tabSelected(m_tabs.last());
}
......
......@@ -81,6 +81,7 @@ class TabBar : public QWidget
void requestTerminalHighlight(int terminalId);
void requestRemoveTerminalHighlight();
void tabContextMenuClosed();
void lastTabClosed();
protected:
......
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