diff --git a/part/infopanel.h b/part/infopanel.h
--- a/part/infopanel.h
+++ b/part/infopanel.h
@@ -64,7 +64,7 @@
void showMetaData();
void hideMetaData();
- QString metadataTextFor(const QModelIndex &);
+ void showMetaDataFor(const QModelIndex &index);
ArchiveModel *m_model;
QString m_prettyFileName;
diff --git a/part/infopanel.cpp b/part/infopanel.cpp
--- a/part/infopanel.cpp
+++ b/part/infopanel.cpp
@@ -129,8 +129,7 @@
const QString name = (nameParts.count() > 0) ? nameParts.last() : entry[ FileName ].toString();
fileName->setText(name);
- metadataLabel->setText(metadataTextFor(index));
- showMetaData();
+ showMetaDataFor(index);
}
}
@@ -156,19 +155,20 @@
void InfoPanel::showMetaData()
{
m_separator->show();
- metadataLabel->show();
+ m_metaDataWidget->show();
}
void InfoPanel::hideMetaData()
{
m_separator->hide();
- metadataLabel->hide();
+ m_metaDataWidget->hide();
}
-QString InfoPanel::metadataTextFor(const QModelIndex &index)
+void InfoPanel::showMetaDataFor(const QModelIndex &index)
{
+ showMetaData();
+
const ArchiveEntry& entry = m_model->entryForIndex(index);
- QString text;
QMimeDatabase db;
QMimeType mimeType;
@@ -179,23 +179,33 @@
mimeType = db.mimeTypeForFile(entry[FileName].toString(), QMimeDatabase::MatchExtension);
}
- text += i18n("Type: %1
", mimeType.comment());
+ m_typeLabel->setText(i18n("Type: %1", mimeType.comment()));
if (entry.contains(Owner)) {
- text += i18n("Owner: %1
", entry[ Owner ].toString());
+ m_ownerLabel->show();
+ m_ownerLabel->setText(i18n("Owner: %1", entry[Owner].toString()));
+ } else {
+ m_ownerLabel->hide();
}
if (entry.contains(Group)) {
- text += i18n("Group: %1
", entry[ Group ].toString());
+ m_groupLabel->show();
+ m_groupLabel->setText(i18n("Group: %1", entry[Group].toString()));
+ } else {
+ m_groupLabel->hide();
}
if (entry.contains(Link)) {
- text += i18n("Target: %1
", entry[ Link ].toString());
+ m_targetLabel->show();
+ m_targetLabel->setText(i18n("Target: %1", entry[Link].toString()));
+ } else {
+ m_targetLabel->hide();
}
if (entry.contains(IsPasswordProtected) && entry[ IsPasswordProtected ].toBool()) {
- text += i18n("Password protected: Yes
");
+ m_passwordLabel->show();
+ m_passwordLabel->setText(i18n("Password protected: Yes"));
+ } else {
+ m_passwordLabel->hide();
}
-
- return text;
}
diff --git a/part/infopanel.ui b/part/infopanel.ui
--- a/part/infopanel.ui
+++ b/part/infopanel.ui
@@ -79,19 +79,44 @@
-
-
-
- Metadata Label
-
-
- 10
-
-
- 20
-
-
- Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
-
+
+
+
-
+
+
+ Type
+
+
+
+ -
+
+
+ Owner
+
+
+
+ -
+
+
+ Group
+
+
+
+ -
+
+
+ Target
+
+
+
+ -
+
+
+ Password
+
+
+
+
-