|
|
|
@ -264,17 +264,17 @@ KioskRun::setupConfigEnv()
|
|
|
|
|
hostname[0] = 0;
|
|
|
|
|
gethostname(hostname, 255);
|
|
|
|
|
|
|
|
|
|
TQString tmpDir = TQString("%1/%2-%3").tqarg(kdeHome).tqarg("tmp").tqarg(hostname);
|
|
|
|
|
TQString tmpDir = TQString("%1/%2-%3").arg(kdeHome).arg("tmp").arg(hostname);
|
|
|
|
|
deleteDir(tmpDir);
|
|
|
|
|
::mkdir(TQFile::encodeName(newTmpDir), 0700);
|
|
|
|
|
::symlink(TQFile::encodeName(newTmpDir), TQFile::encodeName(tmpDir));
|
|
|
|
|
|
|
|
|
|
TQString socketDir = TQString("%1/%2-%3").tqarg(kdeHome).tqarg("socket").tqarg(hostname);
|
|
|
|
|
TQString socketDir = TQString("%1/%2-%3").arg(kdeHome).arg("socket").arg(hostname);
|
|
|
|
|
deleteDir(socketDir);
|
|
|
|
|
::mkdir(TQFile::encodeName(newSocketDir), 0700);
|
|
|
|
|
::symlink(TQFile::encodeName(newSocketDir), TQFile::encodeName(socketDir));
|
|
|
|
|
|
|
|
|
|
m_configDir = TQString("%1/.kde/share/config/").tqarg(m_homeDir);
|
|
|
|
|
m_configDir = TQString("%1/.kde/share/config/").arg(m_homeDir);
|
|
|
|
|
|
|
|
|
|
m_instance = new KInstance("kioskrun");
|
|
|
|
|
(void) m_instance->dirs(); // Create KStandardDirs obj
|
|
|
|
@ -338,7 +338,7 @@ KioskRun::shutdownConfigEnv()
|
|
|
|
|
m_instance = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ImmutabletqStatus
|
|
|
|
|
class ImmutableStatus
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
bool m_fileScope;
|
|
|
|
@ -352,7 +352,7 @@ bool
|
|
|
|
|
KioskRun::isConfigImmutable(const TQString &filename, const TQString &group)
|
|
|
|
|
{
|
|
|
|
|
(void) configFile(filename);
|
|
|
|
|
ImmutabletqStatus *status = m_immutableStatusCache.find(filename);
|
|
|
|
|
ImmutableStatus *status = m_immutableStatusCache.find(filename);
|
|
|
|
|
assert(status);
|
|
|
|
|
if (group.isEmpty())
|
|
|
|
|
return status->m_fileScope;
|
|
|
|
@ -364,7 +364,7 @@ void
|
|
|
|
|
KioskRun::setConfigImmutable(const TQString &filename, const TQString &_group, bool bImmutable)
|
|
|
|
|
{
|
|
|
|
|
(void) configFile(filename);
|
|
|
|
|
ImmutabletqStatus *status = m_immutableStatusCache.find(filename);
|
|
|
|
|
ImmutableStatus *status = m_immutableStatusCache.find(filename);
|
|
|
|
|
assert(status);
|
|
|
|
|
if (_group.isEmpty())
|
|
|
|
|
{
|
|
|
|
@ -377,7 +377,7 @@ KioskRun::setConfigImmutable(const TQString &filename, const TQString &_group, b
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TQString group = TQString("[%1]").tqarg(_group);
|
|
|
|
|
TQString group = TQString("[%1]").arg(_group);
|
|
|
|
|
if (status->m_lines.find(group))
|
|
|
|
|
{
|
|
|
|
|
if (!bImmutable)
|
|
|
|
@ -412,9 +412,9 @@ static void addImmutable(TQString &ext)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString
|
|
|
|
|
KioskRun::saveImmutabletqStatus(const TQString &filename)
|
|
|
|
|
KioskRun::saveImmutableStatus(const TQString &filename)
|
|
|
|
|
{
|
|
|
|
|
ImmutabletqStatus *status = new ImmutabletqStatus;
|
|
|
|
|
ImmutableStatus *status = new ImmutableStatus;
|
|
|
|
|
status->m_fileScope = false;
|
|
|
|
|
status->m_dirty = false;
|
|
|
|
|
m_immutableStatusCache.insert(filename, status);
|
|
|
|
@ -505,21 +505,21 @@ KioskRun::saveImmutabletqStatus(const TQString &filename)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
KioskRun::restoreImmutabletqStatus(const TQString &filename, bool force)
|
|
|
|
|
KioskRun::restoreImmutableStatus(const TQString &filename, bool force)
|
|
|
|
|
{
|
|
|
|
|
ImmutabletqStatus *status = m_immutableStatusCache.take(filename);
|
|
|
|
|
ImmutableStatus *status = m_immutableStatusCache.take(filename);
|
|
|
|
|
if (!status)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "KioskRun::restoreImmutabletqStatus(" << filename << ") status info missing" << endl;
|
|
|
|
|
kdDebug() << "KioskRun::restoreImmutableStatus(" << filename << ") status info missing" << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (!force && !status->m_dirty)
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "KioskRun::restoreImmutabletqStatus(" << filename << ") not changed" << endl;
|
|
|
|
|
kdDebug() << "KioskRun::restoreImmutableStatus(" << filename << ") not changed" << endl;
|
|
|
|
|
delete status;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
kdDebug() << "KioskRun::restoreImmutabletqStatus(" << filename << ") restoring" << endl;
|
|
|
|
|
kdDebug() << "KioskRun::restoreImmutableStatus(" << filename << ") restoring" << endl;
|
|
|
|
|
|
|
|
|
|
TQString path = status->m_tmpFile;
|
|
|
|
|
|
|
|
|
@ -625,7 +625,7 @@ KioskRun::flushConfigCache()
|
|
|
|
|
KConfig *config = it.current();
|
|
|
|
|
bool dirty = config->isDirty();
|
|
|
|
|
config->sync(); // Save
|
|
|
|
|
if (!restoreImmutabletqStatus(file, dirty))
|
|
|
|
|
if (!restoreImmutableStatus(file, dirty))
|
|
|
|
|
return false;
|
|
|
|
|
m_saveConfigCache.remove(file);
|
|
|
|
|
}
|
|
|
|
@ -646,7 +646,7 @@ KioskRun::configFile(const TQString &filename)
|
|
|
|
|
|
|
|
|
|
setupConfigEnv();
|
|
|
|
|
|
|
|
|
|
TQString saveLocation = saveImmutabletqStatus(filename);
|
|
|
|
|
TQString saveLocation = saveImmutableStatus(filename);
|
|
|
|
|
config = new KSimpleConfig(saveLocation);
|
|
|
|
|
m_saveConfigCache.insert(filename, config);
|
|
|
|
|
|
|
|
|
@ -743,7 +743,7 @@ KioskRun::setupRuntimeEnv()
|
|
|
|
|
char hostname[256];
|
|
|
|
|
hostname[0] = 0;
|
|
|
|
|
gethostname(hostname, 255);
|
|
|
|
|
TQString cacheDir = TQString("%1/.kde/cache-%2").tqarg(m_homeDir).tqarg(hostname);
|
|
|
|
|
TQString cacheDir = TQString("%1/.kde/cache-%2").arg(m_homeDir).arg(hostname);
|
|
|
|
|
|
|
|
|
|
deleteDir(cacheDir);
|
|
|
|
|
KStandardDirs::makeDir(cacheDir);
|
|
|
|
@ -751,10 +751,10 @@ KioskRun::setupRuntimeEnv()
|
|
|
|
|
::unlink(TQFile::encodeName(m_homeDir+".kderc"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString iceAuth = TQString("%1/.ICEauthority").tqarg(TQDir::homeDirPath());
|
|
|
|
|
TQString iceAuth = TQString("%1/.ICEauthority").arg(TQDir::homeDirPath());
|
|
|
|
|
setenv("ICEAUTHORITY", TQFile::encodeName(iceAuth), 0); // Don't overwrite existing setting
|
|
|
|
|
|
|
|
|
|
TQString xAuth = TQString("%1/.Xauthority").tqarg(TQDir::homeDirPath());
|
|
|
|
|
TQString xAuth = TQString("%1/.Xauthority").arg(TQDir::homeDirPath());
|
|
|
|
|
setenv("XAUTHORITY", TQFile::encodeName(xAuth), 0); // Don't overwrite existing setting
|
|
|
|
|
|
|
|
|
|
TQString dcopServerFile = m_homeDir+"/.kde/DCOPserver";
|
|
|
|
@ -902,11 +902,11 @@ KioskRun::createDir(const TQString &dir)
|
|
|
|
|
|
|
|
|
|
if (error.isEmpty())
|
|
|
|
|
msg = i18n("<qt>The directory <b>%1</b> could not be created because of an unspecified problem.<p>")
|
|
|
|
|
.tqarg(dir);
|
|
|
|
|
.arg(dir);
|
|
|
|
|
else
|
|
|
|
|
msg = i18n("<qt>The directory <b>%1</b> could not be created because of the following problem:"
|
|
|
|
|
"<p>%2<p>")
|
|
|
|
|
.tqarg(dir, NETACCESS::lastErrorString());
|
|
|
|
|
.arg(dir, NETACCESS::lastErrorString());
|
|
|
|
|
|
|
|
|
|
msg += i18n("Without this directory your changes can not be saved.<p>"
|
|
|
|
|
"Do you want to retry creating the directory or abort the saving of changes?</qt>");
|
|
|
|
@ -944,7 +944,7 @@ KioskRun::createRemoteDirRecursive(const KURL &dest, bool ask)
|
|
|
|
|
// Parent doesn't exist,
|
|
|
|
|
int result = KMessageBox::warningContinueCancel(kapp->mainWidget(),
|
|
|
|
|
i18n("<qt>The directory <b>%1</b> does not yet exist. "
|
|
|
|
|
"Do you want to create it?").tqarg(parent.prettyURL()), TQString(),
|
|
|
|
|
"Do you want to create it?").arg(parent.prettyURL()), TQString(),
|
|
|
|
|
i18n("Create &Dir"));
|
|
|
|
|
if (result != KMessageBox::Continue)
|
|
|
|
|
return false;
|
|
|
|
@ -984,11 +984,11 @@ KioskRun::createRemoteDir(const KURL &dest)
|
|
|
|
|
|
|
|
|
|
if (error.isEmpty())
|
|
|
|
|
msg = i18n("<qt>The directory <b>%1</b> could not be created because of an unspecified problem.<p>")
|
|
|
|
|
.tqarg(dest.prettyURL());
|
|
|
|
|
.arg(dest.prettyURL());
|
|
|
|
|
else
|
|
|
|
|
msg = i18n("<qt>The directory <b>%1</b> could not be created because of the following problem:"
|
|
|
|
|
"<p>%2<p>")
|
|
|
|
|
.tqarg(dest.prettyURL(), NETACCESS::lastErrorString());
|
|
|
|
|
.arg(dest.prettyURL(), NETACCESS::lastErrorString());
|
|
|
|
|
|
|
|
|
|
msg += i18n("Without this directory your files can not be uploaded.<p>"
|
|
|
|
|
"Do you want to retry creating the directory or abort uploading?</qt>");
|
|
|
|
@ -1034,11 +1034,11 @@ KioskRun::install(const TQString &file, const TQString &destination)
|
|
|
|
|
TQString msg;
|
|
|
|
|
if (error.isEmpty())
|
|
|
|
|
msg = i18n("<qt>The file <b>%1</b> could not be installed because of an unspecified problem.")
|
|
|
|
|
.tqarg(destination);
|
|
|
|
|
.arg(destination);
|
|
|
|
|
else
|
|
|
|
|
msg = i18n("<qt>The file <b>%1</b> could not be installed because of the following problem:"
|
|
|
|
|
"<p>%2<p>")
|
|
|
|
|
.tqarg(destination, NETACCESS::lastErrorString());
|
|
|
|
|
.arg(destination, NETACCESS::lastErrorString());
|
|
|
|
|
|
|
|
|
|
msg += i18n("Do you want to retry the installation or abort the saving of changes?</qt>");
|
|
|
|
|
|
|
|
|
@ -1068,11 +1068,11 @@ KioskRun::uploadRemote(const TQString &file, const KURL &dest)
|
|
|
|
|
TQString msg;
|
|
|
|
|
if (error.isEmpty())
|
|
|
|
|
msg = i18n("<qt>The file <b>%1</b> could not be uploaded to <b>%2</b> because of an unspecified problem.")
|
|
|
|
|
.tqarg(file, dest.prettyURL());
|
|
|
|
|
.arg(file, dest.prettyURL());
|
|
|
|
|
else
|
|
|
|
|
msg = i18n("<qt>The file <b>%1</b> could not be uploaded to <b>%2</b> because of the following problem:"
|
|
|
|
|
"<p>%3<p>")
|
|
|
|
|
.tqarg(file, dest.prettyURL(),NETACCESS::lastErrorString());
|
|
|
|
|
.arg(file, dest.prettyURL(),NETACCESS::lastErrorString());
|
|
|
|
|
|
|
|
|
|
msg += i18n("Do you want to retry or abort the uploading?</qt>");
|
|
|
|
|
|
|
|
|
@ -1156,7 +1156,7 @@ KioskRun::getProfileInfo(const TQString &profile, TQString &description, TQStrin
|
|
|
|
|
tmp.replace("/", "_");
|
|
|
|
|
defaultInstallDir += tmp+"/";
|
|
|
|
|
|
|
|
|
|
TQString group = TQString("Directories-%1").tqarg(profile);
|
|
|
|
|
TQString group = TQString("Directories-%1").arg(profile);
|
|
|
|
|
config->setGroup(group);
|
|
|
|
|
|
|
|
|
|
installDir = config->readEntry("prefixes", defaultInstallDir);
|
|
|
|
@ -1204,11 +1204,11 @@ KioskRun::openKderc()
|
|
|
|
|
TQString msg;
|
|
|
|
|
if (error.isEmpty())
|
|
|
|
|
msg = i18n("<qt>The file <b>%1</b> could not be accessed because of an unspecified problem.")
|
|
|
|
|
.tqarg(settingsUrl.path());
|
|
|
|
|
.arg(settingsUrl.path());
|
|
|
|
|
else
|
|
|
|
|
msg = i18n("<qt>The file <b>%1</b> could not be accessed because of the following problem:"
|
|
|
|
|
"<p>%2<p>")
|
|
|
|
|
.tqarg(settingsUrl.path(), error);
|
|
|
|
|
.arg(settingsUrl.path(), error);
|
|
|
|
|
|
|
|
|
|
msg += i18n("Do you want to retry the operation or abort the saving of changes?</qt>");
|
|
|
|
|
|
|
|
|
@ -1274,7 +1274,7 @@ KioskRun::setProfileInfo(const TQString &profile, const TQString &description, c
|
|
|
|
|
{
|
|
|
|
|
int msgResult = KMessageBox::warningYesNoCancelList(kapp->mainWidget(),
|
|
|
|
|
i18n("<qt>The profile directory <b>%1</b> contains the following files, "
|
|
|
|
|
"do you wish to delete these files?").tqarg(installDir),
|
|
|
|
|
"do you wish to delete these files?").arg(installDir),
|
|
|
|
|
allFiles,
|
|
|
|
|
i18n("Deleting Profile"),
|
|
|
|
|
#if KDE_IS_VERSION(3,2,91)
|
|
|
|
@ -1334,7 +1334,7 @@ KioskRun::setProfileInfo(const TQString &profile, const TQString &description, c
|
|
|
|
|
config->setGroup("Directories");
|
|
|
|
|
TQString oldAdmin = config->readEntry("kioskAdmin");
|
|
|
|
|
|
|
|
|
|
TQString group = TQString("Directories-%1").tqarg(profile);
|
|
|
|
|
TQString group = TQString("Directories-%1").arg(profile);
|
|
|
|
|
config->setGroup(group);
|
|
|
|
|
|
|
|
|
|
if ((installDir == config->readEntry("prefixes")) &&
|
|
|
|
@ -1420,8 +1420,8 @@ KioskRun::newProfile()
|
|
|
|
|
KConfig *config = kapp->config();
|
|
|
|
|
for(int p = 1; p; p++)
|
|
|
|
|
{
|
|
|
|
|
TQString profile = TQString("profile%1").tqarg(p);
|
|
|
|
|
TQString group = TQString("Directories-%1").tqarg(profile);
|
|
|
|
|
TQString profile = TQString("profile%1").arg(p);
|
|
|
|
|
TQString group = TQString("Directories-%1").arg(profile);
|
|
|
|
|
if (!config->hasGroup(group))
|
|
|
|
|
{
|
|
|
|
|
if (profilePrefix.isEmpty())
|
|
|
|
@ -1614,7 +1614,7 @@ KioskRun::setCustomRestrictionFileBrowsing(bool restrict)
|
|
|
|
|
TQStringList urlRestrictions;
|
|
|
|
|
for(int i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
TQString key = TQString("rule_%1").tqarg(i+1);
|
|
|
|
|
TQString key = TQString("rule_%1").arg(i+1);
|
|
|
|
|
if (cfg->hasKey(key))
|
|
|
|
|
urlRestrictions.append(cfg->readEntry(key));
|
|
|
|
|
}
|
|
|
|
@ -1640,7 +1640,7 @@ KioskRun::setCustomRestrictionFileBrowsing(bool restrict)
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
TQString key = TQString("rule_%1").tqarg(i+1);
|
|
|
|
|
TQString key = TQString("rule_%1").arg(i+1);
|
|
|
|
|
cfg->writeEntry(key, urlRestrictions[i]);
|
|
|
|
|
}
|
|
|
|
|
KioskRun::self()->setConfigImmutable(file, group, true);
|
|
|
|
|