connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
+ connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(slotUrlIsFileError(KUrl)));
connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(KUrl)),
this, SLOT(slotUrlNavigatorLocationAboutToBeChanged(KUrl)));
}
}
+void DolphinViewContainer::slotUrlIsFileError(const KUrl& url)
+{
+ const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
+ slotItemActivated(item);
+}
+
void DolphinViewContainer::slotItemActivated(const KFileItem& item)
{
// It is possible to activate items on inactive views by
*/
void slotDirectoryLoadingCompleted();
+ /**
+ * Is called if the URL set by DolphinView::setUrl() represents
+ * a file and not a directory. Takes care to activate the file.
+ */
+ void slotUrlIsFileError(const KUrl& url);
+
/**
* Handles clicking on an item. If the item is a directory, the
* directory is opened in the view. If the item is a file, the file
connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl)));
+ connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
// Apply default roles that should be determined
resetRoles();
*/
void directoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ /**
+ * Is emitted when the URL passed by KFileItemModel::setUrl() represents a file.
+ * In this case no signal errorMessage() will be emitted.
+ */
+ void urlIsFileError(const KUrl& url);
+
protected:
virtual void onGroupedSortingChanged(bool current);
virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous);
void KFileItemModelDirLister::handleError(KIO::Job* job)
{
- const QString errorString = job->errorString();
- if (errorString.isEmpty()) {
- emit errorMessage(i18nc("@info:status", "Unknown error."));
+ if (job->error() == KIO::ERR_IS_FILE) {
+ emit urlIsFileError(url());
} else {
- emit errorMessage(errorString);
+ const QString errorString = job->errorString();
+ if (errorString.isEmpty()) {
+ emit errorMessage(i18nc("@info:status", "Unknown error."));
+ } else {
+ emit errorMessage(errorString);
+ }
}
}
/** Is emitted whenever an error has occurred. */
void errorMessage(const QString& msg);
+ /**
+ * Is emitted when the URL of the directory lister represents a file.
+ * In this case no signal errorMessage() will be emitted.
+ */
+ void urlIsFileError(const KUrl& url);
+
protected:
virtual void handleError(KIO::Job* job);
};
connect(m_model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
connect(m_model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
connect(m_model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
+ connect(m_model, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
m_view->installEventFilter(this);
connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
*/
void redirection(const KUrl& oldUrl, const KUrl& newUrl);
+ /**
+ * Is emitted when the URL set by DolphinView::setUrl() represents a file.
+ * In this case no signal errorMessage() will be emitted.
+ */
+ void urlIsFileError(const KUrl& url);
+
/**
* Is emitted when the write state of the folder has been changed. The application
* should disable all actions like "Create New..." that depend on the write