diff --git a/containments/homescreen2/applicationlistmodel.cpp b/containments/homescreen2/applicationlistmodel.cpp index 900c0608..e1121fc2 100644 --- a/containments/homescreen2/applicationlistmodel.cpp +++ b/containments/homescreen2/applicationlistmodel.cpp @@ -240,32 +240,31 @@ void ApplicationListModel::setLocation(int row, LauncherLocation location) return; } - if (location == Favorites) { - if (row >= m_maxFavoriteCount) { + if (location == Favorites) {qWarning()<<"favoriting"<= m_maxFavoriteCount || m_favorites.count() >= m_maxFavoriteCount) { return; } + m_favorites.insert(row, data.storageId); -qWarning()<<"AAAAAAAAAAAAA111"<config().writeEntry("Favorites", m_favorites); emit favoriteCountChanged(); + + // Out of favorites } else if (data.location == Favorites) { m_favorites.removeAll(data.storageId); m_homeScreen->config().writeEntry("Favorites", m_favorites); emit favoriteCountChanged(); } + // In Desktop if (location == Desktop) { m_desktopItems.insert(data.storageId); m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.toList()); - } else if (data.location == Favorites) { + + // Out of Desktop + } else if (data.location == Desktop) { m_desktopItems.remove(data.storageId); m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.toList()); } @@ -290,6 +289,7 @@ void ApplicationListModel::moveItem(int row, int destination) ApplicationData data = m_applicationList.at(row); m_applicationList.insert(destination, data); m_applicationList.takeAt(row); + } else { ApplicationData data = m_applicationList.takeAt(row); m_applicationList.insert(destination, data); @@ -331,11 +331,12 @@ void ApplicationListModel::setMaxFavoriteCount(int count) if (m_maxFavoriteCount == count) { return; } - +qWarning()<<"NEW FAVORITE COUNT"< count) { while (m_favorites.size() > count && m_favorites.count() > 0) { m_favorites.pop_back(); } + emit favoriteCountChanged(); int i = 0; for (auto &app : m_applicationList) { diff --git a/containments/homescreen2/package/contents/ui/launcher/FavoriteStrip.qml b/containments/homescreen2/package/contents/ui/launcher/FavoriteStrip.qml index e6594a68..d2c6e338 100644 --- a/containments/homescreen2/package/contents/ui/launcher/FavoriteStrip.qml +++ b/containments/homescreen2/package/contents/ui/launcher/FavoriteStrip.qml @@ -34,9 +34,9 @@ LauncherContainer { flow.flow: Flow.TopToBottom favoriteStrip: root - visible: plasmoid.nativeInterface.applicationListModel.favoriteCount > 0 || plasmoid.editMode + visible: flow.children.length > 0 || plasmoid.editMode height: launcherGrid.cellHeight + topPadding + bottomPadding - frame.implicitWidth: launcherGrid.cellWidth * Math.max(1, plasmoid.nativeInterface.applicationListModel.favoriteCount) + frame.leftPadding + frame.rightPadding + frame.implicitWidth: launcherGrid.cellWidth * Math.max(1, flow.children.length) + frame.leftPadding + frame.rightPadding } diff --git a/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml b/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml index 2ac74e92..2d17c7bf 100644 --- a/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml +++ b/containments/homescreen2/package/contents/ui/launcher/LauncherDragManager.qml @@ -52,7 +52,7 @@ Item { var pos = favoriteStrip.flow.mapFromItem(delegate, 0, 0); newRow = Math.floor((pos.x + dragCenterX) / delegate.width); - plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Favorites); + //plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Favorites); internal.showSpacer(delegate, dragCenterX, dragCenterY); plasmoid.nativeInterface.applicationListModel.moveItem(delegate.modelData.index, newRow); @@ -60,7 +60,7 @@ Item { // Put it on desktop } else if (newContainer == appletsLayout) { var pos = appletsLayout.mapFromItem(delegate, 0, 0); - plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Desktop); + //plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Desktop); internal.showSpacer(delegate, dragCenterX, dragCenterY); return; @@ -69,7 +69,7 @@ Item { } else { newRow = Math.round(newContainer.flow.width / delegate.width) * Math.floor((delegate.y + dragCenterY) / delegate.height) + Math.floor((delegate.x + dragCenterX) / delegate.width) + favoriteStrip.count; - plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Grid); + //plasmoid.nativeInterface.applicationListModel.setLocation(delegate.modelData.index, ApplicationListModel.Grid); internal.showSpacer(delegate, dragCenterX, dragCenterY); plasmoid.nativeInterface.applicationListModel.moveItem(delegate.modelData.index, newRow); @@ -99,7 +99,8 @@ Item { } function containerForItem(item, dragCenterX, dragCenterY) { - if (favoriteStrip.contains(favoriteStrip.mapFromItem(item, dragCenterX, dragCenterY))) { + if (favoriteStrip.contains(favoriteStrip.mapFromItem(item, dragCenterX, dragCenterY)) + && plasmoid.nativeInterface.applicationListModel.favoriteCount < plasmoid.nativeInterface.applicationListModel.maxFavoriteCount) { return favoriteStrip; } else if (appletsLayout.contains(appletsLayout.mapFromItem(item, dragCenterX, dragCenterY))) { return appletsLayout; @@ -211,13 +212,19 @@ Item { raiseContainer(container); if (container == appletsLayout) { + plasmoid.nativeInterface.applicationListModel.setLocation(item.modelData.index, ApplicationListModel.Desktop); var pos = appletsLayout.mapFromItem(item, 0, 0); item.parent = appletsLayout; item.x = pos.x; item.y = pos.y; appletsLayout.hidePlaceHolder(); appletsLayout.positionItem(item); + return; + } else if (container == favoriteStrip) { + plasmoid.nativeInterface.applicationListModel.setLocation(item.modelData.index, ApplicationListModel.Favorites); + } else { + plasmoid.nativeInterface.applicationListModel.setLocation(item.modelData.index, ApplicationListModel.Grid); } spacer.visible = false; diff --git a/containments/homescreen2/package/contents/ui/main.qml b/containments/homescreen2/package/contents/ui/main.qml index 7b0691b0..87d6cf55 100644 --- a/containments/homescreen2/package/contents/ui/main.qml +++ b/containments/homescreen2/package/contents/ui/main.qml @@ -212,17 +212,24 @@ Item { imagePath: "widgets/arrows" colorGroup: PlasmaCore.Theme.ComplementaryColorGroup } - PlasmaCore.SvgItem { + PlasmaCore.IconItem { + z: 9 anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom - //bottomMargin: favoriteStrip.height } - z: 2 - svg: arrowsSvg - elementId: "up-arrow" - width: units.iconSizes.large + source: "arrow-up" + width: units.iconSizes.medium height: width + colorGroup: PlasmaCore.Theme.ComplementaryColorGroup + + MouseArea { + anchors { + fill: parent + margins: -units.smallSpacing + } + onClicked: mainFlickable.flick(0, -mainFlickable.height) + } } ContainmentLayoutManager.AppletsLayout { @@ -305,7 +312,7 @@ Item { left: parent.left right: parent.right bottom: parent.bottom - bottomMargin: root.height - plamsoid.availableScreenRect.height - plasmoid.availableScreenRect.y + bottomMargin: root.height - plasmoid.availableScreenRect.height - plasmoid.availableScreenRect.y } appletsLayout: appletsLayout launcherGrid: launcher