#include <QMenu>
#include <QTextDocument>
-#ifndef HAVE_BALOO
-#include <KFileMetaDataWidget>
-#else
#include <Baloo/FileMetaDataWidget>
-#endif
#include <panels/places/placesitem.h>
#include <panels/places/placesitemmodel.h>
const bool previewsShown = InformationPanelSettings::previewsShown();
m_preview->setVisible(previewsShown);
-#ifndef HAVE_BALOO
- m_metaDataWidget = new KFileMetaDataWidget(parent);
- connect(m_metaDataWidget, &KFileMetaDataWidget::urlActivated,
- this, &InformationPanelContent::urlActivated);
-#else
m_metaDataWidget = new Baloo::FileMetaDataWidget(parent);
+ m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
connect(m_metaDataWidget, &Baloo::FileMetaDataWidget::urlActivated,
this, &InformationPanelContent::urlActivated);
-#endif
m_metaDataWidget->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
- m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
-
+
// Encapsulate the MetaDataWidget inside a container that has a dummy widget
// at the bottom. This prevents that the meta data widget gets vertically stretched
// in the case where the height of m_metaDataArea > m_metaDataWidget.
m_outdatedPreviewTimer->start();
}
- m_previewJob = new KIO::PreviewJob(KFileItemList() << item, QSize(m_preview->width(), m_preview->height()));
+ QStringList plugins = KIO::PreviewJob::availablePlugins();
+ m_previewJob = new KIO::PreviewJob(KFileItemList() << item,
+ QSize(m_preview->width(), m_preview->height()),
+ &plugins);
m_previewJob->setScaleType(KIO::PreviewJob::Unscaled);
m_previewJob->setIgnoreMaximumSize(item.isLocalFile());
if (m_previewJob->uiDelegate()) {
return QWidget::eventFilter(obj, event);
}
-void InformationPanelContent::configureSettings(const QList<QAction*>& customContextMenuActions)
+void InformationPanelContent::configureSettings(const QList<QAction*>& customContextMenuActions, const QPointF& pos)
{
QMenu popup(this);
dateformatAction->setIcon(QIcon::fromTheme(QStringLiteral("change-date-symbolic")));
dateformatAction->setCheckable(true);
dateformatAction->setChecked(InformationPanelSettings::dateFormat() == static_cast<int>(Baloo::DateFormats::ShortFormat));
+
popup.addSeparator();
foreach (QAction* action, customContextMenuActions) {
popup.addAction(action);
// Open the popup and adjust the settings for the
// selected action.
- QAction* action = popup.exec(QCursor::pos());
+ QAction* action = popup.exec(pos.toPoint());
if (!action) {
return;
}
if (action == previewAction) {
m_preview->setVisible(isChecked);
InformationPanelSettings::setPreviewsShown(isChecked);
- } else if (action == dateformatAction) {
- int dateFormat = static_cast<int>(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat);
-
- InformationPanelSettings::setDateFormat(dateFormat);
- refreshMetaData();
} else if (action == configureAction) {
FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(this);
dialog->setDescription(i18nc("@label::textbox",
dialog->show();
connect(dialog, &FileMetaDataConfigurationDialog::destroyed, this, &InformationPanelContent::refreshMetaData);
}
+ if (action == dateformatAction) {
+ int dateFormat = static_cast<int>(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat);
+
+ InformationPanelSettings::setDateFormat(dateFormat);
+ refreshMetaData();
+ }
}
void InformationPanelContent::showIcon(const KFileItem& item)