summaryrefslogtreecommitdiffstats
path: root/kcontrol/kfontinst/viewpart
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/kfontinst/viewpart')
-rw-r--r--kcontrol/kfontinst/viewpart/FontPreview.cpp118
-rw-r--r--kcontrol/kfontinst/viewpart/FontPreview.h83
-rw-r--r--kcontrol/kfontinst/viewpart/FontViewPart.cpp282
-rw-r--r--kcontrol/kfontinst/viewpart/FontViewPart.h85
-rw-r--r--kcontrol/kfontinst/viewpart/FontViewPartFactory.cpp86
-rw-r--r--kcontrol/kfontinst/viewpart/FontViewPartFactory.h60
-rw-r--r--kcontrol/kfontinst/viewpart/FontViewerApp.cpp130
-rw-r--r--kcontrol/kfontinst/viewpart/FontViewerApp.h68
-rw-r--r--kcontrol/kfontinst/viewpart/KfiPrint.cpp193
-rw-r--r--kcontrol/kfontinst/viewpart/KfiPrint.h49
-rw-r--r--kcontrol/kfontinst/viewpart/Makefile.am30
-rw-r--r--kcontrol/kfontinst/viewpart/kfontview.desktop100
-rw-r--r--kcontrol/kfontinst/viewpart/kfontviewpart.desktop86
-rw-r--r--kcontrol/kfontinst/viewpart/kfontviewpart.rc9
-rw-r--r--kcontrol/kfontinst/viewpart/kfontviewui.rc4
15 files changed, 1383 insertions, 0 deletions
diff --git a/kcontrol/kfontinst/viewpart/FontPreview.cpp b/kcontrol/kfontinst/viewpart/FontPreview.cpp
new file mode 100644
index 000000000..ddd8171cb
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontPreview.cpp
@@ -0,0 +1,118 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontPreview
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 04/11/2001
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2001, 2002, 2003, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include "FontPreview.h"
+#include <kapplication.h>
+#include <klocale.h>
+#include <qpainter.h>
+#include <qimage.h>
+#include <stdlib.h>
+
+namespace KFI
+{
+
+CFontPreview::CFontPreview(QWidget *parent, const char *name)
+ : QWidget(parent, name),
+ itsCurrentFace(1),
+ itsLastWidth(0),
+ itsLastHeight(0),
+ itsBgndCol(eraseColor())
+{
+}
+
+void CFontPreview::showFont(const KURL &url)
+{
+ itsCurrentUrl=url;
+ showFace(1);
+}
+
+void CFontPreview::showFace(int face)
+{
+ itsCurrentFace=face;
+ showFont();
+}
+
+void CFontPreview::showFont()
+{
+ itsLastWidth=width();
+ itsLastHeight=height();
+
+ if(!itsCurrentUrl.isEmpty() &&
+ itsEngine.draw(itsCurrentUrl, itsLastWidth, itsLastHeight, itsPixmap, itsCurrentFace-1, false))
+ {
+ setEraseColor(Qt::white);
+ update();
+ emit status(true);
+ }
+ else
+ {
+ QPixmap nullPix;
+
+ setEraseColor(itsBgndCol);
+ itsPixmap=nullPix;
+ update();
+ emit status(false);
+ }
+}
+
+void CFontPreview::paintEvent(QPaintEvent *)
+{
+ QPainter paint(this);
+
+ if(itsPixmap.isNull())
+ {
+ if(!itsCurrentUrl.isEmpty())
+ {
+ paint.setPen(kapp->palette().active().text());
+ paint.drawText(rect(), AlignCenter, i18n(" No preview available"));
+ }
+ }
+ else
+ {
+ static const int constStepSize=16;
+
+ if(abs(width()-itsLastWidth)>constStepSize || abs(height()-itsLastHeight)>constStepSize)
+ showFont();
+ else
+ paint.drawPixmap(0, 0, itsPixmap);
+ }
+}
+
+QSize CFontPreview::sizeHint() const
+{
+ return QSize(132, 132);
+}
+
+QSize CFontPreview::minimumSizeHint() const
+{
+ return QSize(32, 32);
+}
+
+}
+
+#include "FontPreview.moc"
diff --git a/kcontrol/kfontinst/viewpart/FontPreview.h b/kcontrol/kfontinst/viewpart/FontPreview.h
new file mode 100644
index 000000000..673adeb2d
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontPreview.h
@@ -0,0 +1,83 @@
+#ifndef __FONT_PREVIEW_H__
+#define __FONT_PREVIEW_H__
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontPreview
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 04/11/2001
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2001, 2002, 2003, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include <qstring.h>
+#include <qpixmap.h>
+#include <qsize.h>
+#include <qwidget.h>
+#include <qcolor.h>
+#include <kurl.h>
+#include "FcEngine.h"
+
+namespace KFI
+{
+
+class CFontPreview : public QWidget
+{
+ Q_OBJECT
+
+ public:
+
+ CFontPreview(QWidget *parent, const char *name=NULL);
+ virtual ~CFontPreview() {}
+
+ void paintEvent(QPaintEvent *);
+ QSize sizeHint() const;
+ QSize minimumSizeHint() const;
+
+ void showFont(const KURL &url);
+ void showFont();
+
+ CFcEngine & engine() { return itsEngine; }
+
+ public slots:
+
+ void showFace(int face);
+
+ signals:
+
+ void status(bool);
+
+ private:
+
+ CFcEngine itsEngine;
+ QPixmap itsPixmap;
+ KURL itsCurrentUrl;
+ int itsCurrentFace,
+ itsLastWidth,
+ itsLastHeight;
+ QColor itsBgndCol;
+ QString itsFontName;
+};
+
+}
+
+#endif
diff --git a/kcontrol/kfontinst/viewpart/FontViewPart.cpp b/kcontrol/kfontinst/viewpart/FontViewPart.cpp
new file mode 100644
index 000000000..aaa3bc5ff
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontViewPart.cpp
@@ -0,0 +1,282 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontViewPart
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 03/08/2002
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2002, 2003, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include "FontViewPart.h"
+#include "FontPreview.h"
+#include "Misc.h"
+#include "KfiConstants.h"
+#include "KfiPrint.h"
+#include <klocale.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qframe.h>
+#include <qfile.h>
+#include <qlabel.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
+#include <qvalidator.h>
+#include <qregexp.h>
+#include <qsettings.h>
+#include <qstringlist.h>
+#include <qtimer.h>
+#include <kio/netaccess.h>
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <knuminput.h>
+#include <kstdaction.h>
+#include <kaction.h>
+#include <kinputdialog.h>
+#include <kdialog.h>
+#include <kprinter.h>
+#include <fontconfig/fontconfig.h>
+
+static KURL getDest(const KURL &url, bool system)
+{
+ return KURL(KFI::Misc::root()
+ ? QString("fonts:/") + url.fileName()
+ : QString("fonts:/") + QString(system ? i18n(KFI_KIO_FONTS_SYS) : i18n(KFI_KIO_FONTS_USER))
+ + QChar('/') + url.fileName());
+}
+
+namespace KFI
+{
+
+CFontViewPart::CFontViewPart(QWidget *parent, const char *name)
+{
+ bool kcm=0==strcmp(name, "kcmfontinst");
+
+ itsFrame=new QFrame(parent, "frame");
+
+ QFrame *previewFrame=new QFrame(itsFrame);
+
+ itsToolsFrame=new QFrame(itsFrame);
+
+ QVBoxLayout *layout=new QVBoxLayout(itsFrame, kcm ? 0 : KDialog::marginHint(), kcm ? 0 : KDialog::spacingHint());
+ QGridLayout *previewLayout=new QGridLayout(previewFrame, 1, 1, 1, 1);
+ QHBoxLayout *toolsLayout=new QHBoxLayout(itsToolsFrame, 0, KDialog::spacingHint());
+
+ itsFrame->setFrameShape(QFrame::NoFrame);
+ itsFrame->setFocusPolicy(QWidget::ClickFocus);
+ itsToolsFrame->setFrameShape(QFrame::NoFrame);
+ previewFrame->setFrameShadow(kcm ? QFrame::Sunken : QFrame::Raised);
+ previewFrame->setFrameShape(QFrame::Panel);
+ setInstance(new KInstance("kfontview"));
+
+ itsPreview=new CFontPreview(previewFrame, "FontViewPart::Preview");
+ itsPreview->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ itsFaceLabel=new QLabel(i18n("Face:"), itsToolsFrame);
+ itsFaceSelector=new KIntNumInput(1, itsToolsFrame);
+ itsInstallButton=new QPushButton(i18n("Install..."), itsToolsFrame, "button");
+ itsInstallButton->hide();
+ previewLayout->addWidget(itsPreview, 0, 0);
+ layout->addWidget(previewFrame);
+ layout->addWidget(itsToolsFrame);
+ toolsLayout->addWidget(itsFaceLabel);
+ toolsLayout->addWidget(itsFaceSelector);
+ itsFaceLabel->hide();
+ itsFaceSelector->hide();
+ toolsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum));
+ toolsLayout->addWidget(itsInstallButton);
+ itsToolsFrame->hide();
+ connect(itsPreview, SIGNAL(status(bool)), SLOT(previewStatus(bool)));
+ connect(itsInstallButton, SIGNAL(clicked()), SLOT(install()));
+ connect(itsFaceSelector, SIGNAL(valueChanged(int)), itsPreview, SLOT(showFace(int)));
+
+ itsChangeTextAction=new KAction(i18n("Change Text..."), "text", KShortcut(),
+ this, SLOT(changeText()), actionCollection(), "changeText");
+ itsChangeTextAction->setEnabled(false);
+ itsPrintAction=KStdAction::print(this, SLOT(print()), actionCollection(), "print");
+ itsPrintAction->setEnabled(false);
+
+ setXMLFile("kfontviewpart.rc");
+ setWidget(itsFrame);
+}
+
+bool CFontViewPart::openURL(const KURL &url)
+{
+ if (!url.isValid() || !closeURL())
+ return false;
+
+ if(KFI_KIO_FONTS_PROTOCOL==url.protocol() || url.isLocalFile())
+ {
+ m_url=url;
+ emit started(0);
+ m_file = m_url.path();
+ bool ret=openFile();
+ if (ret)
+ {
+ emit completed();
+ emit setWindowCaption(m_url.prettyURL());
+ }
+ return ret;
+ }
+ else
+ return ReadOnlyPart::openURL(url);
+}
+
+bool CFontViewPart::openFile()
+{
+ // NOTE: Cant do the real open here, as dont seem to be able to use KIO::NetAccess functions during initial start-up.
+ // Bug report 111535 indicates that calling "konqueror <font>" crashes.
+ QTimer::singleShot(0, this, SLOT(timeout()));
+ return true;
+}
+
+void CFontViewPart::timeout()
+{
+ bool showFs=false,
+ isFonts=KFI_KIO_FONTS_PROTOCOL==m_url.protocol();
+
+ itsShowInstallButton=false;
+
+ if(isFonts)
+ FcInitReinitialize();
+ else
+ {
+ KURL destUrl;
+
+ //
+ // Not from fonts:/, so try to see if font is already installed...
+ if(Misc::root())
+ {
+ destUrl=QString("fonts:/")+itsPreview->engine().getName(m_url);
+ itsShowInstallButton=!KIO::NetAccess::exists(destUrl, true, itsFrame->parentWidget());
+ }
+ else
+ {
+ destUrl=QString("fonts:/")+i18n(KFI_KIO_FONTS_SYS)+QChar('/')+itsPreview->engine().getName(m_url);
+ if(KIO::NetAccess::exists(destUrl, true, itsFrame->parentWidget()))
+ itsShowInstallButton=false;
+ else
+ {
+ destUrl=QString("fonts:/")+i18n(KFI_KIO_FONTS_USER)+QChar('/')+itsPreview->engine().getName(m_url);
+ itsShowInstallButton=!KIO::NetAccess::exists(destUrl, true, itsFrame->parentWidget());
+ }
+ }
+ }
+
+ itsPreview->showFont(isFonts ? m_url : m_file);
+
+ if(!isFonts && itsPreview->engine().getNumIndexes()>1)
+ {
+ showFs=true;
+ itsFaceSelector->setRange(1, itsPreview->engine().getNumIndexes(), 1, false);
+ }
+
+ itsFaceLabel->setShown(showFs);
+ itsFaceSelector->setShown(showFs);
+ itsToolsFrame->hide();
+}
+
+void CFontViewPart::previewStatus(bool st)
+{
+ itsInstallButton->setShown(st && itsShowInstallButton);
+ itsToolsFrame->setShown(itsInstallButton->isShown()||itsFaceSelector->isShown());
+ itsChangeTextAction->setEnabled(st);
+ itsPrintAction->setEnabled(st && KFI_KIO_FONTS_PROTOCOL==m_url.protocol());
+}
+
+void CFontViewPart::install()
+{
+ int resp=Misc::root() ? KMessageBox::Yes
+ : KMessageBox::questionYesNoCancel(itsFrame,
+ i18n("Where do you wish to install \"%1\" (%2)?\n"
+ "\"%3\" - only accessible to you, or\n"
+ "\"%4\" - accessible to all (requires administrator "
+ "password)")
+ .arg(itsPreview->engine().getName(m_url))
+ .arg(m_url.fileName())
+ .arg(i18n(KFI_KIO_FONTS_USER))
+ .arg(i18n(KFI_KIO_FONTS_SYS)),
+ i18n("Install"), i18n(KFI_KIO_FONTS_USER),
+ i18n(KFI_KIO_FONTS_SYS));
+
+ if(KMessageBox::Cancel!=resp)
+ {
+ KURL destUrl(getDest(m_url, KMessageBox::No==resp));
+
+ if(KIO::NetAccess::copy(m_url, destUrl, itsFrame->parentWidget()))
+ {
+ //
+ // OK file copied, now look for any AFM or PFM file...
+ KURL::List urls;
+
+ Misc::getAssociatedUrls(m_url, urls);
+
+ if(urls.count())
+ {
+ KURL::List::Iterator it,
+ end=urls.end();
+
+ for(it=urls.begin(); it!=end; ++it)
+ {
+ destUrl=getDest(*it, KMessageBox::No==resp);
+ KIO::NetAccess::copy(*it, destUrl, itsFrame->parentWidget());
+ }
+ }
+
+ KMessageBox::information(itsFrame, i18n("%1:%2 successfully installed.").arg(m_url.protocol())
+ .arg(m_url.path()), i18n("Success"),
+ "FontViewPart_DisplayInstallationSuccess");
+ itsShowInstallButton=false;
+ itsInstallButton->setShown(itsShowInstallButton);
+ }
+ else
+ KMessageBox::error(itsFrame, i18n("Could not install %1:%2").arg(m_url.protocol()).arg(m_url.path()),
+ i18n("Error"));
+ }
+}
+
+void CFontViewPart::changeText()
+{
+ bool status;
+ QRegExpValidator validator(QRegExp(".*"), 0L);
+ QString oldStr(itsPreview->engine().getPreviewString()),
+ newStr(KInputDialog::getText(i18n("Preview String"), i18n("Please enter new string:"),
+ oldStr, &status, itsFrame,
+ "preview string dialog", &validator));
+
+ if(status && newStr!=oldStr)
+ {
+ itsPreview->engine().setPreviewString(newStr);
+ itsPreview->showFont();
+ }
+}
+
+void CFontViewPart::print()
+{
+ QStringList items;
+
+ items.append(itsPreview->engine().getName(m_url));
+
+ Print::printItems(items, 0, itsFrame->parentWidget(), itsPreview->engine());
+}
+
+}
+
+#include "FontViewPart.moc"
diff --git a/kcontrol/kfontinst/viewpart/FontViewPart.h b/kcontrol/kfontinst/viewpart/FontViewPart.h
new file mode 100644
index 000000000..7ffdbb8f4
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontViewPart.h
@@ -0,0 +1,85 @@
+#ifndef __FONT_VIEW_PART_H__
+#define __FONT_VIEW_PART_H__
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontViewPart
+// Author : Craig Drummond
+// Project : K Font Installer (kfontinst-kcontrol)
+// Creation Date : 03/08/2002
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2002, 2003, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include <kparts/part.h>
+
+class QPushButton;
+class QFrame;
+class QLabel;
+class KIntNumInput;
+class KAction;
+class KURL;
+
+namespace KFI
+{
+
+class CFontPreview;
+
+class CFontViewPart : public KParts::ReadOnlyPart
+{
+ Q_OBJECT
+
+ public:
+
+ CFontViewPart(QWidget *parent=0, const char *name=0);
+ virtual ~CFontViewPart() {}
+
+ bool openURL(const KURL &url);
+
+ protected:
+
+ bool openFile();
+
+ private slots:
+
+ void previewStatus(bool st);
+ void timeout();
+ void install();
+ void changeText();
+ void print();
+
+ private:
+
+ CFontPreview *itsPreview;
+ QPushButton *itsInstallButton;
+ QFrame *itsFrame,
+ *itsToolsFrame;
+ QLabel *itsFaceLabel;
+ KIntNumInput *itsFaceSelector;
+ KAction *itsChangeTextAction,
+ *itsPrintAction;
+ bool itsShowInstallButton;
+ int itsFace;
+};
+
+}
+
+#endif
diff --git a/kcontrol/kfontinst/viewpart/FontViewPartFactory.cpp b/kcontrol/kfontinst/viewpart/FontViewPartFactory.cpp
new file mode 100644
index 000000000..52783c1a7
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontViewPartFactory.cpp
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontViewPartFactory
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 03/08/2002
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2002, 2003, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include "FontViewPartFactory.h"
+#include "FontViewPart.h"
+#include <kdebug.h>
+#include <kaboutdata.h>
+#include <kinstance.h>
+#include <assert.h>
+
+extern "C"
+{
+ KDE_EXPORT void* init_libkfontviewpart()
+ {
+ KGlobal::locale()->insertCatalogue("kfontinst");
+ return new KFI::CFontViewPartFactory;
+ }
+}
+
+namespace KFI
+{
+
+KInstance * CFontViewPartFactory::theirInstance=NULL;
+KAboutData * CFontViewPartFactory::theirAbout=NULL;
+
+CFontViewPartFactory::CFontViewPartFactory()
+{
+}
+
+CFontViewPartFactory::~CFontViewPartFactory()
+{
+ delete theirAbout;
+ theirAbout=0L;
+ delete theirInstance;
+ theirInstance=0L;
+}
+
+QObject * CFontViewPartFactory::createObject(QObject *parent, const char *name, const char *, const QStringList &)
+{
+ if(parent && !parent->isWidgetType())
+ {
+ kdDebug() << "CFontViewPartFactory: parent does not inherit QWidget" << endl;
+ return 0L;
+ }
+
+ return new CFontViewPart((QWidget*) parent, name);
+}
+
+KInstance* CFontViewPartFactory::instance()
+{
+ if(!theirInstance)
+ {
+ theirAbout = new KAboutData("fontviewpart", I18N_NOOP("CFontViewPart"), "0.1");
+ theirInstance = new KInstance(theirAbout);
+ }
+ return theirInstance;
+}
+
+}
+
+#include "FontViewPartFactory.moc"
diff --git a/kcontrol/kfontinst/viewpart/FontViewPartFactory.h b/kcontrol/kfontinst/viewpart/FontViewPartFactory.h
new file mode 100644
index 000000000..777d07ebe
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontViewPartFactory.h
@@ -0,0 +1,60 @@
+#ifndef __FONT_VIEW_PART_FACTORY_H__
+#define __FONT_VIEW_PART_FACTORY_H__
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontViewPartFactory
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 03/08/2002
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2002, 2003, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include <klibloader.h>
+
+class KInstance;
+class KAboutData;
+
+namespace KFI
+{
+
+class CFontViewPartFactory : public KLibFactory
+{
+ Q_OBJECT
+
+ public:
+
+ CFontViewPartFactory();
+ virtual ~CFontViewPartFactory();
+ virtual QObject *createObject(QObject *parent = 0, const char *name = 0, const char *classname = "QObject", const QStringList &args = QStringList());
+
+ static KInstance * instance();
+
+ private:
+
+ static KInstance *theirInstance;
+ static KAboutData *theirAbout;
+};
+
+}
+
+#endif
diff --git a/kcontrol/kfontinst/viewpart/FontViewerApp.cpp b/kcontrol/kfontinst/viewpart/FontViewerApp.cpp
new file mode 100644
index 000000000..5ed5cf455
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontViewerApp.cpp
@@ -0,0 +1,130 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Names : KFI::CFontViewerApp, KFI::CFontViewerAppMainWindow
+// Author : Craig Drummond
+// Project : K Font Installer (kfontinst-kcontrol)
+// Creation Date : 30/04/2004
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include "FontViewerApp.h"
+#include "KfiConstants.h"
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kfiledialog.h>
+#include <kconfig.h>
+
+#define CFG_GROUP "FontViewer Settings"
+#define CFG_SIZE_KEY "Window Size"
+
+namespace KFI
+{
+
+CFontViewerAppMainWindow::CFontViewerAppMainWindow()
+ : KParts::MainWindow((QWidget *)0L)
+{
+ KLibFactory *factory=KLibLoader::self()->factory("libkfontviewpart");
+
+ if(factory)
+ {
+ KStdAction::open(this, SLOT(fileOpen()), actionCollection());
+ KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+
+ itsPreview=(KParts::ReadOnlyPart *)factory->create(this, "fontvier", "KParts::ReadOnlyPart");
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ KURL openURL;
+
+ if(args->count() > 0)
+ {
+ KURL url(args->url(args->count() - 1));
+
+ if(url.isValid())
+ openURL = url;
+ }
+
+ setCentralWidget(itsPreview->widget());
+ createGUI(itsPreview);
+
+ if(!openURL.isEmpty())
+ itsPreview->openURL(openURL);
+
+ QSize defSize(450, 380);
+ KConfigGroupSaver saver(kapp->config(), CFG_GROUP);
+
+ resize(kapp->config()->readSizeEntry(CFG_SIZE_KEY, &defSize));
+ show();
+ }
+ else
+ exit(0);
+}
+
+CFontViewerAppMainWindow::~CFontViewerAppMainWindow()
+{
+ KConfigGroupSaver saver(kapp->config(), CFG_GROUP);
+ kapp->config()->writeEntry(CFG_SIZE_KEY, size());
+ kapp->config()->sync();
+}
+
+void CFontViewerAppMainWindow::fileOpen()
+{
+ KURL url(KFileDialog::getOpenURL(QString::null, "application/x-font-ttf application/x-font-otf "
+ "application/x-font-ttc application/x-font-type1 "
+ "application/x-font-bdf application/x-font-pcf ",
+ this, i18n("Select Font to View")));
+ if(url.isValid())
+ itsPreview->openURL(url);
+}
+
+CFontViewerApp::CFontViewerApp()
+{
+ KGlobal::locale()->insertCatalogue(KFI_CATALOGUE);
+ setMainWidget(new CFontViewerAppMainWindow());
+}
+
+}
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP("URL to open"), 0 },
+ KCmdLineLastOption
+};
+
+static KAboutData aboutData("kfontview", I18N_NOOP("Font Viewer"), 0, I18N_NOOP("Simple font viewer"),
+ KAboutData::License_GPL,
+ I18N_NOOP("(c) Craig Drummond, 2004"));
+
+int main(int argc, char **argv)
+{
+ KCmdLineArgs::init(argc, argv, &aboutData);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KFI::CFontViewerApp::addCmdLineOptions();
+
+ KFI::CFontViewerApp app;
+
+ return app.exec();
+}
+
+#include "FontViewerApp.moc"
diff --git a/kcontrol/kfontinst/viewpart/FontViewerApp.h b/kcontrol/kfontinst/viewpart/FontViewerApp.h
new file mode 100644
index 000000000..70543a8f3
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/FontViewerApp.h
@@ -0,0 +1,68 @@
+#ifndef __FONT_VIEWER_APP_H__
+#define __FONT_VIEWER_APP_H__
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Class Name : KFI::CFontViewerApp, KFI::CFontViewAppMainWindow
+// Author : Craig Drummond
+// Project : K Font Installer (kfontinst-kcontrol)
+// Creation Date : 30/04/2004
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2004
+////////////////////////////////////////////////////////////////////////////////
+
+#include <kapplication.h>
+#include <kparts/part.h>
+#include <kparts/mainwindow.h>
+
+namespace KFI
+{
+
+class CFontViewerAppMainWindow : public KParts::MainWindow
+{
+ Q_OBJECT
+
+ public:
+
+ CFontViewerAppMainWindow();
+ virtual ~CFontViewerAppMainWindow();
+
+ public slots:
+
+ void fileOpen();
+
+ private:
+
+ KParts::ReadOnlyPart *itsPreview;
+
+};
+
+class CFontViewerApp : public KApplication
+{
+ public:
+
+ CFontViewerApp();
+ virtual ~CFontViewerApp() {}
+};
+
+}
+
+#endif
diff --git a/kcontrol/kfontinst/viewpart/KfiPrint.cpp b/kcontrol/kfontinst/viewpart/KfiPrint.cpp
new file mode 100644
index 000000000..02366922a
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/KfiPrint.cpp
@@ -0,0 +1,193 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Namespace : KFI::Print
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 14/05/2005
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2005
+////////////////////////////////////////////////////////////////////////////////
+
+#include "KfiPrint.h"
+#include "FcEngine.h"
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
+#include <qsettings.h>
+#include <qstringlist.h>
+#include <kprinter.h>
+#include <qapplication.h>
+#include <qeventloop.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+namespace KFI
+{
+
+namespace Print
+{
+
+static const int constMarginLineBefore=1;
+static const int constMarginLineAfter=2;
+static const int constMarginFont=4;
+
+inline bool sufficientSpace(int y, int pageHeight, int size)
+{
+ return (y+constMarginFont+size)<pageHeight;
+}
+
+static bool sufficientSpace(int y, int titleFontHeight, const int *sizes, int pageHeight, int size)
+{
+ int required=titleFontHeight+constMarginLineBefore+constMarginLineAfter;
+
+ for(unsigned int s=0; sizes[s]; ++s)
+ {
+ required+=sizes[s];
+ if(sizes[s+1])
+ required+=constMarginFont;
+ }
+
+ if(0==size)
+ required+=(3*(constMarginFont+CFcEngine::constDefaultAlphaSize))+constMarginLineBefore+constMarginLineAfter;
+ return (y+required)<pageHeight;
+}
+
+bool printable(const QString &mime)
+{
+ return "application/x-font-type1"==mime || "application/x-font-ttf"==mime || "application/x-font-otf"==mime ||
+ "application/x-font-ttc"==mime || "application/x-font-ghostscript"==mime;
+}
+
+void printItems(const QStringList &items, int size, QWidget *parent, CFcEngine &engine)
+{
+#ifdef HAVE_LOCALE_H
+ char *oldLocale=setlocale(LC_NUMERIC, "C"),
+#endif
+
+ KPrinter printer;
+
+ printer.setFullPage(true);
+
+ if(printer.setup(parent))
+ {
+ QPainter painter;
+ QFont sans("sans", 12, QFont::Bold);
+ QSettings settings;
+ bool entryExists,
+ embedFonts,
+ set=false;
+ QString str(engine.getPreviewString());
+
+ //
+ // Cehck whether the user has enabled font embedding...
+ embedFonts=settings.readBoolEntry("/qt/embedFonts", false, &entryExists);
+
+ // ...if not, then turn on - we may have installed new fonts, without ghostscript being informed, etc.
+ if(!entryExists || !embedFonts)
+ settings.writeEntry("/qt/embedFonts", true);
+
+ printer.setResolution(72);
+ painter.begin(&printer);
+
+ QPaintDeviceMetrics metrics(painter.device());
+ int margin=(int)((2/2.54)*metrics.logicalDpiY()), // 2 cm margins
+ pageWidth=metrics.width()-(2*margin),
+ pageHeight=metrics.height()-(2*margin),
+ y=margin,
+ oneSize[2]={size, 0};
+ const int *sizes=oneSize;
+ bool firstFont(true);
+
+ if(0==size)
+ sizes=CFcEngine::constScalableSizes;
+
+ painter.setClipping(true);
+ painter.setClipRect(margin, margin, pageWidth, pageHeight);
+
+ QStringList::ConstIterator it(items.begin()),
+ end(items.end());
+
+ for(; it!=end; ++it)
+ {
+ unsigned int s=0;
+
+ painter.setFont(sans);
+ QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 0);
+
+ if(!firstFont && !sufficientSpace(y, painter.fontMetrics().height(), sizes, pageHeight, size))
+ {
+ printer.newPage();
+ y=margin;
+ }
+ painter.setFont(sans);
+ y+=painter.fontMetrics().height();
+ painter.drawText(margin, y, *it);
+ y+=constMarginLineBefore;
+ painter.drawLine(margin, y, margin+pageWidth, y);
+ y+=constMarginLineAfter;
+
+ if(0==size)
+ {
+ y+=CFcEngine::constDefaultAlphaSize;
+ painter.setFont(engine.getQFont(*it, CFcEngine::constDefaultAlphaSize));
+ painter.drawText(margin, y, CFcEngine::getLowercaseLetters());
+ y+=constMarginFont+CFcEngine::constDefaultAlphaSize;
+ painter.drawText(margin, y, CFcEngine::getUppercaseLetters());
+ y+=constMarginFont+CFcEngine::constDefaultAlphaSize;
+ painter.drawText(margin, y, CFcEngine::getPunctuation());
+ y+=constMarginFont+constMarginLineBefore;
+ painter.drawLine(margin, y, margin+pageWidth, y);
+ y+=constMarginLineAfter;
+ }
+ for(; sizes[s]; ++s)
+ {
+ y+=sizes[s];
+ painter.setFont(engine.getQFont(*it, sizes[s]));
+ if(sufficientSpace(y, pageHeight, sizes[s]))
+ {
+ painter.drawText(margin, y, str);
+ if(sizes[s+1])
+ y+=constMarginFont;
+ }
+ }
+ firstFont=false;
+ y+=(s<1 || sizes[s-1]<25 ? 14 : 28);
+ }
+
+ painter.end();
+
+ //
+ // Did we change the users font settings? If so, reset to their previous values...
+ if(set)
+ if(entryExists)
+ settings.writeEntry("/qt/embedFonts", false);
+ else
+ settings.removeEntry("/qt/embedFonts");
+ }
+#ifdef HAVE_LOCALE_H
+ if(oldLocale)
+ setlocale(LC_NUMERIC, oldLocale);
+#endif
+}
+
+}
+
+}
diff --git a/kcontrol/kfontinst/viewpart/KfiPrint.h b/kcontrol/kfontinst/viewpart/KfiPrint.h
new file mode 100644
index 000000000..5b927a57a
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/KfiPrint.h
@@ -0,0 +1,49 @@
+#ifndef __PRINT_H__
+#define __PRINT_H__
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Namespace : KFI::Print
+// Author : Craig Drummond
+// Project : K Font Installer
+// Creation Date : 14/05/2005
+// Version : $Revision$ $Date$
+//
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+// (C) Craig Drummond, 2005
+////////////////////////////////////////////////////////////////////////////////
+
+class QStringList;
+class QString;
+class QWidget;
+
+namespace KFI
+{
+
+class CFcEngine;
+
+namespace Print
+{
+extern void printItems(const QStringList &items, int size, QWidget *parent, CFcEngine &engine);
+extern bool printable(const QString &mime);
+}
+
+}
+
+#endif
diff --git a/kcontrol/kfontinst/viewpart/Makefile.am b/kcontrol/kfontinst/viewpart/Makefile.am
new file mode 100644
index 000000000..bfa66c696
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/Makefile.am
@@ -0,0 +1,30 @@
+noinst_LTLIBRARIES = libkfontinstprint.la
+libkfontinstprint_la_SOURCES = KfiPrint.cpp
+libkfontinstprint_la_LDFLAGS = $(all_libraries)
+libkfontinstprint_la_LIBADD = $(LIB_KDEPRINT) ../lib/libkfontinst.la
+
+kde_module_LTLIBRARIES = libkfontviewpart.la
+
+libkfontviewpart_la_SOURCES = FontViewPart.cpp FontViewPartFactory.cpp FontPreview.cpp
+libkfontviewpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+libkfontviewpart_la_LIBADD = $(LIB_KPARTS) libkfontinstprint.la ../lib/libkfontinst.la
+
+noinst_HEADERS = FontViewPart.h FontViewPartFactory.h FontPreview.h FontViewerApp.h KfiPrint.h
+
+kde_services_DATA = kfontviewpart.desktop
+
+AM_CPPFLAGS = -I$(srcdir)/../lib -I$(srcdir)/../../fonts $(all_includes) $(LIBFREETYPE_CFLAGS) $(LIBFONTCONFIG_CFLAGS)
+METASOURCES = AUTO
+
+kfontview_LDADD = $(LIB_KPARTS)
+kfontview_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+bin_PROGRAMS = kfontview
+xdg_apps_DATA = kfontview.desktop
+
+appdata_DATA = kfontviewpart.rc kfontviewui.rc
+appdatadir = $(kde_datadir)/kfontview
+
+kfontview_SOURCES = FontViewerApp.cpp
+
+
diff --git a/kcontrol/kfontinst/viewpart/kfontview.desktop b/kcontrol/kfontinst/viewpart/kfontview.desktop
new file mode 100644
index 000000000..843213221
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/kfontview.desktop
@@ -0,0 +1,100 @@
+[Desktop Entry]
+Name=KFontView
+Name[be]=Прагляд шрыфтоў
+Name[bn]=কে-ফন্ট-ভিউ
+Name[cs]=Prohlížeč písem
+Name[eo]=Tiparorigardilo
+Name[eu]=KFontWiew
+Name[he]=מציג גופנים
+Name[hi]=के-फ़ॉन्ट-व्यू
+Name[mk]=КФонтПреглед
+Name[nb]=Skriftviser
+Name[nds]=Schriftoortkieker
+Name[ne]=K फन्ट दृश्य
+Name[nn]=Skriftvisar
+Name[rw]=K-IgaragazaImyandikire
+Name[se]=Fontačájeheaddji
+Name[sk]=Prehliadač písiem
+Name[sv]=Kfontview
+Name[tg]=Намоишгари КҲарф
+Name[vi]=Trình xem phông chữ KDE
+Name[wa]=Håyneu di fontes (KFontView)
+Name[zh_CN]=字体预览
+Exec=kfontview %i %u
+Icon=fonts
+X-KDE-StartupNotify=true
+Type=Application
+MimeType=application/x-font-ttf;application/x-font-type1;application/x-font-otf;application/x-font-ttc;application/x-font-pcf;application/x-font-bdf;fonts/package;
+GenericName=Font Viewer
+GenericName[af]=Skriftipe Besigter
+GenericName[ar]=معاين المحرف
+GenericName[be]=Праглядальнік шрыфтоў
+GenericName[bg]=Преглед на шрифтове
+GenericName[bn]=ফন্ট প্রদর্শক
+GenericName[br]=Gweler Nodrezhoù
+GenericName[bs]=Preglednik fontova
+GenericName[ca]=Visor de lletres
+GenericName[cs]=Prohlížeč písem
+GenericName[csb]=Przezérnik fòntów
+GenericName[cy]=Gwelydd Wynebfathau
+GenericName[da]=Skrifttype-fremviser
+GenericName[de]=Schriftartenbetrachter
+GenericName[el]=Προβολέας γραμματοσειρών
+GenericName[eo]=Tipara rigardilo
+GenericName[es]=Visor de tipos de letra
+GenericName[et]=Fontide vaataja
+GenericName[eu]=Letra-tipoen ikusgailua
+GenericName[fa]=مشاهده‌گر قلم
+GenericName[fi]=Kirjasinten näytin
+GenericName[fr]=Afficheur de polices
+GenericName[fy]=Lettertypewerjefte
+GenericName[ga]=Amharcán Clófhoirne
+GenericName[gl]=Visor de Fontes
+GenericName[he]=מציג גופנים
+GenericName[hr]=Preglednik fontova
+GenericName[hu]=Betűtípusböngésző
+GenericName[id]=Penampil Font
+GenericName[is]=Leturskoðari
+GenericName[it]=Visualizzatore di caratteri
+GenericName[ja]=フォントビューア
+GenericName[ka]=პროგრამა ფონტების სანახავად
+GenericName[kk]=Қаріпті қарап-шығу
+GenericName[km]=កម្មវិធី​មើល​ពុម្ពអក្សរ
+GenericName[ko]=글꼴 뷰어
+GenericName[lt]=Šriftų žiūryklė
+GenericName[lv]=Fontu Skatītājs
+GenericName[mk]=Прегледувач на фонтови
+GenericName[ms]=Pemapar Fon
+GenericName[mt]=Werrej tal-fonts
+GenericName[nb]=Skrifttypeviser
+GenericName[nds]=Schriftoortkieker
+GenericName[ne]=फन्ट दर्शक
+GenericName[nl]=Lettertypeweergave
+GenericName[nn]=Skriftvisar
+GenericName[pa]=ਫੋਂਟ ਦਰਸ਼ਕ
+GenericName[pl]=Przeglądarka czcionek
+GenericName[pt]=Visualizador de Tipos de Letra
+GenericName[pt_BR]=Visualizador de fontes
+GenericName[ro]=Vizualizor de fonturi
+GenericName[ru]=Программа просмотра шрифтов
+GenericName[rw]=Ikigaragaza Imyandikire
+GenericName[se]=Fontačájeheaddji
+GenericName[sk]=Prehliadač písiem
+GenericName[sl]=Pregledovalnik pisav
+GenericName[sr]=Приказивач фонтова
+GenericName[sr@Latn]=Prikazivač fontova
+GenericName[sv]=Teckensnittsvisning
+GenericName[tg]=Намоишгари ҳарфҳо
+GenericName[th]=โปรแกรมดูแบบอักษร
+GenericName[tr]=Yazıtipi Görüntüleyici
+GenericName[tt]=Yazu Kürsätkeç
+GenericName[uk]=Переглядач шрифтів
+GenericName[uz]=Shrift koʻruvchi
+GenericName[uz@cyrillic]=Шрифт кўрувчи
+GenericName[vi]=Trình xem Phông chữ
+GenericName[wa]=Håyneu di fontes
+GenericName[zh_CN]=字体查看器
+GenericName[zh_TW]=字型檢視器
+Terminal=false
+InitialPreference=1
+Categories=Qt;KDE;Utility;X-KDE-More;
diff --git a/kcontrol/kfontinst/viewpart/kfontviewpart.desktop b/kcontrol/kfontinst/viewpart/kfontviewpart.desktop
new file mode 100644
index 000000000..e1bcd6933
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/kfontviewpart.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Name=Font Viewer
+Name[af]=Skriftipe Besigter
+Name[ar]=معاين المحرف
+Name[az]=Yazı Növü Nümayişçisi
+Name[be]=Праглядальнік шрыфтоў
+Name[bg]=Преглед на шрифт
+Name[bn]=ফন্ট প্রদর্শক
+Name[br]=Gweler Nodrezhoù
+Name[bs]=Preglednik fontova
+Name[ca]=Visor de lletres
+Name[cs]=Prohlížeč písem
+Name[csb]=Przezérnik fòntów
+Name[cy]=Gwelydd Ffont
+Name[da]=Skrifttypevisning
+Name[de]=Schriftartenbetrachter
+Name[el]=Προβολέας γραμματοσειρών
+Name[eo]=Tiparorigardilo
+Name[es]=Visor de tipos de letra
+Name[et]=Fontide vaataja
+Name[eu]=Letra-tipo ikustailea
+Name[fa]=مشاهده‌گر قلم
+Name[fi]=Kirjasinten näytin
+Name[fr]=Afficheur de polices
+Name[fy]=Lettertypewerjefteprogramma
+Name[ga]=Amharcán Clófhoirne
+Name[gl]=Visor de Fontes
+Name[he]=מציג גופנים
+Name[hi]=फ़ॉन्ट प्रदर्शक
+Name[hr]=Preglednik fontova
+Name[hu]=A betűtípusok áttekintése
+Name[id]=Penampil Font
+Name[is]=Leturskoðari
+Name[it]=Vista caratteri
+Name[ja]=フォントビューア
+Name[ka]=პროგრამა ფონტების სანახავად
+Name[kk]=Қаріпті қарап-шығу
+Name[km]=កម្មវិធី​មើល​ពុម្ពអក្សរ
+Name[ko]=글꼴 뷰어
+Name[lo]=ມຸມມອງແບບໄອຄອນ
+Name[lt]=Šrifto žiūriklis
+Name[lv]=Fontu Skatītājs
+Name[mk]=Прегледувач на фонтови
+Name[mn]=Бичиг харагч
+Name[ms]=Pemapar Fon
+Name[mt]=Werrej tal-fonts
+Name[nb]=Skrifttypeviser
+Name[nds]=Schriftoortkieker
+Name[ne]=फन्ट दर्शक
+Name[nl]=Lettertypeweergaveprogramma
+Name[nn]=Skriftvisar
+Name[nso]=Molebeledi wa Fonto
+Name[pa]=ਫੋਂਟ ਦਰਸ਼ਕ
+Name[pl]=Przeglądarka czcionek
+Name[pt]=Visualizador do Tipo de Letra
+Name[pt_BR]=Visualizador de Fontes
+Name[ro]=Vizualizor de fonturi
+Name[ru]=Просмотр шрифтов
+Name[rw]=Ikigaragaza Imyandikire
+Name[se]=Fontačájeheaddji
+Name[sk]=Prehliadač písiem
+Name[sl]=Prikazovalnik pisav
+Name[sr]=Приказивач фонтова
+Name[sr@Latn]=Prikazivač fontova
+Name[sv]=Teckensnittsvisning
+Name[ta]=எழுத்துரு காட்சி
+Name[tg]=Намоишгари ҳарф
+Name[th]=โปรแกรมดูแบบอักษร
+Name[tr]=Yazıtipi İzleyici
+Name[tt]=Yazu Kürsätkeç
+Name[uk]=Переглядач шрифтів
+Name[uz]=Shrift koʻruvchi
+Name[uz@cyrillic]=Шрифт кўрувчи
+Name[ven]=Muvhoni wa Fontu
+Name[vi]=Trình xem Phông chữ
+Name[wa]=Håyneu di fontes
+Name[xh]=Imboniselo Yohlobo lwegama
+Name[zh_CN]=字体查看器
+Name[zh_TW]=字型檢視器
+Name[zu]=Umbukisi Wohlobo lwamagama
+MimeType=application/x-font-ttf;application/x-font-type1;application/x-font-otf;application/x-font-ttc;application/x-font-pcf;application/x-font-bdf;fonts/package
+ServiceTypes=KParts/ReadOnlyPart,Browser/View
+X-KDE-Library=libkfontviewpart
+Type=Service
+InitialPreference=1
+Icon=fonts
diff --git a/kcontrol/kfontinst/viewpart/kfontviewpart.rc b/kcontrol/kfontinst/viewpart/kfontviewpart.rc
new file mode 100644
index 000000000..5df54a47c
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/kfontviewpart.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="kfontviewpart" version="1">
+<ToolBar name="mainToolBar">
+ <text>&amp;Main Toolbar</text>
+ <Action name="print"/>
+ <Action name="changeText"/>
+</ToolBar>
+</kpartgui>
+
diff --git a/kcontrol/kfontinst/viewpart/kfontviewui.rc b/kcontrol/kfontinst/viewpart/kfontviewui.rc
new file mode 100644
index 000000000..f2e4a86fa
--- /dev/null
+++ b/kcontrol/kfontinst/viewpart/kfontviewui.rc
@@ -0,0 +1,4 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="kfontviewui" version="1">
+</kpartgui>
+