plaintextstore_p.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /******************************************************************************
  2. * Copyright (C) 2011-2015 Frank Osterfeld <frank.osterfeld@gmail.com> *
  3. * Copyright (C) 2016 Mathias Hasselmann <mathias.hasselmann@kdab.com> *
  4. * *
  5. * This program is distributed in the hope that it will be useful, but *
  6. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
  7. * or FITNESS FOR A PARTICULAR PURPOSE. For licensing and distribution *
  8. * details, check the accompanying file 'COPYING'. *
  9. *****************************************************************************/
  10. #ifndef QTKEYCHAIN_PLAINTEXTSTORE_P_H
  11. #define QTKEYCHAIN_PLAINTEXTSTORE_P_H
  12. #include "keychain_p.h"
  13. namespace QKeychain {
  14. class PlainTextStore {
  15. Q_DECLARE_TR_FUNCTIONS(QKeychain::PlainTextStore)
  16. public:
  17. explicit PlainTextStore(const QString &service, QSettings *settings);
  18. Error error() const { return m_error; }
  19. QString errorString() const { return m_errorString; }
  20. bool contains(const QString &key) const;
  21. QByteArray readData(const QString &key);
  22. JobPrivate::Mode readMode(const QString &key);
  23. void write(const QString &key, const QByteArray &data, JobPrivate::Mode mode);
  24. void remove(const QString &key);
  25. private:
  26. void setError(Error error, const QString &errorString);
  27. QVariant read(const QString &key);
  28. const QScopedPointer<QSettings> m_localSettings;
  29. QSettings *const m_actualSettings;
  30. QString m_errorString;
  31. Error m_error;
  32. };
  33. }
  34. #endif // QTKEYCHAIN_PLAINTEXTSTORE_P_H