[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:07:31 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=262bc88
The following commit has been merged in the master branch:
commit 262bc886be7fce7d32b4d9397224e7e02b533b8c
Author: Vishesh Handa <me at vhanda.in>
Date: Wed Oct 10 20:44:08 2012 +0530
Remove the NepomukFeeder class
While it was nice experiment, storeResources has been adapted to do
nearly the same job with a new flag - OverwriteAllProperties.
---
kpeople/nepomuk-feeder/CMakeLists.txt | 1 -
kpeople/nepomuk-feeder/nepomuk-storage.cpp | 13 +++--
kpeople/nepomuk-feeder/nepomuk-storage.h | 2 +
kpeople/nepomuk-feeder/nepomukfeeder.cpp | 90 ------------------------------
kpeople/nepomuk-feeder/nepomukfeeder.h | 37 ------------
5 files changed, 11 insertions(+), 132 deletions(-)
diff --git a/kpeople/nepomuk-feeder/CMakeLists.txt b/kpeople/nepomuk-feeder/CMakeLists.txt
index c00d067..aa0907f 100644
--- a/kpeople/nepomuk-feeder/CMakeLists.txt
+++ b/kpeople/nepomuk-feeder/CMakeLists.txt
@@ -53,7 +53,6 @@ set (nepomuktelepathyservice_static_SRCS
contact.cpp
abstract-storage.cpp
nepomuk-storage.cpp
- nepomukfeeder.cpp
test-backdoors.cpp
)
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.cpp b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
index f889fd5..4a85284 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.cpp
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.cpp
@@ -22,7 +22,6 @@
*/
#include "nepomuk-storage.h"
-#include "nepomukfeeder.h"
#include "telepathy.h"
#include <KDebug>
@@ -886,13 +885,19 @@ void NepomukStorage::setContactAvatar(const QString &path,
void NepomukStorage::onContactTimer()
{
- NepomukFeeder feeder;
- feeder.setGraph( m_graph );
- feeder.push();
+ KJob *job = Nepomuk2::storeResources( m_graph, Nepomuk2::IdentifyNew, Nepomuk2::OverwriteAllProperties );
+ connect( job, SIGNAL(finished(KJob*)), this, SLOT(onContactGraphJob(KJob*)) );
m_graph.clear();
}
+void NepomukStorage::onContactGraphJob(KJob* job)
+{
+ if( job->error() ) {
+ kError() << job->errorString();
+ }
+}
+
int qHash(ContactIdentifier c)
diff --git a/kpeople/nepomuk-feeder/nepomuk-storage.h b/kpeople/nepomuk-feeder/nepomuk-storage.h
index e0b902e..05c6acb 100644
--- a/kpeople/nepomuk-feeder/nepomuk-storage.h
+++ b/kpeople/nepomuk-feeder/nepomuk-storage.h
@@ -146,6 +146,8 @@ private Q_SLOTS:
void onAccountsQueryFinishedListing();
void onContactTimer();
+ void onContactGraphJob(KJob* job);
+
private:
Q_DISABLE_COPY(NepomukStorage);
diff --git a/kpeople/nepomuk-feeder/nepomukfeeder.cpp b/kpeople/nepomuk-feeder/nepomukfeeder.cpp
deleted file mode 100644
index 61708c4..0000000
--- a/kpeople/nepomuk-feeder/nepomukfeeder.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- <one line to give the library's name and an idea of what it does.>
- Copyright (C) 2012 Vishesh Handa <me at vhanda.in>
-
- 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 "nepomukfeeder.h"
-
-#include <Nepomuk2/ResourceManager>
-
-#include <Soprano/Model>
-#include <Soprano/StatementIterator>
-#include <Soprano/NodeIterator>
-#include <KDebug>
-
-void NepomukFeeder::setGraph(const Nepomuk2::SimpleResourceGraph& graph)
-{
- m_graph = graph;
-}
-
-namespace {
- QUrl fetchGraph( const QUrl& uri, const QUrl& prop = QUrl() ) {
- Soprano::Model* model = Nepomuk2::ResourceManager::instance()->mainModel();
- QList< Soprano::Node > list = model->listStatements( uri, prop, QUrl() ).iterateContexts().allNodes();
- if( list.isEmpty() )
- return QUrl();
-
- return list.first().uri();
- }
-
- Soprano::Node variantToNode( const QVariant& var ) {
- if( var.type() == QVariant::Url )
- return var.toUrl();
- else {
- Soprano::LiteralValue lv( var );
- return Soprano::Node( lv );
- }
- }
-}
-
-// TODO: Move to the DMS
-void NepomukFeeder::push()
-{
- Soprano::Model* model = Nepomuk2::ResourceManager::instance()->mainModel();
-
- QList<Nepomuk2::SimpleResource> resList = m_graph.toList();
- foreach( const Nepomuk2::SimpleResource& res, resList ) {
- const QUrl uri = res.uri();
-
- QUrl lastGraph = fetchGraph( uri );
-
- const Nepomuk2::PropertyHash& propHash = res.properties();
- const QList<QUrl> keys = propHash.uniqueKeys();
- foreach( const QUrl& prop, keys ) {
- QList<QVariant> values = propHash.values( prop );
-
- QUrl graph = fetchGraph( uri, prop );
- if( graph.isEmpty() )
- graph = lastGraph;
-
- // This might leave some orphan graphs
- model->removeAllStatements( uri, prop, QUrl() );
- foreach( const QVariant& var, values ) {
- if( var.isNull() ) {
- continue;
- }
- Soprano::Statement st( uri, prop, variantToNode(var), graph );
- kDebug() << st;
- model->addStatement( st );
- }
-
- lastGraph = graph;
- }
- }
-}
-
diff --git a/kpeople/nepomuk-feeder/nepomukfeeder.h b/kpeople/nepomuk-feeder/nepomukfeeder.h
deleted file mode 100644
index d52728b..0000000
--- a/kpeople/nepomuk-feeder/nepomukfeeder.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- <one line to give the library's name and an idea of what it does.>
- Copyright (C) 2012 Vishesh Handa <me at vhanda.in>
-
- 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
-*/
-
-
-#ifndef NEPOMUKFEEDER_H
-#define NEPOMUKFEEDER_H
-
-#include <Nepomuk2/SimpleResource>
-#include <Nepomuk2/SimpleResourceGraph>
-
-class NepomukFeeder
-{
-public:
- void setGraph( const Nepomuk2::SimpleResourceGraph& graph );
- void push();
-
-private:
- Nepomuk2::SimpleResourceGraph m_graph;
-};
-
-#endif // NEPOMUKFEEDER_H
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list