• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • libnepomukcore
  • datamanagement
genericdatamanagementjob.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2011 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "genericdatamanagementjob_p.h"
23 #include "datamanagementinterface.h"
24 #include "dbustypes.h"
25 #include "kdbusconnectionpool.h"
26 
27 #include <QtDBus/QDBusConnection>
28 #include <QtDBus/QDBusPendingReply>
29 #include <QtDBus/QDBusPendingCallWatcher>
30 
31 #include <QtCore/QVariant>
32 #include <QtCore/QHash>
33 #include <QThreadStorage>
34 
35 #include <KDebug>
36 
37 Nepomuk2::GenericDataManagementJob::GenericDataManagementJob(const char *methodName,
38  QGenericArgument val0,
39  QGenericArgument val1,
40  QGenericArgument val2,
41  QGenericArgument val3,
42  QGenericArgument val4,
43  QGenericArgument val5)
44  : KJob(0)
45 {
46  QDBusPendingReply<> reply;
47  QMetaObject::invokeMethod(Nepomuk2::dataManagementDBusInterface(),
48  methodName,
49  Qt::DirectConnection,
50  Q_RETURN_ARG(QDBusPendingReply<> , reply),
51  val0,
52  val1,
53  val2,
54  val3,
55  val4,
56  val5);
57  QDBusPendingCallWatcher* dbusCallWatcher = new QDBusPendingCallWatcher(reply);
58  connect(dbusCallWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
59  this, SLOT(slotDBusCallFinished(QDBusPendingCallWatcher*)));
60 }
61 
62 Nepomuk2::GenericDataManagementJob::~GenericDataManagementJob()
63 {
64 }
65 
66 void Nepomuk2::GenericDataManagementJob::start()
67 {
68  // do nothing
69 }
70 
71 void Nepomuk2::GenericDataManagementJob::slotDBusCallFinished(QDBusPendingCallWatcher *watcher)
72 {
73  QDBusPendingReply<> reply = *watcher;
74  if (reply.isError()) {
75  QDBusError error = reply.error();
76  kDebug() << error;
77  setError(int(error.type()));
78  setErrorText(error.message());
79  }
80  delete watcher;
81  emitResult();
82 }
83 
84 QThreadStorage<OrgKdeNepomukDataManagementInterface *> s_perThreadDms;
85 
86 OrgKdeNepomukDataManagementInterface* Nepomuk2::dataManagementDBusInterface()
87 {
88  if (!s_perThreadDms.hasLocalData()) {
89  // DBus types necessary for storeResources
90  DBus::registerDBusTypes();
91 
92  s_perThreadDms.setLocalData(
93  new org::kde::nepomuk::DataManagement(QLatin1String("org.kde.NepomukStorage"),
94  QLatin1String("/datamanagement"),
95  KDBusConnectionPool::threadConnection()));
96  }
97  return s_perThreadDms.localData();
98 }
99 
100 #include "genericdatamanagementjob_p.moc"
datamanagementinterface.h
s_perThreadDms
QThreadStorage< OrgKdeNepomukDataManagementInterface * > s_perThreadDms
Definition: genericdatamanagementjob.cpp:84
Nepomuk2::DBus::registerDBusTypes
void registerDBusTypes()
Definition: dbustypes.cpp:112
start
void start()
Definition: ontologydownloadjob.cpp:13
KJob
dbustypes.h
OrgKdeNepomukDataManagementInterface
Definition: datamanagementinterface.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal