[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:04:51 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=58b7932
The following commit has been merged in the master branch:
commit 58b7932418df6d4d6cd438ee4211e1a848edfa90
Author: Lasath Fernando <kde at lasath.org>
Date: Tue Jan 3 18:03:30 2012 +1100
Made Conversation inherit Queable and made the chat plasmoid in QML to get it to popout properly.
---
KTp/Declarative/conversation-que-manager.cpp | 37 +++++++++++++++++-----------
KTp/Declarative/conversation-que-manager.h | 10 +++++---
KTp/Declarative/conversation.cpp | 16 ++++++++++--
KTp/Declarative/conversation.h | 8 +++++-
KTp/Declarative/messages-model.cpp | 7 ++++--
5 files changed, 54 insertions(+), 24 deletions(-)
diff --git a/KTp/Declarative/conversation-que-manager.cpp b/KTp/Declarative/conversation-que-manager.cpp
index ceeabdb..8ac5083 100644
--- a/KTp/Declarative/conversation-que-manager.cpp
+++ b/KTp/Declarative/conversation-que-manager.cpp
@@ -1,6 +1,5 @@
/*
- <one line to give the library's name and an idea of what it does.>
- Copyright (C) 2012 <copyright holder> <email>
+ Copyright (C) 2011 Lasath Fernando <kde at lasath.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,22 +18,25 @@
#include "conversation-que-manager.h"
+#include <KDebug>
-
-
-Queable::Queable(ConversationQueManager* que)
+void Queable::push()
{
- if(que) {
- m_queManager = que;
- } else {
- m_queManager = ConversationQueManager::instance();
+ if(!m_queManager->que.contains(this)) {
+ m_queManager->que.append(this);
}
}
-void Queable::push()
+Queable::~Queable()
{
- if(!m_queManager->que.contains(this)) {
- m_queManager->que.append(this);
+
+}
+
+Queable::Queable(ConversationQueManager* que)
+ : m_queManager(que)
+{
+ if(!que) {
+ m_queManager = ConversationQueManager::instance();
}
}
@@ -43,7 +45,7 @@ ConversationQueManager* ConversationQueManager::instance()
static ConversationQueManager* m_instance = 0;
if(!m_instance) {
- m_instance = ConversationQueManager();
+ m_instance = new ConversationQueManager();
}
return m_instance;
@@ -51,15 +53,20 @@ ConversationQueManager* ConversationQueManager::instance()
ConversationQueManager::ConversationQueManager(QObject* parent): QObject(parent)
{
+ kDebug();
+
//FIXME: think of a good name for this. What did Kopete call it?
- m_gloablAction = new KAction("cycle-unread-conversations");
- m_gloablAction->setGlobalShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
+ m_gloablAction = new KAction(this);
+ m_gloablAction->setObjectName(QLatin1String("next-unread-conversation"));
+ m_gloablAction->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_J), KAction::ActiveShortcut | KAction::DefaultShortcut, KAction::NoAutoloading);
connect(m_gloablAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), SLOT(popConversation()));
}
void ConversationQueManager::popConversation()
{
+ kDebug();
+
if(!que.isEmpty()) {
que.takeLast()->pop();
}
diff --git a/KTp/Declarative/conversation-que-manager.h b/KTp/Declarative/conversation-que-manager.h
index 94ae6c7..dc8243f 100644
--- a/KTp/Declarative/conversation-que-manager.h
+++ b/KTp/Declarative/conversation-que-manager.h
@@ -1,6 +1,5 @@
/*
- <one line to give the library's name and an idea of what it does.>
- Copyright (C) 2012 <copyright holder> <email>
+ Copyright (C) 2011 Lasath Fernando <kde at lasath.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -24,21 +23,24 @@
#include <QtCore/QObject>
#include <KAction>
+class ConversationQueManager;
class Queable {
friend class ConversationQueManager;
public:
- explicit Queable(ConversationQueManager* que = 0);
-
+ Queable(ConversationQueManager* que = 0);
private:
ConversationQueManager* m_queManager;
protected:
+ virtual ~Queable();
+
void push();
virtual void pop() = 0;
};
class ConversationQueManager : public QObject
{
+Q_OBJECT
friend class Queable;
public:
static ConversationQueManager* instance();
diff --git a/KTp/Declarative/conversation.cpp b/KTp/Declarative/conversation.cpp
index 54373cf..8eb40a2 100644
--- a/KTp/Declarative/conversation.cpp
+++ b/KTp/Declarative/conversation.cpp
@@ -29,10 +29,11 @@ class Conversation::ConversationPrivate
public:
MessagesModel* model;
ConversationTarget* target;
- Tp::AccountPtr account;
+// Tp::AccountPtr account;
};
Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
+ Queable(),
d (new ConversationPrivate)
{
kDebug();
@@ -42,7 +43,8 @@ Conversation::Conversation(Tp::TextChannelPtr channel, Tp::AccountPtr account) :
d->target = new ConversationTarget(channel->targetContact());
- d->account = account;
+ connect(model(), SIGNAL(unreadCountChanged(int)), SLOT(onUnreadMessagesChanged()));
+// d->account = account;
}
Conversation::Conversation(QObject* parent) : QObject(parent)
@@ -61,6 +63,16 @@ ConversationTarget* Conversation::target() const
return d->target;
}
+void Conversation::onUnreadMessagesChanged()
+{
+ push();
+}
+
+void Conversation::pop()
+{
+ Q_EMIT popoutRequested();
+}
+
Conversation::~Conversation()
{
kDebug();
diff --git a/KTp/Declarative/conversation.h b/KTp/Declarative/conversation.h
index 71c1835..f07c81c 100644
--- a/KTp/Declarative/conversation.h
+++ b/KTp/Declarative/conversation.h
@@ -27,10 +27,11 @@
#include <TelepathyQt/TextChannel>
// #include "conversation-model.h"
#include <KIcon>
+#include "conversation-que-manager.h"
class ConversationTarget;
class MessagesModel;
-class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject
+class KDE_TELEPATHY_CHAT_EXPORT Conversation : public QObject, public Queable
{
Q_OBJECT
@@ -49,6 +50,11 @@ public:
Q_SIGNALS:
void modelChanged(MessagesModel* newModel);
void targetChanged(ConversationTarget* target);
+ void popoutRequested();
+
+private Q_SLOTS:
+ virtual void pop();
+ void onUnreadMessagesChanged();
private:
class ConversationPrivate;
diff --git a/KTp/Declarative/messages-model.cpp b/KTp/Declarative/messages-model.cpp
index 6bb515e..35b1e6d 100644
--- a/KTp/Declarative/messages-model.cpp
+++ b/KTp/Declarative/messages-model.cpp
@@ -37,7 +37,7 @@ public:
} type;
MessageItem(QString user, QString text, QDateTime time, MessageType type, QString messageId)
- : user(user), text(text), time(time), type(type), id(messageId)
+ : user(user), text(text), time(time), id(messageId), type(type)
{
if(this->text.endsWith(QLatin1String("
"))) {
this->text.chop(1);
@@ -252,7 +252,7 @@ void MessagesModel::setVisibleToUser(bool visible)
if(d->visible != visible) {
d->visible = visible;
- Q_EMIT visibleToUserChanged(visible);
+ Q_EMIT visibleToUserChanged(d->visible);
}
if(visible) {
@@ -276,6 +276,9 @@ void MessagesModel::printallmessages()
Q_FOREACH(MessageItem msg, d->messages) {
kDebug() << msg.text;
}
+ beginResetModel();
+ d->messages.clear();
+ endResetModel();
}
#include "moc_messages-model.cpp"
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list