/usr/include/akonadi/itemmonitor.h is in kdepimlibs5-dev 4:4.14.10-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /*
Copyright (c) 2007-2008 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_ITEMMONITOR_H
#define AKONADI_ITEMMONITOR_H
#include "akonadi_export.h"
#include <qglobal.h>
class QStringList;
namespace Akonadi {
class Item;
class ItemFetchScope;
/**
* @short A convenience class to monitor a single item for changes.
*
* This class can be used as a base class for classes that want to show
* a single item to the user and keep track of status changes of the item
* without having to using a Monitor object themself.
*
* Example:
*
* @code
*
* // A label that shows the name of a contact item
*
* class ContactLabel : public QLabel, public Akonadi::ItemMonitor
* {
* public:
* ContactLabel( QWidget *parent = 0 )
* : QLabel( parent )
* {
* setText( "No Name" );
* }
*
* protected:
* virtual void itemChanged( const Akonadi::Item &item )
* {
* if ( item.mimeType() != "text/directory" )
* return;
*
* const KABC::Addressee addr = item.payload<KABC::Addressee>();
* setText( addr.fullName() );
* }
*
* virtual void itemRemoved()
* {
* setText( "No Name" );
* }
* };
*
* ...
*
* ContactLabel *label = new ContactLabel( this );
*
* const Akonadi::Item item = fetchJob->items().first();
* label->setItem( item );
*
* @endcode
*
* @author Tobias Koenig <tokoe@kde.org>
*/
class AKONADI_EXPORT ItemMonitor
{
public:
/**
* Creates a new item monitor.
*/
ItemMonitor();
/**
* Destroys the item monitor.
*/
virtual ~ItemMonitor();
/**
* Sets the @p item that shall be monitored.
*/
void setItem(const Item &item);
/**
* Returns the currently monitored item.
*/
Item item() const;
protected:
/**
* This method is called whenever the monitored item has changed.
*
* @param item The changed item.
*/
virtual void itemChanged(const Item &item);
/**
* This method is called whenever the monitored item has been removed.
*/
virtual void itemRemoved();
/**
* Sets the item fetch scope.
*
* Controls how much of an item's data is fetched from the server, e.g.
* whether to fetch the full item payload or only meta data.
*
* @param fetchScope The new scope for item fetch operations.
*
* @see fetchScope()
*/
void setFetchScope(const ItemFetchScope &fetchScope);
/**
* Returns the item fetch scope.
*
* Since this returns a reference it can be used to conveniently modify the
* current scope in-place, i.e. by calling a method on the returned reference
* without storing it in a local variable. See the ItemFetchScope documentation
* for an example.
*
* @return a reference to the current item fetch scope
*
* @see setFetchScope() for replacing the current item fetch scope
*/
ItemFetchScope &fetchScope();
private:
//@cond PRIVATE
class Private;
Private *const d;
//@endcond
Q_DISABLE_COPY(ItemMonitor)
};
}
#endif
|