Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git CMakeLists.txt CMakeLists.txt
- index 0008e57..e5dc102 100644
- --- CMakeLists.txt
- +++ CMakeLists.txt
- @@ -10,7 +10,7 @@ set (CMAKE_MODULE_PATH
- set(KDE_MIN_VERSION "4.4.75")
- find_package (KDE4 ${KDE_MIN_VERSION} REQUIRED)
- -find_package (TelepathyQt4 0.8.9 REQUIRED)
- +find_package (TelepathyQt4 0.9.1 REQUIRED)
- find_package (KTp REQUIRED)
- include (CheckIncludeFiles)
- diff --git app/chat-window.cpp app/chat-window.cpp
- index 4a866ea..3b1c26a 100644
- --- app/chat-window.cpp
- +++ app/chat-window.cpp
- @@ -277,13 +277,8 @@ void ChatWindow::onBlockOperationFinished(Tp::PendingOperation *op)
- QString errorMsg(op->errorName() + QLatin1String(": ") + op->errorMessage());
- sendNotificationToUser(SystemErrorMessage, errorMsg);
- }
- - else { //Change the name of the action to "Unblock Contact" and disconnect it with the block slot and reconnect it with unblock slot
- - QAction *action = actionCollection()->action(QLatin1String("block-contact"));
- -
- - disconnect(action, SIGNAL(triggered()), this, SLOT(onBlockContactTriggered()));
- - action->setText(i18n("&Unblock Contact"));
- -
- - connect(action, SIGNAL(triggered()), this, SLOT(onUnblockContactTriggered()));
- + else {
- + setBlockEnabled(true);
- }
- }
- @@ -322,6 +317,7 @@ void ChatWindow::onCurrentIndexChanged(int index)
- Tp::ContactCapabilities selfCapabilities = currentChatTab->textChannel()->groupSelfContact()->capabilities();
- setAudioCallEnabled(selfCapabilities.streamedMediaAudioCalls() && contactCapabilites.streamedMediaAudioCalls());
- + setBlockEnabled(currentChatTab->textChannel()->targetContact()->isBlocked());
- setFileTransferEnabled(selfCapabilities.fileTransfers() && contactCapabilites.fileTransfers());
- setVideoCallEnabled(selfCapabilities.streamedMediaVideoCalls() && contactCapabilites.streamedMediaVideoCalls());
- setShareDesktopEnabled(s_krfbAvailableChecker->isAvailable() && contactCapabilites.streamTubes(QLatin1String("rfb")));
- @@ -634,6 +630,24 @@ void ChatWindow::setShareDesktopEnabled(bool enable)
- }
- }
- +void ChatWindow::setBlockEnabled(bool blocked)
- +{
- + QAction *action = actionCollection()->action(QLatin1String("block-contact"));
- +
- + if(blocked) {//Change the name of the action to "Unblock Contact" and disconnect it with the block slot and reconnect it with unblock slot
- + disconnect(action, SIGNAL(triggered()), this, SLOT(onBlockContactTriggered()));
- + action->setText(i18n("&Unblock Contact"));
- +
- + connect(action, SIGNAL(triggered()), this, SLOT(onUnblockContactTriggered()));
- + }
- + else {//Change the name of the action to "Block Contact" and disconnect it with the unblock slot and reconnect it with block slot
- + disconnect(action, SIGNAL(triggered()), this, SLOT(onUnblockContactTriggered()));
- + action->setText(i18n("&Block Contact"));
- +
- + connect(action, SIGNAL(triggered()), this, SLOT(onBlockContactTriggered()));
- + }
- +}
- +
- void ChatWindow::startAudioCall(const Tp::AccountPtr& account, const Tp::ContactPtr& contact)
- {
- Tp::PendingChannelRequest *channelRequest = account->ensureAudioCall(contact,
- @@ -721,13 +735,8 @@ void ChatWindow::onUnblockOperationFinished(Tp::PendingOperation *op)
- QString errorMsg(op->errorName() + QLatin1String(": ") + op->errorMessage());
- sendNotificationToUser(SystemErrorMessage, errorMsg);
- }
- - else { //Change the name of the action to "Block Contact" and disconnect it with the unblock slot and reconnect it with block slot
- - QAction *action = actionCollection()->action(QLatin1String("block-contact"));
- -
- - disconnect(action, SIGNAL(triggered()), this, SLOT(onUnblockContactTriggered()));
- - action->setText(i18n("&Block Contact"));
- -
- - connect(action, SIGNAL(triggered()), this, SLOT(onBlockContactTriggered()));
- + else {
- + setBlockEnabled(false);
- }
- }
- diff --git app/chat-window.h app/chat-window.h
- index 7fdf379..3699401 100644
- --- app/chat-window.h
- +++ app/chat-window.h
- @@ -130,7 +130,8 @@ private:
- void setInviteToChatEnabled(bool enable);
- void setVideoCallEnabled(bool enable);
- void setShareDesktopEnabled(bool enable);
- -
- + void setBlockEnabled(bool blocked); //Sets the block/unblock action according to the blocked flag
- +
- /** starts audio call with given contact
- * @param account account sending the audio call request
- * @param contact contact with whom to start audio call
- diff --git lib/channel-contact-model.cpp lib/channel-contact-model.cpp
- index d731322..fa33ac7 100644
- --- lib/channel-contact-model.cpp
- +++ lib/channel-contact-model.cpp
- @@ -112,6 +112,17 @@ void ChannelContactModel::onContactAliasChanged(const QString &alias)
- Q_EMIT contactAliasChanged(contact, alias);
- }
- +
- +void ChannelContactModel::onContactBlockStatusChanged(bool blocked)
- +{
- + Tp::ContactPtr contact(qobject_cast<Tp::Contact*>(sender()));
- +
- + QModelIndex index = createIndex(m_contacts.lastIndexOf(contact), 0);
- + Q_EMIT dataChanged(index, index);
- +
- + Q_EMIT contactBlockStatusChanged(contact, blocked);
- +}
- +
- void ChannelContactModel::addContacts(const Tp::Contacts &contacts)
- {
- QList<Tp::ContactPtr> newContacts = contacts.toList();
- @@ -119,6 +130,7 @@ void ChannelContactModel::addContacts(const Tp::Contacts &contacts)
- Q_FOREACH(Tp::ContactPtr contact, newContacts) {
- connect(contact.data(), SIGNAL(aliasChanged(QString)), SLOT(onContactAliasChanged(QString)));
- connect(contact.data(), SIGNAL(presenceChanged(Tp::Presence)), SLOT(onContactPresenceChanged(Tp::Presence)));
- + connect(contact.data(), SIGNAL(blockStatusChanged(bool)), SLOT(onContactBlockStatusChanged(bool)));
- }
- beginInsertRows(QModelIndex(), m_contacts.size(), m_contacts.size() + newContacts.size());
- @@ -135,7 +147,8 @@ void ChannelContactModel::removeContacts(const Tp::Contacts &contacts)
- //if we don't disconnect could we still get notifications here about their status/presence changes even if a contact has left the room
- disconnect(contact.data(), SIGNAL(aliasChanged(QString)), this, SLOT(onContactAliasChanged(QString)));
- disconnect(contact.data(), SIGNAL(presenceChanged(Tp::Presence)), this, SLOT(onContactPresenceChanged(Tp::Presence)));
- -
- + disconnect(contact.data(), SIGNAL(blockStatusChanged(bool)), this, SLOT(onContactBlockStatusChanged(bool)));
- +
- beginRemoveRows(QModelIndex(), m_contacts.indexOf(contact), m_contacts.indexOf(contact));
- m_contacts.removeAll(contact);
- endRemoveRows();
- diff --git lib/channel-contact-model.h lib/channel-contact-model.h
- index 41d5d84..d62ef98 100644
- --- lib/channel-contact-model.h
- +++ lib/channel-contact-model.h
- @@ -47,6 +47,7 @@ public:
- Q_SIGNALS:
- void contactPresenceChanged(const Tp::ContactPtr &contact, const KTp::Presence &presence);
- void contactAliasChanged(const Tp::ContactPtr &contact, const QString &alias);
- + void contactBlockStatusChanged(const Tp::ContactPtr &contact, bool blocked);
- protected:
- int rowCount(const QModelIndex &parent) const;
- @@ -60,6 +61,7 @@ private Q_SLOTS:
- const Tp::Channel::GroupMemberChangeDetails &details);
- void onContactPresenceChanged(const Tp::Presence &presence);
- void onContactAliasChanged(const QString &alias);
- + void onContactBlockStatusChanged(bool blocked);
- private:
- diff --git lib/chat-widget.cpp lib/chat-widget.cpp
- index bb1f5ef..dce35f4 100644
- --- lib/chat-widget.cpp
- +++ lib/chat-widget.cpp
- @@ -400,6 +400,8 @@ void ChatWidget::setupContactModelSignals()
- SLOT(onContactPresenceChange(Tp::ContactPtr,KTp::Presence)));
- connect(d->contactModel, SIGNAL(contactAliasChanged(Tp::ContactPtr,QString)),
- SLOT(onContactAliasChanged(Tp::ContactPtr,QString)));
- + connect(d->contactModel, SIGNAL(contactBlockStatusChanged(Tp::ContactPtr,bool)),
- + SLOT(onContactBlockStatusChanged(Tp::ContactPtr,bool)));
- }
- @@ -806,6 +808,15 @@ void ChatWidget::onContactAliasChanged(const Tp::ContactPtr & contact, const QSt
- }
- }
- +
- +void ChatWidget::onContactBlockStatusChanged(const Tp::ContactPtr &contact, bool blocked)
- +{
- + //TODO: Add the chatview logic
- +
- + Q_EMIT contactBlockStatusChanged(blocked);
- +
- +}
- +
- void ChatWidget::onChannelInvalidated()
- {
- setChatEnabled(false);
- diff --git lib/chat-widget.h lib/chat-widget.h
- index e1efbbb..5dd6691 100644
- --- lib/chat-widget.h
- +++ lib/chat-widget.h
- @@ -119,6 +119,8 @@ protected Q_SLOTS:
- void onContactPresenceChange(const Tp::ContactPtr &contact, const KTp::Presence &presence);
- void onContactAliasChanged(const Tp::ContactPtr &contact, const QString &alias);
- +
- + void onContactBlockStatusChanged(const Tp::ContactPtr &contact, bool blocked);
- void onChannelInvalidated();
- @@ -143,7 +145,9 @@ Q_SIGNALS:
- void userTypingChanged(Tp::ChannelChatState);
- void contactPresenceChanged(KTp::Presence presence);
- -
- +
- + void contactBlockStatusChanged(bool blocked);
- +
- void unreadMessagesChanged();
- /** Emitted when a notification for the chat window has been activated*/
Add Comment
Please, Sign In to add comment