directly export current profile instead of showing profile manager, since profile manager only allows to export anyway

This commit is contained in:
csoler 2020-11-12 23:16:31 +01:00
parent 3d958a7592
commit 141bfa2ec9
4 changed files with 34 additions and 7 deletions

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>654</width>
<height>400</height> <height>677</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -284,7 +284,7 @@
<string>Email</string> <string>Email</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../icons.qrc"> <iconset>
<normaloff>:/icons/mail_128.png</normaloff>:/icons/mail_128.png</iconset> <normaloff>:/icons/mail_128.png</normaloff>:/icons/mail_128.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">

View File

@ -29,6 +29,7 @@
#include "CryptoPage.h" #include "CryptoPage.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include "retroshare/rsinit.h"
#include <gui/RetroShareLink.h> #include <gui/RetroShareLink.h>
#include <gui/connect/ConfCertDialog.h> #include <gui/connect/ConfCertDialog.h>
#include <gui/profile/ProfileManager.h> #include <gui/profile/ProfileManager.h>
@ -57,16 +58,38 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags)
// hide profile manager as it causes bugs when generating a new profile. // hide profile manager as it causes bugs when generating a new profile.
//ui.profile_Button->hide() ; //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())); ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime()));
} }
#ifdef UNUSED_CODE
void CryptoPage::profilemanager() void CryptoPage::profilemanager()
{ {
ProfileManager().exec(); 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*/ ) void CryptoPage::showEvent ( QShowEvent * /*event*/ )
{ {
RsPeerDetails detail; RsPeerDetails detail;

View File

@ -42,11 +42,12 @@ class CryptoPage : public ConfigPage
virtual QString helpText() const { return ""; } virtual QString helpText() const { return ""; }
private slots: private slots:
void exportProfile();
virtual void load(); virtual void load();
void copyPublicKey(); void copyPublicKey();
void copyRSLink() ; void copyRSLink() ;
virtual void showEvent ( QShowEvent * event ); virtual void showEvent ( QShowEvent * event );
void profilemanager(); // void profilemanager();
bool fileSave(); bool fileSave();
bool fileSaveAs(); bool fileSaveAs();
void showStats(); void showStats();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>644</width> <width>869</width>
<height>459</height> <height>487</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@ -246,6 +246,9 @@
</item> </item>
<item row="14" column="1"> <item row="14" column="1">
<widget class="QPushButton" name="exportprofile"> <widget class="QPushButton" name="exportprofile">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>Export</string> <string>Export</string>
</property> </property>