summaryrefslogtreecommitdiffstats
path: root/conduits/null
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
commitcb7eddb91455a69cf66fcd717e91a51ca5e2cfef (patch)
treecf5546e4d7c44370fbe9ca2be937bd254f30ebaa /conduits/null
downloadkpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.tar.gz
kpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.zip
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpilot@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'conduits/null')
-rw-r--r--conduits/null/CMakeLists.txt38
-rw-r--r--conduits/null/Makefile.am15
-rw-r--r--conduits/null/null-conduit.cc98
-rw-r--r--conduits/null/null-conduit.desktop63
-rw-r--r--conduits/null/null-conduit.h65
-rw-r--r--conduits/null/null-factory.cc125
-rw-r--r--conduits/null/null-factory.h40
-rw-r--r--conduits/null/nullSettings.kcfgc7
-rw-r--r--conduits/null/nullconduit.kcfg13
-rw-r--r--conduits/null/setup_base.ui128
10 files changed, 592 insertions, 0 deletions
diff --git a/conduits/null/CMakeLists.txt b/conduits/null/CMakeLists.txt
new file mode 100644
index 0000000..b2fdbb8
--- /dev/null
+++ b/conduits/null/CMakeLists.txt
@@ -0,0 +1,38 @@
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set(conduit_null_SRCS
+ null-conduit.cc
+ null-factory.cc
+)
+
+set(conduit_null_UIS
+ setup_base.ui
+)
+
+set(conduit_null_KCFGS
+ nullSettings.kcfgc
+)
+
+kde3_add_kcfg_files(conduit_null_SRCS ${conduit_null_KCFGS})
+kde3_add_ui_files(conduit_null_SRCS ${conduit_null_UIS})
+kde3_automoc(${conduit_null_SRCS})
+add_library(conduit_null SHARED ${conduit_null_SRCS})
+
+set_target_properties(
+ conduit_null PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
+ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
+ PREFIX ""
+)
+
+kde3_install_libtool_file(conduit_null)
+
+install(
+ TARGETS conduit_null
+ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
+)
+
+install(
+ FILES null-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
+)
diff --git a/conduits/null/Makefile.am b/conduits/null/Makefile.am
new file mode 100644
index 0000000..c1057b4
--- /dev/null
+++ b/conduits/null/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir)/kpilot/lib $(all_includes)
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = null-conduit.desktop
+
+kde_module_LTLIBRARIES = conduit_null.la
+
+
+conduit_null_la_SOURCES = nullSettings.kcfgc setup_base.ui null-conduit.cc null-factory.cc
+conduit_null_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+conduit_null_la_LIBADD = ../../lib/libkpilot.la $(LIB_KDEUI)
+
+kde_kcfg_DATA = nullconduit.kcfg
diff --git a/conduits/null/null-conduit.cc b/conduits/null/null-conduit.cc
new file mode 100644
index 0000000..d0c07c5
--- /dev/null
+++ b/conduits/null/null-conduit.cc
@@ -0,0 +1,98 @@
+/* KPilot
+**
+** Copyright (C) 2000-2001 by Adriaan de Groot
+**
+** This file is part of the NULL conduit, a conduit for KPilot that
+** does nothing except add a log message to the Pilot's HotSync log.
+** It is also intended as a programming example.
+**
+** This file does the actual conduit work.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to [email protected]
+*/
+
+
+#include "options.h"
+
+// Only include what we really need:
+// First UNIX system stuff, then std C++,
+// then Qt, then KDE, then local includes.
+//
+//
+#include <time.h>
+
+#include <kconfig.h>
+#include <kdebug.h>
+
+#include "pilotSerialDatabase.h"
+#include "null-factory.h"
+#include "null-conduit.h"
+#include "nullSettings.h"
+
+// A conduit that does nothing has a very
+// simple constructor and destructor.
+//
+//
+NullConduit::NullConduit(KPilotLink *d,
+ const char *n,
+ const TQStringList &l) :
+ ConduitAction(d,n,l),
+ fDatabase(0L),
+ fFailImmediately( l.tqcontains( CSL1("--fail") ))
+{
+ FUNCTIONSETUP;
+ fConduitName=i18n("Null");
+}
+
+NullConduit::~NullConduit()
+{
+ FUNCTIONSETUP;
+ KPILOT_DELETE(fDatabase);
+}
+
+/* virtual */ bool NullConduit::exec()
+{
+ FUNCTIONSETUP;
+
+ DEBUGKPILOT << fname << ": Mode " << syncMode().name() << endl;
+
+ if ( fFailImmediately )
+ {
+ DEBUGKPILOT << fname << ": Config says to fail now." << endl;
+ emit logError(i18n("NULL conduit is programmed to fail."));
+ return false;
+ }
+
+ TQString m(NullConduitSettings::logMessage());
+ if (!m.isEmpty())
+ {
+ addSyncLogEntry(m);
+ }
+
+ DEBUGKPILOT << fname
+ << ": Message from null-conduit: "
+ << m
+ << endl;
+
+ emit syncDone(this);
+ return true;
+}
diff --git a/conduits/null/null-conduit.desktop b/conduits/null/null-conduit.desktop
new file mode 100644
index 0000000..3aa6fdf
--- /dev/null
+++ b/conduits/null/null-conduit.desktop
@@ -0,0 +1,63 @@
+[Desktop Entry]
+Type=Service
+Name=NULL
+Name[ca]=NUL
+Name[fa]=پوچ
+Name[mk]=Нулов
+Name[ro]=NUL
+Name[sk]=NIČ
+Name[ta]=வெற்று மதிப்பு
+Name[tr]=BOŞ
+Comment=This conduit does nothing.
+Comment[af]=Hierdie pad doen niks
+Comment[bg]=Това нещо прави нищо
+Comment[bs]=Ovaj conduit ne radi ništa.
+Comment[ca]=Aquest conducte no fa res.
+Comment[cs]=Toto propojení nedělá nic.
+Comment[cy]=Nid yw'r cwndid yma yn gwneud unrhyw beth.
+Comment[da]=Denne kanal gør ingenting.
+Comment[de]=Diese Erweiterung (Conduit) ist ohne Funktion
+Comment[el]=Αυτός ο σύνδεσμος δεν κάνει τίποτα.
+Comment[eo]=Tiu kanalo faras nenion.
+Comment[et]=See kanal ei tee mitte kui midagi.
+Comment[eu]=Kanal honek ez du ezer egiten.
+Comment[fa]=این لوله هیچ چیز ندارد.
+Comment[fi]=Tämä yhdyskäytävä ei tee mitään.
+Comment[fr]=Ce canal ne fait rien.
+Comment[fy]=Dit conduit docht neat.
+Comment[ga]=Ní dhéanann an seoladán seo faic.
+Comment[gl]=Este conducto non fai nada.
+Comment[hi]=यह कन्ड्यूइट कुछ नहीं करता है.
+Comment[hu]=Ez a csatoló üres, csak tesztelési célokat szolgál
+Comment[is]=Þessi rás gerir ekki neitt.
+Comment[it]=Questo conduit non fa nulla.
+Comment[ja]=このコンジットは未知です。
+Comment[kk]=Ештеңе істемейтін арна.
+Comment[km]=បំពង់​នេះ​មិន​ធ្វើ​អ្វី​ទាំងអស់ ។
+Comment[lt]=Šis kanalas nieko neatlieka.
+Comment[mk]=Овој канал не прави ништо.
+Comment[ms]=Saluran ini tidak berbuat apa-apa.
+Comment[nb]=Denne kanalen gjør ingenting.
+Comment[nds]=Disse Kanaal deit gor nix.
+Comment[ne]=यो कन्ड्युटले केही पनि गर्दैन ।
+Comment[nl]=Dit conduit doet niets.
+Comment[nn]=Denne koplinga gjer ingenting.
+Comment[pl]=Ten łącznik nic nie robi.
+Comment[pt]=Esta conduta não faz nada.
+Comment[pt_BR]=Este conduíte não faz coisa alguma.
+Comment[ro]=Această conductă nu face nimic.
+Comment[ru]=Канал, который ничего не делает.
+Comment[sk]=Táto spojka nič nerobí.
+Comment[sl]=Ta veznik ne počne ničesar.
+Comment[sr]=Овај провод не ради ништа.
+Comment[sr@Latn]=Ovaj provod ne radi ništa.
+Comment[sv]=Den här kanalen gör ingenting.
+Comment[ta]=இந்த காப்புக் குழாய் ஒன்றும் செய்யாது
+Comment[tg]=Канале, ки дар ҳолати шурӯъ нест.
+Comment[tr]=Bu kanal herhangi bir işlem yapmaz.
+Comment[uk]=Цей акведук нічого не робить.
+Comment[zh_CN]=此管道不做任何事。
+Comment[zh_TW]=不做任何事。
+Implemented=file
+ServiceTypes=KPilotConduit
+X-KDE-Library=conduit_null
diff --git a/conduits/null/null-conduit.h b/conduits/null/null-conduit.h
new file mode 100644
index 0000000..48593d9
--- /dev/null
+++ b/conduits/null/null-conduit.h
@@ -0,0 +1,65 @@
+#ifndef _NULL_NULL_CONDUIT_H
+#define _NULL_NULL_CONDUIT_H
+/* null-conduit.h KPilot
+**
+** Copyright (C) 2000-2001 by Adriaan de Groot
+**
+** This file is part of the NULL conduit, a conduit for KPilot that
+** does nothing except add a log message to the Pilot's HotSync log.
+** It is also intended as a programming example.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to [email protected]
+*/
+
+#include "plugin.h"
+
+class PilotRecord;
+class PilotDatabase;
+
+/**
+ * The conduit Null does nothing. Almost nothing, anyway.
+ * It writes a single log message to the sync log and then
+ * completes successfully. For debugging purposes it can
+ * also simulate failure, but that is a very specialized
+ * case available only programmatically.
+ */
+class NullConduit : public ConduitAction
+{
+public:
+ /** Constructor. Special case is if @p tqcontains
+ * @c --fail as an argument to the conduit, then
+ * the conduit will fail instead of trivially succeeding.
+ */
+ NullConduit(KPilotLink *,
+ const char *name=0L,
+ const TQStringList &args = TQStringList());
+ virtual ~NullConduit();
+
+protected:
+ virtual bool exec();
+
+protected:
+ PilotDatabase *fDatabase;
+ bool fFailImmediately;
+};
+
+#endif
diff --git a/conduits/null/null-factory.cc b/conduits/null/null-factory.cc
new file mode 100644
index 0000000..c2d381d
--- /dev/null
+++ b/conduits/null/null-factory.cc
@@ -0,0 +1,125 @@
+/* KPilot
+**
+** Copyright (C) 2001 by Dan Pilone
+**
+** This file defines the factory for the null-conduit plugin.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to [email protected]
+*/
+
+#include "options.h"
+
+#include <tqtabwidget.h>
+#include <tqlineedit.h>
+#include <tqcheckbox.h>
+
+#include <kconfig.h>
+#include <kinstance.h>
+#include <kaboutdata.h>
+
+#include "pluginfactory.h"
+
+#include "setup_base.h"
+#include "null-conduit.h"
+#include "null-factory.h"
+#include "nullSettings.h"
+
+
+class NullConduitConfig : public ConduitConfigBase
+{
+public:
+ NullConduitConfig(TQWidget *parent=0L, const char *n=0L);
+ virtual void commit();
+ virtual void load();
+protected:
+ NullWidget *fConfigWidget;
+ KAboutData *fAbout;
+} ;
+
+NullConduitConfig::NullConduitConfig(TQWidget *p, const char *n) :
+ ConduitConfigBase(p,n),
+ fConfigWidget(new NullWidget(p))
+{
+ FUNCTIONSETUP;
+ fConduitName = i18n("Null");
+ fAbout = new KAboutData("nullConduit",
+ I18N_NOOP("Null Conduit for KPilot"),
+ KPILOT_VERSION,
+ I18N_NOOP("Configures the Null Conduit for KPilot"),
+ KAboutData::License_GPL,
+ "(C) 2001, Adriaan de Groot");
+ fAbout->addAuthor("Adriaan de Groot",
+ I18N_NOOP("Primary Author"),
+ "http://www.cs.kun.nl/~adridg/kpilot");
+
+ ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget,fAbout);
+ fWidget=fConfigWidget;
+ TQObject::connect(fConfigWidget->fLogMessage,TQT_SIGNAL(textChanged(const TQString&)),
+ this,TQT_SLOT(modified()));
+}
+
+/* virtual */ void NullConduitConfig::commit()
+{
+ FUNCTIONSETUP;
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname
+ << ": Message="
+ << fConfigWidget->fLogMessage->text()
+ << endl;
+#endif
+
+ NullConduitSettings::setLogMessage( fConfigWidget->fLogMessage->text() );
+ NullConduitSettings::self()->writeConfig();
+ unmodified();
+}
+
+/* virtual */ void NullConduitConfig::load()
+{
+ FUNCTIONSETUP;
+ NullConduitSettings::self()->readConfig();
+
+ fConfigWidget->fLogMessage->setText( NullConduitSettings::logMessage() );
+#ifdef DEBUG
+ DEBUGKPILOT << fname
+ << ": Read Message="
+ << fConfigWidget->fLogMessage->text()
+ << endl;
+#endif
+
+ unmodified();
+}
+
+
+
+extern "C"
+{
+
+unsigned long version_conduit_null = Pilot::PLUGIN_API;
+void *init_conduit_null()
+{
+ return new ConduitFactory<NullConduitConfig,NullConduit>(0,"nullconduit");
+}
+
+}
+
diff --git a/conduits/null/null-factory.h b/conduits/null/null-factory.h
new file mode 100644
index 0000000..2897ad4
--- /dev/null
+++ b/conduits/null/null-factory.h
@@ -0,0 +1,40 @@
+#ifndef _KPILOT_NULL_FACTORY_H
+#define _KPILOT_NULL_FACTORY_H
+/* null-factory.h KPilot
+**
+** Copyright (C) 2001 by Dan Pilone
+**
+** This file defines the factory for the null-conduit plugin.
+** It also defines the class for the behavior of the setup dialog.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation; either version 2.1 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with this program in a file called COPYING; if not, write to
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+** MA 02110-1301, USA.
+*/
+
+/*
+** Bug reports and questions can be sent to [email protected]
+*/
+
+
+extern "C"
+{
+
+void *init_conduit_null();
+
+}
+
+#endif
diff --git a/conduits/null/nullSettings.kcfgc b/conduits/null/nullSettings.kcfgc
new file mode 100644
index 0000000..17a65ca
--- /dev/null
+++ b/conduits/null/nullSettings.kcfgc
@@ -0,0 +1,7 @@
+File=nullconduit.kcfg
+ClassName= NullConduitSettings
+Singleton=true
+ItemAccessors=true
+Mutators=true
+GlobalEnums=true
+SetUserTexts=true
diff --git a/conduits/null/nullconduit.kcfg b/conduits/null/nullconduit.kcfg
new file mode 100644
index 0000000..3e899f1
--- /dev/null
+++ b/conduits/null/nullconduit.kcfg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="kpilotrc"/>
+ <group name="Null-conduit">
+ <entry name="LogMessage" type="String">
+ <label>The error message if the null conduit is supposed to fail</label>
+ <default>KPilot was here.</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/conduits/null/setup_base.ui b/conduits/null/setup_base.ui
new file mode 100644
index 0000000..25b6c08
--- /dev/null
+++ b/conduits/null/setup_base.ui
@@ -0,0 +1,128 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>NullWidget</class>
+<comment>A tabWidget for configuring
+the Null-conduit settings.</comment>
+<author>Adriaan de Groot</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="tqgeometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>342</width>
+ <height>163</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>570</width>
+ <height>270</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Null-Conduit Options</string>
+ </property>
+ <property name="tqlayoutMargin" stdset="0">
+ </property>
+ <property name="tqlayoutSpacing" stdset="0">
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="tqlayoutMargin" stdset="0">
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget2</cstring>
+ </property>
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>fLogMessage</cstring>
+ </property>
+ <property name="text">
+ <string>KPilot was here.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Enter the message to add to the Sync Log on your Pilot here.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Log message:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fLogMessage</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>tabWidget</tabstop>
+</tabstops>
+<tqlayoutdefaults spacing="6" margin="11"/>
+</UI>