removed unused Cert page from ConnectFriendWizard

This commit is contained in:
csoler 2019-06-10 00:36:40 +02:00
parent a55e8241ed
commit a04079daa0
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
3 changed files with 5 additions and 221 deletions

View File

@ -84,7 +84,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
// (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
// ui->userFileFrame->hide(); // in homepage dropmenu now
// this define comes from Qt example. I don't have mac, so it wasn't tested
#ifndef Q_OS_MAC
@ -407,14 +407,6 @@ void ConnectFriendWizard::initializePage(int id)
cleanFriendCert();
break;
case Page_Cert:
connect(ui->userFileCreateButton, SIGNAL(clicked()), this, SLOT(generateCertificateCalled()));
connect(ui->friendFileNameOpenButton, SIGNAL(clicked()), this, SLOT(loadFriendCert()));
ui->friendFileNameEdit->setAcceptFile(true);
ui->CertificatePage->registerField("friendCertificateFile*", ui->friendFileNameEdit);
break;
case Page_WebMail:
@ -571,18 +563,6 @@ void ConnectFriendWizard::initializePage(int id)
}
break;
case Page_FriendRecommendations:
ui->frec_recommendList->setHeaderText(tr("Recommend friends"));
ui->frec_recommendList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->frec_recommendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
ui->frec_recommendList->start();
ui->frec_toList->setHeaderText(tr("To"));
ui->frec_toList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->frec_toList->start();
ui->frec_messageEdit->setText(MessageComposer::recommendMessage());
break;
}
}
@ -646,76 +626,10 @@ bool ConnectFriendWizard::validateCurrentPage()
error = false;
break;
}
case Page_Cert:
{
QString fn = ui->friendFileNameEdit->text();
if (QFile::exists(fn)) {
//Todo: move read from file to p3Peers::loadCertificateFromFile
// read from file
std::string certstr;
QFile CertFile(fn);
if (CertFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
certstr = QString(CertFile.readAll()).toStdString();
CertFile.close();
}
if (certstr.empty()) {
setField("errorMessage", QString(tr("Certificate Load Failed:can't read from file %1")).arg(fn+" ") );
error = false;
break;
}
uint32_t cert_error_code;
if (rsPeers->loadDetailsFromStringCert(certstr, peerDetails, cert_error_code) || rsPeers->parseShortInvite(certstr,peerDetails))
{
mCertificate = certstr;
#ifdef FRIEND_WIZARD_DEBUG
std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl;
#endif
if(peerDetails.id == rsPeers->getOwnId())
{
setField("errorMessage", tr("This is your own certificate! You would not want to make friend with yourself. Wouldn't you?") ) ;
error = false;
}
} else {
setField("errorMessage", QString(tr("Certificate Load Failed:something is wrong with %1")).arg(fn) + " : " + getErrorString(cert_error_code));
error = false;
}
} else {
setField("errorMessage", QString(tr("Certificate Load Failed:file %1 not found")).arg(fn));
error = false;
}
break;
}
case Page_ErrorMessage:
break;
case Page_Conclusion:
break;
case Page_FriendRecommendations:
{
std::set<RsPeerId> recommendIds;
ui->frec_recommendList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(recommendIds, false);
if (recommendIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend for recommendation."), QMessageBox::Ok, QMessageBox::Ok);
return false;
}
std::set<RsPeerId> toIds;
ui->frec_toList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(toIds, false);
if (toIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend as recipient."), QMessageBox::Ok, QMessageBox::Ok);
return false;
}
std::set<RsPeerId>::iterator toId;
for (toId = toIds.begin(); toId != toIds.end(); ++toId) {
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
}
}
}
return true;
@ -725,11 +639,9 @@ int ConnectFriendWizard::nextId() const
{
switch ((Page) currentId()) {
case Page_Text:
case Page_Cert:
case Page_WebMail:
case Page_ErrorMessage:
case Page_Conclusion:
case Page_FriendRecommendations:
return -1;
}
@ -1027,6 +939,7 @@ void ConnectFriendWizard::saveCert()
ts << ui->userCertEdit->document()->toPlainText();
}
#ifdef TO_BE_REMOVED
//========================== CertificatePage =================================
void ConnectFriendWizard::loadFriendCert()
@ -1071,7 +984,6 @@ void ConnectFriendWizard::generateCertificateCalled()
}
}
#ifdef TO_BE_REMOVED
//============================= FofPage ======================================
void ConnectFriendWizard::updatePeersList(int index)

View File

@ -50,7 +50,7 @@ class ConnectFriendWizard : public QWizard
Q_PROPERTY(QString titleColor READ titleColor WRITE setTitleColor)
public:
enum Page { Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion, Page_WebMail, Page_FriendRecommendations };
enum Page { Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion, Page_WebMail };
ConnectFriendWizard(QWidget *parent = 0);
~ConnectFriendWizard();
@ -94,8 +94,8 @@ private slots:
ServicePermissionFlags serviceFlags() const ;
/* CertificatePage */
void loadFriendCert();
void generateCertificateCalled();
//void loadFriendCert();
//void generateCertificateCalled();
/* ConclusionPage */
void groupCurrentIndexChanged(int index);

View File

@ -323,69 +323,6 @@
</item>
</layout>
</widget>
<widget class="ConnectFriendPage" name="CertificatePage">
<property name="title">
<string>Certificate files</string>
</property>
<property name="subTitle">
<string>Use PGP certificates saved in files.</string>
</property>
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_Cert</string>
</attribute>
<layout class="QVBoxLayout" name="CertificatePageVLayout">
<item>
<widget class="QGroupBox" name="userFileFrame">
<property name="title">
<string>Import friend's certificate...</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="userFileFrameHLayout">
<item>
<widget class="QLabel" name="userFileLabel">
<property name="text">
<string>You have to generate a file with your certificate and give it to your friend. Also, you can use a file generated before.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="userFileCreateButton">
<property name="text">
<string>Export my certificate...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="friendFileLabel">
<property name="text">
<string>Drag and Drop your friends's certificate in this Window or specify path in the box below</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="friendFileNameHLayout">
<item>
<widget class="DropLineEdit" name="friendFileNameEdit"/>
</item>
<item>
<widget class="QPushButton" name="friendFileNameOpenButton">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="WebmailPage">
<property name="title">
<string>RetroShare is better with Friends </string>
@ -1023,60 +960,6 @@
</item>
</layout>
</widget>
<widget class="QWizardPage" name="FriendRecommendationsPage">
<property name="title">
<string>Friend Recommendations</string>
</property>
<property name="subTitle">
<string>Recommend many friends to each others</string>
</property>
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_FriendRecommendations</string>
</attribute>
<layout class="QVBoxLayout" name="FriendRecommendationsPageVLayout">
<item>
<layout class="QHBoxLayout" name="frec_HLayout">
<item>
<widget class="FriendSelectionWidget" name="frec_recommendList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="FriendSelectionWidget" name="frec_toList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="frec_label">
<property name="text">
<string>Message:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="frec_messageEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
@ -1084,17 +967,6 @@
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DropLineEdit</class>
<extends>QLineEdit</extends>
<header>gui/common/DropLineEdit.h</header>
</customwidget>
<customwidget>
<class>ConnectFriendPage</class>
<extends>QWizardPage</extends>