From e315ff15daf26cbc70b6f2da50e6ca18081fc7c4 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 19 Sep 2012 23:22:13 +0200 Subject: 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... :) --- src/webwindow/findbar.cpp | 6 +++--- src/webwindow/rekonqfactory.cpp | 30 +++++++++++++++--------------- src/webwindow/rekonqfactory.h | 6 +++--- src/webwindow/rekonqmenu.cpp | 2 +- src/webwindow/webwindow.cpp | 24 ++++++++++++------------ src/webwindow/webwindow.h | 8 ++++---- 6 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/webwindow') 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(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() // // // -// +// // // &Tools // + @@ -316,12 +316,12 @@ void WebWindow::setupActions() // + // + // -// +// // // // + // -// +// // // &Help // @@ -334,7 +334,7 @@ void WebWindow::setupActions() // // // -// +// // + // @@ -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(); -- cgit v1.2.1