Commit 425d0abf authored by Karel Slaný's avatar Karel Slaný

Renamed TaskFindDatabox to TaskFindDataboxFulltext.

parent 79e02b61
......@@ -128,7 +128,7 @@ 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,7 +180,7 @@ 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,7 +36,7 @@
#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"
......@@ -252,13 +252,14 @@ int IsdsWrapper::findDatabox(const QString &userName,
databoxModel->clearAll();
TaskFindDatabox *task;
task = new (std::nothrow) TaskFindDatabox(
m_isdsSession.isdsCtxMap[userName], &m_netLayer, phrase,
searchType, searchScope, page, ISDS_SEARCH2_ITEMS_PER_PAGE, false);
TaskFindDataboxFulltext *task =
new (std::nothrow) TaskFindDataboxFulltext(
m_isdsSession.isdsCtxMap[userName], &m_netLayer, phrase,
searchType, searchScope, page, ISDS_SEARCH2_ITEMS_PER_PAGE,
false);
task->setAutoDelete(false);
m_workPool.runSingle(task);
bool success = TaskFindDatabox::DL_SUCCESS == task->m_result;
bool success = TaskFindDataboxFulltext::DL_SUCCESS == task->m_result;
QList<DataboxModelEntry> dbList = task->m_dbList;
int totalCount = task->m_totalCount;
int currentCount = task->m_currentCount;
......
......@@ -26,9 +26,9 @@
#include "src/net/xml_layer.h"
#include "src/worker/emitter.h"
#include "src/worker/pool.h" /* List with whole messages. */
#include "src/worker/task_find_databox.h"
#include "src/worker/task_find_databox_fulltext.h"
TaskFindDatabox::TaskFindDatabox(IsdsSession::IsdsContext &ctx,
TaskFindDataboxFulltext::TaskFindDataboxFulltext(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, const QString &searchText,
const QString &searchType, const QString &searchScope,
int page, int pageSize, bool highlighting)
......@@ -48,22 +48,23 @@ TaskFindDatabox::TaskFindDatabox(IsdsSession::IsdsContext &ctx,
m_pageSize(pageSize),
m_highlighting(highlighting)
{
Q_ASSERT(Q_NULLPTR != netLayer);
}
void TaskFindDatabox::run(void)
void TaskFindDataboxFulltext::run(void)
{
if (Q_NULLPTR == m_netLayer) {
Q_ASSERT(0);
return;
}
logDebugLv0NL("Starting find databox task in thread '%p'",
logDebugLv0NL("Starting full-text find data box task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Finding databox for account '%s'.",
logDebugLv1NL("Searching for data box from account '%s'.",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
......@@ -74,11 +75,11 @@ void TaskFindDatabox::run(void)
/* ### Worker task end. ### */
logDebugLv0NL("Finding databox task finished in thread '%p'",
logDebugLv0NL("Full-text find data box task finished in thread '%p'",
(void *) QThread::currentThreadId());
}
enum TaskFindDatabox::Result TaskFindDatabox::findDatabox(
enum TaskFindDataboxFulltext::Result TaskFindDataboxFulltext::findDatabox(
IsdsSession::IsdsContext &ctx, NetLayer *netLayer, const QString &searchText,
const QString &searchType, const QString &searchScope, int page,
int pageSize, bool highlighting, QList<DataboxModelEntry> &dbList,
......@@ -89,11 +90,11 @@ enum TaskFindDatabox::Result TaskFindDatabox::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::xmlCreateISDSSearch2SoapRequest(searchText, searchType,
searchScope, page, pageSize, highlighting), xmlDataOut)) {
......@@ -101,7 +102,7 @@ enum TaskFindDatabox::Result TaskFindDatabox::findDatabox(
return DL_ISDS_ERROR;
}
/* Parse databoxes from response */
/* Parse data boxes from response. */
if (!XmlLayer::parseISDSSearch2SoapResponse(xmlDataOut, dbList,
totalCount, currentCount, position, lastPage, ctx.last_isds_msg)) {
lastError = ctx.last_isds_msg;
......
......@@ -24,17 +24,21 @@
#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.
* @brief Task describing finding of data box.
*/
class TaskFindDatabox : public Task {
class TaskFindDataboxFulltext : public Task {
Q_DECLARE_TR_FUNCTIONS(TaskFindDataboxFulltext)
public:
/*!
* @brief Return state describing what happened.
* @brief Return code describing what happened.
*/
enum Result {
DL_SUCCESS, /*!< Operation was successful. */
......@@ -47,40 +51,40 @@ 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] searchText Search text.
* @param[in] searchType Search type option.
* @param[in] searchScope Search scope option.
* @param[in] page Page to be obtain.
* @param[in] pageSize Number of items on the page.
* @param[in] highlighting Highlight search phraze in results.
* @param[in] highlighting Highlight search phrase in results.
*/
explicit TaskFindDatabox(IsdsSession::IsdsContext &ctx,
explicit TaskFindDataboxFulltext(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, const QString &searchText,
const QString &searchType, const QString &searchScope,
int page, int pageSize, bool highlighting);
/*!
* @brief Performs actual find databox.
* @brief Performs actual data-box 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] searchText Search text.
* @param[in] searchType Search type option.
* @param[in] searchScope Search scope option.
* @param[in] page Page to be obtain.
* @param[in] pageSize Number of items on the page.
* @param[in] highlighting Highlight search phraze in results.
* @param[out] dbList List of databoxes.
* @param[out] totalCount Total number of databoxes.
* @param[out] currentCount Number o databoxes on the current page.
* @param[in] highlighting Highlight search phrase in results.
* @param[out] dbList List of data boxes.
* @param[out] totalCount Total number of data boxes.
* @param[out] currentCount Number of data boxes on the current page.
* @param[out] position Number of page.
* @param[out] lastPage True if search result are last page.
* @param[out] lastError Last ISDS error message.
......@@ -96,9 +100,9 @@ public:
QString &lastError);
enum Result m_result; /*!< Return state. */
QList<DataboxModelEntry> m_dbList; /*!< Return list of databoxes. */
int m_totalCount; /*!< Total number of databoxes. */
int m_currentCount; /*!< Number o databoxes on the current page. */
QList<DataboxModelEntry> m_dbList; /*!< Returned list of data boxes. */
int m_totalCount; /*!< Total number of data boxes. */
int m_currentCount; /*!< Number of data boxes on the current page. */
int m_position; /*!< Number of page. */
bool m_lastPage; /*!< True if search result are last page. */
QString m_lastError; /*!< Last ISDS error message. */
......@@ -107,17 +111,17 @@ private:
/*!
* Disable copy and assignment.
*/
TaskFindDatabox(const TaskFindDatabox &);
TaskFindDatabox &operator=(const TaskFindDatabox &);
TaskFindDataboxFulltext(const TaskFindDataboxFulltext &);
TaskFindDataboxFulltext &operator=(const TaskFindDataboxFulltext &);
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_searchText; /*!< Search phrase. */
const QString m_searchType; /*!< Search type. */
const QString m_searchScope; /*!< Search scope. */
int m_page; /*!< Page to be obtain. */
int m_pageSize; /*!< Number of items on the page. */
bool m_highlighting; /*!< Highlight search phraze in results. */
bool m_highlighting; /*!< Highlight search phrase in results. */
};
#endif /* _TASK_FIND_DATABOX_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