diff options
author | Mavridis Philippe <[email protected]> | 2021-01-14 14:08:07 +0200 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2021-01-14 14:08:07 +0200 |
commit | 71fe8d5be5cd4147b20aaba775e9573ebcf85860 (patch) | |
tree | d9c245e5b6721599d1bf2de96949fb7c66701a9d /src | |
parent | 75f04527489372ae40c94e690013e0c84b0a7ca5 (diff) | |
download | klamav-71fe8d5be5cd4147b20aaba775e9573ebcf85860.tar.gz klamav-71fe8d5be5cd4147b20aaba775e9573ebcf85860.zip |
Removed Klamd and Dazuko/Clamuko/Klamd-related code.
Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/freshklam.cpp | 21 | ||||
-rw-r--r-- | src/klamav.cpp | 57 | ||||
-rw-r--r-- | src/klamav.h | 7 | ||||
-rw-r--r-- | src/klamd.cpp | 960 | ||||
-rw-r--r-- | src/klamd.h | 196 | ||||
-rw-r--r-- | src/klamdoptions.cpp | 245 | ||||
-rw-r--r-- | src/klamdoptions.h | 67 | ||||
-rw-r--r-- | src/klamscan.cpp | 11 | ||||
-rw-r--r-- | src/scanviewer.cpp | 13 |
10 files changed, 10 insertions, 1570 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 74acebf..eb5358e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,8 +23,7 @@ klamav_LDADD = $(LIB_TQT) $(LIB_TDECORE) -lDCOP $(LIB_TDEIO) $(LIB_TDEUI) $(LI # which sources should be compiled for klamav klamav_SOURCES = main.cpp klamav.cpp freshklam.cpp sigtool.cpp klamscan.cpp \ - klamd.cpp kuarantine.cpp \ - aboutklamav.cpp dbviewer.cpp \ + kuarantine.cpp aboutklamav.cpp dbviewer.cpp \ frame.cpp tabwidget.cpp viewer.cpp pageviewer.cpp klamav_run.cpp dcopklamscan.skel \ directorylist.cpp scanviewer.cpp schedule.cpp datepicker.cpp cthost.cpp \ ctcron.cpp ctmonth.cpp ctdom.cpp ctdow.cpp cttask.cpp ctvariable.cpp \ diff --git a/src/freshklam.cpp b/src/freshklam.cpp index 7f279e2..a00db74 100644 --- a/src/freshklam.cpp +++ b/src/freshklam.cpp @@ -5,7 +5,6 @@ #include "freshklam.h" #include "klamav.h" -#include "klamd.h" #include "collectiondb.h" /*#include "gmanedb.h"*/ #include "klamavconfig.h" @@ -362,17 +361,7 @@ void Freshklam::slotSearch() command += pidFileName; freshklamAlive = TRUE; } - - if (!(TDEApplication::kApplication()->isRestored())){ - if (tdemain->klamd->isKlamdAlive()){ - TQString klamdconf = tdemain->klamd->getKlamdConfFile(); - ////kdDebug() << klamdconf << endl; - command += " --daemon-notify="; - command += klamdconf; - } - } - writeConf(); command += " --config-file="; command += tempFileName; @@ -391,11 +380,6 @@ void Freshklam::slotSearch() connect( childproc, SIGNAL(receivedStdout(TDEProcess *, char *, int)), SLOT(receivedOutput(TDEProcess *, char *, int)) ); -// if (tdemain->klamd->isKlamdAlive()) -// tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamavdl")); -// else -// tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamavbwdl")); - tdemain->EnableFreshklam->setEnabled(FALSE); tdemain->DisableFreshklam->setEnabled(TRUE); @@ -407,10 +391,7 @@ void Freshklam::finish() cancel_button->setEnabled(false); enableInputs(); - if (tdemain->klamd->isKlamdAlive()) - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_enabled")); - else - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); + tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); buf += '\n'; processOutput(); diff --git a/src/klamav.cpp b/src/klamav.cpp index b104c21..3edb449 100644 --- a/src/klamav.cpp +++ b/src/klamav.cpp @@ -4,7 +4,6 @@ #include "klamav.h" #include "freshklam.h" -#include "klamd.h" #include "sigtool.h" #include "klamscan.h" #include "kuarantine.h" @@ -51,24 +50,18 @@ Klamav::Klamav() connect(_tray,SIGNAL(quitSelected()),SLOT(shuttingDown())); TDEPopupMenu *conf_menu = _tray->contextMenu(); - EnableKlamd = new TDEAction(i18n("&Enable Auto-Scan"), "klamav_on_acc_enabled", 0,this, SLOT(contextEnable()),actionCollection(),"klamd_enable"); - DisableKlamd = new TDEAction(i18n("&Disable Auto-Scan"),"klamav_on_acc_disabled", 0,this, SLOT(contextDisable()),actionCollection(),"klamd_disable"); EnableFreshklam = new TDEAction(i18n("&Enable Auto-Updates"), "klamav", 0,this, SLOT(contextEnableFK()),actionCollection(),"fk_enable"); DisableFreshklam = new TDEAction(i18n("&Disable Auto-Updates"),"klamavbw", 0,this, SLOT(contextDisableFK()),actionCollection(),"fk_disable"); EnableFreshklam->plug(conf_menu); DisableFreshklam->plug(conf_menu); - EnableKlamd->plug(conf_menu); - DisableKlamd->plug(conf_menu); TQToolTip::add( _tray, i18n( "KlamAV - Virus Protection for KDE" ) ); _tray->show(); DisableFreshklam->setEnabled(FALSE); EnableFreshklam->setEnabled(TRUE); - DisableKlamd->setEnabled(FALSE); - EnableKlamd->setEnabled(TRUE); TDEConfig* config = TDEGlobal::config(); config->setGroup("Freshklam"); @@ -87,13 +80,6 @@ Klamav::Klamav() klamscan = new Klamscan(this); tab->addTab(klamscan, i18n("&Scan")); - klamd = new Klamd(this); - tab->addTab(klamd, i18n("&Auto-Scan")); - - connect(klamd->search_button,SIGNAL(clicked()),SLOT(contextEnable())); - connect(klamd->cancel_button,SIGNAL(clicked()),SLOT(contextDisable())); - - freshklam = new Freshklam(this); tab->addTab(freshklam, i18n("&Update")); @@ -126,17 +112,6 @@ Klamav::Klamav() KStdAction::quit(this, SLOT(shuttingDown()), actionCollection()); if (TDEApplication::kApplication()->isRestored()){ -/* config = TDEGlobal::config(); - config->setGroup("Klamd"); - TQString RunKlamd = config->readEntry("Enabled"); - - if (RunKlamd == "Yes"){ - _tray->setPixmap(KSystemTray::loadIcon("klamav")); - DisableKlamd->setEnabled(TRUE); - EnableKlamd->setEnabled(FALSE); - - } -*/ hide(); }else{ show(); @@ -169,10 +144,10 @@ void Klamav::shuttingDown(){ } bool Klamav::queryClose() { - if ((klamd->isKlamdAlive()) || (freshklam->isFreshklamAlive())){ + if ( freshklam->isFreshklamAlive() ){ KMessageBox::information (this,i18n("<p>KlamAV will stay open in the system tray. <br><br>" - " <b>Remember</b> - you can't close KlamAV while <br> auto-scanning " - " and/or auto-updating are still running!</p>"),"KlamAV","dontshow"); + " <b>Remember</b> - you can't close KlamAV while <br> " + " auto-updating is still running!</p>"),"KlamAV","dontshow"); hide(); return false; @@ -181,37 +156,11 @@ bool Klamav::queryClose() { } -void Klamav::contextEnable() { - - klamd->startKlamd(); - //if (klamd->startKlamd()){ - //_tray->setPixmap(KSystemTray::loadIcon("klamav")); - //EnableKlamd->setEnabled(FALSE); - //DisableKlamd->setEnabled(TRUE); - //} -} - void Klamav::clamdStopped() { /* if (freshklam->isFreshklamAlive()) _tray->setPixmap(KSystemTray::loadIcon("klamavbwdl")); else*/ _tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); - DisableKlamd->setEnabled(FALSE); - EnableKlamd->setEnabled(TRUE); -} - -void Klamav::contextDisable() { - klamd->slotCancel(); - resetAutoScan(); -} - -void Klamav::resetAutoScan() { -/* if (freshklam->isFreshklamAlive()) - _tray->setPixmap(KSystemTray::loadIcon("klamavbwdl")); - else*/ - _tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); - DisableKlamd->setEnabled(FALSE); - EnableKlamd->setEnabled(TRUE); } diff --git a/src/klamav.h b/src/klamav.h index 464ad1e..04067fb 100644 --- a/src/klamav.h +++ b/src/klamav.h @@ -30,7 +30,6 @@ class KURLRequester; class Freshklam; class Sigtool; class Klamscan; -class Klamd; class KlamavDock; class Kuarantine; class Activityviewer; @@ -67,11 +66,8 @@ public: KlamavDock *m_dock; KSystemTray *_tray; - TDEAction *EnableKlamd; - TDEAction *DisableKlamd; TDEAction *EnableFreshklam; TDEAction *DisableFreshklam; - Klamd *klamd; Freshklam *freshklam; bool firstDownload; bool downloadDBForWizard; @@ -80,7 +76,6 @@ public: Klamscan *klamscan; Activityviewer *activityviewer; void showVirusBrowser(); - void resetAutoScan(); TQTabWidget *tab; @@ -108,11 +103,9 @@ protected: //void readProperties(TDEConfig *); public slots: - void contextDisable(); void clamdStopped(); void slotConfigKlamav( const TQCString& page ); private slots: - void contextEnable(); void contextEnableFK(); void contextUpdateFK(); void contextDisableFK(); diff --git a/src/klamd.cpp b/src/klamd.cpp deleted file mode 100644 index e6d6859..0000000 --- a/src/klamd.cpp +++ /dev/null @@ -1,960 +0,0 @@ -/* - * Copyright (C) 2004 Robert Hogan <robert at roberthogan dot net> - */ - -#include "klamd.h" -#include "klamav.h" -#include "freshklam.h" -#include "klamavconfig.h" -#include "collectiondb.h" - - - -#include <tdelocale.h> -#include <kiconloader.h> -#include <tdeio/netaccess.h> -#include <karrowbutton.h> - - -#include <tdeaction.h> - -#include <tqcheckbox.h> -#include <kbuttonbox.h> -#include <kprocio.h> -#include <kurlrequester.h> -#include <tqlayout.h> -#include <tdemessagebox.h> -#include <tdetempfile.h> -#include <ksystemtray.h> -#include <tqtoolbutton.h> -#include <knotifyclient.h> - - -const char *check_desc1[] = { - "1", - "2", - "3", - "4", - "5", - 0 -}; - -const char *check_desc2[] = { - "On Access", - "On Execute", - 0 -}; - - -Klamd::Klamd(TQWidget *_parent, const char *name) - : TQWidget(_parent, name) -{ - - parent = _parent; - - klamdAlive = FALSE; - - - //Data Directory Widget - - //TQString dt = TQDateTime::currentDateTime().toString(); - //KMessageBox::information (this,dt); - - TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialog::marginHint(), - KDialog::spacingHint(), "vbox"); - - TQGroupBox *group = new TQGroupBox(i18n("Include Directories"), this); - vbox->addWidget(group); - - TQGridLayout *layout = new TQGridLayout( group, 9, 3, KDialog::spacingHint(), - KDialog::spacingHint(), "layout"); - layout->addRowSpacing(0, group->fontMetrics().height()); - layout->setColStretch(0, 1); - layout->setColStretch(1, 1); - - hlp = new TQWidget( group ); - layout->addMultiCellWidget(hlp, 1,1, 0,2); - TQHBoxLayout *dir_layout = new TQHBoxLayout(hlp, KDialog::spacingHint() ); - - KURL root = KURL( "/" ); - m_fileTreeView = new KFileTreeView( hlp ); - m_fileTreeView->addColumn( i18n("Include") ); - treeBranch = m_fileTreeView->addBranch( root, i18n("Root"), SmallIcon("folder_red") ); - m_fileTreeView->setDirOnlyMode( treeBranch, true ); - treeBranch->setShowingDotFiles( true ); - - - treeBranch->setOpen( true ); - - btnup = new KArrowButton(hlp, LeftArrow); - btnup->setFixedSize(20, 20); - connect(btnup, SIGNAL( clicked() ), SLOT( slotDelIncludeDir() )); - - btndown = new KArrowButton(hlp, RightArrow); - btndown->setEnabled(true); - btndown->setFixedSize(20, 20); - connect(btndown,SIGNAL( clicked() ), SLOT( slotAddIncludeDir())); - - - sessionslb = new MyListBox(hlp); - - config = TDEGlobal::config(); - config->setGroup("Klamd"); - includePaths = config->readListEntry("IncludePaths"); - if (!(includePaths.isEmpty())) - btnup->setEnabled(true); - - sessionslb->insertStringList(includePaths); - - - - dir_layout->addWidget(m_fileTreeView); - dir_layout->addWidget(btnup); - dir_layout->addWidget(btndown); - dir_layout->addWidget(sessionslb); - - TQGroupBox *group2 = new TQGroupBox(i18n("Exclude Directories"), this); - vbox->addWidget(group2); - - TQGridLayout *layout2 = new TQGridLayout( group2, 9, 3, KDialog::spacingHint(), - KDialog::spacingHint(), "layout2"); - layout2->addRowSpacing(0, group2->fontMetrics().height()); - layout2->setColStretch(0, 1); - layout2->setColStretch(1, 1); - - - hlp2 = new TQWidget( group2 ); - layout2->addMultiCellWidget(hlp2, 1,1, 0,2); - TQHBoxLayout *dir_layout2 = new TQHBoxLayout(hlp2, KDialog::spacingHint() ); - - KURL root2 = KURL( "/" ); - m_fileTreeView2 = new KFileTreeView( hlp2 ); - m_fileTreeView2->addColumn( i18n("Exclude") ); - treeBranch2 = m_fileTreeView2->addBranch( root2, i18n("Root"), SmallIcon("folder_red") ); - m_fileTreeView2->setDirOnlyMode( treeBranch2, true ); - treeBranch2->setShowingDotFiles( true ); - treeBranch2->setOpen( true ); - - btnup2 = new KArrowButton(hlp2, LeftArrow); - btnup2->setFixedSize(20, 20); - connect(btnup2, SIGNAL( clicked() ), SLOT( slotDelExcludeDir() )); - - btndown2 = new KArrowButton(hlp2, RightArrow); - btndown2->setEnabled(true); - btndown2->setFixedSize(20, 20); - connect(btndown2,SIGNAL( clicked() ), SLOT( slotAddExcludeDir())); - - - sessionslb2 = new MyListBox(hlp2); - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - excludePaths = config->readListEntry("ExcludePaths"); - if (!(excludePaths.isEmpty())) - btnup2->setEnabled(true); - - sessionslb2->insertStringList(excludePaths); - - - - dir_layout2->addWidget(m_fileTreeView2); - dir_layout2->addWidget(btnup2); - dir_layout2->addWidget(btndown2); - dir_layout2->addWidget(sessionslb2); - - TQGroupBox *group3 = new TQGroupBox(i18n("Options"), this); - vbox->addWidget(group3); - - TQGridLayout *layout3 = new TQGridLayout( group3, 9, 10, KDialog::spacingHint(), - KDialog::spacingHint(), "layout3"); - layout3->addRowSpacing(0, group3->fontMetrics().height()); - //layout3->setColStretch(0, 1); - //layout3->setColStretch(1, 1); - - - hlp3 = new TQWidget( group3 ); - layout3->addMultiCellWidget(hlp3, 1,1, 0,10); - TQHBoxLayout *dir_layout3 = new TQHBoxLayout(hlp3, KDialog::spacingHint() ); - - recursive_box = new TQCheckBox(i18n("&Quarantine"), hlp3); - //recursive_box->setMinimumWidth(recursive_box->sizeHint().width()); - - if ((config->readEntry("Quarantine")) == "Yes") - recursive_box->setChecked(true); - - connect( recursive_box, SIGNAL(toggled(bool)), - SLOT(handleChecks()) ); - - //dir_layout3->addSpacing(10); - dir_layout3->addWidget(recursive_box); - - recursive_box1 = new TQCheckBox(i18n("&Display Warnings"), hlp3); - //recursive_box1->setMinimumWidth(recursive_box1->sizeHint().width()); - - if ((config->readEntry("Warn")) == "Yes") - recursive_box1->setChecked(true); - - connect( recursive_box1, SIGNAL(toggled(bool)), - SLOT(handleChecks()) ); - - //dir_layout3->addSpacing(10); - dir_layout3->addWidget(recursive_box1); - - recursive_box2 = new TQCheckBox(i18n("&Run Docked"), hlp3); - //recursive_box2->setMinimumWidth(recursive_box2->sizeHint().width()); - - if ((config->readEntry("Run Docked")) == "Yes") - recursive_box2->setChecked(true); - - connect( recursive_box2, SIGNAL(toggled(bool)), - SLOT(handleChecks()) ); - - dir_layout3->addWidget(recursive_box2); - dir_layout3->addSpacing(40); - - TQLabel *combo_label = new TQLabel(i18n("Max File Size (MBs):"), hlp3); - //combo_label->setFixedSize(combo_label->sizeHint()); - dir_layout3->addWidget(combo_label); - - check_combo = new TQComboBox(false, hlp3); - check_combo->insertStrList(check_desc1); - check_combo->adjustSize(); - //check_combo->setFixedSize(check_combo->size()); - dir_layout3->addWidget(check_combo); - - dir_layout3->addSpacing(20); - - - TQToolButton* adv_options = new TQToolButton( hlp3,"play" ); - adv_options->setIconSet( SmallIconSet( "configure" ) ); - adv_options->setTextLabel("Options"); - adv_options->setTextPosition(TQToolButton::Right); - adv_options->setUsesTextLabel(true); - -// adv_options = new TQPushButton ("Advanced", hlp3); - dir_layout3->addWidget(adv_options); - //adv_options->setFixedSize(adv_options->sizeHint()); - - connect( adv_options, SIGNAL(clicked()), - SLOT(slotAdvOptions()) ); - -/* TQLabel *combo_label2 = new TQLabel(i18n("Scan:"), hlp3); - combo_label2->setFixedSize(combo_label2->sizeHint()); - dir_layout3->addWidget(combo_label2); - - - check_combo2 = new TQComboBox(false, hlp3); - check_combo2->insertStrList(check_desc2); - check_combo2->adjustSize(); - check_combo2->setFixedSize(check_combo2->size()); - dir_layout3->addWidget(check_combo2); - - TQToolTip::add( check_combo2, "'On Access' scans every file accessed. 'On Execute' only scans files/programs that your system tries to execute." );*/ - - KButtonBox *actionbox = new KButtonBox(this, TQt::Horizontal); - vbox->addWidget(actionbox, 2, 0); - actionbox->addStretch(); - search_button = actionbox->addButton(i18n("&Enable Auto-Scan")); - search_button->setDefault(true); - cancel_button = actionbox->addButton(i18n("&Disable Auto-Scan")); - cancel_button->setEnabled(false); - actionbox->addStretch(); - actionbox->layout(); - -/* - connect( search_button, SIGNAL(clicked()), - SLOT(startKlamd()) ); - connect( cancel_button, SIGNAL(clicked()), - SLOT(slotCancel()) ); -*/ - if (TDEApplication::kApplication()->isRestored()) - restoreKlamd(); - -// KStdAction::quit(this, SLOT(hide()), actionCollection()); - -} - -Klamd::~Klamd() -{ - - if (klamdAlive){ - delete childproc; - childproc = 0; - - } - if (!(tempFileName.isEmpty())) - TDEIO::NetAccess::del(tempFileName,NULL); - -} - - -void Klamd::processOutput() -{ - - if(!childproc) - return; - - item2 = ""; - int pos; - if ((pos = (childproc->readln(item2))) != -1) { - //kdDebug() << item2 << endl; - if ((pos = (item2.find(" FOUND"))) != -1){ - item2 = item2.stripWhiteSpace(); - int fnameStartPoint = (item2.find(":") + 1); - int fnameEndPoint = item2.findRev(":"); - TQString tmpFName = item2.mid(fnameStartPoint,(fnameEndPoint - fnameStartPoint)); - TQString tmpVirusName = item2.mid((fnameEndPoint+1),(item2.length() - (fnameEndPoint+1))); - tmpVirusName.replace("FOUND",""); - CollectionDB::instance()->insertEvent("Virus Found",tmpVirusName,tmpFName); - if (recursive_box1->isChecked()) - KNotifyClient::event(tdemain->_tray->winId(),i18n( "ScanCompleteNoVirus" ), i18n( "Virus %1 Found In %2 by Auto-Scan!" ).arg(tmpVirusName).arg(tmpFName)); - if (recursive_box->isChecked()) - Quarantine(tmpFName.stripWhiteSpace(),tmpVirusName.stripWhiteSpace()); - } - if ((pos = (item2.find("ERROR: Clamuko: Can't register with Dazuko"))) != -1){ - finish(); - KMessageBox::information (this,i18n( "Can't Start On-Access Scanning! Check you have read permissions on file /dev/dazuko.") ); - KNotifyClient::event(tdemain->_tray->winId(),i18n( "Can't Start On-Access Scanning!" ), i18n( "Check you have read permissions on file /dev/dazuko." )); - return; - } - - - } - - - childproc->ackRead(); - - item2 = ""; - buf = ""; - - -} - - -bool Klamd::startKlamd() -{ - - config = TDEGlobal::config(); - config->setGroup("Klamd"); - if ((config->readListEntry("IncludePaths")).isEmpty()){ - KMessageBox::information (this,i18n("You haven't specified any paths to scan. Select the directories you want to KlamAV to keep an eye on and try again.")); - return FALSE; - } - - - if (recursive_box2->isChecked()){ - if (!(this->topLevelWidget()->isHidden())) - KMessageBox::information (this,i18n("I'm going into the background now. You can restore me by clicking on the icon in the system tray on the bottom right.")); - this->topLevelWidget()->hide(); - }/*else{ - this->topLevelWidget()->show(); - }*/ - - - if (runDazuko(true)) - return TRUE; - else - return FALSE; - //this->topLevelWidget()->hide(); -} - -void Klamd::finish() -{ - search_button->setEnabled(true); - cancel_button->setEnabled(false); - //config = TDEGlobal::config(); - if (!TDEApplication::kApplication()->closingDown()){ - config->setGroup("Klamd"); - config->writeEntry("Enabled", "No"); - } - tdemain->clamdStopped(); - - buf += '\n'; - if (childproc){ - processOutput(); - childproc->closeAll(); - childproc->kill(9); - delete childproc; - childproc = 0; - } - klamdAlive = FALSE; - enableInputs(); - if (!(tempFileName.isEmpty())) - TDEIO::NetAccess::del(tempFileName,NULL); - - -} - - -void Klamd::slotCancel() -{ - finish(); - - CollectionDB::instance()->insertEvent("Auto-Scan","Scanning Cancelled",""); - -} - - -void Klamd::childExited() -{ -// int status = childproc->exitStatus(); -// -// kdDebug() << "klamd status" << status << endl; - - tdemain->contextDisable(); - - KMessageBox::information (this,i18n( "The auto-scan process died unexpectedly!") ); - - //if (status != 0) - //matches_label->setText(""); - -} - - -void Klamd::receivedOutput(KProcIO *) -{ - //buf += TQCString(buffer, buflen+1); - processOutput(); -} - - -void Klamd::slotClear() -{ - finish(); - -} - - -void Klamd::setDirName(TQString dir){ -// dir_combo->setEditText(dir); - dir_combo->setURL(dir); -} - -void Klamd::slotAddIncludeDir() -{ - - KURL filepattern = m_fileTreeView->currentURL(); - TQString filepa = filepattern.path(); - if(filepa) - if ((includePaths.contains(filepa) == 0) && (excludePaths.contains(filepa) == 0)){ - sessionslb->insertItem(filepa); - - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - - if (includePaths.contains(filepa) == 0) { - includePaths.prepend(filepa); - }else{ - includePaths.remove(filepa); - includePaths.prepend(filepa); - } - config->writeEntry("IncludePaths", includePaths); - config->sync(); - - btnup->setEnabled(true); - } -} - -void Klamd::slotDelIncludeDir() -{ - - - while (includePaths.contains(sessionslb->currentText())) - { - includePaths.remove(sessionslb->currentText()); - } - - sessionslb->removeItem(sessionslb->currentItem()); - - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - config->writeEntry("IncludePaths", includePaths); - config->sync(); - - if ( sessionslb->count() == 0 ) - btnup->setEnabled(false); - - -} - - -void Klamd::slotAddExcludeDir() -{ -//KFileTreeViewItem* treeItem = dynamic_cast<KFileTreeViewItem*>(KFileTreeViewItem::currentKFileTreeViewItem()); - - KURL filepattern = m_fileTreeView2->currentURL(); - TQString filepa = filepattern.path(); - if(filepa) - if ((includePaths.contains(filepa) == 0) && (excludePaths.contains(filepa) == 0)){ - sessionslb2->insertItem(filepa); - - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - - if (excludePaths.contains(filepa) == 0) { - excludePaths.prepend(filepa); - }else{ - excludePaths.remove(filepa); - excludePaths.prepend(filepa); - } - config->writeEntry("ExcludePaths", excludePaths); - config->sync(); - - btnup2->setEnabled(true); - } -} - -void Klamd::slotDelExcludeDir() -{ - - while (excludePaths.contains(sessionslb2->currentText())) - { - excludePaths.remove(sessionslb2->currentText()); - } - - sessionslb2->removeItem(sessionslb2->currentItem()); - - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - config->writeEntry("ExcludePaths", excludePaths); - config->sync(); - - if ( sessionslb2->count() == 0 ) - btnup2->setEnabled(false); - -} - - -void Klamd::writeConf() -{ - KTempFile tf; - if ( tf.status() != 0 ) { - tf.close(); - //delete tf; - KMessageBox::information (this,"KMFilterActionWithCommand: Could not create temp file!"); - return; - } - - - //config = TDEGlobal::config(); - config->setGroup("Kuarantine"); - TQStringList lastQuarLocations = config->readListEntry("KuarantineLocations"); - TQString quarloc; - for (TQStringList::Iterator ita = lastQuarLocations.begin(); ita == lastQuarLocations.begin() ; ita++){ - quarloc = *ita; - } - - TQString db = tdemain->freshklam->getCurrentDBDir(); - - - //tf->setAutoDelete(TRUE); - - tempFileName = tf.name(); - - TQTextStream &ts = *(tf.textStream()); - - - - - for ( TQListBoxItem *bi = sessionslb->firstItem() ; bi != 0; bi = bi->next() ) - ts << "ClamukoIncludePath " << bi->text() << "\n"; - - ts << "ClamukoExcludePath " <<quarloc << "\n"; - - for ( TQListBoxItem *bi = sessionslb2->firstItem() ; bi != 0; bi = bi->next() ) - ts << "ClamukoExcludePath " << bi->text() << "\n"; - - config->setGroup("Klamd"); - - - - if (KlamavConfig::created()){ - ts << "ClamukoScanOnCloseModified" << "\n"; - clamdcommand = "klamd"; - - ts << "TCPSocket 9888 " << "\n"; - ts << "Foreground" << "\n"; - ts << "LogFile /dev/stdout" << "\n"; - ts << "ScanArchive" << "\n"; - ts << "FixStaleSocket" << "\n"; - ts << "SelfCheck 1800" << "\n"; - ts << TQString("DatabaseDirectory %1").arg(db) << "\n"; - ts << "ClamukoScanOnLine" << "\n"; - - if (KlamavConfig::executed()) - ts << "ClamukoScanOnExec " << "\n"; - - }else{ - clamdcommand = "clamd"; - - ts << "TCPSocket 9888 " << "\n"; - ts << "Foreground True" << "\n"; - ts << "LogFile /dev/stdout" << "\n"; - ts << "ScanArchive True" << "\n"; - ts << "FixStaleSocket True" << "\n"; - ts << "SelfCheck 1800" << "\n"; - ts << TQString("DatabaseDirectory %1").arg(db) << "\n"; - ts << "ClamukoScanOnAccess True" << "\n"; - - if (KlamavConfig::executed()) - ts << "ClamukoScanOnExec True" << "\n"; - - if (KlamavConfig::opened()) - ts << "ClamukoScanOnOpen True" << "\n"; - - if (KlamavConfig::closed()) - ts << "ClamukoScanOnClose True" << "\n"; - } - - TQString curtex = check_combo->currentText(); - ts << "ClamukoMaxFileSize " << curtex << "M\n"; - - tf.close(); -} - -void Klamd::Quarantine(TQString fname, TQString virusname){ - - //config = TDEGlobal::config(); - config->setGroup("Kuarantine"); - //object.replace("Clamuko:",""); - //object = object.stripWhiteSpace(); - ////kdDebug() << object << endl; - //TQString QuarLocation = config->readEntry("KuarantineLocations"); - TQStringList lastQuarLocations = config->readListEntry("KuarantineLocations"); - - TQString quarloc; - for (TQStringList::Iterator it = lastQuarLocations.begin(); it == lastQuarLocations.begin() ; it++){ - quarloc = *it; - } - - lastQuarItems = config->readListEntry(TQString("Items %1").arg(quarloc)); - - if (!(fname.isEmpty())){ - TQDate today = TQDate::currentDate(); - TQTime now = TQTime::currentTime(); - TQString suffix = TQString(":%1 %2") - .arg(today.toString("ddd MMMM d yyyy")) - .arg(now.toString("hh-mm-ss ap")); - - TQString object = fname + ": " + virusname + suffix; - TQStringList tokens = TQStringList::split ( "/", fname, FALSE ); - TQString qname = tokens.last(); - qname.prepend("/"); - qname.prepend(quarloc); - qname.append(suffix); - bufmv = ""; - //kdDebug() << fname << endl; - //kdDebug() << qname << endl; - //kdDebug() << object << endl; - if (rename ((const char *)fname, (const char *)qname) != 0){ - TQString suCommand=TQString("mv '%1' '%2'").arg(fname).arg(qname); - //kdDebug() << suCommand << endl; - proc = new KProcIO(); - proc->setUseShell(TRUE); - *proc<<suCommand; - - - connect( proc, SIGNAL(readReady(KProcIO *)), - SLOT(receivedmvOutput(KProcIO *)) ); - - proc->start(KProcIO::NotifyOnExit,TRUE); - // ouch - proc->wait(); - //kdDebug() << "finished " << suCommand << endl; - if (((bufmv.find("Permission denied"))) != -1){ - KMessageBox::information (this,i18n("<p>Don't have permission to move <b>%1</b> to the quarantine folder.</p>").arg(fname)); - }else if (((bufmv.find("No space"))) != -1){ - KMessageBox::information (this,i18n("<p>Don't have enough space to move <b>%1</b> to the quarantine folder.</p>").arg(fname)); - - }else{ - if (recursive_box1->isChecked()) - KMessageBox::queuedMessageBox(0, KMessageBox::Information, i18n("<p>Infected file found: <br><br>Filename: <b>%1</b> <br>Virus found: <b>%2</b> <br><br>I'm going to quarantine this file. You can restore it later if you want.<br></p>").arg(fname).arg(TQString(virusname).replace("FOUND","")), - //i18n( "Infected File Found!" ), - //i18n( "Quarantine" ) - 0); - - if (lastQuarItems.contains(object)) - lastQuarItems.remove(object); - lastQuarItems.prepend(object); - CollectionDB::instance()->insertEvent("Quarantine",virusname,fname); - } - }else{ - //kdDebug() << "rename worked" << endl; - if (recursive_box1->isChecked()) - KMessageBox::queuedMessageBox(0, KMessageBox::Information, i18n("<p>Infected file found: <br><br>Filename: <b>%1</b> <br>Virus found: <b>%2</b> <br><br>I'm going to quarantine this file. You can restore it later if you want.<br> If the file already exists in the quarantine directory it will be overwritten.</p>").arg(fname).arg(TQString(virusname).replace("FOUND","")), - //i18n( "Infected File Found!" ), - //i18n( "Quarantine" ) - 0); - - if (lastQuarItems.contains(object)) - lastQuarItems.remove(object); - lastQuarItems.prepend(object); - CollectionDB::instance()->insertEvent("Quarantine",virusname,fname); - } - } - - config->writeEntry(TQString("Items %1").arg(quarloc), lastQuarItems); - //config->sync(); - - //tdemain->kuarantine->refresh(); - //kdDebug() << "finished klamd quar" << endl; -} - -void Klamd::receivedmvOutput(KProcIO *) -{ - //kdDebug() << "in receivedmvoutput" << endl; - - mvbuffer = ""; - proc->readln(mvbuffer); - bufmv += TQString(mvbuffer); -} - - - -int Klamd::runDazuko(bool caller){ - - - dazukoLoaded = FALSE; - TQString lsmodCommand="lsmod"; - lsmodproc = new KProcIO(); - TQString curpath = (TQString) getenv("PATH"); - lsmodproc->setEnvironment("PATH",curpath + ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); - - - lsmodproc->setUseShell(TRUE); - *lsmodproc<<lsmodCommand; - - connect( lsmodproc, SIGNAL(readReady(KProcIO *)), - SLOT(checkForDazuko()) ); - if (caller){ - connect( lsmodproc, SIGNAL(processExited(TDEProcess *)), - SLOT(lsmodOutput()) ); - }else{ - connect( lsmodproc, SIGNAL(processExited(TDEProcess *)), - SLOT(lsmodCheck()) ); - } - - - bool succ = lsmodproc->start(KProcIO::NotifyOnExit,TRUE); - - if (!(succ)) - KMessageBox::information (this,i18n( "There was a problem detecting the loaded status of dazuko.") ); - return 1; -} - -void Klamd::lsmodOutput() -{ - if (!(dazukoLoaded)){ - int result; - result = KMessageBox::warningContinueCancel(this, i18n( "I need to load a module called 'dazuko' first. This module will allow KlamAV to gain real-time access to files. If you don't want this message to appear in future, put the following command in your initialization scripts: 'modprobe dazuko.o'. You will next be asked for the root password."), - i18n( "Load Module" ), - i18n( "Load Module" ), - i18n( "Delete2" )); - switch (result) { - case 2 : KMessageBox::information (this,i18n( "Loading of Module Cancelled.") ); break; - case 5 : loadDazuko(); break; - } - - }else{ - loadKlamd(); - } - - -} - -void Klamd::loadKlamd() -{ - writeConf(); - - klamdAlive = TRUE; - - //TQString suCommand=TQString("tdesu -t -c '" +clamdcommand+" -c '%1'").arg(tempFileName)+"'"; - TQString suCommand=TQString(clamdcommand+" -c '%1'").arg(tempFileName); - childproc = new KProcIO(); - childproc->setUseShell(TRUE); - childproc->setUsePty (KProcIO::Stdout,TRUE); - TQString curpath = (TQString) getenv("PATH"); - childproc->setEnvironment("PATH",curpath + ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); - - kdDebug() << suCommand << endl; - - *childproc<<suCommand; - - connect( childproc, SIGNAL(readReady(KProcIO *)), - SLOT(receivedOutput(KProcIO *)) ); - childproc->start(KProcIO::NotifyOnExit); - connect( childproc, SIGNAL(processExited(TDEProcess *)), - SLOT(childExited()) ); - - search_button->setEnabled(false); - cancel_button->setEnabled(true); - -/* if (tdemain->freshklam->isFreshklamAlive()) - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamavdl")); - else*/ - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav")); - tdemain->EnableKlamd->setEnabled(FALSE); - tdemain->DisableKlamd->setEnabled(TRUE); - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - config->writeEntry("Enabled", "Yes"); - config->sync(); - disableInputs(); - - CollectionDB::instance()->insertEvent("Auto-Scan","Scanning Started",""); - -} -void Klamd::loadDazuko() -{ - -// struct utsname info; -// -// if (uname(&info) == -1) -// { -// kdError(0) << "uname() failed: errno = " << errno << endl; -// return; -// } -// -// TQString release = TQString(info.release); -// -// //kdDebug() << release << endl; -// TQString insmodCommand="insmod /lib/modules/" + release + "/dazuko.o"; - TQString insmodCommand="modprobe dazuko"; - //TQString insmodCommand="insmod /opt/kde/bin/dazuko.o"; - KProcIO *insmodproc = new KProcIO(); - - TQString curpath = (TQString) getenv("PATH"); - insmodproc->setEnvironment("PATH",curpath + ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); - - insmodproc->setUseShell(TRUE); - *insmodproc<<"tdesu -i klamav"<<"-c"<<insmodCommand; - - connect( insmodproc, SIGNAL(processExited(TDEProcess *)), - SLOT(moduleLoaded()) ); - - insmodproc->start(KProcIO::NotifyOnExit); -} - -void Klamd::moduleLoaded() -{ - runDazuko(false); - -} - -void Klamd::lsmodCheck() -{ - if (!(dazukoLoaded)){ - KMessageBox::information (this,i18n( "Dazuko was not loaded successfully. Please check your installation." )); - }else{ - int result; - result = KMessageBox::warningContinueCancel(this, i18n( "Module has been loaded. Will now continue to start up real-time scanning."), - i18n( "Continue" ), - i18n( "Continue" ), - i18n( "Delete2" )); - switch (result) { - case 2 : break; - case 5 : loadKlamd();break; - } - } - - -} - -void Klamd::checkForDazuko() -{ - TQString item = ""; - int pos; - pos = lsmodproc->readln(item,TRUE); - //KMessageBox::information (this,item); - if (pos != -1) { - //KMessageBox::information (this,item); - if ((pos = (item.find("dazuko"))) != -1){ - //KMessageBox::information (this,"found dazuko"); - dazukoLoaded = TRUE; - lsmodproc->kill(); - } - lsmodproc->ackRead(); - } -} - -void Klamd::restoreKlamd(){ - - config = TDEGlobal::config(); - config->setGroup("Klamd"); - TQString RunKlamd = config->readEntry("Enabled"); - - if (RunKlamd == "Yes"){ - startKlamd(); - } - -} - -void Klamd::handleChecks(){ - - //config = TDEGlobal::config(); - config->setGroup("Klamd"); - if (recursive_box->isChecked()) - config->writeEntry("Quarantine","Yes"); - else - config->writeEntry("Quarantine","No"); - - if (recursive_box1->isChecked()) - config->writeEntry("Warn","Yes"); - else - config->writeEntry("Warn","No"); - - if (recursive_box2->isChecked()) - config->writeEntry("Run Docked","Yes"); - else - config->writeEntry("Run Docked","No"); - - config->sync(); - -} - -bool Klamd::isKlamdAlive(){ - if (klamdAlive) - return true; - return false; - -} - -TQString Klamd::getKlamdConfFile(){ - return tempFileName; - -} - -void Klamd::slotAdvOptions(){ - -/* config = TDEGlobal::config(); - config->setGroup("Klamd"); - TQString RunKlamd = config->readEntry("Enabled"); - - KlamdOptions *dialog = new KlamdOptions( this, "settings"); - -// connect( dialog, SIGNAL(settingsChanged()), SLOT(applySettings()) ); - - - dialog->show(); - dialog->raise(); - dialog->setActiveWindow();*/ - - tdemain->slotConfigKlamav( "Auto-Scan" ); - -} - -void Klamd::disableInputs(){ - - hlp->setEnabled(false); - hlp2->setEnabled(false); - hlp3->setEnabled(false); -} - -void Klamd::enableInputs(){ - - hlp->setEnabled(true); - hlp2->setEnabled(true); - hlp3->setEnabled(true); - -} - -#include "klamd.moc" diff --git a/src/klamd.h b/src/klamd.h deleted file mode 100644 index e909d49..0000000 --- a/src/klamd.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) 2004 Robert Hogan <robert at roberthogan dot net> - */ - -#ifndef _KLAMD_H_ -#define _KLAMD_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <tdeapplication.h> -#include <tdemainwindow.h> -#include <tqlistview.h> -#include <tqlistbox.h> -#include "tdefiletreeview.h" - - - -class KPrinter; -class TDEToggleAction; -class KURL; -class TQLineEdit; -class TQComboBox; -class TQCheckBox; -class TQListBox; -class TQPushButton; -class TQLabel; -class TDEProcess; -class TDEConfig; -class KURLRequester; -class K3bFileTreeView; -class KArrowButton; -class KProcIO; -class KSystemTray; - -class MyListBox : public TQListBox -{ - -public: - MyListBox(TQWidget *parent) : TQListBox(parent) {} - bool isItemVisible(int id) { return itemVisible(id); } -}; - -/** - * This class serves as the main window for Klamd. It handles the - * menus, toolbars, and status bars. - * - * @short Main window class - * @author $AUTHOR <$EMAIL> - * @version $APP_VERSION - */ -class Klamd : public TQWidget -{ - Q_OBJECT -public: - /** - * Default Constructor - */ - Klamd(TQWidget *parent, const char *name=0); - - /** - * Default Destructor - */ - virtual ~Klamd(); - - /** - * Use this method to load whatever file/URL you have - */ - void setDirName(TQString); - bool isKlamdAlive(); - TQString getKlamdConfFile(); - -public slots: - bool startKlamd(); - void slotCancel(); - -protected: - /** - * Overridden virtuals for TQt drag 'n drop (XDND) - */ - /*virtual void dragEnterEvent(TQDragEnterEvent *event); - virtual void dropEvent(TQDropEvent *event);*/ - -protected: - /** - * This function is called when it is time for the app to save its - * properties for session management purposes. - */ - //void saveProperties(TDEConfig *); - - /** - * This function is called when this app is restored. The TDEConfig - * object points to the session management config file that was saved - * with @ref saveProperties - */ - //void readProperties(TDEConfig *); - - -public: -private: - void setupAccel(); - void setupActions(); - -private: - //KlamdView *m_view; - - /* KPrinter *m_printer; - TDEToggleAction *m_toolbarAction; - TDEToggleAction *m_statusbarAction;*/ - - -signals: - void itemSelected(TQString abs_filename, int line); - - - -private slots: - //void dirButtonClicked(); - //void templateActivated(int index); - void childExited(); - void receivedOutput(KProcIO *); - //void itemSelected(const TQString&); - void slotClear(); - void slotAddIncludeDir(); - void slotAddExcludeDir(); - void slotDelIncludeDir(); - void slotDelExcludeDir(); - void writeConf(); - void Quarantine(TQString fname, TQString virusname); - void restoreKlamd(); - void handleChecks(); - void checkForDazuko(); - void loadDazuko(); - void lsmodOutput(); - void lsmodCheck(); - void moduleLoaded(); - void receivedmvOutput(KProcIO *); - void slotAdvOptions(); - - //void patternTextChanged( const TQString &); -private: - void processOutput(); - void finish(); - void getout(); - int runDazuko(bool caller); - void loadKlamd(); - void enableInputs(); - void disableInputs(); - TQLineEdit *template_edit; - TQComboBox *files_combo, *pattern_combo/*, *dir_combo*/; - KURLRequester *dir_combo; - TQCheckBox *recursive_box; - TQCheckBox *recursive_box1; - TQCheckBox *recursive_box2; - TQListBox *resultbox; - TQLabel *status_label, *matches_label; - KProcIO *childproc; - KProcIO *proc; - KProcIO *lsmodproc; - TQString buf, bufmv, mvbuffer; - TDEConfig* config; - TQStringList lastSearchItems; - TQStringList lastSearchPaths; - TQStringList lastQuarItems; - TQListView* table; - MyListBox *sessionslb; - KArrowButton *btnup, *btndown; - KFileTreeView* m_fileTreeView; - KFileTreeBranch* treeBranch; - MyListBox *sessionslb2; - KArrowButton *btnup2, *btndown2; - KFileTreeView* m_fileTreeView2; - KFileTreeBranch* treeBranch2; - TQString tempFileName; - TQComboBox *check_combo; - TQComboBox *check_combo2; - TQString item2; - TQStringList includePaths; - TQStringList excludePaths; - bool dazukoLoaded; - bool klamdAlive; - TQWidget *parent; - TQString tmpit; - TQString clamdcommand; - //TQPushButton *adv_options; - TQWidget *hlp; - TQWidget *hlp2; - TQWidget *hlp3; -public: - TQPushButton *search_button, *cancel_button; - - -}; - -#endif // _Klamd_H_ diff --git a/src/klamdoptions.cpp b/src/klamdoptions.cpp deleted file mode 100644 index a2b53a5..0000000 --- a/src/klamdoptions.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'klamdoptions.ui' -** -** Created: Sun Mar 6 14:20:47 2005 -** by: The User Interface Compiler ($Id: klamdoptions.cpp,v 1.1.1.1 2006/02/03 20:35:02 hoganrobert Exp $) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ - -#include "klamdoptions.h" - -#include <tqvariant.h> -#include <tqpushbutton.h> -#include <kpushbutton.h> -#include <kdialog.h> -#include <tdemessagebox.h> -#include <tqgroupbox.h> -#include <tqcombobox.h> -#include <tqcheckbox.h> -#include <tqlabel.h> -#include <tqlayout.h> -#include <tqtooltip.h> -#include <tqwhatsthis.h> -#include <tdeconfig.h> -#include <tdelocale.h> - -const char *check_desc3[] = { - "1", - "2", - "3", - "4", - "5", - 0 -}; - -/* - * Constructs a KlamdOptions 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. - */ -KlamdOptions::KlamdOptions( TQWidget* parent, const char* name, bool modal, WFlags fl ) - : TQDialog( parent, name, modal, fl ) -{ - if ( !name ) - setName( "KlamdOptions" ); - setModal( TRUE ); - - OK = new KPushButton( this, "OK" ); - OK->setGeometry( TQRect( 80, 220, 86, 31 ) ); - OK->setDefault( TRUE ); - - connect( OK, SIGNAL(clicked()), - SLOT(updateSettings()) ); - - Cancel = new KPushButton( this, "Cancel" ); - Cancel->setGeometry( TQRect( 180, 220, 86, 31 ) ); - Cancel->setDefault( FALSE ); - - connect( Cancel, SIGNAL(clicked()), - SLOT(close()) ); - - AdvOptions = new KDialog( this, "AdvOptions" ); - AdvOptions->setGeometry( TQRect( 590, 470, 20, 20 ) ); - - TQWidget* privateLayoutWidget = new TQWidget( this, "layout7" ); - privateLayoutWidget->setGeometry( TQRect( 10, 10, 333, 200 ) ); - layout7 = new TQGridLayout( privateLayoutWidget, 1, 1, 11, 6, "layout7"); - - Archives = new TQGroupBox( privateLayoutWidget, "Archives" ); - - MaxSize = new TQComboBox( FALSE, Archives, "MaxSize" ); - MaxSize->insertStrList(check_desc3); - MaxSize->adjustSize(); - - MaxSize->setGeometry( TQRect( 170, 20, 40, 21 ) ); - - ScanArchives = new TQCheckBox( Archives, "ScanArchives" ); - ScanArchives->setGeometry( TQRect( 20, 20, 150, 21 ) ); - connect( ScanArchives, SIGNAL(toggled(bool)),MaxSize, - SLOT(setEnabled(bool)) ); - - textLabel1 = new TQLabel( Archives, "textLabel1" ); - textLabel1->setGeometry( TQRect( 230, 20, 70, 21 ) ); - - layout7->addWidget( Archives, 1, 0 ); - - ScanFilesWhen = new TQGroupBox( privateLayoutWidget, "ScanFilesWhen" ); - - TQWidget* privateLayoutWidget_2 = new TQWidget( ScanFilesWhen, "layout6" ); - privateLayoutWidget_2->setGeometry( TQRect( 20, 20, 140, 60 ) ); - layout6 = new TQGridLayout( privateLayoutWidget_2, 1, 1, 11, 6, "layout6"); - - Created = new TQCheckBox( privateLayoutWidget_2, "Created" ); - - layout6->addWidget( Created, 0, 0 ); - connect( Created, SIGNAL(clicked()), - SLOT(warn()) ); - - Executed = new TQCheckBox( privateLayoutWidget_2, "Executed" ); - - layout6->addWidget( Executed, 2, 0 ); - - TQWidget* privateLayoutWidget_3 = new TQWidget( ScanFilesWhen, "layout7" ); - privateLayoutWidget_3->setGeometry( TQRect( 181, 20, 90, 60 ) ); - layout7_2 = new TQGridLayout( privateLayoutWidget_3, 1, 1, 11, 6, "layout7_2"); - - Opened = new TQCheckBox( privateLayoutWidget_3, "Opened" ); - - layout7_2->addWidget( Opened, 0, 0 ); - - Closed = new TQCheckBox( privateLayoutWidget_3, "Closed" ); - - layout7_2->addWidget( Closed, 1, 0 ); - - connect( Created, SIGNAL(toggled(bool)),Opened, - SLOT(setDisabled(bool)) ); - connect( Created, SIGNAL(toggled(bool)),Closed, - SLOT(setDisabled(bool)) ); - - layout7->addWidget( ScanFilesWhen, 0, 0 ); - languageChange(); - resize( TQSize(351, 270).expandedTo(minimumSizeHint()) ); - clearWState( WState_Polished ); - - fetchSettings(); -} - -/* - * Destroys the object and frees any allocated resources - */ -KlamdOptions::~KlamdOptions() -{ - // no need to delete child widgets, TQt does it all for us -} - -/* - * Sets the strings of the subwidgets using the current - * language. - */ -void KlamdOptions::languageChange() -{ - setCaption( tr( "Advanced Options" ) ); - OK->setText( tr( "OK" ) ); - Cancel->setText( tr( "Cancel" ) ); - Archives->setTitle( tr( "Archives" ) ); - ScanArchives->setText( tr( "Scan Archives up to" ) ); - textLabel1->setText( tr( "MB in size" ) ); - ScanFilesWhen->setTitle( tr( "Scan Files When They Are:" ) ); - Created->setText( tr( "Created/Modified" ) ); - Executed->setText( tr( "Executed" ) ); - Opened->setText( tr( "Opened" ) ); - Closed->setText( tr( "Closed" ) ); -} - -void KlamdOptions::updateSettings() -{ - TDEConfig* config = TDEGlobal::config(); - config->setGroup("Klamd"); - - config->writeEntry("Enabled", "No"); - - if (Created->isChecked()) - config->writeEntry("Created", "Yes"); - else - config->writeEntry("Created", "No"); - - if (Executed->isChecked()) - config->writeEntry("Executed", "Yes"); - else - config->writeEntry("Executed", "No"); - - if (Opened->isChecked()) - config->writeEntry("Opened", "Yes"); - else - config->writeEntry("Opened", "No"); - - if (Closed->isChecked()) - config->writeEntry("Closed", "Yes"); - else - config->writeEntry("Closed", "No"); - - if (ScanArchives->isChecked()){ - config->writeEntry("ScanArchives", "Yes"); - config->writeEntry("MaxSize", MaxSize->currentText()); - }else - config->writeEntry("ScanArchives", "No"); - - config->sync(); - close(); -} - -void KlamdOptions::fetchSettings() -{ - config = TDEGlobal::config(); - config->setGroup("Klamd"); - - - if (config->readEntry("Executed") == "Yes") - Executed->setChecked(true); - else - Executed->setChecked(false); - - if (config->readEntry("Opened") == "Yes") - Opened->setChecked(true); - else - Opened->setChecked(false); - - if (config->readEntry("Closed") == "Yes") - Closed->setChecked(true); - else - Closed->setChecked(false); - - if (config->readEntry("Created") == "Yes"){ - Created->setChecked(true); - Opened->setEnabled(false); - Closed->setEnabled(false); - }else - Created->setChecked(false); - - if (config->readEntry("ScanArchives") == "Yes"){ - ScanArchives->setChecked(true); - MaxSize->setEnabled(true); - MaxSize->setCurrentText(config->readEntry("MaxSize")); - }else{ - ScanArchives->setChecked(false); - MaxSize->setEnabled(false); - - } - - -} - -void KlamdOptions::warn() -{ - - if (Created->isChecked()){ - KMessageBox::information (this,i18n("<p>This option allows for faster, more usable auto-scanning. It is experimental, however, and there are some potential security risks. For more information, see http://klamav.sourceforge.net/index.php?content=ka_security_notes</p>"),"Warning","show"); - } - - -} - -#include "klamdoptions.moc" diff --git a/src/klamdoptions.h b/src/klamdoptions.h deleted file mode 100644 index 7f5d658..0000000 --- a/src/klamdoptions.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'klamdoptions.ui' -** -** Created: Sun Mar 6 14:20:47 2005 -** by: The User Interface Compiler ($Id: klamdoptions.h,v 1.1.1.1 2006/02/03 20:35:04 hoganrobert Exp $) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ - -#ifndef KLAMDOPTIONS_H -#define KLAMDOPTIONS_H - -#include <tqvariant.h> -#include <tqdialog.h> - -class TQVBoxLayout; -class TQHBoxLayout; -class TQGridLayout; -class TQSpacerItem; -class KPushButton; -class KDialog; -class TQGroupBox; -class TQComboBox; -class TQCheckBox; -class TQLabel; -class TDEConfig; - -class KlamdOptions : public TQDialog -{ - Q_OBJECT - -public: - KlamdOptions( TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~KlamdOptions(); - - KPushButton* OK; - KPushButton* Cancel; - KDialog* AdvOptions; - TQGroupBox* Archives; - TQComboBox* MaxSize; - TQCheckBox* ScanArchives; - TQLabel* textLabel1; - TQGroupBox* ScanFilesWhen; - TQCheckBox* Created; - TQCheckBox* Executed; - TQCheckBox* Opened; - TQCheckBox* Closed; - TDEConfig* config; -private: - - void fetchSettings(); - -private slots: - void updateSettings(); - void warn(); - -protected: - TQGridLayout* layout7; - TQGridLayout* layout6; - TQGridLayout* layout7_2; - -protected slots: - virtual void languageChange(); - -}; - -#endif // KLAMDOPTIONS_H diff --git a/src/klamscan.cpp b/src/klamscan.cpp index 16de3c8..e0d9419 100644 --- a/src/klamscan.cpp +++ b/src/klamscan.cpp @@ -4,7 +4,6 @@ #include "klamscan.h" #include "klamav.h" -#include "klamd.h" #include "klamscanoptions.h" #include "schedule.h" #include "directorylist.h" @@ -379,10 +378,7 @@ void Klamscan::scanURLs(const TQString &urls) void Klamscan::slotStopScanning(){ - if (tdemain->klamd->isKlamdAlive()) - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_enabled")); - else - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); + tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); ////kdDebug() << tabBrowser->currentPage()->name() << endl; ScanViewer* cur = static_cast<ScanViewer*>(tabBrowser->currentPage()); @@ -408,10 +404,7 @@ void Klamscan::slotStartAgain(){ void Klamscan::slotRemoveTab(){ - if (tdemain->klamd->isKlamdAlive()) - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_enabled")); - else - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); + tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); ////kdDebug() << tabBrowser->currentPage()->name() << endl; if (tabBrowser->currentPageIndex() != 0){ slotStopScanning(); diff --git a/src/scanviewer.cpp b/src/scanviewer.cpp index c9c60f0..ca2df18 100644 --- a/src/scanviewer.cpp +++ b/src/scanviewer.cpp @@ -8,7 +8,6 @@ #include "directorylist.h" #include "dbviewer.h" #include "collectiondb.h" -#include "klamd.h" #include <config.h> #include "klamavconfig.h" @@ -594,10 +593,7 @@ void ScanViewer::slotCancel() void ScanViewer::resetSysTray() { - if (tdemain->klamd->isKlamdAlive()) - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_enabled")); - else - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); + tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); } void ScanViewer::childExited() @@ -750,12 +746,9 @@ void ScanViewer::Quarantine(){ } } - if (allQuarantined) { - if (tdemain->klamd->isKlamdAlive()) - tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_enabled")); - else + if (allQuarantined) tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_on_acc_disabled")); - }else + else tdemain->_tray->setPixmap(KSystemTray::loadIcon("klamav_scan_found")); config->writeEntry(TQString("Items %1").arg(quarloc), lastQuarItems); config->sync(); |