diff --git a/src/chatlog/chatlog.cpp b/src/chatlog/chatlog.cpp index e0c5e7637..0c067488b 100644 --- a/src/chatlog/chatlog.cpp +++ b/src/chatlog/chatlog.cpp @@ -595,27 +595,6 @@ ChatLine::Ptr ChatLog::getTypingNotification() const return typingNotification; } -QVector ChatLog::getLines() -{ - return lines; -} - -ChatLine::Ptr ChatLog::getLatestLine() const -{ - if (!lines.empty()) { - return lines.last(); - } - return nullptr; -} - -ChatLine::Ptr ChatLog::getFirstLine() const -{ - if (!lines.empty()) { - return lines.first(); - } - return nullptr; -} - /** * @brief Finds the chat line object at a position on screen * @param pos Position on screen in global coordinates diff --git a/src/chatlog/chatlog.h b/src/chatlog/chatlog.h index 6d5b3bf49..9839f2c99 100644 --- a/src/chatlog/chatlog.h +++ b/src/chatlog/chatlog.h @@ -67,9 +67,6 @@ public: bool hasTextToBeCopied() const; ChatLine::Ptr getTypingNotification() const; - QVector getLines(); - ChatLine::Ptr getLatestLine() const; - ChatLine::Ptr getFirstLine() const; ChatLineContent* getContentFromGlobalPos(QPoint pos) const; const uint repNameAfter = 5 * 60; diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index a7630d45b..64ede8c18 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -404,12 +404,10 @@ void GenericChatForm::hideFileMenu() QDateTime GenericChatForm::getLatestTime() const { - return getTime(chatWidget->getLatestLine()); -} + if (chatLog.getFirstIdx() == chatLog.getNextIdx()) + return QDateTime(); -QDateTime GenericChatForm::getFirstTime() const -{ - return getTime(chatWidget->getFirstLine()); + return chatLog.at(chatLog.getNextIdx() - 1).getTimestamp(); } void GenericChatForm::reloadTheme() diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index 01a2c1f8f..3919ac670 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -80,7 +80,6 @@ public: const QDateTime& datetime); static QString resolveToxPk(const ToxPk& pk); QDateTime getLatestTime() const; - QDateTime getFirstTime() const; signals: void messageInserted();