• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • Kopete
  • CommandHandler
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Kopete::CommandHandler Class Reference

#include <kopetecommandhandler.h>

Inheritance diagram for Kopete::CommandHandler:
Inheritance graph
[legend]

Public Types

enum  CommandType { Normal, SystemAlias, UserAlias, Undefined }
 

Public Member Functions

bool commandHandled (const QString &command)
 
bool commandHandledByProtocol (const QString &command, Protocol *protocol)
 
bool processMessage (Message &msg, ChatSession *manager)
 
bool processMessage (const QString &msg, ChatSession *manager)
 
void registerAlias (QObject *parent, const QString &alias, const QString &formatString, const QString &help=QString(), CommandType=SystemAlias, uint minArgs=0, int maxArgs=-1, const KShortcut &cut=KShortcut(), const QString &pix=QString())
 
void registerCommand (QObject *parent, const QString &command, const char *handlerSlot, const QString &help=QString(), uint minArgs=0, int maxArgs=-1, const KShortcut &cut=KShortcut(), const QString &pix=QString())
 
void unregisterAlias (QObject *parent, const QString &alias)
 
void unregisterCommand (QObject *parent, const QString &command)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static CommandHandler * commandHandler ()
 
static QStringList parseArguments (const QString &args)
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Author
Jason Keirstead jason.nosp@m.@kei.nosp@m.rstea.nosp@m.d.or.nosp@m.g

The Kopete::CommandHandler can handle /action like messages

Definition at line 48 of file kopetecommandhandler.h.

Member Enumeration Documentation

enum Kopete::CommandHandler::CommandType

an enum defining the type of a command

Enumerator
Normal 
SystemAlias 
UserAlias 
Undefined 

Definition at line 58 of file kopetecommandhandler.h.

Member Function Documentation

bool Kopete::CommandHandler::commandHandled ( const QString &  command)

Check if a command is already handled.

Parameters
commandThe command to check
Returns
True if the command is already being handled, False if not

Definition at line 448 of file kopetecommandhandler.cpp.

bool Kopete::CommandHandler::commandHandledByProtocol ( const QString &  command,
Kopete::Protocol *  protocol 
)

Check if a command is already handled by a spesific protocol.

Parameters
commandThe command to check
protocolThe protocol to check
Returns
True if the command is already being handled, False if not

Definition at line 459 of file kopetecommandhandler.cpp.

Kopete::CommandHandler * Kopete::CommandHandler::commandHandler ( )
static

Returns a pointer to the command handler.

Definition at line 164 of file kopetecommandhandler.cpp.

QStringList Kopete::CommandHandler::parseArguments ( const QString &  args)
static

Parses a string of command arguments into a QStringList.

Quoted blocks within the arguments string are treated as one argument.

Definition at line 429 of file kopetecommandhandler.cpp.

bool Kopete::CommandHandler::processMessage ( Kopete::Message &  msg,
Kopete::ChatSession *  manager 
)

Process a message to see if any commands should be handled.

Parameters
msgThe message to process
managerThe manager who owns this message
Returns
True if the command was handled, false if not

Definition at line 239 of file kopetecommandhandler.cpp.

bool Kopete::CommandHandler::processMessage ( const QString &  msg,
Kopete::ChatSession *  manager 
)

Process a message to see if any commands should be handled.

See also
processMessage( Kopete::Message &msg, Kopete::ChatSession *manager)
Parameters
msgA QString contain the message
managerthe Kopete::ChatSession who will own the message
Returns
true if the command was handled, false if the command was not handled.

Definition at line 207 of file kopetecommandhandler.cpp.

void Kopete::CommandHandler::registerAlias ( QObject *  parent,
const QString &  alias,
const QString &  formatString,
const QString &  help = QString(),
CommandType  type = SystemAlias,
uint  minArgs = 0,
int  maxArgs = -1,
const KShortcut &  cut = KShortcut(),
const QString &  pix = QString() 
)

Register a command alias.

Parameters
parentThe plugin who owns this alias
aliasThe command for the alias
formatStringThis is the string that will be transformed into another command. The formatString should begin with an already existing command, followed by any other arguments. The variables %1, %2... %9 will be substituted with the arguments passed into the alias. The variable s will be substituted with the entire argument string
helpAn optional help string to be shown when the user uses /help <command>
minArgsthe minimum number of arguments for this command
maxArgsthe maximum number of arguments this command takes
cuta default keyboard shortcut
pixicon name, the icon will be shown in menus

Definition at line 191 of file kopetecommandhandler.cpp.

void Kopete::CommandHandler::registerCommand ( QObject *  parent,
const QString &  command,
const char *  handlerSlot,
const QString &  help = QString(),
uint  minArgs = 0,
int  maxArgs = -1,
const KShortcut &  cut = KShortcut(),
const QString &  pix = QString() 
)

Register a command with the command handler.

Command matching is case insensitive. All commands are registered, regardless of whether or not they are already handled by another handler. This is so that if the first plugin is unloaded, the next handler in the sequence will handle the command. However, there are certain commands which are reserved (internally handled by the Kopete::CommandHandler). These commands can also be overridden by registering a new duplicate command.

Parameters
parentThe plugin who owns this command
commandThe command we want to handle, not including the '/'
handlerSlotThe slot used to handle the command. This slot must accept two parameters, a QString of arguments, and a Kopete::ChatSession pointer to the manager under which the command was sent.
helpAn optional help string to be shown when the user uses /help <command>
minArgsthe minimum number of arguments for this command
maxArgsthe maximum number of arguments this command takes
cuta default keyboard shortcut
pixicon name, the icon will be shown in menus

Definition at line 175 of file kopetecommandhandler.cpp.

void Kopete::CommandHandler::unregisterAlias ( QObject *  parent,
const QString &  alias 
)

Unregister an alias.

See also
unregisterCommand( QObject *parent, const QString &command )
Parameters
parentThe plugin who owns this alias
aliasThe alais to unload

Definition at line 201 of file kopetecommandhandler.cpp.

void Kopete::CommandHandler::unregisterCommand ( QObject *  parent,
const QString &  command 
)

Unregister a command.

When a plugin unloads, all commands are automaticlly unregistered and deleted. This function should only be called in the case of a plugin which loads and unloads commands dynamically.

Parameters
parentThe plugin who owns this command
commandThe command to unload

Definition at line 185 of file kopetecommandhandler.cpp.


The documentation for this class was generated from the following files:
  • kopetecommandhandler.h
  • kopetecommandhandler.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal