diff options
Diffstat (limited to 'kfile-plugins')
-rw-r--r-- | kfile-plugins/Makefile.am | 1 | ||||
-rw-r--r-- | kfile-plugins/deb/Makefile.am | 22 | ||||
-rw-r--r-- | kfile-plugins/deb/kfile_deb.cpp | 130 | ||||
-rw-r--r-- | kfile-plugins/deb/kfile_deb.desktop | 69 | ||||
-rw-r--r-- | kfile-plugins/deb/kfile_deb.h | 39 | ||||
-rw-r--r-- | kfile-plugins/rpm/Makefile.am | 22 | ||||
-rw-r--r-- | kfile-plugins/rpm/kfile_rpm.cpp | 152 | ||||
-rw-r--r-- | kfile-plugins/rpm/kfile_rpm.desktop | 69 | ||||
-rw-r--r-- | kfile-plugins/rpm/kfile_rpm.h | 54 |
9 files changed, 0 insertions, 558 deletions
diff --git a/kfile-plugins/Makefile.am b/kfile-plugins/Makefile.am deleted file mode 100644 index f46ebe3..0000000 --- a/kfile-plugins/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS=rpm deb diff --git a/kfile-plugins/deb/Makefile.am b/kfile-plugins/deb/Makefile.am deleted file mode 100644 index 65e69c3..0000000 --- a/kfile-plugins/deb/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for deb 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 = kfile_deb.h - -kde_module_LTLIBRARIES = kfile_deb.la - -kfile_deb_la_SOURCES = kfile_deb.cpp -kfile_deb_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_deb_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp *.h -o $(podir)/kfile_deb.pot - -services_DATA = kfile_deb.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/deb/kfile_deb.cpp b/kfile-plugins/deb/kfile_deb.cpp deleted file mode 100644 index b2ca328..0000000 --- a/kfile-plugins/deb/kfile_deb.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Laurence Anderson <l.d.anderson@warwick.ac.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 <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> -#include <tqbuffer.h> -#include <kfilterdev.h> -#include <tqregexp.h> -#include <karchive.h> -#include <ktar.h> -#include <kar.h> - -#include "kfile_deb.h" - -typedef KGenericFactory<KDebPlugin> DebFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_deb, DebFactory( "kfile_deb" )) - -KDebPlugin::KDebPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-deb" ); - KFileMimeTypeInfo::GroupInfo* group = 0L; - group = addGroupInfo(info, "General", i18n("General")); - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); - item = addItemInfo(group, "Summary", i18n("Summary"), TQVariant::String); - item = addItemInfo(group, "Size", i18n("Size"), TQVariant::Int); -} - -bool KDebPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - KAr debfile (info.path()); - - if ( !debfile.open( IO_ReadOnly ) ) { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - const KArchiveDirectory* debdir = debfile.directory(); - const KArchiveEntry* controlentry = debdir->entry( "control.tar.gz" ); - if ( !controlentry || !controlentry->isFile() ) { - kdWarning(7034) << "control.tar.gz not found" << endl; - return false; - } - - TQIODevice* filterDev = KFilterDev::device( static_cast<const KArchiveFile *>( controlentry )->device(), "application/x-gzip" ); - if ( !filterDev ) { - kdWarning(7034) << "Couldn't create filter device for control.tar.gz" << endl; - return false; - } - KTar tarfile( filterDev ); - - if ( !tarfile.open( IO_ReadOnly ) ) { - kdWarning(7034) << "Couldn't open control.tar.gz" << endl; - return false; - } - - const KArchiveDirectory* controldir = tarfile.directory(); - Q_ASSERT( controldir ); - - const KArchiveEntry* controlfile = controldir->entry( "control" ); - - Q_ASSERT( controlfile ); - if (controlfile) { - KFileMetaInfoGroup group = appendGroup(info, "General"); - TQByteArray control( static_cast<const KArchiveFile *>(controlfile)->data() ); - - // Now process control array - TQBuffer controldev(control); - controldev.open( IO_ReadOnly ); - while (!controldev.atEnd()) { - char linebuf[100]; - controldev.readLine(linebuf, sizeof( linebuf )); - TQString line(linebuf); - int fieldstart = line.find(TQRegExp(":"), 0) + 2; - if (fieldstart == 1) break; - TQString fieldname = line.mid(0, fieldstart - 2); - TQString fielddata = line.mid(fieldstart, line.length() - fieldstart - 1); - - if (fieldname == "Package") appendItem(group, "Name", fielddata); - else if (fieldname == "Version") appendItem(group, "Version", fielddata); - else if (fieldname == "Description") appendItem(group, "Summary", fielddata); - else if (fieldname == "Installed-Size") appendItem(group, "Size", int(fielddata.toInt())); - - kdDebug(7034) << "Name: [" << fieldname << "] Data: [" << fielddata << "]" << endl; - } - } else { - kdDebug(7034) << "Couldn't read control file" << endl; - return false; - } - - tarfile.close(); - debfile.close(); - - return true; -} - -#include "kfile_deb.moc" diff --git a/kfile-plugins/deb/kfile_deb.desktop b/kfile-plugins/deb/kfile_deb.desktop deleted file mode 100644 index 255baaf..0000000 --- a/kfile-plugins/deb/kfile_deb.desktop +++ /dev/null @@ -1,69 +0,0 @@ -[Desktop Entry] -Type=Service -Name=DEB Stats -Name[af]=Deb Statistiek -Name[ar]=إحصائيَات DEB -Name[az]=DEB Statistikaları -Name[be]=Cтатыстыка DEB -Name[bn]=ডেব পরিসংখ্যান -Name[br]=Stadegoù gant DEB -Name[bs]=DEB statistika -Name[ca]=L'estat dels DEB -Name[cs]=DEB statistiky -Name[cy]=Ystadegau DEB -Name[da]=DEB-stats -Name[el]=Στατιστικά DEB -Name[eo]=DEB statistikoj -Name[es]=Estadísticas DEB -Name[et]=DEB statistika -Name[eu]=DEB estadistikak -Name[fa]=آمار DEB -Name[fi]=DEB-tilastot -Name[fo]=DEB-hagtøl -Name[fr]=État DEB -Name[ga]=Staitistic DEB -Name[gl]=Estatísticas DEB -Name[he]=סטטיסטיקת DEB -Name[hi]=डीईबी स्टेट्स -Name[hr]=DEB statistike -Name[hu]=DEB-statisztika -Name[it]=Statistiche DEB -Name[ka]=DEB სტატისტიკა -Name[kk]=DEB статистикасы -Name[km]=សភាព DEB -Name[ko]=DEB 상태 -Name[lt]=DEB statistika -Name[lv]=DEB Statusi -Name[mn]=ДЕВ Төлөв -Name[mt]=Statistika DEB -Name[nb]=DEB statistikk -Name[ne]=डीईबी तथ्याङ्क -Name[nl]=DEB-statistieken -Name[nn]=DEB-statistikk -Name[pa]=DEB ਸਥਿਤੀ -Name[pl]=Dane pakietów DEB -Name[pt]=Informações de DEBs -Name[pt_BR]=Estados DEB -Name[ro]=Statistici DEB -Name[ru]=Статистика DEB -Name[se]=DEB-statistihkka -Name[sk]=Štatistiky DEB -Name[sl]=Statistike DEB -Name[sr]=DEB Статистике -Name[sr@Latn]=DEB Statistike -Name[sv]=DEB-statistik -Name[ta]=DEB புள்ளி விவரம் -Name[tg]=Статистикаи DEB -Name[th]=สถิติของ DEB -Name[tr]=DEB İstatistikleri -Name[uk]=Дані DEB -Name[ven]=Mbalo dza DEB -Name[vi]=Thống kê DEB -Name[wa]=Sitatistikes DEB -Name[zh_CN]=DEB 统计 -Name[zh_HK]=DEB 統計 -Name[zh_TW]=DEB 統計 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_deb -MimeType=application/x-deb -PreferredItems=Name,Version,Summary,Size diff --git a/kfile-plugins/deb/kfile_deb.h b/kfile-plugins/deb/kfile_deb.h deleted file mode 100644 index 48446e0..0000000 --- a/kfile-plugins/deb/kfile_deb.h +++ /dev/null @@ -1,39 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Laurence Anderson <l.d.anderson@warwick.ac.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_DEB_H__ -#define __KFILE_DEB_H__ - -#include <kfilemetainfo.h> - -class TQStringList; - -class KDebPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KDebPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -}; - -#endif diff --git a/kfile-plugins/rpm/Makefile.am b/kfile-plugins/rpm/Makefile.am deleted file mode 100644 index db4e8cc..0000000 --- a/kfile-plugins/rpm/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for rpm 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 = kfile_rpm.h - -kde_module_LTLIBRARIES = kfile_rpm.la - -kfile_rpm_la_SOURCES = kfile_rpm.cpp -kfile_rpm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_rpm_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp *.h -o $(podir)/kfile_rpm.pot - -services_DATA = kfile_rpm.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/rpm/kfile_rpm.cpp b/kfile-plugins/rpm/kfile_rpm.cpp deleted file mode 100644 index 39ef9c1..0000000 --- a/kfile-plugins/rpm/kfile_rpm.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Laurence Anderson <l.d.anderson@warwick.ac.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 <kgenericfactory.h> -#include <kdebug.h> -#include <tqfile.h> - -#if !defined(__osf__) -#include <inttypes.h> -#else -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -#endif - -#include "kfile_rpm.h" - -typedef KGenericFactory<KRpmPlugin> RpmFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_rpm, RpmFactory( "kfile_rpm" )) - -KRpmPlugin::KRpmPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-rpm" ); - KFileMimeTypeInfo::GroupInfo* group = 0L; - group = addGroupInfo(info, "General", i18n("General")); - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String); - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::String); - item = addItemInfo(group, "Release", i18n("Release"), TQVariant::Int); - item = addItemInfo(group, "Summary", i18n("Summary"), TQVariant::String); - setAttributes ( item, KFileMimeTypeInfo::Description ); - item = addItemInfo(group, "Group", i18n("Group"), TQVariant::String); - item = addItemInfo(group, "Size", i18n("Size"), TQVariant::Int); - setUnit ( item, KFileMimeTypeInfo::Bytes ); - item = addItemInfo(group, "Vendor", i18n("Vendor"), TQVariant::String ); - item = addItemInfo(group, "Packager", i18n("Packager"), TQVariant::String ); - item = addItemInfo(group, "Archive Offset", i18n("Archive Offset"), TQVariant::Int); - item = addItemInfo(group, "Comment", i18n("Comment"), TQVariant::String); - setAttributes( item, KFileMimeTypeInfo::MultiLine ); - - group = addGroupInfo(info, "All tags", i18n("All tags")); - addVariableInfo(group, TQVariant::String, 0); -} - -bool KRpmPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - TQFile file(info.path()); - int pass; - KFileMetaInfoGroup general, all; - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream dstream(&file); - dstream.setByteOrder(TQDataStream::BigEndian); - general = appendGroup(info, "General"); - if (what == KFileMetaInfo::Everything) all = appendGroup(info, "All tags"); - - file.at(96); // Seek past old lead - - for (pass = 0; pass < 2; pass++) { // RPMs have two headers - uint32_t storepos, entries, size, reserved; - unsigned char version; - char magic[3]; - - dstream.readRawBytes(magic, 3); - dstream >> version >> reserved >> entries >> size; - if (memcmp(magic, RPM_HEADER_MAGIC, 3)) return false; - if (version != 1) return false; // Only v1 headers supported - - storepos = file.at() + entries * 16; - if (pass == 0) { // Don't need the first batch of tags - pgp etc - file.at(storepos + size); - file.at(file.at() + (8 - (file.at() % 8)) % 8); // Skip padding - continue; - } - - if (entries < 500) while (entries--) { // Just in case something goes wrong, limit to 500 - uint32_t tag, type, offset, count; - TQString tagname; - dstream >> tag >> type >> offset >> count; - offset += storepos; - - switch (tag) { - case RPMTAG_NAME: tagname = "Name"; break; - case RPMTAG_VERSION: tagname = "Version"; break; - case RPMTAG_SUMMARY: tagname = "Summary"; break; - case RPMTAG_GROUP: tagname = "Group"; break; - case RPMTAG_SIZE: tagname = "Size"; break; - case RPMTAG_RELEASE: tagname = "Release"; break; - case RPMTAG_VENDOR: tagname = "Vendor"; break; - case RPMTAG_PACKAGER: tagname = "Packager"; break; - case RPMTAG_DESCRIPTION: tagname = "Comment"; break; - } - - if ( !tagname.isEmpty() || all.isValid() ) { - // kdDebug(7034) << "Tag number: " << tag << " Type: " << type << endl; - int oldPos = file.at(); - file.at(offset); // Set file position to correct place in store - switch (type) { - case RPM_INT32_TYPE: uint32_t int32tag; - dstream >> int32tag; - if ( !tagname.isEmpty() ) appendItem(general, tagname, int(int32tag)); - if ( all.isValid() ) appendItem(all, TQString("%1").arg( tag ), TQString("%1").arg( int32tag )); - break; - case RPM_INT16_TYPE: uint16_t int16tag; - dstream >> int16tag; - if ( !tagname.isEmpty() ) appendItem(general, tagname, int(int16tag)); - if ( all.isValid() ) appendItem(all, TQString("%1").arg( tag ), TQString("%1").arg( int16tag )); - break; - case RPM_I18NSTRING_TYPE: // Fallthru - case RPM_STRING_TYPE: TQString strtag; char in; - while ( ( in = file.getch() ) != '\0' ) strtag += in; - if ( !tagname.isEmpty() ) appendItem(general, tagname, strtag); - if( all.isValid() ) appendItem(all, TQString("%1").arg( tag ), strtag); - break; - } - file.at(oldPos); // Restore old position - } - } - appendItem(general, "Archive Offset", (storepos + size) ); - } - - return true; -} - -#include "kfile_rpm.moc" diff --git a/kfile-plugins/rpm/kfile_rpm.desktop b/kfile-plugins/rpm/kfile_rpm.desktop deleted file mode 100644 index 5bc63bf..0000000 --- a/kfile-plugins/rpm/kfile_rpm.desktop +++ /dev/null @@ -1,69 +0,0 @@ -[Desktop Entry] -Type=Service -Name=RPM Stats -Name[af]=Rpm Statistiek -Name[ar]=إحصائيَات RPM -Name[az]=RPM Statistikaları -Name[be]=Статыстыка RPM -Name[bn]=আরপিএম পরিসংখ্যান -Name[br]=Stadegoù gant RPM -Name[bs]=RPM statistika -Name[ca]=L'estat dels RPM -Name[cs]=RPM statistiky -Name[cy]=Ystadegau RPM -Name[da]=RPM-stats -Name[el]=Στατιστικά RPM -Name[eo]=RPM statistikoj -Name[es]=Estadísticas RPM -Name[et]=RPM statistika -Name[eu]=RPM estadistikak -Name[fa]=آمار RPM -Name[fi]=RPM-tilastot -Name[fo]=RPM-hagtøl -Name[fr]=État RPM -Name[ga]=Staitistic RPM -Name[gl]=Estatísticas RPM -Name[he]=סטטיסטיקת RPM -Name[hi]=आरपीएम स्टेट्स -Name[hr]=RPM statistike -Name[hu]=RPM-információ -Name[it]=Statistiche RPM -Name[ka]=RPM სტატისტიკა -Name[kk]=RPM статистикасы -Name[km]=សភាព RPM -Name[ko]=RPM 상태 -Name[lt]=RPM statistika -Name[lv]=RPM Statusi -Name[mn]=РПМ Төлөв -Name[mt]=Statistika RPM -Name[nb]=RPM statistikk -Name[ne]=आरपीएम तथ्याङ्क -Name[nl]=RPM-statistieken -Name[nn]=RPM-statistikk -Name[pa]=RPM ਸਥਿਤੀ -Name[pl]=Dane plików RPM -Name[pt]=Informações de RPMs -Name[pt_BR]=Estados do RPM -Name[ro]=Statistici RPM -Name[ru]=Статистика RPM -Name[se]=RPM-statistihkka -Name[sk]=Štatistiky RPM -Name[sl]=Statistike RPM -Name[sr]=RPM Статистике -Name[sr@Latn]=RPM Statistike -Name[sv]=RPM-statistik -Name[ta]=RPM புள்ளி விவரம் -Name[tg]=Статистикаи RPM -Name[th]=สถิติของ RPM -Name[tr]=RPM İstatistikleri -Name[uk]=Дані RPM -Name[ven]=Mbalo dza RPM -Name[vi]=Thống kê RPM -Name[wa]=Sitatistikes RPM -Name[zh_CN]=RPM 统计 -Name[zh_HK]=RPM 統計 -Name[zh_TW]=RPM 統計 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_rpm -MimeType=application/x-rpm -PreferredItems=Name,Version,Summary,Group,Size diff --git a/kfile-plugins/rpm/kfile_rpm.h b/kfile-plugins/rpm/kfile_rpm.h deleted file mode 100644 index bf884c5..0000000 --- a/kfile-plugins/rpm/kfile_rpm.h +++ /dev/null @@ -1,54 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Laurence Anderson <l.d.anderson@warwick.ac.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_RPM_H__ -#define __KFILE_RPM_H__ - -#include <kfilemetainfo.h> - -class TQStringList; - -class KRpmPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KRpmPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -}; - -#define RPM_HEADER_MAGIC "\216\255\350" -#define RPMTAG_NAME 1000 -#define RPMTAG_VERSION 1001 -#define RPMTAG_RELEASE 1002 -#define RPMTAG_SUMMARY 1004 -#define RPMTAG_DESCRIPTION 1005 -#define RPMTAG_SIZE 1009 -#define RPMTAG_VENDOR 1011 -#define RPMTAG_PACKAGER 1015 -#define RPMTAG_GROUP 1016 -#define RPM_INT16_TYPE 3 -#define RPM_INT32_TYPE 4 -#define RPM_STRING_TYPE 6 -#define RPM_I18NSTRING_TYPE 9 - -#endif |