diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2013-07-27 16:34:45 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-07-27 16:34:45 +0200 |
commit | d76ff81b7c1beffef0b84e570914c8f2d47834e6 (patch) | |
tree | 284b80ce7c5456fbb041f7979ac2c0baeead8902 /src/konqplugin | |
download | tork-d76ff81b7c1beffef0b84e570914c8f2d47834e6.tar.gz tork-d76ff81b7c1beffef0b84e570914c8f2d47834e6.zip |
Initial import of tork 0.33
Diffstat (limited to 'src/konqplugin')
-rw-r--r-- | src/konqplugin/Makefile.am | 14 | ||||
-rw-r--r-- | src/konqplugin/hi22-app-tork_konqueroroff.png | bin | 0 -> 3889 bytes | |||
-rw-r--r-- | src/konqplugin/hi22-app-tork_konqueroron.png | bin | 0 -> 3764 bytes | |||
-rw-r--r-- | src/konqplugin/hi48-app-tork_firefox.png | bin | 0 -> 4723 bytes | |||
-rw-r--r-- | src/konqplugin/hi48-app-tork_opera.png | bin | 0 -> 6176 bytes | |||
-rw-r--r-- | src/konqplugin/tork_plug_in.cpp | 197 | ||||
-rw-r--r-- | src/konqplugin/tork_plug_in.desktop | 15 | ||||
-rw-r--r-- | src/konqplugin/tork_plug_in.h | 81 | ||||
-rw-r--r-- | src/konqplugin/tork_plug_in.rc | 11 |
9 files changed, 318 insertions, 0 deletions
diff --git a/src/konqplugin/Makefile.am b/src/konqplugin/Makefile.am new file mode 100644 index 0000000..a00dedd --- /dev/null +++ b/src/konqplugin/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = khtml_tork.la + +khtml_tork_la_METASOURCES = AUTO +khtml_tork_la_SOURCES = tork_plug_in.cpp +khtml_tork_la_LIBADD = $(LIB_KHTML) +khtml_tork_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module + +KDE_ICON = AUTO + +part_DATA = tork_plug_in.rc tork_plug_in.desktop +partdir = $(kde_datadir)/khtml/kpartplugins + diff --git a/src/konqplugin/hi22-app-tork_konqueroroff.png b/src/konqplugin/hi22-app-tork_konqueroroff.png Binary files differnew file mode 100644 index 0000000..f0181c7 --- /dev/null +++ b/src/konqplugin/hi22-app-tork_konqueroroff.png diff --git a/src/konqplugin/hi22-app-tork_konqueroron.png b/src/konqplugin/hi22-app-tork_konqueroron.png Binary files differnew file mode 100644 index 0000000..fbb4411 --- /dev/null +++ b/src/konqplugin/hi22-app-tork_konqueroron.png diff --git a/src/konqplugin/hi48-app-tork_firefox.png b/src/konqplugin/hi48-app-tork_firefox.png Binary files differnew file mode 100644 index 0000000..e48d705 --- /dev/null +++ b/src/konqplugin/hi48-app-tork_firefox.png diff --git a/src/konqplugin/hi48-app-tork_opera.png b/src/konqplugin/hi48-app-tork_opera.png Binary files differnew file mode 100644 index 0000000..b5e97a5 --- /dev/null +++ b/src/konqplugin/hi48-app-tork_opera.png diff --git a/src/konqplugin/tork_plug_in.cpp b/src/konqplugin/tork_plug_in.cpp new file mode 100644 index 0000000..cee0681 --- /dev/null +++ b/src/konqplugin/tork_plug_in.cpp @@ -0,0 +1,197 @@ +/*************************************************************************** +** $Id: tork_plug_in.cpp,v 1.4 2008/07/31 19:56:28 hoganrobert Exp $ + * Copyright (C) 2006 - 2008 Robert Hogan * + * robert@roberthogan.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +/*************************************************************************** + kget_plug_in.cpp - description + ------------------- + begin : Wed Jul 3 22:09:28 CEST 2002 + copyright : (C) 2002 by Patrick + email : pch@valleeurpe.net + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "tork_plug_in.h" + +#include <dcopref.h> +#include <kdatastream.h> +#include <kdebug.h> +#include <khtml_part.h> +#include <kiconloader.h> +#include <kglobal.h> +#include <kaction.h> +#include <kinstance.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <krun.h> + +#include <dom/html_document.h> +#include <dom/html_misc.h> +#include <dom/dom_element.h> + +#include <kparts/partmanager.h> + +#include <set> + + +Tork_plug_in::Tork_plug_in( QObject* parent, const char* name ) + : Plugin( parent, name ) +{ + QPixmap pix = KGlobal::iconLoader()->loadIcon("tork", + KIcon::MainToolbar); + KActionMenu *menu = new KActionMenu( i18n("Anonymity Manager"), pix, + actionCollection(), "tork_menu" ); + menu->setDelayed( false ); + connect( menu->popupMenu(), SIGNAL( aboutToShow() ), SLOT( showPopup() )); + + m_paToggleKDE=new KAction(i18n("Anonymize KDE"), + KGlobal::iconLoader()->loadIconSet("tork_konqueroroff", KIcon::Small), + KShortcut(), + this, SLOT(toggleKDE()), + actionCollection(), "tork_konqueroron" ); + + menu->insert( m_paToggleKDE ); + + + KAction *m_firefox=new KAction(i18n("Re-Open Anonymously with Firefox"), + KGlobal::iconLoader()->loadIconSet("tork_firefox", KIcon::Small), + KShortcut(), + this, SLOT(openWithFirefox()), + actionCollection(), "tork_firefox" ); + menu->insert( m_firefox ); + + KAction *m_opera=new KAction(i18n("Re-Open Anonymously with Opera"), + KGlobal::iconLoader()->loadIconSet("tork_opera", KIcon::Small), + KShortcut(), + this, SLOT(openWithOpera()), + actionCollection(), "tork_opera" ); + menu->insert( m_opera ); + + p_dcopServer= new DCOPClient(); + p_dcopServer->attach (); +} + + +Tork_plug_in::~Tork_plug_in() +{ + p_dcopServer->detach(); + delete p_dcopServer; +} + + +void Tork_plug_in::showPopup() +{ + bool anonymized = false; + + if (p_dcopServer->isApplicationRegistered ("tork")) + { + DCOPRef tork( "tork", "DCOPTork" ); + anonymized = tork.call( "getKDESetting" ); + } + + if (anonymized){ + m_paToggleKDE->setIconSet( KGlobal::iconLoader()->loadIconSet("tork_konqueroroff", + KIcon::Small) ); + m_paToggleKDE->setText( "De-Anonymize KDE" ); + }else{ + m_paToggleKDE->setIconSet( KGlobal::iconLoader()->loadIconSet("tork_konqueroron", + KIcon::Small) ); + m_paToggleKDE->setText( "Anonymize KDE" ); + } +} + +void Tork_plug_in::openWithFirefox() +{ + + openWithBrowser("Firefox"); + +} + +void Tork_plug_in::openWithOpera() +{ + + openWithBrowser("Opera"); + +} + +void Tork_plug_in::openWithBrowser(const QString &browser) +{ + KHTMLPart *htmlPart = static_cast<KHTMLPart*>( parent() ); + QString url = htmlPart->toplevelURL().url(); + + if (p_dcopServer->isApplicationRegistered ("tork")){ + QString function = QString("anonymized%1").arg(browser); + DCOPRef("tork", "DCOPTork").send("startEverything"); + DCOPRef("tork", "DCOPTork").send(QCString(function),url); + }else + KRun::runCommand( QString("tork --anonymous%1 %2").arg(browser).arg(url), "tork", "tork" ); + +} + +void Tork_plug_in::toggleKDE() +{ + if (!p_dcopServer->isApplicationRegistered ("tork")) + KRun::runCommand("tork --toggleKDE"); + else + { + DCOPRef tork( "tork", "DCOPTork" ); + tork.send( "toggleKDESetting"); + } +} + + +KPluginFactory::KPluginFactory( QObject* parent, const char* name ) + : KLibFactory( parent, name ) +{ + s_instance = new KInstance("KPluginFactory"); +} + +QObject* KPluginFactory::createObject( QObject* parent, const char* name, const char*, const QStringList & ) +{ + QObject *obj = new Tork_plug_in( parent, name ); + return obj; +} + +KPluginFactory::~KPluginFactory() +{ + delete s_instance; +} + +extern "C" +{ + KDE_EXPORT void* init_khtml_tork() + { + KGlobal::locale()->insertCatalogue("tork"); + return new KPluginFactory; + } + +} + +KInstance* KPluginFactory::s_instance = 0L; + +#include "tork_plug_in.moc" diff --git a/src/konqplugin/tork_plug_in.desktop b/src/konqplugin/tork_plug_in.desktop new file mode 100644 index 0000000..4b2c518 --- /dev/null +++ b/src/konqplugin/tork_plug_in.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +X-KDE-Library=khtml_tork +X-KDE-PluginInfo-Author=Robert Hogan +X-KDE-PluginInfo-Email=robert@roberthogan.net +X-KDE-PluginInfo-Name=tork +X-KDE-PluginInfo-Version=3.4 +X-KDE-PluginInfo-Website=http://tork.sourceforge.net +X-KDE-PluginInfo-Category=Tools +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +Name=TorK +Type=Application +Comment=Anonymity Manager +Icon=khtml_tork diff --git a/src/konqplugin/tork_plug_in.h b/src/konqplugin/tork_plug_in.h new file mode 100644 index 0000000..4df506c --- /dev/null +++ b/src/konqplugin/tork_plug_in.h @@ -0,0 +1,81 @@ +/*************************************************************************** + ** $Id: tork_plug_in.h,v 1.4 2008/07/31 19:56:28 hoganrobert Exp $ + * Copyright (C) 2006 - 2008 Robert Hogan * + * robert@roberthogan.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +/*************************************************************************** + kget_plug_in.h - description + ------------------- + begin : Wed Jul 3 22:09:28 CEST 2002 + copyright : (C) 2002 by Patrick + email : pch@valleeurpe.net + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#ifndef __plugin_tork_plug_in_h +#define __plugin_tork_plug_in_h + +#include <kparts/plugin.h> +#include <klibloader.h> +#include <dcopclient.h> +#include <kurl.h> + +class KInstance; + +class Tork_plug_in : public KParts::Plugin +{ + Q_OBJECT +public: + Tork_plug_in( QObject* parent = 0, const char* name = 0 ); + KAction *m_paToggleKDE ; + DCOPClient* p_dcopServer; + virtual ~Tork_plug_in(); + +private slots: + void toggleKDE(); + void openWithBrowser(const QString&); + void openWithFirefox(); + void openWithOpera(); + void showPopup(); +}; + + +class KPluginFactory : public KLibFactory +{ + Q_OBJECT +public: + KPluginFactory( QObject *parent = 0, const char *name = 0 ); + ~KPluginFactory() ; + + virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, + const char* name = "QObject", + const QStringList &args = QStringList() ); + +private: + static KInstance* s_instance; +}; + +#endif diff --git a/src/konqplugin/tork_plug_in.rc b/src/konqplugin/tork_plug_in.rc new file mode 100644 index 0000000..8b803b5 --- /dev/null +++ b/src/konqplugin/tork_plug_in.rc @@ -0,0 +1,11 @@ +<!DOCTYPE kpartgui> +<kpartgui library="khtml_tork" name="khtml_tork" version="3" > +<MenuBar> + <Menu name="tools"><Text>&Tools</Text> + <Action name="tork_menu"/> + </Menu> +</MenuBar> +<ToolBar name="mainToolBar"> + <Action name="tork_menu"/> +</ToolBar> +</kpartgui> |