[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:58:50 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=6a90ae1

The following commit has been merged in the master branch:
commit 6a90ae114692f704eee6ec2ba840c80eafc99e6e
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Sat Jan 8 17:51:08 2011 +0000

    start of a delegate to view online state
---
 src/CMakeLists.txt             |  1 +
 src/accounts-list-delegate.cpp | 37 +++++++++++++++++++++++++++++++++++++
 src/accounts-list-delegate.h   | 20 ++++++++++++++++++++
 src/kcm-telepathy-accounts.cpp |  3 +++
 4 files changed, 61 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6ebed12..c55c046 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,6 +12,7 @@ set (telepathy_accounts_kcm_SRCS
      account-item.cpp
      add-account-assistant.cpp
      edit-account-dialog.cpp
+     accounts-list-delegate.cpp
 )
 
 kde4_add_ui_files (telepathy_accounts_kcm_SRCS
diff --git a/src/accounts-list-delegate.cpp b/src/accounts-list-delegate.cpp
new file mode 100644
index 0000000..c6bb7f6
--- /dev/null
+++ b/src/accounts-list-delegate.cpp
@@ -0,0 +1,37 @@
+#include "accounts-list-delegate.h"
+
+#include <QApplication>
+#include <QPainter>
+
+AccountsListDelegate::AccountsListDelegate(QObject *parent) :
+    QAbstractItemDelegate(parent)
+{
+}
+
+QSize AccountsListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    Q_UNUSED(index);
+
+    int iconHeight = option.decorationSize.height() + (4*2);
+
+    return QSize(iconHeight,50); //any random width,the view should give us the whole thing.
+}
+
+void AccountsListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    QStyle *style = QApplication::style();
+
+    style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
+
+    QRect innerRect = option.rect.adjusted(4,4,-4,-4); //add some padding
+    QRect iconRect(innerRect.topLeft(), option.decorationSize);
+
+    QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
+    painter->drawPixmap(iconRect, icon.pixmap(option.decorationSize));
+
+    QRect textRect(iconRect.topRight(), innerRect.bottomRight());
+
+    painter->drawText(textRect, index.data(Qt::DisplayRole).toString());
+}
+
+
diff --git a/src/accounts-list-delegate.h b/src/accounts-list-delegate.h
new file mode 100644
index 0000000..fdc2f81
--- /dev/null
+++ b/src/accounts-list-delegate.h
@@ -0,0 +1,20 @@
+#ifndef ACCOUNTLISTDELEGATE_H
+#define ACCOUNTLISTDELEGATE_H
+
+#include <QAbstractItemDelegate>
+
+class AccountsListDelegate : public QAbstractItemDelegate
+{
+    Q_OBJECT
+public:
+    explicit AccountsListDelegate(QObject *parent = 0);
+    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+
+signals:
+
+public slots:
+
+};
+
+#endif // ACCOUNTLISTDELEGATE_H
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index 554f6d1..8c915b5 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -25,6 +25,7 @@
 #include "accounts-list-model.h"
 #include "add-account-assistant.h"
 #include "edit-account-dialog.h"
+#include "accounts-list-delegate.h"
 
 #include <KGenericFactory>
 #include <KIcon>
@@ -75,6 +76,8 @@ KCMTelepathyAccounts::KCMTelepathyAccounts(QWidget *parent, const QVariantList&
     m_ui->addAccountButton->setIcon(KIcon("list-add"));
     m_ui->editAccountButton->setIcon(KIcon("configure"));
     m_ui->removeAccountButton->setIcon(KIcon("edit-delete"));
+    m_ui->accountsListView->setItemDelegate(new AccountsListDelegate(this));
+
 
     // Connect to useful signals from the UI elements.
     connect(m_ui->addAccountButton,

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list