Am Freitag 09 Oktober 2009 00:49:48 schrieb Ronny Scholz:
> If a bookmark is opened in a new tab, multiple tabs are created.
>
> The number depends on the amount of rekonq windows.
>
> 1 window: 1 tab is created
> 2 windows: 2 tabs are created
> 3 windows: 3 tabs are created
>
> ... and so on.
> _______________________________________________
> rekonq mailing list
> [email protected]
> https://mail.kde.org/mailman/listinfo/rekonq
>
The loading of bookmarks is called for every MainWindow instance. Also, since
we have only one application for several mainwindows,
Application::postLaunch() is called to often.
The attached patch fixes both issues and therefore fixes multiple loading of a
bookmark.
diff --git a/src/application.cpp b/src/application.cpp
index e3c06a5..fdd02bf 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -87,6 +87,16 @@ int Application::newInstance()
{
KCmdLineArgs::setCwd(QDir::currentPath().toUtf8());
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+
+ // we share one process for several mainwindows,
+ // so initialize only once
+ static bool first = true;
+
+ if (first)
+ {
+ QTimer::singleShot(0, this, SLOT(postLaunch()));
+ first = false;
+ }
// is your app session restored? restore session...
// this mechanism also falls back to load usual plain rekonq
@@ -151,6 +161,10 @@ void Application::postLaunch()
Application::historyManager();
Application::sessionManager();
+
+ // bookmarks loading
+ connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
+ Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
}
@@ -393,7 +407,6 @@ MainWindow *Application::newMainWindow()
m_mainWindows.prepend(w);
w->show();
- QTimer::singleShot(0, this, SLOT(postLaunch()));
return w;
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ac9b83b..45a12a7 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -204,10 +204,6 @@ void MainWindow::postLaunch()
// Find Bar signal
connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &)));
- // bookmarks loading
- connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
- Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
-
// setting up toolbars to NOT have context menu enabled
setContextMenuPolicy(Qt::DefaultContextMenu);
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq