File indexing completed on 2024-11-24 03:41:06

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2021 Slava Aseev <nullptrnine@basealt.ru>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 #ifndef _KWALLETFREEDESKTOPATTRIBUTES_H_
0008 #define _KWALLETFREEDESKTOPATTRIBUTES_H_
0009 
0010 #include "kwalletfreedesktopservice.h"
0011 
0012 class KWalletFreedesktopAttributes : public QObject
0013 {
0014 public:
0015     KWalletFreedesktopAttributes(const QString &walletName);
0016 
0017     void read();
0018     void write();
0019     void remove(const EntryLocation &entryLocation);
0020     void remove(const FdoUniqueLabel &itemUniqLabel);
0021     void renameLabel(const EntryLocation &oldLocation, const EntryLocation &newLocation);
0022     void deleteFile();
0023     void renameWallet(const QString &newName);
0024     void newItem(const EntryLocation &entryLocation);
0025 
0026     QList<EntryLocation> matchAttributes(const StrStrMap &attributes) const;
0027     void setAttributes(const EntryLocation &entryLocation, const StrStrMap &attributes);
0028     StrStrMap getAttributes(const EntryLocation &entryLocation) const;
0029 
0030     void setAttributes(const FdoUniqueLabel &itemUniqLabel, const StrStrMap &attributes);
0031     StrStrMap getAttributes(const FdoUniqueLabel &itemUniqLabel) const;
0032 
0033     QString getStringParam(const EntryLocation &entryLocation, const QString &paramName, const QString &defaultParam) const;
0034     qulonglong getULongLongParam(const EntryLocation &entryLocation, const QString &paramName, qulonglong defaultParam) const;
0035 
0036     QString getStringParam(const FdoUniqueLabel &itemUniqLabel, const QString &paramName, const QString &defaultParam) const;
0037     qulonglong getULongLongParam(const FdoUniqueLabel &itemUniqLabel, const QString &paramName, qulonglong defaultParam) const;
0038 
0039     void setParam(const EntryLocation &entryLocation, const QString &paramName, const QString &param);
0040     void setParam(const EntryLocation &entryLocation, const QString &paramName, qulonglong param);
0041 
0042     void setParam(const FdoUniqueLabel &itemUniqLabel, const QString &paramName, const QString &param);
0043     void setParam(const FdoUniqueLabel &itemUniqLabel, const QString &paramName, qulonglong param);
0044 
0045     qulonglong lastModified() const;
0046     qulonglong birthTime() const;
0047     void updateLastModified();
0048 
0049     QList<EntryLocation> listItems() const;
0050 
0051 private:
0052     QString _path;
0053     QJsonObject _params;
0054 };
0055 
0056 #endif