mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kdeui: use foreach() for iterations in KIconLoader
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
9c4a2560c4
commit
0fc795f6a3
2 changed files with 78 additions and 84 deletions
|
@ -614,7 +614,9 @@ void KIconLoaderPrivate::addThemeByName(const QString &themename, const QString
|
|||
|
||||
void KIconLoader::addExtraDesktopThemes()
|
||||
{
|
||||
if ( d->extraDesktopIconsLoaded ) return;
|
||||
if (d->extraDesktopIconsLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->initIconThemes();
|
||||
|
||||
|
@ -622,30 +624,26 @@ void KIconLoader::addExtraDesktopThemes()
|
|||
const QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon");
|
||||
QStringList::ConstIterator it;
|
||||
char buf[1000];
|
||||
int r;
|
||||
for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
|
||||
{
|
||||
QDir dir(*it);
|
||||
foreach (const QString &it, icnlibs) {
|
||||
QDir dir(it);
|
||||
if (!dir.exists())
|
||||
continue;
|
||||
const QStringList lst = dir.entryList(QStringList( "default.*" ), QDir::Dirs);
|
||||
QStringList::ConstIterator it2;
|
||||
for (it2=lst.begin(); it2!=lst.end(); ++it2)
|
||||
{
|
||||
if (!KStandardDirs::exists(*it + *it2 + "/index.theme"))
|
||||
foreach (const QString &it2, lst) {
|
||||
if (!KStandardDirs::exists(it + it2 + "/index.theme")) {
|
||||
continue;
|
||||
r=readlink( QFile::encodeName(*it + *it2) , buf, sizeof(buf)-1);
|
||||
if ( r>0 )
|
||||
{
|
||||
}
|
||||
const int r = readlink(QFile::encodeName(it + it2), buf, sizeof(buf) - 1);
|
||||
if (r > 0) {
|
||||
buf[r] = 0;
|
||||
const QDir dir2(buf);
|
||||
QString themeName=dir2.dirName();
|
||||
|
||||
if (!list.contains(themeName))
|
||||
const QString themeName = dir2.dirName();
|
||||
if (!list.contains(themeName)) {
|
||||
list.append(themeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (it = list.constBegin(); it != list.constEnd(); ++it)
|
||||
{
|
||||
|
@ -1263,19 +1261,17 @@ QStringList KIconLoader::queryIconsByContext(int group_or_size,
|
|||
// Eliminate duplicate entries (same icon in different directories)
|
||||
QString name;
|
||||
QStringList res2, entries;
|
||||
QStringList::ConstIterator it;
|
||||
for (it=result.constBegin(); it!=result.constEnd(); ++it)
|
||||
{
|
||||
int n = (*it).lastIndexOf('/');
|
||||
if (n == -1)
|
||||
name = *it;
|
||||
else
|
||||
name = (*it).mid(n+1);
|
||||
foreach (const QString &it, result) {
|
||||
const int n = it.lastIndexOf('/');
|
||||
if (n == -1) {
|
||||
name = it;
|
||||
} else {
|
||||
name = it.mid(n + 1);
|
||||
}
|
||||
name = d->removeIconExtension(name);
|
||||
if (!entries.contains(name))
|
||||
{
|
||||
if (!entries.contains(name)) {
|
||||
entries += name;
|
||||
res2 += *it;
|
||||
res2 += it;
|
||||
}
|
||||
}
|
||||
return res2;
|
||||
|
@ -1306,19 +1302,17 @@ QStringList KIconLoader::queryIcons(int group_or_size, KIconLoader::Context cont
|
|||
// Eliminate duplicate entries (same icon in different directories)
|
||||
QString name;
|
||||
QStringList res2, entries;
|
||||
QStringList::ConstIterator it;
|
||||
for (it=result.constBegin(); it!=result.constEnd(); ++it)
|
||||
{
|
||||
int n = (*it).lastIndexOf('/');
|
||||
if (n == -1)
|
||||
name = *it;
|
||||
else
|
||||
name = (*it).mid(n+1);
|
||||
foreach (const QString &it, result) {
|
||||
const int n = it.lastIndexOf('/');
|
||||
if (n == -1) {
|
||||
name = it;
|
||||
} else {
|
||||
name = it.mid(n+1);
|
||||
}
|
||||
name = d->removeIconExtension(name);
|
||||
if (!entries.contains(name))
|
||||
{
|
||||
if (!entries.contains(name)) {
|
||||
entries += name;
|
||||
res2 += *it;
|
||||
res2 += it;
|
||||
}
|
||||
}
|
||||
return res2;
|
||||
|
|
|
@ -172,7 +172,7 @@ public:
|
|||
* iconloader object yourself. That one is the current KComponentData's
|
||||
* (typically KApplication's) iconloader.
|
||||
*/
|
||||
explicit KIconLoader(const QString& appname=QString(), KStandardDirs *dirs = 0, QObject* parent = 0);
|
||||
explicit KIconLoader(const QString &appname = QString(), KStandardDirs *dirs = nullptr, QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Constructs an iconloader.
|
||||
|
@ -183,7 +183,7 @@ public:
|
|||
* iconloader object yourself. That one is the current KComponentData's
|
||||
* (typically KApplication's) iconloader.
|
||||
*/
|
||||
explicit KIconLoader(const KComponentData &componentData, QObject* parent = 0);
|
||||
explicit KIconLoader(const KComponentData &componentData, QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Cleanup
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
*/
|
||||
QPixmap loadIcon(const QString &name, KIconLoader::Group group, int size = 0,
|
||||
int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList(),
|
||||
QString *path_store=0L,
|
||||
QString *path_store = nullptr,
|
||||
bool canReturnNull = false) const;
|
||||
|
||||
/**
|
||||
|
@ -255,7 +255,7 @@ public:
|
|||
*/
|
||||
QPixmap loadMimeTypeIcon(const QString &iconName, KIconLoader::Group group, int size = 0,
|
||||
int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList(),
|
||||
QString *path_store=0 ) const;
|
||||
QString *path_store = nullptr) const;
|
||||
|
||||
/**
|
||||
* Returns the path of an icon.
|
||||
|
|
Loading…
Add table
Reference in a new issue