# 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})
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)
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
if(HAVE_BALOO)
set(dolphinprivate_LIB_SRCS
${dolphinprivate_LIB_SRCS}
+ views/tooltips/dolphinfilemetadatawidget.cpp
+ views/tooltips/tooltipmanager.cpp
kitemviews/private/kbaloorolesprovider.cpp
)
endif()
KF5::Baloo
KF5::BalooWidgets
)
-else()
- target_link_libraries(
- dolphinprivate PUBLIC
- KF5::KDELibs4Support # for KFileMetaDataWidget
- )
endif()
set_target_properties(dolphinprivate PROPERTIES
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
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
#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)
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);
#include "dolphindockwidget.h"
#include "dolphincontextmenu.h"
#include "dolphinnewfilemenu.h"
-#include "dolphinplacesmodelsingleton.h"
#include "dolphinrecenttabsmenu.h"
#include "dolphintabwidget.h"
#include "dolphinviewcontainer.h"
#include <KAuthorized>
#include <KConfig>
#include <KFileItemListProperties>
-#include <KFilePlacesModel>
#include <KHelpMenu>
#include <KIO/JobUiDelegate>
#include <KIO/OpenFileManagerWindowJob>
connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
this, &DolphinMainWindow::tabCountChanged);
connect(m_tabWidget, &DolphinTabWidget::currentUrlChanged,
- this, &DolphinMainWindow::setUrlAsCaption);
+ this, &DolphinMainWindow::updateWindowTitle);
setCentralWidget(m_tabWidget);
setupActions();
{
clearStatusBar();
m_activeViewContainer->reload();
+ m_activeViewContainer->statusBar()->updateSpaceInfo();
}
void DolphinMainWindow::stopLoading()
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)
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);
infoPanel, &InformationPanel::setSelection);
connect(this, &DolphinMainWindow::requestItemInfo,
infoPanel, &InformationPanel::requestDelayedItemInfo);
+#endif
// Setup "Folders"
DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
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();
const bool splitView = GeneralSettings::splitView();
m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView);
updateSplitAction();
- setUrlAsCaption(activeViewContainer()->url());
+ updateWindowTitle();
}
emit settingsChanged();
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
{
const int tabCount = count();
for (int i = 0; i < tabCount; ++i) {
+ tabBar()->setTabText(i, tabName(tabPageAt(i)));
tabPageAt(i)->refreshViews();
}
}
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
{
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.
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("&&"));
}
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 */
#include "views/viewproperties.h"
#include <KFileItemActions>
+#include <KFilePlacesModel>
#include <KIO/PreviewJob>
#include <KLocalizedString>
#include <KMessageWidget>
m_urlNavigator(nullptr),
m_emptyTrashButton(nullptr),
m_searchBox(nullptr),
+ m_searchModeEnabled(false),
m_messageWidget(nullptr),
m_view(nullptr),
m_filterBar(nullptr),
}
m_urlNavigator->setLocationUrl(url);
}
+
+ m_searchModeEnabled = enabled;
}
bool DolphinViewContainer::isSearchModeEnabled() const
{
- return m_searchBox->isVisible();
+ return m_searchModeEnabled;
}
QString DolphinViewContainer::placesText() const
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()) {
*/
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
KUrlNavigator* m_urlNavigator;
QPushButton* m_emptyTrashButton;
DolphinSearchBox* m_searchBox;
+ bool m_searchModeEnabled;
KMessageWidget* m_messageWidget;
DolphinView* m_view;
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 {
}
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);
}
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 {
* 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>
* 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
}
DolphinMainWindow* mainWindow = new DolphinMainWindow();
- mainWindow->setAttribute(Qt::WA_DeleteOnClose);
if (parser.isSet(QStringLiteral("select"))) {
mainWindow->openFiles(urls, splitView);
#include "filemetadataconfigurationdialog.h"
-#ifndef HAVE_BALOO
-#include <kfilemetadataconfigurationwidget.h>
-#else
#include <Baloo/FileMetaDataConfigWidget>
-#endif
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
"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);
void slotAccepted();
private:
QLabel* m_descriptionLabel;
-#ifndef HAVE_BALOO
- KFileMetaDataConfigurationWidget* m_configWidget;
-#else
Baloo::FileMetaDataConfigWidget* m_configWidget;
-#endif
};
#endif
#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);
-
+
// 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()) {
}
if (m_metaDataWidget) {
-#ifdef HAVE_BALOO
m_metaDataWidget->setDateFormat(static_cast<Baloo::DateFormats>(InformationPanelSettings::dateFormat()));
-#endif
m_metaDataWidget->show();
m_metaDataWidget->setItems(KFileItemList() << item);
}
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);
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)
}
}
}
-
-#ifdef PLACESITEMMODEL_DEBUG
- qCDebug(DolphinDebug) << "Changed visibility of hidden items";
- showModelState();
-#endif
}
bool PlacesItemModel::hiddenItemsShown() const
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)
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)
addItemFromSourceModel(sourceIndex);
}
}
-
-#ifdef PLACESITEMMODEL_DEBUG
- qCDebug(DolphinDebug) << "Loaded bookmarks";
- showModelState();
-#endif
}
void PlacesItemModel::clear() {
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
-
#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
{
*/
void insertSortedItem(PlacesItem* item);
-#ifdef PLACESITEMMODEL_DEBUG
- void showModelState();
-#endif
-
PlacesItem *itemFromBookmark(const KBookmark &bookmark) const;
void addItemFromSourceModel(const QModelIndex &index);
#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 <QGraphicsSceneDragDropEvent>
#include <QIcon>
#include <QMenu>
+#include <QMimeData>
#include <QVBoxLayout>
PlacesPanel::PlacesPanel(QWidget* parent) :
}
if (!isDevice) {
- editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit..."));
+ editAction = menu.addAction(QIcon::fromTheme("edit-entry"), i18nc("@item:inmenu", "Edit..."));
}
QAction* removeAction = nullptr;
#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.
*/
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"));
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);
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());
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());
setExtensionsVisible(true);
}
+void DolphinStatusBar::updateSpaceInfo()
+{
+ m_spaceInfo->update();
+}
+
void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event)
{
Q_UNUSED(event);
*/
void readSettings();
+ /**
+ * Refreshes the disk space information.
+ */
+ void updateSpaceInfo();
+
public slots:
void setText(const QString& text);
void 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
void setUrl(const QUrl& url);
+public slots:
+ void update();
+
signals:
/**
* This signal is emitted when the size or available space changes.
return m_url;
}
+void StatusBarSpaceInfo::update()
+{
+ if (m_observer) {
+ m_observer->update();
+ }
+}
+
void StatusBarSpaceInfo::showEvent(QShowEvent* event)
{
KCapacityBar::showEvent(event);
void setUrl(const QUrl& url);
QUrl url() const;
+ void update();
+
protected:
void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override;
void testActiveViewAfterClosingSplitView_data();
void testActiveViewAfterClosingSplitView();
void testUpdateWindowTitleAfterClosingSplitView();
+ void testOpenInNewTabTitle();
private:
QScopedPointer<DolphinMainWindow> m_mainWindow;
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->tabIcon(0).name() != tabWidget->tabIcon(1).name());
+ QVERIFY(tabWidget->tabText(0) != tabWidget->tabText(1));
+}
+
QTEST_MAIN(DolphinMainWindowTest)
#include "dolphinmainwindowtest.moc"
{
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();
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);
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);
void DolphinView::hideToolTip()
{
+#ifdef HAVE_BALOO
if (GeneralSettings::showToolTips()) {
m_toolTipManager->hideToolTip();
}
+#endif
}
void DolphinView::calculateItemCount(int& fileCount,
#include <KColorScheme>
#include <KSeparator>
#include <KStringHandler>
-#ifndef HAVE_BALOO
-#include <KFileMetaDataWidget>
-#else
#include <Baloo/FileMetaDataWidget>
-#endif
#include <QLabel>
#include <QStyleOptionFrame>
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);
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
private:
QLabel* m_preview;
QLabel* m_name;
-#ifndef HAVE_BALOO
- KFileMetaDataWidget* m_fileMetaDataWidget;
-#else
Baloo::FileMetaDataWidget* m_fileMetaDataWidget;
-#endif
};
#endif
// 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());
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 {