summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-10 05:43:18 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-10 05:43:31 (GMT)
commitc84b8fecc3a895f3e5396d8d02d0286cd0de5c10 (patch)
treebcbc0aee889095cbe4efd77e029af87d38c75ddc
parentc904044b68c1c2c4bb0413b34434f313868f8a75 (diff)
Add signal/slot. Import plugin
-rw-r--r--kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp51
-rw-r--r--kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.h3
2 files changed, 29 insertions, 25 deletions
diff --git a/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp b/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp
index eb50b4e..d61eedc 100644
--- a/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp
@@ -36,37 +36,38 @@ GMXImportExportPluginInterface::~GMXImportExportPluginInterface()
void GMXImportExportPluginInterface::createAction(KActionCollection *ac)
{
-#if 0
QAction *action = ac->addAction(QStringLiteral("file_import_gmx"));
- action->setText(i18n("Import GMX..."));
- action->setWhatsThis(i18n("Import contacts from a GMX file."));
+ action->setText(i18n("Import GMX file..."));
+ action->setWhatsThis(i18n("Import contacts from a GMX address book file."));
setImportActions(QList<QAction *>() << action);
+ connect(action, &QAction::triggered, this, &GMXImportExportPluginInterface::slotImportGmx);
- QList<QAction *> exportActionList;
-
- action = ac->addAction(QStringLiteral("file_import_gmx"));
- action->setText(i18n("Import GMX..."));
- action->setWhatsThis(i18n("Import contacts from a GMX file."));
- exportActionList << action;
-
- action = ac->addAction(QStringLiteral("file_export_gmx40"));
- action->setWhatsThis(i18n("Export contacts to a GMX 4.0 file."));
- action->setText(i18n("Export GMX 4.0..."));
- exportActionList << action;
+ action = ac->addAction(QStringLiteral("file_export_gmx"));
+ action->setText(i18n("Export GMX file..."));
+ action->setWhatsThis(i18n("Export contacts to a GMX address book file."));
+ setExportActions(QList<QAction *>() << action);
+ connect(action, &QAction::triggered, this, &GMXImportExportPluginInterface::slotExportGmx);
+}
- action = ac->addAction(QStringLiteral("file_export_gmx30"));
- action->setText(i18n("Export GMX 3.0..."));
- action->setWhatsThis(i18n("Export contacts to a GMX 3.0 file."));
- exportActionList << action;
+void GMXImportExportPluginInterface::exec()
+{
+ switch(mImportExportAction) {
+ case Import:
+ break;
+ case Export:
+ break;
+ }
+ //TODO
+}
- action = ac->addAction(QStringLiteral("file_export_gmx21"));
- action->setText(i18n("Export GMX 2.1..."));
- action->setWhatsThis(i18n("Export contacts to a GMX 2.1 file."));
- exportActionList << action;
- setExportActions(exportActionList);
-#endif
+void GMXImportExportPluginInterface::slotImportGmx()
+{
+ mImportExportAction = Import;
+ Q_EMIT emitPluginActivated(this);
}
-void GMXImportExportPluginInterface::exec()
+void GMXImportExportPluginInterface::slotExportGmx()
{
+ mImportExportAction = Export;
+ Q_EMIT emitPluginActivated(this);
}
diff --git a/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.h b/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.h
index a865d76..6937e95 100644
--- a/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.h
+++ b/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.h
@@ -31,6 +31,9 @@ public:
void createAction(KActionCollection *ac) Q_DECL_OVERRIDE;
void exec() Q_DECL_OVERRIDE;
+private:
+ void slotImportGmx();
+ void slotExportGmx();
};
#endif // GMXIMPORTEXPORTPLUGININTERFACE_H