diff options
Diffstat (limited to 'tools/kfile-plugins')
-rw-r--r-- | tools/kfile-plugins/Makefile.am | 1 | ||||
-rw-r--r-- | tools/kfile-plugins/RETURNED_ITEMS | 11 | ||||
-rw-r--r-- | tools/kfile-plugins/abiword/Makefile.am | 22 | ||||
-rw-r--r-- | tools/kfile-plugins/abiword/kfile_abiword.cpp | 145 | ||||
-rw-r--r-- | tools/kfile-plugins/abiword/kfile_abiword.desktop | 49 | ||||
-rw-r--r-- | tools/kfile-plugins/abiword/kfile_abiword.h | 43 | ||||
-rw-r--r-- | tools/kfile-plugins/gnumeric/Makefile.am | 22 | ||||
-rw-r--r-- | tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp | 123 | ||||
-rw-r--r-- | tools/kfile-plugins/gnumeric/kfile_gnumeric.desktop | 49 | ||||
-rw-r--r-- | tools/kfile-plugins/gnumeric/kfile_gnumeric.h | 43 | ||||
-rw-r--r-- | tools/kfile-plugins/koffice/Makefile.am | 22 | ||||
-rw-r--r-- | tools/kfile-plugins/koffice/kfile_koffice.cpp | 116 | ||||
-rw-r--r-- | tools/kfile-plugins/koffice/kfile_koffice.desktop | 66 | ||||
-rw-r--r-- | tools/kfile-plugins/koffice/kfile_koffice.h | 43 | ||||
-rw-r--r-- | tools/kfile-plugins/ooo/Makefile.am | 22 | ||||
-rw-r--r-- | tools/kfile-plugins/ooo/kfile_ooo.cpp | 588 | ||||
-rw-r--r-- | tools/kfile-plugins/ooo/kfile_ooo.desktop | 57 | ||||
-rw-r--r-- | tools/kfile-plugins/ooo/kfile_ooo.h | 78 |
18 files changed, 0 insertions, 1500 deletions
diff --git a/tools/kfile-plugins/Makefile.am b/tools/kfile-plugins/Makefile.am deleted file mode 100644 index 9632d298..00000000 --- a/tools/kfile-plugins/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS=koffice ooo gnumeric abiword diff --git a/tools/kfile-plugins/RETURNED_ITEMS b/tools/kfile-plugins/RETURNED_ITEMS deleted file mode 100644 index 62aea9bd..00000000 --- a/tools/kfile-plugins/RETURNED_ITEMS +++ /dev/null @@ -1,11 +0,0 @@ -Currently just - -Author -Title -Abstract - -as these are the most interesting of the documentinfo.xml properties. - -It would be nice to have other, autogenerated things too. Like number of pages. -To avoid horrible loading times, we should wait until we use the thumbnail managing standard, -then store stuff like #pages in preview.png. diff --git a/tools/kfile-plugins/abiword/Makefile.am b/tools/kfile-plugins/abiword/Makefile.am deleted file mode 100644 index 1242f21b..00000000 --- a/tools/kfile-plugins/abiword/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for gnumeric file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(KOFFICE_INCLUDES) $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_abiword.h - -kde_module_LTLIBRARIES = kfile_abiword.la - -kfile_abiword_la_SOURCES = kfile_abiword.cpp -kfile_abiword_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -lkio -ltdeparts -kfile_abiword_la_LIBADD = $(KOFFICE_LIBS) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -services_DATA = kfile_abiword.desktop -servicesdir = $(kde_servicesdir) - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_abiword.pot diff --git a/tools/kfile-plugins/abiword/kfile_abiword.cpp b/tools/kfile-plugins/abiword/kfile_abiword.cpp deleted file mode 100644 index 2f9bb418..00000000 --- a/tools/kfile-plugins/abiword/kfile_abiword.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Laurent Montel <[email protected]> - * - * 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 "kfile_abiword.h" - -#include <klocale.h> -#include <kgenericfactory.h> -#include <kfilterdev.h> - -#include <tqdom.h> -#include <tqfile.h> -#include <tqdatetime.h> -#include <kdebug.h> - -typedef KGenericFactory<AbiwordPlugin> AbiwordFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_abiword, AbiwordFactory( "kfile_abiword" )) - -AbiwordPlugin::AbiwordPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - init(); -} - -void AbiwordPlugin::init() -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-abiword" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "DocumentInfo", i18n("Document Information")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Abstract", i18n("Abstract"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Description); -} - -bool AbiwordPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - //Find the last extension - TQString strExt; - const int result=info.path().findRev('.'); - if (result>=0) - { - strExt=info.path().mid(result); - } - TQString strMime; // Mime type of the compressor (default: unknown) - if ((strExt==".gz")||(strExt==".GZ") //in case of .abw.gz (logical extension) - ||(strExt==".zabw")||(strExt==".ZABW")) //in case of .zabw (extension used prioritary with AbiWord) - { - // Compressed with gzip - strMime="application/x-gzip"; - kdDebug() << "Compression: gzip" << endl; - } - else if ((strExt==".bz2")||(strExt==".BZ2") //in case of .abw.bz2 (logical extension) - ||(strExt==".bzabw")||(strExt==".BZABW")) //in case of .bzabw (extension used prioritary with AbiWord) - { - // Compressed with bzip2 - strMime="application/x-bzip2"; - kdDebug() << "Compression: bzip2" << endl; - } - - KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo"); - TQIODevice* in = KFilterDev::deviceForFile(info.path(),strMime); - if ( !in ) - { - kdError() << "Cannot create device for uncompressing! Aborting!" << endl; - return false; - } - - if (!in->open(IO_ReadOnly)) - { - kdError() << "Cannot open file for uncompressing! Aborting!" << endl; - delete in; - return false; - } - TQDomDocument doc; - doc.setContent( in ); - in->close(); - TQDomElement docElem = doc.documentElement(); - TQDomNode summary = docElem.namedItem("metadata"); - TQDomNode m_item = summary.namedItem("m"); - - TQString author; - TQString title; - TQString abstract; - - while( !m_item.isNull() ) - { - kdDebug()<<" m_item.toElement().text: "<<m_item.toElement().text()<<endl; - TQString key = m_item.toElement().attribute( "key" ); - if ( key.isEmpty() ) - continue; - else if ( key=="dc.creator" ) - author=m_item.toElement().text(); - else if ( key=="dc.description" ) - abstract=m_item.toElement().text(); - else if ( key=="dc.title" ) - title=m_item.toElement().text(); - else - kdDebug()<<" Other key :"<<key<<endl; - m_item = m_item.nextSibling(); - } - appendItem(group, "Author", stringItem( author )); - appendItem(group, "Title", stringItem( title )); - appendItem(group, "Abstract", stringItem( abstract )); - - delete in; - return true; -} - -TQString AbiwordPlugin::stringItem( const TQString &name ) -{ - return name.isEmpty() ? i18n("*Unknown*") : name; -} - - -#include "kfile_abiword.moc" diff --git a/tools/kfile-plugins/abiword/kfile_abiword.desktop b/tools/kfile-plugins/abiword/kfile_abiword.desktop deleted file mode 100644 index a522452b..00000000 --- a/tools/kfile-plugins/abiword/kfile_abiword.desktop +++ /dev/null @@ -1,49 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Abiword Info -Name[bg]=Информация за Abiword -Name[br]=Titouroù Abiword -Name[ca]=Informació Abiword -Name[cy]=Gwybodaeth Abiword -Name[da]=Abiword-info -Name[el]=Πληροφορίες Abiword -Name[eo]=Abiword-informo -Name[es]=Información de Abiword -Name[et]=Abiword'i info -Name[fa]=اطلاعات Abiword -Name[fi]=Abiword-tiedot -Name[fr]=Informations sur Abiword -Name[fy]=Abiword ynfo -Name[ga]=Eolas faoi Abiword -Name[gl]=Información de Abiword -Name[he]=מידע של Abiword -Name[hu]=Abiword-információ -Name[is]=Abiword upplýsingar -Name[it]=Informazioni su Abiword -Name[ja]=Abiword 情報 -Name[km]=ព័ត៌មាន Abiword -Name[lt]=Abiword informacija -Name[lv]=Abiword informācija -Name[nb]=Abiword-info -Name[nds]=Abiword-Info -Name[ne]=एबीआई वर्ड सूचना -Name[nl]=Abiword-info -Name[pl]=Informacje o Abiword -Name[pt]=Informação do Abiword -Name[pt_BR]=Informação do Abiword -Name[ru]=Информация AbiWord -Name[se]=Abiword-dieđut -Name[sl]=Informacije o Abiword -Name[sr]=Информације Abiword-а -Name[sr@Latn]=Informacije Abiword-a -Name[sv]=Abiword-information -Name[uk]=Інформація Abiword -Name[uz]=Abiword hujjati haqida maʼlumot -Name[uz@cyrillic]=Abiword ҳужжати ҳақида маълумот -Name[zh_CN]=Abiword 信息 -Name[zh_TW]=Abiword 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_abiword -MimeType=application/x-abiword -PreferredGroups=DocumentInfo -PreferredItems=Author,Title,Abstract diff --git a/tools/kfile-plugins/abiword/kfile_abiword.h b/tools/kfile-plugins/abiword/kfile_abiword.h deleted file mode 100644 index 147516fc..00000000 --- a/tools/kfile-plugins/abiword/kfile_abiword.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Laurent Montel [email protected] - * - * 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_ABIWORD_H__ -#define __KFILE_ABIWORD_H__ - -#include <kfilemetainfo.h> - -class TQStringList; -class TQDomNode; - -class AbiwordPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - AbiwordPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -private: - void init(); - TQString stringItem( const TQString &name ); -}; - -#endif diff --git a/tools/kfile-plugins/gnumeric/Makefile.am b/tools/kfile-plugins/gnumeric/Makefile.am deleted file mode 100644 index 85ca467b..00000000 --- a/tools/kfile-plugins/gnumeric/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for gnumeric file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(KOFFICE_INCLUDES) $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_gnumeric.h - -kde_module_LTLIBRARIES = kfile_gnumeric.la - -kfile_gnumeric_la_SOURCES = kfile_gnumeric.cpp -kfile_gnumeric_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -lkio -ltdeparts -kfile_gnumeric_la_LIBADD = $(KOFFICE_LIBS) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -services_DATA = kfile_gnumeric.desktop -servicesdir = $(kde_servicesdir) - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_gnumeric.pot diff --git a/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp b/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp deleted file mode 100644 index 145f318b..00000000 --- a/tools/kfile-plugins/gnumeric/kfile_gnumeric.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Laurent Montel <[email protected]> - * - * 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 "kfile_gnumeric.h" - -#include <klocale.h> -#include <kgenericfactory.h> -#include <kfilterdev.h> - -#include <tqdom.h> -#include <tqfile.h> -#include <tqdatetime.h> -#include <kdebug.h> - -typedef KGenericFactory<GnumericPlugin> GnumericFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_gnumeric, GnumericFactory( "kfile_gnumeric" )) - -GnumericPlugin::GnumericPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - init(); -} - -void GnumericPlugin::init() -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-gnumeric" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "DocumentInfo", i18n("Document Information")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Abstract", i18n("Abstract"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Description); -} - -bool GnumericPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo"); - TQIODevice* in = KFilterDev::deviceForFile(info.path(),"application/x-gzip"); - if ( !in ) - { - kdError() << "Cannot create device for uncompressing! Aborting!" << endl; - return false; - } - - if (!in->open(IO_ReadOnly)) - { - kdError() << "Cannot open file for uncompressing! Aborting!" << endl; - delete in; - return false; - } - TQDomDocument doc; - doc.setContent( in ); - in->close(); - TQDomElement docElem = doc.documentElement(); - TQDomNode summary = docElem.namedItem("gmr:Summary"); - TQDomNode gmr_item = summary.namedItem("gmr:Item"); - TQString author; - TQString title; - TQString abstract; - - while( !gmr_item.isNull() ) - { - TQDomNode gmr_name = gmr_item.namedItem("gmr:name"); - TQDomNode gmr_value = gmr_item.namedItem("gmr:val-string"); - if (gmr_name.toElement().text() == "title") - { - title=gmr_value.toElement().text(); - } - else if (gmr_name.toElement().text() == "author") - { - author=gmr_value.toElement().text(); - } - else if (gmr_name.toElement().text() == "comments") - { - abstract=gmr_value.toElement().text(); - } - gmr_item = gmr_item.nextSibling(); - } - appendItem(group, "Author", stringItem( author )); - appendItem(group, "Title", stringItem( title )); - appendItem(group, "Abstract", stringItem( abstract )); - - delete in; - return true; -} - -TQString GnumericPlugin::stringItem( const TQString &name ) -{ - return name.isEmpty() ? i18n("*Unknown*") : name; -} - - -#include "kfile_gnumeric.moc" diff --git a/tools/kfile-plugins/gnumeric/kfile_gnumeric.desktop b/tools/kfile-plugins/gnumeric/kfile_gnumeric.desktop deleted file mode 100644 index a1372f31..00000000 --- a/tools/kfile-plugins/gnumeric/kfile_gnumeric.desktop +++ /dev/null @@ -1,49 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Gnumeric Info -Name[bg]=Информация за Gnumeric -Name[br]=Titouroù Gnumeric -Name[ca]=Informació GNUmeric -Name[cy]=Gwybodaeth Gnumeric -Name[da]=Gnumeric info -Name[el]=Πληροφορίες Gnumeric -Name[eo]=Gnumeric-informo -Name[es]=Información de Gnumeric -Name[et]=Gnumeric'i info -Name[fa]=اطلاعات Gnumeric -Name[fi]=Gnumeric-tiedot -Name[fr]=Informations sur Gnumeric -Name[fy]=Gnumeric ynfo -Name[ga]=Ginearálta -Name[gl]=Información de Gnumeric -Name[he]=מידע של Gnumeric -Name[hu]=Gnumeric-információ -Name[is]=Gnumeric upplýsingar -Name[it]=Informazioni su Gnumeric -Name[ja]=Gnumeric 情報 -Name[km]=ព័ត៌មាន Gnumeric -Name[lt]=Gnumeric informacija -Name[lv]=Gnumeric informācija -Name[nb]=Gnumeric-info -Name[nds]=Gnumeric-Info -Name[ne]=जीन्यूमेरिक सूचना -Name[nl]=Gnumeric-info -Name[pl]=Informacje o Gnumeric -Name[pt]=Informação do Gnumeric -Name[pt_BR]=Informação do Gnumeric -Name[ru]=Информация Gnumeric -Name[se]=Gnumeric-dieđut -Name[sl]=Informacije o Gnumeric -Name[sr]=Информације Gnumeric-а -Name[sr@Latn]=Informacije Gnumeric-a -Name[sv]=Gnumeric-information -Name[uk]=Інформація Gnumeric -Name[uz]=Gnumeric hujjati haqida maʼlumot -Name[uz@cyrillic]=Gnumeric ҳужжати ҳақида маълумот -Name[zh_CN]=Gnumeric 信息 -Name[zh_TW]=Gnumeric 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_gnumeric -MimeType=application/x-gnumeric -PreferredGroups=DocumentInfo -PreferredItems=Author,Title,Abstract diff --git a/tools/kfile-plugins/gnumeric/kfile_gnumeric.h b/tools/kfile-plugins/gnumeric/kfile_gnumeric.h deleted file mode 100644 index 996e49a8..00000000 --- a/tools/kfile-plugins/gnumeric/kfile_gnumeric.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Laurent Montel [email protected] - * - * 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_GNUMERIC_H__ -#define __KFILE_GNUMERIC_H__ - -#include <kfilemetainfo.h> - -class TQStringList; -class TQDomNode; - -class GnumericPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - GnumericPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -private: - void init(); - TQString stringItem( const TQString &name ); -}; - -#endif diff --git a/tools/kfile-plugins/koffice/Makefile.am b/tools/kfile-plugins/koffice/Makefile.am deleted file mode 100644 index dfbd4080..00000000 --- a/tools/kfile-plugins/koffice/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for koffice file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(KOFFICE_INCLUDES) $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_koffice.h - -kde_module_LTLIBRARIES = kfile_koffice.la - -kfile_koffice_la_SOURCES = kfile_koffice.cpp -kfile_koffice_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -lkio -ltdeparts -kfile_koffice_la_LIBADD = $(KOFFICE_LIBS) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -services_DATA = kfile_koffice.desktop -servicesdir = $(kde_servicesdir) - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_koffice.pot diff --git a/tools/kfile-plugins/koffice/kfile_koffice.cpp b/tools/kfile-plugins/koffice/kfile_koffice.cpp deleted file mode 100644 index 05cd22ef..00000000 --- a/tools/kfile-plugins/koffice/kfile_koffice.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Simon MacMullen - * - * 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 "kfile_koffice.h" - -#include <klocale.h> -#include <kgenericfactory.h> -#include <KoStore.h> -#include <KoStoreDevice.h> - -#include <tqdom.h> -#include <tqfile.h> -#include <tqdatetime.h> - -typedef KGenericFactory<KOfficePlugin> KOfficeFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_koffice, KOfficeFactory( "kfile_koffice" )) - -KOfficePlugin::KOfficePlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - makeMimeTypeInfo( "application/x-kword" ); - makeMimeTypeInfo( "application/x-kpresenter" ); - makeMimeTypeInfo( "application/x-kspread" ); - makeMimeTypeInfo( "application/x-karbon" ); - makeMimeTypeInfo( "application/x-kontour" ); - makeMimeTypeInfo( "application/x-kchart" ); - makeMimeTypeInfo( "application/x-kivio" ); - makeMimeTypeInfo( "application/x-chalk" ); - makeMimeTypeInfo( "application/x-kformula" ); - - /*makeMimeTypeInfo( "application/vnd.kde.kword" ); - makeMimeTypeInfo( "application/vnd.kde.kpresenter" ); - makeMimeTypeInfo( "application/vnd.kde.kspread" ); - makeMimeTypeInfo( "application/vnd.kde.karbon" ); - makeMimeTypeInfo( "application/vnd.kde.kontour" );*/ -} - -void KOfficePlugin::makeMimeTypeInfo(const TQString& mimeType) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "DocumentInfo", i18n("Document Information")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - item = addItemInfo(group, "Abstract", i18n("Abstract"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Description); -} - -bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint what) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - KFileMetaInfoGroup group = appendGroup(info, "DocumentInfo"); - - KoStore* store = KoStore::createStore(info.path(), KoStore::Read); - if ( store && store->open( TQString("documentinfo.xml") ) ) - { - KoStoreDevice dev( store ); - TQDomDocument doc; - doc.setContent( &dev ); - - TQDomNode authorNode = doc.namedItem("document-info").namedItem("author"); - TQDomNode aboutNode = doc.namedItem("document-info").namedItem("about"); - - TQString author = stringFromNode(authorNode, "full-name"); - TQString title = stringFromNode(aboutNode, "title"); - TQString abstract = stringFromNode(aboutNode, "abstract"); - - appendItem(group, "Author", author); - appendItem(group, "Title", title); - appendItem(group, "Abstract", abstract); - - store->close(); - delete store; - return true; - } - delete store; - return false; -} - -TQString KOfficePlugin::stringFromNode(const TQDomNode &node, const TQString &name) -{ - TQString value = node.namedItem(name).toElement().text(); - return value.isEmpty() ? i18n("*Unknown*") : value; -} - - -#include "kfile_koffice.moc" diff --git a/tools/kfile-plugins/koffice/kfile_koffice.desktop b/tools/kfile-plugins/koffice/kfile_koffice.desktop deleted file mode 100644 index 8e653180..00000000 --- a/tools/kfile-plugins/koffice/kfile_koffice.desktop +++ /dev/null @@ -1,66 +0,0 @@ -[Desktop Entry] -Type=Service -Name=KOffice Info -Name[af]=Koffice Inligting -Name[ar]=معلومات KOffice -Name[bg]=Информация за KOffice -Name[br]=Titouroù diwar-benn KOffice -Name[ca]=Informació KOffice -Name[cs]=KOffice info -Name[cy]=Gwybodaeth KOffice -Name[da]=KOffice-information -Name[el]=Πληροφορίες KOffice -Name[eo]=KOffice informo -Name[es]=Información de KOffice -Name[et]=KOffice'i info -Name[eu]=KOffice-en informazioa -Name[fa]=اطلاعات KOffice -Name[fi]=KOffice-tiedot -Name[fo]=KSkrivstovu-upplýsingar -Name[fr]=Informations sur KOffice -Name[fy]=KOffice ynfo -Name[ga]=Eolas faoi KOffice -Name[gl]=Información de KOffice -Name[he]=מידע KOffice -Name[hi]=केऑफ़िस जानकारी -Name[hu]=KOffice-információ -Name[is]=KOffice upplýsingar -Name[it]=Informazioni KOffice -Name[ja]=KOffice 情報 -Name[km]=ព័ត៌មាន KOffice -Name[lo]=ຂໍ້ມູນໂປຣແກມຊຸດສໍານັກງານ -Name[lt]=KOffice informacija -Name[lv]=KOffice informācija -Name[ms]=Maklumat KOffice -Name[mt]=Info. KOffice -Name[nb]=KOffice-info -Name[nds]=KOffice-Info -Name[ne]=केडीई कार्यालय सूचना -Name[nl]=Koffice-info -Name[nn]=KOffice-info -Name[pa]=KOffice ਜਾਣਕਾਰੀ -Name[pl]=Informacje o KOffice -Name[pt]=Informação do KOffice -Name[pt_BR]=Informações do KOffice -Name[ru]=Информация KOffice -Name[se]=KOffice-dieđut -Name[sk]=Informácie o KOffice -Name[sl]=Informacije o KOffice -Name[sr]=Информације KOffice-а -Name[sr@Latn]=Informacije KOffice-a -Name[sv]=Koffice-information -Name[tg]=KOffice Ахборот -Name[th]=ข้อมูลโปรแกรมชุดสำนักงาน -Name[tr]=KOffice Bilgisi -Name[uk]=Інформація KOffice -Name[uz]=KOffice maʼlumot -Name[uz@cyrillic]=KOffice маълумот -Name[wa]=Informåcion KOffice -Name[xh]=Ulwazi lwe KOffice -Name[zh_CN]=KOffice 信息 -Name[zh_TW]=KOffice 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_koffice -MimeType=application/x-kword;application/x-kpresenter;application/x-kspread;application/x-karbon -PreferredGroups=DocumentInfo -PreferredItems=Author,Title,Abstract diff --git a/tools/kfile-plugins/koffice/kfile_koffice.h b/tools/kfile-plugins/koffice/kfile_koffice.h deleted file mode 100644 index 607225a4..00000000 --- a/tools/kfile-plugins/koffice/kfile_koffice.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Simon MacMullen - * - * 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_KOFFICE_H__ -#define __KFILE_KOFFICE_H__ - -#include <kfilemetainfo.h> - -class TQStringList; -class TQDomNode; - -class KOfficePlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KOfficePlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -private: - void makeMimeTypeInfo(const TQString& mimeType); - TQString stringFromNode(const TQDomNode &node, const TQString &name); -}; - -#endif diff --git a/tools/kfile-plugins/ooo/Makefile.am b/tools/kfile-plugins/ooo/Makefile.am deleted file mode 100644 index d72dd705..00000000 --- a/tools/kfile-plugins/ooo/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for OpenOffice.org file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(KOFFICE_INCLUDES) $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_ooo.h - -kde_module_LTLIBRARIES = kfile_ooo.la - -kfile_ooo_la_SOURCES = kfile_ooo.cpp -kfile_ooo_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -ltdecore -ltdeui $(LIB_QT) -lkjs -ltdefx -lkio -ltdeparts -kfile_ooo_la_LIBADD = $(KOFFICE_LIBS) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -services_DATA = kfile_ooo.desktop -servicesdir = $(kde_servicesdir) - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_ooo.pot diff --git a/tools/kfile-plugins/ooo/kfile_ooo.cpp b/tools/kfile-plugins/ooo/kfile_ooo.cpp deleted file mode 100644 index c66e3682..00000000 --- a/tools/kfile-plugins/ooo/kfile_ooo.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Pierre Souchay <[email protected]> - * - * 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. - * - */ - -/** - * CHANGES - * v1.7 to 1.9 - * Added the editing duration analysis. - * v1.6 to 1.7 - * Changed the incorrect meta:date to dc:date - * Now parse date instead of simply print the ISO date - * Fixes bug with keywords, now properly handled - * Changed the deprecated upload method to the new one. - * v1.5 to 1.6 - * Correction for bug 68112: http://bugs.kde.org/show_bug.cgi?id=68112 - * OOo 1.1 does not support garbages in zip files. We now recreate the zip - * file from scratch. It is slower, but we don't have the choice :( - * v1.1 to v1.2 - * Added support for KFileMimeTypeInfo::Hints (Name, Author, Description) - * Added some Advanced Attributes and Statistics according to DTD of OOo - * No more duplicated strings of same contents to facilitate changes - */ - -#include <config.h> -#include "kfile_ooo.h" - -#include <klocale.h> -#include <kgenericfactory.h> -#include <KoStore.h> -#include <KoStoreDevice.h> -#include <kzip.h> -#include <ktempfile.h> -#include <tqptrstack.h> - -#include <tqdom.h> -#include <tqfile.h> -#include <tqdatetime.h> -#include <tqvalidator.h> -#include <kdebug.h> -#include <kio/netaccess.h> - -typedef KGenericFactory<KOfficePlugin> KOfficeFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_ooo, KOfficeFactory( "kfile_ooo" )) - -static const char * const mimetypes[] = -{ "application/vnd.sun.xml.calc", "application/vnd.sun.xml.calc.template", - "application/vnd.sun.xml.draw", "application/vnd.sun.xml.draw.template", - "application/vnd.sun.xml.impress","application/vnd.sun.xml.impress.template", - "application/vnd.sun.xml.writer", "application/vnd.sun.xml.writer.global", - "application/vnd.sun.xml.writer.math", - "application/vnd.sun.xml.writer.template", - "application/vnd.oasis.opendocument.chart", - "application/vnd.oasis.opendocument.formula", - "application/vnd.oasis.opendocument.graphics", - "application/vnd.oasis.opendocument.graphics-template", - "application/vnd.oasis.opendocument.presentation", - "application/vnd.oasis.opendocument.presentation-template", - "application/vnd.oasis.opendocument.spreadsheet", - "application/vnd.oasis.opendocument.spreadsheet-template", - "application/vnd.oasis.opendocument.text", - "application/vnd.oasis.opendocument.text-template", - 0}; - -static const char * const Advanced[] = - { - "meta:printed-by" , I18N_NOOP("Printed By"), - "meta:print-date" , I18N_NOOP("Print Date"), - "dc:date" , I18N_NOOP("Date"), - "meta:creation-date" , I18N_NOOP("Creation Date"), - "meta:initial-creator", I18N_NOOP("Creator"), - "meta:generator" , I18N_NOOP("Generator"), - "meta:editing-cycles" , I18N_NOOP("Editing Cycles"), - "meta:editing-duration" , I18N_NOOP("Editing Duration"), - 0}; - -static const char * dclanguage = "dc:language"; - -static const char * const Information[] = - {"dc:title" , I18N_NOOP("Title") , - "dc:creator" , I18N_NOOP("Author") , - "dc:description", I18N_NOOP("Description"), - "dc:subject" , I18N_NOOP("Subject") , - dclanguage , I18N_NOOP("Language") , - 0}; - -static const char * const Statistics[] = - {"meta:draw-count" , I18N_NOOP("Draws"), - "meta:table-count" , I18N_NOOP("Tables"), - "meta:image-count" , I18N_NOOP("Images"), - "meta:object-count" , I18N_NOOP("Objects"), - "meta:ole-object-count", I18N_NOOP("OLE Objects"), - "meta:page-count" , I18N_NOOP("Pages"), - "meta:paragraph-count" , I18N_NOOP("Paragraphs"), - "meta:word-count" , I18N_NOOP("Words"), - "meta:cell-count" , I18N_NOOP("Cells"), - "meta:character-count" , I18N_NOOP("Characters"), - "meta:row-count" , I18N_NOOP("Rows"), - 0}; - -static const char * metakeywords = "meta:keywords"; -static const char * metakeyword = "meta:keyword" ; -static const char * DocumentInfo = "DocumentInfo" ; -static const char * UserDefined = "UserDefined" ; -static const char * DocAdvanced = "Advanced" ; -static const char * DocStatistics = "Statistics" ; -static const char * metadocstat = "meta:document-statistic"; -static const char * metaname = "meta:name" ; -static const char * metauserdef = "meta:user-defined"; -static const char * metafile = "meta.xml" ; -KOfficePlugin::KOfficePlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - int i = 0; - while (mimetypes[i]) - makeMimeTypeInfo( mimetypes[i++] ); -} - -void KOfficePlugin::makeMimeTypeInfo(const TQString& mimeType) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); - - userdefined = addGroupInfo(info, UserDefined, i18n("User Defined")); - addVariableInfo(userdefined, TQVariant::String, - KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable | - KFileMimeTypeInfo::Modifiable); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - group = addGroupInfo(info, DocumentInfo, i18n("Document Information")); - KFileMimeTypeInfo::ItemInfo* item; - int i = 0; - for (i = 0; Information[i]; i+=2){ - item = addItemInfo(group, Information[i], i18n(Information[i+1]), - TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - switch (i){ - case 0: - setHint(item, KFileMimeTypeInfo::Name); - break; - case 1: - setHint(item, KFileMimeTypeInfo::Author); - break; - case 2: - setHint(item, KFileMimeTypeInfo::Description); - default:; - } - } - - item = addItemInfo(group, metakeyword, i18n("Keywords"), - TQVariant::String); - setHint(item, KFileMimeTypeInfo::Description); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - group = addGroupInfo(info, DocAdvanced, i18n("Document Advanced")); - for (i = 0; Advanced[i]; i+=2){ - // I should add the isDate property instead of testing the index, but it works well, who cares ? :-) - TQVariant::Type typ = TQVariant::String; - if (i > 1 && i < 8) - typ = TQVariant::DateTime; - if (i == 14) - typ = TQVariant::String; - item = addItemInfo(group, Advanced[i], i18n(Advanced[i+1]), typ); - setHint(item, KFileMimeTypeInfo::Description); - } - - group = addGroupInfo(info, DocStatistics, i18n("Document Statistics")); - for (i = 0; Statistics[i]; i+=2){ - item = addItemInfo(group, Statistics[i], i18n(Statistics[i+1]), - TQVariant::Int); - setHint(item, KFileMimeTypeInfo::Length); - } -} - -/** - * Gets a number in the string and update the position next character which - * is not a number - * @param str The string to check - * @param the position to start to, updated to the next character NAN - * @return the number parsed, 0 if number was not valid - */ -int getNumber(TQString &str, int * pos){ - int k = *pos; - for (int len = str.length() ; - str.at(k).isNumber() && k < len ; - k++); - bool result = false; - int num = str.mid( *pos, k-(*pos)).toInt(&result); - *pos = k; - if (!result) - return 0; - return num; -} - -void KOfficePlugin::getEditingTime(KFileMetaInfoGroup group1, - const char * labelid, TQString & txt){ - TQString t; - int days = 0; - int hours = 0; - int minutes = 0; - int seconds = 0; - if (txt.at(0) != 'P'){ - kdDebug(7034) << labelid << "=" << txt << - " does not seems to be a valid duration" << endl; - return; - } - int pos = 1; - if (txt.at(pos).isNumber()){ - days = getNumber(txt, &pos); - if (txt.at(pos++)!='D'){ - days=0; - kdDebug(7034) << labelid << - " First arg was not a day in " << txt << endl; - } - } - if (txt.at(pos)!= 'T'){ - kdDebug(7034) << labelid << "=" << txt << - " does not seems to contain time information" << endl; - return; - } - pos++; - int len = txt.length(); - while (pos < len){ - int res = getNumber(txt, &pos); - if (pos >= len) - return; - switch (txt.at(pos).latin1()) { - case 'H': - hours = res; - break; - case 'M': - minutes = res; - break; - case 'S': - seconds = res; - break; - default: - kdDebug(7034) << "Unknown unit at pos " << pos << " while parsing " << - labelid << "="<< txt << endl; - } - pos++; - } - hours += days * 24; - appendItem(group1, labelid, - i18n("%1:%2.%3").arg(hours).arg(minutes, 2).arg(seconds,2 )); -} - -void KOfficePlugin::getDateTime(KFileMetaInfoGroup group1, - const char * labelid, TQString & txt) -{ - TQDateTime dt = TQDateTime::fromString( txt, Qt::ISODate); - appendItem( group1, labelid, dt); -} - -bool KOfficePlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - KFileMetaInfoGroup group = appendGroup(info, DocumentInfo); - TQDomDocument doc = getMetaDocument(info.path()); - if (doc.isNull()) - return false; - TQDomElement base = getBaseNode(doc).toElement(); - if (base.isNull()) - return false; - for (int i = 0; Information[i]; i+=2) - appendItem(group, Information[i], - stringFromNode(base, Information[i])); - // Special case for keyword - TQDomNodeList keywordList = base.elementsByTagName( metakeyword ); - TQString allKeywords; - for (uint i = 0; i < keywordList.length(); i++){ - TQDomNode node = keywordList.item(i); - if (node.isElement()){ - if (i>0) - allKeywords += ", "; - allKeywords += node.toElement().text(); - } - } - appendItem(group, metakeyword, - allKeywords); - - KFileMetaInfoGroup group1 = appendGroup(info, DocAdvanced); - for (int i = 0; Advanced[i]; i+=2){ - TQString txt = stringFromNode(base, Advanced[i]); - if (!txt.isEmpty()){ - // A silly way to do it... - switch (i){ - case 2: - case 4: - case 6: - getDateTime(group1, Advanced[i], txt); - break; - case 14: - getEditingTime(group1, Advanced[i], txt); - break; - default: - appendItem(group1, Advanced[i], txt);} - } - } - - TQDomNode dstat = base.namedItem(metadocstat); - - KFileMetaInfoGroup group2 = appendGroup(info, DocStatistics); - if (!dstat.isNull() && dstat.isElement()){ - TQDomElement dinfo = dstat.toElement(); - for (int i = 0; Statistics[i]; i+=2) - addAttributeInfo(dinfo, group2, Statistics[i] ); - } - - - TQDomNodeList userList = base.elementsByTagName( metauserdef ); - - KFileMetaInfoGroup groupuser = appendGroup(info, UserDefined); - - for (uint i = 0; i < userList.length(); i++){ - TQDomNode node = userList.item(i); - if (node.isElement()){ - appendItem(groupuser, - node.toElement().attribute(metaname, - TQString("User %1").arg(i)), - node.toElement().text()); - } - } - return true; -} - -TQString KOfficePlugin::stringFromNode(const TQDomNode &node, const TQString &name) -{ - TQString value = node.namedItem(name).toElement().text(); - return value.isEmpty() ? TQString() : value; -} - -void KOfficePlugin::addAttributeInfo(const TQDomElement & elem, KFileMetaInfoGroup & group, const TQString &attributeName) -{ - if (!elem.hasAttribute(attributeName)){ - return; - } - TQString m_attribute = elem.attribute(attributeName, "0"); - if (m_attribute == "0") - return; - appendItem(group, attributeName, m_attribute); -} - -bool KOfficePlugin::writeTextNode(TQDomDocument & doc, - TQDomNode & parentNode, - const TQString &nodeName, - const TQString &value) const -{ - if (parentNode.toElement().isNull()){ - kdDebug(7034) << "Parent node is Null or not an Element, cannot write node " - << nodeName << endl; - return false; - } - - // If the node does not exist, we create it... - if (parentNode.namedItem(nodeName).isNull()) - TQDomNode ex = parentNode.appendChild(doc.createElement(nodeName)); - - // Now, we are sure we have a node - TQDomElement nodeA = parentNode.namedItem(nodeName).toElement(); - - // Ooops... existing node were not of the good type... - if (nodeA.isNull()){ - kdDebug(7034) << "Wrong type of node " << nodeName << ", should be Element" - << endl; - return false; - } - - TQDomText txtNode = doc.createTextNode(value); - - // If the node has already Text Child, we replace it. - if (nodeA.firstChild().isNull()) - nodeA.appendChild(txtNode); - else - nodeA.replaceChild( txtNode, nodeA.firstChild()); - return true; -} - -bool KOfficePlugin::writeInfo( const KFileMetaInfo& info) const -{ - bool no_errors = true; - TQDomDocument doc = getMetaDocument(info.path()); - TQDomElement base = getBaseNode(doc).toElement(); - if (base.isNull()) - return false; - for (int i = 0; Information[i]; i+=2) - no_errors = no_errors && - writeTextNode(doc, base, Information[i], - info[DocumentInfo][Information[i]].value().toString()); - // If we need a meta:keywords container, we create it. - if (base.namedItem(metakeywords).isNull()) - base.appendChild(doc.createElement(metakeywords)); - TQDomNode metaKeyNode = base.namedItem(metakeywords); - - TQDomNodeList childs = doc.elementsByTagName(metakeyword); - for (int i = childs.length(); i >= 0; --i){ - metaKeyNode.removeChild( childs.item(i) ); - } - TQStringList keywordList = TQStringList::split(",", info[DocumentInfo][metakeyword].value().toString().stripWhiteSpace(), false); - for ( TQStringList::Iterator it = keywordList.begin(); it != keywordList.end(); ++it ) { - TQDomElement elem = doc.createElement(metakeyword); - metaKeyNode.appendChild(elem); - elem.appendChild(doc.createTextNode((*it).stripWhiteSpace())); - } - - // Now, we store the user-defined data - TQDomNodeList theElements = base.elementsByTagName(metauserdef); - for (uint i = 0; i < theElements.length(); i++) - { - TQDomElement el = theElements.item(i).toElement(); - if (el.isNull()){ - kdDebug(7034) << metauserdef << " is not an Element" << endl; - no_errors = false; - } - - TQString s = info[UserDefined][el.attribute(metaname)].value().toString(); - if (s != el.text()){ - TQDomText txt = doc.createTextNode(s); - if (!el.firstChild().isNull()) - el.replaceChild(txt, el.firstChild()); - else - el.appendChild(txt); - } - } - - if (!no_errors){ - kdDebug(7034) << "Errors were found while building " << metafile - << " for file " << info.path() << endl; - // It is safer to avoid to manipulate meta.xml if errors, we abort. - return false; - } - writeMetaData(info.path(), doc); - return true; -} - -/** - * This function recreate a zip in dest with all files from src - * except meta.xml - */ -bool copyZipToZip( const KZip * src, KZip * dest) -{ - KArchiveDirectory * src_dir; - KArchiveFile * input_file; - TQPtrStack<KArchiveDirectory> src_dirStack ; - TQStringList dirEntries; - TQStringList curDirName; - TQStringList::Iterator it; - KArchiveEntry* curEntry; - TQString filename = TQString(); - - src_dirStack.push ( src->directory() ); - - do { - src_dir = src_dirStack.pop(); - curDirName.append(src_dir->name()); - dirEntries = src_dir->entries(); - - /* We now iterate over all entries and create entries in dest */ - for ( it = dirEntries.begin(); it != dirEntries.end(); ++it ) { - if ( *it == metafile ) - continue; - curEntry = src_dir->entry( *it ); - - if (curEntry->isFile()) { - input_file = dynamic_cast<KArchiveFile*>( curEntry ); - TQByteArray b = input_file->data(); - if (curDirName.isEmpty() || src_dir->name()=="/"){ - filename = *it; - } else { - filename = curDirName.join("/") + "/" + *it; - } - dest->writeFile(filename , TQString(), TQString(), b.count(), b.data() ); - } else - if (curEntry->isDirectory()) { - src_dirStack.push( dynamic_cast<KArchiveDirectory*>( curEntry ) ); - } - else { - kdDebug(7034) << *it << " is a unknown type. Aborting." << endl; - return false; - } - } - curDirName.pop_back(); - } while ( ! src_dirStack.isEmpty() ); - return true; -} - -bool KOfficePlugin::writeMetaData(const TQString & path, - const TQDomDocument &doc) const -{ - KTempFile tmp_file; - tmp_file.setAutoDelete(true); - KZip * m_zip = new KZip(tmp_file.name()); - KZip * current= new KZip(path); - /* To correct problem with OOo 1.1, we have to recreate the file from scratch */ - if (!m_zip->open(IO_WriteOnly) || !current->open(IO_ReadOnly) ) - return false; - TQCString text = doc.toCString(); - m_zip->setCompression(KZip::DeflateCompression); - if (!copyZipToZip(current, m_zip)) - return false; - m_zip->writeFile(metafile, TQString(), TQString(),text.length(), - text); - delete current; - delete m_zip; - // NULL as third parameter is not good, but I don't know the Window ID - // That is only to avoid the deprecated warning at compile time - if (!TDEIO::NetAccess::upload( tmp_file.name(), KURL(path), NULL)){ - kdDebug(7034) << "Error while saving " << tmp_file.name() << " as " << path << endl; - return false; - } - return true; -} - - -TQIODevice* KOfficePlugin::getData(KArchive &m_zip, int fileMode) const -{ - - if ( !m_zip.open(fileMode) || !m_zip.directory()) - return 0; - - const KArchiveEntry* entry = m_zip.directory()->entry( metafile ); - if (!entry || entry->isDirectory()) - return 0; - - const KZipFileEntry* f = static_cast<const KZipFileEntry *>(entry); - if (!f) - return 0; - return f->device(); -} - -TQDomDocument KOfficePlugin::getMetaDocument(const TQString &path) const -{ - TQDomDocument doc; - KZip m_zip(path); - TQIODevice * io = getData(m_zip, IO_ReadOnly); - if (!io || !io->isReadable()) - return doc; - TQString errorMsg; - int errorLine, errorColumn; - if ( !doc.setContent( io, &errorMsg, &errorLine, &errorColumn ) ){ - kdDebug(7034) << "Error " << errorMsg.latin1() - << "while getting XML content at line " - << errorLine << ", column "<< errorColumn << endl; - delete io; - return doc; - } - delete io; - return doc; -} - -TQDomNode KOfficePlugin::getBaseNode(const TQDomDocument &doc) const -{ - return - doc.namedItem("office:document-meta").namedItem("office:meta"); -} - -TQValidator * KOfficePlugin::createValidator(const TQString &, /* mimetype */ - const TQString & , /* group */ - const TQString &key, - TQObject * parent, - const char * name ) const -{ - if (key == dclanguage) - return new TQRegExpValidator(TQRegExp("[a-zA-Z-]{1,5}"), - parent, name); - return 0; -} - -#include "kfile_ooo.moc" diff --git a/tools/kfile-plugins/ooo/kfile_ooo.desktop b/tools/kfile-plugins/ooo/kfile_ooo.desktop deleted file mode 100644 index 99039aa9..00000000 --- a/tools/kfile-plugins/ooo/kfile_ooo.desktop +++ /dev/null @@ -1,57 +0,0 @@ -[Desktop Entry] -Type=Service -Name=OpenOffice.org Info -Name[bg]=Информация за OpenOffice.org -Name[br]=Titouriñ diwar-benn OpenOffice.org -Name[ca]=Informació OpenOffice.org -Name[cs]=OpenOffice.org info -Name[cy]=Gwybodaeth OpenOffice.org -Name[el]=Πληροφορίες OpenOffice.org -Name[eo]=OpenOffice.org informo -Name[es]=Información de OpenOffice.org -Name[et]=OpenOffice.org-i info -Name[eu]=OpenOffice.org-en informazioa -Name[fa]=اطلاعات OpenOffice.org -Name[fi]=OpenOffice.org-tiedot -Name[fr]=Informations sur OpenOffice.org -Name[fy]=OpenOffice.org ynfo -Name[ga]=Eolas faoi OpenOffice.org -Name[gl]=Información de OpenOffice.org -Name[he]=מידע OpenOffice.org -Name[hi]=स्टारआफिस.ऑर्ग जानकारी -Name[hu]=OpenOffice.org-információ -Name[is]=OpenOffice.org upplýsingar -Name[it]=Informazioni OpenOffice.org -Name[ja]=OpenOffice.org 情報 -Name[km]=ព័ត៌មាន OpenOffice.org -Name[lt]=OpenOffice.org informacija -Name[lv]=OpenOffice.org informācija -Name[ms]=Maklumat OpenOffice.org -Name[nb]=OpenOffice.org-info -Name[nds]=OpenOffice.org-Info -Name[ne]=ओपनअफिस डट अर्ग इन्फो -Name[nl]=OpenOffice.org Informatie -Name[nn]=OpenOffice.org-info -Name[pa]=OpenOffice.org ਜਾਣਕਾਰੀ -Name[pl]=Informacje o OpenOffice.org -Name[pt]=Informação do OpenOffice.org -Name[pt_BR]=Informações do OpenOffice.org -Name[ru]=Информация OpenOffice.org -Name[se]=OpenOffice.org-dieđut -Name[sk]=Informácie o OpenOffice.org -Name[sl]=Informacije o OpenOffice.org -Name[sr]=Информације OpenOffice.org-а -Name[sr@Latn]=Informacije OpenOffice.org-a -Name[sv]=Information om OpenOffice.org -Name[tg]=OpenOffice.org Ахборот -Name[uk]=Інформація про OpenOffice.org -Name[uz]=OpenOffice.org maʼlumot -Name[uz@cyrillic]=OpenOffice.org маълумот -Name[wa]=Informåcion OpenOffice.org -Name[zh_CN]=OpenOffice.org 信息 -Name[zh_TW]=OpenOffice.org 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_ooo -MimeType=application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.global;application/vnd.sun.xml.writer.math;application/vnd.sun.xml.writer.template;application/vnd.oasis.opendocument.chart;application/vnd.oasis.opendocument.formula;application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-template;application/vnd.oasis.opendocument.image;application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-template;application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template -PreferredGroups=DocumentInfo -PreferredItems=Author,Title,Abstract diff --git a/tools/kfile-plugins/ooo/kfile_ooo.h b/tools/kfile-plugins/ooo/kfile_ooo.h deleted file mode 100644 index e9cea14d..00000000 --- a/tools/kfile-plugins/ooo/kfile_ooo.h +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Pierre Souchay <[email protected]> - * - * 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_OOO_H__ -#define __KFILE_OOO_H__ - -#include <kfilemetainfo.h> -#include <tqiodevice.h> -#include <tqdom.h> -#include <karchive.h> -class TQStringList; -class TQDomNode; -class TQDomElement; - -class KOfficePlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - /** - * Constructor */ - KOfficePlugin( TQObject *parent, const char *name, const TQStringList& args ); - /** - * Read informations from files and store info in KFileMetaInfo. - * We currently only parse meta.xml in OOo files. - * @param info informations to modify about current file - * @param what What kind of parsing is needed ? - */ - virtual bool readInfo( KFileMetaInfo& info, uint what); - /** - * Write modified informations in meta.xml - * @param info Informations modified - */ - virtual bool writeInfo( const KFileMetaInfo& info) const; - /** - * We need a validator, for the langage - */ - virtual TQValidator* createValidator( const TQString& mimetype, - const TQString &group, - const TQString &key, - TQObject* parent, - const char* name) const; -private: - bool writeTextNode(TQDomDocument & doc, - TQDomNode & parentNode, - const TQString &nodeName, - const TQString &value) const; - KFileMimeTypeInfo::GroupInfo* userdefined; - void addAttributeInfo(const TQDomElement & elem, KFileMetaInfoGroup & group, - const TQString &attributeName); - TQIODevice* getData(KArchive &m_zip, int fileMode) const; - bool writeMetaData(const TQString & path, const TQDomDocument &doc) const; - TQDomDocument getMetaDocument(const TQString &path) const; - TQDomNode getBaseNode(const TQDomDocument &doc) const; - void makeMimeTypeInfo(const TQString& mimeType); - TQString stringFromNode(const TQDomNode &node, const TQString &name); - void getEditingTime(KFileMetaInfoGroup group1, const char *, TQString & txt); - void getDateTime(KFileMetaInfoGroup group1, const char *, TQString & txt); -}; - -#endif |