diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp index 8ea52e1b2..3d3025f0d 100644 --- a/src/eventmanager.cpp +++ b/src/eventmanager.cpp @@ -103,13 +103,9 @@ QList EventManager::getPropFilesInfo(QString hash) const { int i=0; for(fi=t.begin_files(); fi != t.end_files(); fi++) { QVariantMap file; - if(h.num_files() == 1) { - file["name"] = h.name(); - } else { - QString path = QDir::cleanPath(misc::toQString(fi->path.string())); - QString name = path.split('/').last(); - file["name"] = name; - } + QString path = QDir::cleanPath(misc::toQString(fi->path.string())); + QString name = path.split('/').last(); + file["name"] = name; file["size"] = misc::friendlyUnit((double)fi->size); if(fi->size > 0) file["progress"] = fp[i]/(double)fi->size; diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index ebf27a928..4302a2618 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -498,7 +498,14 @@ public: files_index = new TreeItem*[t.num_files()]; TreeItem *parent = this->rootItem; - if(t.num_files() ==1) { + if(t.num_files() == 1) { + // Create possible parent folder + QStringList path_parts = misc::toQString(t.file_at(0).path.string()).split(QDir::separator()); + path_parts.removeLast(); + foreach(const QString &part, path_parts) { + TreeItem *folder = new TreeItem(part, parent); + parent = folder; + } TreeItem *f = new TreeItem(t.file_at(0), parent, 0); //parent->appendChild(f); files_index[0] = f;