diff options
author | Mavridis Philippe <[email protected]> | 2021-01-14 21:14:15 +0200 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2021-01-14 21:14:15 +0200 |
commit | 13b4879d7e386d8591cd0c5ff3ff74cffe9aed34 (patch) | |
tree | 754bef330b3d7a5f09fe0a04412fd337fa9a456d | |
parent | 20c78186de6bb7963d5df866bb8c297ca7e3d46d (diff) | |
download | klamav-13b4879d7e386d8591cd0c5ff3ff74cffe9aed34.tar.gz klamav-13b4879d7e386d8591cd0c5ff3ff74cffe9aed34.zip |
Virus Browser: Reworked search engine slots.
Slots for obsolete search engines were removed and URLs for working
ones were put into variables (to make changing them easy).
Signed-off-by: Mavridis Philippe <[email protected]>
-rw-r--r-- | src/dbviewer.cpp | 51 | ||||
-rw-r--r-- | src/dbviewer.h | 4 | ||||
-rw-r--r-- | src/klamscan.hpre | 1 | ||||
-rw-r--r-- | src/kuarantine.cpp | 29 | ||||
-rw-r--r-- | src/kuarantine.h | 4 | ||||
-rw-r--r-- | src/scanviewer.cpp | 14 | ||||
-rw-r--r-- | src/scanviewer.h | 2 |
7 files changed, 15 insertions, 90 deletions
diff --git a/src/dbviewer.cpp b/src/dbviewer.cpp index eb8c1e5..64aec4e 100644 --- a/src/dbviewer.cpp +++ b/src/dbviewer.cpp @@ -32,6 +32,8 @@ #include <kstandarddirs.h> #include <kiconloader.h> +#include <kurl.h> + #define TAR_BLOCKSIZE 512 #define FILEBUFF 8192 @@ -87,16 +89,9 @@ KlamDB::KlamDB( TQWidget* parent, const char* name, bool modal, WFlags fl ) menu = new TQPopupMenu( VirusList ); TQPixmap gicon; - TQPixmap vicon; TQPixmap ticon; - TQString iconPath = locate("cache", KMimeType::favIconForURL("http://www.viruspool.net")+".png"); - if ( iconPath.isEmpty() ) - vicon = SmallIcon("edit-find"); - else - vicon = TQPixmap( iconPath ); - - iconPath = locate("cache", KMimeType::favIconForURL("http://www.google.com")+".png"); + TQString iconPath = locate("cache", KMimeType::favIconForURL("http://www.google.com")+".png"); if ( iconPath.isEmpty() ) gicon = SmallIcon("edit-find"); else @@ -108,11 +103,12 @@ KlamDB::KlamDB( TQWidget* parent, const char* name, bool modal, WFlags fl ) else ticon = TQPixmap( iconPath ); - menu->insertItem(vicon, i18n("Search in VirusList"), this,SLOT(slotVirusList()) ); - menu->insertItem(vicon, i18n("Search in VirusPool"), this,SLOT(slotVirusPool()) ); menu->insertItem(ticon, i18n("Search with Trend Micro"), this,SLOT(slotTrendMicro()) ); menu->insertItem(gicon, i18n("Search with Google"), this,SLOT(slotGoogle()) ); + googlePrefix = TQString::fromAscii("http://www.google.com/search?ie=ISO-8859-1&q="); + tMicroPrefix = TQString::fromAscii("https://www.trendmicro.com/vinfo/us/threat-encyclopedia/search/"); + connect(VirusList, SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint& , int ) ), this, SLOT( slotRMB( TQListViewItem *, const TQPoint &, int ) ) ); @@ -924,34 +920,17 @@ void KlamDB::slotOpenPrefix(TQString prefix, TQString title,TQString url) page->openURL(prefix+url); } -void KlamDB::slotVirusPool() -{ - TQString url = VirusList->selectedItem()->text(0); - TQString prefix = TQString("http://www.viruspool.net/virus.cms?&name="); - slotOpenPrefix(prefix,"VirusPool",url); -} - -void KlamDB::slotVirusList() -{ - TQString url = VirusList->selectedItem()->text(0); - TQString prefix = TQString("http://www.viruslist.com/en/find?search_mode=virus&words="); - slotOpenPrefix(prefix,"VirusList",url); -} - void KlamDB::slotGoogle() { - - TQString url = VirusList->selectedItem()->text(0); - TQString prefix = TQString("http://www.google.com/search?ie=ISO-8859-1&q="); - slotOpenPrefix(prefix,"Google",url); + TQString url = KURL::encode_string( VirusList->selectedItem()->text(0) ); + slotOpenPrefix(googlePrefix,"Google",url); } void KlamDB::slotTrendMicro() { - TQString url = VirusList->selectedItem()->text(0); - TQString prefix = TQString("https://www.trendmicro.com/vinfo/us/threat-encyclopedia/search/"); - slotOpenPrefix(prefix,"TrendMicro",url); + TQString url = KURL::encode_string( VirusList->selectedItem()->text(0) ); + slotOpenPrefix(tMicroPrefix,"TrendMicro",url); } void KlamDB::slotExternal(TQString name,TQString service) @@ -959,14 +938,10 @@ void KlamDB::slotExternal(TQString name,TQString service) tdemain->showVirusBrowser(); shouldIShow(this); TQString prefix; - if (service == "VirusPool") - prefix = TQString("http://www.viruspool.net/virus.cms?&name="); - else if (service == "Google") - prefix = TQString("http://www.google.com/search?ie=ISO-8859-1&q="); - else if (service == "VirusList") - prefix = TQString("http://www.viruslist.com/en/find?search_mode=virus&words="); + if (service == "Google") + prefix = googlePrefix; else - prefix = TQString("http://www.trendmicro.com/vinfo/virusencyclo/default2.asp?m=q&virus="); + prefix = tMicroPrefix; slotOpenPrefix(prefix,service,name); } diff --git a/src/dbviewer.h b/src/dbviewer.h index 63a33d5..d647bbe 100644 --- a/src/dbviewer.h +++ b/src/dbviewer.h @@ -75,14 +75,14 @@ private: void slotOpenPrefix(TQString prefix, TQString title,TQString url); KlamAV::PageViewer* homepage; bool loadinprogress; + TQString googlePrefix; + TQString tMicroPrefix; protected slots: virtual void languageChange(); void slotOpenTab(TQListViewItem * item , const TQPoint &point, int num ); void slotOpenTabPlain(const KURL& url, bool background = false); void slotTabCaption(const TQString &capt); void slotRMB( TQListViewItem* Item, const TQPoint & point, int num); - void slotVirusPool(); - void slotVirusList(); void slotGoogle(); void slotTrendMicro(); diff --git a/src/klamscan.hpre b/src/klamscan.hpre index 94f4d17..cd36662 100644 --- a/src/klamscan.hpre +++ b/src/klamscan.hpre @@ -126,7 +126,6 @@ private slots: void slotQuarantineSelected(); void slotAdvOptions(); void slotSchedule(); - void slotVirusPool(); void slotGoogle(); //void patternTextChanged( const TQString &); private: diff --git a/src/kuarantine.cpp b/src/kuarantine.cpp index 03b0847..b25db2c 100644 --- a/src/kuarantine.cpp +++ b/src/kuarantine.cpp @@ -637,16 +637,12 @@ void Kuarantine::slotRMB( TQListViewItem* Item, const TQPoint & point, int ) if (Item->listView() == currentbox){ qmenu->clear(); - qmenu->insertItem( vlicon,i18n("Search for %1 with VirusList").arg(Item->text(1)), this, SLOT(slotVirusListCurrent()) ); - qmenu->insertItem( vicon,i18n("Search for %1 with VirusPool").arg(Item->text(1)), this, SLOT(slotVirusPoolCurrent()) ); qmenu->insertItem( ticon,i18n("Search for %1 with Trend Micro").arg(Item->text(1)), this, SLOT(slotTrendMicroCurrent()) ); qmenu->insertItem( gicon,i18n("Search for %1 with Google").arg(Item->text(1)), this, SLOT(slotGoogleCurrent()) ); qmenu->popup( point ); }else if (Item->listView() == historybox){ hmenu->clear(); - hmenu->insertItem( vicon,i18n("Search for %1 with VirusPool").arg(Item->text(1)), this, SLOT(slotVirusPoolHistory()) ); - hmenu->insertItem( vicon,i18n("Search for %1 with VirusList").arg(Item->text(1)), this, SLOT(slotVirusListHistory()) ); hmenu->insertItem( ticon,i18n("Search for %1 with Trend Micro").arg(Item->text(1)), this, SLOT(slotTrendMicroHistory()) ); hmenu->insertItem( gicon,i18n("Search for %1 with Google").arg(Item->text(1)), this, SLOT(slotGoogleHistory()) ); @@ -655,18 +651,6 @@ void Kuarantine::slotRMB( TQListViewItem* Item, const TQPoint & point, int ) } } -void Kuarantine::slotVirusPoolCurrent() -{ - TQString name = currentbox->currentItem()->text(1); - tdemain->klamdb->slotExternal(name,"VirusPool"); -} - -void Kuarantine::slotVirusListCurrent() -{ - TQString name = currentbox->currentItem()->text(1); - tdemain->klamdb->slotExternal(name,"VirusList"); -} - void Kuarantine::slotGoogleCurrent() { TQString name = currentbox->currentItem()->text(1); @@ -679,19 +663,6 @@ void Kuarantine::slotTrendMicroCurrent() tdemain->klamdb->slotExternal(name, "TrendMicro"); } - -void Kuarantine::slotVirusPoolHistory() -{ - TQString name = historybox->currentItem()->text(1); - tdemain->klamdb->slotExternal(name,"VirusPool"); -} - -void Kuarantine::slotVirusListHistory() -{ - TQString name = historybox->currentItem()->text(1); - tdemain->klamdb->slotExternal(name,"VirusList"); -} - void Kuarantine::slotGoogleHistory() { TQString name = historybox->currentItem()->text(1); diff --git a/src/kuarantine.h b/src/kuarantine.h index 060442a..e8eda63 100644 --- a/src/kuarantine.h +++ b/src/kuarantine.h @@ -126,14 +126,10 @@ private slots: void slotClearHistory(); void slotDeleteHistory(); void updateLastQuarLocations(); - void slotVirusPoolCurrent(); - void slotVirusListCurrent(); void slotGoogleCurrent(); void slotTrendMicroCurrent(); - void slotVirusPoolHistory(); void slotGoogleHistory(); void slotTrendMicroHistory(); - void slotVirusListHistory(); //void patternTextChanged( const TQString &); private: diff --git a/src/scanviewer.cpp b/src/scanviewer.cpp index ca2df18..bf00eca 100644 --- a/src/scanviewer.cpp +++ b/src/scanviewer.cpp @@ -794,9 +794,7 @@ void ScanViewer::slotRMB( TQListViewItem* Item, const TQPoint & point, int ) menu->clear(); menu->insertItem( "Quarantine Selected", this,SLOT(slotQuarantineSelected()) ); - menu->insertItem( vlicon,i18n("Search for %1 with VirusList").arg(Item->text(1)), this, SLOT(slotVirusList()) ); - menu->insertItem( vicon,i18n("Search for %1 with VirusPool").arg(Item->text(1)), this, SLOT(slotVirusPool()) ); menu->insertItem( ticon,i18n("Search for %1 with Trend Micro").arg(Item->text(1)), this, SLOT(slotTrendMicro()) ); menu->insertItem( gicon,i18n("Search for %1 with Google").arg(Item->text(1)), this, SLOT(slotGoogle()) ); @@ -835,24 +833,12 @@ void ScanViewer::slotGoogle() tdemain->klamdb->slotExternal(name, "Google"); } -void ScanViewer::slotVirusPool() -{ - TQString name = resultview->currentItem()->text(1); - tdemain->klamdb->slotExternal(name, "VirusPool"); -} - void ScanViewer::slotTrendMicro() { TQString name = resultview->currentItem()->text(1); tdemain->klamdb->slotExternal(name, "TrendMicro"); } -void ScanViewer::slotVirusList() -{ - TQString name = resultview->currentItem()->text(1); - tdemain->klamdb->slotExternal(name, "VirusList"); -} - void ScanViewer::slotStartAgain() { calculateTime = TRUE; diff --git a/src/scanviewer.h b/src/scanviewer.h index 7dc1306..fa85e6b 100644 --- a/src/scanviewer.h +++ b/src/scanviewer.h @@ -117,8 +117,6 @@ private slots: void slotClear(); void slotRMB( TQListViewItem *, const TQPoint &, int ); void slotQuarantineSelected(); - void slotVirusPool(); - void slotVirusList(); void slotGoogle(); void slotTrendMicro(); void slotCancelScanTime(); |