mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
clipboard: fix editing in popout
This commit is contained in:
@@ -65,15 +65,6 @@ Item {
|
|||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: modal
|
|
||||||
function onOpened() {
|
|
||||||
Qt.callLater(function () {
|
|
||||||
searchField.forceActiveFocus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,10 +78,9 @@ Rectangle {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (entryType === "image") {
|
if (entryType === "image") {
|
||||||
// TODO - forward to editing software
|
return;
|
||||||
} else {
|
|
||||||
editRequested();
|
|
||||||
}
|
}
|
||||||
|
editRequested();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
|
FocusScope {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property var clearConfirmDialog: null
|
||||||
|
|
||||||
|
property string activeTab: "recents"
|
||||||
|
property bool showKeyboardHints: false
|
||||||
|
property int activeImageLoads: 0
|
||||||
|
readonly property int maxConcurrentLoads: 3
|
||||||
|
|
||||||
|
property string mode: "history"
|
||||||
|
property string searchText: ClipboardService.searchText
|
||||||
|
|
||||||
|
readonly property bool clipboardAvailable: ClipboardService.clipboardAvailable
|
||||||
|
readonly property bool wtypeAvailable: ClipboardService.wtypeAvailable
|
||||||
|
readonly property int totalCount: ClipboardService.totalCount
|
||||||
|
readonly property var clipboardEntries: ClipboardService.clipboardEntries
|
||||||
|
readonly property var pinnedEntries: ClipboardService.pinnedEntries
|
||||||
|
readonly property int pinnedCount: ClipboardService.pinnedCount
|
||||||
|
readonly property var unpinnedEntries: ClipboardService.unpinnedEntries
|
||||||
|
readonly property int selectedIndex: ClipboardService.selectedIndex
|
||||||
|
readonly property bool keyboardNavigationActive: ClipboardService.keyboardNavigationActive
|
||||||
|
|
||||||
|
readonly property var modalFocusScope: root
|
||||||
|
property alias searchField: historyContent.searchField
|
||||||
|
property alias editorView: editorView
|
||||||
|
property alias keyboardController: keyboardController
|
||||||
|
|
||||||
|
signal closeRequested
|
||||||
|
signal instantCloseRequested
|
||||||
|
|
||||||
|
onActiveTabChanged: {
|
||||||
|
ClipboardService.selectedIndex = 0;
|
||||||
|
ClipboardService.keyboardNavigationActive = false;
|
||||||
|
}
|
||||||
|
onSearchTextChanged: ClipboardService.searchText = searchText
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
closeRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
function pasteSelected() {
|
||||||
|
ClipboardService.pasteSelected(() => root.instantCloseRequested());
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyEntry(entry) {
|
||||||
|
ClipboardService.copyEntry(entry, () => root.closeRequested());
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteEntry(entry) {
|
||||||
|
ClipboardService.deleteEntry(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletePinnedEntry(entry) {
|
||||||
|
ClipboardService.deletePinnedEntry(entry, clearConfirmDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pinEntry(entry) {
|
||||||
|
ClipboardService.pinEntry(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unpinEntry(entry) {
|
||||||
|
ClipboardService.unpinEntry(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearAll() {
|
||||||
|
ClipboardService.clearAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEntryPreview(entry) {
|
||||||
|
return ClipboardService.getEntryPreview(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEntryType(entry) {
|
||||||
|
return ClipboardService.getEntryType(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateFilteredModel() {
|
||||||
|
ClipboardService.updateFilteredModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshClipboard() {
|
||||||
|
ClipboardService.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editEntry(entry) {
|
||||||
|
if (!entry || entry.isImage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editorView.setEntry(entry);
|
||||||
|
mode = "editor";
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetState() {
|
||||||
|
activeImageLoads = 0;
|
||||||
|
mode = "history";
|
||||||
|
ClipboardService.reset();
|
||||||
|
keyboardController.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
focus: true
|
||||||
|
Keys.onPressed: function (event) {
|
||||||
|
keyboardController.handleKey(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipboardKeyboardController {
|
||||||
|
id: keyboardController
|
||||||
|
modal: root
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: historyView
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
visible: opacity > 0.01
|
||||||
|
enabled: root.mode === "history"
|
||||||
|
|
||||||
|
ClipboardContent {
|
||||||
|
id: historyContent
|
||||||
|
anchors.fill: parent
|
||||||
|
modal: root
|
||||||
|
clearConfirmDialog: root.clearConfirmDialog
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipboardEditor {
|
||||||
|
id: editorView
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0
|
||||||
|
scale: 0.98
|
||||||
|
visible: opacity > 0.01
|
||||||
|
enabled: root.mode === "editor"
|
||||||
|
focus: root.mode === "editor"
|
||||||
|
modal: root
|
||||||
|
keyController: keyboardController
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "history"
|
||||||
|
when: root.mode === "history"
|
||||||
|
PropertyChanges {
|
||||||
|
target: historyView
|
||||||
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: editorView
|
||||||
|
opacity: 0
|
||||||
|
scale: 0.98
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "editor"
|
||||||
|
when: root.mode === "editor"
|
||||||
|
PropertyChanges {
|
||||||
|
target: historyView
|
||||||
|
opacity: 0
|
||||||
|
scale: 0.98
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: editorView
|
||||||
|
opacity: 1
|
||||||
|
scale: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: "history"
|
||||||
|
to: "editor"
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
property: "scale"
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "editor"
|
||||||
|
to: "history"
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.standardEasing
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
property: "scale"
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -17,74 +17,28 @@ DankModal {
|
|||||||
active: clipboardHistoryModal.useHyprlandFocusGrab && clipboardHistoryModal.shouldHaveFocus
|
active: clipboardHistoryModal.useHyprlandFocusGrab && clipboardHistoryModal.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property string activeTab: "recents"
|
|
||||||
onActiveTabChanged: {
|
|
||||||
ClipboardService.selectedIndex = 0;
|
|
||||||
ClipboardService.keyboardNavigationActive = false;
|
|
||||||
}
|
|
||||||
property bool showKeyboardHints: false
|
|
||||||
property Component clipboardContent
|
|
||||||
property int activeImageLoads: 0
|
|
||||||
readonly property int maxConcurrentLoads: 3
|
|
||||||
|
|
||||||
readonly property bool clipboardAvailable: ClipboardService.clipboardAvailable
|
|
||||||
readonly property bool wtypeAvailable: ClipboardService.wtypeAvailable
|
|
||||||
readonly property int totalCount: ClipboardService.totalCount
|
|
||||||
readonly property var clipboardEntries: ClipboardService.clipboardEntries
|
|
||||||
readonly property var pinnedEntries: ClipboardService.pinnedEntries
|
|
||||||
readonly property int pinnedCount: ClipboardService.pinnedCount
|
|
||||||
readonly property var unpinnedEntries: ClipboardService.unpinnedEntries
|
|
||||||
readonly property int selectedIndex: ClipboardService.selectedIndex
|
|
||||||
readonly property bool keyboardNavigationActive: ClipboardService.keyboardNavigationActive
|
|
||||||
property string searchText: ClipboardService.searchText
|
|
||||||
onSearchTextChanged: ClipboardService.searchText = searchText
|
|
||||||
|
|
||||||
Ref {
|
|
||||||
service: ClipboardService
|
|
||||||
}
|
|
||||||
|
|
||||||
property string mode: "history"
|
|
||||||
onModeChanged: {
|
|
||||||
if (mode !== "history") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Qt.callLater(function () {
|
|
||||||
if (contentLoader.item?.searchField) {
|
|
||||||
contentLoader.item.searchField.forceActiveFocus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateFilteredModel() {
|
|
||||||
ClipboardService.updateFilteredModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pasteSelected() {
|
|
||||||
ClipboardService.pasteSelected(instantClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
if (shouldBeVisible) {
|
if (shouldBeVisible) {
|
||||||
hide();
|
hide();
|
||||||
} else {
|
return;
|
||||||
show();
|
|
||||||
}
|
}
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
open();
|
open();
|
||||||
mode = "history";
|
|
||||||
activeImageLoads = 0;
|
|
||||||
shouldHaveFocus = true;
|
shouldHaveFocus = true;
|
||||||
ClipboardService.reset();
|
|
||||||
keyboardController.reset();
|
|
||||||
|
|
||||||
Qt.callLater(function () {
|
Qt.callLater(function () {
|
||||||
if (clipboardAvailable) {
|
if (contentLoader.item) {
|
||||||
|
contentLoader.item.resetState();
|
||||||
|
}
|
||||||
|
if (clipboardHistoryModal.clipboardAvailable) {
|
||||||
if (Theme.isConnectedEffect) {
|
if (Theme.isConnectedEffect) {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (clipboardHistoryModal.shouldBeVisible)
|
if (clipboardHistoryModal.shouldBeVisible) {
|
||||||
ClipboardService.refresh();
|
ClipboardService.refresh();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ClipboardService.refresh();
|
ClipboardService.refresh();
|
||||||
@@ -102,61 +56,12 @@ DankModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDialogClosed: {
|
onDialogClosed: {
|
||||||
activeImageLoads = 0;
|
if (contentLoader.item) {
|
||||||
ClipboardService.reset();
|
contentLoader.item.resetState();
|
||||||
keyboardController.reset();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshClipboard() {
|
readonly property bool clipboardAvailable: ClipboardService.clipboardAvailable
|
||||||
ClipboardService.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyEntry(entry) {
|
|
||||||
ClipboardService.copyEntry(entry, hide);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteEntry(entry) {
|
|
||||||
ClipboardService.deleteEntry(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deletePinnedEntry(entry) {
|
|
||||||
ClipboardService.deletePinnedEntry(entry, clearConfirmDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pinEntry(entry) {
|
|
||||||
ClipboardService.pinEntry(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unpinEntry(entry) {
|
|
||||||
ClipboardService.unpinEntry(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearAll() {
|
|
||||||
ClipboardService.clearAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEntryPreview(entry) {
|
|
||||||
return ClipboardService.getEntryPreview(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEntryType(entry) {
|
|
||||||
return ClipboardService.getEntryType(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function editEntry(entry) {
|
|
||||||
if (!entry) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (entry.isImage) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const editor = contentLoader.item?.editorView;
|
|
||||||
if (!editor) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
editor.setEntry(entry);
|
|
||||||
mode = "editor";
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: false
|
visible: false
|
||||||
modalWidth: ClipboardConstants.modalWidth
|
modalWidth: ClipboardConstants.modalWidth
|
||||||
@@ -166,16 +71,11 @@ DankModal {
|
|||||||
borderColor: Theme.outlineMedium
|
borderColor: Theme.outlineMedium
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
enableShadow: true
|
enableShadow: true
|
||||||
closeOnEscapeKey: mode !== "editor"
|
closeOnEscapeKey: (contentLoader.item?.mode ?? "history") !== "editor"
|
||||||
onBackgroundClicked: hide()
|
onBackgroundClicked: hide()
|
||||||
modalFocusScope.Keys.onPressed: function (event) {
|
|
||||||
keyboardController.handleKey(event);
|
|
||||||
}
|
|
||||||
content: clipboardContent
|
|
||||||
|
|
||||||
ClipboardKeyboardController {
|
Ref {
|
||||||
id: keyboardController
|
service: ClipboardService
|
||||||
modal: clipboardHistoryModal
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmModal {
|
ConfirmModal {
|
||||||
@@ -200,112 +100,11 @@ DankModal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var confirmDialog: clearConfirmDialog
|
content: Component {
|
||||||
|
ClipboardHistoryContent {
|
||||||
clipboardContent: Component {
|
clearConfirmDialog: clearConfirmDialog
|
||||||
Item {
|
onCloseRequested: clipboardHistoryModal.hide()
|
||||||
id: viewContainer
|
onInstantCloseRequested: clipboardHistoryModal.instantClose()
|
||||||
|
|
||||||
property alias editorView: editorView
|
|
||||||
property alias searchField: historyContent.searchField
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: historyView
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
opacity: 1
|
|
||||||
scale: 1
|
|
||||||
visible: opacity > 0.01
|
|
||||||
enabled: clipboardHistoryModal.mode === "history"
|
|
||||||
|
|
||||||
ClipboardContent {
|
|
||||||
id: historyContent
|
|
||||||
anchors.fill: parent
|
|
||||||
modal: clipboardHistoryModal
|
|
||||||
clearConfirmDialog: clipboardHistoryModal.confirmDialog
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ClipboardEditor {
|
|
||||||
id: editorView
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
opacity: 0
|
|
||||||
scale: 0.98
|
|
||||||
visible: opacity > 0.01
|
|
||||||
enabled: clipboardHistoryModal.mode === "editor"
|
|
||||||
focus: clipboardHistoryModal.mode === "editor"
|
|
||||||
modal: clipboardHistoryModal
|
|
||||||
keyController: keyboardController
|
|
||||||
}
|
|
||||||
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: "history"
|
|
||||||
when: clipboardHistoryModal.mode === "history"
|
|
||||||
PropertyChanges {
|
|
||||||
target: historyView
|
|
||||||
opacity: 1
|
|
||||||
scale: 1
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
target: editorView
|
|
||||||
opacity: 0
|
|
||||||
scale: 0.98
|
|
||||||
}
|
|
||||||
},
|
|
||||||
State {
|
|
||||||
name: "editor"
|
|
||||||
when: clipboardHistoryModal.mode === "editor"
|
|
||||||
PropertyChanges {
|
|
||||||
target: historyView
|
|
||||||
opacity: 0
|
|
||||||
scale: 0.98
|
|
||||||
}
|
|
||||||
PropertyChanges {
|
|
||||||
target: editorView
|
|
||||||
opacity: 1
|
|
||||||
scale: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: "history"
|
|
||||||
to: "editor"
|
|
||||||
ParallelAnimation {
|
|
||||||
NumberAnimation {
|
|
||||||
property: "opacity"
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
property: "scale"
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Transition {
|
|
||||||
from: "editor"
|
|
||||||
to: "history"
|
|
||||||
ParallelAnimation {
|
|
||||||
NumberAnimation {
|
|
||||||
property: "opacity"
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
property: "scale"
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.emphasizedEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,47 +15,20 @@ DankPopout {
|
|||||||
property var parentWidget: null
|
property var parentWidget: null
|
||||||
property var triggerScreen: null
|
property var triggerScreen: null
|
||||||
property string activeTab: "recents"
|
property string activeTab: "recents"
|
||||||
property bool showKeyboardHints: false
|
|
||||||
property int activeImageLoads: 0
|
|
||||||
readonly property int maxConcurrentLoads: 3
|
|
||||||
|
|
||||||
readonly property bool clipboardAvailable: ClipboardService.clipboardAvailable
|
readonly property bool clipboardAvailable: ClipboardService.clipboardAvailable
|
||||||
readonly property bool wtypeAvailable: ClipboardService.wtypeAvailable
|
|
||||||
readonly property int totalCount: ClipboardService.totalCount
|
|
||||||
readonly property var clipboardEntries: ClipboardService.clipboardEntries
|
|
||||||
readonly property var pinnedEntries: ClipboardService.pinnedEntries
|
|
||||||
readonly property int pinnedCount: ClipboardService.pinnedCount
|
readonly property int pinnedCount: ClipboardService.pinnedCount
|
||||||
readonly property var unpinnedEntries: ClipboardService.unpinnedEntries
|
readonly property var confirmDialog: clearConfirmDialog
|
||||||
readonly property int selectedIndex: ClipboardService.selectedIndex
|
|
||||||
readonly property bool keyboardNavigationActive: ClipboardService.keyboardNavigationActive
|
|
||||||
property string searchText: ClipboardService.searchText
|
|
||||||
onSearchTextChanged: ClipboardService.searchText = searchText
|
|
||||||
|
|
||||||
readonly property var modalFocusScope: contentLoader.item ?? null
|
readonly property var modalFocusScope: contentLoader.item ?? null
|
||||||
|
|
||||||
Ref {
|
|
||||||
service: ClipboardService
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateFilteredModel() {
|
|
||||||
ClipboardService.updateFilteredModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
function pasteSelected() {
|
|
||||||
ClipboardService.pasteSelected(instantClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
function instantClose() {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
open();
|
open();
|
||||||
activeImageLoads = 0;
|
|
||||||
ClipboardService.reset();
|
|
||||||
keyboardController.reset();
|
|
||||||
|
|
||||||
Qt.callLater(function () {
|
Qt.callLater(function () {
|
||||||
|
if (contentLoader.item) {
|
||||||
|
contentLoader.item.activeTab = activeTab;
|
||||||
|
contentLoader.item.resetState();
|
||||||
|
}
|
||||||
if (contentLoader.item?.searchField) {
|
if (contentLoader.item?.searchField) {
|
||||||
contentLoader.item.searchField.text = "";
|
contentLoader.item.searchField.text = "";
|
||||||
contentLoader.item.searchField.forceActiveFocus();
|
contentLoader.item.searchField.forceActiveFocus();
|
||||||
@@ -65,47 +38,12 @@ DankPopout {
|
|||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
close();
|
close();
|
||||||
activeImageLoads = 0;
|
|
||||||
ClipboardService.reset();
|
|
||||||
keyboardController.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshClipboard() {
|
|
||||||
ClipboardService.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyEntry(entry) {
|
|
||||||
ClipboardService.copyEntry(entry, hide);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteEntry(entry) {
|
|
||||||
ClipboardService.deleteEntry(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deletePinnedEntry(entry) {
|
|
||||||
ClipboardService.deletePinnedEntry(entry, clearConfirmDialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pinEntry(entry) {
|
|
||||||
ClipboardService.pinEntry(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unpinEntry(entry) {
|
|
||||||
ClipboardService.unpinEntry(entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearAll() {
|
function clearAll() {
|
||||||
ClipboardService.clearAll();
|
ClipboardService.clearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEntryPreview(entry) {
|
|
||||||
return ClipboardService.getEntryPreview(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEntryType(entry) {
|
|
||||||
return ClipboardService.getEntryType(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
popupWidth: ClipboardConstants.popoutWidth
|
popupWidth: ClipboardConstants.popoutWidth
|
||||||
popupHeight: ClipboardConstants.popoutHeight
|
popupHeight: ClipboardConstants.popoutHeight
|
||||||
triggerWidth: 55
|
triggerWidth: 55
|
||||||
@@ -117,20 +55,25 @@ DankPopout {
|
|||||||
onBackgroundClicked: hide()
|
onBackgroundClicked: hide()
|
||||||
|
|
||||||
onShouldBeVisibleChanged: {
|
onShouldBeVisibleChanged: {
|
||||||
if (!shouldBeVisible)
|
if (!shouldBeVisible) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (clipboardAvailable) {
|
if (clipboardAvailable) {
|
||||||
if (Theme.isConnectedEffect) {
|
if (Theme.isConnectedEffect) {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (root.shouldBeVisible)
|
if (root.shouldBeVisible) {
|
||||||
ClipboardService.refresh();
|
ClipboardService.refresh();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ClipboardService.refresh();
|
ClipboardService.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboardController.reset();
|
|
||||||
Qt.callLater(function () {
|
Qt.callLater(function () {
|
||||||
|
if (contentLoader.item) {
|
||||||
|
contentLoader.item.activeTab = activeTab;
|
||||||
|
contentLoader.item.resetState();
|
||||||
|
}
|
||||||
if (contentLoader.item?.searchField) {
|
if (contentLoader.item?.searchField) {
|
||||||
contentLoader.item.searchField.text = "";
|
contentLoader.item.searchField.text = "";
|
||||||
contentLoader.item.searchField.forceActiveFocus();
|
contentLoader.item.searchField.forceActiveFocus();
|
||||||
@@ -139,14 +82,13 @@ DankPopout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onPopoutClosed: {
|
onPopoutClosed: {
|
||||||
activeImageLoads = 0;
|
if (contentLoader.item) {
|
||||||
ClipboardService.reset();
|
contentLoader.item.resetState();
|
||||||
keyboardController.reset();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipboardKeyboardController {
|
Ref {
|
||||||
id: keyboardController
|
service: ClipboardService
|
||||||
modal: root
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfirmModal {
|
ConfirmModal {
|
||||||
@@ -155,48 +97,20 @@ DankPopout {
|
|||||||
confirmButtonColor: Theme.primary
|
confirmButtonColor: Theme.primary
|
||||||
}
|
}
|
||||||
|
|
||||||
property var confirmDialog: clearConfirmDialog
|
|
||||||
|
|
||||||
content: Component {
|
content: Component {
|
||||||
FocusScope {
|
ClipboardHistoryContent {
|
||||||
id: contentFocusScope
|
|
||||||
|
|
||||||
LayoutMirroring.enabled: I18n.isRtl
|
LayoutMirroring.enabled: I18n.isRtl
|
||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
focus: true
|
clearConfirmDialog: clearConfirmDialog
|
||||||
|
onCloseRequested: root.hide()
|
||||||
property alias searchField: clipboardContentItem.searchField
|
onInstantCloseRequested: root.close()
|
||||||
|
|
||||||
Keys.onPressed: function (event) {
|
|
||||||
keyboardController.handleKey(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (root.shouldBeVisible)
|
activeTab = root.activeTab;
|
||||||
|
if (root.shouldBeVisible) {
|
||||||
forceActiveFocus();
|
forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root
|
|
||||||
function onShouldBeVisibleChanged() {
|
|
||||||
if (root.shouldBeVisible) {
|
|
||||||
Qt.callLater(() => contentFocusScope.forceActiveFocus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function onOpened() {
|
|
||||||
Qt.callLater(() => {
|
|
||||||
if (clipboardContentItem.searchField) {
|
|
||||||
clipboardContentItem.searchField.forceActiveFocus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ClipboardContent {
|
|
||||||
id: clipboardContentItem
|
|
||||||
modal: root
|
|
||||||
clearConfirmDialog: root.confirmDialog
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user