added button to add/remove signatures and button to copy RS cert link to clipboard

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4841 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-01-24 22:31:53 +00:00
parent ace11b3d65
commit a139700de4
3 changed files with 43 additions and 4 deletions

View File

@ -27,6 +27,7 @@
#include "CryptoPage.h"
#include "util/misc.h"
#include <gui/RetroShareLink.h>
#include <retroshare/rspeers.h> //for rsPeers variable
@ -39,6 +40,8 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
connect(ui._includeSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(load()));
connect(ui._copyLink_PB, SIGNAL(clicked()), this, SLOT(copyRSLink()));
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -65,11 +68,32 @@ CryptoPage::load()
QFont font("Courier New",9,50,false) ;
ui.certtextEdit->setFont(font) ;
ui.certtextEdit->setPlainText(QString::fromUtf8(rsPeers->GetRetroshareInvite(true).c_str()));
ui.certtextEdit->setPlainText(QString::fromUtf8(rsPeers->GetRetroshareInvite(ui._includeSignatures_CB->isChecked()).c_str()));
ui.certtextEdit->setReadOnly(true);
ui.certtextEdit->setMinimumHeight(200);
}
void
CryptoPage::copyRSLink()
{
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) )
{
QList<RetroShareLink> urls ;
urls.push_back(link) ;
RSLinkClipboard::copyLinks(urls) ;
QMessageBox::information(this,
tr("RetroShare"),
tr("A RetroShare link with your Public Key is copied to Clipboard, paste and send it to your"
" friend via email or some other way"));
}
else
QMessageBox::warning(this,
tr("Error"),
tr("Your certificate could not be parsed correctly. Please contact the developpers."));
}
void
CryptoPage::copyPublicKey()
{

View File

@ -38,10 +38,11 @@ class CryptoPage : public ConfigPage
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private slots:
void load();
void copyPublicKey();
void copyRSLink() ;
bool fileSave();
bool fileSaveAs();

View File

@ -500,7 +500,7 @@
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<item row="0" column="0" colspan="5">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Public Key</string>
@ -549,7 +549,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="2">
<item row="1" column="4">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -562,6 +562,20 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="_includeSignatures_CB">
<property name="text">
<string>Include signatures</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="_copyLink_PB">
<property name="text">
<string>copy RetroShare link to clipboard</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources>