[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:05:05 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=d5475b2
The following commit has been merged in the master branch:
commit d5475b299f87449e49a912b49a048c86a8501425
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Wed Mar 14 23:34:12 2012 +0000
Split into QML plugin and QML plasmoid
---
KTp/Declarative/contact-list.cpp | 111 ++++++++++-----------------------------
KTp/Declarative/contact-list.h | 82 ++++++++++++-----------------
2 files changed, 61 insertions(+), 132 deletions(-)
diff --git a/KTp/Declarative/contact-list.cpp b/KTp/Declarative/contact-list.cpp
index cf68d2e..74217bd 100644
--- a/KTp/Declarative/contact-list.cpp
+++ b/KTp/Declarative/contact-list.cpp
@@ -1,28 +1,22 @@
-/***************************************************************************
- * Copyright (C) 2011 by Francesco Nwokeka <francesco.nwokeka at gmail.com> *
- * *
- * 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 "telepathyContactList.h"
-
-#include <KStandardDirs>
-
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QtDeclarative/QDeclarativeContext>
+/*
+ Copyright (C) 2011 David Edmundson <kde at davidedmundson.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 Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "contact-list.h"
#include <TelepathyQt/AccountFactory>
#include <TelepathyQt/ContactFactory>
@@ -30,20 +24,11 @@
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/PendingReady>
-#include <KTp/Models/accounts-model.h>
-#include <KTp/Models/flat-model-proxy.h>
-
-
-
-TelepathyContactList::TelepathyContactList(QObject* parent, const QVariantList& args)
- : Applet(parent, args)
- , m_declarative(new Plasma::DeclarativeWidget(this))
- , m_qmlObject(0)
+ContactList::ContactList(QObject *parent)
+ : QObject(parent),
+ m_accountsModel(new AccountsModel(this)),
+ m_flatModel(new FlatModelProxy(m_accountsModel))
{
- // set plasmoid size
- setMinimumSize(250, 400);
- setAspectRatioMode(Plasma::IgnoreAspectRatio);
-
Tp::registerTypes();
// Start setting up the Telepathy AccountManager.
@@ -78,56 +63,16 @@ TelepathyContactList::TelepathyContactList(QObject* parent, const QVariantList&
connect(m_accountManager->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onAccountManagerReady(Tp::PendingOperation*)));
-
- m_model = new AccountsModel(this);
- m_proxyModel = new FlatModelProxy(m_model);
}
-TelepathyContactList::~TelepathyContactList()
-{
- delete m_declarative;
-}
-int TelepathyContactList::appletHeight() const
+void ContactList::onAccountManagerReady(Tp::PendingOperation *op)
{
- return geometry().height();
+ Q_UNUSED(op);
+ m_accountsModel->setAccountManager(m_accountManager);
}
-int TelepathyContactList::appletWidth() const
-{
- return geometry().width();
-}
-
-
-void TelepathyContactList::init()
-{
- // load QML part of the plasmoid
- if (m_declarative) {
- QString qmlFile = KGlobal::dirs()->findResource("data", "plasma/plasmoids/org.kde.telepathy-contact-list/contents/ui/main.qml");
- qDebug() << "LOADING: " << qmlFile;
- m_declarative->setQmlPath(qmlFile);
-
- // make C++ Plasma::Applet available to QML for resize signal
- m_declarative->engine()->rootContext()->setContextProperty("TelepathyContactList", this);
- m_declarative->engine()->rootContext()->setContextProperty("contactListModel", m_proxyModel);
-
- // setup qml object so that we can talk to the declarative part
- m_qmlObject = dynamic_cast<QObject*>(m_declarative->rootObject());
-
- // connect the qml object to recieve signals from C++ end
- // these two signals are for the plasmoid resize. QML can't determine the Plasma::DeclarativeWidget's boundaries
- connect(this, SIGNAL(widthChanged()), m_qmlObject, SLOT(onWidthChanged()));
- connect(this, SIGNAL(heightChanged()), m_qmlObject, SLOT(onHeightChanged()));
-
- //FIXME this code is messy, steal from qmlsplashscreen
- }
-}
-
-
-// This is the command that links your applet to the .desktop file
-K_EXPORT_PLASMA_APPLET(telepathy-contact-list, TelepathyContactList)
-
-void TelepathyContactList::onAccountManagerReady(Tp::PendingOperation *op)
+FlatModelProxy * ContactList::flatModel() const
{
- m_model->setAccountManager(m_accountManager);
+ return m_flatModel;
}
diff --git a/KTp/Declarative/contact-list.h b/KTp/Declarative/contact-list.h
index f2ae467..dd7f3eb 100644
--- a/KTp/Declarative/contact-list.h
+++ b/KTp/Declarative/contact-list.h
@@ -1,62 +1,46 @@
-/***************************************************************************
- * Copyright (C) 2011 by Francesco Nwokeka <francesco.nwokeka at gmail.com> *
- * *
- * 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 *
- ***************************************************************************/
-
-#ifndef TELEPATHY_CONTACT_LIST_H
-#define TELEPATHY_CONTACT_LIST_H
-
-#include <Plasma/Applet>
-#include <Plasma/DeclarativeWidget>
+/*
+ Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
-#include <TelepathyQt/Types>
+ 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.
-class AccountsModel;
-class FlatModelProxy;
+ 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.
-namespace Tp {
-class PendingOperation;
-}
+ 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
+*/
-class TelepathyContactList : public Plasma::Applet
-{
- Q_OBJECT
-public:
- TelepathyContactList(QObject *parent, const QVariantList &args);
- virtual ~TelepathyContactList();
+#ifndef CONTACT_LIST_H
+#define CONTACT_LIST_H
- Q_PROPERTY(int width READ appletWidth);
- Q_PROPERTY(int height READ appletHeight);
+#include <KTp/Models/accounts-model.h>
+#include <KTp/Models/flat-model-proxy.h>
- int appletHeight() const; /** returns plasma applet's height */
- int appletWidth() const; /** returns plasma applet's width */
- void init();
+#include <TelepathyQt/Types>
+/** Exposes general contact list stuff to QML*/
+class ContactList : public QObject
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(QObject* model READ flatModel)
+
+ ContactList(QObject *parent=0);
+ FlatModelProxy* flatModel() const;
+
private slots:
void onAccountManagerReady(Tp::PendingOperation *op);
-// QString extractAvatarPathFromNepomuk(const QString &nepomukUri);
-
+
private:
- Plasma::DeclarativeWidget *m_declarative;
- QObject *m_qmlObject;
+ AccountsModel* m_accountsModel;
+ FlatModelProxy* m_flatModel;
Tp::AccountManagerPtr m_accountManager;
-
- AccountsModel *m_model;
- FlatModelProxy *m_proxyModel;
};
-#endif // TELEPATHY_CONTACT_LIST_H
+#endif
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list