]> cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/informationpanel.cpp
allow to disable the preview of the Information Panel
[dolphin.git] / src / panels / information / informationpanel.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
3 * *
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. *
8 * *
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. *
13 * *
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 ***************************************************************************/
19
20 #include "informationpanel.h"
21
22 #include <config-nepomuk.h>
23
24 #include <kdialog.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>
33 #include <klocale.h>
34 #include <kmenu.h>
35 #include <kseparator.h>
36
37 #ifdef HAVE_NEPOMUK
38 #include <Nepomuk/Resource>
39 #include <Nepomuk/Types/Property>
40 #include <Nepomuk/Variant>
41 #endif
42
43 #include <Phonon/BackendCapabilities>
44 #include <Phonon/MediaObject>
45 #include <Phonon/SeekSlider>
46
47 #include <QEvent>
48 #include <QInputDialog>
49 #include <QLabel>
50 #include <QPainter>
51 #include <QPixmap>
52 #include <QResizeEvent>
53 #include <QScrollArea>
54 #include <QTextLayout>
55 #include <QTextLine>
56 #include <QTimer>
57 #include <QScrollBar>
58 #include <QVBoxLayout>
59
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"
66
67 /**
68 * Helper function for sorting items with qSort() in
69 * InformationPanel::contextMenu().
70 */
71 bool lessThan(const QAction* action1, const QAction* action2)
72 {
73 return action1->text() < action2->text();
74 }
75
76
77 InformationPanel::InformationPanel(QWidget* parent) :
78 Panel(parent),
79 m_initialized(false),
80 m_pendingPreview(false),
81 m_infoTimer(0),
82 m_outdatedPreviewTimer(0),
83 m_shownUrl(),
84 m_urlCandidate(),
85 m_fileItem(),
86 m_selection(),
87 m_nameLabel(0),
88 m_preview(0),
89 m_phononWidget(0),
90 m_metaDataWidget(0),
91 m_metaTextArea(0),
92 m_metaTextLabel(0)
93 {
94 }
95
96 InformationPanel::~InformationPanel()
97 {
98 }
99
100 QSize InformationPanel::sizeHint() const
101 {
102 QSize size = Panel::sizeHint();
103 size.setWidth(minimumSizeHint().width());
104 return size;
105 }
106
107 void InformationPanel::setUrl(const KUrl& url)
108 {
109 Panel::setUrl(url);
110 if (url.isValid() && !isEqualToShownUrl(url)) {
111 if (isVisible()) {
112 cancelRequest();
113 m_shownUrl = url;
114 showItemInfo();
115 } else {
116 m_shownUrl = url;
117 }
118 }
119 }
120
121 void InformationPanel::setSelection(const KFileItemList& selection)
122 {
123 if (!isVisible()) {
124 return;
125 }
126
127 if ((selection.count() == 0) && (m_selection.count() == 0)) {
128 // The selection has not really changed, only the current index.
129 // QItemSelectionModel emits a signal in this case and it is less
130 // expensive doing the check this way instead of patching
131 // DolphinView::emitSelectionChanged().
132 return;
133 }
134
135 m_selection = selection;
136
137 const int count = selection.count();
138 if (count == 0) {
139 if (!isEqualToShownUrl(url())) {
140 m_shownUrl = url();
141 showItemInfo();
142 }
143 } else {
144 if ((count == 1) && !selection.first().url().isEmpty()) {
145 m_urlCandidate = selection.first().url();
146 }
147 m_infoTimer->start();
148 }
149 }
150
151 void InformationPanel::requestDelayedItemInfo(const KFileItem& item)
152 {
153 if (!isVisible()) {
154 return;
155 }
156
157 cancelRequest();
158
159 m_fileItem = KFileItem();
160 if (item.isNull()) {
161 // The cursor is above the viewport. If files are selected,
162 // show information regarding the selection.
163 if (m_selection.size() > 0) {
164 m_pendingPreview = false;
165 m_infoTimer->start();
166 }
167 } else {
168 const KUrl url = item.url();
169 if (url.isValid() && !isEqualToShownUrl(url)) {
170 m_urlCandidate = item.url();
171 m_fileItem = item;
172 m_infoTimer->start();
173 }
174 }
175 }
176
177 void InformationPanel::showEvent(QShowEvent* event)
178 {
179 Panel::showEvent(event);
180 if (!event->spontaneous()) {
181 if (!m_initialized) {
182 // do a delayed initialization so that no performance
183 // penalty is given when Dolphin is started with a closed
184 // Information Panel
185 init();
186 }
187 showItemInfo();
188 }
189 }
190
191 void InformationPanel::resizeEvent(QResizeEvent* event)
192 {
193 if (isVisible()) {
194 // If the text inside the name label or the info label cannot
195 // get wrapped, then the maximum width of the label is increased
196 // so that the width of the information panel gets increased.
197 // To prevent this, the maximum width is adjusted to
198 // the current width of the panel.
199 const int maxWidth = event->size().width() - KDialog::spacingHint() * 4;
200 m_nameLabel->setMaximumWidth(maxWidth);
201
202 // try to increase the preview as large as possible
203 m_preview->setSizeHint(QSize(maxWidth, maxWidth));
204 m_urlCandidate = m_shownUrl; // reset the URL candidate if a resizing is done
205 m_infoTimer->start();
206 }
207 Panel::resizeEvent(event);
208 }
209
210 bool InformationPanel::eventFilter(QObject* obj, QEvent* event)
211 {
212 // Check whether the size of the meta text area has changed and adjust
213 // the fixed width in a way that no horizontal scrollbar needs to be shown.
214 if ((obj == m_metaTextArea->viewport()) && (event->type() == QEvent::Resize)) {
215 QResizeEvent* resizeEvent = static_cast<QResizeEvent*>(event);
216 m_metaTextLabel->setFixedWidth(resizeEvent->size().width());
217 }
218 return Panel::eventFilter(obj, event);
219 }
220
221 void InformationPanel::contextMenuEvent(QContextMenuEvent* event)
222 {
223 Panel::contextMenuEvent(event);
224
225 #ifdef HAVE_NEPOMUK
226 if (showMultipleSelectionInfo()) {
227 return;
228 }
229
230 KMenu popup(this);
231
232 QAction* previewAction = popup.addAction(i18nc("@action:inmenu", "Preview"));
233 previewAction->setIcon(KIcon("view-preview"));
234 previewAction->setCheckable(true);
235 previewAction->setChecked(InformationPanelSettings::showPreview());
236
237 QAction* ratingAction = popup.addAction(i18nc("@action:inmenu", "Rating"));
238 ratingAction->setIcon(KIcon("rating"));
239 ratingAction->setCheckable(true);
240 ratingAction->setChecked(InformationPanelSettings::showRating());
241
242 QAction* commentAction = popup.addAction(i18nc("@action:inmenu", "Comment"));
243 commentAction->setIcon(KIcon("text-plain"));
244 commentAction->setCheckable(true);
245 commentAction->setChecked(InformationPanelSettings::showComment());
246
247 QAction* tagsAction = popup.addAction(i18nc("@action:inmenu", "Tags"));
248 tagsAction->setCheckable(true);
249 tagsAction->setChecked(InformationPanelSettings::showTags());
250
251 KConfig config("kmetainformationrc", KConfig::NoGlobals);
252 KConfigGroup settings = config.group("Show");
253 initMetaInfoSettings(settings);
254
255 QList<QAction*> actions;
256
257 // Get all meta information labels that are available for
258 // the currently shown file item and add them to the popup.
259 Nepomuk::Resource res(fileItem().url());
260 QHash<QUrl, Nepomuk::Variant> properties = res.properties();
261 QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin();
262 while (it != properties.constEnd()) {
263 Nepomuk::Types::Property prop(it.key());
264 const QString key = prop.label();
265
266 // Meta information provided by Nepomuk that is already
267 // available from KFileItem should not be configurable.
268 bool skip = (key == "fileExtension") ||
269 (key == "name") ||
270 (key == "sourceModified") ||
271 (key == "size") ||
272 (key == "mime type");
273 if (!skip) {
274 // Check whether there is already a meta information
275 // having the same label. In this case don't show it
276 // twice in the menu.
277 foreach (const QAction* action, actions) {
278 if (action->data().toString() == key) {
279 skip = true;
280 break;
281 }
282 }
283 }
284
285 if (!skip) {
286 const QString label = key; // TODO
287 QAction* action = new QAction(label, &popup);
288 action->setCheckable(true);
289 action->setChecked(settings.readEntry(key, true));
290 action->setData(key);
291 actions.append(action);
292 }
293
294 ++it;
295 }
296
297 if (actions.count() > 0) {
298 popup.addSeparator();
299
300 // add all items alphabetically sorted to the popup
301 qSort(actions.begin(), actions.end(), lessThan);
302 foreach (QAction* action, actions) {
303 popup.addAction(action);
304 }
305 }
306
307 // Open the popup and adjust the settings for the
308 // selected action.
309 QAction* action = popup.exec(QCursor::pos());
310 if (action == 0) {
311 return;
312 }
313
314 if (action == previewAction) {
315 // TODO
316 } else if (action == ratingAction) {
317 // TODO
318 } else if (action == commentAction) {
319 // TODO
320 } else if (action == tagsAction) {
321 // TODO
322 } else {
323 settings.writeEntry(action->data().toString(), action->isChecked());
324 settings.sync();
325 showMetaInfo();
326 }
327 #endif
328 }
329
330 void InformationPanel::showItemInfo()
331 {
332 if (!isVisible()) {
333 return;
334 }
335
336 cancelRequest();
337
338 if (showMultipleSelectionInfo()) {
339 KIconLoader iconLoader;
340 QPixmap icon = iconLoader.loadIcon("dialog-information",
341 KIconLoader::NoGroup,
342 KIconLoader::SizeEnormous);
343 m_preview->setPixmap(icon);
344 setNameLabelText(i18ncp("@info", "%1 item selected", "%1 items selected", m_selection.count()));
345 m_shownUrl = KUrl();
346 } else {
347 const KFileItem item = fileItem();
348 const KUrl itemUrl = item.url();
349 if (!applyPlace(itemUrl)) {
350 // try to get a preview pixmap from the item...
351 m_pendingPreview = true;
352
353 // Mark the currently shown preview as outdated. This is done
354 // with a small delay to prevent a flickering when the next preview
355 // can be shown within a short timeframe.
356 m_outdatedPreviewTimer->start();
357
358 KIO::PreviewJob* job = KIO::filePreview(KFileItemList() << item,
359 m_preview->width(),
360 m_preview->height(),
361 0,
362 0,
363 false,
364 true);
365
366 connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)),
367 this, SLOT(showPreview(const KFileItem&, const QPixmap&)));
368 connect(job, SIGNAL(failed(const KFileItem&)),
369 this, SLOT(showIcon(const KFileItem&)));
370
371 setNameLabelText(itemUrl.fileName());
372 }
373 }
374
375 showMetaInfo();
376 }
377
378 void InformationPanel::slotInfoTimeout()
379 {
380 m_shownUrl = m_urlCandidate;
381 showItemInfo();
382 }
383
384 void InformationPanel::markOutdatedPreview()
385 {
386 KIconEffect iconEffect;
387 QPixmap disabledPixmap = iconEffect.apply(m_preview->pixmap(),
388 KIconLoader::Desktop,
389 KIconLoader::DisabledState);
390 m_preview->setPixmap(disabledPixmap);
391 }
392
393 void InformationPanel::showIcon(const KFileItem& item)
394 {
395 m_outdatedPreviewTimer->stop();
396 m_pendingPreview = false;
397 if (!applyPlace(item.url())) {
398 m_preview->setPixmap(item.pixmap(KIconLoader::SizeEnormous));
399 }
400 }
401
402 void InformationPanel::showPreview(const KFileItem& item,
403 const QPixmap& pixmap)
404 {
405 m_outdatedPreviewTimer->stop();
406
407 Q_UNUSED(item);
408 if (m_pendingPreview) {
409 m_preview->setPixmap(pixmap);
410 m_pendingPreview = false;
411 }
412 }
413
414 void InformationPanel::slotFileRenamed(const QString& source, const QString& dest)
415 {
416 const KUrl sourceUrl = KUrl(source);
417
418 // Verify whether the renamed item is selected. If this is the case, the
419 // selection must be updated with the renamed item.
420 bool isSelected = false;
421 for (int i = m_selection.size() - 1; i >= 0; --i) {
422 if (m_selection[i].url() == sourceUrl) {
423 m_selection.removeAt(i);
424 isSelected = true;
425 break;
426 }
427 }
428
429 if ((m_shownUrl == sourceUrl) || isSelected) {
430 m_shownUrl = KUrl(dest);
431 m_fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl);
432 if (isSelected) {
433 m_selection.append(m_fileItem);
434 }
435 showItemInfo();
436 }
437 }
438
439 void InformationPanel::slotFilesAdded(const QString& directory)
440 {
441 if (m_shownUrl == KUrl(directory)) {
442 // If the 'trash' icon changes because the trash has been emptied or got filled,
443 // the signal filesAdded("trash:/") will be emitted.
444 KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory));
445 requestDelayedItemInfo(item);
446 }
447 }
448
449 void InformationPanel::slotFilesChanged(const QStringList& files)
450 {
451 foreach (const QString& fileName, files) {
452 if (m_shownUrl == KUrl(fileName)) {
453 showItemInfo();
454 break;
455 }
456 }
457 }
458
459 void InformationPanel::slotFilesRemoved(const QStringList& files)
460 {
461 foreach (const QString& fileName, files) {
462 if (m_shownUrl == KUrl(fileName)) {
463 // the currently shown item has been removed, show
464 // the parent directory as fallback
465 reset();
466 break;
467 }
468 }
469 }
470
471 void InformationPanel::slotEnteredDirectory(const QString& directory)
472 {
473 if (m_shownUrl == KUrl(directory)) {
474 KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory));
475 requestDelayedItemInfo(item);
476 }
477 }
478
479 void InformationPanel::slotLeftDirectory(const QString& directory)
480 {
481 if (m_shownUrl == KUrl(directory)) {
482 // The signal 'leftDirectory' is also emitted when a media
483 // has been unmounted. In this case no directory change will be
484 // done in Dolphin, but the Information Panel must be updated to
485 // indicate an invalid directory.
486 reset();
487 }
488 }
489
490 bool InformationPanel::applyPlace(const KUrl& url)
491 {
492 KFilePlacesModel* placesModel = DolphinSettings::instance().placesModel();
493 int count = placesModel->rowCount();
494
495 for (int i = 0; i < count; ++i) {
496 QModelIndex index = placesModel->index(i, 0);
497
498 if (url.equals(placesModel->url(index), KUrl::CompareWithoutTrailingSlash)) {
499 setNameLabelText(placesModel->text(index));
500 m_preview->setPixmap(placesModel->icon(index).pixmap(128, 128));
501 return true;
502 }
503 }
504
505 return false;
506 }
507
508 void InformationPanel::cancelRequest()
509 {
510 m_infoTimer->stop();
511 }
512
513 void InformationPanel::showMetaInfo()
514 {
515 m_metaTextLabel->clear();
516
517 if (showMultipleSelectionInfo()) {
518 if (m_metaDataWidget != 0) {
519 KUrl::List urls;
520 foreach (const KFileItem& item, m_selection) {
521 urls.append(item.targetUrl());
522 }
523 m_metaDataWidget->setFiles(urls);
524 }
525
526 quint64 totalSize = 0;
527 foreach (const KFileItem& item, m_selection) {
528 // Only count the size of files, not dirs to match what
529 // DolphinViewContainer::selectionStatusBarText() does.
530 if (!item.isDir() && !item.isLink()) {
531 totalSize += item.size();
532 }
533 }
534 m_metaTextLabel->add(i18nc("@label", "Total size:"), KIO::convertSize(totalSize));
535
536 delete m_phononWidget;
537 m_phononWidget = 0;
538 } else {
539 const KFileItem item = fileItem();
540 if (item.isDir()) {
541 m_metaTextLabel->add(i18nc("@label", "Type:"), i18nc("@label", "Folder"));
542 m_metaTextLabel->add(i18nc("@label", "Modified:"), item.timeString());
543 } else {
544 m_metaTextLabel->add(i18nc("@label", "Type:"), item.mimeComment());
545
546 m_metaTextLabel->add(i18nc("@label", "Size:"), KIO::convertSize(item.size()));
547 m_metaTextLabel->add(i18nc("@label", "Modified:"), item.timeString());
548
549 #ifdef HAVE_NEPOMUK
550 KConfig config("kmetainformationrc", KConfig::NoGlobals);
551 KConfigGroup settings = config.group("Show");
552 initMetaInfoSettings(settings);
553
554 Nepomuk::Resource res(item.url());
555
556 QHash<QUrl, Nepomuk::Variant> properties = res.properties();
557 QHash<QUrl, Nepomuk::Variant>::const_iterator it = properties.constBegin();
558 while (it != properties.constEnd()) {
559 Nepomuk::Types::Property prop(it.key());
560 const QString label = prop.label();
561 if (settings.readEntry(label, true)) {
562 // TODO: use Nepomuk::formatValue(res, prop) if available
563 // instead of it.value().toString()
564 m_metaTextLabel->add(label, it.value().toString());
565 }
566 ++it;
567 }
568 #endif
569 }
570
571 if (m_metaDataWidget != 0) {
572 m_metaDataWidget->setFile(item.targetUrl());
573 }
574
575 if (Phonon::BackendCapabilities::isMimeTypeAvailable(item.mimetype())) {
576 if (m_phononWidget == 0) {
577 m_phononWidget = new PhononWidget(this);
578
579 QVBoxLayout* vBoxLayout = qobject_cast<QVBoxLayout*>(layout());
580 Q_ASSERT(vBoxLayout != 0);
581 vBoxLayout->insertWidget(3, m_phononWidget);
582 }
583 m_phononWidget->setUrl(item.url());
584 } else {
585 delete m_phononWidget;
586 m_phononWidget = 0;
587 }
588 }
589 }
590
591 KFileItem InformationPanel::fileItem() const
592 {
593 if (!m_fileItem.isNull()) {
594 return m_fileItem;
595 }
596
597 if (!m_selection.isEmpty()) {
598 Q_ASSERT(m_selection.count() == 1);
599 return m_selection.first();
600 }
601
602 // no item is hovered and no selection has been done: provide
603 // an item for the directory represented by m_shownUrl
604 KFileItem item(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl);
605 item.refresh();
606 return item;
607 }
608
609 bool InformationPanel::showMultipleSelectionInfo() const
610 {
611 return m_fileItem.isNull() && (m_selection.count() > 1);
612 }
613
614 bool InformationPanel::isEqualToShownUrl(const KUrl& url) const
615 {
616 return m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash);
617 }
618
619 void InformationPanel::setNameLabelText(const QString& text)
620 {
621 QTextOption textOption;
622 textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
623
624 QTextLayout textLayout(text);
625 textLayout.setFont(m_nameLabel->font());
626 textLayout.setTextOption(textOption);
627
628 QString wrappedText;
629 wrappedText.reserve(text.length());
630
631 // wrap the text to fit into the width of m_nameLabel
632 textLayout.beginLayout();
633 QTextLine line = textLayout.createLine();
634 while (line.isValid()) {
635 line.setLineWidth(m_nameLabel->width());
636 wrappedText += text.mid(line.textStart(), line.textLength());
637
638 line = textLayout.createLine();
639 if (line.isValid()) {
640 wrappedText += QChar::LineSeparator;
641 }
642 }
643 textLayout.endLayout();
644
645 m_nameLabel->setText(wrappedText);
646 }
647
648 void InformationPanel::reset()
649 {
650 m_selection.clear();
651 m_shownUrl = url();
652 m_fileItem = KFileItem();
653 showItemInfo();
654 }
655
656 void InformationPanel::initMetaInfoSettings(KConfigGroup& group)
657 {
658 if (!group.readEntry("initialized", false)) {
659 // The resource file is read the first time. Assure
660 // that some meta information is disabled per default.
661 group.writeEntry("fileExtension", false);
662 group.writeEntry("url", false);
663 group.writeEntry("sourceModified", false);
664 group.writeEntry("parentUrl", false);
665 group.writeEntry("size", false);
666 group.writeEntry("mime type", false);
667 group.writeEntry("depth", false);
668 group.writeEntry("name", false);
669
670 // mark the group as initialized
671 group.writeEntry("initialized", true);
672 }
673 }
674
675 void InformationPanel::init()
676 {
677 const int spacing = KDialog::spacingHint();
678
679 m_infoTimer = new QTimer(this);
680 m_infoTimer->setInterval(300);
681 m_infoTimer->setSingleShot(true);
682 connect(m_infoTimer, SIGNAL(timeout()),
683 this, SLOT(slotInfoTimeout()));
684
685 // Initialize timer for disabling an outdated preview with a small
686 // delay. This prevents flickering if the new preview can be generated
687 // within a very small timeframe.
688 m_outdatedPreviewTimer = new QTimer(this);
689 m_outdatedPreviewTimer->setInterval(300);
690 m_outdatedPreviewTimer->setSingleShot(true);
691 connect(m_outdatedPreviewTimer, SIGNAL(timeout()),
692 this, SLOT(markOutdatedPreview()));
693
694 QVBoxLayout* layout = new QVBoxLayout;
695 layout->setSpacing(spacing);
696
697 // name
698 m_nameLabel = new QLabel(this);
699 QFont font = m_nameLabel->font();
700 font.setBold(true);
701 m_nameLabel->setFont(font);
702 m_nameLabel->setAlignment(Qt::AlignHCenter);
703 m_nameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
704
705 // preview
706 m_preview = new PixmapViewer(this);
707 m_preview->setMinimumWidth(KIconLoader::SizeEnormous + KIconLoader::SizeMedium);
708 m_preview->setMinimumHeight(KIconLoader::SizeEnormous);
709
710 if (MetaDataWidget::metaDataAvailable()) {
711 // rating, comment and tags
712 m_metaDataWidget = new MetaDataWidget(this);
713 m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
714 }
715
716 // general meta text information
717 m_metaTextLabel = new MetaTextLabel(this);
718 m_metaTextLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
719
720 m_metaTextArea = new QScrollArea(this);
721 m_metaTextArea->setWidget(m_metaTextLabel);
722 m_metaTextArea->setWidgetResizable(true);
723 m_metaTextArea->setFrameShape(QFrame::NoFrame);
724
725 QWidget* viewport = m_metaTextArea->viewport();
726 viewport->installEventFilter(this);
727
728 QPalette palette = viewport->palette();
729 palette.setColor(viewport->backgroundRole(), QColor(Qt::transparent));
730 viewport->setPalette(palette);
731
732 layout->addWidget(m_nameLabel);
733 layout->addWidget(new KSeparator(this));
734 layout->addWidget(m_preview);
735 layout->addWidget(new KSeparator(this));
736 if (m_metaDataWidget != 0) {
737 layout->addWidget(m_metaDataWidget);
738 layout->addWidget(new KSeparator(this));
739 }
740 layout->addWidget(m_metaTextArea);
741 setLayout(layout);
742
743 org::kde::KDirNotify* dirNotify = new org::kde::KDirNotify(QString(), QString(),
744 QDBusConnection::sessionBus(), this);
745 connect(dirNotify, SIGNAL(FileRenamed(QString, QString)), SLOT(slotFileRenamed(QString, QString)));
746 connect(dirNotify, SIGNAL(FilesAdded(QString)), SLOT(slotFilesAdded(QString)));
747 connect(dirNotify, SIGNAL(FilesChanged(QStringList)), SLOT(slotFilesChanged(QStringList)));
748 connect(dirNotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList)));
749 connect(dirNotify, SIGNAL(enteredDirectory(QString)), SLOT(slotEnteredDirectory(QString)));
750 connect(dirNotify, SIGNAL(leftDirectory(QString)), SLOT(slotLeftDirectory(QString)));
751
752 m_initialized = true;
753 }
754
755 #include "informationpanel.moc"