From 0639d1745b246f6f4d800b51e0379284952162b4 Mon Sep 17 00:00:00 2001
From: ck <qt-info@nokia.com>
Date: Fri, 18 Dec 2009 14:58:24 +0100
Subject: [PATCH] Clarify the meaning of an empty dependencies view.

When there is only one project in a session, it is now more obvious
that the dependency view is supposed to show other projects from
the session.

Reviewed-by: con
---
 src/plugins/projectexplorer/dependenciespanel.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp
index f9608e561c4..c284c18bbe4 100644
--- a/src/plugins/projectexplorer/dependenciespanel.cpp
+++ b/src/plugins/projectexplorer/dependenciespanel.cpp
@@ -84,7 +84,7 @@ void DependenciesModel::resetModel()
 
 int DependenciesModel::rowCount(const QModelIndex &index) const
 {
-    return index.isValid() ? 0 : m_projects.size();
+    return index.isValid() ? 0 : m_projects.isEmpty() ? 1 : m_projects.size();
 }
 
 int DependenciesModel::columnCount(const QModelIndex &index) const
@@ -94,6 +94,11 @@ int DependenciesModel::columnCount(const QModelIndex &index) const
 
 QVariant DependenciesModel::data(const QModelIndex &index, int role) const
 {
+    if (m_projects.isEmpty())
+        return role == Qt::DisplayRole
+            ? tr("<No other projects in this session>")
+            : QVariant();
+
     const Project *p = m_projects.at(index.row());
 
     switch (role) {
@@ -135,6 +140,9 @@ bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value,
 
 Qt::ItemFlags DependenciesModel::flags(const QModelIndex &index) const
 {
+    if (m_projects.isEmpty())
+        return Qt::NoItemFlags;
+
     Qt::ItemFlags rc = QAbstractListModel::flags(index);
     if (index.column() == 0)
         rc |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable;
-- 
GitLab