Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 48b605e1 authored by Laurent Montel's avatar Laurent Montel 😁

Load plugins

parent 32c9536a
......@@ -21,11 +21,33 @@
*/
#include "addresseslocationwidget.h"
#include "abstractaddresslocationwidget.h"
#include "contacteditor_debug.h"
#include <KPluginFactory>
#include <KPluginLoader>
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QLabel>
using namespace ContactEditor;
AddressesLocationWidget::AddressesLocationWidget(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setMargin(0);
KPluginLoader loader(QStringLiteral("contacteditor/addresslocationeditorplugin"));
KPluginFactory *factory = loader.factory();
if (factory) {
mAbstractAddressLocationWidget = factory->create<ContactEditor::AbstractAddressLocationWidget>();
mainLayout->addWidget(mAbstractAddressLocationWidget);
} else {
qCWarning(CONTACTEDITOR_LOG) << " error during loading contacteditor plugin : " << loader.errorString();
QLabel *lab = new QLabel(i18n("Missing plugins. Please verify your installation"), this);
lab->setAlignment(Qt::AlignCenter);
mainLayout->addWidget(lab);
}
}
AddressesLocationWidget::~AddressesLocationWidget()
......@@ -34,15 +56,21 @@ AddressesLocationWidget::~AddressesLocationWidget()
void AddressesLocationWidget::loadContact(const KContacts::Addressee &contact)
{
//TODO
if (mAbstractAddressLocationWidget) {
mAbstractAddressLocationWidget->loadContact(contact);
}
}
void AddressesLocationWidget::storeContact(KContacts::Addressee &contact) const
{
//TODO
if (mAbstractAddressLocationWidget) {
mAbstractAddressLocationWidget->storeContact(contact);
}
}
void AddressesLocationWidget::setReadOnly(bool readOnly)
{
//TODO
if (mAbstractAddressLocationWidget) {
mAbstractAddressLocationWidget->setReadOnly(readOnly);
}
}
......@@ -26,6 +26,7 @@
#include <QSplitter>
#include <KContacts/Addressee>
namespace ContactEditor {
class AbstractAddressLocationWidget;
class AddressesLocationWidget : public QWidget
{
Q_OBJECT
......@@ -37,6 +38,8 @@ public:
void storeContact(KContacts::Addressee &contact) const;
void setReadOnly(bool readOnly);
private:
AbstractAddressLocationWidget *mAbstractAddressLocationWidget;
};
}
#endif // ADDRESSESLOCATIONWIDGET_H
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