mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-05 21:04:14 -04:00
added for Network menu Create new Profile action to can generate more Profiles without need to run Login Window.
disabled from Profile Generator Dialog not used the optional Cert loading sections. fixed startdialogs layout git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1493 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2bf94b909a
commit
01935af39b
7 changed files with 532 additions and 560 deletions
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <rshare.h>
|
#include <rshare.h>
|
||||||
#include <rsiface/rsinit.h>
|
#include <rsiface/rsinit.h>
|
||||||
#include "GenCertDialog.h"
|
#include "GenCertDialog.h"
|
||||||
#include "gui/Preferences/rsharesettings.h"
|
#include "gui/Preferences/rsharesettings.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -32,7 +32,6 @@
|
||||||
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
#define DATETIME_FMT "MMM dd hh:mm:ss"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
||||||
: QDialog(parent, flags)
|
: QDialog(parent, flags)
|
||||||
|
@ -44,39 +43,39 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
||||||
|
|
||||||
|
|
||||||
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
|
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
|
||||||
connect(ui.selectButton, SIGNAL(clicked()), this, SLOT(selectFriend()));
|
//connect(ui.selectButton, SIGNAL(clicked()), this, SLOT(selectFriend()));
|
||||||
connect(ui.friendBox, SIGNAL(stateChanged(int)), this, SLOT(checkChanged(int)));
|
//connect(ui.friendBox, SIGNAL(stateChanged(int)), this, SLOT(checkChanged(int)));
|
||||||
|
|
||||||
ui.genName->setFocus(Qt::OtherFocusReason);
|
ui.genName->setFocus(Qt::OtherFocusReason);
|
||||||
|
|
||||||
#ifdef RS_USE_PGPSSL
|
#ifdef RS_USE_PGPSSL
|
||||||
/* get all available pgp private certificates....
|
/* get all available pgp private certificates....
|
||||||
* mark last one as default.
|
* mark last one as default.
|
||||||
*/
|
*/
|
||||||
std::cerr << "Finding PGPUsers" << std::endl;
|
std::cerr << "Finding PGPUsers" << std::endl;
|
||||||
|
|
||||||
std::list<std::string> pgpIds;
|
std::list<std::string> pgpIds;
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
if (RsInit::GetPGPLogins(pgpIds))
|
if (RsInit::GetPGPLogins(pgpIds))
|
||||||
{
|
{
|
||||||
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
|
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
|
||||||
{
|
{
|
||||||
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
||||||
std::string name, email;
|
std::string name, email;
|
||||||
RsInit::GetPGPLoginDetails(*it, name, email);
|
RsInit::GetPGPLoginDetails(*it, name, email);
|
||||||
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
||||||
ui.genPGPuser->addItem(QString::fromStdString(name), userData);
|
ui.genPGPuser->addItem(QString::fromStdString(name), userData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
//GenCertDialog::~GenCertDialog()
|
//GenCertDialog::~GenCertDialog()
|
||||||
//{
|
//{
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,28 +113,28 @@ void GenCertDialog::genPerson()
|
||||||
std::string passwd = ui.genPasswd->text().toStdString();
|
std::string passwd = ui.genPasswd->text().toStdString();
|
||||||
std::string passwd2 = ui.genPasswd2->text().toStdString();
|
std::string passwd2 = ui.genPasswd2->text().toStdString();
|
||||||
std::string err;
|
std::string err;
|
||||||
|
|
||||||
|
|
||||||
#ifdef RS_USE_PGPSSL
|
#ifdef RS_USE_PGPSSL
|
||||||
|
|
||||||
std::string PGPpasswd = ui.genPGPpassword->text().toStdString();
|
std::string PGPpasswd = ui.genPGPpassword->text().toStdString();
|
||||||
int pgpidx = ui.genPGPuser->currentIndex();
|
int pgpidx = ui.genPGPuser->currentIndex();
|
||||||
if (pgpidx < 0)
|
if (pgpidx < 0)
|
||||||
{
|
{
|
||||||
/* Message Dialog */
|
/* Message Dialog */
|
||||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||||
"Generate ID Failure",
|
"Generate ID Failure",
|
||||||
"Missing PGP Certificate",
|
"Missing PGP Certificate",
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant data = ui.genPGPuser->itemData(pgpidx);
|
QVariant data = ui.genPGPuser->itemData(pgpidx);
|
||||||
std::string PGPId = (data.toString()).toStdString();
|
std::string PGPId = (data.toString()).toStdString();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (genName.length() >= 3)
|
if (genName.length() >= 3)
|
||||||
{
|
{
|
||||||
/* name passes basic test */
|
/* name passes basic test */
|
||||||
|
@ -143,10 +142,10 @@ void GenCertDialog::genPerson()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Message Dialog */
|
/* Message Dialog */
|
||||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||||
"Generate ID Failure",
|
"Generate ID Failure",
|
||||||
"Your Name is too short (3+ characters)",
|
"Your Name is too short (3+ characters)",
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,40 +156,40 @@ void GenCertDialog::genPerson()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Message Dialog */
|
/* Message Dialog */
|
||||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||||
"Generate ID Failure",
|
"Generate ID Failure",
|
||||||
"Your password is too short, or don't match",
|
"Your password is too short, or don't match",
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
|
||||||
ui.genPasswd->setText("");
|
ui.genPasswd->setText("");
|
||||||
ui.genPasswd2->setText("");
|
ui.genPasswd2->setText("");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef RS_USE_PGPSSL
|
#ifdef RS_USE_PGPSSL
|
||||||
/* Initialise the PGP user first */
|
/* Initialise the PGP user first */
|
||||||
RsInit::SelectGPGAccount(PGPId);
|
RsInit::SelectGPGAccount(PGPId);
|
||||||
RsInit::LoadGPGPassword(PGPpasswd);
|
RsInit::LoadGPGPassword(PGPpasswd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string sslId;
|
std::string sslId;
|
||||||
bool okGen = RsInit::GenerateSSLCertificate(genName, genOrg, genLoc, genCountry, passwd, sslId, err);
|
bool okGen = RsInit::GenerateSSLCertificate(genName, genOrg, genLoc, genCountry, passwd, sslId, err);
|
||||||
|
|
||||||
if (okGen)
|
if (okGen)
|
||||||
{
|
{
|
||||||
/* complete the process */
|
/* complete the process */
|
||||||
RsInit::LoadPassword(sslId, passwd);
|
RsInit::LoadPassword(sslId, passwd);
|
||||||
loadCertificates();
|
loadCertificates();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Message Dialog */
|
/* Message Dialog */
|
||||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||||
"Generate ID Failure",
|
"Generate ID Failure",
|
||||||
"Failed to Generate your new Certificate!",
|
"Failed to Generate your new Certificate!",
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +199,8 @@ void GenCertDialog::genPerson()
|
||||||
|
|
||||||
void GenCertDialog::selectFriend()
|
void GenCertDialog::selectFriend()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* still need to find home (first) */
|
/* still need to find home (first) */
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Trusted Friend"), "",
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Trusted Friend"), "",
|
||||||
|
@ -217,15 +216,15 @@ void GenCertDialog::selectFriend()
|
||||||
{
|
{
|
||||||
ui.genFriend -> setText("<Invalid Selected>");
|
ui.genFriend -> setText("<Invalid Selected>");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GenCertDialog::checkChanged(int i)
|
void GenCertDialog::checkChanged(int i)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (i)
|
if (i)
|
||||||
{
|
{
|
||||||
selectFriend();
|
selectFriend();
|
||||||
|
@ -238,26 +237,26 @@ void GenCertDialog::checkChanged(int i)
|
||||||
RsInit::ValidateTrustedUser(fname, userName);
|
RsInit::ValidateTrustedUser(fname, userName);
|
||||||
ui.genFriend -> setText("<None Selected>");
|
ui.genFriend -> setText("<None Selected>");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GenCertDialog::loadCertificates()
|
void GenCertDialog::loadCertificates()
|
||||||
{
|
{
|
||||||
bool autoSave = false;
|
bool autoSave = false;
|
||||||
/* Final stage of loading */
|
/* Final stage of loading */
|
||||||
if (RsInit::LoadCertificates(autoSave))
|
if (RsInit::LoadCertificates(autoSave))
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* some error msg */
|
/* some error msg */
|
||||||
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||||
"Generate ID Failure",
|
"Generate ID Failure",
|
||||||
"Failed to Load your new Certificate!",
|
"Failed to Load your new Certificate!",
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@
|
||||||
#include "NetworkView.h"
|
#include "NetworkView.h"
|
||||||
#include "TrustView.h"
|
#include "TrustView.h"
|
||||||
#include "connect/ConnectDialog.h"
|
#include "connect/ConnectDialog.h"
|
||||||
|
#include "GenCertDialog.h"
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
|
@ -140,7 +141,8 @@ NetworkDialog::NetworkDialog(QWidget *parent)
|
||||||
QMenu *menu = new QMenu(tr("Menu"));
|
QMenu *menu = new QMenu(tr("Menu"));
|
||||||
menu->addAction(ui.actionAddFriend);
|
menu->addAction(ui.actionAddFriend);
|
||||||
//menu->addAction(ui.actionCopyKey);
|
//menu->addAction(ui.actionCopyKey);
|
||||||
menu->addAction(ui.actionExportKey);
|
menu->addAction(ui.actionExportKey);
|
||||||
|
menu->addAction(ui.actionCreate_New_Profile);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(ui.actionTabsright);
|
menu->addAction(ui.actionTabsright);
|
||||||
menu->addAction(ui.actionTabswest);
|
menu->addAction(ui.actionTabswest);
|
||||||
|
@ -702,6 +704,14 @@ void NetworkDialog::on_actionClearLog_triggered() {
|
||||||
ui.infoLog->clear();
|
ui.infoLog->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkDialog::on_actionCreate_New_Profile_activated()
|
||||||
|
{
|
||||||
|
static GenCertDialog *gencertdialog = new GenCertDialog();
|
||||||
|
gencertdialog->show();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkDialog::displayInfoLogMenu(const QPoint& pos) {
|
void NetworkDialog::displayInfoLogMenu(const QPoint& pos) {
|
||||||
// Log Menu
|
// Log Menu
|
||||||
QMenu myLogMenu(this);
|
QMenu myLogMenu(this);
|
||||||
|
|
|
@ -72,6 +72,9 @@ private slots:
|
||||||
void on_actionAddFriend_activated();
|
void on_actionAddFriend_activated();
|
||||||
//void on_actionCopyKey_activated();
|
//void on_actionCopyKey_activated();
|
||||||
void on_actionExportKey_activated();
|
void on_actionExportKey_activated();
|
||||||
|
|
||||||
|
void on_actionCreate_New_Profile_activated();
|
||||||
|
|
||||||
|
|
||||||
void on_actionClearLog_triggered();
|
void on_actionClearLog_triggered();
|
||||||
void displayInfoLogMenu(const QPoint& pos);
|
void displayInfoLogMenu(const QPoint& pos);
|
||||||
|
|
|
@ -554,6 +554,14 @@ p, li { white-space: pre-wrap; }
|
||||||
<string>Export My Key</string>
|
<string>Export My Key</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCreate_New_Profile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create New Profile</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create a new Profile</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc"/>
|
<include location="images.qrc"/>
|
||||||
|
|
|
@ -240,8 +240,8 @@ void StartDialog::createnewaccount()
|
||||||
//gencertdialog->show();
|
//gencertdialog->show();
|
||||||
|
|
||||||
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
||||||
"Create New Certificate",
|
"Create a New Profil",
|
||||||
"This will delete your existing Certificate\n Are you sure you want to continue",
|
"This will generate a new Profile\n Are you sure you want to continue",
|
||||||
(QMessageBox::Ok | QMessageBox::No));
|
(QMessageBox::Ok | QMessageBox::No));
|
||||||
|
|
||||||
if (sb == QMessageBox::Ok)
|
if (sb == QMessageBox::Ok)
|
||||||
|
|
|
@ -600,10 +600,10 @@ p, li { white-space: pre-wrap; }
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<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">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
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:'DejaVu Sans'; font-size:9pt; 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; font-size:8pt;"><span style=" font-size:10pt;">You can login with your Default</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:'MS Shell Dlg 2'; font-size:10pt;">You can login with your</span></p>
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;">RetroShare profile.</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:'MS Shell Dlg 2'; font-size:10pt;">RetroShare profile.</span></p>
|
||||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;">You have a Profile?</p></body></html></string>
|
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">You want a new Profile?</span></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue