File indexing completed on 2024-05-19 04:59:19

0001 /* ============================================================
0002 * StatusBarIcons - Extra icons in statusbar for Falkon
0003 * Copyright (C) 2013-2014  David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #ifndef SBI_NETWORKPROXY_H
0019 #define SBI_NETWORKPROXY_H
0020 
0021 #include <QUrl>
0022 #include <QNetworkProxy>
0023 
0024 class QSettings;
0025 
0026 class SBI_NetworkProxy
0027 {
0028 public:
0029     explicit SBI_NetworkProxy();
0030 
0031     bool operator==(const SBI_NetworkProxy &other) const;
0032 
0033     quint16 port() const;
0034     void setPort(quint16 port);
0035 
0036     QString hostName() const;
0037     void setHostName(const QString &hostName);
0038 
0039     QString userName() const;
0040     void setUserName(const QString &userName);
0041 
0042     QString password() const;
0043     void setPassword(const QString &password);
0044 
0045     QNetworkProxy::ProxyType type() const;
0046     void setType(QNetworkProxy::ProxyType type);
0047 
0048     void loadFromSettings(const QSettings &settings);
0049     void saveToSettings(QSettings &settings) const;
0050 
0051     void applyProxy();
0052 
0053 private:
0054     quint16 m_port;
0055     QString m_hostname;
0056     QString m_username;
0057     QString m_password;
0058 
0059     QNetworkProxy::ProxyType m_type;
0060 };
0061 
0062 #endif // SBI_NETWORKPROXY_H