Discussion:
D8855: Use Kio::KPlacesModel as source model for PlacesItemModel
Renato Oliveira Filho
2017-11-16 20:40:54 UTC
Permalink
renatoo created this revision.
Restricted Application added a subscriber: Dolphin.

REVISION SUMMARY
Use Kio::KPlacesModel as source model for PlacesItemModel avoiding
duplicated code.

TEST PLAN
Unit test created

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/kitemviews/kstandarditemmodel.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo
Cc: #dolphin
Renato Oliveira Filho
2017-11-16 20:41:46 UTC
Permalink
renatoo planned changes to this revision.
renatoo added a comment.


WIP

Still some code cleanup to do and tests to run.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: #dolphin
Nathaniel Graham
2017-11-16 20:42:08 UTC
Permalink
ngraham added a comment.


Awesome. Please make sure to mark any dependent revisions.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: ngraham, #dolphin
Renato Oliveira Filho
2017-11-16 20:44:03 UTC
Permalink
renatoo edited the summary of this revision.
renatoo added dependencies: D8630: Created unit test for PlacesItemModel, D8332: Added baloo urls into places model, D8434: Created 'remote' section, D8348: Add a section for removable devices.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: ngraham, #dolphin
Renato Oliveira Filho
2017-11-17 12:21:37 UTC
Permalink
renatoo edited the summary of this revision.
renatoo added a dependency: D8862: Extend API.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: ngraham, #dolphin
Renato Oliveira Filho
2017-11-17 12:46:52 UTC
Permalink
renatoo updated this revision to Diff 22511.
renatoo added a comment.


Rollback unecessary changes
Added functions documentation

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22487&id=22511

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo
Cc: ngraham, #dolphin
Renato Oliveira Filho
2017-11-17 13:13:33 UTC
Permalink
renatoo updated this revision to Diff 22513.
renatoo added a comment.


Fixed code style

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22511&id=22513

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo
Cc: ngraham, #dolphin
Nicolas Fella
2017-11-18 14:49:12 UTC
Permalink
nicolasfella added a comment.


I would like to propose another approach. Like discussed in https://phabricator.kde.org/D7700 https://phabricator.kde.org/D8243 and https://phabricator.kde.org/D7446 I would vote for splitting the functionality of the placespanel into smaller panels (~one for each group in the current places panel). By default this could look like the status quo, but the user would be able to reorder them in her gusto. For example, hve the "normal" places entries on the left and the baloo stuff or a tags panel on the right. These panels would inherit from a common abstract panel class but each would have its own model which would be much more maintainable (current PlacesItemModel.cpp has ~1200 LOC). The small panels would also not need group support (the panel IS the group) so the code would be less complex as well

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: nicolasfella, ngraham, #dolphin
Nathaniel Graham
2017-11-18 14:54:44 UTC
Permalink
ngraham added a comment.


The problem with that approach is that you'll wind up with a large number of number of panels to manage (Places, Devices, Search For, Recently Saved, Tags...) . Each one can have a scrollbar since its content is scrollable, so you'd wind up with four or five scrollviews immediately above one another, which is a poorer UX compared to the single scrollable view that the Places panel already offers. If we re-implement everything such that each panel never has a scrollview and has to be fit inside a master scrollview... then we've re-implemented exactly what we already have with the places panel.

IMHO the merits of an all-panel approach are separate from this patch anyway. Regardless of the final UI, it makes good sense to abandon our fork of the code in Dolphin.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-20 12:38:23 UTC
Permalink
renatoo planned changes to this revision.
renatoo added a comment.


Fix group types to support new types.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo
Cc: nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-20 13:15:18 UTC
Permalink
renatoo updated this revision to Diff 22646.
renatoo added a comment.


Updated parent branch

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22513&id=22646

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo
Cc: nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-20 15:34:57 UTC
Permalink
renatoo updated this revision to Diff 22662.
renatoo added a comment.


Used convertedUrl from KFilePlacesModel insted of implement a new one

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22646&id=22662

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo
Cc: nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-20 18:53:33 UTC
Permalink
renatoo updated this revision to Diff 22674.
renatoo added a comment.


Removed duplicated code related with item icon

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22662&id=22674

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo
Cc: nicolasfella, ngraham, #dolphin
Anthony Fieroni
2017-11-21 04:43:36 UTC
Permalink
anthonyfieroni added reviewers: elvisangelaccio, emmanuelp.
anthonyfieroni added inline comments.

INLINE COMMENTS
placesitem.cpp:159
+ const QString urlScheme = url().scheme();
+ return (urlScheme.contains(QStringLiteral("search")) || urlScheme.contains(QStringLiteral("timeline")));
}
scheme can be filenamesearch and it's not baloo.
placesitemmodel.cpp:93
{
- const KBookmark bookmark = PlacesItem::createBookmark(m_bookmarkManager, text, url, iconName);
- return new PlacesItem(bookmark);
+ m_sourceModel->addPlace(text, url, iconName, "", mapToSource(after));
}
For empty string do not use "", here use {}
In function declaration

void setBla(const QString &name = {})
placesitemmodel.cpp:159
+
+ if (bookmarkId(m_sourceModel->bookmarkForIndex(sIndex)) == bookmarkId(iBookmark)) {
break;
You should not call bookmarId(iBookmark) on every iteration

const QString itemBookmarkId = bookmarkId(item->bookmark);
placesitemmodel.h:56-59
/**
* attributes.
*/
Docs does not match anymore to function
placesitemmodel.h:149-152
+ void onSourceModelRowsInserted(const QModelIndex &parent, int first, int last);
+ void onSourceModelRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
+ void onSourceModelRowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
+ void onSourceModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
Q_DECL_OVERRIDE

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-21 19:44:26 UTC
Permalink
renatoo added inline comments.

INLINE COMMENTS
anthonyfieroni wrote in placesitemmodel.h:149-152
Q_DECL_OVERRIDE
These are not override functions.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-21 19:47:16 UTC
Permalink
renatoo updated this revision to Diff 22705.
renatoo marked 5 inline comments as done.
renatoo added a comment.


Fixed item drag & drop

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22674&id=22705

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Elvis Angelaccio
2017-11-21 23:10:38 UTC
Permalink
elvisangelaccio added a comment.


Please bump the minimum KIO version in CMakeLists.txt

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-23 14:24:12 UTC
Permalink
renatoo added a comment.
Post by Elvis Angelaccio
Please bump the minimum KIO version in CMakeLists.txt
Ok increased KF5 minimum version to 5.41

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-23 15:22:37 UTC
Permalink
renatoo updated this revision to Diff 22824.
renatoo marked an inline comment as done.
renatoo added a comment.


Bumped KF5 dep version

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22705&id=22824

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-27 11:55:21 UTC
Permalink
renatoo updated this revision to Diff 23002.
renatoo added a comment.


Updated parent branch

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=22824&id=23002

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp
Cc: anthonyfieroni, nicolasfella, ngraham, #dolphin
Laurent Montel
2017-11-28 10:40:23 UTC
Permalink
mlaurent requested changes to this revision.
mlaurent added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS
placesitemmodeltest.cpp:200
+
+QMimeData *PlacesItemModelTest::createMimeData(QList<int> indexes) const
+{
const QList<int>& indexes no ?

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-11-29 12:08:18 UTC
Permalink
renatoo updated this revision to Diff 23128.
renatoo marked an inline comment as done.
renatoo added a comment.


Used const for the function argument

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23002&id=23128

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Laurent Montel
2017-11-29 14:46:04 UTC
Permalink
mlaurent added a comment.


seems good for me +1

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Nathaniel Graham
2017-11-29 14:48:12 UTC
Permalink
ngraham added a comment.
Post by Laurent Montel
seems good for me +1
@mlaurent Great! Can you change your "Needs changes" status to "Accepted"?

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Laurent Montel
2017-11-30 09:59:53 UTC
Permalink
mlaurent added a comment.


I don't know if I can change it to accepted as I am not the maintainer and we depend against not release kf5
so maintainer must accept it not me no ?
==========================================

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Anthony Fieroni
2017-11-30 10:01:59 UTC
Permalink
anthonyfieroni added a comment.
so maintainer must accept it not me no ?
When you want a change request, you became a stopper.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Elvis Angelaccio
2017-11-30 22:13:57 UTC
Permalink
elvisangelaccio added a comment.


Patch doesn't apply for me (running `arc patch D8855`). Do you need to rebase it?

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Nathaniel Graham
2017-11-30 22:47:18 UTC
Permalink
ngraham added a comment.
Post by Anthony Fieroni
so maintainer must accept it not me no ?
When you want a change request, you became a stopper.
@mlaurent Meaning, now that you've requested changes, you need to either accept the revision at some point, or resign from it.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-01 20:08:38 UTC
Permalink
renatoo updated this revision to Diff 23231.
renatoo added a comment.


Rebased with mainline

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23128&id=23231

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Elvis Angelaccio
2017-12-03 14:52:07 UTC
Permalink
elvisangelaccio requested changes to this revision.
elvisangelaccio added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS
placesitem.cpp:159
+ const QString urlScheme = url().scheme();
+ return (urlScheme.contains(QStringLiteral("search")) || urlScheme.contains(QStringLiteral("timeline")));
}
`contains()` has a `QLatin1String` overload which should be preferred.
placesitemmodel.cpp:54-57
-#ifdef HAVE_BALOO
- #include <Baloo/Query>
- #include <Baloo/IndexerConfig>
-#endif
Please also remove `#include <config-baloo.h>` from the header file
placesitemmodel.cpp:85-86
{
- qDeleteAll(m_bookmarkedItems);
- m_bookmarkedItems.clear();
+ delete m_sourceModel;
+ m_sourceModel = nullptr;
}
Maybe we can use a QScopedPointer for `m_sourceModel`?
placesitemmodel.cpp:148
- for (int i = 0; i < count(); ++i) {
- const QUrl itemUrl = placesItem(i)->url();
- if (url == itemUrl) {
- // We can't find a closer one, so stop here.
- foundIndex = i;
+// look for the coorrect position for the item based on source model
+void PlacesItemModel::insertSortedItem(PlacesItem* item)
typo: correct
placesitemmodel.cpp:198
+{
+ const QModelIndex sIndex = mapToSource(index);
+ const PlacesItem *changedItem = placesItem(mapFromSource(sIndex));
Please call it `sourceIndex`
placesitemmodel.cpp:439
+ // Create default view-properties for all "Search For" and "Recently Saved" bookmarks
+ // in case if the user has not already created custom view-properties for a corresponding
+ // query yet.
Sounds like `if` should not be in this sentence.
placesitemmodel.cpp:551
-void PlacesItemModel::loadBookmarks()
-{
- KBookmarkGroup root = m_bookmarkManager->root();
- KBookmark bookmark = root.first();
- QSet<QString> devices = m_availableDevices;
+ const int blockSize = (end - start) + 1;
remove one space before `+`
placesitemmodel.cpp:571
+ for (int r = topLeft.row(); r <= bottomRight.row(); r++) {
+ const QModelIndex sIndex = m_sourceModel->index(r, 0);
+ const KBookmark bookmark = m_sourceModel->bookmarkForIndex(sIndex);
`sourceIndex`
placesitemmodel.cpp:672
int dropIndex = index;
- const PlacesItem::GroupType type = item->groupType();
+ const QString type = item->group();
Please call it `group`
placesitemmodel.cpp:853-855
- // As long as the KFilePlacesView from kdelibs is available, the system-bookmarks
- // for "Recently Saved" and "Search For" should be a setting available only
- // in the Places Panel (see description of AppNamePrefix for more details).
There is a similar comment where we define `AppNamePrefix`, should that be also removed?
placesitemmodel.h:68-69
+ /**
+ */
typo: hidden
placesitemmodel.h:122
- void clear() override;
+ virtual void clear() Q_DECL_OVERRIDE;
`override`
placesitemmodeltest.cpp:152
QStringList urls;
- for (int row = 0; row < m_model->count(); ++row) {
- urls << m_model->placesItem(row)->url().toDisplayString(QUrl::PreferLocalFile);
+ if (model == nullptr) {
+ model = m_model;
`!model` ?
placesitemmodeltest.cpp:193
+{
+ // user hardcoded path to avoid removal of any user persnonal data
+ QDir dir(QStringLiteral("/home/renato/.qttest/share/placesitemmodeltest"));
typo: personal

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-04 12:27:52 UTC
Permalink
renatoo updated this revision to Diff 23421.
renatoo marked 13 inline comments as done.
renatoo added a comment.


Fixed typo
Used QScopedPointer for m_sourceModel
Fixed code style

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23231&id=23421

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-04 12:31:13 UTC
Permalink
renatoo updated this revision to Diff 23422.
renatoo marked an inline comment as done.
renatoo added a comment.


Fixed typo

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23421&id=23422

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent
Cc: mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Milian Wolff
2017-12-06 12:22:17 UTC
Permalink
mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


some small nits and cleanup suggestions from my side, otherwise lgtm.

INLINE COMMENTS
placesitem.cpp:159
+ const QString urlScheme = url().scheme();
+ return (urlScheme.contains("search") || urlScheme.contains("timeline"));
}
shouldn't this be equality comparisons instead of contains checks? are there schemas like "foobar-search-asdf" that need to be matched too?
placesitemmodel.cpp:153
+
+ for(int r = 0; r < m_sourceModel->rowCount(); r++) {
+ sourceIndex = m_sourceModel->index(r, 0);
`for (int r = 0, c = m_sourceModel->rowCount(); r < c; ++r) {`

don't call rowCount on every iteration
placesitemmodel.cpp:408
- const int boomarkIndex = bookmarkIndex(index);
- Q_ASSERT(!m_bookmarkedItems[boomarkIndex]);
- m_bookmarkedItems.removeAt(boomarkIndex);
-
-#ifdef PLACESITEMMODEL_DEBUG
- qCDebug(DolphinDebug) << "Removed item" << index;
- showModelState();
-#endif
-}
-
-void PlacesItemModel::onItemChanged(int index, const QSet<QByteArray>& changedRoles)
-{
- const PlacesItem* changedItem = placesItem(index);
- if (changedItem) {
- // Take care to apply the PlacesItemModel-order of the changed item
- // also to the bookmark-manager.
- const KBookmark insertedBookmark = changedItem->bookmark();
-
- const PlacesItem* previousItem = placesItem(index - 1);
- KBookmark previousBookmark;
- if (previousItem) {
- previousBookmark = previousItem->bookmark();
+ for (int i = 0; i < count(); ++i) {
+ if (bookmarkId(placesItem(i)->bookmark()) == id) {
dito, don't call count on every iteration
placesitemmodel.cpp:427
+{
+ for(int i = 0; i < m_sourceModel->rowCount(); i++) {
+ const QModelIndex index = m_sourceModel->index(i, 0);
dito
placesitemmodel.cpp:592
+{
+ for(int r = 0; r < m_sourceModel->rowCount(); r++) {
+ const QModelIndex sourceIndex = m_sourceModel->index(r, 0);
dito
placesitemmodel.cpp:721
- if (day >= 1) {
- date += '-';
- if (day < 10) {
- date += '0';
+ for (int i = 0; i < m_indexMap.size(); i++) {
+ if (m_indexMap.at(i) == index) {
dito, note that you could also just replace this all with a simple `return m_indexMap.indexOf(index);`, that works too, no? Otherwise try `std::find_if` + `std::distance`
placesitemmodel.cpp:738
{
- QUrl searchUrl;
-
-#ifdef HAVE_BALOO
- const QString path = url.toDisplayString(QUrl::PreferLocalFile);
- if (path.endsWith(QLatin1String("documents"))) {
- searchUrl = searchUrlForType(QStringLiteral("Document"));
- } else if (path.endsWith(QLatin1String("images"))) {
- searchUrl = searchUrlForType(QStringLiteral("Image"));
- } else if (path.endsWith(QLatin1String("audio"))) {
- searchUrl = searchUrlForType(QStringLiteral("Audio"));
- } else if (path.endsWith(QLatin1String("videos"))) {
- searchUrl = searchUrlForType(QStringLiteral("Video"));
- } else {
- Q_ASSERT(false);
+ if ((row < 0) || (row >= m_indexMap.size())) {
+ return QModelIndex();
simplify this whole method to `return m_indexMap.value(row);`
placesitemmodel.cpp:748
+ const QString id = bookmarkId(bookmark);
+ for (int i = 0; i < count(); i++) {
+ PlacesItem *item = placesItem(i);
dito
placesitemmodel.h:226
+
+ QList<QPersistentModelIndex> m_indexMap;
};
QVector, this QList would allocate every item on the heap

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-06 12:45:06 UTC
Permalink
renatoo updated this revision to Diff 23556.
renatoo marked 5 inline comments as done.
renatoo added a comment.


Avoid call model.rowCount() several times while on loop.

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23422&id=23556

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-06 12:47:09 UTC
Permalink
renatoo updated this revision to Diff 23557.
renatoo marked an inline comment as done.
renatoo added a comment.


Used QVector insted of QList for m_indexMap

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23556&id=23557

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-06 12:49:11 UTC
Permalink
renatoo marked an inline comment as done.
renatoo added inline comments.

INLINE COMMENTS
mwolff wrote in placesitem.cpp:159
shouldn't this be equality comparisons instead of contains checks? are there schemas like "foobar-search-asdf" that need to be matched too?
well the search can be "search://" or "baloonsearch://" not sure if anything else. "timeline" I think is fixed there is no variation.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Milian Wolff
2017-12-06 12:51:18 UTC
Permalink
mwolff added inline comments.

INLINE COMMENTS
renatoo wrote in placesitem.cpp:159
well the search can be "search://" or "baloonsearch://" not sure if anything else. "timeline" I think is fixed there is no variation.
Then check for the three variations, instead of these wildcard searched I propose

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Milian Wolff
2017-12-06 12:54:09 UTC
Permalink
mwolff requested changes to this revision.
mwolff added a comment.
This revision now requires changes to proceed.


sorry, three more cases of the for loops :-/

INLINE COMMENTS
placesitemmodel.cpp:109
if (show) {
- // Move all items that are part of m_bookmarkedItems to the model.
- QList<PlacesItem*> itemsToInsert;
- QList<int> insertPos;
- int modelIndex = 0;
- for (int i = 0; i < m_bookmarkedItems.count(); ++i) {
- if (m_bookmarkedItems[i]) {
- itemsToInsert.append(m_bookmarkedItems[i]);
- m_bookmarkedItems[i] = 0;
- insertPos.append(modelIndex);
+ for (int r = 0; r < m_sourceModel->rowCount(); r++) {
+ const QModelIndex index = m_sourceModel->index(r, 0);
missed this one, sorry
placesitemmodel.cpp:117
} else {
- // Move all items of the model, where the "isHidden" property is true, to
- // m_bookmarkedItems.
- Q_ASSERT(m_bookmarkedItems.count() == count());
- for (int i = count() - 1; i >= 0; --i) {
- if (placesItem(i)->isHidden()) {
- hideItem(i);
+ for (int r = 0; r < m_sourceModel->rowCount(); r++) {
+ const QModelIndex index = m_sourceModel->index(r, 0);
dito
placesitemmodel.cpp:427
+{
+ for(int i = 0; i < m_sourceModel->rowCount(); i++) {
+ const QModelIndex index = m_sourceModel->index(i, 0);
dito

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-06 13:02:41 UTC
Permalink
renatoo updated this revision to Diff 23558.
renatoo marked 6 inline comments as done.
renatoo added a comment.


More fixes about rowCount usage

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23557&id=23558

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/kitemviews/kfileitemmodel.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-06 13:02:51 UTC
Permalink
renatoo added inline comments.

INLINE COMMENTS
mwolff wrote in placesitem.cpp:159
Then check for the three variations, instead of these wildcard searched I propose
There is several other places that check with contains. Lets keep this way to avoid regressions.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Milian Wolff
2017-12-06 13:04:14 UTC
Permalink
mwolff accepted this revision.
mwolff added a comment.


thank

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-06 15:30:24 UTC
Permalink
renatoo updated this revision to Diff 23569.
renatoo added a comment.


Avoid crash while hiding a item.

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23558&id=23569

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/kitemviews/kfileitemmodel.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-07 14:38:50 UTC
Permalink
renatoo added a dependent revision: D9242: Implemented support for hide/show groups.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Laurent Montel
2017-12-08 08:53:54 UTC
Permalink
mlaurent accepted this revision.
mlaurent added a comment.


Remove this extra "virtual" and +2

INLINE COMMENTS
placesitemmodel.h:120
- void clear() override;
+ virtual void clear() override;
Remove virtual here as you already use override

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Elvis Angelaccio
2017-12-08 09:04:44 UTC
Permalink
elvisangelaccio accepted this revision.
elvisangelaccio added a comment.
This revision is now accepted and ready to land.


LGTM as well.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-08 16:57:34 UTC
Permalink
renatoo updated this revision to Diff 23661.
renatoo marked an inline comment as done.
renatoo added a comment.


Removed override in favor of override

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23569&id=23661

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/kitemviews/kfileitemmodel.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Renato Oliveira Filho
2017-12-08 17:06:39 UTC
Permalink
renatoo updated this revision to Diff 23662.
renatoo added a comment.


Rebase with master

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23661&id=23662

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/kitemviews/kfileitemmodel.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Nathaniel Graham
2017-12-13 14:38:16 UTC
Permalink
ngraham added a comment.


Wanna land this? :-)

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Phabricator
2017-12-14 12:40:45 UTC
Permalink
This revision was automatically updated to reflect the committed changes.
Closed by commit R318:da6f8fe08625: Use Kio::KPlacesModel as source model for PlacesItemModel (authored by Renato Araujo Oliveira Filho &lt;***@kdab.com&gt;).

REPOSITORY
R318 Dolphin

CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D8855?vs=23662&id=23902

REVISION DETAIL
https://phabricator.kde.org/D8855

AFFECTED FILES
CMakeLists.txt
src/dolphincontextmenu.cpp
src/kitemviews/kfileitemmodel.cpp
src/panels/places/placesitem.cpp
src/panels/places/placesitem.h
src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h
src/panels/places/placespanel.cpp
src/search/dolphinsearchbox.cpp
src/tests/placesitemmodeltest.cpp

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Mark Gaiser
2018-01-25 20:14:22 UTC
Permalink
markg reopened this revision.
markg added a comment.
This revision is now accepted and ready to land.


Hi,

I think this commit broke a test.
https://build.kde.org/job/Applications%20dolphin%20kf5-qt5%20SUSEQt5.9/17/testReport/(root)/TestSuite/placesitemmodeltest/

Could you take a look please?

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff
Cc: markg, mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Mark Gaiser
2018-01-28 13:12:40 UTC
Permalink
markg requested changes to this revision.
markg added a comment.
This revision now requires changes to proceed.


See previous message (i don't know why phabricator immediately marked it as accepted when re-opening).

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff, markg
Cc: markg, mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, #dolphin
Nathaniel Graham
2018-10-03 23:22:59 UTC
Permalink
ngraham added a task: T9795: Use Places Panel code from KIO instead of private implementation.
Herald added a project: Dolphin.
Herald edited subscribers, added: kfm-devel; removed: Dolphin.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: renatoo, elvisangelaccio, emmanuelp, mlaurent, mwolff, markg
Cc: kfm-devel, markg, mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, feverfew, spoorun, navarromorales, firef, andrebarros, emmanuelp, #dolphin
Nathaniel Graham
2018-11-08 20:29:02 UTC
Permalink
ngraham commandeered this revision.
ngraham added a reviewer: renatoo.
ngraham added a comment.


The test has since been fixed, but unfortunately there's no way to re-close this revision unless the original author (@renatoo) does that, or someone else commandeers and abandons it. Since @renatoo hasn't been active recently, I'll do the latter.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: ngraham, elvisangelaccio, emmanuelp, mlaurent, mwolff, markg, renatoo
Cc: kfm-devel, markg, mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, alexde, sourabhboss, feverfew, spoorun, navarromorales, firef, andrebarros, emmanuelp, mikesomov
Nathaniel Graham
2018-11-08 20:29:10 UTC
Permalink
ngraham abandoned this revision.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: ngraham, elvisangelaccio, emmanuelp, mlaurent, mwolff, markg, renatoo
Cc: kfm-devel, markg, mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, alexde, sourabhboss, feverfew, spoorun, navarromorales, firef, andrebarros, emmanuelp, mikesomov
Nathaniel Graham
2018-11-08 20:29:57 UTC
Permalink
ngraham added a comment.


I want to make clear that @renatoo was the original author, and this work was committed in da6f8fe0862585287153f0d90e19eab0b34bfbef <https://phabricator.kde.org/R318:da6f8fe0862585287153f0d90e19eab0b34bfbef>.

REPOSITORY
R318 Dolphin

REVISION DETAIL
https://phabricator.kde.org/D8855

To: ngraham, elvisangelaccio, emmanuelp, mlaurent, mwolff, markg, renatoo
Cc: kfm-devel, markg, mwolff, mlaurent, anthonyfieroni, nicolasfella, ngraham, alexde, sourabhboss, feverfew, spoorun, navarromorales, firef, andrebarros, emmanuelp, mikesomov
Loading...