Esempio n. 1
0
    def addContactToModel(self, watcher):
        # adds a new contact into the contact list model
        try:
            account = AccountManager().get_account(watcher.account)
        except KeyError:
            return

        try:
            contact = account.contact_manager.get_contact(watcher.address)
        except KeyError:
            return

        if contact.group is None:
            try:
                group = (g for g in ContactGroupManager().iter_groups()
                         if g.name == self.groupCombo.stringValue()).next()
            except StopIteration:
                # insert after last editable group
                index = 0
                for g in NSApp.delegate(
                ).contactsWindowController.model.contactGroupsList:
                    if not g.editable:
                        break
                    index += 1

                group = ContactGroup(self.groupCombo.stringValue())
                group.position = index
                group.save()

            contact.group = group
            contact.save()
            NSUserDefaults.standardUserDefaults().setValue_forKey_(
                self.groupCombo.stringValue(), "LastGroupForWatcher")
Esempio n. 2
0
    def addContactToModel(self, watcher):
        # adds a new contact into the contact list model
        try:
            account = AccountManager().get_account(watcher.account)
        except KeyError:
            return

        try:
            contact = account.contact_manager.get_contact(watcher.address)
        except KeyError:
            return

        if contact.group is None:
            try:
                group = (g for g in ContactGroupManager().iter_groups() if g.name == self.groupCombo.stringValue()).next()
            except StopIteration:
                # insert after last editable group
                index = 0
                for g in NSApp.delegate().contactsWindowController.model.contactGroupsList:
                    if not g.editable:
                        break
                    index += 1

                group = ContactGroup(self.groupCombo.stringValue())
                group.position = index
                group.save()

            contact.group = group
            contact.save()
            NSUserDefaults.standardUserDefaults().setValue_forKey_(self.groupCombo.stringValue(), "LastGroupForWatcher")
Esempio n. 3
0
    def init(self):
        self._version = str(NSBundle.mainBundle().infoDictionary().objectForKey_("CFBundleShortVersionString"))

        #first_start = not os.path.exists(ApplicationData.get('config'))

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        Contact.register_extension(BlinkContactExtension)
        ContactGroup.register_extension(BlinkContactGroupExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)

        self._app.start(FileStorage(ApplicationData.directory))
        self.init_configurations()

        # start session mgr
        SessionManager()
Esempio n. 4
0
    def init(self):
        self._version = str(
            NSBundle.mainBundle().infoDictionary().objectForKey_(
                "CFBundleShortVersionString"))

        #first_start = not os.path.exists(ApplicationData.get('config'))

        Account.register_extension(AccountExtension)
        BonjourAccount.register_extension(BonjourAccountExtension)
        Contact.register_extension(BlinkContactExtension)
        ContactGroup.register_extension(BlinkContactGroupExtension)
        SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)

        self._app.start(FileStorage(ApplicationData.directory))
        self.init_configurations()

        # start session mgr
        SessionManager()