diff --git a/applets/webbrowser/package/contents/ui/main.qml b/applets/webbrowser/package/contents/ui/main.qml index d9dc0a634..c81af33be 100644 --- a/applets/webbrowser/package/contents/ui/main.qml +++ b/applets/webbrowser/package/contents/ui/main.qml @@ -1,189 +1,189 @@ /*************************************************************************** * Copyright 2014, 2016 by Mikhail Ivchenko * * Copyright 2018 by Kai Uwe Broulik * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.0 import QtWebEngine 1.5 import QtQuick.Layouts 1.1 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras ColumnLayout { RowLayout{ Layout.fillWidth: true PlasmaComponents.Button{ iconSource: "go-previous" onClicked: webview.goBack() enabled: webview.canGoBack } PlasmaComponents.Button{ iconSource: "go-next" onClicked: webview.goForward() enabled: webview.canGoForward } PlasmaComponents.TextField{ Layout.fillWidth: true onAccepted: { var url = text; if (url.indexOf(":/") < 0) { url = "http://" + url; } webview.url = url; } onActiveFocusChanged: { if (activeFocus) { selectAll(); } } text: webview.url } // this shows page-related information such as blocked popups PlasmaComponents.ToolButton { id: infoButton // callback invoked when button is clicked property var cb // button itself adds sufficient visual padding Layout.leftMargin: -parent.spacing Layout.rightMargin: -parent.spacing onClicked: cb(); function show(text, icon, tooltip, cb) { infoButton.text = text; infoButton.iconName = icon; infoButton.tooltip = tooltip; infoButton.cb = cb; infoButton.visible = true; } function dismiss() { infoButton.visible = false; } } PlasmaComponents.Button{ iconSource: webview.loading ? "process-stop" : "view-refresh" onClicked: webview.loading ? webview.stop() : webview.reload() } } Item { Layout.fillWidth: true Layout.fillHeight: true // TODO use contentsSize but that crashes, now mostly for some sane initial size - Layout.preferredWidth: units.gridUnit * 25 - Layout.preferredHeight: units.gridUnit * 12 + Layout.preferredWidth: units.gridUnit * 36 + Layout.preferredHeight: units.gridUnit * 18 // Binding it to e.g. width will be super slow on resizing Timer { id: updateZoomTimer interval: 100 onTriggered: { // Try to fit contents for a smaller screen webview.zoomFactor = Math.min(1, webview.width / 1000); } } // This reimplements WebEngineView context menu for links to add a "open externally" entry // since you cannot add custom items there yet // there's a FIXME comment about that in QQuickWebEngineViewPrivate::contextMenuRequested PlasmaComponents.Menu { id: linkContextMenu visualParent: webview property string link PlasmaComponents.MenuItem { text: i18nc("@action:inmenu", "Open Link in Browser") icon: "internet-web-browser" onClicked: Qt.openUrlExternally(linkContextMenu.link) } PlasmaComponents.MenuItem { text: i18nc("@action:inmenu", "Copy Link Address") icon: "edit-copy" onClicked: webview.triggerWebAction(WebEngineView.CopyLinkToClipboard) } } WebEngineView { id: webview anchors.fill: parent onUrlChanged: plasmoid.configuration.url = url; Component.onCompleted: url = plasmoid.configuration.url; onLinkHovered: { if (hoveredUrl.toString() !== "") { mouseArea.cursorShape = Qt.PointingHandCursor; } else { mouseArea.cursorShape = Qt.ArrowCursor; } } onWidthChanged: updateZoomTimer.start() onLoadingChanged: { if (loadRequest.status === WebEngineLoadRequest.LoadStartedStatus) { infoButton.dismiss(); } else if (loadRequest.status === WebEngineLoadRequest.LoadSucceededStatus) { updateZoomTimer.start(); } } onContextMenuRequested: { if (request.mediaType === ContextMenuRequest.MediaTypeNone && request.linkUrl.toString() !== "") { linkContextMenu.link = request.linkUrl; linkContextMenu.open(request.x, request.y); request.accepted = true; } } onNewViewRequested: { var url = request.requestedUrl; if (request.userInitiated) { Qt.openUrlExternally(url); } else { infoButton.show(i18nc("An unwanted popup was blocked", "Popup blocked"), "document-close", i18n("Click here to open the following blocked popup:\n%1", url), function () { Qt.openUrlExternally(url); infoButton.dismiss(); }); } } } MouseArea { id: mouseArea anchors.fill: parent acceptedButtons: Qt.BackButton | Qt.ForwardButton onPressed: { if (mouse.button === Qt.BackButton) { webview.goBack(); } else if (mouse.button === Qt.ForwardButton) { webview.goForward(); } } } } } diff --git a/applets/webbrowser/package/metadata.desktop b/applets/webbrowser/package/metadata.desktop index b348d35f2..81f26f66a 100644 --- a/applets/webbrowser/package/metadata.desktop +++ b/applets/webbrowser/package/metadata.desktop @@ -1,93 +1,93 @@ [Desktop Entry] Name=Web browser Name[ca]=Navegador web Name[ca@valencia]=Navegador web Name[cs]=Webový prohlížeč Name[da]=Webbrowser Name[de]=Webbrowser Name[el]=Περιηγητής ιστού Name[en_GB]=Web browser Name[es]=Navegador web Name[et]=Veebibrauser Name[eu]=Web arakatzailea Name[fi]=Verkkoselain Name[fr]=Navigateur Web Name[gl]=Navegador web Name[he]=דפדפן Name[hu]=Webböngésző Name[ia]=Navigator Web Name[id]=Web browser Name[it]=Browser web Name[ko]=웹 브라우저 Name[lt]=Žiniatinklio naršyklė Name[nb]=Nettleser Name[nl]=Webbrowser Name[nn]=Nettlesar Name[pl]=Przeglądarka sieciowa Name[pt]=Navegador Web Name[pt_BR]=Navegador Web Name[ru]=Веб-браузер Name[sk]=Webový prehliadač Name[sl]=Spletni brskalnik Name[sr]=веб прегледач Name[sr@ijekavian]=веб прегледач Name[sr@ijekavianlatin]=veb pregledač Name[sr@latin]=veb pregledač Name[sv]=Webbläsare Name[tr]=Web tarayıcı Name[uk]=Перегляд інтернету Name[x-test]=xxWeb browserxx Name[zh_CN]=网页浏览器 Name[zh_TW]=網頁瀏覽器 Comment=Add a webpage on your desktop. Comment[ca]=Afegeix una pàgina web a l'escriptori. Comment[ca@valencia]=Afig una pàgina web a l'escriptori. Comment[da]=Tilføj en webside til dit skrivebord. Comment[de]=Fügt eine Webseite zu Ihrer Arbeitsfläche hinzu. Comment[el]=Προσθήκη ιστοσελίδας στην επιφάνεια εργασίας σας. Comment[en_GB]=Add a webpage on your desktop. Comment[es]=Añadir una página web a su escritorio. Comment[et]=Veebilehe lisamine töölauale Comment[eu]=Erantsi web-orri bat zure mahaigainean. Comment[fi]=Lisää verkkosivu työpöydällesi. Comment[fr]=Ajouter une page Web sur votre bureau. Comment[gl]=Engadir unha páxina web ao escritorio. Comment[he]=הוסף דף אינטרנט לשולחן העבודה שלך. Comment[hu]=Adjon hozzá egy weboldalt az asztalhoz! Comment[id]=Tambahkan sebuah halaman web pada desktopmu. Comment[it]=Aggiungi una pagina web al tuo desktop. Comment[ko]=데스크톱에 웹 페이지를 추가합니다. Comment[lt]=Internetinis puslapis darbalaukyje. Comment[nb]=Legg de merkeligste plott på skrivebordet! Comment[nl]=Een webpagina toevoegen aan uw bureaublad. Comment[nn]=Legg ei nettside på skrivebordet Comment[pl]=Dodaje stronę internetową na pulpit. Comment[pt]=Adiciona uma página Web ao seu ecrã. Comment[pt_BR]=Adiciona uma página da Web na sua área de trabalho. Comment[ru]=Просмотр веб-страницы на рабочем столе Comment[sk]=Pridať webovú stránku na vašu plochu. Comment[sl]=Dodajte spletno stran na vaše namizje. Comment[sr]=Додајте веб страницу на површ Comment[sr@ijekavian]=Додајте веб страницу на површ Comment[sr@ijekavianlatin]=Dodajte veb stranicu na površ Comment[sr@latin]=Dodajte veb stranicu na površ Comment[sv]=Lägg till en webbsida på skrivbordet. Comment[tr]=Masaüstünüze bir dosya ekleyin. Comment[uk]=Додати сторінку інтернету на вашу стільницю. Comment[x-test]=xxAdd a webpage on your desktop.xx Comment[zh_CN]=添加网页到您的桌面 Comment[zh_TW]=在桌面上新增網頁。 Type=Service -Icon=internet-web-browser +Icon=applications-internet X-KDE-ParentApp= X-KDE-PluginInfo-Author=Mikhail Ivchenko X-KDE-PluginInfo-Email=ematirov@gmail.com X-KDE-PluginInfo-License=GPL-2.0+ X-KDE-PluginInfo-Name=org.kde.plasma.webbrowser X-KDE-PluginInfo-Version=0.1.0 X-KDE-PluginInfo-Website=plasma.kde.org X-KDE-ServiceTypes=Plasma/Applet X-Plasma-API=declarativeappletscript X-Plasma-MainScript=ui/main.qml X-KDE-PluginInfo-Category=Online Services X-Plasma-StandAloneApp=true