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 <mavridisf@gmail.com>
pull/24/head
Mavridis Philippe 3 years ago
parent 20c78186de
commit 13b4879d7e
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -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);
}

@ -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();

@ -126,7 +126,6 @@ private slots:
void slotQuarantineSelected();
void slotAdvOptions();
void slotSchedule();
void slotVirusPool();
void slotGoogle();
//void patternTextChanged( const TQString &);
private:

@ -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);

@ -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:

@ -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;

@ -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();

Loading…
Cancel
Save