KControl: Add option to toggle visibility of hidden modules

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
(cherry picked from commit 82ed0caa3f)
r14.1.x
Mavridis Philippe 2 months ago
parent 10675b72c3
commit eac0d87067

@ -43,6 +43,7 @@ TQString KCGlobal::_iversion = "";
TQString KCGlobal::_imachine = "";
IndexViewMode KCGlobal::_viewmode = Icon;
TDEIcon::StdSizes KCGlobal::_iconsize = TDEIcon::SizeMedium;
bool KCGlobal::_showhidden = false;
TQString KCGlobal::_baseGroup = "";
void KCGlobal::init()

@ -46,6 +46,7 @@ public:
static TQString systemMachine() { return _imachine; }
static IndexViewMode viewMode() { return _viewmode; }
static TDEIcon::StdSizes iconSize() { return _iconsize; }
static bool showHiddenModules() { return _showhidden; }
static TQString baseGroup();
static void setIsInfoCenter(bool b) { _infocenter = b; }
@ -60,6 +61,7 @@ public:
static void setSystemMachine(const TQString& n){ _imachine = n; }
static void setViewMode(IndexViewMode m) { _viewmode = m; }
static void setIconSize(TDEIcon::StdSizes s) { _iconsize = s; }
static void setShowHiddenModules(bool o) { _showhidden = o; }
static void repairAccels( TQWidget * tw );
@ -71,6 +73,7 @@ private:
static IndexViewMode _viewmode;
static TDEIcon::StdSizes _iconsize;
static TQString _baseGroup;
static bool _showhidden;
};
#endif

@ -42,6 +42,8 @@ void IndexWidget::reload()
{
if (_icon)
_icon->fill();
if (_tree)
_tree->fill();
}
TQListViewItem *IndexWidget::firstTreeViewItem()

@ -12,6 +12,8 @@
<Action name="activate_largeicons"/>
<Action name="activate_hugeicons"/>
</Menu>
<Separator/>
<Action name="show_hidden_modules"/>
</Menu>
<Menu name="help">
<Action name="help_about_module" append="about_merge"/>

@ -103,7 +103,7 @@ extern "C" TDE_EXPORT int kdemain(int argc, char *argv[])
TDELocale::setMainCatalogue("kcontrol");
TDEAboutData aboutKControl( "kcontrol", I18N_NOOP("Trinity Control Center"),
KCONTROL_VERSION, I18N_NOOP("The Trinity Control Center"), TDEAboutData::License_GPL,
I18N_NOOP("(c) 1998-2004, The Trinity Control Center Developers"));
I18N_NOOP("(c) 1998-2024, The Trinity Control Center Developers"));
TQCString argv_0 = argv[0];
TDEAboutData *aboutData;

@ -25,6 +25,7 @@
#include <kstandarddirs.h>
#include <kservicegroup.h>
#include <kiconloader.h>
#include <tdecmoduleloader.h>
#include <kdebug.h>
@ -168,3 +169,14 @@ TQPixmap ModuleIconView::loadIcon( const TQString &name )
return icon;
}
ModuleIconItem::ModuleIconItem(TQListView *parent, const TQString& text, const TQPixmap& pm, ConfigModule *m)
: TDEListViewItem(parent, text)
, _tag(TQString::null)
, _module(m)
{
setPixmap(0, pm);
if (!_module) return;
setVisible(KCGlobal::showHiddenModules() || !_module->needsTest() || TDECModuleLoader::testModule(*_module));
}

@ -29,13 +29,7 @@ class ModuleIconItem : public TDEListViewItem
{
public:
ModuleIconItem(TQListView *parent, const TQString& text, const TQPixmap& pm, ConfigModule *m = 0)
: TDEListViewItem(parent, text)
, _tag(TQString::null)
, _module(m)
{
setPixmap(0, pm);
}
ModuleIconItem(TQListView *parent, const TQString& text, const TQPixmap& pm, ConfigModule *m = 0);
void setConfigModule(ConfigModule* m) { _module = m; }
void setTag(const TQString& t) { _tag = t; }

@ -286,7 +286,7 @@ bool ConfigModuleList::readDesktopEntriesRecursive(const TQString &path)
continue;
ConfigModule *module = new ConfigModule(s);
if (module->library().isEmpty() || (module->needsTest() && !TDECModuleLoader::testModule(*module)))
if (module->library().isEmpty())
{
delete module;
continue;

@ -26,6 +26,7 @@
#include <tdelocale.h>
#include <kiconloader.h>
#include <kservicegroup.h>
#include <tdecmoduleloader.h>
#include <kdebug.h>
#include <tqwhatsthis.h>
#include <tqbitmap.h>
@ -91,6 +92,14 @@ ModuleTreeView::ModuleTreeView(ConfigModuleList *list, TQWidget * parent, const
void ModuleTreeView::fill()
{
// If we have a currently selected module, preserve selection
ConfigModule *currentModule = nullptr;
if (currentItem())
{
currentModule = static_cast<ModuleTreeItem*>(currentItem())->module();
}
// (Re)fill the tree view
clear();
TQStringList subMenus = _modules->submenus(KCGlobal::baseGroup());
@ -107,7 +116,14 @@ void ModuleTreeView::fill()
TQPtrList<ConfigModule> moduleList = _modules->modules(KCGlobal::baseGroup());
for (module=moduleList.first(); module != 0; module=moduleList.next())
{
new ModuleTreeItem(this, module);
new ModuleTreeItem(this, module);
}
// Restore selection
if (currentModule)
{
makeSelected(currentModule);
makeVisible(currentModule);
}
}
@ -131,8 +147,6 @@ void ModuleTreeView::fill(ModuleTreeItem *parent, const TQString &parentPath)
}
}
TQSize ModuleTreeView::sizeHint() const
{
return TQListView::sizeHint().boundedTo(
@ -272,12 +286,7 @@ ModuleTreeItem::ModuleTreeItem(TQListViewItem *parent, ConfigModule *module)
, _tag(TQString::null)
, _maxChildIconWidth(0)
{
if (_module)
{
setText(0, " " + module->moduleName());
_icon = module->icon();
setPixmap(0, appIcon(_icon));
}
init();
}
ModuleTreeItem::ModuleTreeItem(TQListView *parent, ConfigModule *module)
@ -286,12 +295,7 @@ ModuleTreeItem::ModuleTreeItem(TQListView *parent, ConfigModule *module)
, _tag(TQString::null)
, _maxChildIconWidth(0)
{
if (_module)
{
setText(0, " " + module->moduleName());
_icon = module->icon();
setPixmap(0, appIcon(_icon));
}
init();
}
ModuleTreeItem::ModuleTreeItem(TQListViewItem *parent, const TQString& text)
@ -308,6 +312,18 @@ ModuleTreeItem::ModuleTreeItem(TQListView *parent, const TQString& text)
, _maxChildIconWidth(0)
{}
void ModuleTreeItem::init()
{
if (!_module) return;
setText(0, " " + _module->moduleName());
_icon = _module->icon();
setPixmap(0, appIcon(_icon));
setVisible(KCGlobal::showHiddenModules() || !_module->needsTest() || TDECModuleLoader::testModule(*_module));
}
void ModuleTreeItem::setPixmap(int column, const TQPixmap& pm)
{
if (!pm.isNull())

@ -56,6 +56,9 @@ public:
protected:
void paintCell( TQPainter * p, const TQColorGroup & cg, int column, int width, int align );
private:
void init();
private:
ConfigModule *_module;
TQString _tag;

@ -267,6 +267,10 @@ actionCollection());
actionCollection(), "activate_hugeicons");
icon_huge->setExclusiveGroup( "iconsize" );
show_hidden_modules = new TDEToggleAction
(i18n("Show hidden modules"), 0, this, TQ_SLOT(toggleHiddenModules()),
actionCollection(), "show_hidden_modules");
about_module = new TDEAction(i18n("About Current Module"), 0, this, TQ_SLOT(aboutModule()), actionCollection(), "help_about_module");
about_module->setEnabled(false);
@ -340,6 +344,12 @@ void TopLevel::activateHugeIcons()
_index->reload();
}
void TopLevel::toggleHiddenModules()
{
KCGlobal::setShowHiddenModules(show_hidden_modules->isChecked());
_index->reload();
}
void TopLevel::newModule(const TQString &name, const TQString& docPath, const TQString &quickhelp)
{
setCaption(name, false);

@ -64,6 +64,7 @@ protected slots:
void activateMediumIcons();
void activateLargeIcons();
void activateHugeIcons();
void toggleHiddenModules();
void deleteDummyAbout();
@ -86,6 +87,7 @@ private:
TDEToggleAction *tree_view, *icon_view;
TDEToggleAction *icon_small, *icon_medium, *icon_large, *icon_huge;
TDEToggleAction *show_hidden_modules;
TDEAction *report_bug, *about_module;
IndexWidget *_index;

Loading…
Cancel
Save