diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp
index d0d103b02..143281b78 100755
--- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp
+++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp
@@ -234,7 +234,16 @@ TextPage::TextPage(QWidget *parent)
userCertCopyButton->setIcon( QIcon(":images/copyrslink.png") );
userCertCopyButton->setToolTip(tr("Copy your Cert to Clipboard"));
connect (userCertCopyButton, SIGNAL( clicked()),
- this, SLOT( copyCert()) );
+ this, SLOT( copyCert()) );
+
+ userCertSaveButton = new QPushButton;
+ userCertSaveButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ userCertSaveButton->setFixedSize(20,20);
+ userCertSaveButton->setFlat(true);
+ userCertSaveButton->setIcon( QIcon(":images/document_save.png") );
+ userCertSaveButton->setToolTip(tr("Save your Cert into a File"));
+ connect (userCertSaveButton, SIGNAL( clicked()),
+ this, SLOT( fileSaveAs()) );
#if defined(Q_OS_WIN)
userCertMailButton = new QPushButton;
@@ -249,6 +258,7 @@ TextPage::TextPage(QWidget *parent)
userCertButtonsLayout = new QVBoxLayout();
userCertButtonsLayout->addWidget(userCertHelpButton);
userCertButtonsLayout->addWidget(userCertCopyButton);
+ userCertButtonsLayout->addWidget(userCertSaveButton);
#if defined(Q_OS_WIN)
userCertButtonsLayout->addWidget(userCertMailButton);
#endif
@@ -338,6 +348,44 @@ TextPage::copyCert()
//============================================================================
//
+bool TextPage::fileSave()
+{
+ if (fileName.isEmpty())
+ return fileSaveAs();
+
+ QFile file(fileName);
+ if (!file.open(QFile::WriteOnly))
+ return false;
+ QTextStream ts(&file);
+ ts.setCodec(QTextCodec::codecForName("UTF-8"));
+ ts << userCertEdit->document()->toPlainText();
+ userCertEdit->document()->setModified(false);
+ return true;
+}
+
+bool TextPage::fileSaveAs()
+{
+ QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
+ QString(), tr("RetroShare Certificate (*.rsc );;All Files (*)"));
+ if (fn.isEmpty())
+ return false;
+ setCurrentFileName(fn);
+ return fileSave();
+}
+
+void TextPage::setCurrentFileName(const QString &fileName)
+{
+ this->fileName = fileName;
+ userCertEdit->document()->setModified(false);
+
+ setWindowModified(false);
+}
+
+
+//
+//============================================================================
+//
+
int TextPage::nextId() const {
std::string certstr;
diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.h b/retroshare-gui/src/gui/connect/ConnectFriendWizard.h
index 74d72b2fc..2bef3aabe 100755
--- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.h
+++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.h
@@ -80,6 +80,7 @@ private:
QVBoxLayout* userCertButtonsLayout;
QPushButton* userCertHelpButton;
QPushButton* userCertCopyButton;
+ QPushButton* userCertSaveButton;
#if defined(Q_OS_WIN)
QPushButton* userCertMailButton;//! on Windows, click on this button
//! launches default email client
@@ -88,11 +89,18 @@ private:
QTextEdit* friendCertEdit;
QVBoxLayout* textPageLayout;
+
+ void setCurrentFileName(const QString &fileName);
+
+ QString fileName;
private slots:
void showHelpUserCert();
void copyCert();
+ bool fileSave();
+ bool fileSaveAs();
+
#if defined(Q_OS_WIN)
//! launches default email client (on windows)
diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc
index 6c6320157..010bc2246 100644
--- a/retroshare-gui/src/gui/images.qrc
+++ b/retroshare-gui/src/gui/images.qrc
@@ -114,6 +114,7 @@
images/directoryselect_24x24_shadow.png
images/diskSave.png
images/dlunch.png
+ images/document_save.png
images/donline.png
images/down.png
images/down_24x24.png
diff --git a/retroshare-gui/src/gui/images/document_save.png b/retroshare-gui/src/gui/images/document_save.png
new file mode 100644
index 000000000..076da14a4
Binary files /dev/null and b/retroshare-gui/src/gui/images/document_save.png differ