From bd9e6617827818fd043452c08c606f07b78014a0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kbabel/datatools/context/Makefile.am | 19 ++++ .../datatools/context/kbabel_contexttool.desktop | 100 ++++++++++++++++++ kbabel/datatools/context/main.cc | 115 +++++++++++++++++++++ kbabel/datatools/context/main.h | 52 ++++++++++ 4 files changed, 286 insertions(+) create mode 100644 kbabel/datatools/context/Makefile.am create mode 100644 kbabel/datatools/context/kbabel_contexttool.desktop create mode 100644 kbabel/datatools/context/main.cc create mode 100644 kbabel/datatools/context/main.h (limited to 'kbabel/datatools/context') diff --git a/kbabel/datatools/context/Makefile.am b/kbabel/datatools/context/Makefile.am new file mode 100644 index 00000000..4d4a7c0e --- /dev/null +++ b/kbabel/datatools/context/Makefile.am @@ -0,0 +1,19 @@ + +INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes) +kbabel_contexttool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la + +####### Files + +kde_module_LTLIBRARIES = kbabel_contexttool.la + +kbabel_contexttool_la_SOURCES = main.cc + +kbabel_contexttool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined + +noinst_HEADERS = main.h + +kbabel_contexttool_la_METASOURCES = AUTO + +service_DATA = kbabel_contexttool.desktop +servicedir = $(kde_servicesdir) + diff --git a/kbabel/datatools/context/kbabel_contexttool.desktop b/kbabel/datatools/context/kbabel_contexttool.desktop new file mode 100644 index 00000000..482fefcf --- /dev/null +++ b/kbabel/datatools/context/kbabel_contexttool.desktop @@ -0,0 +1,100 @@ +[Desktop Entry] +Name=Translated Context Info Validation for KBabel +Name[bg]=Валидност на контекстната информация - KBabel +Name[bs]=Provjera prevedenih kontekst informacija za KBabel +Name[ca]=Validació de la informació al context traduït per a KBabel +Name[cs]=Validace přeložených kontextových informací +Name[cy]=Dilysiant Gwybodaeth Cyd-destun wedi'i cyfieithu i KBabel +Name[da]=Oversat sammenhængsinfo-validering for KBabel +Name[de]=Kontextinfo-Überprüfung für KBabel +Name[el]=Έλεγχος εγκυρότητας μεταφρασμένων σχετικών πληροφοριών για το KBabel +Name[es]=Validación de información de contexto traducida para KBabel +Name[et]=KBabeli tõlgitud kontekstiinfo kontrollija +Name[eu]=Itzulitako kontestuen informazioaren balidazioa KBabel-entzat +Name[fa]=اعتبارسنجی اطلاعات متن ترجمه‌شده برای KBabel +Name[fi]=Käännetyn kontekstitiedon tarkistus KBabelissa +Name[fr]=Validation des informations de contexte de traduction pour KBabel +Name[gl]=Validación da Información de Contexto para KBabel +Name[hi]=के-बेबल के लिए अनूदित कॉन्टेक्स्ट जानकारी वेलिडेशन +Name[hu]=Ellenőrző a fordítási kontextushoz a KBabelben +Name[is]=Staðfesting þýddra samhengisupplýsinga fyrir KBabel +Name[it]=Convalida delle informazioni di contesto tradotte per KBabel +Name[ja]=KBabel 翻訳された文脈情報を検索 +Name[ka]=თარგმნის კონტექსტის ინფორმაცია KBabel-სთვის +Name[kk]=KBabel-дың аударылған контекстік мәліметін тексеру +Name[lt]=KBabel išverstos kontekstinės informacijos patikros įrankis +Name[ms]=Pengesahan Info Konteks Telah Diterjemah untuk KBabel +Name[nb]=Sjekk av oversatt sammenhengsinformasjon i KBabel +Name[nds]=Prööv op översett Infokontext för KBabel +Name[ne]=केब्याबलका लागि अनुबाद गरिएको प्रसङ्ग सूचना प्रमाणीकरण +Name[nl]=Vertaalde contextinformatie-validatie voor KBabel +Name[nn]=Sjekk av omsett samanhengsinformasjon i KBabel +Name[pl]=Sprawdzanie kontekstu tłumaczonej informacji dla KBabel +Name[pt]=Validação da Informação de Contexto do KBabel +Name[pt_BR]=Validação de Informações de Contexto Traduzidas para o KBabel +Name[ru]=Проверка переведённой контекстной информации для KBabel +Name[sk]=Kontrola kontextu v preklade pre KBabel +Name[sl]=Potrjevalnik informacij prevedene vsebine za KBabel +Name[sr]=Овера преведених контекстних информација за KBabel +Name[sr@Latn]=Overa prevedenih kontekstnih informacija za KBabel +Name[sv]=Validering av översatt sammanhangsinformation för Kbabel +Name[ta]= Kபாபேலுக்கு மொழிபெயர்ப்பு சூழல் தகவல் செல்லுபடியாக்கம் +Name[tg]=Тафтиши ахбороти тарҷумашудаи матнӣ барои KBabel +Name[tr]=KBabel için Çevrilen Bağlam Bilgisi Denetimi +Name[uk]=Перевірка інформації контексту перекладу для KBabel +Name[zh_CN]=KBabel 的上下文信息翻译检查器 +Name[zh_TW]=KBabel 的已翻譯內容資訊確認 +ValidationString=context information +X-KDE-Library=kbabel_contexttool +Type=Service +Commands=validate +Comment=Look for Translated Context Info +Comment[bg]=Търсене на контекстна информация за преведените +Comment[bs]=Potraži prevedene kontekstne informacije +Comment[ca]=Mira la informació al context traduït +Comment[cs]=Vyhledat přeložené kontextové informace +Comment[cy]=Chwilio am Gwybodaeth Cyd-destun wedi'i cyfieithu +Comment[da]=Kig efter oversat sammenhængsinfo +Comment[de]=Suche nach übersetzter Kontextinformation +Comment[el]=Έλεγχος για μεταφρασμένες σχετικές πληροφορίες +Comment[es]=Buscar información de contexto traducida +Comment[et]=Tõlgitud kontekstiinfo otsimine +Comment[eu]=Bilatu itzulitako kontestuaren informazioa +Comment[fa]=جستجوی اطلاعات متن ترجمه‌شده +Comment[fi]=Etsi käännettyä kontekstitietoa +Comment[fr]=Analyse les informations de contexte de traduction +Comment[gl]=Verificar a información de contexto +Comment[hi]=अनूदित कॉन्टेक्स्ट जानकारी के लिए देखें +Comment[hu]=A kontextusfordítások kiszűrése +Comment[is]=Leita að þýddum samhengisupplýsingum +Comment[it]=Cerca informazioni di contesto tradotte +Comment[ja]=翻訳された文脈情報を検索 +Comment[ka]=თარგმნის კონტექსტის ინფორმაციის ძიება +Comment[kk]=Аударылған контекстік мәліметін қарау +Comment[lt]=Ieškoti išverstos kontekstinės informacijos +Comment[ms]=Cari Info Konteks Telah Diterjemah +Comment[nb]=Se etter oversatt kontekstinformasjon +Comment[nds]=Op översett Kontextinformatschonen pröven +Comment[ne]=अनुबाद गरिएको प्रसङ्ग सूचना अवलोकन +Comment[nl]=Vertaalde contextinformatie zoeken +Comment[nn]=Sjå etter omsett samanhengsinformasjon +Comment[pl]=Sprawdzenie kontekstu tłumaczonej informacji +Comment[pt]=Verificar a existência de traduções da informação de contexto +Comment[pt_BR]=Procura por Informações de Contexto Traduzidas +Comment[ru]=Поиск переведённой контекстной информации +Comment[sk]=Hľadanie preloženej kontextovej informácie +Comment[sl]=Vpogled v Informacije prevedene vsebine +Comment[sr]=Изглед за преведене контекстне информације +Comment[sr@Latn]=Izgled za prevedene kontekstne informacije +Comment[sv]=Leta efter översatt sammanhangsinformation +Comment[ta]= மொழிபெயர்ப்பு சூழல் தகவலை பார் +Comment[tg]=Ҷустуҷӯи ахбороти тарҷумашудаи матнӣ +Comment[tr]=Çevrilen Bağlam Bilgisi için Görünüş +Comment[uk]=Пошук за інформацією контексту перекладу +Comment[zh_CN]=查找翻译的上下文信息 +Comment[zh_TW]=尋找已翻譯的內容資訊 +Shortcuts=Ctrl+L +ServiceTypes=KDataTool,KBabelValidator +DataType=CatalogItem +DataMimeTypes=application/x-kbabel-catalogitem +ReadOnly=true diff --git a/kbabel/datatools/context/main.cc b/kbabel/datatools/context/main.cc new file mode 100644 index 00000000..19af3afd --- /dev/null +++ b/kbabel/datatools/context/main.cc @@ -0,0 +1,115 @@ +/* This file is part of KBabel + based Copyright (C) 1998, 1999 Torben Weis + 2002 Stanislav Visnovsky + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. 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 +#include "catalogitem.h" +#include "catalogsettings.h" +#include "main.h" + +#include +#include +#include +#include +#include +#include + +/*************************************************** + * + * Factory + * + ***************************************************/ + +K_EXPORT_COMPONENT_FACTORY( kbabel_contexttool, KGenericFactory ( "kbabeldatatool" ) ) + +using namespace KBabel; + +ContextTool::ContextTool( QObject* parent, const char* name, const QStringList & ) + : KDataTool( parent, name ), _cache_origin( 0 ) +{ + i18n("what check found errors","context info"); +} + +bool ContextTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype ) +{ + if ( command != "validate" ) + { + kdDebug(KBABEL) << "Context Tool does only accept the command 'validate' and 'shortcut'" << endl; + kdDebug(KBABEL) << " The commands " << command << " is not accepted" << endl; + return FALSE; + } + + // Check wether we can accept the data + if ( datatype != "CatalogItem" ) + { + kdDebug(KBABEL) << "Context Tool only accepts datatype CatalogItem" << endl; + return FALSE; + } + + if ( mimetype != "application/x-kbabel-catalogitem" ) + { + kdDebug(KBABEL) << "Context Tool only accepts mimetype application/x-kbabel-catalogitem" << endl; + return FALSE; + } + + if( command == "validate" ) + { + CatalogItem* item = (CatalogItem*)(data); + + if( _cache_origin != item->project() ) + { + _context = item->project()->miscSettings().contextInfo; + _cache_origin = item->project(); + } + + bool hasError = false; + + if(!item->isUntranslated() && item->msgid().first().contains(_context) + && item->msgstr().first().contains(_context) ) + { + hasError = true; + } + + if(hasError) + { + item->appendError( "context info" ); + } + else + { + item->removeError( "context info" ); + } + + return !hasError; + } + return FALSE; +} + +#include "main.moc" diff --git a/kbabel/datatools/context/main.h b/kbabel/datatools/context/main.h new file mode 100644 index 00000000..99035691 --- /dev/null +++ b/kbabel/datatools/context/main.h @@ -0,0 +1,52 @@ +/* This file is part of KBabel + based on Copyright (C) 1998, 1999 Torben Weis + 2002 Stanislav Visnovsky + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. 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 __main_h__ +#define __main_h__ + +#include "kbproject.h" + +#include + +class ContextTool : public KDataTool +{ + Q_OBJECT + +public: + ContextTool( QObject* parent, const char* name, const QStringList & ); + virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype); +private: + KBabel::Project::Ptr _cache_origin; + QRegExp _context; +}; + +#endif -- cgit v1.2.1