summaryrefslogtreecommitdiff
path: root/src/kspellplugin.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-12-28 16:50:41 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-12-28 16:50:41 +0100
commitfaa7f72c417b4ccd9b794b32b988312186d62e59 (patch)
tree19a4db56f1526e073ce87a0c05a0923d5a6e442f /src/kspellplugin.cpp
parentSVN_SILENT made messages (.desktop file) (diff)
downloadrekonq-faa7f72c417b4ccd9b794b32b988312186d62e59.tar.xz
Krazy Fixes, first shot
Diffstat (limited to 'src/kspellplugin.cpp')
-rw-r--r--src/kspellplugin.cpp76
1 files changed, 52 insertions, 24 deletions
diff --git a/src/kspellplugin.cpp b/src/kspellplugin.cpp
index 1186eb44..7b20b4a4 100644
--- a/src/kspellplugin.cpp
+++ b/src/kspellplugin.cpp
@@ -3,6 +3,7 @@
* This file is a part of the rekonq project
*
* Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
+* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
*
*
* This program is free software; you can redistribute it and/or
@@ -24,16 +25,45 @@
* ============================================================ */
-#include <stdio.h>
-#include <KDebug>
+// Self Includes
#include "kspellplugin.h"
+
+// KDE Includes
+#include <KDebug>
+
+// Qt Includes
#include <QTextBoundaryFinder>
+// Auto Includes
#include "rekonq.h"
+// Defines
#define methodDebug() kDebug("KWebSpellChecker: %s", __FUNCTION__)
-/////////////////////////////
+
+// ---------------------------------------------------------------------------------------------
+
+
+static bool isValidWord(const QString &str)
+{
+ if (str.isEmpty() || (str.length() == 1 && !str[0].isLetter()))
+ {
+ return false;
+ }
+ const int length = str.length();
+ for (int i = 0; i < length; ++i)
+ {
+ if (!str[i].isNumber())
+ {
+ return true;
+ }
+ }
+ // 'str' only contains numbers
+ return false;
+}
+
+
+// ---------------------------------------------------------------------------------------------
// KWebSpellChecker
@@ -42,48 +72,36 @@ KWebSpellChecker::KWebSpellChecker()
m_speller = new Sonnet::Speller();
}
+
KWebSpellChecker::~KWebSpellChecker()
{
delete m_speller;
}
+
bool KWebSpellChecker::isContinousSpellCheckingEnabled() const
{
return ReKonfig::automaticSpellChecking();
}
+
void KWebSpellChecker::toggleContinousSpellChecking()
{
ReKonfig::setAutomaticSpellChecking(! ReKonfig::automaticSpellChecking());
}
+
void KWebSpellChecker::learnWord(const QString& word)
{
Q_UNUSED(word);
}
+
void KWebSpellChecker::ignoreWordInSpellDocument(const QString& word)
{
Q_UNUSED(word);
}
-static bool isValidWord(const QString &str)
-{
- if (str.isEmpty() || (str.length() == 1 && !str[0].isLetter()))
- {
- return false;
- }
- const int length = str.length();
- for (int i = 0; i < length; ++i)
- {
- if (!str[i].isNumber())
- {
- return true;
- }
- }
- // 'str' only contains numbers
- return false;
-}
void KWebSpellChecker::checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength)
{
@@ -131,8 +149,10 @@ void KWebSpellChecker::checkSpellingOfString(const QString& word, int* misspelli
}
}
+
QString KWebSpellChecker::autoCorrectSuggestionForMisspelledWord(const QString& word)
{
+ Q_UNUSED(word);
/*
QStringList words = m_speller->suggest(word);
if (words.size() > 0)
@@ -141,10 +161,10 @@ QString KWebSpellChecker::autoCorrectSuggestionForMisspelledWord(const QString&
return QString("");
*/
-
- return QString("");
+ return QString();
}
+
void KWebSpellChecker::guessesForWord(const QString& word, const QString& context, QStringList& guesses)
{
Q_UNUSED(context);
@@ -153,15 +173,18 @@ void KWebSpellChecker::guessesForWord(const QString& word, const QString& contex
guesses = words;
}
+
bool KWebSpellChecker::isGrammarCheckingEnabled()
{
return false;
}
+
void KWebSpellChecker::toggleGrammarChecking()
{
}
+
void KWebSpellChecker::checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength)
{
Q_UNUSED(badGrammarLocation);
@@ -169,12 +192,15 @@ void KWebSpellChecker::checkGrammarOfString(const QString&, QList<GrammarDetail>
}
-////////////////////////////////////////////
+// ----------------------------------------------------------------------------------------------------------------
// KWebKitPlatformPlugin
+
+
KWebKitPlatformPlugin::KWebKitPlatformPlugin()
{
}
+
KWebKitPlatformPlugin::~KWebKitPlatformPlugin()
{
}
@@ -185,6 +211,7 @@ bool KWebKitPlatformPlugin::supportsExtension(Extension ext) const
return ext == SpellChecker;
}
+
QObject* KWebKitPlatformPlugin::createExtension(Extension ext) const
{
if (ext == SpellChecker)
@@ -193,6 +220,7 @@ QObject* KWebKitPlatformPlugin::createExtension(Extension ext) const
return NULL;
}
+
+// ----------------------------------------------------------------------------------------------------------------
Q_EXPORT_PLUGIN2(kwebspellchecker, KWebKitPlatformPlugin);
Q_IMPORT_PLUGIN(kwebspellchecker)
-