mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
LocationBar: Complete domain when going back to original text
This commit is contained in:
parent
3e18d17964
commit
82e9d0c0ee
|
@ -119,11 +119,14 @@ void LocationCompleter::currentChanged(const QModelIndex &index)
|
|||
{
|
||||
QString completion = index.data().toString();
|
||||
|
||||
bool isOriginal = false;
|
||||
|
||||
if (completion.isEmpty()) {
|
||||
isOriginal = true;
|
||||
completion = m_originalText;
|
||||
}
|
||||
|
||||
emit showCompletion(completion);
|
||||
emit showCompletion(completion, isOriginal);
|
||||
}
|
||||
|
||||
void LocationCompleter::indexActivated(const QModelIndex &index)
|
||||
|
@ -256,7 +259,7 @@ void LocationCompleter::loadUrl(const QUrl &url)
|
|||
closePopup();
|
||||
|
||||
// Show url in locationbar
|
||||
emit showCompletion(url.toEncoded());
|
||||
emit showCompletion(url.toEncoded(), false);
|
||||
|
||||
// Load url
|
||||
emit loadCompletion();
|
||||
|
|
|
@ -46,7 +46,7 @@ public slots:
|
|||
void showMostVisited();
|
||||
|
||||
signals:
|
||||
void showCompletion(const QString &completion);
|
||||
void showCompletion(const QString &completion, bool isOriginal);
|
||||
void showDomainCompletion(const QString &completion);
|
||||
void loadCompletion();
|
||||
void clearCompletion();
|
||||
|
|
|
@ -74,7 +74,7 @@ LocationBar::LocationBar(BrowserWindow* window)
|
|||
m_completer = new LocationCompleter(this);
|
||||
m_completer->setMainWindow(m_window);
|
||||
m_completer->setLocationBar(this);
|
||||
connect(m_completer, SIGNAL(showCompletion(QString)), this, SLOT(showCompletion(QString)));
|
||||
connect(m_completer, SIGNAL(showCompletion(QString,bool)), this, SLOT(showCompletion(QString,bool)));
|
||||
connect(m_completer, SIGNAL(showDomainCompletion(QString)), this, SLOT(showDomainCompletion(QString)));
|
||||
connect(m_completer, SIGNAL(loadCompletion()), this, SLOT(requestLoadUrl()));
|
||||
connect(m_completer, SIGNAL(clearCompletion()), this, SLOT(clearCompletion()));
|
||||
|
@ -154,12 +154,16 @@ void LocationBar::updatePlaceHolderText()
|
|||
setPlaceholderText(tr("Enter URL address"));
|
||||
}
|
||||
|
||||
void LocationBar::showCompletion(const QString &completion)
|
||||
void LocationBar::showCompletion(const QString &completion, bool isOriginal)
|
||||
{
|
||||
LineEdit::setText(completion);
|
||||
|
||||
// Move cursor to the end
|
||||
end(false);
|
||||
|
||||
if (isOriginal) {
|
||||
completer()->complete();
|
||||
}
|
||||
}
|
||||
|
||||
void LocationBar::clearCompletion()
|
||||
|
|
|
@ -60,7 +60,7 @@ private slots:
|
|||
void setPrivacyState(bool state);
|
||||
void setGoIconVisible(bool state);
|
||||
|
||||
void showCompletion(const QString &completion);
|
||||
void showCompletion(const QString &completion, bool isOriginal);
|
||||
void showDomainCompletion(const QString &completion);
|
||||
void clearCompletion();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user