]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/infosidebarpage.cpp
Better looking categories. Thanks to Aurélien Gâteau for the original patch.
[dolphin.git] / src / infosidebarpage.cpp
index b2705ec7f12dcb20c087c6820dd1c539a3f3260a..7b0d2d40c2109cdd7c13fdab78995f3842698bc8 100644 (file)
@@ -77,8 +77,10 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
 
     // general information
     m_infoLabel = new QLabel(this);
-    m_infoLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+    m_infoLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
     m_infoLabel->setTextFormat(Qt::RichText);
+    m_infoLabel->setWordWrap(true);
+    m_infoLabel->setFont(KGlobalSettings::smallestReadableFont());
 
     if (MetaDataWidget::metaDataAvailable()) {
         m_metadataWidget = new MetaDataWidget(this);
@@ -89,8 +91,8 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) :
     layout->addWidget(m_nameLabel);
     layout->addWidget(new KSeparator(this));
     layout->addWidget(m_infoLabel);
-    layout->addWidget(new KSeparator(this));
-    if (m_metadataWidget) {
+    if (m_metadataWidget != 0) {
+        layout->addWidget(new KSeparator(this));
         layout->addWidget(m_metadataWidget);
     }
     // ensure that widgets in the information side bar are aligned towards the top
@@ -187,7 +189,7 @@ void InfoSidebarPage::showItemInfo()
     const int itemCount = selectedItems.count();
     if (itemCount > 1) {
         KIconLoader iconLoader;
-        QPixmap icon = iconLoader.loadIcon("exec",
+        QPixmap icon = iconLoader.loadIcon("system-run",
                                            KIconLoader::NoGroup,
                                            KIconLoader::SizeEnormous);
         m_preview->setPixmap(icon);
@@ -295,7 +297,12 @@ void InfoSidebarPage::showMetaInfo()
 
             // TODO: See convertMetaInfo below, find a way to display only interesting information
             // in a readable way
-            const KFileMetaInfo metaInfo(fileItem.url());
+            const KFileMetaInfo::WhatFlags flags = KFileMetaInfo::Fastest |
+                                                   KFileMetaInfo::TechnicalInfo |
+                                                   KFileMetaInfo::ContentInfo |
+                                                   KFileMetaInfo::Thumbnail;
+            const QString path = fileItem.url().url();
+            const KFileMetaInfo metaInfo(path, QString(), flags);
             if (metaInfo.isValid()) {
                 const QHash<QString, KFileMetaInfoItem>& items = metaInfo.items();
                 QHash<QString, KFileMetaInfoItem>::const_iterator it = items.constBegin();
@@ -326,9 +333,10 @@ void InfoSidebarPage::showMetaInfo()
 
         unsigned long int totalSize = 0;
         foreach (const KFileItem& item, selectedItems) {
-            // TODO: what to do with directories (same with the one-item-selected-code)?,
-            // item.size() does not return the size of the content : not very instinctive for users
-            totalSize += item.size();
+            // Only count the size of files, not dirs; to match what
+            // DolphinViewContainer::selectionStatusBarText does.
+            if (!item.isDir() && !item.isLink())
+                totalSize += item.size();
         }
         addInfoLine(text, i18nc("@label", "Total size:"), KIO::convertSize(totalSize));
     }