summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-04-28 03:19:14 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-04-28 03:19:14 +0200
commit32da13f039241349c894f5c13cc1954c16c2e783 (patch)
tree63e42d04ac8d38a0650e35c08057be854ebfb508 /src
parentMerge commit 'avaddon/master' into MERGING (diff)
downloadrekonq-32da13f039241349c894f5c13cc1954c16c2e783.tar.xz
Revert "Some changes ported for merge to mainline (bookmarks & links handling related)"
links hadling problem This reverts commit fdbd70a77a8c294e0a578073c738f3bc4dfa6ab5.
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp20
-rw-r--r--src/application.h20
-rw-r--r--src/bookmarks.cpp44
-rw-r--r--src/bookmarks.h49
-rw-r--r--src/main.cpp18
-rw-r--r--src/mainview.cpp83
-rw-r--r--src/mainview.h23
-rw-r--r--src/mainwindow.cpp43
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/panelhistory.cpp6
-rw-r--r--src/panelhistory.h4
-rw-r--r--src/sidepanel.cpp9
-rw-r--r--src/sidepanel.h10
-rw-r--r--src/webview.cpp24
14 files changed, 150 insertions, 204 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 25b328e6..eee803bc 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -79,12 +79,12 @@ int Application::newInstance()
if (!m_mainWindow)
{
m_mainWindow = new MainWindow();
-
+
m_mainWindow->setObjectName("MainWindow");
setWindowIcon(KIcon("rekonq"));
-
+
m_mainWindow->show();
-
+
QTimer::singleShot(0, this, SLOT(postLaunch()));
}
@@ -94,7 +94,7 @@ int Application::newInstance()
{
KUrl url = MainWindow::guessUrlFromString(args->arg(i));
newWebView();
- emit openUrl(url);
+ mainWindow()->loadUrl(url);
}
args->clear();
}
@@ -135,15 +135,21 @@ void Application::slotSaveConfiguration() const
}
+void Application::openUrl(const KUrl &url)
+{
+ mainWindow()->loadUrl(url);
+}
+
+
MainWindow *Application::mainWindow()
{
return m_mainWindow;
}
-WebView *Application::newWebView(bool makeCurrent)
+WebView *Application::newWebView()
{
- return m_mainWindow->mainView()->newWebView(makeCurrent);
+ return m_mainWindow->mainView()->newWebView();
}
@@ -177,7 +183,7 @@ HistoryManager *Application::historyManager()
DownloadManager *Application::downloadManager()
{
- if (!s_downloadManager)
+ if (!s_downloadManager)
{
s_downloadManager = new DownloadManager();
}
diff --git a/src/application.h b/src/application.h
index dfcfab62..98b213a3 100644
--- a/src/application.h
+++ b/src/application.h
@@ -47,18 +47,6 @@ class MainWindow;
class NetworkAccessManager;
class WebView;
-namespace Rekonq {
- /**
- * @short Open link options
- * Defferent modes of opening new tab
- */
- enum OpenType {
- Default, ///< open url according to users settings
- Current, ///< open url in current tab
- New, ///< open url in new tab and make it current
- Background ///< open url in new tab in background
- };
-}
/**
*
@@ -74,7 +62,7 @@ public:
static Application *instance();
MainWindow *mainWindow();
- WebView* newWebView(bool makeCurrent = true);
+ WebView* newWebView();
KIcon icon(const KUrl &url) const;
@@ -84,16 +72,13 @@ public:
static DownloadManager *downloadManager();
static BookmarkProvider *bookmarkProvider();
-signals:
- void openUrl(const KUrl &url, Rekonq::OpenType type=Rekonq::Current);
-
public slots:
/**
* Save application's configuration
* @see ReKonfig::self()->writeConfig();
*/
void slotSaveConfiguration() const;
-
+
private slots:
@@ -101,6 +86,7 @@ private slots:
* Any actions that can be delayed until the window is visible
*/
void postLaunch();
+ void openUrl(const KUrl &url);
private:
static QPointer<HistoryManager> s_historyManager;
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index 70afc29e..568759a8 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -27,6 +27,7 @@
// Local Includes
#include "mainwindow.h"
#include "webview.h"
+#include "application.h"
// KDE Includes
#include <KActionCollection>
@@ -54,14 +55,14 @@ BookmarkOwner::BookmarkOwner(QObject *parent)
}
-void BookmarkOwner::openBookmark(const KBookmark &bookmark,
- Qt::MouseButtons mouseButtons,
+void BookmarkOwner::openBookmark(const KBookmark & bookmark,
+ Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers)
{
- Q_UNUSED(mouseButtons)
+ Q_UNUSED(mouseButtons)
Q_UNUSED(keyboardModifiers)
- emit openUrl(bookmark.url(), Rekonq::Current);
+ emit openUrl(bookmark.url());
}
@@ -77,15 +78,6 @@ QString BookmarkOwner::currentTitle() const
}
-void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm)
-{
- QList<KUrl> urlList = bm.groupUrlList();
- //kDebug() << urlList;
- QList<KUrl>::iterator url;
- for(url = urlList.begin(); url != urlList.end(); ++url)
- emit openUrl(*url, Rekonq::Background);
-}
-
// ------------------------------------------------------------------------------------------------------
@@ -93,10 +85,11 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
KBookmarkOwner *owner,
KMenu *menu,
KActionCollection* actionCollection)
- : KBookmarkMenu(manager, owner, menu, actionCollection)
+ : KBookmarkMenu(manager, owner, menu, actionCollection)
+
{
actionCollection->addAction(KStandardAction::AddBookmark,
- QLatin1String("add_bookmark_payload"),
+ QLatin1String("add_bookmark_payload"),
this, SLOT(slotAddBookmark()));
}
@@ -105,7 +98,7 @@ BookmarkMenu::~BookmarkMenu()
{
}
-
+
KMenu *BookmarkMenu::viewContextMenu(QAction *action)
{
return contextMenu(action);
@@ -123,7 +116,7 @@ void BookmarkMenu::slotAddBookmark()
manager()->emitChanged();
return;
}
-
+
KBookmarkMenu::slotAddBookmark();
}
@@ -158,13 +151,12 @@ BookmarkProvider::BookmarkProvider(QWidget *parent)
}
}
m_manager = KBookmarkManager::managerForExternalFile(bookfile.path());
- connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
+ connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
this, SLOT(slotBookmarksChanged(const QString &, const QString &)));
// setup menu
m_owner = new BookmarkOwner(this);
- connect(m_owner, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)),
- this, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)));
+ connect(m_owner, SIGNAL(openUrl(const KUrl& )), this, SIGNAL(openUrl(const KUrl& )));
m_bookmarkMenu = new BookmarkMenu(m_manager, m_owner, m_menu, m_actionCollection);
// setup toolbar
@@ -192,9 +184,9 @@ void BookmarkProvider::setupToolBar()
m_bookmarkToolBar->setContentsMargins(0, 0, 0, 0);
m_bookmarkToolBar->setMinimumHeight(16);
m_bookmarkToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(m_bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)),
+ connect(m_bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(contextMenu(const QPoint &)));
-
+
slotBookmarksChanged("", "");
}
@@ -209,13 +201,13 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
kWarning() << "There is no bookmark toolbar";
return;
}
-
+
KActionCollection bookmarkCollection(this);
-
+
KBookmarkGroup toolBarGroup = m_manager->toolbar();
if (toolBarGroup.isNull())
return;
-
+
KBookmark bookmark = toolBarGroup.first();
while (!bookmark.isNull()) {
if (!bookmark.isGroup())
@@ -232,7 +224,7 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
QAction *BookmarkProvider::actionByName(const QString &name)
-{
+{
QAction *action = m_actionCollection->action(name);
if (action)
return action;
diff --git a/src/bookmarks.h b/src/bookmarks.h
index 32982c8a..5ac1270d 100644
--- a/src/bookmarks.h
+++ b/src/bookmarks.h
@@ -23,9 +23,6 @@
#ifndef BOOKMARKS_H
#define BOOKMARKS_H
-// Local includes
-#include "application.h"
-
// Qt Includes
#include <QWidget>
@@ -72,8 +69,8 @@ public:
* @param mouseButtons the mouse buttons clicked to select the bookmark
* @param keyboardModifiers the keyboard modifiers pushed when the bookmark was selected
*/
- virtual void openBookmark(const KBookmark &bookmark,
- Qt::MouseButtons mouseButtons,
+ virtual void openBookmark(const KBookmark &bookmark,
+ Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers);
@@ -98,23 +95,14 @@ public:
*/
virtual bool supportsTabs() const { return true; }
- /**
- * Called if the user wants to open every bookmark in this folder in a new tab.
- * The default implementation does nothing.
- * This is only called if supportsTabs() returns true
- */
- virtual void openFolderinTabs(const KBookmarkGroup &bm);
-
signals:
/**
* This signal is emitted when an url has to be loaded
*
* @param url the URL to load
- * @param type type of load
- * @see Application::OpenType
*
*/
- void openUrl(const KUrl &url, Rekonq::OpenType type);
+ void openUrl(const KUrl &);
private:
@@ -136,17 +124,17 @@ class BookmarkMenu : public KBookmarkMenu
Q_OBJECT
public:
- BookmarkMenu(KBookmarkManager* manager,
- KBookmarkOwner* owner,
- KMenu* menu,
+ BookmarkMenu(KBookmarkManager* manager,
+ KBookmarkOwner* owner,
+ KMenu* menu,
KActionCollection* actionCollection);
~BookmarkMenu();
-
+
virtual KMenu *viewContextMenu(QAction* action);
-
+
protected slots:
void slotAddBookmark();
-
+
};
@@ -175,7 +163,7 @@ public:
*/
BookmarkProvider(QWidget* parent=0);
~BookmarkProvider();
-
+
/**
* @short Get the Bookmarks Menu Action
* @return the Bookmarks Menu
@@ -201,14 +189,11 @@ public:
signals:
/**
- * This signal is emitted when an url has to be loaded
- *
- * @param url the URL to load
- * @param type type of load
- * @see Application::OpenType
- *
- */
- void openUrl(const KUrl &url, Rekonq::OpenType type);
+ * @short This signal is emitted when an url has to be loaded
+ *
+ * @param url the URL to load
+ */
+ void openUrl(const KUrl &url);
public slots:
@@ -217,12 +202,12 @@ public slots:
* @param point Point on whitch you want to open this menu
*/
void contextMenu(const QPoint &point);
-
+
/**
* @short Waits for signal that the group with the address has been modified by the caller.
* Waits for signal that the group (or any of its children) with the address
* @p groupAddress (e.g. "/4/5") has been modified by the caller @p caller.
- *
+ *
* @param group bookmark group adress
* @param caller caller that modified the bookmarks
* @see KBookmarkManager::changed
diff --git a/src/main.cpp b/src/main.cpp
index ea7ab8a4..d5e7c33b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -47,18 +47,14 @@ int main(int argc, char **argv)
);
// about authors
- about.addAuthor(ki18n("Andrea Diamantini"),
- ki18n("Project Lead, Developer, Italian translations"),
- "adjam7@gmail.com",
+ about.addAuthor(ki18n("Andrea Diamantini"),
+ ki18n("Project Lead, Developer, Italian translations"),
+ "adjam7@gmail.com",
"http://www.adjam.org");
- about.addAuthor(ki18n("Domrachev Alexandr"),
- ki18n("Developer, Russian translations"),
- "alexandr.domrachev@gmail.com",
- "");
-
-// about.addAuthor(ki18n("your name"),
-// ki18n("your role"),
-// "your mail",
+
+// about.addAuthor(ki18n("your name"),
+// ki18n("your role"),
+// "your mail",
// "your site");
// Initialize command line args
diff --git a/src/mainview.cpp b/src/mainview.cpp
index c3818b50..cbfd418b 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -80,14 +80,9 @@ MainView::MainView(QWidget *parent)
m_recentlyClosedTabsAction->setEnabled(false);
// --
+ connect(this, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrlInCurrentTab(const KUrl &)));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
- connect(Application::instance(), SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)),
- this, SLOT(openUrl(const KUrl &, Rekonq::OpenType)));
- // bookmarks loading
- connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)),
- this, SLOT(openUrl(const KUrl &, Rekonq::OpenType)));
-
setTabsClosable(true);
connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(slotCloseTab(int)));
}
@@ -266,18 +261,16 @@ void MainView::slotCurrentChanged(int index)
WebView *oldWebView = this->webView(m_urlBars->currentIndex());
if (oldWebView)
{
- disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
+ disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)),
this, SIGNAL(showStatusBarMessage(const QString&)));
- disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
+ disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
this, SIGNAL(linkHovered(const QString&)));
- disconnect(oldWebView, SIGNAL(loadProgress(int)),
+ disconnect(oldWebView, SIGNAL(loadProgress(int)),
this, SIGNAL(loadProgress(int)));
}
- connect(webView, SIGNAL(statusBarMessage(const QString &)),
- this, SIGNAL(showStatusBarMessage(const QString &)));
- connect(webView->page(), SIGNAL(linkHovered(const QString &, const QString &, const QString &)),
- this, SIGNAL(linkHovered(const QString &)));
+ connect(webView, SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&)));
+ connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&)));
connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
emit setCurrentTitle(webView->title());
@@ -323,17 +316,17 @@ WebView *MainView::newWebView(bool makeCurrent)
{
// line edit
UrlBar *urlBar = new UrlBar; // Ownership of widget is passed on to the QStackedWidget (addWidget method).
- connect(urlBar, SIGNAL(activated(const KUrl &)), this, SLOT(openUrl(const KUrl &)));
+ connect(urlBar, SIGNAL(activated(const KUrl&)), this, SLOT(loadUrlInCurrentTab(const KUrl&)));
m_urlBars->addUrlBar(urlBar);
WebView *webView = new WebView; // should be deleted on tab close
-
+
// connecting webview with urlbar
connect(webView, SIGNAL(loadProgress(int)), urlBar, SLOT(slotUpdateProgress(int)));
connect(webView, SIGNAL(loadFinished(bool)), urlBar, SLOT(slotLoadFinished(bool)));
connect(webView, SIGNAL(urlChanged(const QUrl &)), urlBar, SLOT(setUrl(const QUrl &)));
connect(webView, SIGNAL(iconChanged()), urlBar, SLOT(slotUpdateUrl()));
-
+
// connecting webview with mainview
connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int)));
@@ -346,17 +339,17 @@ WebView *MainView::newWebView(bool makeCurrent)
connect(webView, SIGNAL(shiftCtrlTabPressed()), this, SLOT(previousTab()));
// connecting webPage signals with mainview
- connect(webView->page(), SIGNAL(windowCloseRequested()),
+ connect(webView->page(), SIGNAL(windowCloseRequested()),
this, SLOT(windowCloseRequested()));
- connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
+ connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
this, SIGNAL(geometryChangeRequested(const QRect &)));
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
this, SIGNAL(printRequested(QWebFrame *)));
- connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
+ connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
- connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
+ connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
- connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
+ connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
addTab(webView, i18n("(Untitled)"));
@@ -536,9 +529,9 @@ void MainView::webViewLoadProgress(int progress)
{
return;
}
-
+
double totalBytes = static_cast<double>(webView->webPage()->totalBytes() / 1024);
-
+
QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB") );
emit showStatusBarMessage(message);
}
@@ -548,7 +541,7 @@ void MainView::webViewLoadFinished(bool ok)
{
WebView *webView = qobject_cast<WebView*>(sender());
int index = webViewIndex(webView);
-
+
if (-1 != index)
{
QLabel *label = animatedLoading(index, true);
@@ -556,7 +549,7 @@ void MainView::webViewLoadFinished(bool ok)
if(movie)
movie->stop();
}
-
+
webViewIconChanged();
// don't display messages for background tabs
@@ -564,7 +557,7 @@ void MainView::webViewLoadFinished(bool ok)
{
return;
}
-
+
if (ok)
emit showStatusBarMessage(i18n("Done"));
else
@@ -639,45 +632,21 @@ void MainView::aboutToShowRecentTabsMenu()
void MainView::aboutToShowRecentTriggeredAction(QAction *action)
{
KUrl url = action->data().toUrl();
- openUrl(url, Rekonq::Current);
+ loadUrlInCurrentTab(url);
}
-void MainView::openUrl(const KUrl& url, Rekonq::OpenType type)
+void MainView::loadUrlInCurrentTab(const KUrl &url)
{
- kDebug() << "sender:" << sender() << " line:" << __LINE__;
-
- if (url.isEmpty())
- {
- kWarning() << "Can't load an empty url; sender:" << sender() << "line: " << __LINE__;
- return;
- }
-
- WebView *webView = NULL;
- if (type == Rekonq::New)
- webView = newWebView(true);
- else if (type == Rekonq::Background)
- webView = newWebView(false);
- else
- webView = currentWebView();
-
- if (!webView)
+ WebView *webView = currentWebView();
+ if (webView)
{
- kWarning() << "Can't find the view" << "line:" << __LINE__;
- return;
+ webView->loadUrl(url);
+ webView->setFocus();
}
- webView->loadUrl(url);
- webView->setFocus();
-
- currentUrlBar()->setUrl(url.prettyUrl());
}
-void MainView::loadUrlInCurrentTab(const KUrl &url)
-{
- openUrl(url);
-}
-
void MainView::nextTab()
{
int next = currentIndex() + 1;
@@ -710,7 +679,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
return 0;
QLabel *label = qobject_cast<QLabel*>(m_tabBar->tabButton(index, QTabBar::LeftSide));
- if (!label)
+ if (!label)
{
label = new QLabel(this);
}
diff --git a/src/mainview.h b/src/mainview.h
index 97b9fbad..5493d6ab 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -26,7 +26,6 @@
// Local Includes
#include "webview.h"
-#include "application.h"
// KDE Includes
#include <KTabWidget>
@@ -49,7 +48,7 @@ class UrlBar;
/**
- * This class represent rekonq Main View. It contains all WebViews and a stack widget
+ * This class represent rekonq Main View. It contains all WebViews and a stack widget
* of associated line edits.
*
*/
@@ -65,6 +64,7 @@ public:
signals:
// tab widget signals
+ void loadUrlPage(const KUrl &url);
void tabsChanged();
void lastTabClosed();
@@ -73,7 +73,7 @@ signals:
void showStatusBarMessage(const QString &message);
void linkHovered(const QString &link);
void loadProgress(int progress);
-
+
void geometryChangeRequested(const QRect &geometry);
void menuBarVisibilityChangeRequested(bool visible);
void statusBarVisibilityChangeRequested(bool visible);
@@ -82,19 +82,19 @@ signals:
public:
// void setupTabButtons();
-
+
UrlBar *urlBar(int index) const;
UrlBar *currentUrlBar() const { return urlBar(-1); }
WebView *webView(int index) const;
QList<WebView *> tabs(); // ?
-
+
// inlines
TabBar *tabBar() const { return m_tabBar; }
StackedUrlBar *urlBarStack() const { return m_urlBars; }
WebView *currentWebView() const { return webView(currentIndex()); }
int webViewIndex(WebView *webView) const { return indexOf(webView); }
KAction *recentlyClosedTabsAction() const { return m_recentlyClosedTabsAction; }
-
+
/**
* show and hide TabBar if user doesn't choose
* "Always Show TabBar" option
@@ -115,6 +115,7 @@ public slots:
* @return a pointer to the new WebView
*/
WebView *newWebView(bool makeCurrent = true);
+ void loadUrlInCurrentTab(const KUrl &url);
void slotCloneTab(int index = -1);
void slotCloseTab(int index = -1);
void slotCloseOtherTabs(int index);
@@ -122,7 +123,6 @@ public slots:
void slotReloadAllTabs();
void nextTab();
void previousTab();
- void openUrl(const KUrl& url, Rekonq::OpenType type=Rekonq::Current);
// WEB slot actions
void slotWebReload();
@@ -136,7 +136,6 @@ public slots:
void slotWebPaste();
private slots:
- KDE_DEPRECATED void loadUrlInCurrentTab(const KUrl &url);
void slotCurrentChanged(int index);
void aboutToShowRecentTabsMenu();
void aboutToShowRecentTriggeredAction(QAction *action); // need QAction!
@@ -151,7 +150,7 @@ private slots:
void windowCloseRequested();
/**
- * This functions move tab informations "from index to index"
+ * This functions move tab informations "from index to index"
*
* @param fromIndex the index from which we move
*
@@ -162,12 +161,12 @@ private slots:
private:
/**
- * This function creates (if not exists) and returns a QLabel
+ * This function creates (if not exists) and returns a QLabel
* with a loading QMovie.
- * Imported from Arora's code.
+ * Imported from Arora's code.
*
* @param index the tab index where inserting the animated label
- * @param addMovie creates or not a loading movie
+ * @param addMovie creates or not a loading movie
*
* @return animated label's pointer
*/
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 5f112abd..a9364ef1 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -103,6 +103,7 @@ MainWindow::MainWindow()
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// --------- connect signals and slots
+ connect(m_view, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrl(const KUrl &)));
connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &)));
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &)));
@@ -117,6 +118,9 @@ MainWindow::MainWindow()
// update toolbar actions
connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions()));
connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions()));
+
+ // bookmarks loading
+ connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
slotUpdateWindowTitle();
@@ -180,7 +184,7 @@ void MainWindow::setupToolBars()
a = new KAction(i18n("Search Bar"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_K));
a->setDefaultWidget(m_searchBar);
- connect(m_searchBar, SIGNAL(search(const KUrl&)), m_view, SLOT(openUrl(const KUrl &)));
+ connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
actionCollection()->addAction(QLatin1String("search_bar"), a);
// bookmarks bar
@@ -307,12 +311,11 @@ void MainWindow::setupSidePanel()
{
// Setup history side panel
m_sidePanel = new SidePanel(i18n("History"), this);
- connect(m_sidePanel, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)),
- m_view, SLOT(openUrl(const KUrl &, Rekonq::OpenType)));
+ connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration()));
-
+
addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel);
-
+
// setup side panel actions
KAction* a = new KAction(this);
a->setText(i18n("History"));
@@ -320,7 +323,7 @@ void MainWindow::setupSidePanel()
a->setChecked(ReKonfig::showSideBar());
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
actionCollection()->addAction(QLatin1String("show_history_panel"), a);
-
+
// connect to toogle action
connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger()));
}
@@ -329,7 +332,7 @@ void MainWindow::setupSidePanel()
void MainWindow::setupHistoryMenu()
{
HistoryMenu *historyMenu = new HistoryMenu(this);
- connect(historyMenu, SIGNAL(openUrl(const KUrl &)), m_view, SLOT(openUrl(const KUrl &)));
+ connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&)));
connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&)));
historyMenu->setTitle(i18n("&History"));
@@ -451,6 +454,16 @@ KUrl MainWindow::guessUrlFromString(const QString &string)
}
+void MainWindow::loadUrl(const KUrl &url)
+{
+ if (!currentTab() || url.isEmpty())
+ return;
+
+ m_view->currentUrlBar()->setUrl(url.prettyUrl());
+ m_view->loadUrlInCurrentTab(url);
+}
+
+
void MainWindow::slotOpenLocation()
{
m_view->currentUrlBar()->selectAll();
@@ -519,7 +532,7 @@ void MainWindow::slotFileOpen()
if (filePath.isEmpty())
return;
- mainView()->openUrl(guessUrlFromString(filePath));
+ loadUrl(guessUrlFromString(filePath));
}
@@ -680,7 +693,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen)
static bool bookmarksToolBarFlag;
static bool statusBarFlag;
static bool sidePanelFlag;
-
+
if (makeFullScreen == true)
{
// save current state
@@ -690,7 +703,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen)
bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden();
statusBarFlag = statusBar()->isHidden();
sidePanelFlag = sidePanel()->isHidden();
-
+
menuBar()->hide();
toolBar("mainToolBar")->hide();
toolBar("locationToolBar")->hide();
@@ -732,12 +745,12 @@ void MainWindow::slotViewPageSource()
/// TODO: autochoose tempfile suffix
sourceFile.setSuffix(QString(".html"));
sourceFile.setAutoRemove(false);
-
+
if (sourceFile.open())
{
QDataStream stream(&sourceFile);
stream << currentTab()->page()->mainFrame()->toHtml().toUtf8();
-
+
url = KUrl();
url.setPath(sourceFile.fileName());
isTempFile = true;
@@ -749,7 +762,7 @@ void MainWindow::slotViewPageSource()
void MainWindow::slotHome()
{
- mainView()->openUrl(KUrl(m_homePage));
+ loadUrl(KUrl(m_homePage));
}
@@ -883,7 +896,7 @@ bool MainWindow::queryClose()
if (m_view->count() > 1)
{
- int answer = KMessageBox::questionYesNoCancel(
+ int answer = KMessageBox::questionYesNoCancel(
this,
i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()),
i18n("Are you sure you want to close the window?"),
@@ -893,7 +906,7 @@ bool MainWindow::queryClose()
"confirmClosingMultipleTabs"
);
- switch (answer)
+ switch (answer)
{
case KMessageBox::Yes:
// Quit
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 6a162005..aedf049d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -77,6 +77,7 @@ private:
public slots:
void slotHome();
+ void loadUrl(const KUrl &url);
void slotUpdateBrowser();
protected:
diff --git a/src/panelhistory.cpp b/src/panelhistory.cpp
index 9e04a88c..57aa9281 100644
--- a/src/panelhistory.cpp
+++ b/src/panelhistory.cpp
@@ -64,7 +64,7 @@ PanelHistory::PanelHistory(QWidget *parent)
//-
HistoryManager *historyManager = Application::historyManager();
QAbstractItemModel *model = historyManager->historyTreeModel();
-
+
m_treeProxyModel->setSourceModel(model);
m_historyTreeView->setModel(m_treeProxyModel);
m_historyTreeView->setExpanded(m_treeProxyModel->index(0, 0), true);
@@ -72,7 +72,7 @@ PanelHistory::PanelHistory(QWidget *parent)
QFontMetrics fm(font());
int header = fm.width(QLatin1Char('m')) * 40;
m_historyTreeView->header()->resizeSection(0, header);
-
+
connect(search, SIGNAL(textChanged(QString)), m_treeProxyModel, SLOT(setFilterFixedString(QString)));
connect(m_historyTreeView, SIGNAL(activated(const QModelIndex&)), this, SLOT(open()));
}
@@ -90,6 +90,6 @@ void PanelHistory::open()
QModelIndex index = m_historyTreeView->currentIndex();
if (!index.parent().isValid())
return;
- emit openUrl(index.data(HistoryModel::UrlRole).toUrl(), Rekonq::Current);
+ emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
}
diff --git a/src/panelhistory.h b/src/panelhistory.h
index dfc3810d..45847565 100644
--- a/src/panelhistory.h
+++ b/src/panelhistory.h
@@ -41,7 +41,7 @@ public:
virtual ~PanelHistory();
signals:
- void openUrl(const KUrl &url, Rekonq::OpenType type=Rekonq::Current);
+ void openUrl(const KUrl&);
private slots:
void open();
@@ -49,7 +49,7 @@ private slots:
private:
QTreeView *m_historyTreeView;
TreeProxyModel *m_treeProxyModel;
-
+
};
#endif // PANELHISTORY_H
diff --git a/src/sidepanel.cpp b/src/sidepanel.cpp
index 7156c3d5..c4ba6c2a 100644
--- a/src/sidepanel.cpp
+++ b/src/sidepanel.cpp
@@ -36,10 +36,9 @@ SidePanel::SidePanel(const QString &title, QWidget *parent, Qt::WindowFlags flag
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
setShown(ReKonfig::showSideBar());
-
- connect(m_panelHistory, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)),
- this, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)));
-
+
+ connect(m_panelHistory, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&)));
+
setWidget(m_panelHistory);
}
@@ -48,7 +47,7 @@ SidePanel::~SidePanel()
{
// Save side panel's state
ReKonfig::setShowSideBar(!isHidden());
-
+
delete m_panelHistory;
}
diff --git a/src/sidepanel.h b/src/sidepanel.h
index 7efb919b..ae1a76f1 100644
--- a/src/sidepanel.h
+++ b/src/sidepanel.h
@@ -34,17 +34,17 @@ class SidePanel : public QDockWidget
{
Q_OBJECT
Q_DISABLE_COPY(SidePanel)
-
+
public:
explicit SidePanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~SidePanel();
-
+
signals:
- void openUrl(const KUrl&, Rekonq::OpenType type=Rekonq::Current);
-
+ void openUrl(const KUrl&);
+
private:
PanelHistory *m_panelHistory;
-
+
};
#endif // SIDEPANEL_H
diff --git a/src/webview.cpp b/src/webview.cpp
index 53802b9c..78f0e734 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -89,7 +89,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
if(m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
{
- webView = Application::instance()->newWebView(false);
+ webView = Application::instance()->newWebView();
webView->setFocus();
webView->load(request);
m_keyboardModifiers = Qt::NoModifier;
@@ -131,7 +131,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
// A short term hack until QtWebKit can get a reload without cache QAction
// *FYI* currently type is never NavigationTypeReload
// See: https://bugs.webkit.org/show_bug.cgi?id=24283
- if (qApp->keyboardModifiers() & Qt::ShiftModifier)
+ if (qApp->keyboardModifiers() & Qt::ShiftModifier)
{
QNetworkRequest newRequest(request);
newRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
@@ -217,7 +217,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
}
QUrl url(path);
- Application::instance()->mainWindow()->mainView()->openUrl(url);
+ Application::instance()->mainWindow()->loadUrl(url);
return;
}
@@ -308,27 +308,27 @@ KActionCollection* WebView::webActions()
a = new KAction(KIcon("tab-new"), i18n("Open Link in New &Tab"), this);
connect(a, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()) );
s_webActionCollection->addAction( QLatin1String("open_link_in_new_tab"), a);
-
+
a = pageAction(QWebPage::Cut);
a->setIcon(KIcon("edit-cut"));
a->setText(i18n("Cu&t"));
s_webActionCollection->addAction( QLatin1String("edit_cut"), a);
-
+
a = pageAction(QWebPage::Copy);
a->setIcon(KIcon("edit-copy"));
a->setText(i18n("&Copy"));
s_webActionCollection->addAction( QLatin1String("edit_copy"), a );
-
+
a = pageAction(QWebPage::Paste);
a->setIcon(KIcon("edit-paste"));
a->setText(i18n("&Paste"));
s_webActionCollection->addAction( QLatin1String("edit_paste"), a );
-
+
a = pageAction(QWebPage::DownloadImageToDisk);
a->setIcon(KIcon("folder-image"));
a->setText(i18n("&Save Image As..."));
s_webActionCollection->addAction( QLatin1String("save_image_as"), a );
-
+
a = pageAction(QWebPage::CopyImageToClipboard);
a->setIcon(KIcon("insert-image"));
a->setText(i18n("&Copy This Image"));
@@ -338,7 +338,7 @@ KActionCollection* WebView::webActions()
a->setIcon(KIcon("folder-downloads"));
a->setText(i18n("&Save Link As..."));
s_webActionCollection->addAction( QLatin1String("save_link_as"), a);
-
+
a = pageAction(QWebPage::CopyLinkToClipboard);
a->setIcon(KIcon("insert-link"));
a->setText(i18n("&Copy Link Location"));
@@ -358,12 +358,12 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
MainWindow *mainwindow = Application::instance()->mainWindow();
-
+
QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("add_bookmark_payload");
addBookmarkAction->setText(i18n("Bookmark This Page"));
addBookmarkAction->setData(QVariant());
KMenu menu(this);
-
+
bool linkIsEmpty = result.linkUrl().isEmpty();
if (!linkIsEmpty)
{
@@ -416,7 +416,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
addBookmarkAction->setText(i18n("&Bookmark This Link"));
}
menu.addSeparator();
-
+
menu.addAction(addBookmarkAction);
menu.exec(mapToGlobal(event->pos()));
}