diff options
author | Mavridis Philippe <[email protected]> | 2021-02-26 19:34:09 +0200 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2021-03-03 17:44:31 +0200 |
commit | 13cb4a5e7dc1c22d25c51da52156a558be0b7d05 (patch) | |
tree | e013fb1be4c88430b4be1ef21acb656c7f91eb5d /src/configdialog.cpp | |
parent | 8300c80d583320087d844b9f0ad0025d4a60aa10 (diff) | |
download | klamav-13cb4a5e7dc1c22d25c51da52156a558be0b7d05.tar.gz klamav-13cb4a5e7dc1c22d25c51da52156a558be0b7d05.zip |
Added On-Access Scanner.
There are still a few TODOs, but it seems to work quite well already.
This relates to issue #10.
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'src/configdialog.cpp')
-rw-r--r-- | src/configdialog.cpp | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/configdialog.cpp b/src/configdialog.cpp index 5cd76ac..43a0fe8 100644 --- a/src/configdialog.cpp +++ b/src/configdialog.cpp @@ -13,11 +13,13 @@ email : [email protected] * * ***************************************************************************/ +#include "klamav.h" #include "configdialog.h" #include "backend.h" #include "archives.h" #include "specialfiletypes.h" -/* #include "autoscanoptions.h" */ +#include "klamonacc.h" +#include "klamonacc_config.h" #include "logoptions.h" #include "sigtool.h" @@ -42,6 +44,7 @@ email : [email protected] #include <klineedit.h> #include <tdelocale.h> #include <kstandarddirs.h> +#include <tdemessagebox.h> ////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC @@ -57,7 +60,7 @@ KlamavConfigDialog::KlamavConfigDialog( TQWidget *parent, const char* name, TDEC m_archives = new ArchiveOptions( 0, "Archives" ); m_emailprotection = new Sigtool ( 0, "E-mail protection" ); m_specialfiletypes = new SpecialFileTypes( 0, "File Types" ); - /* m_autoscanoptions = new AutoScanOptions( 0, "Auto-Scan" ); */ + m_klamonacc = new KlamOnAccConfig( 0, "On-Access Scanner" ); m_logoptions = new LogOptions( 0, "Event Logging" ); // add pages @@ -68,7 +71,13 @@ KlamavConfigDialog::KlamavConfigDialog( TQWidget *parent, const char* name, TDEC addPage( m_archives, i18n( "Archives" ), "ark", i18n( "Configure Archive Scanning" ) ); addPage( m_emailprotection, i18n( "E-mail protection" ), "email", i18n( "Set up your e-mail client to use Klammail" ) ); addPage( m_specialfiletypes, i18n( "File Types" ), "folder", i18n( "Configure File Types" ) ); - /* addPage( m_autoscanoptions, i18n( "Auto-Scan" ), "filefind", i18n( "Configure Auto-Scan" ) ); */ + + addPage( m_klamonacc, i18n( "On-Access Scanner" ), "filefind", i18n( "Configure On-Access Scanning" ) ); + connect( m_klamonacc, SIGNAL(directoriesModified()), tdemain->klamonacc, SLOT(restart()) ); + connect( tdemain->klamonacc, SIGNAL(stateUpdated()), this, SLOT(slotToggleKlamOnAccCheckbox()) ); + connect( m_klamonacc->kcfg_EnableOnAccess, SIGNAL(toggled(bool)), this, SLOT(slotToggleKlamOnAcc(bool)) ); + slotToggleKlamOnAcc( m_klamonacc->kcfg_EnableOnAccess->isOn() ); // initial state + addPage( m_logoptions, i18n( "Event Logging" ), "kate", i18n( "Configure Events to Log" ) ); TQObjectList *list = queryList( "TQLabel", "infoPixmap" ); @@ -82,7 +91,7 @@ KlamavConfigDialog::KlamavConfigDialog( TQWidget *parent, const char* name, TDEC static_cast<TQLabel*>(label)->setMaximumWidth( 250 ); delete list; - + connect( this, SIGNAL(settingsChanged()), SLOT(applySettings()) ); } KlamavConfigDialog::~KlamavConfigDialog() @@ -96,6 +105,19 @@ void KlamavConfigDialog::slotToggleClamdscan(bool on) m_specialfiletypes->setEnabled(!on); } +void KlamavConfigDialog::slotToggleKlamOnAcc(bool on) +{ + m_klamonacc->kcfg_ExtraScanning->setEnabled(on); + m_klamonacc->kcfg_OnAccessMaxFile->setEnabled(on); +// m_klamonacc->kcfg_ExcludeConfDir->setEnabled(on); + m_klamonacc->GroupWatchDirs->setEnabled(on); +} + +void KlamavConfigDialog::slotToggleKlamOnAccCheckbox() +{ + m_klamonacc->kcfg_EnableOnAccess->setChecked( tdemain->klamonacc->isEnabled() ); +} + /** Show page by object name */ void KlamavConfigDialog::showPage( const TQCString& page ) { @@ -116,6 +138,22 @@ void KlamavConfigDialog::addPage( TQWidget *page, const TQString &itemName, cons TDEConfigDialog::addPage( page, itemName, pixmapName, header, manage ); } +void KlamavConfigDialog::applySettings() { + // Some precautions + // if(! m_klamonacc->kcfg_ExcludeConfDir->isOn() ) + // KMessageBox::information(this, i18n("You have chosen not to exclude the TDE configuration directory from the on-access scanner's watchlist. Be warned that watching this directory can severely impact your computer's performance and cause instability."), i18n("Warning!") ); + + // Toggle/restart Klamonacc + bool oldState = tdemain->klamonacc->isEnabled(); + bool newState = m_klamonacc->kcfg_EnableOnAccess->isOn(); + + if( oldState != newState ) // If Klamonacc's state changed + tdemain->klamonacc->toggle( newState ); + else if( newState && m_klamonacc->needsRestart() ) { // If KlamOnAcc's settings were changed + tdemain->klamonacc->restart(); + m_klamonacc->slotSettingsApplied(); + } +} |