summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-09-19 23:22:13 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commite315ff15daf26cbc70b6f2da50e6ca18081fc7c4 (patch)
tree6da0556f2c5c7efb13d8e8b03ba0092e7a5838d3
parentImplement RekonqWindow (diff)
downloadrekonq-e315ff15daf26cbc70b6f2da50e6ca18081fc7c4.tar.xz
Integrated spell checking for rekonq2 (lindsay's work imported)
- inline spell highlighter. This requires WebKit 2.3 to work. - Addition of a suggested replacement word list to the context menu, for the word right clicked on - A standard modeless spell check dialog that works on the current editable text (or selection). Heavily cribbed from Dawit's work on kdewebkitpart. oops... also a codingstyle script round here... :)
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/application.cpp11
-rw-r--r--src/application.h2
-rw-r--r--src/bookmarks/bookmarkmanager.h2
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp8
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp6
-rw-r--r--src/download/downloadmanager.cpp1
-rw-r--r--src/history/historymanager.cpp3
-rw-r--r--src/icons/webicon.cpp2
-rw-r--r--src/kspellplugin.cpp197
-rw-r--r--src/kspellplugin.h76
-rw-r--r--src/main.cpp2
-rw-r--r--src/qwebkitplatformplugin.h201
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/rekonq_defines.h46
-rw-r--r--src/sessionmanager.cpp6
-rw-r--r--src/sessionmanager.h4
-rw-r--r--src/settings/settingsdialog.cpp2
-rw-r--r--src/sync/operasynchandler.cpp12
-rw-r--r--src/tabwindow/rekonqwindow.cpp90
-rw-r--r--src/tabwindow/rekonqwindow.h26
-rw-r--r--src/tabwindow/tabbar.cpp10
-rw-r--r--src/tabwindow/tabbar.h6
-rw-r--r--src/tabwindow/tabpreviewpopup.h2
-rw-r--r--src/tabwindow/tabwindow.cpp18
-rw-r--r--src/tabwindow/tabwindow.h2
-rw-r--r--src/urlbar/listitem.cpp2
-rw-r--r--src/urlbar/urlbar.cpp6
-rw-r--r--src/urlbar/urlsuggester.cpp10
-rw-r--r--src/urlbar/urlsuggester.h16
-rw-r--r--src/webtab/networkaccessmanager.cpp22
-rw-r--r--src/webtab/previewselectorbar.cpp2
-rw-r--r--src/webtab/protocolhandler.cpp4
-rw-r--r--src/webtab/protocolhandler.h2
-rw-r--r--src/webtab/webpage.cpp4
-rw-r--r--src/webtab/webtab.cpp2
-rw-r--r--src/webtab/webtab.h2
-rw-r--r--src/webtab/webview.cpp249
-rw-r--r--src/webtab/webview.h11
-rw-r--r--src/webwindow/findbar.cpp6
-rw-r--r--src/webwindow/rekonqfactory.cpp30
-rw-r--r--src/webwindow/rekonqfactory.h6
-rw-r--r--src/webwindow/rekonqmenu.cpp2
-rw-r--r--src/webwindow/webwindow.cpp24
-rw-r--r--src/webwindow/webwindow.h8
45 files changed, 931 insertions, 220 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5c429a7a..5cadf481 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,7 +4,8 @@ ADD_SUBDIRECTORY( data )
### ------- SETTING REKONQ FILES..
-
+add_definitions(-DQT_STATICPLUGIN)
+QT4_WRAP_CPP(wk_HEADERS_MOC qwebkitplatformplugin.h)
# src files
set(rekonq_KDEINIT_SRCS
@@ -100,6 +101,8 @@ set(rekonq_KDEINIT_SRCS
webwindow/rekonqmenu.cpp
webwindow/webwindow.cpp
#----------------------------------------
+ kspellplugin.cpp
+ ${wk_HEADERS_MOC}
)
diff --git a/src/application.cpp b/src/application.cpp
index efad91c3..6de3eea1 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -76,6 +76,7 @@
// Qt Includes
#include <QDBusInterface>
#include <QDBusReply>
+#include <QDir>
Application::Application()
@@ -184,7 +185,7 @@ int Application::newInstance()
}
else
{
- // NOTE: just load new tabs/windows without arguments
+ // NOTE: just load new tabs/windows without arguments
// if NOT is Session restored...
if (!isSessionRestored())
{
@@ -332,7 +333,7 @@ TabWindow *Application::newTabWindow()
// set object name
int n = m_tabWindows.count() + 1;
- w->setObjectName( QL1S("win") + QString::number(n) );
+ w->setObjectName(QL1S("win") + QString::number(n));
// This is used to track which window was activated most recently
w->installEventFilter(this);
@@ -477,7 +478,7 @@ void Application::updateConfiguration()
// ? tabWindow()->changeWindowIcon(tabWindow()->mainView()->currentIndex())
// : tabWindow()->setWindowIcon(KIcon("rekonq"))
// ;
-//
+//
// hovering unfocused tabs options
switch (ReKonfig::hoveringTabOption())
{
@@ -632,7 +633,7 @@ void Application::createWebAppShortcut()
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
dialog->button(KDialog::Ok)->setText(i18n("Create"));
dialog->setMinimumSize(400, 50);
- dialog->setWindowIcon( QIcon(IconManager::self()->iconForUrl(u).pixmap(16)) );
+ dialog->setWindowIcon(QIcon(IconManager::self()->iconForUrl(u).pixmap(16)));
Ui::webAppCreation wAppWidget;
QWidget widget;
@@ -708,7 +709,7 @@ void Application::createWebAppShortcut()
wAppFile.close();
}
-
+
}
dialog->deleteLater();
diff --git a/src/application.h b/src/application.h
index 66780c5b..e811f3f0 100644
--- a/src/application.h
+++ b/src/application.h
@@ -96,7 +96,7 @@ protected:
Q_SIGNALS:
void toggleBookmarksToolbar(bool);
-
+
private Q_SLOTS:
void updateConfiguration();
diff --git a/src/bookmarks/bookmarkmanager.h b/src/bookmarks/bookmarkmanager.h
index d842c271..3538bcb8 100644
--- a/src/bookmarks/bookmarkmanager.h
+++ b/src/bookmarks/bookmarkmanager.h
@@ -80,7 +80,7 @@ public:
*/
void registerBookmarkBar(BookmarkToolBar *toolbar);
void removeBookmarkBar(BookmarkToolBar *toolbar);
-
+
/**
* @short Get action by name
* This method returns poiner bookmark action of given name.
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index d0907660..54e558cc 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -40,10 +40,10 @@
BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark,
- KBookmarkManager *manager,
- BookmarkOwner *owner,
- bool nullForced,
- QWidget *parent)
+ KBookmarkManager *manager,
+ BookmarkOwner *owner,
+ bool nullForced,
+ QWidget *parent)
: KBookmarkContextMenu(bookmark, manager, owner, parent)
, m_bmOwner(owner)
, m_nullForced(nullForced)
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index 7a904ef5..b101e293 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -192,7 +192,7 @@ void BookmarkToolBar::contextMenu(const QPoint &point)
BookmarkManager::self()->owner(),
nullAction);
- menu.exec( mapToGlobal(point) );
+ menu.exec(mapToGlobal(point));
}
@@ -420,8 +420,8 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
{
WebWindow *w = qobject_cast<WebWindow *>(parent());
QString title = url.contains(w->url().url())
- ? w->title()
- : url;
+ ? w->title()
+ : url;
bookmark = root.addBookmark(title, url);
}
}
diff --git a/src/download/downloadmanager.cpp b/src/download/downloadmanager.cpp
index cae65cd9..151858d2 100644
--- a/src/download/downloadmanager.cpp
+++ b/src/download/downloadmanager.cpp
@@ -44,6 +44,7 @@
#include <KIO/JobUiDelegate>
// Qt Includes
+#include <QApplication>
#include <QDataStream>
#include <QDateTime>
#include <QFile>
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index 30184cef..2b84ddc8 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -43,6 +43,7 @@
#include <KCompletion>
// Qt Includes
+#include <QApplication>
#include <QList>
#include <QUrl>
#include <QDate>
@@ -106,7 +107,7 @@ HistoryManager::~HistoryManager()
return;
}
m_saveTimer->saveIfNeccessary();
-
+
kDebug() << "bye bye history...";
}
diff --git a/src/icons/webicon.cpp b/src/icons/webicon.cpp
index ce482637..64bb884b 100644
--- a/src/icons/webicon.cpp
+++ b/src/icons/webicon.cpp
@@ -61,6 +61,6 @@ void WebIcon::saveIcon(bool b)
{
IconManager::self()->provideIcon(m_page.mainFrame(), m_url, false);
}
-
+
this->deleteLater();
}
diff --git a/src/kspellplugin.cpp b/src/kspellplugin.cpp
new file mode 100644
index 00000000..d25ddf9f
--- /dev/null
+++ b/src/kspellplugin.cpp
@@ -0,0 +1,197 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#include <stdio.h>
+#include <KDebug>
+#include "kspellplugin.h"
+#include <QTextBoundaryFinder>
+
+#include "rekonq.h"
+
+#define methodDebug() kDebug("KWebSpellChecker: %s", __FUNCTION__)
+
+/////////////////////////////
+// KWebSpellChecker
+
+
+KWebSpellChecker::KWebSpellChecker()
+{
+ m_speller = new Sonnet::Speller();
+ kDebug() << "!!! Client = " << m_speller->defaultClient() << endl;
+ kDebug() << "!!! Language = " << m_speller->defaultLanguage() << endl;
+}
+
+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)
+{
+ // sanity check
+ if (misspellingLocation == NULL || misspellingLength == NULL)
+ return;
+
+ *misspellingLocation = -1;
+ *misspellingLength = 0;
+
+ kDebug() << word << endl;
+
+ QTextBoundaryFinder finder = QTextBoundaryFinder(QTextBoundaryFinder::Word, word);
+
+ QTextBoundaryFinder::BoundaryReasons boundary = finder.boundaryReasons();
+ int start = finder.position(), end = finder.position();
+ bool inWord = (boundary & QTextBoundaryFinder::StartWord) != 0;
+ while (finder.toNextBoundary() > 0)
+ {
+ boundary = finder.boundaryReasons();
+ if ((boundary & QTextBoundaryFinder::EndWord) && inWord)
+ {
+ end = finder.position();
+ QString str = finder.string().mid(start, end - start);
+ if (isValidWord(str))
+ {
+#if 1
+ qDebug() << "Word at " << start << " word = '"
+ << str << "', len = " << str.length();
+#endif
+ if (m_speller->isMisspelled(str))
+ {
+ *misspellingLocation = start;
+ *misspellingLength = end - start;
+ }
+ return;
+ }
+ inWord = false;
+ }
+ if ((boundary & QTextBoundaryFinder::StartWord))
+ {
+ start = finder.position();
+ inWord = true;
+ }
+ }
+}
+
+QString KWebSpellChecker::autoCorrectSuggestionForMisspelledWord(const QString& word)
+{
+ /*
+ QStringList words = m_speller->suggest(word);
+ if (words.size() > 0)
+ return words[0];
+ else
+ return QString("");
+ */
+
+
+ return QString("");
+}
+
+void KWebSpellChecker::guessesForWord(const QString& word, const QString& context, QStringList& guesses)
+{
+ Q_UNUSED(context);
+
+ QStringList words = m_speller->suggest(word);
+ guesses = words;
+}
+
+bool KWebSpellChecker::isGrammarCheckingEnabled()
+{
+ return false;
+}
+
+void KWebSpellChecker::toggleGrammarChecking()
+{
+}
+
+void KWebSpellChecker::checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength)
+{
+ Q_UNUSED(badGrammarLocation);
+ Q_UNUSED(badGrammarLength);
+}
+
+
+////////////////////////////////////////////
+// KWebKitPlatformPlugin
+KWebKitPlatformPlugin::KWebKitPlatformPlugin()
+{
+}
+
+KWebKitPlatformPlugin::~KWebKitPlatformPlugin()
+{
+}
+
+
+bool KWebKitPlatformPlugin::supportsExtension(Extension ext) const
+{
+ return ext == SpellChecker;
+}
+
+QObject* KWebKitPlatformPlugin::createExtension(Extension) const
+{
+ return new KWebSpellChecker();
+}
+
+Q_EXPORT_PLUGIN2(kwebspellchecker, KWebKitPlatformPlugin);
+Q_IMPORT_PLUGIN(kwebspellchecker)
+
diff --git a/src/kspellplugin.h b/src/kspellplugin.h
new file mode 100644
index 00000000..faa83106
--- /dev/null
+++ b/src/kspellplugin.h
@@ -0,0 +1,76 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#ifndef TESTQWEBSPELLCHECKER_H
+#define TESTQWEBSPELLCHECKER_H
+
+
+#include <QtGlobal>
+#include <QtPlugin>
+#include <sonnet/speller.h>
+#include "qwebkitplatformplugin.h"
+
+
+
+
+class KWebSpellChecker : public QWebSpellChecker
+{
+ Q_OBJECT
+public:
+ Sonnet::Speller *m_speller;
+
+ KWebSpellChecker();
+ ~KWebSpellChecker();
+
+ virtual bool isContinousSpellCheckingEnabled() const;
+ virtual void toggleContinousSpellChecking();
+ virtual void learnWord(const QString& word);
+ virtual void ignoreWordInSpellDocument(const QString& word);
+ virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength);
+ virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word);
+ virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses);
+
+ virtual bool isGrammarCheckingEnabled();
+ virtual void toggleGrammarChecking();
+ virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
+};
+
+
+class KWebKitPlatformPlugin : public QObject, public QWebKitPlatformPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES(QWebKitPlatformPlugin)
+
+public:
+ KWebKitPlatformPlugin();
+ ~KWebKitPlatformPlugin();
+
+ virtual bool supportsExtension(Extension) const;
+ virtual QObject* createExtension(Extension) const;
+
+};
+
+#endif \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 7b468bae..07963467 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -96,6 +96,6 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
for (int i = 1; TabWindow::canBeRestored(i); i++)
app.newTabWindow()->restore(i);
}
-
+
return app.exec();
}
diff --git a/src/qwebkitplatformplugin.h b/src/qwebkitplatformplugin.h
new file mode 100644
index 00000000..a1f25fdb
--- /dev/null
+++ b/src/qwebkitplatformplugin.h
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef QWEBKITPLATFORMPLUGIN_H
+#define QWEBKITPLATFORMPLUGIN_H
+
+/*
+ * Warning: The contents of this file is not part of the public QtWebKit API
+ * and may be changed from version to version or even be completely removed.
+*/
+
+#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
+#include <QMediaPlayer>
+#endif
+#include <QtCore/QObject>
+#include <QtCore/QRect>
+#include <QtCore/QUrl>
+#include <QtGui/QColor>
+#include <QtGui/QFont>
+
+class QWebSelectData
+{
+public:
+ virtual ~QWebSelectData() {}
+
+ enum ItemType { Option, Group, Separator };
+
+ virtual ItemType itemType(int) const = 0;
+ virtual QString itemText(int index) const = 0;
+ virtual QString itemToolTip(int index) const = 0;
+ virtual bool itemIsEnabled(int index) const = 0;
+ virtual bool itemIsSelected(int index) const = 0;
+ virtual int itemCount() const = 0;
+ virtual bool multiple() const = 0;
+ virtual QColor backgroundColor() const = 0;
+ virtual QColor foregroundColor() const = 0;
+ virtual QColor itemBackgroundColor(int index) const = 0;
+ virtual QColor itemForegroundColor(int index) const = 0;
+};
+
+class QWebSelectMethod : public QObject
+{
+ Q_OBJECT
+public:
+ virtual ~QWebSelectMethod() {}
+
+ virtual void show(const QWebSelectData&) = 0;
+ virtual void hide() = 0;
+ virtual void setGeometry(const QRect&) = 0;
+ virtual void setFont(const QFont&) = 0;
+
+Q_SIGNALS:
+ void selectItem(int index, bool allowMultiplySelections, bool shift);
+ void didHide();
+};
+
+class QWebNotificationData
+{
+public:
+ virtual ~QWebNotificationData() {}
+
+ virtual const QString title() const = 0;
+ virtual const QString message() const = 0;
+ virtual const QUrl iconUrl() const = 0;
+ virtual const QUrl openerPageUrl() const = 0;
+};
+
+class QWebNotificationPresenter : public QObject
+{
+ Q_OBJECT
+public:
+ QWebNotificationPresenter() {}
+ virtual ~QWebNotificationPresenter() {}
+
+ virtual void showNotification(const QWebNotificationData*) = 0;
+
+Q_SIGNALS:
+ void notificationClosed();
+ void notificationClicked();
+};
+
+class QWebHapticFeedbackPlayer: public QObject
+{
+ Q_OBJECT
+public:
+ QWebHapticFeedbackPlayer() {}
+ virtual ~QWebHapticFeedbackPlayer() {}
+
+ enum HapticStrength
+ {
+ None, Weak, Medium, Strong
+ };
+
+ enum HapticEvent
+ {
+ Press, Release
+ };
+
+ virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0;
+};
+
+class QWebTouchModifier : public QObject
+{
+ Q_OBJECT
+public:
+ virtual ~QWebTouchModifier() {}
+
+ enum PaddingDirection
+ {
+ Up, Right, Down, Left
+ };
+
+ virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0;
+};
+
+#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
+class QWebFullScreenVideoHandler : public QObject
+{
+ Q_OBJECT
+public:
+ QWebFullScreenVideoHandler() {}
+ virtual ~QWebFullScreenVideoHandler() {}
+ virtual bool requiresFullScreenForVideoPlayback() const = 0;
+
+Q_SIGNALS:
+ void fullScreenClosed();
+
+public Q_SLOTS:
+ virtual void enterFullScreen(QMediaPlayer*) = 0;
+ virtual void exitFullScreen() = 0;
+};
+#endif
+
+class QWebSpellChecker : public QObject
+{
+ Q_OBJECT
+public:
+ struct GrammarDetail
+ {
+ int location;
+ int length;
+ QStringList guesses;
+ QString userDescription;
+ };
+
+ virtual bool isContinousSpellCheckingEnabled() const = 0;
+ virtual void toggleContinousSpellChecking() = 0;
+
+ virtual void learnWord(const QString& word) = 0;
+ virtual void ignoreWordInSpellDocument(const QString& word) = 0;
+ virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength) = 0;
+ virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word) = 0;
+ virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses) = 0;
+
+ virtual bool isGrammarCheckingEnabled() = 0;
+ virtual void toggleGrammarChecking() = 0;
+ virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
+};
+
+class QWebKitPlatformPlugin
+{
+public:
+ virtual ~QWebKitPlatformPlugin() {}
+
+ enum Extension
+ {
+ MultipleSelections,
+ Notifications,
+ Haptics,
+ TouchInteraction,
+ FullScreenVideoPlayer,
+ SpellChecker
+ };
+
+ virtual bool supportsExtension(Extension) const = 0;
+ virtual QObject* createExtension(Extension) const = 0;
+};
+
+QT_BEGIN_NAMESPACE
+Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9");
+QT_END_NAMESPACE
+
+#endif // QWEBKITPLATFORMPLUGIN_H
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 908df083..cd1d37e0 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -237,6 +237,9 @@
<entry name="middleClickAction" type="Int">
<default>2</default>
</entry>
+ <entry name="automaticSpellChecking" type="Bool">
+ <default>true</default>
+ </entry>
</group>
diff --git a/src/rekonq_defines.h b/src/rekonq_defines.h
index c25d22d2..55a8befc 100644
--- a/src/rekonq_defines.h
+++ b/src/rekonq_defines.h
@@ -67,29 +67,29 @@
namespace Rekonq
{
- /**
- * @short Open link options
- * Different modes of opening new tab
- */
- enum OpenType
- {
- CurrentTab, ///< open url in current tab
- NewTab, ///< open url according to users settings
- NewFocusedTab, ///< open url in new tab and focus it
- NewBackGroundTab, ///< open url in new background tab
- NewWindow ///< open url in new window
- };
-
- /**
- * @short data to be synced
- * Different data we can sync
- */
- enum SyncData
- {
- Bookmarks,
- History,
- Passwords
- };
+/**
+* @short Open link options
+* Different modes of opening new tab
+*/
+enum OpenType
+{
+ CurrentTab, ///< open url in current tab
+ NewTab, ///< open url according to users settings
+ NewFocusedTab, ///< open url in new tab and focus it
+ NewBackGroundTab, ///< open url in new background tab
+ NewWindow ///< open url in new window
+};
+
+/**
+* @short data to be synced
+* Different data we can sync
+*/
+enum SyncData
+{
+ Bookmarks,
+ History,
+ Passwords
+};
}
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 771aca55..adc6fcb3 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -139,7 +139,7 @@ void SessionManager::saveSession()
{
if (!m_isSessionEnabled)
return;
-
+
m_saveTimer->changeOccurred();
}
@@ -239,8 +239,8 @@ void SessionManager::restoreCrashedSession()
QDomElement window = document.elementsByTagName("window").at(winNo).toElement();
TabWindow *tw = (winNo == 0)
- ? rApp->tabWindow()
- : rApp->newTabWindow();
+ ? rApp->tabWindow()
+ : rApp->newTabWindow();
KUrl u = tw->currentWebWindow()->url();
bool useCurrentTab = (u.isEmpty() || u.protocol() == QL1S("about"));
diff --git a/src/sessionmanager.h b/src/sessionmanager.h
index abf39197..dbff7e69 100644
--- a/src/sessionmanager.h
+++ b/src/sessionmanager.h
@@ -46,7 +46,7 @@ class TabWindow;
/**
* Session Management: Needs clean up :)
- *
+ *
*/
class REKONQ_TESTS_EXPORT SessionManager : public QObject
{
@@ -85,7 +85,7 @@ public Q_SLOTS:
private Q_SLOTS:
void saveSession();
void save();
-
+
// This method restores session
// after a crash
void restoreCrashedSession();
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index 99922e54..11575f79 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -198,7 +198,7 @@ bool SettingsDialog::hasChanged()
|| d->advancedWidg->changed()
|| d->privacyWidg->changed()
|| d->ebrowsingModule->changed()
- ;
+ ;
}
diff --git a/src/sync/operasynchandler.cpp b/src/sync/operasynchandler.cpp
index 841f7c11..ee3fb20d 100644
--- a/src/sync/operasynchandler.cpp
+++ b/src/sync/operasynchandler.cpp
@@ -293,12 +293,12 @@ void OperaSyncHandler::getBookmarks()
QByteArray fetchBookmarksUrl = "https://link.api.opera.com/rest/bookmark/descendants/";
QByteArray urlParams = _qoauth.createParametersString(fetchBookmarksUrl,
- QOAuth::GET,
- _authToken,
- _authTokenSecret,
- QOAuth::HMAC_SHA1,
- requestMap,
- QOAuth::ParseForInlineQuery);
+ QOAuth::GET,
+ _authToken,
+ _authTokenSecret,
+ QOAuth::HMAC_SHA1,
+ requestMap,
+ QOAuth::ParseForInlineQuery);
QNetworkRequest request;
diff --git a/src/tabwindow/rekonqwindow.cpp b/src/tabwindow/rekonqwindow.cpp
index f3e321bb..970c73e5 100644
--- a/src/tabwindow/rekonqwindow.cpp
+++ b/src/tabwindow/rekonqwindow.cpp
@@ -53,33 +53,40 @@ public:
{
}
- bool dummyInit() { return true; }
+ bool dummyInit()
+ {
+ return true;
+ }
- bool saveState( QSessionManager& )
+ bool saveState(QSessionManager&)
{
KConfig* config = KApplication::kApplication()->sessionConfig();
int n = 0;
- Q_FOREACH (RekonqWindow* rw, RekonqWindow::windowList()) {
+ Q_FOREACH(RekonqWindow * rw, RekonqWindow::windowList())
+ {
n++;
rw->savePropertiesInternal(config, n);
}
- KConfigGroup group( config, "Number" );
- group.writeEntry("NumberOfWindows", n );
+ KConfigGroup group(config, "Number");
+ group.writeEntry("NumberOfWindows", n);
return true;
}
- bool commitData( QSessionManager& sm )
+ bool commitData(QSessionManager& sm)
{
// not really a fast method but the only compatible one
- if ( sm.allowsInteraction() ) {
+ if (sm.allowsInteraction())
+ {
bool canceled = false;
::s_no_query_exit = true;
- Q_FOREACH (RekonqWindow *window, RekonqWindow::windowList()) {
- if ( !window->testAttribute( Qt::WA_WState_Hidden ) ) {
+ Q_FOREACH(RekonqWindow * window, RekonqWindow::windowList())
+ {
+ if (!window->testAttribute(Qt::WA_WState_Hidden))
+ {
QCloseEvent e;
- QApplication::sendEvent( window, &e );
+ QApplication::sendEvent(window, &e);
canceled = !e.isAccepted();
if (canceled)
break;
@@ -87,7 +94,7 @@ public:
}
::s_no_query_exit = false;
if (canceled)
- return false;
+ return false;
return true;
}
@@ -123,7 +130,7 @@ RekonqWindow::RekonqWindow(QWidget* parent)
if (args && args->isSet("geometry"))
geometry = args->getOption("geometry");
- if ( geometry.isNull() ) // if there is no geometry, it doesn't matter
+ if (geometry.isNull()) // if there is no geometry, it doesn't matter
{
KSharedConfig::Ptr cf = KGlobal::config();
KConfigGroup cg(cf, QL1S("TabWindow"));
@@ -133,14 +140,14 @@ RekonqWindow::RekonqWindow(QWidget* parent)
{
parseGeometry();
}
-
- setWindowTitle( KGlobal::caption() );
+
+ setWindowTitle(KGlobal::caption());
}
RekonqWindow::~RekonqWindow()
{
- sWindowList->removeAll( this );
+ sWindowList->removeAll(this);
KSharedConfig::Ptr cf = KGlobal::config();
KConfigGroup cg(cf, QL1S("TabWindow"));
@@ -150,11 +157,11 @@ RekonqWindow::~RekonqWindow()
QList<RekonqWindow*> RekonqWindow::windowList()
{
- return *sWindowList;
+ return *sWindowList;
}
-void RekonqWindow::savePropertiesInternal( KConfig *config, int number )
+void RekonqWindow::savePropertiesInternal(KConfig *config, int number)
{
QString s;
s.setNum(number);
@@ -174,7 +181,7 @@ void RekonqWindow::savePropertiesInternal( KConfig *config, int number )
}
-bool RekonqWindow::readPropertiesInternal( KConfig *config, int number )
+bool RekonqWindow::readPropertiesInternal(KConfig *config, int number)
{
// in order they are in toolbar list
QString s;
@@ -184,8 +191,8 @@ bool RekonqWindow::readPropertiesInternal( KConfig *config, int number )
KConfigGroup cg(config, s);
// restore the object name (window role)
- if ( cg.hasKey(QL1S("ObjectName" )) )
- setObjectName( cg.readEntry("ObjectName").toLatin1()); // latin1 is right here
+ if (cg.hasKey(QL1S("ObjectName")))
+ setObjectName(cg.readEntry("ObjectName").toLatin1()); // latin1 is right here
restoreWindowSize(cg);
@@ -197,7 +204,7 @@ bool RekonqWindow::readPropertiesInternal( KConfig *config, int number )
}
-void RekonqWindow::restoreWindowSize( const KConfigGroup & _cg )
+void RekonqWindow::restoreWindowSize(const KConfigGroup & _cg)
{
int scnum = QApplication::desktop()->screenNumber(window());
QRect desktopRect = QApplication::desktop()->screenGeometry(scnum);
@@ -207,22 +214,22 @@ void RekonqWindow::restoreWindowSize( const KConfigGroup & _cg )
KConfigGroup cg(_cg);
QString widthString = QString::fromLatin1("Width %1").arg(desktopRect.width());
- int w = cg.readEntry(widthString, defaultSize.width() );
+ int w = cg.readEntry(widthString, defaultSize.width());
QString heightString = QString::fromLatin1("Height %1").arg(desktopRect.height());
- int h = cg.readEntry(heightString, defaultSize.height() );
+ int h = cg.readEntry(heightString, defaultSize.height());
resize(w, h);
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desktopRect.width()).arg(desktopRect.height());
- QByteArray geometry = cg.readEntry( geometryKey, QByteArray() );
+ QByteArray geometry = cg.readEntry(geometryKey, QByteArray());
// if first time run, center window
- if (!restoreGeometry( QByteArray::fromBase64(geometry) ))
- move( (desktopRect.width()-width())/2, (desktopRect.height()-height())/2 );
+ if (!restoreGeometry(QByteArray::fromBase64(geometry)))
+ move((desktopRect.width() - width()) / 2, (desktopRect.height() - height()) / 2);
}
-void RekonqWindow::saveWindowSize( const KConfigGroup & _cg ) const
+void RekonqWindow::saveWindowSize(const KConfigGroup & _cg) const
{
int scnum = QApplication::desktop()->screenNumber(window());
QRect desktopRect = QApplication::desktop()->screenGeometry(scnum);
@@ -242,15 +249,15 @@ void RekonqWindow::saveWindowSize( const KConfigGroup & _cg ) const
KConfigGroup cg(_cg);
QString widthString = QString::fromLatin1("Width %1").arg(desktopRect.width());
- cg.writeEntry(widthString, w );
+ cg.writeEntry(widthString, w);
QString heightString = QString::fromLatin1("Height %1").arg(desktopRect.height());
- cg.writeEntry(heightString, h );
+ cg.writeEntry(heightString, h);
// geometry is saved separately for each resolution
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desktopRect.width()).arg(desktopRect.height());
QByteArray geometry = saveGeometry();
- cg.writeEntry( geometryKey, geometry.toBase64() );
+ cg.writeEntry(geometryKey, geometry.toBase64());
}
@@ -261,7 +268,7 @@ void RekonqWindow::parseGeometry()
if (args->isSet("geometry"))
cmdlineGeometry = args->getOption("geometry");
- Q_ASSERT ( !cmdlineGeometry.isNull() );
+ Q_ASSERT(!cmdlineGeometry.isNull());
// #if defined Q_WS_X11
// int x, y;
@@ -288,7 +295,7 @@ void RekonqWindow::parseGeometry()
// y = KApplication::desktop()->height() + y - h;
// else if ( (m & YValue) )
// y = geometry().y();
-//
+//
// move(x, y);
// }
// #endif
@@ -312,27 +319,28 @@ void RekonqWindow::saveAutoSaveSettings()
}
-bool RekonqWindow::canBeRestored( int number )
+bool RekonqWindow::canBeRestored(int number)
{
- if ( !qApp->isSessionRestored() )
+ if (!qApp->isSessionRestored())
return false;
KConfig *config = kapp->sessionConfig();
- if ( !config )
+ if (!config)
return false;
- KConfigGroup group( config, "Number" );
- const int n = group.readEntry( "NumberOfWindows", 1 );
+ KConfigGroup group(config, "Number");
+ const int n = group.readEntry("NumberOfWindows", 1);
return number >= 1 && number <= n;
}
-bool RekonqWindow::restore( int number, bool show )
+bool RekonqWindow::restore(int number, bool show)
{
- if ( !canBeRestored( number ) )
+ if (!canBeRestored(number))
return false;
KConfig *config = kapp->sessionConfig();
- if ( readPropertiesInternal( config, number ) ){
- if ( show )
+ if (readPropertiesInternal(config, number))
+ {
+ if (show)
RekonqWindow::show();
return false;
}
diff --git a/src/tabwindow/rekonqwindow.h b/src/tabwindow/rekonqwindow.h
index b3f2f698..c7fe80d1 100644
--- a/src/tabwindow/rekonqwindow.h
+++ b/src/tabwindow/rekonqwindow.h
@@ -52,11 +52,11 @@
class RekonqWindow : public KTabWidget
{
friend class KRWSessionManager;
-
+
Q_OBJECT
public:
- explicit RekonqWindow( QWidget* parent = 0 );
+ explicit RekonqWindow(QWidget* parent = 0);
virtual ~RekonqWindow();
@@ -70,16 +70,16 @@ public:
* else @p false.
* @see restore()
**/
- static bool canBeRestored( int number );
+ static bool canBeRestored(int number);
/**
* Try to restore the toplevel widget as defined by @p number (1..X).
*
* You should call canBeRestored() first.
- *
+ *
**/
- bool restore( int number, bool show = true );
-
+ bool restore(int number, bool show = true);
+
protected:
/**
* Save your instance-specific properties. The function is
@@ -92,33 +92,33 @@ protected:
* in this function!
*
*/
- virtual void saveProperties( KConfigGroup & ) {}
+ virtual void saveProperties(KConfigGroup &) {}
/**
* Read your instance-specific properties.
*
* Is called indirectly by restore().
*/
- virtual void readProperties( const KConfigGroup & ) {}
+ virtual void readProperties(const KConfigGroup &) {}
- void savePropertiesInternal( KConfig*, int );
- bool readPropertiesInternal( KConfig*, int );
+ void savePropertiesInternal(KConfig*, int);
+ bool readPropertiesInternal(KConfig*, int);
/**
* For inherited classes
*/
- void saveWindowSize( const KConfigGroup &config ) const;
+ void saveWindowSize(const KConfigGroup &config) const;
/**
* For inherited classes
* Note that a -geometry on the command line has priority.
*/
- void restoreWindowSize( const KConfigGroup & config );
+ void restoreWindowSize(const KConfigGroup & config);
/// parse the geometry from the geometry command line argument
void parseGeometry();
virtual void resizeEvent(QResizeEvent *);
-
+
private Q_SLOTS:
void saveAutoSaveSettings();
diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp
index 91d5e402..18393cf9 100644
--- a/src/tabwindow/tabbar.cpp
+++ b/src/tabwindow/tabbar.cpp
@@ -304,7 +304,7 @@ void TabBar::setTabHighlighted(int index, bool b)
connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
setTabTextColor(index, highlightColor);
- }
+ }
}
@@ -354,7 +354,7 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
&& tabIndex != currentIndex()
&& m_currentTabPreviewIndex != tabIndex
&& event->buttons() == Qt::NoButton
- )
+ )
{
m_currentTabPreviewIndex = tabIndex;
@@ -384,7 +384,7 @@ void TabBar::leaveEvent(QEvent *event)
void TabBar::mousePressEvent(QMouseEvent *event)
{
hideTabPreview();
-
+
// just close tab on middle mouse click
if (event->button() == Qt::MidButton)
return;
@@ -424,8 +424,8 @@ void TabBar::showTabPreview()
int w = c_baseTabWidth;
int h = w * tabW->size().height() / tabW->size().width();
-
- m_previewPopup = new TabPreviewPopup(indexedTab->tabPreview(w,h), indexedTab->url().url() , this);
+
+ m_previewPopup = new TabPreviewPopup(indexedTab->tabPreview(w, h), indexedTab->url().url() , this);
int tabBarWidth = tabW->size().width();
int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - w) / 2;
diff --git a/src/tabwindow/tabbar.h b/src/tabwindow/tabbar.h
index 8dcab051..d0228683 100644
--- a/src/tabwindow/tabbar.h
+++ b/src/tabwindow/tabbar.h
@@ -42,7 +42,7 @@ class TabPreviewPopup;
class TabHighlightEffect;
class QSignalMapper;
-
+
class TabBar : public KTabBar
{
@@ -63,7 +63,7 @@ protected:
virtual void tabRemoved(int index);
virtual void tabLayoutChange();
-
+
Q_SIGNALS:
void cloneTab(int);
void closeTab(int);
@@ -72,7 +72,7 @@ Q_SIGNALS:
void detachTab(int);
void restoreClosedTab(int);
void tabLayoutChanged();
-
+
private Q_SLOTS:
void cloneTab();
void closeTab();
diff --git a/src/tabwindow/tabpreviewpopup.h b/src/tabwindow/tabpreviewpopup.h
index 37d270c7..3269f3de 100644
--- a/src/tabwindow/tabpreviewpopup.h
+++ b/src/tabwindow/tabpreviewpopup.h
@@ -44,7 +44,7 @@ class QString;
class TabPreviewPopup : public KPassivePopup
{
Q_OBJECT
-
+
public:
TabPreviewPopup(const QPixmap &pixmap, const QString &urlText, QWidget *parent = 0);
virtual ~TabPreviewPopup();
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 4d4cdab3..ba355e51 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -88,7 +88,7 @@ TabWindow::TabWindow(bool withTab, QWidget *parent)
connect(tabBar, SIGNAL(restoreClosedTab(int)), this, SLOT(restoreClosedTab(int)));
connect(tabBar, SIGNAL(tabLayoutChanged()), this, SLOT(updateNewTabButtonPosition()));
-
+
// new tab button
KAction* a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
_addTabButton->setDefaultAction(a);
@@ -160,7 +160,7 @@ void TabWindow::loadUrl(const KUrl &url, Rekonq::OpenType type, TabHistory *hist
tab = prepareNewTab();
addTab(tab, i18n("new tab"));
break;
-
+
case Rekonq::NewFocusedTab:
tab = prepareNewTab();
addTab(tab, i18n("new tab"));
@@ -207,7 +207,7 @@ void TabWindow::pageCreated(WebPage *page)
void TabWindow::currentChanged(int newIndex)
{
_openedTabsCounter = 0;
-
+
tabBar()->setTabHighlighted(newIndex, false);
// update window title & icon
@@ -217,8 +217,8 @@ void TabWindow::currentChanged(int newIndex)
QString t = tab->title();
(t.isEmpty())
- ? setWindowTitle(QL1S("rekonq"))
- : setWindowTitle(t + QL1S(" - rekonq"));
+ ? setWindowTitle(QL1S("rekonq"))
+ : setWindowTitle(t + QL1S(" - rekonq"));
}
@@ -248,7 +248,7 @@ void TabWindow::tabTitleChanged(const QString &title)
return;
bool emptyTitle = title.isEmpty();
-
+
QString tabTitle = emptyTitle ? tab->url().url() : title;
tabTitle.replace('&', "&&");
@@ -266,8 +266,8 @@ void TabWindow::tabTitleChanged(const QString &title)
else
{
emptyTitle
- ? setWindowTitle(QL1S("rekonq"))
- : setWindowTitle(tabTitle + QL1S(" - rekonq"));
+ ? setWindowTitle(QL1S("rekonq"))
+ : setWindowTitle(tabTitle + QL1S(" - rekonq"));
}
}
@@ -423,7 +423,7 @@ void TabWindow::detachTab(int index, TabWindow *toWindow)
// else
closeTab(index, false);
-
+
TabWindow *w = 0;
w = (toWindow == 0)
? new TabWindow(false)
diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h
index 9dda54c3..750cac5f 100644
--- a/src/tabwindow/tabwindow.h
+++ b/src/tabwindow/tabwindow.h
@@ -60,7 +60,7 @@ class TabWindow : public RekonqWindow
public:
TabWindow(bool withTab = true, QWidget *parent = 0);
-
+
WebWindow* currentWebWindow() const;
WebWindow* webWindow(int index) const;
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index 86bd9101..f001c47b 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -486,7 +486,7 @@ EngineBar::EngineBar(KService::Ptr selectedEngine, QWidget *parent)
if (SearchEngine::defaultEngine().isNull())
return;
-
+
m_engineGroup->addAction(newEngineAction(SearchEngine::defaultEngine(), selectedEngine));
Q_FOREACH(const KService::Ptr & engine, SearchEngine::favorites())
{
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index a994ea95..db24188b 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -643,7 +643,7 @@ void UrlBar::detectTypedString(const QString &typed)
void UrlBar::suggest()
{
- kDebug() << "SUGGEST ABOUT DIGITED: " << text();
+ kDebug() << "SUGGEST ABOUT DIGITED: " << text();
if (!_box.isNull())
_box.data()->suggestUrls(text());
}
@@ -663,7 +663,7 @@ void UrlBar::refreshFavicon()
_icon->setIcon(KIcon("arrow-right"));
return;
}
-
+
_icon->setIcon(IconManager::self()->iconForUrl(u));
}
@@ -746,7 +746,7 @@ void UrlBar::manageFavorites(QPoint pos)
// also, save a site snapshot
WebSnap *snap = new WebSnap(_tab->url(), this);
Q_UNUSED(snap);
-
+
updateRightIcons();
}
diff --git a/src/urlbar/urlsuggester.cpp b/src/urlbar/urlsuggester.cpp
index 83108a36..90ff2320 100644
--- a/src/urlbar/urlsuggester.cpp
+++ b/src/urlbar/urlsuggester.cpp
@@ -294,7 +294,7 @@ void UrlSuggester::computeWebSearches()
{
QString query = _typedString;
- // this result is generated when an user types something like gg:kde
+ // this result is generated when an user types something like gg:kde
KService::Ptr engine = SearchEngine::fromString(_typedString);
if (engine)
{
@@ -305,7 +305,7 @@ void UrlSuggester::computeWebSearches()
{
engine = SearchEngine::defaultEngine();
}
-
+
UrlSuggestionItem item = UrlSuggestionItem(UrlSuggestionItem::Search, SearchEngine::buildQuery(engine, query), query, engine->name());
UrlSuggestionList list;
list << item;
@@ -382,20 +382,20 @@ void UrlSuggester::computeSuggestions()
// {
// if (text != _typedString)
// return;
-//
+//
// UrlSuggestionList sugList;
// QString urlString;
// Q_FOREACH(const Response & i, suggestions)
// {
// if (text == i.title)
// continue;
-//
+//
// urlString = i.url;
// if (urlString.isEmpty())
// {
// urlString = SearchEngine::buildQuery(UrlSuggester::searchEngine(), i.title);
// }
-//
+//
// UrlSuggestionItem gItem(UrlSuggestionItem::Suggestion, urlString, i.title, i.description, i.image, i.image_width, i.image_height);
// sugList << gItem;
// }
diff --git a/src/urlbar/urlsuggester.h b/src/urlbar/urlsuggester.h
index d7673c3a..edbe116a 100644
--- a/src/urlbar/urlsuggester.h
+++ b/src/urlbar/urlsuggester.h
@@ -84,13 +84,13 @@ public:
{};
UrlSuggestionItem(const int &_type,
- const QString &_url,
- const QString &_title = QString(),
- const QString &_description = QString(),
- const QString &_image = QString(),
- const int &_image_width = 0,
- const int &_image_height = 0
- )
+ const QString &_url,
+ const QString &_title = QString(),
+ const QString &_description = QString(),
+ const QString &_image = QString(),
+ const int &_image_width = 0,
+ const int &_image_height = 0
+ )
: type(_type)
, url(_url)
, title(_title)
@@ -147,7 +147,7 @@ private:
UrlSuggestionList _suggestions;
bool _webSearchFirst;
-
+
static QRegExp _browseRegexp;
static QRegExp _searchEnginesRegexp;
};
diff --git a/src/webtab/networkaccessmanager.cpp b/src/webtab/networkaccessmanager.cpp
index e817faca..95bfa47d 100644
--- a/src/webtab/networkaccessmanager.cpp
+++ b/src/webtab/networkaccessmanager.cpp
@@ -85,15 +85,15 @@ static void hideBlockedElements(const QUrl& url, QWebElementCollection& collecti
{
for (QWebElementCollection::iterator it = collection.begin(); it != collection.end(); ++it)
{
- const QUrl baseUrl ((*it).webFrame()->baseUrl());
+ const QUrl baseUrl((*it).webFrame()->baseUrl());
QString src = (*it).attribute(QL1S("src"));
-
+
if (src.isEmpty())
src = (*it).evaluateJavaScript(QL1S("this.src")).toString();
if (src.isEmpty())
continue;
- const QUrl resolvedUrl (baseUrl.resolved(src));
+ const QUrl resolvedUrl(baseUrl.resolved(src));
if (url == resolvedUrl)
{
//kDebug() << "*** HIDING ELEMENT: " << (*it).tagName() << resolvedUrl;
@@ -125,11 +125,11 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent)
QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData)
{
bool blocked = false;
-
+
// Handle GET operations with AdBlock
if (op == QNetworkAccessManager::GetOperation)
blocked = AdBlockManager::self()->blockRequest(req);
-
+
if (!blocked)
{
if (KProtocolInfo::isHelperProtocol(req.url()))
@@ -162,10 +162,10 @@ void NetworkAccessManager::slotFinished(bool ok)
if (!ok)
return;
- if(!AdBlockManager::self()->isEnabled())
+ if (!AdBlockManager::self()->isEnabled())
return;
- if(!AdBlockManager::self()->isHidingElements())
+ if (!AdBlockManager::self()->isHidingElements())
return;
QWebFrame* frame = qobject_cast<QWebFrame*>(sender());
@@ -176,10 +176,10 @@ void NetworkAccessManager::slotFinished(bool ok)
if (urls.isEmpty())
return;
- QWebElementCollection collection = frame->findAllElements(HIDABLE_ELEMENTS);
- if (frame->parentFrame())
+ QWebElementCollection collection = frame->findAllElements(HIDABLE_ELEMENTS);
+ if (frame->parentFrame())
collection += frame->parentFrame()->findAllElements(HIDABLE_ELEMENTS);
- Q_FOREACH(const QUrl& url, urls)
- hideBlockedElements(url, collection);
+ Q_FOREACH(const QUrl & url, urls)
+ hideBlockedElements(url, collection);
}
diff --git a/src/webtab/previewselectorbar.cpp b/src/webtab/previewselectorbar.cpp
index 24461e79..b37b000c 100644
--- a/src/webtab/previewselectorbar.cpp
+++ b/src/webtab/previewselectorbar.cpp
@@ -101,7 +101,7 @@ void PreviewSelectorBar::loadFinished()
void PreviewSelectorBar::clicked()
{
WebTab *tab = qobject_cast<WebTab *>(parent());
-
+
if (tab->page())
{
KUrl url = tab->url();
diff --git a/src/webtab/protocolhandler.cpp b/src/webtab/protocolhandler.cpp
index bca5a007..ab2f0b8e 100644
--- a/src/webtab/protocolhandler.cpp
+++ b/src/webtab/protocolhandler.cpp
@@ -99,7 +99,7 @@ ProtocolHandler::ProtocolHandler(QObject *parent)
void ProtocolHandler::setWindow(WebWindow *w)
{
_webwin = w;
- _lister->setMainWindow(_webwin);
+ _lister->setMainWindow(_webwin);
}
@@ -276,7 +276,7 @@ void ProtocolHandler::showResults(const KFileItemList &list)
_webwin->urlBar()->setQUrl(_url);
_webwin->view()->setFocus();
-
+
HistoryManager::self()->addHistoryEntry(_url, _url.prettyUrl());
}
}
diff --git a/src/webtab/protocolhandler.h b/src/webtab/protocolhandler.h
index c4bc6faf..7d685ea4 100644
--- a/src/webtab/protocolhandler.h
+++ b/src/webtab/protocolhandler.h
@@ -68,7 +68,7 @@ public:
bool postHandling(const QNetworkRequest &request, QWebFrame *frame);
void setWindow(WebWindow *);
-
+
Q_SIGNALS:
void downloadUrl(const KUrl &);
diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp
index 385a6ac3..cb4ea373 100644
--- a/src/webtab/webpage.cpp
+++ b/src/webtab/webpage.cpp
@@ -131,7 +131,7 @@ WebPage::WebPage(QWidget *parent)
WebTab *tab = qobject_cast<WebTab *>(view->parent());
WebWindow *w = tab->webWindow();
_protHandler.setWindow(w);
-
+
// handling unsupported content...
setForwardUnsupportedContent(true);
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*)));
@@ -425,7 +425,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
WebView *view = qobject_cast<WebView *>(parent());
WebTab *tab = qobject_cast<WebTab *>(view->parent());
tab->setPart(pa, replyUrl);
-
+
// FIXME: Is this enough?
}
else
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp
index e53d7b48..bc40ecca 100644
--- a/src/webtab/webtab.cpp
+++ b/src/webtab/webtab.cpp
@@ -133,7 +133,7 @@ WebWindow *WebTab::webWindow()
WebWindow *w = qobject_cast<WebWindow *>(parent());
return w;
}
-
+
KUrl WebTab::url()
{
if (page() && page()->isOnRekonqPage())
diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h
index 8b60f0ff..a0e6890d 100644
--- a/src/webtab/webtab.h
+++ b/src/webtab/webtab.h
@@ -62,7 +62,7 @@ public:
WebView *view();
WebPage *page();
WebWindow *webWindow();
-
+
inline int progress() const
{
return m_progress;
diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp
index 06412198..5cb5e81d 100644
--- a/src/webtab/webview.cpp
+++ b/src/webtab/webview.cpp
@@ -54,6 +54,10 @@
#include <KStandardDirs>
#include <KToolInvocation>
+#include <sonnet/speller.h>
+#include <Sonnet/Dialog>
+#include <sonnet/backgroundchecker.h>
+
// Qt Includes
#include <QFile>
#include <QTimer>
@@ -68,6 +72,19 @@
#include <QNetworkRequest>
+// needed for the spellCheck
+static QVariant execJScript(QWebHitTestResult result, const QString& script)
+{
+ QWebElement element(result.element());
+ if (element.isNull())
+ return QVariant();
+ return element.evaluateJavaScript(script);
+}
+
+
+// --------------------------------------------------------------------------------------------------
+
+
WebView::WebView(QWidget* parent)
: KWebView(parent, false)
, m_autoScrollTimer(new QTimer(this))
@@ -141,9 +158,103 @@ WebPage *WebView::page()
}
+bool WebView::popupSpellMenu(QContextMenuEvent *event)
+{
+ // return false if not handled
+ if (!ReKonfig::automaticSpellChecking())
+ return false;
+
+ QWebElement element(m_contextMenuHitResult.element());
+ if (element.isNull())
+ return false;
+
+ int selStart = element.evaluateJavaScript("this.selectionStart").toInt();
+ int selEnd = element.evaluateJavaScript("this.selectionEnd").toInt();
+ if (selEnd != selStart)
+ return false; // selection, handle normally
+
+ // No selection - Spell Checking only
+ // Get word
+ QString text = element.evaluateJavaScript("this.value").toString();
+ QRegExp ws("\\b");
+ int s1 = text.lastIndexOf(ws, selStart);
+ int s2 = text.indexOf(ws, selStart);
+ QString word = text.mid(s1, s2 - s1).trimmed();
+
+ // sanity check
+ if (word.isEmpty())
+ return false;
+
+ kDebug() << s1 << ":" << s2 << ":" << word << ":";
+ Sonnet::Speller spellor;
+ if (spellor.isCorrect(word))
+ return false; // no need to popup spell menu
+
+ // find alternates
+ QStringList words = spellor.suggest(word);
+
+ // Construct popup menu
+ QMenu mnu(this);
+
+ // Add alternates
+ if (words.isEmpty())
+ {
+ QAction *a = mnu.addAction(i18n("No suggestions for ") + word);
+ a->setEnabled(false);
+ }
+ else
+ {
+ QStringListIterator it(words);
+ while (it.hasNext())
+ {
+ QString w = it.next();
+ QAction *aWord = mnu.addAction(w);
+ aWord->setData(w);
+ }
+ }
+
+ // Add dictionary options
+ mnu.addSeparator();
+ QAction *aIgnore = mnu.addAction(i18n("Ignore"));
+ QAction *aAddToDict = mnu.addAction(i18n("Add to Dictionary"));
+
+ QAction *aSpellChoice = mnu.exec(event->globalPos());
+ if (aSpellChoice)
+ {
+ if (aSpellChoice == aAddToDict)
+ spellor.addToPersonal(word);
+ else if (aSpellChoice == aIgnore)
+ {
+ // Ignore :)
+ }
+ else
+ {
+ // Choose a replacement word
+ QString w = aSpellChoice->data().toString();
+ if (!w.isEmpty())
+ {
+ // replace word
+ QString script(QL1S("this.value=this.value.substring(0,"));
+ script += QString::number(s1);
+ script += QL1S(") + \"");
+ script += w;
+ script += QL1S("\" + this.value.substring(");
+ script += QString::number(s2);
+ script += QL1S(")");
+ element.evaluateJavaScript(script);
+ // reposition cursor
+ element.evaluateJavaScript("this.selectionEnd=this.selectionStart=" + QString::number(selStart) + ";");
+ }
+ }
+ }
+
+ return true;
+}
+
+
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
- QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
+ m_contextMenuHitResult = page()->mainFrame()->hitTestContent(event->pos());
WebTab *tab = qobject_cast<WebTab *>(parent());
WebWindow *webwin = tab->webWindow();
@@ -159,23 +270,27 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
// Choose right context
int resultHit = 0;
- if (result.linkUrl().isEmpty())
+ if (m_contextMenuHitResult.linkUrl().isEmpty())
resultHit = WebView::EmptySelection;
else
resultHit = WebView::LinkSelection;
- if (!result.pixmap().isNull())
+ if (!m_contextMenuHitResult.pixmap().isNull())
resultHit |= WebView::ImageSelection;
- if (result.isContentSelected())
+ if (m_contextMenuHitResult.isContentSelected())
resultHit = WebView::TextSelection;
// --------------------------------------------------------------------------------
// Ok, let's start filling up the menu...
// is content editable? Add PASTE
- if (result.isContentEditable())
+ if (m_contextMenuHitResult.isContentEditable())
{
+ // Check to see if handled by speller
+ if (popupSpellMenu(event))
+ return;
+
menu.addAction(pageAction(KWebPage::Paste));
menu.addSeparator();
}
@@ -241,16 +356,16 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (resultHit & WebView::LinkSelection)
{
// send by mail: link url
- sendByMailAction->setData(result.linkUrl());
+ sendByMailAction->setData(m_contextMenuHitResult.linkUrl());
sendByMailAction->setText(i18n("Share link"));
a = new KAction(KIcon("tab-new"), i18n("Open in New &Tab"), this);
- a->setData(result.linkUrl());
+ a->setData(m_contextMenuHitResult.linkUrl());
connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab()));
menu.addAction(a);
a = new KAction(KIcon("window-new"), i18n("Open in New &Window"), this);
- a->setData(result.linkUrl());
+ a->setData(m_contextMenuHitResult.linkUrl());
connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
menu.addAction(a);
@@ -271,13 +386,13 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (resultHit & WebView::ImageSelection)
{
// send by mail: image url
- sendByMailAction->setData(result.imageUrl());
+ sendByMailAction->setData(m_contextMenuHitResult.imageUrl());
sendByMailAction->setText(i18n("Share image link"));
menu.addSeparator();
a = new KAction(KIcon("view-preview"), i18n("&View Image"), this);
- a->setData(result.imageUrl());
+ a->setData(m_contextMenuHitResult.imageUrl());
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)),
this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers)));
menu.addAction(a);
@@ -285,14 +400,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(pageAction(KWebPage::DownloadImageToDisk));
a = new KAction(KIcon("view-media-visualization"), i18n("&Copy Image Location"), this);
- a->setData(result.imageUrl());
+ a->setData(m_contextMenuHitResult.imageUrl());
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(slotCopyImageLocation()));
menu.addAction(a);
if (AdBlockManager::self()->isEnabled())
{
a = new KAction(KIcon("preferences-web-browser-adblock"), i18n("Block image"), this);
- a->setData(result.imageUrl());
+ a->setData(m_contextMenuHitResult.imageUrl());
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(blockImage()));
menu.addAction(a);
}
@@ -305,22 +420,22 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
sendByMailAction->setData(selectedText());
sendByMailAction->setText(i18n("Share selected text"));
- if (result.isContentEditable())
+ if (m_contextMenuHitResult.isContentEditable())
{
// actions for text selected in field
menu.addAction(pageAction(KWebPage::Cut));
}
a = pageAction(KWebPage::Copy);
- if (!result.linkUrl().isEmpty())
+ if (!m_contextMenuHitResult.linkUrl().isEmpty())
a->setText(i18n("Copy Text")); //for link
else
a->setText(i18n("Copy"));
menu.addAction(a);
if (selectedText().contains('.')
- && selectedText().indexOf('.') < selectedText().length()
- && !selectedText().trimmed().contains(" ")
+ && selectedText().indexOf('.') < selectedText().length()
+ && !selectedText().trimmed().contains(" ")
)
{
QString text = selectedText();
@@ -336,13 +451,16 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
truncatedUrl.truncate(truncateSize);
truncatedUrl += QL1S("...");
}
- //open selected text url in a new tab
- QAction * const openInNewTabAction = new KAction(KIcon("tab-new"), i18n("Open '%1' in New Tab", truncatedUrl), this);
+
+ // open selected text url in a new tab
+ QAction * const openInNewTabAction = new KAction(KIcon("tab-new"),
+ i18n("Open '%1' in New Tab", truncatedUrl), this);
openInNewTabAction->setData(QUrl(urlLikeText));
connect(openInNewTabAction, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab()));
menu.addAction(openInNewTabAction);
//open selected text url in a new window
- QAction * const openInNewWindowAction = new KAction(KIcon("window-new"), i18n("Open '%1' in New Window", truncatedUrl), this);
+ QAction * const openInNewWindowAction = new KAction(KIcon("window-new"),
+ i18n("Open '%1' in New Window", truncatedUrl), this);
openInNewWindowAction->setData(QUrl(urlLikeText));
connect(openInNewWindowAction, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
menu.addAction(openInNewWindowAction);
@@ -388,7 +506,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (resultHit & WebView::LinkSelection)
{
a = new KAction(KIcon("bookmark-new"), i18n("&Bookmark link"), this);
- a->setData(result.linkUrl());
+ a->setData(m_contextMenuHitResult.linkUrl());
connect(a, SIGNAL(triggered(bool)), this, SLOT(bookmarkLink()));
menu.addAction(a);
}
@@ -400,6 +518,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(sendByMailAction);
menu.addAction(inspectAction);
+ // SPELL CHECK Actions
+ if (m_contextMenuHitResult.isContentEditable())
+ {
+ menu.addSeparator();
+ a = KStandardAction::spelling(this, SLOT(spellCheck()), this);
+ menu.addAction(a);
+ }
+
// finally launch the menu...
menu.exec(mapToGlobal(event->pos()));
}
@@ -1256,3 +1382,86 @@ void WebView::mouseReleaseEvent(QMouseEvent *event)
QWebView::mouseReleaseEvent(event);
}
+
+
+void WebView::spellCheck()
+{
+ QString text(execJScript(m_contextMenuHitResult, QL1S("this.value")).toString());
+
+ if (m_contextMenuHitResult.isContentSelected())
+ {
+ m_spellTextSelectionStart = qMax(0, execJScript(m_contextMenuHitResult, QL1S("this.selectionStart")).toInt());
+ m_spellTextSelectionEnd = qMax(0, execJScript(m_contextMenuHitResult, QL1S("this.selectionEnd")).toInt());
+ text = text.mid(m_spellTextSelectionStart, (m_spellTextSelectionEnd - m_spellTextSelectionStart));
+ }
+ else
+ {
+ m_spellTextSelectionStart = 0;
+ m_spellTextSelectionEnd = 0;
+ }
+
+ if (text.isEmpty())
+ {
+ return;
+ }
+
+ Sonnet::Dialog* spellDialog = new Sonnet::Dialog(new Sonnet::BackgroundChecker(this), this);
+
+ spellDialog->showSpellCheckCompletionMessage(true);
+ connect(spellDialog, SIGNAL(replace(QString, int, QString)), this, SLOT(spellCheckerCorrected(QString, int, QString)));
+ connect(spellDialog, SIGNAL(misspelling(QString, int)), this, SLOT(spellCheckerMisspelling(QString, int)));
+ if (m_contextMenuHitResult.isContentSelected())
+ connect(spellDialog, SIGNAL(done(QString)), this, SLOT(slotSpellCheckDone(QString)));
+ spellDialog->setBuffer(text);
+ spellDialog->show();
+}
+
+
+void WebView::spellCheckerCorrected(const QString& original, int pos, const QString& replacement)
+{
+ // Adjust the selection end...
+ if (m_spellTextSelectionEnd > 0)
+ {
+ m_spellTextSelectionEnd += qMax(0, (replacement.length() - original.length()));
+ }
+
+ const int index = pos + m_spellTextSelectionStart;
+ QString script(QL1S("this.value=this.value.substring(0,"));
+ script += QString::number(index);
+ script += QL1S(") + \"");
+ script += replacement;
+ script += QL1S("\" + this.value.substring(");
+ script += QString::number(index + original.length());
+ script += QL1S(")");
+
+ //kDebug() << "**** script:" << script;
+ execJScript(m_contextMenuHitResult, script);
+}
+
+
+void WebView::spellCheckerMisspelling(const QString& text, int pos)
+{
+ // kDebug() << text << pos;
+ QString selectionScript(QL1S("this.setSelectionRange("));
+ selectionScript += QString::number(pos + m_spellTextSelectionStart);
+ selectionScript += QL1C(',');
+ selectionScript += QString::number(pos + text.length() + m_spellTextSelectionStart);
+ selectionScript += QL1C(')');
+ execJScript(m_contextMenuHitResult, selectionScript);
+}
+
+
+void WebView::slotSpellCheckDone(const QString&)
+{
+ // Restore the text selection if one was present before we started the
+ // spell check.
+ if (m_spellTextSelectionStart > 0 || m_spellTextSelectionEnd > 0)
+ {
+ QString script(QL1S("; this.setSelectionRange("));
+ script += QString::number(m_spellTextSelectionStart);
+ script += QL1C(',');
+ script += QString::number(m_spellTextSelectionEnd);
+ script += QL1C(')');
+ execJScript(m_contextMenuHitResult, script);
+ }
+}
diff --git a/src/webtab/webview.h b/src/webtab/webview.h
index b1648d0d..5487a59f 100644
--- a/src/webtab/webview.h
+++ b/src/webtab/webview.h
@@ -39,6 +39,7 @@
#include <QTime>
#include <QPoint>
#include <QPixmap>
+#include <QWebHitTestResult>
// Forward Declarations
class WebPage;
@@ -72,6 +73,7 @@ public:
const QByteArray & body = QByteArray());
protected:
+ bool popupSpellMenu(QContextMenuEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -95,6 +97,10 @@ private Q_SLOTS:
void openLinkInNewWindow();
void openLinkInNewTab();
void bookmarkLink();
+ void spellCheck();
+ void spellCheckerCorrected(const QString& original, int pos, const QString& replacement);
+ void spellCheckerMisspelling(const QString& text, int pos);
+ void slotSpellCheckDone(const QString&);
void sendByMail();
void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
@@ -130,6 +136,11 @@ private:
private:
QPoint m_clickPos;
+ QWebHitTestResult m_contextMenuHitResult;
+
+ // Spell Checking
+ int m_spellTextSelectionStart;
+ int m_spellTextSelectionEnd;
// Auto Scroll
QTimer *const m_autoScrollTimer;
diff --git a/src/webwindow/findbar.cpp b/src/webwindow/findbar.cpp
index 8e6a98a6..e95f860e 100644
--- a/src/webwindow/findbar.cpp
+++ b/src/webwindow/findbar.cpp
@@ -133,7 +133,7 @@ void FindBar::keyPressEvent(QKeyEvent *event)
findNext();
}
}
-
+
QWidget::keyPressEvent(event);
}
@@ -156,8 +156,8 @@ void FindBar::setVisible(bool visible)
WebWindow *w = qobject_cast<WebWindow *>(parent());
if (visible
- && w->page()->isOnRekonqPage()
- && w->view()->part() != 0)
+ && w->page()->isOnRekonqPage()
+ && w->view()->part() != 0)
{
// findNext is the slot containing part integration code
findNext();
diff --git a/src/webwindow/rekonqfactory.cpp b/src/webwindow/rekonqfactory.cpp
index 8b09c0bd..163935a3 100644
--- a/src/webwindow/rekonqfactory.cpp
+++ b/src/webwindow/rekonqfactory.cpp
@@ -74,7 +74,7 @@ bool readDocument(QDomDocument & document, const QString & filePath)
QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActionCollection *ac)
{
QDomDocument document("rekonqui.rc");
- QString xmlFilePath = KStandardDirs::locate( "data", "rekonq/rekonqui.rc");
+ QString xmlFilePath = KStandardDirs::locate("data", "rekonq/rekonqui.rc");
if (!readDocument(document, xmlFilePath))
return 0;
@@ -87,7 +87,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
return 0;
}
- for(unsigned int i = 0; i < elementToolbarList.length(); ++i)
+ for (unsigned int i = 0; i < elementToolbarList.length(); ++i)
{
QDomNode node = elementToolbarList.at(i);
QDomElement element = node.toElement();
@@ -123,7 +123,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
return 0;
}
- for(unsigned int i = 0; i < elementMenuList.length(); ++i)
+ for (unsigned int i = 0; i < elementMenuList.length(); ++i)
{
QDomNode node = elementMenuList.at(i);
QDomElement element = node.toElement();
@@ -147,15 +147,15 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
KHelpMenu *m = new KHelpMenu(parent, KCmdLineArgs::aboutData());
return m->menu();
}
- else
+ else
{
KMenu *m = new KMenu(parent);
fillMenu(m, node, ac);
return m;
}
-
+
}
-
+
kDebug() << "NO WIDGET RETURNED";
return 0;
}
@@ -164,7 +164,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *ac)
{
QDomElement element = node.toElement();
-
+
if (element.hasAttribute("iconSize"))
{
int iconSize = element.attribute("iconSize").toInt();
@@ -173,27 +173,27 @@ void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *a
if (element.hasAttribute("iconText"))
{
- if(element.attribute("iconText").toLower() == QL1S("icononly"))
+ if (element.attribute("iconText").toLower() == QL1S("icononly"))
{
b->setToolButtonStyle(Qt::ToolButtonIconOnly);
}
- if(element.attribute("iconText").toLower() == QL1S("textonly"))
+ if (element.attribute("iconText").toLower() == QL1S("textonly"))
{
b->setToolButtonStyle(Qt::ToolButtonTextOnly);
}
- if(element.attribute("iconText").toLower() == QL1S("icontextright"))
+ if (element.attribute("iconText").toLower() == QL1S("icontextright"))
{
b->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
}
- if(element.attribute("iconText").toLower() == QL1S("textundericon"))
+ if (element.attribute("iconText").toLower() == QL1S("textundericon"))
{
b->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
- if(element.attribute("iconText").toLower() == QL1S("followstyle"))
+ if (element.attribute("iconText").toLower() == QL1S("followstyle"))
{
b->setToolButtonStyle(Qt::ToolButtonFollowStyle);
}
@@ -201,7 +201,7 @@ void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *a
QDomNodeList childrenList = node.childNodes();
- for(unsigned int i = 0; i < childrenList.length(); ++i)
+ for (unsigned int i = 0; i < childrenList.length(); ++i)
{
QDomElement el = childrenList.at(i).toElement();
@@ -213,7 +213,7 @@ void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *a
{
b->addAction(a);
}
-
+
}
if (el.tagName() == QL1S("Separator"))
@@ -229,7 +229,7 @@ void RekonqFactory::fillMenu(KMenu *m, QDomNode node, KActionCollection *ac)
{
QDomNodeList childrenList = node.childNodes();
- for(unsigned int i = 0; i < childrenList.length(); ++i)
+ for (unsigned int i = 0; i < childrenList.length(); ++i)
{
QDomElement el = childrenList.at(i).toElement();
diff --git a/src/webwindow/rekonqfactory.h b/src/webwindow/rekonqfactory.h
index cf8bc2ee..a0bf956d 100644
--- a/src/webwindow/rekonqfactory.h
+++ b/src/webwindow/rekonqfactory.h
@@ -41,10 +41,10 @@ class QWidget;
namespace RekonqFactory
{
- QWidget *createWidget(const QString &name, QWidget *parent, KActionCollection *);
+QWidget *createWidget(const QString &name, QWidget *parent, KActionCollection *);
- void fillToolbar(KToolBar *, QDomNode, KActionCollection *);
- void fillMenu(KMenu *, QDomNode, KActionCollection *);
+void fillToolbar(KToolBar *, QDomNode, KActionCollection *);
+void fillMenu(KMenu *, QDomNode, KActionCollection *);
};
#endif
diff --git a/src/webwindow/rekonqmenu.cpp b/src/webwindow/rekonqmenu.cpp
index c32d71f5..6973a1b7 100644
--- a/src/webwindow/rekonqmenu.cpp
+++ b/src/webwindow/rekonqmenu.cpp
@@ -57,7 +57,7 @@ void RekonqMenu::showEvent(QShowEvent* event)
kDebug() << "but: " << m_button.data();
kDebug() << "but w: " << m_button.data()->width();
kDebug() << "but h: " << m_button.data()->height();
-
+
// Adjust the position of the menu to be shown within the
// rekonq window to reduce the cases that sub-menus might overlap
// the right screen border.
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 83c49859..dc0bf0bd 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -87,7 +87,7 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
_tab->view()->setPage(pg);
pg->setParent(_tab->view());
}
-
+
// then, setup our actions
setupActions();
@@ -108,7 +108,7 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
l->addWidget(_bookmarksBar.data());
}
-
+
l->addWidget(_tab);
l->addWidget(m_findBar);
l->setContentsMargins(0, 0, 0, 0);
@@ -117,7 +117,7 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
// bookmarks toolbar
connect(rApp, SIGNAL(toggleBookmarksToolbar(bool)), this, SLOT(toggleBookmarksToolbar(bool)));
-
+
// things changed signals
connect(_tab->view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
@@ -135,9 +135,9 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
m_popup->raise();
m_popup->hide();
connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide()));
- connect(_tab->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(notifyMessage(QString)));
+ connect(_tab->page(), SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(notifyMessage(QString)));
- updateHistoryActions();
+ updateHistoryActions();
}
@@ -156,7 +156,7 @@ WebWindow::~WebWindow()
void WebWindow::setupActions()
{
KAction *a;
-
+
// ========================= History related actions ==============================
a = actionCollection()->addAction(KStandardAction::Back);
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)),
@@ -301,7 +301,7 @@ void WebWindow::setupActions()
// <Action name="edit_find" />
// <Action name="view_zoom" />
// <Separator/>
-//
+//
// <Menu name="toolsMenu" icon="preferences-other" noMerge="1">
// <text>&amp;Tools</text>
// <Action name="clear_private_data" /> +
@@ -316,12 +316,12 @@ void WebWindow::setupActions()
// <Action name="sync" /> +
// <Action name="adblock" /> +
// </Menu>
-//
+//
// <Separator/>
// <Action name="show_bookmarks_toolbar" />
// <Action name="fullscreen" /> +
// <Separator/>
-//
+//
// <Menu name="help" icon="help-browser">
// <text>&amp;Help</text>
// <Action name="help_contents"/>
@@ -334,7 +334,7 @@ void WebWindow::setupActions()
// <Action name="help_about_app"/>
// <Action name="help_about_kde"/>
// </Menu>
-//
+//
// <Action name="options_configure" /> +
// </Menu>
@@ -367,7 +367,7 @@ QAction *WebWindow::actionByName(const QString &name)
return actionCollection()->action(name);
}
-
+
void WebWindow::load(const QUrl &url)
{
_tab->view()->load(url);
@@ -572,7 +572,7 @@ void WebWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers ke
void WebWindow::updateHistoryActions()
{
QWebHistory *history = _tab->view()->history();
-
+
bool rekonqPage = _tab->page()->isOnRekonqPage();
QAction *historyBackAction = actionByName(KStandardAction::name(KStandardAction::Back));
diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h
index 37f9c3c0..5f0eecad 100644
--- a/src/webwindow/webwindow.h
+++ b/src/webwindow/webwindow.h
@@ -64,7 +64,7 @@ class WebWindow : public QWidget
public:
WebWindow(QWidget *parent = 0, WebPage *pg = 0);
~WebWindow();
-
+
void load(const QUrl &);
WebPage *page();
@@ -75,18 +75,18 @@ public:
UrlBar *urlBar();
WebTab *view();
-
+
QPixmap tabPreview(int width, int height);
bool isLoading();
- virtual KActionCollection *actionCollection () const;
+ virtual KActionCollection *actionCollection() const;
QAction *actionByName(const QString &name);
private:
void setupActions();
void setupTools();
-
+
private Q_SLOTS:
void webLoadProgress(int);
void webLoadStarted();