Cleaned some ui files.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5457 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-08-22 13:44:23 +00:00
parent 28def71b4e
commit 70cbd3c84d
55 changed files with 628 additions and 12087 deletions

View file

@ -23,44 +23,28 @@
#include <retroshare/rsinit.h>
#include "StartDialog.h"
#include "LogoBar.h"
#include <QFileDialog>
#include <QMessageBox>
#include "util/Widget.h"
#include "settings/rsharesettings.h"
/* Define the format used for displaying the date and time */
#define DATETIME_FMT "MMM dd hh:mm:ss"
#include <iostream>
/** Default constructor */
StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags), reqNewCert(false)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
/* Create Bandwidth Graph related QObjects */
Settings->loadWidgetInformation(this);
_rsLogoBar = NULL;
//LogoBar
_rsLogoBar = new LogoBar(ui.callBarFrame);
Widget::createLayout(ui.callBarFrame)->addWidget(_rsLogoBar);
ui.loadButton->setFocus();
Settings->loadWidgetInformation(this);
ui.loadButton->setFocus();
connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
connect(ui.autologin_checkbox, SIGNAL(clicked()), this, SLOT(notSecureWarning()));
/* load the Certificate File name */
std::string userName;
connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
connect(ui.autologin_checkbox, SIGNAL(clicked()), this, SLOT(notSecureWarning()));
/* get all available pgp private certificates....
* mark last one as default.
*/
* mark last one as default.
*/
std::list<std::string> accountIds;
std::list<std::string>::iterator it;
std::string preferedId;
@ -73,10 +57,10 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
for(it = accountIds.begin(), i = 0; it != accountIds.end(); it++, i++)
{
const QVariant & userData = QVariant(QString::fromStdString(*it));
std::string gpgid, name, email, location;
RsInit::getAccountDetails(*it, gpgid, name, email, location);
QString accountName = QString::fromUtf8(name.c_str()) + " (" + QString::fromStdString(gpgid).right(8) + ") - " + QString::fromUtf8(location.c_str());
ui.loadName->addItem(accountName, userData);
std::string gpgid, name, email, location;
RsInit::getAccountDetails(*it, gpgid, name, email, location);
QString accountName = QString::fromUtf8(name.c_str()) + " (" + QString::fromStdString(gpgid).right(8) + ") - " + QString::fromUtf8(location.c_str());
ui.loadName->addItem(accountName, userData);
if (preferedId == *it)
{
@ -91,106 +75,75 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
}
}
/**
Overloads the default show() slot so we can set opacity*/
void StartDialog::show()
{
//loadSettings();
if(!this->isVisible()) {
QMainWindow::show();
}
}
void StartDialog::closeEvent (QCloseEvent * event)
{
Settings->saveWidgetInformation(this);
Settings->saveWidgetInformation(this);
QWidget::closeEvent(event);
QWidget::closeEvent(event);
}
void StartDialog::closeinfodlg()
{
close();
}
void StartDialog::loadPerson()
{
std::string accountId = "";
std::string accountId = "";
int pgpidx = ui.loadName->currentIndex();
if (pgpidx < 0)
{
/* Message Dialog */
QMessageBox::warning ( this,
"Load Person Failure",
"Missing PGP Certificate",
QMessageBox::Ok);
return;
}
int pgpidx = ui.loadName->currentIndex();
if (pgpidx < 0)
{
/* Message Dialog */
QMessageBox::warning(this, tr("Load Person Failure"), tr("Missing PGP Certificate"), QMessageBox::Ok);
return;
}
QVariant data = ui.loadName->itemData(pgpidx);
accountId = (data.toString()).toStdString();
QVariant data = ui.loadName->itemData(pgpidx);
accountId = (data.toString()).toStdString();
std::string gpgId, gpgName, gpgEmail, sslName;
if (RsInit::getAccountDetails(accountId,
gpgId, gpgName, gpgEmail, sslName))
if (RsInit::getAccountDetails(accountId, gpgId, gpgName, gpgEmail, sslName))
{
RsInit::SelectGPGAccount(gpgId);
}
RsInit::LoadPassword(accountId, "");
RsInit::LoadPassword(accountId, "");
loadCertificates();
}
void StartDialog::loadCertificates()
{
/* Final stage of loading */
std::string lockFile;
int retVal = RsInit::LockAndLoadCertificates(ui.autologin_checkbox->isChecked(), lockFile);
std::string lockFile;
int retVal = RsInit::LockAndLoadCertificates(ui.autologin_checkbox->isChecked(), lockFile);
switch(retVal)
{
case 0: close();
break;
case 1: QMessageBox::warning( this,
tr("Multiple instances"),
tr("Another RetroShare using the same profile is "
"already running on your system. Please close "
"that instance first, or choose another profile\n"
"lock file:\n")+ QString::fromStdString(lockFile));
break;
case 2: QMessageBox::warning( this,
tr("Multiple instances"),
tr("An unexpected error occurred when Retroshare "
"tried to acquire the single instance lock\n"
"lock file:\n")+ QString::fromStdString(lockFile));
break;
case 3: QMessageBox::warning( this,
tr("Login Failure"),
tr("Maybe password is wrong") );
break;
default: std::cerr << "StartDialog::loadCertificates() unexpected switch value " << retVal << std::endl;
case 0: close();
break;
case 1: QMessageBox::warning(this,
tr("Multiple instances"),
tr("Another RetroShare using the same profile is "
"already running on your system. Please close "
"that instance first, or choose another profile\n"
"lock file:\n")+ QString::fromStdString(lockFile));
break;
case 2: QMessageBox::warning(this,
tr("Multiple instances"),
tr("An unexpected error occurred when Retroshare "
"tried to acquire the single instance lock\n"
"lock file:\n")+ QString::fromStdString(lockFile));
break;
case 3: QMessageBox::warning(this,
tr("Login Failure"),
tr("Maybe password is wrong") );
break;
default: std::cerr << "StartDialog::loadCertificates() unexpected switch value " << retVal << std::endl;
}
}
void StartDialog::on_labelProfile_linkActivated(QString /*link*/)
{
// if ((QMessageBox::question(this, tr("Create a New Profile"),tr("This will generate a new Profile\n Are you sure you want to continue?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
// {
reqNewCert = true;
close();
// }
// else
// return;
// if ((QMessageBox::question(this, tr("Create a New Profile"),tr("This will generate a new Profile\n Are you sure you want to continue?"),QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes))== QMessageBox::Yes)
// {
reqNewCert = true;
close();
// }
}
bool StartDialog::requestedNewCert()
@ -198,23 +151,17 @@ bool StartDialog::requestedNewCert()
return reqNewCert;
}
LogoBar & StartDialog::getLogoBar() const {
return *_rsLogoBar;
}
void StartDialog::notSecureWarning() {
void StartDialog::notSecureWarning()
{
/* some error msg */
if(ui.autologin_checkbox->isChecked())
if (ui.autologin_checkbox->isChecked())
#ifdef UBUNTU
QMessageBox::warning ( this, tr("Warning"), tr("The passwd to your SSL certificate (your location) will be stored encrypted in your Gnome Keyring. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
QMessageBox::warning ( this, tr("Warning"), tr("The passwd to your SSL certificate (your location) will be stored encrypted in your Gnome Keyring. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#else
#ifdef __APPLE__
QMessageBox::warning ( this, tr("Warning"), tr("The passwd to your SSL certificate (your location) will be stored encrypted in your Keychain. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#else
QMessageBox::warning ( this, tr("Warning"), tr("The passwd to your SSL certificate (your location) will be stored encrypted in the keys/help.dta file. This is not secure. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#endif
#ifdef __APPLE__
QMessageBox::warning ( this, tr("Warning"), tr("The passwd to your SSL certificate (your location) will be stored encrypted in your Keychain. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#else
QMessageBox::warning ( this, tr("Warning"), tr("The passwd to your SSL certificate (your location) will be stored encrypted in the keys/help.dta file. This is not secure. \n\n Your PGP passwd will not be stored.\n\nThis choice can be reverted in settings."), QMessageBox::Ok);
#endif
#endif
return;
}