From 8c20dc919f7d54eb48fb60f39ba5e1d466a70763 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Wed, 13 Jan 2021 19:26:24 +0200 Subject: Initial commit Signed-off-by: Mavridis Philippe --- src/klamscanoptions.cpp | 442 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 442 insertions(+) create mode 100644 src/klamscanoptions.cpp (limited to 'src/klamscanoptions.cpp') diff --git a/src/klamscanoptions.cpp b/src/klamscanoptions.cpp new file mode 100644 index 0000000..73e99ac --- /dev/null +++ b/src/klamscanoptions.cpp @@ -0,0 +1,442 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'clamscan.ui' +** +** Created: Sun Mar 13 19:55:35 2005 +** by: The User Interface Compiler ($Id: klamscanoptions.cpp,v 1.1.1.1 2006/02/03 20:35:03 hoganrobert Exp $) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#include "klamscanoptions.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KlamscanOptions as a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KlamscanOptions::KlamscanOptions( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KlamscanOptions" ); + + Archive_Support = new QGroupBox( this, "Archive_Support" ); + Archive_Support->setGeometry( QRect( 20, 10, 551, 130 ) ); + + textLabel1_2_2 = new QLabel( Archive_Support, "textLabel1_2_2" ); + textLabel1_2_2->setGeometry( QRect( 13, 52, 222, 21 ) ); + + textLabel1_2 = new QLabel( Archive_Support, "textLabel1_2" ); + textLabel1_2->setGeometry( QRect( 314, 19, 222, 21 ) ); + + textLabel1_2_3 = new QLabel( Archive_Support, "textLabel1_2_3" ); + textLabel1_2_3->setGeometry( QRect( 314, 51, 222, 21 ) ); + + textLabel1 = new QLabel( Archive_Support, "textLabel1" ); + textLabel1->setGeometry( QRect( 13, 20, 222, 21 ) ); + + NoFilesToExtract = new QSpinBox(1,999,1, Archive_Support, "NoFilesToExtract" ); + NoFilesToExtract->setGeometry( QRect( 240, 20, 40, 21 ) ); + + MBsToExtract = new QSpinBox(1,999,1, Archive_Support, "MBsToExtract" ); + MBsToExtract->setGeometry( QRect( 474, 19, 40, 21 ) ); + + RecursionLevel = new QSpinBox(1,999,1, Archive_Support, "RecursionLevel" ); + RecursionLevel->setGeometry( QRect( 241, 51, 40, 21 ) ); + + CompressionRatio = new QSpinBox(1,999,1, Archive_Support, "CompressionRatio" ); + CompressionRatio->setGeometry( QRect( 474, 51, 40, 21 ) ); + + VirusLimitsExceeded = new QCheckBox( Archive_Support, "VirusLimitsExceeded" ); + VirusLimitsExceeded->setGeometry( QRect( 11, 81, 220, 20 ) ); + VirusLimitsExceeded->setPaletteForegroundColor( QColor( 255, 0, 0 ) ); + + VirusEncrypted = new QCheckBox( Archive_Support, "VirusEncrypted" ); + VirusEncrypted->setGeometry( QRect( 318, 82, 220, 20 ) ); + VirusEncrypted->setPaletteForegroundColor( QColor( 255, 0, 0 ) ); + + ArchiveTypes = new QButtonGroup( this, "ArchiveTypes" ); + ArchiveTypes->setGeometry( QRect( 20, 150, 551, 320 ) ); + + ScanZip = new QCheckBox( ArchiveTypes, "ScanZip" ); + ScanZip->setGeometry( QRect( 20, 30, 150, 21 ) ); + + KComboBox* zipUrl = new KComboBox(true, this); + ZipUsing = new KURLRequester( zipUrl,ArchiveTypes, "ZipUsing" ); + ZipUsing->setGeometry( QRect( 178, 29, 340, 26 ) ); + + ScanRar = new QCheckBox( ArchiveTypes, "ScanRar" ); + ScanRar->setGeometry( QRect( 20, 60, 150, 21 ) ); + + KComboBox* rarUrl = new KComboBox(true, this); + RarUsing = new KURLRequester( rarUrl, ArchiveTypes, "RarUsing" ); + RarUsing->setGeometry( QRect( 178, 59, 340, 26 ) ); + + ScanArj = new QCheckBox( ArchiveTypes, "ScanArj" ); + ScanArj->setGeometry( QRect( 20, 90, 150, 21 ) ); + + KComboBox* arjUrl = new KComboBox(true, this); + ArjUsing = new KURLRequester( arjUrl,ArchiveTypes, "ArjUsing" ); + ArjUsing->setGeometry( QRect( 178, 89, 340, 26 ) ); + + ScanZoo = new QCheckBox( ArchiveTypes, "ScanZoo" ); + ScanZoo->setGeometry( QRect( 20, 120, 150, 21 ) ); + + KComboBox* zooUrl = new KComboBox(true, this); + ZooUsing = new KURLRequester( zooUrl,ArchiveTypes, "ZooUsing" ); + ZooUsing->setGeometry( QRect( 178, 119, 340, 26 ) ); + + + ScanLzh = new QCheckBox( ArchiveTypes, "ScanLzh" ); + ScanLzh->setGeometry( QRect( 20, 150, 150, 21 ) ); + + KComboBox* lzhUrl = new KComboBox(true, this); + LzhUsing = new KURLRequester( lzhUrl,ArchiveTypes, "LzhUsing" ); + LzhUsing->setGeometry( QRect( 178, 149, 340, 26 ) ); + + ScanJar = new QCheckBox( ArchiveTypes, "ScanJar" ); + ScanJar->setGeometry( QRect( 20, 180, 150, 21 ) ); + + KComboBox* jarUrl = new KComboBox(true, this); + JarUsing = new KURLRequester( jarUrl,ArchiveTypes, "JarUsing" ); + JarUsing->setGeometry( QRect( 178, 179, 340, 26 ) ); + + ScanDeb = new QCheckBox( ArchiveTypes, "ScanDeb" ); + ScanDeb->setGeometry( QRect( 20, 210, 150, 21 ) ); + + KComboBox* debUrl = new KComboBox(true, this); + DebUsing = new KURLRequester( debUrl,ArchiveTypes, "DebUsing" ); + DebUsing->setGeometry( QRect( 178, 209, 340, 26 ) ); + + ScanTar = new QCheckBox( ArchiveTypes, "ScanTar" ); + ScanTar->setGeometry( QRect( 20, 240, 150, 21 ) ); + + KComboBox* tarUrl = new KComboBox(true, this); + TarUsing = new KURLRequester( tarUrl,ArchiveTypes, "TarUsing" ); + TarUsing->setGeometry( QRect( 178, 239, 340, 26 ) ); + + ScanTgz = new QCheckBox( ArchiveTypes, "ScanTgz" ); + ScanTgz->setGeometry( QRect( 20, 270, 150, 21 ) ); + + KComboBox* tgzUrl = new KComboBox(true, this); + TgzUsing = new KURLRequester( tgzUrl,ArchiveTypes, "TgzUsing" ); + TgzUsing->setGeometry( QRect( 178, 269, 340, 26 ) ); + + FileTypes = new QGroupBox( this, "FileTypes" ); + FileTypes->setGeometry( QRect( 20, 490, 551, 120 ) ); + + ScanMail = new QCheckBox( FileTypes, "ScanMail" ); + ScanMail->setGeometry( QRect( 20, 20, 200, 21 ) ); + + ScanHTML = new QCheckBox( FileTypes, "ScanHTML" ); + ScanHTML->setGeometry( QRect( 270, 20, 200, 21 ) ); + + ScanPE = new QCheckBox( FileTypes, "ScanPE" ); + ScanPE->setGeometry( QRect( 20, 50, 220, 21 ) ); + + ScanOle = new QCheckBox( FileTypes, "ScanOle" ); + ScanOle->setGeometry( QRect( 270, 50, 270, 21 ) ); + ScanOle->setChecked( FALSE ); + + VirusBroken = new QCheckBox( FileTypes, "VirusBroken" ); + VirusBroken->setGeometry( QRect( 20, 80, 240, 20 ) ); + VirusBroken->setPaletteForegroundColor( QColor( 255, 0, 0 ) ); + + ExcludeQuarantine = new QCheckBox( FileTypes, "ExcludeQuarantine" ); + ExcludeQuarantine->setGeometry( QRect( 270, 80, 270, 21 ) ); + ExcludeQuarantine->setChecked( FALSE ); + + OK = new QPushButton( this, i18n( "OK" ) ); + OK->setGeometry( QRect( 190, 626, 91, 31 ) ); + OK->setDefault( TRUE ); + + connect( OK, SIGNAL(clicked()), + SLOT(updateSettings()) ); + + Cancel = new QPushButton( this, i18n( "Cancel" ) ); + Cancel->setGeometry( QRect( 300, 626, 91, 31 ) ); + connect( Cancel, SIGNAL(clicked()), + SLOT(close()) ); + + languageChange(); + resize( QSize(589, 667).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); + fetchSettings(); + +} + +/* + * Destroys the object and frees any allocated resources + */ +KlamscanOptions::~KlamscanOptions() +{ + // no need to delete child widgets, Qt does it all for us +} + +/* + * Sets the strings of the subwidgets using the current + * language. + */ +void KlamscanOptions::languageChange() +{ + setCaption( tr( "Scanning Options" ) ); + Archive_Support->setTitle( tr( "Archive Limits" ) ); + textLabel1_2_2->setText( i18n( "Maximum Level of Recursion" ) ); + textLabel1_2->setText( i18n( "MBs to Extract:" ) ); + textLabel1_2_3->setText( i18n( "Compression Ratio" ) ); + textLabel1->setText( i18n( "Number of Files to Extract:" ) ); + VirusLimitsExceeded->setText( i18n( "Mark as Virus if Limits Exceeded" ) ); + VirusEncrypted->setText( i18n( "Mark as Virus if Encrypted" ) ); + ArchiveTypes->setTitle( i18n( "Archive Types" ) ); + ScanZip->setText( i18n( "Scan Zip Files using" ) ); + ScanRar->setText( i18n( "Scan RAR Files using" ) ); + ScanArj->setText( i18n( "Scan ARJ Files using" ) ); + ScanZoo->setText( i18n( "Scan ZOO Files using" ) ); + ScanLzh->setText( i18n( "Scan LZH Files using" ) ); + ScanJar->setText( i18n( "Scan JAR Files using" ) ); + ScanDeb->setText( i18n( "Scan DEB Files using" ) ); + ScanTar->setText( i18n( "Scan TAR Files using" ) ); + ScanTgz->setText( i18n( "Scan TGZ Files using" ) ); + FileTypes->setTitle( i18n( "Special File Types" ) ); + ScanMail->setText( i18n( "Scan Files Containing Email(s)" ) ); + ScanHTML->setText( i18n( "Scan HTML Files for Exploits" ) ); + ScanPE->setText( i18n( "Scan 'Portable Executable' Files" ) ); + ScanOle->setText( i18n( "Scan the Macros in Microsoft Office Files" ) ); + VirusBroken->setText( i18n( "Treat a Broken Executable as Virus" ) ); + ExcludeQuarantine->setText( i18n( "Exclude Quarantine Directory" ) ); + OK->setText( i18n( "OK" ) ); + Cancel->setText( i18n( "Cancel" ) ); +} + +void KlamscanOptions::updateSettings() +{ + KConfig* config = KGlobal::config(); + config->setGroup("Klamscan"); + + config->writeEntry("NoFilesToExtract", NoFilesToExtract->text()); + config->writeEntry("MBsToExtract", MBsToExtract->text()+"M"); + config->writeEntry("RecursionLevel", RecursionLevel->text()); + config->writeEntry("CompressionRatio", CompressionRatio->text()); + + if (VirusLimitsExceeded->isChecked()) + config->writeEntry("VirusLimitsExceeded", "Yes"); + else + config->writeEntry("VirusLimitsExceeded", "No"); + + if (VirusEncrypted->isChecked()) + config->writeEntry("VirusEncrypted", "Yes"); + else + config->writeEntry("VirusEncrypted", "No"); + + if (ScanMail->isChecked()) + config->writeEntry("ScanMail", "Yes"); + else + config->writeEntry("ScanMail", "No"); + + if (ScanHTML->isChecked()) + config->writeEntry("ScanHTML", "Yes"); + else + config->writeEntry("ScanHTML", "No"); + + if (ScanPE->isChecked()) + config->writeEntry("ScanPE", "Yes"); + else + config->writeEntry("ScanPE", "No"); + + if (ScanOle->isChecked()) + config->writeEntry("ScanOle", "Yes"); + else + config->writeEntry("ScanOle", "No"); + + if (VirusBroken->isChecked()) + config->writeEntry("VirusBroken", "Yes"); + else + config->writeEntry("VirusBroken", "No"); + + if (ExcludeQuarantine->isChecked()) + config->writeEntry("ExcludeQuarantine", "Yes"); + else + config->writeEntry("ExcludeQuarantine", "No"); + + + if (ScanZip->isChecked()){ + config->writeEntry("ScanZip", "Yes"); + config->writeEntry("ZipUsing", ZipUsing->url()); + }else + config->writeEntry("ScanZip", "No"); + + if (ScanRar->isChecked()){ + config->writeEntry("ScanRar", "Yes"); + config->writeEntry("RarUsing", RarUsing->url()); + }else + config->writeEntry("ScanRar", "No"); + + if (ScanArj->isChecked()){ + config->writeEntry("ScanArj", "Yes"); + config->writeEntry("ArjUsing", ArjUsing->url()); + }else + config->writeEntry("ScanArj", "No"); + + if (ScanZoo->isChecked()){ + config->writeEntry("ScanZoo", "Yes"); + config->writeEntry("ZooUsing", ZooUsing->url()); + }else + config->writeEntry("ScanZoo", "No"); + + if (ScanLzh->isChecked()){ + config->writeEntry("ScanLzh", "Yes"); + config->writeEntry("LzhUsing", LzhUsing->url()); + }else + config->writeEntry("ScanLzh", "No"); + + if (ScanJar->isChecked()){ + config->writeEntry("ScanJar", "Yes"); + config->writeEntry("JarUsing", JarUsing->url()); + }else + config->writeEntry("ScanJar", "No"); + + if (ScanDeb->isChecked()){ + config->writeEntry("ScanDeb", "Yes"); + config->writeEntry("DebUsing", DebUsing->url()); + }else + config->writeEntry("ScanDeb", "No"); + + if (ScanTar->isChecked()){ + config->writeEntry("ScanTar", "Yes"); + config->writeEntry("TarUsing", TarUsing->url()); + }else + config->writeEntry("ScanTar", "No"); + + if (ScanTgz->isChecked()){ + config->writeEntry("ScanTgz", "Yes"); + config->writeEntry("TgzUsing", TgzUsing->url()); + }else + config->writeEntry("ScanTgz", "No"); + + + //kdDebug() << ZipUsing->url() << endl; + config->sync(); + close(); +} + +void KlamscanOptions::fetchSettings() +{ + config = KGlobal::config(); + config->setGroup("Klamscan"); + + + NoFilesToExtract->setValue(QString(config->readEntry("NoFilesToExtract")).toInt()); + MBsToExtract->setValue(QString(config->readEntry("MBsToExtract")).replace("M","").toInt()); + CompressionRatio->setValue(QString(config->readEntry("CompressionRatio")).toInt()); + RecursionLevel->setValue(QString(config->readEntry("RecursionLevel")).toInt()); + + if (config->readEntry("VirusLimitsExceeded") == "Yes") + VirusLimitsExceeded->setChecked(true); + else + VirusLimitsExceeded->setChecked(false); + + if (config->readEntry("VirusEncrypted") == "Yes") + VirusEncrypted->setChecked(true); + else + VirusEncrypted->setChecked(false); + + if (config->readEntry("ScanMail") == "Yes") + ScanMail->setChecked(true); + else + ScanMail->setChecked(false); + + if (config->readEntry("ScanHTML") == "Yes") + ScanHTML->setChecked(true); + else + ScanHTML->setChecked(false); + + if (config->readEntry("ScanPE") == "Yes") + ScanPE->setChecked(true); + else + ScanPE->setChecked(false); + + if (config->readEntry("ScanOle") == "Yes") + ScanOle->setChecked(true); + else + ScanOle->setChecked(false); + + if (config->readEntry("VirusBroken") == "Yes") + VirusBroken->setChecked(true); + else + VirusBroken->setChecked(false); + + if (config->readEntry("ExcludeQuarantine") == "Yes") + ExcludeQuarantine->setChecked(true); + else + ExcludeQuarantine->setChecked(false); + + + + if (config->readEntry("ScanZip") == "Yes"){ + ScanZip->setChecked(true); + ZipUsing->setURL(config->readEntry("ZipUsing")); + }else + ScanZip->setChecked(false); + + if (config->readEntry("ScanRar") == "Yes"){ + ScanRar->setChecked(true); + RarUsing->setURL(config->readEntry("RarUsing")); + }else + ScanRar->setChecked(false); + + if (config->readEntry("ScanArj") == "Yes"){ + ScanArj->setChecked(true); + ArjUsing->setURL(config->readEntry("ArjUsing")); + }else + ScanArj->setChecked(false); + + if (config->readEntry("ScanZoo") == "Yes"){ + ScanZoo->setChecked(true); + ZooUsing->setURL(config->readEntry("ZooUsing")); + }else + ScanZoo->setChecked(false); + + if (config->readEntry("ScanLzh") == "Yes"){ + ScanLzh->setChecked(true); + LzhUsing->setURL(config->readEntry("LzhUsing")); + }else + ScanLzh->setChecked(false); + + if (config->readEntry("ScanJar") == "Yes"){ + ScanJar->setChecked(true); + JarUsing->setURL(config->readEntry("JarUsing")); + }else + ScanJar->setChecked(false); + + if (config->readEntry("ScanDeb") == "Yes"){ + ScanDeb->setChecked(true); + DebUsing->setURL(config->readEntry("DebUsing")); + }else + ScanDeb->setChecked(false); + + if (config->readEntry("ScanTar") == "Yes"){ + ScanTar->setChecked(true); + TarUsing->setURL(config->readEntry("TarUsing")); + }else + ScanTar->setChecked(false); + + if (config->readEntry("ScanTgz") == "Yes"){ + ScanTgz->setChecked(true); + TgzUsing->setURL(config->readEntry("TgzUsing")); + }else + ScanTgz->setChecked(false); + +} + +#include "klamscanoptions.moc" -- cgit v1.2.1