Changeset 4bf83ee in confclerk_git


Ignore:
Timestamp:
10/06/17 21:34:23 (5 years ago)
Author:
gregor herrmann <gregor@…>
Branches:
master
Children:
f940bd5
Parents:
e618f18
Message:

Settings (dialog): add username/password options for proxy server

Cf. #59

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/app/appsettings.cpp

    re618f18 r4bf83ee  
    2323const QString PROXY_PORT_SETTING ("proxyPort");
    2424const QString PROXY_TYPE_SETTING ("proxyType");
     25const QString PROXY_USERNAME_SETTING ("proxyUsername");
     26const QString PROXY_PASSWORD_SETTING ("proxyPassword");
    2527const QString PROXY_ISDIRECT_SETTING ("proxyIsDirectConnection");
    2628
     
    4547}
    4648
     49QString AppSettings::proxyUsername()
     50{
     51    return mSettings.value(PROXY_USERNAME_SETTING).toString();
     52}
     53
     54QString AppSettings::proxyPassword()
     55{
     56    return mSettings.value(PROXY_PASSWORD_SETTING).toString();
     57}
     58
    4759bool AppSettings::isDirectConnection()
    4860{
     
    6577}
    6678
     79void AppSettings::setProxyUsername(const QString &aUsername)
     80{
     81    mSettings.setValue(PROXY_USERNAME_SETTING, aUsername);
     82}
     83
     84void AppSettings::setProxyPassword(const QString &aPassword)
     85{
     86    mSettings.setValue(PROXY_PASSWORD_SETTING, aPassword);
     87}
     88
    6789void AppSettings::setDirectConnection(bool aDirectConnection)
    6890{
  • src/app/appsettings.h

    re618f18 r4bf83ee  
    3838        static quint16 proxyPort();
    3939        static QNetworkProxy::ProxyType proxyType();
     40        static QString proxyUsername();
     41        static QString proxyPassword();
    4042        static bool isDirectConnection();
    4143
     
    4345        static void setProxyPort(const quint16 aPort);
    4446        static void setProxyType(QNetworkProxy::ProxyType aProxyType);
     47        static void setProxyUsername(const QString &aUsername);
     48        static void setProxyPassword(const QString &aPassword);
    4549        static void setDirectConnection(bool aDirectConnection);
    4650        static int preEventAlarmSec() {return 60*15;} ///< seconds that alarm should ring before an event starts
  • src/gui/mainwindow.cpp

    re618f18 r4bf83ee  
    5050#include "appsettings.h"
    5151
    52 const QString PROXY_USERNAME;
    53 const QString PROXY_PASSWD;
    54 
    5552MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
    5653    setupUi(this);
     
    8683            AppSettings::proxyAddress(),
    8784            AppSettings::proxyPort(),
    88             PROXY_USERNAME,
    89             PROXY_PASSWD);
     85            AppSettings::proxyUsername(),
     86            AppSettings::proxyPassword());
    9087    QNetworkProxy::setApplicationProxy(proxy);
    9188
     
    367364                AppSettings::proxyAddress(),
    368365                AppSettings::proxyPort(),
    369                 PROXY_USERNAME,
    370                 PROXY_PASSWD);
     366                AppSettings::proxyUsername(),
     367                AppSettings::proxyPassword());
    371368        QNetworkProxy::setApplicationProxy(proxy);
    372369    }
  • src/gui/settingsdialog.cpp

    re618f18 r4bf83ee  
    3939    proxyTypeHTTP->setChecked(proxyType != QNetworkProxy::Socks5Proxy); // we enable QNetworkProxy::HttpProxy by default unless we have QNetworkProxy::Socks5Proxy
    4040    proxyTypeSOCKS5->setChecked(proxyType == QNetworkProxy::Socks5Proxy);
     41    username->setText(AppSettings::proxyUsername());
     42    password->setText(AppSettings::proxyPassword());
    4143    directConnection->setChecked(AppSettings::isDirectConnection());
    4244    proxyWidget->setDisabled(directConnection->isChecked());
     
    5052    AppSettings::setProxyPort(port->value());
    5153    AppSettings::setProxyType(proxyTypeHTTP->isChecked() ? QNetworkProxy::HttpProxy : proxyTypeSOCKS5->isChecked() ? QNetworkProxy::Socks5Proxy : QNetworkProxy::DefaultProxy);
     54    AppSettings::setProxyUsername(username->text());
     55    AppSettings::setProxyPassword(password->text());
    5256    AppSettings::setDirectConnection(directConnection->isChecked());
    5357}
  • src/gui/settingsdialog.ui

    re618f18 r4bf83ee  
    108108          </layout>
    109109         </item>
     110          <item>
     111           <layout class="QHBoxLayout" name="horizontalLayout_3">
     112            <item>
     113             <widget class="QLabel" name="label_4">
     114              <property name="text">
     115               <string>Optional: Username:</string>
     116              </property>
     117             </widget>
     118            </item>
     119            <item>
     120             <widget class="QLineEdit" name="username">
     121             </widget>
     122            </item>
     123            <item>
     124             <widget class="QLabel" name="label_5">
     125              <property name="text">
     126               <string>Password:</string>
     127              </property>
     128             </widget>
     129            </item>
     130            <item>
     131             <widget class="QLineEdit" name="password">
     132              <property name="echoMode">
     133               <enum>QLineEdit::Password</enum>
     134              </property>
     135             </widget>
     136            </item>
     137           </layout>
     138          </item>
    110139        </layout>
    111140       </widget>
Note: See TracChangeset for help on using the changeset viewer.