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:
parent
254f5cc4b1
commit
b26255703d
|
@ -44,18 +44,6 @@ Friend::~Friend()
|
||||||
delete chatForm;
|
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)
|
void Friend::setName(const QString& _name)
|
||||||
{
|
{
|
||||||
QString name = _name;
|
QString name = _name;
|
||||||
|
|
|
@ -37,8 +37,6 @@ public:
|
||||||
~Friend() override;
|
~Friend() override;
|
||||||
Friend& operator=(const Friend& other) = delete;
|
Friend& operator=(const Friend& other) = delete;
|
||||||
|
|
||||||
void loadHistory();
|
|
||||||
|
|
||||||
void setName(const QString& name) override;
|
void setName(const QString& name) override;
|
||||||
void setAlias(const QString& name);
|
void setAlias(const QString& name);
|
||||||
QString getDisplayedName() const override;
|
QString getDisplayedName() const override;
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "src/core/coreav.h"
|
#include "src/core/coreav.h"
|
||||||
#include "src/model/friend.h"
|
#include "src/model/friend.h"
|
||||||
|
#include "src/nexus.h"
|
||||||
#include "src/persistence/offlinemsgengine.h"
|
#include "src/persistence/offlinemsgengine.h"
|
||||||
|
#include "src/persistence/profile.h"
|
||||||
#include "src/persistence/settings.h"
|
#include "src/persistence/settings.h"
|
||||||
#include "src/persistence/history.h"
|
#include "src/persistence/history.h"
|
||||||
#include "src/video/netcamview.h"
|
#include "src/video/netcamview.h"
|
||||||
|
@ -201,6 +203,10 @@ ChatForm::ChatForm(Friend* chatFriend, History* history)
|
||||||
connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered);
|
connect(headWidget, &ChatFormHeader::callRejected, this, &ChatForm::onRejectCallTriggered);
|
||||||
|
|
||||||
updateCallButtons();
|
updateCallButtons();
|
||||||
|
if (Nexus::getProfile()->isHistoryEnabled()) {
|
||||||
|
loadHistory(QDateTime::currentDateTime().addDays(-7), true);
|
||||||
|
}
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
Translator::registerHandler(std::bind(&ChatForm::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&ChatForm::retranslateUi, this), this);
|
||||||
|
|
|
@ -980,7 +980,6 @@ void Widget::addFriend(uint32_t friendId, const ToxPk& friendPk)
|
||||||
|
|
||||||
friendWidgets[friendId] = widget;
|
friendWidgets[friendId] = widget;
|
||||||
chatForms[friendId] = friendForm;
|
chatForms[friendId] = friendForm;
|
||||||
newfriend->loadHistory();
|
|
||||||
|
|
||||||
QDate activityDate = s.getFriendActivity(friendPk);
|
QDate activityDate = s.getFriendActivity(friendPk);
|
||||||
QDate chatDate = friendForm->getLatestDate();
|
QDate chatDate = friendForm->getLatestDate();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user