diff --git a/src/commands/CmdCustom.cpp b/src/commands/CmdCustom.cpp index 1bfd8ca56..6fb338110 100644 --- a/src/commands/CmdCustom.cpp +++ b/src/commands/CmdCustom.cpp @@ -59,6 +59,21 @@ CmdCustom::CmdCustom ( _category = Category::report; } +//////////////////////////////////////////////////////////////////////////////// +// Whether a report uses context is defined by the report..context +// configuration variable. +// +bool CmdCustom::uses_context () const +{ + auto config = Context::getContext ().config; + auto key = "report." + _keyword + ".context"; + + if (config.has (key)) + return config.getBoolean (key); + else + return _uses_context; +} + //////////////////////////////////////////////////////////////////////////////// int CmdCustom::execute (std::string& output) { diff --git a/src/commands/CmdCustom.h b/src/commands/CmdCustom.h index 4b1dbf381..f88bc0303 100644 --- a/src/commands/CmdCustom.h +++ b/src/commands/CmdCustom.h @@ -34,6 +34,7 @@ class CmdCustom : public Command { public: CmdCustom (const std::string&, const std::string&, const std::string&); + bool uses_context () const override; int execute (std::string&); private: diff --git a/src/commands/Command.h b/src/commands/Command.h index 71c13bd30..f144a1cc3 100644 --- a/src/commands/Command.h +++ b/src/commands/Command.h @@ -63,7 +63,7 @@ public: bool read_only () const; bool displays_id () const; bool needs_gc () const; - bool uses_context () const; + virtual bool uses_context () const; bool accepts_filter () const; bool accepts_modifications () const; bool accepts_miscellaneous () const;