summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdecore/kstandarddirs.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index e1c78f6..75205d6 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -1,190 +1,190 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* Version: $Id$
* Generated: Thu Mar 5 16:05:28 EST 1998
*/
//US #include "config.h"
#include <stdlib.h>
#include <assert.h>
//US#include <errno.h>
//US #ifdef HAVE_SYS_STAT_H
//US #include <sys/stat.h>
//US #endif
//US#include <sys/types.h>
//US#include <dirent.h>
//US#include <pwd.h>
#include <qregexp.h>
#include <qasciidict.h>
#include <qdict.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qstring.h>
#include <qapplication.h>
#include <qstringlist.h>
#include "kstandarddirs.h"
#include "kconfig.h"
#include "kdebug.h"
//US #include "kinstance.h"
#include "kshell.h"
//US#include <sys/param.h>
//US#include <unistd.h>
//US
QString KStandardDirs::mAppDir = QString::null;
template class QDict<QStringList>;
#if 0
#include <qtextedit.h>
void ddd( QString op )
{
static QTextEdit * dot = 0;
if ( ! dot )
dot = new QTextEdit();
dot->show();
dot->append( op );
}
#endif
class KStandardDirs::KStandardDirsPrivate
{
public:
KStandardDirsPrivate()
: restrictionsActive(false),
dataRestrictionActive(false)
{ }
bool restrictionsActive;
bool dataRestrictionActive;
QAsciiDict<bool> restrictions;
QStringList xdgdata_prefixes;
QStringList xdgconf_prefixes;
};
static const char* const types[] = {"html", "icon", "apps", "sound",
"data", "locale", "services", "mime",
- "servicetypes", "config", "exe",
+ "servicetypes", "config", "exe", "tmp",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 };
static int tokenize( QStringList& token, const QString& str,
const QString& delim );
KStandardDirs::KStandardDirs( ) : addedCustoms(false)
{
d = new KStandardDirsPrivate;
dircache.setAutoDelete(true);
relatives.setAutoDelete(true);
absolutes.setAutoDelete(true);
savelocations.setAutoDelete(true);
addKDEDefaults();
}
KStandardDirs::~KStandardDirs()
{
delete d;
}
bool KStandardDirs::isRestrictedResource(const char *type, const QString& relPath) const
{
if (!d || !d->restrictionsActive)
return false;
if (d->restrictions[type])
return true;
if (strcmp(type, "data")==0)
{
applyDataRestrictions(relPath);
if (d->dataRestrictionActive)
{
d->dataRestrictionActive = false;
return true;
}
}
return false;
}
void KStandardDirs::applyDataRestrictions(const QString &relPath) const
{
QString key;
int i = relPath.find('/');
if (i != -1)
key = "data_"+relPath.left(i);
else
key = "data_"+relPath;
if (d && d->restrictions[key.latin1()])
d->dataRestrictionActive = true;
}
QStringList KStandardDirs::allTypes() const
{
QStringList list;
for (int i = 0; types[i] != 0; ++i)
list.append(QString::fromLatin1(types[i]));
return list;
}
void KStandardDirs::addPrefix( const QString& _dir )
{
if (_dir.isNull())
return;
QString dir = _dir;
if (dir.at(dir.length() - 1) != '/')
dir += '/';
if (!prefixes.contains(dir)) {
prefixes.append(dir);
dircache.clear();
}
}
void KStandardDirs::addXdgConfigPrefix( const QString& _dir )
{
if (_dir.isNull())
return;
QString dir = _dir;
if (dir.at(dir.length() - 1) != '/')
dir += '/';
if (!d->xdgconf_prefixes.contains(dir)) {
d->xdgconf_prefixes.append(dir);
dircache.clear();
}
}
void KStandardDirs::addXdgDataPrefix( const QString& _dir )
{