cui/source/dialogs/QrCodeGenDialog.cxx |   27 +++++++++++++++++++++++++++
 cui/source/factory/dlgfact.cxx         |    4 ++--
 cui/source/factory/dlgfact.hxx         |    2 +-
 cui/source/inc/QrCodeGenDialog.hxx     |    5 ++++-
 sw/source/uibase/uiview/viewdlg2.cxx   |    6 ++++--
 vcl/jsdialog/enabled.cxx               |    1 +
 6 files changed, 39 insertions(+), 6 deletions(-)

New commits:
commit 6ed38adb5578d0b52d11d8f2077e345f9a8c7ade
Author:     Darshan-upadhyay1110 <darshan.upadh...@collabora.com>
AuthorDate: Thu Sep 7 13:00:50 2023 +0530
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Sep 8 20:38:53 2023 +0200

    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.k...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx 
b/cui/source/dialogs/QrCodeGenDialog.cxx
index 817be7f21ede..43f6f26279ae 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -231,6 +231,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 091caf4d2bb7..a571b99887ae 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)
@@ -1490,7 +1490,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 991ec082ad48..0d60011a922b 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -406,7 +406,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
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx 
b/sw/source/uibase/uiview/viewdlg2.cxx
index 19678d38fdcb..597731645ebe 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -75,9 +75,11 @@ void SwView::ExecDlgExt(SfxRequest const& rReq)
         {
             VclAbstractDialogFactory* pFact = 
VclAbstractDialogFactory::Create();
             const uno::Reference<frame::XModel> xModel(GetCurrentDocument());
-            ScopedVclPtr<AbstractQrCodeGenDialog> 
pDialog(pFact->CreateQrCodeGenDialog(
+            VclPtr<AbstractQrCodeGenDialog> 
pDialog(pFact->CreateQrCodeGenDialog(
                 GetFrameWeld(), xModel, rReq.GetSlot() == SID_EDIT_QRCODE));
-            pDialog->Execute();
+            pDialog->StartExecuteAsync([pDialog](sal_Int32) {
+                pDialog->disposeOnce();
+            });
             break;
         }
         case SID_ADDITIONS_DIALOG:
diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 50e90455c2e6..c93897d95d6c 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -85,6 +85,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
         || rUIFile == u"cui/ui/transparencytabpage.ui"
         || rUIFile == u"cui/ui/twolinespage.ui"
         || rUIFile == u"cui/ui/widgettestdialog.ui"
+        || rUIFile == u"cui/ui/qrcodegen.ui"
         // formula
         || rUIFile == u"formula/ui/formuladialog.ui"
         || rUIFile == u"formula/ui/functionpage.ui"

Reply via email to