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