Commit 02cd2c71 authored by Eike Ziller's avatar Eike Ziller
Browse files

Fix suggested folder for New File from context menu on project tree.

If a virtual category folder had files directly below them and a single
subdirectory, the suggestion was the subdirectory.

Change-Id: I185c7e6e9f64764664f5858d95aea57082161b82
Reviewed-on: http://codereview.qt.nokia.com/1871

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent edd8dac2
......@@ -2344,14 +2344,16 @@ QString pathOrDirectoryFor(Node *node, bool dir)
FolderNode *folder = qobject_cast<FolderNode *>(node);
if (path.contains("#") && folder) {
// Virtual Folder case
// We figure out a commonPath from the subfolders
QStringList list;
foreach (FolderNode *f, folder->subFolderNodes())
list << f->path() + QLatin1Char('/');
if (list.isEmpty())
location = path.left(path.indexOf('#'));
else
// If there are files directly below or no subfolders, take the folder path
if (!folder->fileNodes().isEmpty() || folder->subFolderNodes().isEmpty()) {
location = path.left(path.indexOf('#'));;
} else {
// Otherwise we figure out a commonPath from the subfolders
QStringList list;
foreach (FolderNode *f, folder->subFolderNodes())
list << f->path() + QLatin1Char('/');
location = Utils::commonPath(list);
}
} else {
QFileInfo fi(path);
if (dir) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment