some fixes in the dialog

This commit is contained in:
Marco Martin 2013-10-22 13:05:13 +02:00
parent d7aa34cc6c
commit d797985ffa
2 changed files with 33 additions and 37 deletions

View File

@ -137,16 +137,16 @@ void DialogProxy::setVisible(const bool visible)
if (visible) { if (visible) {
if (location() == Plasma::Types::FullScreen) { if (location() == Plasma::Types::FullScreen) {
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder); m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
setPosition(screen()->availableGeometry().topLeft());
setGeometry(screen()->availableGeometry()); setGeometry(screen()->availableGeometry());
} else { } else {
//syncToMainItemSize(); //syncToMainItemSize();
setPosition(popupPosition(m_visualParent.data(), Qt::AlignCenter)); setPosition(popupPosition(m_visualParent.data(), Qt::AlignCenter));
syncBorders(); syncToMainItemSize();
} }
raise(); raise();
//DialogShadows::self()->addWindow(this, m_frameSvgItem->enabledBorders());
} }
KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge; KWindowEffects::SlideFromLocation slideLocation = KWindowEffects::NoEdge;
@ -340,6 +340,7 @@ void DialogProxy::syncToMainItemSize()
if (!m_mainItem) { if (!m_mainItem) {
return; return;
} }
syncBorders();
//qDebug() << " main item: " << m_mainItem. //qDebug() << " main item: " << m_mainItem.
//FIXME: workaround to prevent dialogs of Popup type disappearing on the second show //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()) + const QSize s = QSize(m_mainItem.data()->width(), m_mainItem.data()->height()) +
@ -349,7 +350,6 @@ void DialogProxy::syncToMainItemSize()
resize(s); resize(s);
emit widthChanged(s.width()); emit widthChanged(s.width());
emit heightChanged(s.height()); emit heightChanged(s.height());
syncBorders();
} }

View File

@ -20,26 +20,32 @@
import QtQuick 2.0 import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.core 2.0 as PlasmaCore 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 org.kde.qtextracomponents 2.0
import QtQuick.Window 2.1
PlasmaCore.Dialog { PlasmaCore.Dialog {
id: dialog id: dialog
location: PlasmaCore.Types.LeftEdge location: PlasmaCore.Types.LeftEdge
Component.onCompleted: dialog.visible = true; Component.onCompleted: dialog.visible = true;
onVisibleChanged: {
if (!visible) {
widgetExplorer.close();
}
}
mainItem: Item { mainItem: Item {
id: main id: main
Text {
text: Screen.height+" "+main.height
}
width: 240 width: 240
height: 800 height: 800//Screen.height
//this is used to perfectly align the filter field and delegates //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 + ( property int minimumWidth: theme.mSize(defaultFont).width * 12
widgetExplorer.orientation == Qt.Horizontal
? 0
: (scrollBar.width + 4 * 2) // 4 * 2 == left and right margins
)
property int minimumHeight: 800//topBar.height + list.delegateHeight + (widgetExplorer.orientation == Qt.Horizontal ? scrollBar.height : 0) + 4 property int minimumHeight: 800//topBar.height + list.delegateHeight + (widgetExplorer.orientation == Qt.Horizontal ? scrollBar.height : 0) + 4
property Item getWidgetsButton property Item getWidgetsButton
@ -273,10 +279,8 @@ PlasmaCore.Dialog {
anchors { anchors {
top: topBar.bottom top: topBar.bottom
left: parent.left left: parent.left
right: widgetExplorer.orientation == Qt.Horizontal right: parent.right
? parent.right bottom: widgetExplorer.orientation == Qt.Horizontal ? parent.bottom : bottomBar.top
: (scrollBar.visible ? scrollBar.left : parent.right)
bottom: widgetExplorer.orientation == Qt.Horizontal ? scrollBar.top : bottomBar.top
leftMargin: 4 leftMargin: 4
bottomMargin: 4 bottomMargin: 4
} }
@ -288,6 +292,8 @@ PlasmaCore.Dialog {
Math.max(0, list.contentX - delta)) Math.max(0, list.contentX - delta))
} }
} }
PlasmaExtras.ScrollArea {
anchors.fill: parent
ListView { ListView {
id: list id: list
@ -304,19 +310,9 @@ PlasmaCore.Dialog {
delegate: AppletDelegate {} 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 { Loader {
id: bottomBar id: bottomBar