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

View file

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

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>428</width> <width>428</width>
<height>413</height> <height>416</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -1032,14 +1032,14 @@ p, li { white-space: pre-wrap; }
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="no_gpg_key_label"> <widget class="QLabel" name="no_gpg_key_label">
<property name="text"> <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>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="4" column="0">
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
@ -1047,7 +1047,7 @@ p, li { white-space: pre-wrap; }
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="genPGPuserlabel"> <widget class="QLabel" name="genPGPuserlabel">
<property name="text"> <property name="text">
<string>OpenPGP User</string> <string>Use GPG key</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -1096,13 +1096,33 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="progress_label"> <widget class="QLabel" name="progress_label">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>