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 4 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 <kstandarddirs.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <kurl.h>
#define TAR_BLOCKSIZE 512 #define TAR_BLOCKSIZE 512
#define FILEBUFF 8192 #define FILEBUFF 8192
@ -87,16 +89,9 @@ KlamDB::KlamDB( TQWidget* parent, const char* name, bool modal, WFlags fl )
menu = new TQPopupMenu( VirusList ); menu = new TQPopupMenu( VirusList );
TQPixmap gicon; TQPixmap gicon;
TQPixmap vicon;
TQPixmap ticon; TQPixmap ticon;
TQString iconPath = locate("cache", KMimeType::favIconForURL("http://www.viruspool.net")+".png"); TQString iconPath = locate("cache", KMimeType::favIconForURL("http://www.google.com")+".png");
if ( iconPath.isEmpty() )
vicon = SmallIcon("edit-find");
else
vicon = TQPixmap( iconPath );
iconPath = locate("cache", KMimeType::favIconForURL("http://www.google.com")+".png");
if ( iconPath.isEmpty() ) if ( iconPath.isEmpty() )
gicon = SmallIcon("edit-find"); gicon = SmallIcon("edit-find");
else else
@ -108,11 +103,12 @@ KlamDB::KlamDB( TQWidget* parent, const char* name, bool modal, WFlags fl )
else else
ticon = TQPixmap( iconPath ); 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(ticon, i18n("Search with Trend Micro"), this,SLOT(slotTrendMicro()) );
menu->insertItem(gicon, i18n("Search with Google"), this,SLOT(slotGoogle()) ); 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 ) ), connect(VirusList, SIGNAL( contextMenuRequested( TQListViewItem *, const TQPoint& , int ) ),
this, SLOT( slotRMB( 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); 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() void KlamDB::slotGoogle()
{ {
TQString url = KURL::encode_string( VirusList->selectedItem()->text(0) );
TQString url = VirusList->selectedItem()->text(0); slotOpenPrefix(googlePrefix,"Google",url);
TQString prefix = TQString("http://www.google.com/search?ie=ISO-8859-1&q=");
slotOpenPrefix(prefix,"Google",url);
} }
void KlamDB::slotTrendMicro() void KlamDB::slotTrendMicro()
{ {
TQString url = VirusList->selectedItem()->text(0); TQString url = KURL::encode_string( VirusList->selectedItem()->text(0) );
TQString prefix = TQString("https://www.trendmicro.com/vinfo/us/threat-encyclopedia/search/"); slotOpenPrefix(tMicroPrefix,"TrendMicro",url);
slotOpenPrefix(prefix,"TrendMicro",url);
} }
void KlamDB::slotExternal(TQString name,TQString service) void KlamDB::slotExternal(TQString name,TQString service)
@ -959,14 +938,10 @@ void KlamDB::slotExternal(TQString name,TQString service)
tdemain->showVirusBrowser(); tdemain->showVirusBrowser();
shouldIShow(this); shouldIShow(this);
TQString prefix; TQString prefix;
if (service == "VirusPool") if (service == "Google")
prefix = TQString("http://www.viruspool.net/virus.cms?&name="); prefix = googlePrefix;
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=");
else else
prefix = TQString("http://www.trendmicro.com/vinfo/virusencyclo/default2.asp?m=q&virus="); prefix = tMicroPrefix;
slotOpenPrefix(prefix,service,name); slotOpenPrefix(prefix,service,name);
} }

@ -75,14 +75,14 @@ private:
void slotOpenPrefix(TQString prefix, TQString title,TQString url); void slotOpenPrefix(TQString prefix, TQString title,TQString url);
KlamAV::PageViewer* homepage; KlamAV::PageViewer* homepage;
bool loadinprogress; bool loadinprogress;
TQString googlePrefix;
TQString tMicroPrefix;
protected slots: protected slots:
virtual void languageChange(); virtual void languageChange();
void slotOpenTab(TQListViewItem * item , const TQPoint &point, int num ); void slotOpenTab(TQListViewItem * item , const TQPoint &point, int num );
void slotOpenTabPlain(const KURL& url, bool background = false); void slotOpenTabPlain(const KURL& url, bool background = false);
void slotTabCaption(const TQString &capt); void slotTabCaption(const TQString &capt);
void slotRMB( TQListViewItem* Item, const TQPoint & point, int num); void slotRMB( TQListViewItem* Item, const TQPoint & point, int num);
void slotVirusPool();
void slotVirusList();
void slotGoogle(); void slotGoogle();
void slotTrendMicro(); void slotTrendMicro();

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

@ -637,16 +637,12 @@ void Kuarantine::slotRMB( TQListViewItem* Item, const TQPoint & point, int )
if (Item->listView() == currentbox){ if (Item->listView() == currentbox){
qmenu->clear(); 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( 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->insertItem( gicon,i18n("Search for %1 with Google").arg(Item->text(1)), this, SLOT(slotGoogleCurrent()) );
qmenu->popup( point ); qmenu->popup( point );
}else if (Item->listView() == historybox){ }else if (Item->listView() == historybox){
hmenu->clear(); 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( 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()) ); 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() void Kuarantine::slotGoogleCurrent()
{ {
TQString name = currentbox->currentItem()->text(1); TQString name = currentbox->currentItem()->text(1);
@ -679,19 +663,6 @@ void Kuarantine::slotTrendMicroCurrent()
tdemain->klamdb->slotExternal(name, "TrendMicro"); 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() void Kuarantine::slotGoogleHistory()
{ {
TQString name = historybox->currentItem()->text(1); TQString name = historybox->currentItem()->text(1);

@ -126,14 +126,10 @@ private slots:
void slotClearHistory(); void slotClearHistory();
void slotDeleteHistory(); void slotDeleteHistory();
void updateLastQuarLocations(); void updateLastQuarLocations();
void slotVirusPoolCurrent();
void slotVirusListCurrent();
void slotGoogleCurrent(); void slotGoogleCurrent();
void slotTrendMicroCurrent(); void slotTrendMicroCurrent();
void slotVirusPoolHistory();
void slotGoogleHistory(); void slotGoogleHistory();
void slotTrendMicroHistory(); void slotTrendMicroHistory();
void slotVirusListHistory();
//void patternTextChanged( const TQString &); //void patternTextChanged( const TQString &);
private: private:

@ -794,9 +794,7 @@ void ScanViewer::slotRMB( TQListViewItem* Item, const TQPoint & point, int )
menu->clear(); menu->clear();
menu->insertItem( "Quarantine Selected", this,SLOT(slotQuarantineSelected()) ); 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( 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()) ); 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"); tdemain->klamdb->slotExternal(name, "Google");
} }
void ScanViewer::slotVirusPool()
{
TQString name = resultview->currentItem()->text(1);
tdemain->klamdb->slotExternal(name, "VirusPool");
}
void ScanViewer::slotTrendMicro() void ScanViewer::slotTrendMicro()
{ {
TQString name = resultview->currentItem()->text(1); TQString name = resultview->currentItem()->text(1);
tdemain->klamdb->slotExternal(name, "TrendMicro"); tdemain->klamdb->slotExternal(name, "TrendMicro");
} }
void ScanViewer::slotVirusList()
{
TQString name = resultview->currentItem()->text(1);
tdemain->klamdb->slotExternal(name, "VirusList");
}
void ScanViewer::slotStartAgain() void ScanViewer::slotStartAgain()
{ {
calculateTime = TRUE; calculateTime = TRUE;

@ -117,8 +117,6 @@ private slots:
void slotClear(); void slotClear();
void slotRMB( TQListViewItem *, const TQPoint &, int ); void slotRMB( TQListViewItem *, const TQPoint &, int );
void slotQuarantineSelected(); void slotQuarantineSelected();
void slotVirusPool();
void slotVirusList();
void slotGoogle(); void slotGoogle();
void slotTrendMicro(); void slotTrendMicro();
void slotCancelScanTime(); void slotCancelScanTime();

Loading…
Cancel
Save