Revert "fix enabled borders management"

This reverts commit aaa1a6315e.
This commit is contained in:
Marco Martin 2014-09-16 17:35:22 +02:00
parent aaa1a6315e
commit 6993ecf9f7

View File

@ -63,17 +63,10 @@ public:
hideOnWindowDeactivate(false),
outputOnly(false),
componentComplete(dialog->parent() == 0),
resizeOrigin(Undefined),
backgroundHints(Dialog::StandardBackground)
{
}
enum ResizeOrigin {
Undefined,
MainItem,
Window
};
void updateInputShape();
//SLOTS
@ -121,6 +114,7 @@ public:
void syncToMainItemSize();
Dialog *q;
QTimer *syncTimer;
Plasma::Types::Location location;
Plasma::FrameSvgItem *frameSvgItem;
QPointer<QQuickItem> mainItem;
@ -132,7 +126,6 @@ public:
bool outputOnly;
Plasma::Theme theme;
bool componentComplete;
ResizeOrigin resizeOrigin;
Dialog::BackgroundHints backgroundHints;
//Attached Layout property of mainItem, if any
@ -149,10 +142,7 @@ QRect DialogPrivate::availableScreenGeometryForPosition(const QPoint& pos) const
// says it's at.
QRect avail;
Q_FOREACH (QScreen *screen, q->screen()->virtualSiblings()) {
//we check geometry() but then take availableGeometry()
//to reliably check in what screen a position is, we need the full
//geometry, included areas for panels
if (screen->geometry().contains(pos)) {
if (screen->availableGeometry().contains(pos)) {
avail = screen->availableGeometry();
break;
}
@ -441,17 +431,16 @@ void DialogPrivate::updateLayoutParameters()
return;
}
Q_ASSERT(mainItem);
//Not all main items define a Layout internally, this depends from the QML
//Q_ASSERT(mainItemLayout);
Q_ASSERT(mainItemLayout);
mainItem->disconnect(q);
int minimumHeight = mainItemLayout ? mainItemLayout->property("minimumHeight").toInt() : 0;
int maximumHeight = mainItemLayout ? mainItemLayout->property("maximumHeight").toInt() : 0;
int minimumHeight = mainItemLayout->property("minimumHeight").toInt();
int maximumHeight = mainItemLayout->property("maximumHeight").toInt();
maximumHeight = maximumHeight ? maximumHeight : DIALOGSIZE_MAX;
int minimumWidth = mainItemLayout ? mainItemLayout->property("minimumWidth").toInt() : 0;
int maximumWidth = mainItemLayout ? mainItemLayout->property("maximumWidth").toInt() : 0;
int minimumWidth = mainItemLayout->property("minimumWidth").toInt();
int maximumWidth = mainItemLayout->property("maximumWidth").toInt();
maximumWidth = maximumWidth ? maximumWidth : DIALOGSIZE_MAX;
auto margin = frameSvgItem->margins();
@ -551,15 +540,14 @@ void DialogPrivate::updateInputShape()
void DialogPrivate::syncToMainItemSize()
{
if (resizeOrigin == Window || !componentComplete || !mainItem || !q->isVisible()) {
if (!componentComplete || !mainItem || !q->isVisible()) {
return;
}
resizeOrigin = MainItem;
if (visualParent) {
// fixedMargins will get all the borders, no matter if they are enabled
auto margins = frameSvgItem->fixedMargins();
// Get the full size with ALL the borders
frameSvgItem->setEnabledBorders(Plasma::FrameSvg::AllBorders);
auto margins = frameSvgItem->margins();
const QSize fullSize = QSize(mainItem->width(), mainItem->height()) +
QSize(margins->left() + margins->right(),
@ -606,8 +594,6 @@ void DialogPrivate::syncToMainItemSize()
mainItem->setY(frameSvgItem->margins()->top());
updateTheme();
resizeOrigin = Undefined;
}
void DialogPrivate::slotWindowPositionChanged()
@ -917,14 +903,6 @@ void Dialog::adjustGeometry(const QRect &geom)
void Dialog::resizeEvent(QResizeEvent* re)
{
QQuickWindow::resizeEvent(re);
if (d->resizeOrigin == DialogPrivate::MainItem) {
return;
}
d->resizeOrigin = DialogPrivate::Window;
d->updateLayoutParameters();
d->resizeOrigin = DialogPrivate::Undefined;
}
void Dialog::setType(WindowType type)