Kate
spellingmenu.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) 2008-2009 by Michel Ludwig <michel.ludwig@kdemail.net> 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 SPELLINGMENU_H 00022 #define SPELLINGMENU_H 00023 00024 #include <QObject> 00025 #include <QSignalMapper> 00026 00027 #include <kactioncollection.h> 00028 #include <kactionmenu.h> 00029 #include <kmenu.h> 00030 #include <ktexteditor/movingrange.h> 00031 #include <ktexteditor/movingrangefeedback.h> 00032 #include <ktexteditor/range.h> 00033 #include <ktexteditor/view.h> 00034 00035 class KateDocument; 00036 class KateView; 00037 00038 class KateOnTheFlyChecker; 00039 00040 class KateSpellingMenu : public QObject { 00041 Q_OBJECT 00042 friend class KateOnTheFlyChecker; 00043 00044 public: 00045 KateSpellingMenu(KateView *view); 00046 virtual ~KateSpellingMenu(); 00047 00048 bool isEnabled() const; 00049 00050 void createActions(KActionCollection *ac); 00051 00057 void setUseMouseForMisspelledRange(bool b); 00058 00059 public Q_SLOTS: 00060 void setEnabled(bool b); 00061 void setVisible(bool b); 00062 00063 protected: 00064 KateView *m_view; 00065 KActionMenu *m_spellingMenuAction; 00066 KAction *m_ignoreWordAction, *m_addToDictionaryAction; 00067 KMenu *m_spellingMenu; 00068 KTextEditor::MovingRange *m_currentMisspelledRange; 00069 KTextEditor::MovingRange *m_currentMouseMisspelledRange; 00070 KTextEditor::MovingRange *m_currentCaretMisspelledRange; 00071 bool m_useMouseForMisspelledRange; 00072 QStringList m_currentSuggestions; 00073 QSignalMapper *m_suggestionsSignalMapper; 00074 00075 // These methods are called from KateOnTheFlyChecker to inform about events involving 00076 // moving ranges. 00077 void rangeDeleted(KTextEditor::MovingRange *range); 00078 void caretEnteredMisspelledRange(KTextEditor::MovingRange *range); 00079 void caretExitedMisspelledRange(KTextEditor::MovingRange *range); 00080 void mouseEnteredMisspelledRange(KTextEditor::MovingRange *range); 00081 void mouseExitedMisspelledRange(KTextEditor::MovingRange *range); 00082 00083 protected Q_SLOTS: 00084 void populateSuggestionsMenu(); 00085 void replaceWordBySuggestion(const QString& suggestion); 00086 00087 void addCurrentWordToDictionary(); 00088 void ignoreCurrentWord(); 00089 }; 00090 00091 #endif 00092 00093 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference