Commit 4ba90d0f authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove unused code

parent aabb5113
......@@ -45,94 +45,6 @@ public:
QString name;
QString comment;
KEntryMap map;
QString expandString(const QString &value)
{
QString aValue = value;
// check for environment variables and make necessary translations
int nDollarPos = aValue.indexOf(QLatin1Char('$'));
while (nDollarPos != -1 && nDollarPos + 1 < aValue.length()) {
// there is at least one $
if (aValue[nDollarPos + 1] == QLatin1Char('(')) {
int nEndPos = nDollarPos + 1;
// the next character is not $
while ((nEndPos <= aValue.length()) && (aValue[nEndPos] != QLatin1Char(')'))) {
nEndPos++;
}
nEndPos++;
QString cmd = aValue.mid(nDollarPos + 2, nEndPos - nDollarPos - 3);
QString result;
// FIXME: wince does not have pipes
#ifndef _WIN32_WCE
FILE *fs = popen(QFile::encodeName(cmd).data(), "r");
if (fs) {
QTextStream ts(fs, QIODevice::ReadOnly);
result = ts.readAll().trimmed();
pclose(fs);
}
#endif
aValue.replace(nDollarPos, nEndPos - nDollarPos, result);
nDollarPos += result.length();
} else if (aValue[nDollarPos + 1] != QLatin1Char('$')) {
int nEndPos = nDollarPos + 1;
// the next character is not $
QStringRef aVarName;
if (aValue[nEndPos] == QLatin1Char('{')) {
while ((nEndPos <= aValue.length()) && (aValue[nEndPos] != QLatin1Char('}'))) {
nEndPos++;
}
nEndPos++;
aVarName = aValue.midRef(nDollarPos + 2, nEndPos - nDollarPos - 3);
} else {
while (nEndPos <= aValue.length() &&
(aValue[nEndPos].isNumber() ||
aValue[nEndPos].isLetter() ||
aValue[nEndPos] == QLatin1Char('_'))) {
nEndPos++;
}
aVarName = aValue.midRef(nDollarPos + 1, nEndPos - nDollarPos - 1);
}
QString env;
if (!aVarName.isEmpty()) {
#ifdef Q_OS_WIN
if (aVarName == QLatin1String("HOME")) {
env = QDir::homePath();
} else
#endif
{
QByteArray pEnv = qgetenv(aVarName.toLatin1().constData());
if (!pEnv.isEmpty()) {
env = QString::fromLocal8Bit(pEnv.constData());
} else {
if (aVarName == QStringLiteral("QT_DATA_HOME")) {
env = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
} else if (aVarName == QStringLiteral("QT_CONFIG_HOME")) {
env = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
} else if (aVarName == QStringLiteral("QT_CACHE_HOME")) {
env = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
}
}
}
aValue.replace(nDollarPos, nEndPos - nDollarPos, env);
nDollarPos += env.length();
} else {
aValue.remove(nDollarPos, nEndPos - nDollarPos);
}
} else {
// remove one of the dollar signs
aValue.remove(nDollarPos, 1);
nDollarPos++;
}
nDollarPos = aValue.indexOf(QLatin1Char('$'), nDollarPos);
}
return aValue;
}
};
KisTag::KisTag()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment