diff options
Diffstat (limited to 'plugins/SessionLoader/KDE4')
-rw-r--r-- | plugins/SessionLoader/KDE4/DebugEngineMacro.h | 25 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/Environment.h | 11 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/StructEnumDefinition.h | 1 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/Variable.h | 16 | ||||
-rwxr-xr-x | plugins/SessionLoader/KDE4/documentation.dox | 33 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/informations.xml | 27 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/sessionLoader.cpp | 51 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/sessionLoader.h | 33 | ||||
-rw-r--r-- | plugins/SessionLoader/KDE4/sessionLoader.pro | 11 |
9 files changed, 208 insertions, 0 deletions
diff --git a/plugins/SessionLoader/KDE4/DebugEngineMacro.h b/plugins/SessionLoader/KDE4/DebugEngineMacro.h new file mode 100644 index 0000000..a3dd648 --- /dev/null +++ b/plugins/SessionLoader/KDE4/DebugEngineMacro.h @@ -0,0 +1,25 @@ +/** \file DebugEngineMacro.h +\brief Define the macro for the debug +\author alpha_one_x86 +\version 0.3 +\date 2010 */ + +#ifndef DEBUGENGINEMACRO_H +#define DEBUGENGINEMACRO_H + +/// \brief Macro for the debug log +#ifdef ULTRACOPIER_PLUGIN_DEBUG + #if defined (__FILE__) && defined (__LINE__) + #define ULTRACOPIER_DEBUGCONSOLE(a,b) emit debugInformation(a,__func__,b,__FILE__,__LINE__) + #else + #define ULTRACOPIER_DEBUGCONSOLE(a,b) emit debugInformation(a,__func__,b) + #endif +#else // ULTRACOPIER_DEBUG + #define ULTRACOPIER_DEBUGCONSOLE(a,b) void() +#endif // ULTRACOPIER_DEBUG + +#endif // DEBUGENGINEMACRO_H + + + + diff --git a/plugins/SessionLoader/KDE4/Environment.h b/plugins/SessionLoader/KDE4/Environment.h new file mode 100644 index 0000000..94fd104 --- /dev/null +++ b/plugins/SessionLoader/KDE4/Environment.h @@ -0,0 +1,11 @@ +/** \file Environment.h
+\brief Define the environment variable and global function
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#include "Variable.h"
+/// \brief The global include
+#include "StructEnumDefinition.h"
+#include "DebugEngineMacro.h"
+
diff --git a/plugins/SessionLoader/KDE4/StructEnumDefinition.h b/plugins/SessionLoader/KDE4/StructEnumDefinition.h new file mode 100644 index 0000000..c1758f4 --- /dev/null +++ b/plugins/SessionLoader/KDE4/StructEnumDefinition.h @@ -0,0 +1 @@ +#include "../../../StructEnumDefinition.h" diff --git a/plugins/SessionLoader/KDE4/Variable.h b/plugins/SessionLoader/KDE4/Variable.h new file mode 100644 index 0000000..8179c93 --- /dev/null +++ b/plugins/SessionLoader/KDE4/Variable.h @@ -0,0 +1,16 @@ +/** \file Variable.h
+\brief Define the environment variable
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#ifndef VARIABLE_H
+#define VARIABLE_H
+
+//Un-comment this next line to put ultracopier plugin in debug mode
+#define ULTRACOPIER_PLUGIN_DEBUG
+
+#endif // VARIABLE_H
+
+
+
diff --git a/plugins/SessionLoader/KDE4/documentation.dox b/plugins/SessionLoader/KDE4/documentation.dox new file mode 100755 index 0000000..fbf0eb4 --- /dev/null +++ b/plugins/SessionLoader/KDE4/documentation.dox @@ -0,0 +1,33 @@ +/* -*- mode: C++ ; c-file-style: "stroustrup" -*- **/ + +/* + This file contains NO source code, just some documentation for doxygen to + parse. +*/ + +/*! + \mainpage KDE4 + + \section mainpage_overview Overview + + It control if it loaded with the session.\n + More informations on <a href="http://ultracopier-wiki.first-world.info/">the wiki of ultracopier</a>. Is part of Ultracopier 0.3 project. + + \section mainpage_platforms Platforms + + This plugin might be usable in all environments where you find Qt 4.\n + To be compatible with the official Ultracopier plugins, you need compil it with Gcc, Qt4.8, and same env as Ultracopier have been compiled, see the documentation. + + \section mainpage_downloads Downloads + + You can found link on <a href="http://ultracopier.first-world.info/">Ultracopier (Supercopier/Teracopy)</a> project page, via git, snapshot sources, ... + + \section mainpage_algorithm Method + + It pass by ~/.kde4/Autostart/ultracopier.sh to set/get it. + + \section license GPL Version 3 + The code source is under GPL3. The image is extacted from Oxygen icon pack of KDE4. + +*/ + diff --git a/plugins/SessionLoader/KDE4/informations.xml b/plugins/SessionLoader/KDE4/informations.xml new file mode 100644 index 0000000..761ba98 --- /dev/null +++ b/plugins/SessionLoader/KDE4/informations.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<package> + <title xml:lang="en"><![CDATA[Session loader for test]]></title><!-- english is required --> + <title xml:lang="fr"><![CDATA[Chargeur de session pour des testes]]></title> + <!-- What kind of plugin this is --> + <category>SessionLoader</category> + <!-- Who wrote this plugin --> + <author><![CDATA[BRULE Herman, alpha_one_x86 (alpha_one_x86@first-world.info)]]></author> + <!-- URL of page or site for this plugin (may provide additional information, bug reports, feature requests). --> + <website xml:lang="en"><![CDATA[http://ultracopier.first-world.info/]]></website><!-- not required --> + <website xml:lang="fr"><![CDATA[http://ultracopier-fr.first-world.info/]]></website><!-- not required --> + <!-- the date-time format should be in timestamps format --> + <pubDate>1287496800</pubDate> + <!-- the architecture code of this plugin, found PlatformMacro.h into ultracopier source --> + <architecture>linux-x86_64-pc</architecture> + <!-- Detailed description --> + <description xml:lang="en"><![CDATA[Test plugin to show how create SessionLoader plugin]]></description> + <description xml:lang="fr"><![CDATA[Plugin de test pour monter comment créer un plugin SessionLoader]]></description> + <!-- Version of this release of this plugin, need be like that's: A.B.C.D, where A, B, C and D is number --> + <version>0.3.0.4</version> + <!-- This internal name should never change, because it is used to detect when a particular plugin is updated. It must comprise only lower case ASCII characters (a-z), numerical digits (0-9), "-", "." or "_", and it must be be unique within the category. And have size lower than 64 char. --> + <name>KDE4</name> + <!-- Dependency checking. This is used to check when a plugin may not be compatible with an updated version of either Ultracopier or another plugin. This example only checks Ultracopier. --> + <dependencies><![CDATA[ + >=ultracopier-0.3.0.4 + ]]></dependencies> +</package>
\ No newline at end of file diff --git a/plugins/SessionLoader/KDE4/sessionLoader.cpp b/plugins/SessionLoader/KDE4/sessionLoader.cpp new file mode 100644 index 0000000..99a9f7c --- /dev/null +++ b/plugins/SessionLoader/KDE4/sessionLoader.cpp @@ -0,0 +1,51 @@ +/** \file session-loader.cpp +\brief Define the session plugin loader test +\author alpha_one_x86 +\version 0.3 +\date 2010 */ + +#include <QtCore> +#include <QFile> +#include <QDir> + +#include "sessionLoader.h" +void SessionLoaderPlugin::setEnabled(bool newValue) +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, newValue: "+QString::number(newValue)); + QFile link(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"); + if(!newValue) + { + if(link.exists() && !link.remove()) + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"unable to remove from the startup: "+link.errorString()); + } + else + { + if(link.open(QIODevice::WriteOnly)) + { + link.write(QString("#!/bin/bash\n").toLocal8Bit()); + link.write(QString(QCoreApplication::applicationFilePath()).toLocal8Bit()); + link.close(); + if(!link.setPermissions(QFile::ExeOwner|QFile::WriteOwner|QFile::ReadOwner)) + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"unable to set permissions: "+link.errorString()); + } + else + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"unable to open in writing the file: "+link.errorString()); + } +} + +bool SessionLoaderPlugin::getEnabled() +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, return this value: "+QString::number(QFile::exists(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"))); + //return the value into the variable + return QFile::exists(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"); +} + +void SessionLoaderPlugin::setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion) +{ + Q_UNUSED(options); + Q_UNUSED(writePath); + Q_UNUSED(pluginPath); + Q_UNUSED(portableVersion); +} + +Q_EXPORT_PLUGIN2(sessionLoader, SessionLoaderPlugin); diff --git a/plugins/SessionLoader/KDE4/sessionLoader.h b/plugins/SessionLoader/KDE4/sessionLoader.h new file mode 100644 index 0000000..ca04fa6 --- /dev/null +++ b/plugins/SessionLoader/KDE4/sessionLoader.h @@ -0,0 +1,33 @@ +/** \file sessionLoader.h +\brief Define the session loader +\author alpha_one_x86 +\version 0.3 +\date 2010 */ + +#ifndef SESSION_LOADER_PLUGIN_H +#define SESSION_LOADER_PLUGIN_H + +#include <QObject> +#include "Environment.h" +#include "../../../interface/PluginInterface_SessionLoader.h" + +/// \brief Define the session loader +class SessionLoaderPlugin : public PluginInterface_SessionLoader +{ + Q_OBJECT + Q_INTERFACES(PluginInterface_SessionLoader) +public: + /// \brief to set if it's enabled or not + void setEnabled(bool); + /// \brief to get if is enabled + bool getEnabled(); + /// \brief set the resources for the plugins + void setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion); +signals: + #ifdef ULTRACOPIER_PLUGIN_DEBUG + /// \brief To debug source + void debugInformation(DebugLevel level,QString fonction,QString text,QString file,int ligne); + #endif +}; + +#endif // SESSION_LOADER_PLUGIN_H diff --git a/plugins/SessionLoader/KDE4/sessionLoader.pro b/plugins/SessionLoader/KDE4/sessionLoader.pro new file mode 100644 index 0000000..5351ab1 --- /dev/null +++ b/plugins/SessionLoader/KDE4/sessionLoader.pro @@ -0,0 +1,11 @@ +TEMPLATE = lib +CONFIG += plugin +HEADERS = sessionLoader.h \ + StructEnumDefinition.h \ + Variable.h \ + Environment.h \ + DebugEngineMacro.h \ + ../../../interface/PluginInterface_SessionLoader.h +SOURCES = sessionLoader.cpp +TARGET = $$qtLibraryTarget(sessionLoader) +TRANSLATIONS += Languages/fr/translation.ts |