diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx index fd2ccfeffe19..8b9081675df0 100644 --- a/include/svtools/fileview.hxx +++ b/include/svtools/fileview.hxx @@ -25,8 +25,9 @@ #include #include #include -#include #include +#include +#include #include // class SvtFileView ----------------------------------------------------- @@ -216,24 +217,19 @@ namespace svtools { enum QueryDeleteResult_Impl { - QUERYDELETE_YES = 0, - QUERYDELETE_NO, - QUERYDELETE_ALL, - QUERYDELETE_CANCEL + QUERYDELETE_CANCEL = RET_CANCEL, + QUERYDELETE_YES = RET_YES, + QUERYDELETE_NO = RET_NO, + QUERYDELETE_ALL = -1 }; -class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public ModalDialog +class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public MessageDialog { - FixedText _aEntryLabel; - FixedText _aEntry; - FixedText _aQueryMsg; + PushButton* m_pYesButton; + PushButton* m_pAllButton; + PushButton* m_pNoButton; - PushButton _aYesButton; - PushButton _aAllButton; - PushButton _aNoButton; - CancelButton _aCancelButton; - - QueryDeleteResult_Impl _eResult; + QueryDeleteResult_Impl m_eResult; private: @@ -244,8 +240,7 @@ public: QueryDeleteDlg_Impl( Window* pParent, const OUString& rName ); - void EnableAllButton() { _aAllButton.Enable( sal_True ); } - QueryDeleteResult_Impl GetResult() const { return _eResult; } + void EnableAllButton() { m_pAllButton->Enable(true); } }; } diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 301d2f7b955f..e11c5aea9a8f 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -27,8 +27,6 @@ //............................................................................. // various unsorted stuff -#define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) - #define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) #define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) diff --git a/svtools/UIConfig_svt.mk b/svtools/UIConfig_svt.mk index 153054fa1000..5a6b0ca2a5f2 100644 --- a/svtools/UIConfig_svt.mk +++ b/svtools/UIConfig_svt.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svt,\ svtools/uiconfig/ui/graphicexport \ svtools/uiconfig/ui/placeedit \ svtools/uiconfig/ui/printersetupdialog \ + svtools/uiconfig/ui/querydeletedialog \ svtools/uiconfig/ui/restartdialog \ svtools/uiconfig/ui/GraphicExportOptionsDialog \ )) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 8757ca0b9178..32ee18ba1870 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include @@ -536,7 +536,7 @@ protected: protected: // IEnumerationResultHandler overridables - virtual void enumerationDone( ::svt::EnumerationResult _eResult ); + virtual void enumerationDone( ::svt::EnumerationResult eResult ); void implEnumerationSuccess(); // ITimeoutHandler @@ -900,7 +900,7 @@ void ViewTabListBox_Impl::ClearAll() // ----------------------------------------------------------------------- void ViewTabListBox_Impl::DeleteEntries() { - svtools::QueryDeleteResult_Impl eResult = svtools::QUERYDELETE_YES; + short eResult = svtools::QUERYDELETE_YES; SvTreeListEntry* pEntry = FirstSelected(); OUString aURL; @@ -946,10 +946,7 @@ void ViewTabListBox_Impl::DeleteEntries() if ( GetSelectionCount() > 1 ) aDlg.EnableAllButton(); - if ( aDlg.Execute() == RET_OK ) - eResult = aDlg.GetResult(); - else - eResult = svtools::QUERYDELETE_CANCEL; + eResult = aDlg.Execute(); sDialogPosition = aDlg.GetWindowState( ); } @@ -2060,7 +2057,7 @@ void SvtFileView_Impl::onTimeout( CallbackTimer* ) } //----------------------------------------------------------------------- -void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult _eResult ) +void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult eResult ) { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( maMutex ); @@ -2074,12 +2071,12 @@ void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult _eResult ) // this is to prevent race conditions return; - m_eAsyncActionResult = _eResult; + m_eAsyncActionResult = eResult; m_bRunningAsyncAction = false; m_aAsyncActionFinished.set(); - if ( svt::SUCCESS == _eResult ) + if ( svt::SUCCESS == eResult ) implEnumerationSuccess(); if ( m_aCurrentAsyncActionHandler.IsSet() ) @@ -2541,53 +2538,34 @@ namespace svtools { // QueryDeleteDlg_Impl // ----------------------------------------------------------------------- -QueryDeleteDlg_Impl::QueryDeleteDlg_Impl -( - Window* pParent, - const OUString& rName // entry name -) : - - ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ), - - _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ), - _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ), - _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ), - _aYesButton ( this, SvtResId( BTN_YES ) ), - _aAllButton ( this, SvtResId( BTN_ALL ) ), - _aNoButton ( this, SvtResId( BTN_NO ) ), - _aCancelButton( this, SvtResId( BTN_CANCEL ) ), - - _eResult( QUERYDELETE_YES ) - +QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(Window* pParent, const OUString& rName) + : MessageDialog(pParent, "QueryDeleteDialog", "svt/ui/querydeletedialog.ui") + , m_eResult( QUERYDELETE_YES ) { - FreeResource(); + get(m_pNoButton, "no"); + get(m_pAllButton, "all"); + get(m_pYesButton, "yes"); // Handler Link aLink( STATIC_LINK( this, QueryDeleteDlg_Impl, ClickLink ) ); - _aYesButton.SetClickHdl( aLink ); - _aAllButton.SetClickHdl( aLink ); - _aNoButton.SetClickHdl( aLink ); + m_pYesButton->SetClickHdl( aLink ); + m_pAllButton->SetClickHdl( aLink ); + m_pNoButton->SetClickHdl( aLink ); // display specified texts - - WinBits nTmpStyle = _aEntry.GetStyle(); - nTmpStyle |= WB_PATHELLIPSIS; - _aEntry.SetStyle( nTmpStyle ); - _aEntry.SetText( rName ); + set_secondary_text(get_secondary_text().replaceFirst("%s", rName)); } // ----------------------------------------------------------------------- IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn ) { - if ( pBtn == &pThis->_aYesButton ) - pThis->_eResult = QUERYDELETE_YES; - else if ( pBtn == &pThis->_aNoButton ) - pThis->_eResult = QUERYDELETE_NO; - else if ( pBtn == &pThis->_aAllButton ) - pThis->_eResult = QUERYDELETE_ALL; - else if ( pBtn == &pThis->_aCancelButton ) - pThis->_eResult = QUERYDELETE_CANCEL; + if (pBtn == pThis->m_pYesButton) + pThis->m_eResult = QUERYDELETE_YES; + else if ( pBtn == pThis->m_pNoButton ) + pThis->m_eResult = QUERYDELETE_NO; + else if (pBtn == pThis->m_pAllButton) + pThis->m_eResult = QUERYDELETE_ALL; pThis->EndDialog( RET_OK ); diff --git a/svtools/source/contnr/fileview.hrc b/svtools/source/contnr/fileview.hrc index 299009517a30..94fed39d9d0c 100644 --- a/svtools/source/contnr/fileview.hrc +++ b/svtools/source/contnr/fileview.hrc @@ -20,14 +20,4 @@ #define MID_FILEVIEW_DELETE 1 #define MID_FILEVIEW_RENAME 2 -// DLG_SFX_QUERYDELETE ******************************************************** - -#define TXT_ENTRY 1 -#define TXT_ENTRYNAME 2 -#define TXT_QUERYMSG 3 -#define BTN_YES 4 -#define BTN_NO 5 -#define BTN_ALL 6 -#define BTN_CANCEL 7 - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index 79c122e3245b..10a5c05a79cb 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -98,74 +98,4 @@ Menu RID_FILEVIEW_CONTEXTMENU }; }; -ModalDialog DLG_SVT_QUERYDELETE -{ - HelpID = "svtools:ModalDialog:DLG_SVT_QUERYDELETE"; - SVLook = TRUE ; - OutputSize = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 221 , 67 ) ; - Text [ en-US ] = "Confirm Delete" ; - - FixedText TXT_ENTRY - { - NoLabel = TRUE; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Entry:" ; - }; - - FixedText TXT_ENTRYNAME - { - Pos = MAP_APPFONT ( 52 , 6 ) ; - Size = MAP_APPFONT ( 163 , 10 ) ; - NoLabel = TRUE ; - }; - - FixedText TXT_QUERYMSG - { - NoLabel = TRUE; - WordBreak = TRUE; - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 209 , 22 ) ; - Text [ en-US ] = "Are you sure you want to delete the selected data?" ; - }; - - PushButton BTN_YES - { - HelpID = "svtools:PushButton:DLG_SVT_QUERYDELETE:BTN_YES"; - Pos = MAP_APPFONT ( 6 , 47 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Text [ en-US ] = "~Delete" ; - }; - - PushButton BTN_ALL - { - HelpID = "svtools:PushButton:DLG_SVT_QUERYDELETE:BTN_ALL"; - Pos = MAP_APPFONT ( 59 , 47 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Disable = TRUE ; - Text [ en-US ] = "Delete ~All" ; - }; - - PushButton BTN_NO - { - HelpID = "svtools:PushButton:DLG_SVT_QUERYDELETE:BTN_NO"; - Pos = MAP_APPFONT ( 112 , 47 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Do ~Not Delete" ; - }; - - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 165 , 47 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/uiconfig/ui/querydeletedialog.ui b/svtools/uiconfig/ui/querydeletedialog.ui new file mode 100644 index 000000000000..823772593f83 --- /dev/null +++ b/svtools/uiconfig/ui/querydeletedialog.ui @@ -0,0 +1,99 @@ + + + + + False + 12 + Confirm Delete + False + dialog + True + question + Are you sure you want to delete the selected data? + Entry: %s + + + False + vertical + 24 + + + False + center + + + _Delete + True + True + True + True + True + True + + + False + True + 0 + + + + + Delete _All + True + False + True + True + True + + + False + True + 1 + + + + + Do _Not Delete + True + True + True + True + + + False + True + 2 + + + + + gtk-cancel + True + True + True + True + + + False + True + 3 + + + + + False + True + end + 0 + + + + + + yes + all + no + cancel + + +