diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 37333bf25ad9a4c538250f5af2f9f1d666362883 (patch) | |
tree | c45e8df5b9efbffe07eb3d9340df7811c7e16943 /ksysv/ksv_service.cpp | |
download | tdeadmin-37333bf25ad9a4c538250f5af2f9f1d666362883.tar.gz tdeadmin-37333bf25ad9a4c538250f5af2f9f1d666362883.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksysv/ksv_service.cpp')
-rw-r--r-- | ksysv/ksv_service.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/ksysv/ksv_service.cpp b/ksysv/ksv_service.cpp new file mode 100644 index 0000000..e13ab6f --- /dev/null +++ b/ksysv/ksv_service.cpp @@ -0,0 +1,76 @@ +/*************************************************************************** + begin : Sun Oct 3 1999 + copyright : (C) 1999 by Peter Putzer + email : putzer@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; version 2. * + * * + ***************************************************************************/ + +#include <ksv_service.h> +#include "leveldb.h" + +KSVService::KSVService (const QString &name, const QString &basedir) + : name_ (name), + base_ (basedir) +{ + +} + +KSVService* KSVService::newService (const QString &name, const QString &basedir) +{ + struct service service; + + int result = ::readServiceInfo (basedir.local8Bit(), name.local8Bit(), &service ); + + if (!result) + { + KSVService* tmp = new KSVService(name, basedir); + tmp->desc_ = service.desc; + tmp->levels = service.levels; + tmp->kPriority = service.kPriority; + tmp->sPriority = service.sPriority; + + return tmp; + } + else + { + return 0L; + } +} + +KSVService::~KSVService() +{ +} + +bool KSVService::isOn (int level) const +{ + return !::isOn (base_.local8Bit(), name_.local8Bit(), level ); +} + +bool KSVService::isConfigured (int level) const +{ + return !::isConfigured (base_.local8Bit(), name_.local8Bit(), level); +} + +int KSVService::set (int level, bool on) +{ + struct service service; + service.name = strdup (name_.local8Bit()); + service.desc = strdup (desc_.local8Bit()); + service.levels = levels; + service.kPriority = kPriority; + service.sPriority = sPriority; + + return ::doSetService ("/etc/rc.d", service, level, on); +} + +QString KSVService::description () const +{ + return desc_.stripWhiteSpace(); +} |