[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:22:04 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=d7cc5c8
The following commit has been merged in the master branch:
commit d7cc5c8bce842b91c4033a93845b747bd6702497
Author: Dan Vrátil <dan at progdan.cz>
Date: Wed Jul 11 00:58:39 2012 +0200
Improvements in LogViewer
- display entities as a per-account tree view
- try to display contact's real name (or nickname) or fallback to Entity alias
when account is offline
- use QSplitter to make width of the EntityView and MessageView adjustable
- make the window slightly bigger by default
REVIEW: 105450
---
lib/adium-theme-view.cpp | 6 +
lib/adium-theme-view.h | 2 +
logviewer/CMakeLists.txt | 2 +
logviewer/entity-model-item.cpp | 120 +++++++++++++++++
logviewer/{message-view.h => entity-model-item.h} | 44 ++++---
logviewer/entity-model.cpp | 145 +++++++++++++++++----
logviewer/entity-model.h | 25 ++--
.../{entity-view.h => entity-proxy-model.cpp} | 35 ++---
logviewer/{entity-view.h => entity-proxy-model.h} | 26 ++--
logviewer/entity-view.cpp | 7 +-
logviewer/entity-view.h | 4 +-
logviewer/log-viewer.cpp | 33 ++++-
logviewer/log-viewer.ui | 55 ++++----
13 files changed, 390 insertions(+), 114 deletions(-)
diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index a97ba98..72db581 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -293,6 +293,12 @@ void AdiumThemeView::setHeaderDisplayed(bool displayHeader)
m_displayHeader = displayHeader;
}
+void AdiumThemeView::clear()
+{
+ if (!page()->mainFrame()->url().isEmpty()) {
+ page()->mainFrame()->setHtml(QString());
+ }
+}
void AdiumThemeView::addContentMessage(const AdiumThemeContentInfo &contentMessage)
{
diff --git a/lib/adium-theme-view.h b/lib/adium-theme-view.h
index 747a8ef..8892fed 100644
--- a/lib/adium-theme-view.h
+++ b/lib/adium-theme-view.h
@@ -86,6 +86,8 @@ public:
void setHeaderDisplayed(bool);
/* .. font, backgrounds, everything else.*/
+ void clear();
+
public Q_SLOTS:
void addContentMessage(const AdiumThemeContentInfo&);
void addStatusMessage(const AdiumThemeStatusInfo&);
diff --git a/logviewer/CMakeLists.txt b/logviewer/CMakeLists.txt
index bb22191..5e669ac 100644
--- a/logviewer/CMakeLists.txt
+++ b/logviewer/CMakeLists.txt
@@ -14,8 +14,10 @@ set(ktp-log-viewer_SRCS
main.cpp
log-viewer.cpp
entity-model.cpp
+ entity-model-item.cpp
message-view.cpp
entity-view.cpp
+ entity-proxy-model.cpp
conversation-date-picker.cpp
)
diff --git a/logviewer/entity-model-item.cpp b/logviewer/entity-model-item.cpp
new file mode 100644
index 0000000..c7f2249
--- /dev/null
+++ b/logviewer/entity-model-item.cpp
@@ -0,0 +1,120 @@
+/***************************************************************************
+ * Copyright (C) 2012 by Dan Vratil <dan at progdan.cz> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "entity-model-item.h"
+#include "entity-model.h"
+
+#include <TelepathyQt/Contact>
+#include <TelepathyLoggerQt4/Entity>
+
+#include <QDebug>
+
+EntityModelItem::EntityModelItem(EntityModelItem *parent):
+ m_parent(parent)
+{
+}
+
+EntityModelItem::~EntityModelItem()
+{
+ qDeleteAll(m_items);
+}
+
+void EntityModelItem::addItem(EntityModelItem *item)
+{
+ m_items << item;
+}
+
+EntityModelItem* EntityModelItem::item(int row) const
+{
+ if (row < m_items.count()) {
+ return m_items.at(row);
+ }
+
+ return 0;
+}
+
+EntityModelItem *EntityModelItem::item(const Tp::AccountPtr &account)
+{
+ Q_FOREACH(EntityModelItem *item, m_items) {
+ if (item->data(EntityModel::AccountRole).value< Tp::AccountPtr >() == account) {
+ return item;
+ }
+ }
+
+ return 0;
+}
+
+
+int EntityModelItem::itemCount() const
+{
+ return m_items.count();
+}
+
+EntityModelItem *EntityModelItem::parent() const
+{
+ return m_parent;
+}
+
+int EntityModelItem::row() const
+{
+ if (m_parent == 0) {
+ return 0;
+ }
+
+ for (int i = 0; i < m_parent->itemCount(); i++) {
+ if (m_parent->item(i) == this) {
+ return i;
+ }
+ }
+
+ return 0;
+}
+
+QVariant EntityModelItem::data(int role) const
+{
+ switch (role) {
+ case Qt::DisplayRole:
+ return m_contact ? m_contact->alias() : (m_entity ? m_entity->alias() : m_account->displayName());
+ case EntityModel::AccountRole:
+ return QVariant::fromValue(m_account);
+ case EntityModel::ContactRole:
+ return QVariant::fromValue(m_contact);
+ case EntityModel::EntityRole:
+ return QVariant::fromValue(m_entity);
+ case EntityModel::IdRole:
+ return m_entity->identifier();
+ }
+
+ return QVariant();
+}
+
+void EntityModelItem::setData(const QVariant &data, int role)
+{
+ switch (role) {
+ case EntityModel::AccountRole:
+ m_account = data.value< Tp::AccountPtr >();
+ break;
+ case EntityModel::ContactRole:
+ m_contact = data.value< Tp::ContactPtr >();
+ break;
+ case EntityModel::EntityRole:
+ m_entity = data.value< Tpl::EntityPtr >();
+ break;
+ }
+}
diff --git a/logviewer/message-view.h b/logviewer/entity-model-item.h
similarity index 65%
copy from logviewer/message-view.h
copy to logviewer/entity-model-item.h
index e4b9b88..e740d25 100644
--- a/logviewer/message-view.h
+++ b/logviewer/entity-model-item.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2012 by David Edmundson <kde at davidedmundson.co.uk> *
+ * Copyright (C) 2012 by Dan Vratil <dan at progdan.cz> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,34 +17,42 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#ifndef MESSAGEVIEW_H
-#define MESSAGEVIEW_H
-#include "adium-theme-view.h"
+#ifndef ENTITY_MODEL_ITEM_H
+#define ENTITY_MODEL_ITEM_H
-#include <QDate>
+#include <QVariant>
+#include <QList>
+#include <TelepathyQt/Types>
#include <TelepathyLoggerQt4/Entity>
-#include <TelepathyLoggerQt4/PendingOperation>
-
-class MessageView : public AdiumThemeView
+class EntityModelItem
{
- Q_OBJECT
+
public:
- explicit MessageView(QWidget *parent = 0);
+ EntityModelItem(EntityModelItem *parent = 0);
+ virtual ~EntityModelItem();
+
+ void addItem(EntityModelItem *item);
+
+ EntityModelItem* item(int row) const;
+ EntityModelItem* item(const Tp::AccountPtr &account);
+ int itemCount() const;
- void loadLog(const Tp::AccountPtr &account, const Tpl::EntityPtr &entity, const QDate &date);
+ QVariant data(int role) const;
+ void setData(const QVariant &data, int role);
-private Q_SLOTS:
- void onLoadFinished();
- void onEventsLoaded(Tpl::PendingOperation* po);
+ int row() const;
+ EntityModelItem* parent() const;
private:
- Tpl::EntityPtr m_entity;
- Tp::AccountPtr m_account;
- QDate m_date;
+ QList< EntityModelItem* > m_items;
+ EntityModelItem *m_parent;
+ Tp::AccountPtr m_account;
+ Tpl::EntityPtr m_entity;
+ Tp::ContactPtr m_contact;
};
-#endif // MESSAGEVIEW_H
+#endif // ENTITY_MODEL_ITEM_H
diff --git a/logviewer/entity-model.cpp b/logviewer/entity-model.cpp
index a661d10..26b9c9c 100644
--- a/logviewer/entity-model.cpp
+++ b/logviewer/entity-model.cpp
@@ -19,6 +19,7 @@
#include "entity-model.h"
+#include "entity-model-item.h"
#include <TelepathyLoggerQt4/LogManager>
#include <TelepathyLoggerQt4/PendingEntities>
@@ -27,13 +28,21 @@
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/Account>
+#include <TelepathyQt/ContactManager>
+#include <TelepathyQt/PendingOperation>
+#include <TelepathyQt/PendingContacts>
#include <QPixmap>
-
EntityModel::EntityModel(QObject *parent) :
- QAbstractListModel(parent)
+ QAbstractItemModel(parent)
+{
+ m_rootItem = new EntityModelItem();
+}
+
+EntityModel::~EntityModel()
{
+ delete m_rootItem;
}
void EntityModel::setAccountManager(const Tp::AccountManagerPtr &accountManager)
@@ -49,35 +58,74 @@ void EntityModel::setAccountManager(const Tp::AccountManagerPtr &accountManager)
int EntityModel::rowCount(const QModelIndex &parent) const
{
if (parent == QModelIndex()) {
- return m_entities.size();
+ return m_rootItem->itemCount();
+ }
+
+ return static_cast<EntityModelItem*>(parent.internalPointer())->itemCount();
+}
+
+int EntityModel::columnCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+
+ return 1;
+}
+
+QModelIndex EntityModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (!hasIndex(row, column, parent)) {
+ return QModelIndex();
+ }
+
+ EntityModelItem *parentItem, *childItem;
+ if (parent == QModelIndex()) {
+ parentItem = m_rootItem;
} else {
- return 0;
+ parentItem = static_cast<EntityModelItem*>(parent.internalPointer());
+ }
+
+ childItem = parentItem->item(row);
+ if (childItem) {
+ return createIndex(row, column, childItem);
+ } else {
+ return QModelIndex();
}
}
+QModelIndex EntityModel::parent(const QModelIndex &child) const
+{
+ if (child == QModelIndex()) {
+ return QModelIndex();
+ }
+
+ EntityModelItem* item = static_cast< EntityModelItem* >(child.internalPointer());
+ EntityModelItem *parent = item->parent();
+
+ if (parent == m_rootItem) {
+ return QModelIndex();
+ }
+
+ return createIndex(parent->row(), 0, parent);
+}
+
QVariant EntityModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
return QVariant();
}
- Tpl::EntityPtr entity = m_entities[index.row()].entity;
-
- switch (role) {
- case Qt::DisplayRole:
- return entity->alias();
- case Qt::DecorationRole:
- return QPixmap(entity->avatarToken());
- case EntityModel::IdRole:
- return entity->identifier();
- case EntityModel::TypeRole:
- return entity->entityType();
- case EntityModel::EntityRole:
- return QVariant::fromValue(entity);
- case EntityModel::AccountRole:
- return QVariant::fromValue(m_entities[index.row()].account);
+ EntityModelItem *item;
+ if (index.parent() == QModelIndex()) {
+ item = m_rootItem->item(index.row());
+ } else {
+ item = m_rootItem->item(index.parent().row())->item(index.row());
+ }
+
+ if (!item) {
+ return QVariant();
}
- return QVariant();
+
+ return item->data(role);
}
void EntityModel::onEntitiesSearchFinished(Tpl::PendingOperation *operation)
@@ -87,16 +135,59 @@ void EntityModel::onEntitiesSearchFinished(Tpl::PendingOperation *operation)
Tpl::EntityPtrList newEntries = pendingEntities->entities();
if (newEntries.size() > 0) {
- beginInsertRows(QModelIndex(), m_entities.size(), m_entities.size() + newEntries.size()-1);
- Q_FOREACH(const Tpl::EntityPtr entity, newEntries) {
- EntityModelItem item;
- item.account = pendingEntities->account();
- item.entity = entity;
-
- m_entities.append(item);
+ Q_FOREACH(const Tpl::EntityPtr &entity, newEntries) {
+ EntityModelItem *parent = m_rootItem->item(pendingEntities->account());
+ if (!parent) {
+ beginInsertRows(QModelIndex(), m_rootItem->itemCount(), m_rootItem->itemCount());
+ parent = new EntityModelItem(m_rootItem);
+ parent->setData(QVariant::fromValue(pendingEntities->account()), EntityModel::AccountRole);
+ m_rootItem->addItem(parent);
+ endInsertRows();
+ }
+
+ QModelIndex parentIndex = index(parent->row(), 0, QModelIndex());
+ beginInsertRows(parentIndex, m_rootItem->item(parentIndex.row())->row(), m_rootItem->item(parentIndex.row())->row() + 1);
+ EntityModelItem *item = new EntityModelItem(parent);
+ item->setData(QVariant::fromValue(pendingEntities->account()), EntityModel::AccountRole);
+ item->setData(QVariant::fromValue(entity), EntityModel::EntityRole);
+ parent->addItem(item);
+
+ if (pendingEntities->account()->connection()) {
+ Tp::PendingOperation *op =
+ pendingEntities->account()->connection()->contactManager()->contactsForIdentifiers(
+ QStringList() << entity->identifier());
+ connect(op, SIGNAL(finished(Tp::PendingOperation*)),
+ this, SLOT(onEntityContactRetrieved(Tp::PendingOperation*)));
+ }
}
endInsertRows();
}
}
+void EntityModel::onEntityContactRetrieved(Tp::PendingOperation *operation)
+{
+ Tp::PendingContacts *pendingContacts = qobject_cast<Tp::PendingContacts*>(operation);
+
+ Q_FOREACH(const Tp::ContactPtr &contact, pendingContacts->contacts()) {
+
+ int accRow = 0; int itemRow = 0;
+ EntityModelItem *parent, *item;
+
+ do {
+ parent = m_rootItem->item(accRow);
+ item = parent->item(itemRow);
+
+ if (item->data(EntityModel::IdRole).toString() == contact->id()) {
+ item->setData(QVariant::fromValue(contact), EntityModel::ContactRole);
+ break;
+ }
+
+ itemRow++;
+ if (itemRow >= parent->itemCount()) {
+ accRow++;
+ itemRow = 0;
+ }
+ } while (accRow < m_rootItem->itemCount());
+ }
+}
diff --git a/logviewer/entity-model.h b/logviewer/entity-model.h
index cd6649e..344a794 100644
--- a/logviewer/entity-model.h
+++ b/logviewer/entity-model.h
@@ -21,7 +21,7 @@
#ifndef ENTITYMODEL_H
#define ENTITYMODEL_H
-#include <QAbstractListModel>
+#include <QAbstractItemModel>
#include <TelepathyQt/Types>
@@ -44,14 +44,9 @@ namespace Tpl{
class PendingOperation;
}
+class EntityModelItem;
-class EntityModelItem {
-public:
- Tpl::EntityPtr entity;
- Tp::AccountPtr account;
-};
-
-class EntityModel : public QAbstractListModel
+class EntityModel : public QAbstractItemModel
{
Q_OBJECT
public:
@@ -59,26 +54,34 @@ public:
IdRole = Qt::UserRole,
TypeRole,
EntityRole,
- AccountRole
+ AccountRole,
+ ContactRole
};
-
explicit EntityModel(QObject *parent = 0);
+ virtual ~EntityModel();
+
void setAccountManager(const Tp::AccountManagerPtr &accountManager);
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &child) const;
+
private Q_SLOTS:
void onEntitiesSearchFinished(Tpl::PendingOperation*);
+ void onEntityContactRetrieved(Tp::PendingOperation*);
private:
- QList<EntityModelItem> m_entities;
+ EntityModelItem *m_rootItem;
};
Q_DECLARE_METATYPE(Tpl::EntityPtr);
Q_DECLARE_METATYPE(Tp::AccountPtr);
+Q_DECLARE_METATYPE(Tp::ContactPtr);
#endif // ENTITYMODEL_H
diff --git a/logviewer/entity-view.h b/logviewer/entity-proxy-model.cpp
similarity index 67%
copy from logviewer/entity-view.h
copy to logviewer/entity-proxy-model.cpp
index 03c23d1..e431cd0 100644
--- a/logviewer/entity-view.h
+++ b/logviewer/entity-proxy-model.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2012 by David Edmundson <kde at davidedmundson.co.uk> *
+ * Copyright (C) 2012 by Dan Vratil <dan at progdan.cz> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,22 +17,27 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#ifndef ENTITYVIEW_H
-#define ENTITYVIEW_H
-#include <QListView>
+#include "entity-proxy-model.h"
-//model is loaded asynchronously so we need to select the correct element on each new element
-//this is done in the view to avoid having to be careful with proxy models.
+#include <QDebug>
-class EntityView : public QListView
+EntityProxyModel::EntityProxyModel(QObject *parent):
+ QSortFilterProxyModel(parent)
{
- Q_OBJECT
-public:
- explicit EntityView(QWidget *parent = 0);
-
-protected Q_SLOTS:
- void rowsInserted(const QModelIndex &parent, int start, int end);
-};
+}
-#endif // ENTITYVIEW_H
+EntityProxyModel::~EntityProxyModel()
+{
+}
+
+bool EntityProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ if (source_parent == QModelIndex()) {
+ return true;
+ }
+
+ QModelIndex index = source_parent.child(source_row, 0);
+ QString term = filterRegExp().pattern();
+ return index.data(Qt::DisplayRole).toString().contains(term, Qt::CaseInsensitive);
+}
diff --git a/logviewer/entity-view.h b/logviewer/entity-proxy-model.h
similarity index 72%
copy from logviewer/entity-view.h
copy to logviewer/entity-proxy-model.h
index 03c23d1..0548081 100644
--- a/logviewer/entity-view.h
+++ b/logviewer/entity-proxy-model.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2012 by David Edmundson <kde at davidedmundson.co.uk> *
+ * Copyright (C) 2012 by Dan Vratil <dan at progdan.cz> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -17,22 +17,24 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#ifndef ENTITYVIEW_H
-#define ENTITYVIEW_H
-#include <QListView>
+#ifndef ENTITY_PROXY_MODEL_H
+#define ENTITY_PROXY_MODEL_H
-//model is loaded asynchronously so we need to select the correct element on each new element
-//this is done in the view to avoid having to be careful with proxy models.
+#include <QSortFilterProxyModel>
-class EntityView : public QListView
+
+class EntityProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
+
public:
- explicit EntityView(QWidget *parent = 0);
-
-protected Q_SLOTS:
- void rowsInserted(const QModelIndex &parent, int start, int end);
+ explicit EntityProxyModel(QObject *parent = 0);
+ virtual ~EntityProxyModel();
+
+protected:
+ bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+
};
-#endif // ENTITYVIEW_H
+#endif // ENTITY_PROXY_MODEL_H
diff --git a/logviewer/entity-view.cpp b/logviewer/entity-view.cpp
index 1ef5ef4..a470957 100644
--- a/logviewer/entity-view.cpp
+++ b/logviewer/entity-view.cpp
@@ -27,13 +27,14 @@
#include "entity-model.h"
EntityView::EntityView(QWidget *parent) :
- QListView(parent)
+ QTreeView(parent)
{
+ setHeaderHidden(true);
}
void EntityView::rowsInserted(const QModelIndex &parent, int start, int end)
{
- QListView::rowsInserted(parent, start, end);
+ QTreeView::rowsInserted(parent, start, end);
static bool loadedCurrentContact = false;
if (loadedCurrentContact) {
@@ -58,4 +59,6 @@ void EntityView::rowsInserted(const QModelIndex &parent, int start, int end)
}
}
+
+ expandAll();
}
diff --git a/logviewer/entity-view.h b/logviewer/entity-view.h
index 03c23d1..d55f194 100644
--- a/logviewer/entity-view.h
+++ b/logviewer/entity-view.h
@@ -20,12 +20,12 @@
#ifndef ENTITYVIEW_H
#define ENTITYVIEW_H
-#include <QListView>
+#include <QTreeView>
//model is loaded asynchronously so we need to select the correct element on each new element
//this is done in the view to avoid having to be careful with proxy models.
-class EntityView : public QListView
+class EntityView : public QTreeView
{
Q_OBJECT
public:
diff --git a/logviewer/log-viewer.cpp b/logviewer/log-viewer.cpp
index 2b472fa..6007f92 100644
--- a/logviewer/log-viewer.cpp
+++ b/logviewer/log-viewer.cpp
@@ -22,6 +22,7 @@
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/PendingReady>
+#include <TelepathyQt/ContactManager>
#include <TelepathyLoggerQt4/Init>
@@ -29,8 +30,10 @@
#include <TelepathyLoggerQt4/LogManager>
#include <QSortFilterProxyModel>
+#include <QWebFrame>
#include "entity-model.h"
+#include "entity-proxy-model.h"
LogViewer::LogViewer(QWidget *parent) :
QWidget(parent),
@@ -41,13 +44,33 @@ LogViewer::LogViewer(QWidget *parent) :
Tp::registerTypes();
Tpl::init();
- m_accountManager = Tp::AccountManager::create();
+ Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(
+ QDBusConnection::sessionBus(),
+ Tp::Features() << Tp::Account::FeatureCore);
+
+ Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(
+ QDBusConnection::sessionBus(),
+ Tp::Features() << Tp::Connection::FeatureCore
+ << Tp::Connection::FeatureSelfContact
+ << Tp::Connection::FeatureRoster);
+
+ Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(
+ Tp::Features() << Tp::Contact::FeatureAlias
+ << Tp::Contact::FeatureAvatarData
+ << Tp::Contact::FeatureSimplePresence
+ << Tp::Contact::FeatureCapabilities);
+
+ Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
+
+ m_accountManager = Tp::AccountManager::create(accountFactory, connectionFactory, channelFactory, contactFactory);
m_entityModel = new EntityModel(this);
- m_filterModel = new QSortFilterProxyModel(this);
+ m_filterModel = new EntityProxyModel(this);
m_filterModel->setSourceModel(m_entityModel);
ui->entityList->setModel(m_filterModel);
+ ui->entityList->setItemsExpandable(true);
+ ui->entityList->setRootIsDecorated(true);
ui->entityFilter->setProxy(m_filterModel);
//TODO parse command line args and update all views as appropriate
@@ -71,6 +94,12 @@ void LogViewer::onAccountManagerReady()
void LogViewer::onEntitySelected(const QModelIndex &index)
{
+ /* Ignore account nodes */
+ if (index.parent() == QModelIndex()) {
+ ui->messageView->clear();
+ return;
+ }
+
Tpl::EntityPtr entity = index.data(EntityModel::EntityRole).value<Tpl::EntityPtr>();
Tp::AccountPtr account = index.data(EntityModel::AccountRole).value<Tp::AccountPtr>();
diff --git a/logviewer/log-viewer.ui b/logviewer/log-viewer.ui
index c5e6a09..7e4097f 100644
--- a/logviewer/log-viewer.ui
+++ b/logviewer/log-viewer.ui
@@ -6,36 +6,41 @@
<rect>
<x>0</x>
<y>0</y>
- <width>477</width>
- <height>362</height>
+ <width>711</width>
+ <height>556</height>
</rect>
</property>
<property name="windowTitle">
<string>LogViewer</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="EntityView" name="entityList"/>
- </item>
- <item>
- <widget class="KFilterProxySearchLine" name="entityFilter"/>
- </item>
- <item>
- <widget class="ConversationDatePicker" name="datePicker" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="MessageView" name="messageView" native="true"/>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QWidget" name="">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="EntityView" name="entityList"/>
+ </item>
+ <item>
+ <widget class="KFilterProxySearchLine" name="entityFilter"/>
+ </item>
+ <item>
+ <widget class="ConversationDatePicker" name="datePicker" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="MessageView" name="messageView" native="true"/>
+ </widget>
</item>
</layout>
</widget>
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list