mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
added dialog box to import existing keyrings when starting the new pgp version for the first time
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5210 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2e05d0ef01
commit
a91e859b66
6 changed files with 145 additions and 28 deletions
|
@ -80,22 +80,48 @@ int main(int argc, char *argv[])
|
|||
RsInit::InitRsConfig();
|
||||
int initResult = RsInit::InitRetroShare(argc, argv);
|
||||
|
||||
if(initResult == RS_INIT_NO_KEYRING) // happens when we already have accounts, but no pgp key. This is when switching to the openpgp-sdk version.
|
||||
{
|
||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(QObject::tr("This version of RetroShare is using OpenPGP-SDK. As a side effect, it's not using the system shared PGP keyring, but has its own keyring shared by all RetroShare instances. <br/><br/>You do not appear to have such a keyring, although GPG keys are mentionned by existing RetroShare accounts, probably because you just changed to this new version of the software."));
|
||||
msgBox.setInformativeText(QObject::tr("Choose between:<Br/><ul><li>Ok to copy the existing keyring from gnupg (safest bet), or </li><li>Discard to start fresh with an empty keyring (you will be asked to create a new PGP key to work with RetroShare). </li><li>Cancel to quit and forge a keyring by yourself (needs some PGP skills)</li></ul>"));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Discard | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if(ret == QMessageBox::Cancel)
|
||||
return 0 ;
|
||||
if(ret == QMessageBox::Ok)
|
||||
{
|
||||
if(!RsInit::copyGnuPGKeyrings())
|
||||
return 0 ;
|
||||
|
||||
initResult = RsInit::InitRetroShare(argc, argv);
|
||||
}
|
||||
else
|
||||
initResult = RS_INIT_OK ;
|
||||
}
|
||||
|
||||
if (initResult < 0) {
|
||||
/* Error occured */
|
||||
QApplication dummyApp (argc, argv); // needed for QMessageBox
|
||||
QMessageBox mb(QMessageBox::Critical, QObject::tr("RetroShare"), "", QMessageBox::Ok);
|
||||
mb.setWindowIcon(QIcon(":/images/rstray3.png"));
|
||||
|
||||
switch (initResult) {
|
||||
case RS_INIT_AUTH_FAILED:
|
||||
std::cerr << "RsInit::InitRetroShare AuthGPG::InitAuth failed" << std::endl;
|
||||
mb.setText(QObject::tr("Inititialize failed. Wrong or missing installation of gpg."));
|
||||
break;
|
||||
default:
|
||||
/* Unexpected return code */
|
||||
std::cerr << "RsInit::InitRetroShare unexpected return code " << initResult << std::endl;
|
||||
mb.setText(QObject::tr("An unexpected error occured. Please report 'RsInit::InitRetroShare unexpected return code %1'.").arg(initResult));
|
||||
break;
|
||||
switch (initResult)
|
||||
{
|
||||
case RS_INIT_AUTH_FAILED:
|
||||
std::cerr << "RsInit::InitRetroShare AuthGPG::InitAuth failed" << std::endl;
|
||||
mb.setText(QObject::tr("Inititialize failed. Wrong or missing installation of gpg."));
|
||||
break;
|
||||
default:
|
||||
/* Unexpected return code */
|
||||
std::cerr << "RsInit::InitRetroShare unexpected return code " << initResult << std::endl;
|
||||
mb.setText(QObject::tr("An unexpected error occured. Please report 'RsInit::InitRetroShare unexpected return code %1'.").arg(initResult));
|
||||
break;
|
||||
}
|
||||
mb.exec();
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue