diff options
author | Kali Kaneko <kali@leap.se> | 2013-10-30 16:47:05 -0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-10-30 16:47:05 -0200 |
commit | c9ecc98e5d0eee4f502ba8030af5e0a5d4835d58 (patch) | |
tree | d1a664d53405fe28b93b6525f6112f23ac431ece /src/leap/bitmask | |
parent | e1a318fdeb0947da940496c793eb2481bf775450 (diff) | |
parent | 318b25373a271c12b3497125db620ab36c0db490 (diff) |
Merge remote-tracking branch 'chiiph/bug/properly_stop_imap' into develop
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/gui/eip_preferenceswindow.py | 36 | ||||
-rw-r--r-- | src/leap/bitmask/gui/ui/eippreferences.ui | 99 | ||||
-rw-r--r-- | src/leap/bitmask/services/mail/conductor.py | 23 |
3 files changed, 21 insertions, 137 deletions
diff --git a/src/leap/bitmask/gui/eip_preferenceswindow.py b/src/leap/bitmask/gui/eip_preferenceswindow.py index 9f8c4ff4..e0c5d51f 100644 --- a/src/leap/bitmask/gui/eip_preferenceswindow.py +++ b/src/leap/bitmask/gui/eip_preferenceswindow.py @@ -50,7 +50,6 @@ 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( @@ -59,40 +58,8 @@ 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): """ @@ -120,16 +87,13 @@ class EIPPreferencesWindow(QtGui.QDialog): Add the client's configured providers to the providers combo boxes. """ self.ui.cbProvidersGateway.clear() - 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 cc77c82e..a3050683 100644 --- a/src/leap/bitmask/gui/ui/eippreferences.ui +++ b/src/leap/bitmask/gui/ui/eippreferences.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>435</width> - <height>273</height> + <height>144</height> </rect> </property> <property name="windowTitle"> @@ -18,7 +18,7 @@ <normaloff>:/images/mask-icon.png</normaloff>:/images/mask-icon.png</iconset> </property> <layout class="QGridLayout" name="gridLayout_2"> - <item row="1" column="0"> + <item row="0" column="0"> <widget class="QGroupBox" name="gbGatewaySelector"> <property name="enabled"> <bool>true</bool> @@ -33,7 +33,7 @@ <item row="0" column="0"> <widget class="QLabel" name="lblSelectProvider"> <property name="text"> - <string>&Select provider:</string> + <string>Select &provider:</string> </property> <property name="buddy"> <cstring>cbProvidersGateway</cstring> @@ -52,7 +52,7 @@ <item row="7" column="2"> <widget class="QPushButton" name="pbSaveGateway"> <property name="text"> - <string>Save this provider settings</string> + <string>&Save this provider settings</string> </property> </widget> </item> @@ -69,7 +69,10 @@ <item row="1" column="0"> <widget class="QLabel" name="label"> <property name="text"> - <string>Select gateway:</string> + <string>Select &gateway:</string> + </property> + <property name="buddy"> + <cstring>cbGateways</cstring> </property> </widget> </item> @@ -85,76 +88,9 @@ </layout> </widget> </item> - <item row="0" column="0"> - <widget class="QGroupBox" name="gbAutomaticEIP"> - <property name="title"> - <string>Automatic Encrypted Internet 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><font color='green'><b>Automatic EIP start saved!</b></font></string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QPushButton" name="pbSaveAutoStartEIP"> - <property name="text"> - <string>Save auto start setting</string> - </property> - </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:</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><Select provider></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> @@ -162,22 +98,5 @@ <resources> <include location="../../../../../data/resources/mainwindow.qrc"/> </resources> - <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> + <connections/> </ui> diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py index 3a3e16a3..c294381b 100644 --- a/src/leap/bitmask/services/mail/conductor.py +++ b/src/leap/bitmask/services/mail/conductor.py @@ -48,6 +48,8 @@ class IMAPControl(object): """ self.imap_machine = None self.imap_service = None + self.imap_port = None + self.imap_factory = None self.imap_connection = None leap_register(signal=leap_events.IMAP_SERVICE_STARTED, @@ -81,7 +83,9 @@ class IMAPControl(object): if self.imap_service is None: # first time. - self.imap_service = imap.start_imap_service( + self.imap_service, \ + self.imap_port, \ + self.imap_factory = imap.start_imap_service( self._soledad, self._keymanager) else: @@ -90,17 +94,18 @@ class IMAPControl(object): def stop_imap_service(self): """ - Stops imap service. - - There is a subtle difference here: - we are just stopping the fetcher here, - but in the smtp case we are stopping the factory. + Stops imap service (fetcher, factory and port). """ self.imap_connection.qtsigs.disconnecting_signal.emit() # TODO We should homogenize both services. if self.imap_service is not None: logger.debug('Stopping imap service.') + # Stop the loop call in the fetcher self.imap_service.stop() + # Stop listening on the IMAP port + self.imap_port.stopListening() + # Stop the protocol + self.imap_factory.doStop() def fetch_incoming_mail(self): """ @@ -208,11 +213,7 @@ class SMTPControl(object): def stop_smtp_service(self): """ - Stops the smtp service. - - There is a subtle difference here: - we are stopping the factory for the smtp service here, - but in the imap case we are just stopping the fetcher. + Stops the smtp service (port and factory). """ self.smtp_connection.qtsigs.disconnecting_signal.emit() # TODO We should homogenize both services. |