Added Copy Cert to Clipboard functionality for ConnectWizard.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1372 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-07-14 13:29:49 +00:00
parent 8cab711a52
commit fff4bc06ab
2 changed files with 31 additions and 1 deletions

View File

@ -32,6 +32,8 @@
#include <QCheckBox> #include <QCheckBox>
#include <QGroupBox> #include <QGroupBox>
#include <QComboBox> #include <QComboBox>
#include <QtGui>
#include <QClipboard>
#include <QTableWidget> #include <QTableWidget>
#include <QHeaderView> #include <QHeaderView>
@ -188,6 +190,16 @@ TextPage::TextPage(QWidget *parent)
userCertHelpButton->setIcon( QIcon(":images/connect/info16.png") ); userCertHelpButton->setIcon( QIcon(":images/connect/info16.png") );
connect (userCertHelpButton, SIGNAL( clicked()), connect (userCertHelpButton, SIGNAL( clicked()),
this, SLOT( showHelpUserCert()) ); this, SLOT( showHelpUserCert()) );
userCertCopyButton = new QPushButton;
userCertCopyButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
userCertCopyButton->setFixedSize(20,20);
userCertCopyButton->setFlat(true);
userCertCopyButton->setIcon( QIcon(":images/copyrslink.png") );
userCertCopyButton->setToolTip(tr("Copy your Cert to Clipboard"));
connect (userCertCopyButton, SIGNAL( clicked()),
this, SLOT( copyCert()) );
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
userCertMailButton = new QPushButton; userCertMailButton = new QPushButton;
userCertMailButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); userCertMailButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
@ -200,6 +212,7 @@ TextPage::TextPage(QWidget *parent)
#endif #endif
userCertButtonsLayout = new QVBoxLayout(); userCertButtonsLayout = new QVBoxLayout();
userCertButtonsLayout->addWidget(userCertHelpButton); userCertButtonsLayout->addWidget(userCertHelpButton);
userCertButtonsLayout->addWidget(userCertCopyButton);
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
userCertButtonsLayout->addWidget(userCertMailButton); userCertButtonsLayout->addWidget(userCertMailButton);
#endif #endif
@ -275,6 +288,21 @@ TextPage::showHelpUserCert()
// //
//============================================================================ //============================================================================
// //
void
TextPage::copyCert()
{
QMessageBox::information(this,
tr("RetroShare"),
tr("Your Cert is copied to Clipbard, paste and send it to your"
"friend via email, ICQ or some other way"));
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(userCertEdit->toPlainText());
}
//
//============================================================================
//
int int
TextPage::nextId() const TextPage::nextId() const
{ {

View File

@ -82,6 +82,7 @@ private:
QHBoxLayout* userCertLayout; QHBoxLayout* userCertLayout;
QVBoxLayout* userCertButtonsLayout; QVBoxLayout* userCertButtonsLayout;
QPushButton* userCertHelpButton; QPushButton* userCertHelpButton;
QPushButton* userCertCopyButton;
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QPushButton* userCertMailButton;//! on Windows, click on this button QPushButton* userCertMailButton;//! on Windows, click on this button
//! launches default email client //! launches default email client
@ -93,6 +94,7 @@ private:
private slots: private slots:
void showHelpUserCert(); void showHelpUserCert();
void copyCert();
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
//! launches default email client (on windows) //! launches default email client (on windows)