summaryrefslogtreecommitdiffstats
path: root/tdefile-plugins/palm-databases
diff options
context:
space:
mode:
Diffstat (limited to 'tdefile-plugins/palm-databases')
-rw-r--r--tdefile-plugins/palm-databases/Makefile.am22
-rw-r--r--tdefile-plugins/palm-databases/tdefile_palm.cpp121
-rw-r--r--tdefile-plugins/palm-databases/tdefile_palm.desktop59
-rw-r--r--tdefile-plugins/palm-databases/tdefile_palm.h41
4 files changed, 243 insertions, 0 deletions
diff --git a/tdefile-plugins/palm-databases/Makefile.am b/tdefile-plugins/palm-databases/Makefile.am
new file mode 100644
index 000000000..552a2a4fe
--- /dev/null
+++ b/tdefile-plugins/palm-databases/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am for palm database meta info plugin
+
+# set the include path for X, qt and KDE
+INCLUDES = $(PISOCK_INCLUDE) $(all_includes)
+
+# these are the headers for your project
+noinst_HEADERS = tdefile_palm.h
+
+kde_module_LTLIBRARIES = tdefile_palm.la
+
+tdefile_palm_la_SOURCES = tdefile_palm.cpp
+tdefile_palm_la_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore
+tdefile_palm_la_LIBADD = $(LIB_KSYCOCA) $(PISOCK_LIB)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) tdefile_palm.cpp -o $(podir)/tdefile_palm.pot
+
+services_DATA = tdefile_palm.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdefile-plugins/palm-databases/tdefile_palm.cpp b/tdefile-plugins/palm-databases/tdefile_palm.cpp
new file mode 100644
index 000000000..3d4e20e93
--- /dev/null
+++ b/tdefile-plugins/palm-databases/tdefile_palm.cpp
@@ -0,0 +1,121 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
+ * Based on the vcf plugin:
+ * Copyright (C) 2002 Shane Wright <me@shanewright.co.uk>
+ *
+ * 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 version 2.
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "tdefile_palm.h"
+
+#include <klocale.h>
+#include <kgenericfactory.h>
+
+#include <tqfile.h>
+#include <tqdatetime.h>
+#include <pi-file.h>
+
+
+typedef KGenericFactory<KPalmPlugin> PalmFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_palm, PalmFactory( "tdefile_palm" ))
+
+KPalmPlugin::KPalmPlugin(TQObject *parent, const char *name,
+ const TQStringList &args)
+
+ : KFilePlugin(parent, name, args)
+{
+ KFileMimeTypeInfo* info = addMimeTypeInfo( "application/vnd.palm" );
+
+ KFileMimeTypeInfo::GroupInfo* group;
+ KFileMimeTypeInfo::ItemInfo* item;
+
+ group = addGroupInfo(info, "General", i18n("General Information"));
+ item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String);
+ item = addItemInfo(group, "DBType", i18n("DB Type"), TQVariant::String);
+ item = addItemInfo(group, "TypeID", i18n("Type ID"), TQVariant::String);
+ item = addItemInfo(group, "CreatorID", i18n("Creator ID"), TQVariant::String);
+ item = addItemInfo(group, "NrRecords", i18n("# of Records"), TQVariant::Int);
+
+ group = addGroupInfo(info, "TimeStamps", i18n("Time Stamps"));
+ item = addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::DateTime);
+ item = addItemInfo(group, "ModificationDate", i18n("Modification Date"), TQVariant::DateTime);
+ item = addItemInfo(group, "BackupDate", i18n("Backup Date"), TQVariant::DateTime);
+
+ group = addGroupInfo(info, "Flags", i18n("Flags"));
+ item = addItemInfo(group, "ReadOnly", i18n("Read-Only"), TQVariant::String);
+ item = addItemInfo(group, "MakeBackup", i18n("Make Backup"), TQVariant::String);
+ item = addItemInfo(group, "CopyProtected", i18n("Copy Protected"), TQVariant::String);
+ item = addItemInfo(group, "Reset", i18n("Reset Handheld After Installing"), TQVariant::String);
+ item = addItemInfo(group, "ExcludeFromSync", i18n("Exclude From Sync"), TQVariant::String);
+}
+
+
+bool KPalmPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ )
+{
+ int nrRec;
+ TQString tempName = info.path();
+ TQCString fileName = TQFile::encodeName(tempName);
+ pi_file *dbFile = pi_file_open(const_cast < char *>((const char *) fileName));
+ if (dbFile == 0L) return false;
+
+ struct DBInfo dBInfo;
+ pi_file_get_info( dbFile, &dBInfo );
+ pi_file_get_entries( dbFile, &nrRec );
+ pi_file_close(dbFile);
+
+ KFileMetaInfoGroup generalGroup = appendGroup(info, "General");
+ appendItem(generalGroup, "Name", dBInfo.name );
+ appendItem(generalGroup, "DBType", (dBInfo.flags & dlpDBFlagResource)?i18n("PalmOS Application"):i18n("PalmOS Record Database") );
+
+ char buff[5];
+ set_long(buff, dBInfo.type);
+ buff[4]='\0';
+ appendItem(generalGroup, "TypeID", buff );
+
+ set_long(buff, dBInfo.creator);
+ buff[4]='\0';
+ appendItem(generalGroup, "CreatorID", buff );
+ appendItem(generalGroup, "NrRecords", nrRec );
+
+
+ KFileMetaInfoGroup timeGroup = appendGroup(info, "TimeStamps");
+ TQDateTime tm;
+ tm.setTime_t( dBInfo.createDate );
+ appendItem(timeGroup, "CreationDate", tm);
+ tm.setTime_t( dBInfo.modifyDate );
+ appendItem(timeGroup, "ModificationDate", tm);
+ tm.setTime_t( dBInfo.backupDate );
+ appendItem(timeGroup, "BackupDate", tm);
+
+ KFileMetaInfoGroup flagGroup = appendGroup(info, "Flags");
+ appendItem(flagGroup, "ReadOnly", (dBInfo.flags & dlpDBFlagReadOnly)?i18n("Yes"):i18n("No") );
+ appendItem(flagGroup, "MakeBackup", (dBInfo.flags & dlpDBFlagBackup)?i18n("Yes"):i18n("No") );
+ appendItem(flagGroup, "CopyProtected", (dBInfo.flags & dlpDBFlagCopyPrevention)?i18n("Yes"):i18n("No") );
+ appendItem(flagGroup, "Reset", (dBInfo.flags & dlpDBFlagReset)?i18n("Yes"):i18n("No") );
+ appendItem(flagGroup, "ExcludeFromSync", (dBInfo.miscFlags & dlpDBMiscFlagExcludeFromSync)?i18n("Yes"):i18n("No") );
+
+ return true;
+}
+
+/*bool KPalmPlugin::writeInfo( const KFileMetaInfo& info ) const
+{
+// int pi_file_set_info((struct pi_file * pf, struct DBInfo * infop));
+//info["tuteTextTechnical"].value("An integer").toInt()
+// Do the stuff with low-level functions. See lines 1119-1142 of pi-file.cc for writing, 244-273 for reading.
+}*/
+
+#include "tdefile_palm.moc"
diff --git a/tdefile-plugins/palm-databases/tdefile_palm.desktop b/tdefile-plugins/palm-databases/tdefile_palm.desktop
new file mode 100644
index 000000000..716944e1e
--- /dev/null
+++ b/tdefile-plugins/palm-databases/tdefile_palm.desktop
@@ -0,0 +1,59 @@
+[Desktop Entry]
+Type=Service
+Name=PalmOS Database Info
+Name[af]=PalmOS databasis informasie
+Name[be]=Інфармацыя аб базе дадзеных PalmOS
+Name[bg]=Информация за БД на PalmOS
+Name[br]=Titouroù diwar-benn ar stlennvon PalmOS
+Name[bs]=Informacije o PalmOS bazi podataka
+Name[ca]=Informació de base de dades PalmOS
+Name[cs]=Informace o databázi PalmOS
+Name[da]=PalmOS database-info
+Name[de]=PalmOS Datenbank-Informationen
+Name[el]=Πληροφορίες βάσης δεδομένων PalmOS
+Name[eo]=PalmOS-Datumbazinformo
+Name[es]=Info. de la base de datos de PalmOS
+Name[et]=PalmOS andmebaasi info
+Name[eu]=PalmOS datu-base informazioa
+Name[fa]=اطلاعات دادگان PalmOS
+Name[fi]=PalmOS-tietokannan tiedot
+Name[fr]=Informations sur les bases de données PalmOS
+Name[fy]=PalmOS-database ynformaasje
+Name[ga]=Eolas faoin Bhunachar Sonraí PalmOS
+Name[gl]=Información de Base de Datos de PalmOS
+Name[he]=מידע אודות בסיס הנתונים של PalmOS
+Name[hu]=PalmOS adatbázis-jellemzők
+Name[is]=PalmOS gagnagrunnsupplýsingar
+Name[it]=Informazioni database PalmOs
+Name[ja]=PalmOS データベース 情報
+Name[kk]=PalmOS деректер қорының мәліметі
+Name[km]=ព័ត៌មាន​មូលដ្ឋាន​ទិន្នន័យ PalmOS
+Name[lt]=PalmOS duomenų bazės info
+Name[mk]=Информации за PalmOS-база на податоци
+Name[ms]=Maklumat Pangkalan Data PalmOS
+Name[nb]=PalmOS Database info
+Name[nds]=PalmOS-Datenbank-Informatschonen
+Name[ne]=PalmOS डाटाबेस सूचना
+Name[nl]=PalmOS-database informatie
+Name[nn]=PalmOS-databaseinfo
+Name[pl]=Baza danych PalmOS
+Name[pt]=Informações de Base de Dados PalmOS
+Name[pt_BR]=Informações da Base de Dados do PalmOS
+Name[ru]=Сведения о базе данных PalmOS
+Name[se]=PalmOS-diehtovuođđodieđut
+Name[sk]=Informácie o databázach PalmOS
+Name[sl]=Informacije zbirke podatkov za PalmOS
+Name[sr]=Информације о PalmOS базама података
+Name[sr@Latn]=Informacije o PalmOS bazama podataka
+Name[sv]=PalmOS-databasinformation
+Name[ta]=பால்ம்OS தரவுத்தள தகவல்
+Name[tg]=Иттилоот дар бораи бонки додаҳои PalmOS
+Name[tr]=PalmOS Veritabanı Bilgisi
+Name[uk]=Інформація про базу даних PalmOS
+Name[zh_CN]=PalmOS 数据库信息
+Name[zh_TW]=PalmOS 資料庫資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_palm
+MimeType=application/vnd.palm
+PreferredGroups=General
+PreferredItems=Name,DBType,TypeID,CreatorID,NrRecords,Size
diff --git a/tdefile-plugins/palm-databases/tdefile_palm.h b/tdefile-plugins/palm-databases/tdefile_palm.h
new file mode 100644
index 000000000..d566d5fcf
--- /dev/null
+++ b/tdefile-plugins/palm-databases/tdefile_palm.h
@@ -0,0 +1,41 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
+ * Based on the vcf plugin:
+ * Copyright (C) 2002 Shane Wright <me@shanewright.co.uk>
+ *
+ * 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 version 2.
+ *
+ * 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; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef __KFILE_PALM_H__
+#define __KFILE_PALM_H__
+
+#include <tdefilemetainfo.h>
+
+class TQStringList;
+
+class KPalmPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ KPalmPlugin( TQObject *parent, const char *name, const TQStringList& args );
+
+ virtual bool readInfo( KFileMetaInfo& info, uint what);
+// virtual bool writeInfo( const KFileMetaInfo& info ) const;
+};
+
+#endif