kexi

KoMacro::Manager Class Reference

#include <manager.h>

List of all members.


Detailed Description

The Manager class acts as window-wide manager for macros.

Example how KoMacro could be used.

 // We have a class that inheritates from QObject and
 // implements some public signals and slots that will
 // be accessible by Macros once a class-instance
 // got published.
 class PublishedObject : public QObject {};

 // Somewhere we have our KMainWindow.
 KMainWindow* mainwindow = new KMainWindow();

 // Create a new KoMacro::Manager instance to access the
 // Macro-framework.
 KoMacro::Manager* manager = new KoMacro::Manager( mainwindow );

 // Now we like to publish a QObject
 PublishedObject* publishedobject = new PublishedObject();
 manager->publishObject(publishedobject);

 // ... here we are able to use manager->createAction() to
 // create Action instances on the fly and work with them.

 // Finally free the publishedobject instance we created. We
 // need to free it manualy cause PublishedObject doesn't
 // got a QObject parent as argument.
 delete publishedobject;

 // Finally free the manager-instance. It's always needed
 // to free the instance by yourself!
 delete manager;

Definition at line 75 of file manager.h.


Public Member Functions

KXMLGUIClient * guiClient () const
bool hasMacro (const QString &macroname)
KSharedPtr< MacrogetMacro (const QString &macroname)
void addMacro (const QString &macroname, KSharedPtr< Macro > macro)
void removeMacro (const QString &macroname)
KSharedPtr< MacrocreateMacro (const QString &macroname)
KSharedPtr< Actionaction (const QString &name) const
QMap< QString, KSharedPtr
< Action > > 
actions () const
QStringList actionNames () const
void publishAction (KSharedPtr< Action > action)
void publishObject (const QString &name, QObject *object)
QGuardedPtr< QObject > object (const QString &name) const
QMap< QString, QGuardedPtr
< QObject > > 
objects () const

Static Public Member Functions

static void init (KXMLGUIClient *xmlguiclient)
static Managerself ()

Friends

class KStaticDeleter< ::KoMacro::Manager >

Member Function Documentation

void Manager::init ( KXMLGUIClient *  xmlguiclient  )  [static]

Initialize this Manager singleton.

This function needs to be called exactly once to initialize the Manager singleton before self() got used.

Definition at line 65 of file manager.cpp.

Manager * Manager::self (  )  [static]

Returns:
a pointer to a Manager singleton-instance. The static method init() needs to be called exactly once before calling this method else we may return NULL .

Definition at line 76 of file manager.cpp.

KXMLGUIClient * Manager::guiClient (  )  const

Returns:
the KXMLGUIClient instance this Manager is associated with.

Definition at line 101 of file manager.cpp.

bool Manager::hasMacro ( const QString &  macroname  ) 

Returns:
true if we carry a Macro with the defined macroname .

Definition at line 106 of file manager.cpp.

KSharedPtr< Macro > Manager::getMacro ( const QString &  macroname  ) 

Returns:
the Macro defined with macroname or NULL if we don't have such a Macro.

Definition at line 111 of file manager.cpp.

void Manager::addMacro ( const QString &  macroname,
KSharedPtr< Macro macro 
)

Add a new Macro to the list of known macros.

If there exists already a Macro instance with the defined macroname then the already existing one will be replace.

Parameters:
macroname The name the Macro will be accessible as.
macro The Macro instance.

Definition at line 116 of file manager.cpp.

void Manager::removeMacro ( const QString &  macroname  ) 

Remove the Macro defined with macroname .

If we don't know about a Macro with that macroname nothing happens.

Definition at line 121 of file manager.cpp.

KSharedPtr< Macro > Manager::createMacro ( const QString &  macroname  ) 

Factory function to create a new Macro instances.

The returned new Macro instance will not be added to the list of known macros. Use addMacro if you like to attach the returned new Macro to this Manager instance.

Definition at line 126 of file manager.cpp.

KSharedPtr< Action > Manager::action ( const QString &  name  )  const

Returns:
the Action which was published under the name name or returns an empty KSharedPtr<Action> object if there was no such Action published.

Definition at line 132 of file manager.cpp.

Action::Map Manager::actions (  )  const

Returns:
a map of all published actions.

Definition at line 137 of file manager.cpp.

QStringList Manager::actionNames (  )  const

Returns:
a list of all published actions.

Definition at line 142 of file manager.cpp.

void Manager::publishAction ( KSharedPtr< Action action  ) 

Publish the Action action .

The published Action will be accessible via it's unique name.

Definition at line 147 of file manager.cpp.

void Manager::publishObject ( const QString &  name,
QObject *  object 
)

Publish the passed QObject object.

Those object will provide it's slots as callable functions.

Definition at line 156 of file manager.cpp.

QGuardedPtr< QObject > Manager::object ( const QString &  name  )  const

Returns:
the publish QObject defined with name name or NULL if there exists no such object.

Definition at line 162 of file manager.cpp.

QMap< QString, QGuardedPtr< QObject > > Manager::objects (  )  const

Returns:
a map of the published QObject instances.

Definition at line 167 of file manager.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys