Commit 2c6920cc authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve plugins

parent dc473a0a
......@@ -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)"));
......
......@@ -34,7 +34,7 @@ public:
private:
void slotImportLdif();
void slotExportLdif();
void import();
void importLdif();
void exportLdif();
};
......
......@@ -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
......
......@@ -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
Supports Markdown
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