summaryrefslogtreecommitdiffstats
path: root/konq-plugins/uachanger
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /konq-plugins/uachanger
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/uachanger')
-rw-r--r--konq-plugins/uachanger/Makefile.am17
-rw-r--r--konq-plugins/uachanger/uachangerplugin.cpp436
-rw-r--r--konq-plugins/uachanger/uachangerplugin.desktop121
-rw-r--r--konq-plugins/uachanger/uachangerplugin.h95
-rw-r--r--konq-plugins/uachanger/uachangerplugin.rc11
5 files changed, 680 insertions, 0 deletions
diff --git a/konq-plugins/uachanger/Makefile.am b/konq-plugins/uachanger/Makefile.am
new file mode 100644
index 0000000..80e2c2b
--- /dev/null
+++ b/konq-plugins/uachanger/Makefile.am
@@ -0,0 +1,17 @@
+kde_module_LTLIBRARIES = libuachangerplugin.la
+
+AM_CPPFLAGS = $(all_includes)
+METASOURCES = AUTO
+
+libuachangerplugin_la_SOURCES = uachangerplugin.cpp
+libuachangerplugin_la_LIBADD = $(LIB_KPARTS) $(LIB_KHTML)
+libuachangerplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+pluginsdir = $(kde_datadir)/khtml/kpartplugins
+plugins_DATA = uachangerplugin.rc uachangerplugin.desktop
+
+appsdir = $(kde_appsdir)/.hidden
+apps_DATA = uachangerplugin.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/uachangerplugin.pot
diff --git a/konq-plugins/uachanger/uachangerplugin.cpp b/konq-plugins/uachanger/uachangerplugin.cpp
new file mode 100644
index 0000000..b929930
--- /dev/null
+++ b/konq-plugins/uachanger/uachangerplugin.cpp
@@ -0,0 +1,436 @@
+/*
+ Copyright (c) 2001 Dawit Alemayehu <adawit@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License (LGPL) as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <sys/utsname.h>
+
+#include <qregexp.h>
+
+#include <krun.h>
+#include <kdebug.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <ktrader.h>
+#include <kconfig.h>
+#include <kio/job.h>
+#include <kservice.h>
+#include <kinstance.h>
+#include <kpopupmenu.h>
+#include <dcopref.h>
+#include <khtml_part.h>
+#include <kgenericfactory.h>
+#include <kprotocolmanager.h>
+#include <kaboutdata.h>
+
+#include "uachangerplugin.h"
+
+typedef KGenericFactory<UAChangerPlugin> UAChangerPluginFactory;
+static const KAboutData aboutdata("uachangerplugin", I18N_NOOP("Change Browser Identification") , "1.0" );
+K_EXPORT_COMPONENT_FACTORY (libuachangerplugin, UAChangerPluginFactory (&aboutdata))
+
+
+#define UA_PTOS(x) (*it)->property(x).toString()
+#define QFL1(x) QString::fromLatin1(x)
+
+
+UAChangerPlugin::UAChangerPlugin( QObject* parent, const char* name,
+ const QStringList & )
+ :KParts::Plugin( parent, name ),
+ m_bSettingsLoaded(false), m_part(0L), m_config(0L)
+{
+ setInstance(UAChangerPlugin::instance());
+
+ m_pUAMenu = new KActionMenu( i18n("Change Browser &Identification"), "agent",
+ actionCollection(), "changeuseragent" );
+ m_pUAMenu->setDelayed( false );
+ connect( m_pUAMenu->popupMenu(), SIGNAL( aboutToShow() ),
+ this, SLOT( slotAboutToShow() ) );
+
+ m_pUAMenu->setEnabled ( false );
+
+ if ( parent && parent->inherits( "KHTMLPart" ) )
+ {
+ m_part = static_cast<KHTMLPart*>(parent);
+ connect( m_part, SIGNAL(started(KIO::Job*)), this,
+ SLOT(slotStarted(KIO::Job*)) );
+ }
+}
+
+UAChangerPlugin::~UAChangerPlugin()
+{
+ saveSettings();
+ slotReloadDescriptions();
+}
+
+void UAChangerPlugin::slotReloadDescriptions()
+{
+ delete m_config;
+ m_config = 0L;
+}
+
+void UAChangerPlugin::parseDescFiles()
+{
+ KTrader::OfferList list = KTrader::self()->query("UserAgentStrings");
+ if ( list.count() == 0 )
+ return;
+
+ m_mapAlias.clear();
+ m_lstAlias.clear();
+ m_lstIdentity.clear();
+
+ struct utsname utsn;
+ uname( &utsn );
+
+ QStringList languageList = KGlobal::locale()->languageList();
+ if ( languageList.count() )
+ {
+ QStringList::Iterator it = languageList.find(QFL1("C"));
+ if( it != languageList.end() )
+ {
+ if( languageList.contains( QFL1("en") ) > 0 )
+ languageList.remove( it );
+ else
+ (*it) = QFL1("en");
+ }
+ }
+
+ KTrader::OfferList::ConstIterator it = list.begin();
+ KTrader::OfferList::ConstIterator lastItem = list.end();
+
+ for ( ; it != lastItem; ++it )
+ {
+ QString tmp = UA_PTOS("X-KDE-UA-FULL");
+ QString tag = UA_PTOS("X-KDE-UA-TAG");
+
+ if(tag != "IE" && tag != "NN" && tag != "MOZ")
+ tag = "OTHER";
+
+ if ( (*it)->property("X-KDE-UA-DYNAMIC-ENTRY").toBool() )
+ {
+ tmp.replace( QFL1("appSysName"), QFL1(utsn.sysname) );
+ tmp.replace( QFL1("appSysRelease"), QFL1(utsn.release) );
+ tmp.replace( QFL1("appMachineType"), QFL1(utsn.machine) );
+ tmp.replace( QFL1("appLanguage"), languageList.join(QFL1(", ")) );
+ tmp.replace( QFL1("appPlatform"), QFL1("X11") );
+ }
+
+ if ( m_lstIdentity.contains(tmp) )
+ continue; // Ignore dups!
+
+ m_lstIdentity << tmp;
+ tmp = QString("%1 %2").arg(UA_PTOS("X-KDE-UA-SYSNAME")).arg(UA_PTOS("X-KDE-UA-SYSRELEASE"));
+
+ if ( tmp.stripWhiteSpace().isEmpty() )
+ {
+ if(tag == "NN" || tag == "IE" || tag == "MOZ")
+ tmp = i18n("Version %1").arg(UA_PTOS("X-KDE-UA-VERSION"));
+ else
+ tmp = QString("%1 %2").arg(UA_PTOS("X-KDE-UA-NAME")).arg(UA_PTOS("X-KDE-UA-VERSION"));
+ }
+ else
+ {
+ if(tag == "NN" || tag == "IE" || tag == "MOZ")
+ tmp = i18n("Version %1 on %2").arg(UA_PTOS("X-KDE-UA-VERSION")).arg(tmp);
+ else
+ tmp = i18n("%1 %2 on %3").arg(UA_PTOS("X-KDE-UA-NAME")).arg(UA_PTOS("X-KDE-UA-VERSION")).arg(tmp);
+ }
+
+ m_lstAlias << tmp;
+
+ /* sort in this UA Alias alphabetically */
+ BrowserGroup ualist = m_mapAlias[tag];
+ BrowserGroup::Iterator e = ualist.begin();
+ while ( !tmp.isEmpty() && e != ualist.end() )
+ {
+ if ( m_lstAlias[(*e)] > tmp ) {
+ ualist.insert( e, m_lstAlias.count()-1 );
+ tmp = QString::null;
+ }
+ ++e;
+ }
+
+ if ( !tmp.isEmpty() )
+ ualist.append( m_lstAlias.count()-1 );
+
+ m_mapAlias[tag] = ualist;
+
+ if(tag == "OTHER")
+ m_mapBrowser[tag] = i18n("Other");
+ else
+ m_mapBrowser[tag] = UA_PTOS("X-KDE-UA-NAME");
+
+ }
+}
+
+void UAChangerPlugin::slotStarted( KIO::Job* )
+{
+ m_currentURL = m_part->url();
+
+ // This plugin works on local files, http[s], and webdav[s].
+ QString proto = m_currentURL.protocol();
+ if (m_currentURL.isLocalFile() ||
+ proto.startsWith("http") || proto.startsWith("webdav"))
+ {
+ if (!m_pUAMenu->isEnabled())
+ m_pUAMenu->setEnabled ( true );
+ }
+ else
+ {
+ m_pUAMenu->setEnabled ( false );
+ }
+}
+
+void UAChangerPlugin::slotAboutToShow()
+{
+ if (!m_config)
+ {
+ m_config = new KConfig( "kio_httprc" );
+ parseDescFiles();
+ }
+
+ if (!m_bSettingsLoaded)
+ loadSettings();
+
+ int count = 0;
+ m_pUAMenu->popupMenu()->clear();
+ m_pUAMenu->popupMenu()->insertTitle(i18n("Identify As")); // imho title doesn't need colon..
+
+ QString host = m_currentURL.isLocalFile() ? QFL1("localhost") : m_currentURL.host();
+ m_currentUserAgent = KProtocolManager::userAgentForHost(host);
+ //kdDebug(90130) << "User Agent: " << m_currentUserAgent << endl;
+
+ int id = m_pUAMenu->popupMenu()->insertItem( i18n("Default Identification"), this,
+ SLOT(slotDefault()), 0, ++count );
+ if( m_currentUserAgent == KProtocolManager::defaultUserAgent() )
+ m_pUAMenu->popupMenu()->setItemChecked(id, true);
+
+ m_pUAMenu->popupMenu()->insertSeparator();
+
+ AliasConstIterator map = m_mapAlias.begin();
+ for( ; map != m_mapAlias.end(); ++map )
+ {
+ KPopupMenu *browserMenu = new KPopupMenu;
+ BrowserGroup::ConstIterator e = map.data().begin();
+ for( ; e != map.data().end(); ++e )
+ {
+ int id = browserMenu->insertItem( m_lstAlias[*e], this, SLOT(slotItemSelected(int)), 0, *e );
+ if (m_lstIdentity[(*e)] == m_currentUserAgent)
+ browserMenu->setItemChecked(id, true);
+ }
+ m_pUAMenu->popupMenu()->insertItem( m_mapBrowser[map.key()], browserMenu );
+ }
+
+ m_pUAMenu->popupMenu()->insertSeparator();
+
+ /* useless here, imho..
+ m_pUAMenu->popupMenu()->insertItem( i18n("Reload Identifications"), this,
+ SLOT(slotReloadDescriptions()),
+ 0, ++count );*/
+
+ m_pUAMenu->popupMenu()->insertItem( i18n("Apply to Entire Site"), this,
+ SLOT(slotApplyToDomain()),
+ 0, ++count );
+ m_pUAMenu->popupMenu()->setItemChecked(count, m_bApplyToDomain);
+
+ m_pUAMenu->popupMenu()->insertItem( i18n("Configure..."), this,
+ SLOT(slotConfigure()));
+
+}
+
+void UAChangerPlugin::slotConfigure()
+{
+ KService::Ptr service = KService::serviceByDesktopName ("useragent");
+ if (service)
+ KRun::runCommand (service->exec ());
+}
+
+void UAChangerPlugin::slotItemSelected( int id )
+{
+ if (m_lstIdentity[id] == m_currentUserAgent) return;
+
+ QString host;
+ m_currentUserAgent = m_lstIdentity[id];
+ host = m_currentURL.isLocalFile() ? QFL1("localhost") : filterHost( m_currentURL.host() );
+
+ m_config->setGroup( host.lower() );
+ m_config->writeEntry( "UserAgent", m_currentUserAgent );
+ m_config->sync();
+
+ // Update the io-slaves...
+ updateIOSlaves ();
+
+ // Reload the page with the new user-agent string
+ m_part->openURL( m_currentURL );
+}
+
+void UAChangerPlugin::slotDefault()
+{
+ if( m_currentUserAgent == KProtocolManager::defaultUserAgent() ) return; // don't flicker!
+ // We have no choice but delete all higher domain level settings here since it
+ // affects what will be matched.
+ QStringList partList = QStringList::split('.', m_currentURL.host(), false);
+
+ if ( !partList.isEmpty() )
+ {
+ partList.remove(partList.begin());
+
+ QStringList domains;
+ // Remove the exact name match...
+ domains << m_currentURL.host ();
+
+ while (partList.count())
+ {
+ if (partList.count() == 2)
+ if (partList[0].length() <=2 && partList[1].length() ==2)
+ break;
+
+ if (partList.count() == 1)
+ break;
+
+ domains << partList.join(QFL1("."));
+ partList.remove(partList.begin());
+ }
+
+ for (QStringList::Iterator it = domains.begin(); it != domains.end(); it++)
+ {
+ //kdDebug () << "Domain to remove: " << *it << endl;
+ if ( m_config->hasGroup(*it) )
+ m_config->deleteGroup(*it);
+ else if( m_config->hasKey(*it) )
+ m_config->deleteEntry(*it);
+ }
+ }
+ else
+ if ( m_currentURL.isLocalFile() && m_config->hasGroup( "localhost" ) )
+ m_config->deleteGroup( "localhost" );
+
+ m_config->sync();
+
+ // Reset some internal variables and inform the http io-slaves of the changes.
+ m_currentUserAgent = KProtocolManager::defaultUserAgent();
+
+ // Update the http io-slaves.
+ updateIOSlaves();
+
+ // Reload the page with the default user-agent
+ m_part->openURL( m_currentURL );
+}
+
+void UAChangerPlugin::updateIOSlaves ()
+{
+ // Inform running http(s) io-slaves about the change...
+ if (!DCOPRef("*", "KIO::Scheduler").send("reparseSlaveConfiguration", QString::null))
+ kdWarning() << "UAChangerPlugin::updateIOSlaves: Unable to update running application!" << endl;
+}
+
+QString UAChangerPlugin::filterHost(const QString &hostname)
+{
+ QRegExp rx;
+
+ // Check for IPv4 address
+ rx.setPattern ("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}");
+ if (rx.exactMatch (hostname))
+ return hostname;
+
+ // Check for IPv6 address here...
+ rx.setPattern ("^\\[.*\\]$");
+ if (rx.exactMatch (hostname))
+ return hostname;
+
+ // Return the TLD if apply to domain or
+ return (m_bApplyToDomain ? findTLD(hostname): hostname);
+}
+
+QString UAChangerPlugin::findTLD (const QString &hostname)
+{
+ QStringList domains;
+ QStringList partList = QStringList::split('.', hostname, false);
+
+ if (partList.count())
+ partList.remove(partList.begin()); // Remove hostname
+
+ while(partList.count())
+ {
+ // We only have a TLD left.
+ if (partList.count() == 1)
+ break;
+
+ if( partList.count() == 2 )
+ {
+ // The .name domain uses <name>.<surname>.name
+ // Although the TLD is striclty speaking .name, for our purpose
+ // it should be <surname>.name since people should not be able
+ // to set cookies for everyone with the same surname.
+ // Matches <surname>.name
+ if( partList[1].lower() == QFL1("name") )
+ {
+ break;
+ }
+ else if( partList[1].length() == 2 )
+ {
+ // If this is a TLD, we should stop. (e.g. co.uk)
+ // We assume this is a TLD if it ends with .xx.yy or .x.yy
+ if (partList[0].length() <= 2)
+ break; // This is a TLD.
+
+ // Catch some TLDs that we miss with the previous check
+ // e.g. com.au, org.uk, mil.co
+ QCString t = partList[0].lower().utf8();
+ if ((t == "com") || (t == "net") || (t == "org") || (t == "gov") ||
+ (t == "edu") || (t == "mil") || (t == "int"))
+ break;
+ }
+ }
+
+ domains.append(partList.join(QFL1(".")));
+ partList.remove(partList.begin()); // Remove part
+ }
+
+ if( domains.isEmpty() )
+ return hostname;
+
+ return domains[0];
+}
+
+void UAChangerPlugin::saveSettings()
+{
+ if(!m_bSettingsLoaded) return;
+
+ KConfig cfg ("uachangerrc", false, false);
+ cfg.setGroup ("General");
+
+ cfg.writeEntry ("applyToDomain", m_bApplyToDomain);
+}
+
+void UAChangerPlugin::loadSettings()
+{
+ KConfig cfg ("uachangerrc", false, false);
+ cfg.setGroup ("General");
+
+ m_bApplyToDomain = cfg.readBoolEntry ("applyToDomain", true);
+ m_bSettingsLoaded = true;
+}
+
+void UAChangerPlugin::slotApplyToDomain()
+{
+ m_bApplyToDomain = !m_bApplyToDomain;
+}
+
+#include "uachangerplugin.moc"
diff --git a/konq-plugins/uachanger/uachangerplugin.desktop b/konq-plugins/uachanger/uachangerplugin.desktop
new file mode 100644
index 0000000..9b15127
--- /dev/null
+++ b/konq-plugins/uachanger/uachangerplugin.desktop
@@ -0,0 +1,121 @@
+[Desktop Entry]
+X-KDE-Library=UserAgentChanger
+X-KDE-PluginInfo-Author=Dawit Alemayehu
+X-KDE-PluginInfo-Email=adawit@kde.org
+X-KDE-PluginInfo-Name=UserAgentChanger
+X-KDE-PluginInfo-Version=3.3
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=Tools
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+Name=UserAgent Changer
+Name[bs]=Promjena identifikacije preglednika
+Name[ca]=Canvia l'agent d'usuari
+Name[cs]=Změna uživatelského agenta
+Name[da]=Ændring af brugeragent
+Name[de]=Browserkennung ändern
+Name[el]=Αλλαγή πράκτορα χρήστη
+Name[eo]=Uzantagenta ŝanĝilo
+Name[es]=Cambiador de la identificación del agente usuario
+Name[et]=Identifikaatori muutja
+Name[eu]=Erabiltzaile agentearen aldatzailea
+Name[fa]=تغییردهندۀ عامل کاربر
+Name[fi]=Käyttäjäagenttimuuttaja
+Name[fr]=Changeur d'identité du navigateur
+Name[fy]=Brûkersagint wizigje
+Name[ga]=Clár Athraithe UserAgent
+Name[gl]=Cámbio de Identificación do Navegador
+Name[he]=משנה זיהוי דפדפן
+Name[hi]=यूज़रएजेंट परिवर्तक
+Name[hr]=Izmjenjivač korisničkog agenta
+Name[hu]=A böngészőazonosító átváltása
+Name[is]=Auðkenni vafra
+Name[it]=Modificatore di User Agent
+Name[ja]=ユーザエージェント チェンジャー
+Name[ka]=UserAgent შემცვლელი
+Name[kk]=UserAgent ауыстырғышы
+Name[km]=កម្មវិធី​ផ្លាស់ប្ដូរ​ភ្នាក់ងារ​អ្នកប្រើ
+Name[lt]=Naudotojo agento keitiklis
+Name[mk]=Менувач на кориснички агент
+Name[nb]=Brukeragent-endring
+Name[nds]=Nettkieker-Kennen ännern
+Name[ne]=प्रयोगकर्ता अभिकर्ता परिवर्तक
+Name[nl]=Gebruikersagent wijzigen
+Name[nn]=Endring av brukaragent
+Name[pa]=ਉਪਭੋਗੀ ਏਜੰਟ ਤਬਦੀਲੀਕਾਰ
+Name[pl]=Zmiana identyfikacji przeglądarki
+Name[pt]=Mudança de Agente do Utilizador
+Name[pt_BR]=Modificar de Agente de Usuários
+Name[ru]=Смена идентификации браузера (UserAgent)
+Name[sk]=Zmena identifikácie prehliadača
+Name[sl]=Spreminjanje uporabniškega agenta
+Name[sr]=Измењивач корисничког агента
+Name[sr@Latn]=Izmenjivač korisničkog agenta
+Name[sv]=Ändring av användaragent
+Name[ta]=பயனர் முகவர் மாற்றி
+Name[tg]=Ивазкунии нишондиҳандаҳои воқеанигор (UserAgent)
+Name[tr]=KullanıcıAjanı Değiştiricisi
+Name[uk]=Селектор агента користувача
+Name[vi]=Bộ đổi UserAgent
+Name[zh_CN]=用户代理更换器
+Comment=Plugin for changing the user agent
+Comment[af]=Inplak vir verandering die gebruiker agent
+Comment[az]=İstifadəçi alıcısını dəyişdirmək üçün əlavə
+Comment[bg]=Приставка за смяна на идентификацията на браузъра
+Comment[bs]=Dodatak za promijenju identifikacije preglednika
+Comment[ca]=Connector per a modificar l'agent d'usuari
+Comment[cs]=Modul pro změnu uživatelského agenta
+Comment[cy]=Ategyn i newid asiant y defnyddiwr
+Comment[da]=Plugin til at ændre brugeragenten
+Comment[de]=Modul zum Ändern der Browserkennung
+Comment[el]=Πρόσθετο για την αλλαγή του πράκτορα χρήστη
+Comment[eo]=Kromaĵo por ŝanĝi la uzantan agenton
+Comment[es]=Complemento para cambiar el agente usuario
+Comment[et]=Brauseri identifikaatori muutmise plugin
+Comment[eu]=Erabiltzaile agentea aldatzeko plugina
+Comment[fa]=وصله برای تغییر عامل کاربر
+Comment[fi]=Sovelma käyttäjäagentin muuttamiseen
+Comment[fr]=Module externe pour changer l'identification du navigateur
+Comment[fy]=Plugin foar it wizigjen fan de brûkersagint
+Comment[ga]=Breiseán a athraíonn an gníomhaire úsáideora
+Comment[gl]=Un plugin para alterar o axente do usuário
+Comment[he]=תוסף לשינוי זיהוי הדפדפן
+Comment[hi]=यूज़रएजेंट बदलने के लिए प्लगइन
+Comment[hr]=Dodatak za izmjenu korisničkog agenta
+Comment[hu]=Bővítőmodul a böngészőazonosító megváltoztatásához
+Comment[is]=Íforrit til að breyta auðkenni vafra
+Comment[it]=Plugin per modificare lo user agent
+Comment[ja]=ユーザエージェント変更用プラグイン
+Comment[ka]=მომხმარებლის აგენტის შეცვლის მოდული
+Comment[kk]=Пайдаланушы агентін ауыстыру плагин модулі
+Comment[km]=កម្មវិធី​ជំនួយ​សម្រាប់​ផ្លាស់ប្ដូរ​ភ្នាក់ងារ​អ្នក​ប្រើ​​
+Comment[lt]=Priedas naudotojo agentui keisti
+Comment[mk]=Приклучок за менување на корисничкиот агент
+Comment[ms]=Plugin untuk mengubah ejen pengguna
+Comment[nb]=Tilleggsmodul for å endre brukeragent
+Comment[nds]=Moduul för't Ännern vun de Nettkieker-Kennen
+Comment[ne]=प्रयोगकर्ता अभिकर्ता परिवर्तनका लागि प्लगइन
+Comment[nl]=Plugin voor het wijzigen van de gebruikersagent
+Comment[nn]=Programtillegg som kan endra brukaragenten
+Comment[pl]=Wtyczka zmiany identyfikacji przeglądarki
+Comment[pt]=Um 'plugin' para alterar o agente do utilizador
+Comment[pt_BR]=Plug-in para modificar o agente de usuário
+Comment[ro]=Modul pentru modificarea identificării "User Agent" a Konqueror
+Comment[ru]=Модуль настройки описания браузера
+Comment[sk]=Modul pre zmenu UserAgent-a
+Comment[sl]=Vstavek za spreminjanje uporabniškega agenta
+Comment[sr]=Прикључак за мењање корисничког агента
+Comment[sr@Latn]=Priključak za menjanje korisničkog agenta
+Comment[sv]=Insticksprogram för att ändra användaragent
+Comment[ta]=பயனர் செயலியை மாற்றுவதற்கான சொருகுப் பொருள்
+Comment[tg]=Модули танзимоти тахаллуси воқеанигор
+Comment[tr]=Kullanıcı ajanını değiştirmek için bir eklenti
+Comment[uk]=Втулок для зміни агента користувача
+Comment[vi]=Bổ sung thay đổi tác nhân người dùng
+Comment[xh]=Plagela ngaphakathi utshintsho lomsebenzisiwomntu omele omnye
+Comment[zh_CN]=用来更换用户代理的插件
+Comment[zh_TW]=改變使用者代理人的外掛程式
+X-KDE-ParentApp=konqueror
+Icon=agent
+DocPath=konq-plugins/uachanger/index.html
diff --git a/konq-plugins/uachanger/uachangerplugin.h b/konq-plugins/uachanger/uachangerplugin.h
new file mode 100644
index 0000000..eb70704
--- /dev/null
+++ b/konq-plugins/uachanger/uachangerplugin.h
@@ -0,0 +1,95 @@
+/*
+ Copyright (c) 2001 Dawit Alemayehu <adawit@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License (LGPL) as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __UACHANGER_PLUGIN_H
+#define __UACHANGER_PLUGIN_H
+
+#include <qmap.h>
+#include <qvaluelist.h>
+#include <qstringlist.h>
+
+#include <kurl.h>
+#include <klibloader.h>
+#include <kparts/plugin.h>
+
+class KHTMLPart;
+class KActionMenu;
+class KConfig;
+
+namespace KIO
+{
+ class Job;
+}
+
+class UAChangerPlugin : public KParts::Plugin
+{
+ Q_OBJECT
+
+public:
+ UAChangerPlugin( QObject* parent, const char* name,
+ const QStringList & );
+ ~UAChangerPlugin();
+
+protected slots:
+ void slotDefault();
+ void parseDescFiles();
+ void updateIOSlaves();
+
+ void slotConfigure();
+ void slotAboutToShow();
+ void slotApplyToDomain();
+ void slotItemSelected(int);
+ void slotStarted(KIO::Job*);
+ void slotReloadDescriptions();
+
+protected:
+ QString findTLD (const QString &hostname);
+ QString filterHost (const QString &hostname);
+
+private:
+ void loadSettings();
+ void saveSettings();
+
+ int m_selectedItem;
+ bool m_bApplyToDomain;
+ bool m_bSettingsLoaded;
+
+ KHTMLPart* m_part;
+ KActionMenu* m_pUAMenu;
+ KConfig* m_config;
+
+ KURL m_currentURL;
+ QString m_currentUserAgent;
+
+ QStringList m_lstAlias;
+ QStringList m_lstIdentity;
+
+ typedef QValueList<int> BrowserGroup;
+ typedef QMap<QString,BrowserGroup> AliasMap;
+ typedef QMap<QString,QString> BrowserMap;
+
+ typedef AliasMap::Iterator AliasIterator;
+ typedef AliasMap::ConstIterator AliasConstIterator;
+
+ BrowserMap m_mapBrowser;
+ AliasMap m_mapAlias;
+};
+
+#endif
diff --git a/konq-plugins/uachanger/uachangerplugin.rc b/konq-plugins/uachanger/uachangerplugin.rc
new file mode 100644
index 0000000..91535bf
--- /dev/null
+++ b/konq-plugins/uachanger/uachangerplugin.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartplugin>
+<kpartplugin name="UserAgentChanger" library="libuachangerplugin">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="changeuseragent"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="extraToolBar"><text>Extra Toolbar</text>
+ <Action name="changeuseragent"/>
+</ToolBar>
+</kpartplugin>