diff --git a/src/model/friend.cpp b/src/model/friend.cpp index fe6290399..d04a8f91d 100644 --- a/src/model/friend.cpp +++ b/src/model/friend.cpp @@ -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; diff --git a/src/model/friend.h b/src/model/friend.h index e9921df38..416551f57 100644 --- a/src/model/friend.h +++ b/src/model/friend.h @@ -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; diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 68a84c341..1b54fed94 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -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); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index dbe8bfc0d..6a478c477 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -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();