diff options
Diffstat (limited to 'kbabel/addons/kfile-plugins')
-rw-r--r-- | kbabel/addons/kfile-plugins/Makefile.am | 22 | ||||
-rw-r--r-- | kbabel/addons/kfile-plugins/kfile_po.cpp | 81 | ||||
-rw-r--r-- | kbabel/addons/kfile-plugins/kfile_po.desktop | 61 | ||||
-rw-r--r-- | kbabel/addons/kfile-plugins/kfile_po.h | 49 |
4 files changed, 213 insertions, 0 deletions
diff --git a/kbabel/addons/kfile-plugins/Makefile.am b/kbabel/addons/kfile-plugins/Makefile.am new file mode 100644 index 00000000..fab776e0 --- /dev/null +++ b/kbabel/addons/kfile-plugins/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for po file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = -I$(srcdir)/../../common/ $(all_includes) + +# these are the headers for the project +noinst_HEADERS = kfile_po.h + +kde_module_LTLIBRARIES = kfile_po.la + +kfile_po_la_SOURCES = kfile_po.cpp +kfile_po_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kfile_po_la_LIBADD = ../../common/libkbabelcommon.la $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) kfile_po.cpp -o $(podir)/kfile_po.pot + +services_DATA = kfile_po.desktop +servicesdir = $(kde_servicesdir) diff --git a/kbabel/addons/kfile-plugins/kfile_po.cpp b/kbabel/addons/kfile-plugins/kfile_po.cpp new file mode 100644 index 00000000..3b9b1a49 --- /dev/null +++ b/kbabel/addons/kfile-plugins/kfile_po.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2002 Marco Wegner <mail@marcowegner.de> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. + */ + + +#include "kfile_po.h" + +#include <qstringlist.h> + +#include "poinfo.h" +#include <kgenericfactory.h> + +using namespace KBabel; + +typedef KGenericFactory<KPoPlugin> POFactory; +K_EXPORT_COMPONENT_FACTORY(kfile_po, POFactory("kfile_po")) + +KPoPlugin::KPoPlugin(QObject *parent, const char *name, + const QStringList& args) + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo("application/x-gettext"); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo(info, "CatalogInfo", i18n("Catalog Information")); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo(group, "Total", i18n("Total Messages"), QVariant::Int); + item = addItemInfo(group, "Fuzzy", i18n("Fuzzy Messages"), QVariant::Int); + item = addItemInfo(group, "Untranslated", i18n("Untranslated Messages"), QVariant::Int); + item = addItemInfo(group, "LastTranslator", i18n("Last Translator"), QVariant::String); + item = addItemInfo(group, "LanguageTeam", i18n("Language Team"), QVariant::String); + item = addItemInfo(group, "Revision", i18n("Revision"), QVariant::String); +} + +bool KPoPlugin::readInfo(KFileMetaInfo& metaInfo, uint) +{ + PoInfo poInfo; + QStringList wordList; + ConversionStatus status = PoInfo::info(metaInfo.path(), poInfo, wordList, false, false, false); + if (status == OK) { + KFileMetaInfoGroup group = appendGroup(metaInfo, "CatalogInfo"); + + appendItem(group, "Total", poInfo.total); + appendItem(group, "Fuzzy", poInfo.fuzzy); + appendItem(group, "Untranslated", poInfo.untranslated); + appendItem(group, "LastTranslator", poInfo.lastTranslator); + appendItem(group, "LanguageTeam", poInfo.languageTeam); + appendItem(group, "Revision", poInfo.revision); + + return true; + } + return false; +} + +#include "kfile_po.moc" diff --git a/kbabel/addons/kfile-plugins/kfile_po.desktop b/kbabel/addons/kfile-plugins/kfile_po.desktop new file mode 100644 index 00000000..c1848a58 --- /dev/null +++ b/kbabel/addons/kfile-plugins/kfile_po.desktop @@ -0,0 +1,61 @@ +[Desktop Entry] +Type=Service +Name=Catalog Information +Name[af]=Katalogus Informasie +Name[bg]=Информация за каталог +Name[br]=Titouroù diwar-benn ar c'hatalog +Name[bs]=Katalog informacije +Name[ca]=Informació de catàleg +Name[cs]=Informace o katalogu +Name[cy]=Gwybodaeth Catalog +Name[da]=Kataloginformation +Name[de]=Katalog-Information +Name[el]=Πληροφορίες καταλόγου +Name[en_GB]=Catalogue Information +Name[eo]=Kataloginformoj +Name[es]=Información de catálogo +Name[et]=Kataloogi info +Name[eu]=Katalogo informatizioa +Name[fa]=اطلاعات فهرست +Name[fi]=Käännöspaketin tiedot +Name[fr]=Informations du catalogue +Name[ga]=Eolas Catalóga +Name[gl]=Información do Catálogo +Name[he]=מידע קטלוג +Name[hi]=केटलॉग जानकारी +Name[hr]=Informacije o katalogu +Name[hu]=Katalógusjellemzők +Name[is]=Upplýsingar um þýðingaskrár +Name[it]=Informazioni sul catalogo +Name[ja]=カタログ情報 +Name[ka]=კატალოგის ინფორმაცია +Name[kk]=Каталог мәліметі +Name[lt]=Katalogo informacija +Name[ms]=Maklumat Katalog +Name[nb]=Kataloginformasjon +Name[nds]=Katalooginformatschoon +Name[ne]=विवरणिका सूचना +Name[nl]=Catalogusinformatie +Name[nn]=Kataloginformasjon +Name[pa]=ਸੂਚੀ ਜਾਣਕਾਰੀ +Name[pl]=Informacje o tłumaczeniu +Name[pt]=Informações do Catálogo +Name[pt_BR]=Informação do Catálogo +Name[ru]=Сведения о файле сообщений +Name[sk]=Informácie o katalógu +Name[sl]=Informacije o katalogu +Name[sr]=Информације о каталогу +Name[sr@Latn]=Informacije o katalogu +Name[sv]=Kataloginformation +Name[ta]=விவரப்பட்டி தகவல் +Name[tg]=Маълумот дар бораи каталог +Name[tr]=Katalog Bilgisi +Name[uk]=Інформація каталогу +Name[xh]=Ulwazi Lwencwadi yemifanekiso +Name[zh_CN]=目录信息 +Name[zh_TW]=類別資訊 +ServiceTypes=KFilePlugin +X-KDE-Library=kfile_po +MimeType=application/x-gettext +PreferredGroups=CatalogInfo +PreferredItems=Total,Fuzzy,Untranslated,LastTranslator,LanguageTeam,Revision diff --git a/kbabel/addons/kfile-plugins/kfile_po.h b/kbabel/addons/kfile-plugins/kfile_po.h new file mode 100644 index 00000000..942a62dc --- /dev/null +++ b/kbabel/addons/kfile-plugins/kfile_po.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2002 Marco Wegner <mail@marcowegner.de> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. + + */ + + +#ifndef KFILE_PO_H +#define KFILE_PO_H + +#include <kfilemetainfo.h> + +class QStringList; + + +class KPoPlugin : public KFilePlugin +{ + Q_OBJECT + + public: + KPoPlugin(QObject *parent, const char *name, const QStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint); +}; + +#endif // KFILE_PO_H |