[kde-doc-english] KDE/kdebase/apps/konsole/src

Kurt Hindenburg kurt.hindenburg at gmail.com
Thu Jul 8 17:30:37 CEST 2010


SVN commit 1147534 by hindenburg:

Change the Rename Dialog to mimic the Edit Profile->Tabs->Tab Titles section.

FEATURE: 228129
FIXED_IN: 4.6
GUI:


 M  +2 -0      CMakeLists.txt  
 A             RenameTabsDialog.cpp   [License: GPL (v2+)]
 A             RenameTabsDialog.h   [License: GPL (v2+)]
 A             RenameTabsDialog.ui  
 M  +12 -14    SessionController.cpp  


--- trunk/KDE/kdebase/apps/konsole/src/CMakeLists.txt #1147533:1147534
@@ -85,6 +85,7 @@
         ProfileListWidget.cpp
         Pty.cpp
         RemoteConnectionDialog.cpp
+        RenameTabsDialog.cpp
         Screen.cpp
         ScreenWindow.cpp
         Session.cpp
@@ -134,6 +135,7 @@
                   KeyBindingEditor.ui
                   ManageProfilesDialog.ui
                   RemoteConnectionDialog.ui
+                  RenameTabsDialog.ui
                  )
 
     kde4_add_library(konsoleprivate SHARED ${konsoleprivate_SRCS})
--- trunk/KDE/kdebase/apps/konsole/src/SessionController.cpp #1147533:1147534
@@ -52,6 +52,7 @@
 #include "Filter.h"
 #include "History.h"
 #include "IncrementalSearchBar.h"
+#include "RenameTabsDialog.h"
 #include "ScreenWindow.h"
 #include "Session.h"
 #include "ProfileList.h"
@@ -545,26 +546,23 @@
 
 void SessionController::renameSession()
 {
+    QScopedPointer<RenameTabsDialog> dialog(new RenameTabsDialog(QApplication::activeWindow()));
+    dialog->setTabTitleText(_session->tabTitleFormat(Session::LocalTabTitle));
+    dialog->setRemoteTabTitleText(_session->tabTitleFormat(Session::RemoteTabTitle));
+
     QPointer<Session> guard(_session);
-    bool ok = false;
-    const QString& text = KInputDialog::getText( i18n("Rename Tab") ,
-                                                 i18n("Enter new tab text:") ,
-                                                 _session->tabTitleFormat(Session::LocalTabTitle) ,
-                                                 &ok, QApplication::activeWindow() );
+    int result = dialog->exec();
     if (!guard)
         return;
 
-    if ( ok )
+    if (result)
     {
-        // renaming changes both the local and remote tab title formats, to save confusion over
-        // the tab title not changing if renaming the tab whilst the remote tab title format is 
-        // being displayed
-        //
-        // The downside of this approach is that after renaming a tab manually, the ability to 
-        // have separate formats for local and remote activities is lost
-        _session->setTabTitleFormat(Session::LocalTabTitle,text);
-        _session->setTabTitleFormat(Session::RemoteTabTitle,text);
+        QString tabTitle = dialog->tabTitleText();
+        QString remoteTabTitle = dialog->remoteTabTitleText();
 
+        _session->setTabTitleFormat(Session::LocalTabTitle, tabTitle);
+        _session->setTabTitleFormat(Session::RemoteTabTitle, remoteTabTitle);
+
         // trigger an update of the tab text
         snapshot();
     }



More information about the kde-doc-english mailing list