Added Friend Request Dialog for SecurityItem

Fixed the horizontal spacers

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5077 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2012-04-04 15:44:35 +00:00
parent af48bb9555
commit 70a7d6ce40
8 changed files with 769 additions and 42 deletions

View File

@ -300,6 +300,7 @@ HEADERS += rshare.h \
gui/channels/EditChanDetails.h \
gui/channels/ShareKey.h \
gui/connect/ConfCertDialog.h \
gui/connect/FriendRequest.h \
gui/msgs/MessageComposer.h \
gui/msgs/MessageWindow.h \
gui/msgs/MessageWidget.h \
@ -441,6 +442,7 @@ FORMS += gui/StartDialog.ui \
gui/chat/CreateLobbyDialog.ui \
gui/ChatLobbyWidget.ui \
gui/connect/ConfCertDialog.ui \
gui/connect/FriendRequest.ui \
gui/msgs/MessageComposer.ui \
gui/msgs/MessageWindow.ui\
gui/msgs/MessageWidget.ui\
@ -577,6 +579,7 @@ SOURCES += main.cpp \
gui/chat/HandleRichText.cpp \
gui/chat/ChatStyle.cpp \
gui/connect/ConfCertDialog.cpp \
gui/connect/FriendRequest.cpp \
gui/msgs/MessageComposer.cpp \
gui/msgs/MessageWidget.cpp \
gui/msgs/MessageWindow.cpp \

View File

@ -0,0 +1,232 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012, 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 <gpgme.h>
#include "FriendRequest.h"
#include <QMessageBox>
#include <QDateTime>
#include <QMenu>
#include <QClipboard>
#include <QMap>
#include <iostream>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsmsgs.h>
#include "gui/help/browser/helpbrowser.h"
#include "gui/common/PeerDefs.h"
#include "gui/common/StatusDefs.h"
#include "gui/RetroShareLink.h"
#include "gui/notifyqt.h"
#include "gui/common/AvatarDefs.h"
/* Define the format used for displaying the date and time */
#define DATETIME_FMT "MMM dd hh:mm:ss"
/** Default constructor */
FriendRequest::FriendRequest(const std::string& id, QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags), mId(id)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(close()));
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
load();
}
/** Destructor. */
FriendRequest::~FriendRequest()
{
}
void FriendRequest::load()
{
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(mId, detail))
{
QMessageBox::information(this,
tr("RetroShare"),
tr("Error : cannot get peer details."));
close();
return;
}
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
ui.peerid->setText(QString::fromStdString(detail.id));
RetroShareLink link;
link.createPerson(detail.id);
ui.rsid->setText(link.toHtml());
ui.rsid->setToolTip(link.title());
ui.avatar->setId(mId, false);
if (detail.accept_connection) {
ui.signGPGKeyCheckBox->hide();
//connection already accepted, propose to sign gpg key
if (!detail.ownsign) {
ui.signKeyButton->show();
} else {
ui.signKeyButton->hide();
}
} else {
ui.signKeyButton->hide();
if (!detail.ownsign) {
ui.signGPGKeyCheckBox->show();
ui.signGPGKeyCheckBox->setChecked(false);
} else {
ui.signGPGKeyCheckBox->hide();
}
}
//web of trust
if (detail.trustLvl == GPGME_VALIDITY_ULTIMATE) {
//trust is ultimate, it means it's one of our own keys
ui.web_of_trust_label->setText(tr("Your trust in this peer is ultimate, it's probably a key you own."));
ui.radioButton_trust_fully->hide();
ui.radioButton_trust_marginnaly->hide();
ui.radioButton_trust_never->hide();
} else {
ui.radioButton_trust_fully->show();
ui.radioButton_trust_marginnaly->show();
ui.radioButton_trust_never->show();
if (detail.trustLvl == GPGME_VALIDITY_FULL) {
ui.web_of_trust_label->setText(tr("Your trust in this peer is full."));
ui.radioButton_trust_fully->setChecked(true);
ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-48.png"));
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png"));
} else if (detail.trustLvl == GPGME_VALIDITY_MARGINAL) {
ui.web_of_trust_label->setText(tr("Your trust in this peer is marginal."));
ui.radioButton_trust_marginnaly->setChecked(true);
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-48.png"));
ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png"));
ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png"));
} else if (detail.trustLvl == GPGME_VALIDITY_NEVER) {
ui.web_of_trust_label->setText(tr("Your trust in this peer is none."));
ui.radioButton_trust_never->setChecked(true);
ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-48.png"));
ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png"));
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
} else {
ui.web_of_trust_label->setText(tr("Your trust in this peer is not set."));
//we have to set up the set exclusive to false in order to uncheck it all
ui.radioButton_trust_fully->setAutoExclusive(false);
ui.radioButton_trust_marginnaly->setAutoExclusive(false);
ui.radioButton_trust_never->setAutoExclusive(false);
ui.radioButton_trust_fully->setChecked(false);
ui.radioButton_trust_marginnaly->setChecked(false);
ui.radioButton_trust_never->setChecked(false);
ui.radioButton_trust_fully->setAutoExclusive(true);
ui.radioButton_trust_marginnaly->setAutoExclusive(true);
ui.radioButton_trust_never->setAutoExclusive(true);
ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png"));
ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png"));
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
}
}
if (detail.hasSignedMe) {
//ui.is_signing_me->setText(tr("Peer has authenticated me as a friend and did sign my GPG key"));
} else {
//ui.is_signing_me->setText(tr("Peer has not authenticated me as a friend and did not sign my GPG key"));
}
}
void FriendRequest::applyDialog()
{
std::cerr << "FriendRequest::applyDialog() called" << std::endl ;
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(mId, detail))
{
if (!rsPeers->getGPGDetails(mId, detail)) {
QMessageBox::information(this,
tr("RetroShare"),
tr("Error : cannot get peer details."));
close();
return;
}
}
//check the GPG trustlvl
if (ui.radioButton_trust_fully->isChecked() && detail.trustLvl != GPGME_VALIDITY_FULL) {
//trust has changed to fully
rsPeers->trustGPGCertificate(detail.id, GPGME_VALIDITY_FULL);
} else if (ui.radioButton_trust_marginnaly->isChecked() && detail.trustLvl != GPGME_VALIDITY_MARGINAL) {
rsPeers->trustGPGCertificate(detail.id, GPGME_VALIDITY_MARGINAL);
} else if (ui.radioButton_trust_never->isChecked() && detail.trustLvl != GPGME_VALIDITY_NEVER) {
rsPeers->trustGPGCertificate(detail.id, GPGME_VALIDITY_NEVER);
}
makeFriend();
close();
}
void FriendRequest::makeFriend()
{
std::string gpg_id = rsPeers->getGPGId(mId);
if (ui.signGPGKeyCheckBox->isChecked()) {
rsPeers->signGPGCertificate(gpg_id);
}
rsPeers->addFriend(mId, gpg_id);
emit configChanged();
}
void FriendRequest::denyFriend()
{
std::string gpg_id = rsPeers->getGPGId(mId);
rsPeers->removeFriend(gpg_id);
emit configChanged();
}
void FriendRequest::signGPGKey()
{
std::string gpg_id = rsPeers->getGPGId(mId);
if (!rsPeers->signGPGCertificate(gpg_id)) {
QMessageBox::warning ( NULL,
tr("Signature Failure"),
tr("Maybe password is wrong"),
QMessageBox::Ok);
}
emit configChanged();
}

View File

@ -0,0 +1,61 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012, 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 _FRIENDREQUEST_H
#define _FRIENDREQUEST_H
#include <QDialog>
#include "ui_FriendRequest.h"
class FriendRequest : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
FriendRequest(const std::string& id, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
~FriendRequest();
signals:
void configChanged();
private:
void load();
private slots:
void applyDialog();
void makeFriend();
void denyFriend();
void signGPGKey();
private:
std::string mId;
/** Qt Designer generated object */
Ui::FriendRequest ui;
};
#endif

View File

@ -0,0 +1,413 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FriendRequest</class>
<widget class="QDialog" name="FriendRequest">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>402</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Friend Request</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame{background-image: url(:/images/connect/connectFriendBanner.png);}
</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/user/user_request48.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt; color:#ffffff;&quot;&gt;Friend Request&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="avatarFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="AvatarWidget" name="avatar" native="true">
<property name="minimumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Peer Info</string>
</property>
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<widget class="QLabel" name="label_name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_id">
<property name="text">
<string>Peer ID</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="peerid">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_rsid">
<property name="text">
<string>RetroShare ID</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="LinkTextBrowser" name="rsid">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="web_of_trust_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Your trust in this peer is:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButton_trust_never">
<property name="maximumSize">
<size>
<width>125</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>None </string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/security-low-48.png</normaloff>:/images/security-low-48.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_trust_marginnaly">
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Marginal </string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/security-medium-48.png</normaloff>:/images/security-medium-48.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_trust_fully">
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Full </string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/security-high-48.png</normaloff>:/images/security-high-48.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="signGPGKeyCheckBox">
<property name="text">
<string>Sign GPG Key</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="signKeyButton">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Signing a friend's key is a way to express your trust into this friend, to your other friends. Besides, only signed peers will receive information about your other trusted friends.&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p align=&quot;justify&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Signing a key cannot be undone, so do it wisely.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Sign GPG key</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/view-certificate-sign-32.png</normaloff>:/images/view-certificate-sign-32.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>154</width>
<height>35</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>175</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="applyButton">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Accept Request and Close&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Accept Friend Request</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>AvatarWidget</class>
<extends>QWidget</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LinkTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/LinkTextBrowser.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="C:/Dokumente und Einstellungen/DEWA--Mietkauf/.designer/images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>476</width>
<height>332</height>
<height>338</height>
</rect>
</property>
<property name="windowTitle">
@ -170,7 +170,7 @@ border-radius: 10px}</string>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>

View File

@ -29,6 +29,7 @@
#include "gui/msgs/MessageComposer.h"
#include "gui/common/StatusDefs.h"
#include "gui/connect/ConfCertDialog.h"
#include "gui/connect/FriendRequest.h"
#include "gui/common/AvatarDefs.h"
#include "gui/notifyqt.h"
@ -52,10 +53,10 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const std::strin
sendmsgButton->setEnabled(false);
quickmsgButton->hide();
chatButton->hide();
addFriendButton->setEnabled(false);
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
peerDetailsButton->setEnabled(false);
friendRequesttoolButton->hide();
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
@ -69,9 +70,9 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const std::strin
connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
connect(addFriendButton, SIGNAL(clicked()), this, SLOT(addFriend()));
connect(removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
connect(peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend()));
connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails()));
connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest()));
connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateItem()));
@ -188,8 +189,7 @@ void SecurityItem::updateItem()
chatButton->hide();
quickmsgButton->hide();
addFriendButton->setEnabled(false);
addFriendButton->show();
friendRequesttoolButton->show();
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
peerDetailsButton->setEnabled(false);
@ -239,15 +239,13 @@ void SecurityItem::updateItem()
if (details.accept_connection)
{
addFriendButton->setEnabled(false);
addFriendButton->hide();
friendRequesttoolButton->hide();
removeFriendButton->setEnabled(true);
removeFriendButton->show();
}
else
{
addFriendButton->setEnabled(true);
addFriendButton->show();
friendRequesttoolButton->show();
removeFriendButton->setEnabled(false);
removeFriendButton->hide();
}
@ -305,16 +303,6 @@ void SecurityItem::removeItem()
/*********** SPECIFIC FUNCTIOSN ***********************/
void SecurityItem::addFriend()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::addFriend()";
std::cerr << std::endl;
#endif
ConfCertDialog::showIt(mGpgId, ConfCertDialog::PageTrust);
}
void SecurityItem::removeFriend()
{
#ifdef DEBUG_ITEM
@ -328,6 +316,17 @@ void SecurityItem::removeFriend()
}
}
void SecurityItem::friendRequest()
{
#ifdef DEBUG_ITEM
std::cerr << "SecurityItem::friendReguest()";
std::cerr << std::endl;
#endif
FriendRequest *frDlg = new FriendRequest(mGpgId);
frDlg->show();
}
void SecurityItem::peerDetails()
{
#ifdef DEBUG_ITEM

View File

@ -50,7 +50,7 @@ private slots:
void removeItem();
void toggle();
void addFriend();
void friendRequest();
void removeFriend();
void peerDetails();
void sendMsg();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>709</width>
<height>338</height>
<width>776</width>
<height>340</height>
</rect>
</property>
<layout class="QGridLayout">
@ -159,6 +159,29 @@ border-radius: 10px}</string>
</item>
<item row="1" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QToolButton" name="friendRequesttoolButton">
<property name="text">
<string>Accept Friend Request</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/user/user_request48.png</normaloff>:/images/user/user_request48.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="peerDetailsButton">
<property name="text">
@ -193,23 +216,6 @@ border-radius: 10px}</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="addFriendButton">
<property name="text">
<string>Make friend</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/user/add_user16.png</normaloff>:/images/user/add_user16.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
@ -272,6 +278,19 @@ border-radius: 10px}</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">