LCOV - code coverage report
Current view: top level - src - qtpasssettings.h (source / functions) Coverage Total Hit
Test: .lcov.total Lines: 20.0 % 5 1
Test Date: 2026-03-23 21:55:57 Functions: 0.0 % 1 0

            Line data    Source code
       1              : // SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
       2              : // SPDX-License-Identifier: GPL-3.0-or-later
       3              : #ifndef SRC_QTPASSSETTINGS_H_
       4              : #define SRC_QTPASSSETTINGS_H_
       5              : 
       6              : #include "enums.h"
       7              : #include "imitatepass.h"
       8              : #include "passwordconfiguration.h"
       9              : #include "realpass.h"
      10              : #include "settingsconstants.h"
      11              : 
      12              : #include <QByteArray>
      13              : #include <QHash>
      14              : #include <QPoint>
      15              : #include <QSettings>
      16              : #include <QSize>
      17              : #include <QVariant>
      18              : 
      19              : /*!
      20              :     \class QtPassSettings
      21              :     \brief Singleton that stores qtpass' settings, saves and loads config
      22              : */
      23              : class QtPassSettings : public QSettings {
      24              : private:
      25              :   explicit QtPassSettings();
      26              : 
      27              :   QtPassSettings(const QString &organization, const QSettings::Format format)
      28            0 :       : QSettings(organization, format) {}
      29              :   QtPassSettings(const QString &organization, const QString &application)
      30           85 :       : QSettings(organization, application) {}
      31              : 
      32            0 :   virtual ~QtPassSettings() {}
      33              : 
      34              :   static bool initialized;
      35              :   static QtPassSettings *m_instance;
      36              : 
      37              :   static Pass *pass;
      38              :   static QScopedPointer<RealPass> realPass;
      39              :   static QScopedPointer<ImitatePass> imitatePass;
      40              : 
      41              : public:
      42              :   static auto getInstance() -> QtPassSettings *;
      43              : 
      44              :   static auto getVersion(const QString &defaultValue = QVariant().toString())
      45              :       -> QString;
      46              :   static void setVersion(const QString &version);
      47              : 
      48              :   static auto
      49              :   getGeometry(const QByteArray &defaultValue = QVariant().toByteArray())
      50              :       -> QByteArray;
      51              :   static void setGeometry(const QByteArray &geometry);
      52              : 
      53              :   static auto
      54              :   getSavestate(const QByteArray &defaultValue = QVariant().toByteArray())
      55              :       -> QByteArray;
      56              :   static void setSavestate(const QByteArray &saveState);
      57              : 
      58              :   static auto getPos(const QPoint &defaultValue = QVariant().toPoint())
      59              :       -> QPoint;
      60              :   static void setPos(const QPoint &pos);
      61              : 
      62              :   static auto getSize(const QSize &defaultValue = QVariant().toSize()) -> QSize;
      63              :   static void setSize(const QSize &size);
      64              : 
      65              :   static auto isMaximized(const bool &defaultValue = QVariant().toBool())
      66              :       -> bool;
      67              :   static void setMaximized(const bool &maximized);
      68              : 
      69              :   static auto isUsePass(const bool &defaultValue = QVariant().toBool()) -> bool;
      70              :   static void setUsePass(const bool &usePass);
      71              : 
      72              :   static auto getClipBoardTypeRaw(
      73            0 :       const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER) -> int;
      74              :   static auto getClipBoardType(
      75            0 :       const Enums::clipBoardType &defaultvalue = Enums::CLIPBOARD_NEVER)
      76              :       -> Enums::clipBoardType;
      77              :   static void setClipBoardType(const int &clipBoardType);
      78              : 
      79              :   static auto isUseSelection(const bool &defaultValue = QVariant().toBool())
      80              :       -> bool;
      81              :   static void setUseSelection(const bool &useSelection);
      82              : 
      83              :   static auto isUseAutoclear(const bool &defaultValue = QVariant().toBool())
      84              :       -> bool;
      85              :   static void setUseAutoclear(const bool &useAutoclear);
      86              : 
      87              :   static auto getAutoclearSeconds(const int &defaultValue = QVariant().toInt())
      88              :       -> int;
      89              :   static void setAutoclearSeconds(const int &autoClearSeconds);
      90              : 
      91              :   static auto
      92              :   isUseAutoclearPanel(const bool &defaultValue = QVariant().toBool()) -> bool;
      93              :   static void setUseAutoclearPanel(const bool &useAutoclearPanel);
      94              : 
      95              :   static auto
      96              :   getAutoclearPanelSeconds(const int &defaultValue = QVariant().toInt()) -> int;
      97              :   static void setAutoclearPanelSeconds(const int &autoClearPanelSeconds);
      98              : 
      99              :   static auto isHidePassword(const bool &defaultValue = QVariant().toBool())
     100              :       -> bool;
     101              :   static void setHidePassword(const bool &hidePassword);
     102              : 
     103              :   static auto isHideContent(const bool &defaultValue = QVariant().toBool())
     104              :       -> bool;
     105              :   static void setHideContent(const bool &hideContent);
     106              : 
     107              :   static auto isUseMonospace(const bool &defaultValue = QVariant().toBool())
     108              :       -> bool;
     109              :   static void setUseMonospace(const bool &useMonospace);
     110              : 
     111              :   static auto isDisplayAsIs(const bool &defaultValue = QVariant().toBool())
     112              :       -> bool;
     113              :   static void setDisplayAsIs(const bool &displayAsIs);
     114              : 
     115              :   static auto isNoLineWrapping(const bool &defaultValue = QVariant().toBool())
     116              :       -> bool;
     117              :   static void setNoLineWrapping(const bool &noLineWrapping);
     118              : 
     119              :   static auto isAddGPGId(const bool &defaultValue = QVariant().toBool())
     120              :       -> bool;
     121              :   static void setAddGPGId(const bool &addGPGId);
     122              : 
     123              :   static auto getPassStore(const QString &defaultValue = QVariant().toString())
     124              :       -> QString;
     125              :   static void setPassStore(const QString &passStore);
     126              : 
     127              :   static auto
     128              :   getPassSigningKey(const QString &defaultValue = QVariant().toString())
     129              :       -> QString;
     130              :   static void setPassSigningKey(const QString &passSigningKey);
     131              : 
     132              :   static void initExecutables();
     133              :   static auto
     134              :   getPassExecutable(const QString &defaultValue = QVariant().toString())
     135              :       -> QString;
     136              :   static void setPassExecutable(const QString &passExecutable);
     137              : 
     138              :   static auto
     139              :   getGitExecutable(const QString &defaultValue = QVariant().toString())
     140              :       -> QString;
     141              :   static void setGitExecutable(const QString &gitExecutable);
     142              : 
     143              :   static auto
     144              :   getGpgExecutable(const QString &defaultValue = QVariant().toString())
     145              :       -> QString;
     146              :   static void setGpgExecutable(const QString &gpgExecutable);
     147              : 
     148              :   static auto
     149              :   getPwgenExecutable(const QString &defaultValue = QVariant().toString())
     150              :       -> QString;
     151              :   static void setPwgenExecutable(const QString &pwgenExecutable);
     152              : 
     153              :   static auto getGpgHome(const QString &defaultValue = QVariant().toString())
     154              :       -> QString;
     155              : 
     156              :   static auto isUseWebDav(const bool &defaultValue = QVariant().toBool())
     157              :       -> bool;
     158              :   static void setUseWebDav(const bool &useWebDav);
     159              : 
     160              :   static auto getWebDavUrl(const QString &defaultValue = QVariant().toString())
     161              :       -> QString;
     162              :   static void setWebDavUrl(const QString &webDavUrl);
     163              : 
     164              :   static auto getWebDavUser(const QString &defaultValue = QVariant().toString())
     165              :       -> QString;
     166              :   static void setWebDavUser(const QString &webDavUser);
     167              : 
     168              :   static auto
     169              :   getWebDavPassword(const QString &defaultValue = QVariant().toString())
     170              :       -> QString;
     171              :   static void setWebDavPassword(const QString &webDavPassword);
     172              : 
     173              :   static auto getProfile(const QString &defaultValue = QVariant().toString())
     174              :       -> QString;
     175              :   static void setProfile(const QString &profile);
     176              : 
     177              :   static auto isUseGit(const bool &defaultValue = QVariant().toBool()) -> bool;
     178              :   static void setUseGit(const bool &useGit);
     179              : 
     180              :   static auto isUseOtp(const bool &defaultValue = QVariant().toBool()) -> bool;
     181              :   static void setUseOtp(const bool &useOtp);
     182              : 
     183              :   static auto isUseQrencode(const bool &defaultValue = QVariant().toBool())
     184              :       -> bool;
     185              :   static void setUseQrencode(const bool &useQrencode);
     186              : 
     187              :   static auto
     188              :   getQrencodeExecutable(const QString &defaultValue = QVariant().toString())
     189              :       -> QString;
     190              :   static void setQrencodeExecutable(const QString &qrencodeExecutable);
     191              : 
     192              :   static auto isUsePwgen(const bool &defaultValue = QVariant().toBool())
     193              :       -> bool;
     194              :   static void setUsePwgen(const bool &usePwgen);
     195              : 
     196              :   static auto isAvoidCapitals(const bool &defaultValue = QVariant().toBool())
     197              :       -> bool;
     198              :   static void setAvoidCapitals(const bool &avoidCapitals);
     199              : 
     200              :   static auto isAvoidNumbers(const bool &defaultValue = QVariant().toBool())
     201              :       -> bool;
     202              :   static void setAvoidNumbers(const bool &avoidNumbers);
     203              : 
     204              :   static auto isLessRandom(const bool &defaultValue = QVariant().toBool())
     205              :       -> bool;
     206              :   static void setLessRandom(const bool &lessRandom);
     207              : 
     208              :   static auto isUseSymbols(const bool &defaultValue = QVariant().toBool())
     209              :       -> bool;
     210              :   static void setUseSymbols(const bool &useSymbols);
     211              : 
     212              :   static auto getPasswordConfiguration() -> PasswordConfiguration;
     213              :   static void setPasswordConfiguration(const PasswordConfiguration &config);
     214              :   static void setPasswordLength(const int &passwordLength);
     215              :   static void setPasswordCharsselection(const int &passwordCharsselection);
     216              :   static void setPasswordChars(const QString &passwordChars);
     217              : 
     218              :   static auto isUseTrayIcon(const bool &defaultValue = QVariant().toBool())
     219              :       -> bool;
     220              :   static void setUseTrayIcon(const bool &useTrayIcon);
     221              : 
     222              :   static auto isHideOnClose(const bool &defaultValue = QVariant().toBool())
     223              :       -> bool;
     224              :   static void setHideOnClose(const bool &hideOnClose);
     225              : 
     226              :   static auto isStartMinimized(const bool &defaultValue = QVariant().toBool())
     227              :       -> bool;
     228              :   static void setStartMinimized(const bool &startMinimized);
     229              : 
     230              :   static auto isAlwaysOnTop(const bool &defaultValue = QVariant().toBool())
     231              :       -> bool;
     232              :   static void setAlwaysOnTop(const bool &alwaysOnTop);
     233              : 
     234              :   static auto isAutoPull(const bool &defaultValue = QVariant().toBool())
     235              :       -> bool;
     236              :   static void setAutoPull(const bool &autoPull);
     237              : 
     238              :   static auto isAutoPush(const bool &defaultValue = QVariant().toBool())
     239              :       -> bool;
     240              :   static void setAutoPush(const bool &autoPush);
     241              : 
     242              :   static auto
     243              :   getPassTemplate(const QString &defaultValue = QVariant().toString())
     244              :       -> QString;
     245              :   static void setPassTemplate(const QString &passTemplate);
     246              : 
     247              :   static auto isUseTemplate(const bool &defaultValue = QVariant().toBool())
     248              :       -> bool;
     249              :   static void setUseTemplate(const bool &useTemplate);
     250              : 
     251              :   static auto
     252              :   isTemplateAllFields(const bool &defaultValue = QVariant().toBool()) -> bool;
     253              :   static void setTemplateAllFields(const bool &templateAllFields);
     254              : 
     255              :   static auto getProfiles() -> QHash<QString, QHash<QString, QString>>;
     256              :   static void
     257              :   setProfiles(const QHash<QString, QHash<QString, QString>> &profiles);
     258              : 
     259              :   static auto getPass() -> Pass *;
     260              :   static auto getRealPass() -> RealPass *;
     261              :   static auto getImitatePass() -> ImitatePass *;
     262              : };
     263              : 
     264              : #endif // SRC_QTPASSSETTINGS_H_
        

Generated by: LCOV version 2.4-beta