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
This commit is contained in:
defnax 2010-06-13 23:42:21 +00:00
parent c5eade329b
commit 2d839b031b
3 changed files with 66 additions and 30 deletions

View File

@ -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<std::string>::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));
}
}
}
@ -397,3 +397,27 @@ void ConfCertDialog::showHelpDialog(const QString &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 );
}

View File

@ -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);
private slots:
/** Overloaded QWidget.show */
void show();
void showTrust();
void listWidgetContextMenuPopup( const QPoint &pos);
void closeinfodlg();
void applyDialog();
void makeFriend();
@ -78,15 +79,15 @@ private slots:
/** Called when a child window requests the given help <b>topic</b>. */
void showHelpDialog(const QString &topic);
void copyToClipboard();
private:
/** Loads the saved connectidialog settings */
// void loadSettings();
void loadDialog();
void loadDialog();
std::string mId;
bool isPGPId;
std::string mId;
bool isPGPId;
/** Qt Designer generated object */
Ui::ConfCertDialog ui;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>489</width>
<height>485</height>
<height>505</height>
</rect>
</property>
<property name="windowTitle">
@ -21,7 +21,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
@ -250,7 +250,14 @@
</widget>
</item>
<item>
<widget class="QListWidget" name="ipAddressList"/>
<widget class="QListWidget" name="ipAddressList">
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
</item>
<item>
<spacer>
@ -433,7 +440,11 @@
</property>
<layout class="QVBoxLayout" name="_11">
<item>
<widget class="QTextBrowser" name="signers"/>
<widget class="QListWidget" name="signers_listWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>