Index: trunk/src/tools/moc/moc.cpp
===================================================================
--- trunk/src/tools/moc/moc.cpp	(revision 769)
+++ trunk/src/tools/moc/moc.cpp	(revision 846)
@@ -1,5 +1,5 @@
 /****************************************************************************
 **
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
@@ -231,9 +231,11 @@
     }
     while (test(CONST) || test(VOLATILE) || test(SIGNED) || test(UNSIGNED)
-           || test(STAR) || test(AND)) {
+           || test(STAR) || test(AND) || test(ANDAND)) {
         type.name += ' ';
         type.name += lexem();
         if (lookup(0) == AND)
             type.referenceType = Type::Reference;
+        else if (lookup(0) == ANDAND)
+            type.referenceType = Type::RValueReference;
         else if (lookup(0) == STAR)
             type.referenceType = Type::Pointer;
@@ -726,4 +728,5 @@
 
             checkSuperClasses(&def);
+            checkProperties(&def);
 
             classList += def;
@@ -1207,4 +1210,10 @@
         }
     }
+
+    //when searching commas within the default argument, we should take care of template depth (anglecount)
+    // unfortunatelly, we do not have enough semantic information to know if '<' is the operator< or
+    // the beginning of a template type. so we just use heuristics.
+    int possible = -1;
+
     while (index < symbols.size()) {
         Token t = symbols.at(index++).token;
@@ -1225,6 +1234,14 @@
             && brackCount <= 0
             && parenCount <= 0
-            && (target != RANGLE || angleCount <= 0))
+            && (target != RANGLE || angleCount <= 0)) {
+            if (target != COMMA || angleCount <= 0)
+                return true;
+            possible = index;
+        }
+
+        if (target == COMMA && t == EQ && possible != -1) {
+            index = possible;
             return true;
+        }
 
         if (braceCount < 0 || brackCount < 0 || parenCount < 0
@@ -1234,4 +1251,10 @@
         }
     }
+
+    if(target == COMMA && angleCount != 0 && possible != -1) {
+        index = possible;
+        return true;
+    }
+
     return false;
 }
@@ -1291,4 +1314,61 @@
 }
 
+void Moc::checkProperties(ClassDef *cdef)
+{
+    //
+    // specify get function, for compatibiliy we accept functions
+    // returning pointers, or const char * for QByteArray.
+    //
+    for (int i = 0; i < cdef->propertyList.count(); ++i) {
+        PropertyDef &p = cdef->propertyList[i];
+        if (p.read.isEmpty())
+            continue;
+        for (int j = 0; j < cdef->publicList.count(); ++j) {
+            const FunctionDef &f = cdef->publicList.at(j);
+            if (f.name != p.read)
+                continue;
+            if (!f.isConst) // get  functions must be const
+                continue;
+            if (f.arguments.size()) // and must not take any arguments
+                continue;
+            PropertyDef::Specification spec = PropertyDef::ValueSpec;
+            QByteArray tmp = f.normalizedType;
+            if (p.type == "QByteArray" && tmp == "const char *")
+                tmp = "QByteArray";
+            if (tmp.left(6) == "const ")
+                tmp = tmp.mid(6);
+            if (p.type != tmp && tmp.endsWith('*')) {
+                tmp.chop(1);
+                spec = PropertyDef::PointerSpec;
+            } else if (f.type.name.endsWith('&')) { // raw type, not normalized type
+                spec = PropertyDef::ReferenceSpec;
+            }
+            if (p.type != tmp)
+                continue;
+            p.gspec = spec;
+            break;
+        }
+        if(!p.notify.isEmpty()) {
+            int notifyId = -1;
+            for (int j = 0; j < cdef->signalList.count(); ++j) {
+                const FunctionDef &f = cdef->signalList.at(j);
+                if(f.name != p.notify) {
+                    continue;
+                } else {
+                    notifyId = j /* Signal indexes start from 0 */;
+                    break;
+                }
+            }
+            p.notifyId = notifyId;
+            if (notifyId == -1) {
+                QByteArray msg = "NOTIFY signal '" + p.notify + "' of property '" + p.name
+                        + "' does not exist in class " + cdef->classname + ".";
+                error(msg.constData());
+            }
+        }
+    }
+}
+
+
 
 QT_END_NAMESPACE
