diff --git a/shell/panelview.cpp b/shell/panelview.cpp --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -488,46 +488,26 @@ } //defaults, may be altered by values written by the scripting in startup phase - int defaultOffset = 0; - int defaultThickness = 30; - int defaultMaxLength = 0; - int defaultMinLength = 0; - int defaultAlignment = Qt::AlignLeft; + const int defaultOffset = 0; + const int defaultAlignment = Qt::AlignLeft; setAlignment((Qt::Alignment)config().readEntry("alignment", defaultAlignment)); m_offset = config().readEntry("offset", defaultOffset); if (m_alignment != Qt::AlignCenter) { m_offset = qMax(0, m_offset); } + const int defaultThickness = 30; setThickness(config().readEntry("thickness", defaultThickness)); + const QSize screenSize = m_screenToFollow->size(); setMinimumSize(QSize(-1, -1)); //FIXME: an invalid size doesn't work with QWindows - setMaximumSize(m_screenToFollow->size()); - - if (containment()->formFactor() == Plasma::Types::Vertical) { - defaultMaxLength = m_screenToFollow->size().height(); - defaultMinLength = m_screenToFollow->size().height(); - - m_maxLength = config().readEntry("maxLength", defaultMaxLength); - m_minLength = config().readEntry("minLength", defaultMinLength); - - const int maxSize = m_screenToFollow->size().height() - m_offset; - m_maxLength = qBound(MINSIZE, m_maxLength, maxSize); - m_minLength = qBound(MINSIZE, m_minLength, maxSize); - //Horizontal - } else { - defaultMaxLength = m_screenToFollow->size().width(); - defaultMinLength = m_screenToFollow->size().width(); - - m_maxLength = config().readEntry("maxLength", defaultMaxLength); - m_minLength = config().readEntry("minLength", defaultMinLength); - - const int maxSize = m_screenToFollow->size().width() - m_offset; - m_maxLength = qBound(MINSIZE, m_maxLength, maxSize); - m_minLength = qBound(MINSIZE, m_minLength, maxSize); - } + setMaximumSize(screenSize); + const int side = containment()->formFactor() == Plasma::Types::Vertical ? screenSize.height() : screenSize.width(); + const int maxSize = side - m_offset; + m_maxLength = qBound(MINSIZE, config().readEntry("maxLength", side), maxSize); + m_minLength = qBound(MINSIZE, config().readEntry("minLength", side), maxSize); setVisibilityMode((VisibilityMode)config().readEntry("panelVisibility", (int)NormalPanel)); resizePanel();