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

akonadi

Akonadi::StandardActionManager

Akonadi::StandardActionManager Class Reference

Manages generic actions for collection and item views. More...

#include <standardactionmanager.h>

Inherits QObject.

List of all members.

Public Types

enum  Type {
  CreateCollection, CopyCollections, DeleteCollections, SynchronizeCollections,
  CollectionProperties, CopyItems, Paste, DeleteItems,
  ManageLocalSubscriptions, AddToFavoriteCollections, RemoveFromFavoriteCollections, RenameFavoriteCollection,
  CopyCollectionToMenu, CopyItemToMenu, MoveItemToMenu, MoveCollectionToMenu,
  CutItems, CutCollections, LastType
}

Signals

void actionStateUpdated ()

Public Member Functions

 StandardActionManager (KActionCollection *actionCollection, QWidget *parent=0)
 ~StandardActionManager ()
KAction * action (Type type) const
KAction * createAction (Type type)
void createAllActions ()
void setActionText (Type type, const KLocalizedString &text)
void setCollectionSelectionModel (QItemSelectionModel *selectionModel)
void setFavoriteCollectionsModel (FavoriteCollectionsModel *favoritesModel)
void setFavoriteSelectionModel (QItemSelectionModel *selectionModel)
void setItemSelectionModel (QItemSelectionModel *selectionModel)

Detailed Description

Manages generic actions for collection and item views.

Manages generic Akonadi actions common for all types. This covers creating of the actions with appropriate labels, icons, shortcuts etc., updating the action state depending on the current selection as well as default implementations for the actual operations.

If the default implementation is not appropriate for your application you can still use the state tracking by disconnecting the triggered() signal and re-connecting it to your implementation. The actual KAction objects can be retrieved by calling createAction() or action() for that.

If the default look and feel (labels, icons, shortcuts) of the actions is not appropriate for your application, you can access them as noted above and customize them to your needs. Additionally, you can set a KLocalizedString which should be used as a action label with correct plural handling for actions operating on multiple objects with setActionText().

Finally, if you have special needs for the action states, connect to the actionStateUpdated() signal and adjust the state accordingly.

The following actions are provided (KAction name in parenthesis):

  • Creation of a new collection (akonadi_collection_create)
  • Copying of selected collections (akonadi_collection_copy)
  • Deletion of selected collections (akonadi_collection_delete)
  • Synchronization of selected collections (akonadi_collection_sync)
  • Showing the collection properties dialog for the current collection (akonadi_collection_properties)
  • Copying of selected items (akonadi_itemcopy)
  • Pasting collections, items or raw data (akonadi_paste)
  • Deleting of selected items (akonadi_item_delete)
  • Managing local subscriptions (akonadi_manage_local_subscriptions)

The following example shows how to use standard actions in your application:

 Akonadi::StandardActionManager *actMgr = new Akonadi::StandardActionManager( actionCollection(), this );
 actMgr->setCollectionSelectionModel( collectionView->collectionSelectionModel() );
 actMgr->createAllActions();

Additionally you have to add the actions to the KXMLGUI file of your application, using the names listed above.

If you only need a subset of the actions provided, you can call createAction() instead of createAllActions() for the action types you want.

Todo:
collection deleting and sync do not support multi-selection yet
Author:
Volker Krause <vkrause@kde.org>

Definition at line 91 of file standardactionmanager.h.


Member Enumeration Documentation

enum Akonadi::StandardActionManager::Type

Describes the supported actions.

Enumerator:
CreateCollection 

Creates an collection.

CopyCollections 

Copies the selected collections.

DeleteCollections 

Deletes the selected collections.

SynchronizeCollections 

Synchronizes collections.

CollectionProperties 

Provides collection properties.

CopyItems 

Copies the selected items.

Paste 

Paste collections or items.

DeleteItems 

Deletes the selected items.

ManageLocalSubscriptions 

Manages local subscriptions.

AddToFavoriteCollections 

Add the collection to the favorite collections model.

Since:
4.4
RemoveFromFavoriteCollections 

Remove the collection from the favorite collections model.

Since:
4.4
RenameFavoriteCollection 

Rename the collection of the favorite collections model.

Since:
4.4
CopyCollectionToMenu 

Menu allowing to quickly copy a collection into another collection.

Since:
4.4
CopyItemToMenu 

Menu allowing to quickly copy an item into a collection.

Since:
4.4
MoveItemToMenu 

Menu allowing to move item into a collection.

Since:
4.4
MoveCollectionToMenu 

Menu allowing to move a collection into another collection.

Since:
4.4
CutItems 

Cuts the selected items.

Since:
4.4
CutCollections 

Cuts the selected collections.

Since:
4.4
LastType 

Marks last action.

Definition at line 98 of file standardactionmanager.h.


Constructor & Destructor Documentation

StandardActionManager::StandardActionManager ( KActionCollection *  actionCollection,
QWidget *  parent = 0 
) [explicit]

Creates a new standard action manager.

Parameters:
actionCollection The action collection to operate on.
parent The parent widget.

Definition at line 719 of file standardactionmanager.cpp.

StandardActionManager::~StandardActionManager (  ) 

Destroys the standard action manager.

Definition at line 729 of file standardactionmanager.cpp.


Member Function Documentation

KAction * StandardActionManager::action ( Type  type  )  const

Returns the action of the given type, 0 if it has not been created (yet).

Definition at line 806 of file standardactionmanager.cpp.

void Akonadi::StandardActionManager::actionStateUpdated (  )  [signal]

This signal is emitted whenever the action state has been updated.

In case you have special needs for changing the state of some actions, connect to this signal and adjust the action state.

KAction * StandardActionManager::createAction ( Type  type  ) 

Creates the action of the given type and adds it to the action collection specified in the constructor if it does not exist yet.

The action is connected to its default implementation provided by this class.

Definition at line 764 of file standardactionmanager.cpp.

void StandardActionManager::createAllActions (  ) 

Convenience method to create all standard actions.

See also:
createAction()

Definition at line 800 of file standardactionmanager.cpp.

void StandardActionManager::setActionText ( Type  type,
const KLocalizedString &  text 
)

Sets the label of the action type to text, which is used during updating the action state and substituted according to the number of selected objects.

This is mainly useful to customize the label of actions that can operate on multiple objects.

Example:

 acctMgr->setActionText( Akonadi::StandardActionManager::CopyItems,
                         ki18np( "Copy Mail", "Copy %1 Mails" ) );

Definition at line 812 of file standardactionmanager.cpp.

void StandardActionManager::setCollectionSelectionModel ( QItemSelectionModel *  selectionModel  ) 

Sets the collection selection model based on which the collection related actions should operate.

If none is set, all collection actions will be disabled.

Definition at line 734 of file standardactionmanager.cpp.

void StandardActionManager::setFavoriteCollectionsModel ( FavoriteCollectionsModel *  favoritesModel  ) 

Sets the favorite collections model based on which the collection relatedactions should operate.

If none is set, the "Add to Favorite Folders" action will be disabled.

Since:
4.4

Definition at line 750 of file standardactionmanager.cpp.

void StandardActionManager::setFavoriteSelectionModel ( QItemSelectionModel *  selectionModel  ) 

Sets the favorite collection selection model based on which the favorite collection related actions should operate.

If none is set, all favorite modifications actions will be disabled.

Since:
4.4

Definition at line 756 of file standardactionmanager.cpp.

void StandardActionManager::setItemSelectionModel ( QItemSelectionModel *  selectionModel  ) 

Sets the item selection model based on which the item related actions should operate.

If none is set, all item actions will be disabled.

Definition at line 743 of file standardactionmanager.cpp.


The documentation for this class was generated from the following files:
  • standardactionmanager.h
  • standardactionmanager.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