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 if (m_metaDataWidget
!= 0) {
349 const bool visible
= m_metaDataWidget
->isRatingVisible() ||
350 m_metaDataWidget
->isCommentVisible() ||
351 m_metaDataWidget
->areTagsVisible();
352 m_metaDataSeparator
->setVisible(visible
);
357 void InformationPanel::showItemInfo()
365 if (showMultipleSelectionInfo()) {
366 KIconLoader iconLoader
;
367 QPixmap icon
= iconLoader
.loadIcon("dialog-information",
368 KIconLoader::NoGroup
,
369 KIconLoader::SizeEnormous
);
370 m_preview
->setPixmap(icon
);
371 setNameLabelText(i18ncp("@info", "%1 item selected", "%1 items selected", m_selection
.count()));
374 const KFileItem item
= fileItem();
375 const KUrl itemUrl
= item
.url();
376 if (!applyPlace(itemUrl
)) {
377 // try to get a preview pixmap from the item...
378 m_pendingPreview
= true;
380 // Mark the currently shown preview as outdated. This is done
381 // with a small delay to prevent a flickering when the next preview
382 // can be shown within a short timeframe.
383 m_outdatedPreviewTimer
->start();
385 KIO::PreviewJob
* job
= KIO::filePreview(KFileItemList() << item
,
393 connect(job
, SIGNAL(gotPreview(const KFileItem
&, const QPixmap
&)),
394 this, SLOT(showPreview(const KFileItem
&, const QPixmap
&)));
395 connect(job
, SIGNAL(failed(const KFileItem
&)),
396 this, SLOT(showIcon(const KFileItem
&)));
398 setNameLabelText(itemUrl
.fileName());
405 void InformationPanel::slotInfoTimeout()
407 m_shownUrl
= m_urlCandidate
;
411 void InformationPanel::markOutdatedPreview()
413 KIconEffect iconEffect
;
414 QPixmap disabledPixmap
= iconEffect
.apply(m_preview
->pixmap(),
415 KIconLoader::Desktop
,
416 KIconLoader::DisabledState
);
417 m_preview
->setPixmap(disabledPixmap
);
420 void InformationPanel::showIcon(const KFileItem
& item
)
422 m_outdatedPreviewTimer
->stop();
423 m_pendingPreview
= false;
424 if (!applyPlace(item
.url())) {
425 m_preview
->setPixmap(item
.pixmap(KIconLoader::SizeEnormous
));
429 void InformationPanel::showPreview(const KFileItem
& item
,
430 const QPixmap
& pixmap
)
432 m_outdatedPreviewTimer
->stop();
435 if (m_pendingPreview
) {
436 m_preview
->setPixmap(pixmap
);
437 m_pendingPreview
= false;
441 void InformationPanel::slotFileRenamed(const QString
& source
, const QString
& dest
)
443 const KUrl sourceUrl
= KUrl(source
);
445 // Verify whether the renamed item is selected. If this is the case, the
446 // selection must be updated with the renamed item.
447 bool isSelected
= false;
448 for (int i
= m_selection
.size() - 1; i
>= 0; --i
) {
449 if (m_selection
[i
].url() == sourceUrl
) {
450 m_selection
.removeAt(i
);
456 if ((m_shownUrl
== sourceUrl
) || isSelected
) {
457 m_shownUrl
= KUrl(dest
);
458 m_fileItem
= KFileItem(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
460 m_selection
.append(m_fileItem
);
466 void InformationPanel::slotFilesAdded(const QString
& directory
)
468 if (m_shownUrl
== KUrl(directory
)) {
469 // If the 'trash' icon changes because the trash has been emptied or got filled,
470 // the signal filesAdded("trash:/") will be emitted.
471 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
472 requestDelayedItemInfo(item
);
476 void InformationPanel::slotFilesChanged(const QStringList
& files
)
478 foreach (const QString
& fileName
, files
) {
479 if (m_shownUrl
== KUrl(fileName
)) {
486 void InformationPanel::slotFilesRemoved(const QStringList
& files
)
488 foreach (const QString
& fileName
, files
) {
489 if (m_shownUrl
== KUrl(fileName
)) {
490 // the currently shown item has been removed, show
491 // the parent directory as fallback
498 void InformationPanel::slotEnteredDirectory(const QString
& directory
)
500 if (m_shownUrl
== KUrl(directory
)) {
501 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
502 requestDelayedItemInfo(item
);
506 void InformationPanel::slotLeftDirectory(const QString
& directory
)
508 if (m_shownUrl
== KUrl(directory
)) {
509 // The signal 'leftDirectory' is also emitted when a media
510 // has been unmounted. In this case no directory change will be
511 // done in Dolphin, but the Information Panel must be updated to
512 // indicate an invalid directory.
517 void InformationPanel::slotPlayingStarted()
519 m_preview
->setVisible(m_phononWidget
->mode() != PhononWidget::Video
);
522 void InformationPanel::slotPlayingStopped()
524 m_preview
->setVisible(true);
527 bool InformationPanel::applyPlace(const KUrl
& url
)
529 KFilePlacesModel
* placesModel
= DolphinSettings::instance().placesModel();
530 int count
= placesModel
->rowCount();
532 for (int i
= 0; i
< count
; ++i
) {
533 QModelIndex index
= placesModel
->index(i
, 0);
535 if (url
.equals(placesModel
->url(index
), KUrl::CompareWithoutTrailingSlash
)) {
536 setNameLabelText(placesModel
->text(index
));
537 m_preview
->setPixmap(placesModel
->icon(index
).pixmap(128, 128));
545 void InformationPanel::cancelRequest()
550 void InformationPanel::showMetaInfo()
552 m_metaTextLabel
->clear();
554 if (showMultipleSelectionInfo()) {
555 if (m_metaDataWidget
!= 0) {
557 foreach (const KFileItem
& item
, m_selection
) {
558 urls
.append(item
.targetUrl());
560 m_metaDataWidget
->setFiles(urls
);
563 quint64 totalSize
= 0;
564 foreach (const KFileItem
& item
, m_selection
) {
565 // Only count the size of files, not dirs to match what
566 // DolphinViewContainer::selectionStatusBarText() does.
567 if (!item
.isDir() && !item
.isLink()) {
568 totalSize
+= item
.size();
571 m_metaTextLabel
->add(i18nc("@label", "Total size:"), KIO::convertSize(totalSize
));
573 const KFileItem item
= fileItem();
575 m_metaTextLabel
->add(i18nc("@label", "Type:"), i18nc("@label", "Folder"));
576 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
578 m_metaTextLabel
->add(i18nc("@label", "Type:"), item
.mimeComment());
580 m_metaTextLabel
->add(i18nc("@label", "Size:"), KIO::convertSize(item
.size()));
581 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
584 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
585 KConfigGroup settings
= config
.group("Show");
586 initMetaInfoSettings(settings
);
588 Nepomuk::Resource
res(item
.url());
590 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
591 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
592 while (it
!= properties
.constEnd()) {
593 Nepomuk::Types::Property
prop(it
.key());
594 const QString label
= prop
.label();
595 if (settings
.readEntry(label
, true)) {
596 // TODO: use Nepomuk::formatValue(res, prop) if available
597 // instead of it.value().toString()
598 m_metaTextLabel
->add(label
, it
.value().toString());
605 if (m_metaDataWidget
!= 0) {
606 m_metaDataWidget
->setFile(item
.targetUrl());
610 updatePhononWidget();
613 KFileItem
InformationPanel::fileItem() const
615 if (!m_fileItem
.isNull()) {
619 if (!m_selection
.isEmpty()) {
620 Q_ASSERT(m_selection
.count() == 1);
621 return m_selection
.first();
624 // no item is hovered and no selection has been done: provide
625 // an item for the directory represented by m_shownUrl
626 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
631 bool InformationPanel::showMultipleSelectionInfo() const
633 return m_fileItem
.isNull() && (m_selection
.count() > 1);
636 bool InformationPanel::isEqualToShownUrl(const KUrl
& url
) const
638 return m_shownUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
);
641 void InformationPanel::setNameLabelText(const QString
& text
)
643 QTextOption textOption
;
644 textOption
.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere
);
646 QTextLayout
textLayout(text
);
647 textLayout
.setFont(m_nameLabel
->font());
648 textLayout
.setTextOption(textOption
);
651 wrappedText
.reserve(text
.length());
653 // wrap the text to fit into the width of m_nameLabel
654 textLayout
.beginLayout();
655 QTextLine line
= textLayout
.createLine();
656 while (line
.isValid()) {
657 line
.setLineWidth(m_nameLabel
->width());
658 wrappedText
+= text
.mid(line
.textStart(), line
.textLength());
660 line
= textLayout
.createLine();
661 if (line
.isValid()) {
662 wrappedText
+= QChar::LineSeparator
;
665 textLayout
.endLayout();
667 m_nameLabel
->setText(wrappedText
);
670 void InformationPanel::reset()
674 m_fileItem
= KFileItem();
678 void InformationPanel::initMetaInfoSettings(KConfigGroup
& group
)
680 if (!group
.readEntry("initialized", false)) {
681 // The resource file is read the first time. Assure
682 // that some meta information is disabled per default.
683 group
.writeEntry("fileExtension", false);
684 group
.writeEntry("url", false);
685 group
.writeEntry("sourceModified", false);
686 group
.writeEntry("parentUrl", false);
687 group
.writeEntry("size", false);
688 group
.writeEntry("mime type", false);
689 group
.writeEntry("depth", false);
690 group
.writeEntry("name", 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 void InformationPanel::init()
729 m_infoTimer
= new QTimer(this);
730 m_infoTimer
->setInterval(300);
731 m_infoTimer
->setSingleShot(true);
732 connect(m_infoTimer
, SIGNAL(timeout()),
733 this, SLOT(slotInfoTimeout()));
735 // Initialize timer for disabling an outdated preview with a small
736 // delay. This prevents flickering if the new preview can be generated
737 // within a very small timeframe.
738 m_outdatedPreviewTimer
= new QTimer(this);
739 m_outdatedPreviewTimer
->setInterval(300);
740 m_outdatedPreviewTimer
->setSingleShot(true);
741 connect(m_outdatedPreviewTimer
, SIGNAL(timeout()),
742 this, SLOT(markOutdatedPreview()));
744 QVBoxLayout
* layout
= new QVBoxLayout
;
745 layout
->setSpacing(KDialog::spacingHint());
748 m_nameLabel
= new QLabel(this);
749 QFont font
= m_nameLabel
->font();
751 m_nameLabel
->setFont(font
);
752 m_nameLabel
->setAlignment(Qt::AlignHCenter
);
753 m_nameLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
754 m_nameLabel
->setMaximumWidth(KIconLoader::SizeEnormous
);
757 const int minPreviewWidth
= KIconLoader::SizeEnormous
+ KIconLoader::SizeMedium
;
759 m_preview
= new PixmapViewer(this);
760 m_preview
->setMinimumWidth(minPreviewWidth
);
761 m_preview
->setMinimumHeight(KIconLoader::SizeEnormous
);
763 m_phononWidget
= new PhononWidget(this);
764 m_phononWidget
->setMinimumWidth(minPreviewWidth
);
765 connect(m_phononWidget
, SIGNAL(playingStarted()),
766 this, SLOT(slotPlayingStarted()));
767 connect(m_phononWidget
, SIGNAL(playingStopped()),
768 this, SLOT(slotPlayingStopped()));
770 m_previewSeparator
= new KSeparator(this);
772 const bool showPreview
= InformationPanelSettings::showPreview();
773 m_preview
->setVisible(showPreview
);
774 m_previewSeparator
->setVisible(showPreview
);
776 if (MetaDataWidget::metaDataAvailable()) {
777 // rating, comment and tags
778 m_metaDataWidget
= new MetaDataWidget(this);
779 m_metaDataWidget
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
781 const bool showRating
= InformationPanelSettings::showRating();
782 const bool showComment
= InformationPanelSettings::showComment();
783 const bool showTags
= InformationPanelSettings::showTags();
785 m_metaDataWidget
->setRatingVisible(showRating
);
786 m_metaDataWidget
->setCommentVisible(showComment
);
787 m_metaDataWidget
->setTagsVisible(showTags
);
789 m_metaDataSeparator
= new KSeparator(this);
790 m_metaDataSeparator
->setVisible(showRating
|| showComment
|| showTags
);
793 // general meta text information
794 m_metaTextLabel
= new MetaTextLabel(this);
795 m_metaTextLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
797 m_metaTextArea
= new QScrollArea(this);
798 m_metaTextArea
->setWidget(m_metaTextLabel
);
799 m_metaTextArea
->setWidgetResizable(true);
800 m_metaTextArea
->setFrameShape(QFrame::NoFrame
);
802 QWidget
* viewport
= m_metaTextArea
->viewport();
803 viewport
->installEventFilter(this);
805 QPalette palette
= viewport
->palette();
806 palette
.setColor(viewport
->backgroundRole(), QColor(Qt::transparent
));
807 viewport
->setPalette(palette
);
809 layout
->addWidget(m_nameLabel
);
810 layout
->addWidget(new KSeparator(this));
811 layout
->addWidget(m_preview
);
812 layout
->addWidget(m_phononWidget
);
813 layout
->addWidget(m_previewSeparator
);
814 if (m_metaDataWidget
!= 0) {
815 layout
->addWidget(m_metaDataWidget
);
816 layout
->addWidget(m_metaDataSeparator
);
818 layout
->addWidget(m_metaTextArea
);
821 org::kde::KDirNotify
* dirNotify
= new org::kde::KDirNotify(QString(), QString(),
822 QDBusConnection::sessionBus(), this);
823 connect(dirNotify
, SIGNAL(FileRenamed(QString
, QString
)), SLOT(slotFileRenamed(QString
, QString
)));
824 connect(dirNotify
, SIGNAL(FilesAdded(QString
)), SLOT(slotFilesAdded(QString
)));
825 connect(dirNotify
, SIGNAL(FilesChanged(QStringList
)), SLOT(slotFilesChanged(QStringList
)));
826 connect(dirNotify
, SIGNAL(FilesRemoved(QStringList
)), SLOT(slotFilesRemoved(QStringList
)));
827 connect(dirNotify
, SIGNAL(enteredDirectory(QString
)), SLOT(slotEnteredDirectory(QString
)));
828 connect(dirNotify
, SIGNAL(leftDirectory(QString
)), SLOT(slotLeftDirectory(QString
)));
830 m_initialized
= true;
833 #include "informationpanel.moc"