Ejemplo n.º 1
0
    def __init__(self, conversationId):
        super(ChatWidget, self).__init__()
        self._conversationId = conversationId
        self._windowTitle = Contacts.instance().getName(self._conversationId)
        self._ownJid = Contacts.instance().phoneToConversationId(getConfig('countryCode') + getConfig('phoneNumber'))
        self._defaultContactPicture = '/%s/im-user.png' % QDir.searchPaths('icons')[0]
        self._chatViewUrl = QUrl('file://%s/ChatView.html' % QDir.searchPaths('html')[0])
        self._historyTimestamp = datetime.date.today()

        self._scrollTimer = QTimer()
        self._scrollTimer.setSingleShot(True)
        self._scrollTimer.timeout.connect(self.on_scrollToBottom)
        self.scroll_to_bottom_signal.connect(self.on_scrollToBottom, Qt.QueuedConnection)

        loadUi(os.path.join(QDir.searchPaths('ui')[0], 'ChatWidget.ui'), self)
        self.setWindowTitle(self._windowTitle)
        self.historyButton.setIcon(QIcon.fromTheme('clock'))

        self.visibilityChanged.connect(self.on_visibilityChanged)
        self.chatView.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.__on_messageText_keyPressEvent = self.messageText.keyPressEvent
        self.messageText.keyPressEvent = self.on_messageText_keyPressEvent
        self.show_message_signal.connect(self.showMessage)
        self.show_history_message_signal.connect(self.showMessage)
        self.show_history_since_signal.connect(self.showHistorySince)
        self.show_history_num_messages_signal.connect(self.showHistoryNumMessages)
        self.has_unread_message_signal.connect(self.unreadMessage)

        self.reloadChatView()
        self.showHistorySince(datetime.date.today(), minMessage=3, maxMessages=10)
Ejemplo n.º 2
0
    def __init__(self, conversationId):
        super(ChatWidget, self).__init__()
        self._conversationId = conversationId
        self._windowTitle = Contacts.instance().jid2name(self._conversationId)
        self._ownJid = Contacts.instance().phoneToConversationId(getConfig('countryCode') + getConfig('phoneNumber'))
        self._defaultContactPicture = '/%s/im-user.png' % QDir.searchPaths('icons')[0]
        self._chatViewUrl = QUrl('file://%s/ChatView.html' % QDir.searchPaths('html')[0])
        self._historyTimestamp = datetime.date.today()

        self._scrollTimer = QTimer()
        self._scrollTimer.setSingleShot(True)
        self._scrollTimer.timeout.connect(self.on_scrollToBottom)
        self.scroll_to_bottom_signal.connect(self.on_scrollToBottom, Qt.QueuedConnection)

        loadUi(os.path.join(QDir.searchPaths('ui')[0], 'ChatWidget.ui'), self)
        self.setWindowTitle(self._windowTitle)
        self.historyButton.setIcon(QIcon.fromTheme('clock'))

        self.visibilityChanged.connect(self.on_visibilityChanged)
        self.chatView.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.__on_messageText_keyPressEvent = self.messageText.keyPressEvent
        self.messageText.keyPressEvent = self.on_messageText_keyPressEvent
        self.show_message_signal.connect(self.showMessage)
        self.show_history_message_signal.connect(self.showMessage)
        self.show_history_since_signal.connect(self.showHistorySince)
        self.show_history_num_messages_signal.connect(self.showHistoryNumMessages)
        self.has_unread_message_signal.connect(self.unreadMessage)

        self.reloadChatView()
        self.showHistorySince(datetime.date.today(), minMessage=3, maxMessages=10)
Ejemplo n.º 3
0
    def __init__(self):
        super(ContactsWidget, self).__init__()
        self._items = {}

        loadUi(os.path.join(QDir.searchPaths('ui')[0], 'ContactsWidget.ui'), self)

        self.importGoogleContactsButton.setIcon(QIcon.fromTheme('browser-download'))
        self.addContactButton.setIcon(QIcon.fromTheme('add'))
Ejemplo n.º 4
0
    def __init__(self):
        super(ContactsWidget, self).__init__()
        self._items = {}

        loadUi(os.path.join(QDir.searchPaths('ui')[0], 'ContactsWidget.ui'),
               self)

        self.importGoogleContactsButton.setIcon(
            QIcon.fromTheme('browser-download'))
        self.addContactButton.setIcon(QIcon.fromTheme('add'))
Ejemplo n.º 5
0
    def __init__(self):
        super(RegistrationDialog, self).__init__()
        loadUi(os.path.join(QDir.searchPaths('ui')[0], 'RegistrationDialog.ui'), self)

        self.countryCodeEdit.setText(getConfig('countryCode', ''))
        self.phoneNumberEdit.setText(getConfig('phoneNumber', ''))
        self._enableRegistration(self._hasValidPhone())

        password = getConfig('password', '')
        self.passwordEdit.setText(password)
        self._passwordChanged()
Ejemplo n.º 6
0
    def __init__(self):
        super(ContactsWidget, self).__init__()

        loadUi(os.path.join(QDir.searchPaths('ui')[0], 'ContactsWidget.ui'), self)

        self.importGoogleContactsButton.setIcon(QIcon.fromTheme('browser-download'))
        self.addContactButton.setIcon(QIcon.fromTheme('add'))

        self.contactsUpdated()
        Contacts.instance().contacts_updated_signal.connect(self.contactsUpdated)
        Contacts.instance().contact_status_changed_signal.connect(self.contactStatusChanged)
        Contacts.instance().edit_contact_signal.connect(self.editContact)
Ejemplo n.º 7
0
    def __init__(self):
        super(RegistrationDialog, self).__init__()
        loadUi(
            os.path.join(QDir.searchPaths('ui')[0], 'RegistrationDialog.ui'),
            self)

        self.countryCodeEdit.setText(getConfig('countryCode', ''))
        self.phoneNumberEdit.setText(getConfig('phoneNumber', ''))
        self._enableRegistration(self._hasValidPhone())

        password = getConfig('password', '')
        self.passwordEdit.setText(password)
        self._passwordChanged()