[Libreoffice-commits] core.git: include/svtools svtools/source svtools/uiconfig svtools/UIConfig_svt.mk

Caolán McNamara caolanm at redhat.com
Wed Nov 27 08:52:40 PST 2013


 include/svtools/fileview.hxx             |   29 +++------
 include/svtools/svtools.hrc              |    2 
 svtools/UIConfig_svt.mk                  |    1 
 svtools/source/contnr/fileview.cxx       |   68 +++++++--------------
 svtools/source/contnr/fileview.hrc       |   10 ---
 svtools/source/contnr/fileview.src       |   70 ---------------------
 svtools/uiconfig/ui/querydeletedialog.ui |   99 +++++++++++++++++++++++++++++++
 7 files changed, 135 insertions(+), 144 deletions(-)

New commits:
commit 02d4eb7438a83982b2602ea1d83d5accb1fe11f6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 27 16:42:53 2013 +0000

    convert query delete dialog to .ui
    
    Change-Id: I0ab09c2c54bba4a287ef0f7cc812596958373e15

diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index fd2ccfe..8b90816 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -25,8 +25,9 @@
 #include <vcl/ctrl.hxx>
 #include <vcl/image.hxx>
 #include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
 #include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/layout.hxx>
 #include <rtl/ustring.hxx>
 
 // 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              _aYesButton;
-    PushButton              _aAllButton;
-    PushButton              _aNoButton;
-    CancelButton            _aCancelButton;
+    PushButton*             m_pYesButton;
+    PushButton*             m_pAllButton;
+    PushButton*             m_pNoButton;
 
-    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 301d2f7..e11c5ae 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 153054f..5a6b0ca 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 8757ca0..32ee18b 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -59,7 +59,7 @@
 #include <unotools/localfilehelper.hxx>
 #include <ucbhelper/content.hxx>
 #include <ucbhelper/commandenvironment.hxx>
-#include <vcl/msgbox.hxx>
+#include <vcl/layout.hxx>
 #include <rtl/math.hxx>
 #include <tools/config.hxx>
 #include <osl/mutex.hxx>
@@ -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 2990095..94fed39 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 79c122e..10a5c05 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 0000000..8237725
--- /dev/null
+++ b/svtools/uiconfig/ui/querydeletedialog.ui
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkMessageDialog" id="QueryDeleteDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="title" translatable="yes">Confirm Delete</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="message_type">question</property>
+    <property name="text" translatable="yes">Are you sure you want to delete the selected data?</property>
+    <property name="secondary_text" translatable="yes">Entry: %s</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="messagedialog-vbox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">24</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="messagedialog-action_area">
+            <property name="can_focus">False</property>
+            <property name="layout_style">center</property>
+            <child>
+              <object class="GtkButton" id="yes">
+                <property name="label" translatable="yes">_Delete</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="all">
+                <property name="label" translatable="yes">Delete _All</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="no">
+                <property name="label" translatable="yes">Do _Not Delete</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="2">yes</action-widget>
+      <action-widget response="-1">all</action-widget>
+      <action-widget response="3">no</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list