From 141bfa2ec93a8c402f945d66992a4ef82f59a4d3 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 12 Nov 2020 23:16:31 +0100 Subject: [PATCH] directly export current profile instead of showing profile manager, since profile manager only allows to export anyway --- .../src/gui/connect/ConnectFriendWizard.ui | 6 ++--- .../src/gui/settings/CryptoPage.cpp | 25 ++++++++++++++++++- retroshare-gui/src/gui/settings/CryptoPage.h | 3 ++- retroshare-gui/src/gui/settings/CryptoPage.ui | 7 ++++-- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui b/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui index e80105688..c9f117eb3 100644 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.ui @@ -6,8 +6,8 @@ 0 0 - 600 - 400 + 654 + 677 @@ -284,7 +284,7 @@ Email - + :/icons/mail_128.png:/icons/mail_128.png diff --git a/retroshare-gui/src/gui/settings/CryptoPage.cpp b/retroshare-gui/src/gui/settings/CryptoPage.cpp index 6be5b943d..99317c14d 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.cpp +++ b/retroshare-gui/src/gui/settings/CryptoPage.cpp @@ -29,6 +29,7 @@ #include "CryptoPage.h" #include "util/misc.h" #include "util/DateTime.h" +#include "retroshare/rsinit.h" #include #include #include @@ -57,16 +58,38 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags) // hide profile manager as it causes bugs when generating a new profile. //ui.profile_Button->hide() ; - connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(profilemanager())); + //connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(profilemanager())); + connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(exportProfile())); ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime())); } +#ifdef UNUSED_CODE void CryptoPage::profilemanager() { ProfileManager().exec(); } +#endif + +void CryptoPage::exportProfile() +{ + RsPgpId gpgId(rsPeers->getGPGOwnId()); + + QString fname = QFileDialog::getSaveFileName(this, tr("Export Identity"), "", tr("RetroShare Identity files (*.asc)")); + + if (fname.isNull()) + return; + + if (fname.right(4).toUpper() != ".ASC") fname += ".asc"; + + if (RsAccounts::ExportIdentity(fname.toUtf8().constData(), gpgId)) + QMessageBox::information(this, tr("Identity saved"), tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it")); + else + QMessageBox::information(this, tr("Identity not saved"), tr("Your identity was not saved. An error occurred.")); +} + + void CryptoPage::showEvent ( QShowEvent * /*event*/ ) { RsPeerDetails detail; diff --git a/retroshare-gui/src/gui/settings/CryptoPage.h b/retroshare-gui/src/gui/settings/CryptoPage.h index abd8bcb6c..e595c63c4 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.h +++ b/retroshare-gui/src/gui/settings/CryptoPage.h @@ -42,11 +42,12 @@ class CryptoPage : public ConfigPage virtual QString helpText() const { return ""; } private slots: + void exportProfile(); virtual void load(); void copyPublicKey(); void copyRSLink() ; virtual void showEvent ( QShowEvent * event ); - void profilemanager(); +// void profilemanager(); bool fileSave(); bool fileSaveAs(); void showStats(); diff --git a/retroshare-gui/src/gui/settings/CryptoPage.ui b/retroshare-gui/src/gui/settings/CryptoPage.ui index bf986996b..6f45b9ea8 100755 --- a/retroshare-gui/src/gui/settings/CryptoPage.ui +++ b/retroshare-gui/src/gui/settings/CryptoPage.ui @@ -6,8 +6,8 @@ 0 0 - 644 - 459 + 869 + 487 @@ -246,6 +246,9 @@ + + <html><head/><body><p>Use this to export your profile key. You can then import it in a different computer and make a new node with the same profile. Doing so, existing friends that you also add to the new node will automatically recognise that new node as friend.</p></body></html> + Export