Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
54f3ce88
Commit
54f3ce88
authored
Jan 17, 2022
by
Waqar Ahmed
Committed by
Christoph Cullmann
Jan 29, 2022
Browse files
Don't allow dropping into different mainWindows for now
parent
615c9fdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
kate/kateviewmanager.cpp
View file @
54f3ce88
...
...
@@ -787,6 +787,13 @@ void KateViewManager::moveViewToViewSpace(KateViewSpace *dest, KateViewSpace *sr
{
// We always have an active view at this point which is what we are moving
Q_ASSERT
(
activeView
());
// Are we trying to drop into some other mainWindow of current app session?
// shouldn't happen, but just a safe guard
if
(
src
->
viewManger
()
!=
dest
->
viewManger
())
{
return
;
}
auto
view
=
src
->
takeView
(
doc
);
dest
->
addView
(
view
);
setActiveSpace
(
dest
);
...
...
kate/kateviewspace.cpp
View file @
54f3ce88
...
...
@@ -404,7 +404,6 @@ void KateViewSpace::registerDocument(KTextEditor::Document *doc)
connect
(
m_tabBar
,
&
KateTabBar
::
currentChanged
,
this
,
&
KateViewSpace
::
changeView
);
}
void
KateViewSpace
::
closeDocument
(
KTextEditor
::
Document
*
doc
)
{
// If this is the only view of the document,
...
...
@@ -431,10 +430,17 @@ void KateViewSpace::closeDocument(KTextEditor::Document *doc)
}
}
bool
KateViewSpace
::
acceptsDroppedTab
(
const
class
TabMimeData
*
tabMimeData
)
{
return
tabMimeData
&&
this
!=
tabMimeData
->
sourceVS
&&
// must not be same viewspace
viewManger
()
==
tabMimeData
->
sourceVS
->
viewManger
()
&&
// for now we don't support dropping into different windows
!
hasDocument
(
tabMimeData
->
doc
);
}
void
KateViewSpace
::
dragEnterEvent
(
QDragEnterEvent
*
e
)
{
auto
mimeData
=
qobject_cast
<
const
TabMimeData
*>
(
e
->
mimeData
());
if
(
mimeData
&&
this
!=
mimeData
->
sourceVS
&&
!
hasDocument
(
mimeData
->
doc
))
{
if
(
acceptsDroppedTab
(
mimeData
))
{
m_dropIndicator
.
reset
(
new
QRubberBand
(
QRubberBand
::
Rectangle
,
this
));
m_dropIndicator
->
setGeometry
(
rect
());
m_dropIndicator
->
show
();
...
...
kate/kateviewspace.h
View file @
54f3ce88
...
...
@@ -44,6 +44,14 @@ public:
*/
void
setActive
(
bool
active
);
/**
* @return the view manager that this viewspace belongs to
*/
KateViewManager
*
viewManger
()
const
{
return
m_viewManager
;
}
/**
* Create new view for given document
* @param doc document to create view for
...
...
@@ -214,6 +222,7 @@ private Q_SLOTS:
void
createNewDocument
();
private:
bool
acceptsDroppedTab
(
const
class
TabMimeData
*
tabMimeData
);
/**
* Returns the amount of documents in KateDocManager that currently
* have no tab in this tab bar.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment