From a084db19661b746c110a4515bb7e0b7cd869502c Mon Sep 17 00:00:00 2001 From: Vincent Reher Date: Mon, 12 Sep 2022 09:14:01 -0700 Subject: [PATCH] Implement a single global instance of TDEHiddenFileMatcher, available to all applications that do not require their own class instance. Match criteria defaults to duplicating traditional dotfile detection but can be modifed and extended as desired. Criteria is stored ${TDEHOME}/share/config/kdeglobals. A future TDE control module will implemented that provides a user interface for viewing or modifying the global match criteria default. Signed-off-by: Vincent Reher --- tdecore/tdeglobal.cpp | 13 +++++++++++++ tdecore/tdeglobal.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/tdecore/tdeglobal.cpp b/tdecore/tdeglobal.cpp index 8ef5f59db..bb3e95682 100644 --- a/tdecore/tdeglobal.cpp +++ b/tdecore/tdeglobal.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #ifdef __TDE_HAVE_TDEHWLIB #include @@ -131,6 +132,16 @@ KCharsets *TDEGlobal::charsets() return _charsets; } +TDEHiddenFileMatcher *TDEGlobal::hiddenFileMatcher() +{ + if( _hiddenFileMatcher == 0 ) { + _hiddenFileMatcher = new TDEHiddenFileMatcher(); + kglobal_init(); + } + + return _hiddenFileMatcher; +} + void TDEGlobal::setActiveInstance(TDEInstance *i) { _activeInstance = i; @@ -223,6 +234,8 @@ TDEInstance *TDEGlobal::_instance = 0; TDEInstance *TDEGlobal::_activeInstance = 0; TDELocale *TDEGlobal::_locale = 0; KCharsets *TDEGlobal::_charsets = 0; +TDEHiddenFileMatcher *TDEGlobal::_hiddenFileMatcher = 0; + KStaticDeleterList *TDEGlobal::_staticDeleters = 0; #ifdef WIN32 diff --git a/tdecore/tdeglobal.h b/tdecore/tdeglobal.h index 1269c36a9..ec033c994 100644 --- a/tdecore/tdeglobal.h +++ b/tdecore/tdeglobal.h @@ -30,6 +30,7 @@ class TDEHardwareDevices; class TDEGlobalNetworkManager; #endif class TDELocale; +class TDEHiddenFileMatcher; class TDEStandardDirs; class KStaticDeleterBase; class KStaticDeleterList; @@ -107,6 +108,12 @@ public: */ static KCharsets *charsets(); + /** + * The global hidden file matcher. + * @return the global hidden file matcher + */ + static TDEHiddenFileMatcher *hiddenFileMatcher(); + /** * Creates a static TQString. * @@ -174,6 +181,7 @@ public: static TDEInstance *_instance; static TDELocale *_locale; static KCharsets *_charsets; + static TDEHiddenFileMatcher *_hiddenFileMatcher; static KStaticDeleterList *_staticDeleters; /**