#include "views/tooltips/tooltipmanager.h"
#include "zoomlevelinfo.h"
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
#include <Baloo/IndexerConfig>
#endif
#include <KColorScheme>
#include <KLocalizedString>
#include <KMessageBox>
#include <KProtocolManager>
+#include <KUrlMimeData>
#include <QAbstractItemView>
#include <QActionGroup>
m_assureVisibleCurrentIndex(false),
m_isFolderWritable(true),
m_dragging(false),
- m_loading(false),
m_url(url),
m_viewPropertiesContext(),
m_mode(DolphinView::IconsView),
connect(selectionManager, &KItemListSelectionManager::selectionChanged,
this, &DolphinView::slotSelectionChanged);
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
m_toolTipManager = new ToolTipManager(this);
connect(m_toolTipManager, &ToolTipManager::urlActivated, this, &DolphinView::urlActivated);
#endif
{
QMimeData* mimeData = selectionMimeData();
KIO::setClipboardDataCut(mimeData, true);
+ KUrlMimeData::exportUrlsToPortal(mimeData);
QApplication::clipboard()->setMimeData(mimeData);
}
void DolphinView::copySelectedItemsToClipboard()
{
- QMimeData* mimeData = selectionMimeData();
+ QMimeData *mimeData = selectionMimeData();
+ KUrlMimeData::exportUrlsToPortal(mimeData);
QApplication::clipboard()->setMimeData(mimeData);
}
break;
case QEvent::ToolTip:
- tryShowNameToolTip(event);
+ tryShowNameToolTip(static_cast<QHelpEvent*>(event));
default:
break;
if (indexes.count() > 5) {
QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count());
- const int answer = KMessageBox::warningYesNo(this, question);
+ const int answer = KMessageBox::warningYesNo(this, question, {},
+ KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()),
+ QStringLiteral("document-open")),
+ KStandardGuiItem::cancel());
if (answer != KMessageBox::Yes) {
return;
}
const QList<QByteArray> visibleRolesSet = view->visibleRoles();
bool indexingEnabled = false;
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
Baloo::IndexerConfig config;
indexingEnabled = config.fileIndexingEnabled();
#endif
const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint());
itemRect.moveTo(pos);
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
auto nativeParent = nativeParentWidget();
if (nativeParent) {
m_toolTipManager->showToolTip(item, itemRect, nativeParent->windowHandle());
void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior)
{
if (GeneralSettings::showToolTips()) {
-#ifdef HAVE_BALOO
+#if HAVE_BALOO
m_toolTipManager->hideToolTip(behavior);
#else
Q_UNUSED(behavior)
void DolphinView::slotDirectoryLoadingStarted()
{
- m_loading = true;
+ m_loadingState = LoadingState::Loading;
updatePlaceholderLabel();
// Disable the writestate temporary until it can be determined in a fast way
void DolphinView::slotDirectoryLoadingCompleted()
{
- m_loading = false;
+ m_loadingState = LoadingState::Completed;
// Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
void DolphinView::slotDirectoryLoadingCanceled()
{
- m_loading = false;
+ m_loadingState = LoadingState::Canceled;
updatePlaceholderLabel();
return;
}
- if (m_loading) {
+ if (m_loadingState == LoadingState::Loading) {
m_placeholderLabel->setVisible(false);
m_showLoadingPlaceholderTimer->start();
return;
}
- if (!nameFilter().isEmpty()) {
+ if (m_loadingState == LoadingState::Canceled) {
+ m_placeholderLabel->setText(i18n("Loading canceled"));
+ } else if (!nameFilter().isEmpty()) {
m_placeholderLabel->setText(i18n("No items matching the filter"));
} else if (m_url.scheme() == QLatin1String("baloosearch") || m_url.scheme() == QLatin1String("filenamesearch")) {
m_placeholderLabel->setText(i18n("No items matching the search"));
m_placeholderLabel->setVisible(true);
}
-void DolphinView::tryShowNameToolTip(QEvent* event)
+void DolphinView::tryShowNameToolTip(QHelpEvent* event)
{
if (!GeneralSettings::showToolTips() && m_mode == DolphinView::IconsView) {
- QHelpEvent *hoverEvent = reinterpret_cast<QHelpEvent *>(event);
- const std::optional<int> index = m_view->itemAt(hoverEvent->pos());
+ const std::optional<int> index = m_view->itemAt(event->pos());
if (!index.has_value()) {
return;
if(isElided) {
const KFileItem item = m_model->fileItem(index.value());
const QString text = item.text();
- const QPoint pos = mapToGlobal(hoverEvent->pos());
+ const QPoint pos = mapToGlobal(event->pos());
QToolTip::showText(pos, text);
}
}