summaryrefslogtreecommitdiffstats
path: root/kbabel/addons/tdefile-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/addons/tdefile-plugins')
-rw-r--r--kbabel/addons/tdefile-plugins/CMakeLists.txt35
-rw-r--r--kbabel/addons/tdefile-plugins/Makefile.am22
-rw-r--r--kbabel/addons/tdefile-plugins/tdefile_po.cpp81
-rw-r--r--kbabel/addons/tdefile-plugins/tdefile_po.desktop61
-rw-r--r--kbabel/addons/tdefile-plugins/tdefile_po.h50
5 files changed, 249 insertions, 0 deletions
diff --git a/kbabel/addons/tdefile-plugins/CMakeLists.txt b/kbabel/addons/tdefile-plugins/CMakeLists.txt
new file mode 100644
index 00000000..57fe6f65
--- /dev/null
+++ b/kbabel/addons/tdefile-plugins/CMakeLists.txt
@@ -0,0 +1,35 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../common
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES tdefile_po.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+
+
+##### tdefile_po (module) #########################
+
+tde_add_kpart( tdefile_po AUTOMOC
+ SOURCES tdefile_po.cpp
+ LINK kbabelcommon-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/kbabel/addons/tdefile-plugins/Makefile.am b/kbabel/addons/tdefile-plugins/Makefile.am
new file mode 100644
index 00000000..2d2b252f
--- /dev/null
+++ b/kbabel/addons/tdefile-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 = tdefile_po.h
+
+kde_module_LTLIBRARIES = tdefile_po.la
+
+tdefile_po_la_SOURCES = tdefile_po.cpp
+tdefile_po_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+tdefile_po_la_LIBADD = ../../common/libkbabelcommon.la $(LIB_KIO)
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) tdefile_po.cpp -o $(podir)/tdefile_po.pot
+
+services_DATA = tdefile_po.desktop
+servicesdir = $(kde_servicesdir)
diff --git a/kbabel/addons/tdefile-plugins/tdefile_po.cpp b/kbabel/addons/tdefile-plugins/tdefile_po.cpp
new file mode 100644
index 00000000..248f6fc1
--- /dev/null
+++ b/kbabel/addons/tdefile-plugins/tdefile_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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the TQt library by Trolltech AS, Norway (or with modified versions
+ of TQt that use the same license as TQt), 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
+ TQt. 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 "tdefile_po.h"
+
+#include <tqstringlist.h>
+
+#include "poinfo.h"
+#include <kgenericfactory.h>
+
+using namespace KBabel;
+
+typedef KGenericFactory<KPoPlugin> POFactory;
+K_EXPORT_COMPONENT_FACTORY(tdefile_po, POFactory("tdefile_po"))
+
+KPoPlugin::KPoPlugin(TQObject *parent, const char *name,
+ const TQStringList& 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"), TQVariant::Int);
+ item = addItemInfo(group, "Fuzzy", i18n("Fuzzy Messages"), TQVariant::Int);
+ item = addItemInfo(group, "Untranslated", i18n("Untranslated Messages"), TQVariant::Int);
+ item = addItemInfo(group, "LastTranslator", i18n("Last Translator"), TQVariant::String);
+ item = addItemInfo(group, "LanguageTeam", i18n("Language Team"), TQVariant::String);
+ item = addItemInfo(group, "Revision", i18n("Revision"), TQVariant::String);
+}
+
+bool KPoPlugin::readInfo(KFileMetaInfo& metaInfo, uint)
+{
+ PoInfo poInfo;
+ TQStringList 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 "tdefile_po.moc"
diff --git a/kbabel/addons/tdefile-plugins/tdefile_po.desktop b/kbabel/addons/tdefile-plugins/tdefile_po.desktop
new file mode 100644
index 00000000..7661ed91
--- /dev/null
+++ b/kbabel/addons/tdefile-plugins/tdefile_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-TDE-Library=tdefile_po
+MimeType=application/x-gettext
+PreferredGroups=CatalogInfo
+PreferredItems=Total,Fuzzy,Untranslated,LastTranslator,LanguageTeam,Revision
diff --git a/kbabel/addons/tdefile-plugins/tdefile_po.h b/kbabel/addons/tdefile-plugins/tdefile_po.h
new file mode 100644
index 00000000..75ed429b
--- /dev/null
+++ b/kbabel/addons/tdefile-plugins/tdefile_po.h
@@ -0,0 +1,50 @@
+/*
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the TQt library by Trolltech AS, Norway (or with modified versions
+ of TQt that use the same license as TQt), 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
+ TQt. 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 <tdefilemetainfo.h>
+
+class TQStringList;
+
+
+class KPoPlugin : public KFilePlugin
+{
+ Q_OBJECT
+
+
+ public:
+ KPoPlugin(TQObject *parent, const char *name, const TQStringList& args);
+ virtual bool readInfo(KFileMetaInfo& info, uint);
+};
+
+#endif // KFILE_PO_H