Commit 867b9ce6 authored by Laurent Montel's avatar Laurent Montel 😁

improve adblockblockableitemswidget

parent af8c7c6a
......@@ -74,7 +74,7 @@ set(KDEPIMLIBS_LIB_VERSION "5.2.40")
set(GRAVATAR_LIB_VERSION "5.2.40")
set(INCIDENCEEDITOR_LIB_VERSION "5.2.40")
set(KTNEF_LIB_VERSION "5.2.40")
set(MESSAGELIB_LIB_VERSION "5.2.42")
set(MESSAGELIB_LIB_VERSION "5.2.43")
find_package(KF5MailCommon ${MAILCOMMN_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5KaddressbookGrantlee ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MessageViewer ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED)
......
......@@ -16,6 +16,7 @@
*/
#include "adblockblockableitemswidget.h"
#include <MessageViewer/WebEngineScript>
#include <QVBoxLayout>
#include <KLocalizedString>
......@@ -124,19 +125,33 @@ void AdBlockBlockableItemsWidget::setWebEngineView(QWebEngineView *view)
searchBlockableItems();
}
void AdBlockBlockableItemsWidget::handleSearchBlockableImageItems(const QVariant &var)
void AdBlockBlockableItemsWidget::handleSearchBlockableImageItems(const QVariant &result)
{
qDebug() << " AdBlockBlockableItemsWidget::handleSearchBlockableImageItems " << result;
const QList<QVariant> lst = result.toList();
Q_FOREACH (const QVariant &var, lst) {
QMap<QString, QVariant> mapVariant = var.toMap();
//Create items
}
//TODO search script
mWebEngineView->page()->runJavaScript(MessageViewer::WebEngineScript::findAllScripts(), invoke(this, &AdBlockBlockableItemsWidget::handleSearchBlockableScriptsItems));
}
void AdBlockBlockableItemsWidget::handleSearchBlockableScriptsItems(const QVariant &var)
void AdBlockBlockableItemsWidget::handleSearchBlockableScriptsItems(const QVariant &result)
{
qDebug() << "void AdBlockBlockableItemsWidget::handleSearchBlockableScriptsItems(const QVariant &var)"<<result;
const QList<QVariant> lst = result.toList();
Q_FOREACH (const QVariant &var, lst) {
QMap<QString, QVariant> mapVariant = var.toMap();
//Create items
}
//TODO more check ?
}
void AdBlockBlockableItemsWidget::handleSearchBlockableItems(const QVariant &var)
{
qDebug() << " AdBlockBlockableItemsWidget::handleSearchBlockableItems " << var;
//TODO
}
......@@ -146,7 +161,7 @@ void AdBlockBlockableItemsWidget::searchBlockableItems()
mListItems->clear();
//TODO fix me add script
//TODO search img
mWebEngineView->page()->runJavaScript(QString(), invoke(this, &AdBlockBlockableItemsWidget::handleSearchBlockableImageItems));
mWebEngineView->page()->runJavaScript(MessageViewer::WebEngineScript::findAllImages(), invoke(this, &AdBlockBlockableItemsWidget::handleSearchBlockableImageItems));
}
}
......
......@@ -23,4 +23,4 @@ set( adblockblockableitemsdialogtest_SRCS adblockblockableitemsdialogtest.cpp ..
add_executable( adblockblockableitemsdialogtest ${adblockblockableitemsdialogtest_SRCS})
add_test(adblockblockableitemsdialogtest adblockblockableitemsdialogtest)
ecm_mark_as_test(adblockblockableitemsdialogtest)
target_link_libraries( adblockblockableitemsdialogtest Qt5::Test Qt5::Widgets KF5::I18n KF5::PimCommon KF5::ItemViews Qt5::WebEngine Qt5::WebEngineWidgets KF5::ConfigCore KF5::KIOWidgets)
target_link_libraries( adblockblockableitemsdialogtest Qt5::Test Qt5::Widgets KF5::I18n KF5::MessageViewer KF5::PimCommon KF5::ItemViews Qt5::WebEngine Qt5::WebEngineWidgets KF5::ConfigCore KF5::KIOWidgets)
set(adblockblockableelementgui_SRCS adblockblockableelementgui.cpp ../adblockblockableitemsdialog.cpp ../adblockblockableitemswidget.cpp)
add_executable(adblockblockableelementgui ${adblockblockableelementgui_SRCS})
target_link_libraries(adblockblockableelementgui
KF5::MessageViewer Qt5::WebEngine Qt5::WebEngineWidgets KF5::ItemViews KF5::KIOWidgets
KF5::MessageViewer Qt5::WebEngine Qt5::WebEngineWidgets KF5::ItemViews KF5::KIOWidgets KF5::MessageViewer
)
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