diff options
author | Timothy Pearson <[email protected]> | 2013-01-27 01:05:39 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-01-27 01:05:39 -0600 |
commit | ff94d46e423398804d2ae63faeb114c2cf604fc4 (patch) | |
tree | 4481ffd491d15ac15081cea46d7cc298ef6351a4 /tdefile-plugins/ts | |
parent | b9553cef2a3cd9f5b89c8aca6f4b7781a079dbb7 (diff) | |
download | tdesdk-ff94d46e423398804d2ae63faeb114c2cf604fc4.tar.gz tdesdk-ff94d46e423398804d2ae63faeb114c2cf604fc4.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdefile-plugins/ts')
-rw-r--r-- | tdefile-plugins/ts/CMakeLists.txt | 35 | ||||
-rw-r--r-- | tdefile-plugins/ts/Makefile.am | 21 | ||||
-rw-r--r-- | tdefile-plugins/ts/tdefile_ts.cpp | 93 | ||||
-rw-r--r-- | tdefile-plugins/ts/tdefile_ts.desktop | 54 | ||||
-rw-r--r-- | tdefile-plugins/ts/tdefile_ts.h | 40 |
5 files changed, 243 insertions, 0 deletions
diff --git a/tdefile-plugins/ts/CMakeLists.txt b/tdefile-plugins/ts/CMakeLists.txt new file mode 100644 index 00000000..ff95bff9 --- /dev/null +++ b/tdefile-plugins/ts/CMakeLists.txt @@ -0,0 +1,35 @@ +################################################# +# +# (C) 2012 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} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_ts.desktop + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_ts (module) ######################### + +tde_add_kpart( tdefile_ts AUTOMOC + SOURCES tdefile_ts.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/ts/Makefile.am b/tdefile-plugins/ts/Makefile.am new file mode 100644 index 00000000..bb46c13c --- /dev/null +++ b/tdefile-plugins/ts/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_ts.h + +kde_module_LTLIBRARIES = tdefile_ts.la + +tdefile_ts_la_SOURCES = tdefile_ts.cpp +tdefile_ts_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_ts_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_ts.pot + +services_DATA = tdefile_ts.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ts/tdefile_ts.cpp b/tdefile-plugins/ts/tdefile_ts.cpp new file mode 100644 index 00000000..2b136a09 --- /dev/null +++ b/tdefile-plugins/ts/tdefile_ts.cpp @@ -0,0 +1,93 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Carsten Niehaus <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "tdefile_ts.h" + +#include <kgenericfactory.h> +#include <kdebug.h> + +#include <tqfile.h> +#include <tqstringlist.h> + +typedef KGenericFactory<KTsPlugin> TsFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_ts, TsFactory("tdefile_ts")) + +KTsPlugin::KTsPlugin(TQObject *parent, const char *name, + const TQStringList &args) : KFilePlugin(parent, name, args) +{ + makeMimeTypeInfo( "application/x-linguist" ); +} + +void KTsPlugin::makeMimeTypeInfo(const TQString& mimeType) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo(mimeType); + + KFileMimeTypeInfo::GroupInfo* group = + addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + item = addItemInfo(group, "Messages", i18n("Messages"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Translated", i18n("Translated"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Untranslated", i18n("Untranslated"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + item = addItemInfo(group, "Obsolete", i18n("Obsolete"), TQVariant::Int); +} + +bool KTsPlugin::readInfo(KFileMetaInfo& info, uint) +{ + TQFile f(info.path()); + if (!f.open(IO_ReadOnly)) + return false; + + int messages = 0; + int untranslated = 0; + int obsolete = 0; + + TQTextStream stream( &f ); + TQString line = stream.readLine(); + + // is it really a linguist file? + if (!line.contains("<!DOCTYPE TS>", false)) + return false; + + while (!stream.eof()) + { + line = stream.readLine(); + + if (line.contains("type=\"obsolete\"")) obsolete++; + + if (line.contains("<source>")) messages++; + + if (line.contains("type=\"unfinished\"")) untranslated++; + + } + + KFileMetaInfoGroup group = appendGroup(info, "General"); + appendItem(group, "Messages", messages); + appendItem(group, "Translated", messages-untranslated-obsolete); + appendItem(group, "Untranslated", untranslated); + appendItem(group, "Obsolete", obsolete); + + return true; +} + +#include "tdefile_ts.moc" diff --git a/tdefile-plugins/ts/tdefile_ts.desktop b/tdefile-plugins/ts/tdefile_ts.desktop new file mode 100644 index 00000000..1d4faebb --- /dev/null +++ b/tdefile-plugins/ts/tdefile_ts.desktop @@ -0,0 +1,54 @@ +[Desktop Entry] +Type=Service +Name=Qt Linguist File Info +Name[bg]=Информация за файла Qt Linguist +Name[br]=Restr titouroù Qt Linguist +Name[bs]=Qt Linguist informacije o datoteci +Name[ca]=Informació fitxer de Qt Linguist +Name[cs]=Info o souboru Qt Linguist +Name[cy]=Gwybodaeth Ffeil Qt Linguist +Name[da]=Qt Linguist Fil-info +Name[de]=Qt Linguist-Dateiinfo +Name[el]=Πληροφορίες αρχείου Qt Linguist +Name[es]=Información de archivo de Qt Linguist +Name[et]=Qt Linguisti faili info +Name[eu]=Qt Linguist fitxategi informazioa +Name[fa]=اطلاعات پروندۀ زبانشناسQt +Name[fi]=Qt Linquist -tiedoston tiedot +Name[fr]=Fichier d'informations Qt Linguist +Name[ga]=Eolas faoi Chomhad Qt Linguist +Name[gl]=Información do Ficheiro de Qt Linguist +Name[hi]=क्यूटी लिंग्विस्ट फ़ाइल जानकारी +Name[hu]=Qt Linguist fájljellemzők +Name[is]=Qt Linguist skráarupplýsingar +Name[it]=Informazioni file per Qt Linguist +Name[ja]=Qt Linguist ファイル情報 +Name[ka]=Qt Linguist ფაილის ინფორმაცია +Name[kk]=Qt Linguist файл мәліметі +Name[lt]=Qt Linguist bylos informacija +Name[nb]=Informasjon om Qt Linguist-fil +Name[nds]=QtLinguist-Datei-Info +Name[ne]=Qt बहुभाषी फाइल सूचना +Name[nl]=Qt Linquïst-bestandsinformatie +Name[nn]=Informasjon om Qt Linguist-fil +Name[pa]=Qt Linguist ਫਾਇਲ ਜਾਣਕਾਰੀ +Name[pl]=Informacja pliku Qt Linguist +Name[pt]=Informação do Ficheiro do Qt Linguist +Name[pt_BR]=Arquivo de Informações de Lingüística do Qt +Name[ru]=Информация о файле в формате Qt Linguist +Name[sk]=Informácie pre Qt Linguist +Name[sl]=Informacije o Qt Linguist +Name[sr]=Информације о фајлу Qt Linguist-а +Name[sr@Latn]=Informacije o fajlu Qt Linguist-a +Name[sv]=Qt Linguist-filinformation +Name[ta]=Qt மொழியியல் கோப்புகள் தகவல் +Name[tg]=Ахборот дар бораи файл дар формати Qt Linguist +Name[tr]=Qt Dilbilimci Dosya Bilgisi +Name[uk]=інформація про файл формату Qt Linguist +Name[zh_CN]=Qt 语言大师文件信息 +Name[zh_TW]=Qt 語言檔資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ts +MimeType=application/x-linguist +PreferredGroups=General +PreferredItems=Messages,Translated,Untranslated,Fuzzi diff --git a/tdefile-plugins/ts/tdefile_ts.h b/tdefile-plugins/ts/tdefile_ts.h new file mode 100644 index 00000000..0f03fac1 --- /dev/null +++ b/tdefile-plugins/ts/tdefile_ts.h @@ -0,0 +1,40 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Carsten Niehaus <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_TS_H_ +#define __KFILE_TS_H_ + +#include <tdefilemetainfo.h> + +class TQStringList; + +class KTsPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KTsPlugin(TQObject *parent, const char *name, const TQStringList& args); + virtual bool readInfo(KFileMetaInfo& info, uint what); + +private: + void makeMimeTypeInfo(const TQString& mimeType); +}; + +#endif |