extended group share keys to Posted

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7608 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-13 18:31:47 +00:00
parent adbfa89c7b
commit 6e2df7e0de
11 changed files with 54 additions and 31 deletions

View file

@ -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"

View file

@ -1,101 +0,0 @@
/****************************************************************
* 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();
}

View file

@ -1,35 +0,0 @@
#ifndef SHAREKEY_H
#define SHAREKEY_H
#include <QDialog>
#include "ui_GxsChannelShareKey.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

View file

@ -1,164 +0,0 @@
<?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>