From d0c313f5b7b458a97a39e029a05fa6679068eb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Pejakovi=C4=87?= Date: Sat, 21 Jan 2012 19:26:47 +0100 Subject: [PATCH 1/4] Location bar Paste and Go --- src/navigation/locationbar.cpp | 76 ++++++++++++++++++++++++++++++++- src/navigation/locationbar.h | 6 +++ src/navigation/websearchbar.cpp | 2 +- 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/navigation/locationbar.cpp b/src/navigation/locationbar.cpp index d95694065..6e7341a45 100644 --- a/src/navigation/locationbar.cpp +++ b/src/navigation/locationbar.cpp @@ -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()) { @@ -335,7 +409,7 @@ void LocationBar::keyReleaseEvent(QKeyEvent* 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_holdingAlt && m_locationBarSettings->addCountryWithAlt && - !text().endsWith(localDomain) && !text().endsWith("/")) { + !text().endsWith(localDomain) && !text().endsWith("/")) { setText(text().append(localDomain)); } diff --git a/src/navigation/locationbar.h b/src/navigation/locationbar.h index d1e395413..77f2a0c09 100644 --- a/src/navigation/locationbar.h +++ b/src/navigation/locationbar.h @@ -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; }; diff --git a/src/navigation/websearchbar.cpp b/src/navigation/websearchbar.cpp index 5bb7b1423..c7d798bb7 100644 --- a/src/navigation/websearchbar.cpp +++ b/src/navigation/websearchbar.cpp @@ -216,7 +216,7 @@ void WebSearchBar::keyPressEvent(QKeyEvent* event) switch (event->key()) { case Qt::Key_Return: case Qt::Key_Enter: - if (event->modifiers() ==Qt::AltModifier) { + if (event->modifiers() == Qt::AltModifier) { searchInNewTab(); } else { From a5fc9042fce46c282d9b2e951e8c0dd5925c8233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Pejakovi=C4=87?= Date: Sat, 21 Jan 2012 19:36:28 +0100 Subject: [PATCH 2/4] Translations update --- translations/cs_CZ.ts | 16 +++++++++++++--- translations/de_DE.ts | 16 +++++++++++++--- translations/el_GR.ts | 16 +++++++++++++--- translations/empty.ts | 16 +++++++++++++--- translations/es_ES.ts | 16 +++++++++++++--- translations/fr_FR.ts | 16 +++++++++++++--- translations/it_IT.ts | 16 +++++++++++++--- translations/nl_NL.ts | 16 +++++++++++++--- translations/pl_PL.ts | 16 +++++++++++++--- translations/pt_PT.ts | 16 +++++++++++++--- translations/ru_RU.ts | 16 +++++++++++++--- translations/sk_SK.ts | 8 ++++++++ translations/sr_BA.ts | 16 +++++++++++++--- translations/sr_RS.ts | 16 +++++++++++++--- translations/zh_CN.ts | 16 +++++++++++++--- 15 files changed, 190 insertions(+), 42 deletions(-) diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index 4ec262d38..c34899f4a 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -1661,17 +1661,27 @@ nebyl nalezen! LocationBar - + Add RSS from this page... Přidat RSS kanál ... - + Enter URL address or search on %1 Zadejte internetovou adresu nebo vyhledávejte na %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .cz diff --git a/translations/de_DE.ts b/translations/de_DE.ts index 7650e990f..ba1aa961f 100644 --- a/translations/de_DE.ts +++ b/translations/de_DE.ts @@ -1657,17 +1657,27 @@ LocationBar - + Add RSS from this page... RSS Feed von dieser Seite hinzufügen... - + Enter URL address or search on %1 URL eingeben oder auf %1 suchen - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .de diff --git a/translations/el_GR.ts b/translations/el_GR.ts index 7b28a5f45..144bebeb8 100644 --- a/translations/el_GR.ts +++ b/translations/el_GR.ts @@ -1657,17 +1657,27 @@ LocationBar - + Add RSS from this page... Προσθήκη RSS από αυτή τη σελίδα... - + Enter URL address or search on %1 Εισαγωγή διεύθυνσης URL ή αναζήτηση στο %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .gr diff --git a/translations/empty.ts b/translations/empty.ts index d4477a002..5b99aadfb 100644 --- a/translations/empty.ts +++ b/translations/empty.ts @@ -1622,17 +1622,27 @@ LocationBar - + Add RSS from this page... - + Enter URL address or search on %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country diff --git a/translations/es_ES.ts b/translations/es_ES.ts index 86f55b4e6..0b5a8eb1f 100644 --- a/translations/es_ES.ts +++ b/translations/es_ES.ts @@ -1656,17 +1656,27 @@ LocationBar - + Add RSS from this page... Añadir RSS desde esta página... - + Enter URL address or search on %1 Introducir la dirección URL o buscar en %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .co.uk diff --git a/translations/fr_FR.ts b/translations/fr_FR.ts index 5fd43d208..0ff05c50e 100644 --- a/translations/fr_FR.ts +++ b/translations/fr_FR.ts @@ -1659,17 +1659,27 @@ n'a pas été trouvé! LocationBar - + Add RSS from this page... Ajouter un flux RSS depuis cette page... - + Enter URL address or search on %1 Entrer une adresse URL ou chercher sur %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .fr diff --git a/translations/it_IT.ts b/translations/it_IT.ts index 3e12bf5fd..70e9ca38b 100644 --- a/translations/it_IT.ts +++ b/translations/it_IT.ts @@ -1656,17 +1656,27 @@ LocationBar - + Add RSS from this page... Aggiungi RSS da questa pagina... - + Enter URL address or search on %1 Inserisci URL o cerca con %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .it diff --git a/translations/nl_NL.ts b/translations/nl_NL.ts index 6ea08418c..565b7db57 100644 --- a/translations/nl_NL.ts +++ b/translations/nl_NL.ts @@ -1657,17 +1657,27 @@ werd niet gevonden! LocationBar - + Add RSS from this page... Voeg RSS toe van deze pagina... - + Enter URL address or search on %1 Voer URL-adres in of zoek op %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .nl diff --git a/translations/pl_PL.ts b/translations/pl_PL.ts index b33690501..1e67a40c7 100644 --- a/translations/pl_PL.ts +++ b/translations/pl_PL.ts @@ -1658,17 +1658,27 @@ LocationBar - + Add RSS from this page... Dodaj kanał RSS... - + Enter URL address or search on %1 Wpisz adres URL lub szukaj na %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .pl diff --git a/translations/pt_PT.ts b/translations/pt_PT.ts index e70f339e6..524428350 100644 --- a/translations/pt_PT.ts +++ b/translations/pt_PT.ts @@ -1656,17 +1656,27 @@ não foi encontrado! LocationBar - + Add RSS from this page... Adicionar RSS desta página... - + Enter URL address or search on %1 Indique o URL ou procure em %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .pt diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts index 9fbf93674..96ec9f4b6 100644 --- a/translations/ru_RU.ts +++ b/translations/ru_RU.ts @@ -1661,17 +1661,27 @@ LocationBar - + Add RSS from this page... Добавить RSS с этой страницы... - + Enter URL address or search on %1 Введите адрес или используйте поиск в %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .ru diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index dacf6cb6b..fb92f8809 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -1327,6 +1327,14 @@ Append domain name on ALT + Enter = Should be different for every country .sk + + Paste And &Go + + + + Clear All + + MainApplication diff --git a/translations/sr_BA.ts b/translations/sr_BA.ts index 01d6aa30d..3db8d58b7 100644 --- a/translations/sr_BA.ts +++ b/translations/sr_BA.ts @@ -1624,17 +1624,27 @@ LocationBar - + Add RSS from this page... Додај РСС са ове странице... - + Enter URL address or search on %1 Унесите УРЛ адресу или тражите на %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .rs.ba diff --git a/translations/sr_RS.ts b/translations/sr_RS.ts index e3f5ea53f..e5ecb3f2b 100644 --- a/translations/sr_RS.ts +++ b/translations/sr_RS.ts @@ -1624,17 +1624,27 @@ LocationBar - + Add RSS from this page... Додај РСС са ове странице... - + Enter URL address or search on %1 Унесите УРЛ адресу или тражите на %1 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .rs.ba diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index c0f908bb1..25c8e900c 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -1650,17 +1650,27 @@ LocationBar - + Add RSS from this page... 从网页添加RSS... - + Enter URL address or search on %1 输入URL地址或在%1上搜索 - + + Paste And &Go + + + + + Clear All + + + + .co.uk Append domain name on ALT + Enter = Should be different for every country .co.uk From 0104917a2969c07cf6988c96dfc814ac475f5402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Pejakovi=C4=87?= Date: Sat, 21 Jan 2012 19:47:09 +0100 Subject: [PATCH 3/4] Serbian translations update --- translations/sr_BA.ts | 12 ++++++------ translations/sr_RS.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/translations/sr_BA.ts b/translations/sr_BA.ts index 3db8d58b7..38398f749 100644 --- a/translations/sr_BA.ts +++ b/translations/sr_BA.ts @@ -1636,12 +1636,12 @@ Paste And &Go - + Налијепи и &иди Clear All - + Очисти све @@ -2116,7 +2116,7 @@ Don't quit upon closing last tab - + Не напуштај по затварању посљедњег језичка @@ -2954,7 +2954,7 @@ Information about application - + Подаци о програму @@ -3289,12 +3289,12 @@ Maximum pages in a row: - + Највише брзих бирања у реду: Change size of pages: - + Промијени величину брзих бирања: Max number of pages in a row: diff --git a/translations/sr_RS.ts b/translations/sr_RS.ts index e5ecb3f2b..bed1d31c1 100644 --- a/translations/sr_RS.ts +++ b/translations/sr_RS.ts @@ -1636,12 +1636,12 @@ Paste And &Go - + Налепи и &иди Clear All - + Очисти све @@ -2116,7 +2116,7 @@ Don't quit upon closing last tab - + Не напуштај по затварању последњег језичка @@ -2954,7 +2954,7 @@ Information about application - + Подаци о програму @@ -3289,12 +3289,12 @@ Maximum pages in a row: - + Највише брзих бирања у реду: Change size of pages: - + Промени величину брзих бирања: Max number of pages in a row: From 0607da10d9217939a90813650a2f3dbbaa559e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Pejakovi=C4=87?= Date: Sat, 21 Jan 2012 19:47:59 +0100 Subject: [PATCH 4/4] Serbian translations update --- translations/sr_BA.ts | 12 ------------ translations/sr_RS.ts | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/translations/sr_BA.ts b/translations/sr_BA.ts index 38398f749..57ea902ba 100644 --- a/translations/sr_BA.ts +++ b/translations/sr_BA.ts @@ -2961,10 +2961,6 @@ &About QupZilla &О Капзили - - Informations about application - Инфо програма - Report &Issue @@ -3296,14 +3292,6 @@ Change size of pages: Промијени величину брзих бирања: - - Max number of pages in a row: - Максималан број брзих бирања у реду: - - - Change size of dials - Промијени величину брзих бирања - Load title from page diff --git a/translations/sr_RS.ts b/translations/sr_RS.ts index bed1d31c1..d195dbfe7 100644 --- a/translations/sr_RS.ts +++ b/translations/sr_RS.ts @@ -2961,10 +2961,6 @@ &About QupZilla &О Капзили - - Informations about application - Инфо програма - Report &Issue @@ -3296,14 +3292,6 @@ Change size of pages: Промени величину брзих бирања: - - Max number of pages in a row: - Максималан број брзих бирања у реду: - - - Change size of dials - Промени величину брзих бирања - Load title from page