Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Pim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Pim
Commits
1041c55c
Commit
1041c55c
authored
May 23, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use lamdba
parent
5ad6fced
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
+10
-19
blogilo/composereditorwebengine/src/private/composerwebengine_p.cpp
...mposereditorwebengine/src/private/composerwebengine_p.cpp
+10
-19
No files found.
blogilo/composereditorwebengine/src/private/composerwebengine_p.cpp
View file @
1041c55c
...
...
@@ -894,28 +894,19 @@ void ComposerEditorWebEnginePrivate::_k_slotReplace()
//TODO
}
struct
SetPlainTextFunctor
{
QString
fn
;
explicit
SetPlainTextFunctor
(
const
QString
&
filename
)
:
fn
(
filename
)
{
}
void
operator
()(
const
QString
&
result
)
{
QFile
file
(
fn
);
bool
success
=
file
.
open
(
QIODevice
::
WriteOnly
);
if
(
success
)
{
// FIXME: here we always use UTF-8 encoding
QByteArray
data
=
result
.
toUtf8
();
const
qint64
c
=
file
.
write
(
data
);
}
}
};
void
ComposerEditorWebEnginePrivate
::
saveHtml
(
QWebEnginePage
*
page
,
const
QString
&
fileName
)
{
if
(
page
)
{
page
->
toHtml
(
SetPlainTextFunctor
(
fileName
));
page
->
toHtml
([
fileName
](
const
QString
&
result
)
{
QFile
file
(
fileName
);
bool
success
=
file
.
open
(
QIODevice
::
WriteOnly
);
if
(
success
)
{
// FIXME: here we always use UTF-8 encoding
QByteArray
data
=
result
.
toUtf8
();
const
qint64
c
=
file
.
write
(
data
);
}
}
);
}
}
...
...
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