summaryrefslogtreecommitdiffstats
path: root/kbabel/addons
diff options
context:
space:
mode:
Diffstat (limited to 'kbabel/addons')
-rw-r--r--kbabel/addons/Makefile.am3
-rw-r--r--kbabel/addons/kfile-plugins/Makefile.am22
-rw-r--r--kbabel/addons/kfile-plugins/kfile_po.cpp81
-rw-r--r--kbabel/addons/kfile-plugins/kfile_po.desktop61
-rw-r--r--kbabel/addons/kfile-plugins/kfile_po.h49
-rw-r--r--kbabel/addons/preview/Makefile.am15
-rw-r--r--kbabel/addons/preview/pothumbcreator.cpp360
-rw-r--r--kbabel/addons/preview/pothumbcreator.h54
-rw-r--r--kbabel/addons/preview/pothumbnail.desktop68
9 files changed, 713 insertions, 0 deletions
diff --git a/kbabel/addons/Makefile.am b/kbabel/addons/Makefile.am
new file mode 100644
index 00000000..291996f0
--- /dev/null
+++ b/kbabel/addons/Makefile.am
@@ -0,0 +1,3 @@
+AUTOMAKE_OPTIONS = foreign 1.4
+
+SUBDIRS = preview kfile-plugins
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
diff --git a/kbabel/addons/preview/Makefile.am b/kbabel/addons/preview/Makefile.am
new file mode 100644
index 00000000..28afdfbd
--- /dev/null
+++ b/kbabel/addons/preview/Makefile.am
@@ -0,0 +1,15 @@
+
+INCLUDES = -I$(srcdir)/../../common $(all_includes)
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = pothumbnail.la
+
+pothumbnail_la_SOURCES = pothumbcreator.cpp
+pothumbnail_la_LIBADD = ../../common/libkbabelcommon.la
+pothumbnail_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+noinst_HEADERS = pothumbcreator.h
+
+services_DATA = pothumbnail.desktop
+servicesdir = $(kde_servicesdir)
+
diff --git a/kbabel/addons/preview/pothumbcreator.cpp b/kbabel/addons/preview/pothumbcreator.cpp
new file mode 100644
index 00000000..f067948a
--- /dev/null
+++ b/kbabel/addons/preview/pothumbcreator.cpp
@@ -0,0 +1,360 @@
+/*
+ This file is part of KBabel
+ Copyright (C) 2001 Matthias Kiefer <kiefer@kde.org>
+
+ Text painting code is based on the text file preview textthumbnail by
+ Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
+ 2000 Malte Starostik <malte@kde.org>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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; 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 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 <qpainter.h>
+#include <qpixmap.h>
+#include <qimage.h>
+
+#include <kapplication.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <kstandarddirs.h>
+#include <kpixmapsplitter.h>
+
+#include "pothumbcreator.h"
+#include "poinfo.h"
+
+using namespace KBabel;
+
+extern "C"
+{
+ KDE_EXPORT ThumbCreator *new_creator()
+ {
+ return new PoThumbCreator;
+ }
+}
+
+PoThumbCreator::PoThumbCreator()
+ : m_splitter(0)
+{
+}
+
+PoThumbCreator::~PoThumbCreator()
+{
+ if(m_splitter)
+ delete m_splitter;
+}
+
+bool PoThumbCreator::create(const QString &path, int width, int height, QImage &img)
+{
+ if ( !m_splitter )
+ {
+ m_splitter = new KPixmapSplitter;
+ QString pixmap = locate( "data", "konqueror/pics/thumbnailfont_7x4.png" );
+ if ( !pixmap.isEmpty() )
+ {
+ m_splitter->setPixmap( QPixmap( pixmap ));
+ m_splitter->setItemSize( QSize( 4, 7 ));
+ }
+ }
+
+ bool ok = false;
+ PoInfo poInfo;
+ QStringList wordList;
+
+ // We do not call msgfmt, as a thumbnail must be created fast.
+ if( PoInfo::info( path, poInfo, wordList, false, true, false ) == OK )
+ {
+ ok = true;
+
+ QPixmap pix;
+ if (height * 3 > width * 4)
+ pix.resize(width, width * 4 / 3);
+ else
+ pix.resize(height * 3 / 4, height);
+
+ pix.fill( QColor( 245, 245, 245 ) ); // light-grey background
+
+
+
+ // one pixel for the rectangle, the rest. whitespace
+ int xBorder = 1 + pix.width()/16; // minimum x-border
+ int yBorder = 1 + pix.height()/16; // minimum y-border
+
+ int circle = 16*360;
+ int fuzzyAngle = poInfo.fuzzy*circle/poInfo.total;
+ int untransAngle = poInfo.untranslated*circle/poInfo.total;
+
+ int w = pix.width()-2*xBorder;
+ int h = pix.height()*2/3-2*yBorder;
+
+ int d = QMIN(w,h);
+ xBorder = (pix.width()-d)/2;
+ yBorder = (pix.height()*2/3-d)/2;
+
+ QPainter p(&pix);
+
+ if(fuzzyAngle>0)
+ {
+ p.setBrush(Qt::blue);
+
+ if(poInfo.total == poInfo.fuzzy)
+ {
+ p.drawEllipse(xBorder,yBorder,d,d);
+ }
+ else
+ {
+ p.drawPie(xBorder,yBorder, d, d, 0, -fuzzyAngle);
+ }
+ }
+
+ if(untransAngle>0)
+ {
+ p.setBrush(Qt::red);
+
+ if(poInfo.untranslated == poInfo.total)
+ {
+ p.drawEllipse(xBorder,yBorder,d,d);
+ }
+ else
+ {
+ p.drawPie(xBorder,yBorder, d, d, -fuzzyAngle, -untransAngle);
+ }
+ }
+
+ if(circle - fuzzyAngle - untransAngle>0)
+ {
+ p.setBrush(Qt::darkGreen);
+
+ if(poInfo.fuzzy==0 && poInfo.untranslated==0)
+ {
+ p.drawEllipse(xBorder,yBorder,d,d);
+ }
+ else
+ {
+ p.drawPie(xBorder,yBorder, d, d, -fuzzyAngle-untransAngle
+ , -(circle-fuzzyAngle-untransAngle) );
+ }
+ }
+
+ p.end();
+
+
+
+ QRect rect;
+
+ QSize chSize = m_splitter->itemSize(); // the size of one char
+ int xOffset = chSize.width();
+ int yOffset = chSize.height();
+
+ // one pixel for the rectangle, the rest. whitespace
+ xBorder = 1 + pix.width()/16; // minimum x-border
+ yBorder = 1 + pix.height()/16; // minimum y-border
+
+ // calculate a better border so that the text is centered
+ int canvasWidth = pix.width() - 2*xBorder;
+ int canvasHeight = pix.height()/3 - 2*yBorder;
+ int numCharsPerLine = (int) (canvasWidth / chSize.width());
+ int numLines = (int) (canvasHeight / chSize.height());
+
+ int rest = pix.width() - (numCharsPerLine * chSize.width());
+ xBorder = QMAX( xBorder, rest/2); // center horizontally
+ rest = pix.height()/3 - (numLines * chSize.height());
+ yBorder = QMAX( yBorder, rest/2); // center vertically
+ // end centering
+
+
+ QString text;
+
+ if(numCharsPerLine < 30)
+ {
+ if(!poInfo.revision.isEmpty())
+ text += poInfo.revision+'\n';
+ if(!poInfo.lastTranslator.isEmpty())
+ text += poInfo.lastTranslator+'\n';
+ if(!poInfo.languageTeam.isEmpty())
+ text += poInfo.languageTeam+'\n';
+ if(!poInfo.contentType.isEmpty())
+ text += poInfo.contentType+'\n';
+ if(!poInfo.creation.isEmpty())
+ text += poInfo.creation+'\n';
+ if(!poInfo.project.isEmpty())
+ text += poInfo.project+'\n';
+ if(!poInfo.mimeVersion.isEmpty())
+ text += "MIME-Version: "+poInfo.mimeVersion+'\n';
+ if(!poInfo.encoding.isEmpty())
+ text += poInfo.encoding+'\n';
+
+ int lines = text.contains('\n')+1;
+ if(lines < numLines)
+ {
+ text = poInfo.headerComment+'\n'+text;
+ if(!poInfo.others.isEmpty())
+ text += poInfo.others+'\n';
+ }
+
+ if(text.at(text.length()-1) == '\n')
+ text.truncate(text.length()-1);
+ }
+ else
+ {
+ if(!poInfo.headerComment.isEmpty())
+ text += poInfo.headerComment+'\n';
+ if(!poInfo.project.isEmpty())
+ text += "Project-Id-Version: "+poInfo.project+'\n';
+ if(!poInfo.creation.isEmpty())
+ text += "POT-Creation-Date: "+poInfo.creation+'\n';
+ if(!poInfo.revision.isEmpty())
+ text += "PO-Revision-Date: "+ poInfo.revision+'\n';
+ if(!poInfo.lastTranslator.isEmpty())
+ text += "Last-Translator: "+poInfo.lastTranslator+'\n';
+ if(!poInfo.languageTeam.isEmpty())
+ text += "Language-Team: "+poInfo.languageTeam+'\n';
+ if(!poInfo.contentType.isEmpty())
+ text += "Content-Type: "+poInfo.contentType+'\n';
+ if(!poInfo.mimeVersion.isEmpty())
+ text += "MIME-Version: "+poInfo.mimeVersion+'\n';
+ if(!poInfo.encoding.isEmpty())
+ text += "Content-Transfer-Encoding: "+poInfo.encoding+'\n';
+ if(!poInfo.others.isEmpty())
+ text += poInfo.others;
+
+
+ if(text.at(text.length()-1) == '\n')
+ text.truncate(text.length()-1);
+ }
+ /*
+ double p = ((double)(poInfo.total-poInfo.fuzzy-poInfo.untranslated))*100/poInfo.total;
+ text = locale->formatNumber(p,0)+'%';
+ */
+ // find the maximum string length to center the text
+ QStringList lineList=QStringList::split('\n',text);
+ uint max=0;
+ for( QStringList::Iterator it = lineList.begin(); it != lineList.end()
+ ; ++it )
+ {
+ if((*it).length() > max)
+ max = (*it).length();
+ }
+ rest = pix.width() - (max * chSize.width());
+ xBorder = QMAX( xBorder, rest/2); // center horizontally
+ rest = pix.height()/3 - (lineList.count() * chSize.height());
+ yBorder = QMAX( yBorder, rest/2); // center vertically
+
+ // where to paint the characters
+ int x = xBorder, y = pix.height()*2/3;
+ int posNewLine = pix.width() - (chSize.width() + xBorder);
+ int posLastLine = pix.height() - (chSize.height() + yBorder);
+ bool newLine = false;
+ Q_ASSERT( posNewLine > 0 );
+ const QPixmap *fontPixmap = &(m_splitter->pixmap());
+
+
+ for ( uint i = 0; i < text.length(); i++ )
+ {
+ if ( x > posNewLine || newLine ) // start a new line?
+ {
+ x = xBorder;
+ y += yOffset;
+
+ if ( y > posLastLine ) // more text than space
+ break;
+
+ // after starting a new line, we also jump to the next
+ // physical newline in the file if we don't come from one
+ if ( !newLine )
+ {
+ int pos = text.find( '\n', i );
+ if ( pos > (int) i )
+ i = pos +1;
+ }
+
+ newLine = false;
+ }
+
+ // check for newlines in the text (unix,dos)
+ QChar ch = text.at( i );
+ if ( ch == '\n' )
+ {
+ newLine = true;
+ continue;
+ }
+ else if ( ch == '\r' && text.at(i+1) == '\n' )
+ {
+ newLine = true;
+ i++; // skip the next character (\n) as well
+ continue;
+ }
+
+ rect = m_splitter->coordinates( ch );
+ if ( !rect.isEmpty() )
+ {
+ bitBlt( &pix, QPoint(x,y), fontPixmap, rect, Qt::CopyROP );
+ }
+
+ x += xOffset; // next character
+ }
+
+ // very very seldom a babelfish lives in po files and even
+ // in this seldom cases they are usually hidden ;-)
+ if(pix.width() > 40 && KApplication::random()%2000 == 0)
+ {
+ QPixmap kbabelPix;
+ if(pix.width() < 80)
+ {
+ kbabelPix = KGlobal::iconLoader()->loadIcon("kbabel"
+ ,KIcon::Small,16,KIcon::DefaultState,0,true);
+ }
+ else if(pix.width() < 150)
+ {
+ kbabelPix = KGlobal::iconLoader()->loadIcon("kbabel"
+ ,KIcon::Desktop,32,KIcon::DefaultState,0,true);
+ }
+ else
+ {
+ kbabelPix = KGlobal::iconLoader()->loadIcon("kbabel"
+ ,KIcon::Desktop,48,KIcon::DefaultState,0,true);
+ }
+
+ int x = pix.width()-kbabelPix.width()-4;
+ x = QMAX(x,0);
+ if(!kbabelPix.isNull())
+ {
+ bitBlt(&pix, QPoint(x,4), &kbabelPix, kbabelPix.rect()
+ , Qt::CopyROP);
+ }
+ }
+
+ img = pix.convertToImage();
+ }
+
+ return ok;
+}
+
+ThumbCreator::Flags PoThumbCreator::flags() const
+{
+ return (Flags)(DrawFrame);
+}
+
diff --git a/kbabel/addons/preview/pothumbcreator.h b/kbabel/addons/preview/pothumbcreator.h
new file mode 100644
index 00000000..401e9431
--- /dev/null
+++ b/kbabel/addons/preview/pothumbcreator.h
@@ -0,0 +1,54 @@
+/*
+ This file is part of KBabel
+ Copyright (C) 2001 Matthias Kiefer <kiefer@kde.org>
+
+ Text painting code is based on the text file preview textthumbnail by
+ Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
+ 2000 Malte Starostik <malte@kde.org>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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; 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 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 POTHUMBCREATOR_H
+#define POTHUMBCREATOR_H
+
+#include <kio/thumbcreator.h>
+
+class KPixmapSplitter;
+
+class PoThumbCreator : public ThumbCreator
+{
+public:
+ PoThumbCreator();
+ virtual ~PoThumbCreator();
+ virtual bool create(const QString &path, int width, int height, QImage &img);
+ virtual Flags flags() const;
+
+private:
+ KPixmapSplitter *m_splitter;
+};
+
+#endif
diff --git a/kbabel/addons/preview/pothumbnail.desktop b/kbabel/addons/preview/pothumbnail.desktop
new file mode 100644
index 00000000..2c15345b
--- /dev/null
+++ b/kbabel/addons/preview/pothumbnail.desktop
@@ -0,0 +1,68 @@
+[Desktop Entry]
+Type=Service
+Name=Message Catalogs
+Name[af]=Boodskap Katalogusse
+Name[az]=İsmarış Kataloqu
+Name[bg]=Каталози със съобщения
+Name[br]=Katalogoù c'hemennadoù
+Name[bs]=Katalozi poruka
+Name[ca]=Catàlegs de missatges
+Name[cs]=Katalogy zpráv
+Name[cy]=Catalogau Negesau
+Name[da]=Beskedkataloger
+Name[de]=Nachrichtenkataloge
+Name[el]=Κατάλογοι μηνυμάτων
+Name[en_GB]=Message Catalogues
+Name[eo]=Mesaĝkatalogoj
+Name[es]=Catálogos de mensajes
+Name[et]=Tõlkefailide kataloogid
+Name[eu]=Katalogo mezuak
+Name[fa]=فهرست پیامها
+Name[fi]=Käännöspaketit
+Name[fr]=Catalogues de messages
+Name[ga]=Catalóg teachtaireachtaí
+Name[gl]=Catálogos de Mensaxes
+Name[he]=קטלוגי הודעות
+Name[hi]=संदेश केटलॉग
+Name[hr]=Katalog poruka
+Name[hu]=Üzenetkatalógusok
+Name[is]=Þýðingaskrár
+Name[it]=Cataloghi di messaggi
+Name[ja]=メッセージカタログ
+Name[ka]=შეტყობინებათა კატალოგი
+Name[kk]=Gettext жазулар каталогы
+Name[lt]=Pranešimų katalogai
+Name[lv]=Ziņojumu Katalogs
+Name[ms]=Mesej Katalog
+Name[mt]=Katalgu ta' Messaġġi
+Name[nb]=Meldingskataloger
+Name[nds]=Narichtenkatalogen
+Name[ne]=सन्देश विवरणिका
+Name[nl]=Gettext-catalogus
+Name[nn]=Meldingskatalogar
+Name[pa]=ਸੁਨੇਹਾ ਸੂਚੀ
+Name[pl]=Katalog napisów
+Name[pt]=Catálogos de Mensagens
+Name[pt_BR]=Catálogo de mensagens
+Name[ro]=Cataloage de mesaje
+Name[ru]=Сообщения Gettext
+Name[sk]=Katalógy správ
+Name[sl]=Katalogi s sporočili
+Name[sr]=Каталози порука
+Name[sr@Latn]=Katalozi poruka
+Name[sv]=Meddelandekataloger
+Name[ta]=செய்தி விவரப்பட்டி
+Name[tg]=Каталоги хабарҳо
+Name[th]=แคตตาล็อกข้อความ
+Name[tr]=Mesaj Katalogları
+Name[uk]=Каталоги повідомлень
+Name[ven]=Khathalogo dza mulaedza
+Name[vi]=Mục lục các thông điệp
+Name[xh]=Umyalezo wemifanekiso esencwadini
+Name[zh_CN]=消息目录
+Name[zh_TW]=訊息類別
+Name[zu]=Umyalezo Wemifanekiso esencwadini
+ServiceTypes=ThumbCreator
+MimeTypes=application/x-gettext
+X-KDE-Library=pothumbnail
+CacheThumbnail=false