Summary: | Tabs should be moveable by keyboard | ||
---|---|---|---|
Product: | [Applications] konversation | Reporter: | Benjamin Wilfing <benjamin.wilfing> |
Component: | general | Assignee: | Konversation Developers <konversation-devel> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Benjamin Wilfing
2005-04-07 02:24:25 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. 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. 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> 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!) |