From 6a1bc5a8e05637d074b9158a0a79c42c92ee9eb0 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Thu, 28 Jan 2021 20:56:06 +0200 Subject: Virus Browser: Updated related HTML files and made them translatable.: Signed-off-by: Mavridis Philippe --- src/about/main.html | 122 +++++++++++++++++++++++++++++----------------------- src/about/nodb.html | 97 +++++++++++++++++++++-------------------- src/about/wait.html | 97 +++++++++++++++++++++-------------------- src/dbviewer.cpp | 77 ++++++++++++++++++++++++++++----- src/viewer.cpp | 17 ++++++++ src/viewer.h | 1 + 6 files changed, 256 insertions(+), 155 deletions(-) diff --git a/src/about/main.html b/src/about/main.html index ff19efb..0402824 100644 --- a/src/about/main.html +++ b/src/about/main.html @@ -1,53 +1,69 @@ - - - - - - - -KlamAV - - - -

KlamAV Virus Browser

Home
News
Download KlamAV
Download ClamAV
Security Notes










-

-

KlamAV's Virus Browser allows you to research - the viruses detected by ClamAV. With the virus browser you can:

-

* Right-click on a virus-name to choose whether to research a virus using Google or VirusPool.

-

* Right-click on a detected virus in the 'Scan' tab to research it in the virus browser.

-

* Right-click on a detected virus in the 'Quarantine' tab to research it in the virus browser.

-

-

NB: The filter on the top-left is experimental. Filtering can take a while so use with care!!

- -

Good Luck.

- -
- \ No newline at end of file + + + + + + + + + + %1 + + + + + + +
+
+
+
+
+ %1 +
+
+
+
+
+ + +
+
+
+
+
+ %1 +
    +
  • %1
  • +
  • %1
  • +
  • %1
  • +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/about/nodb.html b/src/about/nodb.html index fc95504..85c9859 100644 --- a/src/about/nodb.html +++ b/src/about/nodb.html @@ -1,46 +1,51 @@ - - - - - - - -KlamAV - - - -

KlamAV Virus Browser

Home
News
Download KlamAV
Download ClamAV
Security Notes










-

-THERE'S NO DATABASE TO LOAD - DOWNLOAD ONE USING THE UPDATES SECTION!! -

- -
- \ No newline at end of file + + + + + + + + + + %1 + + + + + + +
+
+
+
+
+ %1

%1 +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/about/wait.html b/src/about/wait.html index a7648e4..9b250ae 100644 --- a/src/about/wait.html +++ b/src/about/wait.html @@ -1,46 +1,51 @@ - - - - - - - -KlamAV - - - -

KlamAV Virus Browser

Home
News
Download KlamAV
Download ClamAV
Security Notes










-

-Please wait while the database loads... -

- -
- \ No newline at end of file + + + + + + + + + + %1 + + + + + + +
+
+
+
+
+ %1 +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/src/dbviewer.cpp b/src/dbviewer.cpp index e4e9525..d91dd42 100644 --- a/src/dbviewer.cpp +++ b/src/dbviewer.cpp @@ -12,6 +12,7 @@ #include "pageviewer.h" #include "tabwidget.h" #include "freshklam.h" +#include "version.h" #include "../config.h" #include @@ -692,7 +693,7 @@ void KlamDB::shouldIShow(TQWidget * current) { static struct cl_stat *dbstat=NULL; - TQString location; + TQString location, res; if ((current == this) && (!(loadinprogress))){ TQString db = tdemain->freshklam->getCurrentDBDir(); @@ -700,7 +701,26 @@ void KlamDB::shouldIShow(TQWidget * current) if (checkdir(db.ascii()) == -1){ kdDebug() << "returned -1" << endl; location = locate("data", "klamav/about/nodb.html"); - homepage->openURL(location); + res = homepage->loadFile(location); + + /* Stylesheets */ + res = res.arg( locate( "data", "klamav/about/klamav.css" ) ); + res = res.arg( locate( "data", "tdeui/about/kde_infopage.css" ) ); + if ( kapp->reverseLayout() ) + res = res.arg( "@import \"%1\";" ).arg( locate( "data", "tdeui/about/kde_infopage_rtl.css" ) ); + else + res = res.arg( "" ); + + + res = res.arg( i18n("Virus Browser") ) + .arg( i18n("Virus Browser") ) + .arg( i18n("Version ")+TQString(KLAMAV_VERSION) ) + .arg( i18n("The virus database could not be loaded.") ) + .arg( i18n("Please ensure that you have downloaded one (using the Updates section) and try again.") ); + + homepage->begin(); + homepage->write(res); + homepage->end(); return; } @@ -708,9 +728,28 @@ void KlamDB::shouldIShow(TQWidget * current) if ( ((cl_statchkdir(dbstat) == 1) || (dbstat == NULL))) { location = locate("data", "klamav/about/wait.html"); - homepage->openURL(location); + res = homepage->loadFile(location); + + /* Stylesheets */ + res = res.arg( locate( "data", "klamav/about/klamav.css" ) ); + res = res.arg( locate( "data", "tdeui/about/kde_infopage.css" ) ); + if ( kapp->reverseLayout() ) + res = res.arg( "@import \"%1\";" ).arg( locate( "data", "tdeui/about/kde_infopage_rtl.css" ) ); + else + res = res.arg( "" ); + + + res = res.arg( i18n("Virus Browser") ) + .arg( i18n("Virus Browser") ) + .arg( i18n("Version ")+TQString(KLAMAV_VERSION) ) + .arg( i18n("Please wait while the database loads...") ); + + homepage->begin(); + homepage->write(res); + homepage->end(); + + loadinprogress = true; - loadinprogress = true; sigs = ( int )getSigNos(); progress = new KProgressDialog (this, "progress", i18n( "Loading .." ), i18n( "Loading..." ), true); progress->setAllowCancel(false); @@ -750,13 +789,31 @@ void KlamDB::shouldIShow(TQWidget * current) loadinprogress = false; - // Default english - TQString location = locate( "data", "klamav/about/main-" + TDEGlobal::locale()->language() + ".html" ); - if( location != TQString::null ) - homepage->openURL( location ); - else - homepage->openURL( locate("data", "klamav/about/main.html") ); + location = locate("data", "klamav/about/main.html"); + res = homepage->loadFile(location); + + /* Stylesheets */ + res = res.arg( locate( "data", "klamav/about/klamav.css" ) ); + res = res.arg( locate( "data", "tdeui/about/kde_infopage.css" ) ); + if ( kapp->reverseLayout() ) + res = res.arg( "@import \"%1\";" ).arg( locate( "data", "tdeui/about/kde_infopage_rtl.css" ) ); + else + res = res.arg( "" ); + + + res = res.arg( i18n("Virus Browser") ) + .arg( i18n("Virus Browser") ) + .arg( i18n("Version ")+TQString(KLAMAV_VERSION) ) + .arg( i18n("KlamAV's Virus Browser allows you to research the viruses detected by ClamAV.") ) + .arg( i18n("Usage is simple:") ) + .arg( i18n("Right-click on a virus-name to choose whether to research a virus using Google or TrendMicro.") ) + .arg( i18n("Right-click on a detected virus in the 'Scan' tab to research it in the virus browser.") ) + .arg( i18n("Right-click on a detected virus in the 'Quarantine' tab to research it in the virus browser.") ); + + homepage->begin(); + homepage->write(res); + homepage->end(); } } } diff --git a/src/viewer.cpp b/src/viewer.cpp index f98fb79..dc31dce 100644 --- a/src/viewer.cpp +++ b/src/viewer.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include "viewer.h" @@ -67,6 +68,22 @@ bool Viewer::openURL(const KURL &url) return true; } +/* borrowed from Konqueror */ +TQString Viewer::loadFile( const TQString& file ) { + TQString res; + if( file.isEmpty() ) + return res; + + TQFile f(file); + + if( !f.open(IO_ReadOnly) ) + return res; + + TQTextStream t(&f); + res = t.read(); + + return res; +} bool Viewer::closeURL() { diff --git a/src/viewer.h b/src/viewer.h index f8ed799..eafb43a 100644 --- a/src/viewer.h +++ b/src/viewer.h @@ -26,6 +26,7 @@ namespace KlamAV Viewer(TQWidget* parent, const char* name); virtual bool closeURL(); virtual bool openURL(const KURL &); + TQString loadFile( const TQString& file ); /** used by the BrowserRun object to call TDEHTMLPart::openURL() */ void openPage(const KURL& url) { TDEHTMLPart::openURL(url);} -- cgit v1.2.1