Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
mobile Datovka
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Datovka projects
mobile Datovka
Commits
26f83e20
Commit
26f83e20
authored
Jan 12, 2018
by
Karel Slaný
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added code for converting rich text into plain text.
parent
fdcd9487
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
4 deletions
+97
-4
mobile-datovka.pro
mobile-datovka.pro
+2
-0
qml/components/AccessibleText.qml
qml/components/AccessibleText.qml
+3
-2
qml/components/AccessibleTextButton.qml
qml/components/AccessibleTextButton.qml
+1
-1
qml/pages/PageAccountDetail.qml
qml/pages/PageAccountDetail.qml
+1
-1
src/main.cpp
src/main.cpp
+3
-0
src/qml_interaction/string_manipulation.cpp
src/qml_interaction/string_manipulation.cpp
+40
-0
src/qml_interaction/string_manipulation.h
src/qml_interaction/string_manipulation.h
+47
-0
No files found.
mobile-datovka.pro
View file @
26f83e20
...
@@ -125,6 +125,7 @@ SOURCES += \
...
@@ -125,6 +125,7 @@ SOURCES += \
src/qml_interaction/interaction_zfo_file.cpp \
src/qml_interaction/interaction_zfo_file.cpp \
src/qml_interaction/message_envelope.cpp \
src/qml_interaction/message_envelope.cpp \
src/qml_interaction/message_info.cpp \
src/qml_interaction/message_info.cpp \
src/qml_interaction/string_manipulation.cpp \
src/settings.cpp \
src/settings.cpp \
src/setwrapper.cpp \
src/setwrapper.cpp \
src/sqlite/account_db.cpp \
src/sqlite/account_db.cpp \
...
@@ -188,6 +189,7 @@ HEADERS += \
...
@@ -188,6 +189,7 @@ HEADERS += \
src/qml_interaction/interaction_zfo_file.h \
src/qml_interaction/interaction_zfo_file.h \
src/qml_interaction/message_envelope.h \
src/qml_interaction/message_envelope.h \
src/qml_interaction/message_info.h \
src/qml_interaction/message_info.h \
src/qml_interaction/string_manipulation.h \
src/settings.h \
src/settings.h \
src/setwrapper.h \
src/setwrapper.h \
src/sqlite/account_db.h \
src/sqlite/account_db.h \
...
...
qml/components/AccessibleText.qml
View file @
26f83e20
...
@@ -26,7 +26,8 @@ import QtQuick 2.7
...
@@ -26,7 +26,8 @@ import QtQuick 2.7
/*
/*
* Accessible text component.
* Accessible text component.
*
*
* This component exposes the its text to the accessibility interface.
* This component exposes its text to the accessibility interface. Rich text
* is converted onto plain text.
* If accessibleName is specified then its content is used instead of the text
* If accessibleName is specified then its content is used instead of the text
* property value.
* property value.
*/
*/
...
@@ -37,5 +38,5 @@ Text {
...
@@ -37,5 +38,5 @@ Text {
property
string
accessibleName
:
""
property
string
accessibleName
:
""
Accessible.role
:
Accessible
.
StaticText
Accessible.role
:
Accessible
.
StaticText
Accessible.name
:
(
root
.
accessibleName
!==
""
)
?
root
.
accessibleName
:
root
.
text
Accessible.name
:
(
root
.
accessibleName
!==
""
)
?
root
.
accessibleName
:
((
root
.
textFormat
!==
TextEdit
.
RichText
)
?
root
.
text
:
strManipulation
.
removeRich
(
root
.
text
))
}
}
qml/components/AccessibleTextButton.qml
View file @
26f83e20
...
@@ -46,7 +46,7 @@ Text {
...
@@ -46,7 +46,7 @@ Text {
anchors.fill
:
parent
anchors.fill
:
parent
Accessible.role
:
Accessible
.
Button
Accessible.role
:
Accessible
.
Button
Accessible.name
:
(
root
.
accessibleName
!==
""
)
?
root
.
accessibleName
:
root
.
text
Accessible.name
:
(
root
.
accessibleName
!==
""
)
?
root
.
accessibleName
:
((
root
.
textFormat
!==
TextEdit
.
RichText
)
?
root
.
text
:
strManipulation
.
removeRich
(
root
.
text
))
Accessible.onPressAction
:
{
Accessible.onPressAction
:
{
handleClick
()
handleClick
()
}
}
...
...
qml/pages/PageAccountDetail.qml
View file @
26f83e20
...
@@ -98,7 +98,7 @@ Component {
...
@@ -98,7 +98,7 @@ Component {
ScrollIndicator.vertical
:
ScrollIndicator
{}
ScrollIndicator.vertical
:
ScrollIndicator
{}
}
}
Text
{
Accessible
Text
{
id
:
emptyList
id
:
emptyList
visible
:
true
visible
:
true
color
:
datovkaPalette
.
text
color
:
datovkaPalette
.
text
...
...
src/main.cpp
View file @
26f83e20
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
#include "src/qml_interaction/interaction_filesystem.h"
#include "src/qml_interaction/interaction_filesystem.h"
#include "src/qml_interaction/interaction_zfo_file.h"
#include "src/qml_interaction/interaction_zfo_file.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/qml_interaction/string_manipulation.h"
#include "src/settings.h"
#include "src/settings.h"
#include "src/setwrapper.h"
#include "src/setwrapper.h"
#include "src/sqlite/db_tables.h"
#include "src/sqlite/db_tables.h"
...
@@ -277,6 +278,7 @@ int main(int argc, char *argv[])
...
@@ -277,6 +278,7 @@ int main(int argc, char *argv[])
Files
files
;
Files
files
;
IsdsWrapper
isds
;
IsdsWrapper
isds
;
GlobalSettingsQmlWrapper
settings
;
GlobalSettingsQmlWrapper
settings
;
StringManipulation
strManipulation
;
Zfo
zfo
;
Zfo
zfo
;
/* Connect slot for isds cxt delete when account was deleted or updated */
/* Connect slot for isds cxt delete when account was deleted or updated */
...
@@ -336,6 +338,7 @@ int main(int argc, char *argv[])
...
@@ -336,6 +338,7 @@ int main(int argc, char *argv[])
ctx
->
setContextProperty
(
"accounts"
,
&
accounts
);
ctx
->
setContextProperty
(
"accounts"
,
&
accounts
);
ctx
->
setContextProperty
(
"files"
,
&
files
);
ctx
->
setContextProperty
(
"files"
,
&
files
);
ctx
->
setContextProperty
(
"settings"
,
&
settings
);
ctx
->
setContextProperty
(
"settings"
,
&
settings
);
ctx
->
setContextProperty
(
"strManipulation"
,
&
strManipulation
);
ctx
->
setContextProperty
(
"locker"
,
&
locker
);
ctx
->
setContextProperty
(
"locker"
,
&
locker
);
ctx
->
setContextProperty
(
"interactionZfoFile"
,
&
interactionZfoFile
);
ctx
->
setContextProperty
(
"interactionZfoFile"
,
&
interactionZfoFile
);
ctx
->
setContextProperty
(
"dlgEmitter"
,
QmlDlgHelper
::
dlgEmitter
);
ctx
->
setContextProperty
(
"dlgEmitter"
,
QmlDlgHelper
::
dlgEmitter
);
...
...
src/qml_interaction/string_manipulation.cpp
0 → 100644
View file @
26f83e20
/*
* Copyright (C) 2014-2018 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#include <QXmlStreamReader>
#include "src/qml_interaction/string_manipulation.h"
QString
StringManipulation
::
removeRich
(
const
QString
&
inStr
)
{
QString
plainStr
;
QXmlStreamReader
xml
(
inStr
);
while
(
!
xml
.
atEnd
())
{
if
(
xml
.
readNext
()
==
QXmlStreamReader
::
Characters
)
{
plainStr
+=
xml
.
text
();
}
}
return
plainStr
;
}
src/qml_interaction/string_manipulation.h
0 → 100644
View file @
26f83e20
/*
* Copyright (C) 2014-2018 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#ifndef _STRING_MANIPULATION_H_
#define _STRING_MANIPULATION_H_
#include <QObject>
#include <QString>
/*!
* @brief Convenience class for string manipulation.
*/
class
StringManipulation
:
public
QObject
{
Q_OBJECT
public:
/*!
* @brief Converts rich text to plain text.
*
* @param[in] inStr String that may contain rich text tags.
* @return Plain text.
*/
Q_INVOKABLE
static
QString
removeRich
(
const
QString
&
inStr
);
};
#endif
/* _STRING_MANIPULATION_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