Making Spaces Bar Work - GSoC'22 post #5

⌂ home      ⇧ one level up
Mon Jun 27, 2022 · 291 words · 2 min

During past few days, I have worked on adding functionality to the Space bar. In my last post I described how I got the UI finally working. The next milestone is to have rooms filtered based on the Space user clicks on.

The /hierarchy call was recently added in libQuotient 0.7. This gives a list of all rooms that are children of a given Space.

link to spec

Since the fitering of room list happens in class SortFilterRoomListModel, I added a function in there, named setActiveSpaceRooms. What this function does is to take a Space id as parameter and find all rooms which are children of given Space, via the /hierarchy api call. Once the list of rooms have been found, their id are stored in a QVector, named m_activeSpaceRooms. Then I updated SortFilterRoomListModel::filterAcceptsRow to filter rows based on the value of this vector. If vector is empty, it shows all rooms, filtered on search query (i.e. the original behaviour). If m_activeSpaceRooms vector is not empty, then the id of rooms there are used to filter out rooms from model, along with search terms (if any).

The header of list view has a row layout, with two elements - a home button and a list of Spaces. Home button resets the Space filter and shows all rooms like it does normally. Clicking on a Space icon filters out to show only those rooms which belong to the Space.

Here are two screenshots of NeoChat, with the filtering feature in action.

NeoChat filtering based on a Space

NeoChat filtering based on a Space

I'll be making some improvements here and there and cleaning the code.


hire me! · blog · about · resume · github · kde invent · endeavour · email · home

🪻🌼