mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-21 07:20:28 -04:00
implemented export of identity (to create additional locations easily). Import still to do...
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5285 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2ca0bf71d0
commit
c9eb267165
11 changed files with 263 additions and 88 deletions
|
@ -22,6 +22,7 @@
|
|||
#include <rshare.h>
|
||||
#include <util/rsrandom.h>
|
||||
#include <retroshare/rsinit.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include "GenCertDialog.h"
|
||||
#include "InfoDialog.h"
|
||||
#include <QAbstractEventDispatcher>
|
||||
|
@ -45,6 +46,8 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
|||
connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup()));
|
||||
|
||||
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
|
||||
connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity()));
|
||||
connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity()));
|
||||
connect(ui.infopushButton,SIGNAL(clicked()), this, SLOT(infodlg()));
|
||||
//connect(ui.selectButton, SIGNAL(clicked()), this, SLOT(selectFriend()));
|
||||
//connect(ui.friendBox, SIGNAL(stateChanged(int)), this, SLOT(checkChanged(int)));
|
||||
|
@ -65,7 +68,7 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
|||
if (RsInit::GetPGPLogins(pgpIds)) {
|
||||
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
|
||||
{
|
||||
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
||||
QVariant userData(QString::fromStdString(*it));
|
||||
std::string name, email;
|
||||
RsInit::GetPGPLoginDetails(*it, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
||||
|
@ -88,9 +91,9 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
|||
ui.new_gpg_key_checkbox->setChecked(true);
|
||||
ui.new_gpg_key_checkbox->hide();
|
||||
ui.progressBar->hide();
|
||||
setWindowTitle(tr("Create new Profile"));
|
||||
ui.genButton->setText(tr("Generate new Profile"));
|
||||
ui.label_3->setText( titleString.arg( tr("Create a new Profile") ) ) ;
|
||||
setWindowTitle(tr("Create new Identity"));
|
||||
ui.genButton->setText(tr("Generate new Identity"));
|
||||
ui.label_3->setText( titleString.arg( tr("Create a new Identity") ) ) ;
|
||||
genNewGPGKey = true;
|
||||
}
|
||||
newGPGKeyGenUiSetup();
|
||||
|
@ -111,9 +114,11 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
|
|||
ui.password_input->show();
|
||||
ui.genPGPuserlabel->hide();
|
||||
ui.genPGPuser->hide();
|
||||
setWindowTitle(tr("Create new Profile"));
|
||||
ui.genButton->setText(tr("Generate new Profile"));
|
||||
ui.label_3->setText( titleStr.arg( tr("Create a new Profile") ) ) ;
|
||||
ui.exportIdentity_PB->hide() ;
|
||||
ui.importIdentity_PB->hide() ;
|
||||
setWindowTitle(tr("Create new Identity"));
|
||||
ui.genButton->setText(tr("Generate new Identity"));
|
||||
ui.label_3->setText( titleStr.arg( tr("Create a new Identity") ) ) ;
|
||||
} else {
|
||||
genNewGPGKey = false;
|
||||
ui.name_label->hide();
|
||||
|
@ -124,12 +129,54 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
|
|||
ui.password_input->hide();
|
||||
ui.genPGPuserlabel->show();
|
||||
ui.genPGPuser->show();
|
||||
ui.exportIdentity_PB->show() ;
|
||||
ui.importIdentity_PB->show() ;
|
||||
setWindowTitle(tr("Create new Location"));
|
||||
ui.genButton->setText(tr("Generate new Location"));
|
||||
ui.label_3->setText( titleStr.arg( tr("Create a new Location") ) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void GenCertDialog::exportIdentity()
|
||||
{
|
||||
QString fname = QFileDialog::getSaveFileName(this,tr("Export Identity"), "",tr("Retroshare Identity files (*.asc)")) ;
|
||||
|
||||
if(fname.isNull())
|
||||
return ;
|
||||
|
||||
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
|
||||
std::string gpg_id = data.toString().toStdString() ;
|
||||
|
||||
if(RsInit::exportIdentity(fname.toStdString(),gpg_id))
|
||||
QMessageBox::information(this,tr("Identity saved"),tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it")) ;
|
||||
else
|
||||
QMessageBox::information(this,tr("Identity not saved"),tr("Your identity was not saved. An error occured.")) ;
|
||||
}
|
||||
void GenCertDialog::importIdentity()
|
||||
{
|
||||
QString fname = QFileDialog::getSaveFileName(this,tr("Export Identity"), "",tr("Retroshare Identity files (*.asc)")) ;
|
||||
|
||||
if(fname.isNull())
|
||||
return ;
|
||||
|
||||
std::string gpg_id ;
|
||||
|
||||
if(!RsInit::importIdentity(fname.toStdString(),gpg_id))
|
||||
{
|
||||
QMessageBox::information(this,tr("Identity not loaded"),tr("Your identity was not loaded properly. \nCheck that it is a valid GPG key pair.")) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
std::string name,email ;
|
||||
|
||||
RsInit::GetPGPLoginDetails(gpg_id, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl;
|
||||
QVariant userData(QString::fromStdString(gpg_id));
|
||||
QString gid = QString::fromStdString(gpg_id).right(8) ;
|
||||
ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
|
||||
|
||||
}
|
||||
|
||||
void GenCertDialog::genPerson()
|
||||
{
|
||||
/* Check the data from the GUI. */
|
||||
|
|
|
@ -42,6 +42,8 @@ private slots:
|
|||
void genPerson();
|
||||
//void loadPerson();
|
||||
void selectFriend();
|
||||
void importIdentity();
|
||||
void exportIdentity();
|
||||
void checkChanged(int i);
|
||||
void infodlg();
|
||||
void newGPGKeyGenUiSetup();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>480</height>
|
||||
<width>684</width>
|
||||
<height>517</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -593,8 +593,8 @@ border: 1px solid #CCCCCC;}</string>
|
|||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="no_gpg_key_label">
|
||||
<property name="text">
|
||||
<string>It looks like you don't own any Profile (GPG keys). Please fill in the form below to generate one, or use your favorite gnupg key manager.</string>
|
||||
|
@ -604,36 +604,67 @@ border: 1px solid #CCCCCC;}</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="new_gpg_key_checkbox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Your profile is associated to a GPG key</string>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate a new Profile</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/contact_new128.png</normaloff>:/images/contact_new128.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<property name="textVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="new_gpg_key_checkbox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Your profile is associated to a GPG key</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate a new identity</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/contact_new128.png</normaloff>:/images/contact_new128.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="importIdentity_PB">
|
||||
<property name="text">
|
||||
<string>Import new identity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="exportIdentity_PB">
|
||||
<property name="text">
|
||||
<string>Export selected identity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="progress_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
@ -646,12 +677,12 @@ border: 1px solid #CCCCCC;}</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="genPGPuserlabel">
|
||||
<property name="text">
|
||||
<string>Use Profile</string>
|
||||
<string>Use identity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -737,7 +768,7 @@ anonymous, you can use a fake email.</string>
|
|||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Put a meaningfull location. ex : home, laptop, etc. This field will be used to differentiate different installations with the same profile (gpg key).</string>
|
||||
<string>Put a meaningfull location. ex : home, laptop, etc. This field will be used to differentiate different installations with the same identity (gpg key).</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
|
@ -749,32 +780,6 @@ anonymous, you can use a fake email.</string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -789,7 +794,7 @@ anonymous, you can use a fake email.</string>
|
|||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate New Profile</string>
|
||||
<string>Generate New Identity</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
|
@ -850,8 +855,8 @@ anonymous, you can use a fake email.</string>
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
|
@ -870,30 +875,37 @@ anonymous, you can use a fake email.</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><!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:'Arial'; font-size:16pt; color:#ffffff;">Create a new Profile</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
</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;"><span style=" font-family:'Arial'; font-size:16pt; color:#ffffff;">Create a new Identity</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><!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;">
|
||||
</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;"><span style=" font-family:'Arial'; font-size:8pt; font-weight:600;">RetroShare uses gpg keys for identity management. </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:'Arial'; font-size:8pt; font-weight:600;"></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:'Arial'; font-size:8pt; font-weight:600;">You can use an existing profile (gpg key), or create a new one with this form.</span></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:'Arial'; font-size:8pt; font-weight:600;">You can install retroshare on different locations using the same profile (gpg key).</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<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:'Arial'; font-size:8pt; font-weight:600;">You can use an existing identity (i.e. a gpg key pair), from the list below, or create a new </span></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:'Arial'; font-size:8pt; font-weight:600;">one with this form.</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:'MS Shell Dlg 2'; font-size:8pt;"></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:'Arial'; font-size:8pt; font-weight:600;">You can install retroshare on different locations using the same identity. For this, just export the</span></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:'Arial'; font-size:8pt; font-weight:600;"> selected identity, and import it on the new computer, then create a new location with it.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue