summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/bookmarks/bookmarkcontextmenu.cpp27
-rw-r--r--src/bookmarks/bookmarksmanager.cpp97
-rw-r--r--src/bookmarks/bookmarksmanager.h22
-rw-r--r--src/bookmarks/bookmarkspanel.cpp29
-rw-r--r--src/bookmarks/bookmarksproxy.cpp11
-rw-r--r--src/bookmarks/bookmarksproxy.h12
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp12
-rw-r--r--src/data/rekonq.desktop6
-rw-r--r--src/findbar.cpp12
-rw-r--r--src/findbar.h3
-rw-r--r--src/mainwindow.cpp39
-rw-r--r--src/mainwindow.h4
-rw-r--r--src/newtabpage.cpp128
-rw-r--r--src/newtabpage.h5
-rw-r--r--src/searchengine.cpp110
-rw-r--r--src/searchengine.h10
-rw-r--r--src/settings/generalwidget.cpp22
-rw-r--r--src/settings/generalwidget.h1
-rw-r--r--src/settings/settingsdialog.cpp4
-rw-r--r--src/urlbar/bookmarkwidget.cpp157
-rw-r--r--src/urlbar/bookmarkwidget.h63
-rw-r--r--src/urlbar/urlbar.cpp69
-rw-r--r--src/urlbar/urlbar.h3
-rw-r--r--src/webview.cpp16
-rw-r--r--src/zoombar.cpp17
-rw-r--r--src/zoombar.h5
28 files changed, 630 insertions, 257 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8de22b5b..75ebfc26 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ PROJECT( rekonq )
# Informations to update before to release this package.
# rekonq info
-SET(REKONQ_VERSION "0.5.54" )
+SET(REKONQ_VERSION "0.5.55" )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 127c1c4f..dd90fc10 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -62,6 +62,7 @@ SET( rekonq_KDEINIT_SRCS
urlbar/urlresolver.cpp
urlbar/listitem.cpp
urlbar/rsswidget.cpp
+ urlbar/bookmarkwidget.cpp
#----------------------------------------
analyzer/analyzerpanel.cpp
analyzer/networkanalyzer.cpp
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp
index 96668003..714c8b51 100644
--- a/src/bookmarks/bookmarkcontextmenu.cpp
+++ b/src/bookmarks/bookmarkcontextmenu.cpp
@@ -212,25 +212,7 @@ void BookmarkContextMenu::copyToClipboard()
void BookmarkContextMenu::deleteBookmark()
{
KBookmark bm = bookmark();
- KBookmarkGroup bmg = bm.parentGroup();
- bool folder = bm.isGroup();
- QString name = QString(bm.fullText()).replace("&&", "&");
-
- if (KMessageBox::warningContinueCancel(
- QApplication::activeWindow(),
- folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name)
- : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name),
- folder ? i18n("Bookmark Folder Deletion")
- : i18n("Bookmark Deletion"),
- KStandardGuiItem::del(),
- KStandardGuiItem::cancel(),
- "bookmarkDeletition_askAgain")
- != KMessageBox::Continue
- )
- return;
-
- bmg.deleteBookmark(bm);
- manager()->emitChanged(bmg);
+ Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(bm);
}
@@ -268,8 +250,11 @@ void BookmarkContextMenu::newBookmarkGroup()
{
KBookmark newBk;
newBk = dialog->createNewFolder("New folder", selected.parentGroup());
- selected.parentGroup().moveBookmark(newBk, selected);
- manager()->emitChanged(newBk.parentGroup());
+ if (!newBk.isNull())
+ {
+ selected.parentGroup().moveBookmark(newBk, selected);
+ manager()->emitChanged(newBk.parentGroup());
+ }
}
}
else
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 792baaeb..cade77b4 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -75,6 +75,45 @@ void BookmarkOwner::openBookmark(const KBookmark & bookmark,
}
+bool BookmarkOwner::deleteBookmark(KBookmark &bookmark)
+{
+ QString name = QString(bookmark.fullText()).replace("&&", "&");
+ QString dialogCaption, dialogText;
+
+ if (bookmark.isGroup())
+ {
+ dialogCaption = i18n("Bookmark Folder Deletion");
+ dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name);
+ }
+ else if (bookmark.isSeparator())
+ {
+ dialogCaption = i18n("Separator Deletion");
+ dialogText = i18n("Are you sure you wish to remove this separator?", name);
+ }
+ else
+ {
+ dialogCaption = i18n("Bookmark Deletion");
+ dialogText = i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name);
+ }
+
+ if (KMessageBox::warningContinueCancel(
+ QApplication::activeWindow(),
+ dialogText,
+ dialogCaption,
+ KStandardGuiItem::del(),
+ KStandardGuiItem::cancel(),
+ "bookmarkDeletition_askAgain")
+ != KMessageBox::Continue
+ )
+ return false;
+
+ KBookmarkGroup bmg = bookmark.parentGroup();
+ bmg.deleteBookmark(bookmark);
+ Application::bookmarkProvider()->bookmarkManager()->emitChanged(bmg);
+ return true;
+}
+
+
bool BookmarkOwner::supportsTabs() const
{
return true;
@@ -99,16 +138,16 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark)
if (urlList.length() > 8)
{
- if ( !(KMessageBox::warningContinueCancel( Application::instance()->mainWindow(),
+ if ( !(KMessageBox::warningContinueCancel( Application::instance()->mainWindow(),
i18ncp("%1=Number of tabs. Value is always >=8",
"You are about to open %1 tabs.\nAre you sure?",
- "You are about to open %1 tabs.\nAre you sure?",
+ "You are about to open %1 tabs.\nAre you sure?",
urlList.length()),
"",
KStandardGuiItem::cont(),
KStandardGuiItem::cancel(),
"openFolderInTabs_askAgain"
- ) == KMessageBox::Continue)
+ ) == KMessageBox::Continue)
)
return;
}
@@ -335,7 +374,7 @@ void BookmarkToolBar::actionHovered()
// ------------------------------------------------------------------------------------------------------
-
+
BookmarkProvider::BookmarkProvider(QObject *parent)
: QObject(parent)
, m_manager(0)
@@ -388,13 +427,15 @@ BookmarkProvider::~BookmarkProvider()
void BookmarkProvider::setupBookmarkBar(BookmarkToolBar *toolbar)
{
+ if (m_bookmarkToolBars.contains(toolbar))
+ return;
+
kDebug() << "new bookmark bar...";
-
+
m_bookmarkToolBars.append(toolbar);
toolbar->setContextMenuPolicy(Qt::CustomContextMenu);
connect(toolbar, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
-
- slotBookmarksChanged("", "");
+
kDebug() << "new bookmark bar... DONE!";
}
@@ -451,7 +492,7 @@ void BookmarkProvider::contextMenu(const QPoint &point)
KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent)
{
kDebug() << "new Bookmarks Menu...";
-
+
KMenu *menu = new KMenu(parent);
_bookmarkActionMenu = new KActionMenu(parent);
_bookmarkActionMenu->setMenu(menu);
@@ -522,7 +563,7 @@ QList<KBookmark> BookmarkProvider::find(QString text)
return list;
}
- KBookmark bookmark = bookGroup.first();
+ KBookmark bookmark = bookGroup.first();
while (!bookmark.isNull())
{
list = find(list, bookmark, text);
@@ -591,3 +632,41 @@ void BookmarkProvider::slotPanelChanged()
panel->startLoadFoldedState();
}
}
+
+
+KBookmark BookmarkProvider::bookmarkForUrl(const KUrl &url)
+{
+ KBookmark found;
+
+ KBookmarkGroup root = rootGroup();
+ if (root.isNull())
+ {
+ return found;
+ }
+
+ return bookmarkForUrl(root, url);
+}
+
+
+KBookmark BookmarkProvider::bookmarkForUrl(const KBookmark &bookmark, const KUrl &url)
+{
+ KBookmark found;
+
+ if (bookmark.isGroup())
+ {
+ KBookmarkGroup group = bookmark.toGroup();
+ KBookmark bookmark = group.first();
+
+ while (!bookmark.isNull() && found.isNull())
+ {
+ found = bookmarkForUrl(bookmark, url);
+ bookmark = group.next(bookmark);
+ }
+ }
+ else if (!bookmark.isSeparator() && bookmark.url() == url)
+ {
+ found = bookmark;
+ }
+
+ return found;
+}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 72ea1c3c..b084b8ee 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -89,6 +89,13 @@ public:
Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers);
+ /**
+ * Promps the user to delete a bookmark.
+ * @param bookmark The bookmark to delete.
+ * @return true if the bookmark was deleted, false if canceled.
+ */
+ static bool deleteBookmark(KBookmark &bookmark);
+
/**
* this method, from KBookmarkOwner interface, allows to add the current page
@@ -206,7 +213,7 @@ private:
// ------------------------------------------------------------------------------
-
+
/**
* This class represent the interface to rekonq bookmarks system.
* All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided
@@ -263,7 +270,7 @@ public:
KBookmarkGroup rootGroup();
inline KBookmarkManager *bookmarkManager() { return m_manager; }
-
+
inline BookmarkOwner *bookmarkOwner() { return m_owner; }
QList<KBookmark> find(QString text);
@@ -271,6 +278,8 @@ public:
void registerBookmarkPanel(BookmarksPanel *panel);
void removeBookmarkPanel(BookmarksPanel *panel);
+ KBookmark bookmarkForUrl(const KUrl &url);
+
signals:
/**
* @short This signal is emitted when an url has to be loaded
@@ -297,20 +306,23 @@ public slots:
*/
void slotBookmarksChanged(const QString &group, const QString &caller);
void fillBookmarkBar(BookmarkToolBar *toolBar);
-
+
private slots:
void slotAddBookmark();
void slotPanelChanged();
-
+
private:
QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text);
+ QString titleForBookmarkUrl(const KBookmark &bookmark, const QString &url);
+ KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
+
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
KActionCollection *m_actionCollection;
QList<BookmarkToolBar *> m_bookmarkToolBars;
QList<BookmarksPanel*> m_bookmarkPanels;
-
+
KActionMenu *_bookmarkActionMenu;
};
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index 75d8faf3..b49d4f5e 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -201,12 +201,12 @@ void BookmarksPanel::contextMenu(const QPoint &pos)
KBookmark selected = bookmarkForIndex(index);
- BookmarkContextMenu menu( selected,
- Application::bookmarkProvider()->bookmarkManager(),
- Application::bookmarkProvider()->bookmarkOwner(),
+ BookmarkContextMenu menu( selected,
+ Application::bookmarkProvider()->bookmarkManager(),
+ Application::bookmarkProvider()->bookmarkOwner(),
this
);
-
+
menu.exec(m_treeView->mapToGlobal(pos));
}
@@ -218,24 +218,5 @@ void BookmarksPanel::deleteBookmark()
return;
KBookmark bm = bookmarkForIndex(index);
- KBookmarkGroup bmg = bm.parentGroup();
- bool folder = bm.isGroup();
- QString name = QString(bm.fullText()).replace("&&", "&");
-
- if (KMessageBox::warningContinueCancel(
- QApplication::activeWindow(),
- folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name)
- : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name),
- folder ? i18n("Bookmark Folder Deletion")
- : i18n("Bookmark Deletion"),
- KStandardGuiItem::del(),
- KStandardGuiItem::cancel(),
- "bookmarkDeletition_askAgain")
- != KMessageBox::Continue
- )
- return;
-
-
- bmg.deleteBookmark(bm);
- Application::instance()->bookmarkProvider()->bookmarkManager()->emitChanged(bmg);
+ Application::instance()->bookmarkProvider()->bookmarkOwner()->deleteBookmark(bm);
}
diff --git a/src/bookmarks/bookmarksproxy.cpp b/src/bookmarks/bookmarksproxy.cpp
index 4e4b4f06..1e4da877 100644
--- a/src/bookmarks/bookmarksproxy.cpp
+++ b/src/bookmarks/bookmarksproxy.cpp
@@ -27,19 +27,18 @@
// Self Includes
#include "bookmarksproxy.h"
-#include "bookmarksproxy.moc"
BookmarksProxy::BookmarksProxy(QObject *parent)
: QSortFilterProxyModel(parent)
{
+ setFilterCaseSensitivity(Qt::CaseInsensitive);
}
-bool BookmarksProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+bool BookmarksProxy::filterAcceptsRow(const int source_row, const QModelIndex &source_parent) const
{
- QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
- return recursiveMatch(idx);
+ return recursiveMatch( sourceModel()->index(source_row, 0, source_parent) );
}
@@ -48,10 +47,12 @@ bool BookmarksProxy::recursiveMatch(const QModelIndex &index) const
if (index.data().toString().contains(filterRegExp()))
return true;
- for (int childRow = 0; childRow < sourceModel()->rowCount(index); ++childRow)
+ int numChildren = sourceModel()->rowCount(index);
+ for (int childRow = 0; childRow < numChildren; ++childRow)
{
if (recursiveMatch(sourceModel()->index(childRow, 0, index)))
return true;
}
+
return false;
}
diff --git a/src/bookmarks/bookmarksproxy.h b/src/bookmarks/bookmarksproxy.h
index e7b50d8e..b4554d2b 100644
--- a/src/bookmarks/bookmarksproxy.h
+++ b/src/bookmarks/bookmarksproxy.h
@@ -33,9 +33,13 @@
#include "rekonq_defines.h"
// Qt Includes
-#include <QSortFilterProxyModel>
-
+#include <QtGui/QSortFilterProxyModel>
+/**
+ * QSortFilterProxyModel hides all children which parent doesn't
+ * match the filter. This class is used to change this behavior.
+ * If a bookmark matches the filter it'll be shown, even if it's parent doesn't match it.
+ */
class REKONQ_TESTS_EXPORT BookmarksProxy : public QSortFilterProxyModel
{
Q_OBJECT
@@ -45,9 +49,9 @@ public:
BookmarksProxy(QObject *parent = 0);
protected:
- virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+ virtual bool filterAcceptsRow(const int source_row, const QModelIndex &source_parent) const;
- // returns true if any child(or children-child...) matches filter
+ // returns true if index or any of his children match the filter
bool recursiveMatch(const QModelIndex &index) const;
};
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 7063bf9b..299efaf0 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -406,15 +406,15 @@ bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
if (parent.isValid())
root = bookmarkForIndex(parent).toGroup();
- if (!destIndex.isValid())
+ if (destIndex.isValid() && row != -1)
{
- root.deleteBookmark(bookmark);
- root.addBookmark(bookmark);
- }
+ root.moveBookmark(bookmark, root.previous(dropDestBookmark));
- else if (row != 1)
+ }
+ else
{
- root.moveBookmark(bookmark, root.previous(dropDestBookmark));
+ root.deleteBookmark(bookmark);
+ root.addBookmark(bookmark);
}
Application::bookmarkProvider()->bookmarkManager()->emitChanged();
diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop
index b75f86dc..f8a78960 100644
--- a/src/data/rekonq.desktop
+++ b/src/data/rekonq.desktop
@@ -30,11 +30,17 @@ Name[zh_CN]=rekonq
Name[zh_TW]=rekonq
GenericName=Web Browser
GenericName[da]=Webbrowser
+GenericName[de]=Webbrowser
GenericName[en_GB]=Web Browser
GenericName[es]=Navegador web
GenericName[fr]=Navigateur web
+GenericName[it]=Browser Web
GenericName[pt]=Navegador Web
GenericName[pt_BR]=Navegador Web
+GenericName[sr]=Веб прегледач
+GenericName[sr@ijekavian]=Веб прегледач
+GenericName[sr@ijekavianlatin]=Veb pregledač
+GenericName[sr@latin]=Veb pregledač
GenericName[sv]=Webbläsare
GenericName[uk]=Переглядач Інтернету
GenericName[x-test]=xxWeb Browserxx
diff --git a/src/findbar.cpp b/src/findbar.cpp
index 5d88dc1b..b3b80fac 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -75,6 +75,7 @@ FindBar::FindBar(QWidget *parent)
// hide timer
connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hide()));
+ m_hideTimer->setSingleShot(true);
// label
QLabel *label = new QLabel(i18n("Find:"));
@@ -143,6 +144,7 @@ void FindBar::show()
// show findbar if not visible
if (isHidden())
{
+ emit visibilityChanged(true);
QWidget::show();
emit searchString(m_lineEdit->text());
}
@@ -182,19 +184,13 @@ void FindBar::notifyMatch(bool match)
void FindBar::hide()
{
m_hideTimer->stop();
+ emit visibilityChanged(false);
QWidget::hide();
emit(searchString(m_lineEdit->text()));
}
-void FindBar::setVisible(bool visible)
-{
- emit visibilityChanged(visible);
- QWidget::setVisible(visible);
-}
-
-
void FindBar::toggleVisibility()
{
- setVisible(!isVisible());
+ isVisible() ? hide() : show();
}
diff --git a/src/findbar.h b/src/findbar.h
index 63b2949b..38bbcbc5 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -64,9 +64,6 @@ signals:
void searchString(const QString &);
void visibilityChanged(bool);
-protected:
- void setVisible(bool visible);
-
private:
KLineEdit *m_lineEdit;
QTimer *m_hideTimer;
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/newtabpage.cpp b/src/newtabpage.cpp
index 1c14f3dc..78496bc2 100644
--- a/src/newtabpage.cpp
+++ b/src/newtabpage.cpp
@@ -44,7 +44,6 @@
// KDE Includes
#include <KStandardDirs>
-#include <KIconLoader>
#include <KConfig>
#include <KDialog>
#include <KCalendarSystem>
@@ -167,11 +166,10 @@ void NewTabPage::favoritesPage()
{
m_root.addClass("favorites");
- QWebElement add = markup(".link");
- add.findFirst("a").setAttribute("href", "about:preview/add");
- add.findFirst("img").setAttribute("src" , QString("file:///" +
- KIconLoader::global()->iconPath("list-add", KIconLoader::Small || KIconLoader::SizeSmall)));
- add.findFirst("span").appendInside(i18n("Add Favorite"));
+ const QWebElement add = createLinkItem(i18n("Add Favorite"),
+ QLatin1String("about:preview/add"),
+ QLatin1String("list-add"),
+ KIconLoader::Toolbar);
m_root.document().findFirst("#actions").appendInside(add);
QStringList names = ReKonfig::previewNames();
@@ -338,55 +336,50 @@ void NewTabPage::removePreview(int index)
ReKonfig::self()->writeConfig();
}
-
void NewTabPage::browsingMenu(const KUrl &currentUrl)
{
QList<QWebElement> navItems;
- KIconLoader *loader = KIconLoader::global();
-
- QWebElement nav = markup(".link"); // Favorites
- nav.findFirst("a").setAttribute("href", "about:favorites");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("emblem-favorite", KIconLoader::Desktop || KIconLoader::SizeSmall)));
- nav.findFirst("span").appendInside(i18n("Favorites"));
- navItems.append(nav);
-
- nav = markup(".link"); // Closed Tabs
- nav.findFirst("a").setAttribute("href", "about:closedTabs");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("tab-close", KIconLoader::Desktop || KIconLoader::SizeSmall)));
- nav.findFirst("span").appendInside(i18n("Closed Tabs"));
- navItems.append(nav);
-
- nav = markup(".link"); // Bookmarks
- nav.findFirst("a").setAttribute("href", "about:bookmarks");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("bookmarks", KIconLoader::Desktop || KIconLoader::SizeSmall)));
- nav.findFirst("span").appendInside(i18n("Bookmarks"));
- navItems.append(nav);
-
- nav = markup(".link"); // History
- nav.findFirst("a").setAttribute("href", "about:history");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("view-history", KIconLoader::Desktop || KIconLoader::SizeSmall)));
- nav.findFirst("span").appendInside(i18n("History"));
- navItems.append(nav);
-
- nav = markup(".link"); // Downloads
- nav.findFirst("a").setAttribute("href", "about:downloads");
- nav.findFirst("img").setAttribute("src" , QString("file:///" +
- loader->iconPath("download", KIconLoader::Desktop || KIconLoader::SizeSmall)));
- nav.findFirst("span").appendInside(i18n("Downloads"));
- navItems.append(nav);
+ // Favorites
+ navItems.append(createLinkItem(i18n("Favorites"),
+ QLatin1String("about:favorites"),
+ QLatin1String("emblem-favorite"),
+ KIconLoader::Toolbar));
+
+ // Closed Tabs
+ navItems.append(createLinkItem(i18n("Closed Tabs"),
+ QLatin1String("about:closedTabs"),
+ QLatin1String("tab-close"),
+ KIconLoader::Toolbar));
+
+ // Bookmarks
+ navItems.append(createLinkItem(i18n("Bookmarks"),
+ QLatin1String("about:bookmarks"),
+ QLatin1String("bookmarks"),
+ KIconLoader::Toolbar));
+
+ // History
+ navItems.append(createLinkItem(i18n("History"),
+ QLatin1String("about:history"),
+ QLatin1String("view-history"),
+ KIconLoader::Toolbar));
+
+ // Downloads
+ navItems.append(createLinkItem(i18n("Downloads"),
+ QLatin1String("about:downloads"),
+ QLatin1String("download"),
+ KIconLoader::Toolbar));
foreach(QWebElement it, navItems)
{
- if (it.findFirst("a").attribute("href") == currentUrl.toMimeDataString())
- it.addClass("current");
- else if (currentUrl == "about:home" && it.findFirst("a").attribute("href") == "about:favorites")
- it.addClass("current");
- m_root.document().findFirst("#navigation").appendInside(it);
+ const QString aTagString('a');
+ const QString hrefAttributeString(QLatin1String("href"));
+
+ if (it.findFirst(aTagString).attribute(hrefAttributeString) == currentUrl.toMimeDataString())
+ it.addClass(QLatin1String("current"));
+ else if (currentUrl == QLatin1String("about:home") && it.findFirst(aTagString).attribute(hrefAttributeString) == QLatin1String("about:favorites"))
+ it.addClass(QLatin1String("current"));
+ m_root.document().findFirst(QLatin1String("#navigation")).appendInside(it);
}
}
@@ -395,11 +388,10 @@ void NewTabPage::historyPage()
{
m_root.addClass("history");
- QWebElement clearData = markup(".link");
- clearData.findFirst("a").setAttribute("href", "about:history/clear");
- QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("edit-clear", KIconLoader::SizeSmall || KIconLoader::Small));
- clearData.findFirst("img").setAttribute("src" , iconPath);
- clearData.findFirst("span").appendInside(i18n("Clear Private Data"));
+ const QWebElement clearData = createLinkItem(i18n("Clear Private Data"),
+ QLatin1String("about:history/clear"),
+ QLatin1String("edit-clear"),
+ KIconLoader::Toolbar);
m_root.document().findFirst("#actions").appendInside(clearData);
HistoryTreeModel *model = Application::historyManager()->historyTreeModel();
@@ -441,11 +433,10 @@ void NewTabPage::bookmarksPage()
{
m_root.addClass("bookmarks");
- QWebElement editBookmarks = markup(".link");
- editBookmarks.findFirst("a").setAttribute("href", "about:bookmarks/edit");
- QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("bookmarks-organize", KIconLoader::SizeSmall || KIconLoader::Small));
- editBookmarks.findFirst("img").setAttribute("src" , iconPath);
- editBookmarks.findFirst("span").appendInside(i18n("Edit Bookmarks"));
+ const QWebElement editBookmarks = createLinkItem(i18n("Edit Bookmarks"),
+ QLatin1String("about:bookmarks/edit"),
+ QLatin1String("bookmarks-organize"),
+ KIconLoader::Toolbar);
m_root.document().findFirst("#actions").appendInside(editBookmarks);
KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup();
@@ -542,11 +533,10 @@ void NewTabPage::downloadsPage()
{
m_root.addClass("downloads");
- QWebElement clearData = markup(".link");
- clearData.findFirst("a").setAttribute("href", "about:downloads/clear");
- QString iconPath = QString("file:///" + KIconLoader::global()->iconPath("edit-clear", KIconLoader::SizeSmall || KIconLoader::Small));
- clearData.findFirst("img").setAttribute("src" , iconPath);
- clearData.findFirst("span").appendInside(i18n("Clear Private Data"));
+ const QWebElement clearData = createLinkItem(i18n("Clear Private Data"),
+ QLatin1String("about:downloads/clear"),
+ QLatin1String("edit-clear"),
+ KIconLoader::Toolbar);
m_root.document().findFirst("#actions").appendInside(clearData);
DownloadList list = Application::instance()->downloads();
@@ -595,3 +585,15 @@ void NewTabPage::downloadsPage()
div.lastChild().setPlainText(i18n("Open file"));
}
}
+
+QWebElement NewTabPage::createLinkItem(const QString &title, const QString &urlString, const QString &iconPath, int groupOrSize) const
+{
+ const KIconLoader * const loader = KIconLoader::global();
+
+ QWebElement nav = markup(QLatin1String(".link"));
+ nav.findFirst(QString('a')).setAttribute(QLatin1String("href"), urlString);
+ nav.findFirst(QLatin1String("img")).setAttribute(QLatin1String("src"),
+ QString::fromLatin1("file://") + loader->iconPath(iconPath, groupOrSize));
+ nav.findFirst(QLatin1String("span")).appendInside(title);
+ return nav;
+}
diff --git a/src/newtabpage.h b/src/newtabpage.h
index ad4941d3..2560beb2 100644
--- a/src/newtabpage.h
+++ b/src/newtabpage.h
@@ -33,6 +33,7 @@
#include "rekonq_defines.h"
// KDE Includes
+#include <KIconLoader>
#include <KUrl>
// Qt Includes
@@ -107,7 +108,7 @@ private:
* It works for all elements defined here.
*
*/
- inline QWebElement markup(const QString &selector)
+ inline QWebElement markup(const QString &selector) const
{
return m_root.document().findFirst("#models > " + selector).clone();
}
@@ -115,6 +116,8 @@ private:
QString checkTitle(const QString &title);
private:
+ QWebElement createLinkItem(const QString &title, const QString &urlString, const QString &iconPath, int groupOrSize) const;
+
QString m_html;
QWebElement m_root;
};
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/generalwidget.cpp b/src/settings/generalwidget.cpp
index 09c9e5c7..94f8b9c6 100644
--- a/src/settings/generalwidget.cpp
+++ b/src/settings/generalwidget.cpp
@@ -36,6 +36,8 @@
#include "mainwindow.h"
#include "webtab.h"
+//KDE Includes
+#include <kstandarddirs.h>
GeneralWidget::GeneralWidget(QWidget *parent)
: QWidget(parent)
@@ -48,6 +50,8 @@ GeneralWidget::GeneralWidget(QWidget *parent)
disableHomeSettings(ReKonfig::useNewTabPage());
connect(kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool)));
+
+ checkKGetPresence();
}
@@ -83,3 +87,21 @@ void GeneralWidget::disableHomeSettings(bool b)
kcfg_homePage->setEnabled(!b);
setHomeToCurrentPageButton->setEnabled(!b);
}
+
+void GeneralWidget::checkKGetPresence()
+{
+ if (KStandardDirs::findExe("kget").isNull())
+ {
+ ReKonfig::setKgetDownload(false);
+ ReKonfig::setKgetList(false);
+ kcfg_kgetDownload->setDisabled(true);
+ kcfg_kgetList->setDisabled(true);
+ kcfg_kgetDownload->setToolTip(i18n("Install KGet to enable rekonq to use KGet as download manager"));
+
+ }
+ else
+ {
+ kcfg_kgetDownload->setDisabled(false);
+ kcfg_kgetList->setDisabled(false);
+ }
+}
diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h
index d669fd04..b2cefcfa 100644
--- a/src/settings/generalwidget.h
+++ b/src/settings/generalwidget.h
@@ -44,6 +44,7 @@ public:
void save();
bool changed();
+ void checkKGetPresence();
signals:
void changed(bool);
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
new file mode 100644
index 00000000..ccfe4914
--- /dev/null
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -0,0 +1,157 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus 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/>.
+*
+* ============================================================ */
+
+
+// Auto Includes
+#include "bookmarkwidget.h"
+#include "bookmarkwidget.moc"
+
+// Local includes
+#include "application.h"
+#include "bookmarksmanager.h"
+
+// KDE Includes
+#include <KLocalizedString>
+#include <KLineEdit>
+#include <KMessageBox>
+
+// Qt Includes
+#include <QtGui/QFormLayout>
+#include <QtGui/QDialogButtonBox>
+#include <QtGui/QLabel>
+#include <QtGui/QPushButton>
+
+
+
+BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
+ : QFrame(parent, Qt::Popup)
+ , m_bookmark(bookmark)
+{
+ setAttribute(Qt::WA_DeleteOnClose);
+ setFixedWidth(350);
+ setFrameStyle(QFrame::Panel);
+
+ QFormLayout *layout = new QFormLayout(this);
+ setLayout(layout);
+
+ QHBoxLayout *hLayout = new QHBoxLayout();
+
+ QLabel *bookmarkIcon = new QLabel(this);
+ bookmarkIcon->setPixmap(KIcon("bookmarks").pixmap(32, 32));
+ hLayout->addWidget(bookmarkIcon);
+ hLayout->setSpacing(10);
+
+ QVBoxLayout *vLayout = new QVBoxLayout();
+
+ QLabel *bookmarkInfo = new QLabel(this);
+ bookmarkInfo->setText(i18n("Edit this Bookmark"));
+ QFont font;
+ font.setPointSize(font.pointSize() + 2);
+ bookmarkInfo->setFont(font);
+
+ vLayout->addWidget(bookmarkInfo);
+
+ QPushButton *removeButton = new QPushButton(this);
+ removeButton->setText(i18n("Remove this Bookmark"));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
+
+ vLayout->addWidget(removeButton);
+ hLayout->addLayout(vLayout);
+ layout->addItem(hLayout);
+
+
+ QLabel *nameLabel = new QLabel(this);
+ nameLabel->setText(i18n("Name:"));
+
+ m_name = new KLineEdit(this);
+ if (m_bookmark.isNull())
+ {
+ m_name->setEnabled(false);
+ }
+ else
+ {
+ m_name->setText(m_bookmark.text());
+ m_name->setFocus();
+ }
+
+ layout->addRow(nameLabel, m_name);
+
+ QLabel *urlLabel = new QLabel(this);
+ urlLabel->setText("URL:");
+
+ KLineEdit *url = new KLineEdit(this);
+ url->setText(m_bookmark.url().url());
+ url->setEnabled(false);
+
+ layout->addRow(urlLabel, url);
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+ buttonBox->button(QDialogButtonBox::Ok)->setText(i18n("Done"));
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ layout->addWidget(buttonBox);
+}
+
+
+BookmarkWidget::~BookmarkWidget()
+{
+ delete m_name;
+}
+
+
+void BookmarkWidget::accept()
+{
+ if (!m_bookmark.isNull() && m_name->text() != m_bookmark.fullText())
+ {
+ m_bookmark.setFullText(m_name->text());
+ Application::bookmarkProvider()->bookmarkManager()->emitChanged();
+ }
+ reject();
+}
+
+
+void BookmarkWidget::reject()
+{
+ close();
+ deleteLater();
+}
+
+
+void BookmarkWidget::showAt(const QPoint &pos)
+{
+ QPoint p;
+ p.setX(pos.x());
+ p.setY(pos.y() + 12);
+ move(p);
+ show();
+}
+
+
+void BookmarkWidget::removeBookmark()
+{
+ Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(m_bookmark);
+ reject();
+}
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
new file mode 100644
index 00000000..cdab328e
--- /dev/null
+++ b/src/urlbar/bookmarkwidget.h
@@ -0,0 +1,63 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus 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 BOOKMARKWIDGET_H
+#define BOOKMARKWIDGET_H
+
+// Rekonq Includes
+#include "rekonq_defines.h"
+
+// KDE Includes
+#include <KUrl>
+#include <KBookmark>
+#include <KLineEdit>
+
+// Qt Includes
+#include <QtGui/QFrame>
+
+
+class BookmarkWidget : public QFrame
+{
+ Q_OBJECT
+
+public:
+ BookmarkWidget(const KBookmark &bookmark, QWidget *parent = 0);
+ ~BookmarkWidget();
+
+ void showAt(const QPoint &pos);
+
+private slots:
+ void accept();
+ void reject();
+ void removeBookmark();
+
+private:
+ KBookmark m_bookmark;
+ KLineEdit *m_name;
+
+};
+
+#endif // BOOKMARKWIDGET_H
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 5c3cba28..0d130b94 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -41,6 +41,8 @@
#include "webpage.h"
#include "webview.h"
#include "completionwidget.h"
+#include "bookmarksmanager.h"
+#include "bookmarkwidget.h"
// KDE Includes
#include <KCompletionBox>
@@ -107,6 +109,11 @@ UrlBar::UrlBar(QWidget *parent)
connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
connect(_tab->view(), SIGNAL(loadStarted()), this, SLOT(clearRightIcons()));
+ // bookmark icon
+ _icon->setIcon(KIcon("bookmarks").pixmap(32,32, QIcon::Disabled));
+ connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(const QString &, const QString &)), this, SLOT(onBookmarksChanged()));
+ connect(_icon, SIGNAL(clicked(const QPoint &)), this, SLOT(showBookmarkInfo(const QPoint &)));
+
// load typed urls
connect(this, SIGNAL(returnPressed(const QString &)), this, SLOT(loadTyped(const QString &)));
@@ -138,7 +145,8 @@ void UrlBar::setQUrl(const QUrl& url)
clearFocus();
KLineEdit::setUrl(url);
setCursorPosition(0);
- _icon->setIcon(Application::icon(url));
+// _icon->setIcon(Application::icon(url));
+// updateIcon();
}
}
@@ -185,9 +193,23 @@ void UrlBar::paintEvent(QPaintEvent *event)
}
else
{
- QColor loadingColor = Application::palette().color(QPalette::ToolTipBase);
+ QColor highlight = Application::palette().color(QPalette::Highlight);
+
+ int r = (highlight.red()+2*backgroundColor.red())/3;
+ int g = (highlight.green()+2*backgroundColor.green())/3;
+ int b = (highlight.blue()+2*backgroundColor.blue())/3;
+
+ QColor loadingColor(r, g, b);
- QLinearGradient gradient( QPoint(0, 0), QPoint(width(), height()) );
+ if (abs(loadingColor.lightness() - backgroundColor.lightness()) < 20) //eg. Gaia color scheme
+ {
+ r = (2*highlight.red()+backgroundColor.red())/3;
+ g = (2*highlight.green()+backgroundColor.green())/3;
+ b = (2*highlight.blue()+backgroundColor.blue())/3;
+ loadingColor = QColor(r, g, b);
+ }
+
+ QLinearGradient gradient( QPoint(0, 0), QPoint(width(), 0) );
gradient.setColorAt(0, loadingColor);
gradient.setColorAt(((double)progr) / 100 - .000001, loadingColor);
gradient.setColorAt(((double)progr) / 100, backgroundColor);
@@ -286,6 +308,18 @@ void UrlBar::loadFinished()
return;
}
+ // setting bookmark icon
+ 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??
if (ReKonfig::kgetList())
{
@@ -316,6 +350,35 @@ void UrlBar::loadFinished()
}
+void UrlBar::showBookmarkInfo(const QPoint &pos)
+{
+ if( _tab->url().scheme() == QL1S("about") )
+ return;
+
+ KBookmark bookmark = Application::bookmarkProvider()->bookmarkForUrl(_tab->url());
+
+ IconButton *bt = qobject_cast<IconButton *>(this->sender());
+ if (!bt)
+ return;
+
+ if (bookmark.isNull())
+ {
+ bookmark = Application::bookmarkProvider()->rootGroup().addBookmark(_tab->view()->title(), _tab->url());
+ Application::bookmarkProvider()->bookmarkManager()->emitChanged();
+ }
+
+ BookmarkWidget *widget = new BookmarkWidget(bookmark, window());
+ widget->showAt(pos);
+}
+
+
+void UrlBar::onBookmarksChanged()
+{
+ clearRightIcons();
+ loadFinished();
+}
+
+
void UrlBar::loadTyped(const QString &text)
{
activated( KUrl(text) );
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index 7fbe8bb4..d0e2b60e 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -104,6 +104,9 @@ private slots:
void detectTypedString(const QString &);
void suggest();
+ void showBookmarkInfo(const QPoint &pos);
+ void onBookmarksChanged();
+
protected:
void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *event);
diff --git a/src/webview.cpp b/src/webview.cpp
index 5a7cfeac..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;
@@ -677,9 +677,9 @@ void WebView::scrollTick()
}
if (_scrollBottom)
- page()->mainFrame()->setScrollPosition( QPoint( 0, page()->mainFrame()->scrollPosition().y() + scroll_y ) );
+ page()->currentFrame()->scroll(0, scroll_y);
else
- page()->mainFrame()->setScrollPosition( QPoint( 0, page()->mainFrame()->scrollPosition().y() - scroll_y ) );
+ page()->currentFrame()->scroll(0, -scroll_y);
}
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index 485d71a9..b07aee03 100644
--- a/src/zoombar.cpp
+++ b/src/zoombar.cpp
@@ -124,11 +124,19 @@ void ZoomBar::show()
// show findbar if not visible
if (isHidden())
{
+ emit visibilityChanged(true);
QWidget::show();
}
}
+void ZoomBar::hide()
+{
+ emit visibilityChanged(false);
+ QWidget::hide();
+}
+
+
void ZoomBar::zoomIn()
{
setValue(m_zoomSlider->value() + 1);
@@ -168,14 +176,7 @@ void ZoomBar::setValue(int value)
}
-void ZoomBar::setVisible(bool visible)
-{
- emit visibilityChanged(visible);
- QWidget::setVisible(visible);
-}
-
-
void ZoomBar::toggleVisibility()
{
- setVisible(!isVisible());
+ isVisible() ? hide() : show();
}
diff --git a/src/zoombar.h b/src/zoombar.h
index 8e8d9aba..adb0067b 100644
--- a/src/zoombar.h
+++ b/src/zoombar.h
@@ -54,6 +54,8 @@ public:
public slots:
void show();
+ void hide();
+
void zoomIn();
void zoomOut();
void zoomNormal();
@@ -65,9 +67,6 @@ public slots:
signals:
void visibilityChanged(bool);
-protected:
- void setVisible(bool visible);
-
private:
QToolButton *m_zoomIn;
QToolButton *m_zoomOut;