Index: kernel/classes/ezcontentobjecttrashnode.php
===================================================================
--- kernel/classes/ezcontentobjecttrashnode.php	(revision 21467)
+++ kernel/classes/ezcontentobjecttrashnode.php	(working copy)
@@ -202,21 +202,23 @@
         $limit            = ( isset( $params['Limit']  ) && is_numeric( $params['Limit']  ) ) ? $params['Limit']              : false;
         $asObject         = ( isset( $params['AsObject']          ) )                         ? $params['AsObject']           : true;
         $objectNameFilter = ( isset( $params['ObjectNameFilter']  ) )                         ? $params['ObjectNameFilter']   : false;
-
+        $sortBy           = ( isset( $params['SortBy']  ) && is_array( $params['SortBy']  ) ) ? $params['SortBy']              : array( array( 'name' ) );
+        
         if ( $asCount )
         {
-            $sqlSorting = '';
+            $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( false );
         }
         else
         {
-            // default sorting by the object name, but it probably should be optional in future
-            $params[ 'SortBy' ] = array( array( 'name' ) );
-            $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $params['SortBy'], 'ezcot' );
-            if ( $sortingInfo['sortingFields'] )
-                $sqlSorting = " ORDER BY $sortingInfo[sortingFields]";
-            else
-                $sqlSorting = '';
+            $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $sortBy, 'ezcot' );
         }
+
+        $attributeFilter         = eZContentObjectTreeNode::createAttributeFilterSQLStrings( $params['AttributeFilter'], $sortingInfo );
+        if ( $attributeFilter === false )
+        {
+            return null;
+        }
+
         $useVersionName     = true;
         $versionNameTables  = eZContentObjectTreeNode::createVersionNameTablesSQLString ( $useVersionName );
         $versionNameTargets = eZContentObjectTreeNode::createVersionNameTargetsSQLString( $useVersionName );
@@ -241,7 +243,8 @@
                         ezcot.*,
                         ezcontentclass.serialized_name_list as class_serialized_name_list,
                         ezcontentclass.identifier as class_identifier
-                        $versionNameTargets \n";
+                        $versionNameTargets
+                        $sortingInfo[attributeTargetSQL] \n";
         }
         $query .= "FROM
                         ezcontentobject_trash ezcot,
@@ -248,6 +251,8 @@
                         ezcontentobject,
                         ezcontentclass
                         $versionNameTables
+                        $sortingInfo[attributeFromSQL]
+                        $attributeFilter[from]
                         $sqlPermissionChecking[from]
                    WHERE
                         ezcontentclass.version=0 AND
@@ -253,6 +258,8 @@
                         ezcontentclass.version=0 AND
                         ezcot.contentobject_id = ezcontentobject.id  AND
                         ezcontentclass.id = ezcontentobject.contentclass_id AND
+                        $sortingInfo[attributeWhereSQL]
+                        $attributeFilter[where]
                         $versionNameJoins
                         $sqlPermissionChecking[where]
                         $objectNameFilterSQL
@@ -257,8 +264,9 @@
                         $sqlPermissionChecking[where]
                         $objectNameFilterSQL
                         $languageFilter
-                        $sqlSorting
                         ";
+        if ( $sortingInfo['sortingFields'] && strlen( $sortingInfo['sortingFields'] ) > 5  )
+            $query .= " ORDER BY $sortingInfo[sortingFields]";
 
         $db = eZDB::instance();
         if ( !$offset && !$limit )
Index: kernel/content/ezcontentfunctioncollection.php
===================================================================
--- kernel/content/ezcontentfunctioncollection.php	(revision 21467)
+++ kernel/content/ezcontentfunctioncollection.php	(working copy)
@@ -455,16 +455,16 @@
         return array( 'result' => $searchResult );
     }
 
-    function fetchTrashObjectCount( $objectNameFilter )
+    function fetchTrashObjectCount( $objectNameFilter, $attributeFilter = false )
     {
         //include_once( 'kernel/classes/ezcontentobjecttrashnode.php' );
+        $params = array();
         if ( $objectNameFilter !== false )
         {
-            $params = array();
             $params['ObjectNameFilter'] = $objectNameFilter;
         }
-        else
-            $params = false;
+            
+        $params[ 'AttributeFilter' ] = $attributeFilter;
 
         $trashCount = eZContentObjectTrashNode::trashListCount( $params );
         return array( 'result' => $trashCount );
@@ -470,7 +470,7 @@
         return array( 'result' => $trashCount );
     }
 
-    function fetchTrashObjectList( $offset, $limit, $objectNameFilter )
+    function fetchTrashObjectList( $offset, $limit, $objectNameFilter, $attributeFilter = false, $sortBy = false, $asObject = true )
     {
         //include_once( 'kernel/classes/ezcontentobjecttrashnode.php' );
         $params = array();
@@ -480,6 +480,9 @@
         }
         $params[ 'Limit' ] = $limit;
         $params[ 'Offset' ] = $offset;
+        $params[ 'AttributeFilter' ] = $attributeFilter;
+        $params[ 'SortBy' ] = $sortBy;
+        $params[ 'AsObject' ] = $asObject;
 
         $trashNodesList = eZContentObjectTrashNode::trashList( $params, false );
         return array( 'result' => $trashNodesList );
Index: kernel/content/function_definition.php
===================================================================
--- kernel/content/function_definition.php	(revision 21467)
+++ kernel/content/function_definition.php	(working copy)
@@ -549,7 +549,11 @@
                                       'parameters' => array( array( 'name' => 'objectname_filter',
                                                                     'type' => 'string',
                                                                     'required' => false,
-                                                                    'default' => null ) ) );
+                                                                    'default' => null ),
+                                                            array( 'name' => 'attribute_filter',
+                                                                    'type' => 'mixed',
+                                                                    'required' => false,
+                                                                    'default' => false ) ) );
 
 $FunctionList['trash_object_list'] = array( 'name' => 'trash_object_list',
                                             'operation_types' => array( 'read' ),
@@ -567,7 +571,19 @@
                                                                    array( 'name' => 'objectname_filter',
                                                                           'type' => 'string',
                                                                           'required' => false,
-                                                                           'default' => null ) ) );
+                                                                          'default' => null ),
+                                                                   array( 'name' => 'attribute_filter',
+                                                                          'type' => 'mixed',
+                                                                          'required' => false,
+                                                                          'default' => false ),
+                                                                   array( 'name' => 'sort_by',
+                                                                          'type' => 'mixed',
+                                                                          'required' => false,
+                                                                          'default' => false ),
+                                                                   array( 'name' => 'as_object',
+                                                                          'type' => 'bool',
+                                                                          'required' => false,
+                                                                          'default' => true ) ) );
 
 $FunctionList['draft_count'] = array( 'name' => 'draft_count',
                                       'operation_types' => array( 'read' ),
