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

Kate

katewordcompletion.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) 2003 Anders Lund <anders.lund@lund.tdcadsl.dk>
00004  *  Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public License
00017  *  along with this library; see the file COPYING.LIB.  If not, write to
00018  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  *  Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef _KateWordCompletion_h_
00023 #define _KateWordCompletion_h_
00024 
00025 #include <ktexteditor/plugin.h>
00026 #include <ktexteditor/view.h>
00027 #include <ktexteditor/codecompletioninterface.h>
00028 #include <ktexteditor/codecompletionmodel.h>
00029 #include <ktexteditor/configpage.h>
00030 #include "codecompletionmodelcontrollerinterfacev4.h"
00031 #include <kxmlguiclient.h>
00032 
00033 #include <QtCore/QEvent>
00034 #include <QtCore/QObject>
00035 #include <QtCore/QList>
00036 
00037 #include <kdebug.h>
00038 
00039 
00040 class KateWordCompletionModel : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface4
00041 {
00042   Q_OBJECT
00043   Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface4)
00044   public:
00045     KateWordCompletionModel( QObject *parent );
00046     ~KateWordCompletionModel();
00047 
00058     void completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType);
00059 
00060     
00061     bool shouldStartCompletion(KTextEditor::View* view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position);
00062     bool shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range &range, const QString &currentCompletion);
00063 
00064     
00065     
00066     void saveMatches( KTextEditor::View* view,
00067                             const KTextEditor::Range& range);
00068 
00069     int rowCount ( const QModelIndex & parent ) const;
00070 
00071     QVariant data(const QModelIndex& index, int role) const;
00072     virtual QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const;
00073     virtual QModelIndex parent(const QModelIndex& index) const;
00074     virtual MatchReaction matchingItem(const QModelIndex& matched);
00075 
00076     virtual bool shouldHideItemsWithEqualNames() const;
00077 
00078     const QStringList allMatches( KTextEditor::View *view, const KTextEditor::Range &range ) const;
00079 
00080   private:
00081     QStringList m_matches;
00082     bool m_automatic;
00083 };
00084 
00085 class KateWordCompletionView : public QObject
00086 {
00087   Q_OBJECT
00088 
00089   public:
00090     KateWordCompletionView(KTextEditor::View *view, KActionCollection* ac );
00091     ~KateWordCompletionView();
00092 
00093   private Q_SLOTS:
00094     void completeBackwards();
00095     void completeForwards();
00096     void slotCursorMoved();
00097 
00098     void shellComplete();
00099 
00100     void popupCompletionList();
00101 
00102   private:
00103     void complete( bool fw=true );
00104 
00105     const QString word() const;
00106     const KTextEditor::Range range() const;
00107 
00108     QString findLongestUnique( const QStringList &matches, int lead ) const;
00109 
00110     KTextEditor::View *m_view;
00111     KateWordCompletionModel *m_dWCompletionModel;
00112     struct KateWordCompletionViewPrivate *d;
00113 };
00114 
00115 #endif // _DocWordCompletionPlugin_h_
00116 
00117 // kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal