4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-13 11:09:34 +00:00

put event handler in a side thread

svn path=/trunk/kdesupport/qca/; revision=651447
This commit is contained in:
Justin Karneges 2007-04-07 18:34:52 +00:00
parent ee57685090
commit 023e0c1093

@ -277,6 +277,34 @@ private slots:
}
};
class PassphrasePromptThread : public QCA::SyncThread
{
Q_OBJECT
public:
PassphrasePrompt *pp;
PassphrasePromptThread()
{
start();
}
~PassphrasePromptThread()
{
stop();
}
protected:
virtual void atStart()
{
pp = new PassphrasePrompt;
}
virtual void atEnd()
{
delete pp;
}
};
static bool promptForNewPassphrase(QSecureArray *result)
{
QSecureArray out = QCA::ConsolePrompt::getHidden("Enter new passphrase");
@ -1764,6 +1792,13 @@ int main(int argc, char **argv)
// for all other commands, we set up keystore/prompter:
// enable console passphrase prompt
PassphrasePromptThread passphrasePrompt;
if(!allowprompt)
passphrasePrompt.pp->allowPrompt = false;
if(have_pass)
passphrasePrompt.pp->setExplicitPassword(pass);
// activate the KeyStoreManager and block until ready
QCA::KeyStoreManager::start();
{
@ -1771,13 +1806,6 @@ int main(int argc, char **argv)
ksm.waitForBusyFinished();
}
// enable console passphrase prompt
PassphrasePrompt passphrasePrompt;
if(!allowprompt)
passphrasePrompt.allowPrompt = false;
if(have_pass)
passphrasePrompt.setExplicitPassword(pass);
// TODO: for each kind of operation, we need to check for support first!!
if(args[0] == "key")
{