summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-11-08 12:42:45 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-11-18 15:42:31 +0100
commit830b2f24ec1375b5fee5891f10444a67da562484 (patch)
tree7719aab2693f658f772141ddcac77ab292730c54 /src
parentGet sure against "strange" behaviours in opensearchengine (diff)
downloadrekonq-830b2f24ec1375b5fee5891f10444a67da562484.tar.xz
Remove postLaunch calls
This will help a lot in having a clean/easy startup, also a bit less fast. Let's see if this helps stability... PS: To the bug reporter. I pushed a "NoPostLaunch" in rekonq git repo. Can you please try compiling and testing if this fixes your troubles on startup?? Many thanks for any help. Andrea. CCBUG:284356
Diffstat (limited to 'src')
-rw-r--r--src/application.cpp44
-rw-r--r--src/application.h5
-rw-r--r--src/mainview.cpp13
-rw-r--r--src/mainview.h9
-rw-r--r--src/mainwindow.cpp117
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/tabbar.cpp4
-rw-r--r--src/webtab.cpp1
-rw-r--r--src/webtab.h6
9 files changed, 87 insertions, 113 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 41921aa5..35a4c0d8 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -265,8 +265,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;
@@ -279,29 +295,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();
@@ -438,7 +431,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);
diff --git a/src/application.h b/src/application.h
index 0c4d3101..fe7d3d18 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..80457252 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -62,7 +62,6 @@ QString temporaryUglyHackString = "";
MainView::MainView(MainWindow *parent)
: KTabWidget(parent)
, m_widgetBar(new StackedUrlBar(this))
- , m_originalWidthHint(0)
, m_addTabButton(0)
, m_currentTabIndex(0)
, m_parentWindow(parent)
@@ -72,6 +71,7 @@ MainView::MainView(MainWindow *parent)
m_addTabButton = new QToolButton(this);
setTabBar(tabBar);
+ tabBar->show();
// set mouse tracking for tab previews
setMouseTracking(true);
@@ -96,12 +96,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 +104,15 @@ void MainView::postLaunch()
m_recentlyClosedTabs.removeAll(tab);
m_recentlyClosedTabs.prepend(tab);
}
+}
+
+void MainView::addNewTabButton()
+{
m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab"));
m_addTabButton->setAutoRaise(true);
m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
- m_originalWidthHint = sizeHint().width();
}
diff --git a/src/mainview.h b/src/mainview.h
index 9d5bc8c9..133ede09 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -79,6 +79,8 @@ public:
WebTab *webTab(int index) const;
+ void addNewTabButton();
+
/**
* show and hide TabBar if user doesn't choose
* "Always Show TabBar" option
@@ -105,11 +107,6 @@ public:
return m_recentlyClosedTabs;
}
- inline int originalWidthHint() const
- {
- return m_originalWidthHint;
- };
-
Q_SIGNALS:
// current tab signals
void currentTitle(const QString &url);
@@ -167,8 +164,6 @@ private Q_SLOTS:
void windowCloseRequested();
- void postLaunch();
-
protected:
virtual void resizeEvent(QResizeEvent *event);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index beab3afc..bce5b54a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -144,6 +144,9 @@ MainWindow::MainWindow()
// then, setup our actions
setupActions();
+ // BEFORE setupGUI!!
+ m_view->addNewTabButton();
+
// setting Panels
setupPanels();
@@ -166,8 +169,58 @@ 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)));
+
+ // Ctrl + wheel handling
+ connect(currentTab(), 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();
}
@@ -234,66 +287,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/tabbar.cpp b/src/tabbar.cpp
index ea01ef9b..e9b7ff25 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -97,8 +97,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/webtab.cpp b/src/webtab.cpp
index 61c9077f..3caf46b8 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -86,6 +86,7 @@ WebTab::WebTab(QWidget *parent)
connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
connect(m_webView, SIGNAL(titleChanged(const QString &)), this, SIGNAL(titleChanged(const QString &)));
+ connect(m_webView, SIGNAL(zoomChanged(int)), this, SLOT(zoomChanged(int)));
// Session Manager
connect(m_webView, SIGNAL(loadFinished(bool)), rApp->sessionManager(), SLOT(saveSession()));
diff --git a/src/webtab.h b/src/webtab.h
index 5700ba7a..2e95fecf 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;
@@ -102,6 +103,7 @@ private Q_SLOTS:
Q_SIGNALS:
void loadProgressing();
void titleChanged(const QString &);
+ void zoomChanged(int);
private:
KUrl extractOpensearchUrl(QWebElement e);