Bug 103395 - Tabs should be moveable by keyboard
Summary: Tabs should be moveable by keyboard
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-07 02:24 UTC by Benjamin Wilfing
Modified: 2005-12-31 11:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Wilfing 2005-04-07 02:24:25 UTC
Version:           0.17 #3011 (using KDE 3.4.0, Gentoo)
Compiler:          gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)
OS:                Linux (i686) release 2.6.9

When changing the tab order it is necessary to use the mouse at this time. It would be nice to have keyboard shortcuts for this.
Comment 1 Benjamin Wilfing 2005-06-08 17:32:34 UTC
I'm not really familiar with C++, but is it *that* complicated to assign an already existing function to a keyboard shortcut? I slowly consider returning to xchat, although konversation is really a great application.
Comment 2 Ismail Donmez 2005-06-08 18:20:20 UTC
Our priorities are based on our free time. And well tab code is a total mess. This bug of course will be fixed sometime in the future. Meanwhile you can use whatever irc client you prefer.
Comment 3 Peter Simonsson 2005-06-26 22:43:06 UTC
SVN commit 429178 by psn:

Readd tab moving with a twist... keyboard shortcuts :)

FEATURE:103395


 M  +40 -1     konversationmainwindow.cpp  
 M  +3 -0      konversationmainwindow.h  
 M  +8 -2      konversationui.rc  


--- trunk/extragear/network/konversation/src/konversationmainwindow.cpp #429177:429178
@@ -89,6 +89,7 @@
   m_closeApp = false;
   m_insertCharDialog = 0;
   m_serverListDialog = 0;
+  m_popupTabIndex = -1;
 
   dccTransferHandler=new DccTransferHandler(this);
 
@@ -158,7 +159,10 @@
     QApplication::reverseLayout() ? nextShortcut : prevShortcut,
     this,SLOT(previousTab()),actionCollection(),"previous_tab");
   new KAction(i18n("Close &Tab"),"tab_remove",KShortcut("Ctrl+w"),this,SLOT(closeTab()),actionCollection(),"close_tab");
-  
+
+  new KAction(i18n("Move Tab Left"), "1leftarrow", KShortcut("Alt+Shift+Left"), this, SLOT(moveTabLeft()), actionCollection(), "move_tab_left");
+  new KAction(i18n("Move Tab Right"), "1rightarrow", KShortcut("Alt+Shift+Right"), this, SLOT(moveTabRight()), actionCollection(), "move_tab_right");
+
   QSignalMapper* tabSelectionMapper = new QSignalMapper(this);
   connect(tabSelectionMapper, SIGNAL(mapped(int)), this, SLOT(goToTab(int)));
   
@@ -1557,6 +1561,7 @@
 void KonversationMainWindow::showTabContextMenu(QWidget* tab, const QPoint& pos)
 {
   QPopupMenu* menu = static_cast<QPopupMenu*>(factory()->container("tabContextMenu", this));
+  m_popupTabIndex = getViewContainer()->indexOf(tab);
 
   if(!menu) {
     return;
@@ -1565,4 +1570,38 @@
   menu->popup(pos);
 }
 
+void KonversationMainWindow::moveTabLeft()
+{
+  int index;
+
+  if(m_popupTabIndex == -1) {
+    index = getViewContainer()->currentPageIndex();
+  } else {
+    index = m_popupTabIndex;
+  }
+
+  if(index) {
+    getViewContainer()->moveTab(index, index - 1);
+  }
+
+  m_popupTabIndex = -1;
+}
+
+void KonversationMainWindow::moveTabRight()
+{
+  int index;
+
+  if(m_popupTabIndex == -1) {
+    index = getViewContainer()->currentPageIndex();
+  } else {
+    index = m_popupTabIndex;
+  }
+
+  if(index < (getViewContainer()->count() - 1)) {
+    getViewContainer()->moveTab(index, index + 1);
+  }
+
+  m_popupTabIndex = -1;
+}
+
 #include "konversationmainwindow.moc"
--- trunk/extragear/network/konversation/src/konversationmainwindow.h #429177:429178
@@ -171,6 +171,8 @@
     void nextTab();
     void previousTab();
     void closeTab();
+    void moveTabLeft();
+    void moveTabRight();
 
     void goToTab(int page);
 
@@ -214,6 +216,7 @@
     
     KTabWidget* getViewContainer();
     KTabWidget* viewContainer;
+    int m_popupTabIndex;
 
     Server* frontServer;
     QGuardedPtr<ChatWindow> m_frontView;
--- trunk/extragear/network/konversation/src/konversationui.rc #429177:429178
@@ -36,6 +36,9 @@
       <Action name="close_queries" />
       <Action name="hide_nicknamelist" />
       <Separator />
+      <Action name="move_tab_left" />
+      <Action name="move_tab_right" />
+      <Separator />
       <Action name="open_nicksonline_window" />
       <Action name="open_channel_list" />
       <Action name="open_url_catcher" />
@@ -48,13 +51,16 @@
   <ToolBar fullWidth="true" hidden="true" name="mainToolBar">
     <Action name="open_server_list" />
     <Action name="quick_connect_dialog" />
-    <separator />
+    <Separator />
     <Action name="toggle_away" />
-    <separator />
+    <Separator />
     <Action name="irc_colors" />
   </ToolBar>
 
   <Menu name="tabContextMenu">
+    <Action name="move_tab_left" />
+    <Action name="move_tab_right" />
+    <Separator />
     <Action name="close_tab" />
   </Menu>
 
Comment 4 William Kendrick 2005-12-31 11:03:28 UTC
Damn! Came out after 0.18. :^)  (BTW, it'd be nice if the konversation.kde.org site's announcements had dates on them! Took me forever to find out if this feature existed in 0.18, or came later!)