summaryrefslogtreecommitdiffstats
path: root/tdefile-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tdefile-plugins')
-rw-r--r--tdefile-plugins/Makefile.am5
-rw-r--r--tdefile-plugins/RETURNED_ITEMS28
-rw-r--r--tdefile-plugins/cert/Makefile.am22
-rw-r--r--tdefile-plugins/cert/configure.in.in2
-rw-r--r--tdefile-plugins/cert/tdefile_cert.cpp161
-rw-r--r--tdefile-plugins/cert/tdefile_cert.desktop60
-rw-r--r--tdefile-plugins/cert/tdefile_cert.h43
-rw-r--r--tdefile-plugins/desktop/Makefile.am22
-rw-r--r--tdefile-plugins/desktop/tdefile_desktop.cpp128
-rw-r--r--tdefile-plugins/desktop/tdefile_desktop.desktop68
-rw-r--r--tdefile-plugins/desktop/tdefile_desktop.h40
-rw-r--r--tdefile-plugins/folder/Makefile.am21
-rw-r--r--tdefile-plugins/folder/tdefile_folder.cpp86
-rw-r--r--tdefile-plugins/folder/tdefile_folder.desktop70
-rw-r--r--tdefile-plugins/folder/tdefile_folder.h38
-rw-r--r--tdefile-plugins/html/Makefile.am22
-rw-r--r--tdefile-plugins/html/tdefile_html.cpp158
-rw-r--r--tdefile-plugins/html/tdefile_html.desktop66
-rw-r--r--tdefile-plugins/html/tdefile_html.h39
-rw-r--r--tdefile-plugins/lnk/Makefile.am34
-rw-r--r--tdefile-plugins/lnk/README29
-rw-r--r--tdefile-plugins/lnk/lnkforward.cpp130
-rw-r--r--tdefile-plugins/lnk/lnkforward.desktop114
-rw-r--r--tdefile-plugins/lnk/lnkforward.h43
-rw-r--r--tdefile-plugins/lnk/read_lnk.cpp227
-rw-r--r--tdefile-plugins/lnk/read_lnk.h46
-rw-r--r--tdefile-plugins/lnk/tdefile_lnk.cpp93
-rw-r--r--tdefile-plugins/lnk/tdefile_lnk.desktop62
-rw-r--r--tdefile-plugins/lnk/tdefile_lnk.h47
-rw-r--r--tdefile-plugins/lnk/x-win-lnk.desktop61
-rw-r--r--tdefile-plugins/mhtml/Makefile.am21
-rw-r--r--tdefile-plugins/mhtml/tdefile_mhtml.cpp201
-rw-r--r--tdefile-plugins/mhtml/tdefile_mhtml.desktop60
-rw-r--r--tdefile-plugins/mhtml/tdefile_mhtml.h46
-rw-r--r--tdefile-plugins/txt/Makefile.am21
-rw-r--r--tdefile-plugins/txt/tdefile_txt.cpp129
-rw-r--r--tdefile-plugins/txt/tdefile_txt.desktop70
-rw-r--r--tdefile-plugins/txt/tdefile_txt.h40
38 files changed, 2553 insertions, 0 deletions
diff --git a/tdefile-plugins/Makefile.am b/tdefile-plugins/Makefile.am
new file mode 100644
index 0000000..f62e59b
--- /dev/null
+++ b/tdefile-plugins/Makefile.am
@@ -0,0 +1,5 @@
+if include_tdefileplugin_cert_SUBDIR
+CERT_SUBDIR=cert
+endif
+
+SUBDIRS=txt html desktop folder lnk $(CERT_SUBDIR) mhtml
diff --git a/tdefile-plugins/RETURNED_ITEMS b/tdefile-plugins/RETURNED_ITEMS
new file mode 100644
index 0000000..642a6b2
--- /dev/null
+++ b/tdefile-plugins/RETURNED_ITEMS
@@ -0,0 +1,28 @@
+If you make a new plugin, please add the list of returned items to this list.
+
+tdefile_txt
+=========
+int Characters
+int Words
+int Lines
+QString Format (Unix/DOS/Macintosh)
+
+tdefile_folder
+============
+int items
+QString size (as a string to display bytes, kB, MB, etc)
+
+tdefile_lnk
+============
+int Size of target
+QString Location
+QString Points to
+QString Description
+
+tdefile_mhtml
+===========
+QString Sender
+QString Recipient
+QString CopyTo (The CC: field)
+QString Subject
+QString Date
diff --git a/tdefile-plugins/cert/Makefile.am b/tdefile-plugins/cert/Makefile.am
new file mode 100644
index 0000000..ff679f5
--- /dev/null
+++ b/tdefile-plugins/cert/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am for cert 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_cert.h
+
+kde_module_LTLIBRARIES = tdefile_cert.la
+
+tdefile_cert_la_SOURCES = tdefile_cert.cpp
+tdefile_cert_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_cert_la_LIBADD = $(LIB_KSYCOCA)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) tdefile_cert.cpp -o $(podir)/tdefile_cert.pot
+
+services_DATA = tdefile_cert.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdefile-plugins/cert/configure.in.in b/tdefile-plugins/cert/configure.in.in
new file mode 100644
index 0000000..5c78161
--- /dev/null
+++ b/tdefile-plugins/cert/configure.in.in
@@ -0,0 +1,2 @@
+KDE_CHECK_SSL
+AM_CONDITIONAL(include_tdefileplugin_cert_SUBDIR, test "$have_ssl" = yes)
diff --git a/tdefile-plugins/cert/tdefile_cert.cpp b/tdefile-plugins/cert/tdefile_cert.cpp
new file mode 100644
index 0000000..7f68023
--- /dev/null
+++ b/tdefile-plugins/cert/tdefile_cert.cpp
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Leonid Zeitlin *
+ * lz@europe.com *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include <config.h>
+#include "tdefile_cert.h"
+
+#include <kgenericfactory.h>
+#include <ksslcertificate.h>
+#include <ksslx509map.h>
+#include <kopenssl.h>
+//#include <kstandarddirs.h>
+//#include <kdebug.h>
+//#include <tdeio/global.h>
+
+#include <tqdatetime.h>
+#include <tqfile.h>
+#include <tqcstring.h>
+//#include <tqfileinfo.h>
+//#include <tqdir.h>
+
+typedef KGenericFactory<CertPlugin> CertFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_cert, CertFactory("tdefile-cert"))
+
+CertPlugin::CertPlugin(TQObject *parent, const char *name, const TQStringList &args)
+ : KFilePlugin(parent, name, args)
+{
+ //add the mimetype here - example:
+ //KFileMimeTypeInfo* info = addMimeTypeInfo( "text/html" );
+ KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-x509-ca-cert" );
+
+ // our new group
+ KFileMimeTypeInfo::GroupInfo* group = 0L;
+ KFileMimeTypeInfo::ItemInfo* item;
+
+ group = addGroupInfo(info, "certInfo", i18n("Certificate Information"));
+ item = addItemInfo(group, "ValidFrom", i18n("Valid From"), TQVariant::DateTime);
+ item = addItemInfo(group, "ValidUntil", i18n("Valid Until"), TQVariant::DateTime);
+ item = addItemInfo(group, "State", i18n("State"), TQVariant::String);
+ item = addItemInfo(group, "SerialNo", i18n("Serial Number"), TQVariant::String);
+
+ group = addGroupInfo(info, "certSubjectInfo", i18n("Subject"));
+ item = addItemInfo(group, "O", i18n("Organization"), TQVariant::String);
+ item = addItemInfo(group, "OU", i18n("Organizational Unit"), TQVariant::String);
+ item = addItemInfo(group, "L", i18n("Locality"), TQVariant::String);
+ item = addItemInfo(group, "C", i18n("Country"), TQVariant::String);
+ item = addItemInfo(group, "CN", i18n("Common Name"), TQVariant::String);
+ item = addItemInfo(group, "E", i18n("Email"), TQVariant::String);
+
+ group = addGroupInfo(info, "certIssuerInfo", i18n("Issuer"));
+ item = addItemInfo(group, "O", i18n("Organization"), TQVariant::String);
+ item = addItemInfo(group, "OU", i18n("Organizational Unit"), TQVariant::String);
+ item = addItemInfo(group, "L", i18n("Locality"), TQVariant::String);
+ item = addItemInfo(group, "C", i18n("Country"), TQVariant::String);
+ item = addItemInfo(group, "CN", i18n("Common Name"), TQVariant::String);
+ item = addItemInfo(group, "E", i18n("Email"), TQVariant::String);
+
+ //setUnit(item, KFileMimeTypeInfo::KiloBytes);
+
+ // strings are possible, too:
+ //addItemInfo(group, "Text", i18n("Document Type"), TQVariant::String);
+}
+
+void CertPlugin::appendDNItems(KFileMetaInfoGroup &group, const TQString &DN)
+{
+ KSSLX509Map map(DN);
+ TQString value;
+ //TQString dbg;
+ TQStringList keys = group.supportedKeys();
+ TQStringList::ConstIterator end = keys.end();
+ for (TQStringList::ConstIterator it = keys.begin(); it != end; ++it) {
+ value = map.getValue(*it);
+ //dbg += *it + " = " + value + "; ";
+ if (!value.isNull()) appendItem(group, *it, value);
+ //appendItem(group, "CN", dbg);
+ }
+}
+
+static KSSLCertificate *readCertFromFile(const TQString &path)
+{
+ KSSLCertificate *ret = NULL;
+
+ TQFile file(path);
+ if (!file.open(IO_ReadOnly)) return NULL;
+ TQByteArray file_data = file.readAll();
+ file.close();
+
+ TQCString file_string = TQCString(file_data.data(), file_data.size());
+ // try as is:
+ ret = KSSLCertificate::fromString(file_string);
+ if (ret) return ret;
+ // didn't work. Let's see if begin/end lines are there:
+ KOSSL::self()->ERR_clear_error();
+ const char *begin_line = "-----BEGIN CERTIFICATE-----\n";
+ const char *end_line = "\n-----END CERTIFICATE-----";
+ int begin_pos = file_string.find(begin_line);
+ if (begin_pos >= 0) {
+ begin_pos += strlen(begin_line);
+ int end_pos = file_string.find(end_line, begin_pos);
+ if (end_pos >= 0) {
+ // read the data between begin and end lines
+ TQCString body = file_string.mid(begin_pos, end_pos - begin_pos);
+ ret = KSSLCertificate::fromString(body);
+ return ret; // even if it's NULL, we can't help it
+ }
+ }
+ // still didn't work. Assume the file was in DER (binary) encoding
+ unsigned char *p = (unsigned char*) file_data.data();
+ KOSSL::self()->ERR_clear_error();
+ X509 *x = KOSSL::self()->d2i_X509(NULL, &p, file_data.size());
+ if (x) {
+ ret = KSSLCertificate::fromX509(x);
+ KOSSL::self()->X509_free(x);
+ return ret;
+ }
+ else return NULL;
+}
+
+bool CertPlugin::readInfo(KFileMetaInfo& info, uint /*what*/)
+{
+ KSSLCertificate *cert = readCertFromFile(info.path());
+ if (cert) {
+ KFileMetaInfoGroup group = appendGroup(info, "certInfo");
+ appendItem(group, "ValidFrom", cert->getQDTNotBefore());
+ appendItem(group, "ValidUntil", cert->getQDTNotAfter());
+ appendItem(group, "State", KSSLCertificate::verifyText(cert->validate()));
+ appendItem(group, "SerialNo", cert->getSerialNumber());
+
+ group = appendGroup(info, "certSubjectInfo");
+ appendDNItems(group, cert->getSubject());
+
+ group = appendGroup(info, "certIssuerInfo");
+ appendDNItems(group, cert->getIssuer());
+
+ delete cert;
+ return true;
+ }
+ else {
+ KOSSL::self()->ERR_clear_error(); // don't leave errors behind
+ return false;
+ }
+}
+
+#include "tdefile_cert.moc"
diff --git a/tdefile-plugins/cert/tdefile_cert.desktop b/tdefile-plugins/cert/tdefile_cert.desktop
new file mode 100644
index 0000000..3e589b8
--- /dev/null
+++ b/tdefile-plugins/cert/tdefile_cert.desktop
@@ -0,0 +1,60 @@
+[Desktop Entry]
+Type=Service
+Name=Certificate Info
+Name[bg]=Информация за удостоверение
+Name[br]=Titouroù diwar-benn an testeni
+Name[ca]=Informació del certificat
+Name[cs]=Informace o certifikátu
+Name[da]=Information om certifikat
+Name[de]=Information zum Zertifikat
+Name[el]=Πληροφορίες πιστοποιητικού
+Name[eo]=Atesta informo
+Name[es]=Información del certificado
+Name[et]=Sertifikaadi info
+Name[eu]=Ziurtagiriaren informazioa
+Name[fa]=اطلاعات گواهی‌نامه
+Name[fi]=Sertifikaatin tiedot
+Name[fr]=Informations sur le certificat
+Name[fy]=Sertifikaatynformaasje
+Name[ga]=Eolas faoin Teastas
+Name[gl]=Informacións do Certificado
+Name[hi]=प्रमाणपत्र जानकारी
+Name[hr]=Podaci potvrde
+Name[hu]=Tanúsítvány-jellemzők
+Name[is]=Upplýsingar um skírteini
+Name[it]=Informazioni del certificato
+Name[ja]=認証情報
+Name[ka]=სერტიფიკატის ინფორმაცია
+Name[kk]=Куәлік мәліметтері
+Name[km]=ព័ត៌មាន​វិញ្ញាបនបត្រ
+Name[lt]=Sertifikato informacija
+Name[mk]=Информации за сертификати
+Name[ms]=Maklumat Sijil
+Name[nb]=Sertifikatinformasjon
+Name[nds]=Zertifikaat-Informatschonen
+Name[ne]=प्रमाणपत्र सूचना
+Name[nl]=Certificaatinformatie
+Name[nn]=Informasjon om sertifikat
+Name[pa]=ਸਰਟੀਫਿਕੇਟ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja o certyfikacie
+Name[pt]=Informações do Certificado
+Name[pt_BR]=Informações sobre Certificado
+Name[ru]=Информация о сертификате
+Name[sk]=Informácie o certifikáte
+Name[sl]=Informacija o certifikatu
+Name[sr]=Информације о сертификату
+Name[sr@Latn]=Informacije o sertifikatu
+Name[sv]=Information om certifikat
+Name[ta]=சான்றிதழ் தகவல்
+Name[tr]=Sertifika Bilgisi
+Name[uk]=Інформація про сертифікат
+Name[uz]=Sertifikat haqida maʼlumot
+Name[uz@cyrillic]=Сертификат ҳақида маълумот
+Name[vi]=Thông tin chứng nhận
+Name[zh_CN]=证书信息
+Name[zh_TW]=憑證資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_cert
+MimeType=application/x-x509-ca-cert
+PreferredGroups=certInfo,certSubjectInfo
+PreferredItems=State,CN,O,OU,L,C
diff --git a/tdefile-plugins/cert/tdefile_cert.h b/tdefile-plugins/cert/tdefile_cert.h
new file mode 100644
index 0000000..4d3b93b
--- /dev/null
+++ b/tdefile-plugins/cert/tdefile_cert.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Leonid Zeitlin *
+ * lz@europe.com *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef __KFILE_CERT_H__
+#define __KFILE_CERT_H__
+
+/**
+ * Note: For further information look into <$TDEDIR/include/tdefilemetainfo.h>
+ */
+#include <tdefilemetainfo.h>
+
+class TQStringList;
+class TQString;
+
+class CertPlugin: public KFilePlugin {
+ Q_OBJECT
+
+private:
+ void appendDNItems(KFileMetaInfoGroup &group, const TQString &DN);
+public:
+ CertPlugin(TQObject *parent, const char *name, const TQStringList& args);
+ virtual bool readInfo(KFileMetaInfo& info, uint what);
+};
+
+#endif // __KFILE_CERT_H__
+
diff --git a/tdefile-plugins/desktop/Makefile.am b/tdefile-plugins/desktop/Makefile.am
new file mode 100644
index 0000000..e8315ad
--- /dev/null
+++ b/tdefile-plugins/desktop/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am for .desktop 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_desktop.h
+
+kde_module_LTLIBRARIES = tdefile_desktop.la
+
+tdefile_desktop_la_SOURCES = tdefile_desktop.cpp
+tdefile_desktop_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_desktop_la_LIBADD = $(LIB_KIO)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/tdefile_desktop.pot
+
+services_DATA = tdefile_desktop.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdefile-plugins/desktop/tdefile_desktop.cpp b/tdefile-plugins/desktop/tdefile_desktop.cpp
new file mode 100644
index 0000000..2bcd930
--- /dev/null
+++ b/tdefile-plugins/desktop/tdefile_desktop.cpp
@@ -0,0 +1,128 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2002 Rolf Magnus <ramagnus@kde.org>
+ *
+ * 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_desktop.h"
+
+#include <kurl.h>
+#include <klocale.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kdesktopfile.h>
+#include <kmimetype.h>
+
+typedef KGenericFactory<KDotDesktopPlugin> DotDesktopFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_desktop, DotDesktopFactory("tdefile_desktop"))
+
+KDotDesktopPlugin::KDotDesktopPlugin(TQObject *parent, const char *name,
+ const TQStringList &preferredItems)
+ : KFilePlugin(parent, name, preferredItems)
+{
+ kdDebug(7034) << ".desktop plugin\n";
+
+ KFileMimeTypeInfo* info;
+ KFileMimeTypeInfo::GroupInfo* group;
+ KFileMimeTypeInfo::ItemInfo* item;
+
+ info = addMimeTypeInfo("application/x-desktop");
+ group = addGroupInfo(info, "General", i18n("General"));
+
+ item = addItemInfo(group, "Name", i18n("Name"), TQVariant::String);
+ setHint(item, KFileMimeTypeInfo::Name);
+ item = addItemInfo(group, "Comment", i18n("Comment"), TQVariant::String);
+ setHint(item, KFileMimeTypeInfo::Description);
+
+ addItemInfo(group, "Type", i18n("Type"), TQVariant::String);
+
+ addItemInfo(group, "Device", i18n("Device"), TQVariant::String);
+ addItemInfo(group, "Mount Point", i18n("Mount Point"), TQVariant::String);
+ addItemInfo(group, "File System", i18n("File System"), TQVariant::String);
+ addItemInfo(group, "Writable", i18n("Writable"), TQVariant::Bool);
+
+ addItemInfo(group, "File Type", i18n("File Type"), TQVariant::String);
+ addItemInfo(group, "Service Type", i18n("Service Type"), TQVariant::String);
+ addItemInfo(group, "Preferred Items", i18n("Preferred Items"), TQVariant::String);
+ addItemInfo(group, "Link To", i18n("Link To"), TQVariant::String);
+}
+
+bool KDotDesktopPlugin::readInfo( KFileMetaInfo& info, uint )
+{
+ if ( info.path().isEmpty() ) // remote file
+ return false;
+
+ KDesktopFile file(info.path(), true);
+
+ TQString s;
+
+ KFileMetaInfoGroup group = appendGroup(info, "General");
+
+ s = file.readName();
+ if (!s.isEmpty()) appendItem(group, "Name", s);
+
+ s = file.readComment();
+ if (!s.isEmpty()) appendItem(group, "Comment", s);
+
+ TQString type = file.readType();
+ if (type == "FSDevice")
+ {
+ appendItem(group, "Type", i18n("Device"));
+
+ s = file.readDevice();
+ if (!s.isEmpty()) appendItem(group, "Device", s);
+
+ s = file.readEntry("MountPoint");
+ if (!s.isEmpty()) appendItem(group, "Mount Point", s);
+
+ s = i18n(file.readEntry("FSType").local8Bit());
+ if (!s.isEmpty()) appendItem(group, "File System", s);
+
+ appendItem(group, "Writable",
+ TQVariant(!file.readBoolEntry("ReadOnly", true), 42));
+
+ }
+ else if (type == "Service")
+ {
+ appendItem(group, "Type", i18n("Service"));
+
+ s = file.readEntry("MimeType");
+ if (!s.isEmpty())
+ {
+ KMimeType::Ptr mt = KMimeType::mimeType(s);
+ appendItem(group, "File Type", mt->comment());
+ }
+
+ TQString sType = file.readEntry("ServiceTypes");
+ appendItem(group, "Service Type", sType);
+
+ if (sType == "KFilePlugin")
+ {
+ TQStringList preferred = file.readListEntry("PreferredItems");
+ appendItem(group, "Preferred Items", preferred);
+ }
+ }
+ else if (type == "Link")
+ {
+ TQString url = file.readPathEntry("URL");
+ appendItem(group, "Link To", url);
+ }
+
+ return true;
+}
+
+#include "tdefile_desktop.moc"
diff --git a/tdefile-plugins/desktop/tdefile_desktop.desktop b/tdefile-plugins/desktop/tdefile_desktop.desktop
new file mode 100644
index 0000000..ad9a851
--- /dev/null
+++ b/tdefile-plugins/desktop/tdefile_desktop.desktop
@@ -0,0 +1,68 @@
+[Desktop Entry]
+Type=Service
+Name=Desktop Entry Info
+Name[af]=Werkskerm Inskrywing Inligting
+Name[ar]=معلومات مدخل سطح المكتب
+Name[az]=Masa Üstü Girişi Mə'lumatı
+Name[bg]=Информация за файл Desktop
+Name[br]=Titouroù diwar-benn ar vouetadur burev
+Name[bs]=Informacije o desktop stavci
+Name[ca]=Informació de l'entrada a l'escriptori
+Name[cs]=Info o položce pracovní plochy
+Name[cy]=Gwybodaeth Cofnod Penbwrdd
+Name[da]=Information om desktopindgang
+Name[de]=Information zum Arbeitsflächeneintrag
+Name[el]=Πληροφορίες καταχώρησης επιφάνειας εργασίας
+Name[eo]=Tabula ero informo
+Name[es]=Información de la entrada del escritorio
+Name[et]=Töölaua kirje info
+Name[eu]=Mahaigainaren sarreraren informazioa
+Name[fa]=اطلاعات مدخل رومیزی
+Name[fi]=Työpöytätietueen tiedot
+Name[fo]=Upplýsingar um inngang á skriviborði
+Name[fr]=Informations sur l'entrée du bureau
+Name[fy]=Buroblêdyngong-ynformaasje
+Name[gl]=Información do Campo Desktop
+Name[he]=מידע רשומת שולחן עבודה
+Name[hi]=डेस्कटॉप एन्ट्री जानकारी
+Name[hr]=Podaci o stavki radne površine
+Name[hu]=Információ a munkaasztali bejegyzésekről
+Name[is]=Upplýsingar un skjáborðsfærslu
+Name[it]=Informazioni sulle voci Desktop
+Name[ja]=デスクトップエントリ情報
+Name[ka]=სამუშაო მაგიდის ჩანაწერის ინფორმაცია
+Name[kk]=.desktop жазуының мәліметі
+Name[km]=ព័ត៌មាន​ធាតុ​ផ្ទៃ​តុ
+Name[lt]=Darbastalio įrašo informacija
+Name[mk]=Информации за елемент од работната околина
+Name[ms]=Maklumat Entri Desktop
+Name[nb]=Informasjon om skrivebordsoppføring
+Name[nds]=Schriefdischindrag-Informatschonen
+Name[ne]=डेस्कटप प्रविष्टि सूचना
+Name[nl]=Bureaubladingang-informatie
+Name[nn]=Informasjon om skrivebordsoppføring
+Name[nso]=Tshedimoso Tsenelo ya Desktop
+Name[pa]=ਵੇਹੜਾ ਇੰਦਰਾਜ਼ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja o plikach Desktop
+Name[pt]=Informação do Campo do 'Desktop'
+Name[pt_BR]=Informações sobre a entrada desktop
+Name[ro]=Informaţii înregistrare ecran
+Name[ru]=Информация об элементе .desktop
+Name[sk]=Informácie o položke pracovnej plochy
+Name[sl]=Informacije o vnosu namizja
+Name[sr]=Информације о уносу на радној површини
+Name[sr@Latn]=Informacije o unosu na radnoj površini
+Name[sv]=Information om skrivbordsfil
+Name[ta]=மேல்மேசை உள்ளிடு தகவல்
+Name[tg]=Ахборот дар бораи ҷузъи мизи корӣ
+Name[th]=ข้อมูลรายการพื้นที่ทำงาน
+Name[tr]=Masaüstü Girdi Bilgisi
+Name[uk]=Інформація про елемент стільниці
+Name[vi]=Thông tin mục nhập môi trường
+Name[xh]=Ungeniso Lolwazi lwe Desktop
+Name[zh_CN]=桌面项目信息
+Name[zh_TW]=桌面項目資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_desktop
+MimeType=application/x-desktop
+PreferredItems=Name,Comment,Type,Service Type
diff --git a/tdefile-plugins/desktop/tdefile_desktop.h b/tdefile-plugins/desktop/tdefile_desktop.h
new file mode 100644
index 0000000..b6d0104
--- /dev/null
+++ b/tdefile-plugins/desktop/tdefile_desktop.h
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2002 Rolf Magnus <ramagnus@kde.org>
+ *
+ * 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_DESKTOP_H__
+#define __KFILE_DESKTOP_H__
+
+#include <tdefilemetainfo.h>
+#include <kurl.h>
+
+class TQStringList;
+
+class KDotDesktopPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ KDotDesktopPlugin( TQObject *parent, const char *name,
+ const TQStringList& args );
+
+ virtual bool readInfo ( KFileMetaInfo& info, uint what );
+};
+
+#endif
diff --git a/tdefile-plugins/folder/Makefile.am b/tdefile-plugins/folder/Makefile.am
new file mode 100644
index 0000000..a6917c1
--- /dev/null
+++ b/tdefile-plugins/folder/Makefile.am
@@ -0,0 +1,21 @@
+## Makefile.am for folder file meta info plugin
+
+INCLUDES = $(all_includes)
+
+# these are the headers for your project
+noinst_HEADERS = tdefile_folder.h
+
+kde_module_LTLIBRARIES = tdefile_folder.la
+
+tdefile_folder_la_SOURCES = tdefile_folder.cpp
+tdefile_folder_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_folder_la_LIBADD = $(LIB_KIO)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+services_DATA = tdefile_folder.desktop
+servicesdir = $(kde_servicesdir)
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/tdefile_folder.pot
diff --git a/tdefile-plugins/folder/tdefile_folder.cpp b/tdefile-plugins/folder/tdefile_folder.cpp
new file mode 100644
index 0000000..24a0365
--- /dev/null
+++ b/tdefile-plugins/folder/tdefile_folder.cpp
@@ -0,0 +1,86 @@
+/* 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 "tdefile_folder.h"
+
+#include <kgenericfactory.h>
+#include <tdeio/global.h>
+
+#include <tqfileinfo.h>
+#include <tqdir.h>
+
+typedef KGenericFactory<KFolderPlugin> KFolderFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_folder, KFolderFactory( "tdefile_folder" ))
+
+KFolderPlugin::KFolderPlugin(TQObject *parent, const char *name,
+ const TQStringList &args)
+
+ : KFilePlugin(parent, name, args)
+{
+ KFileMimeTypeInfo* info = addMimeTypeInfo( "inode/directory" );
+
+ KFileMimeTypeInfo::GroupInfo* group = 0L;
+
+ group = addGroupInfo(info, "FolderInfo", i18n("Folder Information"));
+
+ KFileMimeTypeInfo::ItemInfo* item;
+
+ item = addItemInfo(group, "Items", i18n("Items"), TQVariant::Int);
+ item = addItemInfo(group, "Size", i18n("Size"), TQVariant::Int);
+ setUnit(item, KFileMimeTypeInfo::Bytes);
+}
+
+bool KFolderPlugin::readInfo( KFileMetaInfo& info, uint /*what*/)
+{
+ KFileMetaInfoGroup group = appendGroup(info, "FolderInfo");
+
+ if (info.path().isEmpty())
+ return false;
+
+ TQDir dir;
+ if ( !dir.cd(info.path()) )
+ return false;
+
+ const TQPtrList<TQFileInfo> *fileList = dir.entryInfoList();
+ if (!fileList)
+ return false;
+
+ TQPtrListIterator<TQFileInfo> list = TQPtrListIterator<TQFileInfo>(*fileList);
+
+ TQFileInfo* file;
+ int items = 0;
+ TDEIO::filesize_t bytes = 0;
+
+ while ( (file = list.current()) != 0 ) {
+ ++list;
+ if (!file->fileName().startsWith(".")) {
+ items++;
+ bytes += file->size();
+ }
+ }
+
+ appendItem(group, "Items", items);
+ appendItem(group, "Size", bytes);
+
+ return true;
+}
+
+#include "tdefile_folder.moc"
diff --git a/tdefile-plugins/folder/tdefile_folder.desktop b/tdefile-plugins/folder/tdefile_folder.desktop
new file mode 100644
index 0000000..8f14b20
--- /dev/null
+++ b/tdefile-plugins/folder/tdefile_folder.desktop
@@ -0,0 +1,70 @@
+[Desktop Entry]
+Type=Service
+Name=Folder Info
+Name[af]=Kabinet Inligting
+Name[ar]=معلومات المجلد
+Name[az]=Qovluq Mə'lumatı
+Name[bg]=Информация за директория
+Name[br]=Titouroù diwar-benn ar renkell
+Name[bs]=Informacije o direktoriju
+Name[ca]=Info. de la carpeta
+Name[cs]=Info o adresáři
+Name[cy]=Gwybodaeth Plygell
+Name[da]=Mappeinformation
+Name[de]=Ordnerinformation
+Name[el]=Πληροφορίες φακέλου
+Name[eo]=Dosieruja informo
+Name[es]=Información de carpeta
+Name[et]=Kataloogi info
+Name[eu]=Karpetaren informazioa
+Name[fa]=اطلاعات پوشه
+Name[fi]=Kansion tiedot
+Name[fo]=Upplýsingar um inngangar á skriviborði
+Name[fr]=Informations sur le dossier
+Name[fy]=Mappenynformaasje
+Name[gl]=Información do Cartafol
+Name[he]=מידע תיקייה
+Name[hi]=फ़ोल्डर जानकारी
+Name[hr]=Podaci mape
+Name[hu]=Mappajellemzők
+Name[is]=Möppuupplýsingar
+Name[it]=Informazioni su directory
+Name[ja]=フォルダ情報
+Name[ka]=საქაღალდის ინფორმაცია
+Name[kk]=Қапшық мәліметі
+Name[km]=ព័ត៌មាន​ថត
+Name[lt]=Aplanko informacija
+Name[mk]=Информации за папка
+Name[ms]=Maklumat Folder
+Name[nb]=Mappeinformasjon
+Name[nds]=Orner-Informatschonen
+Name[ne]=फोल्डर सूचना
+Name[nl]=Mappeninformatie
+Name[nn]=Kataloginformasjon
+Name[pa]=ਫੋਲਡਰ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja o katalogach
+Name[pt]=Informações de Pastas
+Name[pt_BR]=Informações sobre a Pasta
+Name[ro]=Informaţii folder
+Name[ru]=Информация о папке
+Name[sk]=Informácie o priečinku
+Name[sl]=Informacije o mapi
+Name[sr]=Информације о фасцикли
+Name[sr@Latn]=Informacije o fascikli
+Name[sv]=Kataloginformation
+Name[ta]=அடைவுத்தகவல்
+Name[tg]=Ахборот дар бораи каталог
+Name[th]=ข้อมูลโฟลเดอร์
+Name[tr]=Dizin Bilgisi
+Name[uk]=Інформація про теку
+Name[uz]=Jild haqida maʼlumot
+Name[uz@cyrillic]=Жилд ҳақида маълумот
+Name[vi]=Thông tin thư mục
+Name[xh]=Ulwazi lwencwadi enencukhacha
+Name[zh_CN]=文件夹信息
+Name[zh_TW]=資料夾資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_folder
+MimeType=inode/directory
+PreferredGroups=FolderInfo
+PreferredItems=Items,Size
diff --git a/tdefile-plugins/folder/tdefile_folder.h b/tdefile-plugins/folder/tdefile_folder.h
new file mode 100644
index 0000000..8fe7e94
--- /dev/null
+++ b/tdefile-plugins/folder/tdefile_folder.h
@@ -0,0 +1,38 @@
+/* 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_KFOLDER_H__
+#define __KFILE_KFOLDER_H__
+
+#include <tdefilemetainfo.h>
+
+class TQStringList;
+
+class KFolderPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ KFolderPlugin( TQObject *parent, const char *name, const TQStringList& args );
+
+ virtual bool readInfo( KFileMetaInfo& info, uint what);
+};
+
+#endif
diff --git a/tdefile-plugins/html/Makefile.am b/tdefile-plugins/html/Makefile.am
new file mode 100644
index 0000000..6097b26
--- /dev/null
+++ b/tdefile-plugins/html/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am for html 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_html.h
+
+kde_module_LTLIBRARIES = tdefile_html.la
+
+tdefile_html_la_SOURCES = tdefile_html.cpp
+tdefile_html_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_html_la_LIBADD = $(LIB_KSYCOCA)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) tdefile_html.cpp -o $(podir)/tdefile_html.pot
+
+services_DATA = tdefile_html.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdefile-plugins/html/tdefile_html.cpp b/tdefile-plugins/html/tdefile_html.cpp
new file mode 100644
index 0000000..c59711a
--- /dev/null
+++ b/tdefile-plugins/html/tdefile_html.cpp
@@ -0,0 +1,158 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2001, 2002 Rolf Magnus <ramagnus@kde.org>
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+#include "tdefile_html.h"
+#include "tdefile_html.moc"
+#include <kgenericfactory.h>
+#include <kmimetype.h>
+#include <kurl.h>
+#include <kprocess.h>
+#include <kdebug.h>
+#include <tqcstring.h>
+#include <tqfile.h>
+#include <tqregexp.h>
+#include <tqtextcodec.h>
+
+typedef KGenericFactory<KHtmlPlugin> HtmlFactory;
+
+K_EXPORT_COMPONENT_FACTORY( tdefile_html, HtmlFactory( "tdefile_html" ) )
+
+KHtmlPlugin::KHtmlPlugin( TQObject *parent, const char *name,
+ const TQStringList &args )
+ : KFilePlugin( parent, name, args )
+{
+ kdDebug(7034) << "html plugin\n";
+
+ KFileMimeTypeInfo* info = addMimeTypeInfo("text/html");
+
+ KFileMimeTypeInfo::GroupInfo* group;
+ KFileMimeTypeInfo::ItemInfo* item;
+
+ group = addGroupInfo(info, "General", i18n("General"));
+ addItemInfo(group, "Doctype", i18n("Document Type"), TQVariant::String);
+ addItemInfo(group, "Javascript", i18n("JavaScript"), TQVariant::Bool);
+ item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String);
+ setHint(item, KFileMimeTypeInfo::Name);
+
+ group = addGroupInfo(info, "Metatags", i18n("Meta Tags"));
+ addVariableInfo(group, TQVariant::String, 0);
+}
+
+
+bool KHtmlPlugin::readInfo( KFileMetaInfo& info, uint )
+{
+ if ( info.path().isEmpty() ) // remote file
+ return false;
+
+ TQFile f(info.path());
+ if (!f.open(IO_ReadOnly))
+ return false;
+
+ // we're only interested in the header, so just read until before </head>
+ // or until <body> if the author forgot it
+ // In this case, it's better to limit the size of the buffer to something
+ // sensible. Think a 0-filled 3GB file with an .html extension.
+ int maxBufSize = TQMIN(f.size(), 32768);
+ TQByteArray data(maxBufSize + 1);
+ f.readBlock(data.data(), maxBufSize);
+ data[maxBufSize]='\0';
+
+ TQString s(data);
+
+ int start=0, last=0;
+ TQRegExp exp;
+ exp.setCaseSensitive(false);
+ exp.setMinimal(true);
+
+ KFileMetaInfoGroup group = appendGroup(info, "General");
+
+ exp.setPattern("\\s*<\\s*!doctype\\s*([^>]*)\\s*>");
+ if (exp.search(s, last) != -1)
+ {
+ kdDebug(7034) << "DocType: " << TQString(exp.capturedTexts().join("-")) << endl;
+ appendItem(group, "Doctype", exp.cap(1));
+ last += exp.matchedLength();
+ }
+
+ TQString title;
+ exp.setPattern("<\\s*title\\s*>\\s*(.*)\\s*<\\s*/\\s*title\\s*>");
+ if (exp.search(s, last) != -1)
+ {
+ title = exp.cap(1);
+ last += exp.matchedLength();
+ }
+
+ KFileMetaInfoGroup metatags = appendGroup(info, "Metatags");
+
+ TQString meta, name, content;
+ exp.setPattern("<\\s*meta\\s*([^>]*)\\s*>");
+ TQRegExp rxName("(?:name|http-equiv)\\s*=\\s*\"([^\"]+)\"", false);
+ TQRegExp rxContent("content\\s*=\\s*\"([^\"]+)\"", false);
+ TQRegExp rxCharset("charset\\s*=\\s*(.*)", false);
+ TQTextCodec *codec = 0;
+
+ // find the meta tags
+ last = 0;
+ while (1)
+ {
+ if ((start=exp.search(s, last)) == -1)
+ break;
+ meta = exp.cap(1);
+ last = start+exp.matchedLength();
+
+ kdDebug(7034) << "Found Meta: " << meta << endl;
+
+ if (rxName.search(meta) == -1)
+ continue;
+ name = rxName.cap(1);
+
+ if (rxContent.search(meta) == -1)
+ continue;
+ content = rxContent.cap(1);
+
+ appendItem(metatags, name, content.left(50));
+
+ // check if it has a charset defined
+ if ( rxCharset.search(content) != -1 )
+ {
+ kdDebug(7034) << "CodecForName : " << rxCharset.cap(1) << endl;
+ codec = TQTextCodec::codecForName(rxCharset.cap(1).ascii());
+ }
+ }
+
+ if ( ! title.isEmpty() )
+ {
+ if ( codec )
+ {
+ title = codec->toUnicode(title.ascii());
+ kdDebug(7034) << "Codec : " << codec->name() << endl;
+ }
+
+ appendItem(group, "Title", title);
+ }
+
+ // find out if it contains javascript
+ exp.setPattern("<script>");
+
+ appendItem(group, "Javascript", TQVariant( s.find(exp)!=-1, 42));
+
+ return true;
+}
+
diff --git a/tdefile-plugins/html/tdefile_html.desktop b/tdefile-plugins/html/tdefile_html.desktop
new file mode 100644
index 0000000..4dfd89c
--- /dev/null
+++ b/tdefile-plugins/html/tdefile_html.desktop
@@ -0,0 +1,66 @@
+[Desktop Entry]
+Type=Service
+Name=HTML Playlist Info
+Name[af]=Html Liedjielys Inligting
+Name[ar]=معلومات قائمة أغاني HTML
+Name[az]=HTML Çalğı Siyahısı Mə'lumatı
+Name[bg]=Информация за HTML файл
+Name[br]=Titouroù diwar-benn ar roll tonioù HTML
+Name[ca]=Info. de la llista de reproducció HTML
+Name[cs]=Informace o seznamu skladeb HTML
+Name[cy]=Gwybodaeth Rhestr Chwarae HTML
+Name[da]=Information om HTML-spilleliste
+Name[de]=HTML-Wiedergabelisteninfo
+Name[el]=Πληροφορίες λίστας αναπαραγωγής HTML
+Name[eo]=HTML-ludlistinformo
+Name[es]=Información de la lista de reproducción HTML
+Name[et]=HTML esitusnimekirja info
+Name[eu]=HTML erreprodukzio-zerrendaren informazioa
+Name[fa]=اطلاعات فهرست پخش زنگام
+Name[fi]=HTML soittolistan tiedot
+Name[fo]=HTML spælilistaupplýsingar
+Name[fr]=Informations sur une liste de lecture HTML
+Name[fy]=HTML-ôfspyllistynfo
+Name[gl]=Información de Listas de Reprodución HTML
+Name[he]=מידע רשימת ניגון HTML
+Name[hi]=एचटीएमएल प्लेलिस्ट जानकारी
+Name[hr]=HTML podaci o popisu za sviranje
+Name[hu]=HTML lejátszási lista jellemzői
+Name[is]=Upplýsingar um HTML lagalista
+Name[it]=Informazioni playlist HTML
+Name[ja]=HTML プレイリスト情報
+Name[ka]=HTML სიმღერათა სიის ინფორმაცია
+Name[kk]=HTML орындау тізім мәліметі
+Name[km]=ព័ត៌មាន​បញ្ជី​ចាក់ HTML
+Name[lt]=HTML grojaraščio informacija
+Name[mk]=Информации за HTML-листа на нумери
+Name[ms]=Maklumat Senarai Main HTML
+Name[nb]=HTML-spilleliste-informasjon
+Name[nds]=HTML-Afspellistinformatschonen
+Name[ne]=एचटीएमएल प्लेसूची सूचना
+Name[nl]=HTML-afspeellijstinfo
+Name[nn]=Informasjon om HTML-speleliste
+Name[pa]=HTML ਸੰਗੀਤ-ਸੂਚੀ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja o liście nagrań w HTML-u
+Name[pt]=Informações de Listas de Músicas HTML
+Name[pt_BR]=Informação de listas de reprodução HTML
+Name[ro]=Informaţii listă de redare HTML
+Name[ru]=Информация о списке песен в формате HTML
+Name[sk]=HTML informácie o playliste
+Name[sl]=Informacije o predvajalnem seznamu HTML
+Name[sr]=HTML информације о листи нумера
+Name[sr@Latn]=HTML informacije o listi numera
+Name[sv]=Information om HTML-spellista
+Name[ta]=HTML வாசிப்புப்பட்டியல் தகவல்
+Name[tg]=Ахборот дар бораи рӯйхати сурудҳо дар HTML
+Name[th]=ข้อมูลรายการเล่น HTML
+Name[tr]=HTML Çalma Listesi Bilgisi
+Name[uk]=Інформація списку композицій в HTML
+Name[vi]=Thông tin danh mục nhạc HTML
+Name[xh]=Ulwazi loluhlu lodweliso lomdlali we HTML
+Name[zh_CN]=HTML 播放列表信息
+Name[zh_TW]=HTML 播放清單資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_html
+MimeType=text/html
+PreferredItems=Title,Javascript,Doctype,Keywords
diff --git a/tdefile-plugins/html/tdefile_html.h b/tdefile-plugins/html/tdefile_html.h
new file mode 100644
index 0000000..858d6a1
--- /dev/null
+++ b/tdefile-plugins/html/tdefile_html.h
@@ -0,0 +1,39 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2001, 2002 Rolf Magnus <ramagnus@kde.org>
+ *
+ * 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.
+ *
+ * $Id$
+ */
+
+#ifndef __KMIME_HTML_H__
+#define __KMIME_HTML_H__
+
+#include <tdefilemetainfo.h>
+#include <kurl.h>
+
+class TQStringList;
+
+class KHtmlPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ KHtmlPlugin( TQObject *parent, const char *name, const TQStringList& args );
+ virtual bool readInfo( KFileMetaInfo& info, uint what );
+};
+
+#endif
diff --git a/tdefile-plugins/lnk/Makefile.am b/tdefile-plugins/lnk/Makefile.am
new file mode 100644
index 0000000..083f9a0
--- /dev/null
+++ b/tdefile-plugins/lnk/Makefile.am
@@ -0,0 +1,34 @@
+## Makefile.am for lnk file meta info plugin
+
+INCLUDES = $(all_includes)
+
+bin_PROGRAMS = lnkforward
+
+lnkforward_SOURCES = lnkforward.cpp
+lnkforward_LDADD = $(LIB_TDECORE) $(LIB_KIO)
+lnkforward_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+lnkforward_METASOURCES = lnkforward.moc
+
+lnkforward_DATA = lnkforward.desktop
+lnkforwarddir = $(kde_appsdir)/.hidden
+
+# these are the headers for your project
+noinst_HEADERS = tdefile_lnk.h read_lnk.h lnkforward.h
+
+kde_module_LTLIBRARIES = tdefile_lnk.la
+
+tdefile_lnk_la_SOURCES = tdefile_lnk.cpp read_lnk.cpp
+tdefile_lnk_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_lnk_la_LIBADD = $(LIB_KIO)
+tdefile_lnk_la_METASOURCES = tdefile_lnk.moc
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+kde_services_DATA = tdefile_lnk.desktop
+
+mime_DATA = x-win-lnk.desktop
+mimedir = $(kde_mimedir)/application
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/tdefile_lnk.pot
diff --git a/tdefile-plugins/lnk/README b/tdefile-plugins/lnk/README
new file mode 100644
index 0000000..8b17918
--- /dev/null
+++ b/tdefile-plugins/lnk/README
@@ -0,0 +1,29 @@
+29.May 2004, Martin Koller, m.koller@surfeu.at
+
+This package shall help a better integration of KDE/Linux into a Windows environment
+by providing tools to work with Windows .lnk files
+
+This package contains 2 tools:
+
+- a KFile plugin, tdefile_lnk, which gives metadata information for a .lnk file (where does it point to)
+
+- a small tool, lnkforward, to start an associated application for which the path is in a .lnk file
+ (e.g. when you double-click a file in konqueror)
+
+The .lnk file is registered as MIME type application/x-win-lnk
+
+If you have a dual-boot machine, and you have your Windows partition(s) mounted,
+then you should adapt where konqi can find the corresponding C:, D: or other drives.
+For this you have to adapt the used commandline arguments for lnkforward, which you
+can do in konqis file-associations for the MIME type application/x-win-lnk
+
+The lnkforward tool shall get a commandline option like this:
+
+-map C=/mnt/winC -map D=/mnt/winD
+
+NOTE: both tools work with .lnk files which are either readable via the local filesystem
+(smbfs mounted filesystems) or also via URLs on the network, e.g. smb://something
+
+Have fun.
+
+Martin
diff --git a/tdefile-plugins/lnk/lnkforward.cpp b/tdefile-plugins/lnk/lnkforward.cpp
new file mode 100644
index 0000000..6161a15
--- /dev/null
+++ b/tdefile-plugins/lnk/lnkforward.cpp
@@ -0,0 +1,130 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Martin Koller *
+ * m.koller@surfeu.at *
+ * *
+ * This helper app runs the associated action for a linked file inside a *
+ * M$-Windoze .lnk file, which is useful if you work in a mixed *
+ * Linux/Windoze environment. *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "read_lnk.cpp"
+#include "lnkforward.h"
+
+#include <stdlib.h>
+
+#include <klocale.h>
+#include <krun.h>
+#include <kdebug.h>
+
+//--------------------------------------------------------------------------------
+
+static const char appName[] = "lnkforward";
+static const char programName[] = I18N_NOOP("lnkforward");
+
+static const char description[] = I18N_NOOP("TDE tool for opening URLs given in a Windows .lnk file");
+
+static const char version[] = "1.0";
+
+static const KCmdLineOptions options[] =
+{
+ { "map <drive=path>", I18N_NOOP("Map a Windows drive to a local mountpoint, e.g. \"C=/mnt/windows\""
+ "\nThis option can be given multiple times"), 0},
+ { "+URL", I18N_NOOP("Windows .lnk file to open"), 0},
+ KCmdLineLastOption
+};
+
+//--------------------------------------------------------------------------------
+
+int main(int argc, char **argv)
+{
+ TDECmdLineArgs::init(argc, argv, appName, programName, description, version, false);
+
+ TDECmdLineArgs::addCmdLineOptions(options);
+
+ LNKForwarder app;
+
+ return app.run(TDECmdLineArgs::parsedArgs());
+}
+
+//--------------------------------------------------------------------------------
+
+int LNKForwarder::run(TDECmdLineArgs *args)
+{
+ if ( args->count() == 0 ) return 1;
+
+ LNKInfo info;
+
+ bool ret = readLNK(args->arg(0), info);
+ if ( ! ret ) return 1;
+
+ info.path.replace(TQChar('\\'), TQChar('/'));
+
+ TQString path;
+
+ if ( info.isNetworkPath )
+ {
+ path = "smb:" + info.path;
+ }
+ else
+ {
+ if ( info.driveName.isNull() ) return 1; // can this ever happen ?
+
+ QCStringList map = args->getOptionList("map");
+ bool found = false;
+
+ for (unsigned int i = 0; i < map.count(); i++)
+ {
+ if ( map[i].lower()[0] == info.driveName.lower()[0] )
+ {
+ if ( map[i].length() < 3 )
+ {
+ return 1;
+ }
+ path = map[i].mid(2); // skip e.g. "C="
+ found = true;
+ break;
+ }
+ }
+
+ if ( !found ) return 1; // no mapped drive found
+
+ path += '/'; // make sure that the dir ends with /
+ path += info.path;
+ }
+
+ kdDebug(7034) << "running:" << path << endl;
+ KRun * run = new KRun(path);
+ TQObject::connect(run, TQT_SIGNAL(finished()), this, TQT_SLOT(delayedQuit()));
+ TQObject::connect(run, TQT_SIGNAL(error()), this, TQT_SLOT(delayedQuit()));
+
+ return exec();
+}
+
+//--------------------------------------------------------------------------------
+// copied from kfmclient.cc
+
+void LNKForwarder::delayedQuit()
+{
+ // Quit in 2 seconds. This leaves time for KRun to pop up
+ // "app not found" in TDEProcessRunner, if that was the case.
+ TQTimer::singleShot(2000, this, TQT_SLOT(deref()));
+}
+
+//--------------------------------------------------------------------------------
+
+#include "lnkforward.moc"
diff --git a/tdefile-plugins/lnk/lnkforward.desktop b/tdefile-plugins/lnk/lnkforward.desktop
new file mode 100644
index 0000000..8897490
--- /dev/null
+++ b/tdefile-plugins/lnk/lnkforward.desktop
@@ -0,0 +1,114 @@
+[Desktop Entry]
+Type=Application
+Comment=Start link given in Windows .lnk file
+Comment[bg]=Стартиране на файл връзка на Windows
+Comment[bs]=Pokreni link dat u Windows .lnk datoteci
+Comment[ca]=Inicia l'enllaç donat pel fitxer .lnk de Windows
+Comment[cs]=Spustit odkaz daný v .lnk souboru
+Comment[da]=Start link givet i Windows .lnk-fil
+Comment[de]=Ausführen der Verknüpfung aus einer Windows-Verknüpfungsdatei
+Comment[el]=Εκκίνηση του δεσμού που δίνεται στο αρχείο .lnk των Windows
+Comment[es]=Inicia el enlace que se encuentra en el archivo .lnk de Windows
+Comment[et]=Käivitab Windowsi .lnk-failis antud viida
+Comment[eu]=Hasieratu Windowsen .Ink fitxategiaren esteka
+Comment[fa]=آغاز پیوند داده‌شده در پروندۀ .lnk ویندوز
+Comment[fi]=Käynnistä Windows .lnk-tiedostossa annettu linkki
+Comment[fr]=Lancer le lien issu d'un fichier « .lnk » Windows
+Comment[fy]=Folget keppeling yn de Windows .lnk-triem
+Comment[ga]=Nasc tosaigh ón chomhad .lnk Windows
+Comment[gl]=Iniciar o enlace dado nun ficheiro .lnk de Windows
+Comment[he]=התחל קיצור בקובץ lnk של Windows
+Comment[hi]=विंडोज़ के .lnk फ़ाइल में स्टार्ट लिंक दिया गया है
+Comment[hr]=Pokretanje veze iz Windows datoteke .lnk
+Comment[hu]=Link megnyitása Windows-os Lnk-fájl alapján
+Comment[is]=Ræsa tengil í Windows lnk skrá
+Comment[it]=Collegamento iniziale dato nel file .lnk di Windows
+Comment[ja]=Windows の .lnk ファイルのリンクを開始
+Comment[ka]=Windows .lnk ფაილში მოცემული ბმულის გაშვება
+Comment[kk]=Windows .lnk файл сілтегенің жегу
+Comment[km]=ចាប់ផ្ដើម​តំណ​ដែល​បានផ្ដល់​​ក្នុង​បង្អួច​ឯកសារ .lnk
+Comment[lt]=Atverti nuorodą, nurodytą Windows .lnk byloje
+Comment[mk]=Ја стартува врската дадена во Windows .lnk-датотека
+Comment[ms]=Mulakan pautan yang diberikan dalam Tetingkap. Fail dakwat
+Comment[nb]=Start lenka oppgitt i en Windows .lnk-fil
+Comment[nds]=Den Link ut Windows-Linkdatei utföhren
+Comment[ne]=विन्डोज .lnk फाइलमा दिएको लिङ्क सुरुआत गर्नुहोस्
+Comment[nl]=Volgt koppeling in het Windows .lnk-bestand
+Comment[nn]=Start lenkja oppgjeve i ei Windows .lnk-fil
+Comment[pl]=Uruchamia odnośnik znajdujący się w plikach .lnk systemu Windows
+Comment[pt]=Iniciar a ligação definida pelo ficheiro .lnk do Windows
+Comment[pt_BR]=Inicia um link fornecido de um arquivo .lnk do Windows
+Comment[ru]=Перейти по ссылке из ярлыка Windows (.lnk)
+Comment[sk]=Spustenie zadaného odkazu v súbore Windows .lnk
+Comment[sl]=Zaženi povezavo, dano v datoteki Windows .lnk
+Comment[sr]=Покреће везу дату у Windows-овом .lnk фајлу
+Comment[sr@Latn]=Pokreće vezu datu u Windows-ovom .lnk fajlu
+Comment[sv]=Starta länk given i en Windows länkfil
+Comment[ta]=விண்டோஸ் .lnk fileசில் கொடுக்கப்பட்டதற்கு இணைப்பை துவக்கவும்
+Comment[tg]=Гузаштан бо истинод аз ярлиқи Windows (.lnk)
+Comment[tr]=Windows .lnk dosyasında verilen başlangıç kısayolu
+Comment[uk]=Перейти по посиланню з файла .lnk для Windows
+Comment[uz]=Windows .lnk faylida koʻrsatilgan bogʻga oʻtish
+Comment[uz@cyrillic]=Windows .lnk файлида кўрсатилган боғга ўтиш
+Comment[vi]=Liên kết bắt đầu được ghi trong tập tin .Ink của Windows
+Comment[zh_CN]=启动 Windows .lnk 文件中给出的链接
+Comment[zh_TW]=連結 Windows .lnk 檔中指定的網址
+Exec=lnkforward -map C=/mnt/winc
+MimeType=application/x-win-lnk
+Name=Windows lnk File Forwarder
+Name[bg]=Препращане за файл връзка на Windows
+Name[bs]=Windows lnk datoteka preusmjerivač
+Name[ca]=Enviador de fitxers Windows Ink
+Name[cs]=Informace o odkazech
+Name[da]=Videresender af Windows ink-fil
+Name[de]=Weiterleitung für Windows-Verknüpfungsdateien
+Name[el]=Προωθητής αρχείου lnk των Windows
+Name[eo]=Vindoza lnk dosiera antaŭigilo
+Name[es]=Expedidor de archivos lnk de Windows
+Name[et]=Windowsi .lnk-faili käivitaja
+Name[eu]=Windowsen Ink fitxategiaren berbidaltzailea
+Name[fa]=پیش‌سوی پروندۀ lnk ویندوز
+Name[fi]=Windows lnk-tiedoston edelleenohjaus
+Name[fr]=Transmetteur de fichiers « .lnk » Windows
+Name[fy]=Windows lnk-triemferwizing
+Name[gl]=Reenvio através de Ficheiros Windows lnk
+Name[he]=קיצור דרך של Windows
+Name[hi]=विंडोज़ लिंक फ़ाइल फॉर्वर्डर
+Name[hr]=Prosljeđivanje Windows prečaca
+Name[hu]=Windows-os Lnk-fájl továbbítása
+Name[is]=Windows lnk skráarframsendir
+Name[it]=File lnk di windows con funzione forwarder
+Name[ja]=Windows lnk ファイルフォワーダ
+Name[ka]=Windows lnk ფაილის გადამცემი
+Name[kk]=Windows жарлығының сілтемесіне өту
+Name[km]=កម្មវិធី​បញ្ជូន​បន្ត​បង្អួច​​ឯកសារ lnk​
+Name[lt]=Windows lnk bylų nuorodos
+Name[mk]=Пренасочувач на Windows lnk-датотеки
+Name[ms]=Pemaju Fail Dakwat Tetingkap
+Name[nb]=Videresender Windows lnk-fil
+Name[nds]=Wiederledden för Windows-Linkdateien
+Name[ne]=विन्डोज lnk फाइल अगाडि बढाउने
+Name[nl]=Windows lnk-bestandsverwijzing
+Name[nn]=Vidaresender Windows lnk-fil
+Name[pa]=Windows lnk ਫਾਇਲ ਫਾਰਵਰਡਰ
+Name[pl]=Interpretacja plików lnk systemu Windows
+Name[pt]=Encaminhamento de Ficheiros do Windows
+Name[pt_BR]=Informações de Aplicativos do Windows
+Name[ru]=Перенаправление по ярлыку Windows
+Name[sk]=Presmerovač súborov Windows lnk
+Name[sl]=Posredovalnik za bližnjice v Windows
+Name[sr]=Прослеђивач Windows-ових .lnk фајлова
+Name[sr@Latn]=Prosleđivač Windows-ovih .lnk fajlova
+Name[sv]=Följ Windows länkfil
+Name[ta]=விண்டோஸ் மை கோப்பு திருப்புபவன்
+Name[tg]=Равона бо ярлиқи Windows
+Name[tr]=Windows lnk Dosya Yönlendirici
+Name[uk]=Спрямування за файлом lnk для Windows
+Name[vi]=Bộ chuyển tiếp tập tin Ink Windows
+Name[zh_CN]=Windows lnk 文件转发器
+Name[zh_TW]=Windows lnk 檔轉載
+StartupNotify=false
+Terminal=false
+X-TDE-SubstituteUID=false
+Icon=exec_wine
+NoDisplay=true
diff --git a/tdefile-plugins/lnk/lnkforward.h b/tdefile-plugins/lnk/lnkforward.h
new file mode 100644
index 0000000..14b3e76
--- /dev/null
+++ b/tdefile-plugins/lnk/lnkforward.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Martin Koller *
+ * m.koller@surfeu.at *
+ * *
+ * This helper app runs the associated action for a linked file inside a *
+ * M$-Windoze .lnk file, which is useful if you work in a mixed *
+ * Linux/Windoze environment. *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+
+#ifndef _LNKFORWARDER_H_
+#define _LNKFORWARDER_H_
+
+class LNKForwarder : public TDEApplication
+{
+ Q_OBJECT
+
+
+ public:
+ int run(TDECmdLineArgs *args);
+
+ protected slots:
+ void delayedQuit();
+};
+
+#endif
diff --git a/tdefile-plugins/lnk/read_lnk.cpp b/tdefile-plugins/lnk/read_lnk.cpp
new file mode 100644
index 0000000..47ed5a5
--- /dev/null
+++ b/tdefile-plugins/lnk/read_lnk.cpp
@@ -0,0 +1,227 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Martin Koller *
+ * m.koller@surfeu.at *
+ * *
+ * This function reads the content of a M$-Windoze .lnk file *
+ * and returns data in the given structure. *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "read_lnk.h"
+#include <stdio.h>
+#include <kdebug.h>
+#include <tdeio/netaccess.h>
+
+//--------------------------------------------------------------------------------
+
+//TODO: little/big endian problem ?
+struct LNKHeader
+{
+ char magic[4];
+ char GUID[16];
+ TQ_UINT32 flags;
+ TQ_UINT32 attributes;
+ char time1[8];
+ char time2[8];
+ char time3[8];
+ TQ_UINT32 length;
+ TQ_UINT32 iconNum;
+ TQ_UINT32 showWnd;
+ TQ_UINT32 hotKey;
+ char filler[8];
+};
+
+struct LNKFileLocation
+{
+ TQ_UINT32 totalLen;
+ TQ_UINT32 ptr;
+ TQ_UINT32 flags;
+ TQ_UINT32 localVolume;
+ TQ_UINT32 basePath;
+ TQ_UINT32 netVolume;
+ TQ_UINT32 pathname;
+};
+
+//--------------------------------------------------------------------------------
+
+bool readLNK(const KURL &url, LNKInfo &info)
+{
+ const char* lnkFile = 0;
+
+ TQString tempFile;
+ if ( TDEIO::NetAccess::download(url, tempFile, 0) )
+ lnkFile = tempFile.latin1();
+ else
+ return false;
+
+ kdDebug(7034) << "opening:" << lnkFile << endl;
+ FILE *fd = fopen(lnkFile, "rb");
+ if ( !fd )
+ {
+ kdWarning(7034) << "could not open file " << lnkFile << endl;
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ LNKHeader header;
+
+ if ( fread(&header, sizeof(header), 1, fd) != 1 )
+ {
+ kdWarning(7034) << "wrong header size" << endl;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ if ( memcmp(header.magic, "L\0\0\0", 4) != 0 )
+ {
+ kdWarning(7034) << "wrong magic in header" << endl;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ if ( header.flags & 0x1 ) // the shell item id list is present
+ {
+ TQ_UINT16 len;
+
+ // skip that list
+ if ( (fread(&len, sizeof(len), 1, fd) != 1) || (fseek(fd, len, SEEK_CUR) != 0) )
+ {
+ kdWarning(7034) << "could not read shell item id list" << endl;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+ }
+
+ info.isDirectory = (header.attributes & 0x10);
+
+ if ( ! info.isDirectory ) // not a directory
+ info.fileSize = header.length;
+
+ info.isFileOrDir = (header.flags & 0x2); // points to file or directory
+
+ if ( info.isFileOrDir )
+ {
+ LNKFileLocation loc;
+
+ if ( fread(&loc, sizeof(loc), 1, fd) != 1 )
+ {
+ kdWarning(7034) << "could not read file localtion table" << endl;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ // limit the following "new", because the size to allocate is in the file
+ // which can easily be manipulted to contain a huge number and lead to a crash
+ if ( (loc.totalLen <= sizeof(loc)) || (loc.totalLen > 4096) ) // 4096 is just an arbitrary number I think shall be enough
+ {
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ size_t size = loc.totalLen - sizeof(loc);
+ char *data = new char[size];
+ char *start = data - sizeof(loc);
+
+ if ( fread(data, size, 1, fd) != 1 )
+ {
+ kdWarning(7034) << "could not read pathes data" << endl;
+ delete [] data;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ info.isNetworkPath = !(loc.flags & 0x1);
+
+ if ( !info.isNetworkPath )
+ {
+ info.volumeName = (start + loc.localVolume + 0x10); // volume label
+
+ info.path = TQString();
+
+ if ( *(start + loc.basePath) )
+ {
+ // Don't put any more than "X:" into info.driveName.
+ info.driveName = *(start + loc.basePath);
+ info.driveName += ':';
+
+ // If we in fact do have more than just "X:", store any additional
+ // path information separately in info.path.
+ if ( *(start + loc.basePath + 1) == ':' &&
+ *(start + loc.basePath + 2) != 0)
+ info.path = (start + loc.basePath + 2);
+ }
+
+ if ( *(start + loc.pathname) != 0 )
+ {
+ if ( info.path.isNull() )
+ info.path = (start + loc.pathname);
+ else
+ info.path = info.path + "\\" + (start + loc.pathname);
+ }
+ }
+ else // network path
+ {
+ info.path = TQString("%1\\%2")
+ .arg(start + loc.netVolume + 0x14) // network share name
+ .arg(start + loc.pathname);
+ }
+
+ delete [] data;
+ data = 0;
+
+ if ( header.flags & 0x4 ) // has description string
+ {
+ TQ_UINT16 len;
+
+ if ( fread(&len, sizeof(len), 1, fd) != 1 )
+ {
+ kdWarning(7034) << "could not read description string length" << endl;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ data = new char[len+1]; // this can never be > 65K, so its OK to not check the size
+
+ if ( fread(data, len, 1, fd) != 1 )
+ {
+ kdWarning(7034) << "could not read description string" << endl;
+ delete [] data;
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+ return false;
+ }
+
+ data[len] = 0; // nullbyte seems to miss
+
+ info.description = data;
+
+ delete [] data;
+ }
+ }
+
+ fclose(fd);
+ TDEIO::NetAccess::removeTempFile(tempFile);
+
+ return true;
+}
diff --git a/tdefile-plugins/lnk/read_lnk.h b/tdefile-plugins/lnk/read_lnk.h
new file mode 100644
index 0000000..96f3226
--- /dev/null
+++ b/tdefile-plugins/lnk/read_lnk.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Martin Koller *
+ * m.koller@surfeu.at *
+ * *
+ * This function reads the content of a M$-Windoze .lnk file *
+ * and returns data in the given structure. *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef _READ_LNK_H_
+#define _READ_LNK_H_
+
+#include <tqstring.h>
+class KURL;
+
+struct LNKInfo
+{
+ LNKInfo() : fileSize(0), isNetworkPath(false), isDirectory(false), isFileOrDir(false) {}
+
+ TQ_UINT32 fileSize;
+ bool isNetworkPath;
+ bool isDirectory;
+ bool isFileOrDir;
+ TQString volumeName;
+ TQString driveName;
+ TQString path;
+ TQString description;
+};
+
+bool readLNK(const KURL &url, LNKInfo &info);
+
+#endif
diff --git a/tdefile-plugins/lnk/tdefile_lnk.cpp b/tdefile-plugins/lnk/tdefile_lnk.cpp
new file mode 100644
index 0000000..b706366
--- /dev/null
+++ b/tdefile-plugins/lnk/tdefile_lnk.cpp
@@ -0,0 +1,93 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Martin Koller *
+ * m.koller@surfeu.at *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+// format of a .lnk file retrieved from:
+// http://www.i2s-lab.com/Papers/The_Windows_Shortcut_File_Format.pdf
+
+#include <config.h>
+#include "tdefile_lnk.h"
+#include "read_lnk.h"
+
+#include <kgenericfactory.h>
+
+//--------------------------------------------------------------------------------
+
+typedef KGenericFactory<lnkPlugin> lnkFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_lnk, lnkFactory( "tdefile_lnk" ))
+
+//--------------------------------------------------------------------------------
+
+lnkPlugin::lnkPlugin(TQObject *parent, const char *name,
+ const TQStringList &args)
+ : KFilePlugin(parent, name, args)
+{
+ KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-win-lnk" );
+
+ // our new group
+ KFileMimeTypeInfo::GroupInfo* group = 0;
+ group = addGroupInfo(info, "lnkInfo", i18n("Windows Link File Information"));
+
+ KFileMimeTypeInfo::ItemInfo* item;
+
+ // our new items in the group
+ item = addItemInfo(group, "TargetSize", i18n("Size of Target"), TQVariant::Int);
+ setUnit(item, KFileMimeTypeInfo::Bytes);
+
+ addItemInfo(group, "Where", i18n("Location"), TQVariant::String);
+ addItemInfo(group, "PointsTo", i18n("Points To"), TQVariant::String);
+ addItemInfo(group, "Description", i18n("Description"), TQVariant::String);
+}
+
+//--------------------------------------------------------------------------------
+
+bool lnkPlugin::readInfo( KFileMetaInfo& info, uint /*what*/)
+{
+ KFileMetaInfoGroup group = appendGroup(info, "lnkInfo");
+
+ LNKInfo lnkInfo;
+ bool ret = readLNK(info.url(), lnkInfo);
+
+ if ( ! ret ) return false;
+
+ if ( ! lnkInfo.isDirectory ) // not a directory
+ appendItem(group, "TargetSize", lnkInfo.fileSize);
+
+ if ( ! lnkInfo.isFileOrDir ) // points to something != file or directory
+ return false;
+
+ if ( ! lnkInfo.isNetworkPath )
+ {
+ appendItem(group, "Where", i18n("on Windows disk: %1").arg(lnkInfo.volumeName)); // volume label
+ appendItem(group, "PointsTo", TQString("%1%2").arg(lnkInfo.driveName).arg(lnkInfo.path));
+ }
+ else
+ {
+ appendItem(group, "Where", i18n("on network share"));
+ appendItem(group, "PointsTo", lnkInfo.path);
+ }
+
+ if ( ! lnkInfo.description.isNull() ) // has description string
+ appendItem(group, "Description", lnkInfo.description);
+
+ return true;
+}
+
+#include "tdefile_lnk.moc"
diff --git a/tdefile-plugins/lnk/tdefile_lnk.desktop b/tdefile-plugins/lnk/tdefile_lnk.desktop
new file mode 100644
index 0000000..b7d28c7
--- /dev/null
+++ b/tdefile-plugins/lnk/tdefile_lnk.desktop
@@ -0,0 +1,62 @@
+[Desktop Entry]
+Type=Service
+Name=Windows lnk File Info
+Name[bg]=Информация за файл връзка на Windows
+Name[br]=Titouroù diwar-benn ar restr Windows lnk
+Name[bs]=Windows lnk informacije o datoteci
+Name[ca]=Informació dels fitxers lnk de Windows
+Name[cs]=Informace o Windows lnk souboru
+Name[da]=Information om Windows lnk-fil
+Name[de]=Informationen zur Windows-Verknüpfungsdatei
+Name[el]=Πληροφορίες αρχείου lnk των Windows
+Name[eo]=Vindoza lnk dosiera informo
+Name[es]=Información del archivo lnk de Windows
+Name[et]=Windowsi .lnk-faili info
+Name[eu]=Windowsen Ink fitxategiaren informazioa
+Name[fa]=اطلاعات پروندۀ lnk ویندوز
+Name[fi]=Windows lnk-tiedoston tiedot
+Name[fr]=Informations sur le fichier « .lnk » Windows
+Name[fy]=Windows lnk-triemynformaasje
+Name[ga]=Eolas faoin Chomhad lnk Windows
+Name[gl]=Información de Ficheiros lnk de Windows
+Name[he]= מידע קובץ lnk של Windows
+Name[hi]=विंडो लिंक फ़ाइल जानकारी
+Name[hr]=Podaci Windows prečaca
+Name[hu]=Információ Windows-os Lnk-fájlokról
+Name[is]=Upplýsingar um Windows lnk-skrá
+Name[it]=File di informazioni Windows lnk
+Name[ja]=Windows lnk ファイル情報
+Name[ka]=Windows lnk ფაილის ინფორმაცია
+Name[kk]=Windows жарлық файлдың мәліметі
+Name[km]=ព័ត៌មាន​ឯកសារ​​បង្អួច​ឯកសារ lnk​
+Name[lt]=Windows lnk bylos informacija
+Name[mk]=Информации за Windows Ink-датотека
+Name[ms]=Maklumat Fail Dakwat Tetingkap
+Name[nb]=Informasjon om Windows lnk-fil
+Name[nds]=Informatschonen över de Windows-Linkdatei (.lnk)
+Name[ne]=विन्डोज lnk फाइल सूचना
+Name[nl]=Windows lnk-bestandsinformatie
+Name[nn]=Informasjon om Windows lnk-fil
+Name[pa]=Windows lnk ਫਾਇਲ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja plików lnk systemu Windows
+Name[pt]=Informação do Ficheiro '.lnk' do Windows
+Name[pt_BR]=Informações de Arquivo do Windows
+Name[ru]=Сведения о ярлыке Windows
+Name[sk]=Informácie o súbore Windows lnk
+Name[sl]=Informacija o datoteki Windows .lnk
+Name[sr]=Подаци о Windows-овом .lnk фајлу
+Name[sr@Latn]=Podaci o Windows-ovom .lnk fajlu
+Name[sv]=Information om Windows länkfil
+Name[ta]=விண்டோஸ் இங்க் கோப்பு தகவல்
+Name[tg]=Маълумотҳо дар бораи ярлиқи Windows
+Name[tr]=Windows lnk Dosya Bilgisi
+Name[uk]=Інформація про файл lnk для Windows
+Name[uz]=Windows lnk fayli haqida maʼlumot
+Name[uz@cyrillic]=Windows lnk файли ҳақида маълумот
+Name[vi]=Thông tin tập tin Ink Windows
+Name[zh_CN]=Windows lnk 文件信息
+Name[zh_TW]=Windows lnk 檔資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_lnk
+MimeType=application/x-win-lnk
+PreferredItems=PointsTo,Where,TargetSize,Description
diff --git a/tdefile-plugins/lnk/tdefile_lnk.h b/tdefile-plugins/lnk/tdefile_lnk.h
new file mode 100644
index 0000000..3d43dbc
--- /dev/null
+++ b/tdefile-plugins/lnk/tdefile_lnk.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Martin Koller *
+ * m.koller@surfeu.at *
+ * *
+ * This plugin provides information about the content of a *
+ * M$-Windoze .lnk file, which is useful if you work in a mixed *
+ * Linux/Windoze environment. *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#ifndef __KFILE_LNK_H__
+#define __KFILE_LNK_H__
+
+/**
+ * Note: For further information look into <$TDEDIR/include/tdefilemetainfo.h>
+ */
+#include <tdefilemetainfo.h>
+
+class TQStringList;
+
+class lnkPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ lnkPlugin( TQObject *parent, const char *name, const TQStringList& args );
+
+ virtual bool readInfo( KFileMetaInfo& info, uint what);
+};
+
+#endif // __KFILE_LNK_H__
+
diff --git a/tdefile-plugins/lnk/x-win-lnk.desktop b/tdefile-plugins/lnk/x-win-lnk.desktop
new file mode 100644
index 0000000..18429dc
--- /dev/null
+++ b/tdefile-plugins/lnk/x-win-lnk.desktop
@@ -0,0 +1,61 @@
+[Desktop Entry]
+Type=MimeType
+Comment=Windows Link-File
+Comment[bg]=Файл връзка на Windows
+Comment[bs]=Windows link datoteka
+Comment[ca]=Fitxer enllaç de Windows
+Comment[cs]=Soubor s odkazem Windows
+Comment[da]=Windows link-fil
+Comment[de]=Windows-Verknüpfungsdatei
+Comment[el]=Αρχείο δεσμού των Windows
+Comment[eo]=Vindoza ligdosiero
+Comment[es]=Archivo de enlace de Windows
+Comment[et]=Windowsi link-fail
+Comment[eu]=Windowsen esteka-fitxategia
+Comment[fa]=پروندۀ پیوند ویندوز
+Comment[fi]=Windows linkkitiedosto
+Comment[fr]=Fichier de lien de Windows
+Comment[fy]=Windows snelkeppeling
+Comment[ga]=Comhad Naisc Windows
+Comment[gl]=Ficheiro Windows Link
+Comment[he]=קיצור דרך של Windows
+Comment[hi]=विंडो लिंक-फ़ाइल
+Comment[hr]=Datoteka Windows prečaca
+Comment[hu]=Windows-os Lnk-fájl
+Comment[is]=Windows tengiskrá
+Comment[it]=Windows file di link
+Comment[ja]=Windows リンクファイル
+Comment[ka]=Windows-ის ბმულის ფაილი
+Comment[kk]=Windows сілтеме файлы
+Comment[km]=បង្អួច​ឯកសារ​​តំណ​
+Comment[lt]=Windows bylų nuorodos
+Comment[mk]=Windows Link-датотека
+Comment[ms]=Fail Pautan Tetingkap
+Comment[nb]=Windows Link-fil
+Comment[nds]=Windows-Linkdatei
+Comment[ne]=विन्डोज लिङ्क- फाइल
+Comment[nl]=Windows snelkoppeling
+Comment[nn]=Windows lenkjefil
+Comment[pa]=Windows ਸਬੰਧ-ਫਾਇਲ
+Comment[pl]=Plik odnośnika Windows
+Comment[pt]=Ficheiro Windows Link
+Comment[pt_BR]=Arquivo Link do Windows
+Comment[ru]=Ярлык Windows
+Comment[sk]=Odkaz Windows
+Comment[sl]=Datoteka z bližnjico v Windows
+Comment[sr]=Windows-ов фајл везе
+Comment[sr@Latn]=Windows-ov fajl veze
+Comment[sv]=Windows länkfil
+Comment[ta]=விண்டோஸ் இணைப்பு-கோப்பு
+Comment[tg]=Ярлиқи Windows
+Comment[tr]=Windows Kısayol Dosyası
+Comment[uk]=файл посилання для Windows
+Comment[uz]=Windows bogʻ fayli
+Comment[uz@cyrillic]=Windows боғ файли
+Comment[vi]=Tập tin liên kết Windows
+Comment[zh_CN]=Windows 快捷方式文件
+Comment[zh_TW]=Windows Link 檔
+Hidden=false
+Icon=exec_wine
+MimeType=application/x-win-lnk
+Patterns=*.lnk
diff --git a/tdefile-plugins/mhtml/Makefile.am b/tdefile-plugins/mhtml/Makefile.am
new file mode 100644
index 0000000..3d0b98f
--- /dev/null
+++ b/tdefile-plugins/mhtml/Makefile.am
@@ -0,0 +1,21 @@
+## Makefile.am for folder file meta info plugin
+
+INCLUDES = $(all_includes)
+
+# these are the headers for your project
+noinst_HEADERS = tdefile_mhtml.h
+
+kde_module_LTLIBRARIES = tdefile_mhtml.la
+
+tdefile_mhtml_la_SOURCES = tdefile_mhtml.cpp
+tdefile_mhtml_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_mhtml_la_LIBADD = $(LIB_KIO)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+services_DATA = tdefile_mhtml.desktop
+servicesdir = $(kde_servicesdir)
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/tdefile_mhtml.pot
diff --git a/tdefile-plugins/mhtml/tdefile_mhtml.cpp b/tdefile-plugins/mhtml/tdefile_mhtml.cpp
new file mode 100644
index 0000000..fdf2ffe
--- /dev/null
+++ b/tdefile-plugins/mhtml/tdefile_mhtml.cpp
@@ -0,0 +1,201 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Spiros Georgaras *
+ * sngeorgaras@otenet.gr *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+
+#include <config.h>
+#include "tdefile_mhtml.h"
+
+#include <kgenericfactory.h>
+#include <kmdcodec.h>
+#include <tqstring.h>
+#include <tqcstring.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqtextcodec.h>
+
+typedef KGenericFactory<mhtmlPlugin> mhtmlFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_mhtml, mhtmlFactory( "tdefile_mhtml" ))
+
+mhtmlPlugin::mhtmlPlugin(TQObject *parent, const char *name,
+ const TQStringList &args)
+ : KFilePlugin(parent, name, args)
+{
+ KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-mimearchive" );
+ KFileMimeTypeInfo::GroupInfo* group = 0L;
+ group = addGroupInfo(info, "mhtmlInfo", i18n("Document Information"));
+ KFileMimeTypeInfo::ItemInfo* item;
+ item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String);
+ item = addItemInfo(group, "Sender", i18n("Sender"), TQVariant::String);
+ item = addItemInfo(group, "Recipient", i18n("Recipient"), TQVariant::String);
+ item = addItemInfo(group, "CopyTo", i18n("CC"), TQVariant::String);
+ item = addItemInfo(group, "BlindCopyTo", i18n("BCC"), TQVariant::String);
+ item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String);
+}
+
+bool mhtmlPlugin::readInfo( KFileMetaInfo& info, uint /*what*/)
+{
+ TQString mSender;
+ TQString mRecipient;
+ TQString mCopyTo;
+ TQString mBlindCopyTo;
+ TQString mSubject;
+ TQString mDate;
+ bool canUnfold;
+ if ( info.path().isEmpty() ) // remote file
+ return false;
+
+ TQFile f(info.path());
+ if (!f.open(IO_ReadOnly)) return false;
+ TQTextStream stream(&f);
+ TQString l=stream.readLine();
+ int nFieldsFound = 0;
+ while(!l.isEmpty()){
+ if(l.startsWith("From: ")) {
+ mSender=l.mid(6);
+ nFieldsFound |= 1;
+ canUnfold=TRUE;
+ } else if(l.startsWith("To: ")) {
+ mRecipient=l.mid(4);
+ nFieldsFound |= 2;
+ canUnfold=TRUE;
+ } else if(l.startsWith("Subject: ")) {
+ mSubject=l.mid(9);
+ nFieldsFound |= 4;
+ canUnfold=TRUE;
+ } else if(l.startsWith("Cc: ")) {
+ mCopyTo=l.mid(4);
+ nFieldsFound |= 8;
+ canUnfold=TRUE;
+ } else if(l.startsWith("Bcc: ")) {
+ mBlindCopyTo=l.mid(5);
+ nFieldsFound |= 16;
+ canUnfold=TRUE;
+ } else if(l.startsWith("Date: ")) {
+ mDate=l.mid(6);
+ nFieldsFound |= 32;
+ canUnfold=FALSE;
+ }else if(l.startsWith(" ") || l.startsWith("\t")){
+ // unfold field
+ if(canUnfold){
+ TQString tmp=l.stripWhiteSpace();
+ if(nFieldsFound & 16) mBlindCopyTo=mBlindCopyTo+" "+tmp;
+ else if(nFieldsFound & 8) mCopyTo=mCopyTo+" "+tmp;
+ else if(nFieldsFound & 4) mSubject=mSubject+" "+tmp;
+ else if(nFieldsFound & 2) mRecipient=mRecipient+" "+tmp;
+ else if(nFieldsFound & 1) mSender=mSender+" "+tmp;
+ }
+ }else canUnfold=FALSE;
+ // break out of the loop once the six fields have been found
+ if ( nFieldsFound == 32+16+8+4+2+1 )
+ break;
+ l=stream.readLine();
+ }
+ f.close();
+ KFileMetaInfoGroup group = appendGroup(info, "mhtmlInfo");
+ appendItem(group, "Subject", decodeRFC2047Phrase(mSubject,FALSE));
+ appendItem(group, "Sender", decodeRFC2047Phrase(mSender));
+ appendItem(group, "Recipient", decodeRFC2047Phrase(mRecipient));
+ appendItem(group, "CopyTo", decodeRFC2047Phrase(mCopyTo));
+ appendItem(group, "BlindCopyTo", decodeRFC2047Phrase(mBlindCopyTo));
+ appendItem(group, "Date", mDate);
+ return true;
+}
+
+TQString mhtmlPlugin::decodeRFC2047Phrase(const TQString &msg, bool removeLessGreater){
+ int st=msg.find("=?");
+ int en=-1;
+ TQString msgCopy=msg;
+ TQString decodedText=msgCopy.left(st);
+ TQString encodedText=msgCopy.mid(st);
+ st=encodedText.find("=?");
+ while(st!=-1){
+ en=encodedText.find("?=");
+ while(encodedText.mid(en+2,1)!=" " && en+2<(int)encodedText.length()) en=encodedText.find("?=",en+1);
+ if(en==-1) break;
+ decodedText+=encodedText.left(st);
+ TQString tmp=encodedText.mid(st,en-st+2);
+ encodedText=encodedText.mid(en+2);
+ decodedText+=decodeRFC2047String(tmp);
+ st=encodedText.find("=?",st+1);
+ }
+ decodedText += encodedText;
+ // remove unwanted '<' and '>'
+ if(removeLessGreater){
+ if(decodedText.stripWhiteSpace().startsWith("<") && decodedText.stripWhiteSpace().endsWith(">")){
+ TQString tmp=decodedText.stripWhiteSpace();
+ tmp=tmp.mid(1,tmp.length()-2);
+ decodedText=tmp;
+ }else{
+ TQString dec=decodedText;
+ TQString tmp;
+
+ st=decodedText.find("<");
+ while(st!=-1){
+ st=dec.find("<",st);
+ if(st==0 || (st!=0 && (dec.mid(st-2,2)==", "))){
+ en=dec.find(">",st);
+ if(en==-1 && dec.find(",",st)<en){
+ st++;
+ continue;
+ }
+ dec=dec.left(st)+dec.mid(st+1,en-st-1)+dec.mid(en+1);
+ }else if(st!=-1) st++;
+ }
+ decodedText=dec;
+ }
+ }
+ return decodedText;
+}
+
+TQString mhtmlPlugin::decodeRFC2047String(const TQString &msg){
+ TQString charset;
+ TQString encoding;
+ TQString notEncodedText;
+ TQString encodedText;
+ TQString decodedText;
+ int encEnd=0;
+ if(msg.startsWith("=?") && (encEnd=msg.findRev("?="))!=-1){
+ notEncodedText=msg.mid(encEnd+2);
+ encodedText=msg.left(encEnd);
+ encodedText=encodedText.mid(2,encodedText.length()-2);
+ int questionMark=encodedText.find('?');
+ if(questionMark==-1) return msg;
+ charset=encodedText.left(questionMark).lower();
+ encoding=encodedText.mid(questionMark+1,1).lower();
+ if(encoding!="b" && encoding!="q") return msg;
+ encodedText=encodedText.mid(questionMark+3);
+ if(charset.find(" ")!=-1 && encodedText.find(" ")!=-1) return msg;
+ TQCString tmpIn;
+ TQCString tmpOut;
+ tmpIn = encodedText.local8Bit();
+ if(encoding=="q")tmpOut=KCodecs::quotedPrintableDecode(tmpIn);
+ else tmpOut=KCodecs::base64Decode(tmpIn);
+ if(charset!="us-ascii"){
+ TQTextCodec *codec = TQTextCodec::codecForName(charset.local8Bit());
+ if(!codec) return msg;
+ decodedText=codec->toUnicode(tmpOut);
+ decodedText=decodedText.replace("_"," ");
+ }else decodedText=tmpOut.replace("_"," ");
+ return decodedText + notEncodedText;
+ }else return msg;
+}
+#include "tdefile_mhtml.moc"
+
diff --git a/tdefile-plugins/mhtml/tdefile_mhtml.desktop b/tdefile-plugins/mhtml/tdefile_mhtml.desktop
new file mode 100644
index 0000000..bbcac48
--- /dev/null
+++ b/tdefile-plugins/mhtml/tdefile_mhtml.desktop
@@ -0,0 +1,60 @@
+[Desktop Entry]
+Type=Service
+Name=mhtml Info
+Name[bg]=Информация за mhtml
+Name[br]=Titouroù mhtml
+Name[ca]=Informació mhtml
+Name[cs]=mhtml informace
+Name[da]=mhtml-info
+Name[de]=MHTML-Information
+Name[el]=Πληροφορίες mhtml
+Name[eo]=mhtml informo
+Name[es]=Información mhtml
+Name[et]=mhtmli info
+Name[eu]=mhtml infoa
+Name[fa]=اطلاعات mhtml
+Name[fi]=mhtml tiedot
+Name[fr]=Informations sur « mhtml »
+Name[fy]=mhtml-ynformaasje
+Name[ga]=Eolas mhtml
+Name[gl]=Información de mhtml
+Name[he]=מידע אודות mhtml
+Name[hr]=Podaci o mhtml
+Name[hu]=Mhtml-információ
+Name[is]=Upplýsingar um mhtml
+Name[it]=Informazioni su mhtml
+Name[ja]=mhtml 情報
+Name[ka]=mhtml ინფორმაცია
+Name[kk]=mhtml мәліметі
+Name[km]=ព័ត៌មាន mhtml
+Name[lt]=mhtml info
+Name[mk]=Информации за mhtml
+Name[ms]=Maklumat mhtml
+Name[nb]=mhtml-informasjon
+Name[nds]=MHTML-Informatschonen
+Name[ne]=एमएचटीएमएल सूचना
+Name[nl]=mhtml-informatie
+Name[nn]=mhtml-informasjon
+Name[pa]=mhtml ਜਾਣਕਾਰੀ
+Name[pl]=Informacja mhtml
+Name[pt]=Informações de mhtml
+Name[pt_BR]=Informações sobre mhtml
+Name[ru]=Информация mhtml
+Name[sk]=Informácie o mhtml
+Name[sl]=Informacija o mhtml
+Name[sr]=MHTML информације
+Name[sr@Latn]=MHTML informacije
+Name[sv]=MHTML-information
+Name[ta]=mhtml தகவல்
+Name[tr]=mhtml Bilgisi
+Name[uk]=Інформація про mhtml
+Name[uz]=mhtml fayllari haqida maʼlumot
+Name[uz@cyrillic]=mhtml файллари ҳақида маълумот
+Name[vi]=Thông tin mhtml
+Name[zh_CN]=mhtml 信息
+Name[zh_TW]=mhtml 資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_mhtml
+MimeType=application/x-mimearchive
+PreferredGroups=mhtmlInfo
+PreferredItems=Subject,Sender,Recipient,CopyTo,BlindCopyTo,Date
diff --git a/tdefile-plugins/mhtml/tdefile_mhtml.h b/tdefile-plugins/mhtml/tdefile_mhtml.h
new file mode 100644
index 0000000..50e1231
--- /dev/null
+++ b/tdefile-plugins/mhtml/tdefile_mhtml.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Spiros Georgaras *
+ * sngeorgaras@otenet.gr *
+ * *
+ * 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; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * 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; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+
+#ifndef __KFILE_MHTML_H__
+#define __KFILE_MHTML_H__
+
+/**
+ * Note: For further information look into <$TDEDIR/include/tdefilemetainfo.h>
+ */
+#include <tdefilemetainfo.h>
+
+class TQStringList;
+
+class mhtmlPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ mhtmlPlugin( TQObject *parent, const char *name, const TQStringList& args );
+ virtual bool readInfo( KFileMetaInfo& info, uint what);
+private:
+ TQString decodeRFC2047Phrase(const TQString &msg, bool removeLessGreater=TRUE);
+ TQString decodeRFC2047String(const TQString &msg);
+};
+
+#endif // __KFILE_MHTML_H__
+
diff --git a/tdefile-plugins/txt/Makefile.am b/tdefile-plugins/txt/Makefile.am
new file mode 100644
index 0000000..71c0333
--- /dev/null
+++ b/tdefile-plugins/txt/Makefile.am
@@ -0,0 +1,21 @@
+## Makefile.am for text file meta info plugin
+
+# set the include path for X, qt and KDE
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = tdefile_txt.h
+
+kde_module_LTLIBRARIES = tdefile_txt.la
+
+tdefile_txt_la_SOURCES = tdefile_txt.cpp
+tdefile_txt_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_txt_la_LIBADD = $(LIB_KIO)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/tdefile_txt.pot
+
+services_DATA = tdefile_txt.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/tdefile-plugins/txt/tdefile_txt.cpp b/tdefile-plugins/txt/tdefile_txt.cpp
new file mode 100644
index 0000000..acf7a6d
--- /dev/null
+++ b/tdefile-plugins/txt/tdefile_txt.cpp
@@ -0,0 +1,129 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2002 Nadeem Hasan <nhasan@kde.org>
+ *
+ * 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_txt.h"
+
+#include <kgenericfactory.h>
+#include <kdebug.h>
+
+#include <tqfile.h>
+#include <tqstringlist.h>
+#include <tqregexp.h>
+
+typedef KGenericFactory<KTxtPlugin> TxtFactory;
+
+K_EXPORT_COMPONENT_FACTORY(tdefile_txt, TxtFactory("tdefile_txt"))
+
+KTxtPlugin::KTxtPlugin(TQObject *parent, const char *name,
+ const TQStringList &args) : KFilePlugin(parent, name, args)
+{
+ kdDebug(7034) << "Text file meta info plugin\n";
+ makeMimeTypeInfo( "text/plain" );
+}
+
+void KTxtPlugin::makeMimeTypeInfo(const TQString& mimeType)
+{
+ KFileMimeTypeInfo* info = addMimeTypeInfo(mimeType);
+
+ KFileMimeTypeInfo::GroupInfo* group =
+ addGroupInfo(info, "General", i18n("General"));
+
+ KFileMimeTypeInfo::ItemInfo* item;
+ item = addItemInfo(group, "Lines", i18n("Lines"), TQVariant::Int);
+ setAttributes(item, KFileMimeTypeInfo::Averaged);
+ item = addItemInfo(group, "Words", i18n("Words"), TQVariant::Int);
+ setAttributes(item, KFileMimeTypeInfo::Averaged);
+ item = addItemInfo(group, "Characters", i18n("Characters"), TQVariant::ULongLong);
+ setAttributes(item, KFileMimeTypeInfo::Averaged);
+ item = addItemInfo(group, "Format", i18n("Format"), TQVariant::String);
+}
+
+bool KTxtPlugin::readInfo(KFileMetaInfo& info, uint)
+{
+ if ( info.path().isEmpty() ) // remote file
+ return false;
+
+ TQFile f(info.path());
+ if (!f.open(IO_ReadOnly))
+ return false;
+
+ bool firstline = true;
+ int totLines = 0;
+ int totWords = 0;
+ unsigned long long totChars = f.size();
+ TQString fileFormat;
+ TQString line;
+ bool skipTotals = (totChars > 100*1024); // 100K is the max we read
+
+ unsigned int bytesRead = 0;
+ while (!f.atEnd())
+ {
+ f.readLine(line, 4096);
+
+ int len = line.length();
+
+ // The checks below are necessary to handle embedded NULLs
+ // TQFile::readLine() does not handle them well
+ bytesRead += len;
+ if (bytesRead > totChars)
+ break;
+ if (len == 0)
+ break;
+
+ if (firstline)
+ {
+ firstline = false;
+ if (line[len-1]=='\n')
+ {
+ if (len>=2 && line[len-2]=='\r')
+ fileFormat = i18n("DOS");
+ else
+ fileFormat = i18n("UNIX");
+ }
+ else if (line[len-1]=='\r')
+ fileFormat = i18n("Macintosh");
+ if (skipTotals)
+ break;
+ }
+
+ totWords += (TQStringList::split(TQRegExp("\\s+"), line)).count();
+ totLines++;
+ }
+
+ if (fileFormat.isEmpty())
+ fileFormat = i18n("Unknown");
+
+ kdDebug(7034) << "Lines: " << totLines << endl;
+ kdDebug(7034) << "Words: " << totWords << endl;
+ kdDebug(7034) << "Characters: " << totChars << endl;
+ kdDebug(7034) << "fileFormat: " << fileFormat << endl;
+
+ KFileMetaInfoGroup group = appendGroup(info, "General");
+ if (!skipTotals)
+ {
+ appendItem(group, "Lines", totLines);
+ appendItem(group, "Words", totWords);
+ }
+ appendItem(group, "Characters", totChars);
+ appendItem(group, "Format", fileFormat);
+
+ return true;
+}
+
+#include "tdefile_txt.moc"
diff --git a/tdefile-plugins/txt/tdefile_txt.desktop b/tdefile-plugins/txt/tdefile_txt.desktop
new file mode 100644
index 0000000..ab06d5f
--- /dev/null
+++ b/tdefile-plugins/txt/tdefile_txt.desktop
@@ -0,0 +1,70 @@
+[Desktop Entry]
+Type=Service
+Name=Text File Info
+Name[af]=Teks Lêer Inligting
+Name[ar]=معلومات ملف نصي
+Name[az]=Mətn Faylı Mə'lumatı
+Name[bg]=Информация за текстов файл
+Name[br]=Titouroù diwar-benn ar skrid restr
+Name[bs]=Info o tekst datoteci
+Name[ca]=Info. del fitxer de text
+Name[cs]=Info o textovém souboru
+Name[cy]=Gwybodaeth Ffeil Testun
+Name[da]=Information om tekstfil
+Name[de]=Informationen zur Textdatei
+Name[el]=Πληροφορίες αρχείου κειμένου
+Name[eo]=Tekstdosiera informo
+Name[es]=Información del archivo de texto
+Name[et]=Tekstifaili info
+Name[eu]=Testu fitxategiaren informazioa
+Name[fa]=اطلاعات پروندۀ متن
+Name[fi]=Tekstitiedoston tiedot
+Name[fo]=Tekstfíluupplýsingar
+Name[fr]=Informations sur le fichier texte
+Name[fy]=Teksttriem-ynfo
+Name[gl]=Información de Ficheiro de Texto
+Name[he]=מידע קובץ טקסט
+Name[hi]=पाठ फ़ाइल जानकारी
+Name[hr]=Podaci o tekstualnoj datoteci
+Name[hu]=Információ szöveges fájlokról
+Name[is]=Upplýsingar um textaskrá
+Name[it]=Informazioni File di testo
+Name[ja]=テキストファイル情報
+Name[ka]=ტექსტური ფაილის ინფორმაცია
+Name[kk]=Мәтін файлдың мәліметі
+Name[km]=ព័ត៌មាន​ឯកសារ​អត្ថបទ
+Name[lt]=Teksto bylos informacija
+Name[mk]=Информации за текстуална датотека
+Name[ms]=Maklumat Fail Teks
+Name[nb]=Tekstfilinformasjon
+Name[nds]=Textdatei-Informatschonen
+Name[ne]=पाठ फाइल सूचना
+Name[nl]=Tekstbestand-info
+Name[nn]=Informasjon om tekstfil
+Name[pa]=ਪਾਠ ਫਾਇਲ ਜਾਣਕਾਰੀ
+Name[pl]=Informacja o plikach tekstowych
+Name[pt]=Informações de Ficheiros de Texto
+Name[pt_BR]=Informações Sobre Arquivo texto
+Name[ro]=Informaţii fişier text
+Name[ru]=Информация о текстовом файле
+Name[sk]=Informácie o textovom súbore
+Name[sl]=Informacije o besedilni datoteki
+Name[sr]=Информације о текстуалном фајлу
+Name[sr@Latn]=Informacije o tekstualnom fajlu
+Name[sv]=Information om textfil
+Name[ta]=உரைக் கோப்பு தகவல்
+Name[tg]=Ахборот дар бораи файли матнӣ
+Name[th]=ข้อมูลแฟ้มข้อความ
+Name[tr]=Metin Dosyası Bilgisi
+Name[uk]=Інформація про текстовий файл
+Name[uz]=Matn fayli haqida maʼlumot
+Name[uz@cyrillic]=Матн файли ҳақида маълумот
+Name[vi]=Thông tin tập tin văn bản
+Name[xh]=Ulwazi Lombhalo Wefayile
+Name[zh_CN]=文本文件信息
+Name[zh_TW]=文字檔案資訊
+ServiceTypes=KFilePlugin
+X-TDE-Library=tdefile_txt
+MimeType=text/plain
+PreferredGroups=General
+PreferredItems=Lines,Words,Characters,Format
diff --git a/tdefile-plugins/txt/tdefile_txt.h b/tdefile-plugins/txt/tdefile_txt.h
new file mode 100644
index 0000000..86e80cc
--- /dev/null
+++ b/tdefile-plugins/txt/tdefile_txt.h
@@ -0,0 +1,40 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2002 Nadeem Hasan <nhasan@kde.org>
+ *
+ * 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_TXT_H_
+#define __KFILE_TXT_H_
+
+#include <tdefilemetainfo.h>
+
+class TQStringList;
+
+class KTxtPlugin: public KFilePlugin
+{
+ Q_OBJECT
+
+
+public:
+ KTxtPlugin(TQObject *parent, const char *name, const TQStringList& args);
+ virtual bool readInfo(KFileMetaInfo& info, uint what);
+
+private:
+ void makeMimeTypeInfo(const TQString& mimeType);
+};
+
+#endif