File indexing completed on 2025-01-19 03:55:42
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2014-09-12 0007 * Description : Web Service tool utils methods 0008 * 0009 * SPDX-FileCopyrightText: 2014-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_WS_TOOL_UTILS_H 0016 #define DIGIKAM_WS_TOOL_UTILS_H 0017 0018 // Qt includes 0019 0020 #include <QSettings> 0021 #include <QString> 0022 #include <QDir> 0023 0024 // Local includes 0025 0026 #include "digikam_export.h" 0027 0028 namespace Digikam 0029 { 0030 0031 class DIGIKAM_EXPORT WSToolUtils 0032 { 0033 public: 0034 0035 explicit WSToolUtils() {}; 0036 ~WSToolUtils() {}; 0037 0038 /** 0039 * Generates random string. 0040 */ 0041 static QString randomString(const int& length); 0042 0043 static QDir makeTemporaryDir(const char* prefix); 0044 static void removeTemporaryDir(const char* prefix); 0045 0046 static QSettings* getOauthSettings(QObject* const parent); 0047 0048 static void saveToken(const QString& name, const QString& token); 0049 0050 static QString readToken(const QString& name); 0051 0052 static void clearToken(const QString& name); 0053 0054 private: 0055 0056 static QString oauthConfigFile(); 0057 }; 0058 0059 } // namespace Digikam 0060 0061 #endif // DIGIKAM_WS_TOOL_UTILS_H