Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Datovka projects
mobile Datovka
Commits
a6781030
Commit
a6781030
authored
Jun 01, 2017
by
Karel Slaný
Browse files
Merge branch 'async-dlg-wip' into 'develop'
Isds actions based on asynchronous qml input dialogue See merge request
!63
parents
6c3e7848
ebce6302
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
qml/dialogues/InputDialogue.qml
View file @
a6781030
...
...
@@ -34,21 +34,29 @@ import QtQuick.Controls 2.1
Dialog
{
id
:
root
signal
finished
(
string
userNam
e
,
string
account
Name
,
string
pwd
)
signal
finished
(
string
isdsAction
,
string
pwdTyp
e
,
string
user
Name
,
string
pwd
)
property
int
minimumInputSize
:
parent
.
width
/
2
property
int
maximumInputSize
:
parent
.
width
/
2
property
string
dIsdsAction
property
string
dPwdType
property
string
dUserName
property
string
dAccountName
function
openInputDialog
(
userName
,
accountName
,
title
,
text
,
hidePwd
)
{
function
openInputDialog
(
isdsAction
,
pwdType
,
userName
,
title
,
text
,
placeholderText
,
hidePwd
)
{
dIsdsAction
=
isdsAction
dPwdType
=
pwdType
dUserName
=
userName
dAccountName
=
accountName
root
.
title
=
title
roottext
.
text
=
text
rootpwd
.
clear
()
rootpwd
.
placeholderText
=
title
rootpwd
.
placeholderText
=
placeholderText
rootpwd
.
echoMode
=
(
hidePwd
)
?
TextInput
.
Password
:
TextInput
.
Normal
if
(
pwdType
==
"
totp
"
||
pwdType
==
"
hotp
"
)
{
rootpwd
.
inputMethodHints
=
Qt
.
ImhPreferNumbers
}
else
{
rootpwd
.
inputMethodHints
=
Qt
.
ImhNone
}
rootpwd
.
focus
=
true
root
.
open
()
}
...
...
@@ -84,5 +92,5 @@ Dialog {
}
}
// ColumnLayout
onAccepted
:
finished
(
d
UserName
,
dAccount
Name
,
rootpwd
.
text
.
toString
())
onAccepted
:
finished
(
d
IsdsAction
,
dPwdType
,
dUser
Name
,
rootpwd
.
text
.
toString
())
}
qml/main.qml
View file @
a6781030
...
...
@@ -115,12 +115,12 @@ ApplicationWindow {
InputDialogue
{
id
:
inputDialog
onFinished
:
{
isds
.
returnInputDialogText
(
userName
,
account
Name
,
pwd
)
isds
.
returnInputDialogText
(
isdsAction
,
pwdType
,
user
Name
,
pwd
)
}
Connections
{
target
:
isds
onOpenDialogRequest
:
{
inputDialog
.
openInputDialog
(
userName
,
accountName
,
title
,
t
ext
,
hidePwd
)
inputDialog
.
openInputDialog
(
isdsAction
,
pwdType
,
userName
,
title
,
text
,
placeholderT
ext
,
hidePwd
)
}
}
}
...
...
qml/pages/PageAccountDetail.qml
View file @
a6781030
...
...
@@ -66,7 +66,13 @@ Component {
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
isds
.
getAccountInfo
(
userName
,
false
)
isds
.
doIsdsAction
(
"
getAccountInfo
"
,
userName
)
}
}
Connections
{
target
:
isds
onRunGetAccountInfoSig
:
{
isds
.
getAccountInfo
(
userName
)
}
}
}
...
...
qml/pages/PageAccountList.qml
View file @
a6781030
...
...
@@ -110,7 +110,7 @@ Component {
anchors.fill
:
parent
onClicked
:
{
statusBarText
.
text
=
""
isds
.
syncAllAccounts
(
accountModel
)
isds
.
doIsdsAction
(
"
syncAllAccounts
"
,
""
)
}
}
}
...
...
@@ -260,7 +260,15 @@ Component {
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
isds
.
syncOneAccount
(
accountModel
,
rUserName
)
isds
.
doIsdsAction
(
"
syncOneAccount
"
,
rUserName
)
}
}
Connections
{
target
:
isds
onRunSyncOneAccountSig
:
{
if
(
rUserName
==
userName
)
{
isds
.
syncOneAccount
(
accountModel
,
userName
)
}
}
}
}
...
...
qml/pages/PageMenuMessage.qml
View file @
a6781030
...
...
@@ -160,7 +160,7 @@ Component {
anchors.fill
:
parent
onClicked
:
{
if
(
index
==
0
)
{
isds
.
do
wnloadMessage
(
messageModel
,
userName
,
msgType
,
msgId
)
isds
.
do
IsdsAction
(
"
downloadMessage
"
,
userName
)
}
else
if
(
index
==
1
)
{
messages
.
markMessageAsLocallyRead
(
messageModel
,
userName
,
msgId
,
true
)
}
else
if
(
index
==
2
)
{
...
...
@@ -186,5 +186,11 @@ Component {
delegate
:
messageMenuComponent
}
}
Connections
{
target
:
isds
onRunDownloadMessageSig
:
{
isds
.
downloadMessage
(
messageModel
,
userName
,
msgType
,
msgId
)
}
}
}
}
qml/pages/PageMenuMessageDetail.qml
View file @
a6781030
...
...
@@ -151,7 +151,7 @@ Component {
anchors.fill
:
parent
onClicked
:
{
if
(
index
==
0
)
{
isds
.
do
wnloadMessage
(
messageModel
,
userName
,
msgType
,
msgId
)
isds
.
do
IsdsAction
(
"
downloadMessage
"
,
userName
)
}
else
if
(
index
==
1
)
{
files
.
sendAttachmentsWithEmailFromDb
(
userName
,
msgId
)
}
else
if
(
index
==
2
)
{
...
...
qml/pages/PageMessageDetail.qml
View file @
a6781030
...
...
@@ -201,7 +201,7 @@ Component {
anchors.fill
:
parent
onClicked
:
{
if
(
fromLocalDb
)
{
isds
.
do
wnloadMessage
(
messageModel
,
userName
,
msgType
,
zfoId
)
isds
.
do
IsdsAction
(
"
downloadMessage
"
,
userName
)
}
}
}
...
...
@@ -394,7 +394,7 @@ Component {
if
(
downloadStart
)
{
downloadStart
=
false
if
(
fromLocalDb
)
{
isds
.
do
wnloadMessage
(
messageModel
,
userName
,
msgType
,
zfoId
)
isds
.
do
IsdsAction
(
"
downloadMessage
"
,
userName
)
}
}
}
...
...
@@ -416,7 +416,7 @@ Component {
anchors.fill
:
parent
onClicked
:
{
if
(
fromLocalDb
)
{
isds
.
do
wnloadMessage
(
messageModel
,
userName
,
msgType
,
zfoId
)
isds
.
do
IsdsAction
(
"
downloadMessage
"
,
userName
)
}
}
}
...
...
@@ -433,5 +433,13 @@ Component {
wrapMode
:
Text
.
WordWrap
text
:
""
}
// Text
Connections
{
target
:
isds
onRunDownloadMessageSig
:
{
if
(
fromLocalDb
)
{
isds
.
downloadMessage
(
messageModel
,
userName
,
msgType
,
zfoId
)
}
}
}
}
}
qml/pages/PageMessageList.qml
View file @
a6781030
...
...
@@ -215,9 +215,9 @@ Component {
if
(
downloadStart
)
{
downloadStart
=
false
if
(
msgType
==
MessageType
.
TYPE_RECEIVED
)
{
isds
.
syncSingleAccountReceived
(
accountModel
,
messageModel
,
userName
)
isds
.
doIsdsAction
(
"
syncSingleAccountReceived
"
,
userName
)
}
else
if
(
msgType
==
MessageType
.
TYPE_SENT
)
{
isds
.
syncSingleAccountSent
(
accountModel
,
messageModel
,
userName
)
isds
.
doIsdsAction
(
"
syncSingleAccountSent
"
,
userName
)
}
}
}
...
...
@@ -234,6 +234,18 @@ Component {
messages
.
fillMessageList
(
messageModel
,
userName
,
msgType
)
}
}
Connections
{
target
:
isds
onRunSyncSingleAccountReceivedSig
:
{
isds
.
syncSingleAccountReceived
(
accountModel
,
messageModel
,
userName
)
}
}
Connections
{
target
:
isds
onRunSyncSingleAccountSentSig
:
{
isds
.
syncSingleAccountSent
(
accountModel
,
messageModel
,
userName
)
}
}
}
}
}
qml/pages/PageSettingsAccount.qml
View file @
a6781030
...
...
@@ -72,15 +72,17 @@ Item {
anchors.fill
:
parent
onClicked
:
{
if
(
isNewAccount
)
{
if
(
accounts
.
createAccount
(
accountModel
,
sLoginMethod
,
accountNameTextField
.
text
.
toString
(),
userNameTextField
.
text
.
toString
(),
passwordTextField
.
text
.
toString
(),
testAccount
.
checked
,
rememberPassword
.
checked
,
useLS
.
checked
,
certPathLabelId
.
text
.
toString
()))
{
isds
.
getAccountInfo
(
userNameTextField
.
text
.
toString
(),
true
)
}
// Create a new account context data and add to model.
accounts
.
createAccount
(
accountModel
,
sLoginMethod
,
accountNameTextField
.
text
.
toString
(),
userNameTextField
.
text
.
toString
(),
passwordTextField
.
text
.
toString
(),
testAccount
.
checked
,
rememberPassword
.
checked
,
useLS
.
checked
,
certPathLabelId
.
text
.
toString
())
// Login to new account.
isds
.
doIsdsAction
(
"
addNewAccount
"
,
userNameTextField
.
text
.
toString
())
}
else
{
// Update account context data.
if
(
accounts
.
updateAccount
(
accountModel
,
sLoginMethod
,
accountNameTextField
.
text
.
toString
(),
userNameTextField
.
text
.
toString
(),
...
...
@@ -94,18 +96,31 @@ Item {
}
}
Connections
{
// Connection is activated when account info was downloaded.
target
:
isds
onDownloadAccountInfoFinishedSig
:
{
if
(
isLogged
)
{
settings
.
saveAllSettings
(
accountModel
)
pageView
.
pop
(
StackView
.
Immediate
)
}
}
Connections
{
// Connection is activated when login to new account fails.
target
:
isds
onUnsuccessedLoginToIsdsSig
:
{
if
(
accounts
.
removeAccount
(
accountModel
,
userName
,
false
))
{
settings
.
saveAllSettings
(
accountModel
)
pageView
.
pop
(
StackView
.
Immediate
)
}
else
{
if
(
accounts
.
removeAccount
(
accountModel
,
userName
,
false
))
{
settings
.
saveAllSettings
(
accountModel
)
}
}
}
}
Connections
{
// Connection is activated when login phase was succeeded and
// try download account info.
target
:
isds
onRunGetAccountInfoSig
:
{
settings
.
saveAllSettings
(
accountModel
)
isds
.
getAccountInfo
(
userName
)
}
}
}
}
}
// PageHeader
...
...
@@ -310,6 +325,7 @@ Item {
wrapMode
:
Text
.
Wrap
}
Connections
{
// Connection is activated when settings of exists account is shown.
target
:
accounts
onSendAccountData
:
{
accountNameTextField
.
text
=
acntName
...
...
src/net/isds_const.h
View file @
a6781030
...
...
@@ -84,6 +84,11 @@
#define OTP_TYPE_HOTP "HOTP"
#define OTP_NO_OTP "noOTP"
/* PASSWORD TYPE */
#define PWD_PWD "pwd"
#define PWD_CERT "cert"
#define PWD_HOTP "hotp"
#define PWD_TOTP "totp"
/*!
* @brief Maximum length of message list to be downloaded.
...
...
src/net/isds_wrapper.cpp
View file @
a6781030
This diff is collapsed.
Click to expand it.
src/net/isds_wrapper.h
View file @
a6781030
...
...
@@ -47,104 +47,109 @@ public:
~
IsdsWrapper
(
void
);
/*!
* @brief
Download message list of all accounts
.
* @brief
Change ISDS login password
.
*
* @param[in
,out] acntModelVariant QVariant holding account model
*
to be altered
.
* @param[in
] userName Account username string.
*
@param[in] accountName Account name
.
*/
Q_INVOKABLE
void
syncAllAccounts
(
const
QVariant
&
acntModelVariant
);
bool
changePassword
(
const
QString
&
userName
,
const
QString
&
accountName
);
/*!
* @brief Do
wnload message list of one account
.
* @brief Do
an isds action from QML
.
*
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in] userName Account username string.
* @param[in] isdsAction Isds action identificator.
* @param[in] userName Account user name.
*/
Q_INVOKABLE
void
syncOneAccount
(
const
QVariant
&
acntModelVariant
,
const
QString
&
userName
);
void
doIsdsAction
(
const
QString
&
isdsAction
,
const
QString
&
userName
);
/*!
* @brief Download
received
message
list
.
* @brief Download
s complete
message.
*
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in,out] msgModelVariant QVariant holding message model
* to be altered.
* @param[in] userName Account username string.
* @param[in] messageType Message orientation.
* @param[in] msgId Message ID.
*/
Q_INVOKABLE
void
syncSingleAccountReceived
(
const
QVariant
&
acntModelVariant
,
const
QVariant
&
msgModelVariant
,
const
QString
&
userName
);
void
downloadMessage
(
const
QVariant
&
msgModelVariant
,
const
QString
&
userName
,
enum
Messages
::
MessageType
messageType
,
qint64
msgId
);
/*!
* @brief Download
list of sent messages
.
* @brief Download
account info
.
*
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in,out] msgModelVariant QVariant holding message model
* to be altered.
* @param[in] userName Account username string.
* @param[in] userName Account username string.
*/
Q_INVOKABLE
void
syncSingleAccountSent
(
const
QVariant
&
acntModelVariant
,
const
QVariant
&
msgModelVariant
,
const
QString
&
userName
);
void
getAccountInfo
(
const
QString
&
userName
);
/*!
* @brief Download
account
info.
* @brief Download
s delivery
info.
*
* @param[in] userName Account username string.
* @param[in] isFirstLogin Set on True if it is first login
* into databox (when add account to Datovka).
* @param[in] msgId Message ID.
*/
Q_INVOKABLE
void
get
Account
Info
(
const
QString
&
userName
,
bool
isFirstLogin
);
void
get
Delivery
Info
(
const
QString
&
userName
,
qint64
msgId
);
/*!
* @brief
Downloads complete message
.
* @brief
Password string from QML input dialog
.
*
* @param[in
,out] msgModelVariant QVariant holding message model
*
to be altered
.
* @param[in]
userName Account username string.
* @param[in]
messageType Message orientation
.
* @param[in]
msgId Message ID
.
* @param[in
] isdsAction ISDS Action string.
*
@param[in] pwdType Password type string
.
* @param[in] userName Account username string.
* @param[in]
accountName Account name string
.
* @param[in]
pwd Password or OTP code
.
*/
Q_INVOKABLE
void
downloadMessage
(
const
QVariant
&
msgModelVariant
,
const
QString
&
userName
,
enum
Messages
::
MessageType
messageType
,
qint64
msgId
);
void
returnInputDialogText
(
const
QString
&
isdsAction
,
const
QString
&
pwdType
,
const
QString
&
userName
,
const
QString
&
pwd
);
/*!
* @brief Download
s delivery info
.
* @brief Download
message list of one account
.
*
* @param[in] userName Account username string.
* @param[in] msgId Message ID.
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in] userName Account username string.
*/
Q_INVOKABLE
void
getDeliveryInfo
(
const
QString
&
userName
,
qint64
msgId
);
void
syncOneAccount
(
const
QVariant
&
acntModelVariant
,
const
QString
&
userName
);
/*!
* @brief
Change ISDS login password
.
* @brief
Download received message list
.
*
* @param[in] userName Account username string.
* @param[in] accountName Account name.
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in,out] msgModelVariant QVariant holding message model
* to be altered.
* @param[in] userName Account username string.
*/
Q_INVOKABLE
bool
changePassword
(
const
QString
&
userName
,
const
Q
String
&
account
Name
);
void
syncSingleAccountReceived
(
const
QVariant
&
acntModelVariant
,
const
Q
Variant
&
msgModelVariant
,
const
QString
&
user
Name
);
/*!
* @brief
Password string from QML input dialog
.
* @brief
Download list of sent messages
.
*
* @param[in] userName Account username string.
* @param[in] accountName Account name string.
* @param[in] pwd Password or OTP code.
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in,out] msgModelVariant QVariant holding message model
* to be altered.
* @param[in] userName Account username string.
*/
Q_INVOKABLE
void
returnInputDialogText
(
const
QString
&
userName
,
const
QString
&
accountName
,
const
QString
&
pwd
);
void
syncSingleAccountSent
(
const
QVariant
&
acntModelVariant
,
const
QVariant
&
msgModelVariant
,
const
QString
&
userName
);
/*!
* @brief Logout and close all active OTP connections, clear cookies.
*/
void
closeAllOtpConnections
(
void
);
/*!
* @brief Test if user is connected to databox via OTP.
...
...
@@ -162,24 +167,22 @@ public:
*/
bool
isdsLogoutOTP
(
const
QString
&
userName
);
/*!
* @brief Logout and close all active OTP connections, clear cookies.
*/
void
closeAllOtpConnections
(
void
);
signals:
/*!
* @brief Send open QML input dialog request to QML.
*
* @param[in] isdsAction ISDS Action string.
* @param[in] pwdType Password type string.
* @param[in] userName Account username string.
* @param[in] accountName Account name string.
* @param[in] title Dialogue title.
* @param[in] text Dialogue text.
* @param[in] placeholderText Dialogue placeholder text.
* @param[in] hidePwd True means the password will be hidden.
*/
void
openDialogRequest
(
QString
userName
,
QString
accountName
,
QString
title
,
QString
text
,
bool
hidePwd
);
void
openDialogRequest
(
const
QString
&
isdsAction
,
const
QString
&
pwdType
,
QString
userName
,
QString
title
,
QString
text
,
QString
placeholderText
,
bool
hidePwd
);
/*!
* @brief Set new statusbar text and active busy indicator to QML.
...
...
@@ -205,17 +208,72 @@ signals:
void
downloadMessageListFinishedSig
(
bool
isMsgReceived
);
/*!
* @brief Update account info model in QML.
* @brief Update account info in QML.
*
* @param[in] userName Account user name string.
*/
void
downloadAccountInfoFinishedSig
(
QString
userName
);
/*!
* @brief Run change password isds action from QML.
*
* @param[in] userName Account user name string.
*/
void
runChangePasswordSig
(
QString
userName
);
/*!
* @brief Run download mesasge isds action from QML.
*
* @param[in] userName Account user name string.
*/
void
runDownloadMessageSig
(
QString
userName
);
/*!
* @brief Run download account info action from QML.
*
* @param[in] userName Account user name string.
*/
void
runGetAccountInfoSig
(
QString
userName
);
/*!
* @brief Run sync all accounts action from QML.
*
* @param[in] userName Account user name string.
*/
void
runSyncAllAccountsSig
(
QString
userName
);
/*!
* @brief Run sync one account action from QML.
*
* @param[in] userName Account user name string.
*/
void
runSyncOneAccountSig
(
QString
userName
);
/*!
* @brief Run sync received message list action from QML.
*
* @param[in] userName Account user name string.
*/
void
runSyncSingleAccountReceivedSig
(
QString
userName
);
/*!
* @brief Run sync sent message list action from QML.
*
* @param[in] userName Account user name string.
*/
void
runSyncSingleAccountSentSig
(
QString
userName
);
/*!
* @brief Signal is emitted when login to isds of new account fails.
*
* @param[in] userName Account user name string.
* @param[in] isLogged True if a new account was login to DS.
*/
void
downloadAccountInfoFinished
Sig
(
QString
userName
,
bool
isLogged
);
void
unsuccessedLoginToIsds
Sig
(
QString
userName
);
public
slots
:
/*!
* @brief Do
some
actions when download account info finished.
* @brief Do
post
actions when download account info finished.
*
* @param[in] userName Account username string.
* @param[in] success True if success.
...
...
@@ -225,7 +283,7 @@ public slots:
bool
success
,
const
QString
&
errTxt
);
/*!
* @brief Do
some
actions when download delivery info finished.
* @brief Do
post
actions when download delivery info finished.
*
* @param[in] userName Account username string.
* @param[in] msgId Message ID.
...
...
@@ -236,7 +294,7 @@ public slots:
qint64
msgId
,
bool
success
,
const
QString
&
errTxt
);
/*!
* @brief Do
some
actions when download message finished.
* @brief Do
post
actions when download message finished.
*
* @param[in] userName Account username string.
* @param[in] msgId Message ID.
...
...
@@ -247,7 +305,7 @@ public slots:
bool
success
,
const
QString
&
errTxt
);
/*!
* @brief Do
some
actions when download message list finished.
* @brief Do
post
actions when download message list finished.
*
* @param[in] userName Account username string.
* @param[in] success True if success.
...
...
@@ -270,17 +328,12 @@ public slots:
private:
/*!
* @brief Do
wnload received or sent message list of one account
.
* @brief Do
login action
.
*
* @param[in,out] acntModelVariant QVariant holding account model
* to be altered.
* @param[in,out] msgModelVariant QVariant holding message model
* to be altered.
* @param[in] userName Account username string.
* @param[in] isdsAction Isds action identificator.
* @param[in] userName Account username string.
*/
void
syncSingleAccount
(
const
QVariant
&
acntModelVariant
,
const
QVariant
&
msgModelVariant
,
const
QString
&
userName
,
enum
Messages
::
MessageType
msgDirect
);
void
doLoginAction
(
const
QString
&
isdsAction
,
const
QString
&
userName
);
/*!
* @brief Downloads complete message.
...
...
@@ -295,13 +348,14 @@ private:
qint64
msgId
);
/*!
* @brief
Show notification dialog when any login problem was occurred
.
* @brief
Check if account isds context has all required login data
.
*
* @param[in] isdsAction Isds action identificator.
* @param[in] userName Account username string.
* @
param[in] errTxt Error message from ISDS or XML layer
.
* @
return true if login method has all required login data
.
*/
void
showLoginProblemDialog
(
const
QString
&
userName
,
const
QString
&
errTxt
);
bool
hasCtxAllLoginData
(
const
QString
&
isdsAction
,
const
QString
&
userName
);