Commit 2d3c8b6e authored by Thomas Baumgart's avatar Thomas Baumgart
Browse files

Force usage of global settings in plugins

Since the plugins are shared objects also, we need to inject the global
settings object in the same way as has been implemented with commit
5a1b6235

BUG: 388963
parent 38f19da8
......@@ -33,6 +33,7 @@
#include "kmymoneyplugin.h"
#include "onlinepluginextended.h"
#include "kmymoneyglobalsettings.h"
namespace KMyMoneyPlugin
{
......@@ -93,6 +94,7 @@ namespace KMyMoneyPlugin
guiFactory->removeClient(it.value());
it.value()->unplug();
it.value()->injectExternalSettings(0);
delete it.value();
it = plugins.erase(it);
continue;
......@@ -125,6 +127,7 @@ namespace KMyMoneyPlugin
}
ctnPlugins.standard.insert((*it).pluginId(), plugin);
plugin->injectExternalSettings(KMyMoneyGlobalSettings::self());
plugin->plug();
guiFactory->addClient(plugin);
......
......@@ -56,6 +56,7 @@
#include "numbertowords.h"
#include "pluginsettings.h"
#include "mymoneyenums.h"
#include "kmymoneyglobalsettings.h"
struct CheckPrinting::Private {
QAction* m_action;
......@@ -102,6 +103,11 @@ CheckPrinting::~CheckPrinting()
qDebug("Plugins: checkprinting unloaded");
}
void CheckPrinting::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void CheckPrinting::plug()
{
connect(viewInterface(), &KMyMoneyPlugin::ViewInterface::transactionsSelected, this, &CheckPrinting::slotTransactionsSelected);
......
......@@ -41,6 +41,8 @@ public Q_SLOTS:
void unplug() override;
void configurationChanged() override;
void injectExternalSettings(KMyMoneySettings* p) override;
private:
void readCheckTemplate();
......
......@@ -35,6 +35,8 @@
// ----------------------------------------------------------------------------
// Project Includes
#include "kmymoneyglobalsettings.h"
CSVExporter::CSVExporter(QObject *parent, const QVariantList &args) :
KMyMoneyPlugin::Plugin(parent, "csvexporter"/*must be the same as X-KDE-PluginInfo-Name*/)
{
......@@ -51,6 +53,11 @@ CSVExporter::~CSVExporter()
qDebug("Plugins: csvexporter unloaded");
}
void CSVExporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void CSVExporter::createActions()
{
m_action = actionCollection()->addAction("file_export_csv");
......
......@@ -44,6 +44,8 @@ public:
return m_dlg;
}
void injectExternalSettings(KMyMoneySettings* p) override;
private:
CsvExportDlg* m_dlg;
......
......@@ -37,6 +37,7 @@
#include "core/csvimportercore.h"
#include "csvwizard.h"
#include "statementinterface.h"
#include "kmymoneyglobalsettings.h"
CSVImporter::CSVImporter(QObject *parent, const QVariantList &args) :
KMyMoneyPlugin::Plugin(parent, "csvimporter"/*must be the same as X-KDE-PluginInfo-Name*/)
......@@ -54,6 +55,11 @@ CSVImporter::~CSVImporter()
qDebug("Plugins: csvimporter unloaded");
}
void CSVImporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void CSVImporter::createActions()
{
m_action = actionCollection()->addAction("file_import_csv");
......
......@@ -92,6 +92,8 @@ public:
*/
virtual QString lastError() const override;
void injectExternalSettings(KMyMoneySettings* p) override;
private:
bool m_silent;
public Q_SLOTS:
......
......@@ -38,6 +38,7 @@
#include "mymoneyfile.h"
#include "mymoneyexception.h"
#include "mymoneyseqaccessmgr.h"
#include "kmymoneyglobalsettings.h"
class MyMoneyStatement;
......@@ -57,6 +58,11 @@ GNCImporter::~GNCImporter()
qDebug("Plugins: gncimporter unloaded");
}
void GNCImporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void GNCImporter::createActions()
{
m_action = actionCollection()->addAction("file_import_gnc");
......
......@@ -32,13 +32,15 @@ class MyMoneyGncReader;
class GNCImporter : public KMyMoneyPlugin::Plugin
{
Q_OBJECT
public:
explicit GNCImporter(QObject *parent, const QVariantList &args);
~GNCImporter() override;
QAction *m_action;
void injectExternalSettings(KMyMoneySettings* p) override;
private:
MyMoneyGncReader *m_gncReader;
......
......@@ -37,6 +37,7 @@
#include "schedulestoicalendar.h"
#include "pluginsettings.h"
#include "kmymoneyglobalsettings.h"
struct iCalendarExporter::Private {
QAction* m_action;
......@@ -93,6 +94,11 @@ iCalendarExporter::~iCalendarExporter()
qDebug("Plugins: icalendarexporter unloaded");
}
void iCalendarExporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void iCalendarExporter::slotFirstExport()
{
QPointer<QFileDialog> fileDialog = new QFileDialog(d->m_action->parentWidget(), QString(), QString(), QString("%1|%2\n").arg("*.ics").arg(i18nc("ICS (Filefilter)", "iCalendar files")));
......
......@@ -38,6 +38,8 @@ public:
explicit iCalendarExporter(QObject *parent, const QVariantList &args);
~iCalendarExporter() override;
void injectExternalSettings(KMyMoneySettings* p) override;
protected Q_SLOTS:
// this is the export function called when the user selects the interface menu
void slotFirstExport();
......
......@@ -89,6 +89,7 @@
#include "mymoneystatement.h"
#include "statementinterface.h"
#include "viewinterface.h"
#include "kmymoneyglobalsettings.h"
#ifdef KMM_DEBUG
// Added an option to open the chipTanDialog from the menu for debugging purposes
......@@ -173,6 +174,11 @@ KBanking::~KBanking()
qDebug("Plugins: kbanking unloaded");
}
void KBanking::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void KBanking::plug()
{
m_kbanking = new KBankingExt(this, "KMyMoney");
......
......@@ -88,6 +88,8 @@ public:
void plug() override;
void unplug() override;
void injectExternalSettings(KMyMoneySettings* p) override;
private:
/**
* creates the action objects available through the application menus
......
......@@ -39,6 +39,7 @@ class KToggleAction;
#include "mymoneykeyvaluecontainer.h"
class MyMoneyAccount;
class KMyMoneySettings;
namespace KMyMoneyPlugin { class ImportInterface; }
namespace KMyMoneyPlugin { class StatementInterface; }
namespace KMyMoneyPlugin { class ViewInterface; }
......@@ -126,6 +127,8 @@ public Q_SLOTS:
*/
virtual void configurationChanged() ;
virtual void injectExternalSettings(KMyMoneySettings* p) = 0;
protected:
/** See KMyMoneyApp::toggleAction() for a description */
KToggleAction* toggleAction(const QString& name) const;
......
......@@ -49,6 +49,7 @@
#include "statementinterface.h"
#include "importinterface.h"
#include "ui_importoption.h"
#include "kmymoneyglobalsettings.h"
//#define DEBUG_LIBOFX
......@@ -106,6 +107,11 @@ OFXImporter::~OFXImporter()
qDebug("Plugins: ofximporter unloaded");
}
void OFXImporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void OFXImporter::createActions()
{
QAction *action = actionCollection()->addAction("file_import_ofx");
......
......@@ -43,7 +43,7 @@ class OFXImporter : public KMyMoneyPlugin::Plugin, public KMyMoneyPlugin::Import
Q_OBJECT
Q_INTERFACES(KMyMoneyPlugin::ImporterPlugin)
Q_INTERFACES(KMyMoneyPlugin::OnlinePlugin)
public:
explicit OFXImporter(QObject *parent, const QVariantList &args);
~OFXImporter() override;
......@@ -115,6 +115,8 @@ public:
bool mapAccount(const MyMoneyAccount& acc, MyMoneyKeyValueContainer& settings) override;
bool updateAccount(const MyMoneyAccount& acc, bool moreAccounts) override;
void injectExternalSettings(KMyMoneySettings* p) override;
protected Q_SLOTS:
void slotImportFile();
void slotImportFile(const QString& url);
......
......@@ -33,6 +33,7 @@
#include "kexportdlg.h"
#include "mymoneyqifwriter.h"
#include "kmymoneyglobalsettings.h"
QIFExporter::QIFExporter(QObject *parent, const QVariantList &args) :
KMyMoneyPlugin::Plugin(parent, "qifexporter"/*must be the same as X-KDE-PluginInfo-Name*/)
......@@ -50,6 +51,12 @@ QIFExporter::~QIFExporter()
qDebug("Plugins: qifexporter unloaded");
}
void QIFExporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void QIFExporter::createActions()
{
m_action = actionCollection()->addAction("file_export_qif");
......
......@@ -32,7 +32,7 @@ class MyMoneyQifReader;
class QIFExporter : public KMyMoneyPlugin::Plugin
{
Q_OBJECT
public:
explicit QIFExporter(QObject *parent, const QVariantList &args);
~QIFExporter() override;
......@@ -41,6 +41,8 @@ public:
MyMoneyQifReader *m_qifReader;
void injectExternalSettings(KMyMoneySettings* p) override;
public Q_SLOTS:
/**
* Called when the user wishes to export some transaction to a
......
......@@ -33,6 +33,7 @@
#include "kimportdlg.h"
#include "mymoneyqifreader.h"
#include "statementinterface.h"
#include "kmymoneyglobalsettings.h"
class MyMoneyStatement;
......@@ -52,6 +53,11 @@ QIFImporter::~QIFImporter()
qDebug("Plugins: qifimporter unloaded");
}
void QIFImporter::injectExternalSettings(KMyMoneySettings* p)
{
KMyMoneyGlobalSettings::injectExternalSettings(p);
}
void QIFImporter::createActions()
{
m_action = actionCollection()->addAction("file_import_qif");
......
......@@ -33,13 +33,15 @@ class MyMoneyQifReader;
class QIFImporter : public KMyMoneyPlugin::Plugin
{
Q_OBJECT
public:
explicit QIFImporter(QObject *parent, const QVariantList &args);
~QIFImporter() override;
QAction *m_action;
void injectExternalSettings(KMyMoneySettings* p) override;
private:
MyMoneyQifReader *m_qifReader;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment