summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-01-14 22:24:28 +0200
committerMavridis Philippe <mavridisf@gmail.com>2021-01-14 22:24:28 +0200
commit100a93b70a62694b99081cd9c2687ab885c00305 (patch)
tree44eba9ecbbfa8ab797ddcc60ee6917225afdeadf /src
parentd5e986620ca1379988aed5c701253516c263904b (diff)
downloadklamav-100a93b70a62694b99081cd9c2687ab885c00305.tar.gz
klamav-100a93b70a62694b99081cd9c2687ab885c00305.zip
Implement fixed tabs.
Fixed tabs are tabs that cannot be closed by the user. Examples of such tabs are thwe first (main) tab in the Virus Browser and the Scanner and some essential tabs in the main window. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/tabwidget.cpp10
-rw-r--r--src/tabwidget.h4
2 files changed, 11 insertions, 3 deletions
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index d024b07..b33be4f 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -9,6 +9,7 @@
#include <tqstyle.h>
#include <tqclipboard.h>
+#include <tqstringlist.h>
#include <tdeapplication.h>
#include <ktabbar.h>
@@ -16,12 +17,12 @@
#include <tdelocale.h>
#include <kiconloader.h>
-
using namespace KlamAV;
-TabWidget::TabWidget(TQWidget * parent, const char *name)
+TabWidget::TabWidget(TQWidget * parent, const char *name, TQStringList fixed)
:KTabWidget(parent, name), m_CurrentMaxLength(30)
{
+ fixedTabs = TQStringList(fixed);
setTabReorderingEnabled(true);
connect( this, SIGNAL( currentChanged(TQWidget *) ), this,
SLOT( slotTabChanged(TQWidget *) ) );
@@ -162,6 +163,11 @@ void TabWidget::contextMenu(int i, const TQPoint &p)
if(currentItemId == count() - 1)
popup.setItemEnabled(moveTabRight, false);
+ for( TQStringList::Iterator it = fixedTabs.begin(); it != fixedTabs.end(); ++it) {
+ if( TQString(*it) == label(currentItemId).replace('&',TQString::null) )
+ popup.setItemEnabled(closeTab, false);
+ }
+
popup.exec(p);
}
diff --git a/src/tabwidget.h b/src/tabwidget.h
index 1e2490b..ffedfb8 100644
--- a/src/tabwidget.h
+++ b/src/tabwidget.h
@@ -13,6 +13,7 @@
#include <ktabwidget.h>
#include <tqptrdict.h>
+#include <tqstringlist.h>
namespace KlamAV
{
@@ -22,7 +23,7 @@ class TabWidget:public KTabWidget
Q_OBJECT
public:
- TabWidget(TQWidget * parent = 0, const char *name = 0);
+ TabWidget(TQWidget * parent = 0, const char *name = 0, TQStringList fixedTabs = 0);
~TabWidget();
void addFrame(Frame *f);
Frame *currentFrame();
@@ -55,6 +56,7 @@ class TabWidget:public KTabWidget
unsigned int m_CurrentMaxLength;
int currentItemId;
TQWidget* currentItem;
+ TQStringList fixedTabs;
};
}