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 // The metadata widget also contains a text widget which may return
206 // a large preferred width.
207 if (m_metaDataWidget
!= 0) {
208 m_metaDataWidget
->setMaximumWidth(maxWidth
);
211 // try to increase the preview as large as possible
212 m_preview
->setSizeHint(QSize(maxWidth
, maxWidth
));
213 m_urlCandidate
= m_shownUrl
; // reset the URL candidate if a resizing is done
214 m_infoTimer
->start();
216 if (m_phononWidget
->isVisible() && (m_phononWidget
->mode() == PhononWidget::Video
)) {
217 // assure that the size of the video player is the same as the preview size
218 m_phononWidget
->setVideoSize(QSize(maxWidth
, maxWidth
));
221 Panel::resizeEvent(event
);
224 bool InformationPanel::eventFilter(QObject
* obj
, QEvent
* event
)
226 // Check whether the size of the meta text area has changed and adjust
227 // the fixed width in a way that no horizontal scrollbar needs to be shown.
228 if ((obj
== m_metaTextArea
->viewport()) && (event
->type() == QEvent::Resize
)) {
229 QResizeEvent
* resizeEvent
= static_cast<QResizeEvent
*>(event
);
230 m_metaTextLabel
->setFixedWidth(resizeEvent
->size().width());
232 return Panel::eventFilter(obj
, event
);
235 void InformationPanel::contextMenuEvent(QContextMenuEvent
* event
)
237 Panel::contextMenuEvent(event
);
240 if (showMultipleSelectionInfo()) {
246 QAction
* previewAction
= popup
.addAction(i18nc("@action:inmenu", "Preview"));
247 previewAction
->setIcon(KIcon("view-preview"));
248 previewAction
->setCheckable(true);
249 previewAction
->setChecked(InformationPanelSettings::showPreview());
251 const bool metaDataAvailable
= MetaDataWidget::metaDataAvailable();
253 QAction
* ratingAction
= popup
.addAction(i18nc("@action:inmenu", "Rating"));
254 ratingAction
->setIcon(KIcon("rating"));
255 ratingAction
->setCheckable(true);
256 ratingAction
->setChecked(InformationPanelSettings::showRating());
257 ratingAction
->setEnabled(metaDataAvailable
);
259 QAction
* commentAction
= popup
.addAction(i18nc("@action:inmenu", "Comment"));
260 commentAction
->setIcon(KIcon("text-plain"));
261 commentAction
->setCheckable(true);
262 commentAction
->setChecked(InformationPanelSettings::showComment());
263 commentAction
->setEnabled(metaDataAvailable
);
265 QAction
* tagsAction
= popup
.addAction(i18nc("@action:inmenu", "Tags"));
266 tagsAction
->setCheckable(true);
267 tagsAction
->setChecked(InformationPanelSettings::showTags());
268 tagsAction
->setEnabled(metaDataAvailable
);
270 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
271 KConfigGroup settings
= config
.group("Show");
272 initMetaInfoSettings(settings
);
274 QList
<QAction
*> actions
;
276 // Get all meta information labels that are available for
277 // the currently shown file item and add them to the popup.
278 Nepomuk::Resource
res(fileItem().url());
279 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
280 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
281 while (it
!= properties
.constEnd()) {
282 Nepomuk::Types::Property
prop(it
.key());
283 const QString key
= prop
.label();
285 // Meta information provided by Nepomuk that is already
286 // available from KFileItem should not be configurable.
287 bool skip
= (key
== "fileExtension") ||
289 (key
== "sourceModified") ||
291 (key
== "mime type");
293 // Check whether there is already a meta information
294 // having the same label. In this case don't show it
295 // twice in the menu.
296 foreach (const QAction
* action
, actions
) {
297 if (action
->data().toString() == key
) {
305 const QString label
= key
; // TODO
306 QAction
* action
= new QAction(label
, &popup
);
307 action
->setCheckable(true);
308 action
->setChecked(settings
.readEntry(key
, true));
309 action
->setData(key
);
310 actions
.append(action
);
316 if (actions
.count() > 0) {
317 popup
.addSeparator();
319 // add all items alphabetically sorted to the popup
320 qSort(actions
.begin(), actions
.end(), lessThan
);
321 foreach (QAction
* action
, actions
) {
322 popup
.addAction(action
);
326 // Open the popup and adjust the settings for the
328 QAction
* action
= popup
.exec(QCursor::pos());
333 const bool isChecked
= action
->isChecked();
334 if (action
== previewAction
) {
335 m_preview
->setVisible(isChecked
);
336 m_previewSeparator
->setVisible(isChecked
);
337 InformationPanelSettings::setShowPreview(isChecked
);
338 updatePhononWidget();
339 } else if (action
== ratingAction
) {
340 m_metaDataWidget
->setRatingVisible(isChecked
);
341 InformationPanelSettings::setShowRating(isChecked
);
342 } else if (action
== commentAction
) {
343 m_metaDataWidget
->setCommentVisible(isChecked
);
344 InformationPanelSettings::setShowComment(isChecked
);
345 } else if (action
== tagsAction
) {
346 m_metaDataWidget
->setTagsVisible(isChecked
);
347 InformationPanelSettings::setShowTags(isChecked
);
349 settings
.writeEntry(action
->data().toString(), action
->isChecked());
354 if (m_metaDataWidget
!= 0) {
355 const bool visible
= m_metaDataWidget
->isRatingVisible() ||
356 m_metaDataWidget
->isCommentVisible() ||
357 m_metaDataWidget
->areTagsVisible();
358 m_metaDataSeparator
->setVisible(visible
);
363 void InformationPanel::showItemInfo()
371 if (showMultipleSelectionInfo()) {
372 KIconLoader iconLoader
;
373 QPixmap icon
= iconLoader
.loadIcon("dialog-information",
374 KIconLoader::NoGroup
,
375 KIconLoader::SizeEnormous
);
376 m_preview
->setPixmap(icon
);
377 setNameLabelText(i18ncp("@info", "%1 item selected", "%1 items selected", m_selection
.count()));
380 const KFileItem item
= fileItem();
381 const KUrl itemUrl
= item
.url();
382 if (!applyPlace(itemUrl
)) {
383 // try to get a preview pixmap from the item...
384 m_pendingPreview
= true;
386 // Mark the currently shown preview as outdated. This is done
387 // with a small delay to prevent a flickering when the next preview
388 // can be shown within a short timeframe.
389 m_outdatedPreviewTimer
->start();
391 KIO::PreviewJob
* job
= KIO::filePreview(KFileItemList() << item
,
399 connect(job
, SIGNAL(gotPreview(const KFileItem
&, const QPixmap
&)),
400 this, SLOT(showPreview(const KFileItem
&, const QPixmap
&)));
401 connect(job
, SIGNAL(failed(const KFileItem
&)),
402 this, SLOT(showIcon(const KFileItem
&)));
404 setNameLabelText(itemUrl
.fileName());
411 void InformationPanel::slotInfoTimeout()
413 m_shownUrl
= m_urlCandidate
;
417 void InformationPanel::markOutdatedPreview()
419 KIconEffect iconEffect
;
420 QPixmap disabledPixmap
= iconEffect
.apply(m_preview
->pixmap(),
421 KIconLoader::Desktop
,
422 KIconLoader::DisabledState
);
423 m_preview
->setPixmap(disabledPixmap
);
426 void InformationPanel::showIcon(const KFileItem
& item
)
428 m_outdatedPreviewTimer
->stop();
429 m_pendingPreview
= false;
430 if (!applyPlace(item
.url())) {
431 m_preview
->setPixmap(item
.pixmap(KIconLoader::SizeEnormous
));
435 void InformationPanel::showPreview(const KFileItem
& item
,
436 const QPixmap
& pixmap
)
438 m_outdatedPreviewTimer
->stop();
441 if (m_pendingPreview
) {
442 m_preview
->setPixmap(pixmap
);
443 m_pendingPreview
= false;
447 void InformationPanel::slotFileRenamed(const QString
& source
, const QString
& dest
)
449 const KUrl sourceUrl
= KUrl(source
);
451 // Verify whether the renamed item is selected. If this is the case, the
452 // selection must be updated with the renamed item.
453 bool isSelected
= false;
454 for (int i
= m_selection
.size() - 1; i
>= 0; --i
) {
455 if (m_selection
[i
].url() == sourceUrl
) {
456 m_selection
.removeAt(i
);
462 if ((m_shownUrl
== sourceUrl
) || isSelected
) {
463 m_shownUrl
= KUrl(dest
);
464 m_fileItem
= KFileItem(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
466 m_selection
.append(m_fileItem
);
472 void InformationPanel::slotFilesAdded(const QString
& directory
)
474 if (m_shownUrl
== KUrl(directory
)) {
475 // If the 'trash' icon changes because the trash has been emptied or got filled,
476 // the signal filesAdded("trash:/") will be emitted.
477 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
478 requestDelayedItemInfo(item
);
482 void InformationPanel::slotFilesChanged(const QStringList
& files
)
484 foreach (const QString
& fileName
, files
) {
485 if (m_shownUrl
== KUrl(fileName
)) {
492 void InformationPanel::slotFilesRemoved(const QStringList
& files
)
494 foreach (const QString
& fileName
, files
) {
495 if (m_shownUrl
== KUrl(fileName
)) {
496 // the currently shown item has been removed, show
497 // the parent directory as fallback
504 void InformationPanel::slotEnteredDirectory(const QString
& directory
)
506 if (m_shownUrl
== KUrl(directory
)) {
507 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, KUrl(directory
));
508 requestDelayedItemInfo(item
);
512 void InformationPanel::slotLeftDirectory(const QString
& directory
)
514 if (m_shownUrl
== KUrl(directory
)) {
515 // The signal 'leftDirectory' is also emitted when a media
516 // has been unmounted. In this case no directory change will be
517 // done in Dolphin, but the Information Panel must be updated to
518 // indicate an invalid directory.
523 void InformationPanel::slotPlayingStarted()
525 m_preview
->setVisible(m_phononWidget
->mode() != PhononWidget::Video
);
528 void InformationPanel::slotPlayingStopped()
530 m_preview
->setVisible(true);
533 bool InformationPanel::applyPlace(const KUrl
& url
)
535 KFilePlacesModel
* placesModel
= DolphinSettings::instance().placesModel();
536 int count
= placesModel
->rowCount();
538 for (int i
= 0; i
< count
; ++i
) {
539 QModelIndex index
= placesModel
->index(i
, 0);
541 if (url
.equals(placesModel
->url(index
), KUrl::CompareWithoutTrailingSlash
)) {
542 setNameLabelText(placesModel
->text(index
));
543 m_preview
->setPixmap(placesModel
->icon(index
).pixmap(128, 128));
551 void InformationPanel::cancelRequest()
556 void InformationPanel::showMetaInfo()
558 m_metaTextLabel
->clear();
560 if (showMultipleSelectionInfo()) {
561 if (m_metaDataWidget
!= 0) {
563 foreach (const KFileItem
& item
, m_selection
) {
564 urls
.append(item
.targetUrl());
566 m_metaDataWidget
->setFiles(urls
);
569 quint64 totalSize
= 0;
570 foreach (const KFileItem
& item
, m_selection
) {
571 // Only count the size of files, not dirs to match what
572 // DolphinViewContainer::selectionStatusBarText() does.
573 if (!item
.isDir() && !item
.isLink()) {
574 totalSize
+= item
.size();
577 m_metaTextLabel
->add(i18nc("@label", "Total size:"), KIO::convertSize(totalSize
));
579 const KFileItem item
= fileItem();
581 m_metaTextLabel
->add(i18nc("@label", "Type:"), i18nc("@label", "Folder"));
582 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
584 m_metaTextLabel
->add(i18nc("@label", "Type:"), item
.mimeComment());
586 m_metaTextLabel
->add(i18nc("@label", "Size:"), KIO::convertSize(item
.size()));
587 m_metaTextLabel
->add(i18nc("@label", "Modified:"), item
.timeString());
590 KConfig
config("kmetainformationrc", KConfig::NoGlobals
);
591 KConfigGroup settings
= config
.group("Show");
592 initMetaInfoSettings(settings
);
594 Nepomuk::Resource
res(item
.url());
596 QHash
<QUrl
, Nepomuk::Variant
> properties
= res
.properties();
597 QHash
<QUrl
, Nepomuk::Variant
>::const_iterator it
= properties
.constBegin();
598 while (it
!= properties
.constEnd()) {
599 Nepomuk::Types::Property
prop(it
.key());
600 const QString label
= prop
.label();
601 if (settings
.readEntry(label
, true)) {
602 // TODO: use Nepomuk::formatValue(res, prop) if available
603 // instead of it.value().toString()
604 m_metaTextLabel
->add(label
, it
.value().toString());
611 if (m_metaDataWidget
!= 0) {
612 m_metaDataWidget
->setFile(item
.targetUrl());
616 updatePhononWidget();
619 KFileItem
InformationPanel::fileItem() const
621 if (!m_fileItem
.isNull()) {
625 if (!m_selection
.isEmpty()) {
626 Q_ASSERT(m_selection
.count() == 1);
627 return m_selection
.first();
630 // no item is hovered and no selection has been done: provide
631 // an item for the directory represented by m_shownUrl
632 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, m_shownUrl
);
637 bool InformationPanel::showMultipleSelectionInfo() const
639 return m_fileItem
.isNull() && (m_selection
.count() > 1);
642 bool InformationPanel::isEqualToShownUrl(const KUrl
& url
) const
644 return m_shownUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
);
647 void InformationPanel::setNameLabelText(const QString
& text
)
649 QTextOption textOption
;
650 textOption
.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere
);
652 QTextLayout
textLayout(text
);
653 textLayout
.setFont(m_nameLabel
->font());
654 textLayout
.setTextOption(textOption
);
657 wrappedText
.reserve(text
.length());
659 // wrap the text to fit into the width of m_nameLabel
660 textLayout
.beginLayout();
661 QTextLine line
= textLayout
.createLine();
662 while (line
.isValid()) {
663 line
.setLineWidth(m_nameLabel
->width());
664 wrappedText
+= text
.mid(line
.textStart(), line
.textLength());
666 line
= textLayout
.createLine();
667 if (line
.isValid()) {
668 wrappedText
+= QChar::LineSeparator
;
671 textLayout
.endLayout();
673 m_nameLabel
->setText(wrappedText
);
676 void InformationPanel::reset()
680 m_fileItem
= KFileItem();
684 void InformationPanel::initMetaInfoSettings(KConfigGroup
& group
)
686 if (!group
.readEntry("initialized", false)) {
687 // The resource file is read the first time. Assure
688 // that some meta information is disabled per default.
689 group
.writeEntry("fileExtension", false);
690 group
.writeEntry("url", false);
691 group
.writeEntry("sourceModified", false);
692 group
.writeEntry("parentUrl", false);
693 group
.writeEntry("size", false);
694 group
.writeEntry("mime type", false);
695 group
.writeEntry("depth", false);
696 group
.writeEntry("name", false);
698 // mark the group as initialized
699 group
.writeEntry("initialized", true);
703 void InformationPanel::updatePhononWidget()
705 const bool multipleSelections
= showMultipleSelectionInfo();
706 const bool showPreview
= InformationPanelSettings::showPreview();
708 if (multipleSelections
|| !showPreview
) {
709 m_phononWidget
->hide();
710 } else if (!multipleSelections
&& showPreview
) {
711 const KFileItem item
= fileItem();
712 const QString mimeType
= item
.mimetype();
713 const bool usePhonon
= Phonon::BackendCapabilities::isMimeTypeAvailable(mimeType
) &&
714 (mimeType
!= "image/png"); // TODO: workaround, as Phonon
715 // thinks it supports PNG images
717 m_phononWidget
->show();
718 PhononWidget::Mode mode
= mimeType
.startsWith(QLatin1String("video"))
719 ? PhononWidget::Video
720 : PhononWidget::Audio
;
721 m_phononWidget
->setMode(mode
);
722 m_phononWidget
->setUrl(item
.url());
723 if ((mode
== PhononWidget::Video
) && m_preview
->isVisible()) {
724 m_phononWidget
->setVideoSize(m_preview
->size());
727 m_phononWidget
->hide();
728 m_preview
->setVisible(true);
733 void InformationPanel::init()
735 m_infoTimer
= new QTimer(this);
736 m_infoTimer
->setInterval(300);
737 m_infoTimer
->setSingleShot(true);
738 connect(m_infoTimer
, SIGNAL(timeout()),
739 this, SLOT(slotInfoTimeout()));
741 // Initialize timer for disabling an outdated preview with a small
742 // delay. This prevents flickering if the new preview can be generated
743 // within a very small timeframe.
744 m_outdatedPreviewTimer
= new QTimer(this);
745 m_outdatedPreviewTimer
->setInterval(300);
746 m_outdatedPreviewTimer
->setSingleShot(true);
747 connect(m_outdatedPreviewTimer
, SIGNAL(timeout()),
748 this, SLOT(markOutdatedPreview()));
750 QVBoxLayout
* layout
= new QVBoxLayout
;
751 layout
->setSpacing(KDialog::spacingHint());
754 m_nameLabel
= new QLabel(this);
755 QFont font
= m_nameLabel
->font();
757 m_nameLabel
->setFont(font
);
758 m_nameLabel
->setAlignment(Qt::AlignHCenter
);
759 m_nameLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
760 m_nameLabel
->setMaximumWidth(KIconLoader::SizeEnormous
);
763 const int minPreviewWidth
= KIconLoader::SizeEnormous
+ KIconLoader::SizeMedium
;
765 m_preview
= new PixmapViewer(this);
766 m_preview
->setMinimumWidth(minPreviewWidth
);
767 m_preview
->setMinimumHeight(KIconLoader::SizeEnormous
);
769 m_phononWidget
= new PhononWidget(this);
770 m_phononWidget
->setMinimumWidth(minPreviewWidth
);
771 connect(m_phononWidget
, SIGNAL(playingStarted()),
772 this, SLOT(slotPlayingStarted()));
773 connect(m_phononWidget
, SIGNAL(playingStopped()),
774 this, SLOT(slotPlayingStopped()));
776 m_previewSeparator
= new KSeparator(this);
778 const bool showPreview
= InformationPanelSettings::showPreview();
779 m_preview
->setVisible(showPreview
);
780 m_previewSeparator
->setVisible(showPreview
);
782 if (MetaDataWidget::metaDataAvailable()) {
783 // rating, comment and tags
784 m_metaDataWidget
= new MetaDataWidget(this);
785 m_metaDataWidget
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
786 m_metaDataWidget
->setMaximumWidth(KIconLoader::SizeEnormous
);
788 const bool showRating
= InformationPanelSettings::showRating();
789 const bool showComment
= InformationPanelSettings::showComment();
790 const bool showTags
= InformationPanelSettings::showTags();
792 m_metaDataWidget
->setRatingVisible(showRating
);
793 m_metaDataWidget
->setCommentVisible(showComment
);
794 m_metaDataWidget
->setTagsVisible(showTags
);
796 m_metaDataSeparator
= new KSeparator(this);
797 m_metaDataSeparator
->setVisible(showRating
|| showComment
|| showTags
);
800 // general meta text information
801 m_metaTextLabel
= new MetaTextLabel(this);
802 m_metaTextLabel
->setSizePolicy(QSizePolicy::Preferred
, QSizePolicy::Fixed
);
804 m_metaTextArea
= new QScrollArea(this);
805 m_metaTextArea
->setWidget(m_metaTextLabel
);
806 m_metaTextArea
->setWidgetResizable(true);
807 m_metaTextArea
->setFrameShape(QFrame::NoFrame
);
809 QWidget
* viewport
= m_metaTextArea
->viewport();
810 viewport
->installEventFilter(this);
812 QPalette palette
= viewport
->palette();
813 palette
.setColor(viewport
->backgroundRole(), QColor(Qt::transparent
));
814 viewport
->setPalette(palette
);
816 layout
->addWidget(m_nameLabel
);
817 layout
->addWidget(new KSeparator(this));
818 layout
->addWidget(m_preview
);
819 layout
->addWidget(m_phononWidget
);
820 layout
->addWidget(m_previewSeparator
);
821 if (m_metaDataWidget
!= 0) {
822 layout
->addWidget(m_metaDataWidget
);
823 layout
->addWidget(m_metaDataSeparator
);
825 layout
->addWidget(m_metaTextArea
);
828 org::kde::KDirNotify
* dirNotify
= new org::kde::KDirNotify(QString(), QString(),
829 QDBusConnection::sessionBus(), this);
830 connect(dirNotify
, SIGNAL(FileRenamed(QString
, QString
)), SLOT(slotFileRenamed(QString
, QString
)));
831 connect(dirNotify
, SIGNAL(FilesAdded(QString
)), SLOT(slotFilesAdded(QString
)));
832 connect(dirNotify
, SIGNAL(FilesChanged(QStringList
)), SLOT(slotFilesChanged(QStringList
)));
833 connect(dirNotify
, SIGNAL(FilesRemoved(QStringList
)), SLOT(slotFilesRemoved(QStringList
)));
834 connect(dirNotify
, SIGNAL(enteredDirectory(QString
)), SLOT(slotEnteredDirectory(QString
)));
835 connect(dirNotify
, SIGNAL(leftDirectory(QString
)), SLOT(slotLeftDirectory(QString
)));
837 m_initialized
= true;
840 #include "informationpanel.moc"