summaryrefslogtreecommitdiff
path: root/plugins-alternative/SessionLoader/KDE4
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-alternative/SessionLoader/KDE4')
-rw-r--r--plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h28
-rw-r--r--plugins-alternative/SessionLoader/KDE4/Environment.h10
-rw-r--r--plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h1
-rw-r--r--plugins-alternative/SessionLoader/KDE4/Variable.h15
-rw-r--r--plugins-alternative/SessionLoader/KDE4/documentation.dox32
-rw-r--r--plugins-alternative/SessionLoader/KDE4/informations.xml26
-rw-r--r--plugins-alternative/SessionLoader/KDE4/plugin.json1
-rw-r--r--plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp58
-rw-r--r--plugins-alternative/SessionLoader/KDE4/sessionLoader.h33
-rw-r--r--plugins-alternative/SessionLoader/KDE4/sessionLoader.pro15
10 files changed, 219 insertions, 0 deletions
diff --git a/plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h b/plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h
new file mode 100644
index 0000000..4582010
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h
@@ -0,0 +1,28 @@
+/** \file DebugEngineMacro.h
+\brief Define the macro for the debug
+\author alpha_one_x86
+\licence GPL3, see the file COPYING */
+
+#ifndef DEBUGENGINEMACRO_H
+#define DEBUGENGINEMACRO_H
+
+#ifdef WIN32
+# define __func__ __FUNCTION__
+#endif
+
+/// \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-alternative/SessionLoader/KDE4/Environment.h b/plugins-alternative/SessionLoader/KDE4/Environment.h
new file mode 100644
index 0000000..265a5a6
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/Environment.h
@@ -0,0 +1,10 @@
+/** \file Environment.h
+\brief Define the environment variable and global function
+\author alpha_one_x86
+\licence GPL3, see the file COPYING */
+
+#include "Variable.h"
+/// \brief The global include
+#include "StructEnumDefinition.h"
+#include "DebugEngineMacro.h"
+
diff --git a/plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h b/plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h
new file mode 100644
index 0000000..c1758f4
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h
@@ -0,0 +1 @@
+#include "../../../StructEnumDefinition.h"
diff --git a/plugins-alternative/SessionLoader/KDE4/Variable.h b/plugins-alternative/SessionLoader/KDE4/Variable.h
new file mode 100644
index 0000000..963d0c8
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/Variable.h
@@ -0,0 +1,15 @@
+/** \file Variable.h
+\brief Define the environment variable
+\author alpha_one_x86
+\licence GPL3, see the file COPYING */
+
+#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-alternative/SessionLoader/KDE4/documentation.dox b/plugins-alternative/SessionLoader/KDE4/documentation.dox
new file mode 100644
index 0000000..cf5f3e4
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/documentation.dox
@@ -0,0 +1,32 @@
+/* -*- 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>.
+
+ \section mainpage_platforms Platforms
+
+ Ultracopier might be usable in all environments where you find Qt 5.\n
+ Ultracopier requires Qt 5.0 or newer. Tested on Qt 5.0.
+
+ \section mainpage_downloads Downloads
+
+ You can find the link on <a href="http://ultracopier.first-world.info/">Ultracopier</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-alternative/SessionLoader/KDE4/informations.xml b/plugins-alternative/SessionLoader/KDE4/informations.xml
new file mode 100644
index 0000000..33d260f
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/informations.xml
@@ -0,0 +1,26 @@
+<?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>windows-x86</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>1.4.0.3</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[
+ ]]></dependencies>
+</package> \ No newline at end of file
diff --git a/plugins-alternative/SessionLoader/KDE4/plugin.json b/plugins-alternative/SessionLoader/KDE4/plugin.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/plugin.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
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 <QFile>
+#include <QDir>
+#include <QCoreApplication>
+
+#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()
+{
+}
diff --git a/plugins-alternative/SessionLoader/KDE4/sessionLoader.h b/plugins-alternative/SessionLoader/KDE4/sessionLoader.h
new file mode 100644
index 0000000..b037da7
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/sessionLoader.h
@@ -0,0 +1,33 @@
+/** \file sessionLoader.h
+\brief Define the session loader
+\author alpha_one_x86
+\licence GPL3, see the file COPYING */
+
+#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 KDESessionLoader : public PluginInterface_SessionLoader
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "first-world.info.ultracopier.PluginInterface.SessionLoader/1.0.0.0" FILE "plugin.json")
+ Q_INTERFACES(PluginInterface_SessionLoader)
+public:
+ /// \brief to set if it's enabled or not
+ void setEnabled(const bool &enabled);
+ /// \brief to get if is enabled
+ bool getEnabled() const;
+ /// \brief set the resources for the plugins
+ void setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion);
+ /// \brief to get the options widget, NULL if not have
+ QWidget * options();
+public slots:
+ /// \brief to reload the translation, because the new language have been loaded
+ void newLanguageLoaded();
+};
+
+#endif // SESSION_LOADER_PLUGIN_H
diff --git a/plugins-alternative/SessionLoader/KDE4/sessionLoader.pro b/plugins-alternative/SessionLoader/KDE4/sessionLoader.pro
new file mode 100644
index 0000000..4ac69b4
--- /dev/null
+++ b/plugins-alternative/SessionLoader/KDE4/sessionLoader.pro
@@ -0,0 +1,15 @@
+CONFIG += c++11
+QMAKE_CXXFLAGS+="-std=c++0x -Wall -Wextra"
+mac:QMAKE_CXXFLAGS+="-stdlib=libc++"
+
+TEMPLATE = lib
+CONFIG += plugin
+HEADERS = \
+ $$PWD/sessionLoader.h \
+ $$PWD/StructEnumDefinition.h \
+ $$PWD/Variable.h \
+ $$PWD/Environment.h \
+ $$PWD/DebugEngineMacro.h \
+ $$PWD/../../../interface/PluginInterface_SessionLoader.h
+SOURCES = sessionLoader.cpp
+TARGET = $$qtLibraryTarget(sessionLoader)