+
+void DolphinView::slotIncreaseZoom()
+{
+ setZoomLevel(zoomLevel() + 1);
+}
+
+void DolphinView::slotDecreaseZoom()
+{
+ setZoomLevel(zoomLevel() - 1);
+}
+
+void DolphinView::slotSwipeUp()
+{
+ Q_EMIT goUpRequested();
+}
+
+void DolphinView::showLoadingPlaceholder()
+{
+ m_placeholderLabel->setText(i18n("Loading..."));
+ m_placeholderLabel->setVisible(true);
+}
+
+void DolphinView::updatePlaceholderLabel()
+{
+ m_showLoadingPlaceholderTimer->stop();
+ if (itemsCount() > 0) {
+ m_placeholderLabel->setVisible(false);
+ return;
+ }
+
+ if (m_loadingState == LoadingState::Loading) {
+ m_placeholderLabel->setVisible(false);
+ m_showLoadingPlaceholderTimer->start();
+ return;
+ }
+
+ 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"));
+ } else if (m_url.scheme() == QLatin1String("trash") && m_url.path() == QLatin1String("/")) {
+ m_placeholderLabel->setText(i18n("Trash is empty"));
+ } else if (m_url.scheme() == QLatin1String("tags")) {
+ if (m_url.path() == QLatin1Char('/')) {
+ m_placeholderLabel->setText(i18n("No tags"));
+ } else {
+ const QString tagName = m_url.path().mid(1); // Remove leading /
+ m_placeholderLabel->setText(i18n("No files tagged with \"%1\"", tagName));
+ }
+
+ } else if (m_url.scheme() == QLatin1String("recentlyused")) {
+ m_placeholderLabel->setText(i18n("No recently used items"));
+ } else if (m_url.scheme() == QLatin1String("smb")) {
+ m_placeholderLabel->setText(i18n("No shared folders found"));
+ } else if (m_url.scheme() == QLatin1String("network")) {
+ m_placeholderLabel->setText(i18n("No relevant network resources found"));
+ } else if (m_url.scheme() == QLatin1String("mtp") && m_url.path() == QLatin1String("/")) {
+ m_placeholderLabel->setText(i18n("No MTP-compatible devices found"));
+ } else if (m_url.scheme() == QLatin1String("afc") && m_url.path() == QLatin1String("/")) {
+ m_placeholderLabel->setText(i18n("No Apple devices found"));
+ } else if (m_url.scheme() == QLatin1String("bluetooth")) {
+ m_placeholderLabel->setText(i18n("No Bluetooth devices found"));
+ } else {
+ m_placeholderLabel->setText(i18n("Folder is empty"));
+ }
+
+ m_placeholderLabel->setVisible(true);
+}
+
+void DolphinView::tryShowNameToolTip(QHelpEvent *event)
+{
+ if (!GeneralSettings::showToolTips() && m_mode == DolphinView::IconsView) {
+ const std::optional<int> index = m_view->itemAt(event->pos());
+
+ if (!index.has_value()) {
+ return;
+ }
+
+ // Check whether the filename has been elided
+ const bool isElided = m_view->isElided(index.value());
+
+ if (isElided) {
+ const KFileItem item = m_model->fileItem(index.value());
+ const QString text = item.text();
+ const QPoint pos = mapToGlobal(event->pos());
+ QToolTip::showText(pos, text);
+ }
+ }
+}