Commit 46d82bf1 authored by Karel Slaný's avatar Karel Slaný
Browse files

Renamed TaskAddRecipient to TaskRecipientInfo.

parent 98610e2a
......@@ -217,7 +217,6 @@ SOURCES += \
src/sqlite/message_db_tables.cpp \
src/sqlite/zfo_db.cpp \
src/sqlite/zfo_db_tables.cpp \
src/worker/task_add_recipient.cpp \
src/worker/task_change_password.cpp \
src/worker/task_credit_info.cpp \
src/worker/task_download_account_info.cpp \
......@@ -230,6 +229,7 @@ SOURCES += \
src/worker/task_import_zfo.cpp \
src/worker/task_keep_alive.cpp \
src/worker/task_pdz_info.cpp \
src/worker/task_recipient_info.cpp \
src/worker/task_records_management_stored_messages.cpp \
src/worker/task_send_message.cpp \
src/worker/task_send_sms.cpp \
......@@ -386,7 +386,6 @@ HEADERS += \
src/sqlite/zfo_db_tables.h \
src/worker/emitter.h \
src/worker/task.h \
src/worker/task_add_recipient.h \
src/worker/task_change_password.h \
src/worker/task_credit_info.h \
src/worker/task_download_account_info.h \
......@@ -399,6 +398,7 @@ HEADERS += \
src/worker/task_import_zfo.h \
src/worker/task_keep_alive.h \
src/worker/task_pdz_info.h \
src/worker/task_recipient_info.h \
src/worker/task_records_management_stored_messages.h \
src/worker/task_send_message.h \
src/worker/task_send_sms.h \
......
......@@ -40,7 +40,6 @@
#include "src/settings/prefs_specific.h"
#include "src/setwrapper.h"
#include "src/sqlite/zfo_db.h"
#include "src/worker/task_add_recipient.h"
#include "src/worker/task_change_password.h"
#include "src/worker/task_credit_info.h"
#include "src/worker/task_download_account_info.h"
......@@ -52,6 +51,7 @@
#include "src/worker/task_find_databox_fulltext.h"
#include "src/worker/task_import_zfo.h"
#include "src/worker/task_pdz_info.h"
#include "src/worker/task_recipient_info.h"
#include "src/worker/task_send_message.h"
#include "src/worker/task_send_sms.h"
......@@ -61,25 +61,6 @@
# define macroStdMove(x) (x)
#endif /* Q_COMPILER_RVALUE_REFS */
void Isds::Tasks::addRecipient(const AcntId &acntId, const QString &dbID,
bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos)
{
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR))) {
Q_ASSERT(0);
return;
}
TaskAddRecipient *task = new (::std::nothrow) TaskAddRecipient(
acntId, dbID, senderOvm, canUseInitReply, pdzInfos);
if (task != Q_NULLPTR) {
task->setAutoDelete(true);
GlobInstcs::workPoolPtr->assignHi(task);
}
}
bool Isds::Tasks::changePassword(const AcntId &acntId, const QString &oldPwd,
const QString &newPwd, const QString &otpCode)
{
......@@ -332,6 +313,25 @@ QString Isds::Tasks::importZfoMessages(const QList<AcntId> &acntIdList,
return tr("ZFO import is running... Wait until import will be finished.");
}
void Isds::Tasks::recipientInfo(const AcntId &acntId, const QString &dbID,
bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos)
{
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR))) {
Q_ASSERT(0);
return;
}
TaskRecipientInfo *task = new (::std::nothrow) TaskRecipientInfo(
acntId, dbID, senderOvm, canUseInitReply, pdzInfos);
if (task != Q_NULLPTR) {
task->setAutoDelete(true);
GlobInstcs::workPoolPtr->assignHi(task);
}
}
bool Isds::Tasks::sendGovRequest(const AcntId &acntId,
const Isds::Message &msg, QSet<QString> &transactIds)
{
......
......@@ -40,22 +40,6 @@ namespace Isds {
Q_DECLARE_TR_FUNCTIONS(Tasks)
public:
/*!
* @brief Add recipient and set pdz payment methods.
*
* @param[in] acntId Account identifier.
* @param[in] dbID Recipient data box id.
* @param[in] senderOvm True if sender is OVM.
* @param[in] canUseInitReply True if can use reply
* on initiatory message.
* @param[in] pdzInfos List of pdz info.
*/
static
void addRecipient(const AcntId &acntId, const QString &dbID,
bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos);
/*!
* @brief Change ISDS login password.
*
......@@ -166,6 +150,21 @@ namespace Isds {
QString importZfoMessages(const QList<AcntId> &acntIdList,
const QStringList &filePathList, bool authenticate);
/*!
* @brief Add recipient and set pdz payment methods.
*
* @param[in] acntId Account identifier.
* @param[in] dbID Recipient data box id.
* @param[in] senderOvm True if sender is OVM.
* @param[in] canUseInitReply True if can use reply
* on initiatory message.
* @param[in] pdzInfos List of pdz info.
*/
static
void recipientInfo(const AcntId &acntId, const QString &dbID,
bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos);
/*!
* @brief Sent GOV request.
*
......
......@@ -40,7 +40,7 @@
#include "src/qml_identifiers/qml_account_id.h"
#include "src/settings/accounts.h"
#include "src/worker/emitter.h"
#include "src/worker/task_add_recipient.h"
#include "src/worker/task_recipient_info.h"
#include "src/wrap_accounts.h"
IsdsWrapper::IsdsWrapper(QObject *parent)
......@@ -102,7 +102,7 @@ IsdsWrapper::IsdsWrapper(QObject *parent)
QList<Isds::PDZInfoRec>, bool, QString)));
connect(GlobInstcs::msgProcEmitterPtr,
SIGNAL(addRecipientFinishedSignal(DataboxModelEntry, int)),
SIGNAL(recipientInfoFinishedSignal(DataboxModelEntry, int)),
this, SLOT(addRecipientIntoModel(DataboxModelEntry, int)));
}
......@@ -575,7 +575,7 @@ void IsdsWrapper::addRecipient(const QmlAcntId *qAcntId, const QString &dbID,
bool senderOvm = Accounts::isOvm(qAcntId);
Isds::Tasks::addRecipient(*qAcntId, dbID, senderOvm,
Isds::Tasks::recipientInfo(*qAcntId, dbID, senderOvm,
canUseInitReply, m_pdzInfos);
}
......@@ -589,49 +589,49 @@ void IsdsWrapper::addRecipientIntoModel(const DataboxModelEntry &dbEntry,
}
switch (errCode) {
case TaskAddRecipient::TR_SUCCESS:
case TaskRecipientInfo::TR_SUCCESS:
break;
case TaskAddRecipient::TR_DB_NOT_OVM_NO_DB_INFO:
case TaskRecipientInfo::TR_DB_NOT_OVM_NO_DB_INFO:
Dialogues::message(Dialogues::WARNING,
tr("Unknown Message Type"),
tr("No information about the recipient data box '%1' could be obtained. It is unknown whether public or commercial messages can be sent to this recipient.").arg(dbEntry.dbID()),
QString(), Dialogues::OK, Dialogues::OK);
break;
case TaskAddRecipient::TR_DB_NO_PUBLIC_NO_PDZ:
case TaskRecipientInfo::TR_DB_NO_PUBLIC_NO_PDZ:
Dialogues::message(Dialogues::WARNING,
tr("Unknown Message Type"),
tr("No commercial message to the recipient data box '%1' can be sent. It is unknown whether a public messages can be sent to this recipient.").arg(dbEntry.dbID()),
QString(), Dialogues::OK, Dialogues::OK);
break;
case TaskAddRecipient::TR_DB_UNKNOWN_PUBLIC_NO_PDZ:
case TaskRecipientInfo::TR_DB_UNKNOWN_PUBLIC_NO_PDZ:
Dialogues::message(Dialogues::WARNING,
tr("Unknown Message Type"),
tr("No public message to the recipient data box '%1' can be sent. It is unknown whether a commercial messages can be sent to this recipient.").arg(dbEntry.dbID()),
QString(), Dialogues::OK, Dialogues::OK);
break;
case TaskAddRecipient::TR_DB_NO_ACTIVE:
case TaskRecipientInfo::TR_DB_NO_ACTIVE:
Dialogues::message(Dialogues::CRITICAL,
tr("Data box is not active"),
tr("Recipient with data box ID '%1' does not have active data box.").arg(dbEntry.dbID()),
tr("Recipient data box ID '%1' isn't active.").arg(dbEntry.dbID()),
tr("The message cannot be delivered."),
Dialogues::OK, Dialogues::OK);
m_databoxModel->removeEntry(dbEntry.dbID());
return;
break;
case TaskAddRecipient::TR_DB_NOT_EXISTS:
case TaskRecipientInfo::TR_DB_NOT_EXISTS:
Dialogues::message(Dialogues::CRITICAL,
tr("Wrong Recipient"),
tr("Recipient with data box ID '%1' does not exist.").arg(dbEntry.dbID()),
tr("Recipient with data box ID '%1' doesn't exist.").arg(dbEntry.dbID()),
tr("The message cannot be delivered."),
Dialogues::OK, Dialogues::OK);
m_databoxModel->removeEntry(dbEntry.dbID());
return;
break;
case TaskAddRecipient::TR_DB_SEARCH_ERROR:
case TaskRecipientInfo::TR_DB_SEARCH_ERROR:
{
int msgResponse = Dialogues::message(Dialogues::QUESTION,
tr("Recipient Search Failed"),
tr("Information about recipient data box '%1' could not be obtained.").arg(dbEntry.dbID()),
tr("Information about recipient data box '%1' couldn't be obtained.").arg(dbEntry.dbID()),
tr("Do you still want to add the box '%1' into the recipient list?").arg(dbEntry.dbID()),
Dialogues::NO | Dialogues::YES, Dialogues::NO);
if (msgResponse == Dialogues::NO) {
......@@ -640,7 +640,7 @@ void IsdsWrapper::addRecipientIntoModel(const DataboxModelEntry &dbEntry,
return;
}
break;
case TaskAddRecipient::TR_DB_NO_PUBLIC_PDZ_UNKNOWN:
case TaskRecipientInfo::TR_DB_NO_PUBLIC_PDZ_UNKNOWN:
Dialogues::message(Dialogues::CRITICAL,
tr("Cannot send message"),
tr("No public data message nor a commercial data message (PDZ) can be sent to the recipient data box '%1'.").arg(dbEntry.dbID()),
......
......@@ -306,7 +306,8 @@ public:
void getPdzInfo(const QmlAcntId *qAcntId, const QString &dbID);
/*!
* @brief Add recipient into recipient model and set pdz payment methods.
* @brief Donwload and add recipient into recipient model and set PDZ
* payment methods.
*
* @param[in] qAcntId Account identifier.
* @param[in] dbID Recipient data box id.
......
......@@ -131,12 +131,12 @@ signals:
const QString &errTxt);
/*!
* @brief Add recipient into model.
* @brief Recipient info downloaded.
*
* @param[in] dbEntry Data box entry.
* @param[in] errCode Error code.
*/
void addRecipientFinishedSignal(const DataboxModelEntry &dbEntry,
void recipientInfoFinishedSignal(const DataboxModelEntry &dbEntry,
int errCode);
};
......
......@@ -30,9 +30,9 @@
#include "src/isds/session/isds_session.h"
#include "src/isds/session/isds_sessions.h"
#include "src/worker/emitter.h"
#include "src/worker/task_add_recipient.h"
#include "src/worker/task_recipient_info.h"
TaskAddRecipient::TaskAddRecipient(const AcntId &acntId, const QString &dbID,
TaskRecipientInfo::TaskRecipientInfo(const AcntId &acntId, const QString &dbID,
bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos)
: m_result(TR_ERR),
......@@ -48,19 +48,19 @@ TaskAddRecipient::TaskAddRecipient(const AcntId &acntId, const QString &dbID,
Q_ASSERT(!m_dbId.isEmpty());
}
void TaskAddRecipient::run(void)
void TaskRecipientInfo::run(void)
{
logDebugLv0NL("%s", "--------------ADD RECIPIENT TASK--------------");
logDebugLv0NL("%s", "--------------RECIPIENT INFO TASK--------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
/* ### Worker task begin. ### */
m_result = addRecipient(m_acntId, m_dbId, m_senderOvm,
m_result = recipientInfo(m_acntId, m_dbId, m_senderOvm,
m_canUseInitReply, m_pdzInfos, m_dbEntry, m_lastError);
if (GlobInstcs::msgProcEmitterPtr != Q_NULLPTR) {
emit GlobInstcs::msgProcEmitterPtr->
addRecipientFinishedSignal(m_dbEntry, m_result);
recipientInfoFinishedSignal(m_dbEntry, m_result);
}
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
......@@ -133,7 +133,7 @@ QList<Isds::Type::DmType> setPossiblePdzPaymentMethods(
return dmPaymentTypes;
}
enum TaskAddRecipient::Result TaskAddRecipient::addRecipient(
enum TaskRecipientInfo::Result TaskRecipientInfo::recipientInfo(
const AcntId &acntId, const QString &dbID, bool senderOvm,
bool canUseInitReply, const QList<Isds::PDZInfoRec> &pdzInfos,
DataboxModelEntry &dbEntry, QString &lastError)
......@@ -170,7 +170,7 @@ enum TaskAddRecipient::Result TaskAddRecipient::addRecipient(
QString recipName;
QString recipAddress;
enum Isds::Type::NilBool recipDbEffectiveOVM = Isds::Type::BOOL_NULL;
enum TaskAddRecipient::Result result = TR_SUCCESS;
enum Result result = TR_SUCCESS;
if (foundBoxes.size() == 1) {
......
......@@ -32,12 +32,13 @@
#include "src/worker/task.h"
/*!
* @brief Task describing download recipient info and set pdz payment methods.
* @brief Task download info about the recipient and information about PDZ
* payment methods.
*/
class TaskAddRecipient : public Task {
class TaskRecipientInfo : public Task {
public:
/*!
* @brief Return recipent data box state describing what happened.
* @brief Return recipient data box state describing what happened.
*/
enum Result {
TR_SUCCESS, /*!< Operation was successful. */
......@@ -45,23 +46,23 @@ public:
TR_DB_NOT_EXISTS, /*!< Recipient data box does not exists. */
TR_DB_SEARCH_ERROR, /*!< Recipient data box search error. */
TR_DB_NOT_OVM_NO_DB_INFO, /*!< Recipient data box info error. */
TR_DB_NO_PUBLIC_NO_PDZ, /*!< Data box no pdz nor public. */
TR_DB_UNKNOWN_PUBLIC_NO_PDZ, /*!< Data box only pdz, public unknown. */
TR_DB_NO_PUBLIC_PDZ_UNKNOWN, /*!< Data box only public, pdz unknown. */
TR_DB_NO_PUBLIC_NO_PDZ, /*!< Data box no PDZ nor public. */
TR_DB_UNKNOWN_PUBLIC_NO_PDZ, /*!< Data box only DPZ, public unknown. */
TR_DB_NO_PUBLIC_PDZ_UNKNOWN, /*!< Data box only public, PDZ unknown. */
TR_ERR /*!< Other internal error. */
};
/*!
* @brief Get recipient info and set pdz payment methods.
* @brief Get recipient info and PDZ payment methods.
*
* @param[in] acntId Account identifier.
* @param[in] dbID Recipient data box id.
* @param[in] senderOvm True if sender is OVM.
* @param[in] canUseInitReply True if can use reply
* on initiatory message.
* @param[in] pdzInfos List of pdz info.
* @param[in] pdzInfos List of PDZ info.
*/
explicit TaskAddRecipient(const AcntId &acntId, const QString &dbID,
explicit TaskRecipientInfo(const AcntId &acntId, const QString &dbID,
bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos);
......@@ -79,24 +80,24 @@ private:
/*!
* Disable copy and assignment.
*/
TaskAddRecipient(const TaskAddRecipient &);
TaskAddRecipient &operator=(const TaskAddRecipient &);
TaskRecipientInfo(const TaskRecipientInfo &);
TaskRecipientInfo &operator=(const TaskRecipientInfo &);
/*!
* @brief Get recipient info and set pdz payment methods.
* @brief Get recipient info and PDZ payment methods.
*
* @param[in] acntId Account identifier.
* @param[in] dbID Recipient data box id.
* @param[in] senderOvm True if sender is OVM.
* @param[in] canUseInitReply True if can use reply
* on initiatory message.
* @param[in] pdzInfos List of pdz info.
* @param[in] pdzInfos List of PDZ info.
* @param[out] dbEntry Recipient data box info.
* @param[out] lastError Last ISDS error message.
* @return Error state.
*/
static
enum Result addRecipient(const AcntId &acntId,
enum Result recipientInfo(const AcntId &acntId,
const QString &dbID, bool senderOvm, bool canUseInitReply,
const QList<Isds::PDZInfoRec> &pdzInfos,
DataboxModelEntry &dbEntry, QString &lastError);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment