[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    sharing the PGP code
From:       Mathias Waack <mathias () atoll-net ! de>
Date:       2001-04-08 12:22:52
[Download RAW message or body]

Hi all, 

I've made a first attempt to move the pgp code into libkdenetwork. It works 
at least for me, but is a bit dirty because of the busy pointer stuff. Kpgp 
is now a abstract class, each application using it must create its own 
implementation. The virtual functions 
    virtual void setBusy() =0;
    virtual bool isBusy() =0;
    virtual void idle() =0;
must be implemented. The implementation in KMail is obvious, in KNode I leave 
them empty. 
The only problem are the static methods using the kpgpObject. Each 
application must create such an object (no problem), and it must never delete 
it. The latter is a problem, I don't know how to implement it. But anyway, it 
works now. 
Some small changes in the pgp-code:

- in the desctructor of Kpgp I've added the line
	if (kpgpObject == this) kpgpObject = 0;  
   to make it easier to find the problem if an application deletes its
   kpgpObject
- in the config dialog I changed the sentence "are not encrypted by KMail."
   to "are not encrypted by the Pgp module."
- the constructor of the config dialog gets a boolean flag to disable the
   encrypt to self check box, because KNode doesn't use encryption

I've created a Wrapper class for KMail. The header and source files are 
attached. The cvs diff also. You just need to remove kpgp* and apply the 
patch. 

BTW, who is the current maintainer of the pgp code? 

Mathias

PS: libkdentwork contains the backport of the qregexp from Qt3. Maybe you 
want use it for your filters?


["kmpgpwrap.cpp" (text/x-c++)]

#include <kpgp.h>
#include "kmkernel.h"
#include "kmpgpwrap.h"
#include "kbusyptr.h"

KMpgpWrap::KMpgpWrap()
  : Kpgp()
{
}

KMpgpWrap::~KMpgpWrap()
{
}

void KMpgpWrap::setBusy()
{
  kernel->kbp()->busy();
}

bool KMpgpWrap::isBusy()
{
  return kernel->kbp()->isBusy();
}

void KMpgpWrap::idle()
{
  kernel->kbp()->idle();
}


["kmpgpwrap.h" (text/x-c++)]

#ifndef KMPGPWRAP_H
#define KMPGPWRAP_H

#include <kpgp.h>

class KMpgpWrap : public Kpgp
{
public:
  KMpgpWrap();
  virtual ~KMpgpWrap();
  virtual void setBusy();
  virtual bool isBusy();
  virtual void idle();
};

#endif

["cvs.diff" (text/plain)]

Index: Makefile.am
===================================================================
RCS file: /home/kde/kdenetwork/kmail/Makefile.am,v
retrieving revision 1.107
diff -u -3 -p -r1.107 Makefile.am
--- Makefile.am	2001/04/03 21:56:00	1.107
+++ Makefile.am	2001/04/08 12:33:10
@@ -1,12 +1,12 @@
 KDE_CXXFLAGS = $(USE_RTTI) -UQT_NO_ASCII_CAST -UQT_NO_COMPAT
 
 SUBDIRS = about pics
-INCLUDES = $(all_includes)
-LDADD	= $(LIB_KHTML) -lkspell -lmimelib -lkab $(LIB_KFILE)
+INCLUDES = -I$(top_srcdir)/libkdenetwork $(all_includes)
+LDADD	= $(LIB_KHTML) -lkdenetwork -lkspell -lmimelib -lkab $(LIB_KFILE)
 
 bin_PROGRAMS = kmail
 
-kmail_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+kmail_LDFLAGS = -L../libkdenetwork $(all_libraries) $(KDE_RPATH)
 kmail_SOURCES = kmsender.cpp kmmessage.cpp kmmainwin.cpp \
 		kmfolderdia.cpp kmfoldertree.cpp \
 		kmaccount.cpp kmheaders.cpp \
@@ -19,7 +19,7 @@ kmail_SOURCES = kmsender.cpp kmmessage.c
 		kmacctseldlg.cpp kmfiltermgr.cpp \
 		kmfilteraction.cpp kmidentity.cpp \
 		kmfolderseldlg.cpp kmfilter.cpp kmfilterdlg.cpp \
-		kmmsgbase.cpp kmmsglist.cpp kpgp.cpp kpgpbase.cpp\
+		kmmsgbase.cpp kmmsglist.cpp kmpgpwrap.cpp \
 		kfileio.cpp kmaddrbook.cpp \
 		kmaddrbookdlg.cpp kmiostatusdlg.cpp \
 		kmnewiostatus.cpp kmnewiostatuswdg.cpp \
Index: kmcomposewin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.cpp,v
retrieving revision 1.328
diff -u -3 -p -r1.328 kmcomposewin.cpp
--- kmcomposewin.cpp	2001/04/06 16:10:47	1.328
+++ kmcomposewin.cpp	2001/04/08 12:33:15
@@ -20,7 +20,7 @@
 #include "kfileio.h"
 #include "kbusyptr.h"
 #include "kmmsgpartdlg.h"
-#include "kpgp.h"
+#include <kpgp.h>
 #include "kmaddrbookdlg.h"
 #include "kmaddrbook.h"
 #include "kmidentity.h"
Index: kmkernel.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmkernel.cpp,v
retrieving revision 1.39
diff -u -3 -p -r1.39 kmkernel.cpp
--- kmkernel.cpp	2001/03/13 18:41:00	1.39
+++ kmkernel.cpp	2001/04/08 12:33:17
@@ -31,6 +31,7 @@
 #include "kbusyptr.h"
 #include "kmaddrbook.h"
 #include "kfileio.h"
+#include "kmpgpwrap.h"
 #include <kabapi.h>
 #include <kwin.h>
 
@@ -46,6 +47,7 @@ KMKernel::KMKernel (QObject *parent, con
 {
   //kdDebug() << "KMKernel::KMKernel" << endl;
   mySelf = this;
+  new KMpgpWrap();
 }
 
 KMKernel::~KMKernel ()
Index: kmmessage.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmessage.cpp,v
retrieving revision 1.182
diff -u -3 -p -r1.182 kmmessage.cpp
--- kmmessage.cpp	2001/04/06 12:51:34	1.182
+++ kmmessage.cpp	2001/04/08 12:33:21
@@ -8,7 +8,7 @@
 #include "kmmsgpart.h"
 #include "kmmsginfo.h"
 #include "kmreaderwin.h"
-#include "kpgp.h"
+#include <kpgp.h>
 
 #include "kmfolder.h"
 #include "kmundostack.h"
Index: kmreaderwin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmreaderwin.cpp,v
retrieving revision 1.258
diff -u -3 -p -r1.258 kmreaderwin.cpp
--- kmreaderwin.cpp	2001/04/05 20:19:09	1.258
+++ kmreaderwin.cpp	2001/04/08 12:33:24
@@ -44,7 +44,7 @@
 #include "kfileio.h"
 #include "kbusyptr.h"
 #include "kmmsgpartdlg.h"
-#include "kpgp.h"
+#include <kpgp.h>
 #include "kurl.h"
 
 // for selection

_______________________________________________
Kmail Developers mailing list
Kmail@master.kde.org
http://master.kde.org/mailman/listinfo/kmail


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic