Fix properties display for torrents without metadata

This commit is contained in:
Christophe Dumez
2010-10-28 16:17:59 +00:00
parent 27f257ba03
commit fab63e6ffc

View File

@@ -237,30 +237,34 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
clear();
h = _h;
if(!h.is_valid()) {
qDebug("Properties: invalid handle, returning.");
clear();
return;
}
setEnabled(true);
PropListModel->clear();
try {
// Save path
updateSavePath(h);
changeSavePathButton->setEnabled(h.has_metadata());
// Creation date
lbl_creationDate->setText(h.creation_date());
// Hash
hash_lbl->setText(h.hash());
if(h.has_metadata()) {
// Creation date
lbl_creationDate->setText(h.creation_date());
// Comment
comment_text->setHtml(h.comment());
// URL seeds
loadUrlSeeds();
// List files in torrent
PropListModel->clear();
PropListModel->setupModelData(h.get_torrent_info());
// Expand first item if possible
filesList->expand(PropListModel->index(0, 0));
}
} catch(invalid_handle e) {
qDebug("Properties: INVALID HANDLE");
qDebug("what() == %s", e.what());
}
// Load dynamic data
loadDynamicData();