2015-02-25 18:26:04 +00:00
|
|
|
/*
|
2019-09-04 16:39:31 +00:00
|
|
|
* Copyright 2019 Marco Martin <mart@kde.org>
|
2015-02-25 18:26:04 +00:00
|
|
|
*
|
2019-09-04 16:39:31 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2 or
|
|
|
|
|
* (at your option) any later version.
|
2015-02-25 18:26:04 +00:00
|
|
|
*
|
2019-09-04 16:39:31 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Library General Public License for more details
|
2015-02-25 18:26:04 +00:00
|
|
|
*
|
2019-09-04 16:39:31 +00:00
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2015-02-25 18:26:04 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
import QtQuick 2.12
|
2020-07-22 15:17:10 +00:00
|
|
|
import QtQuick.Window 2.12
|
2015-02-25 18:38:34 +00:00
|
|
|
import QtQuick.Layouts 1.1
|
2019-09-04 16:39:31 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
2015-02-25 18:26:04 +00:00
|
|
|
|
|
|
|
|
import org.kde.plasma.plasmoid 2.0
|
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2019-09-04 16:39:31 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
|
|
|
|
import org.kde.draganddrop 2.0 as DragDrop
|
2015-02-25 18:26:04 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
import "launcher" as Launcher
|
|
|
|
|
|
|
|
|
|
import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager
|
|
|
|
|
|
|
|
|
|
import org.kde.phone.homescreen 1.0
|
2015-03-11 10:50:00 +00:00
|
|
|
|
2020-07-22 15:17:10 +00:00
|
|
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
|
|
|
|
|
2015-06-19 20:03:02 +00:00
|
|
|
Item {
|
2015-02-25 18:26:04 +00:00
|
|
|
id: root
|
2019-09-04 16:39:31 +00:00
|
|
|
width: 640
|
|
|
|
|
height: 480
|
2015-02-25 18:26:04 +00:00
|
|
|
|
|
|
|
|
property Item toolBox
|
|
|
|
|
|
2015-06-20 23:08:46 +00:00
|
|
|
//BEGIN functions
|
|
|
|
|
//Autoscroll related functions
|
2021-02-15 10:44:48 +00:00
|
|
|
function scrollLeft() {
|
|
|
|
|
if (mainFlickable.atXBeginning) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
autoScrollTimer.scrollRight = false;
|
2015-06-20 23:08:46 +00:00
|
|
|
autoScrollTimer.running = true;
|
2021-02-15 10:44:48 +00:00
|
|
|
scrollLeftIndicator.opacity = 1;
|
|
|
|
|
scrollRightIndicator.opacity = 0;
|
2015-06-20 23:08:46 +00:00
|
|
|
}
|
|
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
function scrollRight() {
|
|
|
|
|
if (mainFlickable.atXEnd) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
autoScrollTimer.scrollRight = true;
|
2015-06-20 23:08:46 +00:00
|
|
|
autoScrollTimer.running = true;
|
2021-02-15 10:44:48 +00:00
|
|
|
scrollLeftIndicator.opacity = 0;
|
|
|
|
|
scrollRightIndicator.opacity = 1;
|
2015-06-20 23:08:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function stopScroll() {
|
|
|
|
|
autoScrollTimer.running = false;
|
2021-02-15 10:44:48 +00:00
|
|
|
scrollLeftIndicator.opacity = 0;
|
|
|
|
|
scrollRightIndicator.opacity = 0;
|
2015-06-20 23:08:46 +00:00
|
|
|
}
|
2015-07-09 11:29:26 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
function recalculateMaxFavoriteCount() {
|
|
|
|
|
if (!componentComplete) {
|
|
|
|
|
return;
|
2015-10-15 13:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
plasmoid.nativeInterface.applicationListModel.maxFavoriteCount = Math.max(4, Math.floor(Math.min(width, height) / appletsLayout.cellWidth));
|
2015-06-20 23:08:46 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
//END functions
|
2015-06-20 23:08:46 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
property bool componentComplete: false
|
|
|
|
|
onWidthChanged: recalculateMaxFavoriteCount()
|
|
|
|
|
onHeightChanged:recalculateMaxFavoriteCount()
|
|
|
|
|
Component.onCompleted: {
|
2020-07-22 15:17:10 +00:00
|
|
|
if (plasmoid.screen == 0) {
|
|
|
|
|
MobileShell.HomeScreenControls.homeScreen = root
|
|
|
|
|
MobileShell.HomeScreenControls.homeScreenWindow = root.Window.window
|
|
|
|
|
}
|
2019-09-04 16:39:31 +00:00
|
|
|
componentComplete = true;
|
|
|
|
|
recalculateMaxFavoriteCount()
|
2015-03-05 12:37:39 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-22 15:17:10 +00:00
|
|
|
Plasmoid.onScreenChanged: {
|
|
|
|
|
if (plasmoid.screen == 0) {
|
|
|
|
|
MobileShell.HomeScreenControls.homeScreen = root
|
|
|
|
|
MobileShell.HomeScreenControls.homeScreenWindow = root.Window.window
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Window.onWindowChanged: {
|
|
|
|
|
if (plasmoid.screen == 0) {
|
|
|
|
|
MobileShell.HomeScreenControls.homeScreenWindow = root.Window.window
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Connections {
|
2021-02-15 10:44:48 +00:00
|
|
|
property real lastRequestedPosition: 0
|
2020-07-22 15:17:10 +00:00
|
|
|
target: MobileShell.HomeScreenControls
|
|
|
|
|
function onResetHomeScreenPosition() {
|
|
|
|
|
scrollAnim.to = 0;
|
|
|
|
|
scrollAnim.restart();
|
2021-02-15 10:44:48 +00:00
|
|
|
appDrawer.close();
|
2020-07-22 15:17:10 +00:00
|
|
|
}
|
2020-07-23 15:09:37 +00:00
|
|
|
function onSnapHomeScreenPosition() {
|
2021-02-15 10:44:48 +00:00
|
|
|
if (lastRequestedPosition > 0) {
|
|
|
|
|
appDrawer.open();
|
|
|
|
|
} else {
|
|
|
|
|
appDrawer.close();
|
|
|
|
|
}
|
2020-07-23 15:09:37 +00:00
|
|
|
}
|
|
|
|
|
function onRequestHomeScreenPosition(y) {
|
2021-02-15 10:44:48 +00:00
|
|
|
appDrawer.offset += y;
|
|
|
|
|
lastRequestedPosition = y;
|
2020-07-23 15:09:37 +00:00
|
|
|
}
|
2020-07-22 15:17:10 +00:00
|
|
|
}
|
|
|
|
|
|
2015-03-05 20:12:23 +00:00
|
|
|
Timer {
|
|
|
|
|
id: autoScrollTimer
|
2021-02-15 10:44:48 +00:00
|
|
|
property bool scrollRight: true
|
2015-03-05 20:12:23 +00:00
|
|
|
repeat: true
|
2015-04-11 09:26:55 +00:00
|
|
|
interval: 1500
|
|
|
|
|
onTriggered: {
|
2021-02-15 10:44:48 +00:00
|
|
|
scrollAnim.to = scrollRight ?
|
|
|
|
|
//Scroll Right
|
|
|
|
|
Math.min(mainFlickable.contentItem.width - mainFlickable.width, mainFlickable.contentX + mainFlickable.width) :
|
|
|
|
|
//Scroll Left
|
|
|
|
|
Math.max(0, mainFlickable.contentX - mainFlickable.width);
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2015-04-11 09:26:55 +00:00
|
|
|
scrollAnim.running = true;
|
2015-03-05 20:12:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-02-25 18:26:04 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
Connections {
|
|
|
|
|
target: plasmoid
|
|
|
|
|
onEditModeChanged: {
|
|
|
|
|
appletsLayout.editMode = plasmoid.editMode
|
2015-02-25 18:26:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
Launcher.LauncherDragManager {
|
|
|
|
|
id: launcherDragManager
|
2015-02-25 18:26:04 +00:00
|
|
|
anchors.fill: parent
|
2019-09-04 16:39:31 +00:00
|
|
|
z: 2
|
|
|
|
|
appletsLayout: appletsLayout
|
|
|
|
|
favoriteStrip: favoriteStrip
|
|
|
|
|
}
|
2015-07-08 16:30:15 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
//TODO: this flickable does nothing for now, will be used for horizontal paging
|
2019-09-04 16:39:31 +00:00
|
|
|
Flickable {
|
|
|
|
|
id: mainFlickable
|
2021-02-15 10:44:48 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
anchors {
|
|
|
|
|
fill: parent
|
2021-02-15 10:44:48 +00:00
|
|
|
topMargin: plasmoid.availableScreenRect.y
|
2020-02-06 20:21:08 +00:00
|
|
|
bottomMargin: favoriteStrip.height + plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y
|
2015-03-18 14:45:48 +00:00
|
|
|
}
|
2020-08-13 09:17:06 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
opacity: 1 - appDrawer.openFactor
|
|
|
|
|
transform: Translate {
|
|
|
|
|
y: -mainFlickable.height/10 * appDrawer.openFactor
|
|
|
|
|
}
|
|
|
|
|
scale: (3 - appDrawer.openFactor) /3
|
|
|
|
|
|
2020-02-06 15:56:02 +00:00
|
|
|
//bottomMargin: favoriteStrip.height
|
2021-02-15 10:44:48 +00:00
|
|
|
contentWidth: appletsLayout.width
|
|
|
|
|
contentHeight: height
|
2019-09-04 16:39:31 +00:00
|
|
|
interactive: !plasmoid.editMode && !launcherDragManager.active
|
|
|
|
|
|
2020-02-07 12:48:34 +00:00
|
|
|
signal cancelEditModeForItemsRequested
|
|
|
|
|
onDragStarted: cancelEditModeForItemsRequested()
|
|
|
|
|
onDragEnded: cancelEditModeForItemsRequested()
|
|
|
|
|
onFlickStarted: cancelEditModeForItemsRequested()
|
|
|
|
|
onFlickEnded: cancelEditModeForItemsRequested()
|
|
|
|
|
|
2020-07-23 15:09:37 +00:00
|
|
|
onContentYChanged: MobileShell.HomeScreenControls.homeScreenPosition = contentY
|
|
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
DragHandler {
|
|
|
|
|
target: mainFlickable
|
|
|
|
|
yAxis.enabled: !appletsLayout.editMode
|
2021-02-22 13:59:15 +00:00
|
|
|
enabled: root.focus && appDrawer.status !== Launcher.AppDrawer.Status.Open
|
2021-02-15 10:44:48 +00:00
|
|
|
onTranslationChanged: {
|
|
|
|
|
if (active) {
|
|
|
|
|
appDrawer.offset = -translation.y
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
onActiveChanged: {
|
|
|
|
|
if (!active) {
|
|
|
|
|
appDrawer.snapDrawerStatus();
|
|
|
|
|
}
|
2020-08-13 09:52:53 +00:00
|
|
|
}
|
2015-04-11 09:26:55 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
NumberAnimation {
|
|
|
|
|
id: scrollAnim
|
|
|
|
|
target: mainFlickable
|
2021-02-15 10:44:48 +00:00
|
|
|
properties: "contentX"
|
2019-09-04 16:39:31 +00:00
|
|
|
duration: units.longDuration
|
|
|
|
|
easing.type: Easing.InOutQuad
|
2015-04-11 09:26:55 +00:00
|
|
|
}
|
2015-06-19 20:03:02 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
|
|
|
|
|
// TODO: span on multiple pages
|
|
|
|
|
DragDrop.DropArea {
|
|
|
|
|
id: dropArea
|
2019-09-04 16:39:31 +00:00
|
|
|
width: mainFlickable.width
|
2021-02-15 10:44:48 +00:00
|
|
|
height: mainFlickable.height + favoriteStrip.height
|
2015-04-11 09:26:55 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
onDragEnter: {
|
|
|
|
|
event.accept(event.proposedAction);
|
2021-02-16 12:37:50 +00:00
|
|
|
launcherDragManager.active = true;
|
2020-07-23 15:12:19 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
onDragMove: {
|
|
|
|
|
let posInFavorites = favoriteStrip.mapFromItem(this, event.x, event.y);
|
|
|
|
|
if (posInFavorites.y > 0) {
|
2021-02-16 12:37:50 +00:00
|
|
|
if (plasmoid.nativeInterface.applicationListModel.favoriteCount >= plasmoid.nativeInterface.applicationListModel.maxFavoriteCount ) {
|
|
|
|
|
launcherDragManager.hideSpacer();
|
|
|
|
|
} else {
|
|
|
|
|
launcherDragManager.showSpacerAtPos(event.x, event.y, favoriteStrip);
|
|
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
appletsLayout.hidePlaceHolder();
|
|
|
|
|
} else {
|
2019-09-04 16:39:31 +00:00
|
|
|
appletsLayout.showPlaceHolderAt(
|
|
|
|
|
Qt.rect(event.x - appletsLayout.defaultItemWidth / 2,
|
|
|
|
|
event.y - appletsLayout.defaultItemHeight / 2,
|
|
|
|
|
appletsLayout.defaultItemWidth,
|
|
|
|
|
appletsLayout.defaultItemHeight)
|
|
|
|
|
);
|
2021-02-15 10:44:48 +00:00
|
|
|
launcherDragManager.hideSpacer();
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
}
|
2015-04-10 21:59:52 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
onDragLeave: {
|
|
|
|
|
appletsLayout.hidePlaceHolder();
|
2021-02-16 12:37:50 +00:00
|
|
|
launcherDragManager.active = false;
|
2021-02-15 10:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
preventStealing: true
|
|
|
|
|
|
|
|
|
|
onDrop: {
|
2021-02-16 12:37:50 +00:00
|
|
|
launcherDragManager.active = false;
|
2021-02-15 10:44:48 +00:00
|
|
|
if (event.mimeData.formats[0] === "text/x-plasma-phone-homescreen-launcher") {
|
|
|
|
|
let storageId = event.mimeData.getDataAsByteArray("text/x-plasma-phone-homescreen-launcher");
|
|
|
|
|
|
|
|
|
|
let posInFavorites = favoriteStrip.flow.mapFromItem(this, event.x, event.y);
|
|
|
|
|
if (posInFavorites.y > 0) {
|
2021-02-16 12:37:50 +00:00
|
|
|
if (plasmoid.nativeInterface.applicationListModel.favoriteCount >= plasmoid.nativeInterface.applicationListModel.maxFavoriteCount ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
plasmoid.nativeInterface.applicationListModel.addFavorite(storageId, 0, ApplicationListModel.Favorites)
|
|
|
|
|
let item = launcherRepeater.itemAt(0);
|
|
|
|
|
|
|
|
|
|
if (item) {
|
|
|
|
|
item.x = posInFavorites.x;
|
|
|
|
|
item.y = 0//posInFavorites.y;
|
|
|
|
|
|
|
|
|
|
//launcherDragManager.showSpacer(item, item.width/2, item.height/2);
|
|
|
|
|
launcherDragManager.dropItem(item, item.width/2, item.height/2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
2019-09-04 16:39:31 +00:00
|
|
|
|
|
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
plasmoid.nativeInterface.applicationListModel.addFavorite(storageId, 0, ApplicationListModel.Desktop)
|
|
|
|
|
let item = launcherRepeater.itemAt(0);
|
|
|
|
|
|
|
|
|
|
event.accept(event.proposedAction);
|
|
|
|
|
if (item) {
|
|
|
|
|
item.x = appletsLayout.placeHolder.x;
|
|
|
|
|
item.y = appletsLayout.placeHolder.y;
|
|
|
|
|
appletsLayout.hidePlaceHolder();
|
|
|
|
|
launcherDragManager.dropItem(item, appletsLayout.placeHolder.x + appletsLayout.placeHolder.width/2, appletsLayout.placeHolder.y + appletsLayout.placeHolder.height/2);
|
|
|
|
|
}
|
|
|
|
|
appletsLayout.hidePlaceHolder();
|
|
|
|
|
} else {
|
2019-09-04 16:39:31 +00:00
|
|
|
plasmoid.processMimeData(event.mimeData,
|
|
|
|
|
event.x - appletsLayout.placeHolder.width / 2, event.y - appletsLayout.placeHolder.height / 2);
|
|
|
|
|
event.accept(event.proposedAction);
|
|
|
|
|
appletsLayout.hidePlaceHolder();
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PlasmaCore.Svg {
|
|
|
|
|
id: arrowsSvg
|
|
|
|
|
imagePath: "widgets/arrows"
|
|
|
|
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContainmentLayoutManager.AppletsLayout {
|
|
|
|
|
id: appletsLayout
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
anchors {
|
|
|
|
|
fill: parent
|
|
|
|
|
bottomMargin: favoriteStrip.height
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
|
|
|
|
|
signal appletsLayoutInteracted
|
|
|
|
|
|
|
|
|
|
TapHandler {
|
|
|
|
|
target: mainFlickable
|
|
|
|
|
enabled: appDrawer.status !== Launcher.AppDrawer.Status.Open
|
|
|
|
|
onTapped: {
|
|
|
|
|
//Hides icons close button
|
|
|
|
|
appletsLayout.appletsLayoutInteracted();
|
|
|
|
|
appletsLayout.editMode = false;
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
onLongPressed: appletsLayout.editMode = true;
|
2021-02-22 13:59:15 +00:00
|
|
|
onPressedChanged: root.focus = true;
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2015-02-25 18:38:34 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
cellWidth: favoriteStrip.cellWidth
|
|
|
|
|
cellHeight: Math.floor(height / Math.floor(height / favoriteStrip.cellHeight))
|
2015-03-05 15:53:58 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
configKey: width > height ? "ItemGeometriesHorizontal" : "ItemGeometriesVertical"
|
|
|
|
|
containment: plasmoid
|
|
|
|
|
editModeCondition: plasmoid.immutable
|
|
|
|
|
? ContainmentLayoutManager.AppletsLayout.Manual
|
|
|
|
|
: ContainmentLayoutManager.AppletsLayout.AfterPressAndHold
|
2015-03-11 12:10:43 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
// Sets the containment in edit mode when we go in edit mode as well
|
|
|
|
|
onEditModeChanged: plasmoid.editMode = editMode
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
minimumItemWidth: units.gridUnit * 3
|
|
|
|
|
minimumItemHeight: minimumItemWidth
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
defaultItemWidth: units.gridUnit * 6
|
|
|
|
|
defaultItemHeight: defaultItemWidth
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
acceptsAppletCallback: function(applet, x, y) {
|
|
|
|
|
print("Applet: "+applet+" "+x+" "+y)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
appletContainerComponent: ContainmentLayoutManager.BasicAppletContainer {
|
|
|
|
|
id: appletContainer
|
|
|
|
|
configOverlayComponent: ConfigOverlay {}
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
onEditModeChanged: {
|
|
|
|
|
launcherDragManager.active = dragActive || editMode;
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
onDragActiveChanged: {
|
|
|
|
|
launcherDragManager.active = dragActive || editMode;
|
2015-04-11 10:59:52 +00:00
|
|
|
}
|
2015-06-19 20:03:02 +00:00
|
|
|
}
|
2015-03-13 13:58:18 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
placeHolder: ContainmentLayoutManager.PlaceHolder {}
|
|
|
|
|
//FIXME: move
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
|
id: metrics
|
|
|
|
|
text: "M\nM"
|
|
|
|
|
visible: false
|
|
|
|
|
font.pointSize: theme.defaultFont.pointSize * 0.9
|
|
|
|
|
}
|
|
|
|
|
Launcher.LauncherRepeater {
|
|
|
|
|
id: launcherRepeater
|
|
|
|
|
cellWidth: appletsLayout.cellWidth
|
|
|
|
|
cellHeight: appletsLayout.cellHeight
|
|
|
|
|
appletsLayout: appletsLayout
|
|
|
|
|
favoriteStrip: favoriteStrip
|
2020-07-16 12:51:58 +00:00
|
|
|
}
|
2015-03-05 16:28:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-02-25 18:26:04 +00:00
|
|
|
}
|
2019-09-04 16:39:31 +00:00
|
|
|
|
2021-02-15 10:44:48 +00:00
|
|
|
Launcher.AppDrawer {
|
|
|
|
|
id: appDrawer
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
topPadding: plasmoid.availableScreenRect.y
|
|
|
|
|
bottomPadding: favoriteStrip.height + plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
ScrollIndicator {
|
2021-02-15 10:44:48 +00:00
|
|
|
id: scrollLeftIndicator
|
2019-09-04 16:39:31 +00:00
|
|
|
anchors {
|
2021-02-15 10:44:48 +00:00
|
|
|
left: parent.left
|
|
|
|
|
leftMargin: units.smallSpacing
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
elementId: "left-arrow"
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
ScrollIndicator {
|
|
|
|
|
id: scrollRightIndicator
|
2020-02-06 15:56:02 +00:00
|
|
|
anchors {
|
|
|
|
|
right: parent.right
|
2021-02-15 10:44:48 +00:00
|
|
|
rightMargin: units.smallSpacing
|
2020-02-06 15:56:02 +00:00
|
|
|
}
|
2021-02-15 10:44:48 +00:00
|
|
|
elementId: "right-arrow"
|
2020-02-06 15:56:02 +00:00
|
|
|
}
|
2020-02-08 10:30:28 +00:00
|
|
|
|
2019-09-04 16:39:31 +00:00
|
|
|
Launcher.FavoriteStrip {
|
|
|
|
|
id: favoriteStrip
|
|
|
|
|
anchors {
|
|
|
|
|
left: parent.left
|
|
|
|
|
right: parent.right
|
|
|
|
|
bottom: parent.bottom
|
|
|
|
|
bottomMargin: plasmoid.screenGeometry.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y
|
|
|
|
|
}
|
|
|
|
|
appletsLayout: appletsLayout
|
2021-02-15 10:44:48 +00:00
|
|
|
|
|
|
|
|
DragHandler {
|
|
|
|
|
target: favoriteStrip
|
|
|
|
|
yAxis.enabled: !appletsLayout.editMode
|
2021-02-22 13:59:15 +00:00
|
|
|
enabled: root.focus && appDrawer.status !== Launcher.AppDrawer.Status.Open
|
2021-02-15 10:44:48 +00:00
|
|
|
onTranslationChanged: {
|
|
|
|
|
if (active) {
|
|
|
|
|
appDrawer.offset = -translation.y
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onActiveChanged: {
|
|
|
|
|
if (!active) {
|
|
|
|
|
appDrawer.snapDrawerStatus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TapHandler {
|
|
|
|
|
target: favoriteStrip
|
|
|
|
|
onTapped: {
|
|
|
|
|
//Hides icons close button
|
|
|
|
|
appletsLayout.appletsLayoutInteracted();
|
|
|
|
|
appletsLayout.editMode = false;
|
|
|
|
|
}
|
|
|
|
|
onLongPressed: appletsLayout.editMode = true;
|
2021-02-22 13:59:15 +00:00
|
|
|
onPressedChanged: root.focus = true;
|
2021-02-15 10:44:48 +00:00
|
|
|
}
|
2019-09-04 16:39:31 +00:00
|
|
|
}
|
2015-06-20 21:45:19 +00:00
|
|
|
}
|
2019-09-04 16:39:31 +00:00
|
|
|
|