File indexing completed on 2024-12-15 03:45:02

0001 /*
0002     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_SERVERINFO_H
0008 #define KUSERFEEDBACK_CONSOLE_SERVERINFO_H
0009 
0010 #include <QSharedDataPointer>
0011 #include <QStringList>
0012 
0013 class QUrl;
0014 
0015 namespace KUserFeedback {
0016 namespace Console {
0017 
0018 class ServerInfoData;
0019 
0020 /** Connection information for an analytics server. */
0021 class ServerInfo
0022 {
0023 public:
0024     ServerInfo();
0025     ServerInfo(const ServerInfo &other);
0026     ~ServerInfo();
0027     ServerInfo& operator=(const ServerInfo &other);
0028 
0029     bool isValid() const;
0030 
0031     QString name() const;
0032     void setName(const QString &name);
0033 
0034     QUrl url() const;
0035     void setUrl(const QUrl& url);
0036 
0037     QString userName() const;
0038     void setUserName(const QString& userName);
0039 
0040     QString password() const;
0041     void setPassword(const QString& password);
0042 
0043     /** Save to settings. */
0044     void save() const;
0045     /** Load from settings. */
0046     static ServerInfo load(const QString &name);
0047     /** Delete stored information for the server with name @p name. */
0048     static void remove(const QString &name);
0049 
0050     /** Returns the names of all configured servers. */
0051     static QStringList allServerInfoNames();
0052 
0053 private:
0054     QSharedDataPointer<ServerInfoData> d;
0055 };
0056 
0057 }
0058 }
0059 
0060 #endif // KUSERFEEDBACK_CONSOLE_SERVERINFO_H