27
28
//this is used to perfectly align the filter field and delegates
28
29
property int cellWidth: theme.defaultFont.mSize.width * 20
30
property int minimumWidth: cellWidth + (activityManager.orientation == Qt.Horizontal ? 0 : scrollBar.width)
31
property int minimumWidth: cellWidth + (
32
activityManager.orientation == Qt.Horizontal
34
: (scrollBar.width + 4 * 2) // 4 * 2 == left and right margins
31
36
property int minimumHeight: topBar.height + list.delegateHeight + (activityManager.orientation == Qt.Horizontal ? scrollBar.height : 0) + 4
190
196
PlasmaComponents.Button {
191
197
id: newActivityButton
192
202
iconSource: "list-add"
193
203
text: i18n("Create activity...")
194
204
onClicked: newActivityMenu.open()
196
PlasmaComponents.Button {
198
text: i18n("Add widgets")
199
onClicked: activityManager.addWidgetsRequested()
201
206
Component.onCompleted: {
202
207
topBar.newActivityButton = newActivityButton
210
property int delegateWidth: (activityManager.orientation == Qt.Horizontal) ? (list.width / Math.floor(list.width / cellWidth)) : cellWidth
211
property int delegateHeight: theme.defaultFont.mSize.height * 7 - 4
215
215
top: topBar.bottom
216
216
left: parent.left
217
right: activityManager.orientation == Qt.Horizontal ? parent.right : scrollBar.left
218
bottom: activityManager.orientation == Qt.Horizontal ? scrollBar.top : parent.bottom
217
right: activityManager.orientation == Qt.Horizontal
219
: (scrollBar.visible ? scrollBar.left : parent.right)
220
bottom: activityManager.orientation == Qt.Horizontal ? scrollBar.top : bottomBar.top
224
orientation: activityManager.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.vertical
225
snapMode: ListView.SnapToItem
226
model: PlasmaCore.SortFilterModel {
227
sourceModel: PlasmaCore.DataModel {
228
dataSource: activitySource
231
filterRegExp: ".*"+topBar.query+".*"
234
delegate: ActivityDelegate {}
225
//use this only if the wheel orientation is vertical and the list orientation is horizontal, otherwise will be the list itself managing the wheel
226
if (wheel.orientation == Qt.Vertical && list.orientation == ListView.Horizontal) {
227
var delta = wheel.delta > 0 ? 20 : -20
228
list.contentX = Math.min(Math.max(0, list.contentWidth - list.width),
229
Math.max(0, list.contentX - delta))
235
property int delegateWidth: (activityManager.orientation == Qt.Horizontal) ? (list.width / Math.floor(list.width / cellWidth)) : list.width
236
property int delegateHeight: theme.defaultFont.mSize.height * 7 - 4
241
orientation: activityManager.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.vertical
242
snapMode: ListView.SnapToItem
243
model: PlasmaCore.SortFilterModel {
244
sourceModel: PlasmaCore.DataModel {
245
dataSource: activitySource
248
filterRegExp: ".*"+topBar.query+".*"
250
clip: activityManager.orientation == Qt.Vertical
252
delegate: ActivityDelegate {}
236
255
PlasmaComponents.ScrollBar {
238
257
orientation: activityManager.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.Vertical
240
top: activityManager.orientation == Qt.Horizontal ? undefined : list.top
241
bottom: parent.bottom
259
top: activityManager.orientation == Qt.Horizontal ? undefined : listParent.top
260
bottom: activityManager.orientation == Qt.Horizontal ? parent.bottom : bottomBar.top
242
261
left: activityManager.orientation == Qt.Horizontal ? parent.left : undefined
243
262
right: parent.right
245
264
flickableItem: list
270
sourceComponent: (activityManager.orientation == Qt.Horizontal) ? undefined : verticalBottomBarComponent
275
bottom: parent.bottom
281
id: verticalBottomBarComponent
286
bottom: parent.bottom
291
PlasmaComponents.Button {
297
text: i18n("Add widgets")
298
onClicked: activityManager.addWidgetsRequested()