6#include <QCoreApplication>
8bool QtPassSettings::initialized =
false;
10Pass *QtPassSettings::pass;
15QScopedPointer<RealPass> QtPassSettings::realPass;
16QScopedPointer<ImitatePass> QtPassSettings::imitatePass;
20 if (!QtPassSettings::initialized) {
21 QString portable_ini = QCoreApplication::applicationDirPath() +
22 QDir::separator() +
"qtpass.ini";
23 if (QFile(portable_ini).exists()) {
24 m_instance =
new QtPassSettings(portable_ini, QSettings::IniFormat);
63 QHash<QString, QHash<QString, QString>> profiles;
67 if (!childKeys.empty()) {
68 foreach (QString key, childKeys) {
69 QHash<QString, QString> profile;
70 profile.insert(
"path",
getInstance()->value(key).toString());
71 profile.insert(
"signingKey",
"");
72 profiles.insert(key, profile);
77 QStringList childGroups =
getInstance()->childGroups();
78 foreach (QString group, childGroups) {
79 QHash<QString, QString> profile;
80 profile.insert(
"path",
getInstance()->value(group +
"/path").toString());
81 profile.insert(
"signingKey",
82 getInstance()->value(group +
"/signingKey").toString());
84 profiles.insert(group, profile);
93 const QHash<QString, QHash<QString, QString>> &profiles) {
97 QHash<QString, QHash<QString, QString>>::const_iterator i = profiles.begin();
98 for (; i != profiles.end(); ++i) {
99 getInstance()->setValue(i.key() +
"/path", i.value().value(
"path"));
101 i.value().value(
"signingKey"));
242 const int &autoClearPanelSeconds) {
244 autoClearPanelSeconds);
307 returnValue = QDir(returnValue).absolutePath();
311 if (!QDir(returnValue).exists()) {
312 QDir().mkdir(returnValue);
316 if (!returnValue.endsWith(
"/") && !returnValue.endsWith(QDir::separator())) {
317 returnValue += QDir::separator();
336 QString passExecutable =
340 QString gitExecutable =
344 QString gpgExecutable =
348 QString pwgenExecutable =
523 const int &passwordCharsselection) {
525 passwordCharsselection);
614 if (realPass.isNull())
616 return realPass.data();
619 if (imitatePass.isNull())
621 return imitatePass.data();
Imitates pass features when pass is not enabled or available.
Acts as an abstraction for pass or pass imitation.
Singleton that stores qtpass' settings, saves and loads config.
static QString getPassSigningKey(const QString &defaultValue=QVariant().toString())
static void setMaximized(const bool &maximized)
static QString getVersion(const QString &defaultValue=QVariant().toString())
static void setStartMinimized(const bool &startMinimized)
static void setUseWebDav(const bool &useWebDav)
static bool isUseAutoclearPanel(const bool &defaultValue=QVariant().toBool())
static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds)
static void setPassExecutable(const QString &passExecutable)
static bool isUseSymbols(const bool &defaultValue=QVariant().toBool())
static void setHidePassword(const bool &hidePassword)
static bool isUseTemplate(const bool &defaultValue=QVariant().toBool())
static void setPwgenExecutable(const QString &pwgenExecutable)
static QString getWebDavUrl(const QString &defaultValue=QVariant().toString())
static void setProfile(const QString &profile)
static bool isTemplateAllFields(const bool &defaultValue=QVariant().toBool())
static int getAutoclearPanelSeconds(const int &defaultValue=QVariant().toInt())
static void setUseTrayIcon(const bool &useTrayIcon)
static void setWebDavPassword(const QString &webDavPassword)
static bool isUseOtp(const bool &defaultValue=QVariant().toBool())
static bool isLessRandom(const bool &defaultValue=QVariant().toBool())
static void setPassStore(const QString &passStore)
static ImitatePass * getImitatePass()
static void setPasswordConfiguration(const PasswordConfiguration &config)
static bool isUseGit(const bool &defaultValue=QVariant().toBool())
static void setHideOnClose(const bool &hideOnClose)
static bool isUsePass(const bool &defaultValue=QVariant().toBool())
static bool isAlwaysOnTop(const bool &defaultValue=QVariant().toBool())
static void setPasswordLength(const int &passwordLength)
static QString getPassTemplate(const QString &defaultValue=QVariant().toString())
static void setGitExecutable(const QString &gitExecutable)
static void setPasswordChars(const QString &passwordChars)
static void setUseOtp(const bool &useOtp)
static int getAutoclearSeconds(const int &defaultValue=QVariant().toInt())
static void setProfiles(const QHash< QString, QHash< QString, QString > > &profiles)
static QString getProfile(const QString &defaultValue=QVariant().toString())
static void setUsePwgen(const bool &usePwgen)
static bool isHideOnClose(const bool &defaultValue=QVariant().toBool())
static QByteArray getGeometry(const QByteArray &defaultValue=QVariant().toByteArray())
static void setPassSigningKey(const QString &passSigningKey)
static bool isAvoidNumbers(const bool &defaultValue=QVariant().toBool())
static QString getPwgenExecutable(const QString &defaultValue=QVariant().toString())
static void setPasswordCharsselection(const int &passwordCharsselection)
static bool isAutoPull(const bool &defaultValue=QVariant().toBool())
static QByteArray getSavestate(const QByteArray &defaultValue=QVariant().toByteArray())
static bool isUseTrayIcon(const bool &defaultValue=QVariant().toBool())
static QString getWebDavUser(const QString &defaultValue=QVariant().toString())
static bool isDisplayAsIs(const bool &defaultValue=QVariant().toBool())
static QHash< QString, QHash< QString, QString > > getProfiles()
static void initExecutables()
static void setUseTemplate(const bool &useTemplate)
static bool isUsePwgen(const bool &defaultValue=QVariant().toBool())
static bool isUseWebDav(const bool &defaultValue=QVariant().toBool())
static bool isAvoidCapitals(const bool &defaultValue=QVariant().toBool())
static void setAutoPull(const bool &autoPull)
static void setPassTemplate(const QString &passTemplate)
static void setGpgExecutable(const QString &gpgExecutable)
static bool isStartMinimized(const bool &defaultValue=QVariant().toBool())
static void setPos(const QPoint &pos)
static void setVersion(const QString &version)
static void setUseAutoclear(const bool &useAutoclear)
static void setAlwaysOnTop(const bool &alwaysOnTop)
static QString getGpgExecutable(const QString &defaultValue=QVariant().toString())
static void setWebDavUser(const QString &webDavUser)
static void setDisplayAsIs(const bool &displayAsIs)
static void setUseMonospace(const bool &useMonospace)
static void setAvoidCapitals(const bool &avoidCapitals)
static PasswordConfiguration getPasswordConfiguration()
static void setQrencodeExecutable(const QString &qrencodeExecutable)
static void setWebDavUrl(const QString &webDavUrl)
static Enums::clipBoardType getClipBoardType(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
static void setAddGPGId(const bool &addGPGId)
static void setUsePass(const bool &usePass)
static RealPass * getRealPass()
static bool isUseMonospace(const bool &defaultValue=QVariant().toBool())
static bool isUseQrencode(const bool &defaultValue=QVariant().toBool())
static int getClipBoardTypeRaw(const Enums::clipBoardType &defaultvalue=Enums::CLIPBOARD_NEVER)
static bool isAutoPush(const bool &defaultValue=QVariant().toBool())
static bool isHideContent(const bool &defaultValue=QVariant().toBool())
static QtPassSettings * getInstance()
static QString getPassStore(const QString &defaultValue=QVariant().toString())
static void setSavestate(const QByteArray &saveState)
static void setUseAutoclearPanel(const bool &useAutoclearPanel)
static void setAutoclearSeconds(const int &autoClearSeconds)
static void setNoLineWrapping(const bool &noLineWrapping)
static QString getQrencodeExecutable(const QString &defaultValue=QVariant().toString())
static void setUseQrencode(const bool &useQrencode)
static bool isNoLineWrapping(const bool &defaultValue=QVariant().toBool())
static void setAvoidNumbers(const bool &avoidNumbers)
static QPoint getPos(const QPoint &defaultValue=QVariant().toPoint())
static QSize getSize(const QSize &defaultValue=QVariant().toSize())
static void setAutoPush(const bool &autoPush)
static void setClipBoardType(const int &clipBoardType)
static void setSize(const QSize &size)
static bool isUseAutoclear(const bool &defaultValue=QVariant().toBool())
static QString getWebDavPassword(const QString &defaultValue=QVariant().toString())
static void setLessRandom(const bool &lessRandom)
static QString getGpgHome(const QString &defaultValue=QVariant().toString())
static bool isMaximized(const bool &defaultValue=QVariant().toBool())
static void setHideContent(const bool &hideContent)
static void setGeometry(const QByteArray &geometry)
static QString getPassExecutable(const QString &defaultValue=QVariant().toString())
static QString getGitExecutable(const QString &defaultValue=QVariant().toString())
static void setUseSelection(const bool &useSelection)
static void setTemplateAllFields(const bool &templateAllFields)
static void setUseSymbols(const bool &useSymbols)
static bool isAddGPGId(const bool &defaultValue=QVariant().toBool())
static bool isHidePassword(const bool &defaultValue=QVariant().toBool())
static bool isUseSelection(const bool &defaultValue=QVariant().toBool())
static void setUseGit(const bool &useGit)
Wrapper for executing pass to handle the password-store.
static const QString maximized
static const QString savestate
static const QString useSelection
static const QString passExecutable
static const QString noLineWrapping
static const QString autoPull
static const QString lessRandom
static const QString pwgenExecutable
static const QString geometry
static const QString gpgHome
static const QString version
static const QString passTemplate
static const QString useAutoclear
static const QString webDavUrl
static const QString clipBoardType
static const QString autoclearPanelSeconds
static const QString avoidNumbers
static const QString useAutoclearPanel
static const QString useWebDav
static const QString usePass
static const QString hideOnClose
static const QString alwaysOnTop
static const QString useGit
static const QString gitExecutable
static const QString gpgExecutable
static const QString profile
static const QString useTrayIcon
static const QString size
static const QString useOtp
static const QString startMinimized
static const QString hideContent
static const QString avoidCapitals
static const QString webDavUser
static const QString autoclearSeconds
static const QString usePwgen
static const QString useMonospace
static const QString passwordLength
static const QString qrencodeExecutable
static const QString passStore
static const QString passwordChars
static const QString webDavPassword
static const QString displayAsIs
static const QString useSymbols
static const QString passSigningKey
static const QString templateAllFields
static const QString passwordCharsselection
static const QString addGPGId
static const QString useQrencode
static const QString useTemplate
static const QString autoPush
static const QString hidePassword
static QString findBinaryInPath(QString binary)
Util::findBinaryInPath search for executables.
Holds the Password configuration settings.
int length
Length of the password.
enum PasswordConfiguration::characterSet selected
characterSet
The selected character set.
QString Characters[CHARSETS_COUNT]
The different character sets.