mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -04:00
added to store own key into a file.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2151 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
af973cdf5b
commit
cf9309733b
3 changed files with 49 additions and 1 deletions
|
@ -44,6 +44,7 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
|
|||
|
||||
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
|
||||
connect(ui.exportkeyButton, SIGNAL(clicked()), this, SLOT(exportPublicKey()));
|
||||
connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
|
||||
|
||||
|
||||
loadPublicKey();
|
||||
|
@ -120,3 +121,36 @@ CryptoPage::exportPublicKey()
|
|||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
bool CryptoPage::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 << ui.certtextEdit->document()->toPlainText();
|
||||
ui.certtextEdit->document()->setModified(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoPage::fileSaveAs()
|
||||
{
|
||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save as..."),
|
||||
QString(), tr("TXT-Files (*.pqi *.pem *.txt);;All Files (*)"));
|
||||
if (fn.isEmpty())
|
||||
return false;
|
||||
setCurrentFileName(fn);
|
||||
return fileSave();
|
||||
}
|
||||
|
||||
void CryptoPage::setCurrentFileName(const QString &fileName)
|
||||
{
|
||||
this->fileName = fileName;
|
||||
ui.certtextEdit->document()->setModified(false);
|
||||
|
||||
setWindowModified(false);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue