Bug 413848 - Drag&copy function (by using Ctrl Key) does not work anymore
Summary: Drag&copy function (by using Ctrl Key) does not work anymore
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.63.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-05 17:48 UTC by Ismael Asensio
Modified: 2020-01-26 13:04 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ismael Asensio 2019-11-05 17:48:25 UTC
SUMMARY
The drag&copy function (by using Ctrl Key) doesn't seem to work anymore after Frameworks 5.63.
In previous versions of Kate/Kdevelop this function was working fine (kubuntu 19.10 with ppa / Apps:19.04.3, Frameworks: 5.62)

STEPS TO REPRODUCE
1. Within any editor using ktexteditor (kate/kwrite/kdevelop) select a block of text
2. Press the Ctrl-Key and start dragging with the mouse
3. Drop on another location

OBSERVED RESULT
- The cursor turns into a dragging hand
- The text is moved to the 'drop' location instead of being copied

EXPECTED RESULT
- The cursor turns to an arrow with a plus sign
- The text is copied to the 'drop' location

SOFTWARE/OS VERSIONS 
KDE Applications Version: 19.11.70
KDE Plasma Version: 5.17.80
KDE Frameworks Version: 5.64.0 according to System Settings (oddly, the 'about' dialog reports 5.60.0)
Qt Version: 5.12.4

ADDITIONAL INFORMATION
Also "reported" on https://unix.stackexchange.com/questions/547832/kate-kwrite-editor-drag-drop-copy-functionality-gone
Comment 1 Juraj 2020-01-22 21:49:39 UTC
Hello,
I tracked it down to the revision D23964
https://phabricator.kde.org/D23964

To be exact error is caused by this one change:
https://github.com/KDE/ktexteditor/commit/8f7f22c1fc83a5f18a1701c7c78dae882158de30?diff=unified#diff-fccc06952d6abc88b4b165fc4577eb0fL3240
Comment 2 Albert Astals Cid 2020-01-22 21:50:42 UTC
David some people claim you broke this with https://phabricator.kde.org/D23964
Comment 3 Christoph Cullmann 2020-01-22 22:17:34 UTC
This would fix it for me:

diff --git a/src/view/kateviewinternal.cpp b/src/view/kateviewinternal.cpp
index 51e1efc7..b7922eb2 100644
--- a/src/view/kateviewinternal.cpp
+++ b/src/view/kateviewinternal.cpp
@@ -3232,7 +3232,7 @@ void KateViewInternal::doDrag()
     QMimeData *mimeData = new QMimeData();
     mimeData->setText(view()->selectionText());
     m_dragInfo.dragObject->setMimeData(mimeData);
-    m_dragInfo.dragObject->exec(Qt::MoveAction);
+    m_dragInfo.dragObject->exec(Qt::MoveAction | Qt::CopyAction);
Comment 4 Juraj 2020-01-23 10:17:43 UTC
(In reply to Christoph Cullmann from comment #3)
> This would fix it for me:
> 
> diff --git a/src/view/kateviewinternal.cpp b/src/view/kateviewinternal.cpp
> index 51e1efc7..b7922eb2 100644
> --- a/src/view/kateviewinternal.cpp
> +++ b/src/view/kateviewinternal.cpp
> @@ -3232,7 +3232,7 @@ void KateViewInternal::doDrag()
>      QMimeData *mimeData = new QMimeData();
>      mimeData->setText(view()->selectionText());
>      m_dragInfo.dragObject->setMimeData(mimeData);
> -    m_dragInfo.dragObject->exec(Qt::MoveAction);
> +    m_dragInfo.dragObject->exec(Qt::MoveAction | Qt::CopyAction);

Can confirm, this fixes it for me too.
Comment 5 Christoph Cullmann 2020-01-26 13:04:51 UTC
Git commit 33a47ec6ebb84c9ddda4f4788df8f94c084ae45e by Christoph Cullmann.
Committed on 26/01/2020 at 13:04.
Pushed by cullmann into branch 'master'.

fix Drag&copy function (by using Ctrl Key)

M  +1    -1    src/view/kateviewinternal.cpp

https://commits.kde.org/ktexteditor/33a47ec6ebb84c9ddda4f4788df8f94c084ae45e