From eede11a77226cd461d0643ba574271faff7de3ab Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 25 Sep 2014 20:14:21 +0000 Subject: [PATCH] - removed "use olf key format" from certificate export - improved GXS Id display when unsigned - use ProfileManager to export own PGP key pair in keyring and profile. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7562 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/NetworkDialog.cpp | 45 ++---------- retroshare-gui/src/gui/gxs/GxsIdDetails.cpp | 9 +-- .../src/gui/profile/ProfileManager.cpp | 17 ++--- .../src/gui/profile/ProfileManager.ui | 16 ++--- .../src/gui/settings/CryptoPage.cpp | 9 +-- retroshare-gui/src/gui/settings/CryptoPage.h | 2 +- retroshare-gui/src/gui/settings/CryptoPage.ui | 72 ++++--------------- 7 files changed, 44 insertions(+), 126 deletions(-) diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index fb4c5555f..5323e1f7b 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -34,6 +34,7 @@ #include "common/RSTreeWidgetItem.h" #include #include "gui/msgs/MessageComposer.h" +#include "gui/profile/ProfileManager.h" #include "NetworkDialog.h" //#include "TrustView.h" #include "NetworkView.h" @@ -218,11 +219,11 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ ) contextMnu->addAction(QIcon(IMAGE_MAKEFRIEND), tr("Make friend"), this, SLOT(makeFriend())); } if(peer_id == rsPeers->getGPGOwnId()) - contextMnu->addAction(QIcon(IMAGE_EXPORT), tr("Export my certificate..."), this, SLOT(on_actionExportKey_activated())); + contextMnu->addAction(QIcon(IMAGE_EXPORT), tr("Export/create a new location"), this, SLOT(on_actionExportKey_activated())); contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Peer details..."), this, SLOT(peerdetails())); - //contextMnu->addAction(QIcon(IMAGE_MESSAGE), tr("Send Message"), this, SLOT(sendDistantMessage())); - contextMnu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyLink())); + //contextMnu->addAction(QIcon(IMAGE_MESSAGE), tr("Send Message"), this, SLOT(sendDistantMessage())); + //contextMnu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyLink())); contextMnu->addSeparator() ; contextMnu->addAction(QIcon(IMAGE_CLEAN_UNUSED), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys())); @@ -690,42 +691,8 @@ void NetworkDialog::on_actionAddFriend_activated() void NetworkDialog::on_actionExportKey_activated() { -// qDebug() << " exportcert"; -// -// std::string cert = rsPeers->GetRetroshareInvite(); -// if (cert.empty()) { -// QMessageBox::information(this, tr("RetroShare"), -// tr("Sorry, create certificate failed"), -// QMessageBox::Ok, QMessageBox::Ok); -// return; -// } -// -// use misc::getSaveFileName -// QString qdir = QFileDialog::getSaveFileName(this, -// tr("Please choose a filename"), -// QDir::homePath(), -// tr("RetroShare Certificate (*.rsc );;All Files (*)")); -// //Todo: move save to file to p3Peers::SaveCertificateToFile -// -// if (qdir.isEmpty() == false) { -// QFile CertFile (qdir); -// if (CertFile.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) { -// if (CertFile.write(QByteArray(cert.c_str())) > 0) { -// QMessageBox::information(this, tr("RetroShare"), -// tr("Certificate file successfully created"), -// QMessageBox::Ok, QMessageBox::Ok); -// } else { -// QMessageBox::information(this, tr("RetroShare"), -// tr("Sorry, certificate file creation failed"), -// QMessageBox::Ok, QMessageBox::Ok); -// } -// CertFile.close(); -// } else { -// QMessageBox::information(this, tr("RetroShare"), -// tr("Sorry, certificate file creation failed"), -// QMessageBox::Ok, QMessageBox::Ok); -// } -// } + ProfileManager prof ; + prof.exec() ; } void NetworkDialog::on_actionCreate_New_Profile_activated() diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index 0a608d844..a83746911 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -207,11 +207,12 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std /* look up real name */ std::string authorName = rsPeers->getGPGName(details.mPgpId); comment += QString::fromUtf8(authorName.c_str()); + comment += " ["; + comment += QString::fromStdString(details.mPgpId.toStdString()) ; + comment += "]"; } - - comment += " ["; - comment += QString::fromStdString(details.mPgpId.toStdString()) ; - comment += "]"; + else + comment += QObject::tr("signed by unknown Key") ; } else comment += "Authentication: anonymous" ; diff --git a/retroshare-gui/src/gui/profile/ProfileManager.cpp b/retroshare-gui/src/gui/profile/ProfileManager.cpp index ddc18f9d5..6afda48ff 100644 --- a/retroshare-gui/src/gui/profile/ProfileManager.cpp +++ b/retroshare-gui/src/gui/profile/ProfileManager.cpp @@ -48,22 +48,15 @@ ProfileManager::ProfileManager(QWidget *parent) /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); -// setAttribute ( Qt::WA_DeleteOnClose, true ); - ui.headerFrame->setHeaderImage(QPixmap(":/images/contact_new128.png")); ui.headerFrame->setHeaderText(tr("Profile Manager")); connect(ui.identityTreeWidget, SIGNAL( customContextMenuRequested(QPoint)), this, SLOT( identityTreeWidgetCostumPopupMenu(QPoint))); connect(ui.identityTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(identityItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); -// connect(ui.newIdentity_PB, SIGNAL(clicked()), this, SLOT(newIdentity())); -// connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity())); connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity())); -// ui.newIdentity_PB->hide() ; -// ui.importIdentity_PB->hide() ; - +// ui.exportIdentity_PB->setEnabled(false); fillIdentities(); - ui.exportIdentity_PB->setEnabled(false); } void ProfileManager::identityTreeWidgetCostumPopupMenu(QPoint) @@ -90,6 +83,8 @@ void ProfileManager::fillIdentities() ui.identityTreeWidget->setColumnWidth(COLUMN_NAME, 200); ui.identityTreeWidget->setColumnWidth(COLUMN_EMAIL, 200); + RsPgpId own_pgp_id = rsPeers->getGPGOwnId() ; + std::cerr << "Finding PGPUsers" << std::endl; QTreeWidget *identityTreeWidget = ui.identityTreeWidget; @@ -111,6 +106,12 @@ void ProfileManager::fillIdentities() item -> setText(COLUMN_EMAIL, QString::fromUtf8(email.c_str())); item -> setText(COLUMN_GID, gid); identityTreeWidget->addTopLevelItem(item); + + if(own_pgp_id == *it) + { + item->setSelected(true) ; + ui.exportIdentity_PB->setEnabled(true); + } } } diff --git a/retroshare-gui/src/gui/profile/ProfileManager.ui b/retroshare-gui/src/gui/profile/ProfileManager.ui index 59ba81557..804079ef4 100644 --- a/retroshare-gui/src/gui/profile/ProfileManager.ui +++ b/retroshare-gui/src/gui/profile/ProfileManager.ui @@ -54,12 +54,12 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">Select an identity from the list below to be used on another computer, and press &quot;Export selected identity&quot;</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">To use it on a different computer, select the identity manager in the login window. From there you can import the identity file and create a new location for that identity. </span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">When keeping the same identity for your new location, your friends will automatically accept you.</span></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Select a Retroshare node key from the list below to be used on another computer, and press &quot;Export selected key.&quot;</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To create a new location on a different computer, select the identity manager in the login window. From there you can import the key file and create a new location for that key. </p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Creating a new node with the same key allows your your friend nodes to accept you automatically.</p></body></html> @@ -73,7 +73,7 @@ p, li { white-space: pre-wrap; } - Identities + Full keys available in your keyring: @@ -110,7 +110,7 @@ p, li { white-space: pre-wrap; } - Export selected identity + Export selected key diff --git a/retroshare-gui/src/gui/settings/CryptoPage.cpp b/retroshare-gui/src/gui/settings/CryptoPage.cpp index 94df97cb0..3ba5abfd4 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.cpp +++ b/retroshare-gui/src/gui/settings/CryptoPage.cpp @@ -47,10 +47,6 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags) connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs())); connect(ui._includeSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(load())); connect(ui._copyLink_PB, SIGNAL(clicked()), this, SLOT(copyRSLink())); - connect(ui._useOldFormat_CB, SIGNAL(toggled(bool)), this, SLOT(load())); - - ui._useOldFormat_CB->setEnabled(false) ; - ui._useOldFormat_CB->setChecked(false) ; // hide profile manager as it causes bugs when generating a new profile. //ui.profile_Button->hide() ; @@ -59,15 +55,14 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags) #ifdef Q_WS_WIN #endif - connect(ui.profile_Button,SIGNAL(clicked()), this, SLOT(profilemanager())); + connect(ui.createNewLocation_PB,SIGNAL(clicked()), this, SLOT(profilemanager())); ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime())); } void CryptoPage::profilemanager() { - ProfileManager profilemanager; - profilemanager.exec(); + ProfileManager().exec(); } void CryptoPage::showEvent ( QShowEvent * /*event*/ ) { diff --git a/retroshare-gui/src/gui/settings/CryptoPage.h b/retroshare-gui/src/gui/settings/CryptoPage.h index cb3c013b4..000401636 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.h +++ b/retroshare-gui/src/gui/settings/CryptoPage.h @@ -40,7 +40,7 @@ class CryptoPage : public ConfigPage /** Loads the settings for this page */ virtual QPixmap iconPixmap() const { return QPixmap(":/images/encrypted32.png") ; } - virtual QString pageName() const { return tr("Profile") ; } + virtual QString pageName() const { return tr("Node") ; } virtual QString helpText() const { return ""; } private slots: diff --git a/retroshare-gui/src/gui/settings/CryptoPage.ui b/retroshare-gui/src/gui/settings/CryptoPage.ui index 815276ae2..970d9c755 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.ui +++ b/retroshare-gui/src/gui/settings/CryptoPage.ui @@ -14,56 +14,13 @@ - 0 + 1 - Profile + Node information - - - - - - Qt::NoFocus - - - Profile Manager - - - - :/images/contact_new.png:/images/contact_new.png - - - - 22 - 22 - - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - @@ -233,7 +190,7 @@ - Identity ID + PGP Id : @@ -303,7 +260,7 @@ - Number of Friends: + Friend nodes: @@ -492,16 +449,6 @@ - - - - Use old key format - - - true - - - @@ -522,7 +469,7 @@ - Copy link to clipboard + Copy certificate to clipboard @@ -532,7 +479,14 @@ Save Key into a file - Save Key + Save certificate to file + + + + + + + Create new location...