Commit 6c7a95a1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compiles/works with webengine

parent a05f56ab
......@@ -87,18 +87,23 @@ set(akonadicontact_editor_generalinfo_SRCS
)
if (QTWEBENGINE_EXPERIMENTAL_OPTION)
set(akonadicontact_addresslocation_webengine_editor_SRCS
set(akonadicontact_addresslocation_web_editor_SRCS
editor/addresseditor/webengine/addresseslocationengineviewer.cpp
editor/addresseditor/webengine/addresseslocationenginepage.cpp
)
set(akonadicontact_webengine_LIB Qt5::WebEngine Qt5::WebEngineWidgets)
else()
#set(akonadicontact_addresslocation_web_editor_SRCS
# editor/addresseditor/webkit/addresseslocationviewer.cpp
# )
endif()
set(akonadicontact_addresslocation_editor_SRCS
${akonadicontact_addresslocation_webengine_editor_SRCS}
editor/addresseditor/addresslocationwidget.cpp
editor/addresseditor/webkit/addresseslocationviewer.cpp
${akonadicontact_addresslocation_web_editor_SRCS}
editor/addresseditor/addresslocationwidget.cpp
editor/addresseditor/addresseslocationgrantleeformater.cpp
editor/addresseditor/addressgrantleeobject.cpp
editor/addresseditor/iconnamecache.cpp
......
#define AKONADI_CONTACT_LIB "${CMAKE_INSTALL_PREFIX}/${KDE_INSTALL_LIBDIR}"
#define AKONADI_CONTACT_PREFIX ""
#cmakedefine QTWEBENGINE_EXPERIMENTAL_OPTION 1
......@@ -22,7 +22,11 @@
#include "addresseslocationwidget.h"
#ifdef QTWEBENGINE_EXPERIMENTAL_OPTION
#include "webengine/addresseslocationengineviewer.h"
#else
#include "webkit/addresseslocationviewer.h"
#endif
#include "addresslocationwidget.h"
using namespace Akonadi;
......@@ -33,13 +37,21 @@ AddressesLocationWidget::AddressesLocationWidget(QWidget *parent)
mAddressLocationWidget = new AddressLocationWidget(this);
addWidget(mAddressLocationWidget);
mAddressLocationWidget->setObjectName(QStringLiteral("addresslocationwidget"));
#ifdef QTWEBENGINE_EXPERIMENTAL_OPTION
mAddressesLocationViewer = new AddressesLocationEngineViewer(this);
mAddressesLocationViewer->setObjectName(QStringLiteral("addresseslocationviewer"));
addWidget(mAddressesLocationViewer);
connect(mAddressesLocationViewer, &AddressesLocationEngineViewer::modifyAddress, mAddressLocationWidget, &AddressLocationWidget::slotModifyAddress);
connect(mAddressLocationWidget, &AddressLocationWidget::addNewAddress, mAddressesLocationViewer, &AddressesLocationEngineViewer::addAddress);
connect(mAddressLocationWidget, &AddressLocationWidget::updateAddress, mAddressesLocationViewer, &AddressesLocationEngineViewer::replaceAddress);
#else
mAddressesLocationViewer = new AddressesLocationViewer(this);
mAddressesLocationViewer->setObjectName(QStringLiteral("addresseslocationviewer"));
addWidget(mAddressesLocationViewer);
connect(mAddressesLocationViewer, &AddressesLocationViewer::modifyAddress, mAddressLocationWidget, &AddressLocationWidget::slotModifyAddress);
connect(mAddressLocationWidget, &AddressLocationWidget::addNewAddress, mAddressesLocationViewer, &AddressesLocationViewer::addAddress);
connect(mAddressLocationWidget, &AddressLocationWidget::updateAddress, mAddressesLocationViewer, &AddressesLocationViewer::replaceAddress);
#endif
}
AddressesLocationWidget::~AddressesLocationWidget()
......
......@@ -26,10 +26,15 @@
#include <QSplitter>
#include <KContacts/Addressee>
#include "config-akonadi-contact.h"
namespace Akonadi
{
class AddressesLocationViewer;
class AddressLocationWidget;
#ifdef QTWEBENGINE_EXPERIMENTAL_OPTION
class AddressesLocationEngineViewer;
#else
class AddressesLocationViewer;
#endif
class AddressesLocationWidget : public QSplitter
{
Q_OBJECT
......@@ -42,7 +47,11 @@ public:
void setReadOnly(bool readOnly);
private:
#ifdef QTWEBENGINE_EXPERIMENTAL_OPTION
AddressesLocationEngineViewer *mAddressesLocationViewer;
#else
AddressesLocationViewer *mAddressesLocationViewer;
#endif
AddressLocationWidget *mAddressLocationWidget;
};
}
......
if (NOT QTWEBENGINE_EXPERIMENTAL_OPTION)
set(addresseslocationviewer_SRCS addresseslocationviewertest.cpp ../webkit/addresseslocationviewer.cpp ../addresseslocationgrantleeformater.cpp
../addressgrantleeobject.cpp ../iconnamecache.cpp)
add_executable(addresseslocationviewer ${addresseslocationviewer_SRCS})
add_test(addresseslocationviewer addresseslocationviewer)
ecm_mark_as_test(addresseslocationviewer)
target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n Qt5::WebKitWidgets Grantlee5::Templates KF5::IconThemes KF5::WidgetsAddons)
set(addresseslocationviewer_SRCS addresseslocationviewertest.cpp ../webkit/addresseslocationviewer.cpp ../addresseslocationgrantleeformater.cpp
../addressgrantleeobject.cpp ../iconnamecache.cpp)
add_executable(addresseslocationviewer ${addresseslocationviewer_SRCS})
add_test(addresseslocationviewer addresseslocationviewer)
ecm_mark_as_test(addresseslocationviewer)
target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n Qt5::WebKitWidgets Grantlee5::Templates KF5::IconThemes KF5::WidgetsAddons)
set(addresslocationwidget_SRCS addresslocationwidgettest.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp)
add_executable(addresslocationwidget ${addresslocationwidget_SRCS})
add_test(addresslocationwidget addresslocationwidget)
ecm_mark_as_test(addresslocationwidget)
target_link_libraries(addresslocationwidget Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n KF5::Completion)
set(addresslocationwidget_SRCS addresslocationwidgettest.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp)
add_executable(addresslocationwidget ${addresslocationwidget_SRCS})
add_test(addresslocationwidget addresslocationwidget)
ecm_mark_as_test(addresslocationwidget)
target_link_libraries(addresslocationwidget Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n KF5::Completion)
set(addresseslocationwidget_SRCS addresseslocationwidgettest.cpp ../addresseslocationwidget.cpp ../webkit/addresseslocationviewer.cpp ../addresseslocationgrantleeformater.cpp
../addressgrantleeobject.cpp ../iconnamecache.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp)
add_executable(addresseslocationwidget ${addresseslocationwidget_SRCS})
add_test(addresseslocationwidget addresseslocationwidget)
ecm_mark_as_test(addresseslocationwidget)
target_link_libraries(addresseslocationwidget Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n KF5::Completion Qt5::WebKitWidgets
Grantlee5::Templates KF5::IconThemes KF5::WidgetsAddons)
set(addresseslocationwidget_SRCS addresseslocationwidgettest.cpp ../addresseslocationwidget.cpp ../webkit/addresseslocationviewer.cpp ../addresseslocationgrantleeformater.cpp
../addressgrantleeobject.cpp ../iconnamecache.cpp ../addresslocationwidget.cpp ../selectaddresstypecombobox.cpp ../addresstypedialog.cpp)
add_executable(addresseslocationwidget ${addresseslocationwidget_SRCS})
add_test(addresseslocationwidget addresseslocationwidget)
ecm_mark_as_test(addresseslocationwidget)
target_link_libraries(addresseslocationwidget Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n KF5::Completion Qt5::WebKitWidgets
Grantlee5::Templates KF5::IconThemes KF5::WidgetsAddons)
endif()
if (NOT QTWEBENGINE_EXPERIMENTAL_OPTION)
set(addresseditor_SRCS
main.cpp
../addresseslocationwidget.cpp
......@@ -24,3 +25,4 @@ target_link_libraries(addresseditortest
KF5::WidgetsAddons
)
endif()
/*
This file is part of Akonadi Contact.
Copyright (C) 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
Copyright (C) 2016 Laurent Montel <laurent.montel@kdab.com>
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
......@@ -21,6 +20,7 @@
*/
#include "addresseslocationengineviewer.h"
#include "addresseslocationenginepage.h"
#include "../addresseslocationgrantleeformater.h"
#include <KMessageBox>
#include <KLocalizedString>
......@@ -34,16 +34,14 @@ AddressesLocationEngineViewer::AddressesLocationEngineViewer(QWidget *parent)
: QWebEngineView(parent),
mAddressesLocationGrantleeFormatter(new AddressesLocationGrantleeFormater(this))
{
AddressesLocationEnginePage *pageEngine = new AddressesLocationEnginePage(this);
setPage(pageEngine);
setFocusPolicy(Qt::WheelFocus);
connect(pageEngine, &AddressesLocationEnginePage::urlClicked, this, &AddressesLocationEngineViewer::slotLinkClicked);
setContextMenuPolicy(Qt::CustomContextMenu);
//TODO porting
//page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
//settings()->setAttribute(QWebEngineSettings::JavaEnabled, false);
//settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
//settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true);
//TODO porting
//connect(this, &AddressesLocationEngineViewer::linkClicked, this, &AddressesLocationEngineViewer::slotLinkClicked);
}
AddressesLocationEngineViewer::~AddressesLocationEngineViewer()
......
/*
This file is part of Akonadi Contact.
Copyright (C) 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
Copyright (C) 2016 Laurent Montel <laurent.montel@kdab.com>
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
......@@ -20,7 +19,6 @@
02110-1301, USA.
*/
#ifndef AddressesLocationEngineViewer_H
#define AddressesLocationEngineViewer_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