add the possibility to create a gpg key for new profile

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2089 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-19 21:44:13 +00:00
parent f8d2fb5de3
commit 868e60af06
3 changed files with 64 additions and 17 deletions

View File

@ -42,6 +42,8 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup()));
WidgetBackgroundImage::setBackgroundImage(ui.loginLabel, ":images/new-account.png", WidgetBackgroundImage::AdjustHeight);
@ -57,9 +59,9 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
*/
std::cerr << "Finding PGPUsers" << std::endl;
foundGPGKeys = false;
std::list<std::string> pgpIds;
std::list<std::string>::iterator it;
bool foundGPGKeys = false;
if (RsInit::GetPGPLogins(pgpIds)) {
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
{
@ -74,16 +76,15 @@ GenCertDialog::GenCertDialog(QWidget *parent, Qt::WFlags flags)
if (foundGPGKeys) {
ui.no_gpg_key_label->hide();
ui.name_label->hide();
ui.name_input->hide();
ui.email_label->hide();
ui.email_input->hide();
ui.password_label->hide();
ui.password_input->hide();
ui.new_gpg_key_checkbox->setChecked(false);
genNewGPGKey = false;
} else {
ui.genPGPuserlabel->hide();
ui.genPGPuser->hide();
ui.no_gpg_key_label->show();
ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->hide();
genNewGPGKey = true;
}
newGPGKeyGenUiSetup();
}
/** Destructor. */
@ -116,6 +117,29 @@ void GenCertDialog::closeinfodlg()
close();
}
void GenCertDialog::newGPGKeyGenUiSetup() {
if (ui.new_gpg_key_checkbox->isChecked()) {
genNewGPGKey = true;
ui.name_label->show();
ui.name_input->show();
ui.email_label->show();
ui.email_input->show();
ui.password_label->show();
ui.password_input->show();
ui.genPGPuserlabel->hide();
ui.genPGPuser->hide();
} else {
genNewGPGKey = false;
ui.name_label->hide();
ui.name_input->hide();
ui.email_label->hide();
ui.email_input->hide();
ui.password_label->hide();
ui.password_input->hide();
ui.genPGPuserlabel->show();
ui.genPGPuser->show();
}
}
void GenCertDialog::genPerson()
{
@ -123,7 +147,7 @@ void GenCertDialog::genPerson()
std::string genLoc = ui.genLoc->text().toStdString();
std::string PGPId;
if (foundGPGKeys) {
if (!genNewGPGKey) {
int pgpidx = ui.genPGPuser->currentIndex();
if (pgpidx < 0)
{
@ -145,6 +169,7 @@ void GenCertDialog::genPerson()
ui.progress_label->setMovie(movie);
movie->start();
movie->setSpeed(100); // 2x speed
ui.new_gpg_key_checkbox->hide();
ui.name_label->hide();
ui.name_input->hide();
ui.email_label->hide();

View File

@ -55,6 +55,7 @@ private slots:
void selectFriend();
void checkChanged(int i);
void infodlg();
void newGPGKeyGenUiSetup();
private:
@ -62,12 +63,13 @@ private:
// void loadSettings();
void loadCertificates();
QMovie *movie;
/** Qt Designer generated object */
Ui::GenCertDialog ui;
bool foundGPGKeys;
bool genNewGPGKey;
};
#endif

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>428</width>
<height>413</height>
<height>416</height>
</rect>
</property>
<property name="sizePolicy">
@ -1032,14 +1032,14 @@ p, li { white-space: pre-wrap; }
<item row="0" column="0">
<widget class="QLabel" name="no_gpg_key_label">
<property name="text">
<string>It looks like you don't own any GPG keys. Please fill in the form below to generate one, or use your favorite gnupg keys manager.</string>
<string>It looks like you don't own any GPG keys. Please fill in the form below to generate one, or use your favorite gnupg key manager.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="4" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
@ -1047,7 +1047,7 @@ p, li { white-space: pre-wrap; }
<item row="1" column="0">
<widget class="QLabel" name="genPGPuserlabel">
<property name="text">
<string>OpenPGP User</string>
<string>Use GPG key</string>
</property>
</widget>
</item>
@ -1096,13 +1096,33 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="progress_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="new_gpg_key_checkbox">
<property name="text">
<string>Generate a new a new gpg key</string>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>