Try...
# substitute 'self' with 'qgis.utils.iface' when run from Python console
# 'self.iface = iface' would usually precede this command in your class
layers = self.iface.legendInterface().layers()
for layer in layers:
layerType = layer.type()
if layerType == QgsMapLayer.VectorLayer:
# do some stuff here
Culled from consolidatethread.py from QConsolidate plugin.
Description of QgsLegendInterface object returned from legendInterface().
Edit: added info on 'self' above.