diff --git a/abstract_client.cpp b/abstract_client.cpp index 4022b4ae13..491a38bd9d 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -1461,4 +1461,13 @@ void AbstractClient::startDecorationDoubleClickTimer() m_decorationDoubleClickTimer.start(); } +bool AbstractClient::providesContextHelp() const +{ + return false; +} + +void AbstractClient::showContextHelp() +{ +} + } diff --git a/abstract_client.h b/abstract_client.h index b7d614e17a..9b54b28034 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -213,6 +213,11 @@ class KWIN_EXPORT AbstractClient : public Toplevel * If this property gets abused by application developers, it will be removed again. **/ Q_PROPERTY(bool noBorder READ noBorder WRITE setNoBorder) + /** + * Whether the Client provides context help. Mostly needed by decorations to decide whether to + * show the help button or not. + **/ + Q_PROPERTY(bool providesContextHelp READ providesContextHelp CONSTANT) public: virtual ~AbstractClient(); @@ -511,6 +516,26 @@ public: bool processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu = false); void processDecorationButtonRelease(QMouseEvent *event); + /** + * Returns whether the window provides context help or not. If it does, + * you should show a help menu item or a help button like '?' and call + * contextHelp() if this is invoked. + * + * Default implementation returns @c false. + * @see showContextHelp; + */ + virtual bool providesContextHelp() const; + + /** + * Invokes context help on the window. Only works if the window + * actually provides context help. + * + * Default implementation does nothing. + * + * @see providesContextHelp() + */ + virtual void showContextHelp(); + // TODO: remove boolean trap static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false); diff --git a/client.h b/client.h index e442df98e3..3c945a1be2 100644 --- a/client.h +++ b/client.h @@ -89,11 +89,6 @@ class Client * @see moveable **/ Q_PROPERTY(bool moveableAcrossScreens READ isMovableAcrossScreens) - /** - * Whether the Client provides context help. Mostly needed by decorations to decide whether to - * show the help button or not. - **/ - Q_PROPERTY(bool providesContextHelp READ providesContextHelp CONSTANT) /** * Whether the Client can be resized. The property is evaluated each time it is invoked. * Because of that there is no notify signal. @@ -236,7 +231,7 @@ public: void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet); QSize sizeForClientSize(const QSize&, Sizemode mode = SizemodeAny, bool noframe = false) const override; - bool providesContextHelp() const; + bool providesContextHelp() const override; const QKeySequence &shortcut() const override; void setShortcut(const QString& cut) override; @@ -286,7 +281,7 @@ public: void killWindow(); void toggleShade(); - void showContextHelp(); + void showContextHelp() override; void cancelShadeHoverTimer(); void checkActiveModal(); StrutRect strutRect(StrutArea area) const;