summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow.cpp39
-rw-r--r--src/mainwindow.h4
-rw-r--r--src/searchengine.cpp110
-rw-r--r--src/searchengine.h10
-rw-r--r--src/settings/settingsdialog.cpp4
-rw-r--r--src/urlbar/bookmarkwidget.cpp17
-rw-r--r--src/urlbar/urlbar.cpp2
-rw-r--r--src/webview.cpp12
8 files changed, 91 insertions, 107 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index cbef274a..73779627 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -211,19 +211,7 @@ void MainWindow::setupToolbars()
void MainWindow::postLaunch()
{
- KToolBar *mainBar = toolBar("mainToolBar");
-
- QToolButton *bookmarksButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("bookmarksActionMenu") )));
- if(bookmarksButton)
- {
- connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), bookmarksButton, SLOT(showMenu()));
- }
-
- QToolButton *toolsButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("rekonq_tools") )));
- if(toolsButton)
- {
- connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu()));
- }
+ setupBookmarksAndToolsShortcuts();
// setting popup notification
m_popup->setAutoDelete(false);
@@ -1343,3 +1331,28 @@ bool MainWindow::queryClose()
}
return true;
}
+
+
+void MainWindow::saveNewToolbarConfig()
+{
+ KXmlGuiWindow::saveNewToolbarConfig();
+ setupBookmarksAndToolsShortcuts();
+}
+
+
+void MainWindow::setupBookmarksAndToolsShortcuts()
+{
+ KToolBar *mainBar = toolBar("mainToolBar");
+
+ QToolButton *bookmarksButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("bookmarksActionMenu") )));
+ if(bookmarksButton)
+ {
+ connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), bookmarksButton, SLOT(showMenu()));
+ }
+
+ QToolButton *toolsButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("rekonq_tools") )));
+ if(toolsButton)
+ {
+ connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu()));
+ }
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index e5a43649..50c73b4b 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -81,6 +81,7 @@ public:
void setWidgetsVisible(bool makeFullScreen);
private:
+ void setupBookmarksAndToolsShortcuts();
void setupActions();
void setupTools();
void setupToolbars();
@@ -108,6 +109,9 @@ signals:
void ctrlTabPressed();
void shiftCtrlTabPressed();
+protected slots:
+ void saveNewToolbarConfig();
+
protected:
/**
* Filters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed()
diff --git a/src/searchengine.cpp b/src/searchengine.cpp
index 0a66bb64..7065d55f 100644
--- a/src/searchengine.cpp
+++ b/src/searchengine.cpp
@@ -36,40 +36,70 @@
#include <KServiceTypeTrader>
+bool SearchEngine::m_loaded = false;
QString SearchEngine::m_delimiter = "";
+KService::List SearchEngine::m_favorites;
+KService::Ptr SearchEngine::m_defaultEngine;
-QString SearchEngine::delimiter()
-{
- if (m_delimiter == "") loadDelimiter();
- return m_delimiter;
-}
-
-
-void SearchEngine::loadDelimiter()
+void SearchEngine::reload()
{
- KConfig config("kuriikwsfilterrc"); //Share with konqueror
+ KConfig config("kuriikwsfilterrc"); //Shared with konqueror
KConfigGroup cg = config.group("General");
+
+ //load delimiter
m_delimiter = cg.readEntry("KeywordDelimiter", ":");
+
+ //load favorite engines
+ QStringList favoriteEngines;
+ favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines);
+ KService::List favorites;
+ KService::Ptr service;
+ foreach(const QString &engine, favoriteEngines)
+ {
+ service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
+ if (service)
+ favorites << service;
+ }
+ m_favorites = favorites;
+
+ //load default engine
+ QString d = cg.readEntry("DefaultSearchEngine");
+ m_defaultEngine = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
+ if (!m_defaultEngine)
+ {
+ d = QL1S("google");
+ m_defaultEngine = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
+ }
+
+ m_loaded = true;
}
-KService::Ptr SearchEngine::m_defaultWS;
+QString SearchEngine::delimiter()
+{
+ if (!m_loaded)
+ reload();
+
+ return m_delimiter;
+}
-KService::Ptr SearchEngine::defaultWS()
+KService::List SearchEngine::favorites()
{
- if (!m_defaultWS) loadDefaultWS();
- return m_defaultWS;
+ if (!m_loaded)
+ reload();
+
+ return m_favorites;
}
-void SearchEngine::loadDefaultWS()
+KService::Ptr SearchEngine::defaultEngine()
{
- KConfig config("kuriikwsfilterrc"); //Share with konqueror
- KConfigGroup cg = config.group("General");
- QString d = cg.readEntry("DefaultSearchEngine", "google");
- m_defaultWS = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
+ if (!m_loaded)
+ reload();
+
+ return m_defaultEngine;
}
@@ -106,48 +136,4 @@ QString SearchEngine::buildQuery(KService::Ptr engine, QString text)
}
-KService::List SearchEngine::m_favorites;
-
-
-KService::List SearchEngine::favorites()
-{
- if (m_favorites.isEmpty()) loadFavorites();
- return m_favorites;
-}
-
-void SearchEngine::loadFavorites()
-{
- KConfig config("kuriikwsfilterrc"); //Share with konqueror
- KConfigGroup cg = config.group("General");
- QStringList favoriteEngines;
- favoriteEngines << "google"; //defaults
- favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines);
-
- KService::List favorites;
- KService::Ptr service;
- foreach(const QString &engine, favoriteEngines)
- {
- service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
- if (service)
- favorites << service;
- }
-
- m_favorites = favorites;
-}
-
-KService::Ptr SearchEngine::defaultEngine()
-{
- KConfig config("kuriikwsfilterrc"); //Share with konqueror
- KConfigGroup cg = config.group("General");
- QString d = cg.readEntry("DefaultSearchEngine");
- KService::Ptr service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
- if (!service)
- {
- d = QL1S("google");
- service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(d));
- }
-
- return service;
-
-}
diff --git a/src/searchengine.h b/src/searchengine.h
index 2e30e056..e57b1a5c 100644
--- a/src/searchengine.h
+++ b/src/searchengine.h
@@ -41,22 +41,18 @@
class SearchEngine
{
public:
-
+ static void reload();
static QString delimiter();
static KService::Ptr defaultEngine();
static KService::List favorites();
static KService::Ptr fromString(QString text);
static QString buildQuery(KService::Ptr engine, QString text);
- static KService::Ptr defaultWS();
-
- static void loadDelimiter();
- static void loadFavorites();
- static void loadDefaultWS();
private:
+ static bool m_loaded;
static QString m_delimiter;
static KService::List m_favorites;
- static KService::Ptr m_defaultWS;
+ static KService::Ptr m_defaultEngine;
};
#endif
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index cd64f434..eee2a4e1 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -197,9 +197,7 @@ void SettingsDialog::saveSettings()
d->shortcutsEditor->save();
d->ebrowsingModule->save();
- SearchEngine::loadDefaultWS();
- SearchEngine::loadDelimiter();
- SearchEngine::loadFavorites();
+ SearchEngine::reload();
updateButtons();
emit settingsChanged("ReKonfig");
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index 3380ec57..ccfe4914 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -152,21 +152,6 @@ void BookmarkWidget::showAt(const QPoint &pos)
void BookmarkWidget::removeBookmark()
{
- bool folder = m_bookmark.isGroup();
-
- if (KMessageBox::warningContinueCancel(
- QApplication::activeWindow(),
- folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", m_bookmark.text())
- : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", m_bookmark.text()),
- folder ? i18n("Bookmark Folder Deletion")
- : i18n("Bookmark Deletion"),
- KStandardGuiItem::del())
- == KMessageBox::Continue
- )
- {
- m_bookmark.parentGroup().deleteBookmark(m_bookmark);
- Application::bookmarkProvider()->bookmarkManager()->emitChanged();
- }
-
+ Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(m_bookmark);
reject();
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index e2033120..0d130b94 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -312,10 +312,12 @@ void UrlBar::loadFinished()
if (Application::bookmarkProvider()->bookmarkForUrl(_tab->url()).isNull())
{
_icon->setIcon(KIcon("bookmarks").pixmap(32,32, QIcon::Disabled));
+ _icon->setToolTip(i18n("Bookmark this page"));
}
else
{
_icon->setIcon(KIcon("bookmarks"));
+ _icon->setToolTip(i18n("Edit this bookmark"));
}
// show KGet downloads??
diff --git a/src/webview.cpp b/src/webview.cpp
index 441225af..b710719f 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -536,13 +536,11 @@ void WebView::keyPressEvent(QKeyEvent *event)
}
-
-
-
void WebView::wheelEvent(QWheelEvent *event)
{
- if (!ReKonfig::smoothScrolling() || page()->currentFrame()->hitTestContent(event->pos()).isContentEditable())
- KWebView::wheelEvent(event);
+ // To let some websites (eg: google maps) to handle wheel events
+ int ypos = page()->currentFrame()->scrollPosition().y();
+ KWebView::wheelEvent(event);
// Sync with the zoom slider
if (event->modifiers() == Qt::ControlModifier)
@@ -560,8 +558,10 @@ void WebView::wheelEvent(QWheelEvent *event)
emit zoomChanged(newFactor);
}
- else if ( ReKonfig::smoothScrolling() && !page()->currentFrame()->hitTestContent(event->pos()).isContentEditable())
+ else if (ReKonfig::smoothScrolling() && ypos != page()->currentFrame()->scrollPosition().y())
{
+ page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), ypos));
+
int numDegrees = event->delta() / 8;
int numSteps = numDegrees / 15;