Mark tab as closed when closed from context menu.

This resolves issue #11.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/24/head
Mavridis Philippe 4 years ago
parent a8b9461cd5
commit a3d1f13286
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -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();

@ -118,6 +118,7 @@ private slots:
void contextEnableFK();
void contextUpdateFK();
void contextDisableFK();
void tabClosed(TQString name);
private:
void setupAccel();

@ -186,7 +186,7 @@ void TabWidget::slotCloseTab()
{
if(!currentItem) return;
removePage(currentItem);
delete currentItem;
emit tabClosed( currentItem->name() );
currentItem = 0;
}

@ -38,6 +38,7 @@ class TabWidget:public KTabWidget
signals:
void currentFrameChanged(Frame *);
void tabClosed(TQString);
private: // methods

Loading…
Cancel
Save