Commit 79d114b1 authored by Karel Slaný's avatar Karel Slaný

Hid the widget-based implementation of WidgetMessageDialogue::message().

parent e95a26db
...@@ -83,7 +83,7 @@ TRANSLATIONS_FILES += \ ...@@ -83,7 +83,7 @@ TRANSLATIONS_FILES += \
SOURCES += \ SOURCES += \
src/accounts.cpp \ src/accounts.cpp \
src/dialogues/input_dialogue.cpp \ src/dialogues/dialogues.cpp \
src/dialogues/qml_dialogue_helper.cpp \ src/dialogues/qml_dialogue_helper.cpp \
src/dialogues/qml_input_dialogue.cpp \ src/dialogues/qml_input_dialogue.cpp \
src/dialogues/widget_input_dialogue.cpp \ src/dialogues/widget_input_dialogue.cpp \
...@@ -120,7 +120,7 @@ SOURCES += \ ...@@ -120,7 +120,7 @@ SOURCES += \
HEADERS += \ HEADERS += \
src/accounts.h \ src/accounts.h \
src/common.h \ src/common.h \
src/dialogues/input_dialogue.h \ src/dialogues/dialogues.h \
src/dialogues/qml_dialogue_helper.h \ src/dialogues/qml_dialogue_helper.h \
src/dialogues/qml_input_dialogue.h \ src/dialogues/qml_input_dialogue.h \
src/dialogues/widget_input_dialogue.h \ src/dialogues/widget_input_dialogue.h \
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "src/accounts.h" #include "src/accounts.h"
#include "src/common.h" #include "src/common.h"
#include "src/dialogues/widget_message_dialogue.h" #include "src/dialogues/dialogues.h"
#include "src/net/isds_wrapper.h" #include "src/net/isds_wrapper.h"
#include "src/net/isds_session.h" #include "src/net/isds_session.h"
#include "src/settings.h" #include "src/settings.h"
...@@ -110,13 +110,12 @@ bool Accounts::removeAccount(const QString &userName, bool showDialog) ...@@ -110,13 +110,12 @@ bool Accounts::removeAccount(const QString &userName, bool showDialog)
qDebug("%s()", __func__); qDebug("%s()", __func__);
if (showDialog) { if (showDialog) {
int msgResponse = WidgetMessageDialogue::message( int msgResponse = Dialogues::message(Dialogues::QUESTION,
QMessageBox::Question,
tr("Remove account: %1").arg(userName), tr("Remove account: %1").arg(userName),
tr("Do you want to remove the account '%1'?").arg(userName), tr("Do you want to remove the account '%1'?").arg(userName),
tr("Note: It will also remove all related local databases and account information."), tr("Note: It will also remove all related local databases and account information."),
QMessageBox::No | QMessageBox::Yes, QMessageBox::No); Dialogues::NO | Dialogues::YES, Dialogues::NO);
if (msgResponse == QMessageBox::No) { if (msgResponse == Dialogues::NO) {
return false; return false;
} }
} }
...@@ -187,7 +186,7 @@ void Accounts::updateAccount(const QString &loginMetod, ...@@ -187,7 +186,7 @@ void Accounts::updateAccount(const QString &loginMetod,
qDebug("%s()", __func__); qDebug("%s()", __func__);
if (acntName.isEmpty()) { if (acntName.isEmpty()) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Problem while updating account"), tr("Problem while updating account"),
tr("Account name has not been specified!"), tr("Account name has not been specified!"),
tr("This field must be filled in.")); tr("This field must be filled in."));
...@@ -270,7 +269,7 @@ bool Accounts::createAccount(const QString &loginMetod, ...@@ -270,7 +269,7 @@ bool Accounts::createAccount(const QString &loginMetod,
qDebug("%s()", __func__); qDebug("%s()", __func__);
if (userName.isEmpty() || acntName.isEmpty()) { if (userName.isEmpty() || acntName.isEmpty()) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Problem while creating account"), tr("Problem while creating account"),
tr("User name or account name has not been specified!"), tr("User name or account name has not been specified!"),
tr("These fields must be filled in.")); tr("These fields must be filled in."));
...@@ -290,7 +289,7 @@ bool Accounts::createAccount(const QString &loginMetod, ...@@ -290,7 +289,7 @@ bool Accounts::createAccount(const QString &loginMetod,
acntData.setCertPath(url.toLocalFile()); acntData.setCertPath(url.toLocalFile());
if (globAccountsModelPtr->addAccount(acntData) == -2) { if (globAccountsModelPtr->addAccount(acntData) == -2) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Creating account: %1").arg(userName), tr("Creating account: %1").arg(userName),
tr("Account '%1' could not be created.").arg(acntName), tr("Account '%1' could not be created.").arg(acntName),
tr("Account with user name '%1' already exists.").arg(userName)); tr("Account with user name '%1' already exists.").arg(userName));
......
...@@ -25,9 +25,12 @@ ...@@ -25,9 +25,12 @@
#define USE_QML_DIALOGUES 1 #define USE_QML_DIALOGUES 1
#endif /* !defined(Q_OS_IOS) */ #endif /* !defined(Q_OS_IOS) */
#include "src/dialogues/input_dialogue.h" #include <QWindow>
#include "src/dialogues/dialogues.h"
#include "src/dialogues/qml_input_dialogue.h" #include "src/dialogues/qml_input_dialogue.h"
#include "src/dialogues/widget_input_dialogue.h" #include "src/dialogues/widget_input_dialogue.h"
#include "src/dialogues/widget_message_dialogue.h"
#if !defined(USE_QML_DIALOGUES) #if !defined(USE_QML_DIALOGUES)
/*! /*!
...@@ -61,7 +64,126 @@ QLineEdit::EchoMode toLineEditEchoMode( ...@@ -61,7 +64,126 @@ QLineEdit::EchoMode toLineEditEchoMode(
} }
#endif /* !defined(USE_QML_DIALOGUES) */ #endif /* !defined(USE_QML_DIALOGUES) */
QString InputDialogue::getText(QObject *parent, const QString &title, /*!
* @brief Converts dialogue icon from helper class definition.
*
* @param[in] icon Icon as used in Dialogues.
* @return Icon as used in WidgetMessageDialogue.
*/
static
enum QMessageBox::Icon toMessageBoxIcon(enum Dialogues::Icon icon)
{
switch (icon) {
case Dialogues::NO_ICON:
return QMessageBox::NoIcon;
break;
case Dialogues::QUESTION:
return QMessageBox::Question;
break;
case Dialogues::INFORMATION:
return QMessageBox::Information;
break;
case Dialogues::WARNING:
return QMessageBox::Warning;
break;
case Dialogues::CRITICAL:
return QMessageBox::Critical;
break;
default:
Q_ASSERT(0);
return QMessageBox::NoIcon;
break;
}
}
/*!
* @brief Converts dialogue button from helper class definition.
*
* @param[in] button Button as used in Dialogues.
* @return Button as used in WidgetMessageDialogue.
*/
static
enum QMessageBox::StandardButton toMessageBoxButton(
enum Dialogues::Button button)
{
switch (button) {
case Dialogues::OK:
return QMessageBox::Ok;
break;
case Dialogues::CANCEL:
return QMessageBox::Cancel;
break;
case Dialogues::YES:
return QMessageBox::Yes;
break;
case Dialogues::NO:
return QMessageBox::No;
break;
case Dialogues::NO_BUTTON:
return QMessageBox::NoButton;
break;
default:
Q_ASSERT(0);
return QMessageBox::NoButton;
break;
}
}
/*!
* @brief Concerts return value from message dialogue.
*
* @param[in] retVal Return value as returned by message dialogue.
* @return Converted value.
*/
static
int toDialogueRetVal(int retVal)
{
switch (retVal) {
case -1:
return -1;
break;
case QMessageBox::Ok:
return Dialogues::OK;
break;
case QMessageBox::Cancel:
return Dialogues::CANCEL;
break;
case QMessageBox::Yes:
return Dialogues::YES;
break;
case QMessageBox::No:
return Dialogues::NO;
break;
case QMessageBox::NoButton:
return Dialogues::NO_BUTTON;
break;
default:
Q_ASSERT(0);
return retVal;
break;
}
}
/*!
* @brief Converts dialogue button from helper class definition.
*
* @param[in] button Button as used in Dialogues.
* @return Button as used in WidgetMessageDialogue.
*/
static
QMessageBox::StandardButtons toMessageBoxButtons(Dialogues::Buttons buttons)
{
QMessageBox::StandardButtons outButtons = QMessageBox::NoButton;
outButtons |= (buttons & Dialogues::OK) ? QMessageBox::Ok : QMessageBox::NoButton;
outButtons |= (buttons & Dialogues::CANCEL) ? QMessageBox::Cancel : QMessageBox::NoButton;
outButtons |= (buttons & Dialogues::YES) ? QMessageBox::Yes : QMessageBox::NoButton;
outButtons |= (buttons & Dialogues::NO) ? QMessageBox::No : QMessageBox::NoButton;
return outButtons;
}
QString Dialogues::getText(QObject *parent, const QString &title,
const QString &message, enum QmlDlgHelper::QmlDlgEchoMode echoMode, const QString &message, enum QmlDlgHelper::QmlDlgEchoMode echoMode,
const QString &text, const QString &placeholderText, bool *ok, const QString &text, const QString &placeholderText, bool *ok,
Qt::InputMethodHints inputMethodHints) Qt::InputMethodHints inputMethodHints)
...@@ -77,3 +199,21 @@ QString InputDialogue::getText(QObject *parent, const QString &title, ...@@ -77,3 +199,21 @@ QString InputDialogue::getText(QObject *parent, const QString &title,
Qt::Dialog, inputMethodHints); Qt::Dialog, inputMethodHints);
#endif /* defined(USE_QML_DIALOGUES) */ #endif /* defined(USE_QML_DIALOGUES) */
} }
int Dialogues::message(enum Icon icon, const QString &title,
const QString &text, const QString &infoText,
Buttons buttons, enum Button dfltButton,
const QList< QPair<QString, int> > &customButtons, int *selected)
{
return toDialogueRetVal(
WidgetMessageDialogue::message(toMessageBoxIcon(icon), title,
text, infoText, toMessageBoxButtons(buttons),
toMessageBoxButton(dfltButton), customButtons, selected));
}
void Dialogues::errorMessage(enum Icon icon, const QString &title,
const QString &text, const QString &infoText)
{
WidgetMessageDialogue::errorMessage(toMessageBoxIcon(icon), title,
text, infoText);
}
...@@ -21,27 +21,49 @@ ...@@ -21,27 +21,49 @@
* the two. * the two.
*/ */
#ifndef _INPUT_DIALOGUE_H_ #ifndef _DIALOGUES_H_
#define _INPUT_DIALOGUE_H_ #define _DIALOGUES_H_
#include <QObject> #include <QObject>
#include <QWindow>
#include "src/dialogues/qml_dialogue_helper.h" #include "src/dialogues/qml_dialogue_helper.h"
/*! /*!
* @brief Encapsulates input dialogues. * @brief Encapsulates dialogues.
*/ */
class InputDialogue : public QObject { class Dialogues : public QObject {
Q_OBJECT Q_OBJECT
private: private:
/*! /*!
* @brief Private constructor. * @brief Private constructor.
*/ */
explicit InputDialogue(QObject *parent = Q_NULLPTR); explicit Dialogues(QObject *parent = Q_NULLPTR);
public: public:
/*!
* @brief Dialogue icon decoration.
*/
enum Icon {
NO_ICON,
QUESTION,
INFORMATION,
WARNING,
CRITICAL
};
/*!
* @brief Dialogue button declaration.
*/
enum Button {
OK = 0x00000400,
CANCEL = 0x00400000,
YES = 0x00004000,
NO = 0x00010000,
NO_BUTTON = 0x00000000
};
Q_DECLARE_FLAGS(Buttons, Button)
/*! /*!
* @brief Generates a text edit dialogue. Paste button is added on * @brief Generates a text edit dialogue. Paste button is added on
* Android devices. * Android devices.
...@@ -64,6 +86,42 @@ public: ...@@ -64,6 +86,42 @@ public:
const QString &text = QString(), const QString &text = QString(),
const QString &placeholderText = QString(), bool *ok = Q_NULLPTR, const QString &placeholderText = QString(), bool *ok = Q_NULLPTR,
Qt::InputMethodHints inputMethodHints = Qt::ImhNone); Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
/*!
* @brief Show message and await response.
*
* @param[in] icon Icon identifying importance of the message.
* @param[in] title Title of the dialogue window.
* @param[in] text Main message of the dialogue.
* @param[in] infoText Additional informative text.
* @param[in] buttons Standard buttons to be displayed.
* @param[in] dfltButton Identifies default action button.
* @param[in] customButtons List of pairs of custom button strings and values.
* @param[out] selected Value of selected custom button.
* @return Dialogue code or standard button value, -1 if custom button
* was selected and custom button was selected then \a selected is
* set to value of custom button.
*/
static
int message(enum Icon icon, const QString &title,
const QString &text, const QString &infoText,
Buttons buttons = NO_BUTTON, enum Button dfltButton = NO_BUTTON,
const QList< QPair<QString, int> > &customButtons = QList< QPair<QString, int> >(),
int *selected = Q_NULLPTR);
/*!
* @brief Show error message that can only be acknowledged.
*
* @param[in] icon Icon identifying importance of the message.
* @param[in] title Title of the dialogue window.
* @param[in] text Main message of the dialogue.
* @param[in] infoText Additional informative text.
*/
static
void errorMessage(enum Icon icon, const QString &title,
const QString &text, const QString &infoText);
}; };
#endif /* _INPUT_DIALOGUE_H_ */ Q_DECLARE_OPERATORS_FOR_FLAGS(Dialogues::Buttons)
#endif /* _DIALOGUES_H_ */
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <QQmlEngine> /* qmlRegisterType */ #include <QQmlEngine> /* qmlRegisterType */
#include "src/common.h" #include "src/common.h"
#include "src/dialogues/widget_message_dialogue.h" #include "src/dialogues/dialogues.h"
#include "src/files.h" #include "src/files.h"
#include "src/settings.h" #include "src/settings.h"
#include "src/io/filesystem.h" #include "src/io/filesystem.h"
...@@ -289,19 +289,18 @@ void Files::openAttachment(const QString &fileName, const QByteArray &base64Data ...@@ -289,19 +289,18 @@ void Files::openAttachment(const QString &fileName, const QByteArray &base64Data
*/ */
#else /* !defined Q_OS_IOS */ #else /* !defined Q_OS_IOS */
if (!QDesktopServices::openUrl(QUrl::fromLocalFile(filePath))) { if (!QDesktopServices::openUrl(QUrl::fromLocalFile(filePath))) {
WidgetMessageDialogue::message(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Open attachment error"), tr("Open attachment error"),
tr("There is no application to open this file format."), tr("There is no application to open this file format."),
tr("File: '%1'").arg(filePath), tr("File: '%1'").arg(filePath));
QMessageBox::Ok, QMessageBox::Ok);
} }
#endif /* defined Q_OS_IOS */ #endif /* defined Q_OS_IOS */
} else { } else {
qCritical() << "Cannot create temporary file for" << fileName; qCritical() << "Cannot create temporary file for" << fileName;
WidgetMessageDialogue::message(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Open attachment error"), tr("Open attachment error"),
tr("Cannot save selected file to disk for opening."), tr("Cannot save selected file to disk for opening."),
QString(), QMessageBox::Ok, QMessageBox::Ok); QString());
} }
} }
...@@ -380,12 +379,12 @@ void Files::deleteFileDb(const QString &userName) ...@@ -380,12 +379,12 @@ void Files::deleteFileDb(const QString &userName)
{ {
qDebug("%s()", __func__); qDebug("%s()", __func__);
int msgResponse = WidgetMessageDialogue::message(QMessageBox::Question, int msgResponse = Dialogues::message(Dialogues::QUESTION,
tr("Delete files: %1").arg(userName), tr("Delete files: %1").arg(userName),
tr("Do you want to clean up the file database of account '%1'?").arg(userName), tr("Do you want to clean up the file database of account '%1'?").arg(userName),
tr("Note: All attachment files of messages will be removed from the database."), tr("Note: All attachment files of messages will be removed from the database."),
QMessageBox::No | QMessageBox::Yes, QMessageBox::No); Dialogues::NO | Dialogues::YES, Dialogues::NO);
if (msgResponse == QMessageBox::No) { if (msgResponse == Dialogues::NO) {
return; return;
} }
...@@ -635,14 +634,12 @@ void attachmentSavingNotification(const QString &destPath) ...@@ -635,14 +634,12 @@ void attachmentSavingNotification(const QString &destPath)
{ {
QFileInfo fi(destPath); QFileInfo fi(destPath);
WidgetMessageDialogue::message( Dialogues::errorMessage(
!destPath.isEmpty() ? QMessageBox::Information : !destPath.isEmpty() ? Dialogues::INFORMATION : Dialogues::CRITICAL,
QMessageBox::Critical,
QObject::tr("Attachment saving"), QObject::tr("Attachment saving"),
!destPath.isEmpty() ? QObject::tr("Attachments have been saved.") : !destPath.isEmpty() ? QObject::tr("Attachments have been saved.") :
QObject::tr("Attachments have not been saved!"), QObject::tr("Attachments have not been saved!"),
QObject::tr("Path: '%1'").arg(fi.absolutePath()), QObject::tr("Path: '%1'").arg(fi.absolutePath()));
QMessageBox::Ok, QMessageBox::Ok);
} }
void Files::saveAttachmentsToDiskDb(const QString &userName, void Files::saveAttachmentsToDiskDb(const QString &userName,
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "src/common.h" #include "src/common.h"
#include "src/dialogues/qml_dialogue_helper.h" #include "src/dialogues/qml_dialogue_helper.h"
#include "src/dialogues/qml_input_dialogue.h" #include "src/dialogues/qml_input_dialogue.h"
#include "src/dialogues/widget_message_dialogue.h" #include "src/dialogues/dialogues.h"
#include "src/files.h" #include "src/files.h"
#include "src/locker.h" #include "src/locker.h"
#include "src/net/isds_wrapper.h" #include "src/net/isds_wrapper.h"
...@@ -351,7 +351,7 @@ int main(int argc, char *argv[]) ...@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
arg(globSet.lastUpdateStr()), false, true); arg(globSet.lastUpdateStr()), false, true);
} }
} else { } else {
WidgetMessageDialogue::errorMessage(QMessageBox::Warning, Dialogues::errorMessage(Dialogues::WARNING,
QObject::tr("Security problem"), QObject::tr("Security problem"),
QObject::tr("OpenSSL support is required!"), QObject::tr("OpenSSL support is required!"),
QObject::tr("The device does not support OpenSSL. " QObject::tr("The device does not support OpenSSL. "
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <QStorageInfo> #include <QStorageInfo>
#include "src/common.h" #include "src/common.h"
#include "src/dialogues/widget_message_dialogue.h" #include "src/dialogues/dialogues.h"
#include "src/messages.h" #include "src/messages.h"
#include "src/settings.h" #include "src/settings.h"
#include "src/models/accountmodel.h" #include "src/models/accountmodel.h"
...@@ -185,12 +185,12 @@ void Messages::deleteMessageFromDbs(const QString &userName, qint64 msgId) ...@@ -185,12 +185,12 @@ void Messages::deleteMessageFromDbs(const QString &userName, qint64 msgId)
return; return;
} }
int msgResponse = WidgetMessageDialogue::message(QMessageBox::Question, int msgResponse = Dialogues::message(Dialogues::QUESTION,
tr("Delete message: %1").arg(msgId), tr("Delete message: %1").arg(msgId),
tr("Do you want to delete the message '%1'?").arg(msgId), tr("Do you want to delete the message '%1'?").arg(msgId),
tr("Note: It will delete all attachments and message information from the local database."), tr("Note: It will delete all attachments and message information from the local database."),
QMessageBox::No | QMessageBox::Yes, QMessageBox::No); Dialogues::NO | Dialogues::YES, Dialogues::NO);
if (msgResponse == QMessageBox::No) { if (msgResponse == Dialogues::NO) {
return; return;
} }
...@@ -262,11 +262,10 @@ bool Messages::moveOrCreateNewDbsToNewLocation(const QString &newLocation) ...@@ -262,11 +262,10 @@ bool Messages::moveOrCreateNewDbsToNewLocation(const QString &newLocation)
{ {
QStorageInfo si(newLocation); QStorageInfo si(newLocation);
if (si.bytesAvailable() < allDbSize) { if (si.bytesAvailable() < allDbSize) {
WidgetMessageDialogue::message(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("New location error"), tr("New location error"),
tr("It is not possible to store databases in the new location because there is not enough free space left."), tr("It is not possible to store databases in the new location because there is not enough free space left."),
tr("Databases size is %1 MB.").arg(allDbSize / (1024 * 1024)), tr("Databases size is %1 MB.").arg(allDbSize / (1024 * 1024)));
QMessageBox::Ok, QMessageBox::Ok);
return false; return false;
} }
} }
...@@ -330,11 +329,11 @@ enum Messages::ReloactionAction Messages::askAction(void) ...@@ -330,11 +329,11 @@ enum Messages::ReloactionAction Messages::askAction(void)
customButtons.append(QPair<QString, int>(tr("Create new"), RA_CREATE_NEW)); customButtons.append(QPair<QString, int>(tr("Create new"), RA_CREATE_NEW));
int customVal = -1; int customVal = -1;
WidgetMessageDialogue::message(QMessageBox::Question, Dialogues::message(Dialogues::QUESTION,
tr("Change database location"), tr("Change database location"),
tr("What do you want to do with the currently used database files?"), tr("What do you want to do with the currently used database files?"),
tr("You have the option to move the current database files to a new location or you can delete them and create new empty databases."), tr("You have the option to move the current database files to a new location or you can delete them and create new empty databases."),
QMessageBox::Cancel, QMessageBox::Cancel, Dialogues::CANCEL, Dialogues::CANCEL,
customButtons, &customVal); customButtons, &customVal);
if (customVal == RA_RELOCATE) { if (customVal == RA_RELOCATE) {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <QFileInfo> #include <QFileInfo>
#include "src/common.h" #include "src/common.h"
#include "src/dialogues/input_dialogue.h" #include "src/dialogues/dialogues.h"
#include "src/net/isds_const.h" #include "src/net/isds_const.h"
#include "src/net/isds_session.h" #include "src/net/isds_session.h"
#include "src/net/xml_layer.h" #include "src/net/xml_layer.h"
...@@ -123,7 +123,7 @@ bool IsdsSession::setCertificateData(const QString &userName, ...@@ -123,7 +123,7 @@ bool IsdsSession::setCertificateData(const QString &userName,
return false; return false;
} }
const QString passPhrase = InputDialogue::getText(Q_NULLPTR, const QString passPhrase = Dialogues::getText(Q_NULLPTR,
tr("Certificate password: %1").arg(userName), tr("Certificate password: %1").arg(userName),
tr("Certificate password for '%1' required").arg(accountName), tr("Certificate password for '%1' required").arg(accountName),
QmlDlgHelper::EM_PWD, QString(), tr("Enter certificate password"), QmlDlgHelper::EM_PWD, QString(), tr("Enter certificate password"),
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#include <QDebug> #include <QDebug>
#include "src/dialogues/input_dialogue.h" #include "src/dialogues/dialogues.h"
#include "src/dialogues/widget_message_dialogue.h"
#include "src/net/isds_wrapper.h" #include "src/net/isds_wrapper.h"
#include "src/models/accountmodel.h" #include "src/models/accountmodel.h"
#include "src/settings.h" #include "src/settings.h"
...@@ -50,7 +49,7 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType, ...@@ -50,7 +49,7 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType,
QString errTxt = tr("Wrong username or message ID"); QString errTxt = tr("Wrong username or message ID");
if (userName.isEmpty() || msgId <= 0) { if (userName.isEmpty() || msgId <= 0) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Error"), errTxt, tr("Internal error")); tr("Error"), errTxt, tr("Internal error"));
return; return;
} }
...@@ -66,8 +65,7 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType, ...@@ -66,8 +65,7 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType,
if (mesasgeType == MessageDb::TYPE_RECEIVED) { if (mesasgeType == MessageDb::TYPE_RECEIVED) {
if (!m_xmlLayer.isdsGetCompleteMsgWithoutCms( if (!m_xmlLayer.isdsGetCompleteMsgWithoutCms(
m_isdsSession.isdsCtxMap[userName], msgId)) { m_isdsSession.isdsCtxMap[userName], msgId)) {
WidgetMessageDialogue::errorMessage( Dialogues::errorMessage(Dialogues::CRITICAL,
QMessageBox::Critical,
tr("Delivery info: %1").arg(userName), tr("Delivery info: %1").arg(userName),
tr("Failed to download complete received message %1.").arg(msgId), tr("Failed to download complete received message %1.").arg(msgId),
m_isdsSession.isdsCtxMap[userName].last_isds_msg); m_isdsSession.isdsCtxMap[userName].last_isds_msg);
...@@ -76,8 +74,7 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType, ...@@ -76,8 +74,7 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType,
} else { } else {
if (!m_xmlLayer.isdsGetCompleteSentMsgWithCms( if (!m_xmlLayer.isdsGetCompleteSentMsgWithCms(
m_isdsSession.isdsCtxMap[userName], msgId)) { m_isdsSession.isdsCtxMap[userName], msgId)) {
WidgetMessageDialogue::errorMessage( Dialogues::errorMessage(Dialogues::CRITICAL,
QMessageBox::Critical,
tr("Downloading message: %1").arg(userName), tr("Downloading message: %1").arg(userName),
tr("Failed to download complete sent message %1.").arg(msgId), tr("Failed to download complete sent message %1.").arg(msgId),
m_isdsSession.isdsCtxMap[userName].last_isds_msg); m_isdsSession.isdsCtxMap[userName].last_isds_msg);
...@@ -107,7 +104,7 @@ void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId) ...@@ -107,7 +104,7 @@ void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId)
QString errTxt = tr("Wrong username or message ID"); QString errTxt = tr("Wrong username or message ID");
if (userName.isEmpty() || msgId <= 0) { if (userName.isEmpty() || msgId <= 0) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Error"), errTxt, tr("Internal error")); tr("Error"), errTxt, tr("Internal error"));
return; return;
} }
...@@ -122,7 +119,7 @@ void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId) ...@@ -122,7 +119,7 @@ void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId)
if (!m_xmlLayer.isdsGetMsgDeliveryInfoWithoutCms( if (!m_xmlLayer.isdsGetMsgDeliveryInfoWithoutCms(
m_isdsSession.isdsCtxMap[userName], msgId)) { m_isdsSession.isdsCtxMap[userName], msgId)) {
WidgetMessageDialogue::errorMessage(QMessageBox::Warning, Dialogues::errorMessage(Dialogues::WARNING,
tr("Delivery info: %1").arg(userName), tr("Delivery info: %1").arg(userName),
tr("Failed to download delivery info for message %1.").arg(msgId), tr("Failed to download delivery info for message %1.").arg(msgId),
m_isdsSession.isdsCtxMap[userName].last_isds_msg); m_isdsSession.isdsCtxMap[userName].last_isds_msg);
...@@ -174,7 +171,7 @@ bool IsdsWrapper::syncSingleAccountReceived(const QString &userName) ...@@ -174,7 +171,7 @@ bool IsdsWrapper::syncSingleAccountReceived(const QString &userName)
/* ========================================================================= */ /* ========================================================================= */
{ {
if (userName.isEmpty()) { if (userName.isEmpty()) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Error"), tr("Empty user name"), tr("Internal error")); tr("Error"), tr("Empty user name"), tr("Internal error"));
return false; return false;
} }
...@@ -194,7 +191,7 @@ bool IsdsWrapper::syncSingleAccountReceived(const QString &userName) ...@@ -194,7 +191,7 @@ bool IsdsWrapper::syncSingleAccountReceived(const QString &userName)
if (!m_xmlLayer.isdsGetReceivedMessageList( if (!m_xmlLayer.isdsGetReceivedMessageList(
m_isdsSession.isdsCtxMap[userName], m_isdsSession.isdsCtxMap[userName],
globSet.downloadOnlyNewMsgs, receivedMsgIds)) { globSet.downloadOnlyNewMsgs, receivedMsgIds)) {
WidgetMessageDialogue::errorMessage(QMessageBox::Critical, Dialogues::errorMessage(Dialogues::CRITICAL,
tr("%1: received messages").arg(userName), tr("%1: received messages").arg(userName),
tr("Failed to download list of received messages for user name '%1'.").arg(userName), tr("Failed to download list of received messages for user name '%1'.").arg(userName),
m_isdsSession.isdsCtxMap[userName].last_isds_msg); m_isdsSession.isdsCtxMap[userName].last_isds_msg);
...@@ -226,7 +223,7 @@ bool IsdsWrapper::syncSingleAccountSent(const QString &userName) ...@@ -226,7 +223,7 @@ bool IsdsWrapper::syncSingleAccountSent(const QString &userName)
/* ========================================================================= */ /* ========================================================================= */
{ {
if (userName.isEmpty()) { if (userName.isEmpty()) {