[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkonsole/KDE/4=2E6=5D_src=3A_Set_correct_focus_in_th?=
From:       Kurt Hindenburg <kurt.hindenburg () gmail ! com>
Date:       2011-03-01 4:10:53
Message-ID: 20110301041053.71C36A60C9 () git ! kde ! org
[Download RAW message or body]

Git commit 86ff99b3c1c156fc4d55beed750cc5eb66f61b3d by Kurt Hindenburg.
Committed on 14/02/2011 at 03:29.
Pushed by hindenburg into branch 'KDE/4.6'.

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 acd507e1a55446c6d46d1a2cdbb32a516ae1a021)

M  +9    -0    src/RenameTabsDialog.cpp     
M  +3    -0    src/RenameTabsDialog.h     
M  +8    -0    src/Session.cpp     
M  +7    -0    src/Session.h     
M  +6    -0    src/SessionController.cpp     

http://commits.kde.org/konsole/86ff99b3c1c156fc4d55beed750cc5eb66f61b3d

diff --git a/src/RenameTabsDialog.cpp b/src/RenameTabsDialog.cpp
index 2ecd417..c70cc8a 100644
--- a/src/RenameTabsDialog.cpp
+++ b/src/RenameTabsDialog.cpp
@@ -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)
 {
diff --git a/src/RenameTabsDialog.h b/src/RenameTabsDialog.h
index 734f270..157e6a9 100644
--- a/src/RenameTabsDialog.h
+++ b/src/RenameTabsDialog.h
@@ -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);
diff --git a/src/Session.cpp b/src/Session.cpp
index d1834db..d05cbfe 100644
--- a/src/Session.cpp
+++ b/src/Session.cpp
@@ -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
diff --git a/src/Session.h b/src/Session.h
index de78951..def9f92 100644
--- a/src/Session.h
+++ b/src/Session.h
@@ -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.
    *
diff --git a/src/SessionController.cpp b/src/SessionController.cpp
index 5f80eb9..ef9fec0 100644
--- a/src/SessionController.cpp
+++ b/src/SessionController.cpp
@@ -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)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic