From 1e7d3046aa5acc1eac6ad6ecb621a49043218ffc Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 7 May 2021 01:55:08 +0200 Subject: [PATCH] Remove link confirmation dialog Fix #347 Fix #348 --- qml/main.qml | 40 ---------------------------------------- src/neochatconfig.kcfg | 4 ---- src/roommanager.cpp | 12 +++--------- src/roommanager.h | 3 --- 4 files changed, 3 insertions(+), 56 deletions(-) diff --git a/qml/main.qml b/qml/main.qml index 6ddc3b465..2f1796a51 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -126,12 +126,6 @@ Kirigami.ApplicationWindow { showPassiveNotification(i18n("Warning: %1", message)); } } - - function onOpenLink(url) { - openLinkConfirmationComponent.createObject(QQC2.ApplicationWindow.overlay, { - url: url, - }).open(); - } } function pushReplaceLayer(page, args) { @@ -376,38 +370,4 @@ Kirigami.ApplicationWindow { } } } - - Component { - id: openLinkConfirmationComponent - - Kirigami.OverlaySheet { - id: openLinkConfirmation - required property var url; - - header: Kirigami.Heading { - text: i18n("Confirm opening a link") - } - parent: QQC2.ApplicationWindow.overlay - contentItem: ColumnLayout { - QQC2.Label { - text: i18n("Do you want to open the link to %1?", `${url}`) - wrapMode: Text.WordWrap - } - QQC2.CheckBox { - id: dontAskAgain - text: i18n("Don't ask again") - } - } - footer: QQC2.DialogButtonBox { - standardButtons: QQC2.DialogButtonBox.Ok | QQC2.DialogButtonBox.Cancel - onAccepted: { - Config.confirmLinksAction = !dontAskAgain.checked; - Config.save(); - Qt.openUrlExternally(url); - openLinkConfirmation.close(); - } - onRejected: openLinkConfirmation.close(); - } - } - } } diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg index aa22e0bad..75feeeb61 100644 --- a/src/neochatconfig.kcfg +++ b/src/neochatconfig.kcfg @@ -18,10 +18,6 @@ true - - - true - false diff --git a/src/roommanager.cpp b/src/roommanager.cpp index f75a0097a..c0770848f 100644 --- a/src/roommanager.cpp +++ b/src/roommanager.cpp @@ -164,15 +164,9 @@ void RoomManager::joinRoom(Quotient::Connection *account, bool RoomManager::visitNonMatrix(const QUrl &url) { - // Return true if the user cancels, treating it as an alternative normal - // flow (rather than an abnormal flow when the navigation itself fails). - if (NeoChatConfig::self()->confirmLinksAction()) { - Q_EMIT openLink(url); - } else { - if (!QDesktopServices::openUrl(url)) { - Q_EMIT warning(i18n("No application for the link"), - i18n("Your operating system could not find an application for the link.")); - } + if (!QDesktopServices::openUrl(url)) { + Q_EMIT warning(i18n("No application for the link"), + i18n("Your operating system could not find an application for the link.")); } return true; } diff --git a/src/roommanager.h b/src/roommanager.h index 4f9948922..08753584f 100644 --- a/src/roommanager.h +++ b/src/roommanager.h @@ -95,9 +95,6 @@ Q_SIGNALS: /// Displays warning to the user. void warning(const QString &title, const QString &message); - /// Ask user to open link and then open it. - void openLink(const QUrl &url); - private: NeoChatRoom *m_currentRoom; NeoChatRoom *m_lastCurrentRoom;