implemented publish key sharing between peers for channels.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7582 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-05 19:14:05 +00:00
parent 1d6bf4190e
commit d0469ccfc3
22 changed files with 511 additions and 57 deletions

View file

@ -29,7 +29,7 @@
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
#include "gui/channels/ShareKey.h"
#include "gui/gxschannels/GxsChannelShareKey.h"
#include "gui/common/RSTreeWidget.h"
#include "gui/notifyqt.h"
#include "gui/common/UIStateHelper.h"
@ -432,10 +432,10 @@ void GxsGroupFrameDialog::shareKey()
return;
}
QMessageBox::warning(this, "", "ToDo");
// QMessageBox::warning(this, "", "ToDo");
// ShareKey shareUi(this, mGroupId.toStdString(), shareKeyType());
// shareUi.exec();
ChannelShareKey shareUi(this, mGroupId, shareKeyType());
shareUi.exec();
}
void GxsGroupFrameDialog::loadComment(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, const QString &title)

View file

@ -23,7 +23,7 @@
#include "GxsChannelGroupDialog.h"
#include "GxsChannelPostsWidget.h"
#include "GxsChannelUserNotify.h"
#include "gui/channels/ShareKey.h"
#include "GxsChannelShareKey.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h"
@ -78,10 +78,9 @@ QString GxsChannelDialog::text(TextType type)
return tr("Create Channel");
case TEXT_TODO:
return "<b>Open points:</b><ul>"
"<li>Share key"
"<li>Restore channel keys"
"<li>Navigate channel link"
"<li>Don't show own posts as unread"
"<li>Don't show own posts as unread"
"</ul>";
case TEXT_YOUR_GROUP:

View file

@ -19,18 +19,17 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ShareKey.h"
#include "GxsChannelShareKey.h"
#include <QMessageBox>
#include <algorithm>
//#include <retroshare/rschannels.h>
//#include <retroshare/rsforums.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsgxschannels.h>
#include "gui/common/PeerDefs.h"
ShareKey::ShareKey(QWidget *parent, std::string grpId, int grpType) :
ChannelShareKey::ChannelShareKey(QWidget *parent, const RsGxsGroupId &grpId, int grpType) :
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpId(grpId), mGrpType(grpType)
{
ui = new Ui::ShareKey();
@ -49,12 +48,12 @@ ShareKey::ShareKey(QWidget *parent, std::string grpId, int grpType) :
ui->keyShareList->start();
}
ShareKey::~ShareKey()
ChannelShareKey::~ChannelShareKey()
{
delete ui;
}
void ShareKey::changeEvent(QEvent *e)
void ChannelShareKey::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
@ -66,7 +65,7 @@ void ShareKey::changeEvent(QEvent *e)
}
}
void ShareKey::shareKey()
void ChannelShareKey::shareKey()
{
std::list<RsPeerId> shareList;
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
@ -77,28 +76,26 @@ void ShareKey::shareKey()
return;
}
#if 0
if (mGrpType & CHANNEL_KEY_SHARE) {
if (!rsChannels)
if (!rsGxsChannels)
return;
if (!rsChannels->channelShareKeys(mGrpId, shareList)) {
if (!rsGxsChannels->groupShareKeys(mGrpId, shareList)) {
std::cerr << "Failed to share keys!" << std::endl;
return;
}
} else if(mGrpType & FORUM_KEY_SHARE) {
if(!rsForums)
return;
if (!rsForums->forumShareKeys(mGrpId, shareList)) {
std::cerr << "Failed to share keys!" << std::endl;
return;
}
QMessageBox::warning(NULL,"Not implemented.","Not implemented") ;
// if (!rsForums->forumShareKeys(mGrpId, shareList)) {
// std::cerr << "Failed to share keys!" << std::endl;
//return;
//}
} else {
// incorrect type
return;
}
#endif
close();
}

View file

@ -8,7 +8,7 @@
#define CHANNEL_KEY_SHARE 0x00000001
#define FORUM_KEY_SHARE 0x00000002
class ShareKey : public QDialog
class ChannelShareKey : public QDialog
{
Q_OBJECT
@ -16,8 +16,8 @@ public:
/*
*@param chanId The channel id to send request for
*/
ShareKey(QWidget *parent = 0, std::string grpId = "", int grpType = 0);
~ShareKey();
ChannelShareKey(QWidget *parent = 0, const RsGxsGroupId& grpId = RsGxsGroupId(), int grpType = 0);
~ChannelShareKey();
protected:
void changeEvent(QEvent *e);
@ -26,7 +26,7 @@ private slots:
void shareKey();
private:
std::string mGrpId;
RsGxsGroupId mGrpId;
int mGrpType;
Ui::ShareKey *ui;

View file

@ -24,7 +24,7 @@
#include "GxsForumThreadWidget.h"
#include "GxsForumUserNotify.h"
#include "gui/notifyqt.h"
#include "gui/channels/ShareKey.h"
#include "gui/gxschannels/GxsChannelShareKey.h"
/** Constructor */
GxsForumsDialog::GxsForumsDialog(QWidget *parent)

View file

@ -515,7 +515,6 @@ HEADERS += rshare.h \
gui/statistics/DhtWindow.h \
gui/statistics/StatisticsWindow.h \
gui/statistics/BwCtrlWindow.h \
gui/channels/ShareKey.h \
gui/GetStartedDialog.h \
gui/statistics/RttStatistics.h \
@ -627,7 +626,6 @@ FORMS += gui/StartDialog.ui \
gui/statistics/DhtWindow.ui \
gui/statistics/StatisticsWindow.ui \
gui/statistics/BwCtrlWindow.ui \
gui/channels/ShareKey.ui \
gui/GetStartedDialog.ui \
gui/statistics/RttStatistics.ui \
@ -845,7 +843,6 @@ SOURCES += main.cpp \
gui/statistics/DhtWindow.cpp \
gui/statistics/StatisticsWindow.cpp \
gui/statistics/BwCtrlWindow.cpp \
gui/channels/ShareKey.cpp \
gui/GetStartedDialog.cpp \
gui/statistics/RttStatistics.cpp \
@ -1192,6 +1189,7 @@ gxschannels {
gui/gxschannels/GxsChannelPostsWidget.h \
gui/gxschannels/GxsChannelFilesWidget.h \
gui/gxschannels/GxsChannelFilesStatusWidget.h \
gui/gxschannels/GxsChannelShareKey.h \
gui/feeds/GxsChannelPostItem.h \
gui/gxschannels/GxsChannelUserNotify.h
@ -1199,6 +1197,7 @@ gxschannels {
gui/gxschannels/GxsChannelFilesWidget.ui \
gui/gxschannels/GxsChannelFilesStatusWidget.ui \
gui/gxschannels/CreateGxsChannelMsg.ui \
gui/gxschannels/GxsChannelShareKey.ui \
gui/feeds/GxsChannelPostItem.ui
SOURCES += gui/gxschannels/GxsChannelDialog.cpp \
@ -1206,6 +1205,7 @@ gxschannels {
gui/gxschannels/GxsChannelFilesWidget.cpp \
gui/gxschannels/GxsChannelFilesStatusWidget.cpp \
gui/gxschannels/GxsChannelGroupDialog.cpp \
gui/gxschannels/GxsChannelShareKey.cpp \
gui/gxschannels/CreateGxsChannelMsg.cpp \
gui/feeds/GxsChannelPostItem.cpp \
gui/gxschannels/GxsChannelUserNotify.cpp