Commit 49a877f9 authored by Karel Slaný's avatar Karel Slaný

Removed some signal/slot behind the curtain functionality.

Most of the actions now happen in plain view of the QML pages.
parent ebbcd3cb
......@@ -64,6 +64,7 @@ Component {
zfoId = msgId
attachmentModel.setFromDb(userName, zfoId)
msgDescrHtml = messages.getMessageDetail(userName, zfoId)
}
}
......@@ -89,7 +90,7 @@ Component {
Component.onCompleted: {
if (fromLocalDb) {
messages.markMessageAsLocallyRead(userName, msgId, true)
messages.fillMessageDetail(userName, msgId)
// messages.fillMessageDetail(userName, msgId)
// files.fillFileList(userName, msgId)
if (attachmentList.count == 0) {
emptyList.visible = true
......@@ -167,6 +168,7 @@ Component {
if (fromLocalDb) {
isds.downloadMessage(userName, msgType, zfoId)
attachmentModel.setFromDb(userName, zfoId)
msgDescrHtml = messages.getMessageDetail(userName, zfoId)
msgDownloadButton.visible = false
attachmentMenuButon.visible = true
}
......@@ -225,12 +227,12 @@ Component {
textFormat: TextEdit.RichText
wrapMode: Text.WordWrap
text: msgDescrHtml
Connections {
target: messages
onMessageDetailChanged: {
messageDetailText.text = txt
}
}
// Connections {
// target: messages
// onMessageDetailChanged: {
// messageDetailText.text = txt
// }
// }
// Connections {
// target: files
// onPushNewMessageDeatilPage: {
......@@ -384,6 +386,7 @@ Component {
if (fromLocalDb) {
isds.downloadMessage(userName, msgType, zfoId)
attachmentModel.setFromDb(userName, zfoId)
msgDescrHtml = messages.getMessageDetail(userName, zfoId)
}
}
}
......
......@@ -65,6 +65,7 @@ Component {
zfoId = msgId
attachmentModel.setFromDb(userName, zfoId)
msgDescrHtml = messages.getMessageDetail(userName, zfoId)
}
}
......@@ -90,7 +91,7 @@ Component {
Component.onCompleted: {
if (fromLocalDb) {
messages.markMessageAsLocallyRead(userName, msgId, true)
messages.fillMessageDetail(userName, msgId)
// messages.fillMessageDetail(userName, msgId)
// files.fillFileList(userName, msgId)
if (attachmentList.count == 0) {
emptyList.visible = true
......@@ -192,6 +193,7 @@ Component {
if (fromLocalDb) {
isds.downloadMessage(userName, msgType, zfoId)
attachmentModel.setFromDb(userName, zfoId)
msgDescrHtml = messages.getMessageDetail(userName, zfoId)
msgDownloadButton.visible = false
attachmentMenuButon.visible = true
}
......@@ -381,6 +383,7 @@ Component {
if (fromLocalDb) {
isds.downloadMessage(userName, msgType, zfoId)
attachmentModel.setFromDb(userName, zfoId)
msgDescrHtml = messages.getMessageDetail(userName, zfoId)
}
}
}
......
......@@ -189,22 +189,6 @@ void Files::deleteExpiredFilesFromDbs(int days)
}
}
void Files::fillFileList(const QString &userName, qint64 msgId)
{
qDebug("%s()", __func__);
FileDb *fDb = NULL;
fDb = globFileDbsPtr->accessFileDb(globSet.dbsLocation, userName,
AccountListModel::globAccounts[userName].storeToDisk());
if (fDb == NULL) {
qDebug() << "ERROR: File database cannot open!";
return;
}
globFilesModel.clearAll();
fDb->getFileListFromDb(msgId);
}
void Files::openAttachmentFromDb(const QString &userName,
qint64 msgId, int fileId)
{
......@@ -807,9 +791,6 @@ bool Files::parseXmlData(QString *idStr, QString *annotation,
// remember file list and message detail
stackFileList.push(fileList);
stackMessageDetail.push(html);
/* TODO -- This method should not emit any signals. */
// open new qml page
// emit pushNewMessageDeatilPage(QString::number(msg.dmID));
return success;
}
......
......@@ -43,11 +43,6 @@ public:
*/
explicit Files(QObject *parent = Q_NULLPTR);
/*!
* @brief Load files from databse and fill QML listview via model.
*/
Q_INVOKABLE void fillFileList(const QString &userName, qint64 msgId);
/*!
* @brief Open attachment from database.
*/
......@@ -251,7 +246,6 @@ public:
};
signals:
/*!
* @brief Set new statusbar text and active busy indicator to QML.
*
......@@ -261,15 +255,7 @@ signals:
*/
void statusBarTextChanged(QString txt, bool busy);
/*!
* @brief Push and open a new message detail page to stackview in QML.
*
* @param[in] zfoId Zfo message Id.
*/
void pushNewMessageDeatilPage(QString zfoId);
private:
/*!
* @brief Send email.
*
......
......@@ -218,9 +218,6 @@ int main(int argc, char *argv[])
IsdsWrapper isds;
GlobalSettingsQmlWrapper settings;
/* Connect slot for update message detail after downloading */
QObject::connect(&isds, SIGNAL(messageDownloadFinish(QString, qint64)),
&messages, SLOT(fillMessageDetail(QString, qint64)));
/* Connect slot for isds cxt delete when account was deleted or updated */
QObject::connect(&accounts, SIGNAL(removeIsdsCtx(QString)),
&isds, SLOT(removeIsdsCtx(QString)));
......
......@@ -104,23 +104,25 @@ void Messages::fillMessageList(const QString &userName,
}
/* ========================================================================= */
/*
* Slot: Fill message detail page in QML.
*/
void Messages::fillMessageDetail(const QString &userName, qint64 msgId)
/* ========================================================================= */
QString Messages::getMessageDetail(const QString &userName,
const QString &msgIdStr)
{
qDebug("%s()", __func__);
bool ok = false;
qint64 msgId = msgIdStr.toLongLong(&ok);
if (!ok || (msgId < 0)) {
return QString();
}
MessageDb *msgDb = NULL;
msgDb = globMessageDbsPtr->accessMessageDb(globSet.dbsLocation, userName,
AccountListModel::globAccounts[userName].storeToDisk());
if (msgDb == NULL) {
qDebug() << "ERROR: Message database cannot open!";
return;
return QString();
}
emit messageDetailChanged(msgDb->getMessageDetailDataFromDb(msgId));
return msgDb->getMessageDetailDataFromDb(msgId);
}
......
......@@ -54,11 +54,18 @@ public:
enum MessageType msgType);
/*!
* @brief Load message detail from databse and fill QML
* listview via model.
* @brief Returns HTML-formatted string containing message description.
*
* @note QML has no notion about qint64, therefore the id is passed
* via a string.
*
* @param[in] userName User name identifying account.
* @param[in] msgIdStr String containing message identifier.
* @return Non-empty string on success.
*/
Q_INVOKABLE void fillMessageDetail(const QString &userName,
qint64 msgId);
Q_INVOKABLE static
QString getMessageDetail(const QString &userName,
const QString &msgIdStr);
/*!
* @brief Set message in database as locally read.
......@@ -164,14 +171,6 @@ public:
QString dmEventDescr;
};
signals:
/*!
* @brief Send message detait html string to QML.
*/
void messageDetailChanged(QString txt);
private:
/*!
* @brief Specifies whether the files should be moved or created from
......
......@@ -158,8 +158,6 @@ bool DbWrapper::insertCompleteMessageToDb(const QString &userName,
}
if (ret) {
Files f;
f.fillFileList(userName, msg.dmID);
msgDb->setAttachmentDownloaded(msg.dmID, true);
}
......
......@@ -90,7 +90,6 @@ void IsdsWrapper::downloadMessage(const QString &userName, int mesasgeType,
m_xmlLayer.isdsGetMsgDeliveryInfoWithoutCms(
m_isdsSession.isdsCtxMap[userName], msgId);
emit messageDownloadFinish(userName, msgId);
emit statusBarTextChanged(tr("Message %1 has been downloaded").arg(msgId),
false, true);
}
......
......@@ -38,7 +38,6 @@ class IsdsWrapper : public QObject {
Q_OBJECT
public:
explicit IsdsWrapper(QObject *parent = 0);
~IsdsWrapper();
......@@ -115,16 +114,8 @@ public:
*/
void showErrorMessageBox(const QString &title, const QString &text,
const QString &informatinText, bool isError);
signals:
/*!
* @brief Do action after downloading of complete message.
*
* @param[in] QString - username.
* @param[in] qint64 - mesasge ID.
*/
void messageDownloadFinish(QString, qint64);
signals:
/*!
* @brief Set new statusbar text and active busy indicator to QML.
*
......@@ -137,7 +128,6 @@ signals:
void statusBarTextChanged(QString txt, bool busy, bool isVisible);
public slots:
/*!
* @brief Do this action when account is deleted or updated.
*
......@@ -146,7 +136,6 @@ public slots:
void removeIsdsCtx(const QString &userName);
private:
/*!
* @brief Show error dialog when login problem occurs.
*
......@@ -188,7 +177,6 @@ private:
* Class IsdsSession holds and manages isds contexts of accounts.
*/
IsdsSession m_isdsSession;
};
#endif // _ISDS_WRAPPER_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