Merge pull request #1170 from csoler/v0.6-FT

V0.6 ft
This commit is contained in:
csoler 2018-02-12 22:42:22 +01:00 committed by GitHub
commit 3f9c72e24e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 21 deletions

View File

@ -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.

View File

@ -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();