[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:05:05 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=0fcbba8
The following commit has been merged in the master branch:
commit 0fcbba8db510fe330cee7bf642c9d49a4aa7a142
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Thu Feb 24 00:12:49 2011 +0100
Another code cleanup and unused files removal.
---
account-item.cpp | 173 ----------------------------------
account-item.h | 72 --------------
accounts-list-model.cpp | 243 ------------------------------------------------
accounts-model-item.cpp | 1 -
accounts-model.cpp | 2 +-
accounts-model.h | 6 +-
global.h | 41 --------
main-widget.cpp | 1 -
tree-node.cpp | 6 +-
tree-node.h | 4 +-
10 files changed, 7 insertions(+), 542 deletions(-)
diff --git a/account-item.cpp b/account-item.cpp
deleted file mode 100644
index 799cd1f..0000000
--- a/account-item.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * This file is part of telepathy-accounts-kcm
- *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
- *
- * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <QtCore/QTimer>
-#include <QtGui/QPainter>
-
-#include <KApplication>
-#include <KDebug>
-#include <KIcon>
-#include <KLocalizedString>
-
-#include <TelepathyQt4/PendingOperation>
-#include <TelepathyQt4/PendingReady>
-
-#include "account-item.h"
-#include "accounts-list-model.h"
-
-AccountItem::AccountItem(const Tp::AccountPtr &account, AccountsListModel *parent)
- : QObject(parent),
- m_account(account),
- m_icon(new KIcon())
-{
- kDebug();
-
- //connect AccountPtr signals to AccountItem signals
- connect(m_account.data(),
- SIGNAL(stateChanged(bool)),
- SIGNAL(updated()));
- connect(m_account.data(),
- SIGNAL(displayNameChanged(const QString&)),
- SIGNAL(updated()));
- connect(m_account.data(),
- SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)),
- SIGNAL(updated()));
-
- generateIcon();
-}
-
-AccountItem::~AccountItem()
-{
- kDebug();
-
- delete m_icon;
-}
-
-Tp::AccountPtr AccountItem::account() const
-{
- return m_account;
-}
-
-void AccountItem::remove()
-{
- kDebug() << "Account about to be removed";
-
- Tp::PendingOperation *op = m_account->remove();
- connect(op,
- SIGNAL(finished(Tp::PendingOperation*)),
- SLOT(onAccountRemoved(Tp::PendingOperation*)));
-}
-
-const KIcon& AccountItem::icon() const
-{
- Q_ASSERT(m_icon != 0);
-
- return *m_icon;
-}
-
-const QString AccountItem::connectionStateString() const
-{
- switch (m_account->connectionStatus()) {
- case Tp::ConnectionStatusConnected:
- return i18n("Online");
- case Tp::ConnectionStatusConnecting:
- return i18n("Connecting");
- case Tp::ConnectionStatusDisconnected:
- return i18n("Disconnected");
- default:
- return "Unknown";
- }
-}
-
-const KIcon AccountItem::connectionStateIcon() const
-{
- switch (m_account->connectionStatus()) {
- case Tp::ConnectionStatusConnected:
- return KIcon("user-online");
- case Tp::ConnectionStatusConnecting:
- return KIcon("user-away"); //FIXME this is bit misleading
- case Tp::ConnectionStatusDisconnected:
- return KIcon("user-offline");
- default:
- return KIcon("user-offline");
- }
-}
-
-const QString AccountItem::connectionStatusReason() const
-{
- switch (m_account->connectionStatusReason())
- {
- case Tp::ConnectionStatusReasonAuthenticationFailed:
- return i18n("Authentication Failed");
- case Tp::ConnectionStatusReasonNetworkError:
- return i18n("Network Error");
- default:
- return QString();
- }
-}
-
-void AccountItem::generateIcon()
-{
- kDebug();
-
- QString iconPath = account()->iconName();
-
- //if the icon has not been setted, we use the protocol icon
- if(iconPath.isEmpty()) {
- iconPath = QString("im-%1").arg(account()->protocolName());
- }
-
- delete m_icon;
- m_icon = new KIcon(iconPath);
-
- if(!account()->isValid()) {
- //we paint a warning symbol in the right-bottom corner
- QPixmap pixmap = m_icon->pixmap(32, 32);
- QPainter painter(&pixmap);
- KIcon("dialog-error").paint(&painter, 15, 15, 16, 16);
-
- delete m_icon;
- m_icon = new KIcon(pixmap);
- }
-
- Q_EMIT(updated());
-}
-
-void AccountItem::onAccountRemoved(Tp::PendingOperation *op)
-{
- kDebug();
-
- if (op->isError()) {
- kDebug() << "An error occurred removing the Account."
- << op->errorName()
- << op->errorMessage();
- return;
- }
-
- Q_EMIT removed();
-}
-
-void AccountItem::onTitleForCustomPages(QString mandatoryPage, QList<QString> optionalPage)
-{
- kDebug();
- emit setTitleForCustomPages(mandatoryPage, optionalPage);
-}
-
-#include "account-item.moc"
-
diff --git a/account-item.h b/account-item.h
deleted file mode 100644
index 809b93f..0000000
--- a/account-item.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of telepathy-accounts-kcm
- *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
- *
- * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TELEPATHY_ACCOUNTS_KCM_ACCOUNT_ITEM_H
-#define TELEPATHY_ACCOUNTS_KCM_ACCOUNT_ITEM_H
-
-#include <QtCore/QObject>
-
-#include <TelepathyQt4/Account>
-
-class KIcon;
-
-class AccountsListModel;
-
-namespace Tp {
- class PendingOperation;
-}
-
-class AccountItem : public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(AccountItem);
-
-public:
- explicit AccountItem(const Tp::AccountPtr &account, AccountsListModel *parent = 0);
- virtual ~AccountItem();
- Tp::AccountPtr account() const;
- void remove();
- const KIcon& icon() const;
- const QString connectionStateString() const;
- const KIcon connectionStateIcon() const;
- const QString connectionStatusReason() const;
-
-public Q_SLOTS:
- void onTitleForCustomPages(QString, QList<QString>);
-
-Q_SIGNALS:
- void ready();
- void removed();
- void updated();
- void protocolSelected(QString, QString);
- void setTitleForCustomPages(QString, QList<QString>);
-
-private Q_SLOTS:
- void generateIcon();
- void onAccountRemoved(Tp::PendingOperation *op);
-
-private:
- Tp::AccountPtr m_account;
- KIcon* m_icon;
-};
-
-
-#endif // header guard
-
diff --git a/accounts-list-model.cpp b/accounts-list-model.cpp
deleted file mode 100644
index c91d8d7..0000000
--- a/accounts-list-model.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * This file is part of telepathy-accounts-kcm
- *
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
- *
- * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <KDebug>
-#include <KIcon>
-
-#include <TelepathyQt4/Account>
-
-#include "accounts-list-model.h"
-#include "account-item.h"
-
-AccountsListModel::AccountsListModel(QObject *parent)
- : QAbstractListModel(parent)
-{
- kDebug();
-}
-
-AccountsListModel::~AccountsListModel()
-{
- kDebug();
-}
-
-int AccountsListModel::rowCount(const QModelIndex & parent) const
-{
- // If the index is the root item, then return the row count.
- if (parent == QModelIndex()) {
- return m_accounts.size();
- }
-
- // Otherwise, return 0 (as this is a list model, so all items
- // are children of the root item).
- return 0;
-}
-
-int AccountsListModel::columnCount(const QModelIndex& parent) const
-{
- Q_UNUSED(parent);
-
- // Column count is always 1
- return 1;
-}
-
-
-QVariant AccountsListModel::data(const QModelIndex &index, int role) const
-{
- if(!index.isValid()) {
- return QVariant();
- }
-
- QVariant data;
- Tp::AccountPtr account = m_accounts.at(index.row())->account();
-
- switch(role)
- {
- case Qt::DisplayRole:
- data = QVariant(account->displayName());
- break;
-
- case Qt::DecorationRole:
- data = QVariant(m_accounts.at(index.row())->icon());
- break;
-
-
- case AccountsListModel::ConnectionStateDisplayRole:
- data = QVariant(m_accounts.at(index.row())->connectionStateString());
- break;
-
- case AccountsListModel::ConnectionStateIconRole:
- data = QVariant(m_accounts.at(index.row())->connectionStateIcon());
- break;
-
- case AccountsListModel::ConnectionErrorMessageDisplayRole:
- data = QVariant(m_accounts.at(index.row())->connectionStatusReason());
- break;
- default:
- break;
- }
-
- return data;
-}
-
-bool AccountsListModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- if(!index.isValid()) {
- return false;
- }
-
- if(role == Qt::CheckStateRole) {
- m_accounts.at(index.row())->account()->setEnabled(value.toInt() == Qt::Checked);
- return true;
- }
-
- return false;
-}
-
-QModelIndex AccountsListModel::index(int row, int column, const QModelIndex& parent) const
-{
- if(row < 0 || column < 0 || parent != QModelIndex()) {
- return QModelIndex();
- }
-
- if(row < rowCount() && column < columnCount()) {
- return createIndex(row, column);
- }
-
- return QModelIndex();
-}
-
-
-Qt::ItemFlags AccountsListModel::flags(const QModelIndex &index) const
-{
- return QAbstractItemModel::flags(index);
-}
-
-void AccountsListModel::addAccount(const Tp::AccountPtr &account)
-{
- kDebug() << "Creating a new AccountItem from account:" << account.data();
-
- // Check if the account is already in the model.
- bool found = false;
-
- if (!found) {
- foreach (const AccountItem* ai, m_accounts) {
- if (ai->account() == account) {
- found = true;
- break;
- }
- }
- }
-
- if (found) {
- kWarning() << "Requested to add account"
- << account.data()
- << "to model, but it is already present. Doing nothing.";
- } else {
- kDebug() << "Account not already in model. Create new AccountItem from account:"
- << account.data();
-
- AccountItem *item = new AccountItem(account, this);
-
- beginInsertRows(QModelIndex(), m_accounts.size(), m_accounts.size());
- m_accounts.append(item);
- endInsertRows();
-
- connect(item, SIGNAL(removed()), SLOT(onAccountItemRemoved()));
- connect(item, SIGNAL(updated()), SLOT(onAccountItemUpdated()));
- }
-}
-
-void AccountsListModel::removeAccount(const QModelIndex &index)
-{
- kDebug();
-
- if(!index.isValid()) {
- kDebug() << "Can't remove Account: Invalid index";
- return;
- }
- AccountItem *accountItem = m_accounts.at(index.row());
-
- Q_ASSERT(accountItem);
-
- accountItem->remove();
-}
-
-AccountItem* AccountsListModel::itemForIndex(const QModelIndex &index)
-{
- kDebug();
-
- if(!index.isValid()) {
- kWarning() << "Invalid index" << index;
- return 0;
- }
-
- AccountItem *accountItem = m_accounts.at(index.row());
- return accountItem;
-}
-
-void AccountsListModel::onAccountItemRemoved()
-{
- kDebug();
-
- AccountItem *item = qobject_cast<AccountItem*>(sender());
-
- Q_ASSERT(item);
- if (!item) {
- kWarning() << "Not an AccountItem pointer:" << sender();
- return;
- }
-
- // We can be pretty sure that there is only one reference to a specific AccountItem in the list
- // If we screw up here, the styling delegate will screw up even more
- beginRemoveRows(QModelIndex(), m_accounts.indexOf(item), m_accounts.indexOf(item));
- m_accounts.removeAll(item);
- endRemoveRows();
-
- // FIXME: Workaround until the KWidgetItemDelegate gets fixed (probably KDE 4.7)
- reset();
- delete item;
-}
-
-void AccountsListModel::onAccountItemUpdated()
-{
- kDebug();
-
- AccountItem *item = qobject_cast<AccountItem*>(sender());
-
- Q_ASSERT(item);
- if (!item) {
- kWarning() << "Not an AccountItem pointer:" << sender();
- return;
- }
-
- QModelIndex index = createIndex(m_accounts.lastIndexOf(item), 0);
- emit dataChanged(index, index);
-}
-
-void AccountsListModel::onTitleForCustomPages(QString mandatoryPage, QList<QString> optionalPage)
-{
- kDebug();
-
- emit setTitleForCustomPages(mandatoryPage, optionalPage);
-}
-
-
-#include "accounts-list-model.moc"
-
diff --git a/accounts-model-item.cpp b/accounts-model-item.cpp
index 5053c84..8cc907c 100644
--- a/accounts-model-item.cpp
+++ b/accounts-model-item.cpp
@@ -23,7 +23,6 @@
#include "accounts-model-item.h"
#include "accounts-model.h"
-#include "avatar-image-provider.h"
#include "contact-model-item.h"
namespace Tpy
diff --git a/accounts-model.cpp b/accounts-model.cpp
index dbc4e8f..800646a 100644
--- a/accounts-model.cpp
+++ b/accounts-model.cpp
@@ -28,7 +28,7 @@
namespace Tpy
{
-struct TELEPATHY_QT4_YELL_MODELS_NO_EXPORT AccountsModel::Private
+struct AccountsModel::Private
{
Private(const Tp::AccountManagerPtr &am)
: mAM(am)
diff --git a/accounts-model.h b/accounts-model.h
index 4dfcb30..ac985ba 100644
--- a/accounts-model.h
+++ b/accounts-model.h
@@ -21,19 +21,19 @@
#ifndef _TelepathyQt4Yell_Models_accounts_model_h_HEADER_GUARD_
#define _TelepathyQt4Yell_Models_accounts_model_h_HEADER_GUARD_
-#include <accounts-model-item.h>
+#include <QAbstractListModel>
#include <TelepathyQt4/Account>
#include <TelepathyQt4/AccountManager>
#include <TelepathyQt4/TextChannel>
#include <TelepathyQt4/Types>
-#include <QAbstractListModel>
+#include "accounts-model-item.h"
namespace Tpy
{
-class TELEPATHY_QT4_YELL_MODELS_EXPORT AccountsModel : public QAbstractItemModel
+class AccountsModel : public QAbstractItemModel
{
Q_OBJECT
Q_DISABLE_COPY(AccountsModel)
diff --git a/global.h b/global.h
deleted file mode 100644
index a286b82..0000000
--- a/global.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2010 Nokia Corporation
- *
- * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _TelepathyQt4Yell_Models_global_h_HEADER_GUARD_
-#define _TelepathyQt4Yell_Models_global_h_HEADER_GUARD_
-
-#include <QtGlobal>
-
-#ifdef BUILDING_TELEPATHY_QT4_YELL_MODELS
-# define TELEPATHY_QT4_YELL_MODELS_EXPORT Q_DECL_EXPORT
-#else
-# define TELEPATHY_QT4_YELL_MODELS_EXPORT Q_DECL_IMPORT
-#endif
-
-#if !defined(Q_OS_WIN) && defined(QT_VISIBILITY_AVAILABLE)
-# define TELEPATHY_QT4_YELL_MODELS_NO_EXPORT __attribute__((visibility("hidden")))
-#endif
-
-#ifndef TELEPATHY_QT4_YELL_MODELS_NO_EXPORT
-# define TELEPATHY_QT4_YELL_MODELS_NO_EXPORT
-#endif
-
-#endif
diff --git a/main-widget.cpp b/main-widget.cpp
index 3f8b4d0..2d3aebc 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -49,7 +49,6 @@
#include "main-widget.h"
#include "ui_main-widget.h"
-#include "account-item.h"
#include "accountbutton.h"
#include "contactoverlays.h"
#include "accounts-model.h"
diff --git a/tree-node.cpp b/tree-node.cpp
index 8b81ec8..9e9f1ee 100644
--- a/tree-node.cpp
+++ b/tree-node.cpp
@@ -18,14 +18,12 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <tree-node.h>
-
-//#include "TelepathyQt4Yell/Models/_gen/tree-node.moc.hpp"
+#include "tree-node.h"
namespace Tpy
{
-struct TELEPATHY_QT4_YELL_MODELS_NO_EXPORT TreeNode::Private
+struct TreeNode::Private
{
Private() :
mParent(0)
diff --git a/tree-node.h b/tree-node.h
index 4e1b83c..5206971 100644
--- a/tree-node.h
+++ b/tree-node.h
@@ -24,12 +24,10 @@
#include <QObject>
#include <QVariant>
-#include "global.h"
-
namespace Tpy
{
-class TELEPATHY_QT4_YELL_MODELS_EXPORT TreeNode : public QObject
+class TreeNode : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(TreeNode)
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list