def __init__(self, parent, has_mx, user, backend, soledad_started): """ :param parent: parent object of AdvancedKeyManagement. :parent type: QWidget :param has_mx: defines whether the current provider provides email or not. :type has_mx: bool :param user: the current logged in user. :type user: unicode :param backend: Backend being used :type backend: Backend :param soledad_started: whether soledad has started or not :type soledad_started: bool """ QtGui.QDialog.__init__(self, parent) self.ui = Ui_AdvancedKeyManagement() self.ui.setupUi(self) # XXX: Temporarily disable the key import. self.ui.pbImportKeys.setVisible(False) if not has_mx: msg = self.tr("The provider that you are using " "does not support {0}.") msg = msg.format(get_service_display_name(MX_SERVICE)) self._disable_ui(msg) return if not soledad_started: msg = self.tr("To use this, you need to enable/start {0}.") msg = msg.format(get_service_display_name(MX_SERVICE)) self._disable_ui(msg) return # XXX: since import is disabled this is no longer a dangerous feature. # else: # msg = self.tr( # "<span style='color:#ff0000;'>WARNING</span>:<br>" # "This is an experimental feature, you can lose access to " # "existing e-mails.") # self.ui.lblStatus.setText(msg) self._user = user self._backend = backend self._backend_connect() # show current key information self.ui.leUser.setText(user) # set up connections self.ui.pbImportKeys.clicked.connect(self._import_keys) self.ui.pbExportKeys.clicked.connect(self._export_keys) # Stretch columns to content self.ui.twPublicKeys.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.Stretch) self._backend.keymanager_get_key_details(user) self._backend.keymanager_list_keys()