diff options
author | Ken Moore <ken@ixsystems.com> | 2018-04-17 08:39:05 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-04-17 08:39:05 -0400 |
commit | 33a0bc31c14d37ae835d6096e9c4d66cd2e71901 (patch) | |
tree | 9b527391062fee40920f30e0939ee7414b4f0106 /src-qt5/core | |
parent | Merge pull request #571 from rodlie/lthemeengine_qss_order (diff) | |
download | lumina-33a0bc31c14d37ae835d6096e9c4d66cd2e71901.tar.gz lumina-33a0bc31c14d37ae835d6096e9c4d66cd2e71901.tar.bz2 lumina-33a0bc31c14d37ae835d6096e9c4d66cd2e71901.zip |
Fix up the clipboard persistance.
When moving the owner of the clipboard over to the desktop session, we need to copy *all* of the data on the clipboard, not just the text.
Very often, text on the clipboard is "paired" with control codes or alternate info in other mimetype fields.
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 9ea377ba..fe399e40 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -594,10 +594,21 @@ void LSession::SessionEnding(){ } void LSession::handleClipboard(QClipboard::Mode mode){ - if (!ignoreClipboard) { + if ( !ignoreClipboard && mode == QClipboard::Clipboard ){ //only support Clipboard const QMimeData *mime = QApplication::clipboard()->mimeData(mode); - if (!mime) { return; } - if (mime->hasText()) { QMetaObject::invokeMethod(this, "storeClipboard", Qt::QueuedConnection, Q_ARG(QString, mime->text()), Q_ARG(QClipboard::Mode, mode)); } + if (mime==NULL) { return; } + if (mime->hasText() && !QApplication::clipboard()->ownsClipboard()) { + //preserve the entire mimeData set, not just the text + //Note that even when we want to "save" the test, we should keep the whole thing + // this preserves formatting codes and more that apps might need + QMimeData *copy = new QMimeData(); + QStringList fmts = mime->formats(); + for(int i=0; i<fmts.length(); i++){ copy->setData(fmts[i], mime->data(fmts[i])); } + ignoreClipboard = true; + QApplication::clipboard()->setMimeData(copy, mode); + ignoreClipboard = false; + //QMetaObject::invokeMethod(this, "storeClipboard", Qt::QueuedConnection, Q_ARG(QString, mime->text()), Q_ARG(QClipboard::Mode, mode)); + } } } |