From 234769e9208e1272af16002a39b2fbf48dda89ae Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Sat, 8 Dec 2012 02:04:38 +0330 Subject: [PATCH] Now 'switch to tab' searches current window first. -by ff2000, thank you :) --- src/lib/navigation/completer/locationcompletermodel.cpp | 9 ++++++--- src/lib/navigation/completer/locationcompleterview.cpp | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/navigation/completer/locationcompletermodel.cpp b/src/lib/navigation/completer/locationcompletermodel.cpp index 7aff40a80..869a0f65f 100644 --- a/src/lib/navigation/completer/locationcompletermodel.cpp +++ b/src/lib/navigation/completer/locationcompletermodel.cpp @@ -206,13 +206,16 @@ TabPosition LocationCompleterModel::tabPositionForUrl(const QUrl& url) const TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString& encodedUrl) const { - for(int win=0; win < mApp->windowCount(); ++win) { - QupZilla* mainWin = mApp->mainWindows().at(win); + QList windows = mApp->mainWindows(); + int currentWindowIdx = windows.indexOf(mApp->getWindow()); + windows.prepend(mApp->getWindow()); + for(int win=0; win < windows.count(); ++win) { + QupZilla* mainWin = windows.at(win); QList tabs = mainWin->tabWidget()->allTabs(); for(int tab=0; tab < tabs.count(); ++tab) { if(tabs[tab]->url().toEncoded() == encodedUrl) { TabPosition pos; - pos.windowIndex = win; + pos.windowIndex = win == 0 ? currentWindowIdx : win-1; pos.tabIndex = tab; return pos; } diff --git a/src/lib/navigation/completer/locationcompleterview.cpp b/src/lib/navigation/completer/locationcompleterview.cpp index 58164630d..01af2e2e5 100644 --- a/src/lib/navigation/completer/locationcompleterview.cpp +++ b/src/lib/navigation/completer/locationcompleterview.cpp @@ -23,6 +23,7 @@ #include "history.h" #include "tabwidget.h" #include "qzsettings.h" +#include "tabbedwebview.h" #include #include @@ -277,4 +278,7 @@ void LocationCompleterView::activateTab(TabPosition pos) win->activateWindow(); win->raise(); } + else { + win->weView()->setFocus(); + } }