Index: trac/ticket/query.py
===================================================================
--- trac/ticket/query.py	(revision 5255)
+++ trac/ticket/query.py	(working copy)
@@ -38,6 +38,7 @@
                             INavigationContributor, Chrome
 from trac.wiki.api import IWikiSyntaxProvider, parse_args
 from trac.wiki.macros import WikiMacroBase # TODO: should be moved in .api
+from trac.config import Option
 
 
 class QuerySyntaxError(Exception):
@@ -518,6 +519,14 @@
 
     implements(IRequestHandler, INavigationContributor, IWikiSyntaxProvider,
                IContentConverter)
+               
+    default_query = Option('query', 'default_query', 
+                           default='status=new|assigned|reopened&owner=$USER',
+                           doc='The default query for authenticated users.')
+    
+    default_anonymous_query = Option('query', 'default_anonymous_query', 
+                           default='status=new|assigned|reopened&cc~=$USER',
+                           doc='The default query for anonymous users.')
 
     # IContentConverter methods
     def get_supported_conversions(self):
@@ -559,17 +568,26 @@
 
         constraints = self._get_constraints(req)
         if not constraints and not 'order' in req.args:
-            # avoid displaying all tickets when the query module is invoked
-            # with no parameters. Instead show only open tickets, possibly
-            # associated with the user
-            constraints = {'status': ('new', 'assigned', 'reopened')}
+            # If no constraints are given in the URL, use the default ones.
             if req.authname and req.authname != 'anonymous':
-                constraints['owner'] = (req.authname,)
+                qstring = self.default_query
+                user = req.authname
             else:
                 email = req.session.get('email')
                 name = req.session.get('name')
-                if email or name:
-                    constraints['cc'] = ('~%s' % (email or name),)
+                qstring = self.default_anonymous_query
+                user = email or name or None
+                
+            if user:
+                qstring = qstring.replace('$USER', user)
+            self.log.debug('QueryModule: Using default query: %s', qstring)
+            constraints = Query.from_string(self.env, qstring).constraints
+            # Ensure no field constraints that depend on $USER are used
+            # if we have no username.
+            for field, vals in constraints.items():
+                for val in vals:
+                    if val.endswith('$USER'):
+                        del constraints[field]
 
         cols = req.args.get('col')
         if isinstance(cols,basestring):

