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

Move zoom in webengineviewer

parent 65753b5a
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(MESSAGELIB_LIB_VERSION "5.2.59")
set(MESSAGELIB_LIB_VERSION "5.2.60")
set(KF5_VERSION "5.19.0")
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
......
......@@ -25,7 +25,6 @@ macro(add_messageviewer_class_unittest _source _additionalSource)
endmacro ()
add_messageviewer_unittest( messagedisplayformatattributetest.cpp )
add_messageviewer_class_unittest(zoomactionmenutest.cpp "../src/widgets/zoomactionmenu.cpp")
# convenience macro to add qtest unit tests
macro(add_messageviewer_mailsourceviewbrowserwidget_unittest _source)
......
......@@ -81,7 +81,6 @@ set(libmessageviewer_widgets_SRCS
widgets/openattachmentfolderwidget.cpp
widgets/mailsourceviewer.cpp
widgets/mailsourceviewtextbrowserwidget.cpp
widgets/zoomactionmenu.cpp
)
set(libmessageviewer_widgets_webengine_SRCS
......@@ -278,7 +277,6 @@ ecm_generate_headers(MessageViewer_Camelcasewidgets_HEADERS
InvitationSettings
PrintingSettings
ConfigureWidget
ZoomActionMenu
REQUIRED_HEADERS MessageViewer_widgets_HEADERS
PREFIX MessageViewer
RELATIVE widgets
......
......@@ -142,7 +142,7 @@
#include <QStandardPaths>
#include <header/headerstyleplugin.h>
#include <viewerplugins/viewerplugininterface.h>
#include <widgets/zoomactionmenu.h>
#include <WebEngineViewer/ZoomActionMenu>
#include <kpimtextedit/texttospeechwidget.h>
#include <grantleetheme/grantleethememanager.h>
......@@ -1510,8 +1510,8 @@ void ViewerPrivate::createActions()
if (!ac) {
return;
}
mZoomActionMenu = new MessageViewer::ZoomActionMenu(this);
connect(mZoomActionMenu, &ZoomActionMenu::zoomChanged, mViewer, &MailWebEngineView::slotZoomChanged);
mZoomActionMenu = new WebEngineViewer::ZoomActionMenu(this);
connect(mZoomActionMenu, &WebEngineViewer::ZoomActionMenu::zoomChanged, mViewer, &MailWebEngineView::slotZoomChanged);
mZoomActionMenu->setActionCollection(ac);
mZoomActionMenu->createZoomActions();
......
......@@ -75,6 +75,7 @@ namespace WebEngineViewer
{
class WebHitTestResult;
class FindBarWebEngineView;
class ZoomActionMenu;
}
namespace MessageViewer
{
......@@ -89,7 +90,6 @@ class OpenAttachmentFolderWidget;
class HeaderStyleMenuManager;
class ViewerPluginToolManager;
class ViewerPluginInterface;
class ZoomActionMenu;
/**
\brief Private class for the Viewer, the main widget in the messageviewer library.
......@@ -681,7 +681,7 @@ public:
MessageViewer::HeaderStylePlugin *mHeaderStylePlugin;
MessageViewer::HeaderStyleMenuManager *mHeaderStyleMenuManager;
MessageViewer::ViewerPluginToolManager *mViewerPluginToolManager;
MessageViewer::ZoomActionMenu *mZoomActionMenu;
WebEngineViewer::ZoomActionMenu *mZoomActionMenu;
};
}
......
......@@ -28,8 +28,12 @@ set(libwebengineviewer_webengine_SRCS
)
set(libwebengineviewer_findbar_SRCS
findbar/findbarbase.cpp
findbar/findbarwebengineview.cpp
findbar/findbarbase.cpp
findbar/findbarwebengineview.cpp
)
set(libwebengineviewer_widgets_SRCS
widgets/zoomactionmenu.cpp
)
......@@ -38,6 +42,7 @@ set(libmessageviewer_web_LIB Qt5::WebEngineWidgets )
set(libwebengineviewer_SRCS
${libwebengineviewer_webengine_SRCS}
${libwebengineviewer_findbar_SRCS}
${libwebengineviewer_widgets_SRCS}
)
qt5_add_resources(libwebengineviewer_webengine_SRCS jquery.qrc)
......@@ -122,6 +127,16 @@ ecm_generate_headers(WebEngineViewer_Camelcasewebengine_misc_HEADERS
RELATIVE
)
ecm_generate_headers(WebEngineViewer_Camelcasewidgets_HEADERS
HEADER_NAMES
ZoomActionMenu
REQUIRED_HEADERS WebEngineViewer_widgets_HEADERS
PREFIX WebEngineViewer
RELATIVE widgets
)
ecm_generate_pri_file(BASE_NAME WebEngineViewer
LIB_NAME KF5WebEngineViewer
DEPS "" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/WebEngineViewer
......@@ -134,6 +149,7 @@ install(FILES
${WebEngineViewer_Camelcasewebengine_manager_HEADERS}
${WebEngineViewer_Camelcasewebengine_misc_HEADERS}
${WebEngineViewer_Camelfindbar_HEADERS}
${WebEngineViewer_Camelcasewidgets_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/WebEngineViewer
COMPONENT Devel
)
......@@ -144,6 +160,7 @@ install(FILES
${WebEngineViewer_webengine_urlinterceptor_HEADERS}
${WebEngineViewer_webengine_manager_HEADERS}
${WebEngineViewer_webengine_misc_HEADERS}
${WebEngineViewer_widgets_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/webengineviewer_export.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/webengineviewer
COMPONENT Devel
......
......@@ -5,3 +5,9 @@ ecm_add_test(webhittestresulttest.cpp ../webhittestresult.cpp
)
ecm_add_test(zoomactionmenutest.cpp
TEST_NAME zoomactionmenutest
NAME_PREFIX "webengineviewer-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer KF5::XmlGui
)
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "zoomactionmenutest.h"
#include "../widgets/zoomactionmenu.h"
#include <QTest>
#include <KActionCollection>
ZoomActionMenuTest::ZoomActionMenuTest(QObject *parent)
: QObject(parent)
{
}
ZoomActionMenuTest::~ZoomActionMenuTest()
{
}
void ZoomActionMenuTest::shouldHaveDefaultValue()
{
WebEngineViewer::ZoomActionMenu menu(this);
menu.setActionCollection(new KActionCollection(this));
menu.createZoomActions();
QVERIFY(menu.zoomInAction());
QVERIFY(menu.zoomOutAction());
QVERIFY(menu.zoomResetAction());
}
void ZoomActionMenuTest::shouldAssignZoomFactor()
{
WebEngineViewer::ZoomActionMenu menu(this);
menu.setActionCollection(new KActionCollection(this));
menu.createZoomActions();
qreal initialValue = 50;
menu.setZoomFactor(initialValue);
QCOMPARE(menu.zoomFactor(), initialValue);
}
QTEST_MAIN(ZoomActionMenuTest)
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ZOOMACTIONMENUTEST_H
#define ZOOMACTIONMENUTEST_H
#include <QObject>
class ZoomActionMenuTest : public QObject
{
Q_OBJECT
public:
explicit ZoomActionMenuTest(QObject *parent = Q_NULLPTR);
~ZoomActionMenuTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldAssignZoomFactor();
};
#endif // ZOOMACTIONMENUTEST_H
......@@ -16,12 +16,11 @@
*/
#include "zoomactionmenu.h"
#include "config-messageviewer.h"
#include <KLocalizedString>
#include <KToggleAction>
#include <KActionCollection>
using namespace MessageViewer;
using namespace WebEngineViewer;
namespace
{
qreal zoomBy()
......@@ -30,7 +29,7 @@ qreal zoomBy()
}
}
class MessageViewer::ZoomActionMenuPrivate
class WebEngineViewer::ZoomActionMenuPrivate
{
public:
ZoomActionMenuPrivate(KActionMenu *qq)
......@@ -54,7 +53,7 @@ public:
ZoomActionMenu::ZoomActionMenu(QObject *parent)
: KActionMenu(parent),
d(new MessageViewer::ZoomActionMenuPrivate(this))
d(new WebEngineViewer::ZoomActionMenuPrivate(this))
{
}
......
......@@ -15,17 +15,17 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ZOOMACTIONMENU_H
#define ZOOMACTIONMENU_H
#ifndef WEBENGINEZOOMACTIONMENU_H
#define WEBENGINEZOOMACTIONMENU_H
#include <KActionMenu>
#include "messageviewer_export.h"
#include "webengineviewer_export.h"
class KToggleAction;
class KActionCollection;
namespace MessageViewer
namespace WebEngineViewer
{
class ZoomActionMenuPrivate;
class MESSAGEVIEWER_EXPORT ZoomActionMenu : public KActionMenu
class WEBENGINEVIEWER_EXPORT ZoomActionMenu : public KActionMenu
{
Q_OBJECT
public:
......
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