mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
fixed crash in RsCollection creation
This commit is contained in:
parent
fc3becacbf
commit
8afa127ed5
@ -1861,8 +1861,6 @@ void TransfersDialog::insertTransfers()
|
|||||||
std::set<QString> expanded_hashes ;
|
std::set<QString> expanded_hashes ;
|
||||||
std::set<QString> selected_hashes ;
|
std::set<QString> selected_hashes ;
|
||||||
|
|
||||||
std::cerr << "Updating transfers..." << std::endl;
|
|
||||||
|
|
||||||
DLListModel->update_transfers();
|
DLListModel->update_transfers();
|
||||||
|
|
||||||
// Now show upload hashes. Here we use the "old" way, since the number of uploads is generally not so large.
|
// 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();
|
QList<QTreeWidgetItem*> selected = ui._fileEntriesTW->selectedItems();
|
||||||
int curs = 0;
|
|
||||||
if (count == 0) curs = -1;
|
if(selected.empty())
|
||||||
for (; curs < count; ++curs)
|
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = NULL;
|
QTreeWidgetItem *item = getRootItem();
|
||||||
if (curs >= 0) {
|
|
||||||
item= ui._fileEntriesTW->selectedItems().at(curs);
|
ColFileInfo newChild;
|
||||||
} else {
|
newChild.name = childName;
|
||||||
item = getRootItem();
|
newChild.filename_has_wrong_characters = false;
|
||||||
}
|
newChild.size = 0;
|
||||||
if (item) {
|
newChild.type = DIR_TYPE_DIR;
|
||||||
while (item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != 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
|
item = item->parent();//Only Dir as Parent
|
||||||
}
|
|
||||||
ColFileInfo newChild;
|
ColFileInfo newChild;
|
||||||
newChild.name = childName;
|
newChild.name = childName;
|
||||||
newChild.filename_has_wrong_characters = false;
|
newChild.filename_has_wrong_characters = false;
|
||||||
newChild.size = 0;
|
newChild.size = 0;
|
||||||
newChild.type = DIR_TYPE_DIR;
|
newChild.type = DIR_TYPE_DIR;
|
||||||
newChild.path = item->data(COLUMN_HASH, ROLE_PATH).toString()
|
|
||||||
+ "/" + item->data(COLUMN_HASH, ROLE_NAME).toString();
|
if (item == getRootItem())
|
||||||
if (item == getRootItem()) newChild.path = "";
|
newChild.path = "";
|
||||||
|
else
|
||||||
|
newChild.path = item->data(COLUMN_HASH, ROLE_PATH).toString() + "/" + item->data(COLUMN_HASH, ROLE_NAME).toString();
|
||||||
|
|
||||||
_newColFileInfos.push_back(newChild);
|
_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();
|
updateList();
|
||||||
|
Loading…
Reference in New Issue
Block a user