[Libreoffice-commits] core.git: 2 commits - sw/qa vcl/ios
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 23 09:40:27 UTC 2021
sw/qa/uitest/writer_tests3/hyperlinkdialog.py | 15 +++++++++++++++
vcl/ios/DataFlavorMapping.cxx | 8 ++++----
vcl/ios/DataFlavorMapping.hxx | 2 +-
vcl/ios/clipboard.cxx | 7 ++-----
vcl/ios/clipboard.hxx | 1 -
vcl/ios/iOSTransferable.cxx | 14 +++++---------
vcl/ios/iOSTransferable.hxx | 3 +--
7 files changed, 28 insertions(+), 22 deletions(-)
New commits:
commit b01aab7c5b13ce04caa426e3b85ee19b2ef06c4f
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Jan 13 00:31:43 2021 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Mar 23 10:39:51 2021 +0100
We only use the systemwide general pasteboard
Simplify code to explicitly use it then instead of using variables.
Change-Id: I915a44cf7275fbf2140671a2edf1da29f1bf4e40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109202
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112948
Tested-by: Tor Lillqvist <tml at collabora.com>
diff --git a/vcl/ios/DataFlavorMapping.cxx b/vcl/ios/DataFlavorMapping.cxx
index 9d2ade8b513e..4ccbe374de87 100644
--- a/vcl/ios/DataFlavorMapping.cxx
+++ b/vcl/ios/DataFlavorMapping.cxx
@@ -434,13 +434,13 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor
return sysFlavor;
}
-NSString* DataFlavorMapper::openOfficeImageToSystemFlavor(UIPasteboard* pPasteboard)
+NSString* DataFlavorMapper::openOfficeImageToSystemFlavor()
{
- if ([pPasteboard containsPasteboardTypes:@[ PBTYPE_PNG ]])
+ if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[ PBTYPE_PNG ]])
return PBTYPE_PNG;
- else if ([pPasteboard containsPasteboardTypes:@[ PBTYPE_JPEG ]])
+ else if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[ PBTYPE_JPEG ]])
return PBTYPE_JPEG;
- else if ([pPasteboard containsPasteboardTypes:@[ PBTYPE_PDF ]])
+ else if ([[UIPasteboard generalPasteboard] containsPasteboardTypes:@[ PBTYPE_PDF ]])
return PBTYPE_PDF;
return @"";
}
diff --git a/vcl/ios/DataFlavorMapping.hxx b/vcl/ios/DataFlavorMapping.hxx
index 7e527dc09c34..fa45be243e9e 100644
--- a/vcl/ios/DataFlavorMapping.hxx
+++ b/vcl/ios/DataFlavorMapping.hxx
@@ -80,7 +80,7 @@ public:
If there is no suitable mapping available NULL will
be returned.
*/
- static NSString* openOfficeImageToSystemFlavor(UIPasteboard* pPasteboard);
+ static NSString* openOfficeImageToSystemFlavor();
/* Get a data provider which is able to provide the data 'rTransferable' offers in a format that can
be put on to the system clipboard.
diff --git a/vcl/ios/clipboard.cxx b/vcl/ios/clipboard.cxx
index ad0af57e3995..46dfa92bfcd7 100644
--- a/vcl/ios/clipboard.cxx
+++ b/vcl/ios/clipboard.cxx
@@ -36,9 +36,6 @@ iOSClipboard::iOSClipboard()
mrXMimeCntFactory = css::datatransfer::MimeContentTypeFactory::create(xContext);
mpDataFlavorMapper.reset(new DataFlavorMapper());
-
- mPasteboard = [UIPasteboard generalPasteboard];
- assert(mPasteboard != nil);
}
iOSClipboard::~iOSClipboard() {}
@@ -48,7 +45,7 @@ css::uno::Reference<css::datatransfer::XTransferable> SAL_CALL iOSClipboard::get
osl::MutexGuard aGuard(m_aMutex);
return css::uno::Reference<css::datatransfer::XTransferable>(
- new iOSTransferable(mrXMimeCntFactory, mpDataFlavorMapper, mPasteboard));
+ new iOSTransferable(mrXMimeCntFactory, mpDataFlavorMapper));
}
void SAL_CALL iOSClipboard::setContents(
@@ -75,7 +72,7 @@ void SAL_CALL iOSClipboard::setContents(
}
}
SAL_INFO("vcl.ios.clipboard", "Setting pasteboard items: " << NSDictionaryKeysToOUString(dict));
- [mPasteboard setItems:array options:@{}];
+ [[UIPasteboard generalPasteboard] setItems:array options:@{}];
// We don't keep a copy of the clipboard contents around in-process, so fire the lost clipboard
// ownership event right away.
diff --git a/vcl/ios/clipboard.hxx b/vcl/ios/clipboard.hxx
index 144e9c3acdee..66a4dd1b5591 100644
--- a/vcl/ios/clipboard.hxx
+++ b/vcl/ios/clipboard.hxx
@@ -103,7 +103,6 @@ private:
mClipboardListeners;
css::uno::Reference<css::datatransfer::clipboard::XClipboardOwner> mXClipboardOwner;
std::shared_ptr<DataFlavorMapper> mpDataFlavorMapper;
- UIPasteboard* mPasteboard;
};
#endif // INCLUDED_VCL_IOS_CLIPBOARD_HXX
diff --git a/vcl/ios/iOSTransferable.cxx b/vcl/ios/iOSTransferable.cxx
index 1ae2277014b6..6e1bd00b3a97 100644
--- a/vcl/ios/iOSTransferable.cxx
+++ b/vcl/ios/iOSTransferable.cxx
@@ -86,18 +86,14 @@ bool cmpAllContentTypeParameter(const Reference<XMimeContentType>& xLhs,
} // unnamed namespace
iOSTransferable::iOSTransferable(const Reference<XMimeContentTypeFactory>& rXMimeCntFactory,
- std::shared_ptr<DataFlavorMapper> pDataFlavorMapper,
- UIPasteboard* pasteboard)
+ std::shared_ptr<DataFlavorMapper> pDataFlavorMapper)
: mrXMimeCntFactory(rXMimeCntFactory)
, mDataFlavorMapper(pDataFlavorMapper)
- , mPasteboard(pasteboard)
{
- [mPasteboard retain];
-
initClipboardItemList();
}
-iOSTransferable::~iOSTransferable() { [mPasteboard release]; }
+iOSTransferable::~iOSTransferable() {}
Any SAL_CALL iOSTransferable::getTransferData(const DataFlavor& aFlavor)
{
@@ -109,11 +105,11 @@ Any SAL_CALL iOSTransferable::getTransferData(const DataFlavor& aFlavor)
bool bInternal(false);
NSString* sysFormat = (aFlavor.MimeType.startsWith("image/png"))
- ? DataFlavorMapper::openOfficeImageToSystemFlavor(mPasteboard)
+ ? DataFlavorMapper::openOfficeImageToSystemFlavor()
: mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor, bInternal);
DataProviderPtr_t dp;
- NSData* sysData = [mPasteboard dataForPasteboardType:sysFormat];
+ NSData* sysData = [[UIPasteboard generalPasteboard] dataForPasteboardType:sysFormat];
dp = DataFlavorMapper::getDataProvider(sysFormat, sysData);
if (dp.get() == nullptr)
@@ -138,7 +134,7 @@ sal_Bool SAL_CALL iOSTransferable::isDataFlavorSupported(const DataFlavor& aFlav
void iOSTransferable::initClipboardItemList()
{
- NSArray* pboardFormats = [mPasteboard pasteboardTypes];
+ NSArray* pboardFormats = [[UIPasteboard generalPasteboard] pasteboardTypes];
if (pboardFormats == nullptr)
{
diff --git a/vcl/ios/iOSTransferable.hxx b/vcl/ios/iOSTransferable.hxx
index 5c685dba8949..b76bcf6c0d06 100644
--- a/vcl/ios/iOSTransferable.hxx
+++ b/vcl/ios/iOSTransferable.hxx
@@ -39,7 +39,7 @@ class iOSTransferable : public ::cppu::WeakImplHelper<css::datatransfer::XTransf
public:
explicit iOSTransferable(
css::uno::Reference<css::datatransfer::XMimeContentTypeFactory> const& rXMimeCntFactory,
- std::shared_ptr<DataFlavorMapper> pDataFlavorMapper, UIPasteboard* pasteboard);
+ std::shared_ptr<DataFlavorMapper> pDataFlavorMapper);
virtual ~iOSTransferable() override;
iOSTransferable(const iOSTransferable&) = delete;
@@ -65,7 +65,6 @@ private:
css::uno::Sequence<css::datatransfer::DataFlavor> mFlavorList;
css::uno::Reference<css::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory;
std::shared_ptr<DataFlavorMapper> mDataFlavorMapper;
- UIPasteboard* mPasteboard;
};
#endif
commit e6efc0e309a1a715febec1e830efb1d06e3831de
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Mar 22 20:38:14 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Mar 23 10:39:43 2021 +0100
tdf#141166: sw: Add UItest
Change-Id: If81d02ad19232250c49b4446a905603250a5a2b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112938
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
index 235f1468ab0f..c2b9a85b7618 100644
--- a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
+++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
@@ -80,4 +80,19 @@ class HyperlinkDialog(UITestCase):
self.ui_test.close_doc()
+ def test_tdf141166(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xHelp = xDialog.getChild("help")
+
+ # Without the fix in place, this test would have crashed here
+ self.ui_test.execute_blocking_action(xHelp.executeAction,
+ args=("TYPE", mkPropertyValues({"KEYCODE": "CTRL+h"})), dialog_element="cancel")
+
+ self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list