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

kopete/libkopete

  • sources
  • kde-4.12
  • kdenetwork
  • kopete
  • libkopete
kopetecommandhandler.h
Go to the documentation of this file.
1 /*
2  kopetecommandhandler.h - Command Handler
3 
4  Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
5  Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
6 
7  *************************************************************************
8  * *
9  * This library is free software; you can redistribute it and/or *
10  * modify it under the terms of the GNU Lesser General Public *
11  * License as published by the Free Software Foundation; either *
12  * version 2 of the License, or (at your option) any later version. *
13  * *
14  *************************************************************************
15 */
16 
17 #ifndef KOPETECOMMANDHANDLER_H
18 #define KOPETECOMMANDHANDLER_H
19 
20 #include <QtCore/QMultiHash>
21 
22 #include <kshortcut.h>
23 #include "kopetemessage.h"
24 
25 #include "kopete_export.h"
26 
27 class K3Process;
28 
29 struct CommandHandlerPrivate;
30 
31 class KopeteView;
32 class KopeteCommandGUIClient;
33 
34 namespace Kopete
35 {
36 
37 class ChatSession;
38 class Plugin;
39 class Protocol;
40 class Command;
41 
42 typedef QMultiHash<QString, Command*> CommandList;
43 
49 class KOPETE_EXPORT CommandHandler : public QObject
50 {
51  friend class ::KopeteCommandGUIClient;
52 
53  Q_OBJECT
54 
55  public:
59  enum CommandType { Normal, SystemAlias, UserAlias, Undefined };
60 
64  static CommandHandler *commandHandler();
65 
89  void registerCommand( QObject *parent, const QString &command, const char* handlerSlot,
90  const QString &help = QString(), uint minArgs = 0, int maxArgs = -1,
91  const KShortcut &cut = KShortcut(), const QString &pix = QString() );
92 
110  void registerAlias( QObject *parent,
111  const QString &alias,
112  const QString &formatString,
113  const QString &help = QString(),
114  CommandType = SystemAlias,
115  uint minArgs = 0,
116  int maxArgs = -1,
117  const KShortcut &cut = KShortcut(),
118  const QString &pix = QString() );
119 
130  void unregisterCommand( QObject *parent, const QString &command );
131 
139  void unregisterAlias( QObject *parent, const QString &alias );
140 
148  bool processMessage( Message &msg, ChatSession *manager );
149 
158  bool processMessage( const QString &msg, ChatSession *manager );
159 
164  static QStringList parseArguments( const QString &args );
165 
172  bool commandHandled( const QString &command );
173 
181  bool commandHandledByProtocol( const QString &command, Protocol *protocol);
182 
183  private slots:
184  void slotPluginLoaded( Kopete::Plugin * );
185  void slotPluginDestroyed( QObject * );
186  void slotExecReturnedData(K3Process *proc, char *buff, int bufflen );
187  void slotExecFinished(K3Process *proc);
188  void slotViewCreated( KopeteView *view );
189 
190  void slotHelpCommand( const QString & args, Kopete::ChatSession *manager );
191  void slotClearCommand( const QString & args, Kopete::ChatSession *manager );
192  void slotPartCommand( const QString & args, Kopete::ChatSession *manager );
193  void slotCloseCommand( const QString & args, Kopete::ChatSession *manager );
194  void slotOpenLastUrl( const QString & args, Kopete::ChatSession *manager );
195  //void slotMeCommand( const QString & args, Kopete::ChatSession *manager );
196  void slotExecCommand( const QString & args, Kopete::ChatSession *manager );
197  void slotAwayCommand( const QString & args, Kopete::ChatSession *manager );
198  void slotAwayAllCommand( const QString & args, Kopete::ChatSession *manager );
199  void slotSayCommand( const QString & args, Kopete::ChatSession *manager );
200 
201  private:
206  CommandList commands( Protocol * );
207 
211  void addCommands( CommandList &from, CommandList &to, CommandType type = Undefined );
212 
213  CommandHandler();
214  ~CommandHandler();
215 
216  static CommandHandlerPrivate *p;
217 };
218 
219 }
220 
221 #endif
KOPETE_EXPORT
#define KOPETE_EXPORT
Definition: kopete_export.h:27
Kopete::CommandHandler::CommandType
CommandType
an enum defining the type of a command
Definition: kopetecommandhandler.h:59
Kopete::Command
Definition: kopetecommand.h:32
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
QObject
Kopete::ChatSession
Definition: kopetechatsession.h:74
kopete_export.h
Kopete::Plugin
Base class for all plugins or protocols.
Definition: kopeteplugin.h:84
Kopete::CommandList
QMultiHash< QString, Command * > CommandList
Definition: kopetecommandhandler.h:40
Kopete::CommandHandler::UserAlias
Definition: kopetecommandhandler.h:59
Kopete::CommandHandler
Definition: kopetecommandhandler.h:49
kopetemessage.h
KopeteView
Definition: kopeteview.h:40
Kopete::Message
Representation of a message in Kopete.
Definition: kopetemessage.h:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:51 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