Add certificate-save functionality

* usr can also choose where to save certificate



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@586 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2008-06-07 20:25:25 +00:00
parent 8103b0c372
commit 6b4d072bb0
3 changed files with 52 additions and 17 deletions

View File

@ -22,6 +22,7 @@
#include "InviteDialog.h"
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <util/WidgetBackgroundImage.h>
/** Default constructor */
@ -37,6 +38,7 @@ InviteDialog::InviteDialog(QWidget *parent, Qt::WFlags flags)
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancelbutton()));
connect(ui.emailButton, SIGNAL(clicked()), this, SLOT(emailbutton()));
connect(ui.doneButton, SIGNAL(clicked()), this, SLOT(closebutton()));
connect(ui.sCertButton, SIGNAL(clicked()), this, SLOT(savecertbutton()));
//setFixedSize(QSize(434, 462));
}
@ -103,4 +105,14 @@ void InviteDialog::setInfo(std::string invite)
ui.emailText->setText(QString::fromStdString(invite));
}
void InviteDialog::savecertbutton(void)
{
std::string filename = rsPeers->getPeerName(rsPeers->getOwnId()); // file name will be user name
filename += ".pqi"; // append retroshare cert extension
QString qdir = QFileDialog::getExistingDirectory(this, tr("Please Choose Directory to Save Certificate"), "",
false); // get current directory
qdir += tr(filename.c_str()); // append file name to directory
rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()); // save to file
}

View File

@ -24,6 +24,7 @@
#define _INVITEDIALOG_H
#include <QDialog>
#include <QFileDialog>
#include "ui_InviteDialog.h"
@ -45,6 +46,8 @@ private slots:
void closebutton();
void cancelbutton();
void emailbutton();
/// saves your certificate to file to send to friends
void savecertbutton();
private:

View File

@ -44,7 +44,7 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="5" >
<item row="1" column="0" colspan="7" >
<widget class="QTextEdit" name="emailText" >
<property name="readOnly" >
<bool>true</bool>
@ -52,7 +52,7 @@
<property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
&lt;/style>&lt;/head>&lt;body style=" font-family:'Helvetica'; font-size:10pt; font-weight:400; font-style:normal;">
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-size:8pt;">&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="acceptRichText" >
@ -60,7 +60,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="0" column="0" colspan="5" >
<item row="0" column="0" colspan="7" >
<widget class="QLabel" name="invitefriendLabel" >
<property name="palette" >
<palette>
@ -496,19 +496,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" >
<widget class="QPushButton" name="cancelButton" >
<property name="minimumSize" >
@ -535,7 +522,7 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="2" column="4" >
<item row="2" column="6" >
<widget class="QPushButton" name="doneButton" >
<property name="minimumSize" >
<size>
@ -548,6 +535,39 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="4" >
<widget class="QPushButton" name="sCertButton" >
<property name="text" >
<string>Save Cert To File</string>
</property>
</widget>
</item>
<item row="2" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="5" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>