Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/package/contents/ui/DashboardRepresentation.qml
Show First 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 113 | mainItem: MouseArea { | |||
---|---|---|---|---|---|
119 | 119 | | |||
120 | LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft | 120 | LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft | ||
121 | LayoutMirroring.childrenInherit: true | 121 | LayoutMirroring.childrenInherit: true | ||
122 | 122 | | |||
123 | Connections { | 123 | Connections { | ||
124 | target: kicker | 124 | target: kicker | ||
125 | 125 | | |||
126 | onReset: { | 126 | onReset: { | ||
127 | if (!searching) { | 127 | if (!root.searching) { | ||
128 | filterList.applyFilter(); | 128 | filterList.applyFilter(); | ||
129 | 129 | | |||
130 | if (tabBar.activeTab == 0) { | 130 | if (tabBar.activeTab == 0) { | ||
131 | funnelModel.reset(); | 131 | funnelModel.reset(); | ||
132 | } | 132 | } | ||
133 | } | 133 | } | ||
134 | } | 134 | } | ||
135 | 135 | | |||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 205 | Timer { | |||
206 | id: preloadAllAppsTimer | 206 | id: preloadAllAppsTimer | ||
207 | 207 | | |||
208 | property bool done: false | 208 | property bool done: false | ||
209 | 209 | | |||
210 | interval: 1000 | 210 | interval: 1000 | ||
211 | repeat: false | 211 | repeat: false | ||
212 | 212 | | |||
213 | onTriggered: { | 213 | onTriggered: { | ||
214 | if (done || searching) { | 214 | if (done || root.searching) { | ||
215 | return; | 215 | return; | ||
216 | } | 216 | } | ||
217 | 217 | | |||
218 | for (var i = 0; i < rootModel.count; ++i) { | 218 | for (var i = 0; i < rootModel.count; ++i) { | ||
219 | var model = rootModel.modelForRow(i); | 219 | var model = rootModel.modelForRow(i); | ||
220 | 220 | | |||
221 | if (model.description === "KICKER_ALL_MODEL") { | 221 | if (model.description === "KICKER_ALL_MODEL") { | ||
222 | allAppsGrid.model = model; | 222 | allAppsGrid.model = model; | ||
Show All 19 Lines | 240 | DashboardTabBar { | |||
242 | 242 | | |||
243 | y: 0 | 243 | y: 0 | ||
244 | 244 | | |||
245 | anchors.horizontalCenter: parent.horizontalCenter | 245 | anchors.horizontalCenter: parent.horizontalCenter | ||
246 | 246 | | |||
247 | visible: (plasmoid.immutability !== PlasmaCore.Types.SystemImmutable) | 247 | visible: (plasmoid.immutability !== PlasmaCore.Types.SystemImmutable) | ||
248 | 248 | | |||
249 | onActiveTabChanged: { | 249 | onActiveTabChanged: { | ||
250 | updateWidgetExplorer(); | 250 | root.updateWidgetExplorer(); | ||
251 | reset(); | 251 | root.reset(); | ||
252 | } | 252 | } | ||
253 | 253 | | |||
254 | onHoveredTabChanged: updateWidgetExplorer() | 254 | onHoveredTabChanged: root.updateWidgetExplorer() | ||
255 | 255 | | |||
256 | Keys.onDownPressed: { | 256 | Keys.onDownPressed: { | ||
257 | mainColumn.tryActivate(0, 0); | 257 | mainColumn.tryActivate(0, 0); | ||
258 | } | 258 | } | ||
259 | } | 259 | } | ||
260 | 260 | | |||
261 | TextEdit { | 261 | TextEdit { | ||
262 | id: searchField | 262 | id: searchField | ||
263 | 263 | | |||
264 | width: 0 | 264 | width: 0 | ||
265 | height: 0 | 265 | height: 0 | ||
266 | 266 | | |||
267 | visible: false | 267 | visible: false | ||
268 | 268 | | |||
269 | persistentSelection: true | 269 | persistentSelection: true | ||
270 | 270 | | |||
271 | onTextChanged: { | 271 | onTextChanged: { | ||
272 | if (tabBar.activeTab == 0) { | 272 | if (tabBar.activeTab == 0) { | ||
273 | runnerModel.query = searchField.text; | 273 | runnerModel.query = searchField.text; | ||
274 | } else { | 274 | } else { | ||
275 | widgetExplorer.widgetsModel.searchTerm = searchField.text; | 275 | root.widgetExplorer.widgetsModel.searchTerm = searchField.text; | ||
276 | } | 276 | } | ||
277 | } | 277 | } | ||
278 | 278 | | |||
279 | function clear() { | 279 | function clear() { | ||
280 | text = ""; | 280 | text = ""; | ||
281 | } | 281 | } | ||
282 | 282 | | |||
283 | onSelectionStartChanged: Qt.callLater(searchHeading.updateSelection) | 283 | onSelectionStartChanged: Qt.callLater(searchHeading.updateSelection) | ||
284 | onSelectionEndChanged: Qt.callLater(searchHeading.updateSelection) | 284 | onSelectionEndChanged: Qt.callLater(searchHeading.updateSelection) | ||
285 | } | 285 | } | ||
286 | 286 | | |||
287 | TextEdit { | 287 | TextEdit { | ||
288 | id: searchHeading | 288 | id: searchHeading | ||
289 | 289 | | |||
290 | anchors { | 290 | anchors { | ||
291 | horizontalCenter: parent.horizontalCenter | 291 | horizontalCenter: parent.horizontalCenter | ||
292 | } | 292 | } | ||
293 | 293 | | |||
294 | y: (middleRow.anchors.topMargin / 2) - (smallScreen ? (height/10) : 0) | 294 | y: (middleRow.anchors.topMargin / 2) - (root.smallScreen ? (height/10) : 0) | ||
295 | 295 | | |||
296 | font.pointSize: dummyHeading.font.pointSize * 1.5 | 296 | font.pointSize: dummyHeading.font.pointSize * 1.5 | ||
297 | wrapMode: Text.NoWrap | 297 | wrapMode: Text.NoWrap | ||
298 | opacity: 1.0 | 298 | opacity: 1.0 | ||
299 | 299 | | |||
300 | selectByMouse: false | 300 | selectByMouse: false | ||
301 | cursorVisible: false | 301 | cursorVisible: false | ||
302 | 302 | | |||
303 | color: "white" | 303 | color: "white" | ||
304 | 304 | | |||
305 | text: searching ? i18n("Searching for '%1'", searchField.text) : i18n("Type to search...") | 305 | text: root.searching ? i18n("Searching for '%1'", searchField.text) : i18n("Type to search...") | ||
306 | 306 | | |||
307 | function updateSelection() { | 307 | function updateSelection() { | ||
308 | if (!searchField.selectedText) { | 308 | if (!searchField.selectedText) { | ||
309 | return; | 309 | return; | ||
310 | } | 310 | } | ||
311 | 311 | | |||
312 | var delta = text.lastIndexOf(searchField.text, text.length - 2); | 312 | var delta = text.lastIndexOf(searchField.text, text.length - 2); | ||
313 | searchHeading.select(searchField.selectionStart + delta, searchField.selectionEnd + delta); | 313 | searchHeading.select(searchField.selectionStart + delta, searchField.selectionEnd + delta); | ||
Show All 14 Lines | 317 | PlasmaComponents.ToolButton { | |||
328 | 328 | | |||
329 | visible: (searchField.text != "") | 329 | visible: (searchField.text != "") | ||
330 | 330 | | |||
331 | iconName: "dialog-close" | 331 | iconName: "dialog-close" | ||
332 | flat: false | 332 | flat: false | ||
333 | 333 | | |||
334 | onClicked: searchField.clear(); | 334 | onClicked: searchField.clear(); | ||
335 | 335 | | |||
336 | Keys.onPressed: { | 336 | Keys.onPressed: event => { | ||
337 | if (event.key === Qt.Key_Tab) { | 337 | if (event.key === Qt.Key_Tab) { | ||
338 | event.accepted = true; | 338 | event.accepted = true; | ||
339 | 339 | | |||
340 | if (runnerModel.count) { | 340 | if (runnerModel.count) { | ||
341 | mainColumn.tryActivate(0, 0); | 341 | mainColumn.tryActivate(0, 0); | ||
342 | } else { | 342 | } else { | ||
343 | systemFavoritesGrid.tryActivate(0, 0); | 343 | systemFavoritesGrid.tryActivate(0, 0); | ||
344 | } | 344 | } | ||
Show All 17 Lines | 359 | Row { | |||
362 | anchors { | 362 | anchors { | ||
363 | top: parent.top | 363 | top: parent.top | ||
364 | topMargin: units.gridUnit * (smallScreen ? 8 : 10) | 364 | topMargin: units.gridUnit * (smallScreen ? 8 : 10) | ||
365 | bottom: parent.bottom | 365 | bottom: parent.bottom | ||
366 | bottomMargin: (units.gridUnit * 2) | 366 | bottomMargin: (units.gridUnit * 2) | ||
367 | horizontalCenter: parent.horizontalCenter | 367 | horizontalCenter: parent.horizontalCenter | ||
368 | } | 368 | } | ||
369 | 369 | | |||
370 | width: (root.columns * cellSize) + (2 * spacing) | 370 | width: (root.columns * root.cellSize) + (2 * spacing) | ||
371 | 371 | | |||
372 | spacing: units.gridUnit * 2 | 372 | spacing: units.gridUnit * 2 | ||
373 | 373 | | |||
374 | Item { | 374 | Item { | ||
375 | id: favoritesColumn | 375 | id: favoritesColumn | ||
376 | 376 | | |||
377 | anchors { | 377 | anchors { | ||
378 | top: parent.top | 378 | top: parent.top | ||
379 | bottom: parent.bottom | 379 | bottom: parent.bottom | ||
380 | } | 380 | } | ||
381 | 381 | | |||
382 | width: (columns * cellSize) + units.gridUnit | 382 | width: (columns * root.cellSize) + units.gridUnit | ||
383 | 383 | | |||
384 | property int columns: 3 | 384 | property int columns: 3 | ||
385 | 385 | | |||
386 | PlasmaExtras.Heading { | 386 | PlasmaExtras.Heading { | ||
387 | id: favoritesColumnLabel | 387 | id: favoritesColumnLabel | ||
388 | 388 | | |||
389 | enabled: (tabBar.activeTab == 0) | 389 | enabled: (tabBar.activeTab == 0) | ||
390 | 390 | | |||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 432 | ItemGridView { | |||
435 | enabled: (tabBar.activeTab == 0) | 435 | enabled: (tabBar.activeTab == 0) | ||
436 | 436 | | |||
437 | anchors { | 437 | anchors { | ||
438 | top: favoritesColumnLabelUnderline.bottom | 438 | top: favoritesColumnLabelUnderline.bottom | ||
439 | topMargin: units.largeSpacing | 439 | topMargin: units.largeSpacing | ||
440 | } | 440 | } | ||
441 | 441 | | |||
442 | property int rows: (Math.floor((parent.height - favoritesColumnLabel.height | 442 | property int rows: (Math.floor((parent.height - favoritesColumnLabel.height | ||
443 | - favoritesColumnLabelUnderline.height - units.largeSpacing) / cellSize) | 443 | - favoritesColumnLabelUnderline.height - units.largeSpacing) / root.cellSize) | ||
444 | - systemFavoritesGrid.rows) | 444 | - systemFavoritesGrid.rows) | ||
445 | 445 | | |||
446 | width: parent.width | 446 | width: parent.width | ||
447 | height: rows * cellSize | 447 | height: rows * root.cellSize | ||
448 | 448 | | |||
449 | cellWidth: cellSize | 449 | cellWidth: root.cellSize | ||
450 | cellHeight: cellSize | 450 | cellHeight: root.cellSize | ||
451 | iconSize: root.iconSize | 451 | iconSize: root.iconSize | ||
452 | 452 | | |||
453 | model: globalFavorites | 453 | model: globalFavorites | ||
454 | 454 | | |||
455 | dropEnabled: true | 455 | dropEnabled: true | ||
456 | usesPlasmaTheme: false | 456 | usesPlasmaTheme: false | ||
457 | 457 | | |||
458 | opacity: (enabled ? 1.0 : 0.3) | 458 | opacity: (enabled ? 1.0 : 0.3) | ||
459 | 459 | | |||
460 | Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | 460 | Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | ||
461 | 461 | | |||
462 | onCurrentIndexChanged: { | 462 | onCurrentIndexChanged: { | ||
463 | preloadAllAppsTimer.defer(); | 463 | preloadAllAppsTimer.defer(); | ||
464 | } | 464 | } | ||
465 | 465 | | |||
466 | onKeyNavRight: { | 466 | onKeyNavRight: { | ||
467 | mainColumn.tryActivate(currentRow(), 0); | 467 | mainColumn.tryActivate(currentRow(), 0); | ||
468 | } | 468 | } | ||
469 | 469 | | |||
470 | onKeyNavDown: { | 470 | onKeyNavDown: { | ||
471 | systemFavoritesGrid.tryActivate(0, currentCol()); | 471 | systemFavoritesGrid.tryActivate(0, currentCol()); | ||
472 | } | 472 | } | ||
473 | 473 | | |||
474 | Keys.onPressed: { | 474 | Keys.onPressed: event => { | ||
475 | if (event.key === Qt.Key_Tab) { | 475 | if (event.key === Qt.Key_Tab) { | ||
476 | event.accepted = true; | 476 | event.accepted = true; | ||
477 | 477 | | |||
478 | if (tabBar.visible) { | 478 | if (tabBar.visible) { | ||
479 | tabBar.focus = true; | 479 | tabBar.focus = true; | ||
480 | } else if (searching) { | 480 | } else if (root.searching) { | ||
481 | cancelSearchButton.focus = true; | 481 | cancelSearchButton.focus = true; | ||
482 | } else { | 482 | } else { | ||
483 | mainColumn.tryActivate(0, 0); | 483 | mainColumn.tryActivate(0, 0); | ||
484 | } | 484 | } | ||
485 | } else if (event.key === Qt.Key_Backtab) { | 485 | } else if (event.key === Qt.Key_Backtab) { | ||
486 | event.accepted = true; | 486 | event.accepted = true; | ||
487 | systemFavoritesGrid.tryActivate(0, 0); | 487 | systemFavoritesGrid.tryActivate(0, 0); | ||
488 | } | 488 | } | ||
489 | } | 489 | } | ||
490 | 490 | | |||
491 | Binding { | 491 | Binding { | ||
492 | target: globalFavorites | 492 | target: globalFavorites | ||
493 | property: "iconSize" | 493 | property: "iconSize" | ||
494 | value: root.iconSize | 494 | value: root.iconSize | ||
495 | } | 495 | } | ||
496 | } | 496 | } | ||
497 | 497 | | |||
498 | ItemGridView { | 498 | ItemGridView { | ||
499 | id: systemFavoritesGrid | 499 | id: systemFavoritesGrid | ||
500 | 500 | | |||
501 | anchors { | 501 | anchors { | ||
502 | top: globalFavoritesGrid.bottom | 502 | top: globalFavoritesGrid.bottom | ||
503 | } | 503 | } | ||
504 | 504 | | |||
505 | property int rows: Math.ceil(count / Math.floor(width / cellSize)) | 505 | property int rows: Math.ceil(count / Math.floor(width / root.cellSize)) | ||
506 | 506 | | |||
507 | width: parent.width | 507 | width: parent.width | ||
508 | height: rows * cellSize | 508 | height: rows * root.cellSize | ||
509 | 509 | | |||
510 | cellWidth: cellSize | 510 | cellWidth: root.cellSize | ||
511 | cellHeight: cellSize | 511 | cellHeight: root.cellSize | ||
512 | iconSize: root.iconSize | 512 | iconSize: root.iconSize | ||
513 | 513 | | |||
514 | model: systemFavorites | 514 | model: systemFavorites | ||
515 | 515 | | |||
516 | dropEnabled: true | 516 | dropEnabled: true | ||
517 | usesPlasmaTheme: true | 517 | usesPlasmaTheme: true | ||
518 | 518 | | |||
519 | onCurrentIndexChanged: { | 519 | onCurrentIndexChanged: { | ||
520 | preloadAllAppsTimer.defer(); | 520 | preloadAllAppsTimer.defer(); | ||
521 | } | 521 | } | ||
522 | 522 | | |||
523 | onKeyNavRight: { | 523 | onKeyNavRight: { | ||
524 | mainColumn.tryActivate(globalFavoritesGrid.rows + currentRow(), 0); | 524 | mainColumn.tryActivate(globalFavoritesGrid.rows + currentRow(), 0); | ||
525 | } | 525 | } | ||
526 | 526 | | |||
527 | onKeyNavUp: { | 527 | onKeyNavUp: { | ||
528 | globalFavoritesGrid.tryActivate(globalFavoritesGrid.rows - 1, currentCol()); | 528 | globalFavoritesGrid.tryActivate(globalFavoritesGrid.rows - 1, currentCol()); | ||
529 | } | 529 | } | ||
530 | 530 | | |||
531 | Keys.onPressed: { | 531 | Keys.onPressed: event => { | ||
532 | if (event.key === Qt.Key_Tab) { | 532 | if (event.key === Qt.Key_Tab) { | ||
533 | event.accepted = true; | 533 | event.accepted = true; | ||
534 | 534 | | |||
535 | if (globalFavoritesGrid.enabled) { | 535 | if (globalFavoritesGrid.enabled) { | ||
536 | globalFavoritesGrid.tryActivate(0, 0); | 536 | globalFavoritesGrid.tryActivate(0, 0); | ||
537 | } else if (tabBar.visible) { | 537 | } else if (tabBar.visible) { | ||
538 | tabBar.focus = true; | 538 | tabBar.focus = true; | ||
539 | } else if (searching && !runnerModel.count) { | 539 | } else if (root.searching && !runnerModel.count) { | ||
540 | cancelSearchButton.focus = true; | 540 | cancelSearchButton.focus = true; | ||
541 | } else { | 541 | } else { | ||
542 | mainColumn.tryActivate(0, 0); | 542 | mainColumn.tryActivate(0, 0); | ||
543 | } | 543 | } | ||
544 | } else if (event.key === Qt.Key_Backtab) { | 544 | } else if (event.key === Qt.Key_Backtab) { | ||
545 | event.accepted = true; | 545 | event.accepted = true; | ||
546 | 546 | | |||
547 | if (filterList.enabled) { | 547 | if (filterList.enabled) { | ||
548 | filterList.forceActiveFocus(); | 548 | filterList.forceActiveFocus(); | ||
549 | } else if (searching && !runnerModel.count) { | 549 | } else if (root.searching && !runnerModel.count) { | ||
550 | cancelSearchButton.focus = true; | 550 | cancelSearchButton.focus = true; | ||
551 | } else { | 551 | } else { | ||
552 | mainColumn.tryActivate(0, 0); | 552 | mainColumn.tryActivate(0, 0); | ||
553 | } | 553 | } | ||
554 | } | 554 | } | ||
555 | } | 555 | } | ||
556 | } | 556 | } | ||
557 | } | 557 | } | ||
558 | 558 | | |||
559 | Item { | 559 | Item { | ||
560 | id: mainColumn | 560 | id: mainColumn | ||
561 | 561 | | |||
562 | anchors.top: parent.top | 562 | anchors.top: parent.top | ||
563 | 563 | | |||
564 | width: (columns * cellSize) + units.gridUnit | 564 | width: (columns * root.cellSize) + units.gridUnit | ||
565 | height: Math.floor(parent.height / cellSize) * cellSize + mainGridContainer.headerHeight | 565 | height: Math.floor(parent.height / root.cellSize) * root.cellSize + mainGridContainer.headerHeight | ||
566 | 566 | | |||
567 | property int columns: root.columns - favoritesColumn.columns - filterListColumn.columns | 567 | property int columns: root.columns - favoritesColumn.columns - filterListColumn.columns | ||
568 | property Item visibleGrid: mainGrid | 568 | property Item visibleGrid: mainGrid | ||
569 | 569 | | |||
570 | function tryActivate(row, col) { | 570 | function tryActivate(row, col) { | ||
571 | if (visibleGrid) { | 571 | if (visibleGrid) { | ||
572 | visibleGrid.tryActivate(row, col); | 572 | visibleGrid.tryActivate(row, col); | ||
573 | } | 573 | } | ||
574 | } | 574 | } | ||
575 | 575 | | |||
576 | Item { | 576 | Item { | ||
577 | id: mainGridContainer | 577 | id: mainGridContainer | ||
578 | 578 | | |||
579 | anchors.fill: parent | 579 | anchors.fill: parent | ||
580 | z: (opacity == 1.0) ? 1 : 0 | 580 | z: (opacity == 1.0) ? 1 : 0 | ||
581 | 581 | | |||
582 | enabled: (opacity == 1.0) ? 1 : 0 | 582 | enabled: (opacity == 1.0) ? 1 : 0 | ||
583 | 583 | | |||
584 | property int headerHeight: mainColumnLabel.height + mainColumnLabelUnderline.height + units.largeSpacing | 584 | property int headerHeight: mainColumnLabel.height + mainColumnLabelUnderline.height + units.largeSpacing | ||
585 | 585 | | |||
586 | opacity: { | 586 | opacity: { | ||
587 | if (tabBar.activeTab == 0 && searching) { | 587 | if (tabBar.activeTab == 0 && root.searching) { | ||
588 | return 0.0; | 588 | return 0.0; | ||
589 | } | 589 | } | ||
590 | 590 | | |||
591 | if (filterList.allApps) { | 591 | if (filterList.allApps) { | ||
592 | return 0.0; | 592 | return 0.0; | ||
593 | } | 593 | } | ||
594 | 594 | | |||
595 | return 1.0; | 595 | return 1.0; | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 641 | ItemGridView { | |||
644 | anchors { | 644 | anchors { | ||
645 | top: mainColumnLabelUnderline.bottom | 645 | top: mainColumnLabelUnderline.bottom | ||
646 | topMargin: units.largeSpacing | 646 | topMargin: units.largeSpacing | ||
647 | } | 647 | } | ||
648 | 648 | | |||
649 | width: parent.width | 649 | width: parent.width | ||
650 | height: systemFavoritesGrid.y + systemFavoritesGrid.height - mainGridContainer.headerHeight | 650 | height: systemFavoritesGrid.y + systemFavoritesGrid.height - mainGridContainer.headerHeight | ||
651 | 651 | | |||
652 | cellWidth: (tabBar.activeTab == 0 ? cellSize : cellSize * 2) | 652 | cellWidth: (tabBar.activeTab == 0 ? root.cellSize : root.cellSize * 2) | ||
653 | cellHeight: cellWidth | 653 | cellHeight: cellWidth | ||
654 | iconSize: (tabBar.activeTab == 0 ? root.iconSize : cellWidth - (units.largeSpacing * 2)) | 654 | iconSize: (tabBar.activeTab == 0 ? root.iconSize : cellWidth - (units.largeSpacing * 2)) | ||
655 | 655 | | |||
656 | model: funnelModel | 656 | model: funnelModel | ||
657 | 657 | | |||
658 | onCurrentIndexChanged: { | 658 | onCurrentIndexChanged: { | ||
659 | preloadAllAppsTimer.defer(); | 659 | preloadAllAppsTimer.defer(); | ||
660 | } | 660 | } | ||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 733 | ItemMultiGridView { | |||
742 | height: Math.min(implicitHeight, systemFavoritesGrid.y + systemFavoritesGrid.height) | 742 | height: Math.min(implicitHeight, systemFavoritesGrid.y + systemFavoritesGrid.height) | ||
743 | 743 | | |||
744 | enabled: (opacity == 1.0) ? 1 : 0 | 744 | enabled: (opacity == 1.0) ? 1 : 0 | ||
745 | 745 | | |||
746 | model: runnerModel | 746 | model: runnerModel | ||
747 | 747 | | |||
748 | grabFocus: true | 748 | grabFocus: true | ||
749 | 749 | | |||
750 | opacity: (tabBar.activeTab == 0 && searching) ? 1.0 : 0.0 | 750 | opacity: (tabBar.activeTab == 0 && root.searching) ? 1.0 : 0.0 | ||
751 | 751 | | |||
752 | onOpacityChanged: { | 752 | onOpacityChanged: { | ||
753 | if (opacity == 1.0) { | 753 | if (opacity == 1.0) { | ||
754 | mainColumn.visibleGrid = runnerGrid; | 754 | mainColumn.visibleGrid = runnerGrid; | ||
755 | } | 755 | } | ||
756 | } | 756 | } | ||
757 | 757 | | |||
758 | onKeyNavLeft: { | 758 | onKeyNavLeft: { | ||
759 | var row = 0; | 759 | var row = 0; | ||
760 | 760 | | |||
761 | for (var i = 0; i < subGridIndex; i++) { | 761 | for (var i = 0; i < subGridIndex; i++) { | ||
762 | row += subGridAt(i).lastRow() + 2; // Header counts as one. | 762 | row += subGridAt(i).lastRow() + 2; // Header counts as one. | ||
763 | } | 763 | } | ||
764 | 764 | | |||
765 | row += subGridAt(subGridIndex).currentRow(); | 765 | row += subGridAt(subGridIndex).currentRow(); | ||
766 | 766 | | |||
767 | var target = row + 1 > globalFavoritesGrid.rows ? systemFavoritesGrid : globalFavoritesGrid; | 767 | var target = row + 1 > globalFavoritesGrid.rows ? systemFavoritesGrid : globalFavoritesGrid; | ||
768 | var targetRow = row + 1 > globalFavoritesGrid.rows ? row - globalFavoritesGrid.rows : row; | 768 | var targetRow = row + 1 > globalFavoritesGrid.rows ? row - globalFavoritesGrid.rows : row; | ||
769 | target.tryActivate(targetRow, favoritesColumn.columns - 1); | 769 | target.tryActivate(targetRow, favoritesColumn.columns - 1); | ||
770 | } | 770 | } | ||
771 | } | 771 | } | ||
772 | 772 | | |||
773 | Keys.onPressed: { | 773 | Keys.onPressed: event => { | ||
774 | if (event.key === Qt.Key_Tab) { | 774 | if (event.key === Qt.Key_Tab) { | ||
775 | event.accepted = true; | 775 | event.accepted = true; | ||
776 | 776 | | |||
777 | if (filterList.enabled) { | 777 | if (filterList.enabled) { | ||
778 | filterList.forceActiveFocus(); | 778 | filterList.forceActiveFocus(); | ||
779 | } else { | 779 | } else { | ||
780 | systemFavoritesGrid.tryActivate(0, 0); | 780 | systemFavoritesGrid.tryActivate(0, 0); | ||
781 | } | 781 | } | ||
782 | } else if (event.key === Qt.Key_Backtab) { | 782 | } else if (event.key === Qt.Key_Backtab) { | ||
783 | event.accepted = true; | 783 | event.accepted = true; | ||
784 | 784 | | |||
785 | if (searching) { | 785 | if (root.searching) { | ||
786 | cancelSearchButton.focus = true; | 786 | cancelSearchButton.focus = true; | ||
787 | } else if (tabBar.visible) { | 787 | } else if (tabBar.visible) { | ||
788 | tabBar.focus = true; | 788 | tabBar.focus = true; | ||
789 | } else if (globalFavoritesGrid.enabled) { | 789 | } else if (globalFavoritesGrid.enabled) { | ||
790 | globalFavoritesGrid.tryActivate(0, 0); | 790 | globalFavoritesGrid.tryActivate(0, 0); | ||
791 | } else { | 791 | } else { | ||
792 | systemFavoritesGrid.tryActivate(0, 0); | 792 | systemFavoritesGrid.tryActivate(0, 0); | ||
793 | } | 793 | } | ||
794 | } | 794 | } | ||
795 | } | 795 | } | ||
796 | } | 796 | } | ||
797 | 797 | | |||
798 | Item { | 798 | Item { | ||
799 | id: filterListColumn | 799 | id: filterListColumn | ||
800 | 800 | | |||
801 | anchors { | 801 | anchors { | ||
802 | top: parent.top | 802 | top: parent.top | ||
803 | topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + units.largeSpacing | 803 | topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + units.largeSpacing | ||
804 | bottom: parent.bottom | 804 | bottom: parent.bottom | ||
805 | } | 805 | } | ||
806 | 806 | | |||
807 | width: columns * cellSize | 807 | width: columns * root.cellSize | ||
808 | 808 | | |||
809 | property int columns: 3 | 809 | property int columns: 3 | ||
810 | 810 | | |||
811 | PlasmaExtras.ScrollArea { | 811 | PlasmaExtras.ScrollArea { | ||
812 | id: filterListScrollArea | 812 | id: filterListScrollArea | ||
813 | 813 | | |||
814 | x: root.visible ? 0 : units.gridUnit | 814 | x: root.visible ? 0 : units.gridUnit | ||
815 | 815 | | |||
816 | Behavior on x { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | 816 | Behavior on x { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | ||
817 | 817 | | |||
818 | width: parent.width | 818 | width: parent.width | ||
819 | height: mainGrid.height | 819 | height: mainGrid.height | ||
820 | 820 | | |||
821 | enabled: !searching | 821 | enabled: !root.searching | ||
822 | 822 | | |||
823 | property alias currentIndex: filterList.currentIndex | 823 | property alias currentIndex: filterList.currentIndex | ||
824 | 824 | | |||
825 | opacity: root.visible ? (searching ? 0.30 : 1.0) : 0.3 | 825 | opacity: root.visible ? (root.searching ? 0.30 : 1.0) : 0.3 | ||
826 | 826 | | |||
827 | Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | 827 | Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | ||
828 | 828 | | |||
829 | verticalScrollBarPolicy: (opacity == 1.0) ? Qt.ScrollBarAsNeeded : Qt.ScrollBarAlwaysOff | 829 | verticalScrollBarPolicy: (opacity == 1.0) ? Qt.ScrollBarAsNeeded : Qt.ScrollBarAlwaysOff | ||
830 | 830 | | |||
831 | onEnabledChanged: { | 831 | onEnabledChanged: { | ||
832 | if (!enabled) { | 832 | if (!enabled) { | ||
833 | filterList.currentIndex = -1; | 833 | filterList.currentIndex = -1; | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 858 | delegate: MouseArea { | |||
881 | hoverEnabled: true | 881 | hoverEnabled: true | ||
882 | 882 | | |||
883 | onContainsMouseChanged: { | 883 | onContainsMouseChanged: { | ||
884 | if (!containsMouse) { | 884 | if (!containsMouse) { | ||
885 | updateCurrentItemTimer.stop(); | 885 | updateCurrentItemTimer.stop(); | ||
886 | } | 886 | } | ||
887 | } | 887 | } | ||
888 | 888 | | |||
889 | onPositionChanged: { // Lazy menu implementation. | 889 | onPositionChanged: mouse => { // Lazy menu implementation. | ||
890 | mouseCol = mouse.x; | 890 | mouseCol = mouse.x; | ||
891 | 891 | | |||
892 | if (justOpenedTimer.running || ListView.view.currentIndex === 0 || index === ListView.view.currentIndex) { | 892 | if (justOpenedTimer.running || ListView.view.currentIndex === 0 || index === ListView.view.currentIndex) { | ||
893 | updateCurrentItem(); | 893 | updateCurrentItem(); | ||
894 | } else if ((index == ListView.view.currentIndex - 1) && mouse.y < (height - 6) | 894 | } else if ((index == ListView.view.currentIndex - 1) && mouse.y < (height - 6) | ||
895 | || (index == ListView.view.currentIndex + 1) && mouse.y > 5) { | 895 | || (index == ListView.view.currentIndex + 1) && mouse.y > 5) { | ||
896 | 896 | | |||
897 | if (mouse.x > ListView.view.eligibleWidth - 5) { | 897 | if (mouse.x > ListView.view.eligibleWidth - 5) { | ||
898 | updateCurrentItem(); | 898 | updateCurrentItem(); | ||
899 | } | 899 | } | ||
900 | } else if (mouse.x > ListView.view.eligibleWidth) { | 900 | } else if (mouse.x > ListView.view.eligibleWidth) { | ||
901 | updateCurrentItem(); | 901 | updateCurrentItem(); | ||
902 | } | 902 | } | ||
903 | 903 | | |||
904 | updateCurrentItemTimer.restart(); | 904 | updateCurrentItemTimer.restart(); | ||
905 | } | 905 | } | ||
906 | 906 | | |||
907 | onPressed: { | 907 | onPressed: mouse => { | ||
908 | if (mouse.buttons & Qt.RightButton) { | 908 | if (mouse.buttons & Qt.RightButton) { | ||
909 | if (hasActionList) { | 909 | if (hasActionList) { | ||
910 | openActionMenu(item, mouse.x, mouse.y); | 910 | openActionMenu(item, mouse.x, mouse.y); | ||
911 | } | 911 | } | ||
912 | } | 912 | } | ||
913 | } | 913 | } | ||
914 | 914 | | |||
915 | onClicked: { | 915 | onClicked: mouse => { | ||
916 | if (mouse.button == Qt.LeftButton) { | 916 | if (mouse.button == Qt.LeftButton) { | ||
917 | updateCurrentItem(); | 917 | updateCurrentItem(); | ||
918 | } | 918 | } | ||
919 | } | 919 | } | ||
920 | 920 | | |||
921 | onAboutToShowActionMenu: { | 921 | onAboutToShowActionMenu: { | ||
922 | var actionList = hasActionList ? model.actionList : []; | 922 | var actionList = hasActionList ? model.actionList : []; | ||
923 | Tools.fillActionMenu(i18n, actionMenu, actionList, ListView.view.model.favoritesModel, model.favoriteId); | 923 | Tools.fillActionMenu(i18n, actionMenu, actionList, ListView.view.model.favoritesModel, model.favoriteId); | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 1004 | onCountChanged: { | |||
1007 | for (var i = 0; i < rootModel.count; ++i) { | 1007 | for (var i = 0; i < rootModel.count; ++i) { | ||
1008 | headingMetrics.text = rootModel.labelForRow(i); | 1008 | headingMetrics.text = rootModel.labelForRow(i); | ||
1009 | 1009 | | |||
1010 | if (headingMetrics.width > width) { | 1010 | if (headingMetrics.width > width) { | ||
1011 | width = headingMetrics.width; | 1011 | width = headingMetrics.width; | ||
1012 | } | 1012 | } | ||
1013 | } | 1013 | } | ||
1014 | 1014 | | |||
1015 | filterListColumn.columns = Math.ceil(width / cellSize); | 1015 | filterListColumn.columns = Math.ceil(width / root.cellSize); | ||
1016 | filterListScrollArea.width = width + hItemMargins + (units.gridUnit * 2); | 1016 | filterListScrollArea.width = width + hItemMargins + (units.gridUnit * 2); | ||
1017 | } | 1017 | } | ||
1018 | 1018 | | |||
1019 | function applyFilter() { | 1019 | function applyFilter() { | ||
1020 | if (!searching && currentIndex >= 0) { | 1020 | if (!root.searching && currentIndex >= 0) { | ||
1021 | if (tabBar.activeTab == 1) { | 1021 | if (tabBar.activeTab == 1) { | ||
1022 | root.widgetExplorer.widgetsModel.filterQuery = currentItem.m.filterData; | 1022 | root.widgetExplorer.widgetsModel.filterQuery = currentItem.m.filterData; | ||
1023 | root.widgetExplorer.widgetsModel.filterType = currentItem.m.filterType; | 1023 | root.widgetExplorer.widgetsModel.filterType = currentItem.m.filterType; | ||
1024 | 1024 | | |||
1025 | allApps = false; | 1025 | allApps = false; | ||
1026 | funnelModel.sourceModel = model; | 1026 | funnelModel.sourceModel = model; | ||
1027 | 1027 | | |||
1028 | return; | 1028 | return; | ||
Show All 15 Lines | 1042 | } else { | |||
1044 | allApps = false; | 1044 | allApps = false; | ||
1045 | } | 1045 | } | ||
1046 | } else { | 1046 | } else { | ||
1047 | funnelModel.sourceModel = null; | 1047 | funnelModel.sourceModel = null; | ||
1048 | allApps = false; | 1048 | allApps = false; | ||
1049 | } | 1049 | } | ||
1050 | } | 1050 | } | ||
1051 | 1051 | | |||
1052 | Keys.onPressed: { | 1052 | Keys.onPressed: event => { | ||
1053 | if (event.key === Qt.Key_Left) { | 1053 | if (event.key === Qt.Key_Left) { | ||
1054 | event.accepted = true; | 1054 | event.accepted = true; | ||
1055 | 1055 | | |||
1056 | var currentRow = Math.max(0, Math.ceil(currentItem.y / mainGrid.cellHeight) - 1); | 1056 | var currentRow = Math.max(0, Math.ceil(currentItem.y / mainGrid.cellHeight) - 1); | ||
1057 | mainColumn.tryActivate(currentRow, mainColumn.columns - 1); | 1057 | mainColumn.tryActivate(currentRow, mainColumn.columns - 1); | ||
1058 | } else if (event.key === Qt.Key_Tab) { | 1058 | } else if (event.key === Qt.Key_Tab) { | ||
1059 | event.accepted = true; | 1059 | event.accepted = true; | ||
1060 | systemFavoritesGrid.tryActivate(0, 0); | 1060 | systemFavoritesGrid.tryActivate(0, 0); | ||
1061 | } else if (event.key === Qt.Key_Backtab) { | 1061 | } else if (event.key === Qt.Key_Backtab) { | ||
1062 | event.accepted = true; | 1062 | event.accepted = true; | ||
1063 | mainColumn.tryActivate(0, 0); | 1063 | mainColumn.tryActivate(0, 0); | ||
1064 | } | 1064 | } | ||
1065 | } | 1065 | } | ||
1066 | } | 1066 | } | ||
1067 | } | 1067 | } | ||
1068 | } | 1068 | } | ||
1069 | } | 1069 | } | ||
1070 | 1070 | | |||
1071 | onPressed: { | 1071 | onPressed: mouse => { | ||
1072 | if (mouse.button == Qt.RightButton) { | 1072 | if (mouse.button == Qt.RightButton) { | ||
1073 | contextMenu.open(mouse.x, mouse.y); | 1073 | contextMenu.open(mouse.x, mouse.y); | ||
1074 | } | 1074 | } | ||
1075 | } | 1075 | } | ||
1076 | 1076 | | |||
1077 | onClicked: { | 1077 | onClicked: mouse => { | ||
1078 | if (mouse.button == Qt.LeftButton) { | 1078 | if (mouse.button == Qt.LeftButton) { | ||
1079 | root.toggle(); | 1079 | root.toggle(); | ||
1080 | } | 1080 | } | ||
1081 | } | 1081 | } | ||
1082 | } | 1082 | } | ||
1083 | } | 1083 | } |