Made Scheduler independent from Klamscan's DirectoryList.

This solves issue #20.

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

@ -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");
}

@ -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" );
@ -298,24 +297,6 @@ void Klamscan::slotAdvOptions(){
tdemain->slotConfigKlamav( "Scanning Backend" );
}
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();
}

@ -99,7 +99,6 @@ signals:
public slots:
void scan(TQStringList);
void scanURLs(const TQString &urls);
void slotSchedule();
void slotScanFile();
void slotScanDir();
private slots:

@ -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";

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

Loading…
Cancel
Save