• 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.14
  • 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 <kprocess.h>
24 #include "kopetemessage.h"
25 
26 #include "kopete_export.h"
27 
28 struct CommandHandlerPrivate;
29 
30 class KopeteView;
31 class KopeteCommandGUIClient;
32 
33 namespace Kopete
34 {
35 
36 class ChatSession;
37 class Plugin;
38 class Protocol;
39 class Command;
40 
41 typedef QMultiHash<QString, Command*> CommandList;
42 
48 class KOPETE_EXPORT CommandHandler : public QObject
49 {
50  friend class ::KopeteCommandGUIClient;
51 
52  Q_OBJECT
53 
54  public:
58  enum CommandType { Normal, SystemAlias, UserAlias, Undefined };
59 
63  static CommandHandler *commandHandler();
64 
88  void registerCommand( QObject *parent, const QString &command, const char* handlerSlot,
89  const QString &help = QString(), uint minArgs = 0, int maxArgs = -1,
90  const KShortcut &cut = KShortcut(), const QString &pix = QString() );
91 
109  void registerAlias( QObject *parent,
110  const QString &alias,
111  const QString &formatString,
112  const QString &help = QString(),
113  CommandType = SystemAlias,
114  uint minArgs = 0,
115  int maxArgs = -1,
116  const KShortcut &cut = KShortcut(),
117  const QString &pix = QString() );
118 
129  void unregisterCommand( QObject *parent, const QString &command );
130 
138  void unregisterAlias( QObject *parent, const QString &alias );
139 
147  bool processMessage( Message &msg, ChatSession *manager );
148 
157  bool processMessage( const QString &msg, ChatSession *manager );
158 
163  static QStringList parseArguments( const QString &args );
164 
171  bool commandHandled( const QString &command );
172 
180  bool commandHandledByProtocol( const QString &command, Protocol *protocol);
181 
182  private slots:
183  void slotPluginLoaded( Kopete::Plugin * );
184  void slotPluginDestroyed( QObject * );
185  void slotExecError( QProcess::ProcessError error );
186  void slotExecFinished();
187  void slotExecSendMessage( KProcess *proc, const QString &buffer );
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:58
Kopete::Command
Definition: kopetecommand.h:32
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
Kopete::ChatSession
Definition: kopetechatsession.h:74
QObject
kopete_export.h
QString
QStringList
Kopete::Plugin
Base class for all plugins or protocols.
Definition: kopeteplugin.h:84
Kopete::CommandList
QMultiHash< QString, Command * > CommandList
Definition: kopetecommandhandler.h:39
Kopete::CommandHandler::UserAlias
Definition: kopetecommandhandler.h:58
Kopete::CommandHandler
Definition: kopetecommandhandler.h:48
kopetemessage.h
KopeteView
Definition: kopeteview.h:40
Kopete::Message
Representation of a message in Kopete.
Definition: kopetemessage.h:82
QMultiHash
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 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