diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-01-13 19:30:17 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-01-13 19:30:17 +0200 |
commit | 357ddeb8afd82d69ef871c146f4fc8f2c67fb17e (patch) | |
tree | dc3ef0e6fedd64f5fb177c114f72e1515a07cd1b /src/klamd.cpp | |
parent | c6cbd71bc169ac0e927e52325dbbbcb506abbc73 (diff) | |
download | klamav-357ddeb8afd82d69ef871c146f4fc8f2c67fb17e.tar.gz klamav-357ddeb8afd82d69ef871c146f4fc8f2c67fb17e.zip |
Conversion Qt3->TQt
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src/klamd.cpp')
-rw-r--r-- | src/klamd.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/src/klamd.cpp b/src/klamd.cpp index 55a934d..f8b6c89 100644 --- a/src/klamd.cpp +++ b/src/klamd.cpp @@ -18,15 +18,15 @@ #include <kaction.h> -#include <qcheckbox.h> +#include <tqcheckbox.h> #include <kbuttonbox.h> #include <kprocio.h> #include <kurlrequester.h> -#include <qlayout.h> +#include <tqlayout.h> #include <kmessagebox.h> #include <ktempfile.h> #include <ksystemtray.h> -#include <qtoolbutton.h> +#include <tqtoolbutton.h> #include <knotifyclient.h> @@ -46,8 +46,8 @@ const char *check_desc2[] = { }; -Klamd::Klamd(QWidget *_parent, const char *name) - : QWidget(_parent, name) +Klamd::Klamd(TQWidget *_parent, const char *name) + : TQWidget(_parent, name) { parent = _parent; @@ -57,24 +57,24 @@ Klamd::Klamd(QWidget *_parent, const char *name) //Data Directory Widget - //QString dt = QDateTime::currentDateTime().toString(); + //TQString dt = TQDateTime::currentDateTime().toString(); //KMessageBox::information (this,dt); - QVBoxLayout *vbox = new QVBoxLayout(this, KDialog::marginHint(), + TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "vbox"); - QGroupBox *group = new QGroupBox(i18n("Include Directories"), this); + TQGroupBox *group = new TQGroupBox(i18n("Include Directories"), this); vbox->addWidget(group); - QGridLayout *layout = new QGridLayout( group, 9, 3, KDialog::spacingHint(), + 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 QWidget( group ); + hlp = new TQWidget( group ); layout->addMultiCellWidget(hlp, 1,1, 0,2); - QHBoxLayout *dir_layout = new QHBoxLayout(hlp, KDialog::spacingHint() ); + TQHBoxLayout *dir_layout = new TQHBoxLayout(hlp, KDialog::spacingHint() ); KURL root = KURL( "/" ); m_fileTreeView = new KFileTreeView( hlp ); @@ -113,19 +113,19 @@ Klamd::Klamd(QWidget *_parent, const char *name) dir_layout->addWidget(btndown); dir_layout->addWidget(sessionslb); - QGroupBox *group2 = new QGroupBox(i18n("Exclude Directories"), this); + TQGroupBox *group2 = new TQGroupBox(i18n("Exclude Directories"), this); vbox->addWidget(group2); - QGridLayout *layout2 = new QGridLayout( group2, 9, 3, KDialog::spacingHint(), + 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 QWidget( group2 ); + hlp2 = new TQWidget( group2 ); layout2->addMultiCellWidget(hlp2, 1,1, 0,2); - QHBoxLayout *dir_layout2 = new QHBoxLayout(hlp2, KDialog::spacingHint() ); + TQHBoxLayout *dir_layout2 = new TQHBoxLayout(hlp2, KDialog::spacingHint() ); KURL root2 = KURL( "/" ); m_fileTreeView2 = new KFileTreeView( hlp2 ); @@ -161,21 +161,21 @@ Klamd::Klamd(QWidget *_parent, const char *name) dir_layout2->addWidget(btndown2); dir_layout2->addWidget(sessionslb2); - QGroupBox *group3 = new QGroupBox(i18n("Options"), this); + TQGroupBox *group3 = new TQGroupBox(i18n("Options"), this); vbox->addWidget(group3); - QGridLayout *layout3 = new QGridLayout( group3, 9, 10, KDialog::spacingHint(), + 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 QWidget( group3 ); + hlp3 = new TQWidget( group3 ); layout3->addMultiCellWidget(hlp3, 1,1, 0,10); - QHBoxLayout *dir_layout3 = new QHBoxLayout(hlp3, KDialog::spacingHint() ); + TQHBoxLayout *dir_layout3 = new TQHBoxLayout(hlp3, KDialog::spacingHint() ); - recursive_box = new QCheckBox(i18n("&Quarantine"), hlp3); + recursive_box = new TQCheckBox(i18n("&Quarantine"), hlp3); //recursive_box->setMinimumWidth(recursive_box->sizeHint().width()); if ((config->readEntry("Quarantine")) == "Yes") @@ -187,7 +187,7 @@ Klamd::Klamd(QWidget *_parent, const char *name) //dir_layout3->addSpacing(10); dir_layout3->addWidget(recursive_box); - recursive_box1 = new QCheckBox(i18n("&Display Warnings"), hlp3); + recursive_box1 = new TQCheckBox(i18n("&Display Warnings"), hlp3); //recursive_box1->setMinimumWidth(recursive_box1->sizeHint().width()); if ((config->readEntry("Warn")) == "Yes") @@ -199,7 +199,7 @@ Klamd::Klamd(QWidget *_parent, const char *name) //dir_layout3->addSpacing(10); dir_layout3->addWidget(recursive_box1); - recursive_box2 = new QCheckBox(i18n("&Run Docked"), hlp3); + recursive_box2 = new TQCheckBox(i18n("&Run Docked"), hlp3); //recursive_box2->setMinimumWidth(recursive_box2->sizeHint().width()); if ((config->readEntry("Run Docked")) == "Yes") @@ -211,11 +211,11 @@ Klamd::Klamd(QWidget *_parent, const char *name) dir_layout3->addWidget(recursive_box2); dir_layout3->addSpacing(40); - QLabel *combo_label = new QLabel(i18n("Max File Size (MBs):"), hlp3); + 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 QComboBox(false, hlp3); + check_combo = new TQComboBox(false, hlp3); check_combo->insertStrList(check_desc1); check_combo->adjustSize(); //check_combo->setFixedSize(check_combo->size()); @@ -224,33 +224,33 @@ Klamd::Klamd(QWidget *_parent, const char *name) dir_layout3->addSpacing(20); - QToolButton* adv_options = new QToolButton( hlp3,"play" ); + TQToolButton* adv_options = new TQToolButton( hlp3,"play" ); adv_options->setIconSet( SmallIconSet( "configure" ) ); adv_options->setTextLabel("Options"); - adv_options->setTextPosition(QToolButton::Right); + adv_options->setTextPosition(TQToolButton::Right); adv_options->setUsesTextLabel(true); -// adv_options = new QPushButton ("Advanced", hlp3); +// adv_options = new TQPushButton ("Advanced", hlp3); dir_layout3->addWidget(adv_options); //adv_options->setFixedSize(adv_options->sizeHint()); connect( adv_options, SIGNAL(clicked()), SLOT(slotAdvOptions()) ); -/* QLabel *combo_label2 = new QLabel(i18n("Scan:"), hlp3); +/* TQLabel *combo_label2 = new TQLabel(i18n("Scan:"), hlp3); combo_label2->setFixedSize(combo_label2->sizeHint()); dir_layout3->addWidget(combo_label2); - check_combo2 = new QComboBox(false, hlp3); + 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); - QToolTip::add( check_combo2, "'On Access' scans every file accessed. 'On Execute' only scans files/programs that your system tries to execute." );*/ + 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, Qt::Horizontal); + KButtonBox *actionbox = new KButtonBox(this, TQt::Horizontal); vbox->addWidget(actionbox, 2, 0); actionbox->addStretch(); search_button = actionbox->addButton(i18n("&Enable Auto-Scan")); @@ -301,8 +301,8 @@ void Klamd::processOutput() item2 = item2.stripWhiteSpace(); int fnameStartPoint = (item2.find(":") + 1); int fnameEndPoint = item2.findRev(":"); - QString tmpFName = item2.mid(fnameStartPoint,(fnameEndPoint - fnameStartPoint)); - QString tmpVirusName = item2.mid((fnameEndPoint+1),(item2.length() - (fnameEndPoint+1))); + 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()) @@ -412,7 +412,7 @@ void Klamd::childExited() void Klamd::receivedOutput(KProcIO *) { - //buf += QCString(buffer, buflen+1); + //buf += TQCString(buffer, buflen+1); processOutput(); } @@ -424,7 +424,7 @@ void Klamd::slotClear() } -void Klamd::setDirName(QString dir){ +void Klamd::setDirName(TQString dir){ // dir_combo->setEditText(dir); dir_combo->setURL(dir); } @@ -433,7 +433,7 @@ void Klamd::slotAddIncludeDir() { KURL filepattern = m_fileTreeView->currentURL(); - QString filepa = filepattern.path(); + TQString filepa = filepattern.path(); if(filepa) if ((includePaths.contains(filepa) == 0) && (excludePaths.contains(filepa) == 0)){ sessionslb->insertItem(filepa); @@ -482,7 +482,7 @@ void Klamd::slotAddExcludeDir() //KFileTreeViewItem* treeItem = dynamic_cast<KFileTreeViewItem*>(KFileTreeViewItem::currentKFileTreeViewItem()); KURL filepattern = m_fileTreeView2->currentURL(); - QString filepa = filepattern.path(); + TQString filepa = filepattern.path(); if(filepa) if ((includePaths.contains(filepa) == 0) && (excludePaths.contains(filepa) == 0)){ sessionslb2->insertItem(filepa); @@ -537,30 +537,30 @@ void Klamd::writeConf() //config = KGlobal::config(); config->setGroup("Kuarantine"); - QStringList lastQuarLocations = config->readListEntry("KuarantineLocations"); - QString quarloc; - for (QStringList::Iterator ita = lastQuarLocations.begin(); ita == lastQuarLocations.begin() ; ita++){ + TQStringList lastQuarLocations = config->readListEntry("KuarantineLocations"); + TQString quarloc; + for (TQStringList::Iterator ita = lastQuarLocations.begin(); ita == lastQuarLocations.begin() ; ita++){ quarloc = *ita; } - QString db = kmain->freshklam->getCurrentDBDir(); + TQString db = kmain->freshklam->getCurrentDBDir(); //tf->setAutoDelete(TRUE); tempFileName = tf.name(); - QTextStream &ts = *(tf.textStream()); + TQTextStream &ts = *(tf.textStream()); - for ( QListBoxItem *bi = sessionslb->firstItem() ; bi != 0; bi = bi->next() ) + for ( TQListBoxItem *bi = sessionslb->firstItem() ; bi != 0; bi = bi->next() ) ts << "ClamukoIncludePath " << bi->text() << "\n"; ts << "ClamukoExcludePath " <<quarloc << "\n"; - for ( QListBoxItem *bi = sessionslb2->firstItem() ; bi != 0; bi = bi->next() ) + for ( TQListBoxItem *bi = sessionslb2->firstItem() ; bi != 0; bi = bi->next() ) ts << "ClamukoExcludePath " << bi->text() << "\n"; config->setGroup("Klamd"); @@ -577,7 +577,7 @@ void Klamd::writeConf() ts << "ScanArchive" << "\n"; ts << "FixStaleSocket" << "\n"; ts << "SelfCheck 1800" << "\n"; - ts << QString("DatabaseDirectory %1").arg(db) << "\n"; + ts << TQString("DatabaseDirectory %1").arg(db) << "\n"; ts << "ClamukoScanOnLine" << "\n"; if (KlamavConfig::executed()) @@ -592,7 +592,7 @@ void Klamd::writeConf() ts << "ScanArchive True" << "\n"; ts << "FixStaleSocket True" << "\n"; ts << "SelfCheck 1800" << "\n"; - ts << QString("DatabaseDirectory %1").arg(db) << "\n"; + ts << TQString("DatabaseDirectory %1").arg(db) << "\n"; ts << "ClamukoScanOnAccess True" << "\n"; if (KlamavConfig::executed()) @@ -605,39 +605,39 @@ void Klamd::writeConf() ts << "ClamukoScanOnClose True" << "\n"; } - QString curtex = check_combo->currentText(); + TQString curtex = check_combo->currentText(); ts << "ClamukoMaxFileSize " << curtex << "M\n"; tf.close(); } -void Klamd::Quarantine(QString fname, QString virusname){ +void Klamd::Quarantine(TQString fname, TQString virusname){ //config = KGlobal::config(); config->setGroup("Kuarantine"); //object.replace("Clamuko:",""); //object = object.stripWhiteSpace(); ////kdDebug() << object << endl; - //QString QuarLocation = config->readEntry("KuarantineLocations"); - QStringList lastQuarLocations = config->readListEntry("KuarantineLocations"); + //TQString QuarLocation = config->readEntry("KuarantineLocations"); + TQStringList lastQuarLocations = config->readListEntry("KuarantineLocations"); - QString quarloc; - for (QStringList::Iterator it = lastQuarLocations.begin(); it == lastQuarLocations.begin() ; it++){ + TQString quarloc; + for (TQStringList::Iterator it = lastQuarLocations.begin(); it == lastQuarLocations.begin() ; it++){ quarloc = *it; } - lastQuarItems = config->readListEntry(QString("Items %1").arg(quarloc)); + lastQuarItems = config->readListEntry(TQString("Items %1").arg(quarloc)); if (!(fname.isEmpty())){ - QDate today = QDate::currentDate(); - QTime now = QTime::currentTime(); - QString suffix = QString(":%1 %2") + 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")); - QString object = fname + ": " + virusname + suffix; - QStringList tokens = QStringList::split ( "/", fname, FALSE ); - QString qname = tokens.last(); + TQString object = fname + ": " + virusname + suffix; + TQStringList tokens = TQStringList::split ( "/", fname, FALSE ); + TQString qname = tokens.last(); qname.prepend("/"); qname.prepend(quarloc); qname.append(suffix); @@ -646,7 +646,7 @@ void Klamd::Quarantine(QString fname, QString virusname){ //kdDebug() << qname << endl; //kdDebug() << object << endl; if (rename ((const char *)fname, (const char *)qname) != 0){ - QString suCommand=QString("mv '%1' '%2'").arg(fname).arg(qname); + TQString suCommand=TQString("mv '%1' '%2'").arg(fname).arg(qname); //kdDebug() << suCommand << endl; proc = new KProcIO(); proc->setUseShell(TRUE); @@ -667,7 +667,7 @@ void Klamd::Quarantine(QString fname, QString virusname){ }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(QString(virusname).replace("FOUND","")), + 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); @@ -680,7 +680,7 @@ void Klamd::Quarantine(QString fname, QString virusname){ }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(QString(virusname).replace("FOUND","")), + 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); @@ -692,7 +692,7 @@ void Klamd::Quarantine(QString fname, QString virusname){ } } - config->writeEntry(QString("Items %1").arg(quarloc), lastQuarItems); + config->writeEntry(TQString("Items %1").arg(quarloc), lastQuarItems); //config->sync(); //kmain->kuarantine->refresh(); @@ -705,7 +705,7 @@ void Klamd::receivedmvOutput(KProcIO *) mvbuffer = ""; proc->readln(mvbuffer); - bufmv += QString(mvbuffer); + bufmv += TQString(mvbuffer); } @@ -714,9 +714,9 @@ int Klamd::runDazuko(bool caller){ dazukoLoaded = FALSE; - QString lsmodCommand="lsmod"; + TQString lsmodCommand="lsmod"; lsmodproc = new KProcIO(); - QString curpath = (QString) getenv("PATH"); + TQString curpath = (TQString) getenv("PATH"); lsmodproc->setEnvironment("PATH",curpath + ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); @@ -767,12 +767,12 @@ void Klamd::loadKlamd() klamdAlive = TRUE; - //QString suCommand=QString("kdesu -t -c '" +clamdcommand+" -c '%1'").arg(tempFileName)+"'"; - QString suCommand=QString(clamdcommand+" -c '%1'").arg(tempFileName); + //TQString suCommand=TQString("kdesu -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); - QString curpath = (QString) getenv("PATH"); + TQString curpath = (TQString) getenv("PATH"); childproc->setEnvironment("PATH",curpath + ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); kdDebug() << suCommand << endl; @@ -814,15 +814,15 @@ void Klamd::loadDazuko() // return; // } // -// QString release = QString(info.release); +// TQString release = TQString(info.release); // // //kdDebug() << release << endl; -// QString insmodCommand="insmod /lib/modules/" + release + "/dazuko.o"; - QString insmodCommand="modprobe dazuko"; - //QString insmodCommand="insmod /opt/kde/bin/dazuko.o"; +// TQString insmodCommand="insmod /lib/modules/" + release + "/dazuko.o"; + TQString insmodCommand="modprobe dazuko"; + //TQString insmodCommand="insmod /opt/kde/bin/dazuko.o"; KProcIO *insmodproc = new KProcIO(); - QString curpath = (QString) getenv("PATH"); + TQString curpath = (TQString) getenv("PATH"); insmodproc->setEnvironment("PATH",curpath + ":/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); insmodproc->setUseShell(TRUE); @@ -861,7 +861,7 @@ void Klamd::lsmodCheck() void Klamd::checkForDazuko() { - QString item = ""; + TQString item = ""; int pos; pos = lsmodproc->readln(item,TRUE); //KMessageBox::information (this,item); @@ -880,7 +880,7 @@ void Klamd::restoreKlamd(){ config = KGlobal::config(); config->setGroup("Klamd"); - QString RunKlamd = config->readEntry("Enabled"); + TQString RunKlamd = config->readEntry("Enabled"); if (RunKlamd == "Yes"){ startKlamd(); @@ -918,7 +918,7 @@ bool Klamd::isKlamdAlive(){ } -QString Klamd::getKlamdConfFile(){ +TQString Klamd::getKlamdConfFile(){ return tempFileName; } @@ -927,7 +927,7 @@ void Klamd::slotAdvOptions(){ /* config = KGlobal::config(); config->setGroup("Klamd"); - QString RunKlamd = config->readEntry("Enabled"); + TQString RunKlamd = config->readEntry("Enabled"); KlamdOptions *dialog = new KlamdOptions( this, "settings"); |