Don't show the label while still loading. Since there is no property in
`KDirLister` a dedicated `m_loading` is added for this purpose.
Also, I removed the explicit update on `urlChanged` as the view
probably won't change until the lister starts loading.
BUG: 430085
m_assureVisibleCurrentIndex(false),
m_isFolderWritable(true),
m_dragging(false),
m_assureVisibleCurrentIndex(false),
m_isFolderWritable(true),
m_dragging(false),
m_url(url),
m_viewPropertiesContext(),
m_mode(DolphinView::IconsView),
m_url(url),
m_viewPropertiesContext(),
m_mode(DolphinView::IconsView),
connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted);
connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted);
connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
- connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::directoryLoadingCanceled);
+ connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::slotDirectoryLoadingCanceled);
connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress);
connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress);
connect(m_model, &KFileItemModel::itemsChanged,
connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress);
connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress);
connect(m_model, &KFileItemModel::itemsChanged,
connect(this, &DolphinView::itemCountChanged,
this, &DolphinView::updatePlaceholderLabel);
connect(this, &DolphinView::itemCountChanged,
this, &DolphinView::updatePlaceholderLabel);
- connect(this, &DolphinView::urlChanged,
- this, &DolphinView::updatePlaceholderLabel);
m_view->installEventFilter(this);
connect(m_view, &DolphinItemListView::sortOrderChanged,
m_view->installEventFilter(this);
connect(m_view, &DolphinItemListView::sortOrderChanged,
void DolphinView::slotDirectoryLoadingStarted()
{
void DolphinView::slotDirectoryLoadingStarted()
{
- // We don't want the placeholder label to flicker while the folder is loading
- m_placeholderLabel->setVisible(false);
+ m_loading = true;
+ updatePlaceholderLabel();
// Disable the writestate temporary until it can be determined in a fast way
// in DolphinView::slotDirectoryLoadingCompleted()
// Disable the writestate temporary until it can be determined in a fast way
// in DolphinView::slotDirectoryLoadingCompleted()
void DolphinView::slotDirectoryLoadingCompleted()
{
void DolphinView::slotDirectoryLoadingCompleted()
{
// Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
QTimer::singleShot(0, this, &DolphinView::updateViewState);
// Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
QTimer::singleShot(0, this, &DolphinView::updateViewState);
+void DolphinView::slotDirectoryLoadingCanceled()
+{
+ m_loading = false;
+
+ updatePlaceholderLabel();
+
+ Q_EMIT directoryLoadingCanceled();
+}
+
void DolphinView::slotItemsChanged()
{
m_assureVisibleCurrentIndex = false;
void DolphinView::slotItemsChanged()
{
m_assureVisibleCurrentIndex = false;
void DolphinView::updatePlaceholderLabel()
{
void DolphinView::updatePlaceholderLabel()
{
- if (itemsCount() > 0) {
+ if (m_loading || itemsCount() > 0) {
m_placeholderLabel->setVisible(false);
return;
}
m_placeholderLabel->setVisible(false);
return;
}
*/
void slotDirectoryLoadingCompleted();
*/
void slotDirectoryLoadingCompleted();
+ /**
+ * Invoked when the file item model indicates that the loading of a directory has
+ * been canceled.
+ */
+ void slotDirectoryLoadingCanceled();
+
/**
* Is invoked when items of KFileItemModel have been changed.
*/
/**
* Is invoked when items of KFileItemModel have been changed.
*/
bool m_isFolderWritable;
bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
// tooltip may be shown when hovering an item.
bool m_isFolderWritable;
bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
// tooltip may be shown when hovering an item.
QUrl m_url;
QString m_viewPropertiesContext;
QUrl m_url;
QString m_viewPropertiesContext;