summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-01-14 20:40:57 +0200
committerMavridis Philippe <mavridisf@gmail.com>2021-01-14 20:40:57 +0200
commitf84093be98c2b95e8cad2d56aa8635887dad8faf (patch)
treeccf19a0c2dffe6526f0f66e7aa1f9686f14020c4
parent0635dcaa5cdb0e2966135b4d6611ae19f0fab749 (diff)
downloadklamav-f84093be98c2b95e8cad2d56aa8635887dad8faf.tar.gz
klamav-f84093be98c2b95e8cad2d56aa8635887dad8faf.zip
Implemented slotScanDir(), slotScanFile()
The scan initialisation function in klamscan.* had to be modified a bit. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
-rw-r--r--src/klamav.cpp10
-rw-r--r--src/klamscan.cpp49
-rw-r--r--src/klamscan.h3
3 files changed, 47 insertions, 15 deletions
diff --git a/src/klamav.cpp b/src/klamav.cpp
index 638f0a3..f0cabc0 100644
--- a/src/klamav.cpp
+++ b/src/klamav.cpp
@@ -245,8 +245,14 @@ void Klamav::updateTabState( int tabId, bool init ) {
}
// Menu slots
-void Klamav::slotScanFile() {}
-void Klamav::slotScanDir() {}
+void Klamav::slotScanFile() {
+ klamscan->slotScanFile();
+}
+
+void Klamav::slotScanDir() {
+ klamscan->slotScanDir();
+}
+
void Klamav::slotScheduleScan() {
klamscan->slotSchedule();
}
diff --git a/src/klamscan.cpp b/src/klamscan.cpp
index e0d9419..bb60d0a 100644
--- a/src/klamscan.cpp
+++ b/src/klamscan.cpp
@@ -17,6 +17,7 @@
#include <kstatusbar.h>
#include <kdebug.h>
#include <ksystemtray.h>
+#include <tdefiledialog.h>
#include <tqpushbutton.h>
@@ -196,13 +197,7 @@ Klamscan::~Klamscan()
}
-
-
-
-void Klamscan::slotScan()
-{
-
-
+void Klamscan::scan( TQStringList filepattern ) {
ScanViewer* homepage = new ScanViewer(this, "page");
connect( homepage, SIGNAL( scanFinished(TQWidget *) ), this,
@@ -222,8 +217,15 @@ void Klamscan::slotScan()
tabBrowser->addTab(homepage,suffix);
tabBrowser->setCurrentPage(tabBrowser->count() - 1);
- //return;
-
+
+ CollectionDB::instance()->insertEvent("Manual Scan",TQString("Commencing Scan"),filepattern.join(" "));
+
+ homepage->slotScan(filepattern, check_combo->currentItem(),setup->recursive(),false);
+}
+
+
+void Klamscan::slotScan()
+{
TQStringList filepattern;
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
@@ -240,13 +242,34 @@ void Klamscan::slotScan()
}else{
filepattern = pruneSelectedDirs();
}
- //kdDebug() << filepattern << endl;
- CollectionDB::instance()->insertEvent("Manual Scan",TQString("Commencing Scan"),filepattern.join(" "));
-
- homepage->slotScan(filepattern, check_combo->currentItem(),setup->recursive(),false);
+ scan( filepattern );
+}
+
+
+void Klamscan::slotScanFile() {
+ KURL::List urls( KFileDialog::getOpenURLs(TQString::null,TQString::null,this) );
+ TQStringList filepattern;
+
+ KURL::List::iterator it;
+ for( it = urls.begin(); it != urls.end(); ++it ) {
+ filepattern.append( (*it).pathOrURL() );
+ }
+
+ if( filepattern.count() == 0 )
+ return;
+
+ scan( filepattern );
}
+void Klamscan::slotScanDir() {
+ TQString dir=KFileDialog::getExistingDirectory(TQString::null,this);
+
+ if( dir == TQString::null )
+ return;
+
+ scan( TQStringList(dir) );
+}
void Klamscan::slotAdvOptions(){
diff --git a/src/klamscan.h b/src/klamscan.h
index a294751..1dda666 100644
--- a/src/klamscan.h
+++ b/src/klamscan.h
@@ -96,8 +96,11 @@ private:
signals:
public slots:
+ void scan(TQStringList);
void scanURLs(const TQString &urls);
void slotSchedule();
+ void slotScanFile();
+ void slotScanDir();
private slots:
void slotScan();
void slotAdvOptions();