User: rt      
Date: 05/10/24 01:31:50

Modified:
 /dba/dbaccess/source/ui/dlg/
  generalpage.cxx

Log:
 INTEGRATION: CWS dba201d (1.44.8); FILE MERGED
 2005/09/27 11:57:37 fs 1.44.8.1: #i55125# don't sort the 'types' list box 
alphabetically, but have a fixed order

File Changes:

Directory: /dba/dbaccess/source/ui/dlg/
=======================================

File [changed]: generalpage.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/generalpage.cxx?r1=1.45&r2=1.46
Delta lines:  +31 -2
--------------------
--- generalpage.cxx     5 Oct 2005 14:46:11 -0000       1.45
+++ generalpage.cxx     24 Oct 2005 08:31:44 -0000      1.46
@@ -162,6 +162,27 @@
     }
 
     //-------------------------------------------------------------------------
+    namespace
+    {
+        struct DisplayedType
+        {
+            DATASOURCE_TYPE eType;
+            String          sDisplayName;
+
+            DisplayedType( DATASOURCE_TYPE _eType, const String& _rDisplayName 
) : eType( _eType ), sDisplayName( _rDisplayName ) { }
+        };
+        typedef ::std::vector< DisplayedType > DisplayedTypes;
+
+        struct DisplayedTypeLess : ::std::binary_function< DisplayedType, 
DisplayedType, bool >
+        {
+            bool operator() ( const DisplayedType& _rLHS, const DisplayedType& 
_rRHS )
+            {
+                return _rLHS.eType < _rRHS.eType;
+            }
+        };
+    }
+
+    //-------------------------------------------------------------------------
        void OGeneralPage::initializeTypeList()
        {
         m_pDatasourceType->Clear();
@@ -186,6 +207,8 @@
 
                if ( m_pCollection )
                {
+            DisplayedTypes aDisplayedTypes;
+
                        for (   ODsnTypeCollection::TypeIterator aTypeLoop =  
m_pCollection->begin();
                                        aTypeLoop != m_pCollection->end();
                                        ++aTypeLoop
@@ -205,10 +228,16 @@
                                if ( m_pDatasourceType->GetEntryPos( 
sDisplayName ) == LISTBOX_ENTRY_NOTFOUND )
                                {
                                        sDisplayName = VerifyDisplayName(eType, 
sDisplayName);
-                                       if (sDisplayName.Len() > 0)
-                                               
insertDatasourceTypeEntryData(eType, sDisplayName);
+                                       if ( sDisplayName.Len() > 0 )
+                        aDisplayedTypes.push_back( DisplayedTypes::value_type( 
eType, sDisplayName ) );
                                }
                        }
+            ::std::sort( aDisplayedTypes.begin(), aDisplayedTypes.end(), 
DisplayedTypeLess() );
+            for (   DisplayedTypes::const_iterator loop = 
aDisplayedTypes.begin();
+                    loop != aDisplayedTypes.end();
+                    ++loop
+                )
+                insertDatasourceTypeEntryData( loop->eType, loop->sDisplayName 
);
                }
        }
 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to