public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/krdc] f45: - Fix rhbz#2442266, Add/Edit Bookmarks options disappeared from Bookmarks menubar
@ 2026-11-29 11:43 Than Ngo
  0 siblings, 0 replies; only message in thread
From: Than Ngo @ 2026-11-29 11:43 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/krdc
            Branch : f45
            Commit : efdd2c9e6896886ef2f4a9ac811de72ceccd4aa0
            Author : Than Ngo <than@redhat.com>
            Date   : 2026-11-29T12:42:55+01:00
            Stats  : +379/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/krdc/c/efdd2c9e6896886ef2f4a9ac811de72ceccd4aa0?branch=f45

            Log:
            - Fix rhbz#2442266, Add/Edit Bookmarks options disappeared from Bookmarks menubar
- Fix rhbz#2562588, regression: Cyrillic text copied from Windows becomes Unicode
  escape sequences on Wayland

---
diff --git a/krdc-rhbz#2442266-reintroduce_edit_capabilities.patch b/krdc-rhbz#2442266-reintroduce_edit_capabilities.patch
new file mode 100644
index 0000000..90602ad
--- /dev/null
+++ b/krdc-rhbz#2442266-reintroduce_edit_capabilities.patch
@@ -0,0 +1,226 @@
+commit eb40670505d2ed6d067f548d39ed90c944b5e825
+Author: Fabio Bas <ctrlaltca@gmail.com>
+Date:   Fri Aug 28 19:43:05 2026 +0200
+
+    Reintroduce the edit capabilities in "BookmarkManager:, but use our custom connection dialog for edit and hide the "add" option
+    BUG: 516650
+
+diff --git a/bookmarkmanager.cpp b/bookmarkmanager.cpp
+index eee7ddac..87a53869 100644
+--- a/bookmarkmanager.cpp
++++ b/bookmarkmanager.cpp
+@@ -8,10 +8,98 @@
+ #include "krdc_debug.h"
+ #include "mainwindow.h"
+ 
++#include <KBookmarkAction>
++#include <KBookmarkActionMenu>
+ #include <KLocalizedString>
+ 
+ #include <QStandardPaths>
+ 
++BookmarkContextMenu::BookmarkContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, KBookmarkOwner *owner, QWidget *parent)
++    : KBookmarkContextMenu(bookmark, manager, owner, parent)
++{
++}
++
++void BookmarkContextMenu::addActions()
++{
++    if (bookmark().isGroup()) {
++        KBookmarkContextMenu::addActions();
++        return;
++    }
++
++    addAction(KBookmarkContextMenu::tr("Copy Link Address", "@action:inmenu"), this, &KBookmarkContextMenu::slotCopyLocation);
++    addAction(KBookmarkContextMenu::tr("Properties", "@action:inmenu"), this, [this]() {
++        Q_EMIT editBookmark(bookmark().url());
++    });
++
++    addSeparator();
++    addAction(QIcon::fromTheme(QStringLiteral("edit-delete")),
++              KBookmarkContextMenu::tr("Delete Bookmark", "@action:inmenu"),
++              this,
++              &KBookmarkContextMenu::slotRemove);
++}
++
++BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, KBookmarkOwner *owner, QMenu *parentMenu, BookmarkManager *bookmarkManager)
++    : KBookmarkMenu(manager, owner, parentMenu)
++    , m_bookmarkManager(bookmarkManager)
++{
++    removeAddBookmarkAction();
++}
++
++BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, KBookmarkOwner *owner, QMenu *parentMenu, const QString &parentAddress, BookmarkManager *bookmarkManager)
++    : KBookmarkMenu(manager, owner, parentMenu, parentAddress)
++    , m_bookmarkManager(bookmarkManager)
++{
++}
++
++QMenu *BookmarkMenu::contextMenu(QAction *action)
++{
++    auto *bookmarkAction = dynamic_cast<KBookmarkActionInterface *>(action);
++    if (!bookmarkAction) {
++        return nullptr;
++    }
++
++    auto *menu = new BookmarkContextMenu(bookmarkAction->bookmark(), manager(), owner());
++    connect(menu, &BookmarkContextMenu::editBookmark, m_bookmarkManager, &BookmarkManager::editBookmark);
++
++    return menu;
++}
++
++void BookmarkMenu::refill()
++{
++    KBookmarkMenu::refill();
++    removeAddBookmarkAction();
++}
++
++QAction *BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
++{
++    if (bookmark.isGroup()) {
++        auto *actionMenu = new KBookmarkActionMenu(bookmark, this);
++        m_actions.append(actionMenu);
++
++        auto *subMenu = new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address(), m_bookmarkManager);
++        m_lstSubMenus.append(subMenu);
++        return actionMenu;
++    }
++
++    if (bookmark.isSeparator()) {
++        auto *separator = new QAction(this);
++        separator->setSeparator(true);
++        m_actions.append(separator);
++        return separator;
++    }
++
++    auto *action = new KBookmarkAction(bookmark, owner(), this);
++    m_actions.append(action);
++    return action;
++}
++
++void BookmarkMenu::removeAddBookmarkAction()
++{
++    if (QAction *action = addBookmarkAction()) {
++        parentMenu()->removeAction(action);
++    }
++}
++
+ BookmarkManager::BookmarkManager(KActionCollection *collection, QMenu *menu, MainWindow *parent)
+     : QObject(parent)
+     , KBookmarkOwner()
+@@ -21,7 +109,7 @@ BookmarkManager::BookmarkManager(KActionCollection *collection, QMenu *menu, Mai
+     const QString file = dir + QLatin1String("krdc/bookmarks.xml");
+ 
+     m_manager = new KBookmarkManager(file, this);
+-    m_bookmarkMenu = new KBookmarkMenu(m_manager, this, menu);
++    m_bookmarkMenu = new BookmarkMenu(m_manager, this, menu, this);
+     collection->addActions(menu->actions());
+ 
+     KBookmarkGroup root = m_manager->root();
+@@ -110,17 +198,6 @@ QString BookmarkManager::titleForUrl(const QUrl &url) const
+     return url.toDisplayString(QUrl::UrlFormattingOption::StripTrailingSlash);
+ }
+ 
+-bool BookmarkManager::enableOption(KBookmarkOwner::BookmarkOption option) const
+-{
+-    switch (option) {
+-    case KBookmarkOwner::ShowAddBookmark:
+-    case KBookmarkOwner::ShowEditBookmark:
+-        return false;
+-    default:
+-        return false;
+-    }
+-}
+-
+ bool BookmarkManager::supportsTabs() const
+ {
+     return true;
+diff --git a/bookmarkmanager.h b/bookmarkmanager.h
+index 97d76510..19697739 100644
+--- a/bookmarkmanager.h
++++ b/bookmarkmanager.h
+@@ -10,6 +10,7 @@
+ #include "core/remoteview.h"
+ 
+ #include <KActionCollection>
++#include <KBookmarkContextMenu>
+ #include <KBookmarkManager>
+ #include <KBookmarkMenu>
+ #include <KBookmarkOwner>
+@@ -17,6 +18,37 @@
+ #include <QMenu>
+ 
+ class MainWindow;
++class BookmarkManager;
++
++class BookmarkContextMenu : public KBookmarkContextMenu
++{
++    Q_OBJECT
++
++public:
++    BookmarkContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, KBookmarkOwner *owner, QWidget *parent = nullptr);
++
++    void addActions() override;
++
++Q_SIGNALS:
++    void editBookmark(const QUrl &url);
++};
++
++class BookmarkMenu : public KBookmarkMenu
++{
++public:
++    BookmarkMenu(KBookmarkManager *manager, KBookmarkOwner *owner, QMenu *parentMenu, BookmarkManager *bookmarkManager);
++    BookmarkMenu(KBookmarkManager *manager, KBookmarkOwner *owner, QMenu *parentMenu, const QString &parentAddress, BookmarkManager *bookmarkManager);
++
++protected:
++    QMenu *contextMenu(QAction *action) override;
++    void refill() override;
++    QAction *actionForBookmark(const KBookmark &bookmark) override;
++
++private:
++    void removeAddBookmarkAction();
++
++    BookmarkManager *m_bookmarkManager;
++};
+ 
+ class BookmarkManager : public QObject, public KBookmarkOwner
+ {
+@@ -28,7 +60,6 @@ public:
+ 
+     QUrl currentUrl() const override;
+     QString currentTitle() const override;
+-    bool enableOption(KBookmarkOwner::BookmarkOption option) const override;
+     bool supportsTabs() const override;
+     QList<KBookmarkOwner::FutureBookmark> currentBookmarkList() const override;
+     void addHistoryBookmark(RemoteView *view);
+@@ -42,6 +73,7 @@ public:
+ 
+ Q_SIGNALS:
+     void openUrl(const QUrl &url);
++    void editBookmark(const QUrl &url);
+ 
+ private Q_SLOTS:
+     void openBookmark(const KBookmark &bm, Qt::MouseButtons, Qt::KeyboardModifiers) override;
+@@ -51,7 +83,7 @@ private:
+     QString urlForView(RemoteView *view) const;
+     QString titleForUrl(const QUrl &url) const;
+ 
+-    KBookmarkMenu *m_bookmarkMenu;
++    BookmarkMenu *m_bookmarkMenu;
+     KBookmarkManager *m_manager;
+     KBookmarkGroup m_historyGroup;
+ 
+diff --git a/mainwindow.cpp b/mainwindow.cpp
+index 1ed4dff6..ec88d8da 100644
+--- a/mainwindow.cpp
++++ b/mainwindow.cpp
+@@ -198,6 +198,9 @@ void MainWindow::setupActions()
+     m_bookmarkManager = new BookmarkManager(actionCollection(), bookmarkMenu->menu(), this);
+     actionCollection()->addAction(QStringLiteral("bookmark"), bookmarkMenu);
+     connect(m_bookmarkManager, SIGNAL(openUrl(QUrl)), SLOT(newConnection(QUrl)));
++    connect(m_bookmarkManager, &BookmarkManager::editBookmark, this, [this](const QUrl &url) {
++        showSettingsDialog(url.toString());
++    });
+ }
+ 
+ void MainWindow::loadAllPlugins()

diff --git a/krdc-rhbz#2562588-unicode.patch b/krdc-rhbz#2562588-unicode.patch
new file mode 100644
index 0000000..3b9e817
--- /dev/null
+++ b/krdc-rhbz#2562588-unicode.patch
@@ -0,0 +1,145 @@
+diff -up krdc-26.08.3/rdp/rdpcliprdr.cpp.me krdc-26.08.3/rdp/rdpcliprdr.cpp
+--- krdc-26.08.3/rdp/rdpcliprdr.cpp.me	2026-11-29 15:27:46.746828253 +0100
++++ krdc-26.08.3/rdp/rdpcliprdr.cpp	2026-11-29 15:24:55.157712690 +0100
+@@ -3,13 +3,17 @@
+  * SPDX-License-Identifier: GPL-2.0-or-later
+  */
+ 
++#include <QByteArrayView>
+ #include <QMimeData>
++#include <QStringDecoder>
+ 
+ #include "rdpcliprdr.h"
+ #include "rdpsession.h"
+ #include "rdpview.h"
+ #include <freerdp/version.h>
+ 
++#include "krdc_debug.h"
++
+ UINT RdpClipboard::onSendClientFormatList(CliprdrClientContext *cliprdr)
+ {
+     auto kclip = reinterpret_cast<RdpClipboard *>(cliprdr->custom);
+@@ -22,6 +26,7 @@ UINT RdpClipboard::onSendClientFormatLis
+     UINT32 *pFormatIds = nullptr;
+     UINT32 numFormats = ClipboardGetFormatIds(kclip->m_clipboard, &pFormatIds);
+     CLIPRDR_FORMAT *formats = reinterpret_cast<CLIPRDR_FORMAT *>(calloc(numFormats, sizeof(CLIPRDR_FORMAT)));
++    UINT32 count = 0;
+ 
+     if (!formats) {
+         free(pFormatIds);
+@@ -29,16 +34,30 @@ UINT RdpClipboard::onSendClientFormatLis
+         return ERROR_INTERNAL_ERROR;
+     }
+ 
++    // When the text is offered as CF_UNICODETEXT, leave out the ANSI formats
++    // and CF_LOCALE. WinPR would fill them with UTF-8 or escaped text marked as
++    // en-US, while Windows synthesizes them from CF_UNICODETEXT in the code
++    // page of the server.
++    bool haveUnicodeText = false;
++    for (UINT32 index = 0; index < numFormats; index++) {
++        haveUnicodeText = haveUnicodeText || (pFormatIds[index] == CF_UNICODETEXT);
++    }
++
+     for (UINT32 index = 0; index < numFormats; index++) {
+         UINT32 formatId = pFormatIds[index];
++        if (haveUnicodeText && ((formatId == CF_TEXT) || (formatId == CF_OEMTEXT) || (formatId == CF_LOCALE))) {
++            continue;
++        }
++
+         const char *formatName = ClipboardGetFormatName(kclip->m_clipboard, formatId);
+-        formats[index].formatId = formatId;
+-        formats[index].formatName = nullptr;
++        CLIPRDR_FORMAT &format = formats[count++];
++        format.formatId = formatId;
++        format.formatName = nullptr;
+ 
+         if ((formatId > CF_MAX) && formatName) {
+-            formats[index].formatName = _strdup(formatName);
++            format.formatName = _strdup(formatName);
+ 
+-            if (!formats[index].formatName) {
++            if (!format.formatName) {
+                 free(pFormatIds);
+                 free(formats);
+                 return ERROR_INTERNAL_ERROR;
+@@ -49,7 +68,7 @@ UINT RdpClipboard::onSendClientFormatLis
+     CLIPRDR_FORMAT_LIST formatList = {};
+     formatList.common.msgType = CB_FORMAT_LIST;
+     formatList.common.msgFlags = 0;
+-    formatList.numFormats = numFormats;
++    formatList.numFormats = count;
+     formatList.formats = formats;
+ 
+     if (!cliprdr->ClientFormatList) {
+@@ -171,18 +190,15 @@ UINT RdpClipboard::onServerFormatList(Cl
+         kclip->m_serverFormats.append(format);
+     }
+ 
+-    UINT rc;
+     for (auto format : kclip->m_serverFormats) {
+         if (format->formatId == CF_UNICODETEXT) {
+-            if ((rc = onSendClientFormatDataRequest(cliprdr, CF_UNICODETEXT)) != CHANNEL_RC_OK)
+-                return rc;
+-
+-            break;
+-        } else if (format->formatId == CF_TEXT) {
+-            if ((rc = onSendClientFormatDataRequest(cliprdr, CF_TEXT)) != CHANNEL_RC_OK)
+-                return rc;
++            return onSendClientFormatDataRequest(cliprdr, CF_UNICODETEXT);
++        }
++    }
+ 
+-            break;
++    for (auto format : kclip->m_serverFormats) {
++        if (format->formatId == CF_TEXT) {
++            return onSendClientFormatDataRequest(cliprdr, CF_TEXT);
+         }
+     }
+ 
+@@ -276,11 +292,23 @@ UINT RdpClipboard::onServerFormatDataRes
+     }
+ 
+     if ((formatId == CF_TEXT) || (formatId == CF_UNICODETEXT)) {
+-        auto data = reinterpret_cast<char *>(ClipboardGetData(kclip->m_clipboard, CF_TEXT, &size));
+-        size = strnlen(data, size);
++        // Read the text as CF_UNICODETEXT. Since WinPR 3.32.2, the CF_TEXT it
++        // converts from CF_UNICODETEXT is ASCII with \uXXXX escapes, not UTF-8.
++        auto data = reinterpret_cast<char *>(ClipboardGetData(kclip->m_clipboard, CF_UNICODETEXT, &size));
++        if (!data) {
++            return CHANNEL_RC_OK;
++        }
++
++        QString text = QStringDecoder(QStringDecoder::Utf16LE).decode(QByteArrayView(data, size));
++        free(data);
++        const qsizetype end = text.indexOf(QChar::Null);
++        if (end >= 0) {
++            text.truncate(end);
++        }
++        text.replace(QLatin1String("\r\n"), QLatin1String("\n"));
+ 
+         QMimeData *mimeData = new QMimeData;
+-        mimeData->setText(QString::fromUtf8(data, size));
++        mimeData->setText(text);
+         kclip->m_krdp->session->rdpView()->remoteClipboardChanged(mimeData);
+     }
+ 
+@@ -343,8 +371,17 @@ bool RdpClipboard::sendClipboard(const Q
+         if (text.isEmpty()) {
+             ClipboardEmpty(m_clipboard);
+         } else {
+-            QByteArray bytes = text.toUtf8();
+-            ClipboardSetData(m_clipboard, CF_TEXT, bytes.data(), bytes.size() + 1);
++            // CF_TEXT is ANSI text in the code page given by CF_LOCALE, not UTF-8.
++            // Store the text as CF_UNICODETEXT instead: UTF-16LE with CRLF line
++            // endings and a terminating NUL.
++            QString unicodeText = text;
++            unicodeText.replace(QLatin1String("\r\n"), QLatin1String("\n"));
++            unicodeText.replace(QLatin1Char('\n'), QLatin1String("\r\n"));
++            QByteArray bytes((unicodeText.size() + 1) * qsizetype(sizeof(quint16)), Qt::Uninitialized);
++            qToLittleEndian<quint16>(unicodeText.utf16(), unicodeText.size() + 1, bytes.data());
++            if (!ClipboardSetData(m_clipboard, CF_UNICODETEXT, bytes.constData(), UINT32(bytes.size()))) {
++                qCWarning(KRDC) << "Failed to store clipboard text";
++            }
+         }
+ 
+         onSendClientFormatList(m_cliprdr);

diff --git a/krdc.spec b/krdc.spec
index 527f821..bdc102c 100644
--- a/krdc.spec
+++ b/krdc.spec
@@ -5,13 +5,15 @@ ExcludeArch: %{ix86}
 Name:    krdc
 Summary: Remote desktop client
 Version: 26.08.3
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # Automatically converted from old format: GPLv2+ and GFDL - review is highly recommended.
 License: GPL-2.0-or-later AND LicenseRef-Callaway-GFDL
 URL:     https://invent.kde.org/network/krdc
 Source0: https://download.kde.org/%{stable_kf6}/release-service/%{version}/src/%{name}-%{version}.tar.xz
 
+Patch: krdc-rhbz#2562588-unicode.patch
+Patch: krdc-rhbz#2442266-reintroduce_edit_capabilities.patch
 
 BuildRequires: desktop-file-utils
 BuildRequires: libappstream-glib
@@ -124,6 +126,11 @@ desktop-file-validate %{buildroot}%{_kf6_datadir}/applications/org.kde.%{name}.d
 
 
 %changelog
+* Sun Nov 29 2026 Than Ngo <than@redhat.com> - 26.08.3-2
+- Fix rhbz#2442266, Add/Edit Bookmarks options disappeared from Bookmarks menubar
+- Fix rhbz#2562588, regression: Cyrillic text copied from Windows becomes Unicode
+  escape sequences on Wayland
+
 * Sun Nov 08 2026 Steve Cossette <farchord@gmail.com> - 26.08.3-1
 - 26.08.3
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 11:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 11:43 [rpms/krdc] f45: - Fix rhbz#2442266, Add/Edit Bookmarks options disappeared from Bookmarks menubar Than Ngo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox