[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - 2 commits - vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 15 16:33:32 UTC 2019
vcl/inc/qt5/Qt5DragAndDrop.hxx | 3 +++
vcl/inc/qt5/Qt5Widget.hxx | 2 ++
vcl/qt5/Qt5DragAndDrop.cxx | 2 ++
vcl/qt5/Qt5Frame.cxx | 7 +++++--
vcl/qt5/Qt5Menu.cxx | 6 +++++-
vcl/qt5/Qt5Widget.cxx | 6 ++++--
6 files changed, 21 insertions(+), 5 deletions(-)
New commits:
commit c4a51c9df805b59e97524b7f2c16be9c5ff06c2c
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Sat Dec 8 03:35:09 2018 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Tue Jan 15 17:33:24 2019 +0100
tdf#121974 Convert Qt menu text as needed
Just as is already done in 'Qt5Menu::InsertMenuItem',
the text needs to be converted in 'Qt5Menu::SetItemText'
as well.
Change-Id: I03c8f2e6fe0e926a3f7e4be5b7eac70f1bd9850f
Reviewed-on: https://gerrit.libreoffice.org/64796
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
(cherry picked from commit ee53d07ae17747cb81340c05983b1937bd23c136)
Reviewed-on: https://gerrit.libreoffice.org/65154
(cherry picked from commit 2aee047beae576823c4625678c6220012ff95c88)
Reviewed-on: https://gerrit.libreoffice.org/66300
Tested-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 8203a30c8112..7650eb034a1d 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -286,7 +286,11 @@ void Qt5Menu::SetItemText(unsigned, SalMenuItem* pItem, const rtl::OUString& rTe
Qt5MenuItem* pSalMenuItem = static_cast<Qt5MenuItem*>(pItem);
QAction* pAction = pSalMenuItem->getAction();
if (pAction)
- pAction->setText(toQString(rText));
+ {
+ OUString aText(rText);
+ NativeItemText(aText);
+ pAction->setText(toQString(aText));
+ }
}
void Qt5Menu::SetItemImage(unsigned, SalMenuItem* pItem, const Image& rImage)
commit 001f560f01bab0bc63769e08b7a0a777ee5160fd
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Mon Dec 3 16:40:27 2018 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Tue Jan 15 17:33:10 2019 +0100
tdf#120775: Implement DnD between 2 SalFrames
still only internal DnD (between multiple frames within 1 LibO
instance) is supported
Change-Id: I151162ee1075c8b2d71520aae950fc7214d752b7
Reviewed-on: https://gerrit.libreoffice.org/64477
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit f67e9aeeb1bd6fe82e0c4e851017962c74723213)
Reviewed-on: https://gerrit.libreoffice.org/65152
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
(cherry picked from commit bb7bf732bae1e2f4ebf0ed4e0307dbd63dade1d0)
Reviewed-on: https://gerrit.libreoffice.org/66299
Tested-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/vcl/inc/qt5/Qt5DragAndDrop.hxx b/vcl/inc/qt5/Qt5DragAndDrop.hxx
index dc5b52678d0a..f5ffac3bb21e 100644
--- a/vcl/inc/qt5/Qt5DragAndDrop.hxx
+++ b/vcl/inc/qt5/Qt5DragAndDrop.hxx
@@ -58,6 +58,9 @@ public:
void dragFailed();
void fire_dragEnd(sal_Int8 nAction);
+
+ static Qt5DragSource* m_ActiveDragSource;
+
css::uno::Reference<css::datatransfer::XTransferable> const& GetTransferable() const
{
return m_xTrans;
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 9d4d535d2e90..9f14d44fd5ef 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -56,6 +56,8 @@ class Qt5Widget : public QWidget
virtual void wheelEvent(QWheelEvent*) override;
virtual void closeEvent(QCloseEvent*) override;
+ const QString m_InternalMimeType = "application/x-libreoffice-dnditem";
+
public:
Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f = Qt::WindowFlags());
Qt5Frame* m_pFrame;
diff --git a/vcl/qt5/Qt5DragAndDrop.cxx b/vcl/qt5/Qt5DragAndDrop.cxx
index 280763812b72..092c2b2e10a6 100644
--- a/vcl/qt5/Qt5DragAndDrop.cxx
+++ b/vcl/qt5/Qt5DragAndDrop.cxx
@@ -67,6 +67,7 @@ void Qt5DragSource::startDrag(
if (m_pFrame)
{
Qt5Widget* qw = static_cast<Qt5Widget*>(m_pFrame->GetQWidget());
+ m_ActiveDragSource = this;
qw->startDrag();
}
else
@@ -97,6 +98,7 @@ void Qt5DragSource::fire_dragEnd(sal_Int8 nAction)
m_xListener.clear();
xListener->dragDropEnd(aEv);
}
+ m_ActiveDragSource = nullptr;
}
OUString SAL_CALL Qt5DragSource::getImplementationName()
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 39cfb6796ea8..30d1504347ff 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -1012,6 +1012,9 @@ void Qt5Frame::SetApplicationID(const OUString&)
}
// Drag'n'drop foo
+
+Qt5DragSource* Qt5DragSource::m_ActiveDragSource;
+
void Qt5Frame::registerDragSource(Qt5DragSource* pDragSource)
{
assert(!m_pDragSource);
@@ -1051,7 +1054,7 @@ void Qt5Frame::draggingStarted(const int x, const int y)
aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE;
css::uno::Reference<css::datatransfer::XTransferable> xTransferable;
- xTransferable = m_pDragSource->GetTransferable();
+ xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable();
if (!m_bInDrag && xTransferable.is())
{
@@ -1080,7 +1083,7 @@ void Qt5Frame::dropping(const int x, const int y)
aEvent.SourceActions = css::datatransfer::dnd::DNDConstants::ACTION_MOVE;
css::uno::Reference<css::datatransfer::XTransferable> xTransferable;
- xTransferable = m_pDragSource->GetTransferable();
+ xTransferable = Qt5DragSource::m_ActiveDragSource->GetTransferable();
aEvent.Transferable = xTransferable;
m_pDropTarget->fire_drop(aEvent);
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index ea0258589ff7..2d108fa21cd5 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -187,8 +187,9 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
void Qt5Widget::startDrag()
{
+ // internal drag source
QMimeData* mimeData = new QMimeData;
- mimeData->setData("application/x-libreoffice-dnditem", nullptr);
+ mimeData->setData(m_InternalMimeType, nullptr);
QDrag* drag = new QDrag(this);
drag->setMimeData(mimeData);
@@ -197,8 +198,9 @@ void Qt5Widget::startDrag()
void Qt5Widget::dragEnterEvent(QDragEnterEvent* event)
{
- if (event->source() == this)
+ if (event->mimeData()->hasFormat(m_InternalMimeType))
event->accept();
+ // else FIXME: external drag source
}
void Qt5Widget::dragMoveEvent(QDragMoveEvent* event)
More information about the Libreoffice-commits
mailing list