mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Fixed: from 'switch to tab' commit.
1- Renew TabPositionRole's data when 'm_lastCompletion == string' 2- Don't switch to current tab, because we don't want clear its locationbar.
This commit is contained in:
parent
6b7e13a29d
commit
379f987280
|
@ -39,6 +39,7 @@ bool countBiggerThan(const QStandardItem* i1, const QStandardItem* i2)
|
|||
void LocationCompleterModel::refreshCompletions(const QString &string)
|
||||
{
|
||||
if (m_lastCompletion == string) {
|
||||
refreshTabPositions();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -199,12 +200,17 @@ QSqlQuery LocationCompleterModel::createQuery(const QString &searchString, const
|
|||
}
|
||||
|
||||
TabPosition LocationCompleterModel::tabPositionForUrl(const QUrl& url) const
|
||||
{
|
||||
return tabPositionForEncodedUrl(url.toEncoded());
|
||||
}
|
||||
|
||||
TabPosition LocationCompleterModel::tabPositionForEncodedUrl(const QString& encodedUrl) const
|
||||
{
|
||||
for(int win=0; win < mApp->windowCount(); ++win) {
|
||||
QupZilla* mainWin = mApp->mainWindows().at(win);
|
||||
QList<WebTab*> tabs = mainWin->tabWidget()->allTabs();
|
||||
for(int tab=0; tab < tabs.count(); ++tab) {
|
||||
if(tabs[tab]->url() == url) {
|
||||
if(tabs[tab]->url().toEncoded() == encodedUrl) {
|
||||
TabPosition pos;
|
||||
pos.windowIndex = win;
|
||||
pos.tabIndex = tab;
|
||||
|
@ -214,3 +220,18 @@ TabPosition LocationCompleterModel::tabPositionForUrl(const QUrl& url) const
|
|||
}
|
||||
return TabPosition();
|
||||
}
|
||||
|
||||
void LocationCompleterModel::refreshTabPositions()
|
||||
{
|
||||
if (!qzSettings->showSwitchTab) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int row = 0; row < rowCount(); ++row) {
|
||||
QStandardItem* aItem = item(row);
|
||||
if (!aItem) {
|
||||
continue;
|
||||
}
|
||||
aItem->setData(QVariant::fromValue<TabPosition>(tabPositionForEncodedUrl(aItem->text())), TabPositionRole);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ private:
|
|||
QSqlQuery createQuery(const QString &searchString, const QString &orderBy, const QList<QUrl> &alreadyFound,
|
||||
int limit, bool bookmarks = false, bool exactMatch = false);
|
||||
TabPosition tabPositionForUrl(const QUrl& url) const;
|
||||
TabPosition tabPositionForEncodedUrl(const QString& encodedUrl) const;
|
||||
void refreshTabPositions();
|
||||
|
||||
QString m_lastCompletion;
|
||||
};
|
||||
|
|
|
@ -269,8 +269,12 @@ void LocationCompleterView::mouseReleaseEvent(QMouseEvent* event)
|
|||
|
||||
void LocationCompleterView::activateTab(TabPosition pos)
|
||||
{
|
||||
emit aboutToActivateTab(pos);
|
||||
QupZilla* win = mApp->mainWindows().at(pos.windowIndex);
|
||||
win->activateWindow();
|
||||
win->tabWidget()->setCurrentIndex(pos.tabIndex);
|
||||
if (mApp->getWindow() != win || mApp->getWindow()->tabWidget()->currentIndex() != pos.tabIndex) {
|
||||
emit aboutToActivateTab(pos);
|
||||
win->tabWidget()->setCurrentIndex(pos.tabIndex);
|
||||
win->show();
|
||||
win->activateWindow();
|
||||
win->raise();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user