summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/cryptography
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/plugins/cryptography')
-rw-r--r--kopete/plugins/cryptography/Makefile.am25
-rw-r--r--kopete/plugins/cryptography/cryptographychatui.rc9
-rw-r--r--kopete/plugins/cryptography/cryptographyguiclient.cpp75
-rw-r--r--kopete/plugins/cryptography/cryptographyguiclient.h41
-rw-r--r--kopete/plugins/cryptography/cryptographyplugin.cpp326
-rw-r--r--kopete/plugins/cryptography/cryptographyplugin.h102
-rw-r--r--kopete/plugins/cryptography/cryptographypreferences.cpp49
-rw-r--r--kopete/plugins/cryptography/cryptographypreferences.h42
-rw-r--r--kopete/plugins/cryptography/cryptographyprefsbase.ui196
-rw-r--r--kopete/plugins/cryptography/cryptographyselectuserkey.cpp71
-rw-r--r--kopete/plugins/cryptography/cryptographyselectuserkey.h51
-rw-r--r--kopete/plugins/cryptography/cryptographyui.rc12
-rw-r--r--kopete/plugins/cryptography/cryptographyuserkey_ui.ui79
-rw-r--r--kopete/plugins/cryptography/icons/Makefile.am2
-rw-r--r--kopete/plugins/cryptography/icons/cr16-action-kgpg_key1.pngbin0 -> 267 bytes
-rw-r--r--kopete/plugins/cryptography/icons/cr16-action-kgpg_key2.pngbin0 -> 440 bytes
-rw-r--r--kopete/plugins/cryptography/icons/cr16-action-kgpg_key3.pngbin0 -> 671 bytes
-rw-r--r--kopete/plugins/cryptography/kgpginterface.cpp176
-rw-r--r--kopete/plugins/cryptography/kgpginterface.h91
-rw-r--r--kopete/plugins/cryptography/kgpgselkey.cpp245
-rw-r--r--kopete/plugins/cryptography/kgpgselkey.h64
-rw-r--r--kopete/plugins/cryptography/kopete_cryptography.desktop129
-rw-r--r--kopete/plugins/cryptography/kopete_cryptography_config.desktop126
-rw-r--r--kopete/plugins/cryptography/popuppublic.cpp514
-rw-r--r--kopete/plugins/cryptography/popuppublic.h78
25 files changed, 2503 insertions, 0 deletions
diff --git a/kopete/plugins/cryptography/Makefile.am b/kopete/plugins/cryptography/Makefile.am
new file mode 100644
index 00000000..bbcaca2c
--- /dev/null
+++ b/kopete/plugins/cryptography/Makefile.am
@@ -0,0 +1,25 @@
+METASOURCES = AUTO
+
+SUBDIRS=icons
+
+AM_CPPFLAGS = $(KOPETE_INCLUDES) $(all_includes)
+
+kde_module_LTLIBRARIES = kopete_cryptography.la kcm_kopete_cryptography.la
+
+kopete_cryptography_la_SOURCES = cryptographyplugin.cpp kgpginterface.cpp cryptographyguiclient.cpp cryptographyselectuserkey.cpp cryptographyuserkey_ui.ui popuppublic.cpp kgpgselkey.cpp
+kopete_cryptography_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
+kopete_cryptography_la_LIBADD = ../../libkopete/libkopete.la
+
+kcm_kopete_cryptography_la_SOURCES = cryptographypreferences.cpp cryptographyprefsbase.ui kgpgselkey.cpp
+kcm_kopete_cryptography_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
+kcm_kopete_cryptography_la_LIBADD = ../../libkopete/libkopete.la $(LIB_KUTILS)
+
+service_DATA = kopete_cryptography.desktop
+servicedir = $(kde_servicesdir)
+
+kcm_DATA = kopete_cryptography_config.desktop
+kcmdir = $(kde_servicesdir)/kconfiguredialog
+
+mydatadir = $(kde_datadir)/kopete_cryptography
+mydata_DATA = cryptographyui.rc cryptographychatui.rc
+
diff --git a/kopete/plugins/cryptography/cryptographychatui.rc b/kopete/plugins/cryptography/cryptographychatui.rc
new file mode 100644
index 00000000..3d8835a6
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographychatui.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui>
+<kpartgui version="1" name="kopetecryptographychat">
+ <MenuBar>
+ <Menu name="tools" >
+ <text>&amp;Tools</text>
+ <Action name="cryptographyToggle" />
+ </Menu>
+ </MenuBar>
+</kpartgui>
diff --git a/kopete/plugins/cryptography/cryptographyguiclient.cpp b/kopete/plugins/cryptography/cryptographyguiclient.cpp
new file mode 100644
index 00000000..0c53eee0
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyguiclient.cpp
@@ -0,0 +1,75 @@
+/*
+ cryptographyguiclient.cpp
+
+ Copyright (c) 2004 by Olivier Goffart <ogoffart @ kde.org>
+
+ *************************************************************************
+ * *
+ * 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 "cryptographyguiclient.h"
+#include "cryptographyplugin.h"
+
+
+#include "kopetemetacontact.h"
+#include "kopetecontact.h"
+#include "kopetechatsession.h"
+
+#include <kaction.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+
+class CryptographyPlugin;
+
+CryptographyGUIClient::CryptographyGUIClient(Kopete::ChatSession *parent )
+ : QObject(parent) , KXMLGUIClient(parent)
+{
+ if(!parent || parent->members().isEmpty())
+ {
+ deleteLater(); //we refuse to build this client, it is based on wrong parametters
+ return;
+ }
+
+ QPtrList<Kopete::Contact> mb=parent->members();
+ Kopete::MetaContact *first=mb.first()->metaContact();
+
+ if(!first)
+ {
+ deleteLater(); //we refuse to build this client, it is based on wrong parametters
+ return;
+ }
+
+ setInstance( KGenericFactory<CryptographyPlugin>::instance() );
+
+
+ m_action=new KToggleAction( i18n("Encrypt Messages" ), QString::fromLatin1( "encrypted" ), 0, this, SLOT(slotToggled()), actionCollection() , "cryptographyToggle" );
+ m_action->setChecked( first->pluginData( CryptographyPlugin::plugin() , "encrypt_messages") != QString::fromLatin1("off") ) ;
+
+ setXMLFile("cryptographychatui.rc");
+}
+
+
+CryptographyGUIClient::~CryptographyGUIClient()
+{}
+
+void CryptographyGUIClient::slotToggled()
+{
+ QPtrList<Kopete::Contact> mb=static_cast<Kopete::ChatSession*>(parent())->members();
+ Kopete::MetaContact *first=mb.first()->metaContact();
+
+ if(!first)
+ return;
+
+ first->setPluginData(CryptographyPlugin::plugin() , "encrypt_messages" ,
+ m_action->isChecked() ? "on" : "off" );
+}
+
+
+#include "cryptographyguiclient.moc"
+
diff --git a/kopete/plugins/cryptography/cryptographyguiclient.h b/kopete/plugins/cryptography/cryptographyguiclient.h
new file mode 100644
index 00000000..5a1aee2c
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyguiclient.h
@@ -0,0 +1,41 @@
+/*
+ cryptographyguiclient.h
+
+ Copyright (c) 2004 by Olivier Goffart <ogoffart @ kde.org>
+
+ *************************************************************************
+ * *
+ * 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 CRYPTOGUICLIENT_H
+#define CRYPTOGUICLIENT_H
+
+#include <qobject.h>
+#include <kxmlguiclient.h>
+
+namespace Kopete { class ChatSession; }
+class KToggleAction;
+
+/**
+ *@author Olivier Goffart
+ */
+class CryptographyGUIClient : public QObject, public KXMLGUIClient
+{
+Q_OBJECT
+public:
+ CryptographyGUIClient(Kopete::ChatSession *parent = 0);
+ ~CryptographyGUIClient();
+
+private:
+ KToggleAction *m_action;
+
+private slots:
+ void slotToggled();
+};
+
+#endif
diff --git a/kopete/plugins/cryptography/cryptographyplugin.cpp b/kopete/plugins/cryptography/cryptographyplugin.cpp
new file mode 100644
index 00000000..701ad8bd
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyplugin.cpp
@@ -0,0 +1,326 @@
+/***************************************************************************
+ cryptographyplugin.cpp - description
+ -------------------
+ begin : jeu nov 14 2002
+ copyright : (C) 2002-2004 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 <qstylesheet.h>
+#include <qtimer.h>
+#include <qregexp.h>
+
+#include <kdebug.h>
+#include <kaction.h>
+#include <kconfig.h>
+#include <kgenericfactory.h>
+#include <kdeversion.h>
+#include <kaboutdata.h>
+
+#include "kopetemetacontact.h"
+#include "kopetecontactlist.h"
+#include "kopetechatsessionmanager.h"
+#include "kopetesimplemessagehandler.h"
+#include "kopeteuiglobal.h"
+#include "kopetecontact.h"
+
+#include "cryptographyplugin.h"
+#include "cryptographyselectuserkey.h"
+#include "cryptographyguiclient.h"
+
+#include "kgpginterface.h"
+
+//This regexp try to match an HTML text, but only some authorized tags.
+// used in slotIncomingMessage
+//There are not rules to know if the test should be sent in html or not.
+//In Jabber, the JEP says it's not. so we don't use richtext in our message, but some client did.
+//We limit the html to some basis tag to limit security problem (bad links)
+// - Olivier
+const QRegExp CryptographyPlugin::isHTML( QString::fromLatin1( "^[^<>]*(</?(html|body|br|p|font|center|b|i|u|span|div|pre)(>|[\\s/][^><]*>)[^><]*)+$" ) , false );
+
+typedef KGenericFactory<CryptographyPlugin> CryptographyPluginFactory;
+static const KAboutData aboutdata("kopete_cryptography", I18N_NOOP("Cryptography") , "1.0" );
+K_EXPORT_COMPONENT_FACTORY( kopete_cryptography, CryptographyPluginFactory( &aboutdata ) )
+
+CryptographyPlugin::CryptographyPlugin( QObject *parent, const char *name, const QStringList & /* args */ )
+: Kopete::Plugin( CryptographyPluginFactory::instance(), parent, name ),
+ m_cachedPass()
+{
+ if( !pluginStatic_ )
+ pluginStatic_=this;
+
+ m_inboundHandler = new Kopete::SimpleMessageHandlerFactory( Kopete::Message::Inbound,
+ Kopete::MessageHandlerFactory::InStageToSent, this, SLOT( slotIncomingMessage( Kopete::Message& ) ) );
+ connect( Kopete::ChatSessionManager::self(),
+ SIGNAL( aboutToSend( Kopete::Message & ) ),
+ SLOT( slotOutgoingMessage( Kopete::Message & ) ) );
+
+ m_cachedPass_timer = new QTimer(this, "m_cachedPass_timer" );
+ QObject::connect(m_cachedPass_timer, SIGNAL(timeout()), this, SLOT(slotForgetCachedPass() ));
+
+
+ KAction *action=new KAction( i18n("&Select Cryptography Public Key..."), "encrypted", 0, this, SLOT (slotSelectContactKey()), actionCollection() , "contactSelectKey");
+ connect ( Kopete::ContactList::self() , SIGNAL( metaContactSelected(bool)) , action , SLOT(setEnabled(bool)));
+ action->setEnabled(Kopete::ContactList::self()->selectedMetaContacts().count()==1 );
+
+ setXMLFile("cryptographyui.rc");
+ loadSettings();
+ connect(this, SIGNAL(settingsChanged()), this, SLOT( loadSettings() ) );
+
+ connect( Kopete::ChatSessionManager::self(), SIGNAL( chatSessionCreated( Kopete::ChatSession * )) , SLOT( slotNewKMM( Kopete::ChatSession * ) ) );
+ //Add GUI action to all already existing kmm (if the plugin is launched when kopete already rining)
+ QValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions();
+ for (QValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it)
+ {
+ slotNewKMM(*it);
+ }
+
+}
+
+CryptographyPlugin::~CryptographyPlugin()
+{
+ delete m_inboundHandler;
+ pluginStatic_ = 0L;
+}
+
+void CryptographyPlugin::loadSettings()
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("Cryptography Plugin");
+
+ mPrivateKeyID = config->readEntry("PGP_private_key");
+ mAlsoMyKey = config->readBoolEntry("Also_my_key", false);
+
+ if(config->readBoolEntry("Cache_Till_App_Close", false))
+ mCachePassPhrase = Keep;
+ if(config->readBoolEntry("Cache_Till_Time", false))
+ mCachePassPhrase = Time;
+ if(config->readBoolEntry("Cache_Never", false))
+ mCachePassPhrase = Never;
+ mCacheTime = config->readNumEntry("Cache_Time", 15);
+ mAskPassPhrase = config->readBoolEntry("No_Passphrase_Handling", false);
+}
+
+CryptographyPlugin* CryptographyPlugin::plugin()
+{
+ return pluginStatic_ ;
+}
+
+CryptographyPlugin* CryptographyPlugin::pluginStatic_ = 0L;
+
+QCString CryptographyPlugin::cachedPass()
+{
+ return pluginStatic_->m_cachedPass;
+}
+
+void CryptographyPlugin::setCachedPass(const QCString& p)
+{
+ if(pluginStatic_->mCacheMode==Never)
+ return;
+ if(pluginStatic_->mCacheMode==Time)
+ pluginStatic_->m_cachedPass_timer->start(pluginStatic_->mCacheTime * 60000, false);
+
+ pluginStatic_->m_cachedPass=p;
+}
+
+bool CryptographyPlugin::passphraseHandling()
+{
+ return !pluginStatic_->mAskPassPhrase;
+}
+
+
+/*KActionCollection *CryptographyPlugin::customChatActions(Kopete::ChatSession *KMM)
+{
+ delete m_actionCollection;
+
+ m_actionCollection = new KActionCollection(this);
+ KAction *actionTranslate = new KAction( i18n ("Translate"), 0,
+ this, SLOT( slotTranslateChat() ), m_actionCollection, "actionTranslate" );
+ m_actionCollection->insert( actionTranslate );
+
+ m_currentChatSession=KMM;
+ return m_actionCollection;
+}*/
+
+void CryptographyPlugin::slotIncomingMessage( Kopete::Message& msg )
+{
+ QString body = msg.plainBody();
+ if( !body.startsWith( QString::fromLatin1("-----BEGIN PGP MESSAGE----") )
+ || !body.contains( QString::fromLatin1("-----END PGP MESSAGE----") ) )
+ return;
+
+ if( msg.direction() != Kopete::Message::Inbound )
+ {
+ QString plainBody;
+ if ( m_cachedMessages.contains( body ) )
+ {
+ plainBody = m_cachedMessages[ body ];
+ m_cachedMessages.remove( body );
+ }
+ else
+ {
+ plainBody = KgpgInterface::KgpgDecryptText( body, mPrivateKeyID );
+ }
+
+ if( !plainBody.isEmpty() )
+ {
+ //Check if this is a RTF message before escaping it
+ if( !isHTML.exactMatch( plainBody ) )
+ {
+ plainBody = QStyleSheet::escape( plainBody );
+
+ //this is the same algoritm as in Kopete::Message::escapedBody();
+ plainBody.replace( QString::fromLatin1( "\n" ), QString::fromLatin1( "<br/>" ) )
+ .replace( QString::fromLatin1( "\t" ), QString::fromLatin1( "&nbsp;&nbsp;&nbsp;&nbsp;" ) )
+ .replace( QRegExp( QString::fromLatin1( "\\s\\s" ) ), QString::fromLatin1( "&nbsp; " ) );
+ }
+
+ msg.setBody( QString::fromLatin1("<table width=\"100%\" border=0 cellspacing=0 cellpadding=0><tr><td class=\"highlight\"><font size=\"-1\"><b>")
+ + i18n("Outgoing Encrypted Message: ")
+ + QString::fromLatin1("</b></font></td></tr><tr><td class=\"highlight\">")
+ + plainBody
+ + QString::fromLatin1(" </td></tr></table>")
+ , Kopete::Message::RichText );
+ }
+
+ //if there are too messages in cache, clear the cache
+ if(m_cachedMessages.count() > 5)
+ m_cachedMessages.clear();
+
+ return;
+ }
+
+
+ //the Message::unescape is there because client like fire replace linebreak by <BR> to work even if the protocol doesn't allow newlines (IRC)
+ // cf http://fire.sourceforge.net/forums/viewtopic.php?t=174 and Bug #96052
+ if(body.contains("<"))
+ body= Kopete::Message::unescape(body);
+
+ body = KgpgInterface::KgpgDecryptText( body, mPrivateKeyID );
+
+ if( !body.isEmpty() )
+ {
+ //Check if this is a RTF message before escaping it
+ if( !isHTML.exactMatch( body ) )
+ {
+ body = Kopete::Message::escape( body );
+ }
+
+ msg.setBody( QString::fromLatin1("<table width=\"100%\" border=0 cellspacing=0 cellpadding=0><tr><td class=\"highlight\"><font size=\"-1\"><b>")
+ + i18n("Incoming Encrypted Message: ")
+ + QString::fromLatin1("</b></font></td></tr><tr><td class=\"highlight\">")
+ + body
+ + QString::fromLatin1(" </td></tr></table>")
+ , Kopete::Message::RichText );
+ }
+
+}
+
+void CryptographyPlugin::slotOutgoingMessage( Kopete::Message& msg )
+{
+ if(msg.direction() != Kopete::Message::Outbound)
+ return;
+
+ QStringList keys;
+ QPtrList<Kopete::Contact> contactlist = msg.to();
+ for( Kopete::Contact *c = contactlist.first(); c; c = contactlist.next() )
+ {
+ QString tmpKey;
+ if( c->metaContact() )
+ {
+ if(c->metaContact()->pluginData( this, "encrypt_messages" ) == "off" )
+ return;
+ tmpKey = c->metaContact()->pluginData( this, "gpgKey" );
+ }
+ if( tmpKey.isEmpty() )
+ {
+ // kdDebug( 14303 ) << "CryptographyPlugin::slotOutgoingMessage: no key selected for one contact" <<endl;
+ return;
+ }
+ keys.append( tmpKey );
+ }
+ if(mAlsoMyKey) //encrypt also with the self key
+ keys.append( mPrivateKeyID );
+
+ QString key = keys.join( " " );
+
+ if(key.isEmpty())
+ {
+ kdDebug(14303) << "CryptographyPlugin::slotOutgoingMessage: empty key" <<endl;
+ return;
+ }
+
+ QString original=msg.plainBody();
+
+ /* Code From KGPG */
+
+ ////////////////// encode from editor
+ QString encryptOptions="";
+
+ //if (utrust==true)
+ encryptOptions+=" --always-trust ";
+ //if (arm==true)
+ encryptOptions+=" --armor ";
+
+ /* if (pubcryptography==true)
+ {
+ if (gpgversion<120) encryptOptions+=" --compress-algo 1 --cipher-algo cast5 ";
+ else encryptOptions+=" --cryptography6 ";
+ }*/
+
+// if (selec==NULL) {KMessageBox::sorry(Kopete::UI::Global::mainWidget(),i18n("You have not chosen an encryption key..."));return;}
+
+ QString resultat=KgpgInterface::KgpgEncryptText(original,key,encryptOptions);
+ if (!resultat.isEmpty())
+ {
+ msg.setBody(resultat,Kopete::Message::PlainText);
+ m_cachedMessages.insert(resultat,original);
+ }
+ else
+ kdDebug(14303) << "CryptographyPlugin::slotOutgoingMessage: empty result" <<endl;
+
+}
+
+void CryptographyPlugin::slotSelectContactKey()
+{
+ Kopete::MetaContact *m=Kopete::ContactList::self()->selectedMetaContacts().first();
+ if(!m)
+ return;
+ QString key = m->pluginData( this, "gpgKey" );
+ CryptographySelectUserKey *opts = new CryptographySelectUserKey( key, m );
+ opts->exec();
+ if( opts->result() )
+ {
+ key = opts->publicKey();
+ m->setPluginData( this, "gpgKey", key );
+ }
+ delete opts;
+}
+
+void CryptographyPlugin::slotForgetCachedPass()
+{
+ m_cachedPass=QCString();
+ m_cachedPass_timer->stop();
+}
+
+void CryptographyPlugin::slotNewKMM(Kopete::ChatSession *KMM)
+{
+ connect(this , SIGNAL( destroyed(QObject*)) ,
+ new CryptographyGUIClient(KMM) , SLOT(deleteLater()));
+}
+
+
+
+#include "cryptographyplugin.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
+
diff --git a/kopete/plugins/cryptography/cryptographyplugin.h b/kopete/plugins/cryptography/cryptographyplugin.h
new file mode 100644
index 00000000..506617cc
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyplugin.h
@@ -0,0 +1,102 @@
+/***************************************************************************
+ cryptographyplugin.h - description
+ -------------------
+ begin : jeu nov 14 2002
+ copyright : (C) 2002-2004 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 CryptographyPLUGIN_H
+#define CryptographyPLUGIN_H
+
+
+#include "kopeteplugin.h"
+
+class QStringList;
+class QString;
+class QTimer;
+
+namespace Kopete
+{
+ class Message;
+ class MetaContact;
+ class ChatSession;
+ class SimpleMessageHandlerFactory;
+}
+
+/**
+ * @author Olivier Goffart
+ */
+
+class CryptographyPlugin : public Kopete::Plugin
+{
+ Q_OBJECT
+
+public:
+ enum CacheMode
+ {
+ Keep = 0,
+ Time = 1,
+ Never = 2
+ };
+
+ static CryptographyPlugin *plugin();
+ static QCString cachedPass();
+ static void setCachedPass(const QCString &pass);
+ static bool passphraseHandling();
+ static const QRegExp isHTML;
+
+ CryptographyPlugin( QObject *parent, const char *name, const QStringList &args );
+ ~CryptographyPlugin();
+
+public slots:
+
+ void slotIncomingMessage( Kopete::Message& msg );
+ void slotOutgoingMessage( Kopete::Message& msg );
+
+private slots:
+
+ void slotSelectContactKey();
+ void slotForgetCachedPass();
+ void loadSettings();
+
+ void slotNewKMM(Kopete::ChatSession *);
+
+private:
+ static CryptographyPlugin* pluginStatic_;
+ Kopete::SimpleMessageHandlerFactory *m_inboundHandler;
+ QCString m_cachedPass;
+ QTimer *m_cachedPass_timer;
+
+ //cache messages for showing
+ QMap<QString, QString> m_cachedMessages;
+
+ //Settings
+ QString mPrivateKeyID;
+ int mCacheMode;
+ unsigned int mCacheTime;
+ bool mAlsoMyKey;
+ bool mAskPassPhrase;
+ bool mCachePassPhrase;
+};
+
+#endif
+
+/*
+ * Local variables:
+ * c-indentation-style: k&r
+ * c-basic-offset: 8
+ * indent-tabs-mode: t
+ * End:
+ */
+// vim: set noet ts=4 sts=4 sw=4:
+
diff --git a/kopete/plugins/cryptography/cryptographypreferences.cpp b/kopete/plugins/cryptography/cryptographypreferences.cpp
new file mode 100644
index 00000000..1039aac8
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographypreferences.cpp
@@ -0,0 +1,49 @@
+/***************************************************************************
+ cryptographypreferences.cpp - description
+ -------------------
+ begin : jeu nov 14 2002
+ copyright : (C) 2002 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 <qpushbutton.h>
+
+#include <klineedit.h>
+#include <kgenericfactory.h>
+
+#include "cryptographyprefsbase.h"
+#include "cryptographypreferences.h"
+#include "kgpgselkey.h"
+
+typedef KGenericFactory<CryptographyPreferences> CryptographyPreferencesFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kopete_cryptography, CryptographyPreferencesFactory("kcm_kopete_cryptography"))
+
+CryptographyPreferences::CryptographyPreferences(QWidget *parent, const char* /*name*/, const QStringList &args)
+ : KCAutoConfigModule(CryptographyPreferencesFactory::instance(), parent, args)
+{
+ // Add actuall widget generated from ui file.
+ preferencesDialog = new CryptographyPrefsUI(this);
+ connect (preferencesDialog->m_selectOwnKey , SIGNAL(pressed()) , this , SLOT(slotSelectPressed()));
+ setMainWidget( preferencesDialog ,"Cryptography Plugin");
+}
+
+void CryptographyPreferences::slotSelectPressed()
+{
+ KgpgSelKey opts(this,0,false);
+ opts.exec();
+ if (opts.result()==QDialog::Accepted)
+ preferencesDialog->PGP_private_key->setText(opts.getkeyID());
+}
+
+#include "cryptographypreferences.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
diff --git a/kopete/plugins/cryptography/cryptographypreferences.h b/kopete/plugins/cryptography/cryptographypreferences.h
new file mode 100644
index 00000000..057eacf1
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographypreferences.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ cryptographypreferences.h
+ -------------------
+ begin : jeu nov 14 2002
+ copyright : (C) 2002 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 CryptographyPREFERENCES_H
+#define CryptographyPREFERENCES_H
+
+#include "kcautoconfigmodule.h"
+
+class CryptographyPrefsUI;
+class KAutoConfig;
+
+/**
+ * Preference widget for the Cryptography plugin
+ * @author Olivier Goffart
+ */
+class CryptographyPreferences : public KCAutoConfigModule {
+ Q_OBJECT
+public:
+ CryptographyPreferences(QWidget *parent = 0, const char *name = 0, const QStringList &args = QStringList());
+private:
+ CryptographyPrefsUI *preferencesDialog;
+private slots: // Public slots
+ void slotSelectPressed();
+};
+
+#endif
+
+// vim: set noet ts=4 sts=4 sw=4:
diff --git a/kopete/plugins/cryptography/cryptographyprefsbase.ui b/kopete/plugins/cryptography/cryptographyprefsbase.ui
new file mode 100644
index 00000000..ecec3507
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyprefsbase.ui
@@ -0,0 +1,196 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>CryptographyPrefsUI</class>
+<author>Olivier Goffart</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>CryptographyPrefsUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>403</width>
+ <height>287</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Your private PGP key:</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>m_selectOwnKey</cstring>
+ </property>
+ <property name="text">
+ <string>Select...</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>PGP_private_key</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Also_my_key</cstring>
+ </property>
+ <property name="text">
+ <string>Encrypt outgoing messages with this key</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Check this box if you want to encrypt outgoing messages with this key, so that you will be able to decrypt them yourself later.&lt;br&gt;
+&lt;b&gt;Warning:&lt;/b&gt; This can increase the size of messages, and some protocols will refuse to send your messages because they are too large.</string>
+ </property>
+ </widget>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_cache</cstring>
+ </property>
+ <property name="title">
+ <string>Cache Passphrase</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Cache_Till_App_Close</cstring>
+ </property>
+ <property name="text">
+ <string>Until Kopete closes</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="2" column="1">
+ <property name="name">
+ <cstring>Cache_Time</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maxValue">
+ <number>999</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>15</number>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>minutes</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="2" column="0">
+ <property name="name">
+ <cstring>Cache_Till_Time</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>For</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Cache_Never</cstring>
+ </property>
+ <property name="text">
+ <string>Never</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>No_Passphrase_Handling</cstring>
+ </property>
+ <property name="text">
+ <string>Do not ask for the passphrase</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>No_Passphrase_Handling</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>m_cache</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>PGP_private_key</tabstop>
+ <tabstop>m_selectOwnKey</tabstop>
+ <tabstop>Also_my_key</tabstop>
+ <tabstop>No_Passphrase_Handling</tabstop>
+ <tabstop>Cache_Till_App_Close</tabstop>
+ <tabstop>Cache_Till_Time</tabstop>
+ <tabstop>Cache_Time</tabstop>
+ <tabstop>Cache_Never</tabstop>
+</tabstops>
+<slots>
+ <slot>m_selectOwnKey_clicked()</slot>
+ <slot>m_selectOwnKey_toggled(bool)</slot>
+ <slot>m_selectOwnKey_stateChanged(int)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/kopete/plugins/cryptography/cryptographyselectuserkey.cpp b/kopete/plugins/cryptography/cryptographyselectuserkey.cpp
new file mode 100644
index 00000000..4f1cc35e
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyselectuserkey.cpp
@@ -0,0 +1,71 @@
+/***************************************************************************
+ cryptographyselectuserkey.cpp - description
+ -------------------
+ begin : dim nov 17 2002
+ copyright : (C) 2002 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 <klocale.h>
+#include <klineedit.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+
+#include "cryptographyuserkey_ui.h"
+#include "kopetemetacontact.h"
+#include "popuppublic.h"
+
+#include "cryptographyselectuserkey.h"
+
+CryptographySelectUserKey::CryptographySelectUserKey(const QString& key ,Kopete::MetaContact *mc) : KDialogBase( 0l, "CryptographySelectUserKey", /*modal = */true, i18n("Select Contact's Public Key") , KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok )
+{
+ m_metaContact=mc;
+ view = new CryptographyUserKey_ui(this,"CryptographyUserKey_ui");
+ setMainWidget(view);
+
+ connect (view->m_selectKey , SIGNAL(clicked()) , this , SLOT(slotSelectPressed()));
+ connect (view->m_removeButton , SIGNAL(clicked()) , this , SLOT(slotRemovePressed()));
+
+ view->m_titleLabel->setText(i18n("Select public key for %1").arg(mc->displayName()));
+ view->m_editKey->setText(key);
+}
+CryptographySelectUserKey::~CryptographySelectUserKey()
+{
+}
+
+void CryptographySelectUserKey::slotSelectPressed()
+{
+ popupPublic *dialog=new popupPublic(this, "public_keys", 0,false);
+ connect(dialog,SIGNAL(selectedKey(QString &,QString,bool,bool)),this,SLOT(keySelected(QString &)));
+ dialog->show();
+}
+
+
+void CryptographySelectUserKey::keySelected(QString &key)
+{
+ view->m_editKey->setText(key);
+}
+
+void CryptographySelectUserKey::slotRemovePressed()
+{
+ view->m_editKey->setText("");
+}
+
+QString CryptographySelectUserKey::publicKey() const
+{
+ return view->m_editKey->text();
+}
+
+
+
+#include "cryptographyselectuserkey.moc"
+
diff --git a/kopete/plugins/cryptography/cryptographyselectuserkey.h b/kopete/plugins/cryptography/cryptographyselectuserkey.h
new file mode 100644
index 00000000..1a8828cf
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyselectuserkey.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ cryptographyselectuserkey.h - description
+ -------------------
+ begin : dim nov 17 2002
+ copyright : (C) 2002 by Olivier Goffart
+ email : ogoffart @ kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 CRYPTOGRAPHYSELECTUSERKEY_H
+#define CRYPTOGRAPHYSELECTUSERKEY_H
+
+#include <kdialogbase.h>
+
+namespace Kopete { class MetaContact; }
+class CryptographyUserKey_ui;
+
+/**
+ *@author OlivierGoffart
+ */
+
+class CryptographySelectUserKey : public KDialogBase {
+ Q_OBJECT
+public:
+ CryptographySelectUserKey(const QString &key, Kopete::MetaContact *mc);
+ ~CryptographySelectUserKey();
+
+
+ QString publicKey() const;
+
+private slots:
+ void keySelected(QString &);
+ void slotSelectPressed();
+ /** No descriptions */
+ void slotRemovePressed();
+
+private:
+ CryptographyUserKey_ui *view;
+ Kopete::MetaContact *m_metaContact;
+
+};
+
+#endif
diff --git a/kopete/plugins/cryptography/cryptographyui.rc b/kopete/plugins/cryptography/cryptographyui.rc
new file mode 100644
index 00000000..542cb597
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyui.rc
@@ -0,0 +1,12 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kopete_cryptography" version="1">
+ <MenuBar>
+ <Menu name="edit">
+ <text>&amp;Edit</text>
+ <Action name="contactSelectKey" />
+ </Menu>
+ </MenuBar>
+ <Menu name="contact_popup">
+ <Action name="contactSelectKey" />
+ </Menu>
+</kpartgui>
diff --git a/kopete/plugins/cryptography/cryptographyuserkey_ui.ui b/kopete/plugins/cryptography/cryptographyuserkey_ui.ui
new file mode 100644
index 00000000..d84f2fec
--- /dev/null
+++ b/kopete/plugins/cryptography/cryptographyuserkey_ui.ui
@@ -0,0 +1,79 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>CryptographyUserKey_ui</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>CryptographyUserKey_ui</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>442</width>
+ <height>232</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>PGP key:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>m_editKey</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>m_selectKey</cstring>
+ </property>
+ <property name="text">
+ <string>Select...</string>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="1" column="3">
+ <property name="name">
+ <cstring>m_removeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>m_titleLabel</cstring>
+ </property>
+ <property name="text">
+ <string>TextLabel2</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kopete/plugins/cryptography/icons/Makefile.am b/kopete/plugins/cryptography/icons/Makefile.am
new file mode 100644
index 00000000..db2335c3
--- /dev/null
+++ b/kopete/plugins/cryptography/icons/Makefile.am
@@ -0,0 +1,2 @@
+kgpgiconsdir = $(kde_datadir)/kopete/icons
+kgpgicons_ICON = AUTO
diff --git a/kopete/plugins/cryptography/icons/cr16-action-kgpg_key1.png b/kopete/plugins/cryptography/icons/cr16-action-kgpg_key1.png
new file mode 100644
index 00000000..ee3b21c7
--- /dev/null
+++ b/kopete/plugins/cryptography/icons/cr16-action-kgpg_key1.png
Binary files differ
diff --git a/kopete/plugins/cryptography/icons/cr16-action-kgpg_key2.png b/kopete/plugins/cryptography/icons/cr16-action-kgpg_key2.png
new file mode 100644
index 00000000..ad4e016f
--- /dev/null
+++ b/kopete/plugins/cryptography/icons/cr16-action-kgpg_key2.png
Binary files differ
diff --git a/kopete/plugins/cryptography/icons/cr16-action-kgpg_key3.png b/kopete/plugins/cryptography/icons/cr16-action-kgpg_key3.png
new file mode 100644
index 00000000..ae788cab
--- /dev/null
+++ b/kopete/plugins/cryptography/icons/cr16-action-kgpg_key3.png
Binary files differ
diff --git a/kopete/plugins/cryptography/kgpginterface.cpp b/kopete/plugins/cryptography/kgpginterface.cpp
new file mode 100644
index 00000000..51b35a63
--- /dev/null
+++ b/kopete/plugins/cryptography/kgpginterface.cpp
@@ -0,0 +1,176 @@
+#include "cryptographyplugin.h" //(for the cached passphrase)
+//Code from KGPG
+
+/***************************************************************************
+ kgpginterface.cpp - description
+ -------------------
+ begin : Mon Jul 8 2002
+ copyright : (C) 2002 by y0k0
+ email : bj@altern.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 <klocale.h>
+#include <kpassdlg.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <qfile.h>
+
+#include <kprocio.h>
+
+//#include "kdetailedconsole.h"
+
+#include "kgpginterface.h"
+
+KgpgInterface::KgpgInterface()
+{}
+
+KgpgInterface::~KgpgInterface()
+{}
+
+QString KgpgInterface::KgpgEncryptText(QString text,QString userIDs, QString Options)
+{
+ FILE *fp;
+ QString dests,encResult;
+ char buffer[200];
+
+ userIDs=userIDs.stripWhiteSpace();
+ userIDs=userIDs.simplifyWhiteSpace();
+ Options=Options.stripWhiteSpace();
+
+ int ct=userIDs.find(" ");
+ while (ct!=-1) // if multiple keys...
+ {
+ dests+=" --recipient "+userIDs.section(' ',0,0);
+ userIDs.remove(0,ct+1);
+ ct=userIDs.find(" ");
+ }
+ dests+=" --recipient "+userIDs;
+
+ QCString gpgcmd = "echo -n ";
+ gpgcmd += KShellProcess::quote( text ).utf8();
+ gpgcmd += " | gpg --no-secmem-warning --no-tty ";
+ gpgcmd += Options.local8Bit();
+ gpgcmd += " -e ";
+ gpgcmd += dests.local8Bit();
+
+ ////////// encode with untrusted keys or armor if checked by user
+ fp = popen( gpgcmd, "r");
+ while ( fgets( buffer, sizeof(buffer), fp))
+ encResult+=buffer;
+ pclose(fp);
+
+ if( !encResult.isEmpty() )
+ return encResult;
+ else
+ return QString::null;
+}
+
+QString KgpgInterface::KgpgDecryptText(QString text,QString userID)
+{
+ FILE *fp,*pass;
+ QString encResult;
+
+ char buffer[200];
+ int counter=0,ppass[2];
+ QCString password = CryptographyPlugin::cachedPass();
+ bool passphraseHandling=CryptographyPlugin::passphraseHandling();
+
+ while ((counter<3) && (encResult.isEmpty()))
+ {
+ counter++;
+ if(passphraseHandling && password.isNull())
+ {
+ /// pipe for passphrase
+ //userID=QString::fromUtf8(userID);
+ userID.replace('<',"&lt;");
+ QString passdlg=i18n("Enter passphrase for <b>%1</b>:").arg(userID);
+ if (counter>1)
+ passdlg.prepend(i18n("<b>Bad passphrase</b><br> You have %1 tries left.<br>").arg(QString::number(4-counter)));
+
+ /// pipe for passphrase
+ int code=KPasswordDialog::getPassword(password,passdlg);
+ if (code!=QDialog::Accepted)
+ return QString::null;
+ CryptographyPlugin::setCachedPass(password);
+ }
+
+ if(passphraseHandling)
+ {
+ pipe(ppass);
+ pass = fdopen(ppass[1], "w");
+ fwrite(password, sizeof(char), strlen(password), pass);
+ // fwrite("\n", sizeof(char), 1, pass);
+ fclose(pass);
+ }
+
+ QCString gpgcmd="echo ";
+ gpgcmd += KShellProcess::quote(text).utf8();
+ gpgcmd += " | gpg --no-secmem-warning --no-tty ";
+ if(passphraseHandling)
+ gpgcmd += "--passphrase-fd " + QString::number(ppass[0]).local8Bit();
+ gpgcmd += " -d ";
+
+ ////////// encode with untrusted keys or armor if checked by user
+ fp = popen(gpgcmd, "r");
+ while ( fgets( buffer, sizeof(buffer), fp))
+ encResult += QString::fromUtf8(buffer);
+
+ pclose(fp);
+ password = QCString();
+ }
+
+ if( !encResult.isEmpty() )
+ return encResult;
+ else
+ return QString::null;
+}
+
+QString KgpgInterface::checkForUtf8(QString txt)
+{
+
+ // code borrowed from gpa
+ const char *s;
+
+ /* Make sure the encoding is UTF-8.
+ * Test structure suggested by Werner Koch */
+ if (txt.isEmpty())
+ return QString::null;
+
+ for (s = txt.ascii(); *s && !(*s & 0x80); s++)
+ ;
+ if (*s && !strchr (txt.ascii(), 0xc3) && (txt.find("\\x")==-1))
+ return txt;
+
+ /* The string is not in UTF-8 */
+ //if (strchr (txt.ascii(), 0xc3)) return (txt+" +++");
+ if (txt.find("\\x")==-1)
+ return QString::fromUtf8(txt.ascii());
+ // if (!strchr (txt.ascii(), 0xc3) || (txt.find("\\x")!=-1)) {
+ for ( int idx = 0 ; (idx = txt.find( "\\x", idx )) >= 0 ; ++idx ) {
+ char str[2] = "x";
+ str[0] = (char) QString( txt.mid( idx + 2, 2 ) ).toShort( 0, 16 );
+ txt.replace( idx, 4, str );
+ }
+ if (!strchr (txt.ascii(), 0xc3))
+ return QString::fromUtf8(txt.ascii());
+ else
+ return QString::fromUtf8(QString::fromUtf8(txt.ascii()).ascii()); // perform Utf8 twice, or some keys display badly
+}
+
+
+
+
+#include "kgpginterface.moc"
diff --git a/kopete/plugins/cryptography/kgpginterface.h b/kopete/plugins/cryptography/kgpginterface.h
new file mode 100644
index 00000000..b70bc68a
--- /dev/null
+++ b/kopete/plugins/cryptography/kgpginterface.h
@@ -0,0 +1,91 @@
+//Code from KGPG
+
+/***************************************************************************
+ kgpginterface.h - description
+ -------------------
+ begin : Sat Jun 29 2002
+ copyright : (C) 2002 by
+ email :
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 KGPGINTERFACE_H
+#define KGPGINTERFACE_H
+
+
+#include <kurl.h>
+
+/**
+ * Encrypt a file using gpg.
+ */
+//class KgpgEncryptFile : public QObject {
+class KgpgInterface : public QObject {
+
+ Q_OBJECT
+
+ public:
+ /**
+ * Initialize the class
+ */
+ KgpgInterface();
+
+
+ /**Encrypt text function
+ * @param text QString text to be encrypted.
+ * @param userIDs the recipients key id's.
+ * @param Options String with the wanted gpg options. ex: "--armor"
+ * returns the encrypted text or empty string if encyption failed
+ */
+ static QString KgpgEncryptText(QString text,QString userIDs, QString Options="");
+
+ /**Decrypt text function
+ * @param text QString text to be decrypted.
+ * @param userID QString the name of the decryption key (only used to prompt user for passphrase)
+ */
+ static QString KgpgDecryptText(QString text,QString userID);
+// static QString KgpgDecryptFileToText(KURL srcUrl,QString userID);
+
+ /*
+ * Destructor for the class.
+ */
+ ~KgpgInterface();
+
+ static QString checkForUtf8(QString txt);
+
+
+ private slots:
+
+signals:
+
+ private:
+ /**
+ * @internal structure for communication
+ */
+ QString message,tempKeyFile,userIDs,txtprocess,output;
+ QCString passphrase;
+ bool deleteSuccess,konsLocal,anonymous,txtsent,decfinished,decok,badmdc;
+ int signSuccess;
+ int step,signb,sigsearch;
+ QString konsSignKey, konsKeyID;
+
+
+ /**
+ * @internal structure for the file information
+ */
+ KURL file;
+ /**
+ * @internal structure to send signal only once on error.
+ */
+ bool encError;
+};
+
+
+#endif
diff --git a/kopete/plugins/cryptography/kgpgselkey.cpp b/kopete/plugins/cryptography/kgpgselkey.cpp
new file mode 100644
index 00000000..70f76598
--- /dev/null
+++ b/kopete/plugins/cryptography/kgpgselkey.cpp
@@ -0,0 +1,245 @@
+//Code from KGPG
+
+/***************************************************************************
+ listkeys.cpp - description
+ -------------------
+ begin : Thu Jul 4 2002
+ copyright : (C) 2002 by y0k0
+ email : bj@altern.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+////////////////////////////////////////////////////// code for the key management
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+
+#include <klistview.h>
+#include <klocale.h>
+#include <qcheckbox.h>
+#include <kprocess.h>
+#include <kiconloader.h>
+
+#include "kgpgselkey.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////// Secret key selection dialog, used when user wants to sign a key
+KgpgSelKey::KgpgSelKey(QWidget *parent, const char *name,bool showlocal):KDialogBase( parent, name, true,i18n("Private Key List"),Ok | Cancel)
+{
+ QString keyname;
+ QWidget *page = new QWidget(this);
+ QLabel *labeltxt;
+ KIconLoader *loader = KGlobal::iconLoader();
+
+ keyPair=loader->loadIcon("kgpg_key2",KIcon::Small,20);
+
+ setMinimumSize(300,200);
+ keysListpr = new KListView( page );
+ keysListpr->setRootIsDecorated(true);
+ keysListpr->addColumn( i18n( "Name" ) );
+ keysListpr->setShowSortIndicator(true);
+ keysListpr->setFullWidth(true);
+
+ labeltxt=new QLabel(i18n("Choose secret key:"),page);
+ QVBoxLayout *vbox=new QVBoxLayout(page,3);
+
+ vbox->addWidget(labeltxt);
+ vbox->addWidget(keysListpr);
+ if (showlocal==true)
+ {
+ local = new QCheckBox(i18n("Local signature (cannot be exported)"),page);
+ vbox->addWidget(local);
+ }
+
+ FILE *fp,*fp2;
+ QString tst,tst2;
+ char line[130];
+
+ // FIXME: Why use popen instead of KProcess, QProcess or KProcIO?!?
+ // Are we interested in having buffer overflows now? - Martijn
+ fp = popen( "gpg --no-tty --with-colon --list-secret-keys", "r" );
+ while ( fgets( line, sizeof(line), fp))
+ {
+ tst=line;
+ if (tst.startsWith("sec"))
+ {
+ const QString trust=tst.section(':',1,1);
+ QString val=tst.section(':',6,6);
+ QString id=QString("0x"+tst.section(':',4,4).right(8));
+ if (val.isEmpty())
+ val=i18n("Unlimited");
+ QString tr;
+ switch( trust[0] )
+ {
+ case 'o':
+ tr= i18n("Unknown");
+ break;
+ case 'i':
+ tr= i18n("Invalid");
+ break;
+ case 'd':
+ tr=i18n("Disabled");
+ break;
+ case 'r':
+ tr=i18n("Revoked");
+ break;
+ case 'e':
+ tr=i18n("Expired");
+ break;
+ case 'q':
+ tr=i18n("Undefined");
+ break;
+ case 'n':
+ tr=i18n("None");
+ break;
+ case 'm':
+ tr=i18n("Marginal");
+ break;
+ case 'f':
+ tr=i18n("Full");
+ break;
+ case 'u':
+ tr=i18n("Ultimate");
+ break;
+ default:
+ tr=i18n("?");
+ break;
+ }
+ tst=tst.section(":",9,9);
+
+ // FIXME: Same here: don't use popen! - Martijn
+ fp2 = popen( QString( "gpg --no-tty --with-colon --list-key %1" ).arg( KShellProcess::quote( id ) ).latin1(), "r" );
+ bool dead=true;
+ while ( fgets( line, sizeof(line), fp2))
+ {
+ tst2=line;
+ if (tst2.startsWith("pub"))
+ {
+ const QString trust2=tst2.section(':',1,1);
+ switch( trust2[0] )
+ {
+ case 'f':
+ dead=false;
+ break;
+ case 'u':
+ dead=false;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ pclose(fp2);
+ if (!tst.isEmpty() && (!dead))
+ {
+ KListViewItem *item=new KListViewItem(keysListpr,extractKeyName(tst));
+ KListViewItem *sub= new KListViewItem(item,i18n("ID: %1, trust: %2, expiration: %3").arg(id).arg(tr).arg(val));
+ sub->setSelectable(false);
+ item->setPixmap(0,keyPair);
+ }
+ }
+ }
+ pclose(fp);
+
+
+ QObject::connect(keysListpr,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(slotpreOk()));
+ QObject::connect(keysListpr,SIGNAL(clicked(QListViewItem *)),this,SLOT(slotSelect(QListViewItem *)));
+
+
+ keysListpr->setSelected(keysListpr->firstChild(),true);
+
+ page->show();
+ resize(this->minimumSize());
+ setMainWidget(page);
+}
+
+QString KgpgSelKey::extractKeyName(QString fullName)
+{
+ QString kMail;
+ if (fullName.find("<")!=-1)
+ {
+ kMail=fullName.section('<',-1,-1);
+ kMail.truncate(kMail.length()-1);
+ }
+ QString kName=fullName.section('<',0,0);
+ if (kName.find("(")!=-1) kName=kName.section('(',0,0);
+ return QString(kMail+" ("+kName+")").stripWhiteSpace();
+}
+
+void KgpgSelKey::slotpreOk()
+{
+ if (keysListpr->currentItem()->depth()!=0)
+ return;
+ else
+ slotOk();
+}
+
+void KgpgSelKey::slotOk()
+{
+ if (keysListpr->currentItem()==NULL)
+ reject();
+ else
+ accept();
+}
+
+void KgpgSelKey::slotSelect(QListViewItem *item)
+{
+ if (item==NULL) return;
+ if (item->depth()!=0)
+ {
+ keysListpr->setSelected(item->parent(),true);
+ keysListpr->setCurrentItem(item->parent());
+ }
+}
+
+
+QString KgpgSelKey::getkeyID()
+{
+ QString userid;
+ ///// emit selected key
+ if (keysListpr->currentItem()==NULL) return("");
+ else
+ {
+ userid=keysListpr->currentItem()->firstChild()->text(0);
+ userid=userid.section(',',0,0);
+ userid=userid.section(':',1,1);
+ userid=userid.stripWhiteSpace();
+ return(userid);
+ }
+}
+
+QString KgpgSelKey::getkeyMail()
+{
+ QString username;
+ ///// emit selected key
+ if (keysListpr->currentItem()==NULL) return("");
+ else
+ {
+ username=keysListpr->currentItem()->text(0);
+ //username=username.section(' ',0,0);
+ username=username.stripWhiteSpace();
+ return(username);
+ }
+}
+
+bool KgpgSelKey::getlocal()
+{
+ ///// emit exportation choice
+ return(local->isChecked());
+}
+
+#include "kgpgselkey.moc"
diff --git a/kopete/plugins/cryptography/kgpgselkey.h b/kopete/plugins/cryptography/kgpgselkey.h
new file mode 100644
index 00000000..11bcc498
--- /dev/null
+++ b/kopete/plugins/cryptography/kgpgselkey.h
@@ -0,0 +1,64 @@
+//Code from KGPG
+
+/***************************************************************************
+ listkeys.h - description
+ -------------------
+ begin : Thu Jul 4 2002
+ copyright : (C) 2002 by y0k0
+ email : bj@altern.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 LISTKEYS_H
+#define LISTKEYS_H
+
+
+#include <kdialogbase.h>
+
+class KListView;
+class QCheckBox;
+
+typedef struct gpgKey{
+ QString gpgkeymail;
+ QString gpgkeyname;
+ QString gpgkeyid;
+ QString gpgkeytrust;
+ QString gpgkeyvalidity;
+ QString gpgkeysize;
+ QString gpgkeycreation;
+ QString gpgkeyexpiration;
+ QString gpgkeyalgo;
+};
+
+class KgpgSelKey : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ KgpgSelKey( QWidget *parent = 0, const char *name = 0,bool showlocal=true);
+ KListView *keysListpr;
+QPixmap keyPair;
+QCheckBox *local;
+private slots:
+void slotOk();
+void slotpreOk();
+void slotSelect(QListViewItem *item);
+QString extractKeyName(QString fullName);
+
+public:
+ QString getkeyID();
+ QString getkeyMail();
+ bool getlocal();
+};
+
+
+
+#endif
diff --git a/kopete/plugins/cryptography/kopete_cryptography.desktop b/kopete/plugins/cryptography/kopete_cryptography.desktop
new file mode 100644
index 00000000..bbc3b591
--- /dev/null
+++ b/kopete/plugins/cryptography/kopete_cryptography.desktop
@@ -0,0 +1,129 @@
+[Desktop Entry]
+Type=Service
+X-Kopete-Version=1000900
+Icon=encrypted
+ServiceTypes=Kopete/Plugin
+X-KDE-Library=kopete_cryptography
+X-KDE-PluginInfo-Author=Olivier Goffart
+X-KDE-PluginInfo-Email=ogoffart@tiscalinet.be
+X-KDE-PluginInfo-Name=kopete_cryptography
+X-KDE-PluginInfo-Version=0.8.0
+X-KDE-PluginInfo-Website=http://kopete.kde.org
+X-KDE-PluginInfo-Category=Plugins
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=Cryptography
+Name[ar]=التشفير
+Name[be]=Крыптаграфія
+Name[bg]=Шифроване
+Name[bn]=ক্রিপ্টোগ্রাফি
+Name[bs]=Kriptografija
+Name[ca]=Xifrat
+Name[cs]=Šifrování
+Name[cy]=Cêl-ysgrifennaeth
+Name[da]=Kryptografi
+Name[de]=Kryptographie
+Name[el]=Κρυπτογραφία
+Name[eo]=Ĉifrado
+Name[es]=Criptografí­a
+Name[et]=Krüpto
+Name[eu]=Kriptografia
+Name[fa]=رمزنگاری
+Name[fi]=Salaus
+Name[fr]=Cryptographie
+Name[ga]=Criptiúchán
+Name[gl]=Criptografía
+Name[he]=קריפטוגרפיה
+Name[hi]=क्रिप्टोग्राफी
+Name[hr]=Kriptografija
+Name[hu]=Titkosítás
+Name[is]=Dulritun
+Name[it]=Crittografia
+Name[ja]=暗号化
+Name[ka]=კრიპტოგრაფია
+Name[kk]=Шифрлау
+Name[km]=ការ​គ្រីប
+Name[lt]=Šifravimas
+Name[mk]=Криптографија
+Name[nb]=Kryptografi
+Name[nds]=Verslöteln
+Name[ne]=क्रिप्टोग्राफी
+Name[nl]=Cryptografie
+Name[nn]=Kryptografi
+Name[pl]=Szyfrowanie
+Name[pt]=Encriptação
+Name[pt_BR]=Criptografia
+Name[ro]=Criptografie
+Name[ru]=Шифрование
+Name[se]=Kryptográfiija
+Name[sk]=Šifrovanie
+Name[sl]=Šifriranje
+Name[sr]=Криптографија
+Name[sr@Latn]=Kriptografija
+Name[sv]=Kryptering
+Name[ta]=மறைக்குறியியல்
+Name[tg]=Рамзгузорӣ
+Name[tr]=Şifreleme
+Name[uk]=Криптографія
+Name[uz]=Kriptografiya
+Name[uz@cyrillic]=Криптография
+Name[wa]=Criptografeye
+Name[zh_CN]=加密
+Name[zh_HK]=密碼學
+Name[zh_TW]=加密
+Comment=Encrypt and decrypt messages with GPG
+Comment[ar]=يقوم بتشفير وفل التشفير الرسائل عن طريق GPG
+Comment[be]=Шыфраваць і расшыфроўваць паведамленні ў GPG
+Comment[bg]=Шифроване на съобщения с GPG
+Comment[bn]=জিপিজি ব্যবহার করে বার্তা এনক্রিপ্ট এবং ডিক্রিপ্ট করুন
+Comment[bs]=Šifrujte poruke koristeći GPG
+Comment[ca]=Xifra i desxifra missatges amb GPG
+Comment[cs]=Šifrování a dešifrování zpráv pomocí GPG
+Comment[cy]=Celu a datgelu negeseuon efo GPG
+Comment[da]=Kryptér og dekryptér beskeder med GPG
+Comment[de]=Verschlüsselt und entschlüsselt Nachrichten mit GPG
+Comment[el]=Κρυπτογραφήστε και αποκρυπτογραφήστε μηνύματα με το GPG
+Comment[es]=Cifra y descifra mensajes con GPG
+Comment[et]=Sõnumite krüptimine ja lahtikrüptimine GPG abil
+Comment[eu]=Enkriptatu eta desenkriptatu mezuak GPG-rekin
+Comment[fa]=رمزبندی و سرگشایی پیامها با GPG
+Comment[fi]=Salaa ja pura salaus viesteistä GPG-ohjelmalla
+Comment[fr]=Chiffrer et déchiffrer les messages avec GPG
+Comment[gl]=Encriptar e desencriptar mensaxes con GPG
+Comment[he]=הצפנה ופענוח של הודעות בעזרת GPG
+Comment[hi]=जीपीजी के द्वारा संदेश एनक्रिप्ट तथा डिक्रिप्ट करे
+Comment[hr]=Kriptiranje i dekriptiranej poruka GPG-om
+Comment[hu]=Titkosítás/dekódolás GPG-vel
+Comment[is]=Dulrita og afkóða skeyti með GPG
+Comment[it]=Cifra e decifra i messaggi con GPG
+Comment[ja]=GPG を使ってメッセージを暗号化/復号
+Comment[ka]=GPG შეტყობინებების დაშიფვრა და გაშიფვრვა
+Comment[kk]=GPG көмегімен хабарларды шифрлау не шифрын шешу
+Comment[km]=អ៊ិនគ្រីប និង​ឌិគ្រីប​សារ​ដោយ​ប្រើ GPG
+Comment[lt]=Užšifruoti ir atšifruoti žinutes GPG būdu
+Comment[mk]=Криптирајте и декриптирајте пораки со GPG
+Comment[nb]=Krypter / dekrypter meldinger med GPG
+Comment[nds]=Narichten mit GPG ver- un opslöteln
+Comment[ne]=जीपीजी सँग सन्देशहरू गुप्तिकरण गर्नुहोस्/गुप्तलेखन उल्टाउनुहोस्
+Comment[nl]=Versleutel en ontcijfer berichten met GPG
+Comment[nn]=Krypter og dekrypter meldingar med GPG
+Comment[pl]=Szyfruje i odszyfrowuje wiadomości za pomocą GPG
+Comment[pt]=Cifra e decifra as mensagens com o GPG
+Comment[pt_BR]=Criptografa e descriptografa mensagens com o GPG
+Comment[ro]=Criptează şi decriptează mesajele cu GPG
+Comment[ru]=Шифрование сообщений при помощи GPG
+Comment[se]=Kryptere ja dekryptere dieđáhusaid GPG:ain
+Comment[sk]=Šifruje a dešifruje správy pomocou GPG
+Comment[sl]=Šifriranje in dešifriranje sporočil z GPG
+Comment[sr]=Шифровање и дешифровање порука помоћу GPG-а
+Comment[sr@Latn]=Šifrovanje i dešifrovanje poruka pomoću GPG-a
+Comment[sv]=Kryptera och avkoda meddelanden med GPG
+Comment[ta]=GPG உடன் மறையாக்கம் மற்றும் மறைவிலக்கம்
+Comment[tg]=Рамзгузорӣ ва рамзкушоии пайёмҳо ба воситаи GPG
+Comment[tr]=GPG ile mesajları şifrele ve çöz
+Comment[uk]=Шифрування та розшифрування повідомлень з GPG
+Comment[wa]=Ecripter eyet discripter les messaedjes avou GPG
+Comment[zh_CN]=用 GPG 加密和解密消息
+Comment[zh_HK]=以 GPG 加密或解密訊息
+Comment[zh_TW]=用 GPG 加密或解密您的訊息
diff --git a/kopete/plugins/cryptography/kopete_cryptography_config.desktop b/kopete/plugins/cryptography/kopete_cryptography_config.desktop
new file mode 100644
index 00000000..ed2d4cdb
--- /dev/null
+++ b/kopete/plugins/cryptography/kopete_cryptography_config.desktop
@@ -0,0 +1,126 @@
+[Desktop Entry]
+Icon=encrypted
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kopete_cryptography
+X-KDE-FactoryName=CryptographyConfigFactory
+X-KDE-ParentApp=kopete_cryptography
+X-KDE-ParentComponents=kopete_cryptography
+
+Name=Cryptography
+Name[ar]=التشفير
+Name[be]=Крыптаграфія
+Name[bg]=Шифроване
+Name[bn]=ক্রিপ্টোগ্রাফি
+Name[bs]=Kriptografija
+Name[ca]=Xifrat
+Name[cs]=Šifrování
+Name[cy]=Cêl-ysgrifennaeth
+Name[da]=Kryptografi
+Name[de]=Kryptographie
+Name[el]=Κρυπτογραφία
+Name[eo]=Ĉifrado
+Name[es]=Criptografí­a
+Name[et]=Krüpto
+Name[eu]=Kriptografia
+Name[fa]=رمزنگاری
+Name[fi]=Salaus
+Name[fr]=Cryptographie
+Name[ga]=Criptiúchán
+Name[gl]=Criptografía
+Name[he]=קריפטוגרפיה
+Name[hi]=क्रिप्टोग्राफी
+Name[hr]=Kriptografija
+Name[hu]=Titkosítás
+Name[is]=Dulritun
+Name[it]=Crittografia
+Name[ja]=暗号化
+Name[ka]=კრიპტოგრაფია
+Name[kk]=Шифрлау
+Name[km]=ការ​គ្រីប
+Name[lt]=Šifravimas
+Name[mk]=Криптографија
+Name[nb]=Kryptografi
+Name[nds]=Verslöteln
+Name[ne]=क्रिप्टोग्राफी
+Name[nl]=Cryptografie
+Name[nn]=Kryptografi
+Name[pl]=Szyfrowanie
+Name[pt]=Encriptação
+Name[pt_BR]=Criptografia
+Name[ro]=Criptografie
+Name[ru]=Шифрование
+Name[se]=Kryptográfiija
+Name[sk]=Šifrovanie
+Name[sl]=Šifriranje
+Name[sr]=Криптографија
+Name[sr@Latn]=Kriptografija
+Name[sv]=Kryptering
+Name[ta]=மறைக்குறியியல்
+Name[tg]=Рамзгузорӣ
+Name[tr]=Şifreleme
+Name[uk]=Криптографія
+Name[uz]=Kriptografiya
+Name[uz@cyrillic]=Криптография
+Name[wa]=Criptografeye
+Name[zh_CN]=加密
+Name[zh_HK]=密碼學
+Name[zh_TW]=加密
+Comment=Encrypts messages using PGP
+Comment[ar]=يشفر الرسائل باستخدام PGP
+Comment[be]=Шыфруе паведамленні ў PGP
+Comment[bg]=Шифроване на съобщения с GPG
+Comment[bn]=পিজিপি ব্যবহার করে বার্তা এনক্রিপ্ট করে
+Comment[bs]=Šifruje poruke koristeći GPG
+Comment[ca]=Xifra missatges emprant PGP
+Comment[cs]=Šifrování zpráv pomocí GPG
+Comment[cy]=Celu negeseuon gan ddefnyddio PGP
+Comment[da]=Krypterer beskeder ved brug af PGP
+Comment[de]=Verschlüsselt Nachrichten mit PGP
+Comment[el]=Κρυπτογραφεί τα μηνύματα χρησιμοποιώντας το PGP
+Comment[es]=Cifra mensajes usando PGP
+Comment[et]=Sõnumite krüptimine PGP abil
+Comment[eu]=Enkriptatu mezuak PGP-rekin
+Comment[fa]=پیامها را با استفاده از GPG رمزبندی می‌کند
+Comment[fi]=Salaa viestit käyttäen PGP-ohjelmaa
+Comment[fr]=Chiffrer les messages avec PGP
+Comment[gl]=Encripta mensaxes con PGP
+Comment[he]=מצפין הודעות בעזרת PGP
+Comment[hi]=जीपीजी के द्वारा संदेश एनक्रिप्ट करे
+Comment[hr]=Kriptiranje i dekriptiranej poruka PGP-om
+Comment[hu]=Üzenetek titkosítása PGP-vel
+Comment[is]=Dulritar skeyti með PGP
+Comment[it]=Cifra i messaggi con PGP
+Comment[ja]=PGP を使ってメッセージを暗号化
+Comment[ka]=PGP შეტყობინებების დაშიფვრვა
+Comment[kk]=PGP көмегімен хабарларды шифрлау
+Comment[km]=អ៊ិនគ្រីប​សារ​ដោយ​ប្រើ PGP
+Comment[lt]=Užšifruoti žinutes PGP būdu
+Comment[mk]=Криптирајте пораки употребувајќи PGP
+Comment[nb]=Krypterer meldinger med PGP
+Comment[nds]=Verslötelt Narichten mit PGP
+Comment[ne]=पीजीपी प्रयोग गरेर सन्देश गुप्तिकरण गर्दछ
+Comment[nl]=Versleutelt berichten met PGP
+Comment[nn]=Krypterer meldingar med PGP
+Comment[pl]=Szyfruje wiadomości za pomocą PGP
+Comment[pt]=Cifra as mensagens usando o PGP
+Comment[pt_BR]=Criptografa mensagens usando o PGP
+Comment[ro]=Criptează mesajele cu PGP
+Comment[ru]=Шифрует сообщение с помощью PGP
+Comment[se]=Kryptere dieđáhusaid PGP:ain
+Comment[sk]=Šifruje správy pomocou PGP
+Comment[sl]=Šifriranje sporočil s PGP
+Comment[sr]=Шифровање и дешифровање порука помоћу PGP-а
+Comment[sr@Latn]=Šifrovanje i dešifrovanje poruka pomoću PGP-a
+Comment[sv]=Krypterar meddelanden med PGP
+Comment[ta]=PGP யை பயன்படுத்தி செய்திகளை சங்கேதங்களாக்கு
+Comment[tg]=Рамзгузории пайёмҳо ба воситаи PGP
+Comment[tr]=PGP kullanan mesajları şifreler
+Comment[uk]=Шифрує повідомлення за допомогою PGP
+Comment[wa]=Ecripter les messaedjes avou PGP
+Comment[zh_CN]=用 PGP 加密消息
+Comment[zh_HK]=將訊息以 PGP 加密
+Comment[zh_TW]=用 PGP 加密訊息
+
diff --git a/kopete/plugins/cryptography/popuppublic.cpp b/kopete/plugins/cryptography/popuppublic.cpp
new file mode 100644
index 00000000..36008bcf
--- /dev/null
+++ b/kopete/plugins/cryptography/popuppublic.cpp
@@ -0,0 +1,514 @@
+//File Imported from KGPG ( 2004 - 09 - 03 )
+
+/***************************************************************************
+ popuppublic.cpp - description
+ -------------------
+ begin : Sat Jun 29 2002
+ copyright : (C) 2002 by Jean-Baptiste Mardelle
+ email : bj@altern.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+//////////////////////////////////////////////////////// code for choosing a public key from a list for encryption
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qptrlist.h>
+#include <qwhatsthis.h>
+#include <qpainter.h>
+#include <qiconset.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qhbuttongroup.h>
+#include <qtoolbutton.h>
+#include <qapplication.h>
+#include <qlabel.h>
+
+#include <kdeversion.h>
+#include <klistview.h>
+#include <kprocess.h>
+#include <kprocio.h>
+#include <klocale.h>
+#include <kaccel.h>
+#include <klistviewsearchline.h>
+#include <kactivelabel.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klineedit.h>
+#include <kconfig.h>
+
+
+#include "popuppublic.h"
+//#include "kgpgsettings.h"
+//#include "kgpgview.h"
+//#include "kgpg.h"
+#include "kgpginterface.h"
+
+///////////////// klistviewitem special
+
+class UpdateViewItem2 : public KListViewItem
+{
+public:
+ UpdateViewItem2(QListView *parent, QString name,QString mail,QString id,bool isDefault);
+ virtual void paintCell(QPainter *p, const QColorGroup &cg,int col, int width, int align);
+ virtual QString key(int c,bool ) const;
+ bool def;
+};
+
+UpdateViewItem2::UpdateViewItem2(QListView *parent, QString name,QString mail,QString id,bool isDefault)
+ : KListViewItem(parent)
+{
+def=isDefault;
+ setText(0,name);
+ setText(1,mail);
+ setText(2,id);
+}
+
+
+void UpdateViewItem2::paintCell(QPainter *p, const QColorGroup &cg,int column, int width, int alignment)
+{
+ if ((def) && (column<2)) {
+ QFont font(p->font());
+ font.setBold(true);
+ p->setFont(font);
+ }
+ KListViewItem::paintCell(p, cg, column, width, alignment);
+}
+
+QString UpdateViewItem2 :: key(int c,bool ) const
+{
+ return text(c).lower();
+}
+
+/////////////// main view
+
+popupPublic::popupPublic(QWidget *parent, const char *name,QString sfile,bool filemode,KShortcut goDefaultKey):
+KDialogBase( Plain, i18n("Select Public Key"), Details | Ok | Cancel, Ok, parent, name,true)
+{
+ QWidget *page = plainPage();
+ QVBoxLayout *vbox=new QVBoxLayout(page,0,spacingHint());
+ vbox->setAutoAdd(true);
+
+ setButtonText(KDialogBase::Details,i18n("Options"));
+
+/* if (KGpgSettings::allowCustomEncryptionOptions())
+ customOptions=KGpgSettings::customEncryptionOptions();*/
+
+ KIconLoader *loader = KGlobal::iconLoader();
+
+ keyPair=loader->loadIcon("kgpg_key2",KIcon::Small,20);
+ keySingle=loader->loadIcon("kgpg_key1",KIcon::Small,20);
+ keyGroup=loader->loadIcon("kgpg_key3",KIcon::Small,20);
+
+ if (filemode) setCaption(i18n("Select Public Key for %1").arg(sfile));
+ fmode=filemode;
+
+ QHButtonGroup *hBar=new QHButtonGroup(page);
+ //hBar->setFrameStyle(QFrame::NoFrame);
+ hBar->setMargin(0);
+
+ QToolButton *clearSearch = new QToolButton(hBar);
+ clearSearch->setTextLabel(i18n("Clear Search"), true);
+ clearSearch->setIconSet(SmallIconSet(QApplication::reverseLayout() ? "clear_left"
+ : "locationbar_erase"));
+ (void) new QLabel(i18n("Search: "),hBar);
+ KListViewSearchLine* listViewSearch = new KListViewSearchLine(hBar);
+ connect(clearSearch, SIGNAL(pressed()), listViewSearch, SLOT(clear()));
+
+ keysList = new KListView( page );
+ keysList->addColumn(i18n("Name"));
+ keysList->addColumn(i18n("Email"));
+ keysList->addColumn(i18n("ID"));
+
+ listViewSearch->setListView(keysList);
+
+ keysList->setRootIsDecorated(false);
+ page->setMinimumSize(540,200);
+ keysList->setShowSortIndicator(true);
+ keysList->setFullWidth(true);
+ keysList->setAllColumnsShowFocus(true);
+ keysList->setSelectionModeExt(KListView::Extended);
+ keysList->setColumnWidthMode(0,QListView::Manual);
+ keysList->setColumnWidthMode(1,QListView::Manual);
+ keysList->setColumnWidth(0,210);
+ keysList->setColumnWidth(1,210);
+
+ boutonboxoptions=new QButtonGroup(5,Qt::Vertical ,page,0);
+
+ KActionCollection *actcol=new KActionCollection(this);
+ (void) new KAction(i18n("&Go to Default Key"),goDefaultKey, this, SLOT(slotGotoDefaultKey()),actcol,"go_default_key");
+
+
+ CBarmor=new QCheckBox(i18n("ASCII armored encryption"),boutonboxoptions);
+ CBuntrusted=new QCheckBox(i18n("Allow encryption with untrusted keys"),boutonboxoptions);
+ CBhideid=new QCheckBox(i18n("Hide user id"),boutonboxoptions);
+ setDetailsWidget(boutonboxoptions);
+ QWhatsThis::add
+ (keysList,i18n("<b>Public keys list</b>: select the key that will be used for encryption."));
+ QWhatsThis::add
+ (CBarmor,i18n("<b>ASCII encryption</b>: makes it possible to open the encrypted file/message in a text editor"));
+ QWhatsThis::add
+ (CBhideid,i18n("<b>Hide user ID</b>: Do not put the keyid into encrypted packets. This option hides the receiver "
+ "of the message and is a countermeasure against traffic analysis. It may slow down the decryption process because "
+ "all available secret keys are tried."));
+ QWhatsThis::add
+ (CBuntrusted,i18n("<b>Allow encryption with untrusted keys</b>: when you import a public key, it is usually "
+ "marked as untrusted and you cannot use it unless you sign it in order to make it 'trusted'. Checking this "
+ "box enables you to use any key, even if it has not be signed."));
+
+ if (filemode) {
+ QWidget *parentBox=new QWidget(boutonboxoptions);
+ QHBoxLayout *shredBox=new QHBoxLayout(parentBox,0);
+ //shredBox->setFrameStyle(QFrame::NoFrame);
+ //shredBox->setMargin(0);
+ CBshred=new QCheckBox(i18n("Shred source file"),parentBox);
+ QWhatsThis::add
+ (CBshred,i18n("<b>Shred source file</b>: permanently remove source file. No recovery will be possible"));
+
+ QString shredWhatsThis = i18n( "<qt><b>Shred source file:</b><br /><p>Checking this option will shred (overwrite several times before erasing) the files you have encrypted. This way, it is almost impossible that the source file is recovered.</p><p><b>But you must be aware that this is not secure</b> on all file systems, and that parts of the file may have been saved in a temporary file or in the spooler of your printer if you previously opened it in an editor or tried to print it. Only works on files (not on folders).</p></qt>");
+ KActiveLabel *warn= new KActiveLabel( i18n("<a href=\"whatsthis:%1\">Read this before using shredding</a>").arg(shredWhatsThis),parentBox );
+ shredBox->addWidget(CBshred);
+ shredBox->addWidget(warn);
+ }
+
+ CBsymmetric=new QCheckBox(i18n("Symmetrical encryption"),boutonboxoptions);
+ QWhatsThis::add
+ (CBsymmetric,i18n("<b>Symmetrical encryption</b>: encryption does not use keys. You just need to give a password "
+ "to encrypt/decrypt the file"));
+ QObject::connect(CBsymmetric,SIGNAL(toggled(bool)),this,SLOT(isSymetric(bool)));
+
+//BEGIN modified for Kopete
+
+ setWFlags( getWFlags() | Qt::WDestructiveClose );
+
+
+ /*CBarmor->setChecked( KGpgSettings::asciiArmor() );
+ CBuntrusted->setChecked( KGpgSettings::allowUntrustedKeys() );
+ CBhideid->setChecked( KGpgSettings::hideUserID() );
+ if (filemode) CBshred->setChecked( KGpgSettings::shredSource() );*/
+ KConfig *config = KGlobal::config();
+ config->setGroup("Cryptography Plugin");
+
+ CBarmor->hide();
+ CBuntrusted->setChecked(config->readBoolEntry("UntrustedKeys", true));
+ CBhideid->hide();
+ if (filemode) CBshred->hide();
+ CBsymmetric->hide();
+
+//END modified for Kopete
+
+ /*if (KGpgSettings::allowCustomEncryptionOptions()) {
+ QHButtonGroup *bGroup = new QHButtonGroup(page);
+ //bGroup->setFrameStyle(QFrame::NoFrame);
+ (void) new QLabel(i18n("Custom option:"),bGroup);
+ KLineEdit *optiontxt=new KLineEdit(bGroup);
+ optiontxt->setText(customOptions);
+ QWhatsThis::add
+ (optiontxt,i18n("<b>Custom option</b>: for experienced users only, allows you to enter a gpg command line option, like: '--armor'"));
+ QObject::connect(optiontxt,SIGNAL(textChanged ( const QString & )),this,SLOT(customOpts(const QString & )));
+ }*/
+ QObject::connect(keysList,SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),this,SLOT(slotOk()));
+// QObject::connect(this,SIGNAL(okClicked()),this,SLOT(crypte()));
+ QObject::connect(CBuntrusted,SIGNAL(toggled(bool)),this,SLOT(refresh(bool)));
+
+ char line[200]="\0";
+ FILE *fp2;
+ seclist=QString::null;
+
+ fp2 = popen("gpg --no-secmem-warning --no-tty --with-colon --list-secret-keys ", "r");
+ while ( fgets( line, sizeof(line), fp2))
+ {
+ QString readLine=line;
+ if (readLine.startsWith("sec")) seclist+=", 0x"+readLine.section(":",4,4).right(8);
+ }
+ pclose(fp2);
+
+ trusted=CBuntrusted->isChecked();
+
+ refreshkeys();
+ setMinimumSize(550,200);
+ updateGeometry();
+ keysList->setFocus();
+ show();
+}
+
+popupPublic::~popupPublic()
+{}
+
+
+void popupPublic::slotAccept()
+{
+accept();
+}
+
+void popupPublic::enable()
+{
+ QListViewItem *current = keysList->firstChild();
+ if (current==NULL)
+ return;
+ current->setVisible(true);
+ while ( current->nextSibling() ) {
+ current = current->nextSibling();
+ current->setVisible(true);
+ }
+ keysList->ensureItemVisible(keysList->currentItem());
+}
+
+void popupPublic::sort()
+{
+ bool reselect=false;
+ QListViewItem *current = keysList->firstChild();
+ if (current==NULL)
+ return;
+
+ if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())){
+ if (current->isSelected()) {
+ current->setSelected(false);
+ reselect=true;
+ }
+ current->setVisible(false);
+ }
+
+ while ( current->nextSibling() ) {
+ current = current->nextSibling();
+ if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())) {
+ if (current->isSelected()) {
+ current->setSelected(false);
+ reselect=true;
+ }
+ current->setVisible(false);
+ }
+ }
+
+ if (reselect) {
+ QListViewItem *firstvisible;
+ firstvisible=keysList->firstChild();
+ while (firstvisible->isVisible()!=true) {
+ firstvisible=firstvisible->nextSibling();
+ if (firstvisible==NULL)
+ return;
+ }
+ keysList->setSelected(firstvisible,true);
+ keysList->setCurrentItem(firstvisible);
+ keysList->ensureItemVisible(firstvisible);
+ }
+}
+
+void popupPublic::isSymetric(bool state)
+{
+ keysList->setEnabled(!state);
+ CBuntrusted->setEnabled(!state);
+ CBhideid->setEnabled(!state);
+}
+
+
+void popupPublic::customOpts(const QString &str)
+{
+ customOptions=str;
+}
+
+void popupPublic::slotGotoDefaultKey()
+{
+ /*QListViewItem *myDefaulKey = keysList->findItem(KGpgSettings::defaultKey(),2);
+ keysList->clearSelection();
+ keysList->setCurrentItem(myDefaulKey);
+ keysList->setSelected(myDefaulKey,true);
+ keysList->ensureItemVisible(myDefaulKey);*/
+}
+
+void popupPublic::refresh(bool state)
+{
+ if (state)
+ enable();
+ else
+ sort();
+}
+
+void popupPublic::refreshkeys()
+{
+ keysList->clear();
+ /*QStringList groups= QStringList::split(",", KGpgSettings::groups());
+ if (!groups.isEmpty())
+ {
+ for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it )
+ {
+ if (!QString(*it).isEmpty())
+ {
+ UpdateViewItem2 *item=new UpdateViewItem2(keysList,QString(*it),QString::null,QString::null,false);
+ item->setPixmap(0,keyGroup);
+ }
+ }
+ }*/
+ KProcIO *encid=new KProcIO();
+ *encid << "gpg"<<"--no-secmem-warning"<<"--no-tty"<<"--with-colon"<<"--list-keys";
+ ///////// when process ends, update dialog infos
+ QObject::connect(encid, SIGNAL(processExited(KProcess *)),this, SLOT(slotpreselect()));
+ QObject::connect(encid, SIGNAL(readReady(KProcIO *)),this, SLOT(slotprocread(KProcIO *)));
+ encid->start(KProcess::NotifyOnExit,true);
+}
+
+void popupPublic::slotpreselect()
+{
+QListViewItem *it;
+ //if (fmode) it=keysList->findItem(KGpgSettings::defaultKey(),2);
+ //else {
+ it=keysList->firstChild();
+ if (it==NULL)
+ return;
+ while (!it->isVisible()) {
+ it=it->nextSibling();
+ if (it==NULL)
+ return;
+ }
+ //}
+if (!trusted)
+ sort();
+ keysList->setSelected(it,true);
+ keysList->setCurrentItem(it);
+ keysList->ensureItemVisible(it);
+emit keyListFilled();
+}
+
+void popupPublic::slotSetVisible()
+{
+ keysList->ensureItemVisible(keysList->currentItem());
+}
+
+void popupPublic::slotprocread(KProcIO *p)
+{
+ ///////////////////////////////////////////////////////////////// extract encryption keys
+ bool dead;
+ QString tst,keyname,keymail;
+
+ QString defaultKey ;// = KGpgSettings::defaultKey().right(8);
+
+ while (p->readln(tst)!=-1) {
+ if (tst.startsWith("pub")) {
+ QStringList keyString=QStringList::split(":",tst,true);
+ dead=false;
+ const QString trust=keyString[1];
+ QString val=keyString[6];
+ QString id=QString("0x"+keyString[4].right(8));
+ if (val.isEmpty())
+ val=i18n("Unlimited");
+ QString tr;
+ switch( trust[0] ) {
+ case 'o':
+ untrustedList<<id;
+ break;
+ case 'i':
+ dead=true;
+ break;
+ case 'd':
+ dead=true;
+ break;
+ case 'r':
+ dead=true;
+ break;
+ case 'e':
+ dead=true;
+ break;
+ case 'q':
+ untrustedList<<id;
+ break;
+ case 'n':
+ untrustedList<<id;
+ break;
+ case 'm':
+ untrustedList<<id;
+ break;
+ case 'f':
+ break;
+ case 'u':
+ break;
+ default:
+ untrustedList<<id;
+ break;
+ }
+ if (keyString[11].find('D')!=-1) dead=true;
+ tst=keyString[9];
+ if (tst.find("<")!=-1) {
+ keymail=tst.section('<',-1,-1);
+ keymail.truncate(keymail.length()-1);
+ keyname=tst.section('<',0,0);
+ //if (keyname.find("(")!=-1)
+ // keyname=keyname.section('(',0,0);
+ } else {
+ keymail=QString::null;
+ keyname=tst;//.section('(',0,0);
+ }
+
+ keyname=KgpgInterface::checkForUtf8(keyname);
+
+ if ((!dead) && (!tst.isEmpty())) {
+ bool isDefaultKey=false;
+ if (id.right(8)==defaultKey) isDefaultKey=true;
+ UpdateViewItem2 *item=new UpdateViewItem2(keysList,keyname,keymail,id,isDefaultKey);
+ //KListViewItem *sub= new KListViewItem(item,i18n("ID: %1, trust: %2, validity: %3").arg(id).arg(tr).arg(val));
+ //sub->setSelectable(false);
+ if (seclist.find(tst,0,FALSE)!=-1)
+ item->setPixmap(0,keyPair);
+ else
+ item->setPixmap(0,keySingle);
+ }
+ }
+ }
+}
+
+
+void popupPublic::slotOk()
+{
+//BEGIN modified for Kopete
+ KConfig *config = KGlobal::config();
+ config->setGroup("Cryptography Plugin");
+
+ config->writeEntry("UntrustedKeys", CBuntrusted->isChecked());
+ config->writeEntry("HideID", CBhideid->isChecked());
+
+//END modified for Kopete
+
+
+
+
+ ////// emit selected data
+kdDebug(2100)<<"Ok pressed"<<endl;
+ QStringList selectedKeys;
+ QString userid;
+ QPtrList<QListViewItem> list=keysList->selectedItems();
+
+ for ( uint i = 0; i < list.count(); ++i )
+ if ( list.at(i) ) {
+ if (!list.at(i)->text(2).isEmpty()) selectedKeys<<list.at(i)->text(2);
+ else selectedKeys<<list.at(i)->text(0);
+ }
+ if (selectedKeys.isEmpty() && !CBsymmetric->isChecked())
+ return;
+kdDebug(2100)<<"Selected Key:"<<selectedKeys<<endl;
+ QStringList returnOptions;
+ if (CBuntrusted->isChecked())
+ returnOptions<<"--always-trust";
+ if (CBarmor->isChecked())
+ returnOptions<<"--armor";
+ if (CBhideid->isChecked())
+ returnOptions<<"--throw-keyid";
+ /*if ((KGpgSettings::allowCustomEncryptionOptions()) && (!customOptions.stripWhiteSpace().isEmpty()))
+ returnOptions.operator+ (QStringList::split(QString(" "),customOptions.simplifyWhiteSpace()));*/
+ //hide();
+
+//MODIFIED for kopete
+ if (fmode)
+ emit selectedKey(selectedKeys.first(),QString(),CBshred->isChecked(),CBsymmetric->isChecked());
+ else
+ emit selectedKey(selectedKeys.first(),QString(),false,CBsymmetric->isChecked());
+ accept();
+}
+
+#include "popuppublic.moc"
diff --git a/kopete/plugins/cryptography/popuppublic.h b/kopete/plugins/cryptography/popuppublic.h
new file mode 100644
index 00000000..7e147385
--- /dev/null
+++ b/kopete/plugins/cryptography/popuppublic.h
@@ -0,0 +1,78 @@
+//File Imported from KGPG ( 2004 - 09 - 03 )
+
+/***************************************************************************
+ popuppublic.h - description
+ -------------------
+ begin : Sat Jun 29 2002
+ copyright : (C) 2002 by Jean-Baptiste Mardelle
+ email : bj@altern.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 POPUPPUBLIC_H
+#define POPUPPUBLIC_H
+
+#include <kdialogbase.h>
+
+//#include <kiconloader.h>
+#include <kshortcut.h>
+
+
+class QPushButton;
+class QCheckBox;
+class KListView;
+class QButtonGroup;
+class KProcIO;
+
+class popupPublic : public KDialogBase //QDialog
+{
+ Q_OBJECT
+public:
+
+ popupPublic(QWidget *parent=0, const char *name=0,QString sfile="",bool filemode=false,KShortcut goDefaultKey=QKeySequence(CTRL+Qt::Key_Home));
+ ~popupPublic();
+ KListView *keysList;
+ QCheckBox *CBarmor,*CBuntrusted,*CBshred,*CBsymmetric,*CBhideid;
+ bool fmode,trusted;
+ QPixmap keyPair,keySingle,keyGroup;
+ QString seclist;
+ QStringList untrustedList;
+
+private:
+ KConfig *config;
+ QButtonGroup *boutonboxoptions;
+ QString customOptions;
+
+private slots:
+ void customOpts(const QString &);
+ void slotprocread(KProcIO *);
+ void slotpreselect();
+ void refreshkeys();
+ void refresh(bool state);
+ void isSymetric(bool state);
+ void sort();
+ void enable();
+ void slotGotoDefaultKey();
+
+public slots:
+void slotAccept();
+void slotSetVisible();
+
+protected slots:
+virtual void slotOk();
+
+signals:
+ void selectedKey(QString & ,QString,bool,bool);
+ void keyListFilled();
+
+};
+
+#endif // POPUPPUBLIC_H
+