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:
defnax 2009-08-04 23:37:01 +00:00
parent 2bf94b909a
commit 01935af39b
7 changed files with 532 additions and 560 deletions

View File

@ -21,7 +21,7 @@
#include <rshare.h>
#include <rsiface/rsinit.h>
#include <rsiface/rsinit.h>
#include "GenCertDialog.h"
#include "gui/Preferences/rsharesettings.h"
#include <QFileDialog>
@ -32,7 +32,6 @@
#define DATETIME_FMT "MMM dd hh:mm:ss"
/** Default constructor */
GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags 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.selectButton, SIGNAL(clicked()), this, SLOT(selectFriend()));
connect(ui.friendBox, SIGNAL(stateChanged(int)), this, SLOT(checkChanged(int)));
//connect(ui.selectButton, SIGNAL(clicked()), this, SLOT(selectFriend()));
//connect(ui.friendBox, SIGNAL(stateChanged(int)), this, SLOT(checkChanged(int)));
ui.genName->setFocus(Qt::OtherFocusReason);
#ifdef RS_USE_PGPSSL
/* get all available pgp private certificates....
* mark last one as default.
*/
std::cerr << "Finding PGPUsers" << std::endl;
std::list<std::string> pgpIds;
std::list<std::string>::iterator it;
if (RsInit::GetPGPLogins(pgpIds))
{
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
{
const QVariant & userData = QVariant(QString::fromStdString(*it));
std::string name, email;
RsInit::GetPGPLoginDetails(*it, name, email);
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
ui.genPGPuser->addItem(QString::fromStdString(name), userData);
}
}
#endif
#ifdef RS_USE_PGPSSL
/* get all available pgp private certificates....
* mark last one as default.
*/
std::cerr << "Finding PGPUsers" << std::endl;
std::list<std::string> pgpIds;
std::list<std::string>::iterator it;
if (RsInit::GetPGPLogins(pgpIds))
{
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
{
const QVariant & userData = QVariant(QString::fromStdString(*it));
std::string name, email;
RsInit::GetPGPLoginDetails(*it, name, email);
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
ui.genPGPuser->addItem(QString::fromStdString(name), userData);
}
}
#endif
}
/** Destructor. */
//GenCertDialog::~GenCertDialog()
//{
//}
/** Destructor. */
//GenCertDialog::~GenCertDialog()
//{
//}
/**
@ -114,28 +113,28 @@ void GenCertDialog::genPerson()
std::string passwd = ui.genPasswd->text().toStdString();
std::string passwd2 = ui.genPasswd2->text().toStdString();
std::string err;
#ifdef RS_USE_PGPSSL
#ifdef RS_USE_PGPSSL
std::string PGPpasswd = ui.genPGPpassword->text().toStdString();
int pgpidx = ui.genPGPuser->currentIndex();
if (pgpidx < 0)
{
/* Message Dialog */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Missing PGP Certificate",
QMessageBox::Ok);
return;
}
QVariant data = ui.genPGPuser->itemData(pgpidx);
std::string PGPId = (data.toString()).toStdString();
#endif
int pgpidx = ui.genPGPuser->currentIndex();
if (pgpidx < 0)
{
/* Message Dialog */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Missing PGP Certificate",
QMessageBox::Ok);
return;
}
QVariant data = ui.genPGPuser->itemData(pgpidx);
std::string PGPId = (data.toString()).toStdString();
#endif
if (genName.length() >= 3)
{
/* name passes basic test */
@ -143,10 +142,10 @@ void GenCertDialog::genPerson()
else
{
/* Message Dialog */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Your Name is too short (3+ characters)",
QMessageBox::Ok);
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Your Name is too short (3+ characters)",
QMessageBox::Ok);
return;
}
@ -157,40 +156,40 @@ void GenCertDialog::genPerson()
else
{
/* Message Dialog */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Your password is too short, or don't match",
QMessageBox::Ok);
ui.genPasswd->setText("");
ui.genPasswd2->setText("");
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Your password is too short, or don't match",
QMessageBox::Ok);
ui.genPasswd->setText("");
ui.genPasswd2->setText("");
return;
}
#ifdef RS_USE_PGPSSL
/* Initialise the PGP user first */
RsInit::SelectGPGAccount(PGPId);
RsInit::LoadGPGPassword(PGPpasswd);
#endif
std::string sslId;
#ifdef RS_USE_PGPSSL
/* Initialise the PGP user first */
RsInit::SelectGPGAccount(PGPId);
RsInit::LoadGPGPassword(PGPpasswd);
#endif
std::string sslId;
bool okGen = RsInit::GenerateSSLCertificate(genName, genOrg, genLoc, genCountry, passwd, sslId, err);
if (okGen)
{
/* complete the process */
RsInit::LoadPassword(sslId, passwd);
RsInit::LoadPassword(sslId, passwd);
loadCertificates();
}
else
{
/* Message Dialog */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Failed to Generate your new Certificate!",
QMessageBox::Ok);
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Failed to Generate your new Certificate!",
QMessageBox::Ok);
}
}
@ -200,8 +199,8 @@ void GenCertDialog::genPerson()
void GenCertDialog::selectFriend()
{
#if 0
#if 0
/* still need to find home (first) */
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Trusted Friend"), "",
@ -217,15 +216,15 @@ void GenCertDialog::selectFriend()
{
ui.genFriend -> setText("<Invalid Selected>");
}
#endif
#endif
}
void GenCertDialog::checkChanged(int i)
{
#if 0
#if 0
if (i)
{
selectFriend();
@ -238,26 +237,26 @@ void GenCertDialog::checkChanged(int i)
RsInit::ValidateTrustedUser(fname, userName);
ui.genFriend -> setText("<None Selected>");
}
#endif
}
void GenCertDialog::loadCertificates()
{
bool autoSave = false;
/* Final stage of loading */
if (RsInit::LoadCertificates(autoSave))
{
close();
}
else
{
/* some error msg */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Failed to Load your new Certificate!",
QMessageBox::Ok);
}
}
#endif
}
void GenCertDialog::loadCertificates()
{
bool autoSave = false;
/* Final stage of loading */
if (RsInit::LoadCertificates(autoSave))
{
close();
}
else
{
/* some error msg */
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
"Generate ID Failure",
"Failed to Load your new Certificate!",
QMessageBox::Ok);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
#include "NetworkView.h"
#include "TrustView.h"
#include "connect/ConnectDialog.h"
#include "GenCertDialog.h"
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
@ -140,7 +141,8 @@ NetworkDialog::NetworkDialog(QWidget *parent)
QMenu *menu = new QMenu(tr("Menu"));
menu->addAction(ui.actionAddFriend);
//menu->addAction(ui.actionCopyKey);
menu->addAction(ui.actionExportKey);
menu->addAction(ui.actionExportKey);
menu->addAction(ui.actionCreate_New_Profile);
menu->addSeparator();
menu->addAction(ui.actionTabsright);
menu->addAction(ui.actionTabswest);
@ -702,6 +704,14 @@ void NetworkDialog::on_actionClearLog_triggered() {
ui.infoLog->clear();
}
void NetworkDialog::on_actionCreate_New_Profile_activated()
{
static GenCertDialog *gencertdialog = new GenCertDialog();
gencertdialog->show();
}
void NetworkDialog::displayInfoLogMenu(const QPoint& pos) {
// Log Menu
QMenu myLogMenu(this);

View File

@ -72,6 +72,9 @@ private slots:
void on_actionAddFriend_activated();
//void on_actionCopyKey_activated();
void on_actionExportKey_activated();
void on_actionCreate_New_Profile_activated();
void on_actionClearLog_triggered();
void displayInfoLogMenu(const QPoint& pos);

View File

@ -554,6 +554,14 @@ p, li { white-space: pre-wrap; }
<string>Export My Key</string>
</property>
</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>
<resources>
<include location="images.qrc"/>

View File

@ -240,8 +240,8 @@ void StartDialog::createnewaccount()
//gencertdialog->show();
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
"Create New Certificate",
"This will delete your existing Certificate\n Are you sure you want to continue",
"Create a New Profil",
"This will generate a new Profile\n Are you sure you want to continue",
(QMessageBox::Ok | QMessageBox::No));
if (sb == QMessageBox::Ok)

View File

@ -600,10 +600,10 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;You can login with your Default&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;RetroShare profile.&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;&quot;&gt;You have a Profile?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;You can login with your&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;RetroShare profile.&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;You want a new Profile?&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>