summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-12 05:23:12 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-12 05:23:12 (GMT)
commit2c6920cc78ccd3ec13284479a40dd471cfe47d34 (patch)
tree2ba7fc71491bbae6c0d5a7154609bf39a7c67562
parentdc473a0a6396f3fe131f93600c18db160b2478b6 (diff)
Improve plugins
-rw-r--r--kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp4
-rw-r--r--kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h2
-rw-r--r--kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.cpp34
-rw-r--r--kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.h11
4 files changed, 47 insertions, 4 deletions
diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp
index a7fe757..26b15e2 100644
--- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.cpp
@@ -66,7 +66,7 @@ void LDifImportExportPluginInterface::exec()
{
switch(mImportExportAction) {
case Import:
- import();
+ importLdif();
break;
case Export:
exportLdif();
@@ -87,7 +87,7 @@ void LDifImportExportPluginInterface::slotExportLdif()
}
-void LDifImportExportPluginInterface::import()
+void LDifImportExportPluginInterface::importLdif()
{
KAddressBookImportExport::KAddressBookImportExportContactList contactList;
const QString fileName = QFileDialog::getOpenFileName(parentWidget(), QString(), QDir::homePath(), i18n("LDif Files (*.ldif)"));
diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h
index 3457f2e..07525c3 100644
--- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h
+++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugininterface.h
@@ -34,7 +34,7 @@ public:
private:
void slotImportLdif();
void slotExportLdif();
- void import();
+ void importLdif();
void exportLdif();
};
diff --git a/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.cpp b/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.cpp
index d01649c..4d67dde 100644
--- a/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.cpp
@@ -27,7 +27,8 @@
#include <QUrl>
VCardImportExportPluginInterface::VCardImportExportPluginInterface(QObject *parent)
- : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent)
+ : KAddressBookImportExport::KAddressBookImportExportPluginInterface(parent),
+ mExportVCardType(VCard3)
{
}
@@ -43,6 +44,7 @@ void VCardImportExportPluginInterface::createAction(KActionCollection *ac)
QAction *action = ac->addAction(QStringLiteral("file_import_vcard"));
action->setText(i18n("Import vCard..."));
action->setWhatsThis(i18n("Import contacts from a vCard file."));
+ connect(action, &QAction::triggered, this, &VCardImportExportPluginInterface::slotImportVCard);
setImportActions(QList<QAction *>() << action);
QList<QAction *> exportActionList;
@@ -50,20 +52,44 @@ void VCardImportExportPluginInterface::createAction(KActionCollection *ac)
action = ac->addAction(QStringLiteral("file_export_vcard40"));
action->setWhatsThis(i18n("Export contacts to a vCard 4.0 file."));
action->setText(i18n("Export vCard 4.0..."));
+ connect(action, &QAction::triggered, this, &VCardImportExportPluginInterface::slotExportVCard4);
exportActionList << action;
action = ac->addAction(QStringLiteral("file_export_vcard30"));
action->setText(i18n("Export vCard 3.0..."));
action->setWhatsThis(i18n("Export contacts to a vCard 3.0 file."));
+ connect(action, &QAction::triggered, this, &VCardImportExportPluginInterface::slotExportVCard3);
exportActionList << action;
action = ac->addAction(QStringLiteral("file_export_vcard21"));
action->setText(i18n("Export vCard 2.1..."));
action->setWhatsThis(i18n("Export contacts to a vCard 2.1 file."));
+ connect(action, &QAction::triggered, this, &VCardImportExportPluginInterface::slotExportVCard2);
exportActionList << action;
setExportActions(exportActionList);
}
+void VCardImportExportPluginInterface::slotExportVCard4()
+{
+ mImportExportAction = Export;
+ mExportVCardType = VCard4;
+ Q_EMIT emitPluginActivated(this);
+}
+
+void VCardImportExportPluginInterface::slotExportVCard3()
+{
+ mImportExportAction = Export;
+ mExportVCardType = VCard3;
+ Q_EMIT emitPluginActivated(this);
+}
+
+void VCardImportExportPluginInterface::slotExportVCard2()
+{
+ mImportExportAction = Export;
+ mExportVCardType = VCard2_1;
+ Q_EMIT emitPluginActivated(this);
+}
+
void VCardImportExportPluginInterface::exec()
{
switch(mImportExportAction) {
@@ -76,6 +102,12 @@ void VCardImportExportPluginInterface::exec()
}
}
+void VCardImportExportPluginInterface::slotImportVCard()
+{
+ mImportExportAction = Import;
+ Q_EMIT emitPluginActivated(this);
+}
+
void VCardImportExportPluginInterface::importVCard()
{
#if 0
diff --git a/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.h b/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.h
index a845fe5..948ccfb 100644
--- a/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.h
+++ b/kaddressbook/importexportplugins/vcards/vcardimportexportplugininterface.h
@@ -33,9 +33,20 @@ public:
void exec() Q_DECL_OVERRIDE;
bool canImportFileType(const QUrl &url) Q_DECL_OVERRIDE;
private:
+ enum ExportVCardType {
+ VCard2_1 = 0,
+ VCard3,
+ VCard4
+ };
+
void exportVCard();
void importVCard();
+ void slotImportVCard();
+ void slotExportVCard4();
+ void slotExportVCard3();
+ void slotExportVCard2();
+ ExportVCardType mExportVCardType;
};
#endif // VCARDIMPORTEXPORTPLUGININTERFACE_H