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

Ctrl+Enter shortcut in locationbar for append .com and go.

This commit is contained in:
nowrep 2011-12-23 11:11:14 +01:00
parent 9b84036b88
commit 51027ff782
2 changed files with 30 additions and 11 deletions

View File

@ -75,7 +75,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdit()));
connect(this, SIGNAL(textEdited(QString)), m_locationCompleter, SLOT(refreshCompleter(QString)));
connect(this, SIGNAL(returnPressed()), this, SLOT(urlEnter()));
// connect(this, SIGNAL(returnPressed()), this, SLOT(urlEnter()));
connect(m_locationCompleter->popup(), SIGNAL(clicked(QModelIndex)), p_QupZilla, SLOT(urlEnter()));
connect(m_siteIcon, SIGNAL(clicked()), this, SLOT(showSiteInfo()));
connect(m_goButton, SIGNAL(clicked(QPoint)), this, SLOT(urlEnter()));
@ -303,19 +303,36 @@ void LocationBar::mousePressEvent(QMouseEvent* event)
void LocationBar::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Escape) {
static QString localDomain = tr(".co.uk", "Append domain name on ALT + Enter = Should be different for every country");
switch (event->key()) {
case Qt::Key_Escape:
setText(m_webView->url().toEncoded());
event->accept();
return;
break;
case Qt::Key_Alt:
if (event->key() == Qt::Key_Alt && m_locationBarSettings->addCountryWithAlt && !text().endsWith(localDomain) && !text().endsWith("/")) {
setText(text().append(localDomain));
}
LineEdit::keyPressEvent(event);
break;
case Qt::Key_Return:
case Qt::Key_Enter:
if (event->modifiers() == Qt::ControlModifier) {
setText(text().append(".com"));
urlEnter();
}
else {
urlEnter();
}
break;
default:
LineEdit::keyPressEvent(event);
}
QString localDomain = tr(".co.uk", "Append domain name on ALT + Enter = Should be different for every country");
if (event->key() == Qt::Key_Alt && m_locationBarSettings->addCountryWithAlt && !text().endsWith(localDomain) && !text().endsWith("/")) {
setText(text().append(localDomain));
}
QLineEdit::keyPressEvent(event);
}
LocationBar::~LocationBar()

View File

@ -30,6 +30,8 @@
#include <QToolButton>
#include <QMenu>
#include <QTableView>
#include <QShortcut>
#include "lineedit.h"
class QupZilla;