• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

akonadi

Akonadi::ItemMonitor

Akonadi::ItemMonitor Class Reference

A convenience class to monitor a single item for changes. More...

#include <itemmonitor.h>

List of all members.


Public Member Functions

Item item () const
 ItemMonitor ()
void setItem (const Item &item)
virtual ~ItemMonitor ()

Protected Member Functions

ItemFetchScope & fetchScope ()
virtual void itemChanged (const Item &item)
virtual void itemRemoved ()
void setFetchScope (const ItemFetchScope &fetchScope)

Detailed Description

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:

 // 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 );

Author:
Tobias Koenig <tokoe@kde.org>

Definition at line 81 of file itemmonitor.h.


Constructor & Destructor Documentation

ItemMonitor::ItemMonitor (  ) 

Creates a new item monitor.

Definition at line 29 of file itemmonitor.cpp.

ItemMonitor::~ItemMonitor (  )  [virtual]

Destroys the item monitor.

Definition at line 34 of file itemmonitor.cpp.


Member Function Documentation

ItemFetchScope & ItemMonitor::fetchScope (  )  [protected]

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.

Returns:
a reference to the current item fetch scope
See also:
setFetchScope() for replacing the current item fetch scope

Definition at line 75 of file itemmonitor.cpp.

Item ItemMonitor::item (  )  const

Returns the currently monitored item.

Definition at line 57 of file itemmonitor.cpp.

void ItemMonitor::itemChanged ( const Item &  item  )  [protected, virtual]

This method is called whenever the monitored item has changed.

Parameters:
item The changed item.

Definition at line 62 of file itemmonitor.cpp.

void ItemMonitor::itemRemoved (  )  [protected, virtual]

This method is called whenever the monitored item has been removed.

Definition at line 66 of file itemmonitor.cpp.

void ItemMonitor::setFetchScope ( const ItemFetchScope &  fetchScope  )  [protected]

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.

Parameters:
fetchScope The new scope for item fetch operations.
See also:
fetchScope()

Definition at line 70 of file itemmonitor.cpp.

void ItemMonitor::setItem ( const Item &  item  ) 

Sets the item that shall be monitored.

Definition at line 39 of file itemmonitor.cpp.


The documentation for this class was generated from the following files:
  • itemmonitor.h
  • itemmonitor.cpp

akonadi

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal