Commit 86ff99b3 authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Set correct focus in the "rename tab" dialog.

Currently, the OK button has the focus upon startup. After patch, the
user doesn't need to remember if they need to adjust the remote or
local title.

Patch by Sebastian Kühn

http://git.reviewboard.kde.org/r/100642/
(cherry picked from commit acd507e1)
parent 249dc86a
......@@ -56,6 +56,15 @@ RenameTabsDialog::~RenameTabsDialog()
delete _ui;
}
void RenameTabsDialog::focusTabTitleText()
{
_ui->tabTitleEdit->setFocus();
}
void RenameTabsDialog::focusRemoteTabTitleText()
{
_ui->remoteTabTitleEdit->setFocus();
}
void RenameTabsDialog::setTabTitleText(const QString& text)
{
......
......@@ -49,6 +49,9 @@ public:
void setTabTitleText(const QString&);
void setRemoteTabTitleText(const QString&);
void focusTabTitleText();
void focusRemoteTabTitleText();
public slots:
void insertTabTitleText(const QString& text);
void insertRemoteTabTitleText(const QString& text);
......
......@@ -897,6 +897,14 @@ bool Session::updateForegroundProcessInfo()
return valid;
}
bool Session::isRemote()
{
ProcessInfo* process = getProcessInfo();
bool ok = false;
return ( process->name(&ok) == "ssh" && ok );
}
QString Session::getDynamicTitle()
{
// update current directory from process
......
......@@ -151,6 +151,13 @@ public:
*/
RemoteTabTitle
};
/**
* Returns true if the session currently contains a connection to a
* remote computer. It currently supports ssh.
*/
bool isRemote();
/**
* Sets the format used by this session for tab titles.
*
......
......@@ -550,6 +550,12 @@ void SessionController::renameSession()
dialog->setTabTitleText(_session->tabTitleFormat(Session::LocalTabTitle));
dialog->setRemoteTabTitleText(_session->tabTitleFormat(Session::RemoteTabTitle));
if (!_session->isRemote()) {
dialog->focusTabTitleText();
} else {
dialog->focusRemoteTabTitleText();
}
QPointer<Session> guard(_session);
int result = dialog->exec();
if (!guard)
......
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