def login(view): dialog = LoginDialog(findDefaultAccounts(view)) dialog.CenterOnScreen() if dialog.ShowModal() == wx.ID_OK: params = dialog.getParameters() else: params = None dialog.Destroy() if params is not None: protocol = params.pop('protocol') module = getattr(__import__("p2p.%s" % (protocol)), protocol) module.login(view, setStatusMessage, params['userid'], params['server'], params['password'], params['ssl'])
def login(view): dialog = LoginDialog(findDefaultAccounts(view)) dialog.CenterOnScreen() if dialog.ShowModal() == wx.ID_OK: params = dialog.getParameters() else: params = None dialog.Destroy() if params is not None: protocol = params.pop('protocol') module = getattr(__import__("p2p.%s" %(protocol)), protocol) module.login(view, setStatusMessage, params['userid'], params['server'], params['password'], params['ssl'])
def getAccounts(self, view): for account in findDefaultAccounts(view): if account.protocol == 'mail': self.account = account imapAccount = account.imap smtpAccount = account.smtp break else: self.account = None current = schema.ns('osaf.pim', view).currentSMTPAccount smtpAccount = getattr(current, 'item', None) current = schema.ns('osaf.pim', view).currentMailAccount mailAccount = getattr(current, 'item', None) if isinstance(mailAccount, IMAPAccount): imapAccount = mailAccount else: imapAccount = None smtpAccounts = [account for account in SMTPAccount.iterItems(view)] self.smtpIDs = [account.itsUUID for account in smtpAccounts] smtpChoices = [account.displayName for account in smtpAccounts] if smtpAccount is not None: smtpSelection = smtpChoices.index(smtpAccount.displayName) else: smtpSelection = 0 imapAccounts = [ account for account in IMAPAccount.iterItems(view) if (account.replyToAddress and account.replyToAddress.emailAddress) ] self.imapIDs = [account.itsUUID for account in imapAccounts] imapChoices = [account.displayName for account in imapAccounts] if imapAccount is not None: imapSelection = imapChoices.index(imapAccount.displayName) else: imapSelection = 0 return (smtpChoices, smtpSelection), (imapChoices, imapSelection)
def getAccounts(self, view): for account in findDefaultAccounts(view): if account.protocol == 'mail': self.account = account imapAccount = account.imap smtpAccount = account.smtp break else: self.account = None current = schema.ns('osaf.pim', view).currentSMTPAccount smtpAccount = getattr(current, 'item', None) current = schema.ns('osaf.pim', view).currentMailAccount mailAccount = getattr(current, 'item', None) if isinstance(mailAccount, IMAPAccount): imapAccount = mailAccount else: imapAccount = None smtpAccounts = [account for account in SMTPAccount.iterItems(view)] self.smtpIDs = [account.itsUUID for account in smtpAccounts] smtpChoices = [account.displayName for account in smtpAccounts] if smtpAccount is not None: smtpSelection = smtpChoices.index(smtpAccount.displayName) else: smtpSelection = 0 imapAccounts = [account for account in IMAPAccount.iterItems(view) if (account.replyToAddress and account.replyToAddress.emailAddress)] self.imapIDs = [account.itsUUID for account in imapAccounts] imapChoices = [account.displayName for account in imapAccounts] if imapAccount is not None: imapSelection = imapChoices.index(imapAccount.displayName) else: imapSelection = 0 return (smtpChoices, smtpSelection), (imapChoices, imapSelection)