diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-02-23 22:00:08 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-02-23 22:02:09 +0200 |
commit | 9ca2a086723e4303e89df98e61b19c026bbac9ef (patch) | |
tree | d0077b759ea11e77f6a71e40f437a8fdb4f20d6c /src | |
parent | 29887ca19713b891800797066c97adf4777ee923 (diff) | |
download | klamav-9ca2a086723e4303e89df98e61b19c026bbac9ef.tar.gz klamav-9ca2a086723e4303e89df98e61b19c026bbac9ef.zip |
Freshklam: i18n() of notifications.
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/freshklam.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/freshklam.cpp b/src/freshklam.cpp index 202b57c..0501f25 100644 --- a/src/freshklam.cpp +++ b/src/freshklam.cpp @@ -41,7 +41,7 @@ #include "version.h" #include <stdlib.h> - + const char *check_desc[] = { "1", "2", @@ -85,7 +85,7 @@ Freshklam::Freshklam(TQWidget *parent, const char *name) tdemain->firstDownload = false; checkingDirectly = false; - + freshklamAlive = FALSE; config = TDEGlobal::config(); @@ -111,7 +111,7 @@ Freshklam::Freshklam(TQWidget *parent, const char *name) //Virus Database Directory TQGroupBox *group = new TQGroupBox(i18n("Virus Database Directory"), this); vbox->addWidget(group); - + TQGridLayout *layout = new TQGridLayout( group, 9, 2, KDialog::spacingHint(), KDialog::spacingHint(), "layout"); @@ -157,14 +157,14 @@ Freshklam::Freshklam(TQWidget *parent, const char *name) proxyIP = new KLineEdit(proxy_hlp); proxy_dir_layout->addWidget(proxyIP,0,1); proxyIP->setText(proxyIPText); - + TQLabel *proxy_port_label = new TQLabel(i18n("Port:"), proxy_hlp); //proxy_port_label->setFixedSize(proxy_port_label->sizeHint()); proxy_dir_layout->addWidget(proxy_port_label,0,3); proxyPort = new KLineEdit(proxy_hlp); proxy_dir_layout->addWidget(proxyPort,0,4); proxyPort->setText(proxyPortText); - + TQLabel *proxy_user_label = new TQLabel(i18n("User:"), proxy_hlp); //proxy_user_label->setFixedSize(proxy_user_label->sizeHint()); @@ -172,14 +172,14 @@ Freshklam::Freshklam(TQWidget *parent, const char *name) proxyUser = new KLineEdit(proxy_hlp); proxy_dir_layout->addWidget(proxyUser,1,1); proxyUser->setText(proxyUserText); - + TQLabel *proxy_pass_label = new TQLabel(i18n("Password:"), proxy_hlp); //proxy_pass_label->setFixedSize(proxy_pass_label->sizeHint()); proxy_dir_layout->addWidget(proxy_pass_label,1,3); proxyPass = new KLineEdit(proxy_hlp); proxy_dir_layout->addWidget(proxyPass,1,4); proxyPass->setText(proxyPassText); - + //Daemon Widget @@ -215,7 +215,7 @@ Freshklam::Freshklam(TQWidget *parent, const char *name) daemon_check_layout->addWidget(check_combo); - + TQLabel *combo_label = new TQLabel(i18n("Times a Day"), daemonhlp); //combo_label->setFixedSize(combo_label->sizeHint()); daemon_check_layout->addWidget(combo_label); @@ -253,7 +253,7 @@ Freshklam::Freshklam(TQWidget *parent, const char *name) Freshklam::~Freshklam() { - + if (daemon_box->isChecked()){ killPID(); } @@ -296,30 +296,30 @@ void Freshklam::processOutput() // -> Database updated if ((pos = item2.find("daily.cvd updated")) != -1 || (pos = item2.find("daily.cld updated")) != -1 ){ CollectionDB::instance()->insertEvent("Updates","Daily Database Updated",dir_combo->url()); - KNotifyClient::event(tdemain->_tray->winId(),"Virus Database Updated", "Updated Daily DB (1 out of 3)."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Updating Virues Databases..."), i18n("Updated Daily DB (1 out of 3).")); updateMailClient(); } if ((pos = item2.find("main.cvd updated")) != -1 || (pos = item2.find("main.cld updated")) != -1 ){ - KNotifyClient::event(tdemain->_tray->winId(),"Virus Database Updated", "Updated Main DB (2 out of 3)."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Updating Virues Databases..."), i18n("Updated Main DB (2 out of 3).")); } if ((pos = item2.find("bytecode.cvd updated")) != -1 || (pos = item2.find("bytecode.cld updated")) != -1 ){ - KNotifyClient::event(tdemain->_tray->winId(),"Virus Database Updated", "Updated Bytecode DB (3 out of 3)."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Updating Virues Databases..."), i18n("Updated Bytecode DB (3 out of 3).")); } // -> Database already up to date if ((pos = item2.find("daily.cvd database is up to date")) != -1 || (pos = item2.find("daily.cld database is up to date")) != -1){ - KNotifyClient::event(tdemain->_tray->winId(),"Database Up To Date", "Daily DB Up To Date (1 out of 3)."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Database is Up To Date"), i18n("Daily DB Up To Date (1 out of 3).")); updateMailClient(); } if ((pos = item2.find("main.cvd database is up to date")) != -1 || (pos = item2.find("main.cld database is up to date")) != -1){ - KNotifyClient::event(tdemain->_tray->winId(),"Database Up To Date", "Main DB Up To Date (2 out of 3)."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Database is Up To Date"), i18n("Main DB Up To Date (2 out of 3).")); } if ((pos = item2.find("bytecode.cvd database is up to date")) != -1 || (pos = item2.find("bytecode.cld database is up to date")) != -1){ - KNotifyClient::event(tdemain->_tray->winId(),"Database Up To Date", "Bytecode DB Up To Date (3 out of 3)."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Database is Up To Date"), i18n("Bytecode DB Up To Date (3 out of 3).")); } @@ -329,7 +329,7 @@ void Freshklam::processOutput() pos2 = item2.find('\n',pos); TQString version = item2.mid((pos+20),pos2 - (pos+20)).stripWhiteSpace(); - KNotifyClient::event(tdemain->_tray->winId(),"ClamAVOutDated", TQString("Your copy of ClamAV is out of date! Please Upgrade to ClamAV %1!").arg(version)); + KNotifyClient::event(tdemain->_tray->winId(), i18n("ClamAV Outdated!"), i18n(TQString("Your copy of ClamAV is out of date! Please Upgrade to ClamAV %1!").arg(version).latin1())); } @@ -343,15 +343,15 @@ void Freshklam::slotSearch() cancel_button->setEnabled(true); TQString filepattern = dir_combo->url(); - + CollectionDB::instance()->insertEvent("Updates","Commencing DB Update", filepattern); status_label->setText(i18n("Beginning Update...")); - - + + childproc = new KShellProcess(); TQString command = "freshclam --stdout "; - + TQString user = KUser().loginName(); command += " --user=" + user + " "; @@ -359,7 +359,7 @@ void Freshklam::slotSearch() command += " --datadir="; command += filepattern; } - + if (daemon_box->isChecked()){ command += " -d -c "; command += check_combo->currentText(); @@ -379,12 +379,12 @@ void Freshklam::slotSearch() writeConf(); command += " --config-file="; command += tempFileName; - + disableInputs(); - + *childproc << command; - + //kdDebug() << command << endl; childproc->start(TDEProcess::NotifyOnExit, TDEProcess::Stdout); @@ -393,7 +393,7 @@ void Freshklam::slotSearch() SLOT(childExited()) ); connect( childproc, SIGNAL(receivedStdout(TDEProcess *, char *, int)), SLOT(receivedOutput(TDEProcess *, char *, int)) ); - + tdemain->EnableFreshklam->setEnabled(FALSE); tdemain->DisableFreshklam->setEnabled(TRUE); @@ -416,7 +416,7 @@ void Freshklam::finish() TDEIO::NetAccess::del(tempFileName,NULL); CollectionDB::instance()->insertEvent("Updates","Virus Database Updated",dir_combo->url()); - KNotifyClient::event(tdemain->_tray->winId(),"Virus Database Updated", "Virus Database updated successfully."); + KNotifyClient::event(tdemain->_tray->winId(), i18n("Update Finished"), i18n("Virus Databases updated successfully.")); tdemain->EnableFreshklam->setEnabled(TRUE); tdemain->DisableFreshklam->setEnabled(FALSE); @@ -442,7 +442,7 @@ void Freshklam::updateMetaDB() void Freshklam::slotCancel() { finish(); - + if (daemon_box->isChecked()){ if (!(killPID())) KMessageBox::information (this,i18n( "There was a problem killing the update process!") ); @@ -455,7 +455,7 @@ void Freshklam::slotCancel() void Freshklam::processDied() { - + KMessageBox::information (this,i18n( "Update Process died unexpectedly! Did you kill it manually?" )); status_label->setText(i18n("Update Process Died Unexpectedly!")); @@ -474,13 +474,13 @@ void Freshklam::childExited() winid = TDEApplication::kApplication()->mainWidget()->winId(); }*/ finish(); - + if (daemon_box->isChecked()){ //KMessageBox::information (this,"Update Running in Background!", "Auto-Update","Don't Show Again"); processDied(); return; } - + if (status == 0){ //updateMailClient(); @@ -532,7 +532,7 @@ void Freshklam::updateMailClient() config->setGroup("Freshklam"); - + if (lastDownloadPaths.contains(dir_combo->/*currentText*/url()) == 0) { dir_combo->comboBox()->insertItem(dir_combo->/*currentText*/url(), 0); lastDownloadPaths.prepend(dir_combo->/*currentText*/url()); @@ -541,26 +541,26 @@ void Freshklam::updateMailClient() dir_combo->comboBox()->removeItem(dir_combo->comboBox()->count() - 1); } }else{ - + lastDownloadPaths.remove(dir_combo->url()); lastDownloadPaths.prepend(dir_combo->url()); } config->writeEntry("lastDownloadPaths", lastDownloadPaths); - + config->writeEntry("ProxyIP", proxyIP->text()); config->writeEntry("ProxyPort", proxyPort->text()); config->writeEntry("ProxyUser", proxyUser->text()); config->writeEntry("ProxyPass", proxyPass->text()); - + //KMessageBox::information (this,proxyIP->text()); config->sync(); - + TDEConfig* mailconfig = new TDEConfig("kmailrc"); mailconfig->setGroup("General"); TQVariant nooffilters = mailconfig->readEntry("filters"); - int result; + int result; int numfilters = nooffilters.toInt(); nooffilters = numfilters; for (int j=0; j != numfilters; j++ ){ @@ -573,8 +573,8 @@ void Freshklam::updateMailClient() if (pathonly == dir_combo->url()) break; if (binary.find(" " + dir_combo->url() + " ") == -1){ - - + + TQString path = getenv("HOME"); result = KMessageBox::warningContinueCancelList(this, i18n( "Since you have changed the database location, KlamAV needs to change the parameters used for mail scanning in KMail. The change is displayed below. If you have KMail open you will need to close it now so that the change can take effect. If you want to make the change manually just click 'Cancel'. "),TQString("New filter command: klammail -d %1").arg(dir_combo->url()),i18n( "Update KMail Filters" ),i18n( "Update" )); switch (result) { @@ -626,12 +626,12 @@ void Freshklam::writeConf() KMessageBox::information (this,i18n( "KMFilterActionWithCommand: Could not create temp file!" )); return; } - - - + + + //tf->setAutoDelete(TRUE); tempFileName = tf.name(); - + TQTextStream &ts = *(tf.textStream()); ts << "DatabaseMirror database.clamav.net" << "\n"; @@ -648,7 +648,7 @@ void Freshklam::writeConf() ts << TQString("HTTPProxyPassword %1").arg(proxyPass->text()) << "\n"; } } - } + } else return; } @@ -690,7 +690,7 @@ void Freshklam::handleChecks(){ } bool Freshklam::killPID(){ - + TQFile inf(pidFileName); if (!inf.open(IO_ReadOnly)) return false; @@ -750,7 +750,7 @@ TQString Freshklam::getCurrentDBDir(){ for (TQStringList::Iterator ita = lastDownloadPaths.begin(); ita == lastDownloadPaths.begin() ; ita++){ dbdir = *ita; } - + if (dbdir != dir_combo->url()){ /* load all available databases from default directory */ @@ -768,7 +768,7 @@ TQString Freshklam::getCurrentDBDir(){ }else db = dbdir; - + return db; @@ -799,16 +799,16 @@ void Freshklam::createDBDir(){ config->writeEntry("lastDownloadPaths", lastDownloadPaths); config->sync(); lastDownloadPaths = config->readListEntry("lastDownloadPaths"); - + } - + KMessageBox::information (this,TQString(ok ? i18n( "Your Virus Database location has been set up as '%1'. You can change this to something else if you want to." ) : i18n( "I cannot create the directory '%1' for you. Something is wrong with your HOME or klamav directory. You have to adjust your Virus Database directory by your self." )).arg(path)); if (ok){ int result = KMessageBox::warningContinueCancel(this, i18n( "Would you like to download the latest Virus Database to your new database location now? (You can do this later manually if you want.)"),i18n( "Download Virus Database" ),i18n( "Download" )); switch (result) { case 2 : KMessageBox::information (this,i18n( "You should update the database manually at your earliest convenience.") ); break; - case 5 : + case 5 : tdemain->firstDownload = true; break; @@ -849,7 +849,7 @@ Freshklam::getCurrentVersionOfClamAV( ) versionproc->setUsePty (KProcIO::Stdout,TRUE); *versionproc<<suCommand; - + connect( versionproc, SIGNAL(readReady(KProcIO *)), SLOT(readVersionLine(KProcIO *)) ); connect( versionproc, SIGNAL(processExited(TDEProcess *)), @@ -869,7 +869,7 @@ void Freshklam::readVersionLine(KProcIO *) { TQString lineout = ""; int pos; - + if ((pos = (versionproc->readln(lineout))) != -1) { if ((pos = (lineout.find("ClamAV"))) != -1){ lineout = lineout.stripWhiteSpace(); |