summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-01-14 21:35:29 +0200
committerMavridis Philippe <mavridisf@gmail.com>2021-01-14 21:35:29 +0200
commitec8fde9b34aec386712343c829a121a21bc38b0a (patch)
tree307f3f7a4c2b3a64301d20d66da26b59e16bc5c0 /src
parent25c5545315fa6a15d313abc628242d9bbdf00cfc (diff)
downloadklamav-ec8fde9b34aec386712343c829a121a21bc38b0a.tar.gz
klamav-ec8fde9b34aec386712343c829a121a21bc38b0a.zip
Implemented a check to prevent KlamAV from being exited while a scan
is going on. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/klamav.cpp6
-rw-r--r--src/klamscan.cpp9
-rw-r--r--src/klamscan.h1
3 files changed, 13 insertions, 3 deletions
diff --git a/src/klamav.cpp b/src/klamav.cpp
index 40db2cf..b811e51 100644
--- a/src/klamav.cpp
+++ b/src/klamav.cpp
@@ -168,10 +168,10 @@ void Klamav::shuttingDown(){
}
bool Klamav::queryClose() {
- if ( freshklam->isFreshklamAlive() ){
+ if ( freshklam->isFreshklamAlive() || klamscan->scanGoingOn() ){
KMessageBox::information (this,i18n("<p>KlamAV will stay open in the system tray. <br><br>"
- " <b>Remember</b> - you can't close KlamAV while <br> "
- " auto-updating is still running!</p>"),"KlamAV","dontshow");
+ " <b>Remember</b> - you can't quit KlamAV while <br> "
+ " scanning or auto-updating!</p>"),"KlamAV","dontshow");
hide();
return false;
diff --git a/src/klamscan.cpp b/src/klamscan.cpp
index bb60d0a..6c6663b 100644
--- a/src/klamscan.cpp
+++ b/src/klamscan.cpp
@@ -196,6 +196,15 @@ Klamscan::~Klamscan()
{
}
+bool Klamscan::scanGoingOn() {
+ // Find any tab in which scanning hasn't finished yet
+ for( int i = 1; i < tabBrowser->count(); i++ ) {
+ if( dynamic_cast<ScanViewer*>( tabBrowser->page(i) )->scanGoingOn() )
+ return true;
+ }
+ return false;
+}
+
void Klamscan::scan( TQStringList filepattern ) {
ScanViewer* homepage = new ScanViewer(this, "page");
diff --git a/src/klamscan.h b/src/klamscan.h
index 1dda666..cc3a60e 100644
--- a/src/klamscan.h
+++ b/src/klamscan.h
@@ -66,6 +66,7 @@ public:
void setDirName(TQString);
bool isMultiScan();
+ bool scanGoingOn();
protected:
/**
* Overridden virtuals for TQt drag 'n drop (XDND)