From d797985ffa7785528f2f083a9cf385919d8e5971 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 22 Oct 2013 13:05:13 +0200 Subject: [PATCH] some fixes in the dialog --- src/declarativeimports/core/dialog.cpp | 8 +-- .../contents/explorer/WidgetExplorer.qml | 62 +++++++++---------- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/declarativeimports/core/dialog.cpp b/src/declarativeimports/core/dialog.cpp index 335729991..2d1ec9e95 100644 --- a/src/declarativeimports/core/dialog.cpp +++ b/src/declarativeimports/core/dialog.cpp @@ -137,16 +137,16 @@ void DialogProxy::setVisible(const bool visible) if (visible) { if (location() == Plasma::Types::FullScreen) { m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder); + setPosition(screen()->availableGeometry().topLeft()); setGeometry(screen()->availableGeometry()); } else { //syncToMainItemSize(); setPosition(popupPosition(m_visualParent.data(), Qt::AlignCenter)); - syncBorders(); + syncToMainItemSize(); } raise(); - //DialogShadows::self()->addWindow(this, m_frameSvgItem->enabledBorders()); } KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge; @@ -166,7 +166,7 @@ void DialogProxy::setVisible(const bool visible) break; //no edge, no slide default: - break; + break; } KWindowEffects::slideWindow(winId(), slideLocation, -1); @@ -340,6 +340,7 @@ void DialogProxy::syncToMainItemSize() if (!m_mainItem) { return; } + syncBorders(); //qDebug() << " main item: " << m_mainItem. //FIXME: workaround to prevent dialogs of Popup type disappearing on the second show const QSize s = QSize(m_mainItem.data()->width(), m_mainItem.data()->height()) + @@ -349,7 +350,6 @@ void DialogProxy::syncToMainItemSize() resize(s); emit widthChanged(s.width()); emit heightChanged(s.height()); - syncBorders(); } diff --git a/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml b/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml index 92be594cf..7036da900 100644 --- a/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml +++ b/src/shell/qmlpackages/desktop/contents/explorer/WidgetExplorer.qml @@ -20,26 +20,32 @@ import QtQuick 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.qtextracomponents 2.0 +import QtQuick.Window 2.1 PlasmaCore.Dialog { id: dialog location: PlasmaCore.Types.LeftEdge Component.onCompleted: dialog.visible = true; + onVisibleChanged: { + if (!visible) { + widgetExplorer.close(); + } + } mainItem: Item { id: main + Text { + text: Screen.height+" "+main.height + } width: 240 - height: 800 + height: 800//Screen.height //this is used to perfectly align the filter field and delegates - property int cellWidth: theme.defaultFont.pixelSize * 20 + property int cellWidth: theme.mSize(defaultFont).width * 10 - property int minimumWidth: cellWidth + ( - widgetExplorer.orientation == Qt.Horizontal - ? 0 - : (scrollBar.width + 4 * 2) // 4 * 2 == left and right margins - ) + property int minimumWidth: theme.mSize(defaultFont).width * 12 property int minimumHeight: 800//topBar.height + list.delegateHeight + (widgetExplorer.orientation == Qt.Horizontal ? scrollBar.height : 0) + 4 property Item getWidgetsButton @@ -273,10 +279,8 @@ PlasmaCore.Dialog { anchors { top: topBar.bottom left: parent.left - right: widgetExplorer.orientation == Qt.Horizontal - ? parent.right - : (scrollBar.visible ? scrollBar.left : parent.right) - bottom: widgetExplorer.orientation == Qt.Horizontal ? scrollBar.top : bottomBar.top + right: parent.right + bottom: widgetExplorer.orientation == Qt.Horizontal ? parent.bottom : bottomBar.top leftMargin: 4 bottomMargin: 4 } @@ -288,35 +292,27 @@ PlasmaCore.Dialog { Math.max(0, list.contentX - delta)) } } - ListView { - id: list - - property int delegateWidth: (widgetExplorer.orientation == Qt.Horizontal) ? (list.width / Math.floor(list.width / cellWidth)) : list.width - property int delegateHeight: theme.defaultFont.pixelSize * 7 - 4 - + PlasmaExtras.ScrollArea { anchors.fill: parent + ListView { + id: list - orientation: widgetExplorer.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.Vertical - snapMode: ListView.SnapToItem - model: widgetExplorer.widgetsModel + property int delegateWidth: (widgetExplorer.orientation == Qt.Horizontal) ? (list.width / Math.floor(list.width / cellWidth)) : list.width + property int delegateHeight: theme.defaultFont.pixelSize * 7 - 4 - clip: widgetExplorer.orientation == Qt.Vertical + anchors.fill: parent - delegate: AppletDelegate {} + orientation: widgetExplorer.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.Vertical + snapMode: ListView.SnapToItem + model: widgetExplorer.widgetsModel + + clip: widgetExplorer.orientation == Qt.Vertical + + delegate: AppletDelegate {} + } } } - PlasmaComponents.ScrollBar { - id: scrollBar - orientation: widgetExplorer.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.Vertical - anchors { - top: widgetExplorer.orientation == Qt.Horizontal ? undefined : listParent.top - bottom: widgetExplorer.orientation == Qt.Horizontal ? parent.bottom : bottomBar.top - left: widgetExplorer.orientation == Qt.Horizontal ? parent.left : undefined - right: parent.right - } - flickableItem: list - } Loader { id: bottomBar