• 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
kopetecommand.h
Go to the documentation of this file.
1 
2 /*
3  kopetecommand.h - Command
4 
5  Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
6  Copyright (c) 2005 by Michel Hermier <michel.hermier@wanadoo.fr>
7  Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU Lesser General Public *
13  * License as published by the Free Software Foundation; either *
14  * version 2 of the License, or (at your option) any later version. *
15  * *
16  *************************************************************************
17 */
18 
19 #ifndef KOPETECOMMAND_H
20 #define KOPETECOMMAND_H
21 
22 #include <QtCore/QObject>
23 
24 #include <kaction.h>
25 #include "kopetecommandhandler.h"
26 
27 namespace Kopete
28 {
29 
30 class ChatSession;
31 
32 class Command
33  : public KAction
34 {
35  Q_OBJECT
36 
37 public:
41  typedef enum Type
42  {
43  Normal = 0,
44  System = 1 << 1, // Not removable command
45  Alias = 1 << 2 // Is an alias
46 // Undefined
47  } Type;
48  Q_DECLARE_FLAGS(Types, Type)
49 
50 
67  Command( QObject *parent, const QString &command, const char* handlerSlot,
68  const QString &help = QString(), CommandHandler::CommandType type = CommandHandler::Normal, const QString &formatString = QString(),
69  uint minArgs = 0, int maxArgs = -1, const KShortcut &cut = KShortcut(),
70  const QString &pix = QString() );
71  ~Command();
72 
76  void processCommand( const QString &args, ChatSession *manager, bool gui = false );
77 
81  const QString &command() const { return m_command; }
82 
86  const QString &help() const { return m_help; }
87 
91  CommandHandler::CommandType type() const { return m_type; }
92 
93 signals:
99  void handleCommand( const QString &args, Kopete::ChatSession *manager );
100 
101 private slots:
105  void slotAction();
106 
107 private:
108  void init( const QString &command, const char* slot, const QString &help,
109  CommandHandler::CommandType type, const QString &formatString,
110  uint minArgs, int maxArgs );
111 
112  void printError( const QString &error, ChatSession *manager, bool gui = false ) const;
113 
114  QString m_command;
115  QString m_help;
116  QString m_formatString;
117  int m_minArgs;
118  int m_maxArgs;
119  bool m_processing;
120  CommandHandler::CommandType m_type;
121 
122  class Private;
123  Private * const d;
124 };
125 
126 }
127 
128 Q_DECLARE_OPERATORS_FOR_FLAGS(Kopete::Command::Types)
129 
130 #endif
Kopete::CommandHandler::CommandType
CommandType
an enum defining the type of a command
Definition: kopetecommandhandler.h:58
Kopete::Command
Definition: kopetecommand.h:32
Kopete::Command::command
const QString & command() const
Returns the command this object handles.
Definition: kopetecommand.h:81
kopetecommandhandler.h
Kopete::ChatSession
Definition: kopetechatsession.h:74
Kopete::Command::Type
Type
an enum defining the type of a command
Definition: kopetecommand.h:41
QObject
Kopete::Command::processCommand
void processCommand(const QString &args, ChatSession *manager, bool gui=false)
Process this command.
Definition: kopetecommand.cpp:99
Kopete::Command::System
Definition: kopetecommand.h:44
QString
Kopete::Command::type
CommandHandler::CommandType type() const
Returns the type of the command.
Definition: kopetecommand.h:91
Kopete::Command::help
const QString & help() const
Returns the help string for this command.
Definition: kopetecommand.h:86
Kopete::Command::Alias
Definition: kopetecommand.h:45
KAction
Kopete::Command::Normal
Definition: kopetecommand.h:43
Kopete::CommandHandler
Definition: kopetecommandhandler.h:48
Kopete::Command::handleCommand
void handleCommand(const QString &args, Kopete::ChatSession *manager)
Emitted whenever a command is handled by this object.
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