┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-06-13 15:15:54 +0200
committerPeter Penz <[email protected]>2012-06-13 15:18:21 +0200
commite9463ffe2ac110193cac4c25fcba887249f52b3c (patch)
tree2628af56647926efc845086dc46b95650e89f1d2 /src/kitemviews
parentfb15dac9752b44ceb0846ac013160d8972c5e862 (diff)
Fix regression: Open file if entering it in the URL-navigator
The regression has been introduced when hiding the DolphinDirLister inside KFileItemModel. Now the signal urlIsFileError() gets forwarded to the container again where the file will be opened. BUG: 301757 FIXED-IN: 4.9.0
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp1
-rw-r--r--src/kitemviews/kfileitemmodel.h6
-rw-r--r--src/kitemviews/private/kfileitemmodeldirlister.cpp12
-rw-r--r--src/kitemviews/private/kfileitemmodeldirlister.h6
4 files changed, 21 insertions, 4 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index eec90065a..f8302cfab 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -72,6 +72,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
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();
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index 64359df2c..d9bebdf02 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -244,6 +244,12 @@ signals:
*/
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);
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.cpp b/src/kitemviews/private/kfileitemmodeldirlister.cpp
index be0f9f77b..3d36386a9 100644
--- a/src/kitemviews/private/kfileitemmodeldirlister.cpp
+++ b/src/kitemviews/private/kfileitemmodeldirlister.cpp
@@ -33,11 +33,15 @@ KFileItemModelDirLister::~KFileItemModelDirLister()
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);
+ }
}
}
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h
index 1d58347f4..688ee9c5b 100644
--- a/src/kitemviews/private/kfileitemmodeldirlister.h
+++ b/src/kitemviews/private/kfileitemmodeldirlister.h
@@ -40,6 +40,12 @@ signals:
/** 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);
};