diff --git a/addons/project/kateprojectviewtree.cpp b/addons/project/kateprojectviewtree.cpp --- a/addons/project/kateprojectviewtree.cpp +++ b/addons/project/kateprojectviewtree.cpp @@ -26,6 +26,7 @@ #include #include +#include #include KateProjectViewTree::KateProjectViewTree(KateProjectPluginView *pluginView, KateProject *project) @@ -146,6 +147,7 @@ return; } + qDebug() << filePath; KateProjectTreeViewContextMenu menu; menu.exec(filePath, viewport()->mapToGlobal(event->pos()), this); diff --git a/addons/project/kateprojectworker.cpp b/addons/project/kateprojectworker.cpp --- a/addons/project/kateprojectworker.cpp +++ b/addons/project/kateprojectworker.cpp @@ -130,6 +130,10 @@ */ if (slashIndex < 0) { dir2Item[path] = new KateProjectItem(KateProjectItem::Directory, path); + + qDebug() << path; // TODO: this path is relative. What we need is the absolute path. Files are also stored with full path + dir2Item[path]->setData(path, Qt::UserRole); + dir2Item[QString()]->appendRow(dir2Item[path]); return dir2Item[path]; } @@ -151,6 +155,7 @@ * else: recurse on left side */ dir2Item[path] = new KateProjectItem(KateProjectItem::Directory, rightPart); + dir2Item[path]->setData(path, Qt::UserRole); directoryParent(dir2Item, leftPart)->appendRow(dir2Item[path]); return dir2Item[path]; } @@ -188,6 +193,9 @@ * get file info and skip NON-files */ QFileInfo fileInfo(filePath); +// if (fileInfo.isDir()) { +// qDebug() << filePath; +// } if (!fileInfo.isFile()) { continue; } @@ -206,7 +214,8 @@ dirRelPath = QString(); } - item2ParentPath.append(QPair(fileItem, directoryParent(dir2Item, dirRelPath))); + QStandardItem* parentDirectoryItem = directoryParent(dir2Item, dirRelPath); + item2ParentPath.append(QPair(fileItem, parentDirectoryItem)); fileItem->setData(filePath, Qt::UserRole); (*file2Item)[filePath] = fileItem; }