• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

katewordcompletion.h

Go to the documentation of this file.
00001 /*
00002     This library is free software; you can redistribute it and/or
00003     modify it under the terms of the GNU Library General Public
00004     License version 2 as published by the Free Software Foundation.
00005 
00006     This library is distributed in the hope that it will be useful,
00007     but WITHOUT ANY WARRANTY; without even the implied warranty of
00008     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00009     Library General Public License for more details.
00010 
00011     You should have received a copy of the GNU Library General Public License
00012     along with this library; see the file COPYING.LIB.  If not, write to
00013     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00014     Boston, MA 02110-1301, USA.
00015 
00016     ---
00017     file: docwordcompletion.h
00018 
00019     KTextEditor plugin to autocompletion with document words.
00020     Copyright Anders Lund <anders.lund@lund.tdcadsl.dk>, 2003
00021 
00022     The following completion methods are supported:
00023     * Completion with bigger matching words in
00024       either direction (backward/forward).
00025     * NOT YET Pop up a list of all bigger matching words in document
00026 
00027 */
00028 
00029 #ifndef _KateWordCompletion_h_
00030 #define _KateWordCompletion_h_
00031 
00032 #include <ktexteditor/plugin.h>
00033 #include <ktexteditor/view.h>
00034 #include <ktexteditor/codecompletioninterface.h>
00035 #include <ktexteditor/codecompletionmodel.h>
00036 #include <ktexteditor/configpage.h>
00037 #include <kxmlguiclient.h>
00038 
00039 #include <QtCore/QEvent>
00040 #include <QtCore/QObject>
00041 #include <QtCore/QList>
00042 
00043 #include <kdebug.h>
00044 
00045 class KateWordCompletionModel : public KTextEditor::CodeCompletionModel
00046 {
00047   Q_OBJECT
00048   public:
00049     KateWordCompletionModel( QObject *parent );
00050     ~KateWordCompletionModel();
00051 
00062     void completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType);
00063 
00064     void saveMatches( KTextEditor::View* view,
00065                             const KTextEditor::Range& range);
00066 
00067     int rowCount ( const QModelIndex & parent ) const;
00068 
00069     QVariant data(const QModelIndex& index, int role) const;
00070     virtual QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const;
00071     virtual QModelIndex parent(const QModelIndex& index) const;
00072 
00073     const QStringList allMatches( KTextEditor::View *view, const KTextEditor::Range &range, int minAdditionalLength = 1 ) const;
00074 
00075   private:
00076     QStringList m_matches;
00077 };
00078 
00079 class KateWordCompletionView : public QObject
00080 {
00081   Q_OBJECT
00082 
00083   public:
00084     KateWordCompletionView(KTextEditor::View *view, KActionCollection* ac );
00085     ~KateWordCompletionView();
00086 
00087   private Q_SLOTS:
00088     void completeBackwards();
00089     void completeForwards();
00090     void slotCursorMoved();
00091 
00092     void shellComplete();
00093 
00094     void popupCompletionList();
00095 
00096   private:
00097     void complete( bool fw=true );
00098 
00099     const QString word() const;
00100     const KTextEditor::Range range() const;
00101 
00102     QString findLongestUnique( const QStringList &matches, int lead ) const;
00103 
00104     KTextEditor::View *m_view;
00105     KateWordCompletionModel *m_dWCompletionModel;
00106     struct KateWordCompletionViewPrivate *d;
00107 };
00108 
00109 #endif // _DocWordCompletionPlugin_h_
00110 
00111 // 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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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