Commit c056bc30 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Astyle kdelibs

parent 55cb3b99
......@@ -154,7 +154,6 @@
#include <widgets/zoomactionmenu.h>
#include <kpimtextedit/texttospeechwidget.h>
#include <grantleetheme/grantleethememanager.h>
#include <grantleetheme/grantleetheme.h>
......
......@@ -267,12 +267,12 @@ void MailWebEngineView::toggleFullAddressList(const QString &field, const boost:
void MailWebEngineView::updateToggleFullAddressList(const QVariant &result)
{
qDebug()<<" result" << result;
qDebug() << " result" << result;
if (result.isValid()) {
const QList<QVariant> lst = result.toList();
if (lst.count() == 1) {
const QVariantMap map = lst.at(0).toMap();
qDebug() << "map !!!! "<<map;
qDebug() << "map !!!! " << map;
const bool show = map.value(QStringLiteral("show")).toBool();
const QString field = map.value(QStringLiteral("field")).toString();
page()->runJavaScript(MessageViewer::WebEngineScript::updateToggleFullAddressList(field, show));
......@@ -302,7 +302,7 @@ void MailWebEngineView::scrollToRelativePosition(double pos)
double MailWebEngineView::relativePosition() const
{
qDebug()<<"double MailWebEngineView::relativePosition() const not implemented";
qDebug() << "double MailWebEngineView::relativePosition() const not implemented";
//TODO
return {};
}
......
......@@ -59,7 +59,7 @@ public:
void setAllowExternalContent(bool b);
QList<QAction *> interceptorUrlActions(const MessageViewer::WebHitTestResult &result) const;
void toggleFullAddressList(const QString &field, const boost::function<QString ()> &delayedHtml, bool doShow);
void toggleFullAddressList(const QString &field, const boost::function<QString()> &delayedHtml, bool doShow);
public Q_SLOTS:
void slotZoomChanged(qreal zoom);
......
......@@ -15,7 +15,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "webhittestresulttest.h"
#include "../webhittestresult.h"
#include <QTest>
......@@ -52,7 +51,7 @@ void WebHitTestResultTest::shouldHaveDefaultValues()
void WebHitTestResultTest::shouldAssignPosAndUrl()
{
QPoint pos(5,5);
QPoint pos(5, 5);
QUrl url(QStringLiteral("http://www.kde.org"));
MessageViewer::WebHitTestResult result(pos, url, QVariant());
QVERIFY(result.alternateText().isEmpty());
......@@ -74,7 +73,7 @@ void WebHitTestResultTest::shouldAssignPosAndUrl()
void WebHitTestResultTest::shouldAssignFromQVariant()
{
QPoint pos(5,5);
QPoint pos(5, 5);
QUrl pageUrl(QStringLiteral("http://www.kde.org"));
QVariantMap map;
......@@ -98,7 +97,7 @@ void WebHitTestResultTest::shouldAssignFromQVariant()
map.insert(QStringLiteral("mediaMuted"), mediaMuted);
QString tagName = QStringLiteral("HHHHHH");
map.insert(QStringLiteral("tagName"), tagName);
QRect boundingRect(5,7,9,11);
QRect boundingRect(5, 7, 9, 11);
QVariantList lstRect;
lstRect << boundingRect.left() << boundingRect.top() << boundingRect.width() << boundingRect.height();
map.insert(QStringLiteral("boundingRect"), lstRect);
......@@ -123,7 +122,7 @@ void WebHitTestResultTest::shouldAssignFromQVariant()
void WebHitTestResultTest::shouldCopyWebHitTestResult()
{
QPoint pos(5,5);
QPoint pos(5, 5);
QUrl pageUrl(QStringLiteral("http://www.kde.org"));
QVariantMap map;
......@@ -147,7 +146,7 @@ void WebHitTestResultTest::shouldCopyWebHitTestResult()
map.insert(QStringLiteral("mediaMuted"), mediaMuted);
QString tagName = QStringLiteral("HHHHHH");
map.insert(QStringLiteral("tagName"), tagName);
QRect boundingRect(5,7,9,11);
QRect boundingRect(5, 7, 9, 11);
QVariantList lstRect;
lstRect << boundingRect.left() << boundingRect.top() << boundingRect.width() << boundingRect.height();
map.insert(QStringLiteral("boundingRect"), lstRect);
......
......@@ -15,7 +15,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef WEBHITTESTRESULTTEST_H
#define WEBHITTESTRESULTTEST_H
......@@ -33,7 +32,6 @@ private Q_SLOTS:
void shouldAssignFromQVariant();
void shouldCopyWebHitTestResult();
};
#endif // WEBHITTESTRESULTTEST_H
......@@ -57,7 +57,7 @@ TestWebEngineScriptPage::TestWebEngineScriptPage(QObject *parent)
void TestWebEngineScriptPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID)
{
qDebug() << "JAVASCRIPT MESSAGE : "<< message;
qDebug() << "JAVASCRIPT MESSAGE : " << message;
//TODO improve it.
Q_EMIT showConsoleMessage(message);
}
......@@ -131,8 +131,6 @@ TestScriptWidget::TestScriptWidget(QWidget *parent)
mScriptEdit->setAcceptRichText(false);
vScriptLayout->addWidget(mScriptEdit);
QVBoxLayout *vboxLayout = new QVBoxLayout;
layout->addLayout(vboxLayout);
......@@ -151,19 +149,19 @@ void TestScriptWidget::fillScriptCombo(QComboBox *scriptCombo)
MessageViewer::WebEngineScript::findAllScripts();
MessageViewer::WebEngineScript::findAllAnchors();
MessageViewer::WebEngineScript::findAllAnchorsAndForms();
MessageViewer::WebEngineScript::searchElementPosition(const QString &elementStr);
MessageViewer::WebEngineScript::scrollToPosition(const QPoint &pos);
MessageViewer::WebEngineScript::setElementByIdVisible(const QString &elementStr, bool visibility);
MessageViewer::WebEngineScript::setStyleToElement(const QString &elementStr, const QString &style);
MessageViewer::WebEngineScript::searchElementPosition(const QString & elementStr);
MessageViewer::WebEngineScript::scrollToPosition(const QPoint & pos);
MessageViewer::WebEngineScript::setElementByIdVisible(const QString & elementStr, bool visibility);
MessageViewer::WebEngineScript::setStyleToElement(const QString & elementStr, const QString & style);
MessageViewer::WebEngineScript::scrollDown(int pixel);
MessageViewer::WebEngineScript::scrollUp(int pixel);
MessageViewer::WebEngineScript::scrollPercentage(int percent);
MessageViewer::WebEngineScript::scrollToRelativePosition(int pos);
MessageViewer::WebEngineScript::removeStyleToElement(const QString &element);
MessageViewer::WebEngineScript::injectAttachments(const QString &delayedHtml, const QString &element);
MessageViewer::WebEngineScript::toggleFullAddressList(const QString &field, const QString &html, bool doShow);
MessageViewer::WebEngineScript::replaceInnerHtml(const QString &field, const QString &html, bool doShow);
MessageViewer::WebEngineScript::updateToggleFullAddressList(const QString &field, bool doShow);
MessageViewer::WebEngineScript::removeStyleToElement(const QString & element);
MessageViewer::WebEngineScript::injectAttachments(const QString & delayedHtml, const QString & element);
MessageViewer::WebEngineScript::toggleFullAddressList(const QString & field, const QString & html, bool doShow);
MessageViewer::WebEngineScript::replaceInnerHtml(const QString & field, const QString & html, bool doShow);
MessageViewer::WebEngineScript::updateToggleFullAddressList(const QString & field, bool doShow);
#endif
//TODO
}
......
......@@ -66,7 +66,7 @@ public:
private Q_SLOTS:
void slotExecuteScript();
void handleScript(const QVariant &res);
void handleScript(const QVariant &res);
void slotShowConsoleMessage(const QString &msg);
private:
TestScriptWidget *mTestScriptWidget;
......
......@@ -27,8 +27,7 @@ namespace MessageViewer
{
class NetworkPluginUrlInterceptorConfigureWidget;
class NetworkPluginUrlInterceptorInterface;
struct MESSAGEVIEWER_EXPORT NetworkPluginUrlInterceptorConfigureWidgetSetting
{
struct MESSAGEVIEWER_EXPORT NetworkPluginUrlInterceptorConfigureWidgetSetting {
NetworkPluginUrlInterceptorConfigureWidgetSetting()
: configureWidget(Q_NULLPTR)
{
......@@ -39,7 +38,6 @@ struct MESSAGEVIEWER_EXPORT NetworkPluginUrlInterceptorConfigureWidgetSetting
MessageViewer::NetworkPluginUrlInterceptorConfigureWidget *configureWidget;
};
class MESSAGEVIEWER_EXPORT NetworkPluginUrlInterceptor : public QObject
{
Q_OBJECT
......
......@@ -42,7 +42,7 @@ public:
QList<QAction *> NetworkUrlInterceptorManagerPrivate::interceptorUrlActions(const MessageViewer::WebHitTestResult &result) const
{
QList<QAction *> lstActions;
Q_FOREACH(MessageViewer::NetworkPluginUrlInterceptorInterface *interface, mListInterface) {
Q_FOREACH (MessageViewer::NetworkPluginUrlInterceptorInterface *interface, mListInterface) {
lstActions.append(interface->interceptorUrlActions(result));
}
return lstActions;
......
......@@ -284,8 +284,6 @@ void WebEngineAccessKey::hideAccessKeys()
}
}
void WebEngineAccessKey::handleSearchAccessKey(const QVariant &res)
{
//qDebug() << " void WebEngineAccessKey::handleSearchAccessKey(const QVariant &res)" << res;
......
......@@ -126,9 +126,9 @@ QString WebEngineScript::searchElementPosition(const QString &elementStr)
QString WebEngineScript::scrollPercentage(int percent)
{
const QString source = QString::fromLatin1("var current = document.body.scrollTop;"
"var height = document.height;"
"var newPosition = current + height * %1 / 100;"
"window.scrollTo(window.scrollX, newPostion); [window.scrollX, window.scrollY];").arg(percent);
"var height = document.height;"
"var newPosition = current + height * %1 / 100;"
"window.scrollTo(window.scrollX, newPostion); [window.scrollX, window.scrollY];").arg(percent);
#if 0
const qint64 height = page()->viewportSize().height();
const qint64 current = page()->mainFrame()->scrollBarValue(Qt::Vertical);
......@@ -140,7 +140,7 @@ QString WebEngineScript::scrollPercentage(int percent)
page()->mainFrame()->setScrollBarValue(Qt::Vertical, newPosition);
#endif
qDebug() << "QString WebEngineScript::scrollPercentage(int percent) "<<source;
qDebug() << "QString WebEngineScript::scrollPercentage(int percent) " << source;
//TODO
return source;
}
......@@ -167,9 +167,9 @@ QString WebEngineScript::scrollToPosition(const QPoint &pos)
QString WebEngineScript::removeStyleToElement(const QString &elementStr)
{
const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
"if (element) { "
" element.removeAttribute(\"style\");"
"}").arg(elementStr);
"if (element) { "
" element.removeAttribute(\"style\");"
"}").arg(elementStr);
return source;
}
......@@ -179,7 +179,7 @@ QString WebEngineScript::setStyleToElement(const QString &elementStr, const QStr
"if (element) { "
" element.style = '%2';"
"}").arg(elementStr).arg(style);
qDebug() << "QString WebEngineScript::setStyleToElement(const QString &elementStr, const QString &style) "<<source;
qDebug() << "QString WebEngineScript::setStyleToElement(const QString &elementStr, const QString &style) " << source;
return source;
}
......@@ -196,29 +196,28 @@ QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QSt
"if (element) { "
" element.innerHTML += '%2';"
"}").arg(elementStr).arg(delayedHtml);
qDebug() << "QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QString &elementStr) :"<<source;
qDebug() << "QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QString &elementStr) :" << source;
return source;
}
QString WebEngineScript::replaceInnerHtml(const QString &field, const QString &html, bool doShow)
{
const QString replaceInnerHtmlStr = QLatin1String("iconFull") + field + QLatin1String("AddressList");
const QString source = QString::fromLatin1("(function() {"
"var doShow = %3;"
"var field = \'%4\';"
"var out = [];"
"var element = document.getElementById('%1'); "
"if (element) { "
" element.innerHTML = '%2';"
" out.push({"
" field: field,"
" doShow: doShow"
" });"
"}"
"return out;"
"})()").arg(replaceInnerHtmlStr).arg(html).arg(doShow).arg(field);
qDebug() << "QString WebEngineScript::replaceInnerHtml(const QString &delayedHtml, const QString &elementStr) :"<<source;
"var doShow = %3;"
"var field = \'%4\';"
"var out = [];"
"var element = document.getElementById('%1'); "
"if (element) { "
" element.innerHTML = '%2';"
" out.push({"
" field: field,"
" doShow: doShow"
" });"
"}"
"return out;"
"})()").arg(replaceInnerHtmlStr).arg(html).arg(doShow).arg(field);
qDebug() << "QString WebEngineScript::replaceInnerHtml(const QString &delayedHtml, const QString &elementStr) :" << source;
return source;
}
......@@ -228,10 +227,10 @@ QString WebEngineScript::updateToggleFullAddressList(const QString &field, bool
const QString dotsFullStr = QLatin1String("dotsFull") + field + QLatin1String("AddressList");
const QString hiddenFullStr = QLatin1String("hiddenFull") + field + QLatin1String("AddressList");
const QString source = QString::fromLatin1(" %1;"
" %2;")
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(dotsFullStr, !doShow))
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(hiddenFullStr, doShow));
qDebug() << "QString WebEngineScript::updateToggleFullAddressList(const QString &delayedHtml, const QString &elementStr) :"<<source;
" %2;")
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(dotsFullStr, !doShow))
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(hiddenFullStr, doShow));
qDebug() << "QString WebEngineScript::updateToggleFullAddressList(const QString &delayedHtml, const QString &elementStr) :" << source;
return source;
}
......@@ -242,13 +241,13 @@ QString WebEngineScript::toggleFullAddressList(const QString &field, const QStri
const QString dotsFullStr = QLatin1String("dotsFull") + field + QLatin1String("AddressList");
const QString hiddenFullStr = QLatin1String("hiddenFull") + field + QLatin1String("AddressList");
const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
"if (element) { "
" element.innerHTML = '%2';"
" %3;"
" %4;"
"}").arg(replaceInnerHtmlStr).arg(html)
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(dotsFullStr, !doShow))
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(hiddenFullStr, doShow));
qDebug() << "QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QString &elementStr) :"<<source;
"if (element) { "
" element.innerHTML = '%2';"
" %3;"
" %4;"
"}").arg(replaceInnerHtmlStr).arg(html)
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(dotsFullStr, !doShow))
.arg(MessageViewer::WebEngineScript::setElementByIdVisible(hiddenFullStr, doShow));
qDebug() << "QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QString &elementStr) :" << source;
return source;
}
......@@ -120,7 +120,6 @@ WebHitTestResult::WebHitTestResult(const WebHitTestResult &other)
(*this) = other;
}
WebHitTestResult::~WebHitTestResult()
{
delete d;
......@@ -134,7 +133,6 @@ WebHitTestResult &WebHitTestResult::operator=(const WebHitTestResult &other)
return *this;
}
QString WebHitTestResult::alternateText() const
{
return d->m_alternateText;
......
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