From 5ab6c5decc7c82dccd79c7c23c2abee04d65e14d Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 16 Mar 2012 23:14:57 +0000 Subject: [PATCH] Added Copy Certificate Button to ProfileWidget git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5026 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/profile/ProfileWidget.cpp | 24 ++++++++++++++++++- .../src/gui/profile/ProfileWidget.h | 3 ++- .../src/gui/profile/ProfileWidget.ui | 20 ++++++++++++++-- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/profile/ProfileWidget.cpp b/retroshare-gui/src/gui/profile/ProfileWidget.cpp index c4ceabaf9..318f67a3e 100644 --- a/retroshare-gui/src/gui/profile/ProfileWidget.cpp +++ b/retroshare-gui/src/gui/profile/ProfileWidget.cpp @@ -26,6 +26,9 @@ #include "StatusMessage.h" +#include +#include +#include #include #include @@ -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")); +} diff --git a/retroshare-gui/src/gui/profile/ProfileWidget.h b/retroshare-gui/src/gui/profile/ProfileWidget.h index 0b80864e5..50f677f35 100644 --- a/retroshare-gui/src/gui/profile/ProfileWidget.h +++ b/retroshare-gui/src/gui/profile/ProfileWidget.h @@ -45,7 +45,8 @@ private slots: void showEvent ( QShowEvent * event ); void statusmessagedlg(); - + void copyCert(); + private: diff --git a/retroshare-gui/src/gui/profile/ProfileWidget.ui b/retroshare-gui/src/gui/profile/ProfileWidget.ui index ea8604153..f35e4fdff 100644 --- a/retroshare-gui/src/gui/profile/ProfileWidget.ui +++ b/retroshare-gui/src/gui/profile/ProfileWidget.ui @@ -48,7 +48,7 @@ border: 1px solid #CCCCCC;} 1 - + Edit Personal message @@ -66,7 +66,7 @@ border: 1px solid #CCCCCC; - + Qt::Horizontal @@ -79,6 +79,21 @@ border: 1px solid #CCCCCC; + + + + QPushButton:hover { +border: 1px solid #CCCCCC; +} + + + Copy Certificate + + + true + + + @@ -699,6 +714,7 @@ p, li { white-space: pre-wrap; } +