[Konversation-devel] [Bug 103395] Tabs should be moveable by
keyboard
Peter Simonsson
psn at linux.se
Sun Jun 26 22:43:09 CEST 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=103395
psn linux se changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From psn linux se 2005-06-26 22:43 -------
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>
More information about the Konversation-devel
mailing list