Commit 4100603d authored by Martin Straka's avatar Martin Straka

Renamed some functions and methods

parent 23b90ea4
......@@ -102,8 +102,8 @@ void Accounts::updateNewMessageCounter(const QVariant &acntModelVariant,
}
accountModel->updateCounters(userName,
msgDb->getCntOfNewMessages(MessageDb::TYPE_RECEIVED), -1,
msgDb->getCntOfNewMessages(MessageDb::TYPE_SENT), -1);
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_RECEIVED), -1,
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_SENT), -1);
}
QString Accounts::fillAccountInfo(const QString &userName)
......@@ -393,9 +393,9 @@ void Accounts::loadModelCounters(AccountListModel *accountModel)
}
accountModel->updateCounters(userName,
msgDb->getCntOfNewMessages(MessageDb::TYPE_RECEIVED),
msgDb->getMessageCount(MessageDb::TYPE_RECEIVED),
msgDb->getCntOfNewMessages(MessageDb::TYPE_SENT),
msgDb->getMessageCount(MessageDb::TYPE_SENT));
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_RECEIVED),
msgDb->getMessageCountFromDb(MessageDb::TYPE_RECEIVED),
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_SENT),
msgDb->getMessageCountFromDb(MessageDb::TYPE_SENT));
}
}
......@@ -269,7 +269,7 @@ void Files::sendMsgFilesWithEmail(const QString &userName, qint64 msgId,
userName.toUtf8().constData());
return;
}
if (!msgDb->getMessageDataForEmail(msgId, body, subject)) {
if (!msgDb->getMessageEmailDataFromDb(msgId, body, subject)) {
qCritical("Missing data of message '%s'.",
QString::number(msgId).toUtf8().constData());
return;
......
......@@ -162,7 +162,7 @@ QString Messages::getMessageDetail(const QString &userName,
qCritical("%s", "Cannot open message database.");
return QString();
}
return msgDb->getMessageDetailDataFromDb(msgId);
return msgDb->getMessageDetailHtmlFromDb(msgId);
}
MsgEnvelope *Messages::getMsgEnvelopeDataAndSetRecipient(
......@@ -356,10 +356,10 @@ void Messages::deleteMessageFromDbs(const QVariant &acntModelVariant,
/* Remove row from model, don't regenerate data. */
if (accountModel != Q_NULLPTR) {
accountModel->updateCounters(userName,
msgDb->getCntOfNewMessages(MessageDb::TYPE_RECEIVED),
msgDb->getMessageCount(MessageDb::TYPE_RECEIVED),
msgDb->getCntOfNewMessages(MessageDb::TYPE_SENT),
msgDb->getMessageCount(MessageDb::TYPE_SENT));
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_RECEIVED),
msgDb->getMessageCountFromDb(MessageDb::TYPE_RECEIVED),
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_SENT),
msgDb->getMessageCountFromDb(MessageDb::TYPE_SENT));
}
if (messageModel != Q_NULLPTR) {
messageModel->removeMessage(msgId);
......@@ -722,12 +722,14 @@ int Messages::searchMsg(const QVariant &msgModelVariant, const QString &phrase,
}
if (msgTypes & TYPE_RECEIVED) {
msgs += msgDb->searchMessagesAndSetModel(messageModel,
userName, phrase, MessageDb::TYPE_RECEIVED);
msgs += msgDb->searchMessagesAndSetModelFromDb(
messageModel, userName, phrase,
MessageDb::TYPE_RECEIVED);
}
if (msgTypes & TYPE_SENT) {
msgs += msgDb->searchMessagesAndSetModel(messageModel,
userName, phrase, MessageDb::TYPE_SENT);
msgs += msgDb->searchMessagesAndSetModelFromDb(
messageModel, userName, phrase,
MessageDb::TYPE_SENT);
}
}
......
......@@ -132,7 +132,7 @@ int MessageDb::getDbSizeInBytes(void)
return fi.size();
}
QSet<qint64> MessageDb::getAllMessageIDsFromDB(void)
QSet<qint64> MessageDb::getAllMessageIDsFromDb(void)
{
QSqlQuery query(m_db);
QSet<qint64> msgIDList;
......@@ -237,7 +237,7 @@ void MessageDb::setMessageListModelFromDb(MessageListModel *msgModel,
}
}
int MessageDb::getCntOfNewMessages(enum MessageType messageType)
int MessageDb::getNewMessageCountFromDb(enum MessageType messageType)
{
QSqlQuery query(m_db);
......@@ -258,7 +258,7 @@ int MessageDb::getCntOfNewMessages(enum MessageType messageType)
return 0;
}
int MessageDb::getMessageCount(enum MessageType messageType)
int MessageDb::getMessageCountFromDb(enum MessageType messageType)
{
QSqlQuery query(m_db);
......@@ -347,7 +347,7 @@ MsgEnvelope MessageDb::getMessageEnvelopeFromDb(qint64 dmId)
return msgEnvel;
}
bool MessageDb::getMessageDataForEmail(qint64 dmId, QString &body,
bool MessageDb::getMessageEmailDataFromDb(qint64 dmId, QString &body,
QString &subject)
{
QSqlQuery query(m_db);
......@@ -370,7 +370,7 @@ bool MessageDb::getMessageDataForEmail(qint64 dmId, QString &body,
return false;
}
QString MessageDb::getMessageDetailDataFromDb(qint64 dmId) const
QString MessageDb::getMessageDetailHtmlFromDb(qint64 dmId) const
{
QString html;
QStringList rmPathList;
......@@ -754,7 +754,7 @@ bool MessageDb::openDb(const QString &fileName, bool storeToDisk)
return SQLiteDb::openDb(fileName, flags);
}
int MessageDb::searchMessagesAndSetModel(MessageListModel *msgModel,
int MessageDb::searchMessagesAndSetModelFromDb(MessageListModel *msgModel,
const QString &userName, const QString &phrase,
enum MessageType messageType)
{
......
......@@ -92,7 +92,7 @@ public:
* @param[in] messageType Message type.
* @return count.
*/
int getCntOfNewMessages(enum MessageType messageType);
int getNewMessageCountFromDb(enum MessageType messageType);
/*!
* @brief Get message database size in bytes.
......@@ -106,7 +106,7 @@ public:
*
* @return Set of message IDs.
*/
QSet<qint64> getAllMessageIDsFromDB(void);
QSet<qint64> getAllMessageIDsFromDb(void);
/*!
* @brief Get list of messages from db which are older than number of days.
......@@ -122,7 +122,7 @@ public:
* @param[in] messageType Message type.
* @return count.
*/
int getMessageCount(enum MessageType messageType);
int getMessageCountFromDb(enum MessageType messageType);
/*!
* @brief Return message envelope data.
......@@ -158,7 +158,7 @@ public:
* @return HTML formatted string containing message information.
* Empty string is returned on error.
*/
QString getMessageDetailDataFromDb(qint64 dmId) const;
QString getMessageDetailHtmlFromDb(qint64 dmId) const;
/*!
* @brief Return some message data for email body.
......@@ -168,7 +168,8 @@ public:
* @param[out] subject Message subject.
* @return True on success.
*/
bool getMessageDataForEmail(qint64 dmId, QString &body, QString &subject);
bool getMessageEmailDataFromDb(qint64 dmId, QString &body,
QString &subject);
/*!
* @brief Insert or update events.
......@@ -224,7 +225,7 @@ public:
* @param[in] messageType Type of the sought messages.
* @return Number of results.
*/
int searchMessagesAndSetModel(MessageListModel *msgModel,
int searchMessagesAndSetModelFromDb(MessageListModel *msgModel,
const QString &userName, const QString &phrase,
enum MessageType messageType);
......
......@@ -195,14 +195,14 @@ enum TaskDownloadMessageList::Result TaskDownloadMessageList::downloadMessageLis
if (msgDb != Q_NULLPTR) {
if (msgDirect == Messages::TYPE_RECEIVED) {
accountModel->updateCounters(ctx.username,
msgDb->getCntOfNewMessages(MessageDb::TYPE_RECEIVED),
msgDb->getMessageCount(MessageDb::TYPE_RECEIVED),
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_RECEIVED),
msgDb->getMessageCountFromDb(MessageDb::TYPE_RECEIVED),
-1, -1);
} else {
accountModel->updateCounters(ctx.username,
-1, -1,
msgDb->getCntOfNewMessages(MessageDb::TYPE_SENT),
msgDb->getMessageCount(MessageDb::TYPE_SENT));
msgDb->getNewMessageCountFromDb(MessageDb::TYPE_SENT),
msgDb->getMessageCountFromDb(MessageDb::TYPE_SENT));
}
}
}
......
......@@ -109,7 +109,7 @@ QList<qint64> obtainDbSetDmIds(MessageDb *msgDb,
return QList<qint64>();
}
QSet<qint64> dmIdSet = msgDb->getAllMessageIDsFromDB();
QSet<qint64> dmIdSet = msgDb->getAllMessageIDsFromDb();
dmIdSet -= exludedDmIds.toSet();
return dmIdSet.toList();
......
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