Some code cleanups for the proxy dialog.

This commit is contained in:
Klaas Freitag 2012-08-02 12:07:14 +03:00
parent 343f646660
commit 42283e4684
2 changed files with 186 additions and 185 deletions

View file

@ -24,9 +24,13 @@ Mirall::ProxyDialog::ProxyDialog( QWidget* parent )
{
setupUi(this);
// designer is buggy, so do it programmatically
manualSettings->setEnabled(false);
#if QT_VERSION >= 0x040700
hostLineEdit->setPlaceholderText(QApplication::translate("proxyDialog", "Hostname of proxy server"));
userLineEdit->setPlaceholderText(QApplication::translate("proxyDialog", "Username to authenticate on proxy server"));
hostLineEdit->setPlaceholderText(tr("Hostname of proxy server"));
userLineEdit->setPlaceholderText(tr("Username for proxy server"));
passwordLineEdit->setPlaceholderText(tr("Password for proxy server"));
#endif
// load current proxy settings
@ -40,7 +44,7 @@ Mirall::ProxyDialog::ProxyDialog( QWidget* parent )
manualProxyRadioButton->setChecked(true);
hostLineEdit->setText(cfgFile.proxyHostName());
portSpinBox->setValue(cfgFile.proxyPort());
if (cfgFile.proxyUser() != QString())
if (!cfgFile.proxyUser().isEmpty())
{
authRequiredcheckBox->setChecked(true);
userLineEdit->setText(cfgFile.proxyUser());
@ -83,13 +87,13 @@ void Mirall::ProxyDialog::on_authRequiredcheckBox_stateChanged(int state)
bool e = (state == Qt::Checked);
userLineEdit->setEnabled(e);
passwordLineEdit->setEnabled(e);
proxyUserLabel->setEnabled(e);
proxyPasswordLabel->setEnabled(e);
}
void Mirall::ProxyDialog::on_manualProxyRadioButton_toggled(bool checked)
{
hostLineEdit->setEnabled(checked);
portSpinBox->setEnabled(checked);
authRequiredcheckBox->setEnabled(checked);
manualSettings->setEnabled(checked);
}
void Mirall::ProxyDialog::on_buttonBox_accepted()

View file

@ -6,201 +6,198 @@
<rect>
<x>0</x>
<y>0</y>
<width>509</width>
<height>360</height>
<width>465</width>
<height>362</height>
</rect>
</property>
<property name="windowTitle">
<string>Proxy Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Configure Proxies to access your ownCloud</string>
</property>
<property name="buddy">
<cstring>manualSettings</cstring>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>20</number>
</property>
<property name="text">
<string>Configure Proxies to access your ownCloud</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QRadioButton" name="noProxyRadioButton">
<property name="text">
<string>No Proxy</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
<property name="checked">
<bool>true</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="noProxyRadioButton">
<property name="text">
<string>No Proxy</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="systemProxyRadioButton">
<property name="text">
<string>Use system proxy</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="manualProxyRadioButton">
<property name="text">
<string>Manual proxy configuration:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Proxy User:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="userLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="passwordLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string>Host</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="portSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>8080</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="authRequiredcheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Authentication required</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
<widget class="QRadioButton" name="systemProxyRadioButton">
<property name="text">
<string>Use system proxy</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="manualProxyRadioButton">
<property name="text">
<string>Manual proxy configuration</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="manualSettings" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="verticalSpacing">
<number>-1</number>
</property>
<property name="leftMargin">
<number>40</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="proxyUserLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>User</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="userLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="proxyPasswordLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="passwordLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string>Host</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostLineEdit">
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="authRequiredcheckBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Proxy server requires password</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="portSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>8080</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>