mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
Added Save Cert Button to ConnectFriend Wizard
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2294 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0a5e3c9b63
commit
2573a05dfe
@ -234,7 +234,16 @@ TextPage::TextPage(QWidget *parent)
|
|||||||
userCertCopyButton->setIcon( QIcon(":images/copyrslink.png") );
|
userCertCopyButton->setIcon( QIcon(":images/copyrslink.png") );
|
||||||
userCertCopyButton->setToolTip(tr("Copy your Cert to Clipboard"));
|
userCertCopyButton->setToolTip(tr("Copy your Cert to Clipboard"));
|
||||||
connect (userCertCopyButton, SIGNAL( clicked()),
|
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)
|
#if defined(Q_OS_WIN)
|
||||||
userCertMailButton = new QPushButton;
|
userCertMailButton = new QPushButton;
|
||||||
@ -249,6 +258,7 @@ TextPage::TextPage(QWidget *parent)
|
|||||||
userCertButtonsLayout = new QVBoxLayout();
|
userCertButtonsLayout = new QVBoxLayout();
|
||||||
userCertButtonsLayout->addWidget(userCertHelpButton);
|
userCertButtonsLayout->addWidget(userCertHelpButton);
|
||||||
userCertButtonsLayout->addWidget(userCertCopyButton);
|
userCertButtonsLayout->addWidget(userCertCopyButton);
|
||||||
|
userCertButtonsLayout->addWidget(userCertSaveButton);
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
userCertButtonsLayout->addWidget(userCertMailButton);
|
userCertButtonsLayout->addWidget(userCertMailButton);
|
||||||
#endif
|
#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 {
|
int TextPage::nextId() const {
|
||||||
|
|
||||||
std::string certstr;
|
std::string certstr;
|
||||||
|
@ -80,6 +80,7 @@ private:
|
|||||||
QVBoxLayout* userCertButtonsLayout;
|
QVBoxLayout* userCertButtonsLayout;
|
||||||
QPushButton* userCertHelpButton;
|
QPushButton* userCertHelpButton;
|
||||||
QPushButton* userCertCopyButton;
|
QPushButton* userCertCopyButton;
|
||||||
|
QPushButton* userCertSaveButton;
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QPushButton* userCertMailButton;//! on Windows, click on this button
|
QPushButton* userCertMailButton;//! on Windows, click on this button
|
||||||
//! launches default email client
|
//! launches default email client
|
||||||
@ -88,11 +89,18 @@ private:
|
|||||||
QTextEdit* friendCertEdit;
|
QTextEdit* friendCertEdit;
|
||||||
|
|
||||||
QVBoxLayout* textPageLayout;
|
QVBoxLayout* textPageLayout;
|
||||||
|
|
||||||
|
void setCurrentFileName(const QString &fileName);
|
||||||
|
|
||||||
|
QString fileName;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showHelpUserCert();
|
void showHelpUserCert();
|
||||||
void copyCert();
|
void copyCert();
|
||||||
|
|
||||||
|
bool fileSave();
|
||||||
|
bool fileSaveAs();
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
//! launches default email client (on windows)
|
//! launches default email client (on windows)
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@
|
|||||||
<file>images/directoryselect_24x24_shadow.png</file>
|
<file>images/directoryselect_24x24_shadow.png</file>
|
||||||
<file>images/diskSave.png</file>
|
<file>images/diskSave.png</file>
|
||||||
<file>images/dlunch.png</file>
|
<file>images/dlunch.png</file>
|
||||||
|
<file>images/document_save.png</file>
|
||||||
<file>images/donline.png</file>
|
<file>images/donline.png</file>
|
||||||
<file>images/down.png</file>
|
<file>images/down.png</file>
|
||||||
<file>images/down_24x24.png</file>
|
<file>images/down_24x24.png</file>
|
||||||
|
BIN
retroshare-gui/src/gui/images/document_save.png
Normal file
BIN
retroshare-gui/src/gui/images/document_save.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 581 B |
Loading…
Reference in New Issue
Block a user