mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 09:50:12 +00:00
Merge branch 'release/21.08'
This commit is contained in:
commit
8b4d3624ad
|
@ -90,16 +90,14 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
|
|||
newUrls.append(url);
|
||||
}
|
||||
}
|
||||
dolphinInterfaces.front().second << newUrls;
|
||||
|
||||
for (const auto& interface: qAsConst(dolphinInterfaces)) {
|
||||
if (!interface.second.isEmpty()) {
|
||||
auto reply = openFiles ? interface.first->openFiles(interface.second, splitView) : interface.first->openDirectories(interface.second, splitView);
|
||||
reply.waitForFinished();
|
||||
if (!reply.isError()) {
|
||||
interface.first->activateWindow();
|
||||
attached = true;
|
||||
}
|
||||
auto reply = openFiles ? interface.first->openFiles(newUrls, splitView) : interface.first->openDirectories(newUrls, splitView);
|
||||
reply.waitForFinished();
|
||||
if (!reply.isError()) {
|
||||
interface.first->activateWindow();
|
||||
attached = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return attached;
|
||||
|
|
|
@ -34,7 +34,6 @@ KFileItemModel::KFileItemModel(QObject* parent) :
|
|||
KItemModelBase("text", parent),
|
||||
m_dirLister(nullptr),
|
||||
m_sortDirsFirst(true),
|
||||
m_sortHiddenLast(false),
|
||||
m_sortRole(NameRole),
|
||||
m_sortingProgressPercent(-1),
|
||||
m_roles(),
|
||||
|
@ -208,19 +207,6 @@ bool KFileItemModel::sortDirectoriesFirst() const
|
|||
return m_sortDirsFirst;
|
||||
}
|
||||
|
||||
void KFileItemModel::setSortHiddenLast(bool hiddenLast)
|
||||
{
|
||||
if (hiddenLast != m_sortHiddenLast) {
|
||||
m_sortHiddenLast = hiddenLast;
|
||||
resortAllItems();
|
||||
}
|
||||
}
|
||||
|
||||
bool KFileItemModel::sortHiddenLast() const
|
||||
{
|
||||
return m_sortHiddenLast;
|
||||
}
|
||||
|
||||
void KFileItemModel::setShowHiddenFiles(bool show)
|
||||
{
|
||||
m_dirLister->setShowingDotFiles(show);
|
||||
|
@ -1098,32 +1084,46 @@ void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&
|
|||
QSet<QByteArray> changedRoles;
|
||||
KFileItemList changedFiles;
|
||||
|
||||
// Contains the indexes of the currently visible items
|
||||
// that should get hidden and hence moved to m_filteredItems.
|
||||
QVector<int> newFilteredIndexes;
|
||||
|
||||
// Contains currently hidden items that should
|
||||
// get visible and hence removed from m_filteredItems
|
||||
QList<ItemData*> newVisibleItems;
|
||||
|
||||
QListIterator<QPair<KFileItem, KFileItem> > it(items);
|
||||
while (it.hasNext()) {
|
||||
const QPair<KFileItem, KFileItem>& itemPair = it.next();
|
||||
const KFileItem& oldItem = itemPair.first;
|
||||
const KFileItem& newItem = itemPair.second;
|
||||
const int indexForItem = index(oldItem);
|
||||
const bool newItemMatchesFilter = m_filter.matches(newItem);
|
||||
if (indexForItem >= 0) {
|
||||
m_itemData[indexForItem]->item = newItem;
|
||||
|
||||
// Keep old values as long as possible if they could not retrieved synchronously yet.
|
||||
// The update of the values will be done asynchronously by KFileItemModelRolesUpdater.
|
||||
QHashIterator<QByteArray, QVariant> it(retrieveData(newItem, m_itemData.at(indexForItem)->parent));
|
||||
QHash<QByteArray, QVariant>& values = m_itemData[indexForItem]->values;
|
||||
ItemData * const itemData = m_itemData.at(indexForItem);
|
||||
QHashIterator<QByteArray, QVariant> it(retrieveData(newItem, itemData->parent));
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const QByteArray& role = it.key();
|
||||
if (values.value(role) != it.value()) {
|
||||
values.insert(role, it.value());
|
||||
if (itemData->values.value(role) != it.value()) {
|
||||
itemData->values.insert(role, it.value());
|
||||
changedRoles.insert(role);
|
||||
}
|
||||
}
|
||||
|
||||
m_items.remove(oldItem.url());
|
||||
m_items.insert(newItem.url(), indexForItem);
|
||||
changedFiles.append(newItem);
|
||||
indexes.append(indexForItem);
|
||||
if (newItemMatchesFilter) {
|
||||
m_items.insert(newItem.url(), indexForItem);
|
||||
changedFiles.append(newItem);
|
||||
indexes.append(indexForItem);
|
||||
} else {
|
||||
newFilteredIndexes.append(indexForItem);
|
||||
m_filteredItems.insert(newItem, itemData);
|
||||
}
|
||||
} else {
|
||||
// Check if 'oldItem' is one of the filtered items.
|
||||
QHash<KFileItem, ItemData*>::iterator it = m_filteredItems.find(oldItem);
|
||||
|
@ -1136,11 +1136,22 @@ void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&
|
|||
itemData->values.clear();
|
||||
|
||||
m_filteredItems.erase(it);
|
||||
m_filteredItems.insert(newItem, itemData);
|
||||
if (newItemMatchesFilter) {
|
||||
newVisibleItems.append(itemData);
|
||||
} else {
|
||||
m_filteredItems.insert(newItem, itemData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide items, previously visible that should get hidden
|
||||
const KItemRangeList removedRanges = KItemRangeList::fromSortedContainer(newFilteredIndexes);
|
||||
removeItems(removedRanges, KeepItemData);
|
||||
|
||||
// Show previously hidden items that should get visible
|
||||
insertItems(newVisibleItems);
|
||||
|
||||
// If the changed items have been created recently, they might not be in m_items yet.
|
||||
// In that case, the list 'indexes' might be empty.
|
||||
if (indexes.isEmpty()) {
|
||||
|
@ -1742,17 +1753,6 @@ bool KFileItemModel::lessThan(const ItemData* a, const ItemData* b, const QColla
|
|||
}
|
||||
}
|
||||
|
||||
// Show hidden files and folders last
|
||||
if (m_sortHiddenLast) {
|
||||
const bool isHiddenA = a->item.isHidden();
|
||||
const bool isHiddenB = b->item.isHidden();
|
||||
if (isHiddenA && !isHiddenB) {
|
||||
return false;
|
||||
} else if (!isHiddenA && isHiddenB) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_sortDirsFirst || (DetailsModeSettings::directorySizeCount() && m_sortRole == SizeRole)) {
|
||||
const bool isDirA = a->item.isDir();
|
||||
const bool isDirB = b->item.isDir();
|
||||
|
|
|
@ -85,12 +85,6 @@ public:
|
|||
void setSortDirectoriesFirst(bool dirsFirst);
|
||||
bool sortDirectoriesFirst() const;
|
||||
|
||||
/**
|
||||
* Sets a separate sorting with hidden files and folders last (true) or not (false).
|
||||
*/
|
||||
void setSortHiddenLast(bool hiddenLast);
|
||||
bool sortHiddenLast() const;
|
||||
|
||||
void setShowHiddenFiles(bool show);
|
||||
bool showHiddenFiles() const;
|
||||
|
||||
|
@ -475,7 +469,6 @@ private:
|
|||
QCollator m_collator;
|
||||
bool m_naturalSorting;
|
||||
bool m_sortDirsFirst;
|
||||
bool m_sortHiddenLast;
|
||||
|
||||
RoleType m_sortRole;
|
||||
int m_sortingProgressPercent; // Value of directorySortingProgress() signal
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "kitemviews/kitemlistcontainer.h"
|
||||
#include "kitemviews/kitemlistcontroller.h"
|
||||
#include "kitemviews/kitemlistselectionmanager.h"
|
||||
#include "kitemviews/private/kitemlistroleeditor.h"
|
||||
#include "treeviewcontextmenu.h"
|
||||
#include "views/draganddrophelper.h"
|
||||
|
||||
|
@ -245,7 +246,8 @@ void FoldersPanel::slotRoleEditingFinished(int index, const QByteArray& role, co
|
|||
{
|
||||
if (role == "text") {
|
||||
const KFileItem item = m_model->fileItem(index);
|
||||
const QString newName = value.toString();
|
||||
const EditResult retVal = value.value<EditResult>();
|
||||
const QString newName = retVal.newName;
|
||||
if (!newName.isEmpty() && newName != item.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) {
|
||||
const QUrl oldUrl = item.url();
|
||||
QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
|
||||
|
|
|
@ -57,11 +57,6 @@
|
|||
<default>true</default>
|
||||
</entry>
|
||||
|
||||
<entry name="SortHiddenLast" type="Bool" >
|
||||
<label context="@label">Show hidden files and folders last</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
|
||||
<entry name="VisibleRoles" type="StringList">
|
||||
<label context="@label">Visible roles</label>
|
||||
<default></default>
|
||||
|
|
|
@ -44,7 +44,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
m_sortOrder(nullptr),
|
||||
m_sorting(nullptr),
|
||||
m_sortFoldersFirst(nullptr),
|
||||
m_sortHiddenLast(nullptr),
|
||||
m_previewsShown(nullptr),
|
||||
m_showInGroups(nullptr),
|
||||
m_showHiddenFiles(nullptr),
|
||||
|
@ -83,7 +82,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
}
|
||||
|
||||
m_sortFoldersFirst = new QCheckBox(i18nc("@option:check", "Show folders first"));
|
||||
m_sortHiddenLast = new QCheckBox(i18nc("@option:check", "Show hidden files last"));
|
||||
m_previewsShown = new QCheckBox(i18nc("@option:check", "Show preview"));
|
||||
m_showInGroups = new QCheckBox(i18nc("@option:check", "Show in groups"));
|
||||
m_showHiddenFiles = new QCheckBox(i18nc("@option:check", "Show hidden files"));
|
||||
|
@ -148,7 +146,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
layout->addRow(QString(), m_previewsShown);
|
||||
layout->addRow(QString(), m_showInGroups);
|
||||
layout->addRow(QString(), m_showHiddenFiles);
|
||||
layout->addRow(QString(), m_sortHiddenLast);
|
||||
|
||||
connect(m_viewMode, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &ViewPropertiesDialog::slotViewModeChanged);
|
||||
|
@ -158,8 +155,6 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
this, &ViewPropertiesDialog::slotSortOrderChanged);
|
||||
connect(m_sortFoldersFirst, &QCheckBox::clicked,
|
||||
this, &ViewPropertiesDialog::slotSortFoldersFirstChanged);
|
||||
connect(m_sortHiddenLast, &QCheckBox::clicked,
|
||||
this, &ViewPropertiesDialog::slotSortHiddenLastChanged);
|
||||
connect(m_previewsShown, &QCheckBox::clicked,
|
||||
this, &ViewPropertiesDialog::slotShowPreviewChanged);
|
||||
connect(m_showInGroups, &QCheckBox::clicked,
|
||||
|
@ -287,13 +282,6 @@ void ViewPropertiesDialog::slotSortFoldersFirstChanged()
|
|||
markAsDirty(true);
|
||||
}
|
||||
|
||||
void ViewPropertiesDialog::slotSortHiddenLastChanged()
|
||||
{
|
||||
const bool hiddenLast = m_sortHiddenLast->isChecked();
|
||||
m_viewProps->setSortHiddenLast(hiddenLast);
|
||||
markAsDirty(true);
|
||||
}
|
||||
|
||||
void ViewPropertiesDialog::slotShowPreviewChanged()
|
||||
{
|
||||
const bool show = m_previewsShown->isChecked();
|
||||
|
@ -395,7 +383,6 @@ void ViewPropertiesDialog::applyViewProperties()
|
|||
m_dolphinView->setSortRole(m_viewProps->sortRole());
|
||||
m_dolphinView->setSortOrder(m_viewProps->sortOrder());
|
||||
m_dolphinView->setSortFoldersFirst(m_viewProps->sortFoldersFirst());
|
||||
m_dolphinView->setSortHiddenLast(m_viewProps->sortHiddenLast());
|
||||
m_dolphinView->setGroupedSorting(m_viewProps->groupedSorting());
|
||||
m_dolphinView->setVisibleRoles(m_viewProps->visibleRoles());
|
||||
m_dolphinView->setPreviewsShown(m_viewProps->previewsShown());
|
||||
|
@ -431,7 +418,6 @@ void ViewPropertiesDialog::loadSettings()
|
|||
m_sorting->setCurrentIndex(sortRoleIndex);
|
||||
|
||||
m_sortFoldersFirst->setChecked(m_viewProps->sortFoldersFirst());
|
||||
m_sortHiddenLast->setChecked(m_viewProps->sortHiddenLast());
|
||||
|
||||
// Load show preview, show in groups and show hidden files settings
|
||||
m_previewsShown->setChecked(m_viewProps->previewsShown());
|
||||
|
|
|
@ -46,7 +46,6 @@ private Q_SLOTS:
|
|||
void slotSortOrderChanged(int index);
|
||||
void slotGroupedSortingChanged();
|
||||
void slotSortFoldersFirstChanged();
|
||||
void slotSortHiddenLastChanged();
|
||||
void slotShowPreviewChanged();
|
||||
void slotShowHiddenFilesChanged();
|
||||
void slotItemChanged(QListWidgetItem *item);
|
||||
|
@ -68,7 +67,6 @@ private:
|
|||
QComboBox* m_sortOrder;
|
||||
QComboBox* m_sorting;
|
||||
QCheckBox* m_sortFoldersFirst;
|
||||
QCheckBox* m_sortHiddenLast;
|
||||
QCheckBox* m_previewsShown;
|
||||
QCheckBox* m_showInGroups;
|
||||
QCheckBox* m_showHiddenFiles;
|
||||
|
|
|
@ -812,19 +812,6 @@ void KFileItemModelTest::testRemoveFilteredExpandedItems()
|
|||
|
||||
void KFileItemModelTest::testSorting()
|
||||
{
|
||||
// testDir structure is as follows
|
||||
// ./
|
||||
// ├─ .g/
|
||||
// ├─ a
|
||||
// ├─ b
|
||||
// ├─ c/
|
||||
// │ ├─ c-2/
|
||||
// │ │ ├─ c-3
|
||||
// │ ├─ c-1
|
||||
// ├─ .f
|
||||
// ├─ d
|
||||
// ├─ e
|
||||
|
||||
QSignalSpy itemsInsertedSpy(m_model, &KFileItemModel::itemsInserted);
|
||||
QSignalSpy itemsMovedSpy(m_model, &KFileItemModel::itemsMoved);
|
||||
QVERIFY(itemsMovedSpy.isValid());
|
||||
|
@ -849,27 +836,17 @@ void KFileItemModelTest::testSorting()
|
|||
m_testDir->createFile("d", "The largest file in this directory", now.addDays(-1));
|
||||
m_testDir->createFile("e", "An even larger file", now.addDays(-4));
|
||||
m_testDir->createFile(".f");
|
||||
m_testDir->createDir(".g");
|
||||
|
||||
m_model->loadDirectory(m_testDir->url());
|
||||
QVERIFY(itemsInsertedSpy.wait());
|
||||
QCOMPARE(itemsInsertedSpy.count(), 1);
|
||||
KItemRangeList itemRangeList = itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>();
|
||||
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 5));
|
||||
|
||||
int index = m_model->index(QUrl(m_testDir->url().url() + "/c"));
|
||||
m_model->setExpanded(index, true);
|
||||
QVERIFY(itemsInsertedSpy.wait());
|
||||
QCOMPARE(itemsInsertedSpy.count(), 1);
|
||||
itemRangeList = itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>();
|
||||
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(1, 2));
|
||||
|
||||
index = m_model->index(QUrl(m_testDir->url().url() + "/c/c-2"));
|
||||
m_model->setExpanded(index, true);
|
||||
QVERIFY(itemsInsertedSpy.wait());
|
||||
QCOMPARE(itemsInsertedSpy.count(), 1);
|
||||
itemRangeList = itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>();
|
||||
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(2, 1));
|
||||
|
||||
// Default: Sort by Name, ascending
|
||||
QCOMPARE(m_model->sortRole(), QByteArray("text"));
|
||||
|
@ -965,46 +942,7 @@ void KFileItemModelTest::testSorting()
|
|||
QCOMPARE(itemsMovedSpy.first().at(0).value<KItemRange>(), KItemRange(4, 4));
|
||||
QCOMPARE(itemsMovedSpy.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 6 << 5 << 4);
|
||||
|
||||
// 'Show Hidden Files' enabled
|
||||
m_model->setShowHiddenFiles(true);
|
||||
QVERIFY(m_model->showHiddenFiles());
|
||||
QVERIFY(!m_model->sortHiddenLast());
|
||||
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << ".g" << "d" << "e" << "b" << "a" << ".f");
|
||||
QCOMPARE(itemsMovedSpy.count(), 0);
|
||||
QCOMPARE(itemsInsertedSpy.count(), 1);
|
||||
QCOMPARE(itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>(), KItemRangeList() << KItemRange(4, 1) << KItemRange(8, 1));
|
||||
|
||||
// 'Sort Hidden Files Last' enabled
|
||||
m_model->setSortHiddenLast(true);
|
||||
QVERIFY(m_model->sortHiddenLast());
|
||||
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "d" << "e" << "b" << "a" << ".g" << ".f");
|
||||
QCOMPARE(itemsMovedSpy.count(), 1);
|
||||
QCOMPARE(itemsInsertedSpy.count(), 0);
|
||||
QCOMPARE(itemsMovedSpy.first().at(0).value<KItemRange>(), KItemRange(4, 5));
|
||||
QCOMPARE(itemsMovedSpy.takeFirst().at(1).value<QList<int> >(), QList<int>() << 8 << 4 << 5 << 6 << 7);
|
||||
|
||||
// Sort by Name
|
||||
m_model->setSortRole("text");
|
||||
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "e" << "d" << "b" << "a" << ".g" << ".f");
|
||||
QCOMPARE(itemsMovedSpy.count(), 1);
|
||||
QCOMPARE(itemsMovedSpy.first().at(0).value<KItemRange>(), KItemRange(4, 2));
|
||||
QCOMPARE(itemsMovedSpy.takeFirst().at(1).value<QList<int> >(), QList<int>() << 5 << 4);
|
||||
|
||||
// Sort ascending
|
||||
m_model->setSortOrder(Qt::AscendingOrder);
|
||||
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "a" << "b" << "d" << "e" << ".g" << ".f");
|
||||
QCOMPARE(itemsMovedSpy.count(), 1);
|
||||
QCOMPARE(itemsMovedSpy.first().at(0).value<KItemRange>(), KItemRange(4, 4));
|
||||
QCOMPARE(itemsMovedSpy.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 6 << 5 << 4);
|
||||
|
||||
// 'Sort Folders First' disabled
|
||||
m_model->setSortDirectoriesFirst(false);
|
||||
QVERIFY(!m_model->sortDirectoriesFirst());
|
||||
QCOMPARE(itemsInModel(), QStringList() << "a" << "b" << "c" << "c-1" << "c-2" << "c-3" << "d" << "e" << ".f" << ".g");
|
||||
QCOMPARE(itemsMovedSpy.count(), 1);
|
||||
QCOMPARE(itemsMovedSpy.first().at(0).value<KItemRange>(), KItemRange(0, 10));
|
||||
QCOMPARE(itemsMovedSpy.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1 << 6 << 7 << 9 << 8);
|
||||
|
||||
// TODO: Sort by other roles; show/hide hidden files
|
||||
}
|
||||
|
||||
void KFileItemModelTest::testIndexForKeyboardSearch()
|
||||
|
|
|
@ -465,18 +465,6 @@ bool DolphinView::sortFoldersFirst() const
|
|||
return m_model->sortDirectoriesFirst();
|
||||
}
|
||||
|
||||
void DolphinView::setSortHiddenLast(bool hiddenLast)
|
||||
{
|
||||
if (sortHiddenLast() != hiddenLast) {
|
||||
updateSortHiddenLast(hiddenLast);
|
||||
}
|
||||
}
|
||||
|
||||
bool DolphinView::sortHiddenLast() const
|
||||
{
|
||||
return m_model->sortHiddenLast();
|
||||
}
|
||||
|
||||
void DolphinView::setVisibleRoles(const QList<QByteArray>& roles)
|
||||
{
|
||||
const QList<QByteArray> previousRoles = roles;
|
||||
|
@ -1387,17 +1375,6 @@ void DolphinView::updateSortFoldersFirst(bool foldersFirst)
|
|||
Q_EMIT sortFoldersFirstChanged(foldersFirst);
|
||||
}
|
||||
|
||||
void DolphinView::updateSortHiddenLast(bool hiddenLast)
|
||||
{
|
||||
ViewProperties props(viewPropertiesUrl());
|
||||
props.setSortHiddenLast(hiddenLast);
|
||||
|
||||
m_model->setSortHiddenLast(hiddenLast);
|
||||
|
||||
Q_EMIT sortHiddenLastChanged(hiddenLast);
|
||||
}
|
||||
|
||||
|
||||
QPair<bool, QString> DolphinView::pasteInfo() const
|
||||
{
|
||||
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
|
||||
|
@ -1942,12 +1919,6 @@ void DolphinView::applyViewProperties(const ViewProperties& props)
|
|||
Q_EMIT sortFoldersFirstChanged(sortFoldersFirst);
|
||||
}
|
||||
|
||||
const bool sortHiddenLast = props.sortHiddenLast();
|
||||
if (sortHiddenLast != m_model->sortHiddenLast()) {
|
||||
m_model->setSortHiddenLast(sortHiddenLast);
|
||||
Q_EMIT sortHiddenLastChanged(sortHiddenLast);
|
||||
}
|
||||
|
||||
const QList<QByteArray> visibleRoles = props.visibleRoles();
|
||||
if (visibleRoles != m_visibleRoles) {
|
||||
const QList<QByteArray> previousVisibleRoles = m_visibleRoles;
|
||||
|
|
|
@ -206,10 +206,6 @@ public:
|
|||
void setSortFoldersFirst(bool foldersFirst);
|
||||
bool sortFoldersFirst() const;
|
||||
|
||||
/** Sets a separate sorting with hidden files and folders last (true) or not (false). */
|
||||
void setSortHiddenLast(bool hiddenLast);
|
||||
bool sortHiddenLast() const;
|
||||
|
||||
/** Sets the additional information which should be shown for the items. */
|
||||
void setVisibleRoles(const QList<QByteArray>& roles);
|
||||
|
||||
|
@ -474,11 +470,6 @@ Q_SIGNALS:
|
|||
*/
|
||||
void sortFoldersFirstChanged(bool foldersFirst);
|
||||
|
||||
/**
|
||||
* Is emitted if the sorting of hidden files has been changed.
|
||||
*/
|
||||
void sortHiddenLastChanged(bool hiddenLast);
|
||||
|
||||
/** Is emitted if the additional information shown for this view has been changed. */
|
||||
void visibleRolesChanged(const QList<QByteArray>& current,
|
||||
const QList<QByteArray>& previous);
|
||||
|
@ -688,12 +679,6 @@ private Q_SLOTS:
|
|||
*/
|
||||
void updateSortFoldersFirst(bool foldersFirst);
|
||||
|
||||
/**
|
||||
* Updates the view properties of the current URL to the
|
||||
* sorting of hidden files given by \a hiddenLast.
|
||||
*/
|
||||
void updateSortHiddenLast(bool hiddenLast);
|
||||
|
||||
/**
|
||||
* Indicates in the status bar that the delete operation
|
||||
* of the job \a job has been finished.
|
||||
|
|
|
@ -57,8 +57,6 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view)
|
|||
this, &DolphinViewActionHandler::slotSortOrderChanged);
|
||||
connect(view, &DolphinView::sortFoldersFirstChanged,
|
||||
this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
|
||||
connect(view, &DolphinView::sortHiddenLastChanged,
|
||||
this, &DolphinViewActionHandler::slotSortHiddenLastChanged);
|
||||
connect(view, &DolphinView::visibleRolesChanged,
|
||||
this, &DolphinViewActionHandler::slotVisibleRolesChanged);
|
||||
connect(view, &DolphinView::groupedSortingChanged,
|
||||
|
@ -255,10 +253,6 @@ void DolphinViewActionHandler::createActions()
|
|||
sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First"));
|
||||
connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst);
|
||||
|
||||
KToggleAction* sortHiddenLast = m_actionCollection->add<KToggleAction>(QStringLiteral("hidden_last"));
|
||||
sortHiddenLast->setText(i18nc("@action:inmenu Sort", "Hidden Files Last"));
|
||||
connect(sortHiddenLast, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortHiddenLast);
|
||||
|
||||
// View -> Sort By
|
||||
QActionGroup* sortByActionGroup = createFileItemRolesActionGroup(QStringLiteral("sort_by_"));
|
||||
|
||||
|
@ -293,7 +287,6 @@ void DolphinViewActionHandler::createActions()
|
|||
sortByActionMenu->addAction(descendingAction);
|
||||
sortByActionMenu->addSeparator();
|
||||
sortByActionMenu->addAction(sortFoldersFirst);
|
||||
sortByActionMenu->addAction(sortHiddenLast);
|
||||
|
||||
// View -> Additional Information
|
||||
QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_"));
|
||||
|
@ -488,7 +481,6 @@ void DolphinViewActionHandler::updateViewActions()
|
|||
|
||||
slotSortOrderChanged(m_currentView->sortOrder());
|
||||
slotSortFoldersFirstChanged(m_currentView->sortFoldersFirst());
|
||||
slotSortHiddenLastChanged(m_currentView->sortHiddenLast());
|
||||
slotVisibleRolesChanged(m_currentView->visibleRoles(), QList<QByteArray>());
|
||||
slotGroupedSortingChanged(m_currentView->groupedSorting());
|
||||
slotSortRoleChanged(m_currentView->sortRole());
|
||||
|
@ -524,12 +516,6 @@ void DolphinViewActionHandler::toggleSortFoldersFirst()
|
|||
m_currentView->setSortFoldersFirst(!sortFirst);
|
||||
}
|
||||
|
||||
void DolphinViewActionHandler::toggleSortHiddenLast()
|
||||
{
|
||||
const bool sortHiddenLast = m_currentView->sortHiddenLast();
|
||||
m_currentView->setSortHiddenLast(!sortHiddenLast);
|
||||
}
|
||||
|
||||
void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order)
|
||||
{
|
||||
QAction* descending = m_actionCollection->action(QStringLiteral("descending"));
|
||||
|
@ -544,11 +530,6 @@ void DolphinViewActionHandler::slotSortFoldersFirstChanged(bool foldersFirst)
|
|||
m_actionCollection->action(QStringLiteral("folders_first"))->setChecked(foldersFirst);
|
||||
}
|
||||
|
||||
void DolphinViewActionHandler::slotSortHiddenLastChanged(bool hiddenLast)
|
||||
{
|
||||
m_actionCollection->action(QStringLiteral("hidden_last"))->setChecked(hiddenLast);
|
||||
}
|
||||
|
||||
void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
|
||||
{
|
||||
Q_EMIT actionBeingHandled();
|
||||
|
|
|
@ -136,16 +136,6 @@ private Q_SLOTS:
|
|||
*/
|
||||
void slotSortFoldersFirstChanged(bool foldersFirst);
|
||||
|
||||
/**
|
||||
* Switches between showing hidden files last or not.
|
||||
*/
|
||||
void toggleSortHiddenLast();
|
||||
|
||||
/**
|
||||
* Updates the state of the 'Sort Hidden Last' action.
|
||||
*/
|
||||
void slotSortHiddenLastChanged(bool hiddenLast);
|
||||
|
||||
/**
|
||||
* Updates the state of the 'Sort by' actions.
|
||||
*/
|
||||
|
|
|
@ -245,19 +245,6 @@ bool ViewProperties::sortFoldersFirst() const
|
|||
return m_node->sortFoldersFirst();
|
||||
}
|
||||
|
||||
void ViewProperties::setSortHiddenLast(bool hiddenLast)
|
||||
{
|
||||
if (m_node->sortHiddenLast() != hiddenLast) {
|
||||
m_node->setSortHiddenLast(hiddenLast);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProperties::sortHiddenLast() const
|
||||
{
|
||||
return m_node->sortHiddenLast();
|
||||
}
|
||||
|
||||
void ViewProperties::setVisibleRoles(const QList<QByteArray>& roles)
|
||||
{
|
||||
if (roles == visibleRoles()) {
|
||||
|
@ -366,7 +353,6 @@ void ViewProperties::setDirProperties(const ViewProperties& props)
|
|||
setSortRole(props.sortRole());
|
||||
setSortOrder(props.sortOrder());
|
||||
setSortFoldersFirst(props.sortFoldersFirst());
|
||||
setSortHiddenLast(props.sortHiddenLast());
|
||||
setVisibleRoles(props.visibleRoles());
|
||||
setHeaderColumnWidths(props.headerColumnWidths());
|
||||
m_node->setVersion(props.m_node->version());
|
||||
|
|
|
@ -62,9 +62,6 @@ public:
|
|||
void setSortFoldersFirst(bool foldersFirst);
|
||||
bool sortFoldersFirst() const;
|
||||
|
||||
void setSortHiddenLast(bool hiddenLast);
|
||||
bool sortHiddenLast() const;
|
||||
|
||||
/**
|
||||
* Sets the additional information for the current set view-mode.
|
||||
* Note that the additional-info property is the only property where
|
||||
|
|
Loading…
Reference in a new issue