From 3958fa914c8a524ed4b6a5b035b794e12708fa1d Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Thu, 1 Mar 2018 22:42:01 +0000 Subject: Import ultracopier_1.4.0.4.orig.tar.xz [dgit import orig ultracopier_1.4.0.4.orig.tar.xz] --- .../SessionLoader/KDE4/sessionLoader.cpp | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp (limited to 'plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp') diff --git a/plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp b/plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp new file mode 100644 index 0000000..8024264 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp @@ -0,0 +1,58 @@ +/** \file session-loader.cpp +\brief Define the session plugin loader test +\author alpha_one_x86 +*/ + +#include +#include +#include + +#include "sessionLoader.h" +void KDESessionLoader::setEnabled(const bool &enabled) +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, enabled: "+QString::number(enabled)); + QFile link(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"); + if(!enabled) + { + if(link.exists() && !link.remove()) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to remove from the startup: "+link.errorString()); + } + else + { + if(link.open(QIODevice::WriteOnly)) + { + link.write(QStringLiteral("#!/bin/bash\n").toLocal8Bit()); + link.write(QString(QCoreApplication::applicationFilePath()).toLocal8Bit()); + link.close(); + if(!link.setPermissions(QFile::ExeOwner|QFile::WriteOwner|QFile::ReadOwner)) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to set permissions: "+link.errorString()); + } + else + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to open in writing the file: "+link.errorString()); + } +} + +bool KDESessionLoader::getEnabled() const +{ + //return the value into the variable + return QFile::exists(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"); +} + +void KDESessionLoader::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion) +{ + Q_UNUSED(options); + Q_UNUSED(writePath); + Q_UNUSED(pluginPath); + Q_UNUSED(portableVersion); +} + +/// \brief to get the options widget, NULL if not have +QWidget * KDESessionLoader::options() +{ + return NULL; +} + +/// \brief to reload the translation, because the new language have been loaded +void KDESessionLoader::newLanguageLoaded() +{ +} -- cgit v1.2.3