Kate
katecmd.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries and the Kate part. 00002 * 00003 * Copyright (C) 2001-2010 Christoph Cullmann <cullmann@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef _KATE_CMD_H 00022 #define _KATE_CMD_H 00023 00024 #include "katepartprivate_export.h" 00025 00026 #include <ktexteditor/commandinterface.h> 00027 00028 #include <kcompletion.h> 00029 00030 #include <QtCore/QHash> 00031 #include <QtCore/QStringList> 00032 00033 class KATEPART_TESTS_EXPORT KateCmd 00034 { 00035 public: 00036 KateCmd (); 00037 ~KateCmd (); 00038 00039 static KateCmd *self (); 00040 00041 bool registerCommand (KTextEditor::Command *cmd); 00042 bool unregisterCommand (KTextEditor::Command *cmd); 00043 KTextEditor::Command *queryCommand (const QString &cmd) const; 00044 QList<KTextEditor::Command*> commands() const; 00045 QStringList commandList() const; 00046 00047 QStringList cmds (); 00048 void appendHistory( const QString &cmd ); 00049 const QString fromHistory( int i ) const; 00050 uint historyLength() const { return m_history.count(); } 00051 00052 KCompletion* commandCompletionObject(); 00053 00054 private: 00055 QHash<QString, KTextEditor::Command *> m_dict; 00056 QStringList m_cmds; 00057 QStringList m_history; 00058 KCompletion m_cmdCompletion; // shared completion object for all KateCmdLineEdits in each KTE::View 00059 }; 00060 00067 class KateCmdShellCompletion : public KCompletion 00068 { 00069 public: 00070 KateCmdShellCompletion(); 00071 00078 QString makeCompletion(const QString &text); 00079 00080 protected: 00081 // Called by KCompletion 00082 void postProcessMatch( QString *match ) const; 00083 void postProcessMatches( QStringList *matches ) const; 00084 void postProcessMatches( KCompletionMatches *matches ) const; 00085 00086 private: 00093 void splitText( const QString &text, QString &text_start, QString &text_compl ) const; 00094 00095 QChar m_word_break_char; 00096 QChar m_quote_char1; 00097 QChar m_quote_char2; 00098 QChar m_escape_char; 00099 00100 QString m_text_start; 00101 QString m_text_compl; 00102 00103 }; 00104 00105 #endif 00106 00107 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference