summaryrefslogtreecommitdiffstats
path: root/kbabel/datatools/equations
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/datatools/equations')
-rw-r--r--kbabel/datatools/equations/Makefile.am19
-rw-r--r--kbabel/datatools/equations/kbabel_equationstool.desktop104
-rw-r--r--kbabel/datatools/equations/main.cc113
-rw-r--r--kbabel/datatools/equations/main.h50
4 files changed, 286 insertions, 0 deletions
diff --git a/kbabel/datatools/equations/Makefile.am b/kbabel/datatools/equations/Makefile.am
new file mode 100644
index 00000000..9b49892d
--- /dev/null
+++ b/kbabel/datatools/equations/Makefile.am
@@ -0,0 +1,19 @@
+
+INCLUDES = -I$(srcdir)/../../common -I../../common $(all_includes)
+kbabel_equationstool_la_LIBADD = $(LIB_KIO) ../../common/libkbabelcommon.la
+
+####### Files
+
+kde_module_LTLIBRARIES = kbabel_equationstool.la
+
+kbabel_equationstool_la_SOURCES = main.cc
+
+kbabel_equationstool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined
+
+noinst_HEADERS = main.h
+
+kbabel_equationstool_la_METASOURCES = AUTO
+
+service_DATA = kbabel_equationstool.desktop
+servicedir = $(kde_servicesdir)
+
diff --git a/kbabel/datatools/equations/kbabel_equationstool.desktop b/kbabel/datatools/equations/kbabel_equationstool.desktop
new file mode 100644
index 00000000..cc3544a5
--- /dev/null
+++ b/kbabel/datatools/equations/kbabel_equationstool.desktop
@@ -0,0 +1,104 @@
+[Desktop Entry]
+Name=Equation Validation for KBabel
+Name[bg]=Валидност на изравняването - KBabel
+Name[bs]=Provjera jednakosti za KBabel
+Name[ca]=Validació de les equacions per a KBabel
+Name[cs]=Validace rovnic
+Name[cy]=Dilysiant Hafaliad i KBabel
+Name[da]=Lignings-validering for KBabel
+Name[de]=Formel-Überprüfung für KBabel
+Name[el]=Έλεγχος εγκυρότητας εξισώσεων για το KBabel
+Name[es]=Validación de ecuaciones para KBabel
+Name[et]=KBabeli võrduste kontrollija
+Name[eu]=Ekuazioen balidazioa KBabel-entzat
+Name[fa]=اعتبارسنجی معادله برای KBabel
+Name[fi]=Yhtälöiden tarkistus KBabelissa
+Name[fr]=Validateur de similitudes pour KBabel
+Name[ga]=Bailíochtú Cothromóidí le haghaidh KBabel
+Name[gl]=Validación de ecuacións para KBabel
+Name[hi]=के-बेबल के लिए समीकरण वेलिडेशन
+Name[hu]=Egyenletellenőrző a KBabelhez
+Name[is]=Jöfnustaðfesting fyrir KBabel
+Name[it]=Convalida delle equazioni per KBabel
+Name[ja]=KBabel 等式検証
+Name[ka]=KBabel-ს ფორმულათა დამოწმება
+Name[kk]=KBabel-дың баламаларын тексеруі
+Name[lt]=KBabel lygybių patikros įrankis
+Name[ms]=Pengesahan Persamaan untuk KBabel
+Name[nb]=Likningssjekk for KBabel
+Name[nds]=Gliekenprööv för KBabel
+Name[ne]=केब्याबलका लागि समीकरण प्रमाणीकरण
+Name[nl]=Vergelijkingenvalidatie voor KBabel
+Name[nn]=Likningssjekk for KBabel
+Name[pl]=Sprawdzenie równań w KBabel
+Name[pt]=Validação de Equações para o KBabel
+Name[pt_BR]=Validação de Equação para o KBabel
+Name[ru]=Проверка уравнений для KBabel
+Name[sk]=Kontrola rovníc pre KBabel
+Name[sl]=Potrjevalnik enačb za KBabel
+Name[sr]=Овера једначина за KBabel
+Name[sr@Latn]=Overa jednačina za KBabel
+Name[sv]=Validering av ekvationer för Kbabel
+Name[ta]= Kபாபேலுக்கு சமன்பாடு செல்லுபடிச் சோதனை
+Name[tg]=Тафтиши баробар барои KBabel
+Name[tr]=KBabel için Denklem Denetimi
+Name[uk]=Перевірка рівнянь для KBabel
+Name[zh_CN]=KBabel 的等式检查器
+Name[zh_TW]=KBabel 的等式檢查器
+X-KDE-Library=kbabel_equationstool
+Type=Service
+Commands=validate
+Comment=Check Equations
+Comment[bg]=Проверка на изравняването
+Comment[bs]=Provjeri jednakosti
+Comment[ca]=Comprova les equacions
+Comment[cs]=Zkontrolovat rovnice
+Comment[cy]=Gwirio Hafaliadau
+Comment[da]=Tjek ligninger
+Comment[de]=Formeln prüfen
+Comment[el]=Έλεγχος εξισώσεων
+Comment[es]=Comprobar ecuaciones
+Comment[et]=Võrduste kontroll
+Comment[eu]=Egiaztatu ekuazioak
+Comment[fa]=بررسی معادله‌ها
+Comment[fi]=Tarkista yhtälöt
+Comment[fr]=Vérifier les identités
+Comment[ga]=Seiceáil Cothromóidí
+Comment[gl]=Verifica as ecuacións
+Comment[he]=בודק משוואות
+Comment[hi]=समीकरण जांच करें
+Comment[hu]=Az egyenletek ellenőrzése
+Comment[is]=Athuga jöfnur
+Comment[it]=Controlla equazioni
+Comment[ja]= 等式を検証
+Comment[ka]=ფორმულათა შემოწმება
+Comment[kk]=Баламаларды тексеру
+Comment[lt]=Tikrinti lygybes
+Comment[ms]=Periksa Persamaan
+Comment[nb]=Sjekk likninger
+Comment[nds]=Glieken pröven
+Comment[ne]=समीकरण जाँच गर्नुहोस्
+Comment[nl]=Vergelijkingen controleren
+Comment[nn]=Sjekk likningar
+Comment[pa]=ਸਮੀਕਰਨ ਜਾਂਚ
+Comment[pl]=Sprawdzenie równań
+Comment[pt]=Verifica as equações
+Comment[pt_BR]=Verifica Equações
+Comment[ru]=Проверить уравнения
+Comment[sk]=Kontrola rovníc
+Comment[sl]=Preveri enačbe
+Comment[sr]=Провери једначине
+Comment[sr@Latn]=Proveri jednačine
+Comment[sv]=Kontrollera ekvationer
+Comment[ta]= சமன்பாடு சரிபார்ப்பு
+Comment[tg]=Тафтиш кардани баробарҳо
+Comment[tr]=Denklemleri Denetle
+Comment[uk]=Перевірити рівняння
+Comment[zh_CN]=检查等式
+Comment[zh_TW]=檢查等式
+ServiceTypes=KDataTool,KBabelValidator
+Shortcuts=Ctrl+J
+ValidationString=equations
+DataType=CatalogItem
+DataMimeTypes=application/x-kbabel-catalogitem
+ReadOnly=true
diff --git a/kbabel/datatools/equations/main.cc b/kbabel/datatools/equations/main.cc
new file mode 100644
index 00000000..bab01785
--- /dev/null
+++ b/kbabel/datatools/equations/main.cc
@@ -0,0 +1,113 @@
+/* This file is part of KBabel
+ based Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ 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 <resources.h>
+#include "catalogitem.h"
+#include "catalogsettings.h"
+#include "main.h"
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+
+/***************************************************
+ *
+ * Factory
+ *
+ ***************************************************/
+
+K_EXPORT_COMPONENT_FACTORY( kbabel_equationstool, KGenericFactory<EquationsTool> ( "kbabeldatatool" ) )
+
+using namespace KBabel;
+
+EquationsTool::EquationsTool( QObject* parent, const char* name, const QStringList & )
+ : KDataTool( parent, name ), _equation("^[a-zA-Z0-9]+=.+")
+{
+ i18n("what check found errors","equations");
+}
+
+bool EquationsTool::run( const QString& command, void* data, const QString& datatype, const QString& mimetype )
+{
+ if ( command != "validate" )
+ {
+ kdDebug(KBABEL) << "Equations 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) << "Equations Tool only accepts datatype CatalogItem" << endl;
+ return FALSE;
+ }
+
+ if ( mimetype != "application/x-kbabel-catalogitem" )
+ {
+ kdDebug(KBABEL) << "Equations Tool only accepts mimetype application/x-kbabel-catalogitem" << endl;
+ return FALSE;
+ }
+
+ if( command == "validate" )
+ {
+ CatalogItem* item = (CatalogItem*)(data);
+
+ bool hasError = false;
+
+ if(!item->isUntranslated() && !item->msgid().first().contains('\n')
+ && item->msgid().first().contains(_equation))
+ {
+ int index = item->msgid().first().find('=');
+ QString left = item->msgid().first().left(index);
+ index = item->msgstr().first().find('=');
+ if(left != item->msgstr().first().left(index))
+ hasError = true;
+ }
+
+ if(hasError)
+ {
+ item->appendError( "equations" );
+ }
+ else
+ {
+ item->removeError( "equations" );
+ }
+
+ return !hasError;
+ }
+ return FALSE;
+}
+
+#include "main.moc"
diff --git a/kbabel/datatools/equations/main.h b/kbabel/datatools/equations/main.h
new file mode 100644
index 00000000..6edff1c6
--- /dev/null
+++ b/kbabel/datatools/equations/main.h
@@ -0,0 +1,50 @@
+/* This file is part of KBabel
+ based on Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ 2002 Stanislav Visnovsky <visnovsky@kde.org>
+
+ 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 <qregexp.h>
+#include <kdatatool.h>
+
+class EquationsTool : public KDataTool
+{
+ Q_OBJECT
+
+public:
+ EquationsTool( QObject* parent, const char* name, const QStringList & );
+ virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype);
+private:
+ QRegExp _equation;
+};
+
+#endif