From 2d839b031bd1ca9229faba5be567c66039e0480a Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 13 Jun 2010 23:42:21 +0000 Subject: [PATCH] Added to use QListWidget for Display signers, removed QTextBrowser Added context menu for Signers QListWidget with Copy Peer Name. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3131 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/connect/ConfCertDialog.cpp | 38 ++++++++++++++---- .../src/gui/connect/ConfCertDialog.h | 39 ++++++++++--------- .../src/gui/connect/ConfCertDialog.ui | 19 +++++++-- 3 files changed, 66 insertions(+), 30 deletions(-) diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp index a6e094f20..804f4c298 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp @@ -51,7 +51,7 @@ ConfCertDialog::ConfCertDialog(QWidget *parent, Qt::WFlags flags) connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend())); connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey())); connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog())); - + connect(ui.signers_listWidget, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( listWidgetContextMenuPopup( QPoint ) ) ); ui.applyButton->setToolTip(tr("Apply and Close")); } @@ -286,11 +286,11 @@ void ConfCertDialog::loadDialog() } } - ui.signers->clear() ; + ui.signers_listWidget->clear() ; for(std::list::const_iterator it(detail.gpgSigners.begin());it!=detail.gpgSigners.end();++it) { RsPeerDetails signerDetail; if (rsPeers->getGPGDetails(*it, signerDetail)) { - ui.signers->append(QString::fromStdString(signerDetail.name)); + ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name)); } } } @@ -385,15 +385,39 @@ void ConfCertDialog::signGPGKey() { * topic. */ void ConfCertDialog::showHelpDialog() { - showHelpDialog(QString("trust")); + showHelpDialog(QString("trust")); } /**< Shows the help browser and displays the given help topic. */ void ConfCertDialog::showHelpDialog(const QString &topic) { - static HelpBrowser *helpBrowser = 0; - if (!helpBrowser) + static HelpBrowser *helpBrowser = 0; + if (!helpBrowser) helpBrowser = new HelpBrowser(this); - helpBrowser->showWindow(topic); + helpBrowser->showWindow(topic); } +void ConfCertDialog::listWidgetContextMenuPopup( const QPoint &pos) +{ + QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem(); + if ( ! CurrentItem ) + return; + + QMenu menu( this ); + QAction *copyPeer = new QAction(tr("Copy Peer Name"), this ); + connect( copyPeer , SIGNAL( triggered() ), this, SLOT( copyToClipboard() ) ); + menu.addAction(copyPeer ); + menu.exec(QCursor::pos()); + +} + +void ConfCertDialog::copyToClipboard( ) +{ + QListWidgetItem *CurrentItem = ui.signers_listWidget->currentItem(); + if ( ! CurrentItem ) + return; + + QClipboard * cb = QApplication::clipboard(); + QString text = CurrentItem->text(); + cb->setText( text, QClipboard::Clipboard ); +} diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.h b/retroshare-gui/src/gui/connect/ConfCertDialog.h index 2d224fe9a..f3f489850 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.h +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.h @@ -34,8 +34,8 @@ class ConfCertDialog : public QDialog Q_OBJECT public: - static void show(const std::string& id) ; - static void showTrust(const std::string& id) ; + static void show(const std::string& id) ; + static void showTrust(const std::string& id) ; static ConfCertDialog *instance() ; signals: @@ -47,10 +47,10 @@ private: /** Default destructor */ -void loadId(std::string id); + void loadId(std::string id); #if 0 -void setInfo(std::string name, + void setInfo(std::string name, std::string trust, std::string org, std::string loc, @@ -58,16 +58,17 @@ void setInfo(std::string name, std::string signers); #endif -private slots: - /** Overloaded QWidget.show */ - void show(); - void showTrust(); - protected: - void closeEvent (QCloseEvent * event); - + void closeEvent (QCloseEvent * event); + private slots: + /** Overloaded QWidget.show */ + void show(); + void showTrust(); + + void listWidgetContextMenuPopup( const QPoint &pos); + void closeinfodlg(); void applyDialog(); void makeFriend(); @@ -77,18 +78,18 @@ private slots: void showHelpDialog(); /** Called when a child window requests the given help topic. */ void showHelpDialog(const QString &topic); + + void copyToClipboard(); private: - - /** Loads the saved connectidialog settings */ -// void loadSettings(); -void loadDialog(); + void loadDialog(); -std::string mId; -bool isPGPId; - /** Qt Designer generated object */ - Ui::ConfCertDialog ui; + std::string mId; + bool isPGPId; + + /** Qt Designer generated object */ + Ui::ConfCertDialog ui; }; diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.ui b/retroshare-gui/src/gui/connect/ConfCertDialog.ui index 2a0c36a6a..f3b98edb2 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.ui +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.ui @@ -7,7 +7,7 @@ 0 0 489 - 485 + 505 @@ -21,7 +21,7 @@ - 0 + 1 @@ -250,7 +250,14 @@ - + + + Qt::DefaultContextMenu + + + QAbstractItemView::MultiSelection + + @@ -433,7 +440,11 @@ - + + + Qt::CustomContextMenu + +