From f4fae92b6768541e2952173c3d4b09040f95bf7e Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 16 Feb 2011 20:17:18 +0000 Subject: 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/kdepim@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpilot/conduits/docconduit/CMakeLists.txt | 87 -- kpilot/conduits/docconduit/DOC-converter.cc | 631 ------------ kpilot/conduits/docconduit/DOC-converter.h | 183 ---- kpilot/conduits/docconduit/Icons/CMakeLists.txt | 3 - kpilot/conduits/docconduit/Icons/Makefile.am | 7 - .../docconduit/Icons/cr16-app-kpalmdoc.png | Bin 747 -> 0 bytes .../docconduit/Icons/cr22-app-kpalmdoc.png | Bin 1088 -> 0 bytes .../docconduit/Icons/cr32-app-kpalmdoc.png | Bin 2007 -> 0 bytes .../docconduit/Icons/cr48-app-kpalmdoc.png | Bin 3254 -> 0 bytes kpilot/conduits/docconduit/Makefile.am | 38 - kpilot/conduits/docconduit/bmkSpecification.txt | 199 ---- kpilot/conduits/docconduit/doc-conduit.cc | 1018 -------------------- kpilot/conduits/docconduit/doc-conduit.h | 152 --- kpilot/conduits/docconduit/doc-conflictdialog.cc | 182 ---- kpilot/conduits/docconduit/doc-conflictdialog.h | 83 -- kpilot/conduits/docconduit/doc-factory.cc | 116 --- kpilot/conduits/docconduit/doc-factory.h | 74 -- kpilot/conduits/docconduit/doc-setup.cc | 136 --- kpilot/conduits/docconduit/doc-setup.h | 47 - kpilot/conduits/docconduit/doc-setupdialog.ui | 557 ----------- kpilot/conduits/docconduit/doc_conduit.desktop | 58 -- kpilot/conduits/docconduit/docconduit.kcfg | 54 -- .../conduits/docconduit/docconduitSettings.kcfgc | 7 - kpilot/conduits/docconduit/kpalmdoc.cpp | 58 -- kpilot/conduits/docconduit/kpalmdoc.desktop | 64 -- kpilot/conduits/docconduit/kpalmdoc.kcfg | 41 - kpilot/conduits/docconduit/kpalmdoc.upd | 6 - kpilot/conduits/docconduit/kpalmdocSettings.kcfgc | 7 - kpilot/conduits/docconduit/kpalmdoc_dlg.cc | 529 ---------- kpilot/conduits/docconduit/kpalmdoc_dlg.h | 67 -- kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui | 435 --------- kpilot/conduits/docconduit/makedoc9.cc | 405 -------- kpilot/conduits/docconduit/makedoc9.h | 111 --- kpilot/conduits/docconduit/pilotDOCBookmark.cc | 87 -- kpilot/conduits/docconduit/pilotDOCBookmark.h | 51 - kpilot/conduits/docconduit/pilotDOCEntry.cc | 92 -- kpilot/conduits/docconduit/pilotDOCEntry.h | 73 -- kpilot/conduits/docconduit/pilotDOCHead.cc | 101 -- kpilot/conduits/docconduit/pilotDOCHead.h | 62 -- kpilot/conduits/docconduit/tests/testcompress.cpp | 59 -- 40 files changed, 5880 deletions(-) delete mode 100644 kpilot/conduits/docconduit/CMakeLists.txt delete mode 100644 kpilot/conduits/docconduit/DOC-converter.cc delete mode 100644 kpilot/conduits/docconduit/DOC-converter.h delete mode 100644 kpilot/conduits/docconduit/Icons/CMakeLists.txt delete mode 100644 kpilot/conduits/docconduit/Icons/Makefile.am delete mode 100644 kpilot/conduits/docconduit/Icons/cr16-app-kpalmdoc.png delete mode 100644 kpilot/conduits/docconduit/Icons/cr22-app-kpalmdoc.png delete mode 100644 kpilot/conduits/docconduit/Icons/cr32-app-kpalmdoc.png delete mode 100644 kpilot/conduits/docconduit/Icons/cr48-app-kpalmdoc.png delete mode 100644 kpilot/conduits/docconduit/Makefile.am delete mode 100644 kpilot/conduits/docconduit/bmkSpecification.txt delete mode 100644 kpilot/conduits/docconduit/doc-conduit.cc delete mode 100644 kpilot/conduits/docconduit/doc-conduit.h delete mode 100644 kpilot/conduits/docconduit/doc-conflictdialog.cc delete mode 100644 kpilot/conduits/docconduit/doc-conflictdialog.h delete mode 100644 kpilot/conduits/docconduit/doc-factory.cc delete mode 100644 kpilot/conduits/docconduit/doc-factory.h delete mode 100644 kpilot/conduits/docconduit/doc-setup.cc delete mode 100644 kpilot/conduits/docconduit/doc-setup.h delete mode 100644 kpilot/conduits/docconduit/doc-setupdialog.ui delete mode 100644 kpilot/conduits/docconduit/doc_conduit.desktop delete mode 100644 kpilot/conduits/docconduit/docconduit.kcfg delete mode 100644 kpilot/conduits/docconduit/docconduitSettings.kcfgc delete mode 100644 kpilot/conduits/docconduit/kpalmdoc.cpp delete mode 100644 kpilot/conduits/docconduit/kpalmdoc.desktop delete mode 100644 kpilot/conduits/docconduit/kpalmdoc.kcfg delete mode 100644 kpilot/conduits/docconduit/kpalmdoc.upd delete mode 100644 kpilot/conduits/docconduit/kpalmdocSettings.kcfgc delete mode 100644 kpilot/conduits/docconduit/kpalmdoc_dlg.cc delete mode 100644 kpilot/conduits/docconduit/kpalmdoc_dlg.h delete mode 100644 kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui delete mode 100644 kpilot/conduits/docconduit/makedoc9.cc delete mode 100644 kpilot/conduits/docconduit/makedoc9.h delete mode 100644 kpilot/conduits/docconduit/pilotDOCBookmark.cc delete mode 100644 kpilot/conduits/docconduit/pilotDOCBookmark.h delete mode 100644 kpilot/conduits/docconduit/pilotDOCEntry.cc delete mode 100644 kpilot/conduits/docconduit/pilotDOCEntry.h delete mode 100644 kpilot/conduits/docconduit/pilotDOCHead.cc delete mode 100644 kpilot/conduits/docconduit/pilotDOCHead.h delete mode 100644 kpilot/conduits/docconduit/tests/testcompress.cpp (limited to 'kpilot/conduits/docconduit') diff --git a/kpilot/conduits/docconduit/CMakeLists.txt b/kpilot/conduits/docconduit/CMakeLists.txt deleted file mode 100644 index fa87eb0fb..000000000 --- a/kpilot/conduits/docconduit/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} -) - -set(doc_shared_SRCS - makedoc9.cc - pilotDOCHead.cc - pilotDOCEntry.cc - pilotDOCBookmark.cc - DOC-converter.cc -) - -set(conduit_doc_SRCS - ${doc_shared_SRCS} - kpalmdoc_dlg.cc - kpalmdoc.cpp - doc-factory.cc - doc-setup.cc - doc-conduit.cc - doc-conflictdialog.cc -) - -set(conduit_doc_UIS - kpalmdoc_dlgbase.ui - doc-setupdialog.ui -) - -set(conduit_doc_KCFGS - docconduitSettings.kcfgc - kpalmdocSettings.kcfgc -) - -kde3_add_kcfg_files(conduit_doc_SRCS ${conduit_doc_KCFGS}) -kde3_add_ui_files(conduit_doc_SRCS ${conduit_doc_UIS}) -kde3_automoc(${conduit_doc_SRCS}) -add_library(conduit_doc SHARED ${conduit_doc_SRCS}) - -kpilot_rpath(conduit_doc) - -set_target_properties( - conduit_doc PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR} - PREFIX "" -) - -kde3_install_libtool_file(conduit_doc) - -install( - TARGETS conduit_doc - LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR} -) - -set(kpalmdoc_SRCS - ${doc_shared_SRCS} - kpalmdoc_dlg.cc - kpalmdoc.cpp -) -kde3_add_kcfg_files(kpalmdoc_SRCS kpalmdocSettings.kcfgc) -kde3_add_ui_files(kpalmdoc_SRCS kpalmdoc_dlgbase.ui) -kde3_automoc(${kpalmdoc_SRCS}) -add_executable(kpalmdoc ${kpalmdoc_SRCS}) -target_link_libraries(kpalmdoc ${QT_LIBRARIES} kpilot kdeui kio) -kpilot_rpath(kpalmdoc) - -install( - TARGETS kpalmdoc conduit_doc - LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin -) - -install( - FILES doc_conduit.desktop DESTINATION ${KDE3_SERVICES_DIR} -) - -install( - FILES docconduit.kcfg kpalmdoc.kcfg DESTINATION ${KDE3_KCFG_DIR} -) - -install( - FILES kpalmdoc.desktop DESTINATION ${KDE3_XDG_APPS_DIR} -) - -install( - FILES kpalmdoc.upd - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/apps/kconf_update -) - -add_subdirectory(Icons) diff --git a/kpilot/conduits/docconduit/DOC-converter.cc b/kpilot/conduits/docconduit/DOC-converter.cc deleted file mode 100644 index 6502fe54e..000000000 --- a/kpilot/conduits/docconduit/DOC-converter.cc +++ /dev/null @@ -1,631 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002-2003 by Reinhold Kainhofer -** -** The doc converter synchronizes text files on the PC with DOC databases on the Palm -*/ - -/* -** 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 "DOC-converter.moc" - -#include -#include -#include -#include - -#include -#include -#include - -#include "pilotDOCHead.h" -#include "pilotDOCEntry.h" -#include "pilotDOCBookmark.h" - - - -#define min(a,b) (a= 0 && found -1) { - ++found; - if (found>=from && found=0) { - fBookmarks.append(new docBookmark(/*bmkName.left(16)*/rx.cap(capSubexpression), pos)); - } else { - // TODO: use the subexpressions from the regexp for the bmk name ($1..$9) (given as separate regexp) - TQString bmkText(bmkName); - for (int i=0; i<=rx.numCaptures(); ++i) { - bmkText.replace(CSL1("$%1").arg(i), rx.cap(i)); - bmkText.replace(CSL1("\\%1").arg(i), rx.cap(i)); - } - fBookmarks.append(new docBookmark(bmkText.left(16), pos)); - } - ++nr; - } - ++pos; - } - } - return nr; -} - - - - - - - - -/********************************************************************* - C O N S T R U C T O R - *********************************************************************/ - - -DOCConverter::DOCConverter(TQObject *parent, const char *name):TQObject(parent,name) { - FUNCTIONSETUP; - docdb=0L; - eSortBookmarks=eSortNone; - fBookmarks.setAutoDelete( TRUE ); -} - - - -DOCConverter::~DOCConverter() { - FUNCTIONSETUP; -} - - - - - -/********************************************************************* - S Y N C S T R U C T U R E - *********************************************************************/ - - - -void DOCConverter::setTXTpath(TQString path, TQString file) { - TQDir dr(path); - TQFileInfo pth(dr, file); - if (!file.isEmpty()) - txtfilename = pth.absFilePath(); -} - - - -void DOCConverter::setTXTpath(TQString filename) { - if (!filename.isEmpty()) txtfilename = filename; -} - - - -void DOCConverter::setPDB(PilotDatabase * dbi) { - if (dbi) docdb = dbi; -} - - - -TQString DOCConverter::readText() { - FUNCTIONSETUP; - if (txtfilename.isEmpty()) return TQString(); - TQFile docfile(txtfilename); - if (!docfile.open(IO_ReadOnly)) - { - emit logError(i18n("Unable to open text file %1 for reading.").arg(txtfilename)); - return TQString(); - } - - TQTextStream docstream(&docfile); - - TQString doc = docstream.read(); - docfile.close(); - return doc; -} - - - -int DOCConverter::findBmkEndtags(TQString &text, bmkList&fBmks) { - FUNCTIONSETUP; - // Start from the end of the text - int pos = text.length() - 1, nr=0; - bool doSearch=true; - while (pos >= 0/* && doSearch*/) { - DEBUGKPILOT<<"Current character is \'"< - while (text[pos].isSpace() && pos >= 0) { - DEBUGKPILOT<<"Skipping whitespaces at the end of the file"< is assumed to belong to the text, so there are no more bookmarks. - if (pos < 0 || text[pos] != '>') { - DEBUGKPILOT<<"Current character \'"<. Finish searching for bookmarks."<, now looking for the opening <"< 0) { -// DEBUGKPILOT<<"pos="<"<")); - - rx.setMinimal(TRUE); - int pos = 0; - while (pos >= 0) { - pos = rx.search(text, pos); - if (pos >= 0) { - fBmks.append(new docBookmark(rx.cap(1), pos+1)); - ++nr; - text = text.remove(pos, rx.matchedLength()); - } - } - return nr; -} - -int DOCConverter::findBmkFile(TQString &, bmkList &fBmks) { - FUNCTIONSETUP; - int nr=0; - - TQString bmkfilename = txtfilename; - if (bmkfilename.endsWith(CSL1(".txt"))){ - bmkfilename.remove(bmkfilename.length()-4, 4); - } - TQString oldbmkfilename=bmkfilename; - bmkfilename+=CSL1(BMK_SUFFIX); - TQFile bmkfile(bmkfilename); - if (!bmkfile.open(IO_ReadOnly)) { - bmkfilename=oldbmkfilename+CSL1(PDBBMK_SUFFIX); - bmkfile.setName(bmkfilename); - if (!bmkfile.open(IO_ReadOnly)) { - DEBUGKPILOT<<"Unable to open bookmarks file "<dbPathName()<,,,, - // For an explanation see: http://home.kc.rr.com/krzysztow/PalmPilot/MakeDocJ/index.html - if (fieldnr>0){ - DEBUGKPILOT<<"Working on bookmark \""<1) { - TQString name(bmkinfo[1]); - DEBUGKPILOT<<"Bookmark \""<1) { - TQString patt(bmkinfo[1]); - TQString name(patt); - if (fieldnr>2) { - int cap=bmkinfo[2].toInt(&ok); - if (ok) { - bmk=new docRegExpBookmark(patt, cap); - } else { - name=bmkinfo[2]; - bmk=new docRegExpBookmark(patt, name); - } - } else{ - bmk=new docRegExpBookmark(patt, name); - } - // The third entry in the line (optional) denotes the index of a capture subexpression (if an integer) or the bookmark text as regexp (if a string) - DEBUGKPILOT<<"RegExp Bookmark, pattern="<from=1; - bmk->to=1; - } else { - if (fieldnr>3) { - bool ok; - int tmp=bmkinfo[3].toInt(&ok); - if (ok) bmk->from=tmp; - if (fieldnr>4) { - tmp=bmkinfo[4].toInt(&ok); - if (ok) bmk->to=tmp; - } - } - } - fBmks.append(bmk); - bmk=0L; - } else { - DEBUGKPILOT<<"Could not allocate bookmark "<1) pattern=bmkinfo[1]; - if (fieldnr>2) bookmark=bmkinfo[2]; - DEBUGKPILOT<<"RegExp Bookmark, pattern="< in the text. We have to delete them immediately, otherwise the later bookmarks will be off. - if (fBmkTypes & eBmkInline) { - findBmkInline(text, fBookmarks); - } // end: Inline Bookmarks - - - // Read in regular expressions and positions from an external file (doc-filename with extension .bmk) - if (fBmkTypes & eBmkFile) - { - findBmkFile(text, fBookmarks); - } - - // Process the bookmarks: find the occurrences of the regexps, and sort them if requested: - bmkSortedList pdbBookmarks; - pdbBookmarks.setAutoDelete(TRUE); - docBookmark*bmk; - for (bmk = fBookmarks.first(); bmk; bmk = fBookmarks.next()) - { - bmk->findMatches(text, pdbBookmarks); - } - - switch (eSortBookmarks) - { - case eSortName: - docBookmark::compare_pos=false; -// qHeapSort(pdbBookmarks); - pdbBookmarks.sort(); - break; - case eSortPos: - docBookmark::compare_pos=true; - pdbBookmarks.sort(); - break; - case eSortNone: - default: - break; - } - -#ifdef DEBUG - DEBUGKPILOT << "Bookmarks: "<bmkName.left(20)<<" at position "<position<isOpen()) { - emit logError(i18n("Unable to open palm doc database %1").arg(docdb->dbPathName()) ); - return false; - } - - // Clean the whole database, otherwise the records would be just appended! - docdb->deleteRecord(0, true); - - // Header record for the doc file format - PilotDOCHead docHead; - docHead.position=0; - docHead.recordSize=4096; - docHead.spare=0; - docHead.storyLen=text.length(); - docHead.version=compress?DOC_COMPRESSED:DOC_UNCOMPRESSED; - docHead.numRecords=(int)( (text.length()-1)/docHead.recordSize)+1; - PilotRecord*rec=docHead.pack(); - docdb->writeRecord(rec); - KPILOT_DELETE(rec); - - DEBUGKPILOT << "Write header record: length="<readRecordByIndex(0); - if (!headerRec) - { - emit logError(i18n("Unable to read database header for database %1.").arg(docdb->dbPathName())); - KPILOT_DELETE(docdb); - return false; - } - PilotDOCHead header(headerRec); - KPILOT_DELETE(headerRec); - - DEBUGKPILOT<<"Database "<dbPathName()<<" has "<recordCount()<readRecordByIndex(i); - if (rec) - { - PilotDOCEntry recText(rec, header.version==DOC_COMPRESSED); - doctext.append(recText.getText()); - DEBUGKPILOT<<"Record "<dbPathName())); - } - } - - // After the document records possibly come a few bookmark records, so read them in and put them in a separate bookmark file. - // for the ztxt conduit there might be annotations after the bookmarks, so the upper bound needs to be adapted. - int upperBmkRec=docdb->recordCount(); - bmkSortedList bmks; - bmks.setAutoDelete(TRUE); - for (int i=header.numRecords+1; ireadRecordByIndex(i); - if (rec) - { - PilotDOCBookmark bookie(rec); - docBookmark*bmk=new docBookmark(TQString::fromLatin1(bookie.bookmarkName), bookie.pos); - bmks.append(bmk); - KPILOT_DELETE(rec); - } else { - emit logMessage(i18n("Could not read bookmark record #%1 from Database %2").arg(i).arg(docdb->dbPathName())); - } - } - // TODO: Sort the list of bookmarks according to their position - docBookmark::compare_pos=true; - bmks.sort(); - - if ((fBmkTypes & eBmkFile) && (bmks.count()>0)) - { - TQString bmkfilename = docfile.name(); - if (bmkfilename.endsWith(CSL1(".txt"))){ - bmkfilename.remove(bmkfilename.length()-4, 4); - } - bmkfilename+=CSL1(PDBBMK_SUFFIX); - TQFile bmkfile(bmkfilename); - if (!bmkfile.open(IO_WriteOnly)) - { - emit logError(i18n("Unable to open file %1 for the bookmarks of %2.") - .arg(bmkfilename).arg(docdb ->dbPathName())); - } - else - { - DEBUGKPILOT<<"Writing "<position<<", "<bmkName<position, TQString(CSL1("<*") + - bmk->bmkName + - CSL1("*>"))); - } - } - - // Finally, write the actual text out to the file. - TQTextStream docstream(&docfile); - docstream<cleanup(); - // reset all records to unchanged. I don't know if this is really such a wise idea? - docdb->resetSyncFlags(); - return true; -} - - diff --git a/kpilot/conduits/docconduit/DOC-converter.h b/kpilot/conduits/docconduit/DOC-converter.h deleted file mode 100644 index 802d60f20..000000000 --- a/kpilot/conduits/docconduit/DOC-converter.h +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef _DOC_CONVERTER_H -#define _DOC_CONVERTER_H -/* DOC-converter.h KPilot -** -** Copyright (C) 2002-2003 by Reinhold Kainhofer -** -*/ - -/* -** 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 -*/ - - - -#define DOC_UNCOMPRESSED 1 -#define DOC_COMPRESSED 2 - - -#define BMK_SUFFIX ".bmk" -#define PDBBMK_SUFFIX ".bm" - -#include -#include - -class PilotDatabase; - - -/**************************************************************************************************** - * various bookmark classes. Most important is the bmkList findMatches(TQString, bmkList &) function, - * which needs to return a list of all bookmarks found for the given bookmark expression. - * A bookmark usually consists of a bookmark text and an offset into the text document. - ****************************************************************************************************/ - -class docBookmark; -#define bmkList TQPtrList -#define bmkSortedList TQSortedList - -class docBookmark { -public: - static bool compare_pos; - docBookmark():bmkName(), position(0) { }; - docBookmark(TQString name, long int pos):bmkName(name), position(pos) { }; - docBookmark(const docBookmark &bmk):bmkName(bmk.bmkName),position(bmk.position){}; - virtual ~ docBookmark() { }; - virtual int findMatches(TQString, bmkList &fBookmarks) { - FUNCTIONSETUP; - fBookmarks.append(new docBookmark(*this)); - return 1; - }; - - TQString bmkName; - long int position; -}; - -class docMatchBookmark:public docBookmark { - public: - docMatchBookmark():docBookmark() { from=0; to=100;}; - docMatchBookmark(TQString pattrn, int options=0):docBookmark(), - pattern(pattrn), opts(options) { from=0; to=100; }; - docMatchBookmark(TQString pattrn, TQString bmkname, - int options=0):docBookmark(bmkname, 0), pattern(pattrn), - opts(options) { from=0; to=100; }; - virtual ~ docMatchBookmark() { }; - - virtual int findMatches(TQString, bmkList &fBookmarks); - TQString pattern; - int opts; - int from, to; -}; - -class docRegExpBookmark:public docMatchBookmark { - public: - docRegExpBookmark():docMatchBookmark() { capSubexpression=-1;}; - docRegExpBookmark(TQString regexp, int cap=0, - int options=0):docMatchBookmark(regexp, options) {capSubexpression=cap; }; - docRegExpBookmark(TQString pattrn, TQString bmkname, - int options=0):docMatchBookmark(pattrn, bmkname, options) { capSubexpression=-1; }; - virtual ~ docRegExpBookmark() { }; - - virtual int findMatches(TQString, bmkList &fBookmarks); - int capSubexpression; -}; - - -/************************************************************************************************************* - * The converter class that does the real work for us. - *************************************************************************************************************/ - -class DOCConverter:public TQObject { -Q_OBJECT -private: - PilotDatabase * docdb; - TQString txtfilename; - TQString bmkfilename; - bool compress; - - bmkList fBookmarks; -public: - enum eSortBookmarksEnum - { - eSortNone, - eSortPos, - eSortName - } eSortBookmarks; - -public: - DOCConverter(TQObject *parent=0L, const char *name=0L); - virtual ~ DOCConverter(); - - TQString readText(); - void setTXTpath(TQString path, TQString file); - void setTXTpath(TQString filename); - void setPDB(PilotDatabase * dbi); - TQString txtFilename() const {return txtfilename;} - TQString bmkFilename() const {return bmkfilename;} - void setBmkFilename(TQString bmkf) { bmkfilename=bmkf;} - - bool getCompress() const { return compress; }; - void setCompress(bool newcomp) {compress=newcomp;}; - - bool convertTXTtoPDB(); - bool convertPDBtoTXT(); - - int setBookmarks(bmkList bookmarks) { - fBookmarks = bookmarks; - return fBookmarks.count(); - }; - int clearBookmarks() { - fBookmarks.clear(); - return fBookmarks.count(); - }; - int addBookmark(docBookmark*bookmark) { - fBookmarks.append(bookmark); - return fBookmarks.count(); - }; - - int findBmkEndtags(TQString &, bmkList&); - int findBmkInline(TQString &, bmkList&); - int findBmkFile(TQString &, bmkList&); - - - void setSort(enum eSortBookmarksEnum sort) {eSortBookmarks=sort;} - enum eSortBookmarksEnum getSort() {return eSortBookmarks;} - - enum eBmkTypesEnum { - eBmkNone = 0, - eBmkFile = 1, - eBmkInline = 2, - eBmkEndtags = 4, - eBmkDefaultBmkFile = 8 - } fBmkTypes; - void setBookmarkTypes(int types) { - fBmkTypes = (eBmkTypesEnum) types; - }; - -protected: - int findBookmarks(); - -private: - void readConfig(); -signals: - void logMessage(const TQString &); - void logError(const TQString &); -}; - -#endif diff --git a/kpilot/conduits/docconduit/Icons/CMakeLists.txt b/kpilot/conduits/docconduit/Icons/CMakeLists.txt deleted file mode 100644 index 3d1034d44..000000000 --- a/kpilot/conduits/docconduit/Icons/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ - -kde3_install_icons_custom( hicolor ) - diff --git a/kpilot/conduits/docconduit/Icons/Makefile.am b/kpilot/conduits/docconduit/Icons/Makefile.am deleted file mode 100644 index f371f4aed..000000000 --- a/kpilot/conduits/docconduit/Icons/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -METASOURCES = AUTO - -kpalmdocicondir = $(kde_datadir)/kpilot/icons -kpalmdocicon_ICON = kpalmdoc - -KDE_ICON = kpalmdoc - diff --git a/kpilot/conduits/docconduit/Icons/cr16-app-kpalmdoc.png b/kpilot/conduits/docconduit/Icons/cr16-app-kpalmdoc.png deleted file mode 100644 index 0f5fb75d5..000000000 Binary files a/kpilot/conduits/docconduit/Icons/cr16-app-kpalmdoc.png and /dev/null differ diff --git a/kpilot/conduits/docconduit/Icons/cr22-app-kpalmdoc.png b/kpilot/conduits/docconduit/Icons/cr22-app-kpalmdoc.png deleted file mode 100644 index d93aa4bae..000000000 Binary files a/kpilot/conduits/docconduit/Icons/cr22-app-kpalmdoc.png and /dev/null differ diff --git a/kpilot/conduits/docconduit/Icons/cr32-app-kpalmdoc.png b/kpilot/conduits/docconduit/Icons/cr32-app-kpalmdoc.png deleted file mode 100644 index 09a7020b5..000000000 Binary files a/kpilot/conduits/docconduit/Icons/cr32-app-kpalmdoc.png and /dev/null differ diff --git a/kpilot/conduits/docconduit/Icons/cr48-app-kpalmdoc.png b/kpilot/conduits/docconduit/Icons/cr48-app-kpalmdoc.png deleted file mode 100644 index 41cb3b9b1..000000000 Binary files a/kpilot/conduits/docconduit/Icons/cr48-app-kpalmdoc.png and /dev/null differ diff --git a/kpilot/conduits/docconduit/Makefile.am b/kpilot/conduits/docconduit/Makefile.am deleted file mode 100644 index 77df2b61b..000000000 --- a/kpilot/conduits/docconduit/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -### Makefile for KPilot's doc conduit -### -### The doc conduit is Copyright (C) 2002 by Reinhold Kainhofer -### the files makedoc9.{h,cpp} are also Copyright (C) 2000 by Pat Beirne - -SUBDIRS = Icons - -INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir)/kpilot/lib $(all_includes) -METASOURCES = AUTO - - -servicedir = $(kde_servicesdir) -service_DATA = doc_conduit.desktop - -noinst_LTLIBRARIES = libpalmdoc_shared.la -kde_module_LTLIBRARIES = conduit_doc.la -bin_PROGRAMS = kpalmdoc - -libpalmdoc_shared_la_SOURCES = makedoc9.cc pilotDOCHead.cc pilotDOCEntry.cc pilotDOCBookmark.cc DOC-converter.cc - -conduit_doc_la_SOURCES = docconduitSettings.kcfgc doc-factory.cc doc-setup.cc doc-conduit.cc doc-setupdialog.ui doc-conflictdialog.cc -conduit_doc_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -conduit_doc_la_LIBADD = ../../lib/libkpilot.la libpalmdoc_shared.la \ - $(LIB_KDEUI) $(LIB_KFILE) - -##libpalmdoc_shared.la - -kpalmdoc_SOURCES = kpalmdocSettings.kcfgc kpalmdoc_dlgbase.ui kpalmdoc_dlg.cc kpalmdoc.cpp -kpalmdoc_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) $(KDE_RPATH) -kpalmdoc_LDADD = $(LIB_KFILE) $(PISOCK_LIB) ../../lib/libkpilot.la libpalmdoc_shared.la - -xdg_apps_DATA = kpalmdoc.desktop -servicetypedir = $(kde_servicetypesdir) -kde_kcfg_DATA = docconduit.kcfg kpalmdoc.kcfg - -update_DATA = kpalmdoc.upd -updatedir = $(kde_datadir)/kconf_update - diff --git a/kpilot/conduits/docconduit/bmkSpecification.txt b/kpilot/conduits/docconduit/bmkSpecification.txt deleted file mode 100644 index f8a68d961..000000000 --- a/kpilot/conduits/docconduit/bmkSpecification.txt +++ /dev/null @@ -1,199 +0,0 @@ -KPilot PalmDoc Conduit bookmark Specification -============================================= - -(c) 2003 Reinhold Kainhofer, reinhold@kainhofer.com - -This document is licensed under the FDL (Free Documentation License) -as published by the FSF. Any version of the FDL can be applied -at your convenience. - - - - -The PalmDoc conduit has three ways to indicate bookmarks for a text: - -) Inline tags of the form <* bookmarkname *> - -) Endtags of the form at the end of the document - -) Regular expressions in a separate textname.bmk file - (textname.bmk ist the filename of the text with the .txt replaced by .bmk) - - -In the design of the .bmk file, I tried to stay close to the -syntac of MakeDocJ bookmark files, but it turned out that I -needed to extend the syntax a little. Also, MakeDocJ uses Java -RegExps, while the PalmDoc conduit uses the QRegExp, which have -some slight differences (especially concerning the ^ and $ -patterns as well as backreferences). So if you used MakeDocJ, -the .bmk file syntax will be quite familiar, but you will still -have to adapt your bookmark files for Qt regular expressions -instead of Java regular expressions - - - -1) INLINE TAGS - -Whenever a tag of the form <* someText *> appears in the text, -this sequence is removed from the text, and a bookmark is set -there with the bookmark name "someText" (the part between the -<* and the *>). - - -2) ENDTAGS - -If the text ends with tags of the form , the string -in braces is used as bookmark name, and wherever it appears in -the text, a bookmark is set. -After the > any number of whitespace is allowed, but no other -characters like letters, numbers, or punctuation. Also, inside -the braces no line break must occur. The conduit searches the -text from the end and if it finds a line break inside a <...> -sequence, the tag and everything before it is assumed to belong -to the text and doesn't form a bookmark tag. -Between endtags any number of whitespace (spaces, tabs, line -feeds etc.) is allowed. - -As an example, assume you have a text ending in: -... the bad guy was punished, and they lived happily -ever after! - - - - -The conduit starts at the end, ignores all whitespace between -the tags, so it finds the tags "married", "princess", and "bad guy". -The "Tag with line feed" has a line feed, so it is assumed to belong -to the text. -Assume now you have a text ending in: -... the bad guy was punished, and they lived happily -ever after! - The End - - -Here, only "married" and "princess" are found as bookmarks. Because -of the letters before the "princess" tags, the search for the -bookmarks ends at the letter "d" of "The End" (the conduit starts -from the end and moves backward until it finds some text which -cannot be seen as a endtag. - - - - -3) REGULAR EXPRESSIONS IN A SEPARATE FILE - -This is by far the most complex way to specify bookmarks, but -it is also the mose powerful. -If you have a text with filename "My fairy tale.txt", the -bookmarks will be specified in a file called "My fairy tale.bmk" -(just the text filename with the .txt replaced by .bmk). This -file contains the bookmark definitions, one in each line. Lines -starting with a # are seen as comments, and empty lines are also -ignored. - - -In the .bmk file, each bookmark line has one of the following syntaces -(I will explain all fields later on). Fields in [..] are optional: - -bmkName -bmkPosition, bmkName -+, bmkPatternRegExp[, bmkNameAsString[, firstIncludedBmk[, lastIncludedBmk]]] -+, bmkPatternRegExp[, bmkNameIndexOfSubexpression[, firstIncludedBmk[, lastIncludedBmk]]] --, bmkPatternRegExp[, bmkNameAsString] --, bmkPatternRegExp[, bmkNameIndexOfSubexpression] - - If the first field is a string, it is used as the bookmark name -and pattern to search for. - If the first field is a number, it means the position of the -bookmark, and the second field is the name of the bookmark. - If the first field is either + or -, the second field gives -a regular expression that is used to find the position of the -bookmark. If the first field is a -, the search is done only -once and only the first match will be added as bookmark. If -the first field is a +, the search is done until the regular -expression can no longer be found (the fourth and fifth fields -can be used to include only a certain range of hits). If there -is a third field, and it is a string, it gives the name of the -bookmark as a regular expression (i.e. \1 are replaced by the -first subexpression of the search, where subexpressions are -specified by round brackets in the regexp of the second field). -If there is a third field, and it is a number, it gives the index -of the subexpression of bmkPatternRegExp that is used as the -bookmark name. -If there is no third field, the whole matched text will be used -as bookmark name. -The optional fourth and fifth fields can be used to set bookmarks -only after the first few ocurrences of the regexp in the text, and -to stop the search after the expression has been found a certain -number of times. - - - -If the PDB->PC sync is set up to store the bookmarks in a bookmark file, -it will create a file "My fairy tale.bm" (no "k") with entries of the form -position,bmkName -The .bmk file will be used if it exists, but if no .bmk file exists, the .bm file -will be used. This way you can override the bookmark settings, while -at the same time the PDB->TXT sync does not destroy your possibly -existing .bmk file. - - - -Examples: - -1) Imagine you have a line like: -frog princess -In this case, the text is searched for "frog princess", and a -bookmark is set whenever "frog princess" occurs in the text. -The name of each of these bookmarks will be "frog princess". - -2) A bookmark line: -55, Bookmark at offset 55 -Here, a bookmark will be set at offset 55 (55th character of -the text), and it will have the name "Bookmark at offs" (truncated -to 16 characters) - -3) A bookmark line --,Chapter \d+ -causes a bookmark to be set at the first ocurrence of "Chapter XXX", -where XXX denotes one or more digits. The bookmark name will be -"Chapter XXX" (XXX replaced by the actual digits). - -4) A bookmark line -+,Chapter \d+ -causes bookmarks to be set wherever "Chapter XXX" (XXX being one -or more digits) appears in the text. The bookmark name will again -be "Chapter XXX", but the search does not stop after the first hit. - -5) A bookmark line -+,\n\s*(Chapter \d+)\D+, 1 -causes a bookmark to be set whenever a new line starts with -"Chapter XXX" (whitespace is allowed before the "Chapter"), and -uses the first subexpression in (..) as the bookmark name. If you -have a passage - Chapter 15: here it starts -The regular expression will match, so a bookmark will be set there -and the subexpression "Chapter 15" (which matches the (Chapter \d+) ) -will be used as bookmark text. - -6) A bookmark line -+,\n\s*Part (\d+),\1\. part -sets a bookmark whenever a line starts with "Part XXX". The XXX -will be stored as the first matched subexpression. The third field -"\1\. part" is the regular expression for the bookmark name, where -\1 is replaced by the first matched subexpression of the search (XXX -in this case). So if a line starts with " Part 17: ", the bookmark -name will be "17. part". - -7) A bookmark line -+,Table (\d+): ,\1\. Tabelle,5,25 -will match whenever "Table XXX: " appears in the text, and the bookmark -name will be "XXX. Tabelle". However, the fourth field means that the -first four hits are ignored (the 5th hit is the first hit to be included -as a bookmark), and the fifth field means that all further hits after the -25th will be ignored, too. - -8) In law texts, I use a regular expression -+,\n *(§\.? *\d+[a-z]?\.?) +, 1 -to search for all paragraphs starting like "§. 15. " or " §23 ", and set -a bookmark there using only the part from the § to the last digit or the -full stop after the last digit (the pattern between the (), in our two -cases the bookmark names will be "§. 15." and "§23" ). diff --git a/kpilot/conduits/docconduit/doc-conduit.cc b/kpilot/conduits/docconduit/doc-conduit.cc deleted file mode 100644 index fbaa22f59..000000000 --- a/kpilot/conduits/docconduit/doc-conduit.cc +++ /dev/null @@ -1,1018 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** The doc conduit synchronizes text files on the PC with DOC databases on the Palm -*/ - -/* -** 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. -*/ - - -// naming of the bookmark file: -// PDB->TXT: convert bookmarks to a .bm file -// TXT->PDB: If a .bmk file exists, use it, otherwise use the .bm file (from the PDB->TXT conversion) -// This way, the bookmark file is not overwritten, a manual bookmark file overrides, but the bookmarks from the handheld are still available - - -#include "options.h" -#include "doc-conduit.moc" - -#include -#include - -#include -#include - -#include -#include - -#include "doc-factory.h" -#include "doc-conflictdialog.h" -#include "DOC-converter.h" -#include "pilotDOCHead.h" -#include "docconduitSettings.h" - - -// Something to allow us to check what revision -// the modules are that make up a binary distribution. -extern "C" -{ -unsigned long version_conduit_doc = Pilot::PLUGIN_API; -} - -TQString dirToString(eSyncDirectionEnum dir) { - switch(dir) { -// case eSyncAll: return "eSyncAll"; - case eSyncPDAToPC: return CSL1("eSyncPDAToPC"); - case eSyncPCToPDA: return CSL1("eSyncPCToPDA"); - case eSyncNone: return CSL1("eSyncNone"); - case eSyncConflict: return CSL1("eSyncConflict"); - case eSyncDelete: return CSL1("eSyncDelete"); - default: return CSL1("ERROR"); - } -} - - -/********************************************************************* - C O N S T R U C T O R - *********************************************************************/ - - -DOCConduit::DOCConduit(KPilotLink * o, - const char *n, const TQStringList & a):ConduitAction(o, n, a) -{ - FUNCTIONSETUP; - fConduitName=i18n("DOC"); -} - - - -DOCConduit::~DOCConduit() -{ - FUNCTIONSETUP; -} - - -bool DOCConduit::isCorrectDBTypeCreator(DBInfo dbinfo) { - return dbinfo.type == dbtype() && dbinfo.creator == dbcreator(); -} -const unsigned long DOCConduit::dbtype() { - return get_long(DOCConduitFactory::dbDOCtype); -} -const unsigned long DOCConduit::dbcreator() { - return get_long(DOCConduitFactory::dbDOCcreator); -} - - - -/********************************************************************* - L O A D I N G T H E D A T A - *********************************************************************/ - - - -void DOCConduit::readConfig() -{ - FUNCTIONSETUP; - DOCConduitSettings::self()->readConfig(); - - eConflictResolution = (enum eSyncDirectionEnum) (DOCConduitSettings::conflictResolution() ); - fTXTBookmarks = DOCConverter::eBmkNone; - if ( DOCConduitSettings::convertBookmarks() ) - { - if ( DOCConduitSettings::bmkFileBookmarks() ) - fTXTBookmarks |= DOCConverter::eBmkFile; - if ( DOCConduitSettings::inlineBookmarks() ) - fTXTBookmarks |= DOCConverter::eBmkInline; - if ( DOCConduitSettings::endtagBookmarks() ) - fTXTBookmarks |= DOCConverter::eBmkEndtags; - } - - eSyncDirection = (enum eSyncDirectionEnum)(DOCConduitSettings::syncDirection() ); - -#ifdef DEBUG - DEBUGKPILOT << fname - << ": Settings " - << " tXTDirectory=" << DOCConduitSettings::tXTDirectory() - << " pDBDirectory=" << DOCConduitSettings::pDBDirectory() - << " keepPDBLocally=" << DOCConduitSettings::keepPDBsLocally() - << " eConflictResolution=" << eConflictResolution - << " tXTBookmarks=" << fTXTBookmarks - << " pDBBookmarks=" << DOCConduitSettings::bookmarksToPC() - << " compress=" << DOCConduitSettings::compress() - << " eSyncDirection=" << eSyncDirection << endl; -#endif -} - - - -bool DOCConduit::pcTextChanged(TQString txtfn) -{ - FUNCTIONSETUP; - // How do I find out if a text file has changed shince we last synced it?? - // Use KMD5 for now. If I realize it is too slow, then I have to go back to comparing modification times - // if there is no config setting yet, assume the file has been changed. the md5 sum will be written to the config file after the sync. - TQString oldDigest=DOCConduitSettings::self()->config()->readEntry(txtfn); - if (oldDigest.length()<=0) - { - return true; - } -#ifdef DEBUG - DEBUGKPILOT<<"Old digest is "<readRecordByIndex(0); - PilotDOCHead docHeader(firstRec); - KPILOT_DELETE(firstRec); - - int storyRecs = docHeader.numRecords; - - // determine the index of the next modified record (does it lie - // beyond the actual text records?) - int modRecInd=-1; - PilotRecord*modRec=docdb->readNextModifiedRec(&modRecInd); -#ifdef DEBUG - DEBUGKPILOT<<"Index of first changed record: "<readNextModifiedRec(&modRecInd); -#ifdef DEBUG - DEBUGKPILOT<<"Reread Index of first changed records: "<= 0) { -#ifdef DEBUG - DEBUGKPILOT<<"Handheld side has changed, condition="<< - ((!DOCConduitSettings::ignoreBmkChanges()) || (modRecInd <= storyRecs))<deleteDatabase() !=0 ) { - WARNINGKPILOT << "Unable to delete database " << sinfo.dbinfo.name << " on the PC" << endl; - } - KPILOT_DELETE(database); - } - } - if (!DOCConduitSettings::localSync()) { - PilotDatabase *database=deviceLink()->database( sinfo.dbinfo.name ); - if ( database->deleteDatabase() !=0 ) { - WARNINGKPILOT << "Unable to delete database " << sinfo.dbinfo.name << " from the handheld" << endl; - } - KPILOT_DELETE(database); - } - return true; - } - // preSyncAction should initialize the custom databases/files for the - // specific action chosen for this db and return a pointer to a docDBInfo - // instance which points either to a local database or a database on the handheld. - PilotDatabase *database = preSyncAction(sinfo); - - if (database && ( !database->isOpen() ) ) { -#ifdef DEBUG - DEBUGKPILOT<<"Database "<createDatabase(dbcreator(), dbtype()) ) { -#ifdef DEBUG - DEBUGKPILOT<<"Failed"<isOpen()) { - DOCConverter docconverter; - connect(&docconverter, TQT_SIGNAL(logError(const TQString &)), TQT_SIGNAL(logError(const TQString &))); - connect(&docconverter, TQT_SIGNAL(logMessage(const TQString &)), TQT_SIGNAL(logMessage(const TQString &))); - - docconverter.setTXTpath( DOCConduitSettings::tXTDirectory(), sinfo.txtfilename ); - docconverter.setPDB(database); - docconverter.setCompress(DOCConduitSettings::compress()); - - switch (sinfo.direction) { - case eSyncPDAToPC: - docconverter.setBookmarkTypes(DOCConduitSettings::bookmarksToPC()); - res = docconverter.convertPDBtoTXT(); - break; - case eSyncPCToPDA: - docconverter.setBookmarkTypes(fTXTBookmarks); - res = docconverter.convertTXTtoPDB(); - break; - default: - break; - } - - // Now calculate the md5 checksum of the PC text and write it to the config file - if (res) - { - KMD5 docmd5; - TQFile txtfile(docconverter.txtFilename()); - if (txtfile.open(IO_ReadOnly)) { - docmd5.update(txtfile); - TQString thisDigest(docmd5.hexDigest() /* .data() */); - DOCConduitSettings::self()->config()->writeEntry(docconverter.txtFilename(), thisDigest); - DOCConduitSettings::self()->config()->sync(); -#ifdef DEBUG - DEBUGKPILOT<<"MD5 Checksum of the text "<findDatabase(NULL, &dbinfo, dbnr, dbtype(), dbcreator() /*, cardno */ ) < 0) - { - // no more databases available, so check for PC->Palm sync - TQTimer::singleShot(0, this, TQT_SLOT(syncNextTXT())); - return; - } - dbnr=dbinfo.index+1; -#ifdef DEBUG - DEBUGKPILOT<<"Next Palm database to sync: "<Palm sync - TQTimer::singleShot(0, this, TQT_SLOT(checkDeletedDocs())); - return; - } - - // Walk through all files in the pdb directory and check if it has already been synced. - // if docnames isn't initialized, get a list of all *.pdb files in DOCConduitSettings::pDBDirectory() - if (docnames.isEmpty()/* || dociterator==docnames.end() */) { - docnames=TQDir(DOCConduitSettings::pDBDirectory(), CSL1("*.pdb")).entryList() ; - dociterator=docnames.begin(); - } - if (dociterator==docnames.end()) { - // no more databases available, so start the conflict resolution and then the actual sync proces - docnames.clear(); - TQTimer::singleShot(0, this, TQT_SLOT(checkDeletedDocs())); - return; - } - - TQString fn=(*dociterator); - - TQDir dr(DOCConduitSettings::pDBDirectory()); - TQFileInfo fl(dr, fn ); - TQString pdbfilename=fl.absFilePath(); - ++dociterator; - - // Get the doc title and check if it has already been synced (in the synced docs list of in fDBNames to be synced) - // If the doc title doesn't appear in either list, install it to the Handheld, and add it to the list of dbs to be synced. - TQString dbname=fl.baseName(TRUE).left(30); - if (!fDBNames.contains(dbname) && !fDBListSynced.contains(dbname)) { - if (fHandle->installFiles(pdbfilename, false)) { - DBInfo dbinfo; - // Include all "extensions" except the last. This allows full stops inside the database name (e.g. abbreviations) - // first fill everything with 0, so we won't have a buffer overflow. - memset(&dbinfo.name[0], 0, 33); - strncpy(&dbinfo.name[0], dbname.latin1(), 30); - - docSyncInfo syncInfo(dbname, constructTXTFileName(dbname), pdbfilename, eSyncNone); - syncInfo.dbinfo=dbinfo; - needsSync(syncInfo); - fSyncInfoList.append(syncInfo); - fDBNames.append(dbname); - } else { -#ifdef DEBUG - DEBUGKPILOT<<"Could not install database "<hasConflicts); - if (show) { - if (!dlg || !dlg->exec() ) { - KPILOT_DELETE(dlg) - emit logMessage(i18n("Sync aborted by user.")); - TQTimer::singleShot(0, this, TQT_SLOT(cleanup())); - return; - } - } - KPILOT_DELETE(dlg) - - - // fDBNames will be filled with the names of the databases that are actually synced (not deleted), so I can write the list to the config file - fDBNames.clear(); - fSyncInfoListIterator=fSyncInfoList.begin(); - TQTimer::singleShot(0,this, TQT_SLOT(syncDatabases())); - return; -} - - - -void DOCConduit::syncDatabases() { - FUNCTIONSETUP; - if (fSyncInfoListIterator==fSyncInfoList.end()) { - // We're done, so clean up - TQTimer::singleShot(0, this, TQT_SLOT(cleanup())); - return; - } - - docSyncInfo sinfo=(*fSyncInfoListIterator); - ++fSyncInfoListIterator; - - switch (sinfo.direction) { - case eSyncConflict: -#ifdef DEBUG - DEBUGKPILOT<<"Entry "<database( dbname ); - } -} - - -bool DOCConduit::needsSync(docSyncInfo &sinfo) -{ - FUNCTIONSETUP; - sinfo.direction = eSyncNone; - - PilotDatabase*docdb=openDOCDatabase(TQString::fromLatin1(sinfo.dbinfo.name)); - if (!fDBListSynced.contains(sinfo.handheldDB)) { - // the database wasn't included on last sync, so it has to be new. -#ifdef DEBUG - DEBUGKPILOT<<"Database "<HH HH->PC - ----------------------------------------- - N - | P P D - - N | H D H - N N | C P H - */ - - if (TQFile::exists(sinfo.txtfilename)) sinfo.fPCStatus=eStatNew; - else sinfo.fPCStatus=eStatDoesntExist; - if (docdb && docdb->isOpen()) sinfo.fPalmStatus=eStatNew; - else sinfo.fPalmStatus=eStatDoesntExist; - KPILOT_DELETE(docdb); - - switch (eSyncDirection) { - case eSyncPDAToPC: - if (sinfo.fPalmStatus==eStatDoesntExist) - sinfo.direction=eSyncDelete; - else sinfo.direction=eSyncPDAToPC; - break; - case eSyncPCToPDA: - if (sinfo.fPCStatus==eStatDoesntExist) - sinfo.direction=eSyncDelete; - else sinfo.direction=eSyncPCToPDA; - break; - case eSyncNone: // means actually both directions! - if (sinfo.fPCStatus==eStatNew) { - if (sinfo.fPalmStatus==eStatNew) sinfo.direction=eSyncConflict; - else sinfo.direction=eSyncPCToPDA; - } else { - if (sinfo.fPalmStatus==eStatNew) sinfo.direction=eSyncPDAToPC; - else { - sinfo.direction=eSyncNone; -#ifdef DEBUG - DEBUGKPILOT<<"I'm supposed to find a sync direction, but the "<< - " text "<isOpen()) sinfo.fPalmStatus=eStatDeleted; - else if (hhTextChanged(docdb)) { -#ifdef DEBUG - DEBUGKPILOT<<"Handheld side has changed!"<HH HH->PC - ----------------------------------------- - - - | - - - - C - | P P H - - C | H P H - C C | C P H - D - | D D H - - D | D P D - D D | D D D - ----------------------------------------- - C D | C P D - D C | C D H - */ - - - if (sinfo.fPCStatus == eStatNone && sinfo.fPalmStatus==eStatNone) { -#ifdef DEBUG - DEBUGKPILOT<<"Nothing has changed, not need for a sync."<HH or HH->PC) - // should be done, check if the DB was deleted or if we are supposed - // to sync that direction - - if (eSyncDirection==eSyncPCToPDA) { - if (sinfo.fPCStatus==eStatDeleted) sinfo.direction=eSyncDelete; - else sinfo.direction=eSyncPCToPDA; - return true; - } - if (eSyncDirection==eSyncPDAToPC) { - if (sinfo.fPalmStatus==eStatDeleted) sinfo.direction=eSyncDelete; - else sinfo.direction=eSyncPDAToPC; - return true; - } - - - // --------------------------------------------------------------- - // Finally, do the normal case, where both directions are possible - // --------------------------------------------------------------- - - - // if either is deleted, and the other is not changed, delete - if ( ((sinfo.fPCStatus==eStatDeleted) && (sinfo.fPalmStatus!=eStatChanged)) || - ((sinfo.fPalmStatus==eStatDeleted) && (sinfo.fPCStatus!=eStatChanged)) ) - { -#ifdef DEBUG - DEBUGKPILOT<<"DB was deleted on one side and not changed on " - "the other -> Delete it."<retrieveDatabase(sinfo.pdbfilename, &dbinfo) ) - { - WARNINGKPILOT << "Unable to retrieve database " << dbinfo.name << - " from the handheld into " << sinfo.pdbfilename << "." << endl; - return 0L; - } - } - break; - case eSyncPCToPDA: - if (DOCConduitSettings::keepPDBsLocally()) - { - // make sure the dir for the local db really exists! - TQDir dir(DOCConduitSettings::pDBDirectory()); - if (!dir.exists()) - { - dir.mkdir(dir.absPath()); - } - } - break; - default: - break; - } - if (DOCConduitSettings::keepPDBsLocally()) - { - return new PilotLocalDatabase(DOCConduitSettings::pDBDirectory(), - TQString::fromLatin1(dbinfo.name), false); - } - else - { - return deviceLink()->database(TQString::fromLatin1(dbinfo.name)); - } -} - - -// res gives us information whether the sync worked and the db might need to be -// transferred to the handheld or not (and we just need to clean up the mess) -bool DOCConduit::postSyncAction(PilotDatabase * database, - docSyncInfo &sinfo, bool res) -{ - FUNCTIONSETUP; - bool rs = true; - - switch (sinfo.direction) - { - case eSyncPDAToPC: - // also reset the sync flags on the handheld -#ifdef DEBUG - DEBUGKPILOT<<"Resetting sync flags for database " - <database( - TQString::fromLatin1(sinfo.dbinfo.name)); -#ifdef DEBUG - DEBUGKPILOT<<"Middle 1 Resetting sync flags for database " - <resetSyncFlags(); - KPILOT_DELETE(db); - } - } -#ifdef DEBUG - DEBUGKPILOT<<"End Resetting sync flags for database " - <(database); - if (localdb) - { -#ifdef DEBUG - DEBUGKPILOT<<"Installing file "<dbPathName()<<" (" - <dbPathName(); - // This deletes localdb as well, which is just a cast from database - KPILOT_DELETE(database); - if (!fHandle->installFiles(dbpathname, false)) - { - rs = false; -#ifdef DEBUG - DEBUGKPILOT<<"Could not install the database "<writeConfig(); - - emit syncDone(this); -} - diff --git a/kpilot/conduits/docconduit/doc-conduit.h b/kpilot/conduits/docconduit/doc-conduit.h deleted file mode 100644 index aefb4264f..000000000 --- a/kpilot/conduits/docconduit/doc-conduit.h +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef _doc_CONDUIT_H -#define _doc_CONDUIT_H -/* doc-conduit.h KPilot -** -** Copyright (C) 2002-2003 by Reinhold Kainhofer -** -*/ - -/* -** 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 - -class docSyncInfo; -typedef TQValueList syncInfoList; - -typedef enum eSyncDirectionEnum { - eSyncNone, -// eSyncAll, - eSyncPDAToPC, - eSyncPCToPDA, - eSyncDelete, - eSyncConflict - }; -typedef enum eTextStatus { - eStatNone=0, - eStatNew=1, - eStatChanged=2, - eStatBookmarksChanged=4, - eStatDeleted=8, - eStatDoesntExist=16 - }; - - -TQString dirToString(eSyncDirectionEnum dir); - -class DOCConduit:public ConduitAction { -Q_OBJECT -public: - eSyncDirectionEnum eSyncDirection; - -public: - DOCConduit(KPilotLink * o, - const char *n = 0L, const TQStringList & a = TQStringList()); - virtual ~ DOCConduit(); - - bool encode(TQStringList fileName, PilotDatabase * db); - bool decode(PilotDatabase * db, TQString fileName); - virtual bool exec(); -protected: - virtual bool isCorrectDBTypeCreator(DBInfo dbinfo); - virtual const unsigned long dbtype(); - virtual const unsigned long dbcreator(); - -public slots: -/** syncNextDB walks through all PalmDoc databases on the handheld and decides if they are supposed to be synced to the PC. - * syncNextDB and syncNextDOC fist build the list of all PalmDoc texts, and then the method syncDatabases does the actual sync. */ - void syncNextDB(); - void syncNextTXT(); - void checkPDBFiles(); - void checkDeletedDocs(); - void resolve(); - void syncDatabases(); - void cleanup(); - - private: - /** - * Read the global KPilot config file for settings - * particular to the docConduit conduit. - */ - void readConfig(); - - /** - * Check if the database needs to be synced at all. - */ - bool needsSync(docSyncInfo &sinfo); - /** - * If necessary, copy the database from the palm to a local dir. - * Also initialize the docDBInfo that will be passed to the docconverter - */ - PilotDatabase *preSyncAction(docSyncInfo &sinfo) const; - - bool doSync(docSyncInfo &sinfo); - /** - * Clean up after the sync. The bool parameter res tells - * the function if the conversion was successful or not - */ - bool postSyncAction(PilotDatabase * dbinfo, docSyncInfo &sinfo, bool res = true); - - bool pcTextChanged(TQString txtfn); - bool hhTextChanged(PilotDatabase*docdb); - - /** Opens the database with name dbname. For a local sync, this will be a - * PilotLocalDatabase, otherwise it will be a database on the serial device - * (i.e. an object of class PilotSerialDatabase) */ - PilotDatabase *openDOCDatabase(const TQString &dbname); - - TQString constructPDBFileName(TQString name); - TQString constructTXTFileName(TQString name); - - eSyncDirectionEnum eConflictResolution; - int fTXTBookmarks, fPDBBookmarks; - TQStringList fDBListSynced; - TQStringList fDBNames; - syncInfoList fSyncInfoList; - syncInfoList::Iterator fSyncInfoListIterator; - long int dbnr; - - TQStringList docnames; - TQStringList::Iterator dociterator; -}; - -class docSyncInfo -{ -public: - docSyncInfo(TQString hhDB=TQString(), TQString txtfn=TQString(), TQString pdbfn=TQString(), eSyncDirectionEnum dir=eSyncNone) - { - handheldDB=hhDB; - txtfilename=txtfn; - pdbfilename=pdbfn; - direction=dir; - fPCStatus=eStatNone; - fPalmStatus=eStatNone; - }; - ~docSyncInfo(){}; - TQString handheldDB, txtfilename, pdbfilename; - DBInfo dbinfo; - eSyncDirectionEnum direction; - eTextStatus fPCStatus, fPalmStatus; -}; - - -#endif diff --git a/kpilot/conduits/docconduit/doc-conflictdialog.cc b/kpilot/conduits/docconduit/doc-conflictdialog.cc deleted file mode 100644 index 50ecbbd1e..000000000 --- a/kpilot/conduits/docconduit/doc-conflictdialog.cc +++ /dev/null @@ -1,182 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -*/ - -/* -** 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 "doc-conflictdialog.moc" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -ResolutionDialog::ResolutionDialog( TQWidget* parent, const TQString& caption, syncInfoList*sinfo, KPilotLink*lnk ) - : KDialogBase( parent, "resolutionDialog", true, caption, KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true), tickleTimer(0L), fHandle(lnk) { - FUNCTIONSETUP; - syncInfo=sinfo; - hasConflicts=false; - - TQWidget *page = new TQWidget( this ); - setMainWidget(page); - TQVBoxLayout *topLayout = new TQVBoxLayout( page, 0, spacingHint() ); - - // First, insert the texts on top: - textLabel1 = new TQLabel(i18n("Here is a list of all text files and DOC databases the conduit found. The conduit tried to determine the correct sync direction, but for databases in bold red letters a conflict occurred (i.e. the text was changed both on the desktop and on the handheld). For these databases please specify which version is the current one."), page); - textLabel1->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) ); - topLayout->addWidget(textLabel1); - - textLabel2 = new TQLabel(i18n("You can also change the sync direction for databases without a conflict." ), page ); - textLabel2->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) ); - topLayout->addWidget(textLabel2); - - resolutionGroupBox = new TQGroupBox(i18n("DOC Databases"), page ); - TQVBoxLayout*playout = new TQVBoxLayout(resolutionGroupBox); - TQScrollView* sv = new TQScrollView(resolutionGroupBox); - playout->addWidget(sv); - sv->setResizePolicy(TQScrollView::AutoOneFit); - sv->setHScrollBarMode(TQScrollView::AlwaysOff); - sv->setMargin(5); - TQFrame* big_box = new TQFrame(sv->viewport()); - sv->addChild(big_box); - - - resolutionGroupBoxLayout = new TQGridLayout( big_box, syncInfo->size(), 3 ); - resolutionGroupBoxLayout->setAlignment( Qt::AlignTop ); - - // Invisible button group for the information buttons to use the same slot for all of them (see Dallheimer's book, page 309f) - TQButtonGroup *bgroup = new TQButtonGroup( this ); - bgroup->hide(); - TQObject::connect(bgroup, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(slotInfo(int))); - - if (syncInfo) { - DEBUGKPILOT<<"Adding resolution options for the databases "<begin(); it!=syncInfo->end(); ++it ) { - docSyncInfo si=(*it); - conflictEntry cE; - cE.index=nr; - cE.conflict=(si.direction==eSyncConflict); - DEBUGKPILOT<<"Adding "<")+text+CSL1(""); - DEBUGKPILOT<<"We have a conflict for database "<addWidget( cE.dbname, cE.index, 0 ); - - cE.resolution=new TQComboBox( FALSE, big_box); - cE.resolution->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, - (TQSizePolicy::SizeType)0, 0, 0, - cE.resolution->sizePolicy().hasHeightForWidth() ) ); - cE.resolution->clear(); - cE.resolution->insertItem( i18n( "No Sync" ) ); - cE.resolution->insertItem( i18n( "Sync Handheld to PC" ) ); - cE.resolution->insertItem( i18n( "Sync PC to Handheld" ) ); - cE.resolution->insertItem( i18n( "Delete Both Databases" ) ); - cE.resolution->setCurrentItem((int)si.direction); - resolutionGroupBoxLayout->addWidget( cE.resolution, cE.index, 1); - - cE.info = new TQPushButton( i18n("More Info..."), big_box ); - resolutionGroupBoxLayout->addWidget(cE.info, cE.index, 2); - bgroup->insert(cE.info); - - conflictEntries.append(cE); - ++nr; - } - } else { - WARNINGKPILOT << "The list of text files is not available to the resolution dialog." << endl; - } - - - topLayout->addWidget( resolutionGroupBox ); - resize( TQSize(600, 480).expandedTo(minimumSizeHint()) ); - - if (fHandle) tickleTimer=new TQTimer(this, "TickleTimer"); - if (tickleTimer) { - connect( tickleTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(_tickle()) ); - tickleTimer->start( 10000 ); // tickle the palm every 10 seconds to prevent a timeout until the sync is really finished. - } - -} - -/* - * Destroys the object and frees any allocated resources - */ -ResolutionDialog::~ResolutionDialog() -{ - // no need to delete child widgets, Qt does it all for us -} - -/* virtual slot */ void ResolutionDialog::slotOk() { - FUNCTIONSETUP; - TQValueList::Iterator ceIt; - for (ceIt=conflictEntries.begin(); ceIt!=conflictEntries.end(); ++ceIt) { - (*syncInfo)[(*ceIt).index].direction=(eSyncDirectionEnum)((*ceIt).resolution->currentItem()); - } - KDialogBase::slotOk(); -} - -TQString eTextStatusToString(eTextStatus stat) { - switch(stat) { - case eStatNone: return i18n("unchanged"); - case eStatNew: return i18n("new"); - case eStatChanged: return i18n("changed"); - case eStatBookmarksChanged: return i18n("only bookmarks changed"); - case eStatDeleted: return i18n("deleted"); - case eStatDoesntExist: return i18n("does not exist"); - default: return i18n("unknown"); - } -} - -void ResolutionDialog::slotInfo(int index) { - FUNCTIONSETUP; - conflictEntry cE=conflictEntries[index]; - int ix=cE.index; - if (!syncInfo) return; - docSyncInfo si=(*syncInfo)[ix]; - TQString text=i18n("Status of the database %1:\n\n").arg(si.handheldDB); - text+=i18n("Handheld: %1\n").arg(eTextStatusToString(si.fPalmStatus)); - text+=i18n("Desktop: %1\n").arg(eTextStatusToString(si.fPCStatus)); - - KMessageBox::information(this, text, i18n("Database information")); -} - - -void ResolutionDialog::_tickle() { - FUNCTIONSETUP; - if (fHandle) fHandle->tickle(); -} diff --git a/kpilot/conduits/docconduit/doc-conflictdialog.h b/kpilot/conduits/docconduit/doc-conflictdialog.h deleted file mode 100644 index f0c8b2163..000000000 --- a/kpilot/conduits/docconduit/doc-conflictdialog.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef CONFLICTDIALOG_H -#define CONFLICTDIALOG_H -/* doc-conflictdialog.h KPilot -** -** Copyright (C) 2002-2003 by Reinhold Kainhofer -** -*/ - -/* -** 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 -#include "doc-conduit.h" - - -class TQComboBox; -class TQGridLayout; -class TQGroupBox; - -class TQLabel; -class TQPushButton; -class TQTimer; -class KPilotLink; - - -typedef struct conflictEntry { - TQLabel*dbname; - TQComboBox* resolution; - TQPushButton*info; - int index; - bool conflict; -}; - - -class ResolutionDialog : public KDialogBase -{ - Q_OBJECT - -public: - ResolutionDialog( TQWidget* parent=0, const TQString& caption=i18n("Resolution Dialog"), syncInfoList*sinfo=0L, KPilotLink*lnk=0L); - ~ResolutionDialog(); - - bool hasConflicts; -public slots: - void _tickle(); -protected: - TQTimer* tickleTimer; - KPilotLink* fHandle; - -protected: - TQGroupBox* resolutionGroupBox; - TQGridLayout*resolutionGroupBoxLayout; - - syncInfoList*syncInfo; - TQValueList conflictEntries; - TQLabel *textLabel1,*textLabel2; - -protected slots: - virtual void slotOk(); - void slotInfo(int index); - -}; - -#endif // CONFLICTDIALOG_H diff --git a/kpilot/conduits/docconduit/doc-factory.cc b/kpilot/conduits/docconduit/doc-factory.cc deleted file mode 100644 index cfab20f4d..000000000 --- a/kpilot/conduits/docconduit/doc-factory.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** This file defines the factory for the doc-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 "doc-factory.moc" -#include "doc-factory.h" - -#include -#include -#include - -#include "doc-conduit.h" -#include "doc-setup.h" - - -extern "C" { - void *init_conduit_doc() { - return new DOCConduitFactory; - } -} - - - -// A number of static variables -KAboutData * DOCConduitFactory::fAbout = 0L; - -const char *DOCConduitFactory::dbDOCtype = "TEXt"; -const char *DOCConduitFactory::dbDOCcreator = "REAd"; - - - -DOCConduitFactory::DOCConduitFactory(TQObject * p, const char *n): -KLibFactory(p, n) -{ - FUNCTIONSETUP; - fInstance = new KInstance("docconduit"); - fAbout =new KAboutData("docconduit", - I18N_NOOP("Palm DOC Conduit for KPilot"), KPILOT_VERSION, - I18N_NOOP("Configures the DOC Conduit for KPilot"), - KAboutData::License_GPL, "(C) 2002, Reinhold Kainhofer"); - - fAbout->addAuthor("Reinhold Kainhofer", - I18N_NOOP("Maintainer"), "reinhold@kainhofer.com", - "http://reinhold.kainhofer.com"); -} - -DOCConduitFactory::~DOCConduitFactory() -{ - FUNCTIONSETUP; - KPILOT_DELETE(fInstance); - KPILOT_DELETE(fAbout); -} - - -/* virtual */ TQObject * DOCConduitFactory::createObject(TQObject * p, - const char *n, const char *c, const TQStringList & a) -{ - FUNCTIONSETUP; - -#ifdef DEBUG - DEBUGKPILOT << fname <<": Creating object of class " <(p); - if (w) - { - return new DOCWidgetConfig(w,n); - } - else - { - WARNINGKPILOT << "Couldn't cast parent to widget." << endl; - return 0L; - } - } - if (qstrcmp(c, "SyncAction") == 0) - { - KPilotLink * d = dynamic_cast < KPilotLink * >(p); - if (d) - { - return new DOCConduit(d, n, a); - } - else - { - WARNINGKPILOT << "Couldn't cast parent to KPilotLink" < - -class KInstance; -class KAboutData; - - -class DOCConduitFactory:public KLibFactory -{ - -Q_OBJECT - -public: - DOCConduitFactory(TQObject * = 0L, const char * = 0L); - virtual ~ DOCConduitFactory(); - - static KAboutData *about() { - return fAbout; - }; - - static const char - *fDBListSynced; - static const char *dbDOCtype; - static const char *dbDOCcreator; - - -protected: - virtual TQObject * createObject(TQObject * parent = 0, - const char *name = 0, - const char *classname = "TQObject", - const TQStringList & args = TQStringList()); - -private: - KInstance * fInstance; - static KAboutData *fAbout; -}; - - -extern "C" { - void *init_libdocconduit(); -} - - -#endif diff --git a/kpilot/conduits/docconduit/doc-setup.cc b/kpilot/conduits/docconduit/doc-setup.cc deleted file mode 100644 index 6e6858a5c..000000000 --- a/kpilot/conduits/docconduit/doc-setup.cc +++ /dev/null @@ -1,136 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** This file defines the setup dialog for the doc-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 -#include -#include -#include - -#include -#include -#include - -#include "doc-setupdialog.h" -#include "doc-factory.h" -#include "doc-setup.h" -#include "docconduitSettings.h" - - -DOCWidgetConfig::DOCWidgetConfig(TQWidget * w, const char *n): - ConduitConfigBase(w, n), - fConfigWidget(new DOCWidget(w)) -{ - FUNCTIONSETUP; - - fWidget=fConfigWidget; - - TQStringList l = KGlobal::charsets()->descriptiveEncodingNames(); - for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it) - { - fConfigWidget->fEncoding->insertItem(*it); - } - - fConfigWidget->fTXTDir->setMode(KFile::Directory); - fConfigWidget->fPDBDir->setMode(KFile::Directory); - ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget,DOCConduitFactory::about()); - - fConduitName=i18n("Palm DOC"); - -#define CMOD(a,b) connect(fConfigWidget->a,TQT_SIGNAL(b),this,TQT_SLOT(modified())) - CMOD(fTXTDir,textChanged(const TQString &)); - CMOD(fPDBDir,textChanged(const TQString &)); - CMOD(fkeepPDBLocally,clicked()); - CMOD(fConflictResolution,clicked(int)); - CMOD(fConvertBookmarks,stateChanged(int)); - CMOD(fBookmarksBmk,stateChanged(int)); - CMOD(fBookmarksInline,stateChanged(int)); - CMOD(fBookmarksEndtags,stateChanged(int)); - CMOD(fCompress,stateChanged(int)); - CMOD(fSyncDirection,clicked(int)); - CMOD(fNoConversionOfBmksOnly,stateChanged(int)); - CMOD(fAlwaysUseResolution,stateChanged(int)); - CMOD(fPCBookmarks,clicked(int)); - CMOD(fEncoding,textChanged(const TQString &)); -#undef CMOD - - fConfigWidget->adjustSize(); -} - -/* virtual */ void DOCWidgetConfig::commit() -{ - FUNCTIONSETUP; - - DOCConduitSettings::setTXTDirectory( fConfigWidget->fTXTDir->url() ); - DOCConduitSettings::setPDBDirectory( fConfigWidget->fPDBDir->url() ); - - DOCConduitSettings::setKeepPDBsLocally( fConfigWidget->fkeepPDBLocally->isChecked()); - DOCConduitSettings::setConflictResolution( fConfigWidget->fConflictResolution->id( - fConfigWidget->fConflictResolution->selected()) ); - DOCConduitSettings::setConvertBookmarks(fConfigWidget->fConvertBookmarks->isChecked()); - DOCConduitSettings::setBmkFileBookmarks(fConfigWidget->fBookmarksBmk->isChecked()); - DOCConduitSettings::setInlineBookmarks(fConfigWidget->fBookmarksInline->isChecked()); - DOCConduitSettings::setEndtagBookmarks(fConfigWidget->fBookmarksEndtags->isChecked()); - DOCConduitSettings::setCompress(fConfigWidget->fCompress->isChecked()); - DOCConduitSettings::setSyncDirection(fConfigWidget->fSyncDirection->id( - fConfigWidget->fSyncDirection->selected())); - DOCConduitSettings::setIgnoreBmkChanges(fConfigWidget->fNoConversionOfBmksOnly->isChecked()); - DOCConduitSettings::setAlwaysShowResolutionDialog(fConfigWidget->fAlwaysUseResolution->isChecked()); - DOCConduitSettings::setBookmarksToPC( fConfigWidget->fPCBookmarks->id( - fConfigWidget->fPCBookmarks->selected()) ); - DOCConduitSettings::setEncoding( fConfigWidget->fEncoding->currentText() ); - - DOCConduitSettings::self()->writeConfig(); - unmodified(); -} - -/* virtual */ void DOCWidgetConfig::load() -{ - FUNCTIONSETUP; - DOCConduitSettings::self()->readConfig(); - - fConfigWidget->fTXTDir->setURL( DOCConduitSettings::tXTDirectory() ); - fConfigWidget->fPDBDir->setURL( DOCConduitSettings::pDBDirectory() ); - fConfigWidget->fkeepPDBLocally->setChecked( DOCConduitSettings::keepPDBsLocally() ); - fConfigWidget->fConflictResolution->setButton(DOCConduitSettings::conflictResolution() ); - fConfigWidget->fConvertBookmarks->setChecked(DOCConduitSettings::convertBookmarks() ); - fConfigWidget->fBookmarksBmk->setChecked(DOCConduitSettings::bmkFileBookmarks() ); - fConfigWidget->fBookmarksInline->setChecked(DOCConduitSettings::inlineBookmarks() ); - fConfigWidget->fBookmarksEndtags->setChecked(DOCConduitSettings::endtagBookmarks() ); - fConfigWidget->fCompress->setChecked(DOCConduitSettings::compress() ); - fConfigWidget->fSyncDirection->setButton(DOCConduitSettings::syncDirection() ); - - fConfigWidget->fNoConversionOfBmksOnly->setChecked( DOCConduitSettings::ignoreBmkChanges() ); - fConfigWidget->fAlwaysUseResolution->setChecked( DOCConduitSettings::alwaysShowResolutionDialog() ); - - fConfigWidget->fPCBookmarks->setButton(DOCConduitSettings::bookmarksToPC() ); - fConfigWidget->fEncoding->setCurrentText(DOCConduitSettings::encoding() ); - unmodified(); -} - diff --git a/kpilot/conduits/docconduit/doc-setup.h b/kpilot/conduits/docconduit/doc-setup.h deleted file mode 100644 index 32d1b54bc..000000000 --- a/kpilot/conduits/docconduit/doc-setup.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef _DOC_DOC_SETUP_H -#define _DOC_DOC_SETUP_H -/* doc-setup.h KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** This file defines the widget and behavior for the config dialog -** of the doc 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 DOCWidget; - -class DOCWidgetConfig : public ConduitConfigBase -{ -public: - DOCWidgetConfig(TQWidget *, const char *); - virtual void commit(); - virtual void load(); -protected: - DOCWidget *fConfigWidget; -} ; - - -#endif diff --git a/kpilot/conduits/docconduit/doc-setupdialog.ui b/kpilot/conduits/docconduit/doc-setupdialog.ui deleted file mode 100644 index cbb45e344..000000000 --- a/kpilot/conduits/docconduit/doc-setupdialog.ui +++ /dev/null @@ -1,557 +0,0 @@ - -DOCWidget -Reinhold Kainhofer - - - Form2 - - - - 0 - 0 - 564 - 266 - - - - - 3 - 3 - 0 - 0 - - - - - unnamed - - - 0 - - - 6 - - - - tabWidget - - - - tab - - - General - - - - unnamed - - - - TextLabel1 - - - &Text files: - - - fTXTDir - - - <qt>Enter here, or select clicking the file picker button, the name and location of the folder used to find and synchronize text files. All files with extension .txt located in this folder will be synced to Palm DOC databases in your handheld.</qt> - - - - - fkeepPDBLocally - - - Local co&py: - - - true - - - <qt>Check this box if you want to save a copy of the Palm DOC databases (.pdb files) on your PC.</qt> - - - - - fTXTDir - - - <qt>Enter here, or select clicking the file picker button, the name and location of the folder used to find and synchronize text files. All files with extension .txt located in this folder will be synced to Palm DOC databases in your handheld.</qt> - - - - - fSyncDirection - - - Synchronization Mode - - - - unnamed - - - 11 - - - 6 - - - - RadioButton3 - - - Sync only P&C to PDA - - - 2 - - - <qt>Select this option to synchronize texts changed in your PC to Palm DOC databases in your handheld. Palm DOC databases modified in the handheld will not be converted to text files, but texts changed in the PC will be converted to the Palm DOC databases.</qt> - - - - - RadioButton2 - - - Sync only P&DA to PC - - - <qt>Select this option to synchronize the changes made to Palm DOC databases in your handheld to the PC text files. Palm DOC databases modified in the handheld will be converted to text files, but texts changed in the PC will not be converted to the Palm DOC databases.</qt> - - - - - RadioButton1 - - - Sync &all - - - true - - - 0 - - - <qt>Select this option to synchronize the file texts in your PC to Palm DOC databases in your handheld. Palm DOC databases modified in the handheld will be converted to text files, and texts changed in the PC will be converted to the Palm DOC databases, keeping both versions in sync.</qt> - - - - - - - Spacer1 - - - Vertical - - - Expanding - - - - 20 - 20 - - - - - - fPDBDir - - - <qt>Enter here, or select clicking the file picker button, the name and location of the folder where copies of the handheld databases are kept (.pdb files). Local copies are only made if the box is checked as well.</qt> - - - - - - - tab - - - PC -> Handheld - - - - unnamed - - - - fCompress - - - &Compress - - - true - - - Check this box, if the text should be compressed on the handheld to save memory. Most doc reader on the handheld support compressed texts. - - - <qt>The Palm DOC format supports compressing the text to save memory. Check this box to enable text compression, so the resulting Palm DOC database will consume about 50% less memory than in uncompressed state. Almost all DOC readers on the Palm support compressed texts.</qt> - - - - - fConvertBookmarks - - - Convert &bookmarks - - - true - - - <qt>Check this box to enable bookmark creation when converting text files to Palm DOC databases. Most doc readers support bookmarks. In order to create a bookmark, it is necessary to to provide the location in the text where the bookmark should be set and the bookmark title, in at least one of the formats listed below.</qt> - - - - - spacer9 - - - Vertical - - - Expanding - - - - 20 - 20 - - - - - - fBookmarksInline - - - &Inline tags in text - - - true - - - Check this box to create bookmarks from inline tags in the text. The inline tag consist of tags in the form <* bookmarktext *>. The bookmark location is set using the location of the inline tag in the text, and the name is the text between the <* and the *>. The inline tag (<*...*>) will be removed from the text. - - - - - textLabel1 - - - &Encoding: - - - fEncoding - - - - - fBookmarksEndtags - - - &Tags at end of text - - - Check this box to convert tags of the form <bookmarkname> at the end of the text to bookmarks. The text inside the tag ("bookmarkname") will be searched in the text, and whenever found, a bookmark will be set there. The endtags <...> will then be removed from the end of the text. - - - - - fBookmarksBmk - - - Regular &expressions in .bmk file - - - <qt>Check this box to use regular expressions in a file to search the text for bookmarks. The file should have the same name as the text file, but should end in .bmk instead of .txt (for instance, the regular expression file for textname.txt should be textname.bmk). See the documentation for a description of the format of the bmk file.</qt> - - - - - fEncoding - - - - - - - tab - - - Handheld -> PC - - - - unnamed - - - - spacer16 - - - Vertical - - - Expanding - - - - 20 - 20 - - - - - - fNoConversionOfBmksOnly - - - Do not convert, if text unchanged (only bookmarks) - - - <qt>Check this box to avoid syncing the text on the handheld to the PC if you only changed the bookmarks on the handheld (but not the text).</qt> - - - - - fPCBookmarks - - - Convert Bookmarks - - - - unnamed - - - - radioButton8 - - - Do &not convert bookmarks - - - 0 - - - <qt>Check this box to avoid converting Palm DOC bookmarks to inline tags or to a bookmark file.</qt> - - - - - radioButton11 - - - Convert into .bm &file - - - true - - - 1 - - - <qt>Check this box to convert the Palm DOC database bookmarks to a separate file, in the bmk format (see more about this format in the documentation). The resulting bookmark file shares the same filename as the resulting .txt file, but ends in .bmk instead. This approach creates a clean text file and a bookmark file.</qt> - - - - - radioButton9 - - - Convert as &inline tags - - - 2 - - - <qt>Check this box to convert the Palm DOC database bookmarks to inline tags, in the form &lt;* BookmarkName *&gt;. These tags are inserted in the text in the position marked by the bookmark, and the text inside the tag corresponds to the bookmark name. Inline tags are easy to create, delete, move and edit.</qt> - - - - - - - - - tab - - - Conflicts - - - - unnamed - - - - fConflictResolution - - - Conflict Resolution - - - If the same text was changed on the PC and the handheld, which of the two versions should be used as the new version? - - - <qt>The Palm DOC conduit does not feature merging the modifications when a text is changed both in the handheld and in the computer. Therefore, the choice is between working with the files out of sync, or discarding the changes in one of them.</qt> - - - - unnamed - - - - radioButton12 - - - &No resolution - - - 0 - - - <qt>The Palm DOC conduit does not feature merging the modifications when a text is changed both in the handheld and in the computer. Therefore, when conflicts appear, the choice is between working with the files out of sync, or discarding the changes in one of them. Select this option to prevent KPilot from overwriting your modifications.</qt> - - - - - RadioButton5 - - - P&DA overrides - - - 1 - - - <qt>The Palm DOC conduit does not feature merging the modifications when a text is changed both in the handheld and in the computer. Therefore, when conflicts appear, the choice is between working with the files out of sync, or discarding the changes in one of them. Select this option to make the PDA version overwrite the PC version in case of conflict.</qt> - - - - - RadioButton4 - - - P&C overrides - - - 2 - - - <qt>The Palm DOC conduit does not feature merging the modifications when a text is changed both in the handheld and in the computer. Therefore, when conflicts appear, the choice is between working with the files out of sync, or discarding the changes in one of them. Select this option to make the PC version overwrite the PDA version in case of conflict.</qt> - - - - - RadioButton7 - - - &Ask the user - - - true - - - 4 - - - <qt>The Palm DOC conduit does not feature merging the modifications when a text is changed both in the handheld and in the computer. Therefore, when conflicts appear, the choice is between working with the files out of sync, or discarding the changes in one of them. Select this option to show the resolution dialog to let the user decide on a case by case basis.</qt> - - - - - - - fAlwaysUseResolution - - - &Always show the resolution dialog - - - <qt>Check this box to force the resolution dialog to appear even when there are no conflicts.</qt> - - - - - Spacer8 - - - Vertical - - - Expanding - - - - 20 - 20 - - - - - - - - - - - - - fConvertBookmarks - toggled(bool) - fBookmarksInline - setEnabled(bool) - - - fConvertBookmarks - toggled(bool) - fBookmarksEndtags - setEnabled(bool) - - - fConvertBookmarks - toggled(bool) - fBookmarksBmk - setEnabled(bool) - - - fkeepPDBLocally - toggled(bool) - fPDBDir - setEnabled(bool) - - - - fTXTDir - fkeepPDBLocally - fPDBDir - fCompress - fConvertBookmarks - fBookmarksInline - fBookmarksEndtags - fBookmarksBmk - radioButton11 - fNoConversionOfBmksOnly - RadioButton7 - fAlwaysUseResolution - tabWidget - RadioButton1 - - - - kurlrequester.h - klineedit.h - kpushbutton.h - - diff --git a/kpilot/conduits/docconduit/doc_conduit.desktop b/kpilot/conduits/docconduit/doc_conduit.desktop deleted file mode 100644 index 324347e31..000000000 --- a/kpilot/conduits/docconduit/doc_conduit.desktop +++ /dev/null @@ -1,58 +0,0 @@ -[Desktop Entry] -Type=Service -Comment=Adds text files to your handheld, suitable for DOC readers. -Comment[af]=Voeg teks lêers by jou draagbare toestel in DOC leser formaat. -Comment[bg]=ДобавÑне на текÑтови файлове към мобилно уÑтройÑтво. -Comment[ca]=Afegeix fitxers de text a la vostra agenda, apropiat per a lectors de DOC. -Comment[cs]=PÅ™idává textové soubory do vaÅ¡eho Pilotu, výhodné pro Ätenáře dokumentů. -Comment[da]=Tilføjer tekstfiler til din hÃ¥ndholdte, passende for DOC-læsere. -Comment[de]=Gibt Textdateien in Taschencomputer ein, passend für DOC-Leser. -Comment[el]=ΠÏοσθέτει αÏχεία κειμένου στον υπολογιστή παλάμης σας, κατάλληλο για αναγνώστες DOC. -Comment[es]=Añade archivos de texto a su agenda electrónica. Compatible con los lectores DOC. -Comment[et]=Lisab DOC-riiderile sobilikud tekstifailid sinu pihuseadmele. -Comment[eu]=Zure agenda elektronikora DOC irakurleentzako aproposak diren testu fitxategiak gehitzen ditu. -Comment[fa]=پرونده‌های متن را به دستی شما اضاÙÙ‡ می‌کند، Ú©Ù‡ برای خوانندگان DOC Ù…Ùید است. -Comment[fi]=Lisää tekstitiedostoja taskutietokoneeseen. Tämä on käyttökelpoinen DOC-lukijoille. -Comment[fr]=Ajoute des fichiers texte à votre Palm, approprié pour les lecteurs de DOC. -Comment[fy]=Heakket tekstfjilden ta oan jo handheld, geskikt faor DOC-lêzers. -Comment[gl]=Engade ficheiros de texto ao seu aparello de man, axeitado para os lectores DOC. -Comment[hu]=Szöveges fájlok hozzáadása a kézi számítógéphez, DOC-olvasók számára. -Comment[is]=Bætir textaskrám, sem hægt er að lesa í DOC lesara, við lófatölvuna þína. -Comment[it]=Aggiunge file di testo al tuo Pilot, adatti per lettori DOC. -Comment[ja]=テキストファイルを DOC リーダーã«é©ã—ãŸå½¢å¼ã§ãƒãƒ³ãƒ‰ãƒ˜ãƒ«ãƒ‰ã«è¿½åŠ ã—ã¾ã™ã€‚ -Comment[kk]=DOC файлды оқи алатын қалта құрылғыға мәтінді көшіру. -Comment[km]=បន្ážáŸ‚ម​ឯកសារ​អážáŸ’ážáž”ទ​ទៅ​ឧបករណáŸâ€‹áž™áž½ážšâ€‹ážŠáŸƒâ€‹ážšáž”ស់​អ្នក (សមស្រប​សម្រាប់​កម្មវិធី​អាន DOC) ។ -Comment[lt]=Prideda teksto bylas prie JÅ«sų neÅ¡iojamos knygelÄ—s, tinka DOC skaityklÄ—ms. -Comment[ms]=Menambah fail teks ke komputer telapak, sesuai dengan pembaca DOC. -Comment[nb]=Legger til tekstfiler pÃ¥ PDA-en, som passer for DOC-lesere. -Comment[nds]=Föögt Textdateien op den Handreekner to, de för DOC-Kiekers passt. -Comment[ne]=DOC रिडरका लागि उपयà¥à¤•à¥à¤¤ हà¥à¤¨à¥‡ पाठ फाइल तपाईà¤à¤•à¥‹ हà¥à¤¯à¤¾à¤¨à¥à¤¡à¤¹à¥‡à¤²à¥à¤¡à¤®à¤¾ थपà¥à¤¦à¤› । -Comment[nl]=Voegt tekstvelden toe aan uw handheld, geschikt voor DOC-lezers. -Comment[nn]=Legg til tekstfiler pÃ¥ den handhaldne, passar til DOC-lesarar. -Comment[pl]=Dodaje pliki tekstowe do Twojego palmtopa, w postaci odpowiedniej dla przeglÄ…darek DOC. -Comment[pt]=Adiciona ficheiros de texto ao seu PDA, indicado para os leitores de DOC. -Comment[pt_BR]=Adiciona arquivos de texto ao seu handheld, adequado para leitors de DOC. -Comment[ru]=ÐŸÐµÑ€ÐµÐ½Ð¾Ñ Ñ‚ÐµÐºÑтовых файлов на КПК. -Comment[sk]=Pridá textové súbory do ruÄného zariadenia, vhodné pre Äítanie DOC. -Comment[sl]=V vaÅ¡ roÄni raÄunalnik doda besedilne datoteke, primerne za bralnike DOC. -Comment[sr]=Додаје текÑтуалне фајлове вашем ручном рачунару, погодне за DOC читаче. -Comment[sr@Latn]=Dodaje tekstualne fajlove vaÅ¡em ruÄnom raÄunaru, pogodne za DOC ÄitaÄe. -Comment[sv]=Lägger till textfiler i en handdator, lämpliga för DOC-läsare. -Comment[ta]=DOC படிபà¯à®ªà®µà®°à¯à®•à®³à¯à®•à¯à®•à¯ பொரà¯à®¤à¯à®¤à®®à®¾à®© உஙà¯à®•à®³à¯ பைலடà¯à®Ÿà¯à®•à¯à®•à¯à®°à®¿à®¯ உரை கோபà¯à®ªà¯à®•à®³à¯ˆ சேரà¯à®•à¯à®•à¯à®®à¯ -Comment[tr]=Metin dosyalarını el bilgisayarınıza ekler, DOC biçimi okuyucuları için uygundur. -Comment[uk]=Додає текÑтові файли до вашого кишенькового приÑтрою так, що вони читатимутьÑÑ Ñƒ переглÑдачах DOC. -Comment[zh_CN]=将文本文件添加到您的手æŒè®¾å¤‡ä¸­ï¼Œä»¥ä¾¿é€‚åˆ DOC 阅读程åºã€‚ -Comment[zh_TW]=新增文字到您的 handheld。 -Name=Palm DOC -Name[ca]=DOC de Palm -Name[cy]=DOC Palm -Name[de]=Palm-DOC -Name[fa]=رایانۀ جیبی DOC -Name[hi]=पॉम डॉक -Name[nds]=Palm-DOC -Name[ne]=पालà¥à¤® DOC -Name[pt]=DOC do Palm -Name[ta]=பாம௠ஆவணம௠-Implemented=file -ServiceTypes=KPilotConduit -X-KDE-Library=conduit_doc diff --git a/kpilot/conduits/docconduit/docconduit.kcfg b/kpilot/conduits/docconduit/docconduit.kcfg deleted file mode 100644 index 6301f4595..000000000 --- a/kpilot/conduits/docconduit/docconduit.kcfg +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - false - - - false - - - 0 - - - true - - - true - - - true - - - true - - - true - - - 1 - - - false - - - false - - - 0 - - - - - - ISO8859-15 - - - - diff --git a/kpilot/conduits/docconduit/docconduitSettings.kcfgc b/kpilot/conduits/docconduit/docconduitSettings.kcfgc deleted file mode 100644 index 2a9a3a0f7..000000000 --- a/kpilot/conduits/docconduit/docconduitSettings.kcfgc +++ /dev/null @@ -1,7 +0,0 @@ -File=docconduit.kcfg -ClassName=DOCConduitSettings -Singleton=true -ItemAccessors=true -Mutators=true -GlobalEnums=true -SetUserTexts=true diff --git a/kpilot/conduits/docconduit/kpalmdoc.cpp b/kpilot/conduits/docconduit/kpalmdoc.cpp deleted file mode 100644 index 55956cf48..000000000 --- a/kpilot/conduits/docconduit/kpalmdoc.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* converter.cpp -** -** Copyright (C) 2003 by Reinhold Kainhofer -** -** This is the main program of the KDE PalmDOC converter. -*/ - -/* -** 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 -#include -#include - -#include "kpalmdoc_dlg.h" - - - -int main(int argc, char *argv[]) -{ - - KAboutData about("converter", I18N_NOOP("KPalmDOC"), "-0.0.1", - "KPalmDOC - KDE Converter for PalmDOC texts.\n\n", - KAboutData::License_GPL, "(c) 2003, Reinhold Kainhofer"); - about.addAuthor("Reinhold Kainhofer", I18N_NOOP("Main Developer"), - "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/Linux/"); - about.addCredit("Adriaan de Groot", I18N_NOOP("Maintainer of KPilot"), - "groot@kde.org", "http://www.kpilot.org/"); - - KCmdLineArgs::init(argc, argv, &about); - KApplication::addCmdLineOptions(); - - KApplication app; - ConverterDlg *dlg=new ConverterDlg(0L, i18n("PalmDOC Converter")); - dlg->show(); - return app.exec(); -} - diff --git a/kpilot/conduits/docconduit/kpalmdoc.desktop b/kpilot/conduits/docconduit/kpalmdoc.desktop deleted file mode 100644 index 6acbf66fd..000000000 --- a/kpilot/conduits/docconduit/kpalmdoc.desktop +++ /dev/null @@ -1,64 +0,0 @@ -# KDE Config File -[Desktop Entry] -Name=KPalmDOC -Name[hi]=के-पॉम-डॉक -Name[sv]=Kpalm DOC -Name[ta]=கேகைdoc -GenericName=PalmDOC Converter -GenericName[af]=PalmDOC omskakelaar -GenericName[bg]=Конвертиране на PalmDOC -GenericName[bs]=PalmDOC konverter -GenericName[ca]=Convertidor a PalmDOC -GenericName[cs]=Konvertor PalmDoc -GenericName[cy]=Trosiadydd PalmDOC -GenericName[da]=PalmDOC konverterer -GenericName[de]=PalmDOC-Konvertierung -GenericName[el]=ΜετατÏοπέας PalmDOC -GenericName[eo]=PalmDOC-konvertilo -GenericName[es]=Conversor de PalmDOC -GenericName[et]=PalmDOC konverter -GenericName[eu]=PalmDOC bihurtzailea -GenericName[fa]=مبدل PalmDOC -GenericName[fi]=PalmDOC-muunnin -GenericName[fr]=Convertisseur PalmDOC -GenericName[fy]=PalmDOC-oersetter -GenericName[ga]=Tiontaire PalmDOC -GenericName[gl]=Convertidor de PalmDOC -GenericName[hi]=पॉम-डॉक परिवरà¥à¤¤à¤• -GenericName[hu]=PalmDOC-konverter -GenericName[is]=PalmDOC umbreytir -GenericName[it]=Convertitore PalmDOC -GenericName[ja]= PalmDOC コンãƒãƒ¼ã‚¿ -GenericName[kk]=PalmDOC аударғышы -GenericName[km]=កម្មវិធី​បម្លែង PalmDOC -GenericName[lt]=PalmDOC konverteris -GenericName[ms]=Penukar PalmDOC -GenericName[nb]=PalmDOC-konvertering -GenericName[nds]=PalmDOC-Ãœmwanneln -GenericName[ne]=PalmDOC रà¥à¤ªà¤¾à¤¨à¥à¤¤à¤°à¤£à¤•à¤°à¥à¤¤à¤¾ -GenericName[nl]=PalmDOC-conversie -GenericName[nn]=PalmDOC-omformar -GenericName[pl]=Konwerter formatu PalmDOC -GenericName[pt]=Conversor de PalmDOC -GenericName[pt_BR]=Conversor para PalmDOC -GenericName[ro]=Convertor PalmDOC -GenericName[ru]=Конвертер PalmDOC -GenericName[sk]=PalmDOC prevod -GenericName[sl]=Pretvornik v PalmDOC -GenericName[sr]=PalmDOC конвертор -GenericName[sr@Latn]=PalmDOC konvertor -GenericName[sv]=Konvertering av Palm DOC -GenericName[ta]=பாமà¯DOC மாறà¯à®±à®¿ -GenericName[tg]=Конвертёри PalmDOC -GenericName[tr]=PalmDOC Çevirici -GenericName[uk]=Перетворювач PalmDOC -GenericName[zh_CN]=PalmDOC 转æ¢å™¨ -GenericName[zh_TW]=PalmDOC 轉æ›å™¨ -Exec=kpalmdoc -Icon=kpalmdoc -Type=Application -DocPath=kpalmdoc/index.html -Terminal=false -X-KDE-StartupNotify=true -X-DCOP-ServiceType=Unique -Categories=Qt;KDE;Utility;X-KDE-Utilities-File;Office;PDA; diff --git a/kpilot/conduits/docconduit/kpalmdoc.kcfg b/kpilot/conduits/docconduit/kpalmdoc.kcfg deleted file mode 100644 index 4d3d22119..000000000 --- a/kpilot/conduits/docconduit/kpalmdoc.kcfg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - false - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - 0 - - - ISO8859-15 - - - diff --git a/kpilot/conduits/docconduit/kpalmdoc.upd b/kpilot/conduits/docconduit/kpalmdoc.upd deleted file mode 100644 index 77d3d1eeb..000000000 --- a/kpilot/conduits/docconduit/kpalmdoc.upd +++ /dev/null @@ -1,6 +0,0 @@ -Id=kdepim_3.3 -File=converterrc -Group=,General -AllKeys - - diff --git a/kpilot/conduits/docconduit/kpalmdocSettings.kcfgc b/kpilot/conduits/docconduit/kpalmdocSettings.kcfgc deleted file mode 100644 index 6da45c5e2..000000000 --- a/kpilot/conduits/docconduit/kpalmdocSettings.kcfgc +++ /dev/null @@ -1,7 +0,0 @@ -File=kpalmdoc.kcfg -ClassName=KPalmDocSettings -Singleton=true -ItemAccessors=true -Mutators=true -GlobalEnums=true -SetUserTexts=true diff --git a/kpilot/conduits/docconduit/kpalmdoc_dlg.cc b/kpilot/conduits/docconduit/kpalmdoc_dlg.cc deleted file mode 100644 index 29713ffae..000000000 --- a/kpilot/conduits/docconduit/kpalmdoc_dlg.cc +++ /dev/null @@ -1,529 +0,0 @@ -/* kpalmdoc_dlg.cpp -** -** Copyright (C) 2003 by Reinhold Kainhofer -** -** This is the main dialog of the KDE PalmDOC converter. -*/ - -/* -** 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 -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "kpalmdoc_dlg.h" -#include "kpalmdoc_dlgbase.h" -#include "DOC-converter.h" -#include "kpalmdocSettings.h" - - -ConverterDlg::ConverterDlg( TQWidget *parent, const TQString& caption) - : KDialogBase( parent, "converterdialog", false, caption, KDialogBase::Close|KDialogBase::Help|KDialogBase::User1, - KDialogBase::Close, true, i18n("&About")) -{ - TQWidget *page = makeHBoxMainWidget(); - dlg=new ConverterDlgBase(page); - TQStringList l = KGlobal::charsets()->descriptiveEncodingNames(); - for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it) - { - dlg->fEncoding->insertItem(*it); - } - - readSettings(); - - connect(dlg->fDirectories, TQT_SIGNAL(toggled(bool)), - this, TQT_SLOT(slotDirectories(bool))); - connect(dlg->fTextToPDB, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotToPDB())); - connect(dlg->fPDBToText, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotToText())); - - resize(minimumSize()); -} - -ConverterDlg::~ConverterDlg() -{ - // no need to delete child widgets, Qt does it all for us -} -void ConverterDlg::writeSettings() -{ - // General page - KPalmDocSettings::setTXTFolder( dlg->fTXTDir->url() ); - KPalmDocSettings::setPDBFolder( dlg->fPDBDir->url() ); - KPalmDocSettings::setSyncFolders( dlg->fDirectories->isChecked() ); - KPalmDocSettings::setAskOverwrite( dlg->fAskOverwrite->isChecked() ); - KPalmDocSettings::setVerboseMessages( dlg->fVerbose->isChecked() ); - KPalmDocSettings::setEncoding( dlg->fEncoding->currentText() ); - - // PC->Handheld page - KPalmDocSettings::setCompress( dlg->fCompress->isChecked() ); - KPalmDocSettings::setConvertBookmarks( dlg->fConvertBookmarks->isChecked() ); - KPalmDocSettings::setBookmarksInline( dlg->fBookmarksInline->isChecked() ); - KPalmDocSettings::setBookmarksEndtags( dlg->fBookmarksEndtags->isChecked() ); - KPalmDocSettings::setBookmarksBmk( dlg->fBookmarksBmk->isChecked() ); - - // Handheld->PC page - KPalmDocSettings::setBookmarksToPC( dlg->fPCBookmarks->id(dlg->fPCBookmarks->selected()) ); - - KPalmDocSettings::self()->writeConfig(); -} - -void ConverterDlg::readSettings() -{ - FUNCTIONSETUP; - - KPalmDocSettings::self()->readConfig(); - - // General Page: - dlg->fTXTDir->setURL(KPalmDocSettings::tXTFolder()); - dlg->fPDBDir->setURL(KPalmDocSettings::pDBFolder()); - bool dir=KPalmDocSettings::syncFolders(); - dlg->fDirectories->setChecked(dir); - slotDirectories(dir); - dlg->fAskOverwrite->setChecked( KPalmDocSettings::askOverwrite() ); - dlg->fVerbose->setChecked( KPalmDocSettings::verboseMessages() ); - TQString encoding = KPalmDocSettings::encoding(); -#ifdef DEBUG - DEBUGKPILOT << fname << ": Encoding=" << encoding << endl; -#endif - dlg->fEncoding->setCurrentText( KPalmDocSettings::encoding() ); - - // PC->Handheld page - dlg->fCompress->setChecked(KPalmDocSettings::compress() ); - dlg->fConvertBookmarks->setChecked(KPalmDocSettings::convertBookmarks()); - dlg->fBookmarksInline->setChecked(KPalmDocSettings::bookmarksInline()); - dlg->fBookmarksEndtags->setChecked(KPalmDocSettings::bookmarksEndtags()); - dlg->fBookmarksBmk->setChecked(KPalmDocSettings::bookmarksBmk()); - - // Handheld->PC page - dlg->fPCBookmarks->setButton(KPalmDocSettings::bookmarksToPC() ); -} - -void ConverterDlg::slotClose() -{ - writeSettings(); - kapp->quit(); - delete this; -} - -void ConverterDlg::slotToText() -{ - FUNCTIONSETUP; - // First, get the settings from the controls and initialize - // the converter object - int bmks=dlg->fPCBookmarks->id(dlg->fPCBookmarks->selected()); - DOCConverter conv; - switch(bmks) { - case 0: conv.setBookmarkTypes(DOCConverter::eBmkNone); break; - case 1: conv.setBookmarkTypes(DOCConverter::eBmkInline); break; - case 2: conv.setBookmarkTypes(DOCConverter::eBmkEndtags); break; - case 3: conv.setBookmarkTypes(DOCConverter::eBmkDefaultBmkFile); break; - default: - break; - } - - askOverwrite=dlg->fAskOverwrite->isChecked(); - verbose=dlg->fVerbose->isChecked(); - - - bool dir=dlg->fDirectories->isChecked(); - TQString txturl=dlg->fTXTDir->url(); - TQString pdburl=dlg->fPDBDir->url(); - - TQFileInfo txtinfo(txturl); - TQFileInfo pdbinfo(pdburl); - - if (dir) - { - if (pdbinfo.isFile()) - { - int res=KMessageBox::questionYesNo(this, - i18n("You selected to sync folders, " - "but gave a filename instead (%1)." - "
Use folder %2 instead?
").arg(pdburl) - .arg(pdbinfo.dirPath(true)), TQString::null, i18n("Use Folder"), KStdGuiItem::cancel()); - if (res==KMessageBox::Yes) - { - pdburl=pdbinfo.dirPath(true); - pdbinfo.setFile(pdburl); - } - else return; - } - - if (!pdbinfo.isDir()) - { - // no directory, so error message and return - KMessageBox::sorry(this, - i18n("The folder %1 for " - "the handheld database files is not a valid " - "folder.").arg(pdburl)); - return; - } - - if (!pdbinfo.exists()) - { - KMessageBox::sorry(this, - i18n("The folder %1 for " - "the handheld database files is not a " - "valid directory.").arg(pdburl)); - return; - } - - - // Now check the to directory: - if (txtinfo.isFile()) - { - int res=KMessageBox::questionYesNo(this, - i18n("You selected to sync folders, " - "but gave a filename instead (%1)." - "
Use folder %2 instead?
").arg(txturl) - .arg(txtinfo.dirPath(true)), TQString::null, i18n("Use Folder"), KStdGuiItem::cancel()); - if (res==KMessageBox::Yes) { - txturl=txtinfo.dirPath(true); - txtinfo.setFile(txturl); - } - else return; - } - - // Now that we have a directory path, try to create it: - if (!txtinfo.isDir()) { - txtinfo.dir().mkdir(txturl, true); - } - if (!txtinfo.isDir()) { - KMessageBox::sorry(this, - i18n("The folder %1 for " - "the text files could not be created.").arg(txturl)); - return; - } - - - // Now that we have both directories, create the converter object - DEBUGKPILOT<<"Pdbinfo.dir="<The file %1 does not " - "exist.").arg(pdburl)); - return; - } - - // Now check the to file -/* // I can't check if a given filename is a valid filename - if (!txtinfo.isFile()) - { - KMessageBox::sorry(this, i18n("The filename %1 for the " - "text is not a valid filename.").arg(txturl)); - return; - }*/ - if (convertPDBtoTXT(pdbinfo.dirPath(true), pdbinfo.fileName(), - txtinfo.dirPath(true), txtinfo.fileName(), &conv) ) - { - KMessageBox::information(this, i18n("Conversion of file %1 successful.").arg(pdburl)); - } - - } - -} - -void ConverterDlg::slotToPDB() -{ - FUNCTIONSETUP; - // First, get the settings from the controls and initialize - // the converter object - bool compress=dlg->fCompress->isChecked(); - int bmks=0; - if (dlg->fConvertBookmarks->isChecked()) - { - if (dlg->fBookmarksInline->isChecked()) bmks|=DOCConverter::eBmkInline; - if (dlg->fBookmarksEndtags->isChecked()) bmks|=DOCConverter::eBmkEndtags; - if(dlg->fBookmarksBmk->isChecked()) bmks|=DOCConverter::eBmkDefaultBmkFile; - } - DOCConverter conv; - conv.setBookmarkTypes(bmks); - conv.setCompress(compress); - conv.setSort(DOCConverter::eSortName); - - - askOverwrite=dlg->fAskOverwrite->isChecked(); - verbose=dlg->fVerbose->isChecked(); - - - bool dir=dlg->fDirectories->isChecked(); - TQString txturl=dlg->fTXTDir->url(); - TQString pdburl=dlg->fPDBDir->url(); - - TQFileInfo txtinfo(txturl); - TQFileInfo pdbinfo(pdburl); - - if (dir) - { - if (txtinfo.isFile()) - { - int res=KMessageBox::questionYesNo(this, - i18n("You selected to sync folders, " - "but gave a filename instead (%1)." - "
Use folder %2 instead?
").arg(txturl) - .arg(txtinfo.dirPath(true)), TQString::null, i18n("Use Folder"), KStdGuiItem::cancel()); - if (res==KMessageBox::Yes) - { - txturl=txtinfo.dirPath(true); - txtinfo.setFile(txturl); - } - else return; - } - - if (!txtinfo.isDir() || !txtinfo.exists()) - { - KMessageBox::sorry(this, - i18n("The folder %1 for " - "the text files is not a valid folder.").arg(txturl)); - return; - } - - - // Now check the to directory: - if (pdbinfo.isFile()) - { - int res=KMessageBox::questionYesNo(this, - i18n("You selected to sync folders, " - "but gave a filename instead (%1)." - "
Use folder %2 instead?
") - .arg(pdburl) - .arg(pdbinfo.dirPath(true)), TQString::null, i18n("Use Folder"), KStdGuiItem::cancel()); - if (res==KMessageBox::Yes) { - pdburl=pdbinfo.dirPath(true); - pdbinfo.setFile(pdburl); - } - else return; - } - - // Now that we have a directory path, try to create it: - if (!pdbinfo.isDir()) { - pdbinfo.dir().mkdir(pdburl, true); - } - if (!pdbinfo.isDir()) { - KMessageBox::sorry(this, i18n("The folder %1 for " - "the PalmDOC files could not be created.").arg(pdburl)); - return; - } - - - // Now that we have both directories, create the converter object - DEBUGKPILOT<<"Pdbinfo.dir="<The file %1 does not " - "exist.").arg(txturl)); - return; - } - - if (convertTXTtoPDB(txtinfo.dirPath(true), txtinfo.fileName(), - pdbinfo.dirPath(true), pdbinfo.fileName(), &conv) ) - { - KMessageBox::information(this, i18n("Conversion of file %1 successful.").arg(txturl)); - } - - } - -} - - -void ConverterDlg::slotUser1() -{ - KAboutApplication ab(KGlobal::instance()->aboutData(), this); - ab.show(); - ab.exec(); - return; -} - -void ConverterDlg::slotDirectories(bool dir) -{ - FUNCTIONSETUP; - DEBUGKPILOT<<"Slot Directories: "<fTextLabel->setText(i18n("&Text folder:")); - dlg->fPdbLabel->setText(i18n("&PalmDOC folder:")); - dlg->fTXTDir->setMode(KFile::LocalOnly | KFile::Directory); - dlg->fPDBDir->setMode(KFile::LocalOnly | KFile::Directory); - } else { - dlg->fTextLabel->setText(i18n("&Text file:")); - dlg->fPdbLabel->setText(i18n("&DOC file:")); - dlg->fTXTDir->setMode(KFile::LocalOnly | KFile::File); - dlg->fPDBDir->setMode(KFile::LocalOnly | KFile::File); - } -} - -bool ConverterDlg::convertTXTtoPDB(TQString txtdir, TQString txtfile, - TQString pdbdir, TQString pdbfile, DOCConverter*conv) -{ - FUNCTIONSETUP; - bool res=false; - TQFileInfo dbfileinfo(pdbdir, pdbfile); - DEBUGKPILOT<<"Working on file "<The database file %1 already exists. Overwrite it?") - .arg(dbfileinfo.filePath()), TQString::null, i18n("Overwrite"), KStdGuiItem::cancel() ) )) - { - PilotLocalDatabase*pdbdb=new PilotLocalDatabase(pdbdir, TQFileInfo(pdbfile).baseName(), false); - if (pdbdb) - { - if (!pdbdb->isOpen()) - { -#ifdef DEBUG - DEBUGKPILOT<createDatabase(get_long("REAd"), get_long("TEXt")) ) { - } - } - - if (pdbdb->isOpen()) - { - conv->setPDB(pdbdb); - conv->setTXTpath(txtdir, txtfile); - DEBUGKPILOT<<"Converting "<convertTXTtoPDB()) res=true; - } - delete pdbdb; - } - if ( !res && verbose ) - { - KMessageBox::sorry(this, i18n("Error while converting the text %1.").arg(txtfile)); - } - } - else - { - DEBUGKPILOT<<"Ignoring the file "<The text file %1 already exists. Overwrite it?") - .arg(txtfileinfo.filePath()), TQString::null, i18n("Overwrite"), KStdGuiItem::cancel() ) )) - { - PilotLocalDatabase*pdbdb=new PilotLocalDatabase(pdbdir, TQFileInfo(pdbfile).baseName(), false); - if (pdbdb) - { - if (pdbdb->isOpen()) - { - conv->setPDB(pdbdb); - conv->setTXTpath(txtdir, txtfile); - DEBUGKPILOT<<"Converting "<convertPDBtoTXT()) res=true; - } - delete pdbdb; - } - if ( !res && verbose ) - { - KMessageBox::sorry(this, i18n("Error while converting the text %1.").arg(pdbfile)); - } - } - else - { - DEBUGKPILOT<<"Ignoring the file "< -class ConverterDlgBase; -class DOCConverter; - -class ConverterDlg : public KDialogBase -{ - Q_OBJECT - -public: - ConverterDlg( TQWidget *parent=0, const TQString& caption=0); - ~ConverterDlg(); - -protected slots: - virtual void slotClose(); - void slotToText(); - void slotToPDB(); - void slotDirectories(bool dir); - void slotUser1(); -protected: - void writeSettings(); - void readSettings(); - - // These two functions convert one single file to or from a pdb database - bool convertTXTtoPDB(TQString txtdir, TQString txtfile, - TQString pdbdir, TQString pdbfile, DOCConverter*conv); - bool convertPDBtoTXT(TQString pdbdir, TQString pdbfile, - TQString txtdir, TQString txtfile, DOCConverter*conv); - - - // The actual dialog widget (designer created) holding all controls - ConverterDlgBase*dlg; - // Settings - bool askOverwrite; - bool verbose; -}; - -#endif // CONVERTERDLG_H diff --git a/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui b/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui deleted file mode 100644 index 8b3e89668..000000000 --- a/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui +++ /dev/null @@ -1,435 +0,0 @@ - -ConverterDlgBase - - - ConverterDlgBase - - - - 0 - 0 - 492 - 339 - - - - - unnamed - - - - tabWidget - - - - tab - - - General - - - - unnamed - - - - fPdbLabel - - - - 4 - 5 - 0 - 0 - - - - &PalmDOC file: - - - fPDBDir - - - - - fTextLabel - - - - 4 - 5 - 0 - 0 - - - - &Text file: - - - fTXTDir - - - - - fDirectories - - - Convert whole &folders - - - - - fPDBDir - - - Folder where copies of the handheld databases are kept. You can install them to any PalmOS handheld, and distribute these copies to other people (but beware of copyright infringement). - - - - - fAskOverwrite - - - &Ask before overwriting files - - - - - fVerbose - - - &Verbose messages - - - - - fTextToPDB - - - Convert Text to PalmDOC - - - - - fPDBToText - - - Convert PalmDOC to Text - - - - - spacer5 - - - Vertical - - - Expanding - - - - 20 - 16 - - - - - - fTXTDir - - - Enter the name of the folder where the text files reside on the PC. All files with extension .txt will be synced to the handheld. - - - - - fEncoding - - - - - textLabel1 - - - &Encoding: - - - fEncoding - - - - - - - tab - - - PC -> Handheld - - - - unnamed - - - - spacer6 - - - Horizontal - - - Fixed - - - - 20 - 16 - - - - - - spacer7 - - - Horizontal - - - Fixed - - - - 20 - 16 - - - - - - spacer8 - - - Horizontal - - - Fixed - - - - 20 - 16 - - - - - - fBookmarksInline - - - &Inline tags in text - - - true - - - When a <* bookmarktext *> appears somewhere in the text, a bookmark will be set at this position, and the text between the <* and the *> will be used as bookmark name. The <*...*> will be removed from the text. - - - - - fBookmarksEndtags - - - &Tags at end of text - - - Tags of the form <bookmarkname> at the end of the text will be used to search the text for the pattern between the < and >. Whenever "bookmarkname" appears in the text, a bookmark will be set there. The endtags <...> will then be removed from the end of the text. - - - - - fCompress - - - &Compress - - - true - - - Check this box, if the text should be compressed on the handheld to save memory. Most doc reader on the handheld support compressed texts. - - - The Palm doc format supports compressing the text to save memory. If you check this box, the text will consume about 50% less memory than in uncompressed state. Almost all DOC readers on the Palm support compressed texts. - - - - - fConvertBookmarks - - - Convert &bookmarks - - - true - - - Do you want to convert bookmarks? Most doc readers support bookmarks. You have to provide some information about where the bookmarks should be set and their titles. Check at least one of the bookmark types below. - - - - - fBookmarksBmk - - - Regular &expressions in .bmk file - - - Use regular expressions in a file textname.bmk (textname.txt is the filename of the text) to search the text for bookmarks.See the documentation for a description of the format of the bmk file. - - - - - spacer9 - - - Vertical - - - Expanding - - - - 21 - 200 - - - - - - - - tab - - - Handheld -> PC - - - - unnamed - - - - spacer10 - - - Vertical - - - Expanding - - - - 21 - 190 - - - - - - fPCBookmarks - - - Convert Bookmarks - - - - unnamed - - - - radioButton9 - - - false - - - Convert as &inline tags - - - 1 - - - - - radioButton8 - - - false - - - Do &not convert bookmarks - - - 0 - - - - - radioButton10 - - - false - - - Convert as &end tags - - - - - radioButton11 - - - Convert into .bmk &file - - - true - - - - - - - - - - - - - - fConvertBookmarks - toggled(bool) - fBookmarksInline - setEnabled(bool) - - - fConvertBookmarks - toggled(bool) - fBookmarksEndtags - setEnabled(bool) - - - fConvertBookmarks - toggled(bool) - fBookmarksBmk - setEnabled(bool) - - - - - kurlrequester.h - klineedit.h - kpushbutton.h - - diff --git a/kpilot/conduits/docconduit/makedoc9.cc b/kpilot/conduits/docconduit/makedoc9.cc deleted file mode 100644 index 1f1c56ff1..000000000 --- a/kpilot/conduits/docconduit/makedoc9.cc +++ /dev/null @@ -1,405 +0,0 @@ -// based on: MakeDoc, version 2 -// I only took the tBuf class from there and adapted it. -// -// Compresses text files into a format that is ready to export to a Pilot -// and work with Rick Bram's PilotDOC reader. -// Copyright (C) Reinhold Kainhofer, 2002 -// Copyrigth (C) Pat Beirne, 2000 -// -// Original file (makedoc9.cpp) copyright by: -// Copyright (C) Pat Beirne, 2000. -// Distributable under the GNU General Public License Version 2 or later. -// -// ver 0.6 enforce 31 char limit on database names -// ver 0.7 change header and record0 to structs -// ver 2.0 added category control on the command line -// changed extensions from .prc to .pdb - -/* -** 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. -*/ - - -#include -#include -#include - -#include - - -#include "makedoc9.h" - - - -// -// Issue() -// -// action: handle the details of writing a single -// character to the compressed stream -// -unsigned - tBuf::Issue(byte src, int &bSpace) -{ - unsigned int iDest = len; - byte *dest = buf; - - // TODO: which of the if parts should really be included??? -#if 0 - // modified version of issue - // just issue the char - if (src >= 0x80 || src <= 8) - dest[iDest++] = 1; - dest[iDest++] = src; - -#else - // if there is an outstanding space char, see if - // we can squeeze it in with an ASCII char - if (bSpace) - { - if (src >= 0x40 && src <= 0x7F) - dest[iDest++] = src ^ 0x80; - else - { - // couldn't squeeze it in, so issue the space char by itself - // most chars go out simple, except the range 1...8,0x80...0xFF - dest[iDest++] = ' '; - if (src < 0x80 && (src == 0 || src > 8)) - dest[iDest++] = src; - else - dest[iDest++] = 1, dest[iDest++] = src; - } - // knock down the space flag - bSpace = 0; - } - else - { - // check for a space char - if (src == ' ') - bSpace = 1; - else - { - if (src < 0x80 && (src == 0 || src > 8)) - dest[iDest++] = src; - else - dest[iDest++] = 1, dest[iDest++] = src; - - } - } -#endif - len = iDest; - return iDest; -} - -// -// Compress -// -// params: none -// -// action: takes the given buffer, -// and compresses -// the original data down into a second buffer -// -// comment: This version make heavy use of walking pointers. -// -unsigned tBuf::Compress() -{ - if (!buf) - return 0; - if (isCompressed) { -// cout<<"Buffer is already compressed!"< (1 << COUNT_BITS) + 2 - || pTestTail == pEnd) - { - // issue the codes - // first, check for short runs - if (pTestTail - pTestHead < 4) - { - if (pTestHead[0] > 0x7F || pTestHead[0] <= 8) - buf[len++] = 1; - buf[len++] = pTestHead[0]; - pTestHead++; - } - // for longer runs, issue a run-code - else - { - unsigned int dist = pTestHead - pPrevHit; - unsigned int compound = - (dist << COUNT_BITS) + pTestTail - pTestHead - 4; - -//if (dist>=(1<7) printf("\n!! error len overflow"); - - buf[len++] = 0x80 + (compound >> 8); - buf[len++] = compound & 0xFF; -//printf("\nissuing code for sequence len %d <%c%c%c>",pTestTail-pTestHead-1,pTestHead[0],pTestHead[1],pTestHead[2]); -//printf("\n <%x%x>",pOut[-2],pOut[-1]); - // and start again - pTestHead = pTestTail - 1; - } - // start the search again - pPrevHit = pBuffer; - // within range - if (pTestHead - pPrevHit > ((1 << DISP_BITS) - 1)) - pPrevHit = pTestHead - ((1 << DISP_BITS) - 1); - } - // got a match - else - { - pPrevHit = pHit; - } - // when we get to the end of the buffer, don't inc past the end - // this forces the residue chars out one at a time - if (pTestTail == pEnd) - pTestTail--; - } - - - // final scan to merge consecutive high chars together - // and merge space chars - unsigned int k; - - for (i = k = 0; i < len; i++, k++) - { - buf[k] = buf[i]; - // skip the run-length codes - if (buf[k] >= 0x80 && buf[k] < 0xC0) - buf[++k] = buf[++i]; - // if we hit a high char marker, look ahead for another - // and merge multiples together - else if (buf[k] == 1) - { - buf[k + 1] = buf[i + 1]; - while (i + 2 < len && buf[i + 2] == 1 && buf[k] < 8) - { - buf[k]++; - buf[k + buf[k]] = buf[i + 3]; - i += 2; - } - k += buf[k]; - i++; - } - else if (buf[k] == ' ' && i < len - 1 && buf[i + 1] <= 0x7F - && buf[i + 1] >= 0x40) - buf[k] = 0x80 | buf[++i]; - } - - // delete original buffer - delete[]pBuffer; - len = k; - - isCompressed = true; - return k; -} - -/* - Decompress - - params: none - - action: make a new buffer - run through the source data - check the 4 cases: - 0,9...7F represent self - 1...8 escape n chars - 80...bf reference earlier run - c0...ff space+ASCII - -*/ -unsigned tBuf::Decompress() -{ - if (!buf) - return 0; - if (!isCompressed) { -// cout<<"Buffer already uncompressed. Doing nothing"< 0 && c < 9) - while (c--) - out_buf[i++] = in_buf[j++]; - - // codes 0, 9...0x7F represent themselves - else if (c < 0x80) - out_buf[i++] = c; - - // codes 0xC0...0xFF represent "space + ascii char" - else if (c >= 0xC0) - out_buf[i++] = ' ', out_buf[i++] = c ^ 0x80; - - // codes 0x80...0xBf represent sequences - else - { - int m, n; - - c <<= 8; - c += in_buf[j++]; - m = (c & 0x3FFF) >> COUNT_BITS; - n = c & ((1 << COUNT_BITS) - 1); - n += 3; - while (n--) - { - out_buf[i] = out_buf[i - m]; - i++; - } - } - } - out_buf[i++]='\0'; - out_buf[i++]='\0'; - delete[]buf; - buf = pOut; - len = i; - - isCompressed = false; - return i; -} - -unsigned tBuf::DuplicateCR() -{ - if (!buf) - return 0; - byte *pBuf = new byte[2 * len]; - - unsigned int k, j; - - for (j = k = 0; j < len; j++, k++) - { - pBuf[k] = buf[j]; - if (pBuf[k] == 0x0A) - pBuf[k++] = 0x0D, pBuf[k] = 0x0A; - } - delete[]buf; - buf = pBuf; - len = k; - return k; -} - - - -// this nasty little beast removes really low ASCII and 0's -// and handles the CR problem -// -// if a cr appears before a lf, then remove the cr -// if a cr appears in isolation, change to a lf -unsigned tBuf::RemoveBinary() -{ - if (!buf) - return 0; - byte *in_buf = buf; - byte *out_buf = new byte[len]; - - unsigned int k, j; - - for (j = k = 0; j < len; j++, k++) - { - // copy each byte - out_buf[k] = in_buf[j]; - - // throw away really low ASCII - if (( /*out_buf[k]>=0 && */ out_buf[k] < 9)) - k--; - - // for CR - if (out_buf[k] == 0x0D) - { - // if next is LF, then drop it - if (j < len - 1 && in_buf[j + 1] == 0x0A) - k--; - else // turn it into a LF - out_buf[k] = 0x0A; - } - } - delete[]buf; - buf = out_buf; - len = k; - return k; -} - -void tBuf::setText(const byte * text, unsigned txtlen, bool txtcomp) -{ - if (buf) - delete[]buf; - buf = 0L; - - if (txtlen <= 0) - txtlen = strlen((const char *) text); - len = txtlen; - buf = new byte[len]; - - memcpy(buf, text, len*sizeof(char)); -// strncpy((char *) buf, (const char *) text, len); - isCompressed = txtcomp; -// cout<<"Setting text, compressed="< - -typedef unsigned char byte; -typedef unsigned long DWORD; -typedef unsigned short WORD; - -#define DISP_BITS 11 -#define COUNT_BITS 3 - - - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////// ////////////////////// -///////////////////// tBuf class ////////////////////// -///////////////////// ////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -class tBuf { - private: -// byte hichar[10]; -// int hicharnum; -// bool space; - - byte * buf; - unsigned len; - bool isCompressed; - public: - tBuf() { - buf = 0L; - len=0; - isCompressed=false; - }; - - ~tBuf() - { - if (buf) - delete[]buf; - } - - void Clear() { - delete[]buf; - buf = 0L; - } - void setText(const byte * text, unsigned int txtlen = - 0, bool txtcomp = false); - byte *text() const { - return buf; - } - unsigned Len() const { - return len; - } - void setCompressed(bool compressed = true) { - isCompressed = compressed; - } - bool compressed() const { - return isCompressed; - } - unsigned RemoveBinary(); - unsigned DuplicateCR(); - - unsigned Decompress(); - unsigned Compress(); - - private: - unsigned Issue(byte src, int &bSpace); - void Dump() const { - printf("\nbuffer len=%d", len); -}}; - - -#endif diff --git a/kpilot/conduits/docconduit/pilotDOCBookmark.cc b/kpilot/conduits/docconduit/pilotDOCBookmark.cc deleted file mode 100644 index 9b93f2af1..000000000 --- a/kpilot/conduits/docconduit/pilotDOCBookmark.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** This is a C++ class for the DOC bookmark record structure -*/ - -/* -** 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 "pilotDOCBookmark.h" - - - -PilotDOCBookmark::PilotDOCBookmark():PilotRecordBase(), pos(0) -{ - FUNCTIONSETUP; - memset(&bookmarkName[0], 0, 16); -} - - - -/* initialize the entry from another one. If rec==NULL, this constructor does the same as PilotDOCBookmark() -*/ -PilotDOCBookmark::PilotDOCBookmark(PilotRecord * rec):PilotRecordBase(rec) -{ - if (rec) - { - const pi_buffer_t *b = rec->buffer(); - unsigned int offset = 0; - Pilot::dlp::read(b,offset,bookmarkName,16); - bookmarkName[16]='\0'; - pos = Pilot::dlp::read(b,offset); - } -} - - - -PilotDOCBookmark::PilotDOCBookmark(const PilotDOCBookmark & e):PilotRecordBase(e) -{ - FUNCTIONSETUP; - *this = e; -} - - - -PilotDOCBookmark & PilotDOCBookmark::operator =(const PilotDOCBookmark & e) -{ - if (this != &e) - { - strncpy(&bookmarkName[0], &e.bookmarkName[0], 16); - bookmarkName[16]='\0'; - pos = e.pos; - } - return *this; -} - - - -PilotRecord *PilotDOCBookmark::pack() const -{ - pi_buffer_t *b = pi_buffer_new( 16 + Pilot::dlp::size ); - pi_buffer_append(b, bookmarkName, 16); - b->data[16] = 0; - Pilot::dlp::append(b,pos); - PilotRecord* rec = new PilotRecord(b, this); - return rec; -} diff --git a/kpilot/conduits/docconduit/pilotDOCBookmark.h b/kpilot/conduits/docconduit/pilotDOCBookmark.h deleted file mode 100644 index fe511fc17..000000000 --- a/kpilot/conduits/docconduit/pilotDOCBookmark.h +++ /dev/null @@ -1,51 +0,0 @@ -/* pilotDOCBookmark.h -*- C++ -*- KPilot -** -** Copyright (C) 2003 by Reinhold Kainhofer -** -** See the .cc file for an explanation of what this file is for. -*/ - -/* -** 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 -*/ -#ifndef _KPILOT_PILOTDOCBOOKMARK_H -#define _KPILOT_PILOTDOCBOOKMARK_H - -#include -class PilotRecord; - - -class PilotDOCBookmark:public PilotRecordBase { -public: - PilotDOCBookmark(); - PilotDOCBookmark(PilotRecord * rec); - PilotDOCBookmark(const PilotDOCBookmark & e); - ~PilotDOCBookmark() {}; - PilotDOCBookmark & operator=(const PilotDOCBookmark & e); - - PilotRecord *pack() const; - -public: - char bookmarkName[17]; - long int pos; -}; - - -#endif diff --git a/kpilot/conduits/docconduit/pilotDOCEntry.cc b/kpilot/conduits/docconduit/pilotDOCEntry.cc deleted file mode 100644 index 75a51cefa..000000000 --- a/kpilot/conduits/docconduit/pilotDOCEntry.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** This is a C++ class dealing with PalmDOC text records -*/ - -/* -** 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 "pilotDOCEntry.h" - - - -const int PilotDOCEntry::TEXT_SIZE = 4096; - - -PilotDOCEntry::PilotDOCEntry():PilotRecordBase() -{ - FUNCTIONSETUP; - compress = false; -} - - - -/* initialize the entry from another one. If rec==NULL, this constructor does the same as PilotDOCEntry() -*/ -PilotDOCEntry::PilotDOCEntry(PilotRecord * rec, bool compressed):PilotRecordBase(rec) -{ - if (rec) fText.setText((unsigned char *) rec->data(), rec->size(), compressed); - compress = compressed; -} - - - -PilotDOCEntry::PilotDOCEntry(const PilotDOCEntry & e):PilotRecordBase(e) -{ - FUNCTIONSETUP; - // See PilotDateEntry::operator = for details - fText.setText(e.fText.text(), e.fText.Len(), e.fText.compressed()); - compress = e.compress; -} - - - -PilotDOCEntry & PilotDOCEntry::operator =(const PilotDOCEntry & e) -{ - if (this != &e) - { - fText.setText(e.fText.text(), e.fText.Len(), e.fText.compressed()); - compress = e.compress; - } - return *this; -} - - - - -PilotRecord *PilotDOCEntry::pack() -{ - int len = compress ? fText.Compress() : fText.Decompress(); - - if (len<0) - { - return 0L; - } - - pi_buffer_t *b = pi_buffer_new( len + 4 ); // +4 for safety - memcpy( b->data, (const char *) fText.text(), len ); - b->used = len; - PilotRecord* rec = new PilotRecord(b, this); - return rec; -} diff --git a/kpilot/conduits/docconduit/pilotDOCEntry.h b/kpilot/conduits/docconduit/pilotDOCEntry.h deleted file mode 100644 index 4ecaf19a9..000000000 --- a/kpilot/conduits/docconduit/pilotDOCEntry.h +++ /dev/null @@ -1,73 +0,0 @@ -/* pilotDOCEntry.h -*- C++ -*- KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** See the .cc file for an explanation of what this file is for. -*/ - -/* -** 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 the mailinlist kde-pim@kde.org -*/ -#ifndef _KPILOT_PILOTDOCENTRY_H -#define _KPILOT_PILOTDOCENTRY_H - -#include -#include "makedoc9.h" - - -class PilotRecord; - - -class PilotDOCEntry:public PilotRecordBase { -private: - bool compress; - tBuf fText; -public: - static const int TEXT_SIZE; - PilotDOCEntry(); - PilotDOCEntry(PilotRecord * rec, bool compressed = false); - PilotDOCEntry(const PilotDOCEntry & e); - ~PilotDOCEntry() {}; - PilotDOCEntry & operator=(const PilotDOCEntry & e); - - - TQString getText() { - fText.Decompress(); - return TQString::fromLatin1((const char *) fText.text()); - }; - void setText(TQString newtext, bool compressed = false) { - fText.setText((const unsigned char *) newtext.latin1(), - newtext.length(), compressed); - }; - - bool getCompress() const { - return compress; - } - void setCompress(bool compressed) { - compress = compressed; - }; - - PilotRecord *pack(); // Not const because it can change the compression -}; - - - -#endif - diff --git a/kpilot/conduits/docconduit/pilotDOCHead.cc b/kpilot/conduits/docconduit/pilotDOCHead.cc deleted file mode 100644 index 1f07e2867..000000000 --- a/kpilot/conduits/docconduit/pilotDOCHead.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** This is a C++ class dealing with PalmDOC text records -*/ - -/* -** 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 "pilotDOCHead.h" - -#include "makedoc9.h" - - - -const int PilotDOCHead::textRecordSize = 4096; - -PilotDOCHead::PilotDOCHead():PilotRecordBase(), -version(0), -spare(0), storyLen(0), numRecords(0), recordSize(textRecordSize), position(0) -{ - FUNCTIONSETUP; -} - - - -/* initialize the entry from another one. If rec==NULL, this constructor does the same as PilotDOCHead() -*/ -PilotDOCHead::PilotDOCHead(PilotRecord * rec):PilotRecordBase(rec) -{ - const unsigned char *b = (const unsigned char *) rec->data(); - unsigned int offset = 0; - - version = Pilot::dlp::read(b,offset); - spare = Pilot::dlp::read(b,offset); - storyLen = Pilot::dlp::read(b,offset); - numRecords = Pilot::dlp::read(b,offset); - recordSize = Pilot::dlp::read(b,offset); - position = Pilot::dlp::read(b,offset); -} - - -PilotDOCHead::PilotDOCHead(const PilotDOCHead & e):PilotRecordBase(e) -{ - FUNCTIONSETUP; - *this = e; -} - - - -PilotDOCHead & PilotDOCHead::operator =(const PilotDOCHead & e) -{ - if (this != &e) - { - version = e.version; - spare = e.spare; - storyLen = e.storyLen; - numRecords = e.numRecords; - recordSize = e.recordSize; - position = e.position; - } - return *this; -} - - - - -PilotRecord *PilotDOCHead::pack() const -{ - pi_buffer_t *b = pi_buffer_new(16); - - Pilot::dlp::append(b,version); - Pilot::dlp::append(b,spare); - Pilot::dlp::append(b,storyLen); - Pilot::dlp::append(b,numRecords); - Pilot::dlp::append(b,recordSize); - Pilot::dlp::append(b,position); - - PilotRecord *rec = new PilotRecord(b, this); - return rec; -} - diff --git a/kpilot/conduits/docconduit/pilotDOCHead.h b/kpilot/conduits/docconduit/pilotDOCHead.h deleted file mode 100644 index aeb7fb526..000000000 --- a/kpilot/conduits/docconduit/pilotDOCHead.h +++ /dev/null @@ -1,62 +0,0 @@ -/* pilotDOCHead.h -*- C++ -*- KPilot -** -** Copyright (C) 2002 by Reinhold Kainhofer -** -** See the .cc file for an explanation of what this file is for. -*/ - -/* -** 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 the mailinlist kde-pim@kde.org -*/ -#ifndef _KPILOT_PILOTDOCHEAD_H -#define _KPILOT_PILOTDOCHEAD_H - -#include - -class PilotRecord; - - -class PilotDOCHead:public PilotRecordBase { - private: - static const int textRecordSize; - - public: - int version; - int spare; - long int storyLen; - int numRecords; - int recordSize; - long int position; - - PilotRecord *pack() const; - - public: - PilotDOCHead(); - PilotDOCHead(PilotRecord * rec); - PilotDOCHead(const PilotDOCHead & e); - ~PilotDOCHead() { } - - PilotDOCHead & operator=(const PilotDOCHead & e); -}; - - - -#endif - diff --git a/kpilot/conduits/docconduit/tests/testcompress.cpp b/kpilot/conduits/docconduit/tests/testcompress.cpp deleted file mode 100644 index b8367b2b9..000000000 --- a/kpilot/conduits/docconduit/tests/testcompress.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* -** Copyright (C) 2003 by Reinhold Kainhofer -** -** This is just a very simple programm to check the compress/uncompress -** routines by taking one string, compress and then decompress it and -** see if it is the original string. -*/ - -/* -** 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 -#include - - -#include "../makedoc9.h" - -void main () -{ - tBuf fText; - char*text="asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf"; - - fText.setText((const byte*)text); - cout<<"Decompressed text: "<