Module::Module()
: Plugins::iPlugin()
, mReady(false)
- , mGenerator(false)
- , mStorage(false)
+ , mGenerator(0)
+ , mStorage(0)
, mEvReady(0)
{
setObjectName(QString("%1-Module").arg(VER_MODULE_NAME_STR));
{
QString masterPassword;
QString appName;
- int passwordLength = DefaultPasswordLength;
+ int passwordLength = 0;
// Process command-line arguments
QStringList args = QCoreApplication::arguments();
QExplicitlySharedDataPointer<PswGen::Storage::Data> data;
if (mStorage) {
data = mStorage->query(appName);
- if (data)
+ if (data && passwordLength == 0)
passwordLength = data->length();
}
+ // If the length argument is still not initialized, use the default length value
+ if (!passwordLength)
+ passwordLength = DefaultPasswordLength;
+
// Generate password
QString password = mGenerator->generatePassword(appName, masterPassword, passwordLength);
cout << "Generated password : " << password << endl;
if (mStorage) {
if (!data)
data = new Storage::Data(appName, passwordLength);
+ else
+ data->setLength(passwordLength);
mStorage->save(appName, data);
}
}