Added Copy Certificate Button to ProfileWidget

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5026 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2012-03-16 23:14:57 +00:00
parent 40b9e17a2e
commit 5ab6c5decc
3 changed files with 43 additions and 4 deletions

View File

@ -26,6 +26,9 @@
#include "StatusMessage.h"
#include <QApplication>
#include <QClipboard>
#include <QMessageBox>
#include <QTime>
#include <sstream>
@ -43,7 +46,8 @@ ProfileWidget::ProfileWidget(QWidget *parent, Qt::WFlags flags)
ui.setupUi(this);
connect(ui.editstatuspushButton,SIGNAL(clicked()), this, SLOT(statusmessagedlg()));
connect(ui.CopyCertButton,SIGNAL(clicked()), this, SLOT(copyCert()));
ui.onlinesince->setText(QDateTime::currentDateTime().toString(DATETIME_FMT));
}
@ -118,5 +122,23 @@ void ProfileWidget::statusmessagedlg()
statusmsgdialog->show();
}
void ProfileWidget::copyCert()
{
std::string cert = rsPeers->GetRetroshareInvite(false);
if (cert.empty()) {
QMessageBox::information(this, tr("RetroShare"),
tr("Sorry, create certificate failed"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(QString::fromStdString(cert));
QMessageBox::information(this,
tr("RetroShare"),
tr("Your Cert is copied to Clipboard, paste and send it to your "
"friend via email or some other way"));
}

View File

@ -45,7 +45,8 @@ private slots:
void showEvent ( QShowEvent * event );
void statusmessagedlg();
void copyCert();
private:

View File

@ -48,7 +48,7 @@ border: 1px solid #CCCCCC;}</string>
<property name="bottomMargin">
<number>1</number>
</property>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QPushButton" name="editstatuspushButton">
<property name="toolTip">
<string>Edit Personal message</string>
@ -66,7 +66,7 @@ border: 1px solid #CCCCCC;
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -79,6 +79,21 @@ border: 1px solid #CCCCCC;
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="CopyCertButton">
<property name="styleSheet">
<string notr="true">QPushButton:hover {
border: 1px solid #CCCCCC;
}</string>
</property>
<property name="text">
<string>Copy Certificate</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -699,6 +714,7 @@ p, li { white-space: pre-wrap; }
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>