diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:05:15 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:05:15 -0600 |
commit | 64df902cf71a8ee258fb85f6be26248f399aa01f (patch) | |
tree | dba58f705042c22cea26b678d5b0e4e9a34bf202 /tdefile-plugins | |
parent | de53c98cab07e9c4b0f5e25dab82830fb6fc67ec (diff) | |
download | tdepim-64df902cf71a8ee258fb85f6be26248f399aa01f.tar.gz tdepim-64df902cf71a8ee258fb85f6be26248f399aa01f.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdefile-plugins')
22 files changed, 1087 insertions, 0 deletions
diff --git a/tdefile-plugins/CMakeLists.txt b/tdefile-plugins/CMakeLists.txt new file mode 100644 index 000000000..3f9c0f476 --- /dev/null +++ b/tdefile-plugins/CMakeLists.txt @@ -0,0 +1,13 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( vcf ) +add_subdirectory( ics ) diff --git a/tdefile-plugins/Makefile.am b/tdefile-plugins/Makefile.am new file mode 100644 index 000000000..7ebdda704 --- /dev/null +++ b/tdefile-plugins/Makefile.am @@ -0,0 +1,6 @@ +if compile_kpilot +PILOTPLUGIN = palm-databases +endif + +SUBDIRS=vcf ics $(PILOTPLUGIN) + diff --git a/tdefile-plugins/RETURNED_ITEMS b/tdefile-plugins/RETURNED_ITEMS new file mode 100644 index 000000000..9985e36db --- /dev/null +++ b/tdefile-plugins/RETURNED_ITEMS @@ -0,0 +1,12 @@ +If you make a new plugin, please add the list of returned items to this list. + + +vcf plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +String Name -/- Name of person +String Email -/- Email address + + diff --git a/tdefile-plugins/ics/CMakeLists.txt b/tdefile-plugins/ics/CMakeLists.txt new file mode 100644 index 000000000..66c100712 --- /dev/null +++ b/tdefile-plugins/ics/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_import( libkmime ) +tde_import( ktnef ) +tde_import( libkcal ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_ics.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_ics (module) ######################## + +tde_add_kpart( tdefile_ics AUTOMOC + SOURCES tdefile_ics.cpp + LINK kcal-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/ics/Makefile.am b/tdefile-plugins/ics/Makefile.am new file mode 100644 index 000000000..96a1a7f74 --- /dev/null +++ b/tdefile-plugins/ics/Makefile.am @@ -0,0 +1,24 @@ +# Makefile.am for ics file meta info plugin + +# set the include path for X, tdepim, qt and KDE +INCLUDES = \ + -I$(top_srcdir) \ + $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_ics.h + +kde_module_LTLIBRARIES = tdefile_ics.la + +tdefile_ics_la_SOURCES = tdefile_ics.cpp +tdefile_ics_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore +tdefile_ics_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(LIB_KSYCOCA) + + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_ics.cpp -o $(podir)/tdefile_ics.pot + +services_DATA = tdefile_ics.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ics/tdefile_ics.cpp b/tdefile-plugins/ics/tdefile_ics.cpp new file mode 100644 index 000000000..11a5384fb --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.cpp @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Bram Schoenmakers <bramschoenmakers@kde.nl> + * + * 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 +t 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 <tqdatetime.h> +#include <tqfile.h> + +#include <libkcal/calendarlocal.h> +#include <libkcal/todo.h> + +#include "tdefile_ics.h" + +#include <kgenericfactory.h> + +using namespace KCal; + +typedef KGenericFactory<ICSPlugin> ICSFactory; +K_EXPORT_COMPONENT_FACTORY(tdefile_ics, ICSFactory( "tdefile_ics" )) + +ICSPlugin::ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ) + : KFilePlugin( parent, name, args ) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "text/calendar" ); //TODO: vcs !! + + KFileMimeTypeInfo::GroupInfo* group = 0L; + group = addGroupInfo(info, "ICSInfo", i18n("Calendar Statistics")); + + addItemInfo( group, "ProductID", i18n("Product ID"), TQVariant::String ); + addItemInfo( group, "Events", i18n("Events"), TQVariant::Int ); + addItemInfo( group, "Todos", i18n("To-dos"), TQVariant::Int ); + addItemInfo( group, "TodoCompleted", i18n("Completed To-dos"), TQVariant::Int ); + addItemInfo( group, "TodoOverdue", i18n("Overdue To-dos"), TQVariant::Int ); + addItemInfo( group, "Journals", i18n("Journals"), TQVariant::Int ); +// addItemInfo( group, "Reminders", i18n("Reminders"), TQVariant::Int ); + +} + +/* +I chose to use libkcal instead of reading the calendar manually. It's easier to +maintain this way. +*/ +bool ICSPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + KFileMetaInfoGroup group = appendGroup( info, "ICSInfo"); + + CalendarLocal cal ( TQString::fromLatin1( "UTC" ) ); + if( !cal.load( info.path() ) ) { + kdDebug() << "Could not load calendar" << endl; + return false; + } + + appendItem( group, "ProductID", TQVariant( cal.productId() ) ); + appendItem( group, "Events", TQVariant( int( cal.events().count() ) ) ); + appendItem( group, "Journals", TQVariant( int( cal.journals().count() ) ) ); + Todo::List todos = cal.todos(); + + // count completed and overdue + Todo::List::ConstIterator it = todos.begin(); + Todo::List::ConstIterator end = todos.end(); + + int completed = 0; + int overdue = 0; + for ( ; it != end ; ++it ) { + Todo *todo = *it; + if ( todo->isCompleted() ) + ++completed; + else if ( todo->hasDueDate() && todo->dtDue().date() < TQDate::currentDate() ) + ++overdue; + } + + appendItem( group, "Todos", TQVariant( int(todos.count() ) ) ); + appendItem( group, "TodoCompleted", TQVariant( completed ) ); + appendItem( group, "TodoOverdue", TQVariant( overdue ) ); + + cal.close(); + + return true; +} + +#include "tdefile_ics.moc" diff --git a/tdefile-plugins/ics/tdefile_ics.desktop b/tdefile-plugins/ics/tdefile_ics.desktop new file mode 100644 index 000000000..41d745aa4 --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Type=Service +Name=ICS information +Name[af]=ICS informasie +Name[be]=Інфармацыя аб ICS +Name[bg]=ICS информация +Name[br]=Titouroù ICS +Name[ca]=Informació ICS +Name[cs]=Informace o ICS +Name[da]=ICS-information +Name[de]=ICS-Information +Name[el]=Πληροφορίες ICS +Name[eo]=ICS-Informo +Name[es]=Información ICS +Name[et]=ICS info +Name[eu]=ICS informazioa +Name[fa]=اطلاعات ICS +Name[fi]=ICS-tiedot +Name[fr]=Information sur ICS +Name[fy]=ICS-ynformaasje +Name[gl]=Información ICS +Name[he]=מידע של ICS +Name[hu]=ICS-jellemzők +Name[is]=ICS upplýsingar +Name[it]=Informazioni ICS +Name[ja]=ICS 情報 +Name[kk]=ICS ақпараты +Name[km]=ព័ត៌មាន ICS +Name[lt]=ICS informacija +Name[mk]=Информација за ICS +Name[ms]=Maklumat ICS +Name[nb]=ICS-informasjon +Name[nds]=ICS-Informatschoon +Name[ne]=ICS सूचना +Name[nl]=ICS-informatie +Name[nn]=ICS-informasjon +Name[pa]=ICS ਜਾਣਕਾਰੀ +Name[pl]=Informacja ICS +Name[pt]=Informação ICS +Name[pt_BR]=Informações ICS +Name[ru]=Информация ICS +Name[sk]=Informácie o ICS +Name[sl]=Podatki ICS +Name[sr]=ICS информације +Name[sr@Latn]=ICS informacije +Name[sv]=ICS-information +Name[ta]=ICS தகவல் +Name[tr]=ICS bilgisi +Name[uk]=Інформація про ICS +Name[zh_CN]=ICS 信息 +Name[zh_TW]=ICS 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ics +MimeType=text/calendar +PreferredGroups=ICSInfo +PreferredItems=Events,Todos,Journals diff --git a/tdefile-plugins/ics/tdefile_ics.h b/tdefile-plugins/ics/tdefile_ics.h new file mode 100644 index 000000000..9f4a897eb --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.h @@ -0,0 +1,37 @@ + /* This file is part of the KDE project + * Copyright (C) 2004 Bram Schoenmakers <bramschoenmakers@kde.nl> + * + * 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_ICS_H +#define KFILE_ICS_H + +#include <tdefilemetainfo.h> + +class TQStringList; + +class ICSPlugin : public KFilePlugin +{ + Q_OBJECT + +public: + ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what ); +}; + +#endif 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 diff --git a/tdefile-plugins/rfc822/Makefile.am b/tdefile-plugins/rfc822/Makefile.am new file mode 100644 index 000000000..f7cf89695 --- /dev/null +++ b/tdefile-plugins/rfc822/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for rfc822 file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_rfc822.h + +kde_module_LTLIBRARIES = tdefile_rfc822.la + +tdefile_rfc822_la_SOURCES = tdefile_rfc822.cpp +tdefile_rfc822_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_rfc822_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_rfc822.cpp -o $(podir)/tdefile_rfc822.pot + +services_DATA = tdefile_rfc822.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/rfc822/RETURNED_ITEMS b/tdefile-plugins/rfc822/RETURNED_ITEMS new file mode 100644 index 000000000..be8c9b7e7 --- /dev/null +++ b/tdefile-plugins/rfc822/RETURNED_ITEMS @@ -0,0 +1,14 @@ +If you make a new plugin, please add the list of returned items to this list. + + +rfc822 plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +String From -/- Name/email of sender +String To -/- Name/email of recipient +String Subject -/- Subject line of message +String Date -/- Date stamped in message +String Content-Type -/- Content type declared in headers + diff --git a/tdefile-plugins/rfc822/tdefile_rfc822.cpp b/tdefile-plugins/rfc822/tdefile_rfc822.cpp new file mode 100644 index 000000000..261f0835a --- /dev/null +++ b/tdefile-plugins/rfc822/tdefile_rfc822.cpp @@ -0,0 +1,161 @@ +/* This file is part of the KDE project + * 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 <config.h> +#include "tdefile_rfc822.h" + +#include <kprocess.h> +#include <klocale.h> +#include <kgenericfactory.h> +#include <kstringvalidator.h> +#include <kdebug.h> + +#include <tqdict.h> +#include <tqvalidator.h> +#include <tqcstring.h> +#include <tqfile.h> +#include <tqdatetime.h> + +#if !defined(__osf__) +#include <inttypes.h> +#else +typedef unsigned short uint32_t; +#endif + +typedef KGenericFactory<KRfc822Plugin> Rfc822Factory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_rfc822, Rfc822Factory( "tdefile_rfc822" )) + +KRfc822Plugin::KRfc822Plugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "message/rfc822" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "From", i18n("From"), TQVariant::String); + item = addItemInfo(group, "To", i18n("To"), TQVariant::String); + item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String); + item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); + item = addItemInfo(group, "Content-Type", i18n("Content-Type"), TQVariant::String); +} + + +bool KRfc822Plugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()) << endl; + return false; + } + + /* + Note to self: probably should use TQCString for all this, but + what we're doing is simple and self-contained so never mind.. + */ + + char id_from[] = "From: "; + char id_to[] = "To: "; + char id_subject[] = "Subject: "; + char id_date[] = "Date: "; + char id_contenttype[] = "Content-Type: "; + + // we need a buffer for lines + char linebuf[4096]; + + // we need a buffer for other stuff + char buf_from[1000] = ""; + char buf_to[1000] = ""; + char buf_subject[1000] = ""; + char buf_date[1000] = ""; + char buf_contenttype[1000] = ""; + + memset(buf_from, 0, 999); + memset(buf_to, 0, 999); + memset(buf_subject, 0, 999); + memset(buf_date, 0, 999); + memset(buf_contenttype, 0, 999); + char * myptr; + + bool done=false; + while (!done) { + + // read a line + file.readLine(linebuf, sizeof( linebuf )); + + // have we got something useful? + if (memcmp(linebuf, id_from, 6) == 0) { + // we have a name + myptr = linebuf + 6; + strncpy(buf_from, myptr, sizeof( buf_from )); + buf_from[998]='\0'; + } else if (memcmp(linebuf, id_to, 4) == 0) { + // we have a name + myptr = linebuf + 4; + strncpy(buf_to, myptr, sizeof( buf_to )); + buf_to[998]='\0'; + } else if (memcmp(linebuf, id_subject, 9) == 0) { + // we have a name + myptr = linebuf + 9; + strncpy(buf_subject, myptr, sizeof( buf_subject )); + buf_subject[998]='\0'; + } else if (memcmp(linebuf, id_date, 6) == 0) { + // we have a name + myptr = linebuf + 6; + strncpy(buf_date, myptr, sizeof( buf_date )); + buf_date[998]='\0'; + } else if (memcmp(linebuf, id_contenttype, 14) == 0) { + // we have a name + myptr = linebuf + 14; + strncpy(buf_contenttype, myptr, sizeof( buf_contenttype )); + buf_contenttype[998]='\0'; + } + + // are we done yet? + if ( + ((strlen(buf_from) > 0) && (strlen(buf_to) > 0) && + (strlen(buf_subject) > 0) && (strlen(buf_date) > 0) && + (strlen(buf_contenttype) > 0)) || + (file.atEnd()) + ) + done = true; + + }; + + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + if (strlen(buf_from) > 0) appendItem(group, "From", buf_from); + if (strlen(buf_to) > 0) appendItem(group, "To", buf_to); + if (strlen(buf_subject) > 0) appendItem(group, "Subject", buf_subject); + if (strlen(buf_date) > 0) appendItem(group, "Date", buf_date); + if (strlen(buf_contenttype) > 0) appendItem(group, "Content-Type", buf_contenttype); + + return true; +} + +#include "tdefile_rfc822.moc" diff --git a/tdefile-plugins/rfc822/tdefile_rfc822.desktop b/tdefile-plugins/rfc822/tdefile_rfc822.desktop new file mode 100644 index 000000000..d030e1e57 --- /dev/null +++ b/tdefile-plugins/rfc822/tdefile_rfc822.desktop @@ -0,0 +1,62 @@ +[Desktop Entry] +Type=Service +Name=Email Info +Name[af]=E-pos informasie +Name[be]=Інфармацыя аб паведамленні электроннай пошты +Name[bg]=Информация за е-поща +Name[br]=Titouroù postel +Name[ca]=Informació de correu-e +Name[cs]=Informace o emailu +Name[cy]=Gwybodaeth Ebost +Name[da]=E-mail-info +Name[de]=E-Mail-Info +Name[el]=Πληροφορίες Email +Name[eo]=Retpoŝt-informo +Name[es]=Info de correo electrónico +Name[et]=Kirja info +Name[eu]=E-posta informazioa +Name[fa]=اطلاعات رایانامه +Name[fi]=Sähköpostitiedot +Name[fr]=Informations sur le courrier électronique +Name[fy]=E-port-ynformaasje +Name[gl]=Información de Correo-e +Name[he]=מידע על דוא"ל +Name[hi]=ई-मेल जानकारी +Name[hr]=Email Informacije +Name[hu]=E-mail-jellemzők +Name[is]=Tölvupóst upplýsingar +Name[it]=Informazioni di posta elettronica +Name[ja]=Eメール 情報 +Name[kk]=Эл.пошта мәліметі +Name[km]=ព័ត៌មានអ៊ីមែល +Name[lt]=E. pašto info +Name[mk]=Информации за е-пошта +Name[ms]=Info Emel +Name[nb]=E-post-info +Name[nds]=Nettbreef-Informatschonen +Name[ne]=इमेल सूचना +Name[nl]=E-mail-informatie +Name[nn]=Epost-info +Name[pa]=ਈ-ਪੱਤਰ ਜਾਣਕਾਰੀ +Name[pl]=Informacja o e-mailu +Name[pt]=Informação do E-Mail +Name[pt_BR]=Informações sobre E-mail +Name[ro]=Informaţii e-mail +Name[ru]=Сведения об электронной почте +Name[se]=E-boastadieđut +Name[sk]=Informácie o emaily +Name[sl]=Informacije o e-pošti +Name[sr]=Е-поштанске информације +Name[sr@Latn]=E-poštanske informacije +Name[sv]=E-postinformation +Name[ta]=மின்னஞ்சல் தகவல் +Name[tg]=Иттилоот дар бораи почтаи электронӣ +Name[tr]=E-Posta Bilgisi +Name[uk]=Інформація про повідомлення ел. пошти +Name[zh_CN]=电子邮件信息 +Name[zh_TW]=電子郵件資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_rfc822 +MimeType=message/rfc822 +PreferredGroups=Technical +PreferredItems=From,To,Subject,Date,Content-Type diff --git a/tdefile-plugins/rfc822/tdefile_rfc822.h b/tdefile-plugins/rfc822/tdefile_rfc822.h new file mode 100644 index 000000000..e43948a98 --- /dev/null +++ b/tdefile-plugins/rfc822/tdefile_rfc822.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * 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_RFC822_H__ +#define __KFILE_RFC822_H__ + +#include <tdefilemetainfo.h> + +class TQStringList; + +class KRfc822Plugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KRfc822Plugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/vcf/CMakeLists.txt b/tdefile-plugins/vcf/CMakeLists.txt new file mode 100644 index 000000000..4cf771d26 --- /dev/null +++ b/tdefile-plugins/vcf/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_vcf.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_vcf (module) ######################## + +tde_add_kpart( tdefile_vcf AUTOMOC + SOURCES tdefile_vcf.cpp + LINK kabc-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/vcf/Makefile.am b/tdefile-plugins/vcf/Makefile.am new file mode 100644 index 000000000..61b306d5f --- /dev/null +++ b/tdefile-plugins/vcf/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for vcf file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_vcf.h + +kde_module_LTLIBRARIES = tdefile_vcf.la + +tdefile_vcf_la_SOURCES = tdefile_vcf.cpp +tdefile_vcf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore +tdefile_vcf_la_LIBADD = $(LIB_KSYCOCA) $(LIB_KABC) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_vcf.cpp -o $(podir)/tdefile_vcf.pot + +services_DATA = tdefile_vcf.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/vcf/tdefile_vcf.cpp b/tdefile-plugins/vcf/tdefile_vcf.cpp new file mode 100644 index 000000000..e8746c56a --- /dev/null +++ b/tdefile-plugins/vcf/tdefile_vcf.cpp @@ -0,0 +1,103 @@ +/* This file is part of the KDE project + * 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 <kdebug.h> +#include <config.h> +#include "tdefile_vcf.h" + +#include <kprocess.h> +#include <klocale.h> +#include <kgenericfactory.h> +#include <kabc/vcardconverter.h> + +#include <tqdict.h> +#include <tqfile.h> + +typedef KGenericFactory<KVcfPlugin> VcfFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_vcf, VcfFactory( "tdefile_vcf" )) + +KVcfPlugin::KVcfPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "text/x-vcard" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); + item = addItemInfo(group, "Email", i18n("Email"), TQVariant::String); + item = addItemInfo(group, "Telephone", i18n("Telephone"), TQVariant::String); +} + + +bool KVcfPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQString(TQFile::encodeName(info.path())) << endl; + return false; + } + + // even the vcard thumbnail TQString::fromUtf8(buf_name));creator reads the full file ... + // The following is partly copied from there + TQString contents = file.readAll(); + file.close(); + + KABC::VCardConverter converter; +#if defined(KABC_VCARD_ENCODING_FIX) + KABC::Addressee addr = converter.parseVCardRaw( contents.utf8() ); +#else + KABC::Addressee addr = converter.parseVCard( contents ); +#endif + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + // prepare the text + TQString name = addr.formattedName().simplifyWhiteSpace(); + if ( name.isEmpty() ) + name = addr.givenName() + " " + addr.familyName(); + name = name.simplifyWhiteSpace(); + + if ( ! name.isEmpty() ) + appendItem(group, "Name", name); + + if ( ! addr.preferredEmail().isEmpty() ) + appendItem(group, "Email", addr.preferredEmail()); + + KABC::PhoneNumber::List pnList = addr.phoneNumbers(); + TQStringList phoneNumbers; + for (unsigned int no=0; no<pnList.count(); ++no) { + TQString pn = pnList[no].number().simplifyWhiteSpace(); + if (!pn.isEmpty() && !phoneNumbers.contains(pn)) + phoneNumbers.append(pn); + } + if ( !phoneNumbers.isEmpty() ) + appendItem(group, "Telephone", phoneNumbers.join("\n")); + + return true; +} + +#include "tdefile_vcf.moc" diff --git a/tdefile-plugins/vcf/tdefile_vcf.desktop b/tdefile-plugins/vcf/tdefile_vcf.desktop new file mode 100644 index 000000000..730d731ab --- /dev/null +++ b/tdefile-plugins/vcf/tdefile_vcf.desktop @@ -0,0 +1,65 @@ +[Desktop Entry] +Type=Service +Name=vCard Info +Name[af]=Vkaart Inligting +Name[be]=Інфармацыя аб vCard +Name[bg]=Информация за vCard +Name[br]=Titouroù diwar-benn vCard +Name[ca]=Informació de vCard +Name[cs]=VCard info +Name[cy]=Gwybodaeth vCard +Name[da]=VCard-info +Name[de]=vCard-Info +Name[el]=Πληροφορίες vCard +Name[eo]=vCard-informo +Name[es]=Info de vCard +Name[et]=vCardi info +Name[eu]=vCard informazioa +Name[fa]=اطلاعات vCard +Name[fi]=vCard-tiedot +Name[fr]=Informations vCard +Name[fy]=vCard-ynformaasje +Name[gl]=Información de vCard +Name[he]=מידע vCard +Name[hi]=वी-कार्ड जानकारी +Name[hu]=VCard-jellemzők +Name[is]=vCard upplýsingar +Name[it]=Informazioni vCard +Name[ja]=vCard 情報 +Name[kk]=vCard мәліметі +Name[km]=ព័ត៌មាន vCard +Name[lt]=vCard informacija +Name[mk]=Информации за vCard +Name[ms]=Info vCard +Name[mt]=Informazzjoni vCard +Name[nb]=vCard info +Name[nds]=vCard-Informatschonen +Name[ne]=भी कार्ड सुचना +Name[nl]=vCard-informatie +Name[nn]=vCard-info +Name[nso]=Tshedimoso ya vKarata +Name[pa]=vCard ਜਾਣਕਾਰੀ +Name[pl]=Informacja vCard +Name[pt]=Informação do vCard +Name[pt_BR]=Informações sobre vCard +Name[ro]=Informaţii vCard +Name[ru]=Сведения о визитке vCard +Name[se]=vCard-dieđut +Name[sl]=Informacije o vCard +Name[sr]=vCard информације +Name[sr@Latn]=vCard informacije +Name[sv]=vCard-information +Name[ta]=விஅட்டை தகவல் +Name[tg]=Иттилоот дар бораи визиткаи vCard +Name[tr]=VCard Bilgisi +Name[uk]=Інформація про vCard +Name[ven]=Mafhungo a vCard +Name[xh]=Inkcukacha ye vCard +Name[zh_CN]=vCard 信息 +Name[zh_TW]=vCard 資訊 +Name[zu]=Ulwazi lwe-vCard +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_vcf +MimeType=text/x-vcard +PreferredGroups=Technical +PreferredItems=Name,Email,Telephone diff --git a/tdefile-plugins/vcf/tdefile_vcf.h b/tdefile-plugins/vcf/tdefile_vcf.h new file mode 100644 index 000000000..19866d8b8 --- /dev/null +++ b/tdefile-plugins/vcf/tdefile_vcf.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * 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_VCF_H__ +#define __KFILE_VCF_H__ + +#include <tdefilemetainfo.h> + +class TQStringList; + +class KVcfPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KVcfPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif |