Commit 52d255be authored by Karel Slaný's avatar Karel Slaný

Renamed TaskFindDataboxIsds to TaskFindDatabox.

parent 425d0abf
......@@ -128,8 +128,8 @@ SOURCES += \
src/worker/task_download_delivery_info.cpp \
src/worker/task_download_message.cpp \
src/worker/task_download_message_list.cpp \
src/worker/task_find_databox.cpp \
src/worker/task_find_databox_fulltext.cpp \
src/worker/task_find_databox_isds.cpp \
src/worker/task_keep_alive.cpp \
src/worker/task_send_sms.cpp
......@@ -180,8 +180,8 @@ HEADERS += \
src/worker/task_download_delivery_info.h \
src/worker/task_download_message.h \
src/worker/task_download_message_list.h \
src/worker/task_find_databox.h \
src/worker/task_find_databox_fulltext.h \
src/worker/task_find_databox_isds.h \
src/worker/task_keep_alive.h \
src/worker/task_send_sms.h
......
......@@ -36,8 +36,8 @@
#include "src/worker/task_download_delivery_info.h"
#include "src/worker/task_download_message.h"
#include "src/worker/task_download_message_list.h"
#include "src/worker/task_find_databox.h"
#include "src/worker/task_find_databox_fulltext.h"
#include "src/worker/task_find_databox_isds.h"
#include "src/worker/task_keep_alive.h"
#include "src/worker/task_send_sms.h"
......@@ -257,6 +257,10 @@ int IsdsWrapper::findDatabox(const QString &userName,
m_isdsSession.isdsCtxMap[userName], &m_netLayer, phrase,
searchType, searchScope, page, ISDS_SEARCH2_ITEMS_PER_PAGE,
false);
if (Q_UNLIKELY(task == Q_NULLPTR)) {
Q_ASSERT(0);
return 0;
}
task->setAutoDelete(false);
m_workPool.runSingle(task);
bool success = TaskFindDataboxFulltext::DL_SUCCESS == task->m_result;
......@@ -303,9 +307,12 @@ QString IsdsWrapper::findDataboxIsds(const QString &userName,
return tr("Error to get databox info from ISDS");
}
TaskFindDataboxIsds *task;
task = new (std::nothrow) TaskFindDataboxIsds(
TaskFindDatabox *task = new (std::nothrow) TaskFindDatabox(
m_isdsSession.isdsCtxMap[userName], &m_netLayer, dbID, dbType);
if (Q_UNLIKELY(task == Q_NULLPTR)) {
Q_ASSERT(0);
return tr("Error creating task");
}
task->setAutoDelete(false);
m_workPool.runSingle(task);
QString dbInfo = task->m_dbInfo;
......
......@@ -25,9 +25,9 @@
#include "src/net/isds_const.h"
#include "src/net/xml_layer.h"
#include "src/worker/pool.h"
#include "src/worker/task_find_databox_isds.h"
#include "src/worker/task_find_databox.h"
TaskFindDataboxIsds::TaskFindDataboxIsds(IsdsSession::IsdsContext &ctx,
TaskFindDatabox::TaskFindDatabox(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, const QString &dbID, const QString &dbType)
: m_result(DL_ERR),
m_dbInfo(),
......@@ -37,22 +37,23 @@ TaskFindDataboxIsds::TaskFindDataboxIsds(IsdsSession::IsdsContext &ctx,
m_dbID(dbID),
m_dbType(dbType)
{
Q_ASSERT(Q_NULLPTR != m_netLayer);
}
void TaskFindDataboxIsds::run(void)
void TaskFindDatabox::run(void)
{
if (Q_NULLPTR == m_netLayer) {
Q_ASSERT(0);
return;
}
logDebugLv0NL("Starting find databox info task in thread '%p'",
logDebugLv0NL("Starting find data-box info task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Finding databox info from account '%s'.",
logDebugLv1NL("Searching for data box from account '%s'.",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
......@@ -61,11 +62,11 @@ void TaskFindDataboxIsds::run(void)
/* ### Worker task end. ### */
logDebugLv0NL("Finding databox info task finished in thread '%p'",
logDebugLv0NL("Find data-box info task finished in thread '%p'",
(void *) QThread::currentThreadId());
}
enum TaskFindDataboxIsds::Result TaskFindDataboxIsds::findDatabox(
enum TaskFindDatabox::Result TaskFindDatabox::findDatabox(
IsdsSession::IsdsContext &ctx, NetLayer *netLayer, const QString &dbID,
const QString &dbType, QString &dbInfo, QString &lastError)
{
......@@ -73,11 +74,11 @@ enum TaskFindDataboxIsds::Result TaskFindDataboxIsds::findDatabox(
if (ctx.username.isEmpty()) {
Q_ASSERT(0);
lastError = QObject::tr("Internal error");
lastError = tr("Internal error");
return DL_ERR;
}
/* Send SOAP request to find databox */
/* Send SOAP request to find data box. */
if (!netLayer->sendSoapRequest(ctx, FIND_SERVICE,
XmlLayer::xmlCreateFindDataBoxSoapRequest(dbID, dbType),
xmlDataOut)) {
......@@ -85,7 +86,7 @@ enum TaskFindDataboxIsds::Result TaskFindDataboxIsds::findDatabox(
return DL_ISDS_ERROR;
}
/* Parse databoxes from response */
/* Parse data boxes from response. */
if (!XmlLayer::parseFindDataBoxSoapResponse(xmlDataOut, dbInfo,
ctx.last_isds_msg)) {
lastError = ctx.last_isds_msg;
......
......@@ -21,17 +21,21 @@
* the two.
*/
#ifndef _TASK_FIND_DATABOX_ISDS_H_
#define _TASK_FIND_DATABOX_ISDS_H_
#ifndef _TASK_FIND_DATABOX_H_
#define _TASK_FIND_DATABOX_H_
#include <QCoreApplication> /* Q_DECLARE_TR_FUNCTIONS */
#include "src/net/isds_session.h"
#include "src/net/net_layer.h"
#include "src/worker/task.h"
/*!
* @brief Task describing finding of databox info on isds portale.
* @brief Task describing data-box info search.
*/
class TaskFindDataboxIsds : public Task {
class TaskFindDatabox : public Task {
Q_DECLARE_TR_FUNCTIONS(TaskFindDataboxFulltext)
public:
/*!
* @brief Return state describing what happened.
......@@ -39,7 +43,7 @@ public:
enum Result {
DL_SUCCESS, /*!< Operation was successful. */
DL_ISDS_ERROR, /*!< Error communicating with ISDS. */
DL_XML_ERROR, /*!< Error xml parse. */
DL_XML_ERROR, /*!< Error parsing XML. */
DL_DB_INS_ERR, /*!< Error inserting into database. */
DL_ERR /*!< Other error. */
};
......@@ -47,28 +51,28 @@ public:
/*!
* @brief Constructor.
*
* @param[in] ctx Account isds context (include username).
* @param[in] ctx Account ISDS context (include username).
* @param[in] netLayer Pointer to network manager.
* @param[in] dbID Search databox ID.
* @param[in] dbType Search databox type.
* @param[in] dbID Sought data-box ID.
* @param[in] dbType Sought data-box type.
*/
explicit TaskFindDataboxIsds(IsdsSession::IsdsContext &ctx,
explicit TaskFindDatabox(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, const QString &dbID, const QString &dbType);
/*!
* @brief Performs actual find databox info.
* @brief Performs actual data-box info search.
*/
virtual
void run(void) Q_DECL_OVERRIDE;
/*!
* @brief Find databox.
* @brief Find data box.
*
* @param[in] ctx Account isds context (include username).
* @param[in] ctx Account ISDS context (include username).
* @param[in] netLayer Pointer to network manager.
* @param[in] dbID Search databox ID.
* @param[in] dbType Search databox type.
* @param[out] dbInfo Databox detail info string.
* @param[in] dbID Sought data-box ID.
* @param[in] dbType Sought data-box type.
* @param[out] dbInfo Data box detail info string.
* @param[out] lastError Last ISDS error message.
* @return Error state.
*/
......@@ -78,20 +82,20 @@ public:
QString &dbInfo, QString &lastError);
enum Result m_result; /*!< Return state. */
QString m_dbInfo; /*!< Databox info string. */
QString m_dbInfo; /*!< Data box info string. */
QString m_lastError; /*!< Last ISDS error message. */
private:
/*!
* Disable copy and assignment.
*/
TaskFindDataboxIsds(const TaskFindDataboxIsds &);
TaskFindDataboxIsds &operator=(const TaskFindDataboxIsds &);
TaskFindDatabox(const TaskFindDatabox &);
TaskFindDatabox &operator=(const TaskFindDatabox &);
IsdsSession::IsdsContext m_ctx; /*!< Account isds context. */
IsdsSession::IsdsContext m_ctx; /*!< Account ISDS context. */
NetLayer *m_netLayer; /*!< Pointer to network manager to send request. */
const QString m_dbID; /*!< Search databox ID. */
const QString m_dbType; /*!< Search databox type */
const QString m_dbID; /*!< Sought data-box ID. */
const QString m_dbType; /*!< Sought data-box type. */
};
#endif /* _TASK_FIND_DATABOX_ISDS_H_ */
#endif /* _TASK_FIND_DATABOX_H_ */
......@@ -48,7 +48,7 @@ TaskFindDataboxFulltext::TaskFindDataboxFulltext(IsdsSession::IsdsContext &ctx,
m_pageSize(pageSize),
m_highlighting(highlighting)
{
Q_ASSERT(Q_NULLPTR != netLayer);
Q_ASSERT(Q_NULLPTR != m_netLayer);
}
void TaskFindDataboxFulltext::run(void)
......
......@@ -21,8 +21,8 @@
* the two.
*/
#ifndef _TASK_FIND_DATABOX_H_
#define _TASK_FIND_DATABOX_H_
#ifndef _TASK_FIND_DATABOX_FULLTEXT_H_
#define _TASK_FIND_DATABOX_FULLTEXT_H_
#include <QCoreApplication> /* Q_DECLARE_TR_FUNCTIONS */
......@@ -31,7 +31,7 @@
#include "src/worker/task.h"
/*!
* @brief Task describing finding of data box.
* @brief Task describing full-text data-box search.
*/
class TaskFindDataboxFulltext : public Task {
Q_DECLARE_TR_FUNCTIONS(TaskFindDataboxFulltext)
......@@ -124,4 +124,4 @@ private:
bool m_highlighting; /*!< Highlight search phrase in results. */
};
#endif /* _TASK_FIND_DATABOX_H_ */
#endif /* _TASK_FIND_DATABOX_FULLTEXT_H_ */
Markdown is supported
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