Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
PIM Messagelib
Commits
964ded9a
Commit
964ded9a
authored
Apr 06, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use mailwebenginescript
parent
0304dd06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
69 deletions
+4
-69
messageviewer/src/viewer/webengine/mailwebengineview.cpp
messageviewer/src/viewer/webengine/mailwebengineview.cpp
+4
-3
messageviewer/src/webengine/webenginescript.cpp
messageviewer/src/webengine/webenginescript.cpp
+0
-62
messageviewer/src/webengine/webenginescript.h
messageviewer/src/webengine/webenginescript.h
+0
-4
No files found.
messageviewer/src/viewer/webengine/mailwebengineview.cpp
View file @
964ded9a
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "mailwebenginepage.h"
#include "mailwebenginepage.h"
#include "webengine/webengineaccesskey/webengineaccesskey.h"
#include "webengine/webengineaccesskey/webengineaccesskey.h"
#include "webengine/webenginescript.h"
#include "webengine/webenginescript.h"
#include "mailwebenginescript.h"
#include "messageviewer/messageviewersettings.h"
#include "messageviewer/messageviewersettings.h"
#include "loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h"
#include "loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h"
#include "cidreferencesurlinterceptor/cidreferencesurlinterceptor.h"
#include "cidreferencesurlinterceptor/cidreferencesurlinterceptor.h"
...
@@ -251,7 +252,7 @@ void MailWebEngineView::injectAttachments(const boost::function<QString()> &dela
...
@@ -251,7 +252,7 @@ void MailWebEngineView::injectAttachments(const boost::function<QString()> &dela
if
(
html
.
isEmpty
())
{
if
(
html
.
isEmpty
())
{
return
;
return
;
}
}
page
()
->
runJavaScript
(
MessageViewer
::
WebEngineScript
::
injectAttachments
(
html
,
QStringLiteral
(
"attachmentInjectionPoint"
)));
page
()
->
runJavaScript
(
MessageViewer
::
Mail
WebEngineScript
::
injectAttachments
(
html
,
QStringLiteral
(
"attachmentInjectionPoint"
)));
}
}
void
MailWebEngineView
::
toggleFullAddressList
(
const
QString
&
field
,
const
boost
::
function
<
QString
()
>
&
delayedHtml
,
bool
doShow
)
void
MailWebEngineView
::
toggleFullAddressList
(
const
QString
&
field
,
const
boost
::
function
<
QString
()
>
&
delayedHtml
,
bool
doShow
)
...
@@ -262,7 +263,7 @@ void MailWebEngineView::toggleFullAddressList(const QString &field, const boost:
...
@@ -262,7 +263,7 @@ void MailWebEngineView::toggleFullAddressList(const QString &field, const boost:
}
}
qDebug
()
<<
"void MailWebEngineView::toggleFullAddressList(const QString &field, const boost::function<QString()> &delayedHtml, bool doShow)"
<<
html
<<
" fields "
<<
field
;
qDebug
()
<<
"void MailWebEngineView::toggleFullAddressList(const QString &field, const boost::function<QString()> &delayedHtml, bool doShow)"
<<
html
<<
" fields "
<<
field
;
page
()
->
runJavaScript
(
MessageViewer
::
WebEngineScript
::
replaceInnerHtml
(
field
,
html
,
doShow
),
invoke
(
this
,
&
MailWebEngineView
::
updateToggleFullAddressList
));
page
()
->
runJavaScript
(
MessageViewer
::
Mail
WebEngineScript
::
replaceInnerHtml
(
field
,
html
,
doShow
),
invoke
(
this
,
&
MailWebEngineView
::
updateToggleFullAddressList
));
}
}
void
MailWebEngineView
::
updateToggleFullAddressList
(
const
QVariant
&
result
)
void
MailWebEngineView
::
updateToggleFullAddressList
(
const
QVariant
&
result
)
...
@@ -275,7 +276,7 @@ void MailWebEngineView::updateToggleFullAddressList(const QVariant &result)
...
@@ -275,7 +276,7 @@ void MailWebEngineView::updateToggleFullAddressList(const QVariant &result)
qDebug
()
<<
"map !!!! "
<<
map
;
qDebug
()
<<
"map !!!! "
<<
map
;
const
bool
show
=
map
.
value
(
QStringLiteral
(
"show"
)).
toBool
();
const
bool
show
=
map
.
value
(
QStringLiteral
(
"show"
)).
toBool
();
const
QString
field
=
map
.
value
(
QStringLiteral
(
"field"
)).
toString
();
const
QString
field
=
map
.
value
(
QStringLiteral
(
"field"
)).
toString
();
page
()
->
runJavaScript
(
MessageViewer
::
WebEngineScript
::
updateToggleFullAddressList
(
field
,
show
));
page
()
->
runJavaScript
(
MessageViewer
::
Mail
WebEngineScript
::
updateToggleFullAddressList
(
field
,
show
));
}
}
}
}
}
}
...
...
messageviewer/src/webengine/webenginescript.cpp
View file @
964ded9a
...
@@ -189,65 +189,3 @@ QString WebEngineScript::scrollToRelativePosition(int pos)
...
@@ -189,65 +189,3 @@ QString WebEngineScript::scrollToRelativePosition(int pos)
const
QString
source
=
QString
::
fromLatin1
(
"window.scrollTo(window.scrollX, %1); [window.scrollX, window.scrollY];"
).
arg
(
pos
);
const
QString
source
=
QString
::
fromLatin1
(
"window.scrollTo(window.scrollX, %1); [window.scrollX, window.scrollY];"
).
arg
(
pos
);
return
source
;
return
source
;
}
}
QString
WebEngineScript
::
injectAttachments
(
const
QString
&
delayedHtml
,
const
QString
&
elementStr
)
{
const
QString
source
=
QString
::
fromLatin1
(
"var element = document.getElementById('%1'); "
"if (element) { "
" element.innerHTML += '%2';"
"}"
).
arg
(
elementStr
).
arg
(
delayedHtml
);
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
;
return
source
;
}
QString
WebEngineScript
::
updateToggleFullAddressList
(
const
QString
&
field
,
bool
doShow
)
{
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
;
return
source
;
}
QString
WebEngineScript
::
toggleFullAddressList
(
const
QString
&
field
,
const
QString
&
html
,
bool
doShow
)
{
const
QString
replaceInnerHtmlStr
=
QLatin1String
(
"iconFull"
)
+
field
+
QLatin1String
(
"AddressList"
);
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
;
return
source
;
}
messageviewer/src/webengine/webenginescript.h
View file @
964ded9a
...
@@ -38,10 +38,6 @@ MESSAGEVIEWER_EXPORT QString scrollUp(int pixel);
...
@@ -38,10 +38,6 @@ MESSAGEVIEWER_EXPORT QString scrollUp(int pixel);
MESSAGEVIEWER_EXPORT
QString
scrollPercentage
(
int
percent
);
MESSAGEVIEWER_EXPORT
QString
scrollPercentage
(
int
percent
);
MESSAGEVIEWER_EXPORT
QString
scrollToRelativePosition
(
int
pos
);
MESSAGEVIEWER_EXPORT
QString
scrollToRelativePosition
(
int
pos
);
MESSAGEVIEWER_EXPORT
QString
removeStyleToElement
(
const
QString
&
element
);
MESSAGEVIEWER_EXPORT
QString
removeStyleToElement
(
const
QString
&
element
);
MESSAGEVIEWER_EXPORT
QString
injectAttachments
(
const
QString
&
delayedHtml
,
const
QString
&
element
);
MESSAGEVIEWER_EXPORT
QString
toggleFullAddressList
(
const
QString
&
field
,
const
QString
&
html
,
bool
doShow
);
MESSAGEVIEWER_EXPORT
QString
replaceInnerHtml
(
const
QString
&
field
,
const
QString
&
html
,
bool
doShow
);
MESSAGEVIEWER_EXPORT
QString
updateToggleFullAddressList
(
const
QString
&
field
,
bool
doShow
);
}
}
}
}
#endif // WEBENGINESCRIPT_H
#endif // WEBENGINESCRIPT_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment