1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: Move using loadHistory out of Friend

This commit is contained in:
Diadlo 2018-02-02 00:27:37 +03:00
parent 254f5cc4b1
commit b26255703d
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
4 changed files with 6 additions and 15 deletions

View File

@ -44,18 +44,6 @@ Friend::~Friend()
delete chatForm;
}
/**
* @brief Loads the friend's chat history if enabled
*/
void Friend::loadHistory()
{
if (Nexus::getProfile()->isHistoryEnabled()) {
chatForm->loadHistory(QDateTime::currentDateTime().addDays(-7), true);
}
emit loadChatHistory();
}
void Friend::setName(const QString& _name)
{
QString name = _name;

View File

@ -37,8 +37,6 @@ public:
~Friend() override;
Friend& operator=(const Friend& other) = delete;
void loadHistory();
void setName(const QString& name) override;
void setAlias(const QString& name);
QString getDisplayedName() const override;

View File

@ -26,7 +26,9 @@
#include "src/core/core.h"
#include "src/core/coreav.h"
#include "src/model/friend.h"
#include "src/nexus.h"
#include "src/persistence/offlinemsgengine.h"
#include "src/persistence/profile.h"
#include "src/persistence/settings.h"
#include "src/persistence/history.h"
#include "src/video/netcamview.h"
@ -201,6 +203,10 @@ ChatForm::ChatForm(Friend* chatFriend, History* history)
connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered);
updateCallButtons();
if (Nexus::getProfile()->isHistoryEnabled()) {
loadHistory(QDateTime::currentDateTime().addDays(-7), true);
}
setAcceptDrops(true);
retranslateUi();
Translator::registerHandler(std::bind(&ChatForm::retranslateUi, this), this);

View File

@ -980,7 +980,6 @@ void Widget::addFriend(uint32_t friendId, const ToxPk& friendPk)
friendWidgets[friendId] = widget;
chatForms[friendId] = friendForm;
newfriend->loadHistory();
QDate activityDate = s.getFriendActivity(friendPk);
QDate chatDate = friendForm->getLatestDate();