mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -04:00
Added new settings which will be replace soon as possible Preferences
Changend Quit RetroShare MessageBox with "Yes" and not more with "OK" git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1412 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c99e03f376
commit
6abadc6375
36 changed files with 8708 additions and 27 deletions
143
retroshare-gui/src/gui/settings/CryptoPage.cpp
Executable file
143
retroshare-gui/src/gui/settings/CryptoPage.cpp
Executable file
|
@ -0,0 +1,143 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2006 - 2009 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include "rsiface/rspeers.h" //for rsPeers variable
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include <QClipboard>
|
||||
|
||||
#include <rshare.h>
|
||||
#include "CryptoPage.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
/** Constructor */
|
||||
CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Create RshareSettings object */
|
||||
_settings = new RshareSettings();
|
||||
|
||||
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
|
||||
connect(ui.exportkeyButton, SIGNAL(clicked()), this, SLOT(exportPublicKey()));
|
||||
|
||||
|
||||
loadPublicKey();
|
||||
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CryptoPage::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
/** Saves the changes on this page */
|
||||
bool
|
||||
CryptoPage::save(QString &errmsg)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void
|
||||
CryptoPage::load()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/** Loads ouer default Puplickey */
|
||||
void
|
||||
CryptoPage::loadPublicKey()
|
||||
{
|
||||
//std::cerr << "CryptoPage() getting Invite" << std::endl;
|
||||
|
||||
std::string invite = rsPeers->GetRetroshareInvite();
|
||||
|
||||
RsPeerDetails ownDetail;
|
||||
rsPeers->getPeerDetails(rsPeers->getOwnId(), ownDetail);
|
||||
invite += LOCAL_IP;
|
||||
invite += ownDetail.localAddr + ":";
|
||||
std::ostringstream out;
|
||||
out << ownDetail.localPort;
|
||||
invite += out.str() + ";";
|
||||
invite += "\n";
|
||||
invite += EXT_IP;
|
||||
invite += ownDetail.extAddr + ":";
|
||||
std::ostringstream out2;
|
||||
out2 << ownDetail.extPort;
|
||||
invite += out2.str() + ";";
|
||||
|
||||
ui.certtextEdit->setText(QString::fromStdString(invite));
|
||||
ui.certtextEdit->setReadOnly(true);
|
||||
ui.certtextEdit->setMinimumHeight(200);
|
||||
|
||||
//std::cerr << "CryptoPage() getting Invite: " << invite << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CryptoPage::copyPublicKey()
|
||||
{
|
||||
QMessageBox::information(this,
|
||||
tr("RetroShare"),
|
||||
tr("Your Public Key is copied to Clipbard, paste and send it to your"
|
||||
"friend via email or some other way"));
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(ui.certtextEdit->toPlainText());
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CryptoPage::exportPublicKey()
|
||||
{
|
||||
qDebug() << " exportPulicKey";
|
||||
|
||||
QString qdir = QFileDialog::getSaveFileName(this,
|
||||
"Please choose a filename",
|
||||
QDir::homePath(),
|
||||
"RetroShare Certificate (*.pqi)");
|
||||
|
||||
if ( rsPeers->SaveCertificateToFile(rsPeers->getOwnId(), qdir.toStdString()) )
|
||||
{
|
||||
QMessageBox::information(this, tr("RetroShare"),
|
||||
tr("Certificate file successfully created"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("RetroShare"),
|
||||
tr("Sorry, certificate file creation failed"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue