mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
commit
3f9c72e24e
@ -154,7 +154,7 @@ public:
|
||||
|
||||
if(!ref) // top level. The entry is that of a transfer
|
||||
{
|
||||
if(!convertTabEntryToRefPointer(row,-1,subref))
|
||||
if(row >= mDownloads.size() || !convertTabEntryToRefPointer(row,-1,subref))
|
||||
return QModelIndex() ;
|
||||
|
||||
return createIndex(row,column,subref) ;
|
||||
@ -1861,8 +1861,6 @@ void TransfersDialog::insertTransfers()
|
||||
std::set<QString> expanded_hashes ;
|
||||
std::set<QString> selected_hashes ;
|
||||
|
||||
std::cerr << "Updating transfers..." << std::endl;
|
||||
|
||||
DLListModel->update_transfers();
|
||||
|
||||
// Now show upload hashes. Here we use the "old" way, since the number of uploads is generally not so large.
|
||||
|
@ -1081,34 +1081,76 @@ void RsCollectionDialog::makeDir()
|
||||
|
||||
}
|
||||
|
||||
// Process all selected items
|
||||
int count = ui._fileEntriesTW->selectedItems().count();
|
||||
int curs = 0;
|
||||
if (count == 0) curs = -1;
|
||||
for (; curs < count; ++curs)
|
||||
|
||||
QList<QTreeWidgetItem*> selected = ui._fileEntriesTW->selectedItems();
|
||||
|
||||
if(selected.empty())
|
||||
{
|
||||
QTreeWidgetItem *item = NULL;
|
||||
if (curs >= 0) {
|
||||
item= ui._fileEntriesTW->selectedItems().at(curs);
|
||||
} else {
|
||||
item = getRootItem();
|
||||
}
|
||||
if (item) {
|
||||
while (item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR) {
|
||||
QTreeWidgetItem *item = getRootItem();
|
||||
|
||||
ColFileInfo newChild;
|
||||
newChild.name = childName;
|
||||
newChild.filename_has_wrong_characters = false;
|
||||
newChild.size = 0;
|
||||
newChild.type = DIR_TYPE_DIR;
|
||||
newChild.path = item->data(COLUMN_HASH, ROLE_PATH).toString()
|
||||
+ "/" + item->data(COLUMN_HASH, ROLE_NAME).toString();
|
||||
if (item == getRootItem()) newChild.path = "";
|
||||
|
||||
_newColFileInfos.push_back(newChild);
|
||||
}
|
||||
else
|
||||
for(auto it(selected.begin());it!=selected.end();++it)
|
||||
{
|
||||
QTreeWidgetItem *item = *it;
|
||||
|
||||
while(item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR)
|
||||
item = item->parent();//Only Dir as Parent
|
||||
}
|
||||
|
||||
ColFileInfo newChild;
|
||||
newChild.name = childName;
|
||||
newChild.filename_has_wrong_characters = false;
|
||||
newChild.size = 0;
|
||||
newChild.type = DIR_TYPE_DIR;
|
||||
newChild.path = item->data(COLUMN_HASH, ROLE_PATH).toString()
|
||||
+ "/" + item->data(COLUMN_HASH, ROLE_NAME).toString();
|
||||
if (item == getRootItem()) newChild.path = "";
|
||||
|
||||
if (item == getRootItem())
|
||||
newChild.path = "";
|
||||
else
|
||||
newChild.path = item->data(COLUMN_HASH, ROLE_PATH).toString() + "/" + item->data(COLUMN_HASH, ROLE_NAME).toString();
|
||||
|
||||
_newColFileInfos.push_back(newChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// // Process all selected items
|
||||
// int count = ui._fileEntriesTW->selectedItems().count();
|
||||
// int curs = 0;
|
||||
// if (count == 0) curs = -1;
|
||||
//
|
||||
// for (; curs < count; ++curs)
|
||||
// {
|
||||
// QTreeWidgetItem *item = NULL;
|
||||
// if (curs >= 0) {
|
||||
// item= ui._fileEntriesTW->selectedItems().at(curs);
|
||||
// } else {
|
||||
// item = getRootItem();
|
||||
// }
|
||||
// if (item) {
|
||||
// while (item->parent() != NULL && item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR) {
|
||||
// item = item->parent();//Only Dir as Parent
|
||||
// }
|
||||
// ColFileInfo newChild;
|
||||
// newChild.name = childName;
|
||||
// newChild.filename_has_wrong_characters = false;
|
||||
// newChild.size = 0;
|
||||
// newChild.type = DIR_TYPE_DIR;
|
||||
// newChild.path = item->data(COLUMN_HASH, ROLE_PATH).toString()
|
||||
// + "/" + item->data(COLUMN_HASH, ROLE_NAME).toString();
|
||||
// if (item == getRootItem()) newChild.path = "";
|
||||
//
|
||||
// _newColFileInfos.push_back(newChild);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
updateList();
|
||||
|
Loading…
Reference in New Issue
Block a user