#include "panels/folders/folderspanel.h"
#include "panels/places/placesitemmodel.h"
#include "panels/places/placespanel.h"
-#include "panels/information/informationpanel.h"
#include "panels/terminal/terminalpanel.h"
#include "settings/dolphinsettingsdialog.h"
#include "statusbar/dolphinstatusbar.h"
infoPanel, &InformationPanel::setSelection);
connect(this, &DolphinMainWindow::requestItemInfo,
infoPanel, &InformationPanel::requestDelayedItemInfo);
+ connect(this, &DolphinMainWindow::fileItemsChanged,
+ infoPanel, &InformationPanel::slotFilesItemChanged);
#endif
// i18n: This is the last paragraph for the "What's This"-texts of all four panels.
this, &DolphinMainWindow::slotSelectionChanged);
connect(view, &DolphinView::requestItemInfo,
this, &DolphinMainWindow::requestItemInfo);
+ connect(view, &DolphinView::fileItemsChanged,
+ this, &DolphinMainWindow::fileItemsChanged);
connect(view, &DolphinView::tabRequested,
this, &DolphinMainWindow::openNewTab);
connect(view, &DolphinView::requestContextMenu,
#include <KSortableList>
#include <kxmlguiwindow.h>
+#ifdef HAVE_BALOO
+ #include "panels/information/informationpanel.h"
+#endif
+
#include <QIcon>
#include <QList>
#include <QMenu>
*/
void requestItemInfo(const KFileItem& item);
+ /**
+ * It is emitted when in the current view, files are changed,
+ * or dirs have files/removed from them.
+ */
+ void fileItemsChanged(const KFileItemList &changedFileItems);
+
/**
* Is emitted if the settings have been changed.
*/
QMetaObject::Connection m_updateHistoryConnection;
QMenu m_searchTools;
-
};
inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const
// emitted during the maximum update interval.
m_maximumUpdateIntervalTimer->start();
}
+
+ Q_EMIT fileItemsChanged({KFileItem(directoryUrl)});
}
void KFileItemModel::slotItemsDeleted(const KFileItemList& items)
QVector<int> indexesToRemove;
indexesToRemove.reserve(items.count());
+ KFileItemList dirsChanged;
for (const KFileItem& item : items) {
const int indexForItem = index(item);
m_filteredItems.erase(it);
}
}
+
+ QUrl parentUrl = item.url().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash);
+ if (dirsChanged.findByUrl(parentUrl).isNull()) {
+ dirsChanged << KFileItem(parentUrl);
+ }
}
std::sort(indexesToRemove.begin(), indexesToRemove.end());
const KItemRangeList itemRanges = KItemRangeList::fromSortedContainer(indexesToRemove);
removeFilteredChildren(itemRanges);
removeItems(itemRanges, DeleteItemData);
+
+ Q_EMIT fileItemsChanged(dirsChanged);
}
void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& items)
indexes.reserve(items.count());
QSet<QByteArray> changedRoles;
+ KFileItemList changedFiles;
QListIterator<QPair<KFileItem, KFileItem> > it(items);
while (it.hasNext()) {
m_items.remove(oldItem.url());
m_items.insert(newItem.url(), indexForItem);
+ changedFiles.append(newItem);
indexes.append(indexForItem);
} else {
// Check if 'oldItem' is one of the filtered items.
std::sort(indexes.begin(), indexes.end());
const KItemRangeList itemRangeList = KItemRangeList::fromSortedContainer(indexes);
emitItemsChangedAndTriggerResorting(itemRangeList, changedRoles);
+
+ Q_EMIT fileItemsChanged(changedFiles);
}
void KFileItemModel::slotClear()
*/
void urlIsFileError(const QUrl& url);
+ /**
+ * It is emitted for files when they change and
+ * for dirs when files are added or removed.
+ */
+ void fileItemsChanged(const KFileItemList &changedFileItems);
+
protected:
void onGroupedSortingChanged(bool current) override;
void onSortRoleChanged(const QByteArray& current, const QByteArray& previous, bool resortItems = true) override;
connect(m_folderStatJob, &KIO::Job::result,
this, &InformationPanel::slotFolderStatFinished);
} else {
+ m_shownUrl = item.url();
m_content->showItem(item);
}
}
}
}
+void InformationPanel::slotFilesItemChanged(const KFileItemList &changedFileItems)
+{
+ const auto item = changedFileItems.findByUrl(m_shownUrl);
+ if (!item.isNull()) {
+ m_fileItem = item;
+ showItemInfo();
+ }
+}
+
void InformationPanel::slotFilesChanged(const QStringList& files)
{
for (const QString& fileName : files) {
*/
void requestDelayedItemInfo(const KFileItem& item);
+ void slotFilesItemChanged(const KFileItemList &changedFileItems);
+
protected:
/** @see Panel::urlChanged() */
bool urlChanged() override;
connect(m_model, &KFileItemModel::errorMessage, this, &DolphinView::errorMessage);
connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
+ connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged);
connect(this, &DolphinView::itemCountChanged,
this, &DolphinView::updatePlaceholderLabel);
void goUpRequested();
+ void fileItemsChanged(const KFileItemList &changedFileItems);
+
protected:
/** Changes the zoom level if Control is pressed during a wheel event. */
void wheelEvent(QWheelEvent* event) override;