infoDock->setObjectName("infoDock");
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
Panel* infoPanel = new InformationPanel(infoDock);
+ connect(infoPanel, SIGNAL(urlActivated(KUrl)), activeViewContainer(), SLOT(setUrl(KUrl)));
infoDock->setWidget(infoPanel);
QAction* infoAction = infoDock->toggleViewAction();
m_dirLister = 0; // deleted by m_dolphinModel
}
-void DolphinViewContainer::setUrl(const KUrl& newUrl)
-{
- if (newUrl != m_urlNavigator->url()) {
- m_urlNavigator->setUrl(newUrl);
- // Temporary disable the 'File'->'Create New...' menu until
- // the write permissions can be checked in a fast way at
- // DolphinViewContainer::slotDirListerCompleted().
- m_isFolderWritable = false;
- if (isActive()) {
- m_mainWindow->newMenu()->menu()->setEnabled(false);
- }
- }
-}
-
const KUrl& DolphinViewContainer::url() const
{
return m_urlNavigator->url();
return m_filterBar->isVisible();
}
+void DolphinViewContainer::setUrl(const KUrl& newUrl)
+{
+ if (newUrl != m_urlNavigator->url()) {
+ m_urlNavigator->setUrl(newUrl);
+ // Temporary disable the 'File'->'Create New...' menu until
+ // the write permissions can be checked in a fast way at
+ // DolphinViewContainer::slotDirListerCompleted().
+ m_isFolderWritable = false;
+ if (isActive()) {
+ m_mainWindow->newMenu()->menu()->setEnabled(false);
+ }
+ }
+}
+
void DolphinViewContainer::showFilterBar(bool show)
{
Q_ASSERT(m_filterBar != 0);
virtual ~DolphinViewContainer();
- /**
- * Sets the current active URL, where all actions are applied. The
- * URL navigator is synchronized with this URL. The signals
- * KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
- * are emitted.
- * @see DolphinViewContainer::urlNavigator()
- */
- void setUrl(const KUrl& url);
-
/**
* Returns the current active URL, where all actions are applied.
* The URL navigator is synchronized with this URL.
bool isFilterBarVisible() const;
public slots:
+ /**
+ * Sets the current active URL, where all actions are applied. The
+ * URL navigator is synchronized with this URL. The signals
+ * KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
+ * are emitted.
+ * @see DolphinViewContainer::urlNavigator()
+ */
+ void setUrl(const KUrl& url);
+
/**
* Popups the filter bar above the status bar if \a show is true.
*/
*/
void showFilterBarChanged(bool shown);
-private slots:
+private slots:
/**
* Updates the number of items (= number of files + number of
* directories) in the statusbar. If files are selected, the number
// The signal 'leftDirectory' is also emitted when a media
// has been unmounted. In this case no directory change will be
// done in Dolphin, but the Information Panel must be updated to
- // indicate an invalid directory.
+ // indicate an invalid directory.
markUrlAsInvalid();
}
}
connect(dirNotify, SIGNAL(leftDirectory(QString)), SLOT(slotLeftDirectory(QString)));
m_content = new InformationPanelContent(this);
+ connect(m_content, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl)));
m_initialized = true;
}
/** @see QWidget::sizeHint() */
virtual QSize sizeHint() const;
+signals:
+ void urlActivated(const KUrl& url);
+
public slots:
/** @see Panel::setUrl() */
virtual void setUrl(const KUrl& url);
m_metaDataWidget = new KMetaDataWidget(parent);
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+ connect(m_metaDataWidget, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl)));
// Encapsulate the MetaDataWidget inside a container that has a dummy widget
// at the bottom. This prevents that the meta data widget gets vertically stretched
Item item;
item.name = prop.name();
item.label = tunedLabel(prop.label());
- item.value = formatValue(it.value());
+ if (it.value().isResource() || it.value().isResourceList()) {
+ item.resources = it.value().toResourceList();
+ } else {
+ item.value = formatValue(it.value());
+ }
m_items.append(item);
}
++it;
QString name;
QString label;
QString value;
+ QList<Nepomuk::Resource> resources;
};
KLoadMetaDataThread();
void slotCommentChanged(const QString& comment);
void slotMetaDataUpdateDone();
+ void slotLinkActivated(const QString& link);
#ifdef HAVE_NEPOMUK
/**
* Merges items like 'width' and 'height' as one item.
*/
QList<KLoadMetaDataThread::Item> mergedItems(const QList<KLoadMetaDataThread::Item>& items);
+
+ /**
+ * Returns a (clickable) text for the given item, that can be used for
+ * the information value widget.
+ */
+ QString labelText(const KLoadMetaDataThread::Item& item) const;
#endif
bool m_sizeVisible;
} else {
// create new row
QLabel* infoLabel = new QLabel(item.label, q);
- QLabel* infoValue = new QLabel(item.value, q);
+ QLabel* infoValue = new QLabel(labelText(item), q);
+ connect(infoValue, SIGNAL(linkActivated(QString)),
+ q, SLOT(slotLinkActivated(QString)));
addRow(infoLabel, infoValue);
}
++index;
#endif
}
+void KMetaDataWidget::Private::slotLinkActivated(const QString& link)
+{
+ emit q->urlActivated(KUrl(link));
+}
+
#ifdef HAVE_NEPOMUK
void KMetaDataWidget::Private::startChangeDataJob(KJob* job)
{
return mergedItems;
}
+
+QString KMetaDataWidget::Private::labelText(const KLoadMetaDataThread::Item& item) const
+{
+ if (item.resources.isEmpty()) {
+ return item.value;
+ }
+
+ QStringList links;
+ foreach(const Nepomuk::Resource& res, item.resources) {
+ links << QString::fromLatin1("<a href=\"%1\">%2</a>")
+ .arg(KUrl(res.resourceUri()).url())
+ .arg(res.genericLabel());
+ }
+ return QLatin1String("<p>") + links.join(QLatin1String(";\n"));
+}
#endif
KMetaDataWidget::KMetaDataWidget(QWidget* parent) :
/** @see QWidget::sizeHint() */
virtual QSize sizeHint() const;
+Q_SIGNALS:
+ void urlActivated(const KUrl& url);
+
private:
class Private;
Private* d;
Q_PRIVATE_SLOT(d, void slotTagsChanged(const QList<Nepomuk::Tag>& tags))
Q_PRIVATE_SLOT(d, void slotCommentChanged(const QString& comment))
Q_PRIVATE_SLOT(d, void slotMetaDataUpdateDone())
+ Q_PRIVATE_SLOT(d, void slotLinkActivated(const QString& link))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KMetaDataWidget::MetaDataTypes)