Gui index config: only show the custom subtrees that come from the user config, not the standard ones from the system file

This commit is contained in:
Jean-Francois Dockes 2012-02-03 18:26:12 +01:00
parent e96579568a
commit 98caf723ec
2 changed files with 14 additions and 2 deletions

View File

@ -295,7 +295,14 @@ ConfSubPanelW::ConfSubPanelW(QWidget *parent, ConfNull *config)
SLOT(subDirChanged(QListWidgetItem *, QListWidgetItem *)));
connect(m_subdirs, SIGNAL(entryDeleted(QString)),
this, SLOT(subDirDeleted(QString)));
list<string> allkeydirs = config->getSubKeys();
// We only retrieve the subkeys from the user's config (shallow),
// no use to confuse the user by showing the subtrees which are
// customized in the system config like .thunderbird or
// .purple. This doesn't prevent them to add and customize them
// further.
list<string> allkeydirs = config->getSubKeys(true);
QStringList qls;
for (list<string>::const_iterator it = allkeydirs.begin();
it != allkeydirs.end(); it++) {

View File

@ -105,6 +105,7 @@ public:
virtual int eraseKey(const string &) = 0;
virtual void listall() {};
virtual list<string> getSubKeys() = 0;
virtual list<string> getSubKeys(bool) = 0;
virtual bool holdWrites(bool) = 0;
};
@ -205,6 +206,7 @@ public:
/**
* Return all subkeys
*/
virtual list<string> getSubKeys(bool) {return getSubKeys();}
virtual list<string> getSubKeys();
virtual string getFilename() {return m_filename;}
@ -435,7 +437,8 @@ public:
return nms;
}
virtual list<string> getSubKeys()
virtual list<string> getSubKeys(){return getSubKeys(false);}
virtual list<string> getSubKeys(bool shallow)
{
list<string> sks;
typename list<T*>::iterator it;
@ -443,6 +446,8 @@ public:
list<string> lst;
lst = (*it)->getSubKeys();
sks.insert(sks.end(), lst.begin(), lst.end());
if (shallow)
break;
}
sks.sort();
sks.unique();