summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-10-03 18:57:28 -0300
committerTomás Touceda <chiiph@leap.se>2013-10-03 18:57:28 -0300
commit2c2c636b4244d53f6f1ea240ee95c30a6827c243 (patch)
tree6473fe59701b14c4a78cbb9de5c19a9919f10800
parenta8c9810f5a90578c4dcce2f519e4d89be068f71a (diff)
parenteffec111c39110f5057f49224f07bdd0730e7862 (diff)
Merge remote-tracking branch 'ivan/feature/3631_autostart-eip-optional' into develop
-rw-r--r--changes/feature-3631_autostart-eip-optional2
-rw-r--r--src/leap/bitmask/gui/eip_preferenceswindow.py43
-rw-r--r--src/leap/bitmask/gui/ui/eippreferences.ui125
3 files changed, 151 insertions, 19 deletions
diff --git a/changes/feature-3631_autostart-eip-optional b/changes/feature-3631_autostart-eip-optional
new file mode 100644
index 00000000..83288548
--- /dev/null
+++ b/changes/feature-3631_autostart-eip-optional
@@ -0,0 +1,2 @@
+ o Add preferences option to enable/disable the automatic start of EIP, and
+ selection of the EIP provider to auto start. Closes #3631.
diff --git a/src/leap/bitmask/gui/eip_preferenceswindow.py b/src/leap/bitmask/gui/eip_preferenceswindow.py
index 0e6e8dda..9f8c4ff4 100644
--- a/src/leap/bitmask/gui/eip_preferenceswindow.py
+++ b/src/leap/bitmask/gui/eip_preferenceswindow.py
@@ -50,6 +50,7 @@ class EIPPreferencesWindow(QtGui.QDialog):
self.ui = Ui_EIPPreferences()
self.ui.setupUi(self)
self.ui.lblProvidersGatewayStatus.setVisible(False)
+ self.ui.lblAutoStartEIPStatus.setVisible(False)
# Connections
self.ui.cbProvidersGateway.currentIndexChanged[unicode].connect(
@@ -58,8 +59,40 @@ class EIPPreferencesWindow(QtGui.QDialog):
self.ui.cbGateways.currentIndexChanged[unicode].connect(
lambda x: self.ui.lblProvidersGatewayStatus.setVisible(False))
+ self.ui.cbProvidersEIP.currentIndexChanged[unicode].connect(
+ lambda x: self.ui.lblAutoStartEIPStatus.setVisible(False))
+
+ self.ui.cbAutoStartEIP.toggled.connect(
+ lambda x: self.ui.lblAutoStartEIPStatus.setVisible(False))
+
+ self.ui.pbSaveAutoStartEIP.clicked.connect(self._save_auto_start_eip)
+
self._add_configured_providers()
+ # Load auto start EIP settings
+ self.ui.cbAutoStartEIP.setChecked(self._settings.get_autostart_eip())
+ default_provider = self._settings.get_defaultprovider()
+ idx = self.ui.cbProvidersEIP.findText(default_provider)
+ self.ui.cbProvidersEIP.setCurrentIndex(idx)
+
+ def _save_auto_start_eip(self):
+ """
+ SLOT
+ TRIGGER:
+ self.ui.cbAutoStartEIP.toggled
+
+ Saves the automatic start of EIP user preference.
+ """
+ default_provider = self.ui.cbProvidersEIP.currentText()
+ enabled = self.ui.cbAutoStartEIP.isChecked()
+
+ self._settings.set_autostart_eip(enabled)
+ self._settings.set_defaultprovider(default_provider)
+
+ self.ui.lblAutoStartEIPStatus.show()
+ logger.debug('Auto start EIP saved: {0} {1}.'.format(
+ default_provider, enabled))
+
def _set_providers_gateway_status(self, status, success=False,
error=False):
"""
@@ -87,8 +120,16 @@ class EIPPreferencesWindow(QtGui.QDialog):
Add the client's configured providers to the providers combo boxes.
"""
self.ui.cbProvidersGateway.clear()
- for provider in self._settings.get_configured_providers():
+ self.ui.cbProvidersEIP.clear()
+ providers = self._settings.get_configured_providers()
+ if not providers:
+ self.ui.gbAutomaticEIP.setEnabled(False)
+ self.ui.gbGatewaySelector.setEnabled(False)
+ return
+
+ for provider in providers:
self.ui.cbProvidersGateway.addItem(provider)
+ self.ui.cbProvidersEIP.addItem(provider)
def _save_selected_gateway(self, provider):
"""
diff --git a/src/leap/bitmask/gui/ui/eippreferences.ui b/src/leap/bitmask/gui/ui/eippreferences.ui
index e9bc203d..9493d330 100644
--- a/src/leap/bitmask/gui/ui/eippreferences.ui
+++ b/src/leap/bitmask/gui/ui/eippreferences.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>170</height>
+ <width>398</width>
+ <height>262</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,8 +17,8 @@
<iconset resource="../../../../../data/resources/mainwindow.qrc">
<normaloff>:/images/mask-icon.png</normaloff>:/images/mask-icon.png</iconset>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="0">
<widget class="QGroupBox" name="gbGatewaySelector">
<property name="enabled">
<bool>true</bool>
@@ -30,6 +30,16 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lblSelectProvider">
+ <property name="text">
+ <string>&amp;Select provider:</string>
+ </property>
+ <property name="buddy">
+ <cstring>cbProvidersGateway</cstring>
+ </property>
+ </widget>
+ </item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="cbProvidersGateway">
<item>
@@ -39,13 +49,20 @@
</item>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="lblSelectProvider">
+ <item row="7" column="2">
+ <widget class="QPushButton" name="pbSaveGateway">
<property name="text">
- <string>&amp;Select provider:</string>
+ <string>Save this provider settings</string>
</property>
- <property name="buddy">
- <cstring>cbProvidersGateway</cstring>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="3">
+ <widget class="QLabel" name="lblProvidersGatewayStatus">
+ <property name="text">
+ <string>&lt; Providers Gateway Status &gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@@ -65,30 +82,102 @@
</item>
</widget>
</item>
- <item row="5" column="2">
- <widget class="QPushButton" name="pbSaveGateway">
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="gbAutomaticEIP">
+ <property name="title">
+ <string>Automatic EIP start</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="3" column="0">
+ <widget class="QLabel" name="lblAutoStartEIPStatus">
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
<property name="text">
- <string>Save this provider settings</string>
+ <string>&lt;font color='green'&gt;&lt;b&gt;Automatic EIP start saved!&lt;/b&gt;&lt;/font&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="3">
- <widget class="QLabel" name="lblProvidersGatewayStatus">
+ <item row="3" column="1">
+ <widget class="QPushButton" name="pbSaveAutoStartEIP">
<property name="text">
- <string>&lt; Providers Gateway Status &gt;</string>
+ <string>Save auto start setting</string>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="cbAutoStartEIP">
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>Enable Automatic start of EIP</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
</item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="cbProvidersEIP">
+ <item>
+ <property name="text">
+ <string>&lt;Select provider&gt;</string>
+ </property>
+ </item>
+ </widget>
+ </item>
</layout>
+ <zorder>cbAutoStartEIP</zorder>
+ <zorder>lblAutoStartEIPStatus</zorder>
+ <zorder>pbSaveAutoStartEIP</zorder>
+ <zorder>cbProvidersEIP</zorder>
</widget>
</item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>cbAutoStartEIP</tabstop>
+ <tabstop>cbProvidersEIP</tabstop>
+ <tabstop>pbSaveAutoStartEIP</tabstop>
+ <tabstop>cbProvidersGateway</tabstop>
+ <tabstop>cbGateways</tabstop>
+ <tabstop>pbSaveGateway</tabstop>
+ </tabstops>
<resources>
<include location="../../../../../data/resources/mainwindow.qrc"/>
</resources>
- <connections/>
+ <connections>
+ <connection>
+ <sender>cbAutoStartEIP</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>cbProvidersEIP</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>180</x>
+ <y>53</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>238</x>
+ <y>53</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>