Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Implemented advanced text functions #78

Merged
merged 4 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions debian/ubuntu-keyboard-data.install
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ usr/share/maliit/plugins/com/ubuntu/images/
usr/share/maliit/plugins/com/ubuntu/keys/
usr/share/maliit/plugins/com/ubuntu/languages/
usr/share/maliit/plugins/com/ubuntu/styles/
usr/share/maliit/plugins/com/ubuntu/ActionsToolbar.qml
usr/share/maliit/plugins/com/ubuntu/FloatingActions.qml
usr/share/maliit/plugins/com/ubuntu/Keyboard.qml
usr/share/maliit/plugins/com/ubuntu/KeyboardContainer.qml
usr/share/maliit/plugins/com/ubuntu/WordRibbon.qml
Expand Down
78 changes: 78 additions & 0 deletions qml/ActionsToolbar.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import QtQuick 2.9
UniversalSuperBox marked this conversation as resolved.
Show resolved Hide resolved
import Ubuntu.Components 1.3
import QtQuick.Layouts 1.3
import "keys/"


Rectangle{
id: actionsToolbar

color: fullScreenItem.theme.backgroundColor

anchors {
left: parent.left
right: parent.right
}

states: [
State {
name: "wordribbon"

AnchorChanges {
target: actionsToolbar
anchors.top: undefined
anchors.bottom: keyboardComp.top
}
},
State {
name: "top"

AnchorChanges {
target: actionsToolbar
anchors.top: parent.top
anchors.bottom: undefined
}
}
]

// Disable clicking behind the toolbar
MouseArea {
anchors.fill: parent
z: -1
}

RowLayout {
anchors.fill: parent

ActionBar {
id: leadingActionBar

Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true

numberOfSlots: 4
delegate: ActionsToolbarButton{fullLayout: fullScreenItem.width > units.gu(80)}
actions: [
Action { text: i18n.tr("Select All"); iconName: "edit-select-all"; onTriggered: fullScreenItem.selectAll(); },
Action { text: i18n.tr("Redo"); iconName: "redo"; onTriggered: fullScreenItem.redo();},
Action { text: i18n.tr("Undo"); iconName: "undo"; onTriggered: fullScreenItem.undo();}
]
}

ActionBar {
id: trailingActionBar

Layout.fillHeight: true
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight

delegate: ActionsToolbarButton{fullLayout: fullScreenItem.width > units.gu(45)}

// TODO: Disabled dynamic visibility of copy and cut buttons until input_method.hasSelection is working properly in QtWebEngine
actions: [
Action { text: i18n.tr("Paste"); iconName: "edit-paste"; onTriggered: fullScreenItem.paste(); },
Action { text: i18n.tr("Copy"); iconName: "edit-copy"; /*visible: input_method.hasSelection; */ onTriggered: {fullScreenItem.copy(); fullScreenItem.sendLeftKey();} },
Action { text: i18n.tr("Cut"); iconName: "edit-cut"; /*visible: input_method.hasSelection; */ onTriggered: fullScreenItem.cut(); }
]
}
}
}
112 changes: 112 additions & 0 deletions qml/FloatingActions.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import QtQuick 2.9
import Ubuntu.Components 1.3
import QtQuick.Layouts 1.3
import "keys/"

RowLayout {
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: units.gu(1)
topMargin: toolbar.height + units.gu(1)
}

FloatingActionKey {
id: startLineButton

Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: units.gu(5)
Layout.preferredHeight: units.gu(5)
action: Action {
iconName: "go-first"
onTriggered: {
if (cursorSwipeArea.selectionMode) {
fullScreenItem.selectStartOfLine();
} else {
fullScreenItem.moveToStartOfLine();
}
}
}
}

FloatingActionKey {
id: startDocButton

iconRotation: 90
Layout.alignment: Qt.AlignLeft
Layout.preferredWidth: units.gu(5)
Layout.preferredHeight: units.gu(5)
action: Action {
iconName: "go-first"
onTriggered: {
if (cursorSwipeArea.selectionMode) {
fullScreenItem.selectStartOfDocument();
} else {
fullScreenItem.moveToStartOfDocument();
}
}
}
}

FloatingActionKey {
id: doneButton

Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.minimumWidth: units.gu(5)
Layout.maximumWidth: units.gu(20)
Layout.preferredHeight: units.gu(5)
keyFeedback: false
action: Action {
text: i18n.tr("Done")
iconName: "ok"
onTriggered: {
if (cursorSwipeArea.selectionMode) {
cursorSwipeArea.exitSelectionMode()
} else {
fullScreenItem.exitSwipeMode()
}
}
}
}



FloatingActionKey {
id: endDocButton

iconRotation: 90
Layout.alignment: Qt.AlignRight
Layout.preferredWidth: units.gu(5)
Layout.preferredHeight: units.gu(5)
action: Action {
iconName: "go-last"
onTriggered: {
if (cursorSwipeArea.selectionMode) {
fullScreenItem.selectEndOfDocument();
} else {
fullScreenItem.moveToEndOfDocument();
}
}
}
}

FloatingActionKey {
id: endLineButton

Layout.alignment: Qt.AlignRight
Layout.preferredWidth: units.gu(5)
Layout.preferredHeight: units.gu(5)
action: Action {
iconName: "go-last"
onTriggered: {
if (cursorSwipeArea.selectionMode) {
fullScreenItem.selectEndOfLine();
} else {
fullScreenItem.moveToEndOfLine();
}
}
}
}
}
Loading