diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp
index 199b783f45d137abf09d79d56ddcb25e43cf6bc0..9ea2a9aff56749af04c68e2572a8ea5e5fc31079 100644
--- a/bin/gdbmacros/gdbmacros.cpp
+++ b/bin/gdbmacros/gdbmacros.cpp
@@ -122,6 +122,7 @@ int qtGhVersion = QT_VERSION;
 #   include <QImage>
 #endif
 
+#include <list>
 #include <string>
 #include <vector>
 
@@ -406,12 +407,13 @@ struct QDumper
     QDumper &operator<<(unsigned int i);
     QDumper &operator<<(const void *p);
     QDumper &operator<<(qulonglong c);
-    void put(char c);
-    void addCommaIfNeeded();
-    void putBase64Encoded(const char *buf, int n);
     QDumper &operator<<(const char *str);
     QDumper &operator<<(const QByteArray &ba);
     QDumper &operator<<(const QString &str);
+    void put(char c);
+    void addCommaIfNeeded();
+    void putBase64Encoded(const char *buf, int n);
+    void putEllipsis();
     void disarm();
 
     void beginHash(); // start of data hash output
@@ -657,6 +659,11 @@ void QDumper::endHash()
     put('}');
 }
 
+void QDumper::putEllipsis()
+{
+    addCommaIfNeeded();
+    *this << "{name=\"<incomplete>\",value=\"\",type=\"" << innertype << "\"}";
+}
 
 //
 // Some helpers to keep the dumper code short
@@ -815,6 +822,27 @@ static void qDumpInnerValue(QDumper &d, const char *type, const void *addr)
 }
 
 
+static void qDumpInnerValueOrPointer(QDumper &d,
+    const char *type, const char *strippedtype, const void *addr)
+{
+    if (strippedtype) {
+        if (deref(addr)) {
+            P(d, "addr", deref(addr));
+            P(d, "type", strippedtype);
+            qDumpInnerValueHelper(d, strippedtype, deref(addr));
+        } else {
+            P(d, "addr", addr);
+            P(d, "type", strippedtype);
+            P(d, "value", "<null>");
+            P(d, "numchild", "0");
+        }
+    } else {
+        P(d, "addr", addr);
+        P(d, "type", type);
+        qDumpInnerValueHelper(d, type, addr);
+    }
+}
+
 //////////////////////////////////////////////////////////////////////////////
 
 static void qDumpQByteArray(QDumper &d)
@@ -1212,9 +1240,8 @@ static void qDumpQList(QDumper &d)
         bool isInternal = innerSize <= int(sizeof(void*))
             && isMovableType(d.innertype);
 
-    P(d, "internal", (int)isInternal);
-
-    P(d, "childtype", d.innertype);
+        P(d, "internal", (int)isInternal);
+        P(d, "childtype", d.innertype);
         if (n > 1000)
             n = 1000;
         d << ",children=[";
@@ -1244,11 +1271,8 @@ static void qDumpQList(QDumper &d)
             }
             d.endHash();
         }
-        if (n < nn) {
-            d.beginHash();
-            P(d, "value", "<incomplete>");
-            d.endHash();
-        }
+        if (n < nn)
+            d.putEllipsis();
         d << "]";
     }
     d.disarm();
@@ -1490,7 +1514,6 @@ static void qDumpQObject(QDumper &d)
         d.beginHash();
             P(d, "name", "methods");
             P(d, "exp", "*(class '"NS"QObject'*)" << d.data);
-            P(d, "type", NS"QObjectMethodList");
             P(d, "value", "<" << mo->methodCount() << " items>");
             P(d, "numchild", mo->methodCount());
         d.endHash();
@@ -1876,11 +1899,7 @@ static void qDumpQSet(QDumper &d)
                 d.endHash();
                 ++i;
                 if (i > 10000) {
-                    d.beginHash();
-                    P(d, "name", "Warning:");
-                    P(d, "value", "<incomplete>");
-                    P(d, "type", "");
-                    d.endHash();
+                    d.putEllipsis();
                     break;
                 }
             }
@@ -1935,13 +1954,8 @@ static void qDumpQStringList(QDumper &d)
             P(d, "valueencoded", "1");
             d.endHash();
         }
-        if (n < list.size()) {
-            d.beginHash();
-            P(d, "name", "Warning:");
-            P(d, "value", "<incomplete>");
-            P(d, "type", "");
-            d.endHash();
-        }
+        if (n < list.size())
+            d.putEllipsis();
         d << "]";
     }
     d.disarm();
@@ -2065,37 +2079,68 @@ static void qDumpQVector(QDumper &d)
     P(d, "valuedisabled", "true");
     P(d, "numchild", n);
     if (d.dumpChildren) {
-        bool innerTypeIsPointer = isPointerType(d.innertype);
         QByteArray strippedInnerType = stripPointerType(d.innertype);
-
+        const char *stripped =
+            isPointerType(d.innertype) ? strippedInnerType.data() : 0;
         if (n > 1000)
             n = 1000;
         d << ",children=[";
         for (int i = 0; i != n; ++i) {
             d.beginHash();
             P(d, "name", "[" << i << "]");
-            const void *p = addOffset(v, i * innersize + typeddatasize);
-            if (innerTypeIsPointer) {
-                if (deref(p)) {
-                    //P(d, "value","@" << p);
-                    qDumpInnerValue(d, strippedInnerType.data(), deref(p));
-                } else {
-                    P(d, "type", d.innertype);
-                    P(d, "value", "<null>");
-                    P(d, "numchild", "0");
-                }
-            } else {
-                qDumpInnerValue(d, d.innertype, p);
-            }
+            qDumpInnerValueOrPointer(d, d.innertype, stripped,
+                addOffset(v, i * innersize + typeddatasize));
             d.endHash();
         }
-        if (n < nn) {
+        if (n < nn)
+            d.putEllipsis();
+        d << "]";
+    }
+    d.disarm();
+}
+
+static void qDumpStdList(QDumper &d)
+{
+    const std::list<int> &list = *reinterpret_cast<const std::list<int> *>(d.data);
+    const void *p = d.data;
+    qCheckAccess(p);
+    p = deref(p);
+    qCheckAccess(p);
+    p = deref(p);
+    qCheckAccess(p);
+    p = deref(addOffset(d.data, sizeof(void*)));
+    qCheckAccess(p);
+    p = deref(addOffset(p, sizeof(void*)));
+    qCheckAccess(p);
+    p = deref(addOffset(p, sizeof(void*)));
+    qCheckAccess(p);
+
+    int nn = 0;
+    std::list<int>::const_iterator it = list.begin();
+    for (; nn < 101 && it != list.end(); ++nn, ++it)
+        qCheckAccess(it.operator->());
+
+    if (nn > 100)
+        P(d, "value", "<more than 100 items>");
+    else
+        P(d, "value", "<" << nn << " items>");
+    P(d, "numchild", nn);
+
+    P(d, "valuedisabled", "true");
+    if (d.dumpChildren) {
+        QByteArray strippedInnerType = stripPointerType(d.innertype);
+        const char *stripped =
+            isPointerType(d.innertype) ? strippedInnerType.data() : 0;
+        d << ",children=[";
+        it = list.begin();
+        for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) {
             d.beginHash();
-            P(d, "name", "[...]");
-            P(d, "value", "<incomplete>");
-            P(d, "type", d.innertype);
+            P(d, "name", "[" << i << "]");
+            qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->());
             d.endHash();
         }
+        if (it != list.end())
+            d.putEllipsis();
         d << "]";
     }
     d.disarm();
@@ -2167,37 +2212,21 @@ static void qDumpStdVector(QDumper &d)
     P(d, "numchild", n);
     if (d.dumpChildren) {
         unsigned innersize = d.extraInt[0];
-        bool innerTypeIsPointer = isPointerType(d.innertype);
         QByteArray strippedInnerType = stripPointerType(d.innertype);
-
+        const char *stripped =
+            isPointerType(d.innertype) ? strippedInnerType.data() : 0;
         if (n > 1000)
             n = 1000;
         d << ",children=[";
         for (int i = 0; i != n; ++i) {
             d.beginHash();
             P(d, "name", "[" << i << "]");
-            const void *p = addOffset(v->start, i * innersize);
-            if (innerTypeIsPointer) {
-                if (deref(p)) {
-                    //P(d, "value","@" << p);
-                    qDumpInnerValue(d, strippedInnerType.data(), deref(p));
-                } else {
-                    P(d, "type", d.innertype);
-                    P(d, "value", "<null>");
-                    P(d, "numchild", "0");
-                }
-            } else {
-                qDumpInnerValue(d, d.innertype, p);
-            }
-            d.endHash();
-        }
-        if (n < nn) {
-            d.beginHash();
-            P(d, "name", "[...]");
-            P(d, "value", "<incomplete>");
-            P(d, "type", d.innertype);
+            qDumpInnerValueOrPointer(d, d.innertype, stripped,
+                addOffset(v->start, i * innersize));
             d.endHash();
         }
+        if (n < nn)
+            d.putEllipsis();
         d << "]";
     }
     d.disarm();
@@ -2325,6 +2354,8 @@ static void handleProtocolVersion2and3(QDumper & d)
                 qDumpStdVector(d);
             else if (isEqual(type, "std::vector::bool"))
                 qDumpStdVectorBool(d);
+            else if (isEqual(type, "std::list"))
+                qDumpStdList(d);
             else if (isEqual(type, "string"))
                 qDumpStdString(d);
             else if (isEqual(type, "std::string"))
diff --git a/doc/coding-style.qdoc b/doc/coding-style.qdoc
new file mode 100644
index 0000000000000000000000000000000000000000..f028e56fe743e4ea78e3f683b649084856a2aca4
--- /dev/null
+++ b/doc/coding-style.qdoc
@@ -0,0 +1,246 @@
+/*!
+
+\contentpage{index.html}{Qt Creator}
+\page coding-style.html
+
+\title Qt Creator Coding Rules
+
+THIS IS PRELIMINARY.
+
+\section1 Introduction
+
+The aim of this section is to serve as a guide for the developers, to aid us
+to build understandable and maintainable code, to create less confusion and
+surprises when working on Qt Creator.
+
+As usual: Rules are not set in stone. If there's a good reason to break one,
+do it, preferably after making sure that there are others agreeing.
+
+This document is incomplete.
+
+In general, if you want to contribute to the main source, we expect at least
+that you:
+
+\list 1
+\o The most important rule first: KISS (keep it simple ...): always
+   use a simple implementation in favor of a more complicated one.
+   This eases maintenance a lot.
+\o Write good C++ code: Readable, well commented when necessary,
+   and taking advantage of the OO model. Follow the \l{Formatting} guidelines.
+   There are also certain \l{Code Constructs} that we try to follow.
+\o Adapt the code to the structures already existing in Qt Creator, or in
+   the case that you have better ideas, discuss them with other developers
+   before writing the code.
+\o Take advantage of Qt. Don't re-invent the wheel. Think about what parts
+   of your code are generic enough that they might be incorporated into 
+   Qt proper. 
+\o Document interfaces. Right now we use qdoc, but changing to doxygen
+   is being considered.
+\endlist
+
+
+
+\section1 Submitting Code
+
+It is implicitly understood that all patches contributed to The Qt Creator
+Project are made under under the Gnu General Public License, version 2 or later
+and 
+
+If you have a problem with that, don't contribute code.
+
+Also please don't just pop up out of the blue with a huge patch (or
+small) that changes something substantial in Qt Creator. Always discuss your
+ideas with the other developers on mailing list first.
+
+When you create the patch, please use git or use "diff -up" since we find
+that a lot easier to read than the other diff formats. Also please do not
+send patches that implements or fixes several different things; several
+patches is a much better option.
+
+We also require you to provide a commit message entry with every patch,
+this describes in detail what the patch is doing.
+
+
+
+\section1 Code Constructs
+
+We have several guidelines on code constructs, some of these exist to
+make the code faster, others to make the code clearer. Yet others
+exist to allow us to take advantage of the strong type checking
+in C++.
+
+\list 1
+\o Declaration of variables should wait as long as possible. The rule
+  is: "Don't declare it until you need it." In C++ there are a lot of
+  user defined types, and these can very often be expensive to
+  initialize. This rule connects to the next rule too.
+
+\o Make the scope of a variable as small as possible.
+
+\o Prefer preincrement to postincrement whenever possible.
+  Preincrement has potential of being faster than postincrement. Just
+  think about the obvious implementations of pre/post-increment. This
+  rule applies to decrement too.
+
+\code
+	++T;
+	--U;
+	-NOT-
+	T++; // not used in Qt Creator
+	U--; // not used in Qt Creator
+\endcode
+
+\o Try to minimize evaluation of the same code over and over. This is
+   aimed especially at loops.
+
+\code
+
+	Container::iterator end = large.end();
+	for (Container::iterator it = large.begin(); it != end; ++it) {
+		...;
+	}
+	-NOT-
+	for (Container::iterator it = large.begin();
+	     it != large.end(); ++it) {
+		...;
+	}
+\endcode
+
+
+
+\section1 Formatting
+
+\section2 Declarations
+
+Only one declaration on each line.
+\code
+	int a;
+	int b;
+	-NOT-
+	int a, b; // not used in Qt Creator
+\endcode
+
+  This is especially important when initialization is done at the same
+  time.
+\code
+	QString a = "Joe";
+	QString b = "Foo";
+	-NOT-
+	QString a = "Joe", b = "Foo"; // not used in Qt Creator
+\endcode
+	[Note that 'QString a = "Joe"' is formally calling a copy constructor 
+	on a temporary constructed from a string literal and therefore has the
+	potential of being more expensive then direct construction by
+	'QString a("joe")'. However the compiler is allowed to elide the copy
+	(even if it had side effects), and modern compilers typically do so.
+	Given these equal costs, Qt Creator code favours the '=' idiom as it is in
+	line with the traditional C-style initialization, _and_ cannot be
+	mistaken as function declaration, _and_ reduces the level of nested
+	parantheses in more initializations.]
+	
+
+\section2  Pointers and references
+
+\code
+	char *p = "flop";
+	char &c = *p;
+	-NOT-
+	char* p = "flop"; // not used in Qt Creator
+	char & c = *p;     // not used in Qt Creator
+\endcode
+
+  This is simply in line with the official Qt guide lines.
+
+  Also note that we will have:
+\code
+	const char *p;
+	-NOT-
+	char const * p; // not used in Qt Creator
+\endcode
+
+
+  Using a plain 0 for Null pointer constants is always correct and least effort
+  to type. So:
+\code
+	void *p = 0;
+	-NOT-
+	void *p = NULL; // not used in Qt Creator
+	-NOT-
+	void *p = '\0'; // not used in Qt Creator
+	-NOT-
+	void *p = 42 - 7 * 6; // also not used in Qt Creator
+\endcode
+  Note: As an exception, imported third party code as well as code
+  interfacing the "native" APIs (src/support/os_*) can use NULL.
+
+
+\section2  Operator names and parentheses
+\code
+	operator==(type)
+	-NOT-
+	operator == (type)  // not used in Qt Creator
+\endcode
+
+  The == is part of the function name, separating it makes the
+  declaration look like an expression.
+
+
+\section2 Function names and parentheses
+\code
+	void mangle()
+	-NOT-
+	void mangle ()  // not used in Qt Creator
+\endcode
+
+
+
+\section2 Naming rules
+
+  Simply follow the style of Qt proper. As examples:
+ \list
+  \o Use descriptive but simple and short names. Do not abbreviate.
+
+  \o Class names are capitalized, and function names lowercased.
+    Enums are named like Classes, values are in lower-case.
+\endlist
+
+
+
+\section2 Formatting
+
+   Adapt the formatting of your code to the one used in the
+   other parts of Qt Creator. In case there is different formatting for
+   the same construct, use the one used more often.
+
+
+\section2 Declarations
+
+  - Use this order for the access sections of your class: public,
+    protected, private. The public section is interesting for every
+    user of the class. The private section is only of interest for the
+    implementors of the class (you). [Obviously not true since this is
+    for developers, and we do not want one developer only to be able to
+    read and understand the implementation of class internals. Lgb]
+
+  - Avoid declaring global objects in the declaration file of the class.
+    If the same variable is used for all objects, use a static member.
+
+  - Avoid global or static variables.
+
+
+\section2 File headers
+
+  If you create a new file, the top of the file should include a 
+  header comment equal to the one found in other source files of Qt Creator.
+
+\section2 Documentation
+
+  The documentation is generated from source and header files.
+  You document for the other developers, not for yourself.
+  In the header you should document interfaces, i.e.  what the function does,
+   not the implementation.
+  In the .cpp files you document the implementation if the implementation 
+  in non-obvious.
+
+
+*/
diff --git a/shared/cplusplus/Keywords.cpp b/shared/cplusplus/Keywords.cpp
index 0e19b6b1d4f1be79f24c048cc18adbe41e71068e..d5ec6b5d432ead6b2454c6f92ac2f58a6591471b 100644
--- a/shared/cplusplus/Keywords.cpp
+++ b/shared/cplusplus/Keywords.cpp
@@ -1208,4 +1208,141 @@ int Lexer::classify(const char *s, int n, bool q) {
   } // switch
 }
 
+static inline int classifyOperator2(const char *s) {
+  if (s[0] == 'o') {
+    if (s[1] == 'r') {
+      return T_OR;
+    }
+  }
+  return T_IDENTIFIER;
+}
+
+static inline int classifyOperator3(const char *s) {
+  if (s[0] == 'a') {
+    if (s[1] == 'n') {
+      if (s[2] == 'd') {
+        return T_AND;
+      }
+    }
+  }
+  else if (s[0] == 'n') {
+    if (s[1] == 'o') {
+      if (s[2] == 't') {
+        return T_NOT;
+      }
+    }
+  }
+  else if (s[0] == 'x') {
+    if (s[1] == 'o') {
+      if (s[2] == 'r') {
+        return T_XOR;
+      }
+    }
+  }
+  return T_IDENTIFIER;
+}
+
+static inline int classifyOperator5(const char *s) {
+  if (s[0] == 'b') {
+    if (s[1] == 'i') {
+      if (s[2] == 't') {
+        if (s[3] == 'o') {
+          if (s[4] == 'r') {
+            return T_BITOR;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0] == 'c') {
+    if (s[1] == 'o') {
+      if (s[2] == 'm') {
+        if (s[3] == 'p') {
+          if (s[4] == 'l') {
+            return T_COMPL;
+          }
+        }
+      }
+    }
+  }
+  else if (s[0] == 'o') {
+    if (s[1] == 'r') {
+      if (s[2] == '_') {
+        if (s[3] == 'e') {
+          if (s[4] == 'q') {
+            return T_OR_EQ;
+          }
+        }
+      }
+    }
+  }
+  return T_IDENTIFIER;
+}
+
+static inline int classifyOperator6(const char *s) {
+  if (s[0] == 'a') {
+    if (s[1] == 'n') {
+      if (s[2] == 'd') {
+        if (s[3] == '_') {
+          if (s[4] == 'e') {
+            if (s[5] == 'q') {
+              return T_AND_EQ;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0] == 'b') {
+    if (s[1] == 'i') {
+      if (s[2] == 't') {
+        if (s[3] == 'a') {
+          if (s[4] == 'n') {
+            if (s[5] == 'd') {
+              return T_BITAND;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0] == 'n') {
+    if (s[1] == 'o') {
+      if (s[2] == 't') {
+        if (s[3] == '_') {
+          if (s[4] == 'e') {
+            if (s[5] == 'q') {
+              return T_NOT_EQ;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if (s[0] == 'x') {
+    if (s[1] == 'o') {
+      if (s[2] == 'r') {
+        if (s[3] == '_') {
+          if (s[4] == 'e') {
+            if (s[5] == 'q') {
+              return T_XOR_EQ;
+            }
+          }
+        }
+      }
+    }
+  }
+  return T_IDENTIFIER;
+}
+
+int Lexer::classifyOperator(const char *s, int n) {
+  switch (n) {
+    case 2: return classifyOperator2(s);
+    case 3: return classifyOperator3(s);
+    case 5: return classifyOperator5(s);
+    case 6: return classifyOperator6(s);
+    default: return T_IDENTIFIER;
+  } // switch
+}
+
 CPLUSPLUS_END_NAMESPACE
diff --git a/shared/cplusplus/Lexer.cpp b/shared/cplusplus/Lexer.cpp
index af6f09f74d211d285249c8601829bd2af4cee89f..2e9ae98c1e0c90aac35c1f44387903a9650b52eb 100644
--- a/shared/cplusplus/Lexer.cpp
+++ b/shared/cplusplus/Lexer.cpp
@@ -589,8 +589,13 @@ void Lexer::scan_helper(Token *tok)
                 tok->kind = classify(yytext, yylen, _qtMocRunEnabled);
             else
                 tok->kind = T_IDENTIFIER;
-            if (tok->kind == T_IDENTIFIER && control())
-                tok->identifier = control()->findOrInsertIdentifier(yytext, yylen);
+
+            if (tok->kind == T_IDENTIFIER) {
+                tok->kind = classifyOperator(yytext, yylen);
+
+                if (control())
+                    tok->identifier = control()->findOrInsertIdentifier(yytext, yylen);
+            }
             break;
         } else if (std::isdigit(ch)) {
             const char *yytext = _currentChar - 1;
diff --git a/shared/cplusplus/Lexer.h b/shared/cplusplus/Lexer.h
index 1d85a58eb9fb41664b4b21de4f2c66e32b1e4f6b..57f9d3e1362244dff7456957410fd97ad4977404 100644
--- a/shared/cplusplus/Lexer.h
+++ b/shared/cplusplus/Lexer.h
@@ -112,6 +112,7 @@ private:
     void scan_helper(Token *tok);
     void setSource(const char *firstChar, const char *lastChar);
     static int classify(const char *string, int length, bool q);
+    static int classifyOperator(const char *string, int length);
 
     inline void yyinp()
     {
diff --git a/shared/cplusplus/Token.h b/shared/cplusplus/Token.h
index e172fea568059b365014a66c28a972136b57babd..f017bbc8e7ed9a3acdfa54b48ee3052fee34baa3 100644
--- a/shared/cplusplus/Token.h
+++ b/shared/cplusplus/Token.h
@@ -209,7 +209,19 @@ enum Kind {
 
     T_LAST_KEYWORD = T_SLOTS,
 
-    // ### aliases
+    // aliases
+    T_OR = T_PIPE_PIPE,
+    T_AND = T_AMPER_AMPER,
+    T_NOT = T_EXCLAIM,
+    T_XOR = T_CARET,
+    T_BITOR = T_PIPE,
+    T_COMPL = T_TILDE,
+    T_OR_EQ = T_PIPE_EQUAL,
+    T_AND_EQ = T_AMPER_EQUAL,
+    T_BITAND = T_AMPER,
+    T_NOT_EQ = T_EXCLAIM_EQUAL,
+    T_XOR_EQ = T_CARET_EQUAL,
+
     T___ASM = T_ASM,
     T___ASM__ = T_ASM,
 
diff --git a/src/app/main.cpp b/src/app/main.cpp
index ad61ab0c7505e59127400ca060a44929c1c2960a..eedc9e1365370a07d2e60933568a3e1dbb1aaadf 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -69,7 +69,7 @@ static const char *HELP_OPTION4 = "--help";
 static const char *VERSION_OPTION = "-version";
 static const char *CLIENT_OPTION = "-client";
 
-typedef QSet<ExtensionSystem::PluginSpec *> PluginSpecSet;
+typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
 
 // Helpers for displaying messages. Note that there is no console on Windows.
 #ifdef Q_WS_WIN
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp
index 3e619548a2334a64790d5973612b06cca5c90dfe..d670e7e0018ba051a62f037959d1feeb59f6370d 100644
--- a/src/libs/cplusplus/CppDocument.cpp
+++ b/src/libs/cplusplus/CppDocument.cpp
@@ -33,8 +33,6 @@
 
 #include "CppDocument.h"
 
-#include <utils/qtcassert.h>
-
 #include <Control.h>
 #include <TranslationUnit.h>
 #include <DiagnosticClient.h>
@@ -133,12 +131,16 @@ QString Document::fileName() const
 
 QStringList Document::includedFiles() const
 {
-    return _includedFiles;
+    QStringList files;
+    foreach (const Include &i, _includes)
+        files.append(i.fileName());
+    files.removeDuplicates();
+    return files;
 }
 
-void Document::addIncludeFile(const QString &fileName)
+void Document::addIncludeFile(const QString &fileName, unsigned line)
 {
-    _includedFiles.append(fileName);
+    _includes.append(Include(fileName, line));
 }
 
 void Document::appendMacro(const Macro &macro)
@@ -273,7 +275,7 @@ bool Document::parse(ParseMode mode)
 
 void Document::check()
 {
-    QTC_ASSERT(!_globalNamespace, return);
+    Q_ASSERT(!_globalNamespace);
 
     Semantic semantic(_control);
 
diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h
index aaca36c18eee38455cb94d8ab09db826ad4145b0..54de3c801ea866cac6812bac662ed8fff7e97c15 100644
--- a/src/libs/cplusplus/CppDocument.h
+++ b/src/libs/cplusplus/CppDocument.h
@@ -40,7 +40,7 @@
 
 #include <QByteArray>
 #include <QList>
-#include <QSet>
+#include <QMap>
 #include <QSharedPointer>
 #include <QString>
 #include <QStringList>
@@ -65,7 +65,7 @@ public:
     QString fileName() const;
 
     QStringList includedFiles() const;
-    void addIncludeFile(const QString &fileName);
+    void addIncludeFile(const QString &fileName, unsigned line);
 
     void appendMacro(const Macro &macro);
     void addMacroUse(const Macro &macro, unsigned offset, unsigned length);
@@ -181,6 +181,22 @@ public:
         { return pos >= _begin && pos < _end; }
     };
 
+    class Include {
+        QString _fileName;
+        unsigned _line;
+
+    public:
+        Include(const QString &fileName, unsigned line)
+            : _fileName(fileName), _line(line)
+        { }
+
+        QString fileName() const
+        { return _fileName; }
+
+        unsigned line() const
+        { return _line; }
+    };
+
     class MacroUse: public Block {
         Macro _macro;
 
@@ -196,6 +212,9 @@ public:
         { return _macro; }
     };
 
+    QList<Include> includes() const
+    { return _includes; }
+
     QList<Block> skippedBlocks() const
     { return _skippedBlocks; }
 
@@ -207,16 +226,26 @@ private:
 
 private:
     QString _fileName;
-    QStringList _includedFiles;
     Control *_control;
     TranslationUnit *_translationUnit;
     Namespace *_globalNamespace;
     QList<DiagnosticMessage> _diagnosticMessages;
+    QList<Include> _includes;
     QList<Macro> _definedMacros;
     QList<Block> _skippedBlocks;
     QList<MacroUse> _macroUses;
 };
 
+class CPLUSPLUS_EXPORT Snapshot: public QMap<QString, Document::Ptr>
+{
+public:
+    Snapshot()
+    { }
+
+    ~Snapshot()
+    { }
+};
+
 } // end of namespace CPlusPlus
 
 #endif // CPPDOCUMENT_H
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 67eb05d7f4aea4a4be4e3b02ee6fe315b39eead9..8b24b59f5efe8b79d9da1336dad74f5da7744eae 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -77,7 +77,7 @@ LookupContext::LookupContext(Control *control)
 LookupContext::LookupContext(Symbol *symbol,
                              Document::Ptr expressionDocument,
                              Document::Ptr thisDocument,
-                             const QMap<QString, Document::Ptr> &documents)
+                             const Snapshot &documents)
     : _symbol(symbol),
       _expressionDocument(expressionDocument),
       _thisDocument(thisDocument),
diff --git a/src/libs/cplusplus/LookupContext.h b/src/libs/cplusplus/LookupContext.h
index 36ea6a8298fa714c984110407dadad3f46046e78..18754bf6670676165a8043325caf02ada1ab542c 100644
--- a/src/libs/cplusplus/LookupContext.h
+++ b/src/libs/cplusplus/LookupContext.h
@@ -57,7 +57,7 @@ public:
     LookupContext(Symbol *symbol,
                   Document::Ptr expressionDocument,
                   Document::Ptr thisDocument,
-                  const QMap<QString, Document::Ptr> &documents);
+                  const Snapshot &documents);
 
     LookupContext(Symbol *symbol,
                   const LookupContext &context);
@@ -87,7 +87,7 @@ public:
     QList<Symbol *> resolveClassOrNamespace(Name *name) const
     { return resolveClassOrNamespace(name, visibleScopes()); }
 
-    QMap<QString, Document::Ptr> documents() const
+    Snapshot snapshot() const
     { return _documents; }
 
     enum ResolveMode {
@@ -140,7 +140,7 @@ private:
     Document::Ptr _thisDocument;
 
     // All documents.
-    QMap<QString, Document::Ptr> _documents;
+    Snapshot _documents;
 
     // Visible scopes.
     QList<Scope *> _visibleScopes;
diff --git a/src/libs/cplusplus/OverviewModel.cpp b/src/libs/cplusplus/OverviewModel.cpp
index 7f38cb8ba1a2fb8d06deaecfceddc2e23bd162ba..b1b7267027c3b659f018c235923e8ec9ff74e2f2 100644
--- a/src/libs/cplusplus/OverviewModel.cpp
+++ b/src/libs/cplusplus/OverviewModel.cpp
@@ -34,8 +34,6 @@
 #include "OverviewModel.h"
 #include "Overview.h"
 
-#include <utils/qtcassert.h>
-
 #include <Scope.h>
 #include <Semantic.h>
 #include <Literals.h>
@@ -83,13 +81,13 @@ QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent)
         return createIndex(row, column, symbol);
     } else {
         Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
-        QTC_ASSERT(parentSymbol, return QModelIndex());
+        Q_ASSERT(parentSymbol);
 
         ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol();
-        QTC_ASSERT(scopedSymbol, return QModelIndex());
+        Q_ASSERT(scopedSymbol);
 
         Scope *scope = scopedSymbol->members();
-        QTC_ASSERT(scope, return QModelIndex());
+        Q_ASSERT(scope);
 
         return createIndex(row, 0, scope->symbolAt(row));
     }
@@ -126,12 +124,12 @@ int OverviewModel::rowCount(const QModelIndex &parent) const
             if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item
                 return 0;
             Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
-            QTC_ASSERT(parentSymbol, return 0);
+            Q_ASSERT(parentSymbol);
 
             if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) {
                 if (!scopedSymbol->isFunction()) {
                     Scope *parentScope = scopedSymbol->members();
-                    QTC_ASSERT(parentScope, return 0);
+                    Q_ASSERT(parentScope);
 
                     return parentScope->symbolCount();
                 }
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 6915e1169b0b532e06c797018c883b651fc771f7..0ea9018a353de6936ae0feaece98a7af24d60286 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -45,8 +45,6 @@
 #include <TypeVisitor.h>
 #include <NameVisitor.h>
 
-#include <utils/qtcassert.h>
-
 #include <QtCore/QList>
 #include <QtCore/QtDebug>
 
@@ -100,7 +98,7 @@ protected:
     // types
     virtual void visit(PointerToMemberType * /*ty*/)
     {
-        QTC_ASSERT(false, /**/);
+        Q_ASSERT(false);
     }
 
     virtual void visit(PointerType *ty)
@@ -152,32 +150,32 @@ protected:
     { /* nothing to do*/ }
 
     virtual void visit(Namespace *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(Class *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(Enum *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     // names
     virtual void visit(NameId *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(TemplateNameId *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(DestructorNameId *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(OperatorNameId *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(ConversionNameId *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 
     virtual void visit(QualifiedNameId *)
-    { QTC_ASSERT(false, /**/); }
+    { Q_ASSERT(false); }
 };
 
 } // end of anonymous namespace
diff --git a/src/libs/cplusplus/TypeOfExpression.cpp b/src/libs/cplusplus/TypeOfExpression.cpp
index 487c9f8a46969d1c28b2b6c1fe84cb2020f7ce7c..cb373cce027c5a3606482a0b1cbc2e206a274949 100644
--- a/src/libs/cplusplus/TypeOfExpression.cpp
+++ b/src/libs/cplusplus/TypeOfExpression.cpp
@@ -37,6 +37,7 @@
 #include <TranslationUnit.h>
 #include <cplusplus/LookupContext.h>
 #include <cplusplus/ResolveExpression.h>
+#include <cplusplus/pp.h>
 
 using namespace CPlusPlus;
 
@@ -45,21 +46,25 @@ TypeOfExpression::TypeOfExpression():
 {
 }
 
-void TypeOfExpression::setDocuments(const QMap<QString, Document::Ptr> &documents)
+void TypeOfExpression::setSnapshot(const Snapshot &documents)
 {
-    m_documents = documents;
+    m_snapshot = documents;
     m_lookupContext = LookupContext();
 }
 
 QList<TypeOfExpression::Result> TypeOfExpression::operator()(const QString &expression,
                                                              Document::Ptr document,
-                                                             Symbol *lastVisibleSymbol)
+                                                             Symbol *lastVisibleSymbol,
+                                                             PreprocessMode mode)
 {
-    Document::Ptr expressionDoc = documentForExpression(expression);
+    QString code = expression;
+    if (mode == Preprocess)
+        code = preprocessedExpression(expression, m_snapshot, document);
+    Document::Ptr expressionDoc = documentForExpression(code);
     m_ast = extractExpressionAST(expressionDoc);
 
     m_lookupContext = LookupContext(lastVisibleSymbol, expressionDoc,
-                                    document, m_documents);
+                                    document, m_snapshot);
 
     ResolveExpression resolveExpression(m_lookupContext);
     return resolveExpression(m_ast);
@@ -97,3 +102,36 @@ Document::Ptr TypeOfExpression::documentForExpression(const QString &expression)
     doc->parse(Document::ParseExpression);
     return doc;
 }
+
+void TypeOfExpression::processEnvironment(Snapshot documents,
+                                          Document::Ptr doc, Environment *env,
+                                          QSet<QString> *processed) const
+{
+    if (! doc)
+        return;
+    if (processed->contains(doc->fileName()))
+        return;
+    processed->insert(doc->fileName());
+    foreach (const Document::Include &incl, doc->includes()) {
+        processEnvironment(documents,
+                           documents.value(incl.fileName()),
+                           env, processed);
+    }
+    foreach (const Macro &macro, doc->definedMacros())
+        env->bind(macro);
+}
+
+QString TypeOfExpression::preprocessedExpression(const QString &expression,
+                                                 Snapshot documents,
+                                                 Document::Ptr thisDocument) const
+{
+    Environment env;
+    QSet<QString> processed;
+    processEnvironment(documents, thisDocument,
+                       &env, &processed);
+    const QByteArray code = expression.toUtf8();
+    pp preproc(0, env);
+    QByteArray preprocessedCode;
+    preproc("<expression>", code, &preprocessedCode);
+    return QString::fromUtf8(preprocessedCode);
+}
diff --git a/src/libs/cplusplus/TypeOfExpression.h b/src/libs/cplusplus/TypeOfExpression.h
index cd7a23441fde133111e5f987951d0bcbb2bc51e2..87d4113f30e9f3298a6ad5505e8ae82661f2dbcf 100644
--- a/src/libs/cplusplus/TypeOfExpression.h
+++ b/src/libs/cplusplus/TypeOfExpression.h
@@ -43,6 +43,9 @@
 
 namespace CPlusPlus {
 
+class Environment;
+class Macro;
+
 class CPLUSPLUS_EXPORT TypeOfExpression
 {
 public:
@@ -58,7 +61,12 @@ public:
      * Also clears the lookup context, so can be used to make sure references
      * to the documents previously used are removed.
      */
-    void setDocuments(const QMap<QString, Document::Ptr> &documents);
+    void setSnapshot(const Snapshot &documents);
+
+    enum PreprocessMode {
+        NoPreprocess,
+        Preprocess
+    };
 
     /**
      * Returns a list of possible fully specified types associated with the
@@ -73,7 +81,8 @@ public:
      * @param lastVisibleSymbol The last visible symbol in the document.
      */
     QList<Result> operator()(const QString &expression, Document::Ptr document,
-                             Symbol *lastVisibleSymbol);
+                             Symbol *lastVisibleSymbol,
+                             PreprocessMode mode = NoPreprocess);
 
     /**
      * Returns the AST of the last evaluated expression.
@@ -91,7 +100,15 @@ private:
     ExpressionAST *extractExpressionAST(Document::Ptr doc) const;
     Document::Ptr documentForExpression(const QString &expression) const;
 
-    QMap<QString, Document::Ptr> m_documents;
+    void processEnvironment(CPlusPlus::Snapshot documents,
+                            CPlusPlus::Document::Ptr doc, CPlusPlus::Environment *env,
+                            QSet<QString> *processed) const;
+
+    QString preprocessedExpression(const QString &expression,
+                                   CPlusPlus::Snapshot documents,
+                                   CPlusPlus::Document::Ptr thisDocument) const;
+
+    Snapshot m_snapshot;
     ExpressionAST *m_ast;
     LookupContext m_lookupContext;
 };
diff --git a/src/libs/cplusplus/pp-client.h b/src/libs/cplusplus/pp-client.h
index 2fc781f22f559a60cea8595cc7ab1c3690649b55..eead5bf460012dbab5fdf40a63f451a5da3af88c 100644
--- a/src/libs/cplusplus/pp-client.h
+++ b/src/libs/cplusplus/pp-client.h
@@ -63,7 +63,8 @@ public:
   { }
 
   virtual void macroAdded(const Macro &macro) = 0;
-  virtual void sourceNeeded(QString &fileName, IncludeType mode) = 0; // ### FIX the signature.
+  virtual void sourceNeeded(QString &fileName, IncludeType mode,
+                            unsigned line) = 0; // ### FIX the signature.
 
   virtual void startExpandingMacro(unsigned offset,
                                    const Macro &macro,
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 83386e8079c5fca868024acb4be07b4e74a58cc1..c33fc8cb15157632632cb7905cf8be1421667d65 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -818,7 +818,7 @@ void pp::processInclude(bool skipCurentPath,
         QString fn = QString::fromUtf8(path.constData(), path.length());
 
         if (client)
-            client->sourceNeeded(fn, Client::IncludeGlobal);
+            client->sourceNeeded(fn, Client::IncludeGlobal, firstToken->lineno);
     } else if (tk->is(T_ANGLE_STRING_LITERAL) || tk->is(T_STRING_LITERAL)) {
         const QByteArray spell = tokenSpell(*tk);
         const char *beginOfPath = spell.constBegin();
@@ -831,7 +831,7 @@ void pp::processInclude(bool skipCurentPath,
             QString fn = QString::fromUtf8(path.constData(), path.length());
 
             if (client)
-                client->sourceNeeded(fn, Client::IncludeLocal);
+                client->sourceNeeded(fn, Client::IncludeLocal, firstToken->lineno);
         }
     }
 }
diff --git a/src/libs/cplusplus/pp-environment.cpp b/src/libs/cplusplus/pp-environment.cpp
index 20491727a4ceb2cb9be060cc0d7e9a998ea92794..dd839087a40c54e8281067ed26571eff80f624d5 100644
--- a/src/libs/cplusplus/pp-environment.cpp
+++ b/src/libs/cplusplus/pp-environment.cpp
@@ -53,8 +53,6 @@
 #include "pp-environment.h"
 #include "pp.h"
 
-#include <utils/qtcassert.h>
-
 #include <cstring>
 
 using namespace CPlusPlus;
@@ -93,7 +91,7 @@ Macro *Environment::macroAt(unsigned index) const
 
 Macro *Environment::bind(const Macro &__macro)
 {
-    QTC_ASSERT(! __macro.name.isEmpty(), return 0);
+    Q_ASSERT(! __macro.name.isEmpty());
 
     Macro *m = new Macro (__macro);
     m->hashcode = hash_code(m->name);
diff --git a/src/libs/extensionsystem/optionsparser.cpp b/src/libs/extensionsystem/optionsparser.cpp
index 8884cb378ceb02b002f52b63c1f6aefbfef3f1f5..09dbaa59b7241648efc47e7cb8b30ae963b6ca93 100644
--- a/src/libs/extensionsystem/optionsparser.cpp
+++ b/src/libs/extensionsystem/optionsparser.cpp
@@ -129,7 +129,7 @@ bool OptionsParser::checkForNoLoadOption()
                                                              "The plugin '%1' does not exist.").arg(m_currentArg);
             m_hasError = true;
         } else {
-            m_pmPrivate->pluginSpecs.remove(spec);
+            m_pmPrivate->pluginSpecs.removeAll(spec);
             delete spec;
             m_isDependencyRefreshNeeded = true;
         }
diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp
index 3f7ba386e4e2d096d247cced281e457c26398d69..90e6e4bb0049c613ab92c30485939a093475bc90 100644
--- a/src/libs/extensionsystem/pluginmanager.cpp
+++ b/src/libs/extensionsystem/pluginmanager.cpp
@@ -48,7 +48,7 @@
 #include <QTest>
 #endif
 
-typedef QSet<ExtensionSystem::PluginSpec *> PluginSpecSet;
+typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
 
 enum { debugLeaks = 0 };
 
@@ -162,6 +162,11 @@ enum { debugLeaks = 0 };
 using namespace ExtensionSystem;
 using namespace ExtensionSystem::Internal;
 
+static bool lessThanByPluginName(const PluginSpec *one, const PluginSpec *two)
+{
+    return one->name() < two->name();
+}
+
 PluginManager *PluginManager::m_instance = 0;
 
 /*!
@@ -306,7 +311,7 @@ QStringList PluginManager::arguments() const
 }
 
 /*!
-    \fn QSet<PluginSpec *> PluginManager::plugins() const
+    \fn QList<PluginSpec *> PluginManager::plugins() const
     List of all plugin specifications that have been found in the plugin search paths.
     This list is valid directly after the setPluginPaths() call.
     The plugin specifications contain the information from the plugins' xml description files
@@ -315,7 +320,7 @@ QStringList PluginManager::arguments() const
 
     \sa setPluginPaths()
 */
-QSet<PluginSpec *> PluginManager::plugins() const
+QList<PluginSpec *> PluginManager::plugins() const
 {
     return d->pluginSpecs;
 }
@@ -703,9 +708,11 @@ void PluginManagerPrivate::readPluginPaths()
     foreach (const QString &specFile, specFiles) {
         PluginSpec *spec = new PluginSpec;
         spec->d->read(specFile);
-        pluginSpecs.insert(spec);
+        pluginSpecs.append(spec);
     }
     resolveDependencies();
+    // ensure deterministic plugin load order by sorting
+    qSort(pluginSpecs.begin(), pluginSpecs.end(), lessThanByPluginName);
     emit q->pluginsChanged();
 }
 
diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h
index e46451901e925cd4881b088bd05cafa7671d791a..e621fbea17fe9927d61f96d03de9e0c60a9d973b 100644
--- a/src/libs/extensionsystem/pluginmanager.h
+++ b/src/libs/extensionsystem/pluginmanager.h
@@ -101,7 +101,7 @@ public:
     void loadPlugins();
     QStringList pluginPaths() const;
     void setPluginPaths(const QStringList &paths);
-    QSet<PluginSpec *> plugins() const;
+    QList<PluginSpec *> plugins() const;
     void setFileExtension(const QString &extension);
     QString fileExtension() const;
 
diff --git a/src/libs/extensionsystem/pluginmanager_p.h b/src/libs/extensionsystem/pluginmanager_p.h
index 74cb84c8678d8cdad09d413b11b15ff943b59d85..b286fdf2b1d83432e91faef5a4e95f4dda04c4b7 100644
--- a/src/libs/extensionsystem/pluginmanager_p.h
+++ b/src/libs/extensionsystem/pluginmanager_p.h
@@ -66,7 +66,7 @@ public:
     void loadPlugin(PluginSpec *spec, PluginSpec::State destState);
     void resolveDependencies();
 
-    QSet<PluginSpec *> pluginSpecs;
+    QList<PluginSpec *> pluginSpecs;
     QList<PluginSpec *> testSpecs;
     QStringList pluginPaths;
     QString extension;
diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp
index 170cd72ba0b978894be1609e6f766d4b98ec6512..a8694e29677a433579b8f752a68a77cb3b96899f 100644
--- a/src/libs/extensionsystem/pluginspec.cpp
+++ b/src/libs/extensionsystem/pluginspec.cpp
@@ -693,10 +693,10 @@ int PluginSpecPrivate::versionCompare(const QString &version1, const QString &ve
 }
 
 /*!
-    \fn bool PluginSpecPrivate::resolveDependencies(const QSet<PluginSpec *> &specs)
+    \fn bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
     \internal
 */
-bool PluginSpecPrivate::resolveDependencies(const QSet<PluginSpec *> &specs)
+bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
 {
     if (hasError)
         return false;
diff --git a/src/libs/extensionsystem/pluginspec_p.h b/src/libs/extensionsystem/pluginspec_p.h
index 922fe36d05d65c03fdaf02bd8abaad8ed795d84f..b4fefc59b32a81092963ad49d4349a84e2c3a33d 100644
--- a/src/libs/extensionsystem/pluginspec_p.h
+++ b/src/libs/extensionsystem/pluginspec_p.h
@@ -56,7 +56,7 @@ public:
 
     bool read(const QString &fileName);
     bool provides(const QString &pluginName, const QString &version) const;
-    bool resolveDependencies(const QSet<PluginSpec *> &specs);
+    bool resolveDependencies(const QList<PluginSpec *> &specs);
     bool loadLibrary();
     bool initializePlugin();
     bool initializeExtensions();
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index 81a2228e669f96911aeaa84cc07f5d4284d7ec82..100fdbe717f632f25633f47050f0a239132e778a 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -46,11 +46,12 @@
 #include <QtGui/QHBoxLayout>
 #include <QtGui/QLineEdit>
 #include <QtGui/QToolButton>
+#include <QtGui/QPushButton>
 
 namespace Core {
 namespace Utils {
 
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MAC
 /*static*/ const char * const PathChooser::browseButtonLabel = "Choose...";
 #else
 /*static*/ const char * const PathChooser::browseButtonLabel = "Browse...";
@@ -112,7 +113,11 @@ PathChooser::PathChooser(QWidget *parent) :
     hLayout->addWidget(m_d->m_lineEdit);
     hLayout->setSizeConstraint(QLayout::SetMinimumSize);
 
+#ifdef Q_OS_MAC
+    QPushButton *browseButton = new QPushButton;
+#else
     QToolButton *browseButton = new QToolButton;
+#endif
     browseButton->setText(tr(browseButtonLabel));
     connect(browseButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));
 
diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp
index 83c8ec397ee4ef01e4555c3a29815fca59a2a9c2..615ba5ec2aca73b7d88e68f149820c70c0153b7c 100644
--- a/src/plugins/bookmarks/bookmarksplugin.cpp
+++ b/src/plugins/bookmarks/bookmarksplugin.cpp
@@ -201,14 +201,18 @@ void BookmarksPlugin::updateActions(int state)
 
 void BookmarksPlugin::editorOpened(Core::IEditor *editor)
 {
-    connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
-            this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    if (qobject_cast<ITextEditor *>(editor)) {
+        connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
+                this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    }
 }
 
 void BookmarksPlugin::editorAboutToClose(Core::IEditor *editor)
 {
-    disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
-            this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    if (qobject_cast<ITextEditor *>(editor)) {
+        disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
+                this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
+    }
 }
 
 void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 4eab3fb55719566e789044c73362ff4ef7bf711c..228c58a94ac0a5366743a7eefaebcbfc7388c57a 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -186,6 +186,15 @@ MainWindow::MainWindow() :
     QCoreApplication::setOrganizationName(QLatin1String("Nokia"));
     QSettings::setDefaultFormat(QSettings::IniFormat);
     QString baseName = qApp->style()->objectName();
+    if (baseName == "windows") {
+        // Sometimes we get the standard windows 95 style as a fallback
+        // e.g. if we are running on a KDE4 desktop
+        QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION");
+        if (desktopEnvironment == "kde")
+            baseName = "plastique";
+        else
+            baseName = "cleanlooks";
+    }
     qApp->setStyle(new ManhattanStyle(baseName));
     statusBar()->setProperty("p_styled", true);
 }
diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp
index 82ed13a29e8f5d927e37e67de8e4e7df172927a5..8e84df39321ce520b5cb635168e706b97279242b 100644
--- a/src/plugins/coreplugin/navigationwidget.cpp
+++ b/src/plugins/coreplugin/navigationwidget.cpp
@@ -334,6 +334,10 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget)
 
     m_navigationComboBox = new NavComboBox(this);
     m_navigationWidget = 0;
+#ifdef Q_OS_MAC
+    // this is to avoid ugly tool bar behavior
+    m_navigationComboBox->setMaximumWidth(130);
+#endif
 
     m_toolbar = new QToolBar(this);
     m_toolbar->setContentsMargins(0, 0, 0, 0);
diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp
index 0decae6cf1804dbd980d2e88e217bb2dc13a5850..e534a0d1eae0cc6cda1c9f076a8350d9603ea0eb 100644
--- a/src/plugins/coreplugin/versiondialog.cpp
+++ b/src/plugins/coreplugin/versiondialog.cpp
@@ -72,7 +72,7 @@ VersionDialog::VersionDialog(QWidget *parent)
         "<br/>"
         "Built on " __DATE__ " at " __TIME__ "<br />"
 #ifdef IDE_REVISION
-        "Using revision %5<br/>"
+        "From revision %5<br/>"
 #endif
         "<br/>"
         "<br/>"
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 8d4a36178ce5150221d75c93bbe216532d935dc0..49b130ebc1cc8f8bbe84f52525ded5a77339438f 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -427,7 +427,9 @@ void CPPEditor::switchDeclarationDefinition()
     if (!m_modelManager)
         return;
 
-    Document::Ptr doc = m_modelManager->document(file()->fileName());
+    const Snapshot snapshot = m_modelManager->snapshot();
+
+    Document::Ptr doc = snapshot.value(file()->fileName());
     if (!doc)
         return;
     Symbol *lastSymbol = doc->findSymbolAt(line, column);
@@ -445,7 +447,7 @@ void CPPEditor::switchDeclarationDefinition()
 
     if (f) {
         TypeOfExpression typeOfExpression;
-        typeOfExpression.setDocuments(m_modelManager->documents());
+        typeOfExpression.setSnapshot(m_modelManager->snapshot());
         QList<TypeOfExpression::Result> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
         const LookupContext &context = typeOfExpression.lookupContext();
 
@@ -474,26 +476,38 @@ void CPPEditor::jumpToDefinition()
     if (!m_modelManager)
         return;
 
+    const Snapshot snapshot = m_modelManager->snapshot();
+
     // Find the last symbol up to the cursor position
     int line = 0, column = 0;
     convertPosition(position(), &line, &column);
-    Document::Ptr doc = m_modelManager->document(file()->fileName());
+    Document::Ptr doc = snapshot.value(file()->fileName());
     if (!doc)
         return;
+
+    QTextCursor tc = textCursor();
+    unsigned lineno = tc.blockNumber() + 1;
+    foreach (const Document::Include &incl, doc->includes()) {
+        if (incl.line() == lineno) {
+            if (openCppEditorAt(incl.fileName(), 0, 0))
+                return; // done
+            break;
+        }
+    }
+
     Symbol *lastSymbol = doc->findSymbolAt(line, column);
     if (!lastSymbol)
         return;
 
     // Get the expression under the cursor
     const int endOfName = endOfNameUnderCursor();
-    QTextCursor tc = textCursor();
     tc.setPosition(endOfName);
     ExpressionUnderCursor expressionUnderCursor;
     const QString expression = expressionUnderCursor(tc);
 
     // Evaluate the type of the expression
     TypeOfExpression typeOfExpression;
-    typeOfExpression.setDocuments(m_modelManager->documents());
+    typeOfExpression.setSnapshot(m_modelManager->snapshot());
     QList<TypeOfExpression::Result> resolvedSymbols =
             typeOfExpression(expression, doc, lastSymbol);
 
@@ -515,7 +529,7 @@ void CPPEditor::jumpToDefinition()
             QList<Symbol *> candidates = context.resolve(namedType->name());
             if (!candidates.isEmpty()) {
                 Symbol *s = candidates.takeFirst();
-                openEditorAt(s->fileName(), s->line(), s->column());
+                openCppEditorAt(s->fileName(), s->line(), s->column());
             }
 #endif
         }
@@ -524,7 +538,7 @@ void CPPEditor::jumpToDefinition()
             if (use.contains(endOfName - 1)) {
                 const Macro &macro = use.macro();
                 const QString fileName = QString::fromUtf8(macro.fileName);
-                if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
+                if (openCppEditorAt(fileName, macro.line, 0))
                     return; // done
             }
         }
@@ -562,7 +576,7 @@ Symbol *CPPEditor::findDefinition(Symbol *lastSymbol)
     QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
     LookupContext context(&control);
 
-    const QMap<QString, Document::Ptr> documents = m_modelManager->documents();
+    const Snapshot documents = m_modelManager->snapshot();
     foreach (Document::Ptr doc, documents) {
         QList<Scope *> visibleScopes;
         visibleScopes.append(doc->globalSymbols());
@@ -734,7 +748,8 @@ void CPPEditor::unCommentSelection()
 
         QString endText = endBlock.text();
         int endPos = end - endBlock.position();
-        bool hasTrailingCharacters = !endText.mid(endPos).trimmed().isEmpty();
+        bool hasTrailingCharacters = !endText.left(endPos).remove(QLatin1String("//")).trimmed().isEmpty()
+                                     && !endText.mid(endPos).trimmed().isEmpty();
         if ((endPos <= endText.length() - 2
             && endText.at(endPos) == QLatin1Char('*')
              && endText.at(endPos+1) == QLatin1Char('/'))) {
@@ -826,8 +841,15 @@ int CPPEditor::endOfNameUnderCursor()
     return pos;
 }
 
+TextEditor::ITextEditor *CPPEditor::openCppEditorAt(const QString &fileName,
+                                                    int line, int column)
+{
+    return TextEditor::BaseTextEditor::openEditorAt(fileName, line, column,
+                                                    Constants::C_CPPEDITOR);
+}
+
 bool CPPEditor::openEditorAt(Symbol *s)
 {
     const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength());
-    return TextEditor::BaseTextEditor::openEditorAt(fileName, s->line(), s->column());
+    return openCppEditorAt(fileName, s->line(), s->column());
 }
diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h
index 05f2c5d9c74098d9e6dbd0518bd85bef8271d7fb..2dd88d349934332947796d2bfc9fc69c17009d35 100644
--- a/src/plugins/cppeditor/cppeditor.h
+++ b/src/plugins/cppeditor/cppeditor.h
@@ -123,6 +123,9 @@ private:
     CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol);
     virtual void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar);
 
+    TextEditor::ITextEditor *openCppEditorAt(const QString &fileName, int line,
+                                             int column = 0);
+
     int previousBlockState(QTextBlock block) const;
     QTextCursor moveToPreviousToken(QTextCursor::MoveMode mode) const;
     QTextCursor moveToNextToken(QTextCursor::MoveMode mode) const;
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp
index 35206c2633b2b057df58f8e1b41c22315d4b9b51..addf5301f79b66f5421217ade1d2a4d0d6b15c57 100644
--- a/src/plugins/cpptools/cppcodecompletion.cpp
+++ b/src/plugins/cpptools/cppcodecompletion.cpp
@@ -434,12 +434,15 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
     //if (! expression.isEmpty())
         //qDebug() << "***** expression:" << expression;
 
-    if (Document::Ptr thisDocument = m_manager->document(fileName)) {
+    const Snapshot snapshot = m_manager->snapshot();
+
+    if (Document::Ptr thisDocument = snapshot.value(fileName)) {
         Symbol *symbol = thisDocument->findSymbolAt(line, column);
 
-        typeOfExpression.setDocuments(m_manager->documents());
+        typeOfExpression.setSnapshot(m_manager->snapshot());
 
-        QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol);
+        QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol,
+                                                                         TypeOfExpression::Preprocess);
         LookupContext context = typeOfExpression.lookupContext();
 
         if (!typeOfExpression.expressionAST() && (! m_completionOperator ||
@@ -963,8 +966,10 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
             if (Function *function = symbol->type()->asFunction()) {
                 // If the member is a function, automatically place the opening parenthesis,
                 // except when it might take template parameters.
-                if (!function->returnType().isValid()
-                    && (function->identity() && !function->identity()->isDestructorNameId())) {
+                const bool hasReturnType = function->returnType().isValid()  ||
+                                           function->returnType().isSigned() ||
+                                           function->returnType().isUnsigned();
+                if (! hasReturnType && (function->identity() && !function->identity()->isDestructorNameId())) {
                     // Don't insert any magic, since the user might have just wanted to select the class
 
                 } else if (function->templateParameterCount() != 0) {
@@ -1033,7 +1038,7 @@ void CppCodeCompletion::cleanup()
 
     // Set empty map in order to avoid referencing old versions of the documents
     // until the next completion
-    typeOfExpression.setDocuments(QMap<QString, Document::Ptr>());
+    typeOfExpression.setSnapshot(Snapshot());
 }
 
 int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor)
diff --git a/src/plugins/cpptools/cpphoverhandler.cpp b/src/plugins/cpptools/cpphoverhandler.cpp
index 338123bc5e65014c344cbad8a45ec98bda125c60..fab0d83b31fcc3d0c6c818857324e52cfd29fb19 100644
--- a/src/plugins/cpptools/cpphoverhandler.cpp
+++ b/src/plugins/cpptools/cpphoverhandler.cpp
@@ -165,9 +165,11 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
     QTextCursor tc(edit->document());
     tc.setPosition(pos);
 
+    const Snapshot documents = m_manager->snapshot();
+
     const int lineNumber = tc.block().blockNumber() + 1;
     const QString fileName = editor->file()->fileName();
-    Document::Ptr doc = m_manager->document(fileName);
+    Document::Ptr doc = documents.value(fileName);
     if (doc) {
         foreach (Document::DiagnosticMessage m, doc->diagnosticMessages()) {
             if (m.line() == lineNumber) {
@@ -177,6 +179,16 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
         }
     }
 
+    if (m_toolTip.isEmpty()) {
+        unsigned lineno = tc.blockNumber() + 1;
+        foreach (const Document::Include &incl, doc->includes()) {
+            if (lineno == incl.line()) {
+                m_toolTip = incl.fileName();
+                break;
+            }
+        }
+    }
+
     if (m_toolTip.isEmpty()) {
         // Move to the end of a qualified name
         bool stop = false;
@@ -202,7 +214,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
             Symbol *lastSymbol = doc->findSymbolAt(line, column);
 
             TypeOfExpression typeOfExpression;
-            typeOfExpression.setDocuments(m_manager->documents());
+            typeOfExpression.setSnapshot(documents);
             QList<TypeOfExpression::Result> types = typeOfExpression(expression, doc, lastSymbol);
 
             if (!types.isEmpty()) {
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index 40888d99f3f770af4f6461e007a6230503ce0eb9..a02656ee8c96943d5e774970c2727a0cb53126e0 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -138,11 +138,12 @@ protected:
     virtual void stopExpandingMacro(unsigned offset, const Macro &macro);
     virtual void startSkippingBlocks(unsigned offset);
     virtual void stopSkippingBlocks(unsigned offset);
-    virtual void sourceNeeded(QString &fileName, IncludeType type);
+    virtual void sourceNeeded(QString &fileName, IncludeType type,
+                              unsigned line);
 
 private:
     QPointer<CppModelManager> m_modelManager;
-    CppModelManager::DocumentTable m_documents;
+    Snapshot m_snapshot;
     Environment env;
     pp m_proc;
     QStringList m_includePaths;
@@ -159,7 +160,7 @@ private:
 
 CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
     : m_modelManager(modelManager),
-    m_documents(modelManager->documents()),
+    m_snapshot(modelManager->snapshot()),
     m_proc(this, env)
 { }
 
@@ -176,7 +177,7 @@ void CppPreprocessor::setProjectFiles(const QStringList &files)
 { m_projectFiles = files; }
 
 void CppPreprocessor::run(QString &fileName)
-{ sourceNeeded(fileName, IncludeGlobal); }
+{ sourceNeeded(fileName, IncludeGlobal, /*line = */ 0); }
 
 void CppPreprocessor::operator()(QString &fileName)
 { run(fileName); }
@@ -339,7 +340,7 @@ void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *process
     processed->insert(fn);
 
     foreach (QString includedFile, doc->includedFiles()) {
-        mergeEnvironment(m_documents.value(includedFile), processed);
+        mergeEnvironment(m_snapshot.value(includedFile), processed);
     }
 
     foreach (const Macro macro, doc->definedMacros()) {
@@ -361,7 +362,8 @@ void CppPreprocessor::stopSkippingBlocks(unsigned offset)
         m_currentDoc->stopSkippingBlocks(offset);
 }
 
-void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
+void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
+                                   unsigned line)
 {
     if (fileName.isEmpty())
         return;
@@ -369,7 +371,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
     QByteArray contents = tryIncludeFile(fileName, type);
 
     if (m_currentDoc) {
-        m_currentDoc->addIncludeFile(fileName);
+        m_currentDoc->addIncludeFile(fileName, line);
         if (contents.isEmpty() && ! QFileInfo(fileName).isAbsolute()) {
             QString msg;
             msg += fileName;
@@ -384,7 +386,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
     }
 
     if (! contents.isEmpty()) {
-        Document::Ptr cachedDoc = m_documents.value(fileName);
+        Document::Ptr cachedDoc = m_snapshot.value(fileName);
         if (cachedDoc && m_currentDoc) {
             mergeEnvironment(cachedDoc);
         } else {
@@ -475,11 +477,8 @@ CppModelManager::CppModelManager(QObject *parent) :
 CppModelManager::~CppModelManager()
 { }
 
-Document::Ptr CppModelManager::document(const QString &fileName) const
-{ return m_documents.value(fileName); }
-
-CppModelManager::DocumentTable CppModelManager::documents() const
-{ return m_documents; }
+Snapshot CppModelManager::snapshot() const
+{ return m_snapshot; }
 
 void CppModelManager::ensureUpdated()
 {
@@ -670,7 +669,7 @@ void CppModelManager::emitDocumentUpdated(Document::Ptr doc)
 void CppModelManager::onDocumentUpdated(Document::Ptr doc)
 {
     const QString fileName = doc->fileName();
-    m_documents[fileName] = doc;
+    m_snapshot[fileName] = doc;
     QList<Core::IEditor *> openedEditors = m_core->editorManager()->openedEditors();
     foreach (Core::IEditor *editor, openedEditors) {
         if (editor->file()->fileName() == fileName) {
@@ -835,7 +834,7 @@ void CppModelManager::parse(QFutureInterface<void> &future,
 
 void CppModelManager::GC()
 {
-    DocumentTable documents = m_documents;
+    Snapshot documents = m_snapshot;
 
     QSet<QString> processed;
     QStringList todo = projectFiles();
@@ -866,7 +865,7 @@ void CppModelManager::GC()
     }
 
     emit aboutToRemoveFiles(removedFiles);
-    m_documents = documents;
+    m_snapshot = documents;
 }
 
 
diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h
index 3b2f4e19993248a6e31c124c902568ed89947d9d..25947056203929e7fac1e17096525b8f402dd64b 100644
--- a/src/plugins/cpptools/cppmodelmanager.h
+++ b/src/plugins/cpptools/cppmodelmanager.h
@@ -76,8 +76,7 @@ public:
     virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
     virtual void updateProjectInfo(const ProjectInfo &pinfo);
 
-    virtual CPlusPlus::Document::Ptr document(const QString &fileName) const;
-    virtual DocumentTable documents() const;
+    virtual CPlusPlus::Snapshot snapshot() const;
     virtual void GC();
 
     QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
@@ -146,7 +145,7 @@ private:
     Core::ICore *m_core;
     ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
     CppHoverHandler *m_hoverHandler;
-    DocumentTable m_documents;
+    CPlusPlus::Snapshot m_snapshot;
 
     // cache
     bool m_dirty;
diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h
index e3ad4fe961be962f93cf30f3f7745ca055b8faa0..6dc0da67ca0b90cac3a9abec535fbac23f676def 100644
--- a/src/plugins/cpptools/cppmodelmanagerinterface.h
+++ b/src/plugins/cpptools/cppmodelmanagerinterface.h
@@ -46,14 +46,11 @@ namespace ProjectExplorer {
 
 namespace CppTools {
 
-class CPPTOOLS_EXPORT CppModelManagerInterface
-        : public QObject
+class CPPTOOLS_EXPORT CppModelManagerInterface: public QObject
 {
     Q_OBJECT
 
 public:
-    typedef QMap<QString, CPlusPlus::Document::Ptr> DocumentTable; // ### remove me
-
     class ProjectInfo
     {
     public:
@@ -89,8 +86,7 @@ public:
     virtual void GC() = 0;
     virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
 
-    virtual CPlusPlus::Document::Ptr document(const QString &fileName) const = 0;
-    virtual DocumentTable documents() const = 0;
+    virtual CPlusPlus::Snapshot snapshot() const = 0;
 
     virtual QList<ProjectInfo> projectInfos() const = 0;
     virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro
index 74112379e3904c195bdc5431077e08c6ec32a9b2..170f62b5bf19f348f34f5474fd6d2d5e47ab7216 100644
--- a/src/plugins/cpptools/cpptools.pro
+++ b/src/plugins/cpptools/cpptools.pro
@@ -6,7 +6,6 @@ include(cpptools_dependencies.pri)
 
 # DEFINES += QT_NO_CAST_FROM_ASCII
 DEFINES += QT_NO_CAST_TO_ASCII
-unix:QMAKE_CXXFLAGS_DEBUG += -O3
 INCLUDEPATH += .
 DEFINES += CPPTOOLS_LIBRARY
 CONFIG += help
diff --git a/src/plugins/cpptools/searchsymbols.h b/src/plugins/cpptools/searchsymbols.h
index 4997e5cf049bb72d9512c56191bf2d4d0728abcd..494455f6d85ad2e7796cd5bd32cf41b554890859 100644
--- a/src/plugins/cpptools/searchsymbols.h
+++ b/src/plugins/cpptools/searchsymbols.h
@@ -43,6 +43,7 @@
 #include <QIcon>
 #include <QMetaType>
 #include <QString>
+#include <QSet>
 
 #include <functional>
 
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index 3d67e19c6aae2337f008e5416c5d18d99ba5c729..7308fb441c2da8c38ec4cd3d69599896bd44843e 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -58,7 +58,6 @@ SOURCES += attachexternaldialog.cpp \
     gdbengine.cpp \
     gdbmi.cpp \
     gdboptionpage.cpp \
-    gdbtypemacros.cpp \
     gdbengine.h \
     moduleshandler.cpp \
     moduleswindow.cpp \
@@ -79,7 +78,6 @@ FORMS += attachexternaldialog.ui \
     breakcondition.ui \
     mode.ui \
     gdboptionpage.ui \
-    gdbtypemacros.ui \
     startexternaldialog.ui \
 
 RESOURCES += debugger.qrc
diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp
index a01a3ddc57e0d81e136e2945c7bdc8ed5e520ad7..4981f199790ee9a70885b03028a7d0dfbbeb2e6f 100644
--- a/src/plugins/debugger/debuggermanager.cpp
+++ b/src/plugins/debugger/debuggermanager.cpp
@@ -1033,7 +1033,6 @@ void DebuggerManager::addToWatchWindow()
 void DebuggerManager::watchExpression(const QString &expression)
 {
     watchHandler()->watchExpression(expression);
-    //engine()->updateWatchModel();
 }
 
 void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber)
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 37406f70cc1a6678e9506c75d320adea5711d544..d9217069c6849858e9737a54d2f20a7f6b3394df 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -183,7 +183,6 @@ DebuggerPlugin::DebuggerPlugin()
 {
     m_pm = 0;
     m_generalOptionPage = 0;
-    m_typeMacroPage = 0;
     m_locationMark = 0;
     m_manager = 0;
 }
@@ -202,7 +201,6 @@ void DebuggerPlugin::shutdown()
     //qDebug() << "DebuggerPlugin::~DebuggerPlugin";
     removeObject(m_debugMode);
     removeObject(m_generalOptionPage);
-    removeObject(m_typeMacroPage);
 
     // FIXME: when using the line below, BreakWindow etc gets deleted twice.
     // so better leak for now...
@@ -212,9 +210,6 @@ void DebuggerPlugin::shutdown()
     delete m_generalOptionPage;
     m_generalOptionPage = 0;
 
-    delete m_typeMacroPage;
-    m_typeMacroPage = 0;
-
     delete m_locationMark;
     m_locationMark = 0;
 
@@ -409,13 +404,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
     mdebug->addAction(cmd);
 
     m_generalOptionPage = 0;
-    m_typeMacroPage = 0;
 
     // FIXME:
     m_generalOptionPage = new GdbOptionPage(&theGdbSettings());
     addObject(m_generalOptionPage);
-    m_typeMacroPage = new TypeMacroPage(&theGdbSettings());
-    addObject(m_typeMacroPage);
 
     m_locationMark = 0;
 
diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h
index 91ffe4dbf770a43fa839f9d27e4c49818c373d2a..ebf12b5e12331b2fdb1827ec3252299b19ffe0e8 100644
--- a/src/plugins/debugger/debuggerplugin.h
+++ b/src/plugins/debugger/debuggerplugin.h
@@ -54,7 +54,6 @@ namespace Internal {
 class DebuggerManager;
 class DebugMode;
 class GdbOptionPage;
-class TypeMacroPage;
 class LocationMark;
 
 class DebuggerPlugin : public ExtensionSystem::IPlugin
@@ -103,7 +102,6 @@ private:
 
     ExtensionSystem::PluginManager *m_pm;
     GdbOptionPage *m_generalOptionPage;
-    TypeMacroPage *m_typeMacroPage;
 
     QString m_previousMode;
     LocationMark *m_locationMark;
diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp
index d7ac5b1aaa1b4897e1c51bcdcb415aefc75ec271..83473674782dd90e230b7cde2cfdbb2b487dbd15 100644
--- a/src/plugins/debugger/gdbengine.cpp
+++ b/src/plugins/debugger/gdbengine.cpp
@@ -2939,6 +2939,8 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
             if (tmplate == "QSet")
                 return true;
         }
+        if (tmplate == "std::list")
+            return true;
         if (tmplate == "std::vector" && inner != "bool")
             return true;
         if (tmplate == "std::basic_string") {
diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h
index 56106a7524468e7270340462f80df9e1a88a02ff..6b3cbb15fee9b0883386513d048939d8d7fe9b7b 100644
--- a/src/plugins/debugger/gdbengine.h
+++ b/src/plugins/debugger/gdbengine.h
@@ -80,7 +80,7 @@ enum DataDumperState
     DataDumperUnavailable,
 };
 
-// FIXME: Move to extra file?
+
 class GdbSettings
 {
 public:
diff --git a/src/plugins/debugger/gdboptionpage.cpp b/src/plugins/debugger/gdboptionpage.cpp
index e05b811889abf12094d267a823b45f70716a9ed9..7d6742e95827c328349ff1c0c4dc1bd78b3a9a68 100644
--- a/src/plugins/debugger/gdboptionpage.cpp
+++ b/src/plugins/debugger/gdboptionpage.cpp
@@ -58,7 +58,11 @@ GdbOptionPage::GdbOptionPage(GdbSettings *settings)
 #if defined(Q_OS_WIN32)
     defaultCommand.append(".exe");
 #endif
+    QString defaultScript = coreIFace->resourcePath() +
+        QLatin1String("/gdb/qt4macros");
+
     m_settings->m_gdbCmd   = s->value("Location", defaultCommand).toString();
+    m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString();
     m_settings->m_gdbEnv   = s->value("Environment", "").toString();
     m_settings->m_autoRun  = s->value("AutoRun", true).toBool();
     m_settings->m_autoQuit = s->value("AutoQuit", true).toBool();
@@ -72,36 +76,50 @@ QString GdbOptionPage::name() const
 
 QString GdbOptionPage::category() const
 {
-    return "Debugger|Gdb";
+    return "Debugger";
 }
 
 QString GdbOptionPage::trCategory() const
 {
-    return tr("Debugger|Gdb");
+    return tr("Debugger");
 }
 
 QWidget *GdbOptionPage::createPage(QWidget *parent)
 {
     QWidget *w = new QWidget(parent);
     m_ui.setupUi(w);
-    m_ui.gdbEdit->setText(m_settings->m_gdbCmd);
-    m_ui.envEdit->setText(m_settings->m_gdbEnv);
+    m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command);
+    m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location"));
+    m_ui.gdbLocationChooser->setPath(m_settings->m_gdbCmd);
+    m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File);
+    m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File"));
+    m_ui.scriptFileChooser->setPath(m_settings->m_scriptFile);
+    m_ui.environmentEdit->setText(m_settings->m_gdbEnv);
     m_ui.autoStartBox->setChecked(m_settings->m_autoRun);
     m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit);
-    connect(m_ui.pushButtonBrowse, SIGNAL(clicked()),
-        this, SLOT(browse()));
+
+    // FIXME
+    m_ui.autoStartBox->hide();
+    m_ui.autoQuitBox->hide();
+    m_ui.environmentEdit->hide();
+    m_ui.labelEnvironment->hide();
+
+    connect(m_ui.gdbLocationChooser, SIGNAL(changed()),
+        this, SLOT(onGdbLocationChanged()));
+    connect(m_ui.scriptFileChooser, SIGNAL(changed()),
+        this, SLOT(onScriptFileChanged()));
 
     return w;
 }
 
-void GdbOptionPage::browse()
+void GdbOptionPage::onGdbLocationChanged()
 {
-    QString fileName = QFileDialog::getOpenFileName(m_ui.pushButtonBrowse,
-            "Browse for gdb executable");
-    if (fileName.isEmpty())
-        return;
-    m_settings->m_gdbCmd = fileName;
-    m_ui.gdbEdit->setText(fileName);
+    m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
+}
+
+void GdbOptionPage::onScriptFileChanged()
+{
+    m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
 }
 
 void GdbOptionPage::finished(bool accepted)
@@ -109,10 +127,11 @@ void GdbOptionPage::finished(bool accepted)
     if (!accepted)
         return;
 
-    m_settings->m_gdbCmd   = m_ui.gdbEdit->text();
-    m_settings->m_gdbEnv   = m_ui.envEdit->text();
+    m_settings->m_gdbCmd   = m_ui.gdbLocationChooser->path();
+    m_settings->m_gdbEnv   = m_ui.environmentEdit->text();
     m_settings->m_autoRun  = m_ui.autoStartBox->isChecked();
     m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked();
+    m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
 
     Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
     if (!coreIFace || !coreIFace->settings())
diff --git a/src/plugins/debugger/gdboptionpage.h b/src/plugins/debugger/gdboptionpage.h
index 1d71024bac1b7ef923b9ce577041c0b0266055b8..d306e03e20f72b5b30fc8a4e103cc56b2466d94c 100644
--- a/src/plugins/debugger/gdboptionpage.h
+++ b/src/plugins/debugger/gdboptionpage.h
@@ -35,7 +35,6 @@
 #define GDBOPTIONPAGE_H
 
 #include "ui_gdboptionpage.h"
-#include "ui_gdbtypemacros.h"
 
 #include <coreplugin/dialogs/ioptionspage.h>
 
@@ -63,7 +62,8 @@ public:
     void finished(bool accepted);
 
 public slots:
-    void browse();
+    void onGdbLocationChanged();
+    void onScriptFileChanged();
 
 private:
     ExtensionSystem::PluginManager *m_pm;
@@ -72,6 +72,7 @@ private:
     GdbSettings *m_settings;
 };
 
+#if 0
 class TypeMacroPage : public Core::IOptionsPage
 {
     Q_OBJECT
@@ -87,7 +88,6 @@ public:
     void finished(bool accepted);
 
 private slots:
-    void onScriptButton();
     void onAddButton();
     void onDelButton();
     void currentItemChanged(QTreeWidgetItem *item);
@@ -100,6 +100,7 @@ private:
     GdbSettings *m_settings;
     QWidget *m_widget;
 };
+#endif
 
 } // namespace Internal
 } // namespace Debugger
diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui
index 4b58d5d7140061767fd2ce58a05c3fe1bec6f59c..580f13c0d660ebce063942c822c4d357ec9c6ed3 100644
--- a/src/plugins/debugger/gdboptionpage.ui
+++ b/src/plugins/debugger/gdboptionpage.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>433</width>
-    <height>216</height>
+    <height>233</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -23,7 +23,7 @@
    <item>
     <widget class="QGroupBox" name="groupBox">
      <property name="title">
-      <string>Gdb Debug Options</string>
+      <string>Locations</string>
      </property>
      <layout class="QGridLayout">
       <property name="margin">
@@ -32,46 +32,45 @@
       <property name="spacing">
        <number>6</number>
       </property>
-      <item row="0" column="1">
-       <widget class="QLineEdit" name="gdbEdit"/>
-      </item>
-      <item row="1" column="1" colspan="2">
-       <widget class="QLineEdit" name="envEdit"/>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="environmentEdit"/>
       </item>
       <item row="0" column="0">
-       <widget class="QLabel" name="label">
+       <widget class="QLabel" name="labelGdbLocaltion">
+        <property name="toolTip">
+         <string>This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH.</string>
+        </property>
         <property name="text">
          <string>Gdb Location:</string>
         </property>
-        <property name="buddy">
-         <cstring>gdbEdit</cstring>
-        </property>
        </widget>
       </item>
       <item row="1" column="0">
-       <widget class="QLabel" name="label_2">
+       <widget class="QLabel" name="labelEnvironment">
         <property name="text">
          <string>Environment:</string>
         </property>
         <property name="buddy">
-         <cstring>envEdit</cstring>
+         <cstring>environmentEdit</cstring>
         </property>
        </widget>
       </item>
-      <item row="0" column="2">
-       <widget class="QPushButton" name="pushButtonBrowse">
-        <property name="text">
-         <string/>
+      <item row="2" column="0">
+       <widget class="QLabel" name="labelGdbStartupScript">
+        <property name="toolTip">
+         <string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string>
         </property>
-        <property name="icon">
-         <iconset resource="../coreplugin/core.qrc">
-          <normaloff>:/qworkbench/images/fileopen.png</normaloff>:/qworkbench/images/fileopen.png</iconset>
-        </property>
-        <property name="checkable">
-         <bool>false</bool>
+        <property name="text">
+         <string>Gdb Startup Script:</string>
         </property>
        </widget>
       </item>
+      <item row="2" column="1">
+       <widget class="Core::Utils::PathChooser" name="scriptFileChooser" native="true"/>
+      </item>
+      <item row="0" column="1">
+       <widget class="Core::Utils::PathChooser" name="gdbLocationChooser" native="true"/>
+      </item>
      </layout>
     </widget>
    </item>
@@ -104,6 +103,14 @@
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>Core::Utils::PathChooser</class>
+   <extends>QWidget</extends>
+   <header location="global">utils/pathchooser.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources>
   <include location="../coreplugin/core.qrc"/>
  </resources>
diff --git a/src/plugins/debugger/gdbtypemacros.cpp b/src/plugins/debugger/gdbtypemacros.cpp
index 8610d01e39d87c2c9a64ff84cbf1389a74fc11bd..89178af268f09a142239f93ebde64d76ea1c9b1d 100644
--- a/src/plugins/debugger/gdbtypemacros.cpp
+++ b/src/plugins/debugger/gdbtypemacros.cpp
@@ -109,6 +109,8 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
 
     m_widget = new QWidget(parent);
     m_ui.setupUi(m_widget);
+    m_ui.scriptFile->setPromptDialogTitle(tr("Select Gdb Script"));
+    m_ui.scriptFile->setExpectedKind(Core::Utils::PathChooser::File);
 
     connect(m_ui.addButton, SIGNAL(clicked()),
         this, SLOT(onAddButton()));
@@ -116,8 +118,8 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
     connect(m_ui.delButton, SIGNAL(clicked()),
         this, SLOT(onDelButton()));
 
-    connect(m_ui.scriptButton, SIGNAL(clicked()),
-        this, SLOT(onScriptButton()));
+    connect(m_ui.scriptFile, SIGNAL(validChanged()),
+        this, SLOT(updateButtonState()));
 
     connect(m_ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
         this, SLOT(currentItemChanged(QTreeWidgetItem *)));
@@ -139,7 +141,7 @@ QWidget *TypeMacroPage::createPage(QWidget *parent)
         ++i;
     }
 
-    m_ui.scriptEdit->setText(m_settings->m_scriptFile);
+    m_ui.scriptFile->setPath(m_settings->m_scriptFile);
 
     updateButtonState();
 
@@ -152,7 +154,7 @@ void TypeMacroPage::finished(bool accepted)
 	return;
 
     m_settings->m_typeMacros.clear();
-    m_settings->m_scriptFile = m_ui.scriptEdit->text();
+    m_settings->m_scriptFile = m_ui.scriptFile->path();
 
     for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
         QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
@@ -172,13 +174,6 @@ void TypeMacroPage::finished(bool accepted)
     }
 }
 
-void TypeMacroPage::onScriptButton()
-{
-    QString fileName = QFileDialog::getOpenFileName(m_widget, tr("Select Gdb Script"));
-    m_ui.scriptEdit->setText(fileName);
-    updateButtonState();
-}
-
 void TypeMacroPage::onAddButton()
 {
     if (m_ui.typeEdit->text().isEmpty() || m_ui.macroEdit->text().isEmpty())
diff --git a/src/plugins/debugger/gdbtypemacros.ui b/src/plugins/debugger/gdbtypemacros.ui
index aa7215577b4d1728cd34c8ec26257c0f71c5f7cf..f42514e4e499eaae2255cffd59dd74ebfa4b803f 100644
--- a/src/plugins/debugger/gdbtypemacros.ui
+++ b/src/plugins/debugger/gdbtypemacros.ui
@@ -1,146 +1,115 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>TypeMacroPage</class>
- <widget class="QWidget" name="TypeMacroPage" >
-  <property name="geometry" >
+ <widget class="QWidget" name="TypeMacroPage">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>519</width>
-    <height>238</height>
+    <height>263</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
-   <property name="spacing" >
+  <layout class="QVBoxLayout">
+   <property name="spacing">
     <number>6</number>
    </property>
+   <property name="margin">
+    <number>9</number>
+   </property>
    <item>
-    <widget class="QGroupBox" name="groupBox" >
-     <property name="title" >
-      <string>Script File</string>
-     </property>
-     <layout class="QHBoxLayout" >
-      <property name="margin" >
-       <number>9</number>
-      </property>
-      <property name="spacing" >
-       <number>6</number>
-      </property>
-      <item>
-       <widget class="QLineEdit" name="scriptEdit" />
-      </item>
-      <item>
-       <widget class="QToolButton" name="scriptButton" >
-        <property name="minimumSize" >
-         <size>
-          <width>21</width>
-          <height>23</height>
-         </size>
-        </property>
-        <property name="text" >
-         <string>...</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <layout class="QGridLayout" >
-     <property name="margin" >
+    <layout class="QGridLayout">
+     <property name="margin">
       <number>0</number>
      </property>
-     <property name="spacing" >
+     <property name="spacing">
       <number>6</number>
      </property>
-     <item row="0" column="0" colspan="2" >
-      <widget class="QTreeWidget" name="treeWidget" >
-       <property name="rootIsDecorated" >
+     <item row="0" column="0" colspan="2">
+      <widget class="QTreeWidget" name="treeWidget">
+       <property name="rootIsDecorated">
         <bool>false</bool>
        </property>
        <column>
-        <property name="text" >
+        <property name="text">
          <string>Type</string>
         </property>
        </column>
        <column>
-        <property name="text" >
+        <property name="text">
          <string>Macro</string>
         </property>
        </column>
       </widget>
      </item>
-     <item row="1" column="2" >
-      <widget class="QToolButton" name="addButton" >
-       <property name="minimumSize" >
+     <item row="1" column="2">
+      <widget class="QToolButton" name="addButton">
+       <property name="minimumSize">
         <size>
          <width>21</width>
          <height>23</height>
         </size>
        </property>
-       <property name="text" >
+       <property name="text">
         <string>+</string>
        </property>
-       <property name="icon" >
-        <iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/newitem.png</iconset>
+       <property name="icon">
+        <iconset>
+         <normaloff>:/gdbdebugger/images/newitem.png</normaloff>:/gdbdebugger/images/newitem.png</iconset>
        </property>
       </widget>
      </item>
-     <item row="2" column="0" >
-      <widget class="QLabel" name="label_2" >
-       <property name="text" >
+     <item row="2" column="0">
+      <widget class="QLabel" name="label_2">
+       <property name="text">
         <string>Macro Name:</string>
        </property>
       </widget>
      </item>
-     <item row="3" column="0" >
-      <widget class="QLabel" name="label_3" >
-       <property name="text" >
+     <item row="3" column="0">
+      <widget class="QLabel" name="label_3">
+       <property name="text">
         <string>Parse as:</string>
        </property>
       </widget>
      </item>
-     <item row="2" column="1" >
-      <widget class="QLineEdit" name="macroEdit" />
+     <item row="2" column="1">
+      <widget class="QLineEdit" name="macroEdit"/>
      </item>
-     <item row="0" column="2" >
-      <layout class="QVBoxLayout" >
-       <property name="margin" >
+     <item row="0" column="2">
+      <layout class="QVBoxLayout">
+       <property name="spacing">
         <number>0</number>
        </property>
-       <property name="spacing" >
+       <property name="margin">
         <number>0</number>
        </property>
        <item>
-        <widget class="QToolButton" name="delButton" >
-         <property name="minimumSize" >
+        <widget class="QToolButton" name="delButton">
+         <property name="minimumSize">
           <size>
            <width>21</width>
            <height>23</height>
           </size>
          </property>
-         <property name="text" >
+         <property name="text">
           <string>-</string>
          </property>
-         <property name="icon" >
-          <iconset resource="gdbdebugger.qrc" >:/gdbdebugger/images/delete.png</iconset>
+         <property name="icon">
+          <iconset>
+           <normaloff>:/gdbdebugger/images/delete.png</normaloff>:/gdbdebugger/images/delete.png</iconset>
          </property>
         </widget>
        </item>
        <item>
         <spacer>
-         <property name="orientation" >
+         <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeHint" >
+         <property name="sizeHint" stdset="0">
           <size>
            <width>20</width>
            <height>40</height>
@@ -150,25 +119,25 @@
        </item>
       </layout>
      </item>
-     <item row="1" column="1" >
-      <widget class="QLineEdit" name="typeEdit" />
+     <item row="1" column="1">
+      <widget class="QLineEdit" name="typeEdit"/>
      </item>
-     <item row="1" column="0" >
-      <widget class="QLabel" name="label" >
-       <property name="text" >
+     <item row="1" column="0">
+      <widget class="QLabel" name="label">
+       <property name="text">
         <string>Type:</string>
        </property>
       </widget>
      </item>
-     <item row="3" column="1" >
-      <widget class="QComboBox" name="parseAsBox" >
+     <item row="3" column="1">
+      <widget class="QComboBox" name="parseAsBox">
        <item>
-        <property name="text" >
+        <property name="text">
          <string>ASCII (char *)</string>
         </property>
        </item>
        <item>
-        <property name="text" >
+        <property name="text">
          <string>Unicode (short)</string>
         </property>
        </item>
@@ -178,9 +147,8 @@
    </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
  <resources>
-  <include location="gdbdebugger.qrc" />
+  <include location="gdbdebugger.qrc"/>
  </resources>
  <connections/>
 </ui>
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 053fcadcd199ea8915dc09342b8b9d4462239ec7..5328a171aeaedd75001076214e245c9bba072e27 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -402,18 +402,41 @@ bool WatchHandler::setData(const QModelIndex &idx,
 static QString niceType(QString type)
 {
     if (type.contains("std::")) {
-        static QRegExp re("std::vector<(.*)\\s*,std::allocator<(.*)>\\s*>");
-        re.setMinimal(true);
-
+        // std::string
         type.replace("std::basic_string<char, std::char_traits<char>, "
                      "std::allocator<char> >", "std::string");
+
+        // std::wstring
         type.replace("std::basic_string<wchar_t, std::char_traits<wchar_t>, "
                      "std::allocator<wchar_t> >", "std::wstring");
 
+        // std::vector
+        static QRegExp re1("std::vector<(.*), std::allocator<(.*)>\\s*>");
+        re1.setMinimal(true);
+        for (int i = 0; i != 10; ++i) {
+            if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2)) 
+                break;
+            type.replace(re1.cap(0), "std::vector<" + re1.cap(1) + ">");
+        }
+
+        // std::list
+        static QRegExp re2("std::list<(.*), std::allocator<(.*)>\\s*>");
+        re2.setMinimal(true);
         for (int i = 0; i != 10; ++i) {
-            if (re.indexIn(type) == -1 || re.cap(1) != re.cap(2)) 
+            if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2)) 
                 break;
-            type.replace(re.cap(0), "std::vector<" + re.cap(1) + ">");
+            type.replace(re2.cap(0), "std::list<" + re2.cap(1) + ">");
+        }
+
+        // std::map
+        static QRegExp re3("std::map<(.*), (.*), std::less<(.*)\\s*>, "
+            "std::allocator<std::pair<const (.*), (.*)\\s*> > >");
+        re3.setMinimal(true);
+        for (int i = 0; i != 10; ++i) {
+            if (re3.indexIn(type) == -1 || re3.cap(1) != re3.cap(3)
+                || re3.cap(1) != re3.cap(4) || re3.cap(2) != re3.cap(5)) 
+                break;
+            type.replace(re3.cap(0), "std::map<" + re3.cap(1) + ", " + re3.cap(2) + ">");
         }
 
         type.replace(" >", ">");
@@ -865,9 +888,9 @@ void WatchHandler::watchExpression(const QString &exp)
     data.name = exp;
     data.iname = "watch." + exp;
     insertData(data);
+    emit watchModelUpdateRequested();
 }
 
-
 void WatchHandler::setDisplayedIName(const QString &iname, bool on)
 {
     WatchData *d = findData(iname);
diff --git a/src/plugins/designer/workbenchintegration.cpp b/src/plugins/designer/workbenchintegration.cpp
index cc6f5afb7d61e77b745ba8117c1211aa293a8b19..590ff14cf6e5acce558c8ffb5d7ac107cebf086b 100644
--- a/src/plugins/designer/workbenchintegration.cpp
+++ b/src/plugins/designer/workbenchintegration.cpp
@@ -95,7 +95,7 @@ static QList<Document::Ptr> findDocumentsIncluding(const QString &fileName, bool
 
     QList<Document::Ptr> docList;
     // take all docs
-    CppTools::CppModelManagerInterface::DocumentTable docTable = cppModelManager->documents();
+    CPlusPlus::Snapshot docTable = cppModelManager->snapshot();
     foreach (Document::Ptr doc, docTable) { // we go through all documents
         QStringList includes = doc->includedFiles();
         foreach (QString include, includes) {
@@ -286,7 +286,7 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
     QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
     LookupContext context(&control);
 
-    const QMap<QString, Document::Ptr> documents = cppModelManager->documents();
+    const Snapshot documents = cppModelManager->snapshot();
     foreach (Document::Ptr doc, documents) {
         QList<Scope *> visibleScopes;
         visibleScopes.append(doc->globalSymbols());
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index ff0cdbde5e40ca31e081f0f0bb58aae6e39d5eca..466307b4de39cd1c6fbe27979e56cda4ebe90ca1 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -197,7 +197,7 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &fileNam
     const QString title = tr("Git Diff");
 
     VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDirectory, true, "originalFileName", workingDirectory);
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
+    executeGit(workingDirectory, arguments, editor);
 
 }
 
@@ -215,14 +215,14 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
     const QString sourceFile = source(workingDirectory, fileName);
 
     VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "originalFileName", sourceFile);
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
+    executeGit(workingDirectory, arguments, editor);
 }
 
 void GitClient::status(const QString &workingDirectory)
 {
     QStringList statusArgs(QLatin1String("status"));
     statusArgs << QLatin1String("-u");
-    executeGit(workingDirectory, statusArgs, m_plugin->outputWindow(), 0,true);
+    executeGit(workingDirectory, statusArgs, 0, true);
 }
 
 void GitClient::log(const QString &workingDirectory, const QString &fileName)
@@ -242,7 +242,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName)
     const QString kind = QLatin1String(Git::Constants::GIT_LOG_EDITOR_KIND);
     const QString sourceFile = source(workingDirectory, fileName);
     VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, false, "logFileName", sourceFile);
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
+    executeGit(workingDirectory, arguments, editor);
 }
 
 void GitClient::show(const QString &source, const QString &id)
@@ -258,7 +258,7 @@ void GitClient::show(const QString &source, const QString &id)
 
     const QFileInfo sourceFi(source);
     const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
-    executeGit(workDir, arguments, m_plugin->outputWindow(), editor);
+    executeGit(workDir, arguments, editor);
 }
 
 void GitClient::blame(const QString &workingDirectory, const QString &fileName)
@@ -273,7 +273,7 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName)
     const QString sourceFile = source(workingDirectory, fileName);
 
     VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "blameFileName", sourceFile);
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
+    executeGit(workingDirectory, arguments, editor);
 }
 
 void GitClient::checkout(const QString &workingDirectory, const QString &fileName)
@@ -287,7 +287,7 @@ void GitClient::checkout(const QString &workingDirectory, const QString &fileNam
     arguments << QLatin1String("checkout") << QLatin1String("HEAD") << QLatin1String("--")
             << fileName;
 
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
+    executeGit(workingDirectory, arguments, 0, true);
 }
 
 void GitClient::hardReset(const QString &workingDirectory, const QString &commit)
@@ -297,7 +297,7 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit
     if (!commit.isEmpty())
         arguments << commit;
 
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
+    executeGit(workingDirectory, arguments, 0, true);
 }
 
 void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
@@ -305,7 +305,7 @@ void GitClient::addFile(const QString &workingDirectory, const QString &fileName
     QStringList arguments;
     arguments << QLatin1String("add") << fileName;
 
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
+    executeGit(workingDirectory, arguments, 0, true);
 }
 
 bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
@@ -380,13 +380,14 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
 }
 
 void GitClient::executeGit(const QString &workingDirectory, const QStringList &arguments,
-                           GitOutputWindow *outputWindow, VCSBase::VCSBaseEditor* editor,
+                           VCSBase::VCSBaseEditor* editor,
                            bool outputToWindow)
 {
     if (Git::Constants::debug)
         qDebug() << "executeGit" << workingDirectory << arguments << editor;
 
-    m_plugin->outputWindow()->append(formatCommand(QLatin1String(kGitCommand), arguments));
+    GitOutputWindow *outputWindow = m_plugin->outputWindow();
+    outputWindow->append(formatCommand(QLatin1String(kGitCommand), arguments));
 
     QProcess process;
     ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment();
@@ -396,8 +397,13 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
 
     GitCommand* command = new GitCommand();
     if (outputToWindow) {
-        connect(command, SIGNAL(outputText(QString)), outputWindow, SLOT(append(QString)));
-        connect(command, SIGNAL(outputData(QByteArray)), outputWindow, SLOT(appendData(QByteArray)));
+        if (!editor) { // assume that the commands output is the important thing
+            connect(command, SIGNAL(outputText(QString)), this, SLOT(appendAndPopup(QString)));
+            connect(command, SIGNAL(outputData(QByteArray)), this, SLOT(appendDataAndPopup(QByteArray)));
+        } else {
+            connect(command, SIGNAL(outputText(QString)), outputWindow, SLOT(append(QString)));
+            connect(command, SIGNAL(outputData(QByteArray)), outputWindow, SLOT(appendData(QByteArray)));
+        }
     } else {
         QTC_ASSERT(editor, /**/);
         connect(command, SIGNAL(outputText(QString)), editor, SLOT(setPlainText(QString)));
@@ -405,11 +411,23 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
     }
 
     if (outputWindow)
-        connect(command, SIGNAL(errorText(QString)), outputWindow, SLOT(append(QString)));
+        connect(command, SIGNAL(errorText(QString)), this, SLOT(appendAndPopup(QString)));
 
     command->execute(arguments, workingDirectory, environment);
 }
 
+void GitClient::appendDataAndPopup(const QByteArray &data)
+{
+    m_plugin->outputWindow()->appendData(data);
+    m_plugin->outputWindow()->popup(false);
+}
+
+void GitClient::appendAndPopup(const QString &text)
+{
+    m_plugin->outputWindow()->append(text);
+    m_plugin->outputWindow()->popup(false);
+}
+
 bool GitClient::synchronousGit(const QString &workingDirectory,
                                const QStringList &arguments,
                                QByteArray* outputText,
@@ -810,12 +828,12 @@ void GitClient::revert(const QStringList &files)
 
 void GitClient::pull(const QString &workingDirectory)
 {
-    executeGit(workingDirectory, QStringList(QLatin1String("pull")), m_plugin->outputWindow(), 0, true);
+    executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true);
 }
 
 void GitClient::push(const QString &workingDirectory)
 {
-    executeGit(workingDirectory, QStringList(QLatin1String("push")), m_plugin->outputWindow(), 0, true);
+    executeGit(workingDirectory, QStringList(QLatin1String("push")), 0, true);
 }
 
 QString GitClient::msgNoChangedFiles()
@@ -829,7 +847,7 @@ void GitClient::stash(const QString &workingDirectory)
     QString errorMessage;
     switch (gitStatus(workingDirectory, false, 0, &errorMessage)) {
     case  StatusChanged:
-        executeGit(workingDirectory, QStringList(QLatin1String("stash")), m_plugin->outputWindow(), 0, true);
+        executeGit(workingDirectory, QStringList(QLatin1String("stash")), 0, true);
         break;
     case StatusUnchanged:
         m_plugin->outputWindow()->append(msgNoChangedFiles());
@@ -846,21 +864,21 @@ void GitClient::stashPop(const QString &workingDirectory)
 {
     QStringList arguments(QLatin1String("stash"));
     arguments << QLatin1String("pop");
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
+    executeGit(workingDirectory, arguments, 0, true);
 }
 
 void GitClient::branchList(const QString &workingDirectory)
 {
     QStringList arguments(QLatin1String("branch"));
     arguments << QLatin1String("-r");
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
+    executeGit(workingDirectory, arguments, 0, true);
 }
 
 void GitClient::stashList(const QString &workingDirectory)
 {
     QStringList arguments(QLatin1String("stash"));
     arguments << QLatin1String("list");
-    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
+    executeGit(workingDirectory, arguments, 0, true);
 }
 
 QString GitClient::readConfig(const QString &workingDirectory, const QStringList &configVar)
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index efc767e54095e98e8be96022f1bd5ed04cf4989f..eb42b27efcb65501de3c8618713c1103e6b0b9a7 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -130,6 +130,10 @@ public:
 public slots:
     void show(const QString &source, const QString &id);
 
+private slots:
+    void appendAndPopup(const QString &text);
+    void appendDataAndPopup(const QByteArray &data);
+
 private:
     VCSBase::VCSBaseEditor *createVCSEditor(const QString &kind,
                                                  QString title,
@@ -141,7 +145,6 @@ private:
 
     void executeGit(const QString &workingDirectory,
                                            const QStringList &arguments,
-                                           GitOutputWindow *outputWindow,
                                            VCSBase::VCSBaseEditor* editor = 0,
                                            bool outputToWindow = false);
 
diff --git a/src/plugins/git/gitoutputwindow.cpp b/src/plugins/git/gitoutputwindow.cpp
index 375be9095973414a65bf715b3c2c38e7a394ffd0..fbaed2c8413f8118379458bf37cdbb955da9b7e6 100644
--- a/src/plugins/git/gitoutputwindow.cpp
+++ b/src/plugins/git/gitoutputwindow.cpp
@@ -105,7 +105,6 @@ void GitOutputWindow::append(const QString &text)
     foreach (const QString &s, lines)
         m_outputListWidget->addItem(s);
     m_outputListWidget->scrollToBottom();
-    popup();
 }
 
 void GitOutputWindow::setData(const QByteArray &data)
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index d9187f542a9852f7e04bea63f428dcf4e108fd20..f7647fb2d1a83f6a98464e66d2d62e5e4462d3da 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -496,7 +496,7 @@ QString GitPlugin::getWorkingDirectory()
     if (workingDirectory.isEmpty()) {
         m_outputWindow->clearContents();
         m_outputWindow->append(tr("Could not find working directory"));
-        m_outputWindow->popup();
+        m_outputWindow->popup(false);
         return QString();
     }
     return workingDirectory;
@@ -612,6 +612,7 @@ void GitPlugin::startCommit()
     changeTmpFile->setAutoRemove(true);
     if (!changeTmpFile->open()) {
         m_outputWindow->append(tr("Cannot create temporary file: %1").arg(changeTmpFile->errorString()));
+        m_outputWindow->popup(false);
         delete changeTmpFile;
         return;
     }
diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp
index e1b14cb9ccc627c31fff00065d560f8f7fa7e31e..7f0581fc3c3a976775b4ffc7213de87dbe0cc13e 100644
--- a/src/plugins/git/settingspage.cpp
+++ b/src/plugins/git/settingspage.cpp
@@ -77,7 +77,7 @@ QString SettingsPage::name() const
     return tr("General");
 }
 
- QString SettingsPage::category() const
+QString SettingsPage::category() const
 {
     return QLatin1String("Git");
 }
diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui
index aa2337605b8bf95f21521e9e0fdb8fb790ace6d8..151608d03b01d3a8d77e2c725a86fe32bfddf70b 100644
--- a/src/plugins/git/settingspage.ui
+++ b/src/plugins/git/settingspage.ui
@@ -6,114 +6,97 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>436</width>
-    <height>186</height>
+    <width>389</width>
+    <height>183</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QHBoxLayout" name="horizontalLayout">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <layout class="QVBoxLayout" name="verticalLayout">
-     <item>
-      <widget class="QGroupBox" name="environmentGroupBox">
-       <property name="enabled">
-        <bool>true</bool>
-       </property>
-       <property name="title">
-        <string>Environment variables</string>
-       </property>
-       <property name="checkable">
-        <bool>true</bool>
-       </property>
-       <layout class="QFormLayout" name="formLayout">
-        <item row="0" column="0">
-         <widget class="QLabel" name="pathlabel">
-          <property name="text">
-           <string>PATH:</string>
-          </property>
-         </widget>
-        </item>
-        <item row="0" column="1">
-         <layout class="QHBoxLayout" name="horizontalLayout_2">
-          <item>
-           <widget class="QLineEdit" name="pathLineEdit"/>
-          </item>
-          <item>
-           <widget class="QPushButton" name="adoptButton">
-            <property name="text">
-             <string>From system</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item row="1" column="0">
-         <widget class="QLabel" name="noteLabel">
-          <property name="text">
-           <string>&lt;b&gt;Note:&lt;/b&gt;</string>
-          </property>
-         </widget>
+    <widget class="QGroupBox" name="environmentGroupBox">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
+     <property name="title">
+      <string>Environment variables</string>
+     </property>
+     <property name="checkable">
+      <bool>true</bool>
+     </property>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="pathlabel">
+        <property name="text">
+         <string>PATH:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QLineEdit" name="pathLineEdit"/>
         </item>
-        <item row="1" column="1">
-         <widget class="QLabel" name="noteFieldlabel">
+        <item>
+         <widget class="QPushButton" name="adoptButton">
           <property name="text">
-           <string>Git needs to find Perl in the environment as well.</string>
+           <string>From system</string>
           </property>
          </widget>
         </item>
        </layout>
-      </widget>
-     </item>
-     <item>
-      <layout class="QFormLayout" name="logFormLayout">
-       <property name="fieldGrowthPolicy">
-        <enum>QFormLayout::ExpandingFieldsGrow</enum>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="noteLabel">
+        <property name="text">
+         <string>&lt;b&gt;Note:&lt;/b&gt;</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLabel" name="noteFieldlabel">
+        <property name="text">
+         <string>Git needs to find Perl in the environment as well.</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <layout class="QFormLayout" name="logFormLayout">
+     <property name="fieldGrowthPolicy">
+      <enum>QFormLayout::ExpandingFieldsGrow</enum>
+     </property>
+     <item row="0" column="1">
+      <widget class="QSpinBox" name="logCountSpinBox">
+       <property name="toolTip">
+        <string>Note that huge amount of commits might take some time.</string>
        </property>
-       <item row="0" column="1">
-        <widget class="QSpinBox" name="logCountSpinBox">
-         <property name="toolTip">
-          <string>Note that huge amount of commits might take some time.</string>
-         </property>
-         <property name="maximum">
-          <number>1000</number>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="logCountLabel">
-         <property name="text">
-          <string>Log commit display count:</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </item>
-     <item>
-      <spacer name="verticalSpacer">
-       <property name="orientation">
-        <enum>Qt::Vertical</enum>
+       <property name="maximum">
+        <number>1000</number>
        </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>20</width>
-         <height>40</height>
-        </size>
+      </widget>
+     </item>
+     <item row="0" column="0">
+      <widget class="QLabel" name="logCountLabel">
+       <property name="text">
+        <string>Log commit display count:</string>
        </property>
-      </spacer>
+      </widget>
      </item>
     </layout>
    </item>
    <item>
-    <spacer name="horizontalSpacer">
+    <spacer name="verticalSpacer">
      <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>40</width>
-       <height>20</height>
+       <width>20</width>
+       <height>40</height>
       </size>
      </property>
     </spacer>
diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp
index e5a2e7026508cad620caa7cfb81af625a137f3ff..de4f851e5cef4bd815e1ca327fe03efbee5cd925 100644
--- a/src/plugins/projectexplorer/projectmodels.cpp
+++ b/src/plugins/projectexplorer/projectmodels.cpp
@@ -626,7 +626,7 @@ QList<FolderNode*> DetailedModel::recursiveSubFolders(FolderNode *parentFolder)
 
 FlatModel::FlatModel(SessionNode *rootNode, QObject *parent)
         : QAbstractItemModel(parent),
-          m_filterProjects(true),
+          m_filterProjects(false),
           m_filterGeneratedFiles(true),
           m_rootNode(rootNode),
           m_startupProject(0),
@@ -914,6 +914,8 @@ QModelIndex FlatModel::indexForNode(const Node *node_)
 
 void FlatModel::setProjectFilterEnabled(bool filter)
 {
+    if (filter == m_filterProjects)
+        return;
     m_filterProjects = filter;
     reset();
 }
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index 6285bb81dee49a304e10cbd99f75607eeef22758..c2197a2dc7c7042ab3cc6c6a6c2dc5b235355391 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -90,6 +90,20 @@ protected:
         if (event->reason() != Qt::PopupFocusReason)
             QTreeView::focusOutEvent(event);
     }
+
+#ifdef Q_OS_MAC
+    void keyPressEvent(QKeyEvent *event)
+    {
+        if ((event->key() == Qt::Key_Return
+                || event->key() == Qt::Key_Enter)
+                && event->modifiers() == 0
+                && currentIndex().isValid()) {
+            emit activated(currentIndex());
+            return;
+        }
+        QTreeView::keyPressEvent(event);
+    }
+#endif
 };
 
 /*!
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index c725c915c9e37692fb39507ca46d6881511714e3..e6732387424c2832b804bd5e37d9b4b26419f1c2 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -45,6 +45,7 @@
 #include <coreplugin/icore.h>
 
 #include <QtCore/QDebug>
+#include <QtGui/QApplication>
 #include <QtGui/QBoxLayout>
 #include <QtGui/QComboBox>
 #include <QtGui/QTabWidget>
@@ -190,7 +191,14 @@ void ProjectWindow::updateTreeWidget()
     // That one runs fully thorough and deletes all widgets, even that one that we are currently removing
     // from m_panelsTabWidget.
     // To prevent that, we simply prevent the focus switching....
-    m_treeWidget->setFocus();
+    QWidget *focusWidget = qApp->focusWidget();
+    while (focusWidget) {
+        if (focusWidget == this) {
+            m_treeWidget->setFocus();
+            break;
+        }
+        focusWidget = focusWidget->parentWidget();
+    }
     m_treeWidget->clear();
 
     foreach(Project *project, m_session->projects()) {
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index a9bded02c61ec0ba57ef1701041f957b8afc4c8a..89716ce3f68ab22a905a51f71ce7e5913e2e45be 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -628,8 +628,10 @@ bool SessionManager::loadImpl(const QString &fileName)
     if (success) {
         // restore the active mode
         const QString &modeIdentifier = value(QLatin1String("ActiveMode")).toString();
-        if (!modeIdentifier.isEmpty())
+        if (!modeIdentifier.isEmpty()) {
             m_core->modeManager()->activateMode(modeIdentifier);
+            m_core->modeManager()->setFocusToCurrentMode();
+        }
     }
 
     if (debug)
diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp
index c926320193701e29529bfb93d396ad2650eaf6d7..9e47ac404d2f688a2e68966052b7a7abcfc457cb 100644
--- a/src/plugins/qt4projectmanager/qt4project.cpp
+++ b/src/plugins/qt4projectmanager/qt4project.cpp
@@ -498,12 +498,8 @@ void Qt4Project::updateCodeModel()
         pinfo.sourceFiles = files;
 
         modelmanager->updateProjectInfo(pinfo);
-
-        modelmanager->GC();
         modelmanager->updateSourceFiles(pinfo.sourceFiles);
     }
-
-    // update info
 }
 
 
diff --git a/src/plugins/quickopen/filesystemfilter.cpp b/src/plugins/quickopen/filesystemfilter.cpp
index 8265f6a07efb19d511504663031809997194f9f6..386523ebc43682ff849bd497590cc231ea82df4b 100644
--- a/src/plugins/quickopen/filesystemfilter.cpp
+++ b/src/plugins/quickopen/filesystemfilter.cpp
@@ -54,14 +54,7 @@ QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry)
     QString name = entryInfo.fileName();
     QString directory = entryInfo.path();
     QString filePath = entryInfo.filePath();
-    bool isDrive = false;
-    foreach (const QFileInfo &drive, QDir::drives()) {
-        if (filePath.startsWith(drive.path())) {
-            isDrive = true;
-            break;
-        }
-    }
-    if (!isDrive) {
+    if (entryInfo.isRelative()) {
         if (filePath.startsWith("~/")) {
             directory.replace(0, 1, QDir::homePath());
         } else {
diff --git a/src/plugins/quickopen/opendocumentsfilter.h b/src/plugins/quickopen/opendocumentsfilter.h
index 7b24aeeca0241067286ccb0921a6cdb52fe01b2a..6957119727e90a3bf3bd785fb786190d5f4fc918 100644
--- a/src/plugins/quickopen/opendocumentsfilter.h
+++ b/src/plugins/quickopen/opendocumentsfilter.h
@@ -54,8 +54,8 @@ class OpenDocumentsFilter : public QuickOpen::IQuickOpenFilter
 
 public:
     OpenDocumentsFilter(Core::EditorManager *editorManager);
-    QString trName() const { return tr("Open document"); }
-    QString name() const { return "Open document"; }
+    QString trName() const { return tr("Open documents"); }
+    QString name() const { return "Open documents"; }
     QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
     QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
     void accept(QuickOpen::FilterEntry selection) const;
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index db5413c3446c8370c5d99db1a79d0c380508c424..1cff254452c6aaa4690a745fcaa1bf38fe4f1b8e 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -128,12 +128,13 @@ protected:
 
 ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
                                              int line,
-                                             int column)
+                                             int column,
+                                             const QString &editorKind)
 {
     Core::EditorManager *editorManager =
             ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager();
     editorManager->addCurrentPositionToNavigationHistory(true);
-    Core::IEditor *editor = editorManager->openEditor(fileName, QString(), true);
+    Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true);
     TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
     if (texteditor) {
         texteditor->gotoLine(line, column);
@@ -684,6 +685,67 @@ void BaseTextEditor::selectBlockDown()
     _q_matchParentheses();
 }
 
+void BaseTextEditor::moveLineUp()
+{
+    moveLineUpDown(true);
+}
+
+void BaseTextEditor::moveLineDown()
+{
+    moveLineUpDown(false);
+}
+
+void BaseTextEditor::moveLineUpDown(bool up)
+{
+    QTextCursor cursor = textCursor();
+    QTextCursor move = cursor;
+    move.beginEditBlock();
+
+    bool hasSelection = cursor.hasSelection();
+
+    if (cursor.hasSelection()) {
+        move.setPosition(cursor.selectionStart());
+        move.movePosition(QTextCursor::StartOfBlock);
+        move.setPosition(cursor.selectionEnd(), QTextCursor::KeepAnchor);
+        move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
+    } else {
+        move.movePosition(QTextCursor::StartOfBlock);
+        move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
+    }
+    QString text = move.selectedText();
+    move.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
+    move.removeSelectedText();
+
+    if (up) {
+        move.movePosition(QTextCursor::PreviousBlock);
+        move.insertBlock();
+        move.movePosition(QTextCursor::Left);
+    } else {
+        move.movePosition(QTextCursor::EndOfBlock);
+        if (move.atBlockStart()) { // empty block
+            move.movePosition(QTextCursor::NextBlock);
+            move.insertBlock();
+            move.movePosition(QTextCursor::Left);
+        } else {
+            move.insertBlock();
+        }
+    }
+
+    int start = move.position();
+    move.clearSelection();
+    move.insertText(text);
+    int end = move.position();
+
+    if (hasSelection) {
+        move.setPosition(start);
+        move.setPosition(end, QTextCursor::KeepAnchor);
+    }
+
+    indent(document(), move, QChar::Null);
+    move.endEditBlock();
+
+    setTextCursor(move);
+}
 
 void BaseTextEditor::cleanWhitespace()
 {
@@ -740,9 +802,13 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e)
         QTextCursor cursor = textCursor();
         if (d->m_inBlockSelectionMode)
             cursor.clearSelection();
-        cursor.insertBlock();
         if (d->m_document->tabSettings().m_autoIndent) {
+            cursor.beginEditBlock();
+            cursor.insertBlock();
             indent(document(), cursor, QChar::Null);
+            cursor.endEditBlock();
+        } else {
+            cursor.insertBlock();
         }
         e->accept();
         setTextCursor(cursor);
@@ -2451,7 +2517,7 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
             }
         } else if (e->button() == Qt::RightButton) {
             QMenu * contextMenu = new QMenu(this);
-            emit d->m_editable->markContextMenuRequested(editableInterface(), cursor.blockNumber(), contextMenu);
+            emit d->m_editable->markContextMenuRequested(editableInterface(), cursor.blockNumber() + 1, contextMenu);
             if (!contextMenu->isEmpty())
                 contextMenu->exec(e->globalPos());
             delete contextMenu;
@@ -2702,6 +2768,8 @@ void BaseTextEditor::handleHomeKey(bool anchor)
 
     while (character == tab || character.category() == QChar::Separator_Space) {
         ++pos;
+        if (pos == initpos)
+            break;
         character = characterAt(pos);
     }
 
@@ -2889,12 +2957,13 @@ void BaseTextEditor::markBlocksAsChanged(QList<int> blockNumbers) {
 
 TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor *cursor, QChar c)
 {
-    if (!TextEditDocumentLayout::hasParentheses(cursor->block()))
+    QTextBlock block = cursor->block();
+    if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
         return NoMatch;
 
-    Parentheses parenList = TextEditDocumentLayout::parentheses(cursor->block());
+    Parentheses parenList = TextEditDocumentLayout::parentheses(block);
     Parenthesis openParen, closedParen;
-    QTextBlock closedParenParag = cursor->block();
+    QTextBlock closedParenParag = block;
 
     const int cursorPos = cursor->position() - closedParenParag.position();
     int i = 0;
@@ -2919,7 +2988,8 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor
                 closedParenParag = closedParenParag.next();
                 if (!closedParenParag.isValid())
                     return NoMatch;
-                if (TextEditDocumentLayout::hasParentheses(closedParenParag)) {
+                if (TextEditDocumentLayout::hasParentheses(closedParenParag)
+                    && !TextEditDocumentLayout::ifdefedOut(closedParenParag)) {
                     parenList = TextEditDocumentLayout::parentheses(closedParenParag);
                     break;
                 }
@@ -2956,12 +3026,13 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor
 
 TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCursor *cursor, QChar c)
 {
-    if (!TextEditDocumentLayout::hasParentheses(cursor->block()))
+    QTextBlock block = cursor->block();
+    if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
         return NoMatch;
 
-    Parentheses parenList = TextEditDocumentLayout::parentheses(cursor->block());
+    Parentheses parenList = TextEditDocumentLayout::parentheses(block);
     Parenthesis openParen, closedParen;
-    QTextBlock openParenParag = cursor->block();
+    QTextBlock openParenParag = block;
 
     const int cursorPos = cursor->position() - openParenParag.position();
     int i = parenList.count() - 1;
@@ -2987,7 +3058,8 @@ TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCurs
                 if (!openParenParag.isValid())
                     return NoMatch;
 
-                if (TextEditDocumentLayout::hasParentheses(openParenParag)) {
+                if (TextEditDocumentLayout::hasParentheses(openParenParag)
+                    && !TextEditDocumentLayout::ifdefedOut(openParenParag)) {
                     parenList = TextEditDocumentLayout::parentheses(openParenParag);
                     break;
                 }
@@ -3029,7 +3101,7 @@ bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool se
     int ignore = 0;
     while (block.isValid()) {
         Parentheses parenList = TextEditDocumentLayout::parentheses(block);
-        if (!parenList.isEmpty()) {
+        if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
             for (int i = parenList.count()-1; i >= 0; --i) {
                 Parenthesis paren = parenList.at(i);
                 if (block == cursor->block() && position - block.position() <= paren.pos + 1)
@@ -3056,7 +3128,7 @@ bool TextBlockUserData::findNextClosingParenthesis(QTextCursor *cursor, bool sel
     int ignore = 0;
     while (block.isValid()) {
         Parentheses parenList = TextEditDocumentLayout::parentheses(block);
-        if (!parenList.isEmpty()) {
+        if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
             for (int i = 0; i < parenList.count(); ++i) {
                 Parenthesis paren = parenList.at(i);
                 if (block == cursor->block() && position - block.position() >= paren.pos)
@@ -3081,7 +3153,7 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorBackward(QTextCursor
     cursor->clearSelection();
     const QTextBlock block = cursor->block();
 
-    if (!TextEditDocumentLayout::hasParentheses(block))
+    if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
         return NoMatch;
 
     const int relPos = cursor->position() - block.position();
@@ -3103,7 +3175,7 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorForward(QTextCursor *
     cursor->clearSelection();
     const QTextBlock block = cursor->block();
 
-    if (!TextEditDocumentLayout::hasParentheses(block))
+    if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block))
         return NoMatch;
 
     const int relPos = cursor->position() - block.position();
@@ -3314,7 +3386,7 @@ void BaseTextEditorPrivate::moveCursorVisible()
     if (!cursor.block().isVisible()) {
         cursor.setVisualNavigation(true);
         cursor.movePosition(QTextCursor::PreviousBlock);
-        q->setTextCursor(cursor);        
+        q->setTextCursor(cursor);
     }
     q->ensureCursorVisible();
 }
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index 1219439fc986264c6e55230cac59b0b00c507a4e..d75e174fea2bdabcd8dfa189417117f4ff60d248 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -230,7 +230,8 @@ public:
     BaseTextEditor(QWidget *parent);
     ~BaseTextEditor();
 
-    static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0);
+    static ITextEditor *openEditorAt(const QString &fileName, int line, int column = 0,
+                                     const QString &editorKind = QString());
 
     // EditorInterface
     Core::IFile * file();
@@ -329,6 +330,9 @@ public slots:
     void selectBlockUp();
     void selectBlockDown();
 
+    void moveLineUp();
+    void moveLineDown();
+
     void cleanWhitespace();
 
 signals:
@@ -447,6 +451,7 @@ private:
     void indentOrUnindent(bool doIndent);
     void handleHomeKey(bool anchor);
     void handleBackspaceKey();
+    void moveLineUpDown(bool up);
 
     void toggleBlockVisible(const QTextBlock &block);
     QRect collapseBox(const QTextBlock &block);
diff --git a/src/plugins/texteditor/generalsettingspage.ui b/src/plugins/texteditor/generalsettingspage.ui
index 11f6b8b997ea48feee9ae24a99274c1cb0011c54..140f94628d60464e62513533e023cb46262c0c91 100644
--- a/src/plugins/texteditor/generalsettingspage.ui
+++ b/src/plugins/texteditor/generalsettingspage.ui
@@ -66,6 +66,9 @@
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
+          <property name="minimum">
+           <number>1</number>
+          </property>
           <property name="maximum">
            <number>20</number>
           </property>
@@ -132,6 +135,9 @@
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
+          <property name="minimum">
+           <number>1</number>
+          </property>
           <property name="maximum">
            <number>20</number>
           </property>
diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp
index 12fc7d1fac5a3d2b55f6c76d412e008238a86d75..39a12ee93fd98159b1e5efb2a797626bbd2d3e75 100644
--- a/src/plugins/texteditor/texteditoractionhandler.cpp
+++ b/src/plugins/texteditor/texteditoractionhandler.cpp
@@ -71,6 +71,7 @@ TextEditorActionHandler::TextEditorActionHandler(Core::ICore *core,
                  = m_gotoBlockStartAction = m_gotoBlockStartWithSelectionAction
                  = m_gotoBlockEndAction = m_gotoBlockEndWithSelectionAction
                  = m_selectBlockUpAction = m_selectBlockDownAction
+                 = m_moveLineUpAction = m_moveLineDownAction
                  = 0;
 
     m_contextId << m_core->uniqueIDManager()->uniqueIdentifier(context);
@@ -223,6 +224,16 @@ void TextEditorActionHandler::createActions()
     command = am->registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId);
     command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
     connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown()));
+
+    m_moveLineUpAction= new QAction(tr("Move Line Up"), this);
+    command = am->registerAction(m_moveLineUpAction, Constants::MOVE_LINE_UP, m_contextId);
+    command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Up")));
+    connect(m_moveLineUpAction, SIGNAL(triggered()), this, SLOT(moveLineUp()));
+
+    m_moveLineDownAction= new QAction(tr("Move Line Down"), this);
+    command = am->registerAction(m_moveLineDownAction, Constants::MOVE_LINE_DOWN, m_contextId);
+    command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Down")));
+    connect(m_moveLineDownAction, SIGNAL(triggered()), this, SLOT(moveLineDown()));
 }
 
 bool TextEditorActionHandler::supportsAction(const QString & /*id */) const
@@ -287,6 +298,8 @@ void TextEditorActionHandler::updateActions(UpdateMode um)
     m_gotoBlockEndWithSelectionAction->setEnabled(um != NoEditor);
     m_selectBlockUpAction->setEnabled(um != NoEditor);
     m_selectBlockDownAction->setEnabled(um != NoEditor);
+    m_moveLineUpAction->setEnabled(um != NoEditor);
+    m_moveLineDownAction->setEnabled(um != NoEditor);
 
     m_visualizeWhitespaceAction->setEnabled(um != NoEditor);
     if (m_currentEditor)
@@ -390,6 +403,8 @@ FUNCTION(gotoBlockStartWithSelection)
 FUNCTION(gotoBlockEndWithSelection)
 FUNCTION(selectBlockUp)
 FUNCTION(selectBlockDown)
+FUNCTION(moveLineUp)
+FUNCTION(moveLineDown)
 
 void TextEditorActionHandler::updateCurrentEditor(Core::IContext *object)
 {
diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h
index 520ae26ddf6618e0a09d18cc80f8751592901fbc..98e8c9198a9dd10ac27d8f6e558f01c14311af3c 100644
--- a/src/plugins/texteditor/texteditoractionhandler.h
+++ b/src/plugins/texteditor/texteditoractionhandler.h
@@ -116,6 +116,8 @@ private slots:
     void gotoBlockEndWithSelection();
     void selectBlockUp();
     void selectBlockDown();
+    void moveLineUp();
+    void moveLineDown();
     void updateCurrentEditor(Core::IContext *object);
 
 private:
@@ -145,6 +147,8 @@ private:
     QAction *m_gotoBlockEndWithSelectionAction;
     QAction *m_selectBlockUpAction;
     QAction *m_selectBlockDownAction;
+    QAction *m_moveLineUpAction;
+    QAction *m_moveLineDownAction;
 
     uint m_optionalActions;
     QPointer<BaseTextEditor> m_currentEditor;
diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h
index 192a07c257e86ec089721fc19f27edbfc3b857b7..d9147a9a9e92cd37f1e5ae452e3100be99e6a154 100644
--- a/src/plugins/texteditor/texteditorconstants.h
+++ b/src/plugins/texteditor/texteditorconstants.h
@@ -55,6 +55,8 @@ const char * const GOTO_BLOCK_END        = "TextEditor.GotoBlockEnd";
 const char * const GOTO_BLOCK_END_WITH_SELECTION = "TextEditor.GotoBlockEndWithSelection";
 const char * const SELECT_BLOCK_UP       = "TextEditor.SelectBlockUp";
 const char * const SELECT_BLOCK_DOWN     = "TextEditor.SelectBlockDown";
+const char * const MOVE_LINE_UP       = "TextEditor.MoveLineUp";
+const char * const MOVE_LINE_DOWN     = "TextEditor.MoveLineDown";
 const char * const DELETE_LINE           = "TextEditor.DeleteLine";
 const char * const DELETE_WORD           = "TextEditor.DeleteWord";
 const char * const SELECT_ENCODING       = "TextEditor.SelectEncoding";
diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp
index 958c8985b058c560a6e642a3cb16c6cba79ebb3d..ab5ee635b5afe67bf23a4e0aaf4f27385d73500a 100644
--- a/tests/manual/gdbdebugger/simple/app.cpp
+++ b/tests/manual/gdbdebugger/simple/app.cpp
@@ -53,6 +53,9 @@
 #include <QtNetwork/QHostAddress>
 
 #include <iostream>
+#include <map>
+#include <list>
+#include <stack>
 #include <string>
 #include <vector>
 
@@ -71,6 +74,9 @@ uint qHash(const double & f)
     return int(f);
 }
 
+#define X myns
+X::QString str;
+
 class  Foo
 {
 public:
@@ -126,8 +132,7 @@ void testArray()
     }
 }
 
-
-void testByteArray()
+void testQByteArray()
 {
     QByteArray ba = "Hello";
     ba += '"';
@@ -137,8 +142,7 @@ void testByteArray()
     ba += 2;
 }
 
-
-void testHash()
+void testQHash()
 {
     QHash<int, float> hgg0;
     hgg0[11] = 11.0;
@@ -162,7 +166,7 @@ void testHash()
     hash.insert(".", QPointer<QObject>(&ob));
 }
 
-void testImage()
+void testQImage()
 {
     QImage im(QSize(200, 200), QImage::Format_RGB32);
     im.fill(QColor(200, 100, 130).rgba());
@@ -190,7 +194,7 @@ void testIO()
 }
 
 
-void testList()
+void testQList()
 {
 #if 1
     QList<int> li;
@@ -252,7 +256,7 @@ void testList()
     v.push_back("dd");
  }
 
-void testMap()
+void testQMap()
 {
     QMap<uint, QStringList> ggl;
     ggl[11] = QStringList() << "11";
@@ -287,7 +291,7 @@ void testMap()
 #endif
 }
 
-void testObject(int &argc, char *argv[])
+void testQObject(int &argc, char *argv[])
 {
     QApplication app(argc, argv);
     QAction act("xxx", &app);
@@ -315,7 +319,7 @@ void testObject(int &argc, char *argv[])
     app.exec();
 }
 
-void testPixmap()
+void testQPixmap()
 {
     QImage im(QSize(200, 200), QImage::Format_RGB32);
     im.fill(QColor(200, 100, 130).rgba());
@@ -351,7 +355,7 @@ void testPlugin()
     }
 }
 
-void testSet()
+void testQSet()
 {
     QSet<int> hgg0;
     hgg0.insert(11);
@@ -373,65 +377,98 @@ void stringRefTest(const QString &refstring)
     Q_UNUSED(refstring);
 }
 
-
-int F(int a, int b)
+void testStdList()
 {
-   return a + b;
-}
-
-int add(int i) { return i + 2; }
-
-int mul(int i) { return i * 2; }
-
-
-void testStdVector()
-{
-    int x = F(add(1), mul(2));
-    Q_UNUSED(x);
-    std::vector<int *> plist1;
+    std::list<int *> plist1;
     plist1.push_back(new int(1));
     plist1.push_back(0);
     plist1.push_back(new int(2));
 
-    std::vector<int> flist2;
+    std::list<int> flist2;
     flist2.push_back(1);
     flist2.push_back(2);
     flist2.push_back(3);
     flist2.push_back(4);
 
-    int a = 1;
-    int b = 0;
-
-    while (0) {
-        a += 1;
-        if (b)
-            break;
-    }
-
     flist2.push_back(1);
     flist2.push_back(2);
     flist2.push_back(3);
     flist2.push_back(4);
 
-    std::vector<Foo *> plist;
+    std::list<Foo *> plist;
     plist.push_back(new Foo(1));
     plist.push_back(0);
     plist.push_back(new Foo(2));
 
-    std::vector<Foo> flist;
+    std::list<Foo> flist;
     flist.push_back(1);
-
     flist.push_back(2);
     flist.push_back(3);
     flist.push_back(4);
-    //flist.takeFirst();
-    //flist.takeFirst();
 
-    std::vector<bool> vec;
+    std::list<bool> vec;
     vec.push_back(true);
     vec.push_back(false);
 }
 
+void testStdMap()
+{
+    std::map<uint, QStringList> ggl;
+    ggl[11] = QStringList() << "11";
+    ggl[22] = QStringList() << "22";
+
+    typedef std::map<uint, QStringList> T;
+    T ggt;
+    ggt[11] = QStringList() << "11";
+    ggt[22] = QStringList() << "22";
+
+#if 0
+    std::map<uint, float> gg0;
+    gg0[11] = 11.0;
+    gg0[22] = 22.0;
+
+
+    std::map<QString, float> gg1;
+    gg1["22.0"] = 22.0;
+
+    std::map<int, QString> gg2;
+    gg2[22] = "22.0";
+
+    std::map<QString, Foo> gg3;
+    gg3["22.0"] = Foo(22);
+    gg3["33.0"] = Foo(33);
+
+    QObject ob;
+    std::map<QString, QPointer<QObject> > map;
+    map.insert("Hallo", QPointer<QObject>(&ob));
+    map.insert("Welt", QPointer<QObject>(&ob));
+    map.insert(".", QPointer<QObject>(&ob));
+#endif
+}
+
+void testStdStack()
+{
+    std::stack<int *> plist1;
+    plist1.push(new int(1));
+    plist1.push(0);
+    plist1.push(new int(2));
+    plist1.pop();
+    plist1.pop();
+    plist1.pop();
+
+    std::stack<int> flist2;
+    flist2.push(1);
+    flist2.push(2);
+
+    std::stack<Foo *> plist;
+    plist.push(new Foo(1));
+    plist.push(new Foo(2));
+
+    std::stack<Foo> flist;
+    flist.push(1);
+    flist.push(2);
+}
+
 void testStdString()
 {
     QString foo;
@@ -470,7 +507,43 @@ void testStdString()
     v.push_back(str);
 }
 
-void testString()
+void testStdVector()
+{
+    std::vector<int *> plist1;
+    plist1.push_back(new int(1));
+    plist1.push_back(0);
+    plist1.push_back(new int(2));
+
+    std::vector<int> flist2;
+    flist2.push_back(1);
+    flist2.push_back(2);
+    flist2.push_back(3);
+    flist2.push_back(4);
+
+    flist2.push_back(1);
+    flist2.push_back(2);
+    flist2.push_back(3);
+    flist2.push_back(4);
+
+    std::vector<Foo *> plist;
+    plist.push_back(new Foo(1));
+    plist.push_back(0);
+    plist.push_back(new Foo(2));
+
+    std::vector<Foo> flist;
+    flist.push_back(1);
+    flist.push_back(2);
+    flist.push_back(3);
+    flist.push_back(4);
+    //flist.takeFirst();
+    //flist.takeFirst();
+
+    std::vector<bool> vec;
+    vec.push_back(true);
+    vec.push_back(false);
+}
+
+void testQString()
 {
     QString str = "Hello ";
     str += " big, ";
@@ -480,19 +553,9 @@ void testString()
     str += " World ";
     str += " World ";
     str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
-    str += " World ";
 }
 
-void testString3()
+void testQString3()
 {
     QString str = "Hello ";
     str += " big, ";
@@ -508,7 +571,7 @@ void testString3()
     delete pstring;
 }
 
-void testStringList()
+void testQStringList()
 {
     QStringList l;
     l << "Hello ";
@@ -542,7 +605,7 @@ private:
     int m_id;
 };
 
-void testThreads()
+void testQThread()
 {
     Thread thread1(1);
     Thread thread2(2);
@@ -552,7 +615,7 @@ void testThreads()
     thread2.wait();
 }
 
-void testVariant1()
+void testQVariant1()
 {
     QVariant v;
     v = 1;
@@ -561,7 +624,7 @@ void testVariant1()
     v = 1;
 }
 
-void testVariant2()
+void testQVariant2()
 {
     QVariant var;
 #if 0
@@ -586,7 +649,7 @@ void testVariant2()
     var.setValue(my);
 }
 
-void testVariant3()
+void testQVariant3()
 {
     QList<int> list;
     list << 1 << 2 << 3;
@@ -595,8 +658,10 @@ void testVariant3()
     list = qVariantValue<QList<int> >(variant);
 }
 
-void testVector()
+void testQVector()
 {
+    QVector<int> big(10000);
+
     QVector<Foo *> plist;
     plist.append(new Foo(1));
     plist.append(0);
@@ -616,7 +681,7 @@ void testVector()
     vec.append(false);
 }
 
-void testVectorOfList()
+void testQVectorOfQList()
 {
     QVector<QList<int> > v;
     QVector<QList<int> > *pv = &v;
@@ -729,16 +794,9 @@ void testNamespace()
     bar.doit(1);
 }
 
-int main(int argc, char *argv[])
-{
-    testIO();
-    //QString s;
-    //s = "hallo";
-    //QList<QVector<int> *> vi;
-    //QList<QVector<double> *> vd;
-    //int n = A::barz();
-
 
+void testHidden()
+{
     int  n = 1;
     n = 2;
     n = 3;
@@ -762,34 +820,43 @@ int main(int argc, char *argv[])
     }
     ++n;
     ++n;
+}
 
+int main(int argc, char *argv[])
+{
+    //testIO();
+    testHidden();
     testArray();
-    testStdVector();
+
+    testStdList();
+    testStdMap();
+    testStdStack();
     testStdString();
+    testStdVector();
 
     testPlugin();
-    testList();
+    testQList();
     testNamespace();
     //return 0;
-    testByteArray();
-    testHash();
-    testImage();
-    testMap();
-    testString();
-    testSet();
-    testStringList();
+    testQByteArray();
+    testQHash();
+    testQImage();
+    testQMap();
+    testQString();
+    testQSet();
+    testQStringList();
     testStruct();
     //testThreads();
-    testVariant1();
-    testVariant2();
-    testVariant3();
-    testVector();
-    testVectorOfList();
+    testQVariant1();
+    testQVariant2();
+    testQVariant3();
+    testQVector();
+    testQVectorOfQList();
 
 
     *(int *)0 = 0;
 
-    testObject(argc, argv);
+    testQObject(argc, argv);
 
 
     //QColor color(255,128,10);