From f55391f7e46aa0c156bf0afa983d7aec1bd2ce8b Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Sat, 5 Feb 2011 18:37:12 +0000 Subject: [PATCH] clear chat history bug fix (tracker 2992786) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4013 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp | 9 +++++++++ retroshare-gui/src/gui/im_history/IMHistoryKeeper.h | 3 +++ retroshare-gui/src/gui/im_history/IMHistoryWriter.h | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp index aeebe0f5b..b96118384 100644 --- a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp +++ b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp @@ -20,6 +20,7 @@ ****************************************************************/ #include "IMHistoryKeeper.h" +#include #include #include @@ -249,6 +250,14 @@ void IMHistoryKeeper::removeMessages(QList &hiids) } } +void IMHistoryKeeper::clearHistory(){ + + IMHistoryWriter wri; + if(!wri.remove(hfName)) + std::cerr << "\nFailed to remove history file" << std::endl; + +} + //============================================================================= void IMHistoryKeeper::saveHistory() diff --git a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.h b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.h index 4349c9c09..7bae019f5 100644 --- a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.h +++ b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.h @@ -93,6 +93,9 @@ public: //! Remove items void removeMessages(QList &hiids); + //! Remove history + void clearHistory(void); + private: bool loadHistoryFile(); diff --git a/retroshare-gui/src/gui/im_history/IMHistoryWriter.h b/retroshare-gui/src/gui/im_history/IMHistoryWriter.h index b9c69f2a2..5a2a0c9a2 100644 --- a/retroshare-gui/src/gui/im_history/IMHistoryWriter.h +++ b/retroshare-gui/src/gui/im_history/IMHistoryWriter.h @@ -37,6 +37,9 @@ public: bool write(QList& itemList, const QString fileName ); + //! remove history file + bool remove(const QString& fileName); + QString errorMessage(); private: @@ -47,4 +50,4 @@ private: -#endif \ No newline at end of file +#endif