mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
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:
parent
1d6bf4190e
commit
d0469ccfc3
22 changed files with 511 additions and 57 deletions
|
@ -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:
|
||||
|
|
101
retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.cpp
Normal file
101
retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.cpp
Normal file
|
@ -0,0 +1,101 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2010 Christopher Evi-Parker
|
||||
*
|
||||
* 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 "GxsChannelShareKey.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <algorithm>
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
|
||||
#include "gui/common/PeerDefs.h"
|
||||
|
||||
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();
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/user/agt_forum64.png"));
|
||||
ui->headerFrame->setHeaderText(tr("Share Channel"));
|
||||
|
||||
connect( ui->buttonBox, SIGNAL(accepted()), this, SLOT(shareKey()));
|
||||
connect( ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
|
||||
/* initialize key share list */
|
||||
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
||||
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||
ui->keyShareList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||
ui->keyShareList->start();
|
||||
}
|
||||
|
||||
ChannelShareKey::~ChannelShareKey()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ChannelShareKey::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelShareKey::shareKey()
|
||||
{
|
||||
std::list<RsPeerId> shareList;
|
||||
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
|
||||
|
||||
if (shareList.empty()) {
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please select at least one peer"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (mGrpType & CHANNEL_KEY_SHARE) {
|
||||
if (!rsGxsChannels)
|
||||
return;
|
||||
|
||||
if (!rsGxsChannels->groupShareKeys(mGrpId, shareList)) {
|
||||
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)) {
|
||||
// std::cerr << "Failed to share keys!" << std::endl;
|
||||
//return;
|
||||
//}
|
||||
} else {
|
||||
// incorrect type
|
||||
return;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
35
retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.h
Normal file
35
retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef SHAREKEY_H
|
||||
#define SHAREKEY_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_ShareKey.h"
|
||||
|
||||
#define CHANNEL_KEY_SHARE 0x00000001
|
||||
#define FORUM_KEY_SHARE 0x00000002
|
||||
|
||||
class ChannelShareKey : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*
|
||||
*@param chanId The channel id to send request for
|
||||
*/
|
||||
ChannelShareKey(QWidget *parent = 0, const RsGxsGroupId& grpId = RsGxsGroupId(), int grpType = 0);
|
||||
~ChannelShareKey();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
void shareKey();
|
||||
|
||||
private:
|
||||
RsGxsGroupId mGrpId;
|
||||
int mGrpType;
|
||||
|
||||
Ui::ShareKey *ui;
|
||||
};
|
||||
|
||||
#endif // SHAREKEY_H
|
164
retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.ui
Normal file
164
retroshare-gui/src/gui/gxschannels/GxsChannelShareKey.ui
Normal file
|
@ -0,0 +1,164 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShareKey</class>
|
||||
<widget class="QDialog" name="ShareKey">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>472</width>
|
||||
<height>347</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Share Channel</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="HeaderFrame" name="headerFrame"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QDockWidget" name="contactsdockWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>52487</width>
|
||||
<height>524287</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>check peers you would like to share private publish key with</string>
|
||||
</property>
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Share for Friend</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>4</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1677215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Select the Friends with which you want to Share your Channel.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>HeaderFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>gui/common/HeaderFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>FriendSelectionWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/common/FriendSelectionWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Add table
Add a link
Reference in a new issue