diff --git a/dialog.cpp b/dialog.cpp index 03d0361d8..6b0d518f1 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -100,7 +100,7 @@ void DialogPrivate::themeChanged() // WA_NoSystemBackground is going to fail combined with sliding popups, but is needed // when we aren't compositing q->setAttribute(Qt::WA_NoSystemBackground, !translucency); - WindowEffects::overrideShadow(q->winId(), !DialogShadows::self()->hasElement("shadow-left")); + WindowEffects::overrideShadow(q->winId(), !DialogShadows::self()->enabled()); updateMask(); q->update(); } @@ -400,7 +400,7 @@ Dialog::Dialog(QWidget *parent, Qt::WindowFlags f) QPalette pal = palette(); pal.setColor(backgroundRole(), Qt::transparent); setPalette(pal); - WindowEffects::overrideShadow(winId(), !DialogShadows::self()->hasElement("shadow-left")); + WindowEffects::overrideShadow(winId(), !DialogShadows::self()->enabled()); d->adjustViewTimer = new QTimer(this); d->adjustViewTimer->setSingleShot(true); @@ -729,7 +729,7 @@ void Dialog::showEvent(QShowEvent * event) } emit dialogVisible(true); - // WindowEffects::overrideShadow(winId(), true); + WindowEffects::overrideShadow(winId(), !DialogShadows::self()->enabled()); DialogShadows::self()->addWindow(this, d->background->enabledBorders()); } diff --git a/private/dialogshadows.cpp b/private/dialogshadows.cpp index 0b36fe398..eb4f5c947 100644 --- a/private/dialogshadows.cpp +++ b/private/dialogshadows.cpp @@ -83,11 +83,11 @@ public: K_GLOBAL_STATIC(DialogShadowsSingleton, privateDialogShadowsSelf) -DialogShadows::DialogShadows(QObject *parent) +DialogShadows::DialogShadows(QObject *parent, const QString &prefix) : Plasma::Svg(parent), d(new Private(this)) { - setImagePath("dialogs/background"); + setImagePath(prefix); connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows())); } @@ -193,10 +193,6 @@ void DialogShadows::Private::setupPixmaps() void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBorders) { #ifdef Q_WS_X11 - /*foreach (const QPixmap &pixmap, m_shadowPixmaps) { - data[enabledBorders] << pixmap.handle(); - }*/ - //shadow-top if (enabledBorders & Plasma::FrameSvg::TopBorder) { data[enabledBorders] << m_shadowPixmaps[0].handle(); @@ -279,7 +275,6 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB QSize marginHint; if (enabledBorders & Plasma::FrameSvg::TopBorder) { marginHint = q->elementSize("shadow-hint-top-margin"); - kDebug() << "top margin hint is:" << marginHint; if (marginHint.isValid()) { top = marginHint.height(); } else { @@ -291,7 +286,6 @@ void DialogShadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledB if (enabledBorders & Plasma::FrameSvg::RightBorder) { marginHint = q->elementSize("shadow-hint-right-margin"); - kDebug() << "right margin hint is:" << marginHint; if (marginHint.isValid()) { right = marginHint.width(); } else { @@ -352,7 +346,7 @@ void DialogShadows::Private::clearPixmaps() void DialogShadows::Private::updateShadow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders) { #ifdef Q_WS_X11 - if (m_shadowPixmaps.size() == 0) { + if (m_shadowPixmaps.isEmpty()) { setupPixmaps(); } @@ -378,5 +372,10 @@ void DialogShadows::Private::clearShadow(const QWidget *window) #endif } +bool DialogShadows::enabled() const +{ + return hasElement("shadow-left"); +} + #include "dialogshadows_p.moc" diff --git a/private/dialogshadows_p.h b/private/dialogshadows_p.h index 3225c1041..a2d62ccbe 100644 --- a/private/dialogshadows_p.h +++ b/private/dialogshadows_p.h @@ -30,14 +30,14 @@ class DialogShadows : public Plasma::Svg Q_OBJECT public: - explicit DialogShadows(QObject *parent = 0); + explicit DialogShadows(QObject *parent = 0, const QString &prefix = "dialogs/background"); static DialogShadows *self(); void addWindow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders = Plasma::FrameSvg::AllBorders); void removeWindow(const QWidget *window); -private Q_SLOTS: + bool enabled() const; private: class Private;