summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-01-17 13:00:04 +0200
committerMavridis Philippe <mavridisf@gmail.com>2021-01-17 13:13:10 +0200
commita3d1f13286393aba4a0673efca28f85f346f15c1 (patch)
tree9cca1123c961fcd9e0d2bc3c8a84b6f771659ff3
parenta8b9461cd5938d7bde7fcccb4cae201cbbad525c (diff)
downloadklamav-a3d1f132.tar.gz
klamav-a3d1f132.zip
Mark tab as closed when closed from context menu.
This resolves issue #11. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
-rw-r--r--src/klamav.cpp31
-rw-r--r--src/klamav.h1
-rw-r--r--src/tabwidget.cpp2
-rw-r--r--src/tabwidget.h1
4 files changed, 30 insertions, 5 deletions
diff --git a/src/klamav.cpp b/src/klamav.cpp
index ab7d7a7..7499a9b 100644
--- a/src/klamav.cpp
+++ b/src/klamav.cpp
@@ -53,6 +53,7 @@ Klamav::Klamav()
fixedTabs << i18n("Scan") << i18n("Update");
tab = new TabWidget(this, "KlamAV", fixedTabs);
+ connect( tab, SIGNAL(tabClosed(TQString)), this, SLOT(tabClosed(TQString)) );
_tray = new KSystemTray(tdemain, "klamav tray");
_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled"));
@@ -108,9 +109,9 @@ Klamav::Klamav()
top->setMenuBar(menubar);
- activityviewer = new Activityviewer(this);
+ activityviewer = new Activityviewer(this, "Events");
- aboutklamav = new Aboutklamav(this);
+ aboutklamav = new Aboutklamav(this, "Welcome");
updateTabState(0, true); // Welcome tab
klamscan = new Klamscan(this);
@@ -124,10 +125,10 @@ Klamav::Klamav()
- kuarantine = new Kuarantine(this);
+ kuarantine = new Kuarantine(this, "Quarantine");
updateTabState(1, true); // Quarantine tab
- klamdb = new KlamDB(this);
+ klamdb = new KlamDB(this, "DBViewer");
updateTabState(2, true); // Virus Browser tab
updateTabState(3, true); // Events tab
@@ -248,6 +249,28 @@ void Klamav::updateTabState( int tabId, bool init ) {
tabs_menu->setItemChecked(itemId, config->readBoolEntry(optionName, true) );
}
+void Klamav::tabClosed(TQString name) {
+ int uncheck;
+ TQString optionName;
+
+ if ( name == "Welcome" ) {
+ uncheck=showWelcomeTab;
+ optionName="ShowWelcomeTab";
+ } else if ( name == "Quarantine" ) {
+ uncheck=showQuarantineTab;
+ optionName="ShowQuarantineTab";
+ } else if ( name == "DBViewer" ) {
+ uncheck=showDBViewerTab;
+ optionName="ShowDBViewerTab";
+ } else if ( name == "Events" ) {
+ uncheck=showEventsTab;
+ optionName="ShowEventsTab";
+ }
+
+ tabs_menu->setItemChecked(uncheck, false);
+ config->writeEntry(optionName, false);
+}
+
// Menu slots
void Klamav::slotScanFile() {
klamscan->slotScanFile();
diff --git a/src/klamav.h b/src/klamav.h
index e539f85..f3d2960 100644
--- a/src/klamav.h
+++ b/src/klamav.h
@@ -118,6 +118,7 @@ private slots:
void contextEnableFK();
void contextUpdateFK();
void contextDisableFK();
+ void tabClosed(TQString name);
private:
void setupAccel();
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index b33be4f..bee6ea7 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -186,7 +186,7 @@ void TabWidget::slotCloseTab()
{
if(!currentItem) return;
removePage(currentItem);
- delete currentItem;
+ emit tabClosed( currentItem->name() );
currentItem = 0;
}
diff --git a/src/tabwidget.h b/src/tabwidget.h
index ffedfb8..b60493a 100644
--- a/src/tabwidget.h
+++ b/src/tabwidget.h
@@ -38,6 +38,7 @@ class TabWidget:public KTabWidget
signals:
void currentFrameChanged(Frame *);
+ void tabClosed(TQString);
private: // methods