]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'Applications/18.08'
authorKai Uwe Broulik <kde@privat.broulik.de>
Wed, 24 Oct 2018 07:53:07 +0000 (09:53 +0200)
committerKai Uwe Broulik <kde@privat.broulik.de>
Wed, 24 Oct 2018 07:53:07 +0000 (09:53 +0200)
42 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/dbusinterface.cpp
src/dolphincontextmenu.cpp
src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphintabwidget.cpp
src/dolphintabwidget.h
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h
src/kitemviews/kfileitemlistwidget.cpp
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodelrolesupdater.cpp
src/kitemviews/private/kdirectorycontentscounterworker.h
src/kitemviews/private/kitemlistviewlayouter.cpp
src/main.cpp
src/org.kde.dolphin.appdata.xml
src/panels/information/filemetadataconfigurationdialog.cpp
src/panels/information/filemetadataconfigurationdialog.h
src/panels/information/informationpanelcontent.cpp
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/panels/places/placespanel.h
src/settings/general/behaviorsettingspage.cpp
src/statusbar/dolphinstatusbar.cpp
src/statusbar/dolphinstatusbar.h
src/statusbar/mountpointobservercache.cpp
src/statusbar/spaceinfoobserver.cpp
src/statusbar/spaceinfoobserver.h
src/statusbar/statusbarspaceinfo.cpp
src/statusbar/statusbarspaceinfo.h
src/tests/dolphinmainwindowtest.cpp
src/tests/kfileitemmodeltest.cpp
src/tests/kitemlistcontrollertest.cpp
src/tests/placesitemmodeltest.cpp
src/trash/dolphintrash.cpp
src/views/dolphinview.cpp
src/views/tooltips/dolphinfilemetadatawidget.cpp
src/views/tooltips/dolphinfilemetadatawidget.h
src/views/tooltips/tooltipmanager.cpp
src/views/viewproperties.cpp

index b2e666a432ab47667140d653de6e684b698848f1..390376e944c03460cebd1155f6e89baa3409da1e 100644 (file)
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.0)
 
 # KDE Application Version, managed by release script
 set (KDE_APPLICATIONS_VERSION_MAJOR "18")
-set (KDE_APPLICATIONS_VERSION_MINOR "08")
-set (KDE_APPLICATIONS_VERSION_MICRO "2")
+set (KDE_APPLICATIONS_VERSION_MINOR "11")
+set (KDE_APPLICATIONS_VERSION_MICRO "70")
 set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
 project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION})
 
@@ -94,10 +94,7 @@ if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND)
     message(STATUS "Baloo packages are found")
     set(HAVE_BALOO TRUE)
 else()
-    message(WARNING "Baloo packages not found. They are needed for the metadata features of Dolphin.")
-    find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
-        KDELibs4Support # for KFileMetaDataWidget
-    )
+    message(WARNING "Baloo packages not found. They are needed for the metadata features of Dolphin (including the information panel).")
 endif()
 
 add_subdirectory(src)
index eacb792fc9cf05956fd7c4d7f5937569432917f6..5aff4b0fadcac1912962e20146ce6532cce7b1e7 100644 (file)
@@ -98,8 +98,6 @@ set(dolphinprivate_LIB_SRCS
     views/dolphinviewactionhandler.cpp
     views/draganddrophelper.cpp
     views/renamedialog.cpp
-    views/tooltips/dolphinfilemetadatawidget.cpp
-    views/tooltips/tooltipmanager.cpp
     views/versioncontrol/updateitemstatesthread.cpp
     views/versioncontrol/versioncontrolobserver.cpp
     views/viewmodecontroller.cpp
@@ -114,6 +112,8 @@ set(dolphinprivate_LIB_SRCS
 if(HAVE_BALOO)
     set(dolphinprivate_LIB_SRCS
         ${dolphinprivate_LIB_SRCS}
+        views/tooltips/dolphinfilemetadatawidget.cpp
+        views/tooltips/tooltipmanager.cpp
         kitemviews/private/kbaloorolesprovider.cpp
     )
 endif()
@@ -155,11 +155,6 @@ if(HAVE_BALOO)
         KF5::Baloo
         KF5::BalooWidgets
     )
-else()
-    target_link_libraries(
-        dolphinprivate PUBLIC
-        KF5::KDELibs4Support # for KFileMetaDataWidget
-    )
 endif()
 
 set_target_properties(dolphinprivate PROPERTIES
@@ -204,11 +199,6 @@ set(dolphinstatic_SRCS
     dolphintabwidget.cpp
     trash/dolphintrash.cpp
     filterbar/filterbar.cpp
-    panels/information/filemetadataconfigurationdialog.cpp
-    panels/information/informationpanel.cpp
-    panels/information/informationpanelcontent.cpp
-    panels/information/pixmapviewer.cpp
-    panels/information/phononwidget.cpp
     panels/places/placespanel.cpp
     panels/places/placesitem.cpp
     panels/places/placesitemeditdialog.cpp
@@ -252,6 +242,17 @@ set(dolphinstatic_SRCS
     global.cpp
 )
 
+if(HAVE_BALOO)
+    set(dolphinstatic_SRCS
+        ${dolphinstatic_SRCS}
+        panels/information/filemetadataconfigurationdialog.cpp
+        panels/information/informationpanel.cpp
+        panels/information/informationpanelcontent.cpp
+        panels/information/pixmapviewer.cpp
+        panels/information/phononwidget.cpp
+    )
+endif()
+
 kconfig_add_kcfg_files(dolphinstatic_SRCS GENERATE_MOC
     panels/folders/dolphin_folderspanelsettings.kcfgc
     panels/information/dolphin_informationpanelsettings.kcfgc
index e5192f2077224a63e74a69105d75501ee197dd1c..c780bc7cdc9cb853f4df70cc9d57a4df72183872 100644 (file)
 #include <KPropertiesDialog>
 
 #include <QDBusConnection>
+#include <QDBusConnectionInterface>
 
 DBusInterface::DBusInterface() :
     QObject()
 {
-    QDBusConnection::sessionBus().registerService(QStringLiteral("org.freedesktop.FileManager1"));
     QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this,
             QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
+    QDBusConnection::sessionBus().interface()->registerService(QStringLiteral("org.freedesktop.FileManager1"),
+                                                               QDBusConnectionInterface::QueueService);
 }
 
 void DBusInterface::ShowFolders(const QStringList& uriList, const QString& startUpId)
index 8fdaab1d0e17ecb5ed2bd6748dbb288c5136d116..a521551e59a050e8015f9a40dd74dd9e7b59e864 100644 (file)
@@ -341,7 +341,12 @@ void DolphinContextMenu::openViewportContextMenu()
     addSeparator();
 
     // Insert 'Open With' entries
-    const KFileItemListProperties baseUrlProperties(KFileItemList() << baseFileItem());
+    KFileItem baseItem = view->rootItem();
+    if (baseItem.isNull() || baseItem.url() != m_baseUrl) {
+        baseItem = baseFileItem();
+    }
+
+    const KFileItemListProperties baseUrlProperties(KFileItemList() << baseItem);
     KFileItemActions fileItemActions;
     fileItemActions.setParentWidget(m_mainWindow);
     fileItemActions.setItemListProperties(baseUrlProperties);
index 38537d92a9edc4d52cf2e73a69398975c62383cd..75a340f0a5e14aa0b7b7432158cbb99384ff0337 100644 (file)
@@ -25,7 +25,6 @@
 #include "dolphindockwidget.h"
 #include "dolphincontextmenu.h"
 #include "dolphinnewfilemenu.h"
-#include "dolphinplacesmodelsingleton.h"
 #include "dolphinrecenttabsmenu.h"
 #include "dolphintabwidget.h"
 #include "dolphinviewcontainer.h"
@@ -49,7 +48,6 @@
 #include <KAuthorized>
 #include <KConfig>
 #include <KFileItemListProperties>
-#include <KFilePlacesModel>
 #include <KHelpMenu>
 #include <KIO/JobUiDelegate>
 #include <KIO/OpenFileManagerWindowJob>
@@ -137,7 +135,7 @@ DolphinMainWindow::DolphinMainWindow() :
     connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
             this, &DolphinMainWindow::tabCountChanged);
     connect(m_tabWidget, &DolphinTabWidget::currentUrlChanged,
-            this, &DolphinMainWindow::setUrlAsCaption);
+            this, &DolphinMainWindow::updateWindowTitle);
     setCentralWidget(m_tabWidget);
 
     setupActions();
@@ -588,6 +586,7 @@ void DolphinMainWindow::reloadView()
 {
     clearStatusBar();
     m_activeViewContainer->reload();
+    m_activeViewContainer->statusBar()->updateSpaceInfo();
 }
 
 void DolphinMainWindow::stopLoading()
@@ -855,6 +854,11 @@ void DolphinMainWindow::updateControlMenu()
 
     KActionCollection* ac = actionCollection();
 
+    // Add "Create New" menu
+    menu->addMenu(m_newFileMenu->menu());
+
+    menu->addSeparator();
+
     // Add "Edit" actions
     bool added = addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Undo)), menu) |
                  addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Find)), menu) |
@@ -996,46 +1000,9 @@ void DolphinMainWindow::tabCountChanged(int count)
     actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions);
 }
 
-void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
+void DolphinMainWindow::updateWindowTitle()
 {
-    QString schemePrefix;
-    if (!url.isLocalFile()) {
-        schemePrefix.append(url.scheme() + " - ");
-        if (!url.host().isEmpty()) {
-            schemePrefix.append(url.host() + " - ");
-        }
-    }
-
-    if (GeneralSettings::showFullPathInTitlebar()) {
-        const QString path = url.adjusted(QUrl::StripTrailingSlash).path();
-        setWindowTitle(schemePrefix + path);
-        return;
-    }
-
-    KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
-    const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly);
-
-    if (!matchedPlaces.isEmpty()) {
-        setWindowTitle(placesModel->text(matchedPlaces.first()));
-        return;
-    }
-
-    QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
-    if (fileName.isEmpty()) {
-        fileName = '/';
-    }
-
-    if (m_activeViewContainer->isSearchModeEnabled()) {
-        if(m_activeViewContainer->currentSearchText().isEmpty()){
-            setWindowTitle(i18n("Search"));
-        } else {
-            const auto searchText = i18n("Search for %1", m_activeViewContainer->currentSearchText());
-            setWindowTitle(searchText);
-        }
-        return;
-    }
-
-    setWindowTitle(schemePrefix + fileName);
+    setWindowTitle(m_activeViewContainer->caption());
 }
 
 void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath)
@@ -1262,6 +1229,8 @@ void DolphinMainWindow::setupDockWidgets()
     infoDock->setLocked(lock);
     infoDock->setObjectName(QStringLiteral("infoDock"));
     infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+
+#ifdef HAVE_BALOO
     InformationPanel* infoPanel = new InformationPanel(infoDock);
     infoPanel->setCustomContextMenuActions({lockLayoutAction});
     connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
@@ -1277,6 +1246,7 @@ void DolphinMainWindow::setupDockWidgets()
             infoPanel, &InformationPanel::setSelection);
     connect(this, &DolphinMainWindow::requestItemInfo,
             infoPanel, &InformationPanel::requestDelayedItemInfo);
+#endif
 
     // Setup "Folders"
     DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
@@ -1373,7 +1343,9 @@ void DolphinMainWindow::setupDockWidgets()
     panelsMenu->setDelayed(false);
     const KActionCollection* ac = actionCollection();
     panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel")));
+#ifdef HAVE_BALOO
     panelsMenu->addAction(ac->action(QStringLiteral("show_information_panel")));
+#endif
     panelsMenu->addAction(ac->action(QStringLiteral("show_folders_panel")));
     panelsMenu->addAction(ac->action(QStringLiteral("show_terminal_panel")));
     panelsMenu->addSeparator();
@@ -1497,7 +1469,7 @@ void DolphinMainWindow::refreshViews()
         const bool splitView = GeneralSettings::splitView();
         m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView);
         updateSplitAction();
-        setUrlAsCaption(activeViewContainer()->url());
+        updateWindowTitle();
     }
 
     emit settingsChanged();
index 637f41f2108e2d143abc2beeadb6cd9b6ff0c624..f2876a8770d240e214660a3b713aeff151f13cfe 100644 (file)
@@ -412,10 +412,9 @@ private slots:
     void tabCountChanged(int count);
 
     /**
-     * Sets the window caption to url.fileName() if this is non-empty,
-     * "/" if the URL is "file:///", and url.protocol() otherwise.
+     * Updates the Window Title with the caption from the active view container
      */
-    void setUrlAsCaption(const QUrl& url);
+    void updateWindowTitle();
 
     /**
      * This slot is called when the user requested to unmount a removable media
index a5c2f8c98c77e48dd72d02aaec36f5bf92838483..edb7247cc611d2edd556d797643b553128136283 100644 (file)
@@ -116,6 +116,7 @@ void DolphinTabWidget::refreshViews()
 {
     const int tabCount = count();
     for (int i = 0; i < tabCount; ++i) {
+        tabBar()->setTabText(i, tabName(tabPageAt(i)));
         tabPageAt(i)->refreshViews();
     }
 }
@@ -160,7 +161,7 @@ void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryU
             this, &DolphinTabWidget::activeViewChanged);
     connect(tabPage, &DolphinTabPage::activeViewUrlChanged,
             this, &DolphinTabWidget::tabUrlChanged);
-    addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName(primaryUrl));
+    addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName(tabPage));
 
     if (focusWidget) {
         // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
@@ -305,7 +306,7 @@ void DolphinTabWidget::tabUrlChanged(const QUrl& url)
 {
     const int index = indexOf(qobject_cast<QWidget*>(sender()));
     if (index >= 0) {
-        tabBar()->setTabText(index, tabName(url));
+        tabBar()->setTabText(index, tabName(tabPageAt(index)));
         tabBar()->setTabIcon(index, QIcon::fromTheme(KIO::iconNameForUrl(url)));
 
         // Emit the currentUrlChanged signal if the url of the current tab has been changed.
@@ -353,20 +354,13 @@ void DolphinTabWidget::tabRemoved(int index)
     emit tabCountChanged(count());
 }
 
-QString DolphinTabWidget::tabName(const QUrl& url) const
+QString DolphinTabWidget::tabName(DolphinTabPage* tabPage) const
 {
-    QString name;
-    if (url == QUrl(QStringLiteral("file:///"))) {
-        name = '/';
-    } else {
-        name = url.adjusted(QUrl::StripTrailingSlash).fileName();
-        if (name.isEmpty()) {
-            name = url.scheme();
-        } else {
-            // Make sure that a '&' inside the directory name is displayed correctly
-            // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
-            name.replace('&', QLatin1String("&&"));
-        }
+    if (!tabPage) {
+        return QString();
     }
-    return name;
+    QString name = tabPage->activeViewContainer()->caption();
+    // Make sure that a '&' inside the directory name is displayed correctly
+    // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
+    return name.replace('&', QLatin1String("&&"));
 }
index b4493f7ed82e00e1a82270b0cf9d3e48fe8eaf1c..0cb662966a76a4a07b45da950edb811a6ee54f22 100644 (file)
@@ -191,9 +191,10 @@ protected:
 
 private:
     /**
-     * Returns the name of the tab for the URL \a url.
+     * @param tabPage The tab page to get the name of
+     * @return The name of the tab page
      */
-    QString tabName(const QUrl& url) const;
+    QString tabName(DolphinTabPage* tabPage) const;
 
 private:
     /** Caches the (negated) places panel visibility */
index f473752dc11af6de163e80cfcb443a20d28fd977..767af64e1c6b103236c15cc517f8653e939ee8f2 100644 (file)
@@ -31,6 +31,7 @@
 #include "views/viewproperties.h"
 
 #include <KFileItemActions>
+#include <KFilePlacesModel>
 #include <KIO/PreviewJob>
 #include <KLocalizedString>
 #include <KMessageWidget>
@@ -55,6 +56,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
     m_urlNavigator(nullptr),
     m_emptyTrashButton(nullptr),
     m_searchBox(nullptr),
+    m_searchModeEnabled(false),
     m_messageWidget(nullptr),
     m_view(nullptr),
     m_filterBar(nullptr),
@@ -377,11 +379,13 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
         }
         m_urlNavigator->setLocationUrl(url);
     }
+
+    m_searchModeEnabled = enabled;
 }
 
 bool DolphinViewContainer::isSearchModeEnabled() const
 {
-    return m_searchBox->isVisible();
+    return m_searchModeEnabled;
 }
 
 QString DolphinViewContainer::placesText() const
@@ -409,6 +413,53 @@ void DolphinViewContainer::reload()
     m_messageWidget->hide();
 }
 
+QString DolphinViewContainer::caption() const
+{
+    if (GeneralSettings::showFullPathInTitlebar()) {
+        if (!url().isLocalFile()) {
+            return url().adjusted(QUrl::StripTrailingSlash).toString();
+        }
+        return url().adjusted(QUrl::StripTrailingSlash).path();
+    }
+
+    KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
+    const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url(), 1, Qt::MatchExactly);
+
+    if (!matchedPlaces.isEmpty()) {
+        return placesModel->text(matchedPlaces.first());
+    }
+
+    if (isSearchModeEnabled()) {
+        if (currentSearchText().isEmpty()){
+            return i18n("Search");
+        } else {
+            return i18n("Search for %1", currentSearchText());
+        }
+    }
+
+    if (!url().isLocalFile()) {
+        QUrl adjustedUrl = url().adjusted(QUrl::StripTrailingSlash);
+        QString caption;
+        if (!adjustedUrl.fileName().isEmpty()) {
+            caption = adjustedUrl.fileName();
+        } else if (!adjustedUrl.path().isEmpty() && adjustedUrl.path() != "/") {
+            caption = adjustedUrl.path();
+        } else if (!adjustedUrl.host().isEmpty()) {
+            caption = adjustedUrl.host();
+        } else {
+            caption = adjustedUrl.toString();
+        }
+        return caption;
+    }
+
+    QString fileName = url().adjusted(QUrl::StripTrailingSlash).fileName();
+    if (fileName.isEmpty()) {
+        fileName = '/';
+    }
+
+    return fileName;
+}
+
 void DolphinViewContainer::setUrl(const QUrl& newUrl)
 {
     if (newUrl != m_urlNavigator->locationUrl()) {
@@ -633,7 +684,6 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
 
 void DolphinViewContainer::slotUrlSelectionRequested(const QUrl& url)
 {
-    qCDebug(DolphinDebug) << "slotUrlSelectionRequested: " << url;
     m_view->markUrlsAsSelected({url});
     m_view->markUrlAsCurrent(url); // makes the item scroll into view
 }
index b5bcc78ad344c55ddc0c1720cec0a1b887085851..f33a5a11868e4cac9dd2807b3df89ddd0a09796b 100644 (file)
@@ -136,6 +136,13 @@ public:
      */
     void reload();
 
+    /**
+     * @return Returns a Caption suitable for display to the user. It is
+     * calculated depending on settings, if a search is active and other
+     * factors.
+     */
+    QString caption() const;
+
 public slots:
     /**
      * Sets the current active URL, where all actions are applied. The
@@ -324,6 +331,7 @@ private:
     KUrlNavigator* m_urlNavigator;
     QPushButton* m_emptyTrashButton;
     DolphinSearchBox* m_searchBox;
+    bool m_searchModeEnabled;
     KMessageWidget* m_messageWidget;
 
     DolphinView* m_view;
index e548e7519b78f109a57e7ec0f910da0a1219f948..40b8ccf3717a4a10965cf8c361c8be7e743fb57a 100644 (file)
@@ -78,7 +78,13 @@ QString KFileItemListWidgetInformant::roleText(const QByteArray& role,
             const KIO::filesize_t size = roleValue.value<KIO::filesize_t>();
             text = KFormat().formatByteSize(size);
         }
-    } else if (role == "modificationtime" || role == "creationtime" || role == "accesstime" || role == "deletiontime" || role == "imageDateTime") {
+    } else if (role == "modificationtime" || role == "creationtime" || role == "accesstime") {
+            bool ok;
+            const long long time = roleValue.toLongLong(&ok);
+            if (ok && time != -1) {
+                return QLocale().toString(QDateTime::fromSecsSinceEpoch(time), QLocale::ShortFormat);
+            }
+    } else if (role == "deletiontime" || role == "imageDateTime") {
         const QDateTime dateTime = roleValue.toDateTime();
         text = QLocale().toString(dateTime, QLocale::ShortFormat);
     } else {
index 8503cc8bcf46ae934bdc4cbc0a4ba0e290fff0f8..fd0a88fb61a034b9001e6ace59cbf9819fa8126e 100644 (file)
@@ -1563,26 +1563,26 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
     }
 
     if (m_requestRole[ModificationTimeRole]) {
-        // Don't use KFileItem::timeString() as this is too expensive when
-        // having several thousands of items. Instead the formatting of the
-        // date-time will be done on-demand by the view when the date will be shown.
-        const QDateTime dateTime = item.time(KFileItem::ModificationTime);
+        // Don't use KFileItem::timeString() or KFileItem::time() as this is too expensive when
+        // having several thousands of items. Instead read the raw number from UDSEntry directly
+        // and the formatting of the date-time will be done on-demand by the view when the date will be shown.
+        const long long dateTime = item.entry().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1);
         data.insert(sharedValue("modificationtime"), dateTime);
     }
 
     if (m_requestRole[CreationTimeRole]) {
-        // Don't use KFileItem::timeString() as this is too expensive when
-        // having several thousands of items. Instead the formatting of the
-        // date-time will be done on-demand by the view when the date will be shown.
-        const QDateTime dateTime = item.time(KFileItem::CreationTime);
+        // Don't use KFileItem::timeString() or KFileItem::time() as this is too expensive when
+        // having several thousands of items. Instead read the raw number from UDSEntry directly
+        // and the formatting of the date-time will be done on-demand by the view when the date will be shown.
+        const long long dateTime = item.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1);
         data.insert(sharedValue("creationtime"), dateTime);
     }
 
     if (m_requestRole[AccessTimeRole]) {
-        // Don't use KFileItem::timeString() as this is too expensive when
-        // having several thousands of items. Instead the formatting of the
-        // date-time will be done on-demand by the view when the date will be shown.
-        const QDateTime dateTime = item.time(KFileItem::AccessTime);
+        // Don't use KFileItem::timeString() or KFileItem::time() as this is too expensive when
+        // having several thousands of items. Instead read the raw number from UDSEntry directly
+        // and the formatting of the date-time will be done on-demand by the view when the date will be shown.
+        const long long dateTime = item.entry().numberValue(KIO::UDSEntry::UDS_ACCESS_TIME, -1);
         data.insert(sharedValue("accesstime"), dateTime);
     }
 
index abc5f176a349a1857fd937dc3a02129395caf6d2..f4d69dec2766b83ce8f768bc005815056f88650a 100644 (file)
@@ -495,14 +495,9 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi
 
     QPixmap scaledPixmap = pixmap;
 
-    const QString mimeType = item.mimetype();
-    const int slashIndex = mimeType.indexOf(QLatin1Char('/'));
-    const bool isFontPreview = mimeType.rightRef(slashIndex).contains(QLatin1String("font"));
-    const bool isFolderPreview = item.isDir();
-    const bool isWindowsExePreview = mimeType == QLatin1String("application/x-ms-dos-executable") ||
-                                     mimeType == QLatin1String("application/x-msdownload");
-
-    if (!isFolderPreview && !isFontPreview && !isWindowsExePreview) {
+    if (!pixmap.hasAlpha()
+        && m_iconSize.width()  > KIconLoader::SizeSmallMedium
+        && m_iconSize.height() > KIconLoader::SizeSmallMedium) {
         if (m_enlargeSmallPreviews) {
             KPixmapModifier::applyFrame(scaledPixmap, m_iconSize);
         } else {
index 2460a0e1ff132d28300494b37c56cbb9f6f8e6d4..b40da6e87b57f5f99eb48c57b302a012bdc8b2d5 100644 (file)
@@ -17,8 +17,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#ifndef KDIRECTORYCONTENTENTSCOUNTERWORKER_H
-#define KDIRECTORYCONTENTENTSCOUNTERWORKER_H
+#ifndef KDIRECTORYCONTENTSCOUNTERWORKER_H
+#define KDIRECTORYCONTENTSCOUNTERWORKER_H
 
 #include <QMetaType>
 #include <QObject>
index c765cdcfe9c787b5cb5cdba037075eb62e5ca8e9..56e0f338fa861746ce0df4d50dfe77d23553d0da 100644 (file)
@@ -17,9 +17,9 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
+#include "kitemlistviewlayouter.h"
 #include "dolphindebug.h"
 #include "kitemlistsizehintresolver.h"
-#include "kitemlistviewlayouter.h"
 #include "kitemviews/kitemmodelbase.h"
 
 // #define KITEMLISTVIEWLAYOUTER_DEBUG
index a46b5e2d823dd5edded67467d32c11557a7d1aef..3db63eab0c6d0bc61e21f6cdb1048c4b68b3a578 100644 (file)
@@ -144,7 +144,6 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
     }
 
     DolphinMainWindow* mainWindow = new DolphinMainWindow();
-    mainWindow->setAttribute(Qt::WA_DeleteOnClose);
 
     if (parser.isSet(QStringLiteral("select"))) {
         mainWindow->openFiles(urls, splitView);
index 30b0be216d228acd0598f0dfcfa1fb4e87452608..9aa3d146f7dc14c28b77580bf6c23067c0a130ae 100644 (file)
@@ -97,6 +97,7 @@
   <description>
     <p>Dolphin is a lightweight file manager. It has been designed with ease of use and simplicity in mind, while still allowing flexibility and customisation. This means that you can do your file management exactly the way you want to do it.</p>
     <p xml:lang="ar">دولفين هو مدير ملفات خفيف. صُمِّم دولفين مع أخذ سهولة الاستخدام والبساطة بعين الاعتبار، مع السماح بالمرونة والتخصيص. يعني هذا أنه يمكنك إدارة ملفاتك كما تريد تمامًا.</p>
+    <p xml:lang="ast">Dolphin ye un xestor de ficheros llixeru. Diseñóse cola cenciellez y facilidá d'usu en mente, al empar que permite flexibilidá y personalización. Esto quier dicir que pues facer la xestión de ficheros del mou exautu que quieras.</p>
     <p xml:lang="bs">Dolphinje lagan file manager. On je bio dizajniran sa lakoćom korišćenja i jednostavnosti u vidu, još omogućavajući fleksibilnost i prilagođavanje. To znači da možete da radite svoje upravljanje datotekama onako kako želite da to uradi.</p>
     <p xml:lang="ca">El Dolphin és un gestor de fitxers lleuger. S'ha dissenyat pensant a facilitar el seu ús i que sigui simple, permetent la flexibilitat i la personalització. Això vol dir que podeu fer la gestió dels vostres fitxers de la manera exacta com ho vulgueu fer.</p>
     <p xml:lang="ca-valencia">El Dolphin és un gestor de fitxers lleuger. S'ha dissenyat pensant a facilitar el seu ús i que siga simple, permetent la flexibilitat i la personalització. Això vol dir que podeu fer la gestió dels vostres fitxers de la manera exacta com ho vulgueu fer.</p>
       <li xml:lang="zh-TW">網址導覽列讓您可以快速瀏覽檔案與資料夾。</li>
       <li>Supports several different kinds of view styles and properties and allows you to configure the view exactly how you want it.</li>
       <li xml:lang="ar">يدعم العديد من الأنواع المختلفة من الخصائص وأنماط العرض ويسمح لك بضبط العرض كما تريد تمامًا.</li>
+      <li xml:lang="ast">Sofita estilos y propiedaes de vista diferentes, y permítete configurar la vista exautamente como quieras.</li>
       <li xml:lang="bs">Dopušta vište vrsta stilova pogleda i svojstava i dopšta vam da konfigurišete pogled baš kako želite.</li>
       <li xml:lang="ca">Accepta diferents classes diverses d'estils de visualització i propietats i us permet configurar la visualització exactament com la vulgueu.</li>
       <li xml:lang="ca-valencia">Accepta diferents classes diverses d'estils de visualització i propietats i vos permet configurar la visualització exactament com la vulgueu.</li>
       <li xml:lang="zh-TW">網址導覽列讓您可以快速瀏覽檔案與資料夾。</li>
       <li>Split view, allowing you to easily copy or move files between locations.</li>
       <li xml:lang="ar">العرض المقسوم، يسمح لك بنسخ ونقل الملفات بين مكانين بسهولة.</li>
+      <li xml:lang="ast">La vista dixebrada permítete copiar o mover ficheros de mou fácil ente allugamientos.</li>
       <li xml:lang="bs">Razdvaja pogled, dopuštajući lako kopiranje ili pomijeranje datoteka između lokacija</li>
       <li xml:lang="ca">Divisió de visualització, permetent copiar o moure fitxers fàcilment entre les ubicacions.</li>
       <li xml:lang="ca-valencia">Divisió de visualització, permetent copiar o moure fitxers fàcilment entre les ubicacions.</li>
       <li xml:lang="zh-TW">支援數個檢視模式,您也可以調整檢視模式的屬性。</li>
       <li>Additional information and shortcuts are available as dock-able panels, allowing you to move them around freely and display exactly what you want.</li>
       <li xml:lang="ar">تتوفر معلومات واختصارات إضافية كلوحات قابلة للرصف، مما يسمح لك بنقلها بحريّة وعرضها بالضبط كما تريد.</li>
+      <li xml:lang="ast">La información adicional y los atayos tán disponibles como paneles anclables que pues mover ande quieras y amosar como exautamente quieras.</li>
       <li xml:lang="bs">Dodatne informacije i kratice su dostupne kao usidreni paneli, dopuštajući vam da se krećete slobodno i prikažete šta želite.</li>
       <li xml:lang="ca">Hi ha informació addicional i dreceres disponibles com a plafons que es poden acoblar, permetent moure'ls lliurement i mostrar exactament el què vulgueu.</li>
       <li xml:lang="ca-valencia">Hi ha informació addicional i dreceres disponibles com a plafons que es poden acoblar, permetent moure'ls lliurement i mostrar exactament el què vulgueu.</li>
       <li xml:lang="zh-TW">額外資訊與嵌入式面板捷徑讓您可以輕易顯示您常用的項目。</li>
       <li>Informational dialogues are displayed in an unobtrusive way.</li>
       <li xml:lang="ar">حواريات المعلومات تُعرَض بطريقة غير مُزعجة.</li>
+      <li xml:lang="ast">Los diálogos informativos amuésense d'un mou non intrusivu.</li>
       <li xml:lang="bs">Informativni dijalozi su prikazani na nenametljiv način.</li>
       <li xml:lang="ca">Els diàlegs informatius es mostren d'una manera no molesta.</li>
       <li xml:lang="ca-valencia">Els diàlegs informatius es mostren d'una manera no molesta.</li>
       <li xml:lang="zh-TW">支援多分頁</li>
       <li>Undo/redo support</li>
       <li xml:lang="ar">دعم التراجع والإعادة</li>
+      <li xml:lang="ast">Sofitu pa la desfechura/refechura</li>
       <li xml:lang="bs">Podrška za poništavanje/ponavljanje akcija</li>
       <li xml:lang="ca">Admet desfer/refer</li>
       <li xml:lang="ca-valencia">Admet desfer/refer</li>
index 3b3789175bb6f48117ac6aee9994d8b0d6457493..f3ca819b7d644736f0b8c7fbb88db28f328cbb8b 100644 (file)
 
 #include "filemetadataconfigurationdialog.h"
 
-#ifndef HAVE_BALOO
-#include <kfilemetadataconfigurationwidget.h>
-#else
 #include <Baloo/FileMetaDataConfigWidget>
-#endif
 #include <KConfigGroup>
 #include <KLocalizedString>
 #include <KSharedConfig>
@@ -56,12 +52,7 @@ FileMetaDataConfigurationDialog::FileMetaDataConfigurationDialog(QWidget* parent
                                           "be shown:"), this);
     m_descriptionLabel->setWordWrap(true);
 
-#ifndef HAVE_BALOO
-    m_configWidget = new KFileMetaDataConfigurationWidget(this);
-#else
     m_configWidget = new Baloo::FileMetaDataConfigWidget(this);
-#endif
-
 
     QWidget* mainWidget = new QWidget(this);
     QVBoxLayout* topLayout = new QVBoxLayout(mainWidget);
index b38404da86f49df086d59aa156c9ee28af4221c4..04357783c324c1eb96b776063d6d96250e5dc6de 100644 (file)
@@ -70,11 +70,7 @@ protected slots:
     void slotAccepted();
 private:
     QLabel* m_descriptionLabel;
-#ifndef HAVE_BALOO
-    KFileMetaDataConfigurationWidget* m_configWidget;
-#else
     Baloo::FileMetaDataConfigWidget* m_configWidget;
-#endif
 };
 
 #endif
index 0cba0cdf0687cb86f04c820a09c305fa0c5d5a8d..6f671e683058f6c6af214d0224404868bcdbe001 100644 (file)
 #include <QMenu>
 #include <QTextDocument>
 
-#ifndef HAVE_BALOO
-#include <KFileMetaDataWidget>
-#else
 #include <Baloo/FileMetaDataWidget>
-#endif
 
 #include <panels/places/placesitem.h>
 #include <panels/places/placesitemmodel.h>
@@ -106,19 +102,13 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
     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);
+
     // 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.
@@ -180,7 +170,10 @@ void InformationPanelContent::showItem(const KFileItem& item)
             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()) {
@@ -194,9 +187,7 @@ void InformationPanelContent::showItem(const KFileItem& item)
     }
 
     if (m_metaDataWidget) {
-#ifdef HAVE_BALOO
         m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
-#endif
         m_metaDataWidget->show();
         m_metaDataWidget->setItems(KFileItemList() << item);
     }
@@ -285,12 +276,11 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
     QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure..."));
     configureAction->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
 
-#ifdef HAVE_BALOO
     QAction* dateformatAction = popup.addAction(i18nc("@action:inmenu", "Condensed Date"));
     dateformatAction->setIcon(QIcon::fromTheme(QStringLiteral("change-date-symbolic")));
     dateformatAction->setCheckable(true);
     dateformatAction->setChecked(InformationPanelSettings::dateFormat() == static_cast<int>(Baloo::DateFormats::ShortFormat));
-#endif
+
     popup.addSeparator();
     foreach (QAction* action, customContextMenuActions) {
         popup.addAction(action);
@@ -316,14 +306,12 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
         dialog->show();
         connect(dialog, &FileMetaDataConfigurationDialog::destroyed, this, &InformationPanelContent::refreshMetaData);
     }
-#ifdef HAVE_BALOO
     if (action == dateformatAction) {
         int dateFormat = static_cast<int>(isChecked ? Baloo::DateFormats::ShortFormat : Baloo::DateFormats::LongFormat);
 
         InformationPanelSettings::setDateFormat(dateFormat);
         refreshMetaData();
     }
-#endif
 }
 
 void InformationPanelContent::showIcon(const KFileItem& item)
index 7e313482da21455c327ddcf95f171a837be98088..f7fe5587c7fa3cd2c5ce855982aad8e93fe83925 100644 (file)
@@ -120,11 +120,6 @@ void PlacesItemModel::setHiddenItemsShown(bool show)
             }
         }
     }
-
-#ifdef PLACESITEMMODEL_DEBUG
-        qCDebug(DolphinDebug) << "Changed visibility of hidden items";
-        showModelState();
-#endif
 }
 
 bool PlacesItemModel::hiddenItemsShown() const
@@ -169,10 +164,6 @@ void PlacesItemModel::insertSortedItem(PlacesItem* item)
 void PlacesItemModel::onItemInserted(int index)
 {
     KStandardItemModel::onItemInserted(index);
-#ifdef PLACESITEMMODEL_DEBUG
-    qCDebug(DolphinDebug) << "Inserted item" << index;
-    showModelState();
-#endif
 }
 
 void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem)
@@ -180,10 +171,6 @@ void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem)
     m_indexMap.removeAt(index);
 
     KStandardItemModel::onItemRemoved(index, removedItem);
-#ifdef PLACESITEMMODEL_DEBUG
-    qCDebug(DolphinDebug) << "Removed item" << index;
-    showModelState();
-#endif
 }
 
 void PlacesItemModel::onItemChanged(int index, const QSet<QByteArray>& changedRoles)
@@ -635,11 +622,6 @@ void PlacesItemModel::loadBookmarks()
             addItemFromSourceModel(sourceIndex);
         }
     }
-
-#ifdef PLACESITEMMODEL_DEBUG
-    qCDebug(DolphinDebug) << "Loaded bookmarks";
-    showModelState();
-#endif
 }
 
 void PlacesItemModel::clear() {
@@ -786,44 +768,3 @@ PlacesItem *PlacesItemModel::itemFromBookmark(const KBookmark &bookmark) const
     return nullptr;
 }
 
-#ifdef PLACESITEMMODEL_DEBUG
-void PlacesItemModel::showModelState()
-{
-    qCDebug(DolphinDebug) << "=================================";
-    qCDebug(DolphinDebug) << "Model:";
-    qCDebug(DolphinDebug) << "hidden-index model-index   text";
-    int modelIndex = 0;
-    for (int i = 0; i < m_bookmarkedItems.count(); ++i) {
-        if (m_bookmarkedItems[i]) {
-            qCDebug(DolphinDebug) <<  i << "(Hidden)    " << "             " << m_bookmarkedItems[i]->dataValue("text").toString();
-        } else {
-            if (item(modelIndex)) {
-                qCDebug(DolphinDebug) <<  i << "          " << modelIndex << "           " << item(modelIndex)->dataValue("text").toString();
-            } else {
-                qCDebug(DolphinDebug) <<  i << "          " << modelIndex << "           " << "(not available yet)";
-            }
-            ++modelIndex;
-        }
-    }
-
-    qCDebug(DolphinDebug);
-    qCDebug(DolphinDebug) << "Bookmarks:";
-
-    int bookmarkIndex = 0;
-    KBookmarkGroup root = m_bookmarkManager->root();
-    KBookmark bookmark = root.first();
-    while (!bookmark.isNull()) {
-        const QString udi = bookmark.metaDataItem("UDI");
-        const QString text = udi.isEmpty() ? bookmark.text() : udi;
-        if (bookmark.metaDataItem("IsHidden") == QLatin1String("true")) {
-            qCDebug(DolphinDebug) << bookmarkIndex << "(Hidden)" << text;
-        } else {
-            qCDebug(DolphinDebug) << bookmarkIndex << "        " << text;
-        }
-
-        bookmark = root.next(bookmark);
-        ++bookmarkIndex;
-    }
-}
-#endif
-
index a2086efc57b6727a16fe672b6c1523aaf6022081..c4ff7e2ddd97b549da74df073d084db5b940a56e 100644 (file)
 #include <QUrl>
 
 class KBookmark;
-class KBookmarkManager;
 class PlacesItem;
 class QAction;
 
-// #define PLACESITEMMODEL_DEBUG
-
 /**
  * @brief Model for maintaining the bookmarks of the places panel.
  *
- * It is compatible to the KFilePlacesModel from kdelibs but adds
- * the ability to have groups for places.
+ * It is based on KFilePlacesModel from KIO.
  */
 class PlacesItemModel: public KStandardItemModel
 {
@@ -204,10 +200,6 @@ private:
      */
     void insertSortedItem(PlacesItem* item);
 
-#ifdef PLACESITEMMODEL_DEBUG
-    void showModelState();
-#endif
-
     PlacesItem *itemFromBookmark(const KBookmark &bookmark) const;
 
     void addItemFromSourceModel(const QModelIndex &index);
index 00d8735c39020edb929c5947382f5119f5f3565b..7b4900f7c3a1795c424c0f3dc9abd0a72de8361b 100644 (file)
 #include "trash/dolphintrash.h"
 #include "views/draganddrophelper.h"
 
-#include <KDirNotify>
-#include <KFileItem>
 #include <KFilePlacesModel>
 #include <KIO/DropJob>
 #include <KIO/EmptyTrashJob>
 #include <KIO/Job>
-#include <KIO/JobUiDelegate>
 #include <KIconLoader>
-#include <KJobWidgets>
 #include <KLocalizedString>
-#include <KMessageBox>
-#include <KNotification>
+#include <KMountPoint>
+#include <KPropertiesDialog>
 
 #include <QGraphicsSceneDragDropEvent>
 #include <QIcon>
 #include <QMenu>
+#include <QMimeData>
 #include <QVBoxLayout>
 
 PlacesPanel::PlacesPanel(QWidget* parent) :
@@ -174,6 +171,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
     QAction* editAction = nullptr;
     QAction* teardownAction = nullptr;
     QAction* ejectAction = nullptr;
+    QAction* mountAction = nullptr;
 
     const bool isDevice = !item->udi().isEmpty();
     const bool isTrash = (item->url().scheme() == QLatin1String("trash"));
@@ -186,11 +184,25 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
 
         teardownAction = m_model->teardownAction(index);
         if (teardownAction) {
+            // Disable teardown option for root and home partitions
+            bool teardownEnabled = item->url() != QUrl::fromLocalFile(QDir::rootPath());
+            if (teardownEnabled) {
+                KMountPoint::Ptr mountPoint = KMountPoint::currentMountPoints().findByPath(QDir::homePath());
+                if (mountPoint && item->url() == QUrl::fromLocalFile(mountPoint->mountPoint())) {
+                    teardownEnabled = false;
+                }
+            }
+            teardownAction->setEnabled(teardownEnabled);
+
             teardownAction->setParent(&menu);
             menu.addAction(teardownAction);
         }
 
-        if (teardownAction || ejectAction) {
+        if (item->storageSetupNeeded()) {
+            mountAction = menu.addAction(QIcon::fromTheme(QStringLiteral("media-mount")), i18nc("@action:inmenu", "Mount"));
+        }
+
+        if (teardownAction || ejectAction || mountAction) {
             menu.addSeparator();
         }
     } else {
@@ -201,14 +213,18 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
         }
     }
 
-    QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme("window-new"), i18nc("@item:inmenu", "Open in New Window"));
-    QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@item:inmenu", "Open in New Tab"));
+    QAction* openInNewWindowAction = menu.addAction(QIcon::fromTheme(QStringLiteral("window-new")), i18nc("@item:inmenu", "Open in New Window"));
+    QAction* openInNewTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@item:inmenu", "Open in New Tab"));
+    QAction* propertiesAction = nullptr;
+    if (item->url().isLocalFile()) {
+        propertiesAction = menu.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18nc("@action:inmenu", "Properties"));
+    }
     if (!isDevice && !isTrash) {
         menu.addSeparator();
     }
 
     if (!isDevice) {
-        editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit..."));
+        editAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-entry")), i18nc("@item:inmenu", "Edit..."));
     }
 
     QAction* removeAction = nullptr;
@@ -216,7 +232,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
         removeAction = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18nc("@item:inmenu", "Remove"));
     }
 
-    QAction* hideAction = menu.addAction(i18nc("@item:inmenu", "Hide"));
+    QAction* hideAction = menu.addAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Hide"));
     hideAction->setCheckable(true);
     hideAction->setChecked(item->isHidden());
 
@@ -248,10 +264,16 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
                 // TriggerItem does set up the storage first and then it will
                 // emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
                 triggerItem(index, Qt::MiddleButton);
+            } else if (action == mountAction) {
+                m_model->requestStorageSetup(index);
             } else if (action == teardownAction) {
                 m_model->requestTearDown(index);
             } else if (action == ejectAction) {
                 m_model->requestEject(index);
+            } else if (action == propertiesAction) {
+                KPropertiesDialog* dialog = new KPropertiesDialog(item->url(), this);
+                dialog->setAttribute(Qt::WA_DeleteOnClose);
+                dialog->show();
             }
         }
     }
@@ -267,7 +289,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
 
     QAction* showAllAction = nullptr;
     if (m_model->hiddenCount() > 0) {
-        showAllAction = menu.addAction(i18nc("@item:inmenu", "Show All Entries"));
+        showAllAction = menu.addAction(QIcon::fromTheme(QStringLiteral("visibility")), i18nc("@item:inmenu", "Show All Entries"));
         showAllAction->setCheckable(true);
         showAllAction->setChecked(m_model->hiddenItemsShown());
     }
@@ -334,7 +356,7 @@ QAction *PlacesPanel::buildGroupContextMenu(QMenu *menu, int index)
     }
 
     KFilePlacesModel::GroupType groupType = m_model->groupType(index);
-    QAction *hideGroupAction = menu->addAction(i18nc("@item:inmenu", "Hide Section '%1'", m_model->item(index)->group()));
+    QAction *hideGroupAction = menu->addAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Hide Section '%1'", m_model->item(index)->group()));
     hideGroupAction->setCheckable(true);
     hideGroupAction->setChecked(m_model->isGroupHidden(groupType));
 
index d626979401d58c554efa266aaefa771eb76583ab..c6f959d231af8623b52746915346d4aa08a5b749 100644 (file)
 
 #include "panels/panel.h"
 
-#include <QMimeData>
 #include <QUrl>
 
 class KItemListController;
-class PlacesItem;
 class PlacesItemModel;
 class PlacesView;
 class QGraphicsSceneDragDropEvent;
-class KJob;
 class QMenu;
+class QMimeData;
 /**
  * @brief Combines bookmarks and mounted devices as list.
  */
index 921ab3f8e126c8fd848f86ceaa43d2dd2f24dc10..add9acad58e6a41e2b17e11a85680a0ee39dcce1 100644 (file)
@@ -78,13 +78,19 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
     topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
 
 
+#ifdef HAVE_BALOO
     // 'Show tooltips'
     m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"));
     topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showToolTips);
+#endif
 
     // 'Show selection marker'
     m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"));
+#ifdef HAVE_BALOO
     topLayout->addRow(QString(), m_showSelectionToggle);
+#else
+    topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showSelectionToggle);
+#endif
 
     // 'Inline renaming of items'
     m_renameInline = new QCheckBox(i18nc("option:check", "Rename inline"));
@@ -98,7 +104,9 @@ BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
 
     connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
     connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
+#ifdef HAVE_BALOO
     connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
+#endif
     connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
     connect(m_naturalSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
     connect(m_caseInsensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
@@ -118,7 +126,9 @@ void BehaviorSettingsPage::applySettings()
 
     const bool useGlobalViewProps = m_globalViewProps->isChecked();
     settings->setGlobalViewProps(useGlobalViewProps);
+#ifdef HAVE_BALOO
     settings->setShowToolTips(m_showToolTips->isChecked());
+#endif
     settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
     setSortingChoiceValue(settings);
     settings->setRenameInline(m_renameInline->isChecked());
@@ -149,7 +159,9 @@ void BehaviorSettingsPage::loadSettings()
     m_localViewProps->setChecked(!useGlobalViewProps);
     m_globalViewProps->setChecked(useGlobalViewProps);
 
+#ifdef HAVE_BALOO
     m_showToolTips->setChecked(GeneralSettings::showToolTips());
+#endif
     m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
     m_renameInline->setChecked(GeneralSettings::renameInline());
     m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
index 34916830eaa666e92ebb8125d72c5f929f7e7c7f..b3fddba10825ba58164d183d405f5e43cb501bd8 100644 (file)
@@ -252,6 +252,11 @@ void DolphinStatusBar::readSettings()
     setExtensionsVisible(true);
 }
 
+void DolphinStatusBar::updateSpaceInfo()
+{
+    m_spaceInfo->update();
+}
+
 void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
 {
     Q_UNUSED(event);
index 8b872ace58325a161d6370d15ec94a960164bfb8..7461d1d7d3fcecc707bfd3af2cd1edddfb6425fd 100644 (file)
@@ -88,6 +88,11 @@ public:
      */
     void readSettings();
 
+    /**
+     * Refreshes the disk space information.
+     */
+    void updateSpaceInfo();
+
 public slots:
     void setText(const QString& text);
     void setUrl(const QUrl& url);
index bcdc0b61cdb1630dd51e133e9ccd9469359bbdbf..b39e26e3a6776581d215da5ae4d6b2f4989b4828 100644 (file)
@@ -78,7 +78,7 @@ MountPointObserver* MountPointObserverCache::observerForUrl(const QUrl& url)
         connect(observer, &MountPointObserver::destroyed, this, &MountPointObserverCache::slotObserverDestroyed);
 
         if (!m_updateTimer->isActive()) {
-            m_updateTimer->start(10000);
+            m_updateTimer->start(60000); // 1 minute
         }
 
         connect(m_updateTimer, &QTimer::timeout, observer, &MountPointObserver::update);
index 6cf695d5508d6c011577fd9604dc5b44df3099cc..692eba7e7a781d52aa5e59acf13426c3cb951cf8 100644 (file)
@@ -71,6 +71,13 @@ void SpaceInfoObserver::setUrl(const QUrl& url)
     }
 }
 
+void SpaceInfoObserver::update()
+{
+    if (m_mountPointObserver) {
+        m_mountPointObserver->update();
+    }
+}
+
 void SpaceInfoObserver::spaceInfoChanged(quint64 size, quint64 available)
 {
     // Make sure that the size has actually changed
index 1e74caef475777089cdc9272ae8ca02368cc869c..93f4c8c9146b6122be489264c58d7e04907b8111 100644 (file)
@@ -40,6 +40,9 @@ public:
 
     void setUrl(const QUrl& url);
 
+public slots:
+    void update();
+
 signals:
     /**
      * This signal is emitted when the size or available space changes.
index 65af174909097c2d82833174234964c9e64754e1..8822495766b799d8bbb4e7ce10cf38b3015b181f 100644 (file)
@@ -54,6 +54,13 @@ QUrl StatusBarSpaceInfo::url() const
     return m_url;
 }
 
+void StatusBarSpaceInfo::update()
+{
+    if (m_observer) {
+        m_observer->update();
+    }
+}
+
 void StatusBarSpaceInfo::showEvent(QShowEvent* event)
 {
     KCapacityBar::showEvent(event);
index 4f36517aeab5a21ace8a5ee5ef1eac1241d5198e..24f8b7f29fb6b910c4fd0c9564eed7d207daead5 100644 (file)
@@ -45,6 +45,8 @@ public:
     void setUrl(const QUrl& url);
     QUrl url() const;
 
+    void update();
+
 protected:
     void showEvent(QShowEvent* event) override;
     void hideEvent(QHideEvent* event) override;
index 0dc33012418f3aba196f0848c28f8fb22ae51ddb..673bccd4409c9b6bfe84a03c84bd61b4e2fa0c20 100644 (file)
@@ -40,9 +40,11 @@ private slots:
     void testActiveViewAfterClosingSplitView_data();
     void testActiveViewAfterClosingSplitView();
     void testUpdateWindowTitleAfterClosingSplitView();
+    void testOpenInNewTabTitle();
     void testNewFileMenuEnabled_data();
     void testNewFileMenuEnabled();
 
+
 private:
     QScopedPointer<DolphinMainWindow> m_mainWindow;
 };
@@ -173,6 +175,25 @@ void DolphinMainWindowTest::testUpdateWindowTitleAfterClosingSplitView()
     QCOMPARE(currentUrlChangedSpy.count(), 1);
 }
 
+// Test case for bug #397910
+void DolphinMainWindowTest::testOpenInNewTabTitle()
+{
+    m_mainWindow->openDirectories({ QUrl::fromLocalFile(QDir::homePath()) }, false);
+    m_mainWindow->show();
+    QVERIFY(QTest::qWaitForWindowExposed(m_mainWindow.data()));
+    QVERIFY(m_mainWindow->isVisible());
+
+    auto tabWidget = m_mainWindow->findChild<DolphinTabWidget*>("tabWidget");
+    QVERIFY(tabWidget);
+
+    tabWidget->openNewTab(QUrl::fromLocalFile(QDir::tempPath()));
+    QCOMPARE(tabWidget->count(), 2);
+    QVERIFY(tabWidget->tabText(0) != tabWidget->tabText(1));
+    if (!tabWidget->tabIcon(0).isNull() && !tabWidget->tabIcon(1).isNull()) {
+        QVERIFY(tabWidget->tabIcon(0).name() != tabWidget->tabIcon(1).name());
+    }
+}
+
 void DolphinMainWindowTest::testNewFileMenuEnabled_data()
 {
     QTest::addColumn<QUrl>("activeViewUrl");
index b455c521dd4fc8cfc9d5eb1e920d80e83119c77f..2f258d17d94310405f9419d4900aeda350146a2b 100644 (file)
@@ -1551,25 +1551,26 @@ void KFileItemModelTest::testChangeSortRoleWhileFiltering()
 {
     KFileItemList items;
 
-    KIO::UDSEntry entry;
-    entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, 0100000);    // S_IFREG might not be defined on non-Unix platforms.
-    entry.insert(KIO::UDSEntry::UDS_ACCESS, 07777);
-    entry.insert(KIO::UDSEntry::UDS_SIZE, 0);
-    entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, 0);
-    entry.insert(KIO::UDSEntry::UDS_GROUP, "group");
-    entry.insert(KIO::UDSEntry::UDS_ACCESS_TIME, 0);
-
-    entry.insert(KIO::UDSEntry::UDS_NAME, "a.txt");
-    entry.insert(KIO::UDSEntry::UDS_USER, "user-b");
-    items.append(KFileItem(entry, m_testDir->url(), false, true));
-
-    entry.insert(KIO::UDSEntry::UDS_NAME, "b.txt");
-    entry.insert(KIO::UDSEntry::UDS_USER, "user-c");
-    items.append(KFileItem(entry, m_testDir->url(), false, true));
-
-    entry.insert(KIO::UDSEntry::UDS_NAME, "c.txt");
-    entry.insert(KIO::UDSEntry::UDS_USER, "user-a");
-    items.append(KFileItem(entry, m_testDir->url(), false, true));
+    KIO::UDSEntry entry[3];
+
+    entry[0].insert(KIO::UDSEntry::UDS_NAME, "a.txt");
+    entry[0].insert(KIO::UDSEntry::UDS_USER, "user-b");
+
+    entry[1].insert(KIO::UDSEntry::UDS_NAME, "b.txt");
+    entry[1].insert(KIO::UDSEntry::UDS_USER, "user-c");
+
+    entry[2].insert(KIO::UDSEntry::UDS_NAME, "c.txt");
+    entry[2].insert(KIO::UDSEntry::UDS_USER, "user-a");
+
+    for (int i = 0; i < 3; ++i) {
+        entry[i].insert(KIO::UDSEntry::UDS_FILE_TYPE, 0100000);    // S_IFREG might not be defined on non-Unix platforms.
+        entry[i].insert(KIO::UDSEntry::UDS_ACCESS, 07777);
+        entry[i].insert(KIO::UDSEntry::UDS_SIZE, 0);
+        entry[i].insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, 0);
+        entry[i].insert(KIO::UDSEntry::UDS_GROUP, "group");
+        entry[i].insert(KIO::UDSEntry::UDS_ACCESS_TIME, 0);
+        items.append(KFileItem(entry[i], m_testDir->url(), false, true));
+    }
 
     m_model->slotItemsAdded(m_testDir->url(), items);
     m_model->slotCompleted();
index a468ca6dc61fa37b571b4afeedd8416e2660f26c..c472f128f311fd9847d9c87f9103e5ab9711ba19 100644 (file)
@@ -545,6 +545,7 @@ void KItemListControllerTest::testKeyboardNavigation()
                 }
                 // No items are selected. Therefore, the current item should be activated.
                 // This is handled by falling through to the NoSelection/SingleSelection case.
+                Q_FALLTHROUGH();
             case KItemListController::NoSelection:
             case KItemListController::SingleSelection:
                 // In NoSelection and SingleSelection mode, the current item should be activated.
index 545bba89c7aba26d78dff61f1cd9f12c799e0e26..40ee47cbc9beb514eb71a0cb327cc67e3da6feed 100644 (file)
@@ -96,7 +96,7 @@ private:
     QStringList placesUrls(PlacesItemModel *model = nullptr) const;
     QStringList initialUrls() const;
     void createPlaceItem(const QString &text, const QUrl &url, const QString &icon);
-    void removePlaceAfter(int index);
+    void schedulePlaceRemoval(int index);
     void cancelPlaceRemoval(int index);
     void removeTestUserData();
     QMimeData *createMimeData(const QList<int> &indexes) const;
@@ -190,7 +190,7 @@ void PlacesItemModelTest::createPlaceItem(const QString &text, const QUrl &url,
     m_model->createPlacesItem(text, url, icon);
 }
 
-void PlacesItemModelTest::removePlaceAfter(int index)
+void PlacesItemModelTest::schedulePlaceRemoval(int index)
 {
     m_tobeRemoved.insert(index);
 }
@@ -235,7 +235,7 @@ QMimeData *PlacesItemModelTest::createMimeData(const QList<int> &indexes) const
 void PlacesItemModelTest::init()
 {
     m_model = new PlacesItemModel();
-    // WORKAROUND: need to wait for bookmark to load, check: PlacesItemModel::updateBookmarks
+    // WORKAROUND: need to wait for bookmark to load
     QTest::qWait(300);
     QCOMPARE(m_model->count(), m_expectedModelCount);
 }
@@ -563,7 +563,7 @@ void PlacesItemModelTest::testSystemItems()
     QTRY_COMPARE(itemsInsertedSpy.count(), 1);
 
     // make sure the new place get removed
-    removePlaceAfter(tempDirIndex);
+    schedulePlaceRemoval(tempDirIndex);
 
     QList<QVariant> args = itemsInsertedSpy.takeFirst();
     KItemRangeList range = args.at(0).value<KItemRangeList>();
@@ -589,7 +589,7 @@ void PlacesItemModelTest::testSystemItems()
 
 void PlacesItemModelTest::testEditBookmark()
 {
-    int tempDirIndex = 3;
+    int tempDirIndex = 1;
     if (m_hasDesktopFolder) {
         tempDirIndex++;
     }
@@ -602,32 +602,32 @@ void PlacesItemModelTest::testEditBookmark()
     createPlaceItem(QStringLiteral("Temporary Dir"), QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::TempLocation)), QString());
 
     // make sure that the new item will be removed later
-    removePlaceAfter(tempDirIndex);
+    schedulePlaceRemoval(tempDirIndex + 2);
 
     QSignalSpy itemsChangedSply(m_model, &PlacesItemModel::itemsChanged);
 
     // modify place text
-    m_model->item(3)->setText(QStringLiteral("Renamed place"));
+    m_model->item(tempDirIndex)->setText(QStringLiteral("Renamed place"));
     m_model->refresh();
 
     // check if the correct signal was fired
     QTRY_COMPARE(itemsChangedSply.count(), 1);
     QList<QVariant> args = itemsChangedSply.takeFirst();
     KItemRangeList range = args.at(0).value<KItemRangeList>();
-    QCOMPARE(range.first().index, 3);
+    QCOMPARE(range.first().index, tempDirIndex);
     QCOMPARE(range.first().count, 1);
     QSet<QByteArray> roles = args.at(1).value<QSet<QByteArray> >();
     QCOMPARE(roles.size(), 1);
     QCOMPARE(*roles.begin(), QByteArrayLiteral("text"));
-    QCOMPARE(m_model->item(3)->text(), QStringLiteral("Renamed place"));
+    QCOMPARE(m_model->item(tempDirIndex)->text(), QStringLiteral("Renamed place"));
 
     // check if the item was updated in the other model
-    QTRY_COMPARE(other->item(3)->text(), QStringLiteral("Renamed place"));
+    QTRY_COMPARE(other->item(tempDirIndex)->text(), QStringLiteral("Renamed place"));
 }
 
 void PlacesItemModelTest::testEditAfterCreation()
 {
-    int tempDirIndex = 3;
+    int tempDirIndex = 1;
     if (m_hasDesktopFolder) {
         tempDirIndex++;
     }
@@ -646,25 +646,25 @@ void PlacesItemModelTest::testEditAfterCreation()
     QTRY_COMPARE(model->count(), m_model->count());
 
     // make sure that the new item will be removed later
-    removePlaceAfter(tempDirIndex);
+    schedulePlaceRemoval(tempDirIndex + 2);
 
     // modify place text
-    PlacesItem *item = m_model->placesItem(3);
+    PlacesItem *item = m_model->placesItem(tempDirIndex);
     item->setText(QStringLiteral("Renamed place"));
     m_model->refresh();
 
     // check if the second model got the changes
     QTRY_COMPARE(model->count(), m_model->count());
-    QTRY_COMPARE(model->placesItem(3)->text(), m_model->placesItem(3)->text());
-    QTRY_COMPARE(model->placesItem(3)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")),
-                 m_model->placesItem(3)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")));
-    QTRY_COMPARE(model->placesItem(3)->icon(), m_model->placesItem(3)->icon());
-    QTRY_COMPARE(model->placesItem(3)->url(), m_model->placesItem(3)->url());
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->text(), m_model->placesItem(tempDirIndex)->text());
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")),
+                 m_model->placesItem(tempDirIndex)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")));
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->icon(), m_model->placesItem(tempDirIndex)->icon());
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->url(), m_model->placesItem(tempDirIndex)->url());
 }
 
 void PlacesItemModelTest::testEditMetadata()
 {
-    int tempDirIndex = 3;
+    int tempDirIndex = 1;
     if (m_hasDesktopFolder) {
         tempDirIndex++;
     }
@@ -684,21 +684,21 @@ void PlacesItemModelTest::testEditMetadata()
     QTRY_COMPARE(model->count(), m_model->count());
 
     // make sure that the new item will be removed later
-    removePlaceAfter(tempDirIndex);
+    schedulePlaceRemoval(tempDirIndex + 2);
 
     // modify place metadata
-    PlacesItem *item = m_model->placesItem(3);
+    PlacesItem *item = m_model->placesItem(tempDirIndex);
     item->bookmark().setMetaDataItem(QStringLiteral("OnlyInApp"), KAboutData::applicationData().componentName());
     m_model->refresh();
 
     // check if the place was modified in both models
-    QTRY_COMPARE(model->placesItem(3)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")),
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")),
                  KAboutData::applicationData().componentName());
-    QTRY_COMPARE(model->placesItem(3)->text(), m_model->placesItem(3)->text());
-    QTRY_COMPARE(model->placesItem(3)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")),
-                 m_model->placesItem(3)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")));
-    QTRY_COMPARE(model->placesItem(3)->icon(), m_model->placesItem(3)->icon());
-    QTRY_COMPARE(model->placesItem(3)->url(), m_model->placesItem(3)->url());
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->text(), m_model->placesItem(tempDirIndex)->text());
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")),
+                 m_model->placesItem(tempDirIndex)->bookmark().metaDataItem(QStringLiteral("OnlyInApp")));
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->icon(), m_model->placesItem(tempDirIndex)->icon());
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->url(), m_model->placesItem(tempDirIndex)->url());
 }
 
 void PlacesItemModelTest::testRefresh()
@@ -722,7 +722,7 @@ void PlacesItemModelTest::testRefresh()
     QTRY_COMPARE(model->count(), m_model->count());
 
     // make sure that the new item will be removed later
-    removePlaceAfter(tempDirIndex);
+    schedulePlaceRemoval(tempDirIndex);
 
     PlacesItem *item = m_model->placesItem(tempDirIndex);
     PlacesItem *sameItem = model->placesItem(tempDirIndex);
@@ -893,7 +893,7 @@ void PlacesItemModelTest::testDuplicatedEntries()
 
 void PlacesItemModelTest::renameAfterCreation()
 {
-    int tempDirIndex = 3;
+    int tempDirIndex = 1;
     if (m_hasDesktopFolder) {
         tempDirIndex++;
     }
@@ -910,10 +910,10 @@ void PlacesItemModelTest::renameAfterCreation()
 
     // create a new place
     createPlaceItem(QStringLiteral("Temporary Dir"), tempUrl, QString());
-    urls.insert(tempDirIndex, tempUrl.toLocalFile());
+    urls.insert(tempDirIndex + 2, tempUrl.toLocalFile());
 
     // make sure that the new item will be removed later
-    removePlaceAfter(tempDirIndex);
+    schedulePlaceRemoval(tempDirIndex + 2);
 
     CHECK_PLACES_URLS(urls);
     QCOMPARE(model->count(), m_model->count());
@@ -922,7 +922,7 @@ void PlacesItemModelTest::renameAfterCreation()
     // modify place text
     QSignalSpy changedSpy(m_model, &PlacesItemModel::itemsChanged);
 
-    PlacesItem *item = m_model->placesItem(3);
+    PlacesItem *item = m_model->placesItem(tempDirIndex);
     item->setText(QStringLiteral("New Temporary Dir"));
     item->setUrl(item->url());
     item->setIcon(item->icon());
@@ -931,8 +931,8 @@ void PlacesItemModelTest::renameAfterCreation()
     QTRY_COMPARE(changedSpy.count(), 1);
 
     // check if the place was modified in both models
-    QTRY_COMPARE(m_model->placesItem(3)->text(), QStringLiteral("New Temporary Dir"));
-    QTRY_COMPARE(model->placesItem(3)->text(), QStringLiteral("New Temporary Dir"));
+    QTRY_COMPARE(m_model->placesItem(tempDirIndex)->text(), QStringLiteral("New Temporary Dir"));
+    QTRY_COMPARE(model->placesItem(tempDirIndex)->text(), QStringLiteral("New Temporary Dir"));
 }
 
 QTEST_MAIN(PlacesItemModelTest)
index 749d0d48111318374a4b35bc703c29876ed7c9b9..e4a2d947c1a7a2ffe7086e429d69e5d0c8596e74 100644 (file)
@@ -26,7 +26,7 @@
 #include <KNotification>
 #include <KConfig>
 #include <KConfigGroup>
-
+#include <KLocalizedString>
 
 Trash::Trash()
     : m_trashDirLister(new KDirLister())
@@ -66,8 +66,10 @@ KIO::Job *Trash::empty(QWidget *window)
         KJobWidgets::setWindow(job, window);
         job->uiDelegate()->setAutoErrorHandlingEnabled(true);
          // as long as KIO doesn't do this, do it ourselves
-        connect(job, &KIO::Job::result, [](){
-            KNotification::event(QStringLiteral("Trash: emptied"), QString(), QPixmap(), nullptr, KNotification::DefaultEvent);
+        connect(job, &KIO::Job::result, []() {
+            KNotification::event(QStringLiteral("Trash: emptied"), i18n("Trash Emptied"),
+                                 i18n("The Trash was emptied."), QStringLiteral("user-trash"),
+                                 nullptr, KNotification::DefaultEvent);
         });
         return job;
     }
index 1db62b8003040ab582c1a7d4e97a42fa735f5cb1..40346c169c849bf7583b01708beda9ad3d26c523 100644 (file)
@@ -176,8 +176,10 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
     connect(selectionManager, &KItemListSelectionManager::selectionChanged,
             this, &DolphinView::slotSelectionChanged);
 
+#ifdef HAVE_BALOO
     m_toolTipManager = new ToolTipManager(this);
     connect(m_toolTipManager, &ToolTipManager::urlActivated, this, &DolphinView::urlActivated);
+#endif
 
     m_versionControlObserver = new VersionControlObserver(this);
     m_versionControlObserver->setModel(m_model);
@@ -1031,7 +1033,9 @@ void DolphinView::slotItemHovered(int index)
         const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint());
         itemRect.moveTo(pos);
 
+#ifdef HAVE_BALOO
         m_toolTipManager->showToolTip(item, itemRect, nativeParentWidget()->windowHandle());
+#endif
     }
 
     emit requestItemInfo(item);
@@ -1408,9 +1412,11 @@ void DolphinView::updateViewState()
 
 void DolphinView::hideToolTip()
 {
+#ifdef HAVE_BALOO
     if (GeneralSettings::showToolTips()) {
         m_toolTipManager->hideToolTip();
     }
+#endif
 }
 
 void DolphinView::calculateItemCount(int& fileCount,
@@ -1482,7 +1488,7 @@ void DolphinView::slotRenamingResult(KJob* job)
 void DolphinView::slotDirectoryLoadingStarted()
 {
     // Disable the writestate temporary until it can be determined in a fast way
-    // in DolphinView::slotLoadingCompleted()
+    // in DolphinView::slotDirectoryLoadingCompleted()
     if (m_isFolderWritable) {
         m_isFolderWritable = false;
         emit writeStateChanged(m_isFolderWritable);
@@ -1563,7 +1569,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
     if (role == "text") {
         const KFileItem oldItem = m_model->fileItem(index);
         const QString newName = value.toString();
-        if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
+        if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) {
             const QUrl oldUrl = oldItem.url();
 
             QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
index 1df6a66732da090723a56b741b6c800759ffb2ee..f4a688ea82d2663a982e00a1ee0d7ea00aee3039 100644 (file)
 #include <KColorScheme>
 #include <KSeparator>
 #include <KStringHandler>
-#ifndef HAVE_BALOO
-#include <KFileMetaDataWidget>
-#else
 #include <Baloo/FileMetaDataWidget>
-#endif
 
 #include <QLabel>
 #include <QStyleOptionFrame>
@@ -61,19 +57,11 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) :
     m_name->setMaximumWidth(fontMetrics.averageCharWidth() * 40);
 
     // Create widget for the meta data
-#ifndef HAVE_BALOO
-    m_fileMetaDataWidget = new KFileMetaDataWidget(this);
-    connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished,
-            this, &DolphinFileMetaDataWidget::metaDataRequestFinished);
-    connect(m_fileMetaDataWidget, &KFileMetaDataWidget::urlActivated,
-            this, &DolphinFileMetaDataWidget::urlActivated);
-#else
     m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this);
     connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished,
             this, &DolphinFileMetaDataWidget::metaDataRequestFinished);
     connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::urlActivated,
             this, &DolphinFileMetaDataWidget::urlActivated);
-#endif
     m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
     m_fileMetaDataWidget->setReadOnly(true);
 
index 1e2cfadb677394da10bebf1662f30038f8aae23f..b9dbd98a1049a1e3d13271eb9ec3123ffc3e91ff 100644 (file)
 class KFileItemList;
 class QLabel;
 
-#ifndef HAVE_BALOO
-class KFileMetaDataWidget;
-#else
 namespace Baloo {
     class FileMetaDataWidget;
 }
-#endif
 
 /**
  * @brief Widget that shows the meta information and a preview of one
@@ -79,11 +75,7 @@ signals:
 private:
     QLabel* m_preview;
     QLabel* m_name;
-#ifndef HAVE_BALOO
-    KFileMetaDataWidget* m_fileMetaDataWidget;
-#else
     Baloo::FileMetaDataWidget* m_fileMetaDataWidget;
-#endif
 };
 
 #endif
index 19c87b0847c95725fdb111ea8c977d64f45f1637..bb2890138a99a952af19c8b076382d9d8714669f 100644 (file)
@@ -129,7 +129,10 @@ void ToolTipManager::startContentRetrieval()
     // Request a preview of the item
     m_fileMetaDataWidget->setPreview(QPixmap());
 
-    KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item, QSize(256, 256));
+    QStringList plugins = KIO::PreviewJob::availablePlugins();
+    KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item,
+                                               QSize(256, 256),
+                                               &plugins);
     job->setIgnoreMaximumSize(m_item.isLocalFile());
     if (job->uiDelegate()) {
         KJobWidgets::setWindow(job, qApp->activeWindow());
index e5d636cd1e1626a51b421da2dbf51e49e34c5bd0..d7c6abd65ed9742bc3d4fa944fe62d150c823c73 100644 (file)
@@ -63,17 +63,19 @@ ViewProperties::ViewProperties(const QUrl& url) :
         useDetailsViewWithPath = true;
     } else if (url.isLocalFile()) {
         m_filePath = url.toLocalFile();
-        const QFileInfo dirInfo(m_filePath);
-        const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName);
-        // Check if the directory is writable and check if the ".directory" file exists and
-        // is read- and writable.
-        if (!dirInfo.isWritable()
-                || (fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable()))
-                || !isPartOfHome(m_filePath)) {
-#ifdef Q_OS_WIN
-                       // m_filePath probably begins with C:/ - the colon is not a valid character for paths though
-                       m_filePath =  QDir::separator() + m_filePath.remove(QLatin1Char(':'));
-#endif
+
+        bool useDestinationDir = !isPartOfHome(m_filePath);
+        if (!useDestinationDir) {
+            const QFileInfo dirInfo(m_filePath);
+            const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName);
+            useDestinationDir = !dirInfo.isWritable() || (dirInfo.size() > 0 && fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable()));
+        }
+
+        if (useDestinationDir) {
+    #ifdef Q_OS_WIN
+            // m_filePath probably begins with C:/ - the colon is not a valid character for paths though
+            m_filePath =  QDir::separator() + m_filePath.remove(QLatin1Char(':'));
+    #endif
             m_filePath = destinationDir(QStringLiteral("local")) + m_filePath;
         }
     } else {