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>::iterator it;
bool foundGPGKeys = false;
haveGPGKeys = false;
#ifdef TO_REMOVE
/* replace with true/false below */
if (!mOnlyGenerateIdentity) {
#endif
if (RsAccounts::GetPGPLogins(pgpIds)) {
for(it = pgpIds.begin(); it != pgpIds.end(); ++it)
{
@ -207,13 +210,15 @@ void GenCertDialog::init()
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
QString gid = QString::fromStdString( (*it).toStdString()).right(8) ;
ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
foundGPGKeys = true;
haveGPGKeys = true;
}
}
#ifdef TO_REMOVE
}
if (foundGPGKeys) {
#endif
if (haveGPGKeys) {
ui.no_gpg_key_label->hide();
ui.header_label->show();
ui.new_gpg_key_checkbox->setChecked(false);
setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node"));
@ -221,6 +226,7 @@ void GenCertDialog::init()
genNewGPGKey = false;
} else {
ui.no_gpg_key_label->setVisible(!mOnlyGenerateIdentity);
ui.header_label->setVisible(mOnlyGenerateIdentity);
ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->setEnabled(true);
setWindowTitle(tr("Create new profile"));
@ -229,19 +235,22 @@ void GenCertDialog::init()
genNewGPGKey = true;
}
#ifdef TO_REMOVE
QString text; /*= ui.header_label->text() + "\n";*/
text += tr("You can create a new profile with this form.");
if (mOnlyGenerateIdentity) {
ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->hide();
#endif
ui.genprofileinfo_label->hide();
#ifdef TO_REMOVE
} else {
text += "\n";
text += tr("Alternatively you can use an existing profile. Just uncheck \"Create a new profile\"");
}
ui.header_label->setText(text);
#endif
newGPGKeyGenUiSetup();
//updateUiSetup();
}
@ -275,24 +284,28 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
setWindowTitle(tr("Create new profile"));
ui.genButton2->setText(tr("Generate 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.adv_checkbox->setVisible(true);
ui.node_label->setVisible(true);
ui.node_input->setVisible(true);
ui.entropy_label->setVisible(true);
ui.entropy_bar->setVisible(true);
ui.genprofileinfo_label->hide();
ui.header_label->show();
ui.genprofileinfo_label->setVisible(false);
if (!mOnlyGenerateIdentity) {
ui.header_label->setVisible(haveGPGKeys);
}
//ui.keylength_label->show();
//ui.keylength_comboBox->show();
} else {
bool havePGPkeys = (ui.genPGPuser->count() != 0)?true:false;
if (havePGPkeys) {
//haveGPGKeys = (ui.genPGPuser->count() != 0)?true:false;
if (haveGPGKeys) {
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
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->setVisible(true);
} else {
ui.genprofileinfo_label->show();
}
}
genNewGPGKey = false;
@ -307,23 +320,23 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
ui.genPGPuserlabel->show();
ui.genPGPuser->show();
ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity);
ui.exportIdentity_PB->setVisible(havePGPkeys);
ui.exportIdentity_PB->setEnabled(havePGPkeys);
ui.exportIdentity_PB->setVisible(haveGPGKeys);
ui.exportIdentity_PB->setEnabled(haveGPGKeys);
setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate 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.genButton2->setVisible(havePGPkeys);
ui.adv_checkbox->setVisible(havePGPkeys);
ui.adv_checkbox->setChecked(havePGPkeys && adv_state);
ui.genPGPuser->setVisible(havePGPkeys);
ui.genPGPuserlabel->setVisible(havePGPkeys);
ui.node_label->setVisible(havePGPkeys);
ui.node_input->setVisible(havePGPkeys);
ui.entropy_label->setVisible(havePGPkeys);
ui.entropy_bar->setVisible(havePGPkeys);
ui.genprofileinfo_label->show();
ui.header_label->hide();
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(haveGPGKeys);
ui.adv_checkbox->setVisible(haveGPGKeys);
ui.adv_checkbox->setChecked(haveGPGKeys && adv_state);
ui.genPGPuser->setVisible(haveGPGKeys);
ui.genPGPuserlabel->setVisible(haveGPGKeys);
ui.node_label->setVisible(haveGPGKeys);
ui.node_input->setVisible(haveGPGKeys);
ui.entropy_label->setVisible(haveGPGKeys);
ui.entropy_bar->setVisible(haveGPGKeys);
//ui.genprofileinfo_label->show();
ui.header_label->setVisible(false);
ui.keylength_label->hide();
ui.keylength_comboBox->hide();
}

View File

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

View File

@ -46,7 +46,8 @@
</font>
</property>
<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 name="wordWrap">
<bool>true</bool>
@ -223,34 +224,25 @@
</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">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<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">
<string>Use profile</string>
</property>
@ -258,6 +250,18 @@
</item>
<item>
<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">
<string>Name</string>
</property>
@ -304,13 +308,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="keylength_label">
<property name="text">
<string>PGP key length</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -462,6 +459,61 @@ anonymous, you can use a fake email.</string>
</item>
</layout>
</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>
<widget class="QComboBox" name="keylength_comboBox"/>
</item>

View File

@ -34,6 +34,14 @@ GenCertDialog QLabel#label_hiddenaddr2 {
background: #CCFFCC;
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 {
color: rgb(255, 255, 255);
@ -57,6 +65,7 @@ GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4;
}
/* FriendsDialog */
FriendsDialog QFrame#headFrame {