Added a History Browser for GroupChat

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3420 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-09-01 14:15:50 +00:00
parent af4667232b
commit 7dd99a0c35
7 changed files with 198 additions and 16 deletions

View File

@ -203,6 +203,7 @@ HEADERS += rshare.h \
gui/LogoBar.h \
gui/xprogressbar.h \
gui/plugins/PluginInterface.h \
gui/im_history/ImHistoryBrowser.h \
gui/im_history/IMHistoryKeeper.h \
gui/im_history/IMHistoryReader.h \
gui/im_history/IMHistoryItem.h \
@ -373,7 +374,8 @@ FORMS += gui/StartDialog.ui \
gui/feeds/ChanMsgItem.ui \
gui/feeds/SubFileItem.ui \
gui/feeds/SubDestItem.ui \
gui/feeds/AttachFileItem.ui
gui/feeds/AttachFileItem.ui \
gui/im_history/ImHistoryBrowser.ui \
SOURCES += main.cpp \
rshare.cpp \
@ -414,6 +416,7 @@ SOURCES += main.cpp \
gui/SoundManager.cpp \
gui/MessagesDialog.cpp \
gui/FileTransferInfoWidget.cpp \
gui/im_history/ImHistoryBrowser.cpp \
gui/im_history/IMHistoryKeeper.cpp \
gui/im_history/IMHistoryReader.cpp \
gui/im_history/IMHistoryItem.cpp \

View File

@ -52,6 +52,8 @@
#include "gui/forums/CreateForum.h"
#include "gui/channels/CreateChannel.h"
#include "gui/feeds/AttachFileItem.h"
#include "gui/im_history/ImHistoryBrowser.h"
#include "RetroShareLink.h"
#include "MainWindow.h"
@ -221,7 +223,7 @@ PeersDialog::PeersDialog(QWidget *parent)
QMenu * grpchatmenu = new QMenu();
grpchatmenu->addAction(ui.actionClearChat);
grpchatmenu->addAction(ui.actionSave_History);
//grpchatmenu->addAction(ui.actionDisable_Emoticons);
grpchatmenu->addAction(ui.actionMessageHistory);
ui.menuButton->setMenu(grpchatmenu);
_underline = false;
@ -1887,3 +1889,9 @@ void PeersDialog::statusColumn()
}
}
void PeersDialog::on_actionMessageHistory_triggered()
{
ImHistoryBrowser imBrowser(this);
imBrowser.exec();
}

View File

@ -82,6 +82,8 @@ public slots:
void addSmileys();
void on_actionClearChat_triggered();
void on_actionMessageHistory_triggered();
void displayInfoChatMenu(const QPoint& pos);
// called by notifyQt when another peer is typing (in group chant and private chat)

View File

@ -1465,15 +1465,12 @@ p, li { white-space: pre-wrap; }
<string>Edit your status Message</string>
</property>
</action>
<action name="actionDisable_Emoticons">
<property name="checkable">
<bool>true</bool>
</property>
<action name="actionMessageHistory">
<property name="text">
<string>Disable Emoticons</string>
<string>Browse Message History</string>
</property>
<property name="toolTip">
<string>Disable Emoticons</string>
<string>Browse History</string>
</property>
</action>
<action name="actionSave_History">

View File

@ -0,0 +1,45 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 The RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ImHistoryBrowser.h"
#include <QMessageBox>
#include <QDateTime>
#include <QMenu>
#include <QClipboard>
#include "rshare.h"
/** Default constructor */
ImHistoryBrowser::ImHistoryBrowser(QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags), historyKeeper(Rshare::dataDirectory() + "/his1.xml")
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
QStringList him;
historyKeeper.getMessages(him, "", "THIS", 8);
foreach(QString mess, him)
ui.textBrowser->append(mess);
}

View File

@ -0,0 +1,57 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006 - 2010 The RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _IMHISTORYBROWSER_H
#define _IMHISTORYBROWSER_H
#include <QDialog>
#include "IMHistoryKeeper.h"
#include "ui_ImHistoryBrowser.h"
class ImHistoryBrowser : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
ImHistoryBrowser(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
private slots:
private:
IMHistoryKeeper historyKeeper;
/** Qt Designer generated object */
Ui::ImHistoryBrowser ui;
};
#endif

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImHistoryBrowser</class>
<widget class="QDialog" name="ImHistoryBrowser">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>333</height>
</rect>
</property>
<property name="windowTitle">
<string>Message History</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextBrowser" name="textBrowser"/>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ImHistoryBrowser</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>237</x>
<y>312</y>
</hint>
<hint type="destinationlabel">
<x>237</x>
<y>166</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ImHistoryBrowser</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>237</x>
<y>312</y>
</hint>
<hint type="destinationlabel">
<x>237</x>
<y>166</y>
</hint>
</hints>
</connection>
</connections>
</ui>