1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "informationpanel.h"
22 #include <config-nepomuk.h>
25 #include <kdirnotify.h>
26 #include <kfileitem.h>
27 #include <kfilemetainfo.h>
28 #include <kfileplacesmodel.h>
29 #include <kglobalsettings.h>
30 #include <kio/previewjob.h>
31 #include <kiconeffect.h>
32 #include <kiconloader.h>
35 #include <kseparator.h>
39 #define DISABLE_NEPOMUK_LEGACY
41 #include <Nepomuk/Resource>
42 #include <Nepomuk/Types/Property>
43 #include <Nepomuk/Variant>
46 #include <Phonon/BackendCapabilities>
47 #include <Phonon/MediaObject>
48 #include <Phonon/SeekSlider>
51 #include <QInputDialog>
55 #include <QResizeEvent>
56 #include <QScrollArea>
57 #include <QTextLayout>
61 #include <QVBoxLayout>
63 #include "dolphin_informationpanelsettings.h"
64 #include "settings/dolphinsettings.h"
65 #include "metadatawidget.h"
66 #include "metatextlabel.h"
67 #include "phononwidget.h"
68 #include "pixmapviewer.h"
71 * Helper function for sorting items with qSort() in
72 * InformationPanel::contextMenu().
74 bool lessThan(const QAction
* action1
, const QAction
* action2
)
76 return action1
->text() < action2
->text();
80 InformationPanel::InformationPanel(QWidget
* parent
) :
83 m_pendingPreview(false),
85 m_outdatedPreviewTimer(0),
92 m_previewSeparator(0),
95 m_metaDataSeparator(0),
101 InformationPanel::~InformationPanel()
103 InformationPanelSettings::self()->writeConfig();
106 QSize
InformationPanel::sizeHint() const
108 QSize size
= Panel::sizeHint();
109 size
.setWidth(minimumSizeHint().width());
113 void InformationPanel::setUrl(const KUrl
& url
)
116 if (url
.isValid() && !isEqualToShownUrl(url
)) {
127 void InformationPanel::setSelection(const KFileItemList
& selection
)
133 if ((selection
.count() == 0) && (m_selection
.count() == 0)) {
134 // The selection has not really changed, only the current index.
135 // QItemSelectionModel emits a signal in this case and it is less
136 // expensive doing the check this way instead of patching
137 // DolphinView::emitSelectionChanged().
141 m_selection
= selection
;
143 const int count
= selection
.count();
145 if (!isEqualToShownUrl(url())) {
150 if ((count
== 1) && !selection
.first().url().isEmpty()) {
151 m_urlCandidate
= selection
.first().url();
153 m_infoTimer
->start();
157 void InformationPanel::requestDelayedItemInfo(const KFileItem
& item
)
165 m_fileItem
= KFileItem();
167 // The cursor is above the viewport. If files are selected,
168 // show information regarding the selection.
169 if (m_selection
.size() > 0) {
170 m_pendingPreview
= false;
171 m_infoTimer
->start();
174 const KUrl url
= item
.url();
175 if (url
.isValid() && !isEqualToShownUrl(url
)) {
176 m_urlCandidate
= item
.url();
178 m_infoTimer
->start();
183 void InformationPanel::showEvent(QShowEvent
* event
)
185 Panel::showEvent(event
);
186 if (!event
->spontaneous()) {
187 if (!m_initialized
) {
188 // do a delayed initialization so that no performance
189 // penalty is given when Dolphin is started with a closed
197 void InformationPanel::resizeEvent(QResizeEvent
* event
)
200 // If the text inside the name label or the info label cannot
201 // get wrapped, then the maximum width of the label is increased
202 // so that the width of the information panel gets increased.
203 // To prevent this, the maximum width is adjusted to
204 // the current width of the panel.
205 const int maxWidth
= event
->size().width() - KDialog::spacingHint() * 4;
206 m_nameLabel
->setMaximumWidth(maxWidth
);
208 // The metadata widget also contains a text widget which may return
209 // a large preferred width.
210 if (m_metaDataWidget
!= 0) {
211 m_metaDataWidget
->setMaximumWidth(maxWidth
);
214 // try to increase the preview as large as possible
215 m_preview
->setSizeHint(QSize(maxWidth
, maxWidth
));
216 m_urlCandidate
= m_shownUrl
; // reset the URL candidate if a resizing is done
217 m_infoTimer
->start();
219 if (m_phononWidget
->isVisible() && (m_phononWidget
->mode() == PhononWidget::Video
)) {
220 // assure that the size of the video player is the same as the preview size
221 m_phononWidget
->setVideoSize(QSize(maxWidth
, maxWidth
));
224 Panel::resizeEvent(event
);
227 bool InformationPanel::eventFilter(QObject
* obj
, QEvent
* event
)
229 // Check whether the size of the meta text area has changed and adjust
230 // the fixed width in a way that no horizontal scrollbar needs to be shown.
231 if ((obj
== m_metaTextArea
->viewport()) && (event
->type() == QEvent::Resize
)) {
232 QResizeEvent
* resizeEvent
= static_cast<QResizeEvent
*>(event
);
233 m_metaTextLabel
->setFixedWidth(resizeEvent
->size().width());
235 return Panel::eventFilter(obj
, event
);
238 void InformationPanel::contextMenuEvent(QContextMenuEvent
* event
)
240 Panel::contextMenuEvent(event
);
243 if (showMultipleSelectionInfo()) {
249 QAction
* previewAction
= popup
.addAction(i18nc("@action:inmenu", "Preview"));
250 previewAction
->setIcon(KIcon("view-preview"));
251 previewAction
->setCheckable(true);
252 previewAction
->setChecked(InformationPanelSettings::showPreview());
254 const bool metaDataAvailable
= MetaDataWidget::metaDataAvailable();
256 QAction
* ratingAction
= popup
.addAction(i18nc("@action:inmenu", "Rating"));
257 ratingAction
->setIcon(KIcon("rating"));
258 ratingAction
->setCheckable(true);
259 ratingAction
->setChecked(InformationPanelSettings::showRating());
260 ratingAction
->setEnabled(metaDataAvailable
);
262 QAction
* commentAction
= popup
.addAction(i18nc("@action:inmenu", "Comment"));
263 commentAction
->setIcon(KIcon("text-plain"));
264 commentAction
->setCheckable(true);
265 commentAction
->setChecked(InformationPanelSettings::showComment());
266 commentAction
->setEnabled(metaDataAvailable
);
268 QAction
* tagsAction
= popup
.addAction(i18nc("@action:inmenu", "Tags"));
269 tagsAction
->setCheckable(true);
270 tagsAction
->setChecked(InformationPanelSettings::showTags());
271 tagsAction
->setEnabled(metaDataAvailable
);
273 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
274 KConfigGroup settings
= config
.group("Show");
275 initMetaInfoSettings(settings
);
277 QList
<QAction
*> actions
;
279 // Get all meta information labels that are available for
280 // the currently shown file item and add them to the popup.
281 Nepomuk::Resource
res(fileItem().url());
282 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
283 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
284 while (it
!= properties
.constEnd()) {
285 Nepomuk::Types::Property
prop(it
.key());
286 const QString key
= prop
.name();
288 // Meta information provided by Nepomuk that is already
289 // available from KFileItem should not be configurable.
290 bool skip
= (key
== "fileExtension") ||
292 (key
== "sourceModified") ||
294 (key
== "mime type");
296 // Check whether there is already a meta information
297 // having the same label. In this case don't show it
298 // twice in the menu.
299 foreach (const QAction
* action
, actions
) {
300 if (action
->data().toString() == key
) {
308 const QString label
= tunedLabel(prop
.label());
309 QAction
* action
= new QAction(label
, &popup
);
310 action
->setCheckable(true);
311 action
->setChecked(settings
.readEntry(key
, true));
312 action
->setData(key
);
313 actions
.append(action
);
319 if (actions
.count() > 0) {
320 popup
.addSeparator();
322 // add all items alphabetically sorted to the popup
323 qSort(actions
.begin(), actions
.end(), lessThan
);
324 foreach (QAction
* action
, actions
) {
325 popup
.addAction(action
);
329 // Open the popup and adjust the settings for the
331 QAction
* action
= popup
.exec(QCursor::pos());
336 const bool isChecked
= action
->isChecked();
337 if (action
== previewAction
) {
338 m_preview
->setVisible(isChecked
);
339 m_previewSeparator
->setVisible(isChecked
);
340 InformationPanelSettings::setShowPreview(isChecked
);
341 updatePhononWidget();
342 } else if (action
== ratingAction
) {
343 m_metaDataWidget
->setRatingVisible(isChecked
);
344 InformationPanelSettings::setShowRating(isChecked
);
345 } else if (action
== commentAction
) {
346 m_metaDataWidget
->setCommentVisible(isChecked
);
347 InformationPanelSettings::setShowComment(isChecked
);
348 } else if (action
== tagsAction
) {
349 m_metaDataWidget
->setTagsVisible(isChecked
);
350 InformationPanelSettings::setShowTags(isChecked
);
352 settings
.writeEntry(action
->data().toString(), action
->isChecked());
357 if (m_metaDataWidget
!= 0) {
358 const bool visible
= m_metaDataWidget
->isRatingVisible() ||
359 m_metaDataWidget
->isCommentVisible() ||
360 m_metaDataWidget
->areTagsVisible();
361 m_metaDataSeparator
->setVisible(visible
);
366 void InformationPanel::showItemInfo()
374 if (showMultipleSelectionInfo()) {
375 KIconLoader iconLoader
;
376 QPixmap icon
= iconLoader
.loadIcon("dialog-information",
377 KIconLoader::NoGroup
,
378 KIconLoader::SizeEnormous
);
379 m_preview
->setPixmap(icon
);
380 setNameLabelText(i18ncp("@info", "%1 item selected", "%1 items selected", m_selection
.count()));
383 const KFileItem item
= fileItem();
384 const KUrl itemUrl
= item
.url();
385 if (!applyPlace(itemUrl
)) {
386 // try to get a preview pixmap from the item...
387 m_pendingPreview
= true;
389 // Mark the currently shown preview as outdated. This is done
390 // with a small delay to prevent a flickering when the next preview
391 // can be shown within a short timeframe.
392 m_outdatedPreviewTimer
->start();
394 KIO::PreviewJob
* job
= KIO::filePreview(KFileItemList() << item
,
402 connect(job
, SIGNAL(gotPreview(const KFileItem
&, const QPixmap
&)),
403 this, SLOT(showPreview(const KFileItem
&, const QPixmap
&)));
404 connect(job
, SIGNAL(failed(const KFileItem
&)),
405 this, SLOT(showIcon(const KFileItem
&)));
407 setNameLabelText(itemUrl
.fileName());
414 void InformationPanel::slotInfoTimeout()
416 m_shownUrl
= m_urlCandidate
;
420 void InformationPanel::markOutdatedPreview()
422 KIconEffect iconEffect
;
423 QPixmap disabledPixmap
= iconEffect
.apply(m_preview
->pixmap(),
424 KIconLoader::Desktop
,
425 KIconLoader::DisabledState
);
426 m_preview
->setPixmap(disabledPixmap
);
429 void InformationPanel::showIcon(const KFileItem
& item
)
431 m_outdatedPreviewTimer
->stop();
432 m_pendingPreview
= false;
433 if (!applyPlace(item
.url())) {
434 m_preview
->setPixmap(item
.pixmap(KIconLoader::SizeEnormous
));
438 void InformationPanel::showPreview(const KFileItem
& item
,
439 const QPixmap
& pixmap
)
441 m_outdatedPreviewTimer
->stop();
444 if (m_pendingPreview
) {
445 m_preview
->setPixmap(pixmap
);
446 m_pendingPreview
= false;
450 void InformationPanel::slotFileRenamed(const QString
& source
, const QString
& dest
)
452 if (m_shownUrl
== KUrl(source
)) {
453 m_shownUrl
= KUrl(dest
);
454 m_fileItem
= KFileItem(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
459 void InformationPanel::slotFilesAdded(const QString
& directory
)
461 if (m_shownUrl
== KUrl(directory
)) {
462 // If the 'trash' icon changes because the trash has been emptied or got filled,
463 // the signal filesAdded("trash:/") will be emitted.
464 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
465 requestDelayedItemInfo(item
);
469 void InformationPanel::slotFilesChanged(const QStringList
& files
)
471 foreach (const QString
& fileName
, files
) {
472 if (m_shownUrl
== KUrl(fileName
)) {
479 void InformationPanel::slotFilesRemoved(const QStringList
& files
)
481 foreach (const QString
& fileName
, files
) {
482 if (m_shownUrl
== KUrl(fileName
)) {
483 // the currently shown item has been removed, show
484 // the parent directory as fallback
491 void InformationPanel::slotEnteredDirectory(const QString
& directory
)
493 if (m_shownUrl
== KUrl(directory
)) {
494 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
495 requestDelayedItemInfo(item
);
499 void InformationPanel::slotLeftDirectory(const QString
& directory
)
501 if (m_shownUrl
== KUrl(directory
)) {
502 // The signal 'leftDirectory' is also emitted when a media
503 // has been unmounted. In this case no directory change will be
504 // done in Dolphin, but the Information Panel must be updated to
505 // indicate an invalid directory.
510 void InformationPanel::slotPlayingStarted()
512 m_preview
->setVisible(m_phononWidget
->mode() != PhononWidget::Video
);
515 void InformationPanel::slotPlayingStopped()
517 m_preview
->setVisible(true);
520 bool InformationPanel::applyPlace(const KUrl
& url
)
522 KFilePlacesModel
* placesModel
= DolphinSettings::instance().placesModel();
523 int count
= placesModel
->rowCount();
525 for (int i
= 0; i
< count
; ++i
) {
526 QModelIndex index
= placesModel
->index(i
, 0);
528 if (url
.equals(placesModel
->url(index
), KUrl::CompareWithoutTrailingSlash
)) {
529 setNameLabelText(placesModel
->text(index
));
530 m_preview
->setPixmap(placesModel
->icon(index
).pixmap(128, 128));
538 void InformationPanel::cancelRequest()
543 void InformationPanel::showMetaInfo()
545 m_metaTextLabel
->clear();
547 if (showMultipleSelectionInfo()) {
548 if (m_metaDataWidget
!= 0) {
550 foreach (const KFileItem
& item
, m_selection
) {
551 urls
.append(item
.targetUrl());
553 m_metaDataWidget
->setFiles(urls
);
556 quint64 totalSize
= 0;
557 foreach (const KFileItem
& item
, m_selection
) {
558 // Only count the size of files, not dirs to match what
559 // DolphinViewContainer::selectionStatusBarText() does.
560 if (!item
.isDir() && !item
.isLink()) {
561 totalSize
+= item
.size();
564 m_metaTextLabel
->add(i18nc("@label", "Total size:"), KIO::convertSize(totalSize
));
566 const KFileItem item
= fileItem();
568 m_metaTextLabel
->add(i18nc("@label", "Type:"), i18nc("@label", "Folder"));
569 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
571 m_metaTextLabel
->add(i18nc("@label", "Type:"), item
.mimeComment());
573 m_metaTextLabel
->add(i18nc("@label", "Size:"), KIO::convertSize(item
.size()));
574 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
577 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
578 KConfigGroup settings
= config
.group("Show");
579 initMetaInfoSettings(settings
);
581 Nepomuk::Resource
res(item
.url());
583 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
584 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
585 while (it
!= properties
.constEnd()) {
586 Nepomuk::Types::Property
prop(it
.key());
587 if (settings
.readEntry(prop
.name(), true)) {
588 // TODO #1: use Nepomuk::formatValue(res, prop) if available
589 // instead of it.value().toString()
590 // TODO #2: using tunedLabel() is a workaround for KDE 4.3 until
591 // we get translated labels
592 m_metaTextLabel
->add(tunedLabel(prop
.label()) + ':', it
.value().toString());
599 if (m_metaDataWidget
!= 0) {
600 m_metaDataWidget
->setFile(item
.targetUrl());
604 updatePhononWidget();
607 KFileItem
InformationPanel::fileItem() const
609 if (!m_fileItem
.isNull()) {
613 if (!m_selection
.isEmpty()) {
614 Q_ASSERT(m_selection
.count() == 1);
615 return m_selection
.first();
618 // no item is hovered and no selection has been done: provide
619 // an item for the directory represented by m_shownUrl
620 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
625 bool InformationPanel::showMultipleSelectionInfo() const
627 return m_fileItem
.isNull() && (m_selection
.count() > 1);
630 bool InformationPanel::isEqualToShownUrl(const KUrl
& url
) const
632 return m_shownUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
);
635 void InformationPanel::setNameLabelText(const QString
& text
)
637 QTextOption textOption
;
638 textOption
.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere
);
640 QTextLayout
textLayout(text
);
641 textLayout
.setFont(m_nameLabel
->font());
642 textLayout
.setTextOption(textOption
);
645 wrappedText
.reserve(text
.length());
647 // wrap the text to fit into the width of m_nameLabel
648 textLayout
.beginLayout();
649 QTextLine line
= textLayout
.createLine();
650 while (line
.isValid()) {
651 line
.setLineWidth(m_nameLabel
->width());
652 wrappedText
+= text
.mid(line
.textStart(), line
.textLength());
654 line
= textLayout
.createLine();
655 if (line
.isValid()) {
656 wrappedText
+= QChar::LineSeparator
;
659 textLayout
.endLayout();
661 m_nameLabel
->setText(wrappedText
);
664 void InformationPanel::reset()
668 m_fileItem
= KFileItem();
672 void InformationPanel::initMetaInfoSettings(KConfigGroup
& group
)
674 if (!group
.readEntry("initialized", false)) {
675 // The resource file is read the first time. Assure
676 // that some meta information is disabled per default.
678 static const char* disabledProperties
[] = {
679 "asText", "contentSize", "depth", "fileExtension",
680 "fileName", "fileSize", "isPartOf", "mimetype", "name",
681 "parentUrl", "plainTextContent", "sourceModified",
683 0 // mandatory last entry
687 while (disabledProperties
[i
] != 0) {
688 group
.writeEntry(disabledProperties
[i
], false);
692 // mark the group as initialized
693 group
.writeEntry("initialized", true);
697 void InformationPanel::updatePhononWidget()
699 const bool multipleSelections
= showMultipleSelectionInfo();
700 const bool showPreview
= InformationPanelSettings::showPreview();
702 if (multipleSelections
|| !showPreview
) {
703 m_phononWidget
->hide();
704 } else if (!multipleSelections
&& showPreview
) {
705 const KFileItem item
= fileItem();
706 const QString mimeType
= item
.mimetype();
707 const bool usePhonon
= Phonon::BackendCapabilities::isMimeTypeAvailable(mimeType
) &&
708 (mimeType
!= "image/png"); // TODO: workaround, as Phonon
709 // thinks it supports PNG images
711 m_phononWidget
->show();
712 PhononWidget::Mode mode
= mimeType
.startsWith(QLatin1String("video"))
713 ? PhononWidget::Video
714 : PhononWidget::Audio
;
715 m_phononWidget
->setMode(mode
);
716 m_phononWidget
->setUrl(item
.url());
717 if ((mode
== PhononWidget::Video
) && m_preview
->isVisible()) {
718 m_phononWidget
->setVideoSize(m_preview
->size());
721 m_phononWidget
->hide();
722 m_preview
->setVisible(true);
727 QString
InformationPanel::tunedLabel(const QString
& label
) const
730 const int labelLength
= label
.length();
731 if (labelLength
> 0) {
732 tunedLabel
.reserve(labelLength
);
733 tunedLabel
= label
[0].toUpper();
734 for (int i
= 1; i
< labelLength
; ++i
) {
735 if (label
[i
].isUpper() && !label
[i
- 1].isSpace() && !label
[i
- 1].isUpper()) {
737 tunedLabel
+= label
[i
].toLower();
739 tunedLabel
+= label
[i
];
746 void InformationPanel::init()
748 m_infoTimer
= new QTimer(this);
749 m_infoTimer
->setInterval(300);
750 m_infoTimer
->setSingleShot(true);
751 connect(m_infoTimer
, SIGNAL(timeout()),
752 this, SLOT(slotInfoTimeout()));
754 // Initialize timer for disabling an outdated preview with a small
755 // delay. This prevents flickering if the new preview can be generated
756 // within a very small timeframe.
757 m_outdatedPreviewTimer
= new QTimer(this);
758 m_outdatedPreviewTimer
->setInterval(300);
759 m_outdatedPreviewTimer
->setSingleShot(true);
760 connect(m_outdatedPreviewTimer
, SIGNAL(timeout()),
761 this, SLOT(markOutdatedPreview()));
763 QVBoxLayout
* layout
= new QVBoxLayout
;
764 layout
->setSpacing(KDialog::spacingHint());
767 m_nameLabel
= new QLabel(this);
768 QFont font
= m_nameLabel
->font();
770 m_nameLabel
->setFont(font
);
771 m_nameLabel
->setAlignment(Qt::AlignHCenter
);
772 m_nameLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
773 m_nameLabel
->setMaximumWidth(KIconLoader::SizeEnormous
);
776 const int minPreviewWidth
= KIconLoader::SizeEnormous
+ KIconLoader::SizeMedium
;
778 m_preview
= new PixmapViewer(this);
779 m_preview
->setMinimumWidth(minPreviewWidth
);
780 m_preview
->setMinimumHeight(KIconLoader::SizeEnormous
);
782 m_phononWidget
= new PhononWidget(this);
783 m_phononWidget
->setMinimumWidth(minPreviewWidth
);
784 connect(m_phononWidget
, SIGNAL(playingStarted()),
785 this, SLOT(slotPlayingStarted()));
786 connect(m_phononWidget
, SIGNAL(playingStopped()),
787 this, SLOT(slotPlayingStopped()));
789 m_previewSeparator
= new KSeparator(this);
791 const bool showPreview
= InformationPanelSettings::showPreview();
792 m_preview
->setVisible(showPreview
);
793 m_previewSeparator
->setVisible(showPreview
);
795 if (MetaDataWidget::metaDataAvailable()) {
796 // rating, comment and tags
797 m_metaDataWidget
= new MetaDataWidget(this);
798 m_metaDataWidget
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
799 m_metaDataWidget
->setMaximumWidth(KIconLoader::SizeEnormous
);
801 const bool showRating
= InformationPanelSettings::showRating();
802 const bool showComment
= InformationPanelSettings::showComment();
803 const bool showTags
= InformationPanelSettings::showTags();
805 m_metaDataWidget
->setRatingVisible(showRating
);
806 m_metaDataWidget
->setCommentVisible(showComment
);
807 m_metaDataWidget
->setTagsVisible(showTags
);
809 m_metaDataSeparator
= new KSeparator(this);
810 m_metaDataSeparator
->setVisible(showRating
|| showComment
|| showTags
);
813 // general meta text information
814 m_metaTextLabel
= new MetaTextLabel(this);
815 m_metaTextLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
817 m_metaTextArea
= new QScrollArea(this);
818 m_metaTextArea
->setWidget(m_metaTextLabel
);
819 m_metaTextArea
->setWidgetResizable(true);
820 m_metaTextArea
->setFrameShape(QFrame::NoFrame
);
822 QWidget
* viewport
= m_metaTextArea
->viewport();
823 viewport
->installEventFilter(this);
825 QPalette palette
= viewport
->palette();
826 palette
.setColor(viewport
->backgroundRole(), QColor(Qt::transparent
));
827 viewport
->setPalette(palette
);
829 layout
->addWidget(m_nameLabel
);
830 layout
->addWidget(new KSeparator(this));
831 layout
->addWidget(m_preview
);
832 layout
->addWidget(m_phononWidget
);
833 layout
->addWidget(m_previewSeparator
);
834 if (m_metaDataWidget
!= 0) {
835 layout
->addWidget(m_metaDataWidget
);
836 layout
->addWidget(m_metaDataSeparator
);
838 layout
->addWidget(m_metaTextArea
);
841 org::kde::KDirNotify
* dirNotify
= new org::kde::KDirNotify(QString(), QString(),
842 QDBusConnection::sessionBus(), this);
843 connect(dirNotify
, SIGNAL(FileRenamed(QString
, QString
)), SLOT(slotFileRenamed(QString
, QString
)));
844 connect(dirNotify
, SIGNAL(FilesAdded(QString
)), SLOT(slotFilesAdded(QString
)));
845 connect(dirNotify
, SIGNAL(FilesChanged(QStringList
)), SLOT(slotFilesChanged(QStringList
)));
846 connect(dirNotify
, SIGNAL(FilesRemoved(QStringList
)), SLOT(slotFilesRemoved(QStringList
)));
847 connect(dirNotify
, SIGNAL(enteredDirectory(QString
)), SLOT(slotEnteredDirectory(QString
)));
848 connect(dirNotify
, SIGNAL(leftDirectory(QString
)), SLOT(slotLeftDirectory(QString
)));
850 m_initialized
= true;
853 #include "informationpanel.moc"