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>
38 #include <Nepomuk/Resource>
39 #include <Nepomuk/Types/Property>
40 #include <Nepomuk/Variant>
43 #include <Phonon/BackendCapabilities>
44 #include <Phonon/MediaObject>
45 #include <Phonon/SeekSlider>
48 #include <QInputDialog>
52 #include <QResizeEvent>
53 #include <QScrollArea>
54 #include <QTextLayout>
58 #include <QVBoxLayout>
60 #include "dolphin_informationpanelsettings.h"
61 #include "settings/dolphinsettings.h"
62 #include "metadatawidget.h"
63 #include "metatextlabel.h"
64 #include "phononwidget.h"
65 #include "pixmapviewer.h"
68 * Helper function for sorting items with qSort() in
69 * InformationPanel::contextMenu().
71 bool lessThan(const QAction
* action1
, const QAction
* action2
)
73 return action1
->text() < action2
->text();
77 InformationPanel::InformationPanel(QWidget
* parent
) :
80 m_pendingPreview(false),
82 m_outdatedPreviewTimer(0),
89 m_previewSeparator(0),
92 m_metaDataSeparator(0),
98 InformationPanel::~InformationPanel()
100 InformationPanelSettings::self()->writeConfig();
103 QSize
InformationPanel::sizeHint() const
105 QSize size
= Panel::sizeHint();
106 size
.setWidth(minimumSizeHint().width());
110 void InformationPanel::setUrl(const KUrl
& url
)
113 if (url
.isValid() && !isEqualToShownUrl(url
)) {
124 void InformationPanel::setSelection(const KFileItemList
& selection
)
130 if ((selection
.count() == 0) && (m_selection
.count() == 0)) {
131 // The selection has not really changed, only the current index.
132 // QItemSelectionModel emits a signal in this case and it is less
133 // expensive doing the check this way instead of patching
134 // DolphinView::emitSelectionChanged().
138 m_selection
= selection
;
140 const int count
= selection
.count();
142 if (!isEqualToShownUrl(url())) {
147 if ((count
== 1) && !selection
.first().url().isEmpty()) {
148 m_urlCandidate
= selection
.first().url();
150 m_infoTimer
->start();
154 void InformationPanel::requestDelayedItemInfo(const KFileItem
& item
)
162 m_fileItem
= KFileItem();
164 // The cursor is above the viewport. If files are selected,
165 // show information regarding the selection.
166 if (m_selection
.size() > 0) {
167 m_pendingPreview
= false;
168 m_infoTimer
->start();
171 const KUrl url
= item
.url();
172 if (url
.isValid() && !isEqualToShownUrl(url
)) {
173 m_urlCandidate
= item
.url();
175 m_infoTimer
->start();
180 void InformationPanel::showEvent(QShowEvent
* event
)
182 Panel::showEvent(event
);
183 if (!event
->spontaneous()) {
184 if (!m_initialized
) {
185 // do a delayed initialization so that no performance
186 // penalty is given when Dolphin is started with a closed
194 void InformationPanel::resizeEvent(QResizeEvent
* event
)
197 // If the text inside the name label or the info label cannot
198 // get wrapped, then the maximum width of the label is increased
199 // so that the width of the information panel gets increased.
200 // To prevent this, the maximum width is adjusted to
201 // the current width of the panel.
202 const int maxWidth
= event
->size().width() - KDialog::spacingHint() * 4;
203 m_nameLabel
->setMaximumWidth(maxWidth
);
205 // try to increase the preview as large as possible
206 m_preview
->setSizeHint(QSize(maxWidth
, maxWidth
));
207 m_urlCandidate
= m_shownUrl
; // reset the URL candidate if a resizing is done
208 m_infoTimer
->start();
210 if (m_phononWidget
->isVisible() && (m_phononWidget
->mode() == PhononWidget::Video
)) {
211 // assure that the size of the video player is the same as the preview size
212 m_phononWidget
->setVideoSize(QSize(maxWidth
, maxWidth
));
215 Panel::resizeEvent(event
);
218 bool InformationPanel::eventFilter(QObject
* obj
, QEvent
* event
)
220 // Check whether the size of the meta text area has changed and adjust
221 // the fixed width in a way that no horizontal scrollbar needs to be shown.
222 if ((obj
== m_metaTextArea
->viewport()) && (event
->type() == QEvent::Resize
)) {
223 QResizeEvent
* resizeEvent
= static_cast<QResizeEvent
*>(event
);
224 m_metaTextLabel
->setFixedWidth(resizeEvent
->size().width());
226 return Panel::eventFilter(obj
, event
);
229 void InformationPanel::contextMenuEvent(QContextMenuEvent
* event
)
231 Panel::contextMenuEvent(event
);
234 if (showMultipleSelectionInfo()) {
240 QAction
* previewAction
= popup
.addAction(i18nc("@action:inmenu", "Preview"));
241 previewAction
->setIcon(KIcon("view-preview"));
242 previewAction
->setCheckable(true);
243 previewAction
->setChecked(InformationPanelSettings::showPreview());
245 const bool metaDataAvailable
= MetaDataWidget::metaDataAvailable();
247 QAction
* ratingAction
= popup
.addAction(i18nc("@action:inmenu", "Rating"));
248 ratingAction
->setIcon(KIcon("rating"));
249 ratingAction
->setCheckable(true);
250 ratingAction
->setChecked(InformationPanelSettings::showRating());
251 ratingAction
->setEnabled(metaDataAvailable
);
253 QAction
* commentAction
= popup
.addAction(i18nc("@action:inmenu", "Comment"));
254 commentAction
->setIcon(KIcon("text-plain"));
255 commentAction
->setCheckable(true);
256 commentAction
->setChecked(InformationPanelSettings::showComment());
257 commentAction
->setEnabled(metaDataAvailable
);
259 QAction
* tagsAction
= popup
.addAction(i18nc("@action:inmenu", "Tags"));
260 tagsAction
->setCheckable(true);
261 tagsAction
->setChecked(InformationPanelSettings::showTags());
262 tagsAction
->setEnabled(metaDataAvailable
);
264 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
265 KConfigGroup settings
= config
.group("Show");
266 initMetaInfoSettings(settings
);
268 QList
<QAction
*> actions
;
270 // Get all meta information labels that are available for
271 // the currently shown file item and add them to the popup.
272 Nepomuk::Resource
res(fileItem().url());
273 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
274 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
275 while (it
!= properties
.constEnd()) {
276 Nepomuk::Types::Property
prop(it
.key());
277 const QString key
= prop
.label();
279 // Meta information provided by Nepomuk that is already
280 // available from KFileItem should not be configurable.
281 bool skip
= (key
== "fileExtension") ||
283 (key
== "sourceModified") ||
285 (key
== "mime type");
287 // Check whether there is already a meta information
288 // having the same label. In this case don't show it
289 // twice in the menu.
290 foreach (const QAction
* action
, actions
) {
291 if (action
->data().toString() == key
) {
299 const QString label
= key
; // TODO
300 QAction
* action
= new QAction(label
, &popup
);
301 action
->setCheckable(true);
302 action
->setChecked(settings
.readEntry(key
, true));
303 action
->setData(key
);
304 actions
.append(action
);
310 if (actions
.count() > 0) {
311 popup
.addSeparator();
313 // add all items alphabetically sorted to the popup
314 qSort(actions
.begin(), actions
.end(), lessThan
);
315 foreach (QAction
* action
, actions
) {
316 popup
.addAction(action
);
320 // Open the popup and adjust the settings for the
322 QAction
* action
= popup
.exec(QCursor::pos());
327 const bool isChecked
= action
->isChecked();
328 if (action
== previewAction
) {
329 m_preview
->setVisible(isChecked
);
330 m_previewSeparator
->setVisible(isChecked
);
331 InformationPanelSettings::setShowPreview(isChecked
);
332 updatePhononWidget();
333 } else if (action
== ratingAction
) {
334 m_metaDataWidget
->setRatingVisible(isChecked
);
335 InformationPanelSettings::setShowRating(isChecked
);
336 } else if (action
== commentAction
) {
337 m_metaDataWidget
->setCommentVisible(isChecked
);
338 InformationPanelSettings::setShowComment(isChecked
);
339 } else if (action
== tagsAction
) {
340 m_metaDataWidget
->setTagsVisible(isChecked
);
341 InformationPanelSettings::setShowTags(isChecked
);
343 settings
.writeEntry(action
->data().toString(), action
->isChecked());
348 const bool visible
= m_metaDataWidget
->isRatingVisible() ||
349 m_metaDataWidget
->isCommentVisible() ||
350 m_metaDataWidget
->areTagsVisible();
351 m_metaDataSeparator
->setVisible(visible
);
355 void InformationPanel::showItemInfo()
363 if (showMultipleSelectionInfo()) {
364 KIconLoader iconLoader
;
365 QPixmap icon
= iconLoader
.loadIcon("dialog-information",
366 KIconLoader::NoGroup
,
367 KIconLoader::SizeEnormous
);
368 m_preview
->setPixmap(icon
);
369 setNameLabelText(i18ncp("@info", "%1 item selected", "%1 items selected", m_selection
.count()));
372 const KFileItem item
= fileItem();
373 const KUrl itemUrl
= item
.url();
374 if (!applyPlace(itemUrl
)) {
375 // try to get a preview pixmap from the item...
376 m_pendingPreview
= true;
378 // Mark the currently shown preview as outdated. This is done
379 // with a small delay to prevent a flickering when the next preview
380 // can be shown within a short timeframe.
381 m_outdatedPreviewTimer
->start();
383 KIO::PreviewJob
* job
= KIO::filePreview(KFileItemList() << item
,
391 connect(job
, SIGNAL(gotPreview(const KFileItem
&, const QPixmap
&)),
392 this, SLOT(showPreview(const KFileItem
&, const QPixmap
&)));
393 connect(job
, SIGNAL(failed(const KFileItem
&)),
394 this, SLOT(showIcon(const KFileItem
&)));
396 setNameLabelText(itemUrl
.fileName());
403 void InformationPanel::slotInfoTimeout()
405 m_shownUrl
= m_urlCandidate
;
409 void InformationPanel::markOutdatedPreview()
411 KIconEffect iconEffect
;
412 QPixmap disabledPixmap
= iconEffect
.apply(m_preview
->pixmap(),
413 KIconLoader::Desktop
,
414 KIconLoader::DisabledState
);
415 m_preview
->setPixmap(disabledPixmap
);
418 void InformationPanel::showIcon(const KFileItem
& item
)
420 m_outdatedPreviewTimer
->stop();
421 m_pendingPreview
= false;
422 if (!applyPlace(item
.url())) {
423 m_preview
->setPixmap(item
.pixmap(KIconLoader::SizeEnormous
));
427 void InformationPanel::showPreview(const KFileItem
& item
,
428 const QPixmap
& pixmap
)
430 m_outdatedPreviewTimer
->stop();
433 if (m_pendingPreview
) {
434 m_preview
->setPixmap(pixmap
);
435 m_pendingPreview
= false;
439 void InformationPanel::slotFileRenamed(const QString
& source
, const QString
& dest
)
441 const KUrl sourceUrl
= KUrl(source
);
443 // Verify whether the renamed item is selected. If this is the case, the
444 // selection must be updated with the renamed item.
445 bool isSelected
= false;
446 for (int i
= m_selection
.size() - 1; i
>= 0; --i
) {
447 if (m_selection
[i
].url() == sourceUrl
) {
448 m_selection
.removeAt(i
);
454 if ((m_shownUrl
== sourceUrl
) || isSelected
) {
455 m_shownUrl
= KUrl(dest
);
456 m_fileItem
= KFileItem(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
458 m_selection
.append(m_fileItem
);
464 void InformationPanel::slotFilesAdded(const QString
& directory
)
466 if (m_shownUrl
== KUrl(directory
)) {
467 // If the 'trash' icon changes because the trash has been emptied or got filled,
468 // the signal filesAdded("trash:/") will be emitted.
469 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
470 requestDelayedItemInfo(item
);
474 void InformationPanel::slotFilesChanged(const QStringList
& files
)
476 foreach (const QString
& fileName
, files
) {
477 if (m_shownUrl
== KUrl(fileName
)) {
484 void InformationPanel::slotFilesRemoved(const QStringList
& files
)
486 foreach (const QString
& fileName
, files
) {
487 if (m_shownUrl
== KUrl(fileName
)) {
488 // the currently shown item has been removed, show
489 // the parent directory as fallback
496 void InformationPanel::slotEnteredDirectory(const QString
& directory
)
498 if (m_shownUrl
== KUrl(directory
)) {
499 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
500 requestDelayedItemInfo(item
);
504 void InformationPanel::slotLeftDirectory(const QString
& directory
)
506 if (m_shownUrl
== KUrl(directory
)) {
507 // The signal 'leftDirectory' is also emitted when a media
508 // has been unmounted. In this case no directory change will be
509 // done in Dolphin, but the Information Panel must be updated to
510 // indicate an invalid directory.
515 void InformationPanel::slotPlayingStarted()
517 m_preview
->setVisible(m_phononWidget
->mode() != PhononWidget::Video
);
520 void InformationPanel::slotPlayingStopped()
522 m_preview
->setVisible(true);
525 bool InformationPanel::applyPlace(const KUrl
& url
)
527 KFilePlacesModel
* placesModel
= DolphinSettings::instance().placesModel();
528 int count
= placesModel
->rowCount();
530 for (int i
= 0; i
< count
; ++i
) {
531 QModelIndex index
= placesModel
->index(i
, 0);
533 if (url
.equals(placesModel
->url(index
), KUrl::CompareWithoutTrailingSlash
)) {
534 setNameLabelText(placesModel
->text(index
));
535 m_preview
->setPixmap(placesModel
->icon(index
).pixmap(128, 128));
543 void InformationPanel::cancelRequest()
548 void InformationPanel::showMetaInfo()
550 m_metaTextLabel
->clear();
552 if (showMultipleSelectionInfo()) {
553 if (m_metaDataWidget
!= 0) {
555 foreach (const KFileItem
& item
, m_selection
) {
556 urls
.append(item
.targetUrl());
558 m_metaDataWidget
->setFiles(urls
);
561 quint64 totalSize
= 0;
562 foreach (const KFileItem
& item
, m_selection
) {
563 // Only count the size of files, not dirs to match what
564 // DolphinViewContainer::selectionStatusBarText() does.
565 if (!item
.isDir() && !item
.isLink()) {
566 totalSize
+= item
.size();
569 m_metaTextLabel
->add(i18nc("@label", "Total size:"), KIO::convertSize(totalSize
));
571 const KFileItem item
= fileItem();
573 m_metaTextLabel
->add(i18nc("@label", "Type:"), i18nc("@label", "Folder"));
574 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
576 m_metaTextLabel
->add(i18nc("@label", "Type:"), item
.mimeComment());
578 m_metaTextLabel
->add(i18nc("@label", "Size:"), KIO::convertSize(item
.size()));
579 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
582 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
583 KConfigGroup settings
= config
.group("Show");
584 initMetaInfoSettings(settings
);
586 Nepomuk::Resource
res(item
.url());
588 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
589 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
590 while (it
!= properties
.constEnd()) {
591 Nepomuk::Types::Property
prop(it
.key());
592 const QString label
= prop
.label();
593 if (settings
.readEntry(label
, true)) {
594 // TODO: use Nepomuk::formatValue(res, prop) if available
595 // instead of it.value().toString()
596 m_metaTextLabel
->add(label
, it
.value().toString());
603 if (m_metaDataWidget
!= 0) {
604 m_metaDataWidget
->setFile(item
.targetUrl());
608 updatePhononWidget();
611 KFileItem
InformationPanel::fileItem() const
613 if (!m_fileItem
.isNull()) {
617 if (!m_selection
.isEmpty()) {
618 Q_ASSERT(m_selection
.count() == 1);
619 return m_selection
.first();
622 // no item is hovered and no selection has been done: provide
623 // an item for the directory represented by m_shownUrl
624 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
629 bool InformationPanel::showMultipleSelectionInfo() const
631 return m_fileItem
.isNull() && (m_selection
.count() > 1);
634 bool InformationPanel::isEqualToShownUrl(const KUrl
& url
) const
636 return m_shownUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
);
639 void InformationPanel::setNameLabelText(const QString
& text
)
641 QTextOption textOption
;
642 textOption
.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere
);
644 QTextLayout
textLayout(text
);
645 textLayout
.setFont(m_nameLabel
->font());
646 textLayout
.setTextOption(textOption
);
649 wrappedText
.reserve(text
.length());
651 // wrap the text to fit into the width of m_nameLabel
652 textLayout
.beginLayout();
653 QTextLine line
= textLayout
.createLine();
654 while (line
.isValid()) {
655 line
.setLineWidth(m_nameLabel
->width());
656 wrappedText
+= text
.mid(line
.textStart(), line
.textLength());
658 line
= textLayout
.createLine();
659 if (line
.isValid()) {
660 wrappedText
+= QChar::LineSeparator
;
663 textLayout
.endLayout();
665 m_nameLabel
->setText(wrappedText
);
668 void InformationPanel::reset()
672 m_fileItem
= KFileItem();
676 void InformationPanel::initMetaInfoSettings(KConfigGroup
& group
)
678 if (!group
.readEntry("initialized", false)) {
679 // The resource file is read the first time. Assure
680 // that some meta information is disabled per default.
681 group
.writeEntry("fileExtension", false);
682 group
.writeEntry("url", false);
683 group
.writeEntry("sourceModified", false);
684 group
.writeEntry("parentUrl", false);
685 group
.writeEntry("size", false);
686 group
.writeEntry("mime type", false);
687 group
.writeEntry("depth", false);
688 group
.writeEntry("name", false);
690 // mark the group as initialized
691 group
.writeEntry("initialized", true);
695 void InformationPanel::updatePhononWidget()
697 const bool multipleSelections
= showMultipleSelectionInfo();
698 const bool showPreview
= InformationPanelSettings::showPreview();
700 if (multipleSelections
|| !showPreview
) {
701 m_phononWidget
->hide();
702 } else if (!multipleSelections
&& showPreview
) {
703 const KFileItem item
= fileItem();
704 const QString mimeType
= item
.mimetype();
705 const bool usePhonon
= Phonon::BackendCapabilities::isMimeTypeAvailable(mimeType
) &&
706 (mimeType
!= "image/png"); // TODO: workaround, as Phonon
707 // thinks it supports PNG images
709 m_phononWidget
->show();
710 PhononWidget::Mode mode
= mimeType
.startsWith("video")
711 ? PhononWidget::Video
712 : PhononWidget::Audio
;
713 m_phononWidget
->setMode(mode
);
714 m_phononWidget
->setUrl(item
.url());
715 if ((mode
== PhononWidget::Video
) && m_preview
->isVisible()) {
716 m_phononWidget
->setVideoSize(m_preview
->size());
719 m_phononWidget
->hide();
720 m_preview
->setVisible(true);
725 void InformationPanel::init()
727 m_infoTimer
= new QTimer(this);
728 m_infoTimer
->setInterval(300);
729 m_infoTimer
->setSingleShot(true);
730 connect(m_infoTimer
, SIGNAL(timeout()),
731 this, SLOT(slotInfoTimeout()));
733 // Initialize timer for disabling an outdated preview with a small
734 // delay. This prevents flickering if the new preview can be generated
735 // within a very small timeframe.
736 m_outdatedPreviewTimer
= new QTimer(this);
737 m_outdatedPreviewTimer
->setInterval(300);
738 m_outdatedPreviewTimer
->setSingleShot(true);
739 connect(m_outdatedPreviewTimer
, SIGNAL(timeout()),
740 this, SLOT(markOutdatedPreview()));
742 QVBoxLayout
* layout
= new QVBoxLayout
;
743 layout
->setSpacing(KDialog::spacingHint());
746 m_nameLabel
= new QLabel(this);
747 QFont font
= m_nameLabel
->font();
749 m_nameLabel
->setFont(font
);
750 m_nameLabel
->setAlignment(Qt::AlignHCenter
);
751 m_nameLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
752 m_nameLabel
->setMaximumWidth(KIconLoader::SizeEnormous
);
755 const int minPreviewWidth
= KIconLoader::SizeEnormous
+ KIconLoader::SizeMedium
;
757 m_preview
= new PixmapViewer(this);
758 m_preview
->setMinimumWidth(minPreviewWidth
);
759 m_preview
->setMinimumHeight(KIconLoader::SizeEnormous
);
761 m_phononWidget
= new PhononWidget(this);
762 m_phononWidget
->setMinimumWidth(minPreviewWidth
);
763 connect(m_phononWidget
, SIGNAL(playingStarted()),
764 this, SLOT(slotPlayingStarted()));
765 connect(m_phononWidget
, SIGNAL(playingStopped()),
766 this, SLOT(slotPlayingStopped()));
768 m_previewSeparator
= new KSeparator(this);
770 const bool showPreview
= InformationPanelSettings::showPreview();
771 m_preview
->setVisible(showPreview
);
772 m_previewSeparator
->setVisible(showPreview
);
774 if (MetaDataWidget::metaDataAvailable()) {
775 // rating, comment and tags
776 m_metaDataWidget
= new MetaDataWidget(this);
777 m_metaDataWidget
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
779 const bool showRating
= InformationPanelSettings::showRating();
780 const bool showComment
= InformationPanelSettings::showComment();
781 const bool showTags
= InformationPanelSettings::showTags();
783 m_metaDataWidget
->setRatingVisible(showRating
);
784 m_metaDataWidget
->setCommentVisible(showComment
);
785 m_metaDataWidget
->setTagsVisible(showTags
);
787 m_metaDataSeparator
= new KSeparator(this);
788 m_metaDataSeparator
->setVisible(showRating
|| showComment
|| showTags
);
791 // general meta text information
792 m_metaTextLabel
= new MetaTextLabel(this);
793 m_metaTextLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
795 m_metaTextArea
= new QScrollArea(this);
796 m_metaTextArea
->setWidget(m_metaTextLabel
);
797 m_metaTextArea
->setWidgetResizable(true);
798 m_metaTextArea
->setFrameShape(QFrame::NoFrame
);
800 QWidget
* viewport
= m_metaTextArea
->viewport();
801 viewport
->installEventFilter(this);
803 QPalette palette
= viewport
->palette();
804 palette
.setColor(viewport
->backgroundRole(), QColor(Qt::transparent
));
805 viewport
->setPalette(palette
);
807 layout
->addWidget(m_nameLabel
);
808 layout
->addWidget(new KSeparator(this));
809 layout
->addWidget(m_preview
);
810 layout
->addWidget(m_phononWidget
);
811 layout
->addWidget(m_previewSeparator
);
812 if (m_metaDataWidget
!= 0) {
813 layout
->addWidget(m_metaDataWidget
);
814 layout
->addWidget(m_metaDataSeparator
);
816 layout
->addWidget(m_metaTextArea
);
819 org::kde::KDirNotify
* dirNotify
= new org::kde::KDirNotify(QString(), QString(),
820 QDBusConnection::sessionBus(), this);
821 connect(dirNotify
, SIGNAL(FileRenamed(QString
, QString
)), SLOT(slotFileRenamed(QString
, QString
)));
822 connect(dirNotify
, SIGNAL(FilesAdded(QString
)), SLOT(slotFilesAdded(QString
)));
823 connect(dirNotify
, SIGNAL(FilesChanged(QStringList
)), SLOT(slotFilesChanged(QStringList
)));
824 connect(dirNotify
, SIGNAL(FilesRemoved(QStringList
)), SLOT(slotFilesRemoved(QStringList
)));
825 connect(dirNotify
, SIGNAL(enteredDirectory(QString
)), SLOT(slotEnteredDirectory(QString
)));
826 connect(dirNotify
, SIGNAL(leftDirectory(QString
)), SLOT(slotLeftDirectory(QString
)));
828 m_initialized
= true;
831 #include "informationpanel.moc"