sw/source/ui/dbui/mmoutputtypepage.cxx |   48 ++++++++++++++++++---------------
 sw/source/ui/dbui/mmresultdialogs.cxx  |    8 +++--
 sw/source/ui/inc/mmresultdialogs.hxx   |   11 +++----
 sw/source/uibase/uiview/viewsrch.cxx   |    3 ++
 sw/uiconfig/swriter/ui/mmsendmails.ui  |    4 +-
 5 files changed, 42 insertions(+), 32 deletions(-)

New commits:
commit 106f66e921da871c26ce6b642f9f67024417b93d
Author: Jim Raykowski <rayk...@gmail.com>
Date:   Mon Feb 12 23:43:00 2018 -0900

    tdf#115620 Prevent "Find Text" changing "Navigate By"
    
    Change-Id: I46ab436e98f0d24e51277f22b2a707dfd5e2937c
    Reviewed-on: https://gerrit.libreoffice.org/49690
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    (cherry picked from commit eb975197b62204062393979e33438a3a4e2d27c1)
    Reviewed-on: https://gerrit.libreoffice.org/49696
    Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>

diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index e6fc466dfc9a..463bd92054df 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -198,6 +198,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
         case FN_REPEAT_SEARCH:
         case FID_SEARCH_NOW:
         {
+            sal_uInt16 nMoveType = SwView::GetMoveType();
             {
                 if(FID_SEARCH_NOW == nSlot && !rReq.IsAPI())
                     SwView::SetMoveType(NID_SRCH_REP);
@@ -396,6 +397,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
                         }
 #endif
                         m_bFound = false;
+                        SwView::SetMoveType(nMoveType);
                         return;
                     }
 
@@ -425,6 +427,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
 
             rReq.Done();
             m_eLastSearchCommand = m_pSrchItem->GetCommand();
+            SwView::SetMoveType(nMoveType);
         }
         break;
         case FID_SEARCH_SEARCHSET:
commit e0d32e7fc9abd0c5718398f6ed80a75c392e746a
Author: Alex McMurchy1917 <mcmurchy1917-libreoff...@yahoo.co.uk>
Date:   Thu Aug 24 14:34:13 2017 +0100

    tdf#103919 mailmerge: prevent premature end of emailing
    
    ...by changing the parent of SwSendMailDialog.
    
    The destruction of the main dialog (SwMMResultEmailDialog) also
    closes the progress dlg (SwSendMailDialog), which shuts down the
    dispatcher stopping anymore messages from being sent. Have changed
    the parent of progress dlg such that it will not close when the
    main dialog is closed. This has allowed the main dialog to be
    closed immediately after the progress dialog had been created
    making for a cleaner ui.
    
    During the development of this patch
    there were problems with the timer causing LO to consistently crash
    during the dispose of OutputDevice, but I could find no logical
    reason for the crashes.
    (It didn't crash if smtp authentication failed. It also didn't
    crash when run in gdb...)
    Moving the exit code from StateChanged to CloseHdl magically
    fixed the crashing problem. I think it makes it a bit clearer
    to end in closeHdl anyway, and start the timer only in case of
    an early cancellation (before all the mail messages
    have been queued up). This eliminates MOST of the use of the
    timer - since the typical exit occurs after the email process
    has finished.
    
    Change-Id: Icd3af372772fab3e78eb0702b120d7a811baa6bd
    Reviewed-on: https://gerrit.libreoffice.org/41519
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/49680

diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx 
b/sw/source/ui/dbui/mmoutputtypepage.cxx
index 0dd9bedcc917..dd9ce480b9f0 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -241,7 +241,7 @@ SwSendWarningBox_Impl::SwSendWarningBox_Impl(vcl::Window* 
pParent, const OUStrin
 #define ITEMID_STATUS   2
 
 SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, 
SwMailMergeConfigItem& rConfigItem) :
-    ModelessDialog /*SfxModalDialog*/(pParent, "SendMailsDialog", 
"modules/swriter/ui/mmsendmails.ui"),
+    Dialog(pParent, "SendMailsDialog", "modules/swriter/ui/mmsendmails.ui"),
     m_pTransferStatus(get<FixedText>("transferstatus")),
     m_pPaused(get<FixedText>("paused")),
     m_pProgressBar(get<ProgressBar>("progress")),
@@ -257,9 +257,10 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, 
SwMailMergeConfigItem&
     m_sCompleted(   SwResId(ST_COMPLETED )),
     m_sFailed(      SwResId(ST_FAILED     )),
     m_bCancel(false),
-    m_bDesctructionEnabled(false),
+    m_bDestructionEnabled(false),
     m_pImpl(new SwSendMailDialog_Impl),
     m_pConfigItem(&rConfigItem),
+    m_nExpectedCount(0),
     m_nSendCount(0),
     m_nErrorCount(0)
 {
@@ -290,6 +291,7 @@ SwSendMailDialog::SwSendMailDialog(vcl::Window *pParent, 
SwMailMergeConfigItem&
     m_pStatus->SetTabs(&nTabs[0], MapUnit::MapPixel);
     m_pStatus->SetSpaceBetweenEntries(3);
 
+    m_pPaused->Show(false);
     UpdateTransferStatus();
 }
 
@@ -331,7 +333,8 @@ void SwSendMailDialog::dispose()
     m_pStatusHB.clear();
     m_pStop.clear();
     m_pClose.clear();
-    ModelessDialog::dispose();
+
+    Dialog::dispose();
 }
 
 void SwSendMailDialog::AddDocument( SwMailDescriptor const & rDesc )
@@ -367,7 +370,15 @@ IMPL_LINK( SwSendMailDialog, StopHdl_Impl, Button*, 
pButton, void )
 
 IMPL_LINK_NOARG(SwSendMailDialog, CloseHdl_Impl, Button*, void)
 {
-    ModelessDialog::Show( false );
+    Dialog::Show( false );
+
+    if ( m_bDestructionEnabled )
+        disposeOnce();
+    else
+    {
+        m_pImpl->aRemoveIdle.SetInvokeHandler( LINK( this, SwSendMailDialog, 
RemoveThis ) );
+        m_pImpl->aRemoveIdle.Start();
+    }
 }
 
 IMPL_STATIC_LINK( SwSendMailDialog, StartSendMails, void*, pDialog, void )
@@ -385,7 +396,7 @@ IMPL_LINK( SwSendMailDialog, RemoveThis, Timer*, pTimer, 
void )
             m_pImpl->xMailDispatcher->shutdown();
     }
 
-    if( m_bDesctructionEnabled &&
+    if( m_bDestructionEnabled &&
             (!m_pImpl->xMailDispatcher.is() ||
                     !m_pImpl->xMailDispatcher->isRunning()))
     {
@@ -513,22 +524,12 @@ void  SwSendMailDialog::IterateMails()
     UpdateTransferStatus();
 }
 
-void SwSendMailDialog::ShowDialog()
+void SwSendMailDialog::ShowDialog(sal_Int32 nExpectedCount)
 {
     Application::PostUserEvent( LINK( this, SwSendMailDialog,
                                       StartSendMails ), this, true );
-    ModelessDialog::Show();
-}
-
-void  SwSendMailDialog::StateChanged( StateChangedType nStateChange )
-{
-    ModelessDialog::StateChanged( nStateChange );
-    if(StateChangedType::Visible == nStateChange && !IsVisible())
-    {
-        m_pImpl->aRemoveIdle.SetInvokeHandler( LINK( this, SwSendMailDialog,
-                                                    RemoveThis ) );
-        m_pImpl->aRemoveIdle.Start();
-    }
+    m_nExpectedCount = nExpectedCount > 0 ? nExpectedCount : 1;
+    Dialog::Show();
 }
 
 void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> const 
& xMessage,
@@ -566,21 +567,26 @@ void SwSendMailDialog::UpdateTransferStatus()
 {
     OUString sStatus( m_sTransferStatus );
     sStatus = sStatus.replaceFirst("%1", OUString::number(m_nSendCount) );
-    sStatus = sStatus.replaceFirst("%2", 
OUString::number(m_pImpl->aDescriptors.size()));
+    sStatus = sStatus.replaceFirst("%2", OUString::number(m_nExpectedCount));
     m_pTransferStatus->SetText(sStatus);
 
     sStatus = m_sErrorStatus.replaceFirst("%1", 
OUString::number(m_nErrorCount) );
     m_pErrorStatus->SetText(sStatus);
 
     if(m_pImpl->aDescriptors.size())
-        m_pProgressBar->SetValue((sal_uInt16)(m_nSendCount * 100 / 
m_pImpl->aDescriptors.size()));
+        m_pProgressBar->SetValue(static_cast<sal_uInt16>(m_nSendCount * 100 / 
m_nExpectedCount));
     else
         m_pProgressBar->SetValue(0);
 }
 
 void SwSendMailDialog::AllMailsSent()
 {
-    m_pStop->Enable(false);
+    // Leave open if some kind of error occurred
+    if ( m_nSendCount == m_nExpectedCount )
+    {
+        m_pStop->Enable( false );
+        Dialog::Show( false );
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx 
b/sw/source/ui/dbui/mmresultdialogs.cxx
index 05b354d9eb6d..e63fa1983f35 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -1081,12 +1081,15 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, 
Button*, pButton, void)
     xStore->storeToURL( sTargetTempURL, aValues   );
 
     //create the send dialog
-    VclPtr<SwSendMailDialog> pDlg = VclPtr<SwSendMailDialog>::Create(pButton, 
*xConfigItem);
-    pDlg->ShowDialog();
+    vcl::Window* pParent = Application::GetDefDialogParent();
+    VclPtr<SwSendMailDialog> pDlg = VclPtr<SwSendMailDialog>::Create(pParent, 
*xConfigItem);
+
+    pDlg->ShowDialog(nEnd - nBegin);
     //help to force painting the dialog
     //TODO/CLEANUP
     //predetermined breaking point
     Application::Reschedule( true );
+    endDialog(pButton);
     for(sal_uInt32 nDoc = nBegin; nDoc < nEnd; ++nDoc)
     {
         SwDocMergeInfo& rInfo = xConfigItem->GetDocumentMergeInfo(nDoc);
@@ -1238,7 +1241,6 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, 
Button*, pButton, void)
     pDlg->EnableDestruction();
     ::osl::File::remove( sTargetTempURL );
 
-    endDialog(pButton);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/inc/mmresultdialogs.hxx 
b/sw/source/ui/inc/mmresultdialogs.hxx
index 2b6f65aa58e2..01e89826372c 100644
--- a/sw/source/ui/inc/mmresultdialogs.hxx
+++ b/sw/source/ui/inc/mmresultdialogs.hxx
@@ -162,7 +162,7 @@ struct SwMailDescriptor
 };
 struct SwSendMailDialog_Impl;
 class SwMailMergeConfigItem;
-class SwSendMailDialog : public ModelessDialog //SfxModalDialog
+class SwSendMailDialog : public Dialog
 {
     VclPtr<FixedText>               m_pTransferStatus;
     VclPtr<FixedText>               m_pPaused;
@@ -185,10 +185,11 @@ class SwSendMailDialog : public ModelessDialog 
//SfxModalDialog
     OUString                m_sFailed;
 
     bool                    m_bCancel;
-    bool                    m_bDesctructionEnabled;
+    bool                    m_bDestructionEnabled;
 
     SwSendMailDialog_Impl*  m_pImpl;
     SwMailMergeConfigItem*  m_pConfigItem;
+    sal_Int32               m_nExpectedCount;
     sal_Int32               m_nSendCount;
     sal_Int32               m_nErrorCount;
 
@@ -202,16 +203,14 @@ class SwSendMailDialog : public ModelessDialog 
//SfxModalDialog
     void        SendMails();
     void        UpdateTransferStatus();
 
-    virtual void        StateChanged( StateChangedType nStateChange ) override;
-
 public:
     SwSendMailDialog( vcl::Window* pParent, SwMailMergeConfigItem& );
     virtual ~SwSendMailDialog() override;
     virtual void        dispose() override;
 
     void                AddDocument( SwMailDescriptor const & rDesc );
-    void                EnableDestruction() {m_bDesctructionEnabled = true;}
-    void                ShowDialog();
+    void                EnableDestruction() {m_bDestructionEnabled = true;}
+    void                ShowDialog(sal_Int32 nExpectedCount);
 
     void                DocumentSent( css::uno::Reference< 
css::mail::XMailMessage> const & xMessage,
                                         bool bResult,
diff --git a/sw/uiconfig/swriter/ui/mmsendmails.ui 
b/sw/uiconfig/swriter/ui/mmsendmails.ui
index d53421211188..b4c055f1a71f 100644
--- a/sw/uiconfig/swriter/ui/mmsendmails.ui
+++ b/sw/uiconfig/swriter/ui/mmsendmails.ui
@@ -23,7 +23,7 @@
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="stop">
-                <property name="label" translatable="yes" 
context="mmsendmails|stop">_Stop</property>
+                <property name="label" translatable="yes" 
context="mmsendmails|stop">_Pause</property>
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -38,7 +38,7 @@
             </child>
             <child>
               <object class="GtkButton" id="close">
-                <property name="label">gtk-close</property>
+                <property name="label">gtk-cancel</property>
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to