1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Merge pull request #206 from pejakm/master

Paste and go in locationbar context menu
This commit is contained in:
David Rosca 2012-01-21 11:05:33 -08:00
commit 61d41046b6
18 changed files with 280 additions and 76 deletions

View File

@ -41,6 +41,9 @@ LocationBar::LocationBar(QupZilla* mainClass)
, p_QupZilla(mainClass)
, m_webView(0)
, m_locationBarSettings(LocationBarSettings::instance())
, m_menu(new QMenu(this))
, m_pasteAndGoAction(0)
, m_clearAction(0)
, m_holdingAlt(false)
{
setObjectName("locationbar");
@ -238,6 +241,77 @@ void LocationBar::setPrivacy(bool state)
style()->polish(this);
}
void LocationBar::pasteAndGo()
{
clear();
paste();
urlEnter();
}
void LocationBar::contextMenuEvent(QContextMenuEvent* event)
{
Q_UNUSED(event)
if (!m_pasteAndGoAction) {
m_pasteAndGoAction = new QAction(QIcon::fromTheme("edit-paste"), tr("Paste And &Go"), this);
m_pasteAndGoAction->setShortcut(QKeySequence("Ctrl+Shift+V"));
connect(m_pasteAndGoAction, SIGNAL(triggered()), this, SLOT(pasteAndGo()));
}
if (!m_clearAction) {
m_clearAction = new QAction(QIcon::fromTheme("edit-clear"), tr("Clear All"), this);
connect(m_clearAction, SIGNAL(triggered()), this, SLOT(clear()));
}
QMenu* tempMenu = createStandardContextMenu();
m_menu->clear();
int i = 0;
foreach(QAction * act, tempMenu->actions()) {
act->setParent(m_menu);
tempMenu->removeAction(act);
m_menu->addAction(act);
switch (i) {
case 0:
act->setIcon(QIcon::fromTheme("edit-undo"));
break;
case 1:
act->setIcon(QIcon::fromTheme("edit-redo"));
break;
case 3:
act->setIcon(QIcon::fromTheme("edit-cut"));
break;
case 4:
act->setIcon(QIcon::fromTheme("edit-copy"));
break;
case 5:
act->setIcon(QIcon::fromTheme("edit-paste"));
m_menu->addAction(act);
m_menu->addAction(m_pasteAndGoAction);
break;
case 6:
act->setIcon(QIcon::fromTheme("edit-delete"));
m_menu->addAction(act);
m_menu->addAction(m_clearAction);
break;
case 8:
act->setIcon(QIcon::fromTheme("edit-select-all"));
break;
}
++i;
}
delete tempMenu;
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p);
}
void LocationBar::dropEvent(QDropEvent* event)
{
if (event->mimeData()->hasUrls()) {

View File

@ -74,10 +74,12 @@ private slots:
void urlEnter();
void clearIcon();
void showRSSIcon(bool state);
void pasteAndGo();
void updatePlaceHolderText();
private:
void contextMenuEvent(QContextMenuEvent* event);
void focusOutEvent(QFocusEvent* e);
void mouseDoubleClickEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent* event);
@ -100,6 +102,10 @@ private:
LocationCompleter* m_locationCompleter;
LocationBarSettings* m_locationBarSettings;
QMenu* m_menu;
QAction* m_pasteAndGoAction;
QAction* m_clearAction;
bool m_rssIconVisible;
bool m_holdingAlt;
};

View File

@ -1661,17 +1661,27 @@ nebyl nalezen!</translation>
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Přidat RSS kanál ...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Zadejte internetovou adresu nebo vyhledávejte na %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.cz</translation>

View File

@ -1658,17 +1658,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>RSS Feed von dieser Seite hinzufügen...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>URL eingeben oder auf %1 suchen</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.de</translation>

View File

@ -1657,17 +1657,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Προσθήκη RSS από αυτή τη σελίδα...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Εισαγωγή διεύθυνσης URL ή αναζήτηση στο %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.gr</translation>

View File

@ -1622,17 +1622,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation type="unfinished"></translation>

View File

@ -1656,17 +1656,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Añadir RSS desde esta página...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Introducir la dirección URL o buscar en %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.co.uk</translation>

View File

@ -1659,17 +1659,27 @@ n&apos;a pas été trouvé!</translation>
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Ajouter un flux RSS depuis cette page...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Entrer une adresse URL ou chercher sur %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.fr</translation>

View File

@ -1656,17 +1656,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Aggiungi RSS da questa pagina...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Inserisci URL o cerca con %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.it</translation>

View File

@ -1657,17 +1657,27 @@ werd niet gevonden!</translation>
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Voeg RSS toe van deze pagina...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Voer URL-adres in of zoek op %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.nl</translation>

View File

@ -1658,17 +1658,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Dodaj kanał RSS...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Wpisz adres URL lub szukaj na %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.pl</translation>

View File

@ -1656,17 +1656,27 @@ não foi encontrado!</translation>
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Adicionar RSS desta página...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Indique o URL ou procure em %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.pt</translation>

View File

@ -1661,17 +1661,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Добавить RSS с этой страницы...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Введите адрес или используйте поиск в %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.ru</translation>

View File

@ -1327,6 +1327,14 @@
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.sk</translation>
</message>
<message>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainApplication</name>

View File

@ -1624,17 +1624,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Додај РСС са ове странице...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Унесите УРЛ адресу или тражите на %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation>Налијепи и &amp;иди</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation>Очисти све</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.rs.ba</translation>
@ -2106,7 +2116,7 @@
<message>
<location filename="../src/preferences/preferences.ui" line="729"/>
<source>Don&apos;t quit upon closing last tab</source>
<translation type="unfinished"></translation>
<translation>Не напуштај по затварању посљедњег језичка</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="766"/>
@ -2944,17 +2954,13 @@
<message>
<location filename="../src/app/qupzilla.cpp" line="796"/>
<source>Information about application</source>
<translation type="unfinished"></translation>
<translation>Подаци о програму</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="282"/>
<source>&amp;About QupZilla</source>
<translation>&amp;О Капзили</translation>
</message>
<message>
<source>Informations about application</source>
<translation type="obsolete">Инфо програма</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="801"/>
<source>Report &amp;Issue</source>
@ -3279,20 +3285,12 @@
<message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="270"/>
<source>Maximum pages in a row:</source>
<translation type="unfinished"></translation>
<translation>Највише брзих бирања у реду:</translation>
</message>
<message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="271"/>
<source>Change size of pages:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Max number of pages in a row:</source>
<translation type="obsolete">Максималан број брзих бирања у реду:</translation>
</message>
<message>
<source>Change size of dials</source>
<translation type="obsolete">Промијени величину брзих бирања</translation>
<translation>Промијени величину брзих бирања:</translation>
</message>
<message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="252"/>

View File

@ -1624,17 +1624,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>Додај РСС са ове странице...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>Унесите УРЛ адресу или тражите на %1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation>Налепи и &amp;иди</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation>Очисти све</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.rs.ba</translation>
@ -2106,7 +2116,7 @@
<message>
<location filename="../src/preferences/preferences.ui" line="729"/>
<source>Don&apos;t quit upon closing last tab</source>
<translation type="unfinished"></translation>
<translation>Не напуштај по затварању последњег језичка</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="766"/>
@ -2944,17 +2954,13 @@
<message>
<location filename="../src/app/qupzilla.cpp" line="796"/>
<source>Information about application</source>
<translation type="unfinished"></translation>
<translation>Подаци о програму</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="282"/>
<source>&amp;About QupZilla</source>
<translation>&amp;О Капзили</translation>
</message>
<message>
<source>Informations about application</source>
<translation type="obsolete">Инфо програма</translation>
</message>
<message>
<location filename="../src/app/qupzilla.cpp" line="801"/>
<source>Report &amp;Issue</source>
@ -3279,20 +3285,12 @@
<message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="270"/>
<source>Maximum pages in a row:</source>
<translation type="unfinished"></translation>
<translation>Највише брзих бирања у реду:</translation>
</message>
<message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="271"/>
<source>Change size of pages:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Max number of pages in a row:</source>
<translation type="obsolete">Максималан број брзих бирања у реду:</translation>
</message>
<message>
<source>Change size of dials</source>
<translation type="obsolete">Промени величину брзих бирања</translation>
<translation>Промени величину брзих бирања:</translation>
</message>
<message>
<location filename="../src/network/qupzillaschemehandler.cpp" line="252"/>

View File

@ -1650,17 +1650,27 @@
<context>
<name>LocationBar</name>
<message>
<location filename="../src/navigation/locationbar.cpp" line="51"/>
<location filename="../src/navigation/locationbar.cpp" line="54"/>
<source>Add RSS from this page...</source>
<translation>RSS...</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="89"/>
<location filename="../src/navigation/locationbar.cpp" line="92"/>
<source>Enter URL address or search on %1</source>
<translation>URL地址或在%1</translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="335"/>
<location filename="../src/navigation/locationbar.cpp" line="256"/>
<source>Paste And &amp;Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="262"/>
<source>Clear All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/navigation/locationbar.cpp" line="409"/>
<source>.co.uk</source>
<comment>Append domain name on ALT + Enter = Should be different for every country</comment>
<translation>.co.uk</translation>