[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:20:49 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=930702b
The following commit has been merged in the master branch:
commit 930702b89cc1b16c599729a2dd3489f565de9022
Author: Lasath Fernando <kde at lasath.org>
Date: Tue Jan 3 16:21:12 2012 +1100
Implemented ConversationQueManager class with Queable interface.
---
lib/conversation-que-manager.cpp | 66 ++++++++++++++++++++++
...rsations-model.h => conversation-que-manager.h} | 47 +++++++--------
2 files changed, 90 insertions(+), 23 deletions(-)
diff --git a/lib/conversation-que-manager.cpp b/lib/conversation-que-manager.cpp
new file mode 100644
index 0000000..ceeabdb
--- /dev/null
+++ b/lib/conversation-que-manager.cpp
@@ -0,0 +1,66 @@
+/*
+ <one line to give the library's name and an idea of what it does.>
+ Copyright (C) 2012 <copyright holder> <email>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+
+#include "conversation-que-manager.h"
+
+
+
+Queable::Queable(ConversationQueManager* que)
+{
+ if(que) {
+ m_queManager = que;
+ } else {
+ m_queManager = ConversationQueManager::instance();
+ }
+}
+
+void Queable::push()
+{
+ if(!m_queManager->que.contains(this)) {
+ m_queManager->que.append(this);
+ }
+}
+
+ConversationQueManager* ConversationQueManager::instance()
+{
+ static ConversationQueManager* m_instance = 0;
+
+ if(!m_instance) {
+ m_instance = ConversationQueManager();
+ }
+
+ return m_instance;
+}
+
+ConversationQueManager::ConversationQueManager(QObject* parent): QObject(parent)
+{
+ //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);
+
+ connect(m_gloablAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), SLOT(popConversation()));
+}
+
+void ConversationQueManager::popConversation()
+{
+ if(!que.isEmpty()) {
+ que.takeLast()->pop();
+ }
+}
\ No newline at end of file
diff --git a/lib/conversations-model.h b/lib/conversation-que-manager.h
similarity index 51%
copy from lib/conversations-model.h
copy to lib/conversation-que-manager.h
index 4af433c..94ae6c7 100644
--- a/lib/conversations-model.h
+++ b/lib/conversation-que-manager.h
@@ -1,5 +1,6 @@
/*
- Copyright (C) 2011 Lasath Fernando <kde at lasath.org>
+ <one line to give the library's name and an idea of what it does.>
+ Copyright (C) 2012 <copyright holder> <email>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -17,36 +18,36 @@
*/
-#ifndef CONVERSATIONS_MODEL_H
-#define CONVERSATIONS_MODEL_H
+#ifndef CONVERSATION_QUE_MANAGER_H
+#define CONVERSATION_QUE_MANAGER_H
-#include <QAbstractListModel>
+#include <QtCore/QObject>
+#include <KAction>
-#include "ktpchat_export.h"
+class Queable {
+ friend class ConversationQueManager;
+public:
+ explicit Queable(ConversationQueManager* que = 0);
+private:
+ ConversationQueManager* m_queManager;
-class Conversation;
+protected:
+ void push();
+ virtual void pop() = 0;
+};
-class KDE_TELEPATHY_CHAT_EXPORT ConversationsModel : public QAbstractListModel
+class ConversationQueManager : public QObject
{
-Q_OBJECT
+ friend class Queable;
public:
- ConversationsModel();
- virtual ~ConversationsModel();
-
- virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
- virtual int rowCount ( const QModelIndex& parent = QModelIndex() ) const;
-
- enum role {
- ConversationRole = Qt::UserRole
- };
-
+ static ConversationQueManager* instance();
private:
- class ConversationsModelPrivate;
- ConversationsModelPrivate* d;
-
+ QList<Queable*> que;
+ KAction* m_gloablAction;
+ explicit ConversationQueManager(QObject* parent = 0);
private Q_SLOTS:
- void onInconmingConversation(Conversation *convo);
+ void popConversation();
};
-#endif // CONVERSATIONS_MODEL_H
+#endif // CONVERSATION_QUE_MANAGER_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list