1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Now 'switch to tab' searches current window first.

-by ff2000, thank you :)
This commit is contained in:
S. Razi Alavizadeh 2012-12-08 02:04:38 +03:30
parent efebfb8148
commit 234769e920
2 changed files with 10 additions and 3 deletions

View File

@ -206,13 +206,16 @@ TabPosition LocationCompleterModel::tabPositionForUrl(const QUrl& url) const
TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString& encodedUrl) const TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString& encodedUrl) const
{ {
for(int win=0; win < mApp->windowCount(); ++win) { QList<QupZilla*> windows = mApp->mainWindows();
QupZilla* mainWin = mApp->mainWindows().at(win); int currentWindowIdx = windows.indexOf(mApp->getWindow());
windows.prepend(mApp->getWindow());
for(int win=0; win < windows.count(); ++win) {
QupZilla* mainWin = windows.at(win);
QList<WebTab*> tabs = mainWin->tabWidget()->allTabs(); QList<WebTab*> tabs = mainWin->tabWidget()->allTabs();
for(int tab=0; tab < tabs.count(); ++tab) { for(int tab=0; tab < tabs.count(); ++tab) {
if(tabs[tab]->url().toEncoded() == encodedUrl) { if(tabs[tab]->url().toEncoded() == encodedUrl) {
TabPosition pos; TabPosition pos;
pos.windowIndex = win; pos.windowIndex = win == 0 ? currentWindowIdx : win-1;
pos.tabIndex = tab; pos.tabIndex = tab;
return pos; return pos;
} }

View File

@ -23,6 +23,7 @@
#include "history.h" #include "history.h"
#include "tabwidget.h" #include "tabwidget.h"
#include "qzsettings.h" #include "qzsettings.h"
#include "tabbedwebview.h"
#include <QKeyEvent> #include <QKeyEvent>
#include <QApplication> #include <QApplication>
@ -277,4 +278,7 @@ void LocationCompleterView::activateTab(TabPosition pos)
win->activateWindow(); win->activateWindow();
win->raise(); win->raise();
} }
else {
win->weView()->setFocus();
}
} }