Commit 380254bc authored by Laurent Montel's avatar Laurent Montel 😁

Install html file

parent 4e7135d2
......@@ -242,3 +242,5 @@ install( FILES
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel
)
add_subdirectory(editor/addresseditor/html)
......@@ -24,14 +24,17 @@
#include "addressgrantleeobject.h"
#include <grantlee/engine.h>
#include <QVariantList>
#include <QStandardPaths>
AddressesLocationGrantleeFormater::AddressesLocationGrantleeFormater(QObject *parent)
: QObject(parent),
mEngine(new Grantlee::Engine)
{
mTemplateLoader = QSharedPointer<Grantlee::FileSystemTemplateLoader>(new Grantlee::FileSystemTemplateLoader);
QString themePath; //TODO
changeGrantleePath(themePath);
mGrantleeThemePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QStringLiteral("akonadicontact/grantleetheme/default/"),
QStandardPaths::LocateDirectory);
changeGrantleePath(mGrantleeThemePath);
}
AddressesLocationGrantleeFormater::~AddressesLocationGrantleeFormater()
......@@ -48,8 +51,10 @@ QString AddressesLocationGrantleeFormater::formatAddresses(const KContacts::Addr
AddressGrantleeObject *addressObj = new AddressGrantleeObject(addresses.at(i), i);
addressList << QVariant::fromValue(static_cast<QObject *>(addressObj));
}
//TODO
QVariantHash addressHash;
addressHash.insert(QStringLiteral("addresses"), addressList);
addressHash.insert(QStringLiteral("absoluteThemePath"), mGrantleeThemePath);
Grantlee::Context context(addressHash);
const QString contentHtml = mSelfcontainedTemplate->render(&context);
return contentHtml;
......
......@@ -44,6 +44,7 @@ private:
void changeGrantleePath(const QString &path);
Grantlee::Engine *mEngine;
QString mErrorMessage;
QString mGrantleeThemePath;
QSharedPointer<Grantlee::FileSystemTemplateLoader> mTemplateLoader;
Grantlee::Template mSelfcontainedTemplate;
};
......
install(DIRECTORY default DESTINATION ${KDE_INSTALL_DATADIR}/akonadicontact/grantleetheme/ )
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