summaryrefslogtreecommitdiffstats
path: root/conduits/notepadconduit
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/notepadconduit
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/notepadconduit')
-rw-r--r--conduits/notepadconduit/CMakeLists.txt38
-rw-r--r--conduits/notepadconduit/Makefile.am14
-rw-r--r--conduits/notepadconduit/notepad-conduit.cc265
-rw-r--r--conduits/notepadconduit/notepad-conduit.desktop64
-rw-r--r--conduits/notepadconduit/notepad-conduit.h94
-rw-r--r--conduits/notepadconduit/notepad-factory.cc124
-rw-r--r--conduits/notepadconduit/notepad-factory.h38
-rw-r--r--conduits/notepadconduit/notepad-setup.ui79
-rw-r--r--conduits/notepadconduit/notepadconduit.kcfg14
-rw-r--r--conduits/notepadconduit/notepadconduit.kcfgc7
10 files changed, 737 insertions, 0 deletions
diff --git a/conduits/notepadconduit/CMakeLists.txt b/conduits/notepadconduit/CMakeLists.txt
new file mode 100644
index 0000000..90e202d
--- /dev/null
+++ b/conduits/notepadconduit/CMakeLists.txt
@@ -0,0 +1,38 @@
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set(conduit_notepad_SRCS
+ notepad-factory.cc
+ notepad-conduit.cc
+)
+
+set(conduit_notepad_UIS
+ notepad-setup.ui
+)
+
+set(conduit_notepad_KCFGS
+ notepadconduit.kcfgc
+)
+
+kde3_add_kcfg_files(conduit_notepad_SRCS ${conduit_notepad_KCFGS})
+kde3_add_ui_files(conduit_notepad_SRCS ${conduit_notepad_UIS})
+kde3_automoc(${conduit_notepad_SRCS})
+add_library(conduit_notepad SHARED ${conduit_notepad_SRCS})
+
+set_target_properties(
+ conduit_notepad PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
+ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
+ PREFIX ""
+)
+
+kde3_install_libtool_file(conduit_notepad)
+
+install(
+ TARGETS conduit_notepad
+ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
+)
+
+install(
+ FILES notepad-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
+)
diff --git a/conduits/notepadconduit/Makefile.am b/conduits/notepadconduit/Makefile.am
new file mode 100644
index 0000000..d50e4fd
--- /dev/null
+++ b/conduits/notepadconduit/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir)/kpilot/lib $(all_includes)
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = notepad-conduit.desktop
+
+kde_module_LTLIBRARIES = conduit_notepad.la
+
+conduit_notepad_la_SOURCES = notepadconduit.kcfgc notepad-setup.ui \
+ notepad-conduit.cc notepad-factory.cc
+conduit_notepad_la_LDFLAGS= -module $(KDE_PLUGIN) $(all_libraries)
+conduit_notepad_la_LIBADD= ../../lib/libkpilot.la $(LIB_KDEUI) $(LIB_KIO)
+
diff --git a/conduits/notepadconduit/notepad-conduit.cc b/conduits/notepadconduit/notepad-conduit.cc
new file mode 100644
index 0000000..10d9bf7
--- /dev/null
+++ b/conduits/notepadconduit/notepad-conduit.cc
@@ -0,0 +1,265 @@
+/* KPilot
+**
+** Copyright (C) 2004 by Adriaan de Groot, Joern Ahrens
+**
+** The code for NotepadActionThread::unpackNotePad was taken from
+** Angus Ainslies read-notepad.c, which is part of pilot-link.
+** NotepadActionThread::saveImage is also based on read-notepad.c.
+**
+** This file is part of the Notepad conduit, a conduit for KPilot that
+** stores the notepad drawings to files.
+*/
+
+/*
+** 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 "pilotUser.h"
+#include "pilotSerialDatabase.h"
+
+#include "notepad-conduit.h" // The Conduit action
+#include "notepadconduit.h" // The settings class
+
+#include <pi-notepad.h>
+
+#include <tqthread.h>
+#include <tqapplication.h>
+#include <tqvaluelist.h>
+#include <tqimage.h>
+#include <tqdir.h>
+#include <tqcstring.h>
+
+extern "C"
+{
+unsigned long version_conduit_notepad = Pilot::PLUGIN_API;
+}
+
+NotepadConduit::NotepadConduit(KPilotLink *d, const char *n,
+ const TQStringList &args) : ConduitAction(d, n, args)
+{
+ FUNCTIONSETUP;
+ fConduitName=i18n("Notepad");
+ thread = 0L;
+
+}
+
+NotepadConduit::~NotepadConduit()
+{
+ FUNCTIONSETUP;
+}
+
+/* virtual */ bool NotepadConduit::exec()
+{
+ FUNCTIONSETUP;
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": In exec() @" << (unsigned long) this << endl;
+#endif
+
+ TQDir dir(NotepadConduitSettings::outputDirectory());
+ if(!dir.exists() && !dir.mkdir(dir.path())) {
+ emit logError(i18n("Unable to open %1").arg(dir.path()));
+ delayDone();
+ return false;
+ }
+ else {
+ thread = new NotepadActionThread(this, deviceLink());
+ thread->start();
+ // tickle is disabled due to crashs during sync
+ // -> PADP TX "unexpected package"
+// startTickle();
+ }
+
+ return true;
+}
+
+bool NotepadConduit::event(TQEvent *e)
+{
+ FUNCTIONSETUP;
+
+ if(e->type() == TQEvent::User) {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": Notepad thread done." << endl;
+#endif
+// stopTickle();
+ delayDone();
+ if(thread->getFailed())
+ logError(i18n("1 notepad could not be saved", "%n notepads could not be saved", thread->getFailed()));
+ logMessage(i18n("1 notepad saved", "%n notepads saved", thread->getSaved()));
+ delete thread;
+ return true;
+ }
+ else
+ return ConduitAction::event(e);
+}
+
+//-----------------------------------------------------------------------------
+// NotepadActionThread
+//-----------------------------------------------------------------------------
+
+NotepadActionThread::NotepadActionThread(TQObject *parent, KPilotLink *link) :
+ fParent(parent), fLink(link), notSaved(0), saved(0)
+{
+ FUNCTIONSETUP;
+}
+
+void NotepadActionThread::run()
+{
+ FUNCTIONSETUP;
+
+ PilotDatabase *db = fLink->database( CSL1("npadDB") );
+
+ int n = db->recordCount();
+
+ if ( n > 0 )
+ {
+ TQValueList<recordid_t> vl = db->idList();
+ TQValueList<recordid_t>::iterator it;
+ struct NotePad a;
+ for ( it = vl.begin(); it != vl.end(); ++it )
+ {
+ PilotRecord *pr = db->readRecordById(*it);
+ if(pr)
+ {
+ unpack_NotePad(&a, (unsigned char*)pr->data(), pr->size());
+ saveImage(&a);
+ free_NotePad(&a);
+ }
+ }
+ }
+ KPILOT_DELETE(db);
+ TQApplication::postEvent(fParent, new TQEvent(TQEvent::User));
+}
+
+static void saveImageFromBITS(TQImage &image, struct NotePad *n, unsigned int width)
+{
+ FUNCTIONSETUP;
+ image.setColor(0, tqRgb(0xaa, 0xc1 ,0x91));
+ image.setColor(1, tqRgb(0x30, 0x36, 0x29));
+
+ int x = 0;
+ int y = 0;
+ int pos = 0;
+ for(unsigned int i=0; i<n->body.dataLen/2; ++i)
+ {
+ for(int j=0; j<n->data[i].repeat; ++j)
+ {
+ for(int k=0; k<8; ++k)
+ {
+ y = pos / width;
+ x = pos % width ;
+
+ image.setPixel( x, y,
+ (n->data[i].data & 1<<(7-k)) ? 1 : 0 );
+ ++pos;
+ }
+ }
+ }
+}
+
+static void saveImageFromUNCOMPRESSED(TQImage &image, struct NotePad *n, unsigned int width)
+{
+ FUNCTIONSETUP;
+
+ image.setColor(0, tqRgb(0xaa, 0xc1 ,0x91));
+ image.setColor(1, tqRgb(0x30, 0x36, 0x29));
+
+ unsigned int pos = 0;
+ unsigned int x,y;
+
+ for (unsigned int i=0; i<n->body.dataLen / 2; ++i)
+ {
+ for (unsigned int k=0; k<8; ++k)
+ {
+ y = pos / width;
+ x = pos % width ;
+
+ image.setPixel( x, y,
+ (n->data[i].repeat & 1<<(7-k)) ? 1 : 0 );
+ ++pos;
+ }
+
+ for (unsigned int k=0; k<8; ++k)
+ {
+ y = pos / width;
+ x = pos % width ;
+
+ image.setPixel( x, y,
+ (n->data[i].data & 1<<(7-k)) ? 1 : 0 );
+ ++pos;
+ }
+ }
+}
+
+void NotepadActionThread::saveImage(struct NotePad *n)
+{
+ FUNCTIONSETUP;
+
+ // Width needs adjusting, based on whether it's low res (+8)
+ // or a hi-res notepad image.
+ int width = n->body.width + ( n->body.width > 160 ? 16 : 8 );
+ int height = n->body.height;
+
+
+ TQImage image(width, height, 8, 2);
+
+ switch (n->body.dataType)
+ {
+ case NOTEPAD_DATA_BITS :
+ saveImageFromBITS( image,n,width );
+ break;
+ case NOTEPAD_DATA_UNCOMPRESSED :
+ saveImageFromUNCOMPRESSED( image,n,width );
+ break;
+ case NOTEPAD_DATA_PNG :
+ image.loadFromData((uchar*)(n->data), n->body.dataLen);
+ break;
+ default :
+ // Unknown data type
+ WARNINGKPILOT << "Unknown data type: " << n->body.dataType << endl;
+ return;
+
+ // TODO: Post a warning to the UI
+ }
+
+ TQString filename(n->name);
+ if(filename.isEmpty())
+ {
+ filename.sprintf("%4d-%02d-%02d_%02d-%02d-%02d",
+ n->changeDate.year,
+ n->changeDate.month,
+ n->changeDate.day,
+ n->changeDate.hour,
+ n->changeDate.min,
+ n->changeDate.sec);
+ }
+ TQString imgname = TQString("%1/%2.png").arg(NotepadConduitSettings::outputDirectory()).arg(filename);
+
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": Notepad " << imgname << endl;
+#endif
+ if(!image.save(imgname, "PNG", -1))
+ ++notSaved;
+ else
+ ++saved;
+}
+
diff --git a/conduits/notepadconduit/notepad-conduit.desktop b/conduits/notepadconduit/notepad-conduit.desktop
new file mode 100644
index 0000000..4847621
--- /dev/null
+++ b/conduits/notepadconduit/notepad-conduit.desktop
@@ -0,0 +1,64 @@
+[Desktop Entry]
+Type=Service
+Name=NotePad
+Name[cs]=Poznámkový blok
+Name[da]=Notesblok
+Name[de]=Notizen
+Name[es]=Bloc de notas
+Name[fi]=Muistio
+Name[fr]=Notes
+Name[gl]=Caderno de Notas
+Name[hu]=Notepad
+Name[nb]=NotisBlokk
+Name[ne]=नोटप्याड
+Name[nn]=NotisBlokk
+Name[pl]=Notatnik
+Name[sv]=Anteckningar
+Name[ta]=நோட்பேட்
+Name[tg]=Эзоҳот
+Name[zh_CN]=记事本
+Comment=This conduit backs up NotePad drawings to a local folder.
+Comment[af]=Hierdie pad sinkroniseer NotePad tekeninge na 'n plaaslike gids.
+Comment[bg]=Създаване на архивни копия на изображенията създадени с NotePad в локална директория.
+Comment[ca]=Aquest conducte copia els dibuixos NotePad a una carpeta local.
+Comment[cs]=Toto propojení synchronizuje záznamy v PDA s lokálním adresářem.
+Comment[da]=Denne kanal sikkerhedskopierer NotePad's tegninger til en lokal mappe.
+Comment[de]=Diese Erweiterung (Conduit) sichert NotePad-Zeichnungen in einen lokalen Ordner.
+Comment[el]=Αυτός ο σύνδεσμος δημιουργεί αντίγραφα ασφαλείας σχεδίων του NotePad σε έναν τοπικό φάκελο.
+Comment[es]=Este conducto copia los dibujos del bloc de notas en una carpeta local.
+Comment[et]=See kanal teeb NotePadi joonistustest varukoopia kohalikku kataloogi.
+Comment[eu]=Kanal honek Ohar-blokaren marrazkiak karpeta lokal batera gordetzen ditu.
+Comment[fa]=این لوله، ترسیمهای NotePad را در پوشه‌ای محلی پشتیبانی می‌کند.
+Comment[fi]=Tämä yhdyskäytävä tekee varmuuskopion NotePad -piirroksista paikalliseen kansioon.
+Comment[fr]=Ce conduit sauvegarde les dessins (Notes) dans un dossier local
+Comment[fy]=Dit conduit makket in reservekopy fan de notysje fan de notysje-oantekenings nei in lokale map.
+Comment[gl]=Este conducto pon de volta os debuxos do NotePad a un cartafol local.
+Comment[hu]=Bővítőmodul NotePad-rajzok helyi könyvtárba való lementéséhez.
+Comment[is]=Þessi rás afritar NotePad teikningar í staðbundna möppu.
+Comment[it]=Questo conduit archivia i disegni NotePad in una cartella locale.
+Comment[ja]=このコンジットは NotePad の絵をローカルのフォルダにバックアップします。
+Comment[kk]=NotePad файлдарының сақтық көшірмелерін жергілікті қапшықта жасау арнасы.
+Comment[km]=បំពង់​នេះ​អាច​បម្រុង​ទុក​គំនូរ NotePad ទៅ​ថត​មូលដ្ឋាន ។
+Comment[lt]=Šis kanalas padaro NotePad piešinių atsargines kopijas į vietinį aplanką.
+Comment[ms]=Saluran ini menyandarkan lukisan NotePad ke folder setempat.
+Comment[nb]=Denne kanalen tar sikkerhetskopi av NotePad tegninger til en lokal mappe.
+Comment[nds]=Sekert NotePad-Teken binnen en lokaal Orner.
+Comment[ne]=यो कन्ड्युटले स्थानीय फाइलमा नोटप्याड रेखाचित्र ब्याकअप गर्छ ।
+Comment[nl]=Dit conduit maakt een backup van de notitie-aantekeningen naar een lokale map.
+Comment[pl]=Ten łącznik robi kopię zapasową rysunków z Notatnika do lokalnego katalogu.
+Comment[pt]=Esta conduta salvaguarda desenhos NotePad para uma pasta local.
+Comment[pt_BR]=Este conduíte faz backup de desenhos do NotePad em uma pasta local.
+Comment[ru]=Канал создания резервных копий примечаний в локальной папке.
+Comment[sk]=Táto spojka zálohuje poznámky NotePad do lokálneho priečinku.
+Comment[sl]=Ta veznik arhivira risanja z NotePadom v krajevno mapo.
+Comment[sr]=Овај провод прави резервне копије NotePad цртежа у локалну фасциклу.
+Comment[sr@Latn]=Ovaj provod pravi rezervne kopije NotePad crteža u lokalnu fasciklu.
+Comment[sv]=Den här kanalen säkerhetskopierar ritade anteckningar i en lokal katalog.
+Comment[ta]=இது நோட்பேடின் வரைபடங்களை உள்ளடைவுக்கு சேமிக்கிறது
+Comment[tr]=Bu bileşen, NotePad çizimlerini yerel bir dosyaya aktarır veya alır.
+Comment[uk]=Цей акведук створює резервну копію нотаток у локальній теці.
+Comment[zh_CN]=此管道将记事本的绘图保存到本地文件夹。
+Comment[zh_TW]=此軟體備份 NotePad 畫的圖到本地端資料夾。
+Implemented=file
+ServiceTypes=KPilotConduit
+X-KDE-Library=conduit_notepad
diff --git a/conduits/notepadconduit/notepad-conduit.h b/conduits/notepadconduit/notepad-conduit.h
new file mode 100644
index 0000000..907a306
--- /dev/null
+++ b/conduits/notepadconduit/notepad-conduit.h
@@ -0,0 +1,94 @@
+#ifndef _KPILOT_NOTEPAD_CONDUIT_H
+#define _KPILOT_NOTEPAD_CONDUIT_H
+/* notepad-conduit.h KPilot
+**
+** Copyright (C) 2004 by Adriaan de Groot, Joern Ahrens, Angus Ainslie
+**
+** The code for NotepadActionThread::unpackNotePad was taken from
+** Angus Ainslies read-notepad.c, which is part of pilot-link.
+** NotepadActionThread::saveImage is also based on read-notepad.c.
+**
+** This file is part of the Notepad conduit, a conduit for KPilot that
+** store the notepad drawings to files.
+*/
+
+/*
+** 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"
+
+#include <tqthread.h>
+struct NotePad;
+class NotepadActionThread;
+
+class NotepadConduit : public ConduitAction
+{
+public:
+ NotepadConduit(KPilotLink *,
+ const char *name=0L,
+ const TQStringList &args = TQStringList());
+ virtual ~NotepadConduit();
+ virtual bool event(TQEvent *e);
+
+protected:
+ virtual bool exec(); // From ConduitAction
+
+private:
+ NotepadActionThread *thread;
+};
+
+
+/**
+ * This class saves the notepads to disk
+ */
+class NotepadActionThread : public QThread
+{
+public:
+ NotepadActionThread(TQObject *parent, KPilotLink *link);
+
+ virtual void run();
+ int getFailed() { return notSaved; }
+ int getSaved() { return saved; }
+
+private:
+ TQObject *fParent;
+ KPilotLink *fLink;
+
+ /**
+ * counts how many notepads couldn't be saved during the sync
+ */
+ int notSaved;
+ /**
+ * counts how many files a saved during the sync
+ */
+ int saved;
+
+ int unpackNotePad(struct NotePad *a, unsigned char *buffer, int len);
+
+ /**
+ * Saves a single NotePad structure to disk, using the name in
+ * the Note @p n, or if no name is specified, using the
+ * timestamp in the note.
+ */
+ void saveImage(struct NotePad *n);
+};
+
+#endif
diff --git a/conduits/notepadconduit/notepad-factory.cc b/conduits/notepadconduit/notepad-factory.cc
new file mode 100644
index 0000000..0e1094b
--- /dev/null
+++ b/conduits/notepadconduit/notepad-factory.cc
@@ -0,0 +1,124 @@
+/* KPilot
+**
+** Copyright (C) 2004 by Adriaan de Groot, Joern Ahrens
+**
+** This file defines the factory for the notepad-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 <kconfig.h>
+#include <kinstance.h>
+#include <kaboutdata.h>
+#include <kurlrequester.h>
+#include <kmessagebox.h>
+#include <tqlineedit.h>
+
+#include "pluginfactory.h"
+
+#include "notepad-conduit.h" // Conduit action
+#include "notepad-setup.h"
+#include "notepadconduit.h" // Settings class
+
+//----------------------------------------------------------------------------
+// Conduit Configuration
+//----------------------------------------------------------------------------
+class NotepadConduitConfig : public ConduitConfigBase
+{
+public:
+ NotepadConduitConfig(TQWidget *parent=0L, const char *n=0L);
+ virtual void commit();
+ virtual void load();
+ static ConduitConfigBase *create(TQWidget *p, const char *n)
+ {
+ return new NotepadConduitConfig(p, n);
+ };
+
+protected:
+ NotepadWidget *fConfigWidget;
+} ;
+
+static KAboutData *createAbout()
+{
+ FUNCTIONSETUP;
+
+ KAboutData *fAbout = new KAboutData("NotepadConduit",
+ I18N_NOOP("Saves notepads to png files"),
+ KPILOT_VERSION,
+ I18N_NOOP("Configures the Notepad Conduit for KPilot"),
+ KAboutData::License_LGPL,
+ "(C) 2004, Joern Ahrens");
+ fAbout->addAuthor("Joern Ahrens",
+ I18N_NOOP("Primary Author"),
+ "http://www.jokele.de/");
+ fAbout->addCredit("Adriaan de Groot");
+ fAbout->addCredit("Angus Ainslies",
+ I18N_NOOP("Notepad conduit is based on Angus' read-notepad, part of pilot-link" ));
+ return fAbout;
+}
+
+
+NotepadConduitConfig::NotepadConduitConfig(TQWidget *p, const char *n) :
+ ConduitConfigBase(p, n),
+ fConfigWidget(new NotepadWidget(p))
+{
+ FUNCTIONSETUP;
+
+ fConduitName = i18n("Notepad");
+ ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget, createAbout());
+ fWidget=fConfigWidget;
+ TQObject::connect(fConfigWidget->fOutputDirectory, TQT_SIGNAL(textChanged(const TQString&)),
+ this, TQT_SLOT(modified()));
+ fConfigWidget->fOutputDirectory->setMode(KFile::Directory |
+ KFile::LocalOnly);
+}
+
+/* virtual */ void NotepadConduitConfig::commit()
+{
+ FUNCTIONSETUP;
+
+ NotepadConduitSettings::setOutputDirectory(fConfigWidget->fOutputDirectory->url());
+ NotepadConduitSettings::self()->writeConfig();
+}
+
+/* virtual */ void NotepadConduitConfig::load()
+{
+ FUNCTIONSETUP;
+
+ NotepadConduitSettings::self()->readConfig();
+ fConfigWidget->fOutputDirectory->setURL(NotepadConduitSettings::outputDirectory());
+ fModified=false;
+}
+
+extern "C"
+{
+
+void *init_conduit_notepad()
+{
+ return new ConduitFactory<NotepadConduitConfig,NotepadConduit>(0,"abbrowserconduit");
+}
+
+}
+
diff --git a/conduits/notepadconduit/notepad-factory.h b/conduits/notepadconduit/notepad-factory.h
new file mode 100644
index 0000000..f208cd1
--- /dev/null
+++ b/conduits/notepadconduit/notepad-factory.h
@@ -0,0 +1,38 @@
+#ifndef _KPILOT_NOTEPAD_FACTORY_H
+#define _KPILOT_NOTEPAD_FACTORY_H
+/* notepad-factory.h KPilot
+**
+** Copyright (C) 2004 by Adriaan de Groot, Joern Ahrens
+**
+** This file defines the factory for the notepad-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]
+*/
+
+extern "C"
+{
+
+void *init_conduit_notepad();
+
+}
+
+#endif
diff --git a/conduits/notepadconduit/notepad-setup.ui b/conduits/notepadconduit/notepad-setup.ui
new file mode 100644
index 0000000..8674235
--- /dev/null
+++ b/conduits/notepadconduit/notepad-setup.ui
@@ -0,0 +1,79 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>NotepadWidget</class>
+<author>Jörn Ahrens</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form2</cstring>
+ </property>
+ <property name="tqgeometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>435</width>
+ <height>391</height>
+ </rect>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Path to the directory to which the pictures should be exported.</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>250</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>fOutputDirectory</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Output:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<tqlayoutdefaults spacing="6" margin="11"/>
+<includes>
+ <include location="global" impldecl="in implementation">kurlrequester.h</include>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+</includes>
+</UI>
diff --git a/conduits/notepadconduit/notepadconduit.kcfg b/conduits/notepadconduit/notepadconduit.kcfg
new file mode 100644
index 0000000..1a2c9bf
--- /dev/null
+++ b/conduits/notepadconduit/notepadconduit.kcfg
@@ -0,0 +1,14 @@
+<?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="Notepad-conduit">
+ <entry name="outputDirectory" type="Path">
+ <label>The export directory for the notepad drawings</label>
+ <default>$HOME</default>
+ </entry>
+ </group>
+
+</kcfg>
diff --git a/conduits/notepadconduit/notepadconduit.kcfgc b/conduits/notepadconduit/notepadconduit.kcfgc
new file mode 100644
index 0000000..e18fa7c
--- /dev/null
+++ b/conduits/notepadconduit/notepadconduit.kcfgc
@@ -0,0 +1,7 @@
+File=notepadconduit.kcfg
+ClassName=NotepadConduitSettings
+Singleton=true
+ItemAccessors=true
+Mutators=true
+GlobalEnums=true
+SetUserTexts=true