summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2021-06-29 13:17:37 +0200
committerSlávek Banko <slavek.banko@axis.cz>2021-07-01 12:27:39 +0200
commit036880495c584526b536b08589620290a9171f8c (patch)
treef10637d949527f8cf87d565092b84848b8891c8e
parentf389a60aad6a9d0ca5cd648f4743bfa1c30ed904 (diff)
downloadkopete-otr-036880495c584526b536b08589620290a9171f8c.tar.gz
kopete-otr-036880495c584526b536b08589620290a9171f8c.zip
Create a custom OTRPluginFactory object instead of using the KGenericFactory
template. This prevents an unwanted creation of a hidden second instance if the library is built with enabled hidden visibility. This resolves issue #3. Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 186deab80cc9a4b742027d74f8025e15bbd334ca)
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/otrguiclient.cpp3
-rw-r--r--src/otrguiclient.h7
-rw-r--r--src/otrlchatinterface.cpp6
-rw-r--r--src/otrlconfinterface.cpp4
-rw-r--r--src/otrlconfinterface.h2
-rw-r--r--src/otrplugin-factory.cpp38
-rw-r--r--src/otrplugin-factory.h45
-rw-r--r--src/otrplugin.cpp11
-rw-r--r--src/otrplugin.h6
-rw-r--r--src/otrpreferences.cpp4
-rw-r--r--src/otrpreferences.h1
-rw-r--r--src/privkeypopup.cpp5
-rw-r--r--src/privkeypopup.h2
-rw-r--r--src/smppopup.cpp16
-rw-r--r--src/smppopup.h2
-rw-r--r--src/verifypopup.cpp3
-rw-r--r--src/verifypopup.h2
18 files changed, 122 insertions, 36 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index efb8046..5ebb546 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -83,6 +83,7 @@ tde_add_kpart( ${PROJECT_NAME} AUTOMOC
SOURCES
otrplugin-factory.cpp
+
LINK
kotr-shared
tdecore-shared
diff --git a/src/otrguiclient.cpp b/src/otrguiclient.cpp
index ccafe80..48dc193 100644
--- a/src/otrguiclient.cpp
+++ b/src/otrguiclient.cpp
@@ -18,6 +18,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
#include <tdeaction.h>
#include <tdelocale.h>
diff --git a/src/otrguiclient.h b/src/otrguiclient.h
index 084d515..9eaef0e 100644
--- a/src/otrguiclient.h
+++ b/src/otrguiclient.h
@@ -45,12 +45,9 @@ namespace Kopete { class ChatSession; }
*/
-
-
-class OtrGUIClient : public TQObject , public KXMLGUIClient
+class OtrGUIClient : public TQObject, public KXMLGUIClient
{
Q_OBJECT
-
public:
@@ -70,7 +67,7 @@ private slots:
void slotDisableOtr();
void encryptionEnabled( Kopete::ChatSession* session, int state );
void slotVerifyFingerprint();
-
+
signals:
void signalOtrChatsession( Kopete::ChatSession* session, bool enable );
void signalVerifyFingerprint( Kopete::ChatSession *session );
diff --git a/src/otrlchatinterface.cpp b/src/otrlchatinterface.cpp
index 41fd427..5e11453 100644
--- a/src/otrlchatinterface.cpp
+++ b/src/otrlchatinterface.cpp
@@ -24,6 +24,10 @@
* @author Michael Zanetti
*/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -60,8 +64,6 @@
#include "privkeypopup.h"
#include "smppopup.h"
-#include "config.h"
-
OtrlChatInterface *OtrlChatInterface::mSelf = 0;
static OtrlUserState userstate;
static OtrlPolicy confPolicy;
diff --git a/src/otrlconfinterface.cpp b/src/otrlconfinterface.cpp
index 5b4f6f0..dc79ee5 100644
--- a/src/otrlconfinterface.cpp
+++ b/src/otrlconfinterface.cpp
@@ -23,6 +23,10 @@
* @author Michael Zanetti
*/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
#include <tqapplication.h>
#include <tqeventloop.h>
diff --git a/src/otrlconfinterface.h b/src/otrlconfinterface.h
index 801889a..d0579f7 100644
--- a/src/otrlconfinterface.h
+++ b/src/otrlconfinterface.h
@@ -60,7 +60,7 @@ private:
OtrlUserState userstate;
TQWidget *preferencesDialog;
- Fingerprint *findFingerprint( TQString strFingerprint );
+ Fingerprint *findFingerprint( TQString strFingerprint );
};
#endif
diff --git a/src/otrplugin-factory.cpp b/src/otrplugin-factory.cpp
index bf1df9f..1d6fafc 100644
--- a/src/otrplugin-factory.cpp
+++ b/src/otrplugin-factory.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2007 by Michael Zanetti *
+ * Copyright (C) 2021 by Slávek Banko *
* *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -15,18 +15,44 @@
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
#include <kgenericfactory.h>
#include <tdeaboutdata.h>
+#include "otrplugin-factory.h"
#include "otrplugin.h"
-/**
- * @author Michael Zanetti
- */
-typedef KGenericFactory<OTRPlugin> OTRPluginFactory;
+// typedef KGenericFactory<OTRPlugin> OTRPluginFactory;
static const TDEAboutData aboutdata("kopete_otr", I18N_NOOP("OTR") , "0.7" );
K_EXPORT_COMPONENT_FACTORY( kopete_otr, OTRPluginFactory( &aboutdata ) )
+
+TDEInstance *OTRPluginFactory::s_instance = 0;
+
+OTRPluginFactory::OTRPluginFactory( const TDEAboutData *aboutdata )
+{
+ s_instance = new TDEInstance( aboutdata );
+}
+
+OTRPluginFactory::~OTRPluginFactory()
+{
+ delete s_instance;
+}
+
+KParts::Part *OTRPluginFactory::createPartObject( TQWidget * /*parentWidget*/,
+ const char * /*widgetName*/,
+ TQObject *parent,
+ const char *name,
+ const char * /*className*/,
+ const TQStringList & args )
+{
+ return (KParts::Part*) new OTRPlugin( instance(), parent, name, args);
+}
+
+#include "otrplugin-factory.moc"
diff --git a/src/otrplugin-factory.h b/src/otrplugin-factory.h
new file mode 100644
index 0000000..a38ea5f
--- /dev/null
+++ b/src/otrplugin-factory.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+ * Copyright (C) 2021 by Slávek Banko *
+ * *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#if !defined(OTRPLUGIN_FACTORY_H)
+#define OTRPLUGIN_FACTORY_H
+
+#include <tdeparts/factory.h>
+
+
+class OTRPluginFactory : public KParts::Factory
+{
+ Q_OBJECT
+
+public:
+ OTRPluginFactory( const TDEAboutData* );
+ virtual ~OTRPluginFactory();
+
+ virtual KParts::Part *createPartObject( TQWidget *parentWidget, const char *widgetName,
+ TQObject *parent, const char *name,
+ const char *className, const TQStringList &args );
+
+ static TDEInstance *instance() { return s_instance; }
+
+private:
+ static TDEInstance *s_instance;
+};
+
+#endif /* OTRPLUGIN_FACTORY_H */
diff --git a/src/otrplugin.cpp b/src/otrplugin.cpp
index 0d9a5fe..a78cfd5 100644
--- a/src/otrplugin.cpp
+++ b/src/otrplugin.cpp
@@ -18,6 +18,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
#include <tqstylesheet.h>
#include <tqtimer.h>
#include <tqregexp.h>
@@ -56,11 +60,8 @@
*/
-
-typedef KGenericFactory<OTRPlugin> OTRPluginFactory;
-
-OTRPlugin::OTRPlugin( TQObject *parent, const char *name, const TQStringList & /* args */ )
-: Kopete::Plugin( OTRPluginFactory::instance(), parent, name )
+OTRPlugin::OTRPlugin( TDEInstance *instance, TQObject *parent, const char *name, const TQStringList & /* args */ )
+: Kopete::Plugin( instance, parent, name )
{
if( !pluginStatic_ )
pluginStatic_=this;
diff --git a/src/otrplugin.h b/src/otrplugin.h
index 14d582b..23943aa 100644
--- a/src/otrplugin.h
+++ b/src/otrplugin.h
@@ -19,7 +19,7 @@
#define OTRPLUGIN_H
-#include "kdebug.h"
+#include <kdebug.h>
#include <kopeteplugin.h>
#include <kopetemessagehandler.h>
@@ -68,13 +68,12 @@ public:
class KDE_EXPORT OTRPlugin : public Kopete::Plugin
{
Q_OBJECT
-
public:
static OTRPlugin *plugin();
- OTRPlugin( TQObject *parent, const char *name, const TQStringList &args );
+ OTRPlugin( TDEInstance *instance, TQObject *parent, const char *name, const TQStringList &args );
~OTRPlugin();
void emitGoneSecure( Kopete::ChatSession *session, int status );
@@ -113,7 +112,6 @@ private:
signals:
void goneSecure( Kopete::ChatSession *session, int state );
-
};
#endif
diff --git a/src/otrpreferences.cpp b/src/otrpreferences.cpp
index 9fabb3f..6f6fafe 100644
--- a/src/otrpreferences.cpp
+++ b/src/otrpreferences.cpp
@@ -18,6 +18,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqmap.h>
diff --git a/src/otrpreferences.h b/src/otrpreferences.h
index 12e4ab1..f4b4f16 100644
--- a/src/otrpreferences.h
+++ b/src/otrpreferences.h
@@ -31,7 +31,6 @@
class OTRPreferences : public TDECModule {
Q_OBJECT
-
public:
OTRPreferences(TQWidget *parent = 0, const char *name = 0, const TQStringList &args = TQStringList());
diff --git a/src/privkeypopup.cpp b/src/privkeypopup.cpp
index 3d3b8e4..58c92b5 100644
--- a/src/privkeypopup.cpp
+++ b/src/privkeypopup.cpp
@@ -22,6 +22,11 @@
* @author Michael Zanetti
*/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <kdemacros.h>
#include "privkeypopup.h"
diff --git a/src/privkeypopup.h b/src/privkeypopup.h
index a069528..fab64ab 100644
--- a/src/privkeypopup.h
+++ b/src/privkeypopup.h
@@ -30,7 +30,6 @@
class PrivKeyPopup : public PrivKeyPopupUI
{
Q_OBJECT
-
public:
PrivKeyPopup(TQWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
@@ -53,4 +52,3 @@ protected slots:
};
#endif
-
diff --git a/src/smppopup.cpp b/src/smppopup.cpp
index 0a550cc..fef988e 100644
--- a/src/smppopup.cpp
+++ b/src/smppopup.cpp
@@ -18,13 +18,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include "tqlabel.h"
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
-#include "kdebug.h"
-#include "tdelocale.h"
-#include "klineedit.h"
-#include "kurl.h"
-#include "krun.h"
+#include <tqlabel.h>
+
+#include <kdebug.h>
+#include <tdelocale.h>
+#include <klineedit.h>
+#include <kurl.h>
+#include <krun.h>
#include "smppopup.h"
#include "verifypopup.h"
diff --git a/src/smppopup.h b/src/smppopup.h
index 69c9513..10801dd 100644
--- a/src/smppopup.h
+++ b/src/smppopup.h
@@ -33,7 +33,6 @@ extern "C"{
class SMPPopup : public SMPPopupUI
{
Q_OBJECT
-
public:
SMPPopup(TQWidget* parent = 0, const char* name = 0, TQString title = TQString::null, WFlags fl = 0, ConnContext *context = 0, Kopete::ChatSession *session = 0, bool initiate = true );
@@ -61,4 +60,3 @@ protected slots:
};
#endif
-
diff --git a/src/verifypopup.cpp b/src/verifypopup.cpp
index 12397aa..92b52eb 100644
--- a/src/verifypopup.cpp
+++ b/src/verifypopup.cpp
@@ -18,6 +18,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
#include "verifypopup.h"
#include "otrlchatinterface.h"
diff --git a/src/verifypopup.h b/src/verifypopup.h
index d74a4e9..934de5d 100644
--- a/src/verifypopup.h
+++ b/src/verifypopup.h
@@ -27,7 +27,6 @@
class VerifyPopup : public VerifyPopupUI
{
Q_OBJECT
-
public:
VerifyPopup(TQWidget* parent = 0, const char* name = 0, Kopete::ChatSession *session = NULL, bool modal = FALSE, WFlags fl = 0 );
@@ -48,4 +47,3 @@ protected slots:
};
#endif
-