summaryrefslogtreecommitdiffstats
path: root/kpilot/conduits/knotes
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kpilot/conduits/knotes
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpilot/conduits/knotes')
-rw-r--r--kpilot/conduits/knotes/CMakeLists.txt52
-rw-r--r--kpilot/conduits/knotes/Makefile.am21
-rw-r--r--kpilot/conduits/knotes/cr32-app-knotesconduit.pngbin0 -> 369 bytes
-rw-r--r--kpilot/conduits/knotes/knotes-action.cc872
-rw-r--r--kpilot/conduits/knotes/knotes-action.h113
-rw-r--r--kpilot/conduits/knotes/knotes-conduit.desktop94
-rw-r--r--kpilot/conduits/knotes/knotes-factory.cc133
-rw-r--r--kpilot/conduits/knotes/knotes-factory.h70
-rw-r--r--kpilot/conduits/knotes/knotes-setup.cc83
-rw-r--r--kpilot/conduits/knotes/knotes-setup.h49
-rw-r--r--kpilot/conduits/knotes/knotesconduit.kcfg25
-rw-r--r--kpilot/conduits/knotes/knotesconduitSettings.kcfgc7
-rw-r--r--kpilot/conduits/knotes/setup_base.ui88
13 files changed, 1607 insertions, 0 deletions
diff --git a/kpilot/conduits/knotes/CMakeLists.txt b/kpilot/conduits/knotes/CMakeLists.txt
new file mode 100644
index 00000000..568adb42
--- /dev/null
+++ b/kpilot/conduits/knotes/CMakeLists.txt
@@ -0,0 +1,52 @@
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set(conduit_knotes_SRCS
+ knotes-factory.cc
+ knotes-setup.cc
+ knotes-action.cc
+)
+
+set(conduit_knotes_UIS
+ setup_base.ui
+)
+
+set(conduit_knotes_KCFGS
+ knotesconduitSettings.kcfgc
+)
+
+#set(conduit_knotes_STUBS
+# KNotesIface.h
+#)
+
+#kde3_add_dcop_skels(conduit_knotes_SRCS ${conduit_knotes_STUBS})
+#kde3_add_dcop_stubs(conduit_knotes_SRCS ${conduit_knotes_STUBS})
+
+kde3_add_kcfg_files(conduit_knotes_SRCS ${conduit_knotes_KCFGS})
+kde3_add_ui_files(conduit_knotes_SRCS ${conduit_knotes_UIS})
+kde3_automoc(${conduit_knotes_SRCS})
+
+add_library(conduit_knotes SHARED ${conduit_knotes_SRCS})
+target_link_libraries(conduit_knotes kcal)
+
+set_target_properties(conduit_knotes PROPERTIES
+ LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
+ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
+ PREFIX ""
+)
+
+kde3_install_libtool_file(conduit_knotes)
+
+install(
+ TARGETS conduit_knotes
+ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
+)
+
+install(
+ FILES knotes-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
+)
+
+install(
+ FILES knotesconduit.kcfg DESTINATION ${KDE3_KCFG_DIR}
+)
diff --git a/kpilot/conduits/knotes/Makefile.am b/kpilot/conduits/knotes/Makefile.am
new file mode 100644
index 00000000..db4cff3e
--- /dev/null
+++ b/kpilot/conduits/knotes/Makefile.am
@@ -0,0 +1,21 @@
+INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir) -I$(top_srcdir)/kpilot/lib $(all_includes)
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = knotes-conduit.desktop
+
+kde_module_LTLIBRARIES = conduit_knotes.la
+
+
+conduit_knotes_la_SOURCES = \
+ knotesconduitSettings.kcfgc \
+ knotes-factory.cc \
+ knotes-setup.cc \
+ knotes-action.cc \
+ setup_base.ui
+
+conduit_knotes_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+conduit_knotes_la_LIBADD = ../../lib/libkpilot.la $(LIB_KDEUI)
+
+kde_kcfg_DATA = knotesconduit.kcfg
diff --git a/kpilot/conduits/knotes/cr32-app-knotesconduit.png b/kpilot/conduits/knotes/cr32-app-knotesconduit.png
new file mode 100644
index 00000000..6bca7900
--- /dev/null
+++ b/kpilot/conduits/knotes/cr32-app-knotesconduit.png
Binary files differ
diff --git a/kpilot/conduits/knotes/knotes-action.cc b/kpilot/conduits/knotes/knotes-action.cc
new file mode 100644
index 00000000..905e5ef3
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-action.cc
@@ -0,0 +1,872 @@
+/* KPilot
+**
+** Copyright (C) 2001 by Dan Pilone
+** Copyright (C) 2002,2003,2004 by Adriaan de Groot
+**
+** This file defines the SyncAction for the knotes-conduit plugin.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 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 General Public License for more details.
+**
+** You should have received a copy of the GNU 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 kde-pim@kde.org
+*/
+
+#include "options.h"
+
+#include <qmap.h>
+#include <qtimer.h>
+
+#include <kapplication.h>
+
+#include <kurl.h>
+#include <libkcal/calendarlocal.h>
+#include <kstandarddirs.h>
+
+
+#include <kconfig.h>
+//#include <dcopclient.h>
+
+#include <time.h> // required by pilot-link includes
+
+#include <pi-memo.h>
+
+#include "pilotMemo.h"
+#include "pilotSerialDatabase.h"
+
+//#include "KNotesIface_stub.h"
+
+#include "knotes-factory.h"
+
+#include "knotes-action.moc"
+#include "knotesconduitSettings.h"
+
+extern "C"
+{
+
+unsigned long version_conduit_knotes = Pilot::PLUGIN_API;
+
+}
+
+typedef QString KNoteID_t;
+typedef const QString &KNoteID_pt;
+
+class NoteAndMemo
+{
+public:
+ NoteAndMemo() : noteId(),memoId(-1) { } ;
+ NoteAndMemo(KNoteID_pt noteid,int memoid) : noteId(noteid),memoId(memoid) { } ;
+ bool operator ==(const NoteAndMemo &p) const
+ {
+ return (p.memo()==memoId) && (p.note()==noteId);
+ }
+
+ int memo() const { return memoId; } ;
+ KNoteID_t note() const { return noteId; } ;
+ inline bool valid() const { return (memoId>0) && (!noteId.isEmpty()) ; } ;
+ QString toString() const { return CSL1("<%1,%2>").arg(noteId).arg(memoId); } ;
+
+ static NoteAndMemo findNote(const QValueList<NoteAndMemo> &,KNoteID_pt note);
+ static NoteAndMemo findMemo(const QValueList<NoteAndMemo> &,int memo);
+
+protected:
+ KNoteID_t noteId;
+ int memoId;
+} ;
+
+NoteAndMemo NoteAndMemo::findNote(const QValueList<NoteAndMemo> &l ,KNoteID_pt note)
+{
+ FUNCTIONSETUP;
+
+ for (QValueList<NoteAndMemo>::ConstIterator it = l.begin();
+ it != l.end();
+ ++it)
+ {
+ if ((*it).note()==note) return *it;
+ }
+
+ return NoteAndMemo();
+}
+
+NoteAndMemo NoteAndMemo::findMemo(const QValueList<NoteAndMemo> &l , int memo)
+{
+ FUNCTIONSETUP;
+
+ for (QValueList<NoteAndMemo>::ConstIterator it =l.begin();
+ it != l.end();
+ ++it)
+ {
+ if ((*it).memo()==memo) return *it;
+ }
+
+ return NoteAndMemo();
+}
+
+class KNotesAction::KNotesActionPrivate
+{
+public:
+ KNotesActionPrivate() :
+ fNotesResource(0L),
+ fTimer(0L),
+ fDeleteCounter(0),
+ fModifiedNotesCounter(0),
+ fModifiedMemosCounter(0),
+ fAddedNotesCounter(0),
+ fAddedMemosCounter(0),
+ fDeletedNotesCounter(0),
+ fDeletedMemosCounter(0),
+ fDeleteNoteForMemo(false)
+ { } ;
+ ~KNotesActionPrivate()
+ {
+ fNotesResource->save();
+
+ KPILOT_DELETE(fNotesResource);
+ KPILOT_DELETE(fTimer);
+ }
+
+ // The record index we're dealing with. Used by
+ // CopyHHToPC sync only.
+ int fRecordIndex;
+
+ KCal::CalendarLocal *fNotesResource;
+ // This is the collection of notes held by KNotes and
+ KCal::Journal::List fNotes;
+
+ // This iterates through that list; it's in here because
+ // we use slots to process one item at a time and need
+ // to keep track of where we are between slot calls.
+ KCal::Journal::List::ConstIterator fIndex;
+
+ // The DCOP client for this application, and the KNotes stub.
+ // DCOPClient *fDCOP;
+ //KNotesIface_stub *fKNotes;
+
+ // The timer for invoking process() to do some more work.
+ QTimer *fTimer;
+
+ // The database we're working with (MemoDB)
+ // PilotSerialDatabase *fDatabase;
+ // Some counter that needs to be preserved between calls to
+ // process(). Typically used to note how much work is done.
+ int fDeleteCounter; // Count deleted memos as well.
+ unsigned int fModifiedNotesCounter; // Count modified KNotes.
+ unsigned int fModifiedMemosCounter;
+ unsigned int fAddedNotesCounter;
+ unsigned int fAddedMemosCounter;
+ unsigned int fDeletedNotesCounter;
+ unsigned int fDeletedMemosCounter;
+
+ // We need to translate between the ids that KNotes uses and
+ // Pilot id's, so we make a list of pairs.
+ //
+ QValueList<NoteAndMemo> fIdList;
+
+ // Setting to delete a KNote when the corresponding memo
+ // has been deleted.
+ bool fDeleteNoteForMemo;
+};
+
+
+
+KNotesAction::KNotesAction(KPilotLink *o,
+ const char *n, const QStringList &a) :
+ ConduitAction(o,n ? n : "knotes-conduit",a),
+ fP(new KNotesActionPrivate)
+{
+ FUNCTIONSETUP;
+
+/*
+ if (fP) fP->fDCOP = KApplication::kApplication()->dcopClient();
+
+ if (fP && !fP->fDCOP)
+ {
+ WARNINGKPILOT << "Can't get DCOP client." << endl;
+ }
+*/
+}
+
+/* virtual */ KNotesAction::~KNotesAction()
+{
+ FUNCTIONSETUP;
+
+ KPILOT_DELETE(fP);
+}
+
+/* virtual */ bool KNotesAction::exec()
+{
+ FUNCTIONSETUP;
+ DEBUGKPILOT << fname << ": Starting knotes conduit." << endl;
+
+ if (syncMode().isTest())
+ {
+ test();
+ delayDone();
+ return true;
+ }
+
+ QString e;
+ if (!openKNotesResource()) return false;
+
+ // Database names seem to be latin1
+ if (!openDatabases(CSL1("MemoDB")))
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << "Can not open databases." << endl;
+#endif
+ emit logError(i18n("Could not open MemoDB on the handheld."));
+ return false;
+ }
+
+ fP->fTimer = new QTimer(this);
+ fActionStatus = Init;
+
+ // this is not needed. As it is done in the initstate in process();
+ // resetIndexes();
+
+ connect(fP->fTimer,SIGNAL(timeout()),SLOT(process()));
+ fP->fTimer->start(0,false);
+
+ return true;
+}
+
+void KNotesAction::test()
+{
+ if (!openKNotesResource()) return;
+ listNotes();
+}
+
+bool KNotesAction::openKNotesResource()
+{
+ FUNCTIONSETUP;
+
+ KConfig korgcfg( locate( "config", CSL1("korganizerrc") ) );
+ korgcfg.setGroup( "Time & Date" );
+ QString tz(korgcfg.readEntry( "TimeZoneId" ) );
+
+ fP->fNotesResource = new KCal::CalendarLocal(tz);
+ KURL mURL = KGlobal::dirs()->saveLocation( "data", "knotes/" ) + "notes.ics";
+
+ if( fP->fNotesResource->load( mURL.path() ) )
+ {
+ fP->fNotes = fP->fNotesResource->journals();
+ return true;
+ }
+ else
+ {
+ emit logError( i18n("Could not load the resource at: %1").arg(mURL.path()) );
+ return false;
+ }
+}
+
+
+void KNotesAction::resetIndexes()
+{
+ FUNCTIONSETUP;
+
+ fP->fRecordIndex = 0;
+ fP->fIndex = fP->fNotes.begin();
+}
+
+void KNotesAction::listNotes()
+{
+ FUNCTIONSETUP;
+
+ KCal::Journal::List notes = fP->fNotesResource->journals();
+ DEBUGKPILOT << fname << ": the resource contains " << notes.size()
+ << " note(s)." << endl;
+
+ KCal::Journal::List::ConstIterator it;
+ int i = 1;
+ for ( it = notes.begin(); it != notes.end(); ++it )
+ {
+ DEBUGKPILOT << fname << ": note " << i << " has id " << (*it)->uid()
+ << endl;
+ i++;
+ }
+
+ DEBUGKPILOT << fname << ": "
+ << "Sync direction: " << syncMode().name() << endl;
+}
+
+/* slot */ void KNotesAction::process()
+{
+ FUNCTIONSETUP;
+
+ DEBUGKPILOT << fname << ": Now in state " << fActionStatus << endl;
+
+ switch(fActionStatus)
+ {
+ case Init:
+ resetIndexes();
+ getAppInfo();
+ getConfigInfo();
+ switch(syncMode().mode())
+ {
+ case SyncAction::SyncMode::eBackup:
+ case SyncAction::SyncMode::eRestore:
+ // Impossible!
+ fActionStatus = Done;
+ break;
+ case SyncAction::SyncMode::eCopyHHToPC :
+ listNotes(); // Debugging
+ fActionStatus = MemosToKNotes;
+ break;
+ case SyncAction::SyncMode::eHotSync:
+ case SyncAction::SyncMode::eFullSync:
+ case SyncAction::SyncMode::eCopyPCToHH:
+ fActionStatus = ModifiedNotesToPilot;
+ break;
+ }
+ break;
+ case ModifiedNotesToPilot:
+ if (modifyNoteOnPilot())
+ {
+ resetIndexes();
+ fActionStatus = DeleteNotesOnPilot;
+ }
+ break;
+ case DeleteNotesOnPilot:
+ if (deleteNoteOnPilot())
+ {
+ resetIndexes();
+ fActionStatus = NewNotesToPilot;
+ }
+ break;
+ case NewNotesToPilot :
+ if (addNewNoteToPilot())
+ {
+ resetIndexes();
+ fDatabase->resetDBIndex();
+ switch(syncMode().mode())
+ {
+ case SyncAction::SyncMode::eBackup:
+ case SyncAction::SyncMode::eRestore:
+ case SyncAction::SyncMode::eCopyHHToPC :
+ // Impossible!
+ fActionStatus = Done;
+ break;
+ case SyncAction::SyncMode::eHotSync:
+ case SyncAction::SyncMode::eFullSync:
+ fActionStatus = MemosToKNotes;
+ break;
+ case SyncAction::SyncMode::eCopyPCToHH:
+ fActionStatus = Cleanup;
+ break;
+ }
+ }
+ break;
+ case MemosToKNotes :
+ if (syncMemoToKNotes())
+ {
+ fActionStatus=Cleanup;
+ }
+ break;
+ case Cleanup :
+ cleanupMemos();
+ break;
+ default :
+ if (fP->fTimer) fP->fTimer->stop();
+ delayDone();
+ }
+}
+
+
+void KNotesAction::getConfigInfo()
+{
+ FUNCTIONSETUP;
+
+ KNotesConduitSettings::self()->readConfig();
+
+ fP->fDeleteNoteForMemo = KNotesConduitSettings::deleteNoteForMemo();
+
+ QValueList<KNoteID_t> notes;
+ QValueList<int> memos;
+
+ // Make this match the type of KNoteID_t !
+ notes=KNotesConduitSettings::noteIds();
+ memos=KNotesConduitSettings::memoIds();
+
+ if (notes.count() != memos.count())
+ {
+ WARNINGKPILOT
+ << ": Notes and memo id lists don't match ("
+ << notes.count()
+ << ","
+ << memos.count()
+ << ")"
+ << endl;
+ notes.clear();
+ memos.clear();
+ setFirstSync( true );
+ }
+
+ QValueList<KNoteID_t>::ConstIterator iNotes = notes.begin();
+ QValueList<int>::ConstIterator iMemos = memos.begin();
+
+ while((iNotes != notes.end()) && (iMemos != memos.end()))
+ {
+ fP->fIdList.append(NoteAndMemo(*iNotes,*iMemos));
+ ++iNotes;
+ ++iMemos;
+ }
+}
+
+void KNotesAction::getAppInfo()
+{
+ FUNCTIONSETUP;
+
+ resetIndexes();
+}
+
+
+bool KNotesAction::modifyNoteOnPilot()
+{
+ FUNCTIONSETUP;
+ return true;
+ /*
+ if (fP->fIndex == fP->fNotes.end())
+ {
+ return true;
+ }
+ */
+
+ //TODO DCOP_REMOVAL
+ /*
+ if (fP->fKNotes->isModified(CSL1("kpilot"),fP->fIndex.key()))
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname
+ << ": The note #"
+ << fP->fIndex.key()
+ << " with name "
+ << fP->fIndex.data()
+ << " is modified in KNotes."
+ << endl;
+#endif
+
+ NoteAndMemo nm = NoteAndMemo::findNote(fP->fIdList,
+ fP->fIndex.key());
+
+ if (nm.valid())
+ {
+ QString text,title,body;
+ title = fP->fIndex.data();
+ body = fP->fKNotes->text(fP->fIndex.key());
+ if (body.startsWith(title))
+ {
+ text = body;
+ }
+ else
+ {
+ text = title + CSL1("\n") + body;
+ }
+
+ PilotMemo *a = new PilotMemo(text);
+ PilotRecord *r = a->pack();
+ r->setID(nm.memo());
+
+ int newid = fDatabase->writeRecord(r);
+ fLocalDatabase->writeRecord(r);
+
+ if (newid != nm.memo())
+ {
+ WARNINGKPILOT
+ << ": Memo id changed during write? "
+ << "From "
+ << nm.memo()
+ << " to "
+ << newid
+ << endl;
+ }
+ }
+ else
+ {
+ WARNINGKPILOT << "Modified note unknown to Pilot" << endl;
+ // Add it anyway, with new PilotID.
+ int newid = addNoteToPilot();
+ fP->fIdList.remove(nm);
+ fP->fIdList.append(NoteAndMemo(fP->fIndex.key(),newid));
+ }
+
+ ++(fP->fModifiedMemosCounter);
+ }
+ */
+
+ //++(fP->fIndex);
+ //return false;
+}
+
+bool KNotesAction::deleteNoteOnPilot()
+{
+ FUNCTIONSETUP;
+
+ /*
+ QValueList<NoteAndMemo>::Iterator i = fP->fIdList.begin();
+ while ( i != fP->fIdList.end() )
+ {
+ // TODO DCOP_REMOVE
+ if (fP->fNotes.contains((*i).note()))
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": Note " << (*i).note() << " still exists." << endl;
+#endif
+ }
+ else
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": Note " << (*i).note() << " is deleted." << endl;
+#endif
+ fDatabase->deleteRecord((*i).memo());
+ fLocalDatabase->deleteRecord((*i).memo());
+ i = fP->fIdList.remove(i);
+ fP->fDeletedMemosCounter++;
+ continue;
+ }
+ ++i;
+ }
+ */
+ return true;
+}
+
+bool KNotesAction::addNewNoteToPilot()
+{
+ FUNCTIONSETUP;
+
+ if (fP->fIndex == fP->fNotes.end())
+ {
+ return true;
+ }
+
+ KCal::Journal *j = (*fP->fIndex);
+
+ if( j->pilotId() == 0 )
+ {
+ DEBUGKPILOT << fname << ": Adding note with id " << j->uid()
+ << " to pilot." << endl;
+
+ int newid = addNoteToPilot();
+
+ ++(fP->fAddedMemosCounter);
+ }
+ //TODO DCOP_REMOVAL
+ /*
+ if (fP->fKNotes->isNew(CSL1("kpilot"),fP->fIndex.key()))
+ {
+ int newid = addNoteToPilot();
+ fP->fIdList.append(NoteAndMemo(fP->fIndex.key(),newid));
+ ++(fP->fAddedMemosCounter);
+ }
+ */
+
+ ++(fP->fIndex);
+ return false;
+}
+
+bool KNotesAction::syncMemoToKNotes()
+{
+ FUNCTIONSETUP;
+
+ PilotRecord *rec = 0L;
+
+ if ( syncMode() == SyncAction::SyncMode::eCopyHHToPC )
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": Read record " << fP->fRecordIndex << endl;
+#endif
+ rec = fDatabase->readRecordByIndex(fP->fRecordIndex);
+ fP->fRecordIndex++;
+ }
+ else
+ {
+ rec = fDatabase->readNextModifiedRec();
+ }
+
+ if (!rec)
+ {
+ return true;
+ }
+
+ PilotMemo *memo = new PilotMemo(rec);
+ NoteAndMemo m = NoteAndMemo::findMemo(fP->fIdList,memo->id());
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": Looking at memo "
+ << memo->id()
+ << " which was found "
+ << m.toString()
+ << endl;
+#endif
+
+ if (memo->isDeleted())
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": It's been deleted." << endl;
+#endif
+ if (m.valid())
+ {
+ // We knew about the note already, but it
+ // has changed on the Pilot.
+ //
+ //
+ if (fP->fDeleteNoteForMemo)
+ {
+ //TODO DCOP_REMOVAL
+ //fP->fKNotes->killNote(m.note(),KNotesConduitSettings::suppressKNotesConfirm()
+ //) ;
+ fP->fDeletedNotesCounter++;
+ }
+ }
+ else
+ {
+#ifdef DEBUG
+ DEBUGKPILOT << fname << ": It's new and deleted." << endl;
+#endif
+ }
+
+ fLocalDatabase->deleteRecord(rec->id());
+ }
+ else
+ {
+ if (m.valid())
+ {
+ #ifdef DEBUG
+ DEBUGKPILOT << fname << ": It's just modified." << endl;
+ DEBUGKPILOT << fname << ": <"
+// << fP->fNotes[m.note()]
+ << "> <"
+ << memo->shortTitle()
+ << ">"
+ << endl;
+ #endif
+ // Check if KNotes still knows about this note
+ //TODO DCOP_REMOVAL
+ /*
+ if (!(fP->fKNotes->name(m.note()).isEmpty()))
+ {
+ updateNote(m,memo);
+ }
+ else
+ {
+ uint c = fP->fIdList.remove(m);
+ if (!c)
+ {
+ WARNINGKPILOT
+ << "Tried to remove valid note and failed."
+ << endl;
+ }
+ addMemoToKNotes(memo);
+ }
+ */
+ }
+ else
+ {
+ addMemoToKNotes(memo);
+ }
+ fLocalDatabase->writeRecord(rec);
+ }
+
+ KPILOT_DELETE(memo);
+ KPILOT_DELETE(rec);
+
+ return false;
+}
+
+void KNotesAction::updateNote(const NoteAndMemo &m, const PilotMemo *memo)
+{
+ FUNCTIONSETUP;
+ //TODO DCOP_REMOVAL
+ if (true/*fP->fNotes[m.note()] != memo->shortTitle()*/)
+ {
+ // Name changed. KNotes might complain though.
+ //TODO DCOP_REMOVAL
+ //fP->fKNotes->setName(m.note(), memo->shortTitle());
+ }
+ //TODO DCOP_REMOVAL
+ //fP->fKNotes->setText(m.note(),memo->text());
+ fP->fModifiedNotesCounter++;
+}
+
+void KNotesAction::addMemoToKNotes(const PilotMemo *memo)
+{
+ FUNCTIONSETUP;
+ // This note is new to KNotes
+ //TODO DCOP_REMOVAL
+ //KNoteID_t i = fP->fKNotes->newNote(memo->shortTitle(), memo->text());
+ //fP->fIdList.append(NoteAndMemo(i,memo->id()));
+ //fP->fAddedNotesCounter++;
+
+#ifdef DEBUG
+ //TODO DCOP_REMOVAL
+ //DEBUGKPILOT << fname << ": It's new with knote id " << i << endl;
+#endif
+}
+int KNotesAction::addNoteToPilot()
+{
+ FUNCTIONSETUP;
+
+ KCal::Journal *j = (*fP->fIndex);
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname
+ << ": The note #"
+ << j->uid()
+ << " with name "
+ << j->summary()
+ << " is new to the Pilot."
+ << endl;
+#endif
+
+ QString text = j->summary() + CSL1("\n");
+ text.append( j->description() );
+ //TODO DCOP_REMOVAL
+ //text.append(fP->fKNotes->text(fP->fIndex.key()));
+
+ PilotMemo *a = new PilotMemo(text);
+ PilotRecord *r = a->pack();
+
+ int newid = fDatabase->writeRecord(r);
+ fLocalDatabase->writeRecord(r);
+
+ j->setPilotId( newid );
+
+ delete r;
+ delete a;
+ delete j;
+
+ fP->fAddedMemosCounter++;
+
+ return newid;
+}
+
+
+void KNotesAction::cleanupMemos()
+{
+ FUNCTIONSETUP;
+
+ // Tell KNotes we're up-to-date
+ //TODO DCOP_REMOVAL
+ //fP->fKNotes->sync(CSL1("kpilot"));
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname
+ << ": Writing "
+ << fP->fIdList.count()
+ << " pairs to the config file."
+ << endl;
+ DEBUGKPILOT << fname
+ << ": The config file is read-only: "
+ << KNotesConduitSettings::self()->config()->isReadOnly()
+ << endl;
+#endif
+
+ QValueList<KNoteID_t> notes;
+ QValueList<int> memos;
+
+ for (QValueList<NoteAndMemo>::ConstIterator i =
+ fP->fIdList.begin();
+ i!=fP->fIdList.end();
+ ++i)
+ {
+ notes.append((*i).note());
+ memos.append((*i).memo());
+ }
+
+ KNotesConduitSettings::setNoteIds(notes);
+ KNotesConduitSettings::setMemoIds(memos);
+ KNotesConduitSettings::self()->writeConfig();
+
+ fActionStatus=Done;
+ fDatabase->cleanup();
+ fDatabase->resetSyncFlags();
+ fLocalDatabase->cleanup();
+ fLocalDatabase->resetSyncFlags();
+
+ // Tell the user what happened. If no changes were
+ // made, spoke remains false and we'll tack a
+ // message on to the end saying so, so that
+ // the user always gets at least one message.
+ bool spoke = false;
+ if (fP->fAddedMemosCounter)
+ {
+ addSyncLogEntry(i18n("Added one new memo.",
+ "Added %n new memos.",
+ fP->fAddedMemosCounter));
+ }
+ if (fP->fModifiedMemosCounter)
+ {
+ addSyncLogEntry(i18n("Modified one memo.",
+ "Modified %n memos.",
+ fP->fModifiedMemosCounter));
+ spoke = true;
+ }
+ if (fP->fDeletedMemosCounter)
+ {
+ addSyncLogEntry(i18n("Deleted one memo.",
+ "Deleted %n memos.",fP->fDeletedMemosCounter));
+ spoke = true;
+ }
+ if (fP->fAddedNotesCounter)
+ {
+ addSyncLogEntry(i18n("Added one note to KNotes.",
+ "Added %n notes to KNotes.",fP->fAddedNotesCounter));
+ spoke = true;
+ }
+ if (fP->fModifiedNotesCounter)
+ {
+ addSyncLogEntry(i18n("Modified one note in KNotes.",
+ "Modified %n notes in KNotes.",fP->fModifiedNotesCounter));
+ spoke = true;
+ }
+ if (fP->fDeletedNotesCounter)
+ {
+ addSyncLogEntry(i18n("Deleted one note from KNotes.",
+ "Deleted %n notes from KNotes.",fP->fDeletedNotesCounter));
+ spoke = true;
+ }
+ if (!spoke)
+ {
+ addSyncLogEntry(i18n("No change to KNotes."));
+ }
+}
+
+
+/* virtual */ QString KNotesAction::statusString() const
+{
+ switch(fActionStatus)
+ {
+ case Init : return CSL1("Init");
+ case NewNotesToPilot :
+ return CSL1("NewNotesToPilot key=%1");
+ // TODO DCOP_REMOVAL .arg(fP->fIndex.key());
+ case ModifiedNotesToPilot :
+ return CSL1("ModifiedNotesToPilot key=%1");
+ //TODO DCOP_REMOVAL .arg(fP->fIndex.key());
+ case MemosToKNotes :
+ return CSL1("MemosToKNotes rec=%1")
+ .arg(fP->fRecordIndex);
+ case Cleanup : return CSL1("Cleanup");
+ case Done :
+ return CSL1("Done");
+ default :
+ return CSL1("Unknown (%1)").arg(fActionStatus);
+ }
+}
+
+
+
diff --git a/kpilot/conduits/knotes/knotes-action.h b/kpilot/conduits/knotes/knotes-action.h
new file mode 100644
index 00000000..695e9074
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-action.h
@@ -0,0 +1,113 @@
+#ifndef _KPILOT_KNOTES_ACTION_H
+#define _KPILOT_KNOTES_ACTION_H
+/* knotes-action.h KPilot
+**
+** Copyright (C) 2001,2003 by Dan Pilone
+**
+** This file defines the SyncAction that the KNotes conduit performs.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 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 General Public License for more details.
+**
+** You should have received a copy of the GNU 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 kde-pim@kde.org
+*/
+
+#include <plugin.h>
+
+
+class NoteAndMemo;
+class PilotMemo;
+
+class KNotesAction : public ConduitAction
+{
+Q_OBJECT
+public:
+ KNotesAction(
+ KPilotLink *o,
+ const char *n = 0L,
+ const QStringList &a = QStringList() );
+ virtual ~KNotesAction();
+
+ enum Status { Init,
+ ModifiedNotesToPilot,
+ DeleteNotesOnPilot,
+ NewNotesToPilot,
+ MemosToKNotes,
+ Cleanup,
+ Done } ;
+ virtual QString statusString() const;
+
+protected:
+ virtual bool exec();
+
+protected:
+ /**
+ * For test mode -- just list the notes KNotes has.
+ */
+ void listNotes();
+
+ /** Run a test on the conduit. */
+ void test();
+
+ /**
+ * Loads the KNotes resource and retrieve the list of notes it
+ * has. @return false if the the resource could not be opened and a new
+ * resource could not be created. Modifies fP to store the notes in.
+ */
+ bool openKNotesResource();
+
+ /**
+ * For actual processing. These are called by process
+ * and it is critical that fP->fIndex is set properly.
+ *
+ * Each returns true when it is completely finished processing,
+ * if it returns a bool. Void functions need only be called once.
+ */
+ void getAppInfo();
+ void getConfigInfo();
+ bool modifyNoteOnPilot();
+ bool deleteNoteOnPilot();
+ bool addNewNoteToPilot();
+ bool syncMemoToKNotes();
+ void cleanupMemos();
+
+ void updateNote(const NoteAndMemo &,const PilotMemo *);
+
+ /**
+ * Add the Memo to KNotes.
+ */
+ void addMemoToKNotes(const PilotMemo *);
+ /**
+ * Add the Note currently being processed to the
+ * pilot as a new memo. Returns the id of the record.
+ */
+ int addNoteToPilot();
+
+
+ void resetIndexes();
+
+protected slots:
+ void process();
+
+private:
+ class KNotesActionPrivate;
+ KNotesActionPrivate *fP;
+} ;
+
+#endif
diff --git a/kpilot/conduits/knotes/knotes-conduit.desktop b/kpilot/conduits/knotes/knotes-conduit.desktop
new file mode 100644
index 00000000..7f405cdb
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-conduit.desktop
@@ -0,0 +1,94 @@
+[Desktop Entry]
+Type=Service
+Comment=This conduit syncs the Memo Pad application with KNotes.
+Comment[af]=Hierdie pad synkroniseer die Memo Pad program met KNotes.
+Comment[bg]=Синхронизация на бележки на KDE с мобилни устройства
+Comment[bs]=Ovaj conduit sinhronizuje Memo Pad aplikaciju sa KNotes.
+Comment[ca]=Aquest conducte sincronitza l'aplicació Memo Pad amb Knotes.
+Comment[cs]=Toto propojení synchronizuje vašeho Pilota s poznámkami v KNotes.
+Comment[cy]=Mae'r cwndid yma yn cydamseru y cymhwysiad Memo Pad efo KNodiadau.
+Comment[da]=Denne kanal synkroniserer dit memopad-program med KNotes.
+Comment[de]=Abgleich des Memo Pad mit KNotes
+Comment[el]=Αυτός ο σύνδεσμος συγχρονίζει την εφαρμογή Memo Pad με το KNotes.
+Comment[eo]=Tiu kanalo sinkronigas la MemoPad-aplikaĵon kun KNotoj.
+Comment[es]=Este conducto sincroniza la aplicación de Notas con KNotes.
+Comment[et]=See kanal sünkroniseerib Memo Pad rakenduse ja KNotesi.
+Comment[eu]=Kanal honek Memo Pad aplikazioa KNotes-ekin sinkronizatzen du.
+Comment[fa]=این لوله، کاربرد Memo Pad را با KNotes همگام می‌سازد.
+Comment[fi]=Tämä yhdyskäytävä synkronoi Memo Pad -ohelman KNotesin kanssa.
+Comment[fr]=Ce canal synchronise l'application « Memo Pad » avec KNotes.
+Comment[fy]=Dit conduit syngronisearret de Memo Pad mei KNotes.
+Comment[gl]=Este conducto sincroniza a aplicación Memo Pad con KNotes.
+Comment[hi]=यह कन्ड्यूइट मेमो पेड अनुप्रयोगों को के-नोट्स के साथ सिंक करता है
+Comment[hu]=Ezzel a csatolóval a Memo Pad program és a KNotes között lehet szinkronizálást végezni.
+Comment[is]=Þessi rás samstillir lófatölvuna þína við KNotes.
+Comment[it]=Questo condotto sincronizza l'applicazione Memo Pad con KNotes.
+Comment[ja]=このコンジットはメモ帳アプリケーションを KNotes と同期させます。
+Comment[ka]=ეს არხი ახდენს Memo Pad პროგრამის სინქრონიზაციას KNotes-თან.
+Comment[kk]=Memo Pad қолданбаны KNotes жазбаларымен қадамдастыру арнасы.
+Comment[km]=បំពង់​នេះ​អាច​ឲ្យ​កម្មវិធី Memo Pad ធ្វើ​សមកាលកម្ម​ជាមួយ​នឹង KNotes ។
+Comment[lt]=Šis kanalas sinchronizuoja Memo Pad programą su KNotes.
+Comment[mk]=Овој канал ја синхронизира апликацијата Memo Pad со КБелешки.
+Comment[ms]=Saluran ini mensegerakkan aplikasi Memo Pad dengan KNotes.
+Comment[nb]=Denne kanalen synkroniserer notatblokk-programmet med KNotes.
+Comment[nds]=Synkroniseert dat Palm-Programm "Memo Pad" mit KNotes.
+Comment[ne]=यो कन्ड्युटले मेमो प्याड अनुप्रयोग केडीई टिप्पणीमा सिन्क गर्दछ ।
+Comment[nl]=Dit conduit synchroniseert de Memo Pad met KNotes.
+Comment[nn]=Denne koplinga synkroniserer «Memo Pad»-applikasjonen med KNotes.
+Comment[pl]=Ten łącznik synchronizuje program Memo Pad palmtopa z KNotes (notatkami).
+Comment[pt]=Esta conduta sincroniza os memorandos com o KNotes.
+Comment[pt_BR]=Este conduíte sincroniza a aplicação Memo Pad com o KNotes.
+Comment[ro]=Această conductă sincronizează aplicaţia Memo Pad cu KNotes.
+Comment[ru]=Канал синхронизации заметок КПК и KDE.
+Comment[sk]=Táto spojka synchronizuje aplikáciu Memo Pad s KNotes
+Comment[sl]=Ta veznik usklajuje program Memo Pad s KNotice.
+Comment[sr]=Овај провод синхронизује Memo Pad програме са KNotes-ом.
+Comment[sr@Latn]=Ovaj provod sinhronizuje Memo Pad programe sa KNotes-om.
+Comment[sv]=Den här kanalen synkroniserar programmet Memo Pad med Knotes.
+Comment[ta]=இந்த காப்புக் குழாய் குறிப்பாணை அட்டை பயன்பாடு கேகுறிப்புகளுடன் ஒத்திசைக்கிறது
+Comment[tg]=Канали синхронизатсияи қайдоти Pilot ва KDE.
+Comment[tr]=Bu kanal KNotes ile el bilgisayarınızı senkronize etmenize olanak sağlar
+Comment[uk]=Цей акведук синхронізує Memo Pad з тижневиком KNotes.
+Comment[zh_CN]=此管道将会将您的备忘程序与 KNotes 同步。
+Comment[zh_TW]=此軟體將 KNote 與 Memo Pad 應用程式同步。
+Name=KNotes / Memos
+Name[be]=K Нататкі
+Name[bg]=KNotes/Memos
+Name[cs]=KNotes / Poznámky
+Name[cy]=KNodiadau/Memos
+Name[da]=KNotes / Memoer
+Name[el]=KNotes / Υπομνήματα
+Name[eo]=KNotoj
+Name[et]=KNotes / memod
+Name[eu]=KNotes / Oharrak
+Name[fr]=KNotes / Mémos
+Name[fy]=KNotes / memo's
+Name[ga]=KNotes / Meamraim
+Name[hi]=के-नोट्स / मेमो
+Name[hu]=KNotes / memók
+Name[is]=KNotes / minnisblöð
+Name[it]=KNotes / Memo
+Name[ka]=KNotes / ჩანიშვნები
+Name[kk]=KNotes / Жазбалар
+Name[km]=KNotes / អនុស្សរណៈ
+Name[lt]=KNotes / Memo
+Name[mk]=КБелешки / Меморандуми
+Name[ms]=KNotes / Memo
+Name[nds]=KNotes / Notizen
+Name[ne]=केडीई टिप्पणी / मेमो
+Name[nl]=KNotes / memo's
+Name[nn]=KNotes / Memoar
+Name[pl]=KNotes / Notatki
+Name[pt]=Notas / Memorandos
+Name[pt_BR]=KNotes / Memorandos
+Name[ru]=KNotes / Заметки
+Name[sk]=Poznámky / Memo
+Name[sl]=KNotice / Opomniki
+Name[sv]=Knotes/Memo Pad
+Name[ta]=கேகுறிப்புகள்/குறிப்பாணைகள்
+Name[tg]=KNotes / Қайдот
+Name[tr]=KNotlar / Hatırlatmalar
+Name[zh_CN]=KNotes / 备忘
+Implemented=file
+ServiceTypes=KPilotConduit
+X-KDE-Library=conduit_knotes
diff --git a/kpilot/conduits/knotes/knotes-factory.cc b/kpilot/conduits/knotes/knotes-factory.cc
new file mode 100644
index 00000000..a919e1ed
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-factory.cc
@@ -0,0 +1,133 @@
+/* KPilot
+**
+** Copyright (C) 2001,2003 by Dan Pilone
+**
+** This file defines the factory for the knotes-conduit plugin.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 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 General Public License for more details.
+**
+** You should have received a copy of the GNU 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 kde-pim@kde.org
+*/
+
+#include "options.h"
+
+#include <kapplication.h>
+#include <kinstance.h>
+#include <kaboutdata.h>
+
+#include <dcopclient.h>
+
+#include <time.h> // Needed by pilot-link include
+
+#include <pi-memo.h>
+
+#include "knotes-action.h"
+#include "knotes-setup.h"
+
+#include "knotes-factory.moc"
+
+
+extern "C"
+{
+
+void *init_conduit_knotes()
+{
+ return new KNotesConduitFactory;
+}
+
+}
+
+
+/* static */ KAboutData *KNotesConduitFactory::fAbout = 0L;
+
+KNotesConduitFactory::KNotesConduitFactory(QObject *p, const char *n) :
+ KLibFactory(p,n)
+{
+ FUNCTIONSETUP;
+
+ fInstance = new KInstance("knotesconduit");
+ fAbout = new KAboutData("knotesconduit",
+ I18N_NOOP("KNotes Conduit for KPilot"),
+ KPILOT_VERSION,
+ I18N_NOOP("Configures the KNotes Conduit for KPilot"),
+ KAboutData::License_GPL,
+ "(C) 2001, Adriaan de Groot");
+ fAbout->addAuthor("Adriaan de Groot",
+ I18N_NOOP("Primary Author"),
+ "groot@kde.org",
+ "http://www.cs.kun.nl/~adridg/kpilot");
+ fAbout->addCredit("David Bishop",
+ I18N_NOOP("UI"));
+}
+
+KNotesConduitFactory::~KNotesConduitFactory()
+{
+ FUNCTIONSETUP;
+
+ KPILOT_DELETE(fInstance);
+ KPILOT_DELETE(fAbout);
+}
+
+/* virtual */ QObject *KNotesConduitFactory::createObject( QObject *p,
+ const char *n,
+ const char *c,
+ const QStringList &a)
+{
+ FUNCTIONSETUP;
+
+#ifdef DEBUG
+ DEBUGKPILOT << fname
+ << ": Creating object of class "
+ << c
+ << endl;
+#endif
+
+ if (qstrcmp(c,"ConduitConfigBase")==0)
+ {
+ QWidget *w = dynamic_cast<QWidget *>(p);
+ if (w)
+ {
+ return new KNotesConfigBase(w,0L);
+ }
+ else
+ {
+ return 0L;
+ }
+ }
+ else
+ if (qstrcmp(c,"SyncAction")==0)
+ {
+ KPilotLink *d = dynamic_cast<KPilotLink *>(p);
+
+ if (d)
+ {
+ return new KNotesAction(d,n,a);
+ }
+ else
+ {
+ WARNINGKPILOT
+ << "Couldn't cast parent to KPilotDeviceLink"
+ << endl;
+ return 0L;
+ }
+ }
+
+ return 0L;
+}
diff --git a/kpilot/conduits/knotes/knotes-factory.h b/kpilot/conduits/knotes/knotes-factory.h
new file mode 100644
index 00000000..94ad4442
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-factory.h
@@ -0,0 +1,70 @@
+#ifndef _KPILOT_NULL_FACTORY_H
+#define _KPILOT_NULL_FACTORY_H
+/* null-factory.h KPilot
+**
+** Copyright (C) 2001,2003 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 General Public License as published by
+** the Free Software Foundation; either version 2 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 General Public License for more details.
+**
+** You should have received a copy of the GNU 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 kde-pim@kde.org
+*/
+
+#include <klibloader.h>
+
+class KInstance;
+class KAboutData;
+
+class KNotesConduitFactory : public KLibFactory
+{
+Q_OBJECT
+
+public:
+ KNotesConduitFactory(QObject * = 0L,const char * = 0L);
+ virtual ~KNotesConduitFactory();
+
+ static KAboutData *about() { return fAbout; } ;
+
+ // The KNotes instance, unlike previous conduits (alphabetically)
+ // has const char * const members. The extra const prevents people
+ // from assigning to this variable, so you have to work hard to
+ // break its value. We store group and entry keys in here.
+
+protected:
+ virtual QObject* createObject( QObject* parent = 0,
+ const char* name = 0,
+ const char* classname = "QObject",
+ const QStringList &args = QStringList() );
+private:
+ KInstance *fInstance;
+ static KAboutData *fAbout;
+} ;
+
+extern "C"
+{
+
+void *init_libknotesconduit();
+
+}
+
+
+#endif
diff --git a/kpilot/conduits/knotes/knotes-setup.cc b/kpilot/conduits/knotes/knotes-setup.cc
new file mode 100644
index 00000000..da8b31c4
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-setup.cc
@@ -0,0 +1,83 @@
+/* KPilot
+**
+** Copyright (C) 2001,2003 by Dan Pilone
+**
+** This file defines the setup dialog for the knotes-conduit plugin.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 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 General Public License for more details.
+**
+** You should have received a copy of the GNU 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 kde-pim@kde.org
+*/
+
+#include "options.h"
+
+#include <qtabwidget.h>
+#include <qcheckbox.h>
+#include <qmap.h>
+#include <qtimer.h>
+
+#include <kapplication.h>
+#include <kconfig.h>
+
+#include "setup_base.h"
+
+#include "knotes-factory.h"
+#include "knotes-setup.h"
+#include "knotesconduitSettings.h"
+
+
+KNotesConfigBase::KNotesConfigBase(QWidget *w, const char *n) :
+ ConduitConfigBase(w,n),
+ fConfigWidget(0L)
+{
+ fConfigWidget = new KNotesWidget(w);
+ ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget,KNotesConduitFactory::about());
+ fWidget = fConfigWidget;
+ QObject::connect(fConfigWidget->fDeleteNoteForMemo,SIGNAL(clicked()),
+ this,SLOT(modified()));
+ QObject::connect(fConfigWidget->fSuppressConfirm,SIGNAL(clicked()),
+ this,SLOT(modified()));
+ QObject::connect(fConfigWidget->fDeleteNoteForMemo,SIGNAL(toggled(bool)),
+ fConfigWidget->fSuppressConfirm,SLOT(setEnabled(bool)));
+ fConduitName=i18n("KNotes");
+}
+
+void KNotesConfigBase::commit()
+{
+ KNotesConduitSettings::setDeleteNoteForMemo( fConfigWidget->fDeleteNoteForMemo->isChecked() );
+ KNotesConduitSettings::setSuppressKNotesConfirm(fConfigWidget->fSuppressConfirm->isChecked());
+ KNotesConduitSettings::self()->writeConfig();
+ unmodified();
+}
+
+void KNotesConfigBase::load()
+{
+ KNotesConduitSettings::self()->readConfig();
+ fConfigWidget->fDeleteNoteForMemo->setChecked(KNotesConduitSettings::deleteNoteForMemo() );
+ fConfigWidget->fSuppressConfirm->setChecked(KNotesConduitSettings::suppressKNotesConfirm() );
+ fConfigWidget->fSuppressConfirm->setEnabled(KNotesConduitSettings::deleteNoteForMemo());
+ unmodified();
+}
+
+/* static */ ConduitConfigBase *KNotesConfigBase::create(QWidget *w, const char *n)
+{
+ return new KNotesConfigBase(w,n);
+}
+
diff --git a/kpilot/conduits/knotes/knotes-setup.h b/kpilot/conduits/knotes/knotes-setup.h
new file mode 100644
index 00000000..9e7603df
--- /dev/null
+++ b/kpilot/conduits/knotes/knotes-setup.h
@@ -0,0 +1,49 @@
+#ifndef _KPILOT_KNOTES_SETUP_H
+#define _KPILOT_KNOTES_SETUP_H
+/* knotes-setup.h KPilot
+**
+** Copyright (C) 2001,2003 by Dan Pilone
+**
+** This file defines the widget and behavior for the config dialog
+** of the KNotes conduit.
+*/
+
+/*
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 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 General Public License for more details.
+**
+** You should have received a copy of the GNU 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 kde-pim@kde.org
+*/
+
+#include "plugin.h"
+
+class KNotesWidget;
+
+class KNotesConfigBase : public ConduitConfigBase
+{
+public:
+ KNotesConfigBase(QWidget *parent, const char *name);
+
+ virtual void commit();
+ virtual void load();
+
+ static ConduitConfigBase *create(QWidget *p, const char *n);
+private:
+ KNotesWidget *fConfigWidget;
+} ;
+
+#endif
diff --git a/kpilot/conduits/knotes/knotesconduit.kcfg b/kpilot/conduits/knotes/knotesconduit.kcfg
new file mode 100644
index 00000000..41d86d2b
--- /dev/null
+++ b/kpilot/conduits/knotes/knotesconduit.kcfg
@@ -0,0 +1,25 @@
+<?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="kpilot_notesconduitrc"/>
+ <group name="General">
+ <entry name="DeleteNoteForMemo" type="Bool">
+ <default>false</default>
+ </entry>
+ <entry name="SuppressKNotesConfirm" type="Bool">
+ <label>Suppress the confirmation KNotes normally shows when deleting a note.</label>
+ <default>false</default>
+ </entry>
+
+ <entry name="MemoIds" type="IntList">
+ <label>list of the synced MemoDB records</label>
+ <default></default>
+ </entry>
+ <entry name="NoteIds" type="StringList">
+ <label>list of the corresponding KNotes note IDs</label>
+ <default></default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/kpilot/conduits/knotes/knotesconduitSettings.kcfgc b/kpilot/conduits/knotes/knotesconduitSettings.kcfgc
new file mode 100644
index 00000000..33152ac6
--- /dev/null
+++ b/kpilot/conduits/knotes/knotesconduitSettings.kcfgc
@@ -0,0 +1,7 @@
+File=knotesconduit.kcfg
+ClassName=KNotesConduitSettings
+Singleton=true
+ItemAccessors=true
+Mutators=true
+GlobalEnums=true
+SetUserTexts=true
diff --git a/kpilot/conduits/knotes/setup_base.ui b/kpilot/conduits/knotes/setup_base.ui
new file mode 100644
index 00000000..e6aef804
--- /dev/null
+++ b/kpilot/conduits/knotes/setup_base.ui
@@ -0,0 +1,88 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>KNotesWidget</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KNotesWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>436</width>
+ <height>394</height>
+ </rect>
+ </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">
+ <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>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>fDeleteNoteForMemo</cstring>
+ </property>
+ <property name="text">
+ <string>Delete KNote when Pilot memo is deleted</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Check this box if you wish to delete notes from KNotes automatically when the corresponding Pilot memo is deleted. Use this option with care, as the notes you want to keep in the handheld and in the desktop are not necessarily the same.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>fSuppressConfirm</cstring>
+ </property>
+ <property name="text">
+ <string>Suppress delete-confirmation in KNotes</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Check this box if you wish to delete notes from KNotes, without confirmation, when the corresponding Pilot memo is deleted. Use this option only if you want to keep the same notes in the handheld and in the PC.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>101</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>