def OnSubscribe(self, evt): view = self.view url = self.textUrl.GetValue() if url.startswith('webcal:'): url = 'http:' + url[7:] share = Sharing.findMatchingShare(view, url) if share is not None: self.__showStatus("You are already subscribed") return try: share = Sharing.Share(view=view) share.configureInbound(url) if share is None: return if self.accountPanel.IsShown(): share.conduit.account.username = self.textUsername.GetValue() share.conduit.account.password = self.textPassword.GetValue() self.__showStatus("In progress...") wx.Yield() share.sync() collection = share.contents mainView = Globals.views[0] mainView.postEventByName( "AddToSidebarWithoutCopyingAndSelectFirst", {'items': [collection]}) event = 'ApplicationBarAll' if share.filterKinds and len(share.filterKinds) == 1: filterKind = share.filterKinds[0] if filterKind == '//parcels/osaf/pim/calendar/CalendarEventMixin': event = 'ApplicationBarEvent' elif filterKind == '//parcels/osaf/pim/tasks/TaskMixin': event = 'ApplicationBarTask' elif filterKind == '//parcels/osaf/pim/mail/MailMessageMixin': event = 'ApplicationBarMail' mainView.postEventByName(event, {}) self.EndModal(True) except Sharing.NotAllowed, err: self.__showAccountInfo(share.conduit.account) share.delete(True)
def OnSubscribe(self, evt): view = self.view url = self.textUrl.GetValue() if url.startswith('webcal:'): url = 'http:' + url[7:] share = Sharing.findMatchingShare(view, url) if share is not None: self.__showStatus("You are already subscribed") return try: share = Sharing.Share(view=view) share.configureInbound(url) if share is None: return if self.accountPanel.IsShown(): share.conduit.account.username = self.textUsername.GetValue() share.conduit.account.password = self.textPassword.GetValue() self.__showStatus("In progress...") wx.Yield() share.sync() collection = share.contents mainView = Globals.views[0] mainView.postEventByName("AddToSidebarWithoutCopyingAndSelectFirst", {'items':[collection]}) event = 'ApplicationBarAll' if share.filterKinds and len(share.filterKinds) == 1: filterKind = share.filterKinds[0] if filterKind == '//parcels/osaf/pim/calendar/CalendarEventMixin': event = 'ApplicationBarEvent' elif filterKind == '//parcels/osaf/pim/tasks/TaskMixin': event = 'ApplicationBarTask' elif filterKind == '//parcels/osaf/pim/mail/MailMessageMixin': event = 'ApplicationBarMail' mainView.postEventByName(event, {}) self.EndModal(True) except Sharing.NotAllowed, err: self.__showAccountInfo(share.conduit.account) share.delete(True)
def displaySMTPSendSuccess (self, mailMessage): """ Called when the SMTP Send was successful. """ if mailMessage is not None and mailMessage.isOutbound: self.setStatusMessage (_('Mail "%s" sent.') % mailMessage.about) # If this was a sharing invitation, find its collection and remove the # successfully-notified addressees from the invites list. try: (url, collectionName) = MailSharing.getSharingHeaderInfo(mailMessage) except KeyError: pass else: share = Sharing.findMatchingShare(self.itsView, url) itemCollection = share.contents for addresseeContact in mailMessage.toAddress: if addresseeContact in itemCollection.invitees: itemCollection.invitees.remove(addresseeContact)
def displaySMTPSendSuccess(self, mailMessage): """ Called when the SMTP Send was successful. """ if mailMessage is not None and mailMessage.isOutbound: self.setStatusMessage(_('Mail "%s" sent.') % mailMessage.about) # If this was a sharing invitation, find its collection and remove the # successfully-notified addressees from the invites list. try: (url, collectionName) = MailSharing.getSharingHeaderInfo(mailMessage) except KeyError: pass else: share = Sharing.findMatchingShare(self.itsView, url) itemCollection = share.contents for addresseeContact in mailMessage.toAddress: if addresseeContact in itemCollection.invitees: itemCollection.invitees.remove(addresseeContact)