|
|
|
@ -65,7 +65,7 @@ int main(int argc, char **argv)
|
|
|
|
|
TQString walletFolder = about.appName();
|
|
|
|
|
TQString dialog = I18N_NOOP("Please enter password"); // Default dialog text
|
|
|
|
|
TQString keyFile;
|
|
|
|
|
TQCString password;
|
|
|
|
|
TQString password;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Parse commandline arguments
|
|
|
|
@ -86,14 +86,16 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
|
|
wallet->readPassword(keyFile, retrievedPass);
|
|
|
|
|
|
|
|
|
|
if ( retrievedPass ) {
|
|
|
|
|
if (!retrievedPass.isNull())
|
|
|
|
|
{
|
|
|
|
|
password = retrievedPass;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Password could not be retrieved from wallet. Open password dialog
|
|
|
|
|
if ( !password ) {
|
|
|
|
|
if (password.isNull())
|
|
|
|
|
{
|
|
|
|
|
// create the password dialog, but only show "Enable Keep" button, if the wallet is opened
|
|
|
|
|
KPasswordDialog *kpd = new KPasswordDialog(KPasswordDialog::Password, wallet, 0);
|
|
|
|
|
kpd->setPrompt(dialog);
|
|
|
|
@ -107,7 +109,8 @@ int main(int argc, char **argv)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If "Enable Keep" is enabled, open/create a folder in KWallet and store the password.
|
|
|
|
|
if ( password && wallet && kpd->keep() ) {
|
|
|
|
|
if (!password.isNull() && wallet && kpd->keep())
|
|
|
|
|
{
|
|
|
|
|
if ( !wallet->hasFolder( walletFolder ) ) {
|
|
|
|
|
wallet->createFolder(walletFolder);
|
|
|
|
|
}
|
|
|
|
@ -124,10 +127,13 @@ int main(int argc, char **argv)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Finally return the password if one has been entered
|
|
|
|
|
if (password) {
|
|
|
|
|
std::cout << password;
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
return 1;
|
|
|
|
|
if(!password.isNull())
|
|
|
|
|
{
|
|
|
|
|
std::cout << password.local8Bit();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|