]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/information/informationpanelcontent.cpp
Use a ':' as end of the label instead of a '.', even if the label is top-aligned.
[dolphin.git] / src / panels / information / informationpanelcontent.cpp
index 8d8c21549d6a5c1e03a0715da21433e4321c58e4..da576d05fe89980dbe23be12c020aa03a1e1149a 100644 (file)
@@ -42,6 +42,7 @@
 #include <QPointer>
 #include <QResizeEvent>
 #include <QScrollArea>
+#include <QTextDocument>
 #include <QTextLayout>
 #include <QTextLine>
 #include <QTimer>
@@ -54,7 +55,7 @@
 #include "pixmapviewer.h"
 
 InformationPanelContent::InformationPanelContent(QWidget* parent) :
-    Panel(parent),
+    QWidget(parent),
     m_item(),
     m_pendingPreview(false),
     m_outdatedPreviewTimer(0),
@@ -86,6 +87,7 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
     m_preview->setMinimumHeight(KIconLoader::SizeEnormous);
 
     m_phononWidget = new PhononWidget(parent);
+    m_phononWidget->hide();
     m_phononWidget->setMinimumWidth(minPreviewWidth);
     connect(m_phononWidget, SIGNAL(playingStarted()),
             this, SLOT(slotPlayingStarted()));
@@ -147,17 +149,17 @@ void InformationPanelContent::showItem(const KFileItem& item)
     m_pendingPreview = false;
 
     const KUrl itemUrl = item.url();
-    const bool isNepomukSearchUrl = itemUrl.protocol().startsWith("nepomuk") && item.nepomukUri().isEmpty();
+    const bool isSearchUrl = itemUrl.protocol().contains("search") && item.nepomukUri().isEmpty();
     if (!applyPlace(itemUrl)) {
-        if (isNepomukSearchUrl) {
-            // in the case of a Nepomuk query-URL the URL is not readable for humans
+        setNameLabelText(item.text());
+        if (isSearchUrl) {
+            // in the case of a search-URL the URL is not readable for humans
             // (at least not useful to show in the Information Panel)
             KIconLoader iconLoader;
             QPixmap icon = iconLoader.loadIcon("nepomuk",
                                                KIconLoader::NoGroup,
                                                KIconLoader::SizeEnormous);
             m_preview->setPixmap(icon);
-            setNameLabelText(QString());
         } else {
             // try to get a preview pixmap from the item...
             m_pendingPreview = true;
@@ -183,18 +185,12 @@ void InformationPanelContent::showItem(const KFileItem& item)
                     this, SLOT(showPreview(const KFileItem&, const QPixmap&)));
             connect(job, SIGNAL(failed(const KFileItem&)),
                     this, SLOT(showIcon(const KFileItem&)));
-
-            setNameLabelText(item.text());
         }
     }
 
     if (m_metaDataWidget != 0) {
-        if (isNepomukSearchUrl) {
-            m_metaDataWidget->hide();
-        } else {
-            m_metaDataWidget->show();
-            m_metaDataWidget->setItems(KFileItemList() << item);
-        }
+        m_metaDataWidget->show();
+        m_metaDataWidget->setItems(KFileItemList() << item);
     }
 
     if (InformationPanelSettings::showPreview()) {
@@ -266,7 +262,7 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event)
         break;
     }
 
-    return Panel::eventFilter(obj, event);
+    return QWidget::eventFilter(obj, event);
 }
 
 void InformationPanelContent::configureSettings()
@@ -295,7 +291,7 @@ void InformationPanelContent::configureSettings()
     } else if (action == configureAction) {
         FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog();
         dialog->setDescription(i18nc("@label::textbox",
-                                     "Select which data should be shown in the information panel."));
+                                     "Select which data should be shown in the information panel:"));
         dialog->setItems(m_metaDataWidget->items());
         dialog->setAttribute(Qt::WA_DeleteOnClose);
         dialog->show();
@@ -328,10 +324,10 @@ void InformationPanelContent::showPreview(const KFileItem& item,
 
 void InformationPanelContent::markOutdatedPreview()
 {
-    KIconEffect iconEffect;
-    QPixmap disabledPixmap = iconEffect.apply(m_preview->pixmap(),
-                                              KIconLoader::Desktop,
-                                              KIconLoader::DisabledState);
+    KIconEffect *iconEffect = KIconLoader::global()->iconEffect();
+    QPixmap disabledPixmap = iconEffect->apply(m_preview->pixmap(),
+                                               KIconLoader::Desktop,
+                                               KIconLoader::DisabledState);
     m_preview->setPixmap(disabledPixmap);
 }
 
@@ -375,8 +371,8 @@ void InformationPanelContent::setNameLabelText(const QString& text)
     QTextOption textOption;
     textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
 
-    const QString processedText = KStringHandler::preProcessWrap(text);
-    
+    const QString processedText = Qt::mightBeRichText(text) ? text : KStringHandler::preProcessWrap(text);
+
     QTextLayout textLayout(processedText);
     textLayout.setFont(m_nameLabel->font());
     textLayout.setTextOption(textOption);