Exemplo n.º 1
0
void IdEditDialog::setupNewId(bool pseudo)
{
	setWindowTitle(tr("New identity"));

	mIsNew = true;
	mGroupId.clear();

	ui->lineEdit_KeyId->setText(tr("To be generated"));
	ui->lineEdit_Nickname->setText("");
	ui->radioButton_GpgId->setEnabled(true);
	ui->radioButton_Pseudo->setEnabled(true);

	if (pseudo)
	{
		ui->radioButton_Pseudo->setChecked(true);
	}
	else
	{
		ui->radioButton_GpgId->setChecked(true);
	}

	// force - incase it wasn't triggered.
	idTypeToggled(true);

	ui->frame_Tags->setHidden(true);
	ui->radioButton_GpgId->setEnabled(true);
	ui->radioButton_Pseudo->setEnabled(true);

	setAvatar(QPixmap());

    // force resize of dialog, to hide empty space from the hidden recogn tags area
    adjustSize();
}
Exemplo n.º 2
0
void IdEditDialog::setupNewId(bool pseudo,bool enable_anon)
{
	setWindowTitle(tr("New identity"));

    	if(pseudo && !enable_anon)
        {
            std::cerr << "IdEditDialog::setupNewId: Error. Cannot init with pseudo-anonymous id when anon ids are disabled." << std::endl;
            pseudo = false ;
        }
        
	mIsNew = true;
	mGroupId.clear();

	ui->lineEdit_KeyId->setText(tr("To be generated"));
	ui->lineEdit_Nickname->setText("");
	ui->radioButton_GpgId->setEnabled(true);
	ui->radioButton_Pseudo->setEnabled(true);

	if (pseudo)
	{
		ui->radioButton_Pseudo->setChecked(true);
	}
	else
	{
		ui->radioButton_GpgId->setChecked(true);
	}

	// force - incase it wasn't triggered.
	idTypeToggled(true);

	ui->frame_Tags->setHidden(true);
	ui->radioButton_GpgId->setEnabled(true);
    
    	if(enable_anon)
		ui->radioButton_Pseudo->setEnabled(true);
        else
		ui->radioButton_Pseudo->setEnabled(false);

	setAvatar(QPixmap());

    // force resize of dialog, to hide empty space from the hidden recogn tags area
    adjustSize();
}
Exemplo n.º 3
0
void IdEditDialog::loadExistingId(uint32_t token)
{
	mStateHelper->setLoading(IDEDITDIALOG_LOADID, false);

	/* get details from libretroshare */
	std::vector<RsGxsIdGroup> datavector;
	if (!rsIdentity->getGroupData(token, datavector))
	{
		ui->lineEdit_KeyId->setText(tr("Error getting key!"));
		return;
	}

	if (datavector.size() != 1)
	{
		std::cerr << "IdDialog::insertIdDetails() Invalid datavector size";
		std::cerr << std::endl;

		ui->lineEdit_KeyId->setText(tr("Error KeyID invalid"));
		ui->lineEdit_Nickname->setText("");

		ui->lineEdit_GpgHash->setText(tr("N/A"));
		ui->lineEdit_GpgId->setText(tr("N/A"));
		ui->lineEdit_GpgName->setText(tr("N/A"));
		return;
	}

	mEditGroup = datavector[0];
	mGroupId = mEditGroup.mMeta.mGroupId;

	QPixmap avatar;
	if (mEditGroup.mImage.mSize > 0) {
		avatar.loadFromData(mEditGroup.mImage.mData, mEditGroup.mImage.mSize, "PNG");
	}

	setAvatar(avatar);

	bool realid = (mEditGroup.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID);

	if (realid)
	{
		ui->radioButton_GpgId->setChecked(true);
	}
	else
	{
		ui->radioButton_Pseudo->setChecked(true);
	}
	// these are not editable for existing Id.
	ui->radioButton_GpgId->setEnabled(false);
	ui->radioButton_Pseudo->setEnabled(false);

	// DOES THIS TRIGGER ALREADY???
	// force - incase it wasn't triggered.
	idTypeToggled(true);

    ui->lineEdit_Nickname->setText(QString::fromUtf8(mEditGroup.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
	ui->lineEdit_KeyId->setText(QString::fromStdString(mEditGroup.mMeta.mGroupId.toStdString()));

	if (realid)
	{
		ui->lineEdit_GpgHash->setText(QString::fromStdString(mEditGroup.mPgpIdHash.toStdString()));

		if (mEditGroup.mPgpKnown)
		{
			RsPeerDetails details;
			rsPeers->getGPGDetails(mEditGroup.mPgpId, details);
			ui->lineEdit_GpgName->setText(QString::fromUtf8(details.name.c_str()));

			ui->lineEdit_GpgId->setText(QString::fromStdString(mEditGroup.mPgpId.toStdString()));
		}
		else
		{
			ui->lineEdit_GpgId->setText(tr("Unknown GpgId"));
			ui->lineEdit_GpgName->setText(tr("Unknown real name"));
		}
	}
	else
	{
		ui->lineEdit_GpgHash->setText(tr("N/A"));
		ui->lineEdit_GpgId->setText(tr("N/A"));
		ui->lineEdit_GpgName->setText(tr("N/A"));
	}

	// RecognTags.
	ui->frame_Tags->setHidden(false);

	loadRecognTags();
}