summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-03-14 12:48:16 +0200
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-03-16 21:11:55 +0900
commit02a4aa92fe215e454c5ede8480b770ccc3c4696f (patch)
tree21ae5f239448548296ab1dc7175b60c70a37a569
parent6d5126f2d0f30a192beba1c3ea7230932e929b32 (diff)
downloadklamav-02a4aa92fe215e454c5ede8480b770ccc3c4696f.tar.gz
klamav-02a4aa92fe215e454c5ede8480b770ccc3c4696f.zip
Made Scheduler independent from Klamscan's DirectoryList.
This solves issue #20. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit 8af10422f097ffa90ec6367f817fafbd39d3b419)
-rw-r--r--src/klamav.cpp7
-rw-r--r--src/klamscan.cpp21
-rw-r--r--src/klamscan.h1
-rw-r--r--src/schedule.cpp27
-rw-r--r--src/schedule.h4
5 files changed, 27 insertions, 33 deletions
diff --git a/src/klamav.cpp b/src/klamav.cpp
index 734858c..a79a58d 100644
--- a/src/klamav.cpp
+++ b/src/klamav.cpp
@@ -6,6 +6,7 @@
#include "freshklam.h"
#include "sigtool.h"
#include "klamscan.h"
+#include "schedule.h"
#include "kuarantine.h"
#include "welcome.h"
#include "dbviewer.h"
@@ -289,8 +290,12 @@ void Klamav::slotScanDir() {
}
void Klamav::slotScheduleScan() {
- klamscan->slotSchedule();
+ Schedule *schedule_dlg = new Schedule(this, "scheduler");
+ schedule_dlg->show();
+ schedule_dlg->raise();
+ schedule_dlg->setActiveWindow();
}
+
void Klamav::slotOptions() {
slotConfigKlamav("Scanning Backend");
}
diff --git a/src/klamscan.cpp b/src/klamscan.cpp
index 1b04aca..ea5c92e 100644
--- a/src/klamscan.cpp
+++ b/src/klamscan.cpp
@@ -108,8 +108,7 @@ Klamscan::Klamscan(TQWidget *parent, const char *name)
schedule->adjustSize();
layout->addWidget(schedule,0,4);
- connect( schedule, SIGNAL(clicked()),
- SLOT(slotSchedule()) );
+ connect( schedule, SIGNAL(clicked()), tdemain, SLOT(slotScheduleScan()) );
TQToolButton* adv_options = new TQToolButton( privateLayoutWidget2,"play" );
@@ -300,24 +299,6 @@ void Klamscan::slotAdvOptions(){
}
-void Klamscan::slotSchedule(){
-
- TQStringList filepattern = setup->pruneSelectedDirs(setup->dirs());
-
-
- if (filepattern.isEmpty()){
- KMessageBox::error(this, i18n( "Please select something to scan!") );
- return;
- }
-
- Schedule *dialog = new Schedule( this, filepattern, "settings");
- dialog->show();
- dialog->raise();
- dialog->setActiveWindow();
-
-
-}
-
void Klamscan::setDefaults(){
diff --git a/src/klamscan.h b/src/klamscan.h
index b74d214..4b58c9d 100644
--- a/src/klamscan.h
+++ b/src/klamscan.h
@@ -99,7 +99,6 @@ signals:
public slots:
void scan(TQStringList);
void scanURLs(const TQString &urls);
- void slotSchedule();
void slotScanFile();
void slotScanDir();
private slots:
diff --git a/src/schedule.cpp b/src/schedule.cpp
index c0250ed..743c551 100644
--- a/src/schedule.cpp
+++ b/src/schedule.cpp
@@ -2,6 +2,7 @@
* Copyright (C) 2004 Robert Hogan <robert at roberthogan dot net>
*/
+#include "directorylist.h"
#include "schedule.h"
#include "klamav.h"
#include "datepicker.h"
@@ -20,11 +21,12 @@
#include <dcopclient.h>
#include <kstdguiitem.h>
#include <sys/stat.h>
+#include <kdebug.h> // REMOVEME
/* Finding out ICEauthority path */
#include <kprocio.h>
-Schedule::Schedule( TQWidget* parent, TQStringList filepattern, const char* name, bool modal, WFlags fl )
+Schedule::Schedule( TQWidget* parent, const char* name, bool modal, WFlags fl )
: TQDialog( parent, name, modal, fl )
{
@@ -40,10 +42,16 @@ Schedule::Schedule( TQWidget* parent, TQStringList filepattern, const char* name
/* Figure out where the ICEauthority file is located */
getICEauth();
- _filepattern = filepattern;
//bool isRTL = TQApplication::reverseLayout();
- TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialog::marginHint(),
- KDialog::spacingHint(), "vbox");
+ TQHBoxLayout *hbox = new TQHBoxLayout(this, KDialog::marginHint(),
+ KDialog::spacingHint(), "hbox");
+
+ /* CollectionSetup not in full mode due to issue #19 */
+ setup = new CollectionSetup(this, true, false);
+ hbox->addWidget(setup);
+
+ TQVBoxLayout *vbox = new TQVBoxLayout(0, 0, 0, "vbox");
+ hbox->addLayout(vbox);
TQGroupBox *group = new TQGroupBox("Schedule Scan of Selected Folders", this);
vbox->addWidget(group);
@@ -188,7 +196,8 @@ void Schedule::slotAddDateToCombo(TQDate newdate)
void Schedule::slotScheduleScan()
{
-
+ // Update directory list
+ filepattern = setup->dirs();
/* cthost = new CTHost();*/
/* const CTHost& cth(*cthost);
@@ -208,14 +217,14 @@ void Schedule::slotScheduleScan()
if (command.contains(i18n("When I log in to TDE")) ){
TQString startupcommand = createStartupScript();
- cttask->comment = (const char *)i18n("KlamAV Scheduled Scan at TDE Login of %1").arg(_filepattern.join(" ")).local8Bit();
+ cttask->comment = (const char *)i18n("KlamAV Scheduled Scan at TDE Login of %1").arg(filepattern.join(" ")).local8Bit();
cttask->command = (const char *)TQString("%1").arg(startupcommand).local8Bit();
cttask->enabled = FALSE;
}else{
- cttask->comment = (const char *)i18n("KlamAV Scheduled Scan of %1").arg(_filepattern.join(" ")).local8Bit();
- cttask->command = (const char *)TQString("%1 '%2'").arg(createScanScript()).arg(_filepattern.join("' '")).local8Bit();
+ cttask->comment = (const char *)i18n("KlamAV Scheduled Scan of %1").arg(filepattern.join(" ")).local8Bit();
+ cttask->command = (const char *)TQString("%1 '%2'").arg(createScanScript()).arg(filepattern.join("' '")).local8Bit();
cttask->enabled = TRUE;
}
cttask->silent = FALSE;
@@ -430,7 +439,7 @@ TQString Schedule::createStartupScript()
ts << "[Desktop Entry]" << "\n";
ts << "Encoding=UTF-8" << "\n";
ts << "Name=Klamav" << "\n";
- ts << TQString("Exec=klamav %i %m -caption \"%c\" --scanthis '%1'").arg(_filepattern.join("' '")) << "\n";
+ ts << TQString("Exec=klamav %i %m -caption \"%c\" --scanthis '%1'").arg(filepattern.join("' '")) << "\n";
ts << "Icon=klamav" << "\n";
ts << "Type=Application" << "\n";
ts << "DocPath=klamav/klamav.html" << "\n";
diff --git a/src/schedule.h b/src/schedule.h
index 486019a..a20dc79 100644
--- a/src/schedule.h
+++ b/src/schedule.h
@@ -79,7 +79,7 @@ public:
/**
* Default Constructor
*/
- Schedule( TQWidget* parent = 0, TQStringList filepattern = 0,const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ Schedule( TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
/**
* Default Destructor
@@ -165,7 +165,7 @@ private:
TQDate _date;
HMSTimeWidget* hour;
HMSTimeWidget* minute;
- TQStringList _filepattern;
+ TQStringList filepattern;
KTView *schedulebox;
CTHost* cthost;
CTTask* cttask;