mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-02 03:16:18 -05:00
GUI side of the v0.5.0 modifications.
* Changes to startup / login function to handle multiple accounts. * Switched on OpenPGP version by default. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1452 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a023a0bfcd
commit
246927ac46
@ -97,7 +97,7 @@ LIBS += -L"../../../../lib" -lretroshare -lminiupnpc -lssl -lcrypto
|
||||
|
||||
# ###########################################
|
||||
|
||||
LIBS += -lz #-lgpgme
|
||||
LIBS += -lz -lgpgme
|
||||
LIBS += -lQtUiTools
|
||||
|
||||
DEPENDPATH += . \
|
||||
|
@ -57,13 +57,13 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
|
||||
|
||||
std::list<std::string> pgpIds;
|
||||
std::list<std::string>::iterator it;
|
||||
if (RsInit::GetLogins(pgpIds))
|
||||
if (RsInit::GetPGPLogins(pgpIds))
|
||||
{
|
||||
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
|
||||
{
|
||||
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
||||
std::string name, email;
|
||||
RsInit::GetLoginDetails(*it, name, email);
|
||||
RsInit::GetPGPLoginDetails(*it, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
||||
ui.genPGPuser->addItem(QString::fromStdString(name), userData);
|
||||
}
|
||||
@ -171,15 +171,17 @@ void GenCertDialog::genPerson()
|
||||
|
||||
#ifdef RS_USE_PGPSSL
|
||||
/* Initialise the PGP user first */
|
||||
RsInit::LoadGPGPassword(PGPId, PGPpasswd);
|
||||
RsInit::SelectGPGAccount(PGPId);
|
||||
RsInit::LoadGPGPassword(PGPpasswd);
|
||||
#endif
|
||||
|
||||
|
||||
bool okGen = RsInit::RsGenerateCertificate(genName, genOrg, genLoc, genCountry, passwd, err);
|
||||
std::string sslId;
|
||||
bool okGen = RsInit::GenerateSSLCertificate(genName, genOrg, genLoc, genCountry, passwd, sslId, err);
|
||||
|
||||
if (okGen)
|
||||
{
|
||||
/* complete the process */
|
||||
RsInit::LoadPassword(sslId, passwd);
|
||||
loadCertificates();
|
||||
}
|
||||
else
|
||||
@ -199,6 +201,7 @@ void GenCertDialog::genPerson()
|
||||
void GenCertDialog::selectFriend()
|
||||
{
|
||||
|
||||
#if 0
|
||||
/* still need to find home (first) */
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Trusted Friend"), "",
|
||||
@ -214,11 +217,15 @@ void GenCertDialog::selectFriend()
|
||||
{
|
||||
ui.genFriend -> setText("<Invalid Selected>");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GenCertDialog::checkChanged(int i)
|
||||
{
|
||||
|
||||
#if 0
|
||||
if (i)
|
||||
{
|
||||
selectFriend();
|
||||
@ -231,6 +238,8 @@ void GenCertDialog::checkChanged(int i)
|
||||
RsInit::ValidateTrustedUser(fname, userName);
|
||||
ui.genFriend -> setText("<None Selected>");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,18 +75,52 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
|
||||
* mark last one as default.
|
||||
*/
|
||||
|
||||
std::list<std::string> accountIds;
|
||||
std::list<std::string>::iterator it;
|
||||
std::string preferedId;
|
||||
RsInit::getPreferedAccountId(preferedId);
|
||||
int pidx = -1;
|
||||
int i;
|
||||
|
||||
if (RsInit::getAccountIds(accountIds))
|
||||
{
|
||||
for(it = accountIds.begin(), i = 0; it != accountIds.end(); it++, i++)
|
||||
{
|
||||
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
||||
std::string gpgid, name, email, sslname;
|
||||
RsInit::getAccountDetails(*it, gpgid, name, email, sslname);
|
||||
QString accountName = QString::fromStdString(name);
|
||||
accountName += "/";
|
||||
accountName += QString::fromStdString(sslname);
|
||||
ui.loadName->addItem(accountName, userData);
|
||||
|
||||
if (preferedId == *it)
|
||||
{
|
||||
pidx = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pidx > 0)
|
||||
{
|
||||
ui.loadName->setCurrentIndex(pidx);
|
||||
}
|
||||
|
||||
#if 0
|
||||
std::list<std::string> pgpIds;
|
||||
std::list<std::string>::iterator it;
|
||||
if (RsInit::GetLogins(pgpIds))
|
||||
if (RsInit::GetPGPLogins(pgpIds))
|
||||
{
|
||||
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
|
||||
{
|
||||
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
||||
std::string name, email;
|
||||
RsInit::GetLoginDetails(*it, name, email);
|
||||
RsInit::GetPGPLoginDetails(*it, name, email);
|
||||
ui.loadName->addItem(QString::fromStdString(name), userData);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
if (RsInit::ValidateCertificate(userName))
|
||||
@ -146,6 +180,7 @@ void StartDialog::closeinfodlg()
|
||||
|
||||
void StartDialog::loadPerson()
|
||||
{
|
||||
std::string accountId = "";
|
||||
std::string passwd = ui.loadPasswd->text().toStdString();
|
||||
#ifdef RS_USE_PGPSSL
|
||||
|
||||
@ -162,12 +197,18 @@ void StartDialog::loadPerson()
|
||||
}
|
||||
|
||||
QVariant data = ui.loadName->itemData(pgpidx);
|
||||
std::string PGPId = (data.toString()).toStdString();
|
||||
accountId = (data.toString()).toStdString();
|
||||
|
||||
RsInit::LoadGPGPassword(PGPId, gpgPasswd);
|
||||
std::string gpgId, gpgName, gpgEmail, sslName;
|
||||
if (RsInit::getAccountDetails(accountId,
|
||||
gpgId, gpgName, gpgEmail, sslName))
|
||||
{
|
||||
RsInit::SelectGPGAccount(gpgId);
|
||||
RsInit::LoadGPGPassword(gpgPasswd);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
RsInit::LoadPassword(passwd);
|
||||
RsInit::LoadPassword(accountId, passwd);
|
||||
loadCertificates();
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,13 @@
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
#include <QString>
|
||||
/***
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
***/
|
||||
|
||||
//! a base class for plugins
|
||||
|
||||
|
@ -39,9 +39,6 @@
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/notifyqt.h"
|
||||
|
||||
RsIface *rsiface = NULL;
|
||||
RsControl *rsicontrol = NULL;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@ -64,7 +61,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Setup The GUI Stuff */
|
||||
Rshare rshare(args, argc, argv,
|
||||
QString(RsInit::RsConfigDirectory()));
|
||||
QString::fromStdString(RsInit::RsConfigDirectory()));
|
||||
|
||||
/* Login Dialog */
|
||||
if (!okStart)
|
||||
@ -74,7 +71,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
StartDialog *sd = NULL;
|
||||
bool genCert = false;
|
||||
if (RsInit::ValidateCertificate(userName))
|
||||
std::list<std::string> accountIds;
|
||||
if (RsInit::getAccountIds(accountIds) && (accountIds.size() > 0))
|
||||
{
|
||||
sd = new StartDialog();
|
||||
sd->show();
|
||||
@ -121,37 +119,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
NotifyQt *notify = new NotifyQt();
|
||||
RsIface *iface = createRsIface(*notify);
|
||||
RsControl *rsServer = createRsControl(*iface, *notify);
|
||||
createRsIface(*notify);
|
||||
createRsControl(*rsiface, *notify);
|
||||
|
||||
|
||||
/* save to the global variables */
|
||||
rsiface = iface;
|
||||
rsicontrol = rsServer;
|
||||
|
||||
rsServer->StartupRetroShare();
|
||||
RsInit::passwd="" ;
|
||||
// CleanupRsConfig(config);
|
||||
rsicontrol->StartupRetroShare();
|
||||
|
||||
MainWindow *w = new MainWindow;
|
||||
//QMainWindow *skinWindow = new QMainWindow();
|
||||
|
||||
//skinWindow->resize(w->size().width()+15,w->size().width()+15);
|
||||
//skinWindow->setWindowTitle(w->windowTitle());
|
||||
//skinWindow->setCentralWidget(w);
|
||||
|
||||
/* Attach the Dialogs, to the Notify Class */
|
||||
// Not needed anymore since the notify class is directly connected by Qt signals/slots to the correct widgets below.
|
||||
//
|
||||
// notify->setRsIface(iface);
|
||||
// notify->setNetworkDialog(w->networkDialog);
|
||||
// notify->setPeersDialog(w->peersDialog);
|
||||
// notify->setDirDialog(w->sharedfilesDialog);
|
||||
// notify->setTransfersDialog(w->transfersDialog);
|
||||
// notify->setChatDialog(w->chatDialog);
|
||||
// notify->setMessagesDialog(w->messagesDialog);
|
||||
// notify->setChannelsDialog(w->channelsDialog);
|
||||
// notify->setMessengerWindow(w->messengerWindow);
|
||||
|
||||
// I'm using a signal to transfer the hashing info to the mainwindow, because Qt schedules signals properly to
|
||||
// avoid clashes between infos from threads.
|
||||
@ -187,13 +160,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
w->show();
|
||||
//skinWindow->show();
|
||||
|
||||
}
|
||||
|
||||
/* Run Retroshare */
|
||||
//int ret = rshare.run();
|
||||
|
||||
/* Startup a Timer to keep the gui's updated */
|
||||
QTimer *timer = new QTimer(w);
|
||||
timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI()));
|
||||
|
@ -1,78 +1,104 @@
|
||||
#ifndef RETROSHARE_INIT_INTERFACE_H
|
||||
#define RETROSHARE_INIT_INTERFACE_H
|
||||
|
||||
/*
|
||||
* "$Id: rsiface.h,v 1.9 2007-04-21 19:08:51 rmf24 Exp $"
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2004-2006 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* Initialisation Class (not publicly disclosed to RsIFace) */
|
||||
|
||||
/****
|
||||
* #define RS_USE_PGPSSL 1
|
||||
***/
|
||||
|
||||
#define RS_USE_PGPSSL 1
|
||||
|
||||
class RsInit
|
||||
{
|
||||
public:
|
||||
/* Commandline/Directory options */
|
||||
/* reorganised RsInit system */
|
||||
|
||||
static const char *RsConfigDirectory() ;
|
||||
/* PreLogin */
|
||||
static void InitRsConfig() ;
|
||||
static int InitRetroShare(int argc, char **argv);
|
||||
|
||||
|
||||
static bool setStartMinimised() ;
|
||||
static int InitRetroShare(int argcIgnored, char **argvIgnored) ;
|
||||
static int LoadCertificates(bool autoLoginNT) ;
|
||||
/* Account Details (Combined GPG+SSL Setup) */
|
||||
static bool getPreferedAccountId(std::string &id);
|
||||
static bool getAccountIds(std::list<std::string> &ids);
|
||||
static bool getAccountDetails(std::string id,
|
||||
std::string &gpgId, std::string &gpgName,
|
||||
std::string &gpgEmail, std::string &sslName);
|
||||
|
||||
static bool ValidateCertificate(std::string &userName) ;
|
||||
static bool ValidateTrustedUser(std::string fname, std::string &userName) ;
|
||||
static bool LoadPassword(std::string passwd) ;
|
||||
static bool RsGenerateCertificate(std::string name, std::string org, std::string loc, std::string country, std::string passwd, std::string &errString);
|
||||
static void load_check_basedir() ;
|
||||
static int create_configinit() ;
|
||||
|
||||
|
||||
/* Generating GPGme Account */
|
||||
static int GetPGPLogins(std::list<std::string> &pgpIds);
|
||||
static int GetPGPLoginDetails(std::string id, std::string &name, std::string &email);
|
||||
static bool GeneratePGPCertificate(std::string name, std::string comment, std::string email, std::string passwd, std::string &pgpId, std::string &errString);
|
||||
|
||||
/* Login PGP */
|
||||
static bool SelectGPGAccount(std::string id);
|
||||
static bool LoadGPGPassword(std::string passwd);
|
||||
|
||||
/* Create SSL Certificates */
|
||||
static bool GenerateSSLCertificate(std::string name, std::string org, std::string loc, std::string country, std::string passwd, std::string &sslId, std::string &errString);
|
||||
|
||||
/* Login SSL */
|
||||
static bool LoadPassword(std::string id, std::string passwd) ;
|
||||
|
||||
/* Final Certificate load. This can be called if:
|
||||
* a) InitRetroshare() returns true -> autoLoad/password Set.
|
||||
* b) SelectGPGAccount() && LoadPassword()
|
||||
*/
|
||||
static int LoadCertificates(bool autoLoginNT) ;
|
||||
|
||||
|
||||
/* Post Login Options */
|
||||
static std::string RsConfigDirectory();
|
||||
static bool setStartMinimised() ;
|
||||
|
||||
|
||||
private:
|
||||
/* PreLogin */
|
||||
static std::string getHomePath() ;
|
||||
static void setupBaseDir();
|
||||
|
||||
/* Account Details */
|
||||
static bool get_configinit(std::string dir, std::string &id);
|
||||
static bool create_configinit(std::string dir, std::string id);
|
||||
|
||||
static bool setupAccount(std::string accountdir);
|
||||
|
||||
/* Auto Login */
|
||||
static bool RsStoreAutoLogin() ;
|
||||
static bool RsTryAutoLogin() ;
|
||||
static bool RsClearAutoLogin(std::string basedir) ;
|
||||
static void InitRsConfig() ;
|
||||
static bool RsClearAutoLogin() ;
|
||||
|
||||
static std::string getHomePath() ;
|
||||
|
||||
/* PGPSSL init functions */
|
||||
|
||||
#ifdef RS_USE_PGPSSL
|
||||
static bool LoadGPGPassword(std::string id, std::string passwd);
|
||||
static int GetLogins(std::list<std::string> &pgpIds);
|
||||
static int GetLoginDetails(std::string id, std::string &name, std::string &email);
|
||||
|
||||
static std::string gpgPasswd;
|
||||
#endif
|
||||
|
||||
/* Key Parameters that must be set before
|
||||
* RetroShare will start up:
|
||||
*/
|
||||
static std::string load_cert;
|
||||
static std::string load_key;
|
||||
static std::string passwd;
|
||||
|
||||
static bool havePasswd; /* for Commandline password */
|
||||
static bool autoLogin; /* autoLogin allowed */
|
||||
static bool startMinimised; /* Icon or Full Window */
|
||||
|
||||
/* Win/Unix Differences */
|
||||
static char dirSeperator;
|
||||
|
||||
/* Directories */
|
||||
static std::string basedir;
|
||||
static std::string homePath;
|
||||
|
||||
/* Listening Port */
|
||||
static bool forceExtPort;
|
||||
static bool forceLocalAddr;
|
||||
static unsigned short port;
|
||||
static char inet[256];
|
||||
|
||||
/* Logging */
|
||||
static bool haveLogFile;
|
||||
static bool outStderr;
|
||||
static bool haveDebugLevel;
|
||||
static int debugLevel;
|
||||
static char logfname[1024];
|
||||
|
||||
static bool firsttime_run;
|
||||
static bool load_trustedpeer;
|
||||
static std::string load_trustedpeer_file;
|
||||
|
||||
static bool udpListenerOnly;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -128,6 +128,7 @@ class RsConfig
|
||||
|
||||
int maxDownloadDataRate; /* kb */
|
||||
int maxUploadDataRate; /* kb */
|
||||
int maxIndivDataRate; /* kb */
|
||||
|
||||
int promptAtBoot; /* popup the password prompt */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user