From 4078d3f2dc215c91d92dc73236a2fbbfc10bc8b1 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 19 Feb 2026 16:59:36 -0500 Subject: [PATCH] Remove attach dialog This was used when you pressed the "Attach file/image" button but had an image copied to your clipboard - allowing you to select from either source. This is a weird thing to ask, the button should always prompt you with a file dialog. It's still possible to paste an image from your clipboard with CTRL+V, but there isn't a way to do it via right-click yet. Fixes #712 --- src/chatbar/AttachDialog.qml | 64 ------------------------------------ src/chatbar/CMakeLists.txt | 1 - src/chatbar/SendBar.qml | 19 ++--------- 3 files changed, 2 insertions(+), 82 deletions(-) delete mode 100644 src/chatbar/AttachDialog.qml diff --git a/src/chatbar/AttachDialog.qml b/src/chatbar/AttachDialog.qml deleted file mode 100644 index 75e79bdd2..000000000 --- a/src/chatbar/AttachDialog.qml +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-FileCopyrightText: 2020 Carl Schwan -// SPDX-License-Identifier: GPL-2.0-or-later - -import QtCore -import QtQuick -import QtQuick.Controls as QQC2 -import QtQuick.Layouts - -import org.kde.kirigami as Kirigami - -import org.kde.neochat - -QQC2.Popup { - id: root - - padding: Kirigami.Units.largeSpacing - - signal chosen(string path) - - contentItem: RowLayout { - - spacing: Kirigami.Units.smallSpacing - - QQC2.ToolButton { - Layout.fillHeight: true - - icon.name: 'mail-attachment' - - text: i18nc("@action:button", "Choose local file") - - onClicked: { - root.close(); - var fileDialog = openFileDialog.createObject(QQC2.Overlay.overlay) as OpenFileDialog; - fileDialog.chosen.connect(path => root.chosen(path)); - fileDialog.open(); - } - } - - Kirigami.Separator {} - - QQC2.ToolButton { - Layout.fillHeight: true - - icon.name: 'insert-image' - text: i18nc("@action:button", "Clipboard image") - onClicked: { - const path = StandardPaths.standardLocations(StandardPaths.CacheLocation)[0] + "/screenshots/" + (new Date()).getTime() + ".png"; - if (!Clipboard.saveImage(path)) { - return; - } - root.chosen(path); - root.close(); - } - } - } - Component { - id: openFileDialog - - OpenFileDialog { - parentWindow: Window.window - currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] - } - } -} diff --git a/src/chatbar/CMakeLists.txt b/src/chatbar/CMakeLists.txt index fdd08781f..4d0445e76 100644 --- a/src/chatbar/CMakeLists.txt +++ b/src/chatbar/CMakeLists.txt @@ -6,7 +6,6 @@ ecm_add_qml_module(Chatbar GENERATE_PLUGIN_SOURCE URI org.kde.neochat.chatbar OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat/chatbar QML_FILES - AttachDialog.qml ChatBar.qml ChatBarCore.qml RichEditBar.qml diff --git a/src/chatbar/SendBar.qml b/src/chatbar/SendBar.qml index c49116fc3..fa034cbf3 100644 --- a/src/chatbar/SendBar.qml +++ b/src/chatbar/SendBar.qml @@ -43,11 +43,7 @@ RowLayout { function addAttachment(): void { if (!root.contentModel.hasRichFormatting) { - if (LibNeoChat.Clipboard.hasImage) { - attachDialog(); - } else { - fileDialog(); - } + fileDialog(); return; } @@ -58,22 +54,11 @@ RowLayout { standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel }); warningDialog.onAccepted.connect(() => { - if (LibNeoChat.Clipboard.hasImage) { - attachmentButton.attachDialog(); - } else { - attachmentButton.fileDialog(); - } + attachmentButton.fileDialog(); }); warningDialog.open(); } - function attachDialog(): void { - let dialog = Qt.createComponent('org.kde.neochat.chatbar', 'AttachDialog').createObject(QQC2.Overlay.overlay) as AttachDialog; - dialog.anchors.centerIn = QQC2.Overlay.overlay; - dialog.chosen.connect(path => root.contentModel.addAttachment(path)); - dialog.open(); - } - function fileDialog(): void { let dialog = Qt.createComponent('org.kde.neochat.libneochat', 'OpenFileDialog').createObject(QQC2.Overlay.overlay, { parentWindow: Window.window,