diff --git a/applets/testapplet/contents/ui/main.qml b/applets/testapplet/contents/ui/main.qml index b1de00497..31681130c 100644 --- a/applets/testapplet/contents/ui/main.qml +++ b/applets/testapplet/contents/ui/main.qml @@ -28,6 +28,8 @@ Rectangle { height: 100 radius: 10 smooth: true + property int minimumWidth: units.gridUnit * 20 + property int minimumHeight: column.implicitHeight property Component compactRepresentation: Component { Rectangle { @@ -39,6 +41,7 @@ Rectangle { } Column { + id: column anchors.centerIn: parent Text { text: "I'm an applet" diff --git a/applets/testcomponentsapplet/contents/ui/testcomponents.qml b/applets/testcomponentsapplet/contents/ui/testcomponents.qml index 1ecb6795b..2c04eb6d2 100644 --- a/applets/testcomponentsapplet/contents/ui/testcomponents.qml +++ b/applets/testcomponentsapplet/contents/ui/testcomponents.qml @@ -28,6 +28,8 @@ Item { width: 100 height: 100 clip: true + property int minimumWidth: units.gridUnit * 20 + property int minimumHeight: units.gridUnit * 30 property int _s: theme.iconSizes.small property int _h: theme.iconSizes.desktop diff --git a/applets/testshaderapplet/contents/ui/testshaderapplet.qml b/applets/testshaderapplet/contents/ui/testshaderapplet.qml index 4648e0a39..f61ec9cb7 100644 --- a/applets/testshaderapplet/contents/ui/testshaderapplet.qml +++ b/applets/testshaderapplet/contents/ui/testshaderapplet.qml @@ -28,6 +28,8 @@ Item { width: 400 height: 400 + property int minimumWidth: units.gridUnit * 20 + property int minimumHeight: units.gridUnit * 30 property int _s: theme.iconSizes.small property int _h: theme.iconSizes.desktop property int _m: 12 diff --git a/containments/CMakeLists.txt b/containments/CMakeLists.txt index b0764bcc3..aac88c663 100644 --- a/containments/CMakeLists.txt +++ b/containments/CMakeLists.txt @@ -1,3 +1,3 @@ installPackage(testcontainment org.kde.testcontainment plasma/plasmoids containment) -installPackage(testpanel org.kde.panel applets plasma/plasmoids containment) +installPackage(testpanel org.kde.panel plasma/plasmoids containment) diff --git a/containments/testpanel/contents/ui/main.qml b/containments/testpanel/contents/ui/main.qml index e6054bff8..389a38a9b 100644 --- a/containments/testpanel/contents/ui/main.qml +++ b/containments/testpanel/contents/ui/main.qml @@ -16,7 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ -import QtQuick 2.0 +import QtQuick 2.1 +import QtQuick.Layouts 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents @@ -32,7 +33,7 @@ Item { Connections { target: plasmoid onAppletAdded: { - var container = appletContainerComponent.createObject((plasmoid.formFactor == 3) ? column : row) + var container = appletContainerComponent.createObject((plasmoid.formFactor == PlasmaCore.Types.Vertical) ? column : row) print("Applet added in test panel: " + applet) applet.parent = container container.applet = applet @@ -41,13 +42,17 @@ Item { container.visible = true } onFormFactorChanged: { - if (plasmoid.formFactor == 3) { + if (plasmoid.formFactor == PlasmaCore.Types.Vertical) { for (var container in row.children) { - container.parent = column + var item = row.children[0]; + item.parent = column + item.width = column.width } } else { for (var container in column.children) { - container.parent = row + var item = column.children[0]; + item.parent = row + item.height = row.height } } } @@ -59,11 +64,11 @@ Item { id: container visible: false - width: Math.min(root.width, root.height) - height: width + Layout.preferredWidth: Math.min(root.width, root.height) + Layout.preferredHeight: Layout.preferredWidth - property Item applet + property Item applet PlasmaComponents.BusyIndicator { z: 1000 @@ -74,7 +79,7 @@ Item { } } - Row { + RowLayout { id: row anchors { top: parent.top @@ -82,7 +87,7 @@ Item { left: parent.left } } - Column { + ColumnLayout { id: column anchors { top: parent.top diff --git a/panelview.cpp b/panelview.cpp index 2d0dac636..3c55b0f1c 100644 --- a/panelview.cpp +++ b/panelview.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -100,6 +102,8 @@ void PanelView::init() } setResizeMode(View::SizeRootObjectToView); + qmlRegisterType(); + engine()->rootContext()->setContextProperty("panel", this); setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml"))); positionPanel(); } @@ -367,6 +371,7 @@ void PanelView::restore() emit maximumLengthChanged(); emit minimumLengthChanged(); emit offsetChanged(); + emit alignmentChanged(); } void PanelView::resizeEvent(QResizeEvent *ev) diff --git a/panelview.h b/panelview.h index d8d86a798..4dca67cc2 100644 --- a/panelview.h +++ b/panelview.h @@ -35,6 +35,7 @@ class PanelView : public View Q_PROPERTY(int length READ length WRITE setLength NOTIFY lengthChanged) Q_PROPERTY(int maximumLength READ maximumLength WRITE setMaximumLength NOTIFY maximumLengthChanged) Q_PROPERTY(int minimumLength READ minimumLength WRITE setMinimumLength NOTIFY minimumLengthChanged) + Q_PROPERTY(QScreen *screen READ screen NOTIFY screenChanged) public: explicit PanelView(DesktopCorona *corona, QWindow *parent = 0); @@ -73,6 +74,7 @@ Q_SIGNALS: void lengthChanged(); void maximumLengthChanged(); void minimumLengthChanged(); + void screenChanged(QScreen *screen); private Q_SLOTS: void positionPanel(); diff --git a/qmlpackages/desktop/contents/applet/CompactApplet.qml b/qmlpackages/desktop/contents/applet/CompactApplet.qml index fe6346b0c..18200304e 100644 --- a/qmlpackages/desktop/contents/applet/CompactApplet.qml +++ b/qmlpackages/desktop/contents/applet/CompactApplet.qml @@ -25,10 +25,20 @@ import org.kde.plasma.components 2.0 as PlasmaComponents Item { id: root + property int minimumWidth: compactRepresentation && compactRepresentation.minimumWidth !== undefined ? compactRepresentation.minimumWidth : -1 + property int minimumHeight: compactRepresentation && compactRepresentation.minimumHeight !== undefined ? compactRepresentation.minimumHeight : -1 + + property int maximumWidth: compactRepresentation && compactRepresentation.maximumWidth !== undefined ? compactRepresentation.maximumWidth : -1 + property int maximumHeight: compactRepresentation && compactRepresentation.maximumHeight !== undefined ? compactRepresentation.maximumHeight : -1 + + property int implicitWidth: compactRepresentation && compactRepresentation.implicitWidth !== undefined ? compactRepresentation.implicitWidth : -1 + property int implicitHeight: compactRepresentation && compactRepresentation.implicitHeight !== undefined ? compactRepresentation.implicitHeight : -1 + + + property Item applet property Item compactRepresentation - onAppletChanged: { applet.parent = appletParent applet.anchors.fill = applet.parent @@ -48,7 +58,7 @@ Item { mainItem: Item { id: appletParent - width: applet && applet.implicitWidth > 0 ? applet.implicitWidth : theme.mSize(theme.defaultFont).width * 35 + width: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).width * 35 height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).height * 25 onWidthChanged: applet.width = width onHeightChanged: applet.height = height diff --git a/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml b/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml index 18ddf50a6..86ab24d88 100644 --- a/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml +++ b/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml @@ -25,8 +25,8 @@ import org.kde.plasma.configuration 2.0 Item { id: root state: parent.state - implicitWidth: childrenRect.width + 20 - implicitHeight: childrenRect.height + 20 + implicitWidth: column.width + 20 + implicitHeight: row.height + 20 PlasmaComponents.ButtonRow { id: row spacing: 0 diff --git a/qmlpackages/desktop/contents/views/Panel.qml b/qmlpackages/desktop/contents/views/Panel.qml index dcbc7b3b5..f57327829 100644 --- a/qmlpackages/desktop/contents/views/Panel.qml +++ b/qmlpackages/desktop/contents/views/Panel.qml @@ -30,6 +30,41 @@ PlasmaCore.FrameSvgItem { property Item containment + function adjustBorders() { + var borders = PlasmaCore.FrameSvg.AllBorders; + + switch (containment.location) { + case PlasmaCore.Types.TopEdge: + borders = borders & ~PlasmaCore.FrameSvg.TopBorder; + break; + case PlasmaCore.Types.LeftEdge: + borders = borders & ~PlasmaCore.FrameSvg.LeftBorder; + break; + case PlasmaCore.Types.RightEdge: + borders = borders & ~PlasmaCore.FrameSvg.RightBorder; + break; + case PlasmaCore.Types.BottomEdge: + default: + borders = borders & ~PlasmaCore.FrameSvg.BottomBorder; + break; + } + + if (panel.x <= panel.screen.geometry.x) { + borders = borders & ~PlasmaCore.FrameSvg.LeftBorder; + } + if (panel.x + panel.width >= panel.screen.geometry.x + panel.screen.geometry.width) { + borders = borders & ~PlasmaCore.FrameSvg.RightBorder; + } + if (panel.y <= panel.screen.geometry.y) { + borders = borders & ~PlasmaCore.FrameSvg.TopBorder; + } + if (panel.y + panel.height >= panel.screen.geometry.y + panel.screen.geometry.height) { + borders = borders & ~PlasmaCore.FrameSvg.BottomBorder; + } + + root.enabledBorders = borders; + } + onContainmentChanged: { print("New panel Containment: " + containment) //containment.parent = root @@ -37,6 +72,36 @@ PlasmaCore.FrameSvgItem { containment.anchors.fill = root } + Connections { + target: containment + onLocationChanged: { + adjustBorders() + } + } + + Connections { + target: panel + onXChanged: { + adjustBorders(); + } + onYChanged: { + adjustBorders(); + } + onWidthChanged: { + adjustBorders(); + } + onHeightChanged: { + adjustBorders(); + } + } + + Connections { + target: panel.screen + onGeometryChanged: { + adjustBorders(); + } + } + Component.onCompleted: { print("PanelView QML loaded") } diff --git a/qmlpackages/desktop/metadata.desktop b/qmlpackages/desktop/metadata.desktop index 06c5d0d23..3037d0257 100644 --- a/qmlpackages/desktop/metadata.desktop +++ b/qmlpackages/desktop/metadata.desktop @@ -12,6 +12,7 @@ Comment[x-test]=xxDesktop view furniturexx Encoding=UTF-8 Keywords= Name=Desktop +Name[bs]=Površ Name[cs]=Pracovní plocha Name[de]=Arbeitsfläche Name[es]=Escritorio diff --git a/qmlpackages/wallpapers/autumn/metadata.desktop b/qmlpackages/wallpapers/autumn/metadata.desktop index 86febdf97..fef80c0b0 100644 --- a/qmlpackages/wallpapers/autumn/metadata.desktop +++ b/qmlpackages/wallpapers/autumn/metadata.desktop @@ -2,6 +2,7 @@ Encoding=UTF-8 Keywords= Name=Autumn +Name[bs]=Jesen Name[cs]=Podzim Name[de]=Herbst Name[es]=Otoño