/* SPDX-FileCopyrightText: 2016 Smith AR SPDX-FileCopyrightText: 2016 Michail Vourlakos SPDX-License-Identifier: GPL-2.0-or-later */ import QtQuick 2.0 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.latte.core 0.2 as LatteCore import org.kde.latte.components 1.0 as LatteComponents import org.kde.latte.private.containment 0.1 as LatteContainment import "../../controls" as LatteExtraControls PlasmaComponents.Page { id: page width: content.width + content.Layout.leftMargin * 2 height: content.height + units.smallSpacing * 2 ColumnLayout { id: content width: (dialog.appliedWidth - units.smallSpacing * 2) - Layout.leftMargin * 2 spacing: dialog.subGroupSpacing anchors.horizontalCenter: parent.horizontalCenter Layout.leftMargin: units.smallSpacing * 2 //! BEGIN: Inline Dock/Panel Type, it is used only when the secondary window //! overlaps the main dock config window Loader { Layout.fillWidth: true active: dialog.advancedLevel && viewConfig.showInlineProperties && viewConfig.isReady visible: active sourceComponent: ColumnLayout { Layout.fillWidth: true Layout.topMargin: units.smallSpacing spacing: units.smallSpacing LatteComponents.Header { text: i18n("Type") } LatteExtraControls.TypeSelection{ id: viewTypeSelection horizontal: true } } } //! END: Inline Dock/Panel Type //! BEGIN: Location ColumnLayout { Layout.fillWidth: true spacing: units.smallSpacing Layout.topMargin: units.smallSpacing LatteComponents.Header { text: screenRow.visible ? i18n("Screen") : i18n("Location") } Connections { target: universalSettings onScreensCountChanged: screenRow.updateScreens() } RowLayout { id: screenRow Layout.fillWidth: true Layout.leftMargin: units.smallSpacing * 2 Layout.rightMargin: units.smallSpacing * 3 spacing: 2 visible: screensCount > 1 || dialog.advancedLevel property int screensCount: 1 function updateScreens() { screensCount = universalSettings.screens.length; screensModel.clear(); var primary = {name: i18n("Follow Primary Screen"), icon: 'favorite'}; screensModel.append(primary); //check if the screen exists, it is used in cases Latte is moving //the view automatically to primaryScreen in order for the user //to has always a view with tasks shown var screenExists = false for (var i = 0; i < universalSettings.screens.length; i++) { if (universalSettings.screens[i].name === latteView.positioner.currentScreenName) { screenExists = true; } } if (!screenExists && !latteView.onPrimary) { var scr = {name: latteView.positioner.currentScreenName, icon: 'view-fullscreen'}; screensModel.append(scr); } for (var i = 0; i < universalSettings.screens.length; i++) { var scr = {name: universalSettings.screens[i].name, icon: 'view-fullscreen'}; screensModel.append(scr); } if (latteView.onPrimary) { screenCmb.currentIndex = 0; } else { screenCmb.currentIndex = screenCmb.findScreen(latteView.positioner.currentScreenName); } console.log(latteView.positioner.currentScreenName); } Connections{ target: viewConfig onShowSignal: screenRow.updateScreens(); } ListModel { id: screensModel } LatteComponents.ComboBox { id: screenCmb Layout.fillWidth: true model: screensModel textRole: "name" iconRole: "icon" Component.onCompleted: screenRow.updateScreens(); onActivated: { if (index === 0) { latteView.positioner.setNextLocation("", "{primary-screen}", PlasmaCore.Types.Floating, LatteCore.Types.NoneAlignment); } else if (index>0 && (index !== findScreen(latteView.positioner.currentScreenName) || latteView.onPrimary)) { latteView.positioner.setNextLocation("", textAt(index), PlasmaCore.Types.Floating, LatteCore.Types.NoneAlignment); } } function findScreen(scrName) { for(var i=0; i