summaryrefslogtreecommitdiff
path: root/recipes/portabase
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/portabase')
-rw-r--r--recipes/portabase/metakit-2.4.9.3/metakit-2.4.9.3.patch108
-rw-r--r--recipes/portabase/metakit_2.4.9.3.bb65
-rw-r--r--recipes/portabase/portabase-1.9/fileselector.patch128
-rw-r--r--recipes/portabase/portabase-1.9/qt2310-fontbug.patch11
-rw-r--r--recipes/portabase/portabase-1.9/qtopia.patch70
-rw-r--r--recipes/portabase/portabase-1.9/qtversion.patch101
-rw-r--r--recipes/portabase/portabase_1.9.bb129
7 files changed, 612 insertions, 0 deletions
diff --git a/recipes/portabase/metakit-2.4.9.3/metakit-2.4.9.3.patch b/recipes/portabase/metakit-2.4.9.3/metakit-2.4.9.3.patch
new file mode 100644
index 0000000000..35babe28b4
--- /dev/null
+++ b/recipes/portabase/metakit-2.4.9.3/metakit-2.4.9.3.patch
@@ -0,0 +1,108 @@
+diff -Naur metakit-2.4.9.3/include/mk4.h metakit-2.4.9.3-patched/include/mk4.h
+--- metakit-2.4.9.3/include/mk4.h 2004-01-26 04:54:45.000000000 -0500
++++ metakit-2.4.9.3-patched/include/mk4.h 2004-02-28 21:07:34.000000000 -0500
+@@ -217,6 +217,9 @@
+ bool operator< (const t4_i64 a_, const t4_i64 b_);
+ #endif
+
++typedef int ((*StringCompareFunc)(const char*, const char*));
++typedef int ((*Win32FileOpenFunc)(const char*, int));
++
+ //---------------------------------------------------------------------------
+
+ class c4_View
+@@ -330,6 +333,7 @@
+ friend bool operator> (const c4_View&, const c4_View&);
+ friend bool operator<= (const c4_View&, const c4_View&);
+ friend bool operator>= (const c4_View&, const c4_View&);
++ static StringCompareFunc stringCompareFunc;
+
+ protected:
+ void _IncSeqRef();
+@@ -554,6 +558,8 @@
+ bool LoadFrom(c4_Stream&);
+ void SaveTo(c4_Stream&);
+
++ static Win32FileOpenFunc win32FileOpenFunc;
++
+ //DROPPED: c4_Storage (const char* filename_, const char* description_);
+ //DROPPED: c4_View Store(const char* name_, const c4_View& view_);
+ //DROPPED: c4_HandlerSeq& RootTable() const;
+diff -Naur metakit-2.4.9.3/src/fileio.cpp metakit-2.4.9.3-patched/src/fileio.cpp
+--- metakit-2.4.9.3/src/fileio.cpp 2003-11-22 20:42:51.000000000 -0500
++++ metakit-2.4.9.3-patched/src/fileio.cpp 2004-02-28 21:07:34.000000000 -0500
+@@ -321,7 +321,7 @@
+
+ #if q4_WIN32 && !q4_BORC && !q4_WINCE
+ int flags = _O_BINARY | _O_NOINHERIT | (mode_ > 0 ? _O_RDWR : _O_RDONLY);
+- int fd = _open(fname_, flags);
++ int fd = (*c4_Storage::win32FileOpenFunc)(fname_, flags);
+ if (fd != -1)
+ _cleanup = _file = _fdopen(fd, mode_ > 0 ? "r+b" : "rb");
+ #else
+@@ -339,7 +339,8 @@
+
+ if (mode_ > 0) {
+ #if q4_WIN32 && !q4_BORC && !q4_WINCE
+- fd = _open(fname_, flags | _O_CREAT, _S_IREAD | _S_IWRITE);
++ flags = flags | _O_CREAT, _S_IREAD | _S_IWRITE;
++ fd = (*c4_Storage::win32FileOpenFunc)(fname_, flags);
+ if (fd != -1)
+ _cleanup = _file = _fdopen(fd, "w+b");
+ #else
+diff -Naur metakit-2.4.9.3/src/format.cpp metakit-2.4.9.3-patched/src/format.cpp
+--- metakit-2.4.9.3/src/format.cpp 2004-01-19 17:49:43.000000000 -0500
++++ metakit-2.4.9.3-patched/src/format.cpp 2004-02-28 21:07:35.000000000 -0500
+@@ -923,7 +923,7 @@
+ c4_String v1 ((const char*) b1_.Contents(), b1_.Size());
+ c4_String v2 ((const char*) b2_.Contents(), b2_.Size());
+
+- return v1.CompareNoCase(v2);
++ return (*c4_View::stringCompareFunc)(v1, v2);
+ }
+
+ void c4_FormatS::Insert(int index_, const c4_Bytes& buf_, int count_)
+diff -Naur metakit-2.4.9.3/src/store.cpp metakit-2.4.9.3-patched/src/store.cpp
+--- metakit-2.4.9.3/src/store.cpp 2003-11-22 20:42:51.000000000 -0500
++++ metakit-2.4.9.3-patched/src/store.cpp 2004-02-28 21:09:26.000000000 -0500
+@@ -18,6 +18,10 @@
+ #if !q4_INLINE
+ #include "store.inl"
+ #endif
++
++#if q4_WIN32
++#include <io.h>
++#endif
+
+ /////////////////////////////////////////////////////////////////////////////
+
+@@ -426,6 +430,17 @@
+ c4_Persist::Save(&stream_, Persist()->Root());
+ }
+
++int f4_Latin1OpenFunc(const char *fname_, int mode_)
++{
++#if q4_WIN32
++ return _open(fname_, mode_);
++#else
++ return -1;
++#endif
++}
++
++Win32FileOpenFunc c4_Storage::win32FileOpenFunc = f4_Latin1OpenFunc;
++
+ /////////////////////////////////////////////////////////////////////////////
+
+ c4_DerivedSeq::c4_DerivedSeq (c4_Sequence& seq_)
+diff -Naur metakit-2.4.9.3/src/view.cpp metakit-2.4.9.3-patched/src/view.cpp
+--- metakit-2.4.9.3/src/view.cpp 2003-11-22 20:42:51.000000000 -0500
++++ metakit-2.4.9.3-patched/src/view.cpp 2004-02-28 21:07:35.000000000 -0500
+@@ -1005,6 +1005,8 @@
+ return na == nb ? 0 : i < na ? +1 : -1;
+ }
+
++StringCompareFunc c4_View::stringCompareFunc = strcmp;
++
+ /////////////////////////////////////////////////////////////////////////////
+
+ /** @class c4_Cursor
diff --git a/recipes/portabase/metakit_2.4.9.3.bb b/recipes/portabase/metakit_2.4.9.3.bb
new file mode 100644
index 0000000000..404dfcfe1e
--- /dev/null
+++ b/recipes/portabase/metakit_2.4.9.3.bb
@@ -0,0 +1,65 @@
+SECTION = "libs"
+DESCRIPTION = "Metakit is an efficient embedded database library with a small \
+footprint. It fills the gap between flat-file, relational, object-oriented, and \
+tree-structured databases, supporting relational joins, serialization, nested structures,\
+and instant schema evolution."
+LICENSE = "MetaKit"
+HOMEPAGE = "http://www.equi4.com/metakit.html"
+
+SRC_URI = "http://www.equi4.com/pub/mk/metakit-${PV}.tar.gz \
+ file://metakit-2.4.9.3.patch;patch=1"
+PR = "r3"
+
+FILES_${PN} += " ${libdir}/*.so"
+
+do_configure_prepend() {
+
+# cp ${STAGING_DATADIR}/libtool/*.* ${S}/unix/scripts/
+
+}
+
+do_configure () {
+
+ cd builds
+ ../unix/configure \
+ --build=${BUILD_SYS} \
+ --host=${HOST_SYS} \
+ --target=${TARGET_SYS} \
+ --prefix=${prefix} \
+ --exec_prefix=${exec_prefix} \
+ --bindir=${bindir} \
+ --sbindir=${sbindir} \
+ --libexecdir=${libexecdir} \
+ --datadir=${datadir} \
+ --sysconfdir=${sysconfdir} \
+ --sharedstatedir=${sharedstatedir} \
+ --localstatedir=${localstatedir} \
+ --libdir=${libdir} \
+ --includedir=${includedir} \
+ --oldincludedir=${oldincludedir} \
+ --infodir=${infodir} \
+ --mandir=${mandir} \
+ ${EXTRA_OECONF} \
+ $@;
+
+}
+
+do_stage() {
+ oe_libinstall -a -so -C builds/.libs libmk4 ${STAGING_LIBDIR}
+ install -d ${STAGING_INCDIR}/
+ for X in mk4.h mk4.inl
+ do
+ install -m 0644 include/${X} ${STAGING_INCDIR}/${X}
+ done
+
+}
+
+do_compile () {
+ cd builds
+ oe_runmake
+}
+
+do_install() {
+ oe_libinstall -so -C builds/.libs libmk4 ${D}${libdir}
+}
+
diff --git a/recipes/portabase/portabase-1.9/fileselector.patch b/recipes/portabase/portabase-1.9/fileselector.patch
new file mode 100644
index 0000000000..7f70c347e5
--- /dev/null
+++ b/recipes/portabase/portabase-1.9/fileselector.patch
@@ -0,0 +1,128 @@
+diff -urN portabase.orig/fileselector.cpp portabase/fileselector.cpp
+--- portabase.orig/fileselector.cpp 2004-09-02 20:06:38.000000000 +0200
++++ portabase/fileselector.cpp 2004-09-02 20:59:22.000000000 +0200
+@@ -43,8 +43,8 @@
+
+ bool PBFileSelector::duplicate()
+ {
+- const DocLnk *selection = selected();
+- if (selection == 0) {
++ DocLnk selection(selectedDocument());
++ if (!selection.isValid()) {
+ return FALSE;
+ }
+ bool ok;
+@@ -56,7 +56,7 @@
+ DocLnk copy;
+ configureDocLnk(copy, name);
+ FileManager fm;
+- ok = fm.copyFile(*selection, copy);
++ ok = fm.copyFile(selection, copy);
+ }
+ if (ok) {
+ reread();
+@@ -65,14 +65,13 @@
+ QMessageBox::warning(this, QQDialog::tr("PortaBase"),
+ tr("Unable to create new file"));
+ }
+- delete selection;
+ return ok;
+ }
+
+ bool PBFileSelector::rename()
+ {
+- const DocLnk *selection = selected();
+- if (selection == 0) {
++ DocLnk selection(selectedDocument());
++ if (!selection.isValid()) {
+ return FALSE;
+ }
+ bool ok;
+@@ -88,9 +87,9 @@
+ configureDocLnk(copy, name);
+ // actual moving would be more efficient, but harder to implement...
+ FileManager fm;
+- if (fm.copyFile(*selection, copy)) {
+- QFile::remove(selection->file());
+- QFile::remove(selection->linkFile());
++ if (fm.copyFile(selection, copy)) {
++ QFile::remove(selection.file());
++ QFile::remove(selection.linkFile());
+ ok = TRUE;
+ }
+ else {
+@@ -104,7 +103,6 @@
+ QMessageBox::warning(this, QQDialog::tr("PortaBase"),
+ tr("Unable to rename the file"));
+ }
+- delete selection;
+ return ok;
+ }
+
+diff -urN portabase.orig/importdialog.cpp portabase/importdialog.cpp
+--- portabase.orig/importdialog.cpp 2004-09-02 20:06:38.000000000 +0200
++++ portabase/importdialog.cpp 2004-09-02 20:54:47.000000000 +0200
+@@ -130,14 +130,13 @@
+ int result = QDialog::exec();
+ if (result && !importDone) {
+ // "OK" was clicked...see if there is a selected file
+- const DocLnk *f = selector->selected();
+- if (!f) {
++ DocLnk f(selector->selectedDocument());
++ if (!f.isValid()) {
+ return QDialog::Rejected;
+ }
+- if (!import(f->file())) {
++ if (!import(f.file())) {
+ result = QDialog::Rejected;
+ }
+- delete f;
+ }
+ return result;
+ }
+diff -urN portabase.orig/portabase.cpp portabase/portabase.cpp
+--- portabase.orig/portabase.cpp 2004-09-02 20:06:38.000000000 +0200
++++ portabase/portabase.cpp 2004-09-02 20:56:58.000000000 +0200
+@@ -527,12 +527,11 @@
+
+ void PortaBase::openFile()
+ {
+- const DocLnk *selection = fileSelector->selected();
+- if (selection == 0) {
++ DocLnk selection (fileSelector->selectedDocument());
++ if (!selection.isValid()) {
+ return;
+ }
+- openFile(*selection);
+- delete selection;
++ openFile(selection);
+ }
+
+ void PortaBase::openFile(const QString &f)
+@@ -591,21 +590,19 @@
+
+ void PortaBase::deleteFile()
+ {
+- const DocLnk *selection = fileSelector->selected();
+- if (selection == 0) {
++ DocLnk selection(fileSelector->selectedDocument());
++ if (!selection.isValid()) {
+ return;
+ }
+ if (QMessageBox::warning(this, QQDialog::tr("PortaBase"), tr("Delete")
+- + " \"" + selection->name() + "\"\n"
++ + " \"" + selection.name() + "\"\n"
+ + tr("Are you sure?"),
+ QObject::tr("Yes"), QObject::tr("No"),
+ QString::null, 1) > 0) {
+- delete selection;
+ return;
+ }
+- QFile::remove(selection->file());
+- QFile::remove(selection->linkFile());
+- delete selection;
++ QFile::remove(selection.file());
++ QFile::remove(selection.linkFile());
+ fileSelector->reread();
+ }
+
diff --git a/recipes/portabase/portabase-1.9/qt2310-fontbug.patch b/recipes/portabase/portabase-1.9/qt2310-fontbug.patch
new file mode 100644
index 0000000000..3999ca35dc
--- /dev/null
+++ b/recipes/portabase/portabase-1.9/qt2310-fontbug.patch
@@ -0,0 +1,11 @@
+--- portabase/preferences.cpp.orig 2005-02-13 22:48:10 +0100
++++ portabase/preferences.cpp 2005-02-13 22:48:06 +0100
+@@ -154,7 +154,7 @@
+ {
+ QWidget *appearanceTab = new QWidget(tabs);
+ QVBoxLayout *layout = new QVBoxLayout(appearanceTab);
+-#if defined(Q_WS_QWS)
++#if defined(Q_WS_QWS) && QT_VERSION <= 239
+ sizeFactor = 10;
+ #else
+ sizeFactor = 1;
diff --git a/recipes/portabase/portabase-1.9/qtopia.patch b/recipes/portabase/portabase-1.9/qtopia.patch
new file mode 100644
index 0000000000..a3a80776db
--- /dev/null
+++ b/recipes/portabase/portabase-1.9/qtopia.patch
@@ -0,0 +1,70 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- portabase/portabase.pro~qtopia
++++ portabase/portabase.pro
+@@ -7,7 +7,7 @@
+ portabase_zh_TW.ts
+ # determine which version to compile for
+ # options are desktop, qtopia, or sharp (add "test" for the test environment)
+-CONFIG += desktop
++CONFIG += qtopia
+
+ # Files common between all versions
+ HEADERS = portabase.h \
+@@ -120,7 +120,7 @@
+ metakitfuncs.cpp
+
+ # Stuff for all Linux/UNIX versions
+-unix:LIBS += -lm -lmk4 -lbeecrypt -ljpeg
++unix:LIBS += -lm -lmk4 -lbeecrypt -ljpeg -lstdc++
+
+ # Stuff for older Zaurus ROMs
+ qtopia:CONFIG += zaurus
+@@ -155,44 +155,3 @@
+ dynamicedit.cpp \
+ inputdialog.cpp
+
+-# Stuff for the Qtopia test environment
+-test:TMAKE_CC = gcc-2.95
+-test:TMAKE_CXX = g++-2.95
+-
+-# Stuff for all desktop versions
+-desktop:CONFIG += thread
+-desktop:HEADERS += desktop/QtaDatePicker.h \
+- desktop/applnk.h \
+- desktop/config.h \
+- desktop/dynamicedit.h \
+- desktop/filemanager.h \
+- desktop/fileselector.h \
+- desktop/helpbrowser.h \
+- desktop/importdialog.h \
+- desktop/newfiledialog.h \
+- desktop/oldconfig.h \
+- desktop/qpeapplication.h \
+- desktop/resource.h \
+- desktop/timestring.h
+-desktop:SOURCES += desktop/QtaDatePicker.cpp \
+- desktop/applnk.cpp \
+- desktop/config.cpp \
+- desktop/dynamicedit.cpp \
+- desktop/filemanager.cpp \
+- desktop/fileselector.cpp \
+- desktop/helpbrowser.cpp \
+- desktop/importdialog.cpp \
+- desktop/newfiledialog.cpp \
+- desktop/oldconfig.cpp \
+- desktop/qpeapplication.cpp \
+- desktop/resource.cpp \
+- desktop/timestring.cpp
+-
+-# Stuff for Windows
+-win32:LIBS += mk4vc60s.lib beecrypt.lib libjpeg.lib
+-win32:DEFINES += QT_DLL
+-win32:RC_FILE = portabase.rc
+-win32:QMAKE_CXXFLAGS_RELEASE += /MD
+-win32:INCLUDEPATH += D:\Devel\metakit-2.4.9.3\include \
+- D:\Devel\jpeg-6b \
+- D:\Devel
diff --git a/recipes/portabase/portabase-1.9/qtversion.patch b/recipes/portabase/portabase-1.9/qtversion.patch
new file mode 100644
index 0000000000..e7e93d0544
--- /dev/null
+++ b/recipes/portabase/portabase-1.9/qtversion.patch
@@ -0,0 +1,101 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- /dev/null
++++ portabase/packages/portabase/portabase-1.9/qtversion.patch
+@@ -0,0 +1,49 @@
++
++#
++# Patch managed by http://www.holgerschurig.de/patcher.html
++#
++
++--- portabase/datewidget.cpp~qtversion.patch
+++++ portabase/datewidget.cpp
++@@ -21,7 +21,7 @@
++ #include "desktop/resource.h"
++ #endif
++
++-#if QT_VERSION >= 300
+++#if QT_VERSION >= 0x030000
++ #include "desktop/QtaDatePicker.h"
++ #else
++ #include "QtaDatePicker.h"
++--- portabase/metakitfuncs.cpp~qtversion.patch
+++++ portabase/metakitfuncs.cpp
++@@ -19,7 +19,7 @@
++
++ int compareStrings(const QString &s1, const QString &s2)
++ {
++-#if QT_VERSION >= 300
+++#if QT_VERSION >= 0x030000
++ return s1.localeAwareCompare(s2);
++ #else
++ // do the right thing for null and empty
++--- portabase/roweditor.cpp~qtversion.patch
+++++ portabase/roweditor.cpp
++@@ -26,7 +26,7 @@
++ #include "roweditor.h"
++ #include "timewidget.h"
++
++-#if QT_VERSION >= 300
+++#if QT_VERSION >= 0x030000
++ #include "desktop/dynamicedit.h"
++ #else
++ #include "dynamicedit.h"
++--- portabase/shadedlistitem.cpp~qtversion.patch
+++++ portabase/shadedlistitem.cpp
++@@ -45,7 +45,7 @@
++ void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
++ {
++ QColorGroup colors(cg);
++-#if QT_VERSION >=300
+++#if QT_VERSION >= 0x030000
++ const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
++ const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
++ #else
+--- portabase/datewidget.cpp~qtversion
++++ portabase/datewidget.cpp
+@@ -21,7 +21,7 @@
+ #include "desktop/resource.h"
+ #endif
+
+-#if QT_VERSION >= 300
++#if QT_VERSION >= 0x030000
+ #include "desktop/QtaDatePicker.h"
+ #else
+ #include "QtaDatePicker.h"
+--- portabase/roweditor.cpp~qtversion
++++ portabase/roweditor.cpp
+@@ -26,7 +26,7 @@
+ #include "roweditor.h"
+ #include "timewidget.h"
+
+-#if QT_VERSION >= 300
++#if QT_VERSION >= 0x030000
+ #include "desktop/dynamicedit.h"
+ #else
+ #include "dynamicedit.h"
+--- portabase/shadedlistitem.cpp~qtversion
++++ portabase/shadedlistitem.cpp
+@@ -45,7 +45,7 @@
+ void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
+ {
+ QColorGroup colors(cg);
+-#if QT_VERSION >=300
++#if QT_VERSION >= 0x030000
+ const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
+ const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
+ #else
+--- portabase/metakitfuncs.cpp~qtversion
++++ portabase/metakitfuncs.cpp
+@@ -19,7 +19,7 @@
+
+ int compareStrings(const QString &s1, const QString &s2)
+ {
+-#if QT_VERSION >= 300
++#if QT_VERSION >= 0x030000
+ return s1.localeAwareCompare(s2);
+ #else
+ // do the right thing for null and empty
diff --git a/recipes/portabase/portabase_1.9.bb b/recipes/portabase/portabase_1.9.bb
new file mode 100644
index 0000000000..e6eb9716ff
--- /dev/null
+++ b/recipes/portabase/portabase_1.9.bb
@@ -0,0 +1,129 @@
+DESCRIPTION = "Portabase is a small database program for creating, browsing, \
+and editing custom tables of data."
+SECTION = "opie/applications"
+LICENSE = "GPL"
+HOMEPAGE = "http://portabase.sourceforge.net/"
+DEPENDS = "metakit beecrypt"
+APPNAME = "portabase"
+PR = "r4"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/portabase/portabase_${PV}.tar.gz \
+ file://qtopia.patch;patch=1 \
+ file://fileselector.patch;patch=1 \
+ file://qtversion.patch;patch=1 \
+ file://qt2310-fontbug.patch;patch=1"
+
+S = "${WORKDIR}/portabase"
+
+inherit palmtop
+
+do_configure_prepend() {
+ find . -name "Makefile"|xargs rm -f
+}
+
+QMAKE_PROFILES = "portabase.pro"
+QPEDIR = "${OPIEDIR}"
+EXTRA_QMAKEVARS_POST += "CONFIG-=desktop"
+
+# lrelease portabase.pro
+
+do_install() {
+ install -d ${D}${palmtopdir}/bin \
+ ${D}${palmtopdir}/apps/Applications \
+ ${D}${palmtopdir}/pics/${APPNAME} \
+ ${D}${palmtopdir}/help/en
+ install -D -m 0755 ${APPNAME} ${D}${palmtopdir}/bin/${APPNAME}
+ install -m 0644 package/${APPNAME}.desktop ${D}${palmtopdir}/apps/Applications/${APPNAME}.desktop
+
+ install -D -m 0644 pics/PortaBase.png ${D}${palmtopdir}/pics/PortaBase.png
+ for f in calculator.png checked.png image.png note.png save.png save_disabled.png unchecked.png calendar.xpm QtaDatePickerNext.xpm QtaDatePickerPrev.xpm
+ do
+ install -D -m 0644 pics/$f ${D}${palmtopdir}/pics/${APPNAME}/$f
+ done
+
+ install -D -m 0644 help/html/${APPNAME}.html ${D}${palmtopdir}/help/en/html/${APPNAME}.html
+}
+
+
+pkg_postinst() {
+#!/bin/sh
+
+NEWTYPE=application/portabase
+EXT=pob
+
+T=${NEWTYPE%/*}
+S=${NEWTYPE#*/}
+
+grep $EXT $QPEDIR/etc/mime.types |
+(
+ read TYPE EXTS
+ if [ -z "$TYPE" ]
+ then
+ if grep -q "^$NEWTYPE[ ]" $QPEDIR/etc/mime.types || grep -q "^$NEWTYPE$" $QPEDIR/etc/mime.types
+ then
+ if sed -e '/^'$T"\\/"$S'[ ]/ s/$/ '$EXT'/' <$QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new ||
+ sed -e '/^'$T"\\/"$S'$/ s/$/ '$EXT'/' <$QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new
+ then
+ mv $QPEDIR/etc/mime.types.new $QPEDIR/etc/mime.types
+ exit 0
+ else
+ echo >&2 "Internal MIME type update error"
+ exit 1
+ fi
+ else
+ echo "" >>$QPEDIR/etc/mime.types
+ sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new
+ mv $QPEDIR/etc/mime.types.new $QPEDIR/etc/mime.types
+ echo "$NEWTYPE $EXT" >>$QPEDIR/etc/mime.types
+ exit 0
+ fi
+ elif [ "$TYPE" = "$NEWTYPE" ]
+ then
+ #echo "Already done"
+ exit 0
+ else
+ echo >&2 "$EXT already assigned to $TYPE"
+ exit 1
+ fi
+)
+
+NEWTYPE=text/x-csv
+EXT=csv
+
+T=${NEWTYPE%/*}
+S=${NEWTYPE#*/}
+
+grep $EXT $QPEDIR/etc/mime.types |
+(
+ read TYPE EXTS
+ if [ -z "$TYPE" ]
+ then
+ if grep -q "^$NEWTYPE[ ]" $QPEDIR/etc/mime.types || grep -q "^$NEWTYPE$" $QPEDIR/etc/mime.types
+ then
+ if sed -e '/^'$T"\\/"$S'[ ]/ s/$/ '$EXT'/' <$QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new ||
+ sed -e '/^'$T"\\/"$S'$/ s/$/ '$EXT'/' <$QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new
+ then
+ mv $QPEDIR/etc/mime.types.new $QPEDIR/etc/mime.types
+ exit 0
+ else
+ echo >&2 "Internal MIME type update error"
+ exit 1
+ fi
+ else
+ echo "" >>$QPEDIR/etc/mime.types
+ sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $QPEDIR/etc/mime.types >$QPEDIR/etc/mime.types.new
+ mv $QPEDIR/etc/mime.types.new $QPEDIR/etc/mime.types
+ echo "$NEWTYPE $EXT" >>$QPEDIR/etc/mime.types
+ exit 0
+ fi
+ elif [ "$TYPE" = "$NEWTYPE" ]
+ then
+ #echo "Already done"
+ exit 0
+ else
+ echo >&2 "$EXT already assigned to $TYPE"
+ exit 1
+ fi
+)
+}
+