Commit a63fc1b2 authored by Karel Slaný's avatar Karel Slaný

Merge branch 'task-log-message' into 'develop'

Modify existing and add new log messages into tasks

See merge request !128
parents 58a0df74 bfcef04e
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -119,6 +119,7 @@ bool DbWrapper::insertMessageListToDb(const QString &userName,
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
txt = tr("Internal error!");
Q_ASSERT(0);
return false;
}
......@@ -187,12 +188,11 @@ bool DbWrapper::insertCompleteMessageToDb(const QString &userName, qint64 dmId,
(GlobInstcs::fileDbsPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
Q_ASSERT(0);
txt = tr("Internal error!");
return false;
}
bool ret = true;
/* Open files database from username */
/* Open file database */
FileDb *fDb = GlobInstcs::fileDbsPtr->accessFileDb(
GlobInstcs::setPtr->dbsLocation, userName,
(*GlobInstcs::acntMapPtr)[userName].storeToDisk());
......@@ -201,48 +201,40 @@ bool DbWrapper::insertCompleteMessageToDb(const QString &userName, qint64 dmId,
return false;
}
/* Insert or update files into files database */
/* Insert or update attachment files */
fDb->beginTransaction();
foreach (const Isds::Document &document, message.documents()) {
if (!fDb->insertUpdateFileIntoDb(dmId, document)) {
txt = tr("File %1 insertion failed!").
arg(document.fileDescr());
ret = false;
return false;
}
}
fDb->commitTransaction();
/* Open messages database from username */
/* Open message database */
MessageDb *msgDb = GlobInstcs::messageDbsPtr->accessMessageDb(
GlobInstcs::setPtr->dbsLocation, userName,
(*GlobInstcs::acntMapPtr)[userName].storeToDisk());
if (msgDb == Q_NULLPTR) {
txt = tr("Cannot open message database!");
return false;
}
/* Update message envelope data in messages database */
if (ret) {
if (!msgDb->insertOrUpdateMessageEnvelopeInDb(dmId, messageType,
message.envelope())) {
txt = tr("Message %1 envelope update failed!").
arg(dmId);
ret = false;
}
goto fail;
}
if (ret) {
/*
* Download complete message action should not mark
* a message as locally read. Only user-action can change the
* local state when the user opens the message detail.
*/
/* Insert or update message envelope data */
if (!msgDb->insertOrUpdateMessageEnvelopeInDb(dmId, messageType,
message.envelope())) {
txt = tr("Message %1 envelope update failed!").
arg(dmId);
goto fail;
} else {
msgDb->setAttachmentDownloaded(dmId, true);
}
txt = tr("Message has been downloaded");
return true;
fail:
fDb->rollbackTransaction();
return false;
}
bool DbWrapper::insertPwdExpirationToDb(const QString &userName,
......@@ -288,6 +280,7 @@ bool DbWrapper::updateAuthorInfo(const QString &userName,
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
txt = tr("Internal error!");
Q_ASSERT(0);
return false;
}
......@@ -315,6 +308,7 @@ bool DbWrapper::insertMesasgeDeliveryInfoToDb(const QString &userName,
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
txt = tr("Internal error!");
Q_ASSERT(0);
return false;
}
......
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -49,23 +49,19 @@ void TaskChangePassword::run(void)
return;
}
logDebugLv0NL("Starting change password task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Change password for account '%s'.",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv0NL("%s", "--------------CHANGE PASSWORD TASK-------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = changePassword(m_ctx, m_netLayer, m_dbOTPType, m_oldPwd, m_newPwd);
m_result = changePassword(m_ctx, m_netLayer, m_dbOTPType,
m_oldPwd, m_newPwd);
m_isdsText = m_ctx.last_isds_msg;
/* ### Worker task end. ### */
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
logDebugLv0NL("Change password task finished in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task end. ### */
}
enum TaskChangePassword::Result TaskChangePassword::changePassword(
......@@ -73,10 +69,14 @@ enum TaskChangePassword::Result TaskChangePassword::changePassword(
const QString &oldPwd, const QString &newPwd)
{
if (ctx.username.isEmpty()) {
logErrorNL("%s", "Account user name missing!");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
QByteArray xmlDataOut;
/* Send SOAP request */
......@@ -84,20 +84,28 @@ enum TaskChangePassword::Result TaskChangePassword::changePassword(
if (!netLayer->createChangePwdRequest(ctx, DB_SERVICE,
Xml::xmlCreateChangeISDSPasswordSoapRequest(oldPwd,
newPwd), xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
} else {
if (!netLayer->createChangePwdRequest(ctx, OTP_CHNG_PWD_SERVICE,
Xml::xmlCreateChangePasswordOTPSoapRequest(dbOTPType,
oldPwd, newPwd), xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
}
/* Parse SOAP response */
if (!Xml::parseDbStatusFromXml(xmlDataOut, ctx.last_isds_msg)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_XML_ERROR;
}
logDebugLv1NL("%s", "Password has been changed");
return DL_SUCCESS;
}
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -47,20 +47,13 @@ void TaskDownloadAccountInfo::run(void)
return;
}
logDebugLv0NL("Starting download account info task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Downloading account info for account '%s'.",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv0NL("%s", "--------------ACCOUNT INFO TASK---------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = downloadAccountInfo(m_ctx, m_netLayer);
/* ### Worker task end. ### */
if (GlobInstcs::msgProcEmitterPtr != Q_NULLPTR) {
emit GlobInstcs::msgProcEmitterPtr->downloadAccountInfoFinishedSignal(
m_ctx.username,
......@@ -68,18 +61,24 @@ void TaskDownloadAccountInfo::run(void)
m_ctx.last_isds_msg);
}
logDebugLv0NL("Download account info task finished in thread '%p'",
(void *) QThread::currentThreadId());
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
/* ### Worker task end. ### */
}
enum TaskDownloadAccountInfo::Result TaskDownloadAccountInfo::downloadAccountInfo(
IsdsSession::IsdsContext &ctx, NetLayer *netLayer)
{
if (ctx.username.isEmpty()) {
logErrorNL("%s", "Account user name missing!");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
QByteArray xmlDataOut;
/* Send SOAP request to download account owner info */
......@@ -93,17 +92,25 @@ enum TaskDownloadAccountInfo::Result TaskDownloadAccountInfo::downloadAccountInf
Isds::DbOwnerInfo dbOwnerInfo =
Xml::parseGetOwnerInfoFromLogin(xmlDataOut, ctx.last_isds_msg);
if (dbOwnerInfo.isNull()) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_XML_ERROR;
}
/* Store data into db */
if (!DbWrapper::insertAccountInfoToDb(ctx.username, dbOwnerInfo)) {
logErrorNL("Cannot store owner info into database: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_DB_INS_ERR;
}
logDebugLv1NL("%s", "Owner info has been downloaded");
/* Send SOAP request to download user info */
if (!netLayer->sendSoapRequest(ctx, DB_SERVICE,
Xml::xmlCreateGetUserInfoFromLoginSoapRequest(), xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
......@@ -111,25 +118,37 @@ enum TaskDownloadAccountInfo::Result TaskDownloadAccountInfo::downloadAccountInf
Isds::DbUserInfo dbUserInfo =
Xml::parseGetUserInfoFromLogin(xmlDataOut, ctx.last_isds_msg);
if (dbUserInfo.isNull()) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_XML_ERROR;
}
/* Store data into db */
if (!DbWrapper::insertUserInfoToDb(ctx.username, dbUserInfo)) {
logErrorNL("Cannot store user info into database: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_DB_INS_ERR;
}
logDebugLv1NL("%s", "User info has been downloaded");
/* Send SOAP request download password info */
if (!netLayer->sendSoapRequest(ctx, DB_SERVICE,
Xml::xmlCreateGetPasswordInfoSoapRequest(), xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
/* Parse SOAP response and store data into db */
if (!DbWrapper::insertPwdExpirationToDb(ctx.username,
Xml::parseGetPasswordInfo(xmlDataOut, ctx.last_isds_msg))) {
logErrorNL("Cannot store password info into database: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_DB_INS_ERR;
}
logDebugLv1NL("%s", "Password info has been downloaded");
return DL_SUCCESS;
}
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -47,21 +47,13 @@ void TaskDownloadDeliveryInfo::run(void)
return;
}
logDebugLv0NL("Starting download message delivery info task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Downloading message delivery info %s for account '%s'.",
QString::number(m_msgId).toUtf8().constData(),
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv0NL("%s", "--------------DELIVERY INFO TASK---------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = downloadDeliveryInfo(m_ctx, m_netLayer, m_msgId);
/* ### Worker task end. ### */
if (GlobInstcs::msgProcEmitterPtr != Q_NULLPTR) {
emit GlobInstcs::msgProcEmitterPtr->downloadDeliveryInfoFinishedSignal(
m_ctx.username, m_msgId,
......@@ -69,23 +61,31 @@ void TaskDownloadDeliveryInfo::run(void)
m_ctx.last_isds_msg);
}
logDebugLv0NL("Download message message delivery info task finished in thread '%p'",
(void *) QThread::currentThreadId());
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
/* ### Worker task end. ### */
}
enum TaskDownloadDeliveryInfo::Result TaskDownloadDeliveryInfo::downloadDeliveryInfo(
IsdsSession::IsdsContext &ctx, NetLayer *netLayer, qint64 msgId)
{
if (ctx.username.isEmpty()) {
logErrorNL("%s", "Account user name missing!");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
QByteArray xmlDataOut;
/* Send SOAP request */
if (!netLayer->sendSoapRequest(ctx, MESSAGE_SERVICE,
Xml::xmlCreateSignedDeliveryInfoSoapRequest(msgId), xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
......@@ -98,9 +98,14 @@ enum TaskDownloadDeliveryInfo::Result TaskDownloadDeliveryInfo::downloadDelivery
if (!events.isEmpty()) {
if (!DbWrapper::insertMesasgeDeliveryInfoToDb(ctx.username,
events, msgId, ctx.last_isds_msg)) {
logWarningNL("Cannot insert delivery info into "
"database: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_DB_INS_ERR;
}
}
logDebugLv1NL("%s", "Delivery info has been downloaded");
return DL_SUCCESS;
}
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -65,22 +65,14 @@ void TaskDownloadMessage::run(void)
return;
}
logDebugLv0NL("Starting download message task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Downloading message %s for account '%s'.",
QString::number(m_msgId).toUtf8().constData(),
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv0NL("%s", "-------------DOWNLOAD MESSAGE TASK-------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = downloadMessage(m_ctx, m_netLayer, m_msgId,
m_msgDirect, m_messageModel, m_saveZfo, m_isTestAccount);
/* ### Worker task end. ### */
if (GlobInstcs::msgProcEmitterPtr != Q_NULLPTR) {
emit GlobInstcs::msgProcEmitterPtr->downloadMessageFinishedSignal(
m_ctx.username, m_msgId,
......@@ -88,8 +80,10 @@ void TaskDownloadMessage::run(void)
m_ctx.last_isds_msg);
}
logDebugLv0NL("Download message task finished in thread '%p'",
(void *) QThread::currentThreadId());
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
/* ### Worker task end. ### */
}
enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
......@@ -98,10 +92,14 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
MessageListModel *messageModel, bool saveZfo, bool isTestAccount)
{
if (ctx.username.isEmpty()) {
logErrorNL("%s", "Account user name missing!");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
QByteArray xmlDataOut;
QString userType, authorName;
QByteArray zfoData;
......@@ -110,6 +108,8 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
if (!netLayer->sendSoapRequest(ctx, LOGIN_SERVICE,
Xml::xmlCreateDownloadMessageSoapRequest(msgId, msgDirect),
xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
......@@ -118,10 +118,12 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
xmlDataOut, ctx.last_isds_msg, zfoData);
if (message.isNull()) {
logErrorNL("%s", "Message is empty or invalid!");
return DL_XML_ERROR;
}
if (message.documents().isEmpty()) {
logErrorNL("%s", "Message attachment missing!");
return DL_ERR;
}
......@@ -146,6 +148,8 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
/* Store data into db */
if (!DbWrapper::insertCompleteMessageToDb(ctx.username, msgId, message,
msgType, ctx.last_isds_msg)) {
logErrorNL("Cannot insert complete message into database: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_DB_INS_ERR;
}
......@@ -165,7 +169,8 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
Xml::xmlCreateGetMessageAuthorSoapRequest(msgId), xmlDataOut);
/* Parse SOAP response */
Xml::parseGetAuthorInfo(xmlDataOut, userType, authorName, ctx.last_isds_msg);
Xml::parseGetAuthorInfo(xmlDataOut, userType, authorName,
ctx.last_isds_msg);
/* Store data into db */
DbWrapper::updateAuthorInfo(ctx.username, userType, authorName,
......@@ -199,5 +204,7 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
zfoData);
}
logDebugLv1NL("%s", "Complete message has been downloaded");
return DL_SUCCESS;
}
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -72,24 +72,20 @@ void TaskDownloadMessageList::run(void)
return;
}
logDebugLv0NL("Starting download message list task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Downloading %s message list for account '%s'.",
(Messages::TYPE_RECEIVED == m_msgDirect) ? "received" : "sent",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
if ((Messages::TYPE_RECEIVED == m_msgDirect)) {
logDebugLv0NL("%s", "---------RECEIVED MESSAGE LIST TASK------------");
} else {
logDebugLv0NL("%s", "------------SENT MESSAGE LIST TASK-------------");
}
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = downloadMessageList(m_ctx, m_netLayer,
m_msgDirect, m_dmStatusFilter, m_dmOffset, m_dmLimit,
m_workPool, m_messageModel, m_accountModel, m_downloadCompleteMsgs,
m_dbsLocation, m_saveZfo, m_isTestAccount, m_statusBarText);
/* ### Worker task end. ### */
if (GlobInstcs::msgProcEmitterPtr != Q_NULLPTR) {
emit GlobInstcs::msgProcEmitterPtr->downloadMessageListFinishedSignal(
m_ctx.username,
......@@ -98,8 +94,10 @@ void TaskDownloadMessageList::run(void)
m_msgDirect == Messages::TYPE_RECEIVED);
}
logDebugLv0NL("Download message list task finished in thread '%p'",
(void *) QThread::currentThreadId());
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
/* ### Worker task end. ### */
}
enum TaskDownloadMessageList::Result TaskDownloadMessageList::downloadMessageList(
......@@ -112,21 +110,28 @@ enum TaskDownloadMessageList::Result TaskDownloadMessageList::downloadMessageLis
{
if (Q_UNLIKELY((GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
logErrorNL("%s", "Internal error!");
Q_ASSERT(0);
return DL_ERR;
}
if (ctx.username.isEmpty()) {
logErrorNL("%s", "Account user name missing!");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
QByteArray xmlDataOut;
/* Send SOAP request */
if (!netLayer->sendSoapRequest(ctx, MESSAGE_SERVICE,
Xml::xmlCreateGetMessageListSoapRequest(msgDirect,
dmStatusFilter, dmOffset, dmLimit), xmlDataOut)) {
logErrorNL("ISDS returns: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_ISDS_ERROR;
}
......@@ -147,6 +152,8 @@ enum TaskDownloadMessageList::Result TaskDownloadMessageList::downloadMessageLis
: MessageDb::TYPE_SENT,
envelopes, messageChangedStatusList, ctx.last_isds_msg,
listOfNewMsgIds)) {
logErrorNL("Cannot insert message list into database: '%s'",
ctx.last_isds_msg.toUtf8().constData());
return DL_DB_INS_ERR;
}
......@@ -224,5 +231,7 @@ enum TaskDownloadMessageList::Result TaskDownloadMessageList::downloadMessageLis
}
}
logDebugLv1NL("%s", "Message list has been downloaded");
return DL_SUCCESS;
}
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -48,23 +48,18 @@ void TaskFindDatabox::run(void)
return;
}
logDebugLv0NL("Starting find data-box info task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Searching for data box from account '%s'.",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv0NL("%s", "---------------FIND DATABOX TASK---------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = findDatabox(m_ctx, m_netLayer, m_dbID, m_dbType,
m_dbInfo, m_lastError);
/* ### Worker task end. ### */
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
logDebugLv0NL("Find data-box info task finished in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task end. ### */
}
enum TaskFindDatabox::Result TaskFindDatabox::findDatabox(
......@@ -74,16 +69,21 @@ enum TaskFindDatabox::Result TaskFindDatabox::findDatabox(
QByteArray xmlDataOut;
if (ctx.username.isEmpty()) {
Q_ASSERT(0);
logErrorNL("%s", "Account user name missing!");
lastError = tr("Internal error");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
/* Send SOAP request to find data box. */
if (!netLayer->sendSoapRequest(ctx, FIND_SERVICE,
Xml::xmlCreateFindDataBoxSoapRequest(dbID, dbType),
xmlDataOut)) {
lastError = ctx.last_isds_msg;
logErrorNL("ISDS returns: '%s'", lastError.toUtf8().constData());
return DL_ISDS_ERROR;
}
......@@ -91,6 +91,7 @@ enum TaskFindDatabox::Result TaskFindDatabox::findDatabox(
if (!Xml::parseFindDataBoxSoapResponse(xmlDataOut, dbInfo,
ctx.last_isds_msg)) {
lastError = ctx.last_isds_msg;
logErrorNL("ISDS returns: '%s'", lastError.toUtf8().constData());
return DL_XML_ERROR;
}
......
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -59,25 +59,20 @@ void TaskFindDataboxFulltext::run(void)
return;
}
logDebugLv0NL("Starting full-text find data box task in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task begin. ### */
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv1NL("Searching for data box from account '%s'.",
m_ctx.account_name.toUtf8().constData());
logDebugLv1NL("%s", "-----------------------------------------------");
logDebugLv0NL("%s", "---------FULLTEXT FIND DATABOX TASK------------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
m_result = findDatabox(m_ctx, m_netLayer, m_searchText, m_searchType,
m_searchScope, m_page, m_pageSize, m_highlighting,
m_dbList, m_totalCount, m_currentCount, m_position, m_lastPage,
m_lastError);
/* ### Worker task end. ### */
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
logDebugLv0NL("Full-text find data box task finished in thread '%p'",
(void *) QThread::currentThreadId());
/* ### Worker task end. ### */
}
enum TaskFindDataboxFulltext::Result TaskFindDataboxFulltext::findDatabox(
......@@ -90,16 +85,21 @@ enum TaskFindDataboxFulltext::Result TaskFindDataboxFulltext::findDatabox(
QByteArray xmlDataOut;
if (ctx.username.isEmpty()) {
Q_ASSERT(0);
lastError = tr("Internal error");
logErrorNL("%s", "Account user name missing!");
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
ctx.account_name.toUtf8().constData());
/* Send SOAP request to find data box. */
if (!netLayer->sendSoapRequest(ctx, FIND_SERVICE,
Xml::xmlCreateISDSSearch2SoapRequest(searchText, searchType,
searchScope, page, pageSize, highlighting), xmlDataOut)) {
lastError = ctx.last_isds_msg;
logErrorNL("ISDS returns: '%s'", lastError.toUtf8().constData());
return DL_ISDS_ERROR;
}
......
......@@ -8,7 +8,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
......@@ -72,11 +72,11 @@ void TaskImportZfo::run(void)
return;
}