┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorChirag Anand <[email protected]>2011-09-22 18:08:49 +0530
committerChirag Anand <[email protected]>2011-09-22 18:08:49 +0530
commit9ca11175a4c9e93607131c45b8e5470e1e5014b7 (patch)
tree61f1635596c0e5e76881344693af4238f05215ed /src/kitemviews
parentbc96a102340252363158ded39a3cb0adaee59824 (diff)
Fixed bug for selecting files with --select parameter.
Files selected via --select parameter did not get current item focus. And if files were deleted while being current item, updating the view would select the next item instead of the first item in the list. BUG: 257805 CCMAIL: [email protected] CCMAIL: [email protected]
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp7
-rw-r--r--src/kitemviews/kfileitemmodel.h6
2 files changed, 13 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 9b96d7eac..a36ca0cdf 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -263,6 +263,13 @@ int KFileItemModel::index(const KFileItem& item) const
return m_items.value(item.url(), -1);
}
+int KFileItemModel::index(const KUrl& url) const
+{
+ KUrl urlToFind = url;
+ urlToFind.adjustPath(KUrl::RemoveTrailingSlash);
+ return m_items.value(urlToFind, -1);
+}
+
KFileItem KFileItemModel::rootItem() const
{
const KDirLister* dirLister = m_dirLister.data();
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index b79eec4ee..3c8cdba2c 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -106,6 +106,12 @@ public:
int index(const KFileItem& item) const;
/**
+ * @return The index for the URL \a url. -1 is returned if no file-item
+ * is found. The runtime complexity of this call is O(1).
+ */
+ int index(const KUrl& url) const;
+
+ /**
* @return Root item of all items.
*/
KFileItem rootItem() const;