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
187bf93e
Commit
187bf93e
authored
May 26, 2017
by
Martin Straka
Browse files
Download delivery info tasks is asynchronous
parent
671350fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/net/isds_wrapper.cpp
View file @
187bf93e
...
...
@@ -60,6 +60,11 @@ IsdsWrapper::IsdsWrapper(QObject *parent)
SIGNAL
(
downloadMessageListFinishedSignal
(
QString
,
bool
,
QString
,
QString
,
bool
)),
this
,
SLOT
(
downloadMessageListFinished
(
QString
,
bool
,
QString
,
QString
,
bool
)));
connect
(
&
globMsgProcEmitter
,
SIGNAL
(
downloadDeliveryInfoFinishedSignal
(
QString
,
qint64
,
bool
,
QString
)),
this
,
SLOT
(
downloadDeliveryInfoFinished
(
QString
,
qint64
,
bool
,
QString
)));
}
IsdsWrapper
::~
IsdsWrapper
(
void
)
...
...
@@ -251,8 +256,8 @@ void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId)
TaskDownloadDeliveryInfo
*
task
;
task
=
new
(
std
::
nothrow
)
TaskDownloadDeliveryInfo
(
m_isdsSession
.
isdsCtxMap
[
userName
],
&
m_netLayer
,
&
m_dbWrapper
,
msgId
);
task
->
setAutoDelete
(
fals
e
);
m_workPool
.
runSingle
(
task
);
task
->
setAutoDelete
(
tru
e
);
m_workPool
.
assignHi
(
task
);
bool
success
=
TaskDownloadDeliveryInfo
::
DL_SUCCESS
==
task
->
m_result
;
delete
task
;
...
...
@@ -269,6 +274,19 @@ void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId)
}
}
void
IsdsWrapper
::
downloadDeliveryInfoFinished
(
const
QString
&
userName
,
qint64
msgId
,
bool
success
,
const
QString
&
errTxt
)
{
if
(
!
success
)
{
Dialogues
::
errorMessage
(
Dialogues
::
WARNING
,
tr
(
"Delivery info: %1"
).
arg
(
userName
),
tr
(
"Failed to download delivery info for message %1."
).
arg
(
msgId
),
errTxt
);
}
else
{
emit
statusBarTextChanged
(
errTxt
,
false
,
true
);
}
}
bool
IsdsWrapper
::
changePassword
(
const
QString
&
userName
,
const
QString
&
accountName
)
{
...
...
src/net/isds_wrapper.h
View file @
187bf93e
...
...
@@ -238,6 +238,17 @@ public slots:
bool
success
,
const
QString
&
statusBarText
,
const
QString
&
errTxt
,
bool
isMsgReceived
);
/*!
* @brief Do some actions when download delivery info finished.
*
* @param[in] userName Account username string.
* @param[in] msgId Message ID.
* @param[in] success True if success.
* @param[in] errTxt Errot description.
*/
void
downloadDeliveryInfoFinished
(
const
QString
&
userName
,
qint64
msgId
,
bool
success
,
const
QString
&
errTxt
);
private:
/*!
...
...
src/worker/emitter.h
View file @
187bf93e
...
...
@@ -57,6 +57,17 @@ signals:
void
downloadMessageListFinishedSignal
(
const
QString
&
userName
,
bool
success
,
const
QString
&
statusBarText
,
const
QString
&
errTxt
,
bool
isMsgReceived
);
/*!
* @brief Do some actions when download delivery info finished.
*
* @param[in] userName Account username string.
* @param[in] msgId Message ID.
* @param[in] success True if success.
* @param[in] errTxt Errot description.
*/
void
downloadDeliveryInfoFinishedSignal
(
const
QString
&
userName
,
qint64
msgId
,
bool
success
,
const
QString
&
errTxt
);
};
/*!
...
...
src/worker/task_download_delivery_info.cpp
View file @
187bf93e
...
...
@@ -24,6 +24,7 @@
#include
"src/log/log.h"
#include
"src/net/isds_const.h"
#include
"src/net/xml_layer.h"
#include
"src/worker/emitter.h"
#include
"src/worker/pool.h"
/* List with whole messages. */
#include
"src/worker/task_download_delivery_info.h"
...
...
@@ -64,6 +65,10 @@ void TaskDownloadDeliveryInfo::run(void)
/* ### Worker task end. ### */
emit
globMsgProcEmitter
.
downloadDeliveryInfoFinishedSignal
(
m_ctx
.
username
,
m_msgId
,
TaskDownloadDeliveryInfo
::
DL_SUCCESS
==
m_result
,
m_ctx
.
last_isds_msg
);
logDebugLv0NL
(
"Download message message delivery info task finished in thread '%p'"
,
(
void
*
)
QThread
::
currentThreadId
());
}
...
...
Write
Preview
Supports
Markdown
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