improved GenCertDialog (patch from Henry)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8281 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-05-21 09:03:58 +00:00
parent 5d194d2a9a
commit 807b7378df
4 changed files with 129 additions and 54 deletions

View File

@ -196,8 +196,11 @@ void GenCertDialog::init()
std::list<RsPgpId> pgpIds; std::list<RsPgpId> pgpIds;
std::list<RsPgpId>::iterator it; std::list<RsPgpId>::iterator it;
bool foundGPGKeys = false; haveGPGKeys = false;
#ifdef TO_REMOVE
/* replace with true/false below */
if (!mOnlyGenerateIdentity) { if (!mOnlyGenerateIdentity) {
#endif
if (RsAccounts::GetPGPLogins(pgpIds)) { if (RsAccounts::GetPGPLogins(pgpIds)) {
for(it = pgpIds.begin(); it != pgpIds.end(); ++it) for(it = pgpIds.begin(); it != pgpIds.end(); ++it)
{ {
@ -207,13 +210,15 @@ void GenCertDialog::init()
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl; std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
QString gid = QString::fromStdString( (*it).toStdString()).right(8) ; QString gid = QString::fromStdString( (*it).toStdString()).right(8) ;
ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData); ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
foundGPGKeys = true; haveGPGKeys = true;
} }
} }
#ifdef TO_REMOVE
} }
#endif
if (foundGPGKeys) { if (haveGPGKeys) {
ui.no_gpg_key_label->hide(); ui.no_gpg_key_label->hide();
ui.header_label->show();
ui.new_gpg_key_checkbox->setChecked(false); ui.new_gpg_key_checkbox->setChecked(false);
setWindowTitle(tr("Create new node")); setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node")); ui.genButton2->setText(tr("Generate new node"));
@ -221,6 +226,7 @@ void GenCertDialog::init()
genNewGPGKey = false; genNewGPGKey = false;
} else { } else {
ui.no_gpg_key_label->setVisible(!mOnlyGenerateIdentity); ui.no_gpg_key_label->setVisible(!mOnlyGenerateIdentity);
ui.header_label->setVisible(mOnlyGenerateIdentity);
ui.new_gpg_key_checkbox->setChecked(true); ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->setEnabled(true); ui.new_gpg_key_checkbox->setEnabled(true);
setWindowTitle(tr("Create new profile")); setWindowTitle(tr("Create new profile"));
@ -229,19 +235,22 @@ void GenCertDialog::init()
genNewGPGKey = true; genNewGPGKey = true;
} }
#ifdef TO_REMOVE
QString text; /*= ui.header_label->text() + "\n";*/ QString text; /*= ui.header_label->text() + "\n";*/
text += tr("You can create a new profile with this form."); text += tr("You can create a new profile with this form.");
if (mOnlyGenerateIdentity) { if (mOnlyGenerateIdentity) {
ui.new_gpg_key_checkbox->setChecked(true); ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->hide(); ui.new_gpg_key_checkbox->hide();
#endif
ui.genprofileinfo_label->hide(); ui.genprofileinfo_label->hide();
#ifdef TO_REMOVE
} else { } else {
text += "\n"; text += "\n";
text += tr("Alternatively you can use an existing profile. Just uncheck \"Create a new profile\""); text += tr("Alternatively you can use an existing profile. Just uncheck \"Create a new profile\"");
} }
ui.header_label->setText(text); ui.header_label->setText(text);
#endif
newGPGKeyGenUiSetup(); newGPGKeyGenUiSetup();
//updateUiSetup(); //updateUiSetup();
} }
@ -275,24 +284,28 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
setWindowTitle(tr("Create new profile")); setWindowTitle(tr("Create new profile"));
ui.genButton2->setText(tr("Generate new profile and node")); ui.genButton2->setText(tr("Generate new profile and node"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node")); ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
ui.no_gpg_key_label->setText(tr("Please fill out this form to create a profile and node.")); ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
ui.genButton2->setVisible(true); ui.genButton2->setVisible(true);
ui.adv_checkbox->setVisible(true); ui.adv_checkbox->setVisible(true);
ui.node_label->setVisible(true); ui.node_label->setVisible(true);
ui.node_input->setVisible(true); ui.node_input->setVisible(true);
ui.entropy_label->setVisible(true); ui.entropy_label->setVisible(true);
ui.entropy_bar->setVisible(true); ui.entropy_bar->setVisible(true);
ui.genprofileinfo_label->hide(); ui.genprofileinfo_label->setVisible(false);
ui.header_label->show(); if (!mOnlyGenerateIdentity) {
ui.header_label->setVisible(haveGPGKeys);
}
//ui.keylength_label->show(); //ui.keylength_label->show();
//ui.keylength_comboBox->show(); //ui.keylength_comboBox->show();
} else { } else {
bool havePGPkeys = (ui.genPGPuser->count() != 0)?true:false; //haveGPGKeys = (ui.genPGPuser->count() != 0)?true:false;
if (havePGPkeys) { if (haveGPGKeys) {
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex()); QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
if (!rsAccounts->selectAccountByString(data.toString().toStdString())) { if (!rsAccounts->selectAccountByString(data.toString().toStdString())) {
ui.no_node_label->setText(tr("No node is associated with the profile named") + " " + ui.genPGPuser->currentText() + ". " +tr("Please create a node for it by providing a node name.")); ui.no_node_label->setText(tr("No node is associated with the profile named") + " " + ui.genPGPuser->currentText() + ". " +tr("Please create a node for it by providing a node name."));
ui.no_node_label->setVisible(true); ui.no_node_label->setVisible(true);
} else {
ui.genprofileinfo_label->show();
} }
} }
genNewGPGKey = false; genNewGPGKey = false;
@ -307,23 +320,23 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
ui.genPGPuserlabel->show(); ui.genPGPuserlabel->show();
ui.genPGPuser->show(); ui.genPGPuser->show();
ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity); ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity);
ui.exportIdentity_PB->setVisible(havePGPkeys); ui.exportIdentity_PB->setVisible(haveGPGKeys);
ui.exportIdentity_PB->setEnabled(havePGPkeys); ui.exportIdentity_PB->setEnabled(haveGPGKeys);
setWindowTitle(tr("Create new node")); setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node")); ui.genButton2->setText(tr("Generate new node"));
ui.headerFrame->setHeaderText(tr("Create a new node")); ui.headerFrame->setHeaderText(tr("Create a new node"));
ui.no_gpg_key_label->setText(tr("No valid profile found!\nPlease import one first.")); ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to import a profile and after that associate a node with it."));
ui.genButton2->setVisible(havePGPkeys); ui.genButton2->setVisible(haveGPGKeys);
ui.adv_checkbox->setVisible(havePGPkeys); ui.adv_checkbox->setVisible(haveGPGKeys);
ui.adv_checkbox->setChecked(havePGPkeys && adv_state); ui.adv_checkbox->setChecked(haveGPGKeys && adv_state);
ui.genPGPuser->setVisible(havePGPkeys); ui.genPGPuser->setVisible(haveGPGKeys);
ui.genPGPuserlabel->setVisible(havePGPkeys); ui.genPGPuserlabel->setVisible(haveGPGKeys);
ui.node_label->setVisible(havePGPkeys); ui.node_label->setVisible(haveGPGKeys);
ui.node_input->setVisible(havePGPkeys); ui.node_input->setVisible(haveGPGKeys);
ui.entropy_label->setVisible(havePGPkeys); ui.entropy_label->setVisible(haveGPGKeys);
ui.entropy_bar->setVisible(havePGPkeys); ui.entropy_bar->setVisible(haveGPGKeys);
ui.genprofileinfo_label->show(); //ui.genprofileinfo_label->show();
ui.header_label->hide(); ui.header_label->setVisible(false);
ui.keylength_label->hide(); ui.keylength_label->hide();
ui.keylength_comboBox->hide(); ui.keylength_comboBox->hide();
} }

View File

@ -51,6 +51,7 @@ private:
Ui::GenCertDialog ui; Ui::GenCertDialog ui;
bool genNewGPGKey; bool genNewGPGKey;
bool haveGPGKeys;
bool mOnlyGenerateIdentity; bool mOnlyGenerateIdentity;
QTimer *entropy_timer ; QTimer *entropy_timer ;

View File

@ -46,7 +46,8 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>You can create a new profile with this form.
Alternatively you can use an existing profile. Just uncheck "Create a new profile"</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -223,34 +224,25 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QLabel" name="label_hiddenaddr2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is a TOR Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;/p&gt;&lt;p&gt;In order to get one, you must configure TOR to create a new hidden service. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options-&amp;gt;Server-&amp;gt;TOR configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLabel" name="genPGPuserlabel"> <widget class="QLabel" name="genPGPuserlabel">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Use profile</string> <string>Use profile</string>
</property> </property>
@ -258,6 +250,18 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="name_label"> <widget class="QLabel" name="name_label">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Name</string> <string>Name</string>
</property> </property>
@ -304,13 +308,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="keylength_label">
<property name="text">
<string>PGP key length</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -462,6 +459,61 @@ anonymous, you can use a fake email.</string>
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_hiddenaddr2">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is a TOR Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;/p&gt;&lt;p&gt;In order to get one, you must configure TOR to create a new hidden service. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options-&amp;gt;Server-&amp;gt;TOR configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<widget class="QLabel" name="keylength_label">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>PGP key length</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QComboBox" name="keylength_comboBox"/> <widget class="QComboBox" name="keylength_comboBox"/>
</item> </item>

View File

@ -34,6 +34,14 @@ GenCertDialog QLabel#label_hiddenaddr2 {
background: #CCFFCC; background: #CCFFCC;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #CCFFCC, stop:1 #AAFFAA); background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #CCFFCC, stop:1 #AAFFAA);
} }
GenCertDialog QLabel#no_node_label, GenCertDialog QLabel#no_gpg_key_label {
border: 1px solid #FFC550;
border-radius: 6px;
background: #FFEECC;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFEECC, stop:1 #FFE3AB);
padding: 4px;
font-size: 14px;
}
GenCertDialog > QFrame#headerFrame > QLabel#headerLabel { GenCertDialog > QFrame#headerFrame > QLabel#headerLabel {
color: rgb(255, 255, 255); color: rgb(255, 255, 255);
@ -57,6 +65,7 @@ GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4; border-image: url(:/images/btn_blue_hover.png) 4;
} }
/* FriendsDialog */ /* FriendsDialog */
FriendsDialog QFrame#headFrame { FriendsDialog QFrame#headFrame {