Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'xenial' into xenial_-_bottomedge
Browse files Browse the repository at this point in the history
  • Loading branch information
kugiigi authored Feb 4, 2021
2 parents dd99830 + f6f636e commit b9526ae
Show file tree
Hide file tree
Showing 32 changed files with 1,185 additions and 306 deletions.
4 changes: 3 additions & 1 deletion src/Morph/Web/MorphWebContext.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ WebEngineProfile {
property alias dataPath: oxideContext.persistentStoragePath
property alias maxCacheSizeHint: oxideContext.httpCacheMaximumSize
property alias incognito: oxideContext.offTheRecord
property int userAgentId: 0
property string customUserAgent: ""
readonly property string defaultUserAgent: __ua.defaultUA

offTheRecord: false
Expand All @@ -35,7 +37,7 @@ WebEngineProfile {
cachePath: cacheLocation
maxCacheSizeHint: cacheSizeHint

userAgent: defaultUserAgent
userAgent: (customUserAgent !== "") ? customUserAgent : defaultUserAgent

persistentCookiesPolicy: WebEngineProfile.ForcePersistentCookies

Expand Down
2 changes: 1 addition & 1 deletion src/Morph/Web/MorphWebView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import QtQuick 2.4
import QtQuick.Window 2.2
import QtWebEngine 1.5
import QtWebEngine 1.10
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import "." // QTBUG-34418
Expand Down
1 change: 1 addition & 0 deletions src/Morph/Web/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void MorphBrowserPlugin::initializeEngine(QQmlEngine* engine, const char* uri)
void MorphBrowserPlugin::registerTypes(const char* uri)
{
Q_ASSERT(uri == QLatin1String("Morph.Web"));
qmlRegisterModule(uri, 0, 1);
}

#include "plugin.moc"
2 changes: 2 additions & 0 deletions src/app/BrowserView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ FocusScope {
OrientationHelper {
id: contentsItem

automaticOrientation: false

KeyboardRectangle {
id: _osk
}
Expand Down
1 change: 0 additions & 1 deletion src/app/BrowserWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Window {
property var currentWebview: null
property bool hasTouchScreen: false

contentOrientation: Screen.orientation

minimumWidth: units.gu(40)
minimumHeight: units.gu(20)
Expand Down
7 changes: 5 additions & 2 deletions src/app/ChromeBase.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ StyledItem {

property alias backgroundColor: backgroundRect.color

property alias loading: progressBar.visible
property alias loadProgress: progressBar.value
property bool loading: false
property real loadProgress: 0.0

states: [
State {
Expand Down Expand Up @@ -71,6 +71,9 @@ StyledItem {
ThinProgressBar {
id: progressBar

visible: chrome.loading
value: chrome.loadProgress

anchors {
left: parent.left
right: parent.right
Expand Down
133 changes: 36 additions & 97 deletions src/app/CustomUserAgentsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,12 @@ BrowserPage {

property bool selectMode
signal done()
signal reload(string selectedUserAgent)
signal reload()

title: i18n.tr("Custom User Agents")

showBackAction: !selectMode

function setUserAgentAsCurrentItem(userAgentName) {
for (var index = 0; index < customUserAgentsListView.count; index++) {
var userAgent = customUserAgentsListView.model.get(index);
if (userAgent.name === userAgentName) {
customUserAgentsListView.currentIndex = index;
return;
}
}
}

leadingActions: [
Action {
objectName: "close"
Expand Down Expand Up @@ -100,20 +90,11 @@ BrowserPage {
iconName: "add"
visible: !selectMode
onTriggered: {
var promptDialog = PopupUtils.open(Qt.resolvedUrl("PromptDialog.qml"), customUserAgentsPage);
promptDialog.title = i18n.tr("New User Agent")
promptDialog.message = i18n.tr("Add the name for the new user agent")
promptDialog.accept.connect(function(text) {
if (text !== "") {
if (UserAgentsModel.contains(text)) {
customUserAgentsPage.setUserAgentAsCurrentItem(text);
}
else {
customUserAgentsListView.currentIndex = -1;
UserAgentsModel.insertEntry(text, "");
reload(text);
}
}
var addDialog = PopupUtils.open(Qt.resolvedUrl("EditCustomUserAgentDialog.qml"), customUserAgentsPage);
addDialog.title = i18n.tr("New User Agent");
addDialog.accept.connect(function(userAgentName, userAgentString) {
UserAgentsModel.insertEntry(userAgentName, userAgentString);
reload();
});
}
}
Expand All @@ -140,81 +121,15 @@ BrowserPage {

delegate: ListItem {
id: item
readonly property bool isCurrentItem: item.ListView.isCurrentItem
//height: isCurrentItem ? layout.height : units.gu(5)
height: layout.height
color: isCurrentItem ? theme.palette.selected.base : theme.palette.normal.background

MouseArea {
anchors.fill: parent
onClicked: customUserAgentsListView.currentIndex = index
}

SlotsLayout {
id: layout
width: parent.width

mainSlot:

Column {

spacing: units.gu(2)

Row {
spacing: units.gu(1.5)
height: item.ListView.isCurrentItem ? units.gu(2) : units.gu(1)
width: parent.width

Icon {
anchors.verticalCenter: userAgentName.verticalCenter
visible: item.ListView.isCurrentItem
name: "avatar-default-symbolic"
height: units.gu(2)
width: height
}

Label {
id: userAgentLabel
anchors.verticalCenter: parent.verticalCenter
visible: ! item.ListView.isCurrentItem
width: parent.width
height: units.gu(1)
text: model.name
}

TextField {
id: userAgentName
visible: item.ListView.isCurrentItem
text: model.name
onFocusChanged: {
if (!focus) {
if (text === "") {
text = model.name;
}
else {
UserAgentsModel.setUserAgentName(model.id, text);
}
}
}
}

}

TextArea {
visible: item.ListView.isCurrentItem
width: parent.width
text: model.userAgentString
placeholderText: i18n.tr("enter user agent string...")
onFocusChanged: {
if (! focus) {
UserAgentsModel.setUserAgentString(model.id, text);
}
}
}
}
Label {
id: userAgentLabel
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
height: units.gu(1)
text: model.name
}


leadingActions: deleteActionList

ListItemActions {
Expand All @@ -231,6 +146,30 @@ BrowserPage {
}
]
}

trailingActions: trailingActionList

ListItemActions {
id: trailingActionList
actions: [
Action {
objectName: "trailingActionList.edit"
iconName: "edit"
enabled: true
onTriggered: {
var editDialog = PopupUtils.open(Qt.resolvedUrl("EditCustomUserAgentDialog.qml"), customUserAgentsPage);
editDialog.title = i18n.tr("Edit User Agent");
editDialog.previousUserAgentName = model.name;
editDialog.userAgentName = model.name;
editDialog.userAgentString = model.userAgentString;
editDialog.accept.connect(function(userAgentName, userAgentString) {
UserAgentsModel.setUserAgentString(model.id, userAgentString);
UserAgentsModel.setUserAgentName(model.id, userAgentName);
});
}
}
]
}
}
}

Expand Down
Loading

0 comments on commit b9526ae

Please sign in to comment.