summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp57
-rw-r--r--src/application.h5
-rw-r--r--src/mainview.cpp30
-rw-r--r--src/mainview.h14
-rw-r--r--src/mainwindow.cpp114
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/rekonq.kcfg4
-rw-r--r--src/tabbar.cpp4
-rw-r--r--src/tabpreviewpopup.cpp10
-rw-r--r--src/webtab.h5
-rw-r--r--src/zoombar.cpp1
11 files changed, 109 insertions, 136 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 6fd5e3c5..6ef0b0c3 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -269,8 +269,24 @@ int Application::newInstance()
if (isFirstLoad)
{
- // give me some time to do the other things..
- QTimer::singleShot(100, this, SLOT(postLaunch()));
+ // updating rekonq configuration
+ updateConfiguration();
+
+ setWindowIcon(KIcon("rekonq"));
+
+ historyManager();
+
+ // bookmarks loading
+ connect(bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
+ instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
+
+ // crash recovering
+ if (ReKonfig::recoverOnCrash())
+ {
+ mainWindow()->currentTab()->showMessageBar();
+ }
+ ReKonfig::setRecoverOnCrash(ReKonfig::recoverOnCrash() + 1);
+ saveConfiguration();
}
return exitValue;
@@ -283,29 +299,6 @@ Application *Application::instance()
}
-void Application::postLaunch()
-{
- // updating rekonq configuration
- updateConfiguration();
-
- setWindowIcon(KIcon("rekonq"));
-
- historyManager();
-
- // bookmarks loading
- connect(bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
- instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
-
- // crash recovering
- if (ReKonfig::recoverOnCrash())
- {
- mainWindow()->currentTab()->showMessageBar();
- }
- ReKonfig::setRecoverOnCrash(ReKonfig::recoverOnCrash() + 1);
- saveConfiguration();
-}
-
-
void Application::saveConfiguration() const
{
ReKonfig::self()->writeConfig();
@@ -442,7 +435,6 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
barForTab->setQUrl(url);
WebView *view = tab->view();
-
if (view)
{
FilterUrlJob *job = new FilterUrlJob(view, url.pathOrUrl(), this);
@@ -474,8 +466,8 @@ void Application::removeMainWindow(MainWindow *window)
// QApplication should quit as soon we have no mainwindow
// But QtWebkit seems to create windows without Qt::WA_QuitOnClose attribute,
// making rekonq keep running after last window is closed
- if ( m_mainWindows.length() == 0 )
- QCoreApplication::quit ();
+ if (m_mainWindows.length() == 0)
+ QCoreApplication::quit();
}
@@ -649,7 +641,7 @@ void Application::updateConfiguration()
case 3: // nothing
for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
{
- mainWindow()->mainView()->tabBar()->setTabToolTip(i, "");
+ mainWindow()->mainView()->tabBar()->setTabToolTip(i, QL1S(""));
}
break;
@@ -791,8 +783,9 @@ void Application::createWebAppShortcut()
QWidget widget;
wAppWidget.setupUi(&widget);
+ const QString title = mainWindow()->currentTab()->view()->title().remove("&");
wAppWidget.iconLabel->setPixmap(iconManager()->iconForUrl(u).pixmap(32));
- wAppWidget.titleLabel->setText(h);
+ wAppWidget.titleLabel->setText(title);
wAppWidget.kcfg_createDesktopAppShortcut->setChecked(ReKonfig::createDesktopAppShortcut());
wAppWidget.kcfg_createMenuAppShortcut->setChecked(ReKonfig::createMenuAppShortcut());
@@ -819,7 +812,7 @@ void Application::createWebAppShortcut()
if (ReKonfig::createDesktopAppShortcut())
{
QString desktop = KGlobalSettings::desktopPath();
- QFile wAppFile(desktop + QL1C('/') + h + QL1S(".desktop"));
+ QFile wAppFile(desktop + QL1C('/') + title + QL1S(".desktop"));
if (!wAppFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
@@ -837,7 +830,7 @@ void Application::createWebAppShortcut()
if (ReKonfig::createMenuAppShortcut())
{
QString appMenuDir = KStandardDirs::locateLocal("xdgdata-apps", QString());
- QFile wAppFile(appMenuDir + QL1C('/') + h + QL1S(".desktop"));
+ QFile wAppFile(appMenuDir + QL1C('/') + title + QL1S(".desktop"));
if (!wAppFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
diff --git a/src/application.h b/src/application.h
index 30d2b55d..acc0335f 100644
--- a/src/application.h
+++ b/src/application.h
@@ -120,11 +120,6 @@ protected:
bool eventFilter(QObject *watched, QEvent *event);
private slots:
- /**
- * Any actions that can be delayed until the window is visible
- */
- void postLaunch();
-
void loadResolvedUrl(ThreadWeaver::Job *);
void updateConfiguration();
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 2b5a8202..1ad452ea 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -59,19 +59,18 @@
//Hack:
QString temporaryUglyHackString = "";
-MainView::MainView(MainWindow *parent)
+MainView::MainView(QWidget *parent)
: KTabWidget(parent)
, m_widgetBar(new StackedUrlBar(this))
- , m_originalWidthHint(0)
, m_addTabButton(0)
, m_currentTabIndex(0)
- , m_parentWindow(parent)
{
// setting tabbar
TabBar *tabBar = new TabBar(this);
m_addTabButton = new QToolButton(this);
setTabBar(tabBar);
+ tabBar->show();
// set mouse tracking for tab previews
setMouseTracking(true);
@@ -96,12 +95,6 @@ MainView::MainView(MainWindow *parent)
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
connect(this, SIGNAL(currentChanged(int)), rApp->sessionManager(), SLOT(saveSession()));
- QTimer::singleShot(0, this, SLOT(postLaunch()));
-}
-
-
-void MainView::postLaunch()
-{
QList<TabHistory> list = rApp->sessionManager()->closedSites();
Q_FOREACH(const TabHistory & tab, list)
{
@@ -110,12 +103,15 @@ void MainView::postLaunch()
m_recentlyClosedTabs.removeAll(tab);
m_recentlyClosedTabs.prepend(tab);
}
+}
- m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab"));
+
+void MainView::addNewTabButton(QAction *newTabAction)
+{
+ m_addTabButton->setDefaultAction(newTabAction);
m_addTabButton->setAutoRaise(true);
m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
- m_originalWidthHint = sizeHint().width();
}
@@ -370,7 +366,8 @@ void MainView::windowCloseRequested()
{
if (count() == 1)
{
- m_parentWindow->close();
+ MainWindow *w = qobject_cast<MainWindow *>(parent());
+ w->close();
}
else
{
@@ -426,7 +423,8 @@ void MainView::closeTab(int index, bool del)
if (ReKonfig::lastTabClosesWindow())
{
// closing window...
- m_parentWindow->close();
+ MainWindow *w = qobject_cast<MainWindow *>(parent());
+ w->close();
return;
}
@@ -598,12 +596,8 @@ void MainView::webViewUrlChanged(const QUrl &url)
{
WebView *view = qobject_cast<WebView *>(sender());
int index = indexOf(view->parentWidget());
- if (-1 != index)
- {
- tabBar()->setTabData(index, url);
- }
if (ReKonfig::hoveringTabOption() == 2)
- tabBar()->setTabToolTip(index, webTab(index)->url().toMimeDataString());
+ tabBar()->setTabToolTip(index, url.toString());
}
diff --git a/src/mainview.h b/src/mainview.h
index 9d5bc8c9..632ddbca 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -42,7 +42,6 @@
// Forward Declarations
class HistoryItem;
-class MainWindow;
class StackedUrlBar;
class TabBar;
class UrlBar;
@@ -65,7 +64,7 @@ class REKONQ_TESTS_EXPORT MainView : public KTabWidget
Q_OBJECT
public:
- MainView(MainWindow *parent);
+ MainView(QWidget *parent);
inline StackedUrlBar *widgetBar() const
{
@@ -79,6 +78,8 @@ public:
WebTab *webTab(int index) const;
+ void addNewTabButton(QAction *);
+
/**
* show and hide TabBar if user doesn't choose
* "Always Show TabBar" option
@@ -105,11 +106,6 @@ public:
return m_recentlyClosedTabs;
}
- inline int originalWidthHint() const
- {
- return m_originalWidthHint;
- };
-
Q_SIGNALS:
// current tab signals
void currentTitle(const QString &url);
@@ -167,8 +163,6 @@ private Q_SLOTS:
void windowCloseRequested();
- void postLaunch();
-
protected:
virtual void resizeEvent(QResizeEvent *event);
@@ -201,8 +195,6 @@ private:
int m_currentTabIndex;
QList<TabHistory> m_recentlyClosedTabs;
-
- MainWindow *m_parentWindow;
};
#endif // MAINVIEW_H
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 880e4d47..811f1cf8 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -144,6 +144,9 @@ MainWindow::MainWindow()
// then, setup our actions
setupActions();
+ // BEFORE setupGUI, AFTER setupActions!!
+ m_view->addNewTabButton(actionByName("new_tab"));
+
// setting Panels
setupPanels();
@@ -166,8 +169,55 @@ MainWindow::MainWindow()
// no more status bar..
setStatusBar(0);
- // give me some time to do all the other stuffs...
- QTimer::singleShot(100, this, SLOT(postLaunch()));
+ setupBookmarksAndToolsShortcuts();
+
+ // setting popup notification
+ connect(rApp, SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide()));
+ m_popup->setAutoFillBackground(true);
+ m_popup->setMargin(4);
+ m_popup->raise();
+ m_popup->hide();
+ connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide()));
+
+ // notification system
+ connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
+ connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&)));
+
+ // connect signals and slots
+ connect(m_view, SIGNAL(currentTitle(const QString &)), this, SLOT(updateWindowTitle(const QString &)));
+ connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *)));
+
+ // (shift +) ctrl + tab switching
+ connect(this, SIGNAL(ctrlTabPressed()), m_view, SLOT(nextTab()));
+ connect(this, SIGNAL(shiftCtrlTabPressed()), m_view, SLOT(previousTab()));
+
+ // wheel history navigation
+ connect(m_view, SIGNAL(openPreviousInHistory()), this, SLOT(openPrevious()));
+ connect(m_view, SIGNAL(openNextInHistory()), this, SLOT(openNext()));
+
+ // update toolbar actions signals
+ connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(updateActions()));
+
+ // Change window icon according to tab icon
+ connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(changeWindowIcon(int)));
+
+ // Find Bar signal
+ connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(find(const QString &)));
+
+ // Zoom Bar signal
+ connect(m_view, SIGNAL(currentChanged(int)), m_zoomBar, SLOT(updateSlider(int)));
+
+ // Save session on window closing
+ connect(this, SIGNAL(windowClosing()), rApp->sessionManager(), SLOT(saveSession()));
+
+ // setting up toolbars to NOT have context menu enabled
+ setContextMenuPolicy(Qt::DefaultContextMenu);
+
+ // accept d'n'd
+ setAcceptDrops(true);
+
+ // Bookmark ToolBar (needs to be setup after the call to setupGUI())
+ initBookmarkBar();
}
@@ -234,66 +284,6 @@ void MainWindow::configureToolbars()
}
-void MainWindow::postLaunch()
-{
- setupBookmarksAndToolsShortcuts();
-
- // setting popup notification
- connect(rApp, SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide()));
- m_popup->setAutoFillBackground(true);
- m_popup->setMargin(4);
- m_popup->raise();
- m_popup->hide();
- connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide()));
-
- // notification system
- connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
- connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&)));
-
- // connect signals and slots
- connect(m_view, SIGNAL(currentTitle(const QString &)), this, SLOT(updateWindowTitle(const QString &)));
- connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *)));
-
- // (shift +) ctrl + tab switching
- connect(this, SIGNAL(ctrlTabPressed()), m_view, SLOT(nextTab()));
- connect(this, SIGNAL(shiftCtrlTabPressed()), m_view, SLOT(previousTab()));
-
- // wheel history navigation
- connect(m_view, SIGNAL(openPreviousInHistory()), this, SLOT(openPrevious()));
- connect(m_view, SIGNAL(openNextInHistory()), this, SLOT(openNext()));
-
- // update toolbar actions signals
- connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(updateActions()));
-
- // Change window icon according to tab icon
- connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(changeWindowIcon(int)));
-
- // launch it manually. Just the first time...
- updateActions();
-
- // Find Bar signal
- connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(find(const QString &)));
-
- // Zoom Bar signal
- connect(m_view, SIGNAL(currentChanged(int)), m_zoomBar, SLOT(updateSlider(int)));
-
- // Ctrl + wheel handling
- connect(this->currentTab()->view(), SIGNAL(zoomChanged(int)), m_zoomBar, SLOT(setValue(int)));
-
- // Save session on window closing
- connect(this, SIGNAL(windowClosing()), rApp->sessionManager(), SLOT(saveSession()));
-
- // setting up toolbars to NOT have context menu enabled
- setContextMenuPolicy(Qt::DefaultContextMenu);
-
- // accept d'n'd
- setAcceptDrops(true);
-
- // Bookmark ToolBar (needs to be setup after the call to setupGUI())
- initBookmarkBar();
-}
-
-
QSize MainWindow::sizeHint() const
{
QRect desktopRect = QApplication::desktop()->screenGeometry();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index df6e40c1..9dfe4a1e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -144,7 +144,6 @@ protected:
void finalizeGUI(KXMLGUIClient *client);
private Q_SLOTS:
- void postLaunch();
void browserLoading(bool);
void updateWindowTitle(const QString &title = QString());
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 96e71f00..227c6b10 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -231,10 +231,10 @@
<!-- AdBlock Settings -->
<group name="AdBlock">
<entry name="adBlockEnabled" type="Bool">
- <default>true</default>
+ <default>false</default>
</entry>
<entry name="hideAdsEnabled" type="Bool">
- <default>true</default>
+ <default>false</default>
</entry>
<entry name="subscriptionTitles" type="StringList">
<default>EasyList</default>
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 6e9b781b..ff293d18 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -99,8 +99,8 @@ QSize TabBar::tabSizeHint(int index) const
int buttonSize = view->addTabButton()->size().width();
int tabBarWidth = view->size().width() - buttonSize;
- int baseWidth = view->originalWidthHint() / baseWidthDivisor;
- int minWidth = view->originalWidthHint() / minWidthDivisor;
+ int baseWidth = view->sizeHint().width() / baseWidthDivisor;
+ int minWidth = view->sizeHint().width() / minWidthDivisor;
int w;
if (baseWidth * count() < tabBarWidth)
diff --git a/src/tabpreviewpopup.cpp b/src/tabpreviewpopup.cpp
index b94cf425..31d3cca9 100644
--- a/src/tabpreviewpopup.cpp
+++ b/src/tabpreviewpopup.cpp
@@ -99,7 +99,15 @@ void TabPreviewPopup::setWebTab(WebTab* tab)
int w = (tab->parentWidget()->sizeHint().width() / TabBar::baseWidthDivisor);
int h = w * rApp->mainWindow()->size().height() / rApp->mainWindow()->size().width();
- setThumbnail(WebSnap::renderTabPreview(*tab->page(), w, h));
+ if (!tab->part())
+ setThumbnail(WebSnap::renderTabPreview(*tab->page(), w, h));
+ else
+ {
+ QWidget *part = tab->part()->widget();
+ QPixmap partThumb(part->size());
+ part->render(&partThumb);
+ setThumbnail(partThumb.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
+ }
setUrl(tab->url().prettyUrl());
setFixedSize(w, h + m_url->heightForWidth(w));
diff --git a/src/webtab.h b/src/webtab.h
index 5700ba7a..fefdaf66 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -58,7 +58,7 @@ public:
explicit WebTab(QWidget *parent = 0);
~WebTab();
- inline WebView *view() const
+ WebView *view() const
{
return m_webView;
}
@@ -66,10 +66,11 @@ public:
{
return m_urlBar;
}
- inline WebPage *page() const
+ WebPage *page() const
{
return view()->page();
}
+
inline int progress() const
{
return m_progress;
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index 95a2c250..d709b38a 100644
--- a/src/zoombar.cpp
+++ b/src/zoombar.cpp
@@ -166,6 +166,7 @@ void ZoomBar::updateSlider(int webview)
return;
m_zoomSlider->setValue(tab->view()->zoomFactor() * 10);
+ connect(tab->view(), SIGNAL(zoomChanged(int)), this, SLOT(setValue(int)));
}