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

akonadi

Akonadi::CollectionPropertiesPage

Akonadi::CollectionPropertiesPage Class Reference

A single page in a collection properties dialog. More...

#include <collectionpropertiespage.h>

Inherits QWidget.

List of all members.

Public Member Functions

 CollectionPropertiesPage (QWidget *parent=0)
 ~CollectionPropertiesPage ()
virtual bool canHandle (const Collection &collection) const
virtual void load (const Collection &collection)=0
QString pageTitle () const
virtual void save (Collection &collection)=0
void setPageTitle (const QString &title)

Detailed Description

A single page in a collection properties dialog.

The collection properties dialog can be extended by custom collection properties pages, which provide gui elements for viewing and changing collection attributes.

The following example shows how to create a simple collection properties page for the secercy attribute from the Akonadi::Attribute example.

 class SecrecyPage : public CollectionPropertiesPage
 {
    public:
      SecrecyPage( QWidget *parent = 0 )
        : CollectionPropertiesPage( parent )
      {
        QVBoxLayout *layout = new QVBoxLayout( this );

        mSecrecy = new QComboBox( this );
        mSecrecy->addItem( "Public" );
        mSecrecy->addItem( "Private" );
        mSecrecy->addItem( "Confidential" );

        layout->addWidget( new QLabel( "Secrecy:" ) );
        layout->addWidget( mSecrecy );

        setPageTitle( i18n( "Secrecy" ) );
      }

      void load( const Collection &collection )
      {
        SecrecyAttribute *attr = collection.attribute( "secrecy" );

        switch ( attr->secrecy() ) {
          case SecrecyAttribute::Public: mSecrecy->setCurrentIndex( 0 ); break;
          case SecrecyAttribute::Private: mSecrecy->setCurrentIndex( 1 ); break;
          case SecrecyAttribute::Confidential: mSecrecy->setCurrentIndex( 2 ); break;
        }
      }

      void save( Collection &collection )
      {
        SecrecyAttribute *attr = collection.attribute( "secrecy" );

        switch ( mSecrecy->currentIndex() ) {
          case 0: attr->setSecrecy( SecrecyAttribute::Public ); break;
          case 1: attr->setSecrecy( SecrecyAttribute::Private ); break;
          case 2: attr->setSecrecy( SecrecyAttribute::Confidential ); break;
        }
      }

      bool canHandle( const Collection &collection ) const
      {
        return collection.hasAttribute( "secrecy" );
      }
 };

 AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY( SecrecyPageFactory, SecrecyPage )
See also:
Akonadi::CollectionPropertiesDialog, Akonadi::CollectionPropertiesPageFactory
Author:
Volker Krause <vkrause@kde.org>

Definition at line 99 of file collectionpropertiespage.h.


Constructor & Destructor Documentation

CollectionPropertiesPage::CollectionPropertiesPage ( QWidget *  parent = 0  )  [explicit]

Creates a new collection properties page.

Parameters:
parent The parent widget.

Definition at line 37 of file collectionpropertiespage.cpp.

CollectionPropertiesPage::~CollectionPropertiesPage (  ) 

Destroys the collection properties page.

Definition at line 43 of file collectionpropertiespage.cpp.


Member Function Documentation

bool CollectionPropertiesPage::canHandle ( const Collection &  collection  )  const [virtual]

Checks if this page can actually handle the given collection.

Returns true if the collection can be handled, false otherwise The default implementation returns always true. When false is returned this page is not shown in the properties dialog.

Parameters:
collection The collection to check.

Definition at line 48 of file collectionpropertiespage.cpp.

virtual void Akonadi::CollectionPropertiesPage::load ( const Collection &  collection  )  [pure virtual]

Loads the page content from the given collection.

Parameters:
collection The collection to load.
QString Akonadi::CollectionPropertiesPage::pageTitle (  )  const

Returns the page title.

Definition at line 53 of file collectionpropertiespage.cpp.

virtual void Akonadi::CollectionPropertiesPage::save ( Collection &  collection  )  [pure virtual]

Saves page content to the given collection.

Parameters:
collection Reference to the collection to save to.
void CollectionPropertiesPage::setPageTitle ( const QString &  title  ) 

Sets the page title.

Parameters:
title Translated, preferbly short tab title.

Definition at line 58 of file collectionpropertiespage.cpp.


The documentation for this class was generated from the following files:
  • collectionpropertiespage.h
  • collectionpropertiespage.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
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.2-20100208
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