summaryrefslogtreecommitdiffstats
path: root/src/tabwidget.cpp
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-01-14 22:21:56 +0200
committerMavridis Philippe <mavridisf@gmail.com>2021-01-14 22:21:56 +0200
commitd5e986620ca1379988aed5c701253516c263904b (patch)
treef2ce28f3d5aeba3197ea11b8c78eeacd0d595acb /src/tabwidget.cpp
parente03731b27eed5830544609391372482066af5267 (diff)
downloadklamav-d5e986620ca1379988aed5c701253516c263904b.tar.gz
klamav-d5e986620ca1379988aed5c701253516c263904b.zip
Implemented tabs context menu
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/tabwidget.cpp')
-rw-r--r--src/tabwidget.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index e1c079f..d024b07 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -147,16 +147,35 @@ void TabWidget::setTitle( const TQString &title , TQWidget* sender)
void TabWidget::contextMenu(int i, const TQPoint &p)
{
+ currentItemId = i;
currentItem = page(i);
TDEPopupMenu popup;
- int closeTab = popup.insertItem( SmallIcon("tab_remove"), i18n("Close Tab"), this, SLOT( slotCloseTab() ) );
- if(indexOf(currentItem) == 0) { // you can't detach or close articles tab..
- popup.setItemEnabled(closeTab, false);
- }
+ int moveTabLeft = popup.insertItem( SmallIcon("back"), i18n("Move Tab &Left"), this, SLOT(slotMoveTabLeft()) );
+ int moveTabRight = popup.insertItem( SmallIcon("forward"), i18n("Move Tab &Right"), this, SLOT(slotMoveTabRight()) );
+ popup.insertSeparator();
+ int closeTab = popup.insertItem( SmallIcon("tab_remove"), i18n("Close Tab"), this, SLOT(slotCloseTab()) );
+
+ if(currentItemId == 0)
+ popup.setItemEnabled(moveTabLeft, false);
+
+ if(currentItemId == count() - 1)
+ popup.setItemEnabled(moveTabRight, false);
+
popup.exec(p);
}
+
+void TabWidget::slotMoveTabLeft() {
+ if( currentItemId > 0 )
+ moveTab(currentItemId, currentItemId-1);
+}
+
+void TabWidget::slotMoveTabRight() {
+ if( currentItemId < count() - 1 )
+ moveTab(currentItemId, currentItemId+1);
+}
+
void TabWidget::slotCloseTab()
{
if(!currentItem) return;