Commit c1f017ce authored by Laurent Montel's avatar Laurent Montel 😁

Add viewer

parent 27a1c151
......@@ -31,6 +31,7 @@ ecm_setup_version(${KDEPIMLIBS_VERSION} VARIABLE_PREFIX AKONADICONTACT
SOVERSION 5
)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test WebKitWidgets)
########### Find packages ###########
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_VERSION} CONFIG REQUIRED)
......
......@@ -166,6 +166,7 @@ PRIVATE
KF5::XmlGui
Phonon::phonon4qt5
Grantlee5::Templates
Qt5::WebKitWidgets
)
if(KF5Prison_FOUND)
......
......@@ -22,11 +22,18 @@
#include "addresseslocationviewer.h"
#include "addresseslocationgrantleeformater.h"
#include <QWebSettings>
AddressesLocationViewer::AddressesLocationViewer(QWidget *parent)
: QWidget(parent),
: QWebView(parent),
mAddressesLocationGrantleeFormatter(new AddressesLocationGrantleeFormater(this))
{
setContextMenuPolicy(Qt::CustomContextMenu);
settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
settings()->setAttribute(QWebSettings::JavaEnabled, false);
settings()->setAttribute(QWebSettings::PluginsEnabled, false);
settings()->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
settings()->setAttribute(QWebSettings::AutoLoadImages, true);
connect(this, &AddressesLocationViewer::linkClicked, this, &AddressesLocationViewer::slotLinkClicked);
}
AddressesLocationViewer::~AddressesLocationViewer()
......@@ -34,6 +41,11 @@ AddressesLocationViewer::~AddressesLocationViewer()
}
void AddressesLocationViewer::slotLinkClicked(const QUrl &url)
{
}
void AddressesLocationViewer::updateView()
{
const QString html = mAddressesLocationGrantleeFormatter->formatAddresses(mAddresses);
......
......@@ -24,10 +24,10 @@
#ifndef ADDRESSESLOCATIONVIEWER_H
#define ADDRESSESLOCATIONVIEWER_H
#include <QWidget>
#include <QWebView>
#include <KContacts/Address>
class AddressesLocationGrantleeFormater;
class AddressesLocationViewer : public QWidget
class AddressesLocationViewer : public QWebView
{
Q_OBJECT
public:
......@@ -40,6 +40,9 @@ public:
KContacts::Address::List addresses() const;
void setAddresses(const KContacts::Address::List &addresses);
private Q_SLOTS:
void slotLinkClicked(const QUrl &url);
private:
void updateView();
KContacts::Address::List mAddresses;
......
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