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

List:       kde-commits
Subject:    extragear/utils/yakuake
From:       Eike Hein <hein () kde ! org>
Date:       2009-04-11 19:57:32
Message-ID: 1239479852.932375.16348.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 952400 by hein:

* Fixed interactive tab rename always renaming the active tab,
  rather than the tab the line edit was invoked for and shown
  on top of.
* Don't allow tab reordering by drag'n'drop during interactive
  rename.
* Some minor cleanup and optimization around tab renaming.


 M  +2 -0      ChangeLog  
 M  +16 -9     app/tabbar.cpp  
 M  +5 -2      app/tabbar.h  


--- trunk/extragear/utils/yakuake/ChangeLog #952399:952400
@@ -55,6 +55,8 @@
 * Fixed the 'removeTerminal(int terminalId)' D-Bus call always closing the
   active terminal of the session containing the target terminal, rather than
   the target terminal.
+* Fixed interactive tab rename always renaming the active tab, rather than
+  the tab the line edit was invoked for and shown on top of.
 * Slightly improved options layout on the Behavior page of the configura-
   tion dialog.
 * On KDE 4.2 and higher, the first-run dialog now no longer allows setting
--- trunk/extragear/utils/yakuake/app/tabbar.cpp #952399:952400
@@ -50,6 +50,7 @@
                        "<para>The tab bar allows you to switch between sessions. You \
can double-click a tab to edit its label.</para>"));  
     m_selectedSessionId = -1;
+    m_renamingSessionId = -1;
 
     m_mousePressed = false;
     m_mousePressedIndex = -1;
@@ -88,7 +89,7 @@
     m_lineEdit->hide();
 
     connect(m_lineEdit, SIGNAL(editingFinished()), m_lineEdit, SLOT(hide()));
-    connect(m_lineEdit, SIGNAL(returnPressed()), this, SLOT(renameTab()));
+    connect(m_lineEdit, SIGNAL(returnPressed()), this, \
SLOT(interactiveRenameDone()));  
     setAcceptDrops(true);
 }
@@ -462,7 +463,7 @@
         {
             int index = tabAt(m_startPos.x());
 
-            if (index >= 0)
+            if (index >= 0 && !m_lineEdit->isVisible())
                 startDrag(index);
         }
     }
@@ -601,7 +602,7 @@
 
     int index = m_tabs.indexOf(sessionId);
 
-    if (m_lineEdit->isVisible() && index == m_editingSessionId)
+    if (m_lineEdit->isVisible() && sessionId == m_renamingSessionId)
         m_lineEdit->hide();
 
     m_tabs.removeAt(index);
@@ -615,16 +616,13 @@
 
 void TabBar::renameTab(int sessionId, const QString& newTitle)
 {
-    if (sessionId == -1) sessionId = m_selectedSessionId;
     if (sessionId == -1) return;
     if (!m_tabTitles.contains(sessionId)) return;
 
-    if (newTitle.isEmpty() && !m_lineEdit->text().isEmpty())
-        m_tabTitles[sessionId] = m_lineEdit->text().trimmed();
-    else
+    if (!newTitle.isEmpty())
         m_tabTitles[sessionId] = newTitle;
 
-    repaint();
+    update();
 }
 
 void TabBar::interactiveRename(int sessionId)
@@ -637,7 +635,7 @@
     int y = m_skin->tabBarPosition().y();
     int width = m_tabWidths.at(index) - x;
 
-    m_editingSessionId = index;
+    m_renamingSessionId = index;
 
     m_lineEdit->setText(m_tabTitles[sessionId]);
     m_lineEdit->setGeometry(x-1, y-1, width+3, height()+2);
@@ -646,6 +644,15 @@
     m_lineEdit->show();
 }
 
+void TabBar::interactiveRenameDone()
+{
+    int sessionId = m_renamingSessionId;
+
+    m_renamingSessionId = -1;
+
+    renameTab(sessionId, m_lineEdit->text().trimmed());
+}
+
 void TabBar::selectTab(int sessionId)
 {
     if (!m_tabs.contains(sessionId)) return;
--- trunk/extragear/utils/yakuake/app/tabbar.h #952399:952400
@@ -101,19 +101,22 @@
 
 
     private slots:
-        void readyTabContextMenu();
         void readySessionMenu();
 
         void contextMenuActionHovered(QAction* action);
 
         void closeTabButtonClicked();
 
+        void interactiveRenameDone();
 
+
     private:
         QString standardTabTitle();
         QString makeTabTitle(int number);
         int tabAt(int x);
 
+        void readyTabContextMenu();
+
         void updateMoveActions(int index);
         void updateToggleActions(int sessionId);
         void updateToggleKeyboardInputMenu(int sessionId = -1);
@@ -136,7 +139,7 @@
         KMenu* m_sessionMenu;
 
         KLineEdit* m_lineEdit;
-        int m_editingSessionId;
+        int m_renamingSessionId;
 
         QList<int> m_tabs;
         QHash<int, QString> m_tabTitles;


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

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