Пример #1
0
/** Default constructor */
StartDialog::StartDialog(QWidget *parent)
  : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint), reqNewCert(false)
{
	/* Invoke Qt Designer generated QObject setup routine */
	ui.setupUi(this);

#ifdef RS_AUTOLOGIN
	connect(ui.autologin_checkbox, SIGNAL(clicked()), this, SLOT(notSecureWarning()));
#else
	ui.autologin_checkbox->setHidden(true);
#endif

	Settings->loadWidgetInformation(this);

	ui.loadButton->setFocus();

	connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));

	/* get all available pgp private certificates....
	* mark last one as default.
	*/
	std::list<RsPeerId> accountIds;
	std::list<RsPeerId>::iterator it;
	RsPeerId preferedId;
	RsAccounts::GetPreferredAccountId(preferedId);
	int pidx = -1;
	int i;

	if (RsAccounts::GetAccountIds(accountIds))
	{
		for(it = accountIds.begin(), i = 0; it != accountIds.end(); ++it, ++i)
		{
			const QVariant & userData = QVariant(QString::fromStdString((*it).toStdString()));
			RsPgpId gpgid ;
			std::string name, email, node;
			RsAccounts::GetAccountDetails(*it, gpgid, name, email, node);
			QString accountName = QString::fromUtf8(name.c_str()) + " (" + QString::fromStdString(gpgid.toStdString()).right(8) + ") - " + QString::fromUtf8(node.c_str());
			ui.loadName->addItem(accountName, userData);

			if (preferedId == *it)
			{
				pidx = i;
			}
		}
	}

	if (pidx > 0)
	{
		ui.loadName->setCurrentIndex(pidx);
	}
}
Пример #2
0
/** Default constructor */
StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
  : QMainWindow(parent, flags), reqNewCert(false)
{
  /* Invoke Qt Designer generated QObject setup routine */
  ui.setupUi(this);

/**
#if (QT_VERSION >= 040300)
  skinobject = new QSkinObject(this);
  skinobject->startSkinning();
#endif**/

  RshareSettings config;
  config.loadWidgetInformation(this);
 
  _rsLogoBar = NULL;
 
  //LogoBar
  _rsLogoBar = new LogoBar(ui.callBarFrame);
  Widget::createLayout(ui.callBarFrame)->addWidget(_rsLogoBar);

  /* Create Bandwidth Graph related QObjects */
  _settings = new RshareSettings();
  

  
  //connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
  connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
  connect(ui.loadPasswd, SIGNAL(returnPressed()), this, SLOT(loadPerson()));
  //connect(ui.selectButton, SIGNAL(clicked()), this, SLOT(selectFriend()));
  //connect(ui.friendBox, SIGNAL(stateChanged(int)), this, SLOT(checkChanged(int)));
  connect(ui.createaccountButton, SIGNAL(clicked()), this, SLOT(createnewaccount()));

  /* load the Certificate File name */
  std::string userName;

#ifdef RS_USE_PGPSSL
	/* get all available pgp private certificates....
	 * mark last one as default.
	 */

	std::list<std::string> pgpIds;
	std::list<std::string>::iterator it;
	if (RsInit::GetLogins(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);
       			ui.loadName->addItem(QString::fromStdString(name), userData);
		}
	}
#else

  if (RsInit::ValidateCertificate(userName))
  {
  	/* just need to enter password */
        ui.loadName->addItem(QString::fromStdString(userName));
	//ui.loadName->setText(QString::fromStdString(userName));
	ui.loadPasswd->setFocus(Qt::OtherFocusReason);
	ui.loadButton -> setEnabled(true);
  }
  else
  {
  	/* need to generate new user */
        ui.loadName->addItem("<No Existing User>");
	//ui.loadName->setText("<No Existing User>");
	ui.loadButton -> setEnabled(false);
	//ui.genName->setFocus(Qt::OtherFocusReason);
  }
#ifndef Q_WS_WIN
	ui.autoBox->setChecked(false) ;
	ui.autoBox->setEnabled(false) ;
#endif
#endif

  //ui.genFriend -> setText("<None Selected>");

}