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

kapptemplate

  • sources
  • kde-4.12
  • kdesdk
  • kapptemplate
  • templates
  • C++
  • akonadiresource
%{APPNAMELC}resource.cpp
Go to the documentation of this file.
1 #include "%{APPNAMELC}resource.h"
2 
3 #include "settings.h"
4 #include "settingsadaptor.h"
5 
6 #include <QtDBus/QDBusConnection>
7 
8 using namespace Akonadi;
9 
10 %{APPNAME}Resource::%{APPNAME}Resource( const QString &id )
11  : ResourceBase( id )
12 {
13  new SettingsAdaptor( Settings::self() );
14  QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ),
15  Settings::self(), QDBusConnection::ExportAdaptors );
16 
17  // TODO: you can put any resource specific initialization code here.
18 }
19 
20 %{APPNAME}Resource::~%{APPNAME}Resource()
21 {
22 }
23 
24 void %{APPNAME}Resource::retrieveCollections()
25 {
26  // TODO: this method is called when Akonadi wants to have all the
27  // collections your resource provides.
28  // Be sure to set the remote ID and the content MIME types
29 }
30 
31 void %{APPNAME}Resource::retrieveItems( const Akonadi::Collection &collection )
32 {
33  Q_UNUSED( collection );
34 
35  // TODO: this method is called when Akonadi wants to know about all the
36  // items in the given collection. You can but don't have to provide all the
37  // data for each item, remote ID and MIME type are enough at this stage.
38  // Depending on how your resource accesses the data, there are several
39  // different ways to tell Akonadi when you are done.
40 }
41 
42 bool %{APPNAME}Resource::retrieveItem( const Akonadi::Item &item, const QSet<QByteArray> &parts )
43 {
44  Q_UNUSED( item );
45  Q_UNUSED( parts );
46 
47  // TODO: this method is called when Akonadi wants more data for a given item.
48  // You can only provide the parts that have been requested but you are allowed
49  // to provide all in one go
50 
51  return true;
52 }
53 
54 void %{APPNAME}Resource::aboutToQuit()
55 {
56  // TODO: any cleanup you need to do while there is still an active
57  // event loop. The resource will terminate after this method returns
58 }
59 
60 void %{APPNAME}Resource::configure( WId windowId )
61 {
62  Q_UNUSED( windowId );
63 
64  // TODO: this method is usually called when a new resource is being
65  // added to the Akonadi setup. You can do any kind of user interaction here,
66  // e.g. showing dialogs.
67  // The given window ID is usually useful to get the correct
68  // "on top of parent" behavior if the running window manager applies any kind
69  // of focus stealing prevention technique
70  //
71  // If the configuration dialog has been accepted by the user by clicking Ok,
72  // the signal configurationDialogAccepted() has to be emitted, otherwise, if
73  // the user canceled the dialog, configurationDialogRejected() has to be emitted.
74 }
75 
76 void %{APPNAME}Resource::itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection )
77 {
78  Q_UNUSED( item );
79  Q_UNUSED( collection );
80 
81  // TODO: this method is called when somebody else, e.g. a client application,
82  // has created an item in a collection managed by your resource.
83 
84  // NOTE: There is an equivalent method for collections, but it isn't part
85  // of this template code to keep it simple
86 }
87 
88 void %{APPNAME}Resource::itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &parts )
89 {
90  Q_UNUSED( item );
91  Q_UNUSED( parts );
92 
93  // TODO: this method is called when somebody else, e.g. a client application,
94  // has changed an item managed by your resource.
95 
96  // NOTE: There is an equivalent method for collections, but it isn't part
97  // of this template code to keep it simple
98 }
99 
100 void %{APPNAME}Resource::itemRemoved( const Akonadi::Item &item )
101 {
102  Q_UNUSED( item );
103 
104  // TODO: this method is called when somebody else, e.g. a client application,
105  // has deleted an item managed by your resource.
106 
107  // NOTE: There is an equivalent method for collections, but it isn't part
108  // of this template code to keep it simple
109 }
110 
111 AKONADI_RESOURCE_MAIN( %{APPNAME}Resource )
112 
113 #include "%{APPNAMELC}resource.moc"
Settings::self
static Settings * self()
Definition: C++/akonadiresource/settings.cpp:19
settings.h
APPNAME
main APPNAME
%{APPNAMELC}resource.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:22 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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