[Libreoffice-commits] core.git: extensions/source extensions/uiconfig extensions/UIConfig_sabpilot.mk

Caolán McNamara caolanm at redhat.com
Thu May 8 09:28:54 PDT 2014


 extensions/UIConfig_sabpilot.mk                    |    1 
 extensions/source/abpilot/abpfinalpage.cxx         |   70 +++----
 extensions/source/abpilot/abpfinalpage.hxx         |   21 +-
 extensions/source/abpilot/abpresid.hrc             |   13 -
 extensions/source/abpilot/abspilot.src             |   86 --------
 extensions/uiconfig/sabpilot/ui/datasourcepage.ui  |  204 +++++++++++++++++++++
 extensions/uiconfig/sabpilot/ui/fieldassignpage.ui |    4 
 extensions/uiconfig/sabpilot/ui/selecttypepage.ui  |    2 
 8 files changed, 254 insertions(+), 147 deletions(-)

New commits:
commit 9319ea5b5321e33b0f7bfa85e2064bc794d3b465
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 8 17:23:21 2014 +0100

    convert FinalPage to .ui
    
    Change-Id: I3e7728da37d36bdf7f9a24bbc70bae856a85d9c4

diff --git a/extensions/UIConfig_sabpilot.mk b/extensions/UIConfig_sabpilot.mk
index b630a75..a52e50e 100644
--- a/extensions/UIConfig_sabpilot.mk
+++ b/extensions/UIConfig_sabpilot.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_UIConfig_UIConfig,modules/sabpilot))
 
 $(eval $(call gb_UIConfig_add_uifiles,modules/sabpilot,\
+	extensions/uiconfig/sabpilot/ui/datasourcepage \
 	extensions/uiconfig/sabpilot/ui/fieldassignpage \
 	extensions/uiconfig/sabpilot/ui/selecttablepage \
 	extensions/uiconfig/sabpilot/ui/selecttypepage \
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx
index 8fd56ab..337b732 100644
--- a/extensions/source/abpilot/abpfinalpage.cxx
+++ b/extensions/source/abpilot/abpfinalpage.cxx
@@ -43,32 +43,33 @@ namespace abp
     }
 
     //= FinalPage
-
-
     FinalPage::FinalPage( OAddessBookSourcePilot* _pParent )
-        :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_FINAL))
-        ,m_aExplanation         ( this, ModuleRes( FT_FINISH_EXPL ) )
-        ,m_aLocationLabel       ( this, ModuleRes( FT_LOCATION ) )
-        ,m_aLocation            ( this, ModuleRes( CBB_LOCATION ) )
-        ,m_aBrowse              ( this, ModuleRes( PB_BROWSE ) )
-        ,m_aRegisterName        ( this, ModuleRes( CB_REGISTER_DS ) )
-        ,m_aNameLabel           ( this, ModuleRes( FT_NAME_EXPL ) )
-        ,m_aName                ( this, ModuleRes( ET_DATASOURCENAME ) )
-        ,m_aDuplicateNameError  ( this, ModuleRes( FT_DUPLICATENAME ) )
-        ,m_aLocationController( _pParent->getORB(), m_aLocation, m_aBrowse )
+        : AddressBookSourcePage(_pParent, "DataSourcePage",
+            "modules/sabpilot/ui/datasourcepage.ui")
     {
-        FreeResource();
-
-        m_aName.SetModifyHdl( LINK(this, FinalPage, OnNameModified) );
-        m_aLocation.SetModifyHdl( LINK(this, FinalPage, OnNameModified) );
-        m_aRegisterName.SetClickHdl( LINK( this, FinalPage, OnRegister ) );
-        m_aRegisterName.Check(true);
+        get(m_pLocation, "location");
+        get(m_pBrowse, "browse");
+        get(m_pRegisterName, "available");
+        get(m_pNameLabel, "nameft");
+        get(m_pName, "name");
+        get(m_pDuplicateNameError, "warning");
+        m_pLocationController = new ::svx::DatabaseLocationInputController(_pParent->getORB(),
+            *m_pLocation, *m_pBrowse);
+
+        m_pName->SetModifyHdl( LINK(this, FinalPage, OnNameModified) );
+        m_pLocation->SetModifyHdl( LINK(this, FinalPage, OnNameModified) );
+        m_pRegisterName->SetClickHdl( LINK( this, FinalPage, OnRegister ) );
+        m_pRegisterName->Check(true);
     }
 
+    FinalPage::~FinalPage()
+    {
+        delete m_pLocationController;
+    }
 
     bool FinalPage::isValidName() const
     {
-        OUString sCurrentName(m_aName.GetText());
+        OUString sCurrentName(m_pName->GetText());
 
         if (sCurrentName.isEmpty())
             // the name must not be empty
@@ -81,7 +82,6 @@ namespace abp
         return true;
     }
 
-
     void FinalPage::setFields()
     {
         AddressSettings& rSettings = getSettings();
@@ -104,16 +104,16 @@ namespace abp
         }
         OSL_ENSURE( aURL.GetProtocol() != INET_PROT_NOT_VALID ,"No valid file name!");
         rSettings.sDataSourceName = aURL.GetMainURL( INetURLObject::NO_DECODE );
-        m_aLocationController.setURL( rSettings.sDataSourceName );
+        m_pLocationController->setURL( rSettings.sDataSourceName );
         OUString sName = aURL.getName( );
         sal_Int32 nPos = sName.indexOf(aURL.GetExtension());
         if ( nPos != -1 )
         {
             sName = sName.replaceAt(nPos-1, 4, "");
         }
-        m_aName.SetText(sName);
+        m_pName->SetText(sName);
 
-        OnRegister(&m_aRegisterName);
+        OnRegister(m_pRegisterName);
     }
 
 
@@ -131,15 +131,15 @@ namespace abp
             return false;
 
         if  (   ( ::svt::WizardTypes::eTravelBackward != _eReason )
-            &&  ( !m_aLocationController.prepareCommit() )
+            &&  ( !m_pLocationController->prepareCommit() )
             )
             return false;
 
         AddressSettings& rSettings = getSettings();
-        rSettings.sDataSourceName = m_aLocationController.getURL();
-        rSettings.bRegisterDataSource = m_aRegisterName.IsChecked();
+        rSettings.sDataSourceName = m_pLocationController->getURL();
+        rSettings.bRegisterDataSource = m_pRegisterName->IsChecked();
         if ( rSettings.bRegisterDataSource )
-            rSettings.sRegisteredDataSourceName = m_aName.GetText();
+            rSettings.sRegisteredDataSourceName = m_pName->GetText();
 
         return true;
     }
@@ -154,7 +154,7 @@ namespace abp
         aContext.getDataSourceNames( m_aInvalidDataSourceNames );
 
         // give the name edit the focus
-        m_aLocation.GrabFocus();
+        m_pLocation->GrabFocus();
 
         // default the finish button
         getDialog()->defaultButton( WZB_FINISH );
@@ -181,14 +181,14 @@ namespace abp
     void FinalPage::implCheckName()
     {
         bool bValidName = isValidName();
-        bool bEmptyName = m_aName.GetText().isEmpty();
-        bool bEmptyLocation = m_aLocation.GetText().isEmpty();
+        bool bEmptyName = m_pName->GetText().isEmpty();
+        bool bEmptyLocation = m_pLocation->GetText().isEmpty();
 
         // enable or disable the finish button
-        getDialog()->enableButtons( WZB_FINISH, !bEmptyLocation && (!m_aRegisterName.IsChecked() || bValidName) );
+        getDialog()->enableButtons( WZB_FINISH, !bEmptyLocation && (!m_pRegisterName->IsChecked() || bValidName) );
 
         // show the error message for an invalid name
-        m_aDuplicateNameError.Show( !bValidName && !bEmptyName );
+        m_pDuplicateNameError->Show( !bValidName && !bEmptyName );
     }
 
 
@@ -201,9 +201,9 @@ namespace abp
 
     IMPL_LINK_NOARG(FinalPage, OnRegister)
     {
-        bool bEnable = m_aRegisterName.IsChecked();
-        m_aNameLabel.Enable(bEnable);
-        m_aName.Enable(bEnable);
+        bool bEnable = m_pRegisterName->IsChecked();
+        m_pNameLabel->Enable(bEnable);
+        m_pName->Enable(bEnable);
         implCheckName();
         return 0L;
     }
diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx
index d972c46..6c8c329 100644
--- a/extensions/source/abpilot/abpfinalpage.hxx
+++ b/extensions/source/abpilot/abpfinalpage.hxx
@@ -38,22 +38,21 @@ namespace abp
     class FinalPage : public AddressBookSourcePage
     {
     protected:
-        FixedText       m_aExplanation;
-        FixedText       m_aLocationLabel;
-        ::svt::OFileURLControl  m_aLocation;
-        PushButton      m_aBrowse;
-        CheckBox        m_aRegisterName;
-        FixedText       m_aNameLabel;
-        Edit            m_aName;
-        FixedText       m_aDuplicateNameError;
-
-        ::svx::DatabaseLocationInputController
-                        m_aLocationController;
+        ::svt::OFileURLControl*  m_pLocation;
+        PushButton*     m_pBrowse;
+        CheckBox*       m_pRegisterName;
+        FixedText*      m_pNameLabel;
+        Edit*           m_pName;
+        FixedText*      m_pDuplicateNameError;
+
+        ::svx::DatabaseLocationInputController*
+                        m_pLocationController;
 
         StringBag       m_aInvalidDataSourceNames;
 
     public:
         FinalPage( OAddessBookSourcePilot* _pParent );
+        ~FinalPage();
 
     protected:
         // OWizardPage overridables
diff --git a/extensions/source/abpilot/abpresid.hrc b/extensions/source/abpilot/abpresid.hrc
index 2e4b02c..ae19767 100644
--- a/extensions/source/abpilot/abpresid.hrc
+++ b/extensions/source/abpilot/abpresid.hrc
@@ -45,10 +45,9 @@
 // tab pages
 
 #define RID_PAGE_ADMININVOKATION        ( RID_PAGE_START +  1 )
-#define RID_PAGE_FINAL                  ( RID_PAGE_START +  4 )
 // please adjust RID_PAGE_END (below) when adding new tab pages
 
-#define RID_PAGE_END                    RID_PAGE_FINAL
+#define RID_PAGE_END                    RID_PAGE_ADMININVOKATION
 
 
 // strings
@@ -130,18 +129,8 @@
 #define FT_ADMINEXPLANATION      3
 #define FT_NAME_EXPL             4
 #define FT_ERROR                 5
-#define FT_FINISH_EXPL           9
-#define FT_DUPLICATENAME        10
-#define FT_LOCATION             11
-
-#define ET_DATASOURCENAME       1
 
 #define PB_INVOKE_ADMIN_DIALOG  1
-#define PB_BROWSE               3
-
-#define CB_REGISTER_DS          1
-
-#define CBB_LOCATION            1
 
 #define STR_SELECT_ABTYPE           1
 #define STR_INVOKE_ADMIN_DIALOG     2
diff --git a/extensions/source/abpilot/abspilot.src b/extensions/source/abpilot/abspilot.src
index f3f65bc..04e700c 100644
--- a/extensions/source/abpilot/abspilot.src
+++ b/extensions/source/abpilot/abspilot.src
@@ -93,92 +93,6 @@ TabPage RID_PAGE_ADMININVOKATION
     };
 };
 
-TabPage RID_PAGE_FINAL
-{
-    HelpID = "extensions:TabPage:RID_PAGE_FINAL";
-    SVLook  = TRUE ;
-    Size    = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ;
-
-    FixedText FT_FINISH_EXPL
-    {
-        Pos     = MAP_APPFONT ( BORDER_X, 9 ) ;
-        Size    = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 40 ) ;
-        WordBreak = TRUE;
-
-        Text [ en-US ] = "That was all the information necessary to integrate your address data into %PRODUCTNAME.\n\nNow, just enter the name under which you want to register the data source in %PRODUCTNAME.";
-    };
-
-    FixedText FT_LOCATION
-    {
-        Pos     = MAP_APPFONT ( BORDER_X, 53 ) ;
-        Size    = MAP_APPFONT ( 50, 8 ) ;
-        Group = TRUE;
-
-        Text [ en-US ] = "Location";
-    };
-
-    ComboBox CBB_LOCATION
-    {
-        HelpID = "extensions:ComboBox:RID_PAGE_FINAL:CBB_LOCATION";
-        Pos     = MAP_APPFONT ( BORDER_X , 64 ) ;
-        Size    = MAP_APPFONT ( WINDOW_SIZE_X - 53 - BORDER_X - BORDER_X, 12) ;
-        SVLook = TRUE;
-        Border = TRUE;
-        DropDown = TRUE ;
-        AutoHScroll = TRUE ;
-    };
-
-    PushButton PB_BROWSE
-    {
-        HelpID = "extensions:PushButton:RID_PAGE_FINAL:PB_BROWSE";
-        Pos     = MAP_APPFONT ( WINDOW_SIZE_X - 50 - BORDER_X  , 63 ) ;
-        Size    = MAP_APPFONT ( 50, 14) ;
-        SVLook = TRUE;
-        Group = FALSE;
-
-        Text [ en-US ] = "Browse...";
-    };
-
-    CheckBox CB_REGISTER_DS
-    {
-        HelpID = "extensions:CheckBox:RID_PAGE_FINAL:CB_REGISTER_DS";
-        Pos     = MAP_APPFONT ( BORDER_X, 82 ) ;
-        Size    = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X, 8) ;
-        SVLook = TRUE;
-        Group = TRUE;
-
-        Text [ en-US ] = "Make this address book available to all modules in %PRODUCTNAME.";
-    };
-    FixedText FT_NAME_EXPL
-    {
-        Pos     = MAP_APPFONT ( BORDER_X + 10, 93 ) ;
-        Size    = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X - 10, 8 ) ;
-
-        Text [ en-US ] = "Address book name";
-    };
-
-    Edit ET_DATASOURCENAME
-    {
-        HelpID = "extensions:Edit:RID_PAGE_FINAL:ET_DATASOURCENAME";
-        Pos     = MAP_APPFONT ( BORDER_X + 10, 104 ) ;
-        Size    = MAP_APPFONT ( WINDOW_SIZE_X - 56 - BORDER_X - BORDER_X - 10, 12) ;
-        SVLook = TRUE;
-        Border = TRUE;
-    };
-
-    FixedText FT_DUPLICATENAME
-    {
-        Pos     = MAP_APPFONT ( BORDER_X + 10, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 24 ) ;
-        Size    = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 24) ;
-        WordBreak = TRUE;
-        Hide = TRUE;
-        Group = FALSE;
-
-        Text [ en-US ] = "Another data source already has this name. As data sources have to have globally unique names, you need to choose another one.";
-    };
-};
-
-
 ErrorBox RID_ERR_NEEDTYPESELECTION
 {
     Buttons = WB_OK;
diff --git a/extensions/uiconfig/sabpilot/ui/datasourcepage.ui b/extensions/uiconfig/sabpilot/ui/datasourcepage.ui
new file mode 100644
index 0000000..dc8c04d
--- /dev/null
+++ b/extensions/uiconfig/sabpilot/ui/datasourcepage.ui
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+  <requires lib="gtk+" version="3.0"/>
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkGrid" id="DataSourcePage">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="row_spacing">12</property>
+    <child>
+      <object class="GtkLabel" id="label2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="label" translatable="yes">That was all the information necessary to integrate your address data into %PRODUCTNAME.
+
+Now, just enter the name under which you want to register the data source in %PRODUCTNAME.</property>
+        <property name="wrap">True</property>
+        <property name="max_width_chars">80</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid" id="grid3">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="row_spacing">6</property>
+        <child>
+          <object class="GtkGrid" id="grid4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Location</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">location</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="browse">
+                <property name="label" translatable="yes">Browse...</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="left_attach">2</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="svtlo-OFileURLControl" id="location">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="has_entry">True</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry" id="comboboxtext-entry">
+                    <property name="can_focus">False</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="available">
+            <property name="label" translatable="yes">Make this address book available to all modules in %PRODUCTNAME.</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="xalign">0</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkAlignment" id="alignment1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkGrid" id="grid5">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkGrid" id="grid6">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="column_spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="nameft">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Address book name</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">location</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkEntry" id="name">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">1</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="warning">
+                    <property name="can_focus">False</property>
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
+                    <property name="label" translatable="yes">Another data source already has this name. As data sources have to have globally unique names, you need to choose another one.</property>
+                    <property name="wrap">True</property>
+                    <property name="max_width_chars">80</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui b/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui
index f5cc1d3..53868d4 100644
--- a/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui
+++ b/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui
@@ -19,7 +19,7 @@ For instance, you could have stored the e-mail addresses in a field named "email
 
 Click the button below to open another dialog where you can enter the settings for your data source.</property>
         <property name="wrap">True</property>
-        <property name="max_width_chars">90</property>
+        <property name="max_width_chars">80</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
@@ -52,7 +52,7 @@ Click the button below to open another dialog where you can enter the settings f
         <property name="xalign">0</property>
         <property name="yalign">0</property>
         <property name="wrap">True</property>
-        <property name="max_width_chars">90</property>
+        <property name="max_width_chars">80</property>
       </object>
       <packing>
         <property name="left_attach">0</property>
diff --git a/extensions/uiconfig/sabpilot/ui/selecttypepage.ui b/extensions/uiconfig/sabpilot/ui/selecttypepage.ui
index f61c3a1..5551f42 100644
--- a/extensions/uiconfig/sabpilot/ui/selecttypepage.ui
+++ b/extensions/uiconfig/sabpilot/ui/selecttypepage.ui
@@ -246,7 +246,7 @@
 
 This wizard helps you create the data source.</property>
         <property name="wrap">True</property>
-        <property name="max_width_chars">90</property>
+        <property name="max_width_chars">80</property>
       </object>
       <packing>
         <property name="left_attach">0</property>


More information about the Libreoffice-commits mailing list