diff options
author | Darshan-upadhyay1110 <darshan.upadhyay@collabora.com> | 2023-09-07 13:00:50 +0530 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-10 20:49:08 +0200 |
commit | 39f9c0020505719517972bbf262306c2e0defd9c (patch) | |
tree | 7975f4032148af1ee5c9dabc00fdbe187308a88d /cui | |
parent | a6c68549d0132d76a04d21c146a48345742c451f (diff) |
Enable QR and barcode dialog for online
- enable QR and barcode genration dialog for online
- Change Qr code genration dialog to async
Change-Id: Ia46b8e27a3002adcc893e5ef4c2545d7edcc3e41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156642
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 6ed38adb5578d0b52d11d8f2077e345f9a8c7ade)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157728
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/QrCodeGenDialog.cxx | 27 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 4 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/QrCodeGenDialog.hxx | 5 |
4 files changed, 34 insertions, 4 deletions
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx index 0058ea362128..8a25e3b364e7 100644 --- a/cui/source/dialogs/QrCodeGenDialog.cxx +++ b/cui/source/dialogs/QrCodeGenDialog.cxx @@ -250,6 +250,33 @@ short QrCodeGenDialog::run() #endif } +bool QrCodeGenDialog::runAsync(const std::shared_ptr<QrCodeGenDialog>& rController, + const std::function<void(sal_Int32)>& rFunc) +{ +#if ENABLE_ZXING + + weld::GenericDialogController::runAsync(rController, [rController, rFunc](sal_Int32 nResult) { + if (nResult == RET_OK) + { + try + { + rController->Apply(); + } + catch (const std::exception&) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( + rController->GetParent(), VclMessageType::Warning, VclButtonsType::Ok, + CuiResId(RID_CUISTR_QRCODEDATALONG))); + xBox->run(); + } + } + + rFunc(nResult); + }); +#endif + return true; +} + void QrCodeGenDialog::Apply() { #if ENABLE_ZXING diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index f558f9e4a37d..086fd01c5af3 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -113,7 +113,6 @@ IMPL_ABSTDLG_CLASS(AbstractGraphicFilterDialog) IMPL_ABSTDLG_CLASS(AbstractHangulHanjaConversionDialog) IMPL_ABSTDLG_CLASS(AbstractInsertObjectDialog) IMPL_ABSTDLG_CLASS(AbstractLinksDialog) -IMPL_ABSTDLG_CLASS(AbstractQrCodeGenDialog) IMPL_ABSTDLG_CLASS(AbstractScreenshotAnnotationDlg) IMPL_ABSTDLG_CLASS(AbstractSignatureLineDialog) IMPL_ABSTDLG_CLASS(AbstractSignSignatureLineDialog) @@ -132,6 +131,7 @@ IMPL_ABSTDLG_CLASS(AbstractSvxZoomDialog) IMPL_ABSTDLG_CLASS(AbstractTitleDialog) IMPL_ABSTDLG_CLASS(AbstractURLDlg) IMPL_ABSTDLG_CLASS_ASYNC(AbstractPasswordToOpenModifyDialog,weld::DialogController) +IMPL_ABSTDLG_CLASS_ASYNC(AbstractQrCodeGenDialog,QrCodeGenDialog) IMPL_ABSTDLG_CLASS_ASYNC(AbstractPasteDialog,SfxDialogController) IMPL_ABSTDLG_CLASS_ASYNC(AbstractScriptSelectorDialog,SfxDialogController) IMPL_ABSTDLG_CLASS_ASYNC(AbstractSpellDialog,SfxDialogController) @@ -1495,7 +1495,7 @@ VclPtr<AbstractQrCodeGenDialog> AbstractDialogFactory_Impl::CreateQrCodeGenDialo weld::Window* pParent, const Reference<XModel> xModel, bool bEditExisting) { return VclPtr<AbstractQrCodeGenDialog_Impl>::Create( - std::make_unique<QrCodeGenDialog>(pParent, xModel, bEditExisting)); + std::make_shared<QrCodeGenDialog>(pParent, xModel, bEditExisting)); } VclPtr<AbstractAdditionsDialog> AbstractDialogFactory_Impl::CreateAdditionsDialog( diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 4adc0d82ee47..38ca4beded0a 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -407,7 +407,7 @@ DECL_ABSTDLG_CLASS(AbstractSignatureLineDialog,SignatureLineDialog) }; // AbstractQrCodeGenDialog_Impl -DECL_ABSTDLG_CLASS(AbstractQrCodeGenDialog,QrCodeGenDialog) +DECL_ABSTDLG_CLASS_ASYNC(AbstractQrCodeGenDialog,QrCodeGenDialog) }; // AbstractSignSignatureLineDialog_Impl diff --git a/cui/source/inc/QrCodeGenDialog.hxx b/cui/source/inc/QrCodeGenDialog.hxx index 001df88c5581..e477c0b44879 100644 --- a/cui/source/inc/QrCodeGenDialog.hxx +++ b/cui/source/inc/QrCodeGenDialog.hxx @@ -24,9 +24,11 @@ public: bool bEditExisting); virtual short run() override; + static bool runAsync(const std::shared_ptr<QrCodeGenDialog>& rController, + const std::function<void(sal_Int32)>& rFunc); -protected: void Apply(); + weld::Widget* GetParent() { return mpParent; } private: css::uno::Reference<css::frame::XModel> m_xModel; @@ -34,6 +36,7 @@ private: std::unique_ptr<weld::RadioButton> m_xECC[4]; std::unique_ptr<weld::SpinButton> m_xSpinBorder; std::unique_ptr<weld::ComboBox> m_xComboType; + #if ENABLE_ZXING weld::Widget* mpParent; #endif |