SHA256
1
0
forked from pool/breeze
breeze/0002-set-button-s-visibility-depending-on-the-availabilit.patch

67 lines
2.8 KiB
Diff
Raw Normal View History

From 46b78432e25a124e9b85b007723435700aec047a Mon Sep 17 00:00:00 2001
From: Hugo Pereira Da Costa <hugo.pereira@free.fr>
Date: Sun, 22 Mar 2015 20:22:18 +0100
Subject: [PATCH 2/5] set button's visibility depending on the availability of
the corresponding feature CCBUG: 343641
---
kdecoration/breezebutton.cpp | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/kdecoration/breezebutton.cpp b/kdecoration/breezebutton.cpp
index 5ac0cfe420c6de50db30491e90dc0244666add33..1a3c0c2b0f66a2c8582798b82dee97dcc7785b12 100644
--- a/kdecoration/breezebutton.cpp
+++ b/kdecoration/breezebutton.cpp
@@ -63,13 +63,47 @@ namespace Breeze
if (auto d = qobject_cast<Decoration*>(decoration))
{
Button *b = new Button(type, d, parent);
- if (type == KDecoration2::DecorationButtonType::Menu)
+ switch( type )
{
+
+ case KDecoration2::DecorationButtonType::Close:
+ b->setVisible( d->client().data()->isCloseable() );
+ QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::closeableChanged, b, &Breeze::Button::setVisible );
+ break;
+
+ case KDecoration2::DecorationButtonType::Maximize:
+ b->setVisible( d->client().data()->isMaximizeable() );
+ QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Breeze::Button::setVisible );
+ break;
+
+ case KDecoration2::DecorationButtonType::Minimize:
+ b->setVisible( d->client().data()->isMinimizeable() );
+ QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Breeze::Button::setVisible );
+ break;
+
+ case KDecoration2::DecorationButtonType::ContextHelp:
+ b->setVisible( d->client().data()->providesContextHelp() );
+ QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Breeze::Button::setVisible );
+ break;
+
+ case KDecoration2::DecorationButtonType::Shade:
+ b->setVisible( d->client().data()->isShadeable() );
+ QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Breeze::Button::setVisible );
+ break;
+
+ case KDecoration2::DecorationButtonType::Menu:
QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); });
+ break;
+
+ default: break;
+
}
+
return b;
}
+
return nullptr;
+
}
//__________________________________________________________________
--
2.3.3