# # # patch "src/view/WorkspaceWindow.cpp" # from [019cbcc51cd716c49eaa9bb2d1ae54df04084856] # to [6a1d8aa85544a2727ce324ed317b6637e1b5e3f4] # # patch "src/view/WorkspaceWindow.h" # from [ccc33495e5dbe966045065fb35311d07f5f7e96e] # to [558c0425e0e25438eb09744828fd0fa3069e67c9] # ============================================================ --- src/view/WorkspaceWindow.cpp 019cbcc51cd716c49eaa9bb2d1ae54df04084856 +++ src/view/WorkspaceWindow.cpp 6a1d8aa85544a2727ce324ed317b6637e1b5e3f4 @@ -165,7 +165,22 @@ void WorkspaceWindow::setup() menuBar, SIGNAL(expandTree(bool)), treeView, SLOT(expandAllNodes(bool)) ); +/* + connect( + treeView, SIGNAL(expanded(const QModelIndex &)), + this, SLOT(readInventory(const QModelIndex &)) + ); +*/ + connect( + treeView, SIGNAL(clicked(const QModelIndex &)), + this, SLOT(readInventory(const QModelIndex &)) + ); + connect( + listView, SIGNAL(doubleClicked(const QModelIndex &)), + this, SLOT(readInventory(const QModelIndex &)) + ); + listSplitter->addWidget(listView); listSplitter->addWidget(attrView); @@ -243,7 +258,7 @@ void WorkspaceWindow::load(const QString invModel->setWorkspacePath(workspacePath); attrModel->setWorkspacePath(workspacePath); - // read the inventory + // read the base set of the inventory invModel->readInventory(); // initialize the dialog manager @@ -339,3 +354,25 @@ void WorkspaceWindow::invalidWorkspaceFo close(); } +void WorkspaceWindow::readInventory(const QModelIndex & index) +{ + QModelIndex sourceIndex = static_cast + (index.model())->mapToSource(index); + ModelItem * item = static_cast + (sourceIndex.internalPointer()); + InventoryItem * invitem = dynamic_cast + (item); + + if (!invitem) return; + + // 'inventory' can only be restricted with existing file paths + // and not with invalid file/directory combinations or missing paths + // restricting to single files makes no sense for us here either + if (invitem->getFSType() != InventoryItem::Directory) return; + + // do not query again here if we already expanded this directory + if (invitem->isExpanded()) return; + + invModel->readInventory(invitem->getPath()); +} + ============================================================ --- src/view/WorkspaceWindow.h ccc33495e5dbe966045065fb35311d07f5f7e96e +++ src/view/WorkspaceWindow.h 558c0425e0e25438eb09744828fd0fa3069e67c9 @@ -67,6 +67,7 @@ private slots: void invalidWorkspaceFormat(const QString &); void openFile(const QString &); void checkForUnaccountedRenames(); + void readInventory(const QModelIndex &); }; #endif