Merge pull request #1686 from defnax/changes-for-connect-friend-wizard

Changes for connect friend wizard
This commit is contained in:
csoler 2019-11-18 20:39:42 +01:00 committed by GitHub
commit 09ba897c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 293 deletions

View File

@ -80,9 +80,6 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
mTitleFontSize = 0; // Standard
mTitleFontWeight = 0; // Standard
// (csoler) I'm hiding this, since it is not needed anymore with the new Home page.
ui->userFrame->hide();
// ui->userFileFrame->hide(); // in homepage dropmenu now
@ -138,7 +135,6 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
}
else
{
ui->userFrame->hide(); // certificates page - top half with own cert and it's functions
ui->cp_Frame->hide(); // Advanced options - key sign, whitelist, direct source ...
AdvancedVisible=false;
ui->trustLabel->hide();
@ -302,6 +298,7 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage, tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
setButtonText(QWizard::FinishButton , tr("Accept"));
}
}
}
@ -326,6 +323,7 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage, tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
setButtonText(QWizard::FinishButton , tr("Accept"));
}
}
}
@ -351,10 +349,11 @@ void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId,
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
setStartId(Page_Conclusion);
if (friendRequest){
ui->cp_Label->show();
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage,tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
ui->cp_Label->show();
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage,tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
setButtonText(QWizard::FinishButton , tr("Accept"));
}
}
@ -383,14 +382,9 @@ void ConnectFriendWizard::initializePage(int id)
{
switch ((Page) id) {
case Page_Text:
connect(ui->userCertHelpButton, SIGNAL( clicked()), this, SLOT(showHelpUserCert()));
connect(ui->userCertIncludeSignaturesButton, SIGNAL(clicked()), this, SLOT(toggleSignatureState()));
connect(ui->userCertOldFormatButton, SIGNAL(clicked()), this, SLOT(toggleFormatState()));
connect(ui->userCertCopyButton, SIGNAL(clicked()), this, SLOT(copyCert()));
connect(ui->userCertPasteButton, SIGNAL(clicked()), this, SLOT(pasteCert()));
connect(ui->userCertOpenButton, SIGNAL(clicked()), this, SLOT(openCert()));
connect(ui->userCertSaveButton, SIGNAL(clicked()), this, SLOT(saveCert()));
connect(ui->userCertMailButton, SIGNAL(clicked()), this, SLOT(runEmailClient()));
connect(ui->friendCertEdit, SIGNAL(textChanged()), this, SLOT(friendCertChanged()));
cleanfriendCertTimer = new QTimer(this);
@ -398,13 +392,6 @@ void ConnectFriendWizard::initializePage(int id)
cleanfriendCertTimer->setInterval(1000); // 1 second
connect(cleanfriendCertTimer, SIGNAL(timeout()), this, SLOT(cleanFriendCert()));
ui->userCertOldFormatButton->setChecked(false);
ui->userCertOldFormatButton->hide() ;
toggleFormatState(true);
toggleSignatureState(false);
updateOwnCert();
cleanFriendCert();
break;
@ -780,52 +767,6 @@ void ConnectFriendWizard::accept()
//============================= TextPage =====================================
void ConnectFriendWizard::updateOwnCert()
{
std::string invite = rsPeers->GetRetroshareInvite( rsPeers->getOwnId(),
ui->userCertIncludeSignaturesButton->isChecked() );
std::cerr << "TextPage() getting Invite: " << invite << std::endl;
ui->userCertEdit->setPlainText(QString::fromUtf8(invite.c_str()));
}
void ConnectFriendWizard::toggleFormatState(bool doUpdate)
{
if (ui->userCertOldFormatButton->isChecked())
{
ui->userCertOldFormatButton->setToolTip(tr("Use new certificate format (safer, more robust)"));
ui->userCertOldFormatButton->setIcon(QIcon(":/images/ledoff1.png")) ;
}
else
{
ui->userCertOldFormatButton->setToolTip(tr("Use old (backward compatible) certificate format"));
ui->userCertOldFormatButton->setIcon(QIcon(":/images/ledon1.png")) ;
}
if (doUpdate) {
updateOwnCert();
}
}
void ConnectFriendWizard::toggleSignatureState(bool doUpdate)
{
if (ui->userCertIncludeSignaturesButton->isChecked()) {
ui->userCertIncludeSignaturesButton->setToolTip(tr("Remove signatures"));
} else {
ui->userCertIncludeSignaturesButton->setToolTip(tr("Include signatures"));
}
if (doUpdate) {
updateOwnCert();
}
}
void ConnectFriendWizard::runEmailClient()
{
sendMail("", tr("RetroShare Invite"), ui->userCertEdit->toPlainText());
}
void ConnectFriendWizard::friendCertChanged()
{
ui->TextPage->setComplete(false);
@ -893,18 +834,6 @@ void ConnectFriendWizard::cleanFriendCert()
ui->TextPage->setComplete(certValid);
}
void ConnectFriendWizard::showHelpUserCert()
{
QMessageBox::information(this, tr("Connect Friend Help"), tr("You can copy this text and send it to your friend via email or some other way"));
}
void ConnectFriendWizard::copyCert()
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(ui->userCertEdit->toPlainText());
QMessageBox::information(this, "RetroShare", tr("Your Cert is copied to Clipboard, paste and send it to your friend via email or some other way"));
}
void ConnectFriendWizard::pasteCert()
{
QClipboard *clipboard = QApplication::clipboard();
@ -927,23 +856,6 @@ void ConnectFriendWizard::openCert()
}
}
void ConnectFriendWizard::saveCert()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as..."), "", tr("RetroShare Certificate (*.rsc );;All Files (*)"));
if (fileName.isEmpty())
return;
QFile file(fileName);
if (!file.open(QFile::WriteOnly))
return;
//Todo: move save to file to p3Peers::SaveCertificateToFile
QTextStream ts(&file);
ts.setCodec(QTextCodec::codecForName("UTF-8"));
ts << ui->userCertEdit->document()->toPlainText();
}
#ifdef TO_BE_REMOVED
//========================== CertificatePage =================================

View File

@ -78,16 +78,9 @@ protected:
private slots:
/* TextPage */
void updateOwnCert();
void toggleSignatureState(bool doUpdate = true);
void toggleFormatState(bool doUpdate = true);
void runEmailClient();
void runEmailClient2();
void showHelpUserCert();
void copyCert();
void pasteCert();
void openCert();
void saveCert();
void friendCertChanged();
void cleanFriendCert();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>500</height>
<height>437</height>
</rect>
</property>
<property name="windowTitle">
@ -28,192 +28,6 @@
<string notr="true">ConnectFriendWizard::Page_Text</string>
</attribute>
<layout class="QVBoxLayout" name="TextPageVLayout">
<item>
<widget class="QFrame" name="userFrame">
<layout class="QGridLayout" name="userFrameGLayout">
<item row="1" column="1">
<layout class="QVBoxLayout" name="userCertButtonVLayout">
<item>
<widget class="QToolButton" name="userCertHelpButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
<verstretch>20</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="userCertIncludeSignaturesButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
<verstretch>20</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Include signatures</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/gpgp_key_generate.png</normaloff>:/images/gpgp_key_generate.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="userCertCopyButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
<verstretch>20</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Copy your Cert to Clipboard</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="userCertSaveButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
<verstretch>20</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Save your Cert into a File</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/document_save.png</normaloff>:/images/document_save.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="userCertMailButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
<verstretch>20</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Run Email program</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="userCertOldFormatButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>20</horstretch>
<verstretch>20</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/ledon1.png</normaloff>:/images/ledon1.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="userCertButtonVSpacer">
<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>
</item>
<item row="1" column="0">
<widget class="QPlainTextEdit" name="userCertEdit">
<property name="font">
<font>
<family>Courier New</family>
</font>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="tabStopWidth">
<number>80</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="userCertLabel">
<property name="text">
<string>The text below is your Retroshare ID. You have to provide it to your friend</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="friendFrame">
<layout class="QGridLayout" name="friendFrameGLayout">
@ -938,7 +752,7 @@
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>To accept the Friend Request, click the Finish button.</string>
<string>To accept the Friend Request, click the Accept button.</string>
</property>
<property name="margin">
<number>2</number>

View File

@ -320,13 +320,13 @@ GenCertDialog > QFrame#headerFrame > QLabel#headerLabel {
/* ConnectFriendWizard */
ConnectFriendWizard QWizardPage#ConclusionPage > QGroupBox#peerDetailsFrame {
border: 2px solid #CCCCCC;
border: 2px solid #039bd5;
border-radius:6px;
background: white;
padding: 12 12px;
}
ConnectFriendWizard QLabel#fr_label, QLabel#requestinfolabel
ConnectFriendWizard QLabel#fr_label, QLabel#requestinfolabel, QLabel#cp_Label
{
border: 1px solid #DCDC41;
border-radius: 6px;
@ -334,6 +334,15 @@ ConnectFriendWizard QLabel#fr_label, QLabel#requestinfolabel
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}
ConnectFriendWizard QGroupBox::title#peerDetailsFrame
{
padding: 4 12px;
background: transparent;
padding: 4 12px;
background: #039bd5;
color: white;
}
/* Toaster */
ChatToaster > QFrame#windowFrame,