mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 16:35:21 -04:00
Add ConnectFriendWizard improvement.
Add cert details in friendCertCleanLabel tooltip. Use qss for background color of friendCertCleanLabel. Add Known IP in final view.
This commit is contained in:
parent
e8b97405b9
commit
a072b151f5
7 changed files with 57 additions and 36 deletions
|
@ -39,6 +39,7 @@
|
|||
#include "ConnectFriendWizard.h"
|
||||
#include "ui_ConnectFriendWizard.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/connect/ConfCertDialog.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
|
@ -572,6 +573,16 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
ui->ipEdit->setText(s);
|
||||
ui->signersEdit->setPlainText(ts);
|
||||
|
||||
ui->knownIpLabel->setHidden(peerDetails.ipAddressList.empty());
|
||||
ui->knownIpEdit->setHidden(peerDetails.ipAddressList.empty());
|
||||
{
|
||||
QString ipList;
|
||||
for(auto& it : peerDetails.ipAddressList)
|
||||
ipList.append(QString::fromStdString(it) + "\n");
|
||||
|
||||
ui->knownIpEdit->setPlainText(ipList);
|
||||
}
|
||||
|
||||
fillGroups(this, ui->groupComboBox, groupId);
|
||||
|
||||
if(peerDetails.isHiddenNode)
|
||||
|
@ -587,15 +598,16 @@ void ConnectFriendWizard::initializePage(int id)
|
|||
}
|
||||
if(mIsShortInvite)
|
||||
{
|
||||
ui->nameEdit->setText(tr("[Unknown]"));
|
||||
ui->addKeyToKeyring_CB->setChecked(false);
|
||||
ui->addKeyToKeyring_CB->setEnabled(false);
|
||||
if(ui->nameEdit->text().isEmpty())
|
||||
ui->nameEdit->setText(tr("[Unknown]"));
|
||||
ui->addKeyToKeyring_CB->setChecked(false);
|
||||
ui->addKeyToKeyring_CB->setEnabled(false);
|
||||
ui->signersEdit->hide();
|
||||
ui->signersLabel->hide();
|
||||
ui->signGPGCheckBox->setChecked(false);
|
||||
ui->signGPGCheckBox->setEnabled(false);
|
||||
ui->acceptNoSignGPGCheckBox->setChecked(true);
|
||||
ui->acceptNoSignGPGCheckBox->setEnabled(false);
|
||||
ui->signGPGCheckBox->setChecked(false);
|
||||
ui->signGPGCheckBox->setEnabled(false);
|
||||
ui->acceptNoSignGPGCheckBox->setChecked(true);
|
||||
ui->acceptNoSignGPGCheckBox->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->ipEdit->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
|
@ -856,30 +868,30 @@ void ConnectFriendWizard::cleanFriendCert()
|
|||
{
|
||||
bool certValid = false;
|
||||
QString errorMsg ;
|
||||
QString certDetail;
|
||||
std::string cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
|
||||
|
||||
if (cert.empty()) {
|
||||
ui->friendCertCleanLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/delete.png"));
|
||||
ui->friendCertCleanLabel->setToolTip("");
|
||||
ui->friendCertCleanLabel->setStyleSheet("");
|
||||
errorMsg = tr("");
|
||||
|
||||
} else {
|
||||
std::string cleanCert;
|
||||
uint32_t error_code;
|
||||
RsPeerDetails details;
|
||||
|
||||
if (rsPeers->cleanCertificate(cert, cleanCert, mIsShortInvite, error_code))
|
||||
{
|
||||
if (rsPeers->cleanCertificate(cert, cleanCert, mIsShortInvite, error_code, details))
|
||||
{
|
||||
certValid = true;
|
||||
|
||||
if (cert != cleanCert)
|
||||
{
|
||||
{
|
||||
QTextCursor textCursor = ui->friendCertEdit->textCursor();
|
||||
|
||||
whileBlocking(ui->friendCertEdit)->setPlainText(QString::fromUtf8(cleanCert.c_str()));
|
||||
whileBlocking(ui->friendCertEdit)->setTextCursor(textCursor);
|
||||
|
||||
ui->friendCertCleanLabel->setStyleSheet("");
|
||||
certDetail = ConfCertDialog::getCertificateDescription(details,false,mIsShortInvite,!details.ipAddressList.empty());
|
||||
}
|
||||
|
||||
if (mIsShortInvite)
|
||||
|
@ -887,7 +899,7 @@ void ConnectFriendWizard::cleanFriendCert()
|
|||
else
|
||||
errorMsg = tr("Valid certificate") ;
|
||||
|
||||
ui->friendCertCleanLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/accepted16.png"));
|
||||
ui->friendCertCleanLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/accepted16.png"));
|
||||
} else {
|
||||
if (error_code > 0) {
|
||||
switch (error_code) {
|
||||
|
@ -903,16 +915,17 @@ void ConnectFriendWizard::cleanFriendCert()
|
|||
|
||||
default:
|
||||
errorMsg = tr("Not a valid Retroshare certificate!") ;
|
||||
ui->friendCertCleanLabel->setStyleSheet("QLabel#friendCertCleanLabel {border: 1px solid #DCDC41; border-radius: 6px; background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);}");
|
||||
}
|
||||
}
|
||||
ui->friendCertCleanLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/delete.png"));
|
||||
}
|
||||
}
|
||||
|
||||
ui->friendCertCleanLabel->setPixmap(certValid ? FilesDefs::getPixmapFromQtResourcePath(":/images/accepted16.png") : FilesDefs::getPixmapFromQtResourcePath(":/images/delete.png"));
|
||||
ui->friendCertCleanLabel->setToolTip(errorMsg);
|
||||
ui->friendCertCleanLabel->setPixmap(certValid ? FilesDefs::getPixmapFromQtResourcePath(":/images/accepted16.png") : FilesDefs::getPixmapFromQtResourcePath(":/images/delete.png"));
|
||||
ui->friendCertCleanLabel->setToolTip("<p>" + errorMsg + (certValid ? "\n" + certDetail : "") + "</p>");
|
||||
ui->friendCertCleanLabel->setText(errorMsg);
|
||||
ui->friendCertCleanLabel->setProperty("WrongValue", !certValid && !errorMsg.isEmpty());
|
||||
ui->friendCertCleanLabel->style()->unpolish(ui->friendCertCleanLabel);
|
||||
ui->friendCertCleanLabel->style()->polish( ui->friendCertCleanLabel);
|
||||
|
||||
ui->TextPage->setComplete(certValid);
|
||||
}
|
||||
|
|
|
@ -590,7 +590,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Email</string>
|
||||
<string notr="true">ProfilId</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -629,7 +629,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Signers</string>
|
||||
<string>Signers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -675,6 +675,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="knownIpLabel">
|
||||
<property name="text">
|
||||
<string>Known IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QPlainTextEdit" name="knownIpEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue