diff --git a/libretroshare/src/retroshare/rsposted.h b/libretroshare/src/retroshare/rsposted.h index 516cd069a..0ff4bf9ea 100644 --- a/libretroshare/src/retroshare/rsposted.h +++ b/libretroshare/src/retroshare/rsposted.h @@ -99,6 +99,8 @@ virtual bool createGroup(uint32_t &token, RsPostedGroup &group) = 0; virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0; virtual bool updateGroup(uint32_t &token, RsPostedGroup &group) = 0; + + virtual bool groupShareKeys(const RsGxsGroupId& group,const std::list& peers) = 0 ; }; diff --git a/libretroshare/src/services/p3posted.cc b/libretroshare/src/services/p3posted.cc index dfa32be0a..c8ab5faf3 100644 --- a/libretroshare/src/services/p3posted.cc +++ b/libretroshare/src/services/p3posted.cc @@ -62,7 +62,11 @@ RsServiceInfo p3Posted::getServiceInfo() GXS_POSTED_MIN_MINOR_VERSION); } - +bool p3Posted::groupShareKeys(const RsGxsGroupId& groupId,const std::list& peers) +{ + RsGenExchange::shareGroupPublishKey(groupId,peers) ; + return true ; +} bool p3Posted::getGroupData(const uint32_t &token, std::vector &groups) { diff --git a/libretroshare/src/services/p3posted.h b/libretroshare/src/services/p3posted.h index f9590dc69..700253e5e 100644 --- a/libretroshare/src/services/p3posted.h +++ b/libretroshare/src/services/p3posted.h @@ -70,6 +70,7 @@ virtual bool createGroup(uint32_t &token, RsPostedGroup &group); virtual bool createPost(uint32_t &token, RsPostedPost &post); virtual bool updateGroup(uint32_t &token, RsPostedGroup &group); +virtual bool groupShareKeys(const RsGxsGroupId &group, const std::list& peers); ////////////////////////////////////////////////////////////////////////////// // WRAPPERS due to the separate Interface. diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index f16e04c00..ff83b7eb7 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -26,7 +26,7 @@ #include "PostedGroupDialog.h" #include "PostedListWidget.h" #include "PostedUserNotify.h" -//#include "gui/channels/ShareKey.h" +#include "gui/gxs/GxsGroupShareKey.h" #include "gui/settings/rsharesettings.h" #include @@ -118,7 +118,7 @@ GxsGroupDialog *PostedDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenS int PostedDialog::shareKeyType() { - return 0; //POSTED_KEY_SHARE; + return POSTED_KEY_SHARE; } GxsMessageFrameWidget *PostedDialog::createMessageFrameWidget(const RsGxsGroupId &groupId) diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 468d431c5..184da69f1 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -29,7 +29,7 @@ #include "gui/settings/rsharesettings.h" #include "gui/RetroShareLink.h" -#include "gui/gxschannels/GxsChannelShareKey.h" +#include "gui/gxs/GxsGroupShareKey.h" #include "gui/common/RSTreeWidget.h" #include "gui/notifyqt.h" #include "gui/common/UIStateHelper.h" @@ -434,7 +434,7 @@ void GxsGroupFrameDialog::shareKey() // QMessageBox::warning(this, "", "ToDo"); - ChannelShareKey shareUi(this, mGroupId, shareKeyType()); + GroupShareKey shareUi(this, mGroupId, shareKeyType()); shareUi.exec(); } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.cpp b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp similarity index 72% rename from retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.cpp rename to retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp index a545fd3b2..12276c686 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp @@ -19,17 +19,19 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ -#include "GxsChannelShareKey.h" +#include "GxsGroupShareKey.h" #include #include #include #include +#include +#include #include "gui/common/PeerDefs.h" -ChannelShareKey::ChannelShareKey(QWidget *parent, const RsGxsGroupId &grpId, int grpType) : +GroupShareKey::GroupShareKey(QWidget *parent, const RsGxsGroupId &grpId, int grpType) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpId(grpId), mGrpType(grpType) { ui = new Ui::ShareKey(); @@ -48,12 +50,12 @@ ChannelShareKey::ChannelShareKey(QWidget *parent, const RsGxsGroupId &grpId, int ui->keyShareList->start(); } -ChannelShareKey::~ChannelShareKey() +GroupShareKey::~GroupShareKey() { delete ui; } -void ChannelShareKey::changeEvent(QEvent *e) +void GroupShareKey::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { @@ -65,7 +67,7 @@ void ChannelShareKey::changeEvent(QEvent *e) } } -void ChannelShareKey::shareKey() +void GroupShareKey::shareKey() { std::list shareList; ui->keyShareList->selectedIds(shareList, false); @@ -76,23 +78,37 @@ void ChannelShareKey::shareKey() return; } - if (mGrpType & CHANNEL_KEY_SHARE) { + if (mGrpType == CHANNEL_KEY_SHARE) + { if (!rsGxsChannels) - return; + return; if (!rsGxsChannels->groupShareKeys(mGrpId, shareList)) { - std::cerr << "Failed to share keys!" << std::endl; - return; - } - } else if(mGrpType & FORUM_KEY_SHARE) { - + std::cerr << "Failed to share keys!" << std::endl; + return; + } + } + else if(mGrpType == FORUM_KEY_SHARE) + { QMessageBox::warning(NULL,"Not implemented.","Not implemented") ; - // if (!rsForums->forumShareKeys(mGrpId, shareList)) { + // if (!rsForums->forumShareKeys(mGrpId, shareList)) { // std::cerr << "Failed to share keys!" << std::endl; - //return; + //return; //} - } else { + } + else if (mGrpType == POSTED_KEY_SHARE) + { + if (!rsPosted) + return; + + if (!rsPosted->groupShareKeys(mGrpId, shareList)) { + std::cerr << "Failed to share keys!" << std::endl; + return; + } + } + else + { // incorrect type return; } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.h b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.h similarity index 64% rename from retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.h rename to retroshare-gui/src/gui/gxs/GxsGroupShareKey.h index c96e02dfa..4752fd28c 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.h @@ -7,8 +7,9 @@ #define CHANNEL_KEY_SHARE 0x00000001 #define FORUM_KEY_SHARE 0x00000002 +#define POSTED_KEY_SHARE 0x00000003 -class ChannelShareKey : public QDialog +class GroupShareKey : public QDialog { Q_OBJECT @@ -16,8 +17,8 @@ public: /* *@param chanId The channel id to send request for */ - ChannelShareKey(QWidget *parent = 0, const RsGxsGroupId& grpId = RsGxsGroupId(), int grpType = 0); - ~ChannelShareKey(); + GroupShareKey(QWidget *parent = 0, const RsGxsGroupId& grpId = RsGxsGroupId(), int grpType = 0); + ~GroupShareKey(); protected: void changeEvent(QEvent *e); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.ui b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.ui similarity index 100% rename from retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.ui rename to retroshare-gui/src/gui/gxs/GxsGroupShareKey.ui diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index ccc7ae630..29e24d1c0 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -23,7 +23,7 @@ #include "GxsChannelGroupDialog.h" #include "GxsChannelPostsWidget.h" #include "GxsChannelUserNotify.h" -#include "GxsChannelShareKey.h" +#include "gui/gxs/GxsGroupShareKey.h" #include "gui/feeds/GxsChannelPostItem.h" #include "gui/settings/rsharesettings.h" #include "gui/notifyqt.h" diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp index bfe63b93a..0f8aa0494 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp @@ -24,7 +24,7 @@ #include "GxsForumThreadWidget.h" #include "GxsForumUserNotify.h" #include "gui/notifyqt.h" -#include "gui/gxschannels/GxsChannelShareKey.h" +#include "gui/gxs/GxsGroupShareKey.h" /** Constructor */ GxsForumsDialog::GxsForumsDialog(QWidget *parent) diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index ad10995dd..9b181ef29 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -1191,7 +1191,6 @@ 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,7 +1198,6 @@ 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 \ @@ -1207,7 +1205,6 @@ 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 @@ -1270,6 +1267,7 @@ gxsgui { gui/gxs/RsGxsUpdateBroadcastBase.h \ gui/gxs/RsGxsUpdateBroadcastWidget.h \ gui/gxs/RsGxsUpdateBroadcastPage.h \ + gui/gxs/GxsGroupShareKey.h \ gui/gxs/GxsUserNotify.h \ util/TokenQueue.h \ util/RsGxsUpdateBroadcast.h \ @@ -1280,10 +1278,10 @@ gxsgui { gui/gxs/GxsCommentContainer.ui \ gui/gxs/GxsCommentDialog.ui \ gui/gxs/GxsCreateCommentDialog.ui \ - gui/gxs/GxsGroupFrameDialog.ui - + gui/gxs/GxsGroupFrameDialog.ui\ + gui/gxs/GxsGroupShareKey.ui # gui/gxs/GxsMsgDialog.ui \ -# gui/gxs/GxsCommentTreeWidget.ui \ +# gui/gxs/GxsCommentTreeWidget.ui SOURCES += gui/gxs/GxsGroupDialog.cpp \ gui/gxs/WikiGroupDialog.cpp \ @@ -1291,6 +1289,7 @@ gxsgui { gui/gxs/GxsIdChooser.cpp \ gui/gxs/GxsIdLabel.cpp \ gui/gxs/GxsCircleChooser.cpp \ + gui/gxs/GxsGroupShareKey.cpp \ gui/gxs/GxsCircleLabel.cpp \ gui/gxs/GxsIdTreeWidget.cpp \ gui/gxs/GxsIdTreeWidgetItem.cpp \