From eba183d4de47093c6e44a99c8d7fe313aa2834c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:42 -0600 Subject: Fix FTBFS --- kcontrol/tdefontinst/kcmfontinst/CMakeLists.txt | 40 ++ kcontrol/tdefontinst/kcmfontinst/KCmFontInst.cpp | 648 +++++++++++++++++++++ kcontrol/tdefontinst/kcmfontinst/KCmFontInst.h | 116 ++++ .../tdefontinst/kcmfontinst/KFileFontIconView.cpp | 88 +++ .../tdefontinst/kcmfontinst/KFileFontIconView.h | 55 ++ kcontrol/tdefontinst/kcmfontinst/KFileFontView.cpp | 645 ++++++++++++++++++++ kcontrol/tdefontinst/kcmfontinst/KFileFontView.h | 219 +++++++ kcontrol/tdefontinst/kcmfontinst/Makefile.am | 31 + kcontrol/tdefontinst/kcmfontinst/PrintDialog.cpp | 74 +++ kcontrol/tdefontinst/kcmfontinst/PrintDialog.h | 56 ++ .../tdefontinst/kcmfontinst/SettingsDialog.cpp | 99 ++++ kcontrol/tdefontinst/kcmfontinst/SettingsDialog.h | 57 ++ .../kcmfontinst/cr16-action-newfont.png | Bin 0 -> 613 bytes .../kcmfontinst/cr22-action-newfont.png | Bin 0 -> 951 bytes .../kcmfontinst/cr32-action-newfont.png | Bin 0 -> 1821 bytes .../tdefontinst/kcmfontinst/kcmfontinst.desktop | 235 ++++++++ 16 files changed, 2363 insertions(+) create mode 100644 kcontrol/tdefontinst/kcmfontinst/CMakeLists.txt create mode 100644 kcontrol/tdefontinst/kcmfontinst/KCmFontInst.cpp create mode 100644 kcontrol/tdefontinst/kcmfontinst/KCmFontInst.h create mode 100644 kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.cpp create mode 100644 kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.h create mode 100644 kcontrol/tdefontinst/kcmfontinst/KFileFontView.cpp create mode 100644 kcontrol/tdefontinst/kcmfontinst/KFileFontView.h create mode 100644 kcontrol/tdefontinst/kcmfontinst/Makefile.am create mode 100644 kcontrol/tdefontinst/kcmfontinst/PrintDialog.cpp create mode 100644 kcontrol/tdefontinst/kcmfontinst/PrintDialog.h create mode 100644 kcontrol/tdefontinst/kcmfontinst/SettingsDialog.cpp create mode 100644 kcontrol/tdefontinst/kcmfontinst/SettingsDialog.h create mode 100644 kcontrol/tdefontinst/kcmfontinst/cr16-action-newfont.png create mode 100644 kcontrol/tdefontinst/kcmfontinst/cr22-action-newfont.png create mode 100644 kcontrol/tdefontinst/kcmfontinst/cr32-action-newfont.png create mode 100644 kcontrol/tdefontinst/kcmfontinst/kcmfontinst.desktop (limited to 'kcontrol/tdefontinst/kcmfontinst') diff --git a/kcontrol/tdefontinst/kcmfontinst/CMakeLists.txt b/kcontrol/tdefontinst/kcmfontinst/CMakeLists.txt new file mode 100644 index 000000000..b5a0da812 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/kcontrol/kfontinst/lib + ${CMAKE_SOURCE_DIR}/kcontrol/kfontinst/viewpart + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +tde_install_icons() +install( FILES kcmfontinst.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_fontinst (module) ##################### + +tde_add_kpart( kcm_fontinst AUTOMOC + SOURCES + KCmFontInst.cpp KFileFontIconView.cpp KFileFontView.cpp + PrintDialog.cpp SettingsDialog.cpp + LINK kfontinstprint-static kfontinst-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/tdefontinst/kcmfontinst/KCmFontInst.cpp b/kcontrol/tdefontinst/kcmfontinst/KCmFontInst.cpp new file mode 100644 index 000000000..da1e5f2e2 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/KCmFontInst.cpp @@ -0,0 +1,648 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CKCmFontInst +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 26/04/2003 +// 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, 2003, 2004 +//////////////////////////////////////////////////////////////////////////////// + +#include "KCmFontInst.h" +#include "KfiConstants.h" +#include "PrintDialog.h" +#include "SettingsDialog.h" +#ifdef HAVE_XFT +#include "KfiPrint.h" +#include "FcEngine.h" +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Misc.h" +#include "KFileFontIconView.h" +#include "KFileFontView.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CFG_GROUP "Main Settings" +#define CFG_LISTVIEW "ListView" +#define CFG_PATH "Path" +#define CFG_SPLITTER_SIZES "SplitterSizes" +#define CFG_SHOW_BITMAP "ShowBitmap" +#define CFG_FONT_SIZE "FontSize" + +typedef KGenericFactory FontInstallFactory; +K_EXPORT_COMPONENT_FACTORY(kcm_fontinst, FontInstallFactory("kcmfontinst")) + +namespace KFI +{ + +CKCmFontInst::CKCmFontInst(TQWidget *parent, const char *, const TQStringList&) + : TDECModule(parent, "kfontinst"), +#ifdef HAVE_XFT + itsPreview(NULL), +#endif + itsConfig(KFI_UI_CFG_FILE) +{ + TDEGlobal::locale()->insertCatalogue(KFI_CATALOGUE); + + TDEAboutData* about = new TDEAboutData("kcmfontinst", + I18N_NOOP("TDE Font Installer"), + 0, 0, + TDEAboutData::License_GPL, + I18N_NOOP("GUI front end to the fonts:/ ioslave.\n" + "(c) Craig Drummond, 2000 - 2004")); + about->addAuthor("Craig Drummond", I18N_NOOP("Developer and maintainer"), "craig@kde.org"); + setAboutData(about); + + const char *appName=TDECmdLineArgs::appName(); + + itsEmbeddedAdmin=Misc::root() && (NULL==appName || strcmp("kcontrol", appName) && + TDECmdLineArgs::parsedArgs()->isSet("embed")); + + itsStatusLabel = new TQLabel(this); + itsStatusLabel->setFrameShape(TQFrame::Panel); + itsStatusLabel->setFrameShadow(TQFrame::Sunken); + itsStatusLabel->setLineWidth(1); + + itsConfig.setGroup(CFG_GROUP); + + TQFrame *fontsFrame; +#ifdef HAVE_XFT + KLibFactory *factory=KLibLoader::self()->factory("libkfontviewpart"); + + if(factory) + { + itsSplitter=new TQSplitter(this); + fontsFrame=new TQFrame(itsSplitter), + itsPreview=(KParts::ReadOnlyPart *)factory->create(TQT_TQOBJECT(itsSplitter), "kcmfontinst", "KParts::ReadOnlyPart"); + itsSplitter->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding); + + TQValueList sizes(itsConfig.readIntListEntry(CFG_SPLITTER_SIZES)); + + if(2!=sizes.count()) + { + sizes.clear(); + sizes+=250; + sizes+=150; + } + itsSplitter->setSizes(sizes); + } + else + { +#endif + fontsFrame=new TQFrame(this); + fontsFrame->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding); +#ifdef HAVE_XFT + } +#endif + + TQGridLayout *fontsLayout=new TQGridLayout(fontsFrame, 1, 1, 0, 1); + TQVBoxLayout *layout=new TQVBoxLayout(this, 0, KDialog::spacingHint()); + TDEToolBar *toolbar=new TDEToolBar(this); + bool showBitmap(itsConfig.readBoolEntry(CFG_SHOW_BITMAP, false)); + + fontsFrame->setLineWidth(0); + toolbar->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::Minimum); + toolbar->setMovingEnabled(false); + + TQString previousPath=itsConfig.readEntry(CFG_PATH); + + itsDirOp = new KDirOperator(Misc::root() ? TQString("fonts:/") : TQString("fonts:/")+i18n(KFI_KIO_FONTS_USER), + fontsFrame); + itsDirOp->setViewConfig(&itsConfig, "ListView Settings"); + itsDirOp->setMinimumSize(TQSize(96, 64)); + setMimeTypes(showBitmap); + itsDirOp->dirLister()->setMainWindow(this); + itsDirOp->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding); + fontsLayout->addMultiCellWidget(itsDirOp, 0, 0, 0, 1); + + KPushButton *button=new KPushButton(KGuiItem(i18n("Add Fonts..."), "newfont"), fontsFrame); + connect(button, TQT_SIGNAL(clicked()), TQT_SLOT(addFonts())); + button->setSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum); + fontsLayout->addWidget(button, 1, 0); + TQT_TQLAYOUT(fontsLayout)->addItem(new TQSpacerItem(4, 4, TQSizePolicy::Expanding, TQSizePolicy::Minimum)); + + layout->addWidget(toolbar); +#ifdef HAVE_XFT + layout->addWidget(itsPreview ? itsSplitter : fontsFrame); +#else + layout->addWidget(fontsFrame); +#endif + layout->addWidget(itsStatusLabel); + + setButtons(0); + setRootOnlyMsg(i18n("The fonts shown are your personal fonts.
To see (and install) " + "system-wide fonts, click on the \"Administrator Mode\" button below.")); + setUseRootOnlyMsg(true); + itsDirOp->setMode(KFile::Files); + + // + // Now for the hack! + TDEAction *act; + TDEActionMenu *topMnu=dynamic_cast(itsDirOp->actionCollection()->action("popupMenu")); + + itsViewMenuAct=dynamic_cast(itsDirOp->actionCollection()->action("view menu")); + topMnu->popupMenu()->clear(); + connect(topMnu->popupMenu(), TQT_SIGNAL(aboutToShow()), TQT_SLOT(setupMenu())); + if((act=itsDirOp->actionCollection()->action("up"))) + act->disconnect(TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(cdUp())); + if((act=itsDirOp->actionCollection()->action("home"))) + act->disconnect(TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(home())); + if((act=itsDirOp->actionCollection()->action("back"))) + act->disconnect(TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(back())); + if((act=itsDirOp->actionCollection()->action("forward"))) + act->disconnect(TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(forward())); + + if((act=itsDirOp->actionCollection()->action("reload"))) + act->plug(toolbar); + + topMnu->insert(itsViewMenuAct); + + if((itsIconAct=dynamic_cast(itsDirOp->actionCollection()->action("short view")))) + { + disconnect(itsIconAct, TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(slotSimpleView())); + connect(itsIconAct, TQT_SIGNAL(activated()), TQT_SLOT(iconView())); + itsIconAct->plug(toolbar); + } + + if((itsListAct=dynamic_cast(itsDirOp->actionCollection()->action("detailed view")))) + { + disconnect(itsListAct, TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(slotDetailedView())); + connect(itsListAct, TQT_SIGNAL(activated()), TQT_SLOT(listView())); + itsListAct->plug(toolbar); + } + + itsShowBitmapAct=new TDEToggleAction(i18n("Show Bitmap Fonts"), "font_bitmap", 0, TQT_TQOBJECT(this), TQT_SLOT(filterFonts()), + itsDirOp->actionCollection(), "showbitmap"); + itsShowBitmapAct->setChecked(showBitmap); + itsShowBitmapAct->plug(toolbar); + + toolbar->insertLineSeparator(); + + act=new TDEAction(i18n("Add Fonts..."), "newfont", 0, TQT_TQOBJECT(this), TQT_SLOT(addFonts()), itsDirOp->actionCollection(), "addfonts"); + act->plug(toolbar); + topMnu->insert(act); + + if((itsDeleteAct=itsDirOp->actionCollection()->action("delete"))) + { + itsDeleteAct->plug(toolbar); + itsDeleteAct->setEnabled(false); + topMnu->insert(itsDeleteAct); + disconnect(itsDeleteAct, TQT_SIGNAL(activated()), itsDirOp, TQT_SLOT(deleteSelected())); + connect(itsDeleteAct, TQT_SIGNAL(activated()), this, TQT_SLOT(removeFonts())); + } + + toolbar->insertLineSeparator(); + act=new TDEAction(i18n("Configure..."), "configure", 0, TQT_TQOBJECT(this), TQT_SLOT(configure()), itsDirOp->actionCollection(), "configure"); + act->plug(toolbar); +#ifdef HAVE_XFT + toolbar->insertLineSeparator(); + act=new TDEAction(i18n("Print..."), "fileprint", 0, TQT_TQOBJECT(this), TQT_SLOT(print()), itsDirOp->actionCollection(), "print"); + act->plug(toolbar); +#endif + + if( (itsSepDirsAct=itsDirOp->actionCollection()->action("separate dirs")) && + (itsShowHiddenAct=itsDirOp->actionCollection()->action("show hidden"))) + { + //disconnect(itsViewMenuAct->popupMenu(), TQT_SIGNAL(aboutToShow()), itsDirOp, TQT_SLOT(insertViewDependentActions())); + connect(itsViewMenuAct->popupMenu(), TQT_SIGNAL(aboutToShow()), TQT_SLOT(setupViewMenu())); + setupViewMenu(); + } + +#ifdef HAVE_XFT + if(itsPreview) + { + TDEActionCollection *previewCol=itsPreview->actionCollection(); + + if(previewCol && previewCol->count()>0 && (act=previewCol->action("changeText"))) + act->plug(toolbar); + } +#endif + + // + // Set view... + if(itsConfig.readBoolEntry(CFG_LISTVIEW, true)) + listView(); + else + iconView(); + + itsDirOp->dirLister()->setShowingDotFiles(true); + + connect(itsDirOp, TQT_SIGNAL(fileHighlighted(const KFileItem *)), TQT_SLOT(fileHighlighted(const KFileItem *))); + connect(itsDirOp, TQT_SIGNAL(finishedLoading()), TQT_SLOT(loadingFinished())); + connect(itsDirOp, TQT_SIGNAL(dropped(const KFileItem *, TQDropEvent *, const KURL::List &)), + TQT_SLOT(dropped(const KFileItem *, TQDropEvent *, const KURL::List &))); + connect(itsDirOp->dirLister(), TQT_SIGNAL(infoMessage(const TQString &)), TQT_SLOT(infoMessage(const TQString &))); + connect(itsDirOp, TQT_SIGNAL(updateInformation(int, int)), TQT_SLOT(updateInformation(int, int))); +} + +CKCmFontInst::~CKCmFontInst() +{ +#ifdef HAVE_XFT + if(itsPreview) + { + itsConfig.setGroup(CFG_GROUP); + itsConfig.writeEntry(CFG_SPLITTER_SIZES, itsSplitter->sizes()); + } +#endif + delete itsDirOp; +} + +void CKCmFontInst::setMimeTypes(bool showBitmap) +{ + TQStringList mimeTypes; + + mimeTypes << "application/x-font-ttf" + << "application/x-font-otf" + << "application/x-font-ttc" + << "application/x-font-type1"; + if(showBitmap) + mimeTypes << "application/x-font-pcf" + << "application/x-font-bdf"; + + itsDirOp->setMimeFilter(mimeTypes); +} + +void CKCmFontInst::filterFonts() +{ + setMimeTypes(itsShowBitmapAct->isChecked()); + itsDirOp->rereadDir(); + itsConfig.setGroup(CFG_GROUP); + itsConfig.writeEntry(CFG_SHOW_BITMAP, itsShowBitmapAct->isChecked()); + if(itsEmbeddedAdmin) + itsConfig.sync(); +} + +TQString CKCmFontInst::quickHelp() const +{ + return Misc::root() + ? i18n("

Font Installer

This module allows you to" + //" install TrueType, Type1, Speedo, and Bitmap" + " install TrueType, Type1, and Bitmap" + " fonts.

You may also install fonts using Konqueror:" + " type fonts:/ into Konqueror's location bar" + " and this will display your installed fonts. To install a" + " font, simply copy one into the folder.

") + : i18n("

Font Installer

This module allows you to" + //" install TrueType, Type1, Speedo, and Bitmap" + " install TrueType, Type1, and Bitmap" + " fonts.

You may also install fonts using Konqueror:" + " type fonts:/ into Konqueror's location bar" + " and this will display your installed fonts. To install a" + " font, simply copy it into the appropriate folder - " + " \"Personal\" for fonts available to just yourself, or " + " \"System\" for system-wide fonts (available to all).

" + "

NOTE: As you are not logged in as \"root\", any" + " fonts installed will only be available to you. To install" + " fonts system-wide, use the \"Administrator Mode\"" + " button to run this module as \"root\".

"); +} + +void CKCmFontInst::listView() +{ + CKFileFontView *newView=new CKFileFontView(itsDirOp, "detailed view"); + + itsDirOp->setView(newView); + itsListAct->setChecked(true); + itsConfig.setGroup(CFG_GROUP); + itsConfig.writeEntry(CFG_LISTVIEW, true); + if(itsEmbeddedAdmin) + itsConfig.sync(); + itsDirOp->setAcceptDrops(true); +} + +void CKCmFontInst::iconView() +{ + CKFileFontIconView *newView=new CKFileFontIconView(itsDirOp, "simple view"); + + itsDirOp->setView(newView); + itsIconAct->setChecked(true); + itsConfig.setGroup(CFG_GROUP); + itsConfig.writeEntry(CFG_LISTVIEW, false); + if(itsEmbeddedAdmin) + itsConfig.sync(); + itsDirOp->setAcceptDrops(true); +} + +void CKCmFontInst::setupMenu() +{ + itsDirOp->setupMenu(KDirOperator::SortActions|/*KDirOperator::FileActions|*/KDirOperator::ViewActions); +} + +void CKCmFontInst::setupViewMenu() +{ + itsViewMenuAct->remove(itsSepDirsAct); + itsViewMenuAct->remove(itsShowHiddenAct); +} + +void CKCmFontInst::fileHighlighted(const KFileItem *item) +{ + const KFileItemList *list=itsDirOp->selectedItems(); + + itsDeleteAct->setEnabled(list && list->count()); + +#ifdef HAVE_XFT + if(itsPreview) + { + // + // Generate preview... + const KFileItem *previewItem=item + ? item + : list && 1==list->count() + ? list->getFirst() + : NULL; + + if(previewItem && list && list->contains(previewItem)) // OK, check its been selected - not deselected!!! + itsPreview->openURL(previewItem->url()); + } +#endif +} + +void CKCmFontInst::loadingFinished() +{ + TQListView *lView=dynamic_cast(itsDirOp->view()); + + if(lView) + lView->sort(); + else + { + TQIconView *iView=dynamic_cast(itsDirOp->view()); + + if(iView) + iView->sort(); + } + fileHighlighted(NULL); +} + +void CKCmFontInst::addFonts() +{ + KURL::List list=KFileDialog::getOpenURLs(TQString::null, "application/x-font-ttf application/x-font-otf " + "application/x-font-ttc application/x-font-type1 " + "application/x-font-pcf application/x-font-bdf", + //"application/x-font-snf application/x-font-speedo", + this, i18n("Add Fonts")); + + if(list.count()) + addFonts(list, itsDirOp->url()); +} + +void CKCmFontInst::removeFonts() +{ + if(itsDirOp->selectedItems()->isEmpty()) + KMessageBox::information(this, i18n("You did not select anything to delete."), i18n("Nothing to Delete")); + else + { + KURL::List urls; + TQStringList files; + KFileItemListIterator it(*(itsDirOp->selectedItems())); + + for(; it.current(); ++it) + { + KURL url((*it)->url()); + + url.setQuery(KFI_KIO_NO_CLEAR); + files.append((*it)->text()); + urls.append(url); + } + + bool doIt=false; + + switch(files.count()) + { + case 0: + break; + case 1: + doIt = KMessageBox::Continue==KMessageBox::warningContinueCancel(this, + i18n("Do you really want to delete\n '%1'?").arg(files.first()), + i18n("Delete Font"), KStdGuiItem::del()); + break; + default: + doIt = KMessageBox::Continue==KMessageBox::warningContinueCancelList(this, + i18n("Do you really want to delete this font?", "Do you really want to delete these %n fonts?", + files.count()), + files, i18n("Delete Fonts"), KStdGuiItem::del()); + } + + if(doIt) + { + TDEIO::DeleteJob *job = TDEIO::del(urls, false, true); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), this, TQT_SLOT(delResult(TDEIO::Job *))); + job->setWindow(this); + job->setAutoErrorHandlingEnabled(true, this); + } + } +} + +void CKCmFontInst::configure() +{ + CSettingsDialog(this).exec(); +} + +void CKCmFontInst::print() +{ +#ifdef HAVE_XFT + KFileItemList list; + bool ok=false; + + for (KFileItem *item=itsDirOp->view()->firstFileItem(); item && !ok; item=itsDirOp->view()->nextItem(item)) + if(Print::printable(item->mimetype())) + ok=true; + + if(ok) + { + const KFileItemList *list=itsDirOp->selectedItems(); + bool select=false; + + if(list) + { + KFileItemList::Iterator it(list->begin()), + end(list->end()); + + for(; it!=end && !select; ++it) + if(Print::printable((*it)->mimetype())) + select=true; + } + + CPrintDialog dlg(this); + + itsConfig.setGroup(CFG_GROUP); + if(dlg.exec(select, itsConfig.readNumEntry(CFG_FONT_SIZE, 1))) + { + static const int constSizes[]={0, 12, 18, 24, 36, 48}; + + TQStringList items; + TQValueVector sizes; + CFcEngine engine; + + if(dlg.outputAll()) + { + for (KFileItem *item=itsDirOp->view()->firstFileItem(); item; item=itsDirOp->view()->nextItem(item)) + items.append(item->name()); + } + else + { + KFileItemList::Iterator it(list->begin()), + end(list->end()); + + for(; it!=end; ++it) + items.append((*it)->name()); + } + Print::printItems(items, constSizes[dlg.chosenSize()], this, engine); + itsConfig.writeEntry(CFG_FONT_SIZE, dlg.chosenSize()); + if(itsEmbeddedAdmin) + itsConfig.sync(); + } + } + else + KMessageBox::information(this, i18n("There are no printable fonts.\nYou can only print non-bitmap fonts."), + i18n("Cannot Print")); +#endif +} + +void CKCmFontInst::dropped(const KFileItem *i, TQDropEvent *, const KURL::List &urls) +{ + if(urls.count()) + addFonts(urls, i && i->isDir() ? i->url() : itsDirOp->url()); +} + +void CKCmFontInst::infoMessage(const TQString &msg) +{ + itsStatusLabel->setText(msg); +} + +static TQString family(const TQString &name) +{ + int commaPos=name.find(','); + + return -1==commaPos ? name : name.left(commaPos); +} + +void CKCmFontInst::updateInformation(int, int fonts) +{ + TDEIO::filesize_t size=0; + TQString text(i18n("One Font", "%n Fonts", fonts)); + TQStringList families; + + if(fonts>0) + { + KFileItem *item=NULL; + + for (item=itsDirOp->view()->firstFileItem(); item; item=itsDirOp->view()->nextItem(item)) + { + TQString fam(family(item->text())); + + size+=item->size(); + if(-1==families.findIndex(fam)) + families+=fam; + } + } + + if(fonts>0) + { + text+=" "; + text+=i18n("(%1 Total)").arg(TDEIO::convertSize(size)); + } + text+=" - "; + text+=i18n("One Family", "%n Families", families.count()); + itsStatusLabel->setText(text); +} + +void CKCmFontInst::delResult(TDEIO::Job *job) +{ + // + // To speed up font deletion, we dont rescan font list each time - so after this has completed, we need + // to refresh font list before updating the directory listing... + TQByteArray packedArgs; + TQDataStream stream(packedArgs, IO_WriteOnly); + + stream << KFI::SPECIAL_RESCAN; + + TDEIO::NetAccess::synchronousRun(TDEIO::special(KFI_KIO_FONTS_PROTOCOL ":/", packedArgs), this); + jobResult(job); +} + +void CKCmFontInst::jobResult(TDEIO::Job *job) +{ + // + // Force an update of the view. For some reason the view is not automatically updated when + // run in embedded mode - e.g. from the "Admin" mode button on KControl. + itsDirOp->dirLister()->updateDirectory(itsDirOp->url()); + if(job && 0==job->error()) + KMessageBox::information(this, +#ifdef HAVE_XFT + i18n("

Please note that any open applications will need to be restarted in order " + "for any changes to be noticed.

(You will also have to restart this application " + "in order to use its print function on any newly installed fonts.)

"), +#else + i18n("Please note that any open applications will need to be restarted in order " + "for any changes to be noticed."), +#endif + i18n("Success"), "TDEFontinst_WarnAboutFontChangesAndOpenApps"); +} + +void CKCmFontInst::addFonts(const KURL::List &src, const KURL &dest) +{ + if(src.count()) + { + KURL::List copy(src); + KURL::List::ConstIterator it; + + // + // Check if font has any associated AFM or PFM file... + for(it=src.begin(); it!=src.end(); ++it) + { + KURL::List associatedUrls; + + Misc::getAssociatedUrls(*it, associatedUrls, false, this); + copy+=associatedUrls; + } + + TDEIO::CopyJob *job=TDEIO::copy(copy, dest, true); + connect(job, TQT_SIGNAL(result(TDEIO::Job *)), this, TQT_SLOT(jobResult(TDEIO::Job *))); + job->setWindow(this); + job->setAutoErrorHandlingEnabled(true, this); + } +} + +} + +#include "KCmFontInst.moc" diff --git a/kcontrol/tdefontinst/kcmfontinst/KCmFontInst.h b/kcontrol/tdefontinst/kcmfontinst/KCmFontInst.h new file mode 100644 index 000000000..a5dccb161 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/KCmFontInst.h @@ -0,0 +1,116 @@ +#ifndef __KCM_FONT_INST_H__ +#define __KCM_FONT_INST_H__ + +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CKCmFontInst +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 26/04/2003 +// 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, 2003, 2004 +//////////////////////////////////////////////////////////////////////////////// + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#ifdef HAVE_XFT +#include +#endif + +class KDirOperator; +class TDEAction; +class TDERadioAction; +class TDEActionMenu; +class TDEToggleAction; +class KFileItem; +class TQLabel; +class TQSplitter; +class TQDropEvent; +class KFileItem; + +namespace KFI +{ + +class CKCmFontInst : public TDECModule +{ + Q_OBJECT + + public: + + CKCmFontInst(TQWidget *parent=NULL, const char *name=NULL, const TQStringList &list=TQStringList()); + virtual ~CKCmFontInst(); + + void setMimeTypes(bool showBitmap); + + public slots: + + void filterFonts(); + TQString quickHelp() const; + void listView(); + void iconView(); + void setupMenu(); + void setupViewMenu(); + void fileHighlighted(const KFileItem *item); + void loadingFinished(); + void addFonts(); + void removeFonts(); + void configure(); + void print(); + void dropped(const KFileItem *i, TQDropEvent *e, const KURL::List &urls); + void infoMessage(const TQString &msg); + void updateInformation(int dirs, int fonts); + void delResult(TDEIO::Job *job); + void jobResult(TDEIO::Job *job); + + private: + + void addFonts(const KURL::List &src, const KURL &dest); + + private: + + KDirOperator *itsDirOp; + KURL itsTop; + TDEToggleAction *itsShowBitmapAct; + TDEAction *itsSepDirsAct, + *itsShowHiddenAct, + *itsDeleteAct; + TDERadioAction *itsListAct, + *itsIconAct; + TDEActionMenu *itsViewMenuAct; +#ifdef HAVE_XFT + KParts::ReadOnlyPart *itsPreview; +#endif + TQSplitter *itsSplitter; + TDEConfig itsConfig; + bool itsEmbeddedAdmin; + TQLabel *itsStatusLabel; +}; + +} + +#endif diff --git a/kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.cpp b/kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.cpp new file mode 100644 index 000000000..0770094e3 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.cpp @@ -0,0 +1,88 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CKFileFontIconView +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 31/05/2003 +// 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, 2003, 2004 +//////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include "KFileFontIconView.h" + +namespace KFI +{ + +// CPD: KDE4 should make acceptDrag() virtual there fore can get rid of all these ::contentsX functions... +void CKFileFontIconView::contentsDragEnterEvent(TQDragEnterEvent *e) +{ + if(acceptDrag(e)) + KFileIconView::contentsDragEnterEvent(e); + else + e->ignore(); +} + +void CKFileFontIconView::contentsDragMoveEvent(TQDragMoveEvent *e) +{ + if(acceptDrag(e)) + KFileIconView::contentsDragMoveEvent(e); + else + e->ignore(); +} + +void CKFileFontIconView::contentsDropEvent(TQDropEvent *e) +{ + contentsDragLeaveEvent(NULL); + + if(acceptDrag(e)) + KFileIconView::contentsDropEvent(e); + else + e->ignore(); +} + +bool CKFileFontIconView::acceptDrag(TQDropEvent *e) const +{ +#if 0 // Crashes - seems to be called to quick??? + bool ok=false; + KURL::List urls; + + if(KURLDrag::canDecode(e) && (e->source()!=const_cast(this)) && + (TQDropEvent::Copy==e->action() || TQDropEvent::Move==e->action()) && + KURLDrag::decode(e, urls) && !urls.isEmpty()) + { + KURL::List::Iterator it; + + ok=true; + for(it=urls.begin(); ok && it!=urls.end(); ++it) + if(!CFontEngine::isAFontOrAfm(TQFile::encodeName((*it).path()))) + ok=false; + } + + return ok; +#endif + return KURLDrag::canDecode(e) && (e->source()!= const_cast(this)) && + (TQDropEvent::Copy==e->action() || TQDropEvent::Move==e->action()); +} + +} diff --git a/kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.h b/kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.h new file mode 100644 index 000000000..474b0e7fb --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/KFileFontIconView.h @@ -0,0 +1,55 @@ +#ifndef __TDEFILE_FONT_ICON_VIEW_H__ +#define __TDEFILE_FONT_ICON_VIEW_H__ + +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CKFileFontIconView +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 01/08/2003 +// 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, 2003, 2004 +//////////////////////////////////////////////////////////////////////////////// + +#include + +namespace KFI +{ + +class CKFileFontIconView : public KFileIconView +{ + public: + + CKFileFontIconView(TQWidget *parent, const char *name) : KFileIconView(parent, name) {} + virtual ~CKFileFontIconView() {} + + protected: + + // DND support + void contentsDragEnterEvent(TQDragEnterEvent *e); + void contentsDragMoveEvent(TQDragMoveEvent *e); + void contentsDropEvent(TQDropEvent *e); + bool acceptDrag(TQDropEvent *e) const; +}; + +} + +#endif diff --git a/kcontrol/tdefontinst/kcmfontinst/KFileFontView.cpp b/kcontrol/tdefontinst/kcmfontinst/KFileFontView.cpp new file mode 100644 index 000000000..fb45b44ca --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/KFileFontView.cpp @@ -0,0 +1,645 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : CKFileFontView +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 31/05/2003 +// 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, 2003 +//////////////////////////////////////////////////////////////////////////////// + +// +// NOTE: HEAVILY copied from tdefiledetailview.cpp... +// +// Copyright (C) 1997 Stephan Kulow +// 2000, 2001 Carsten Pfeiffer +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "KFileFontView.h" + +#define COL_NAME 0 +#define COL_SIZE 1 +#define COL_TYPE 2 + +class CKFileFontView::CKFileFontViewPrivate +{ + public: + + CKFileFontViewPrivate() : itsDropItem(0) {} + + CFontListViewItem *itsDropItem; + TQTimer itsAutoOpenTimer; +}; + +CKFileFontView::CKFileFontView(TQWidget *parent, const char *name) + : TDEListView(parent, name), + KFileView(), + d(new CKFileFontViewPrivate()) +{ + itsSortingCol = COL_NAME; + itsBlockSortingSignal = false; + setViewName(i18n("Detailed View")); + + addColumn(i18n("Name")); + addColumn(i18n("Size")); + addColumn(i18n("Type")); + setShowSortIndicator(true); + setAllColumnsShowFocus(true); + setDragEnabled(false); + + connect(header(), TQT_SIGNAL(sectionClicked(int)), TQT_SLOT(slotSortingChanged(int))); + connect(this, TQT_SIGNAL(returnPressed(TQListViewItem *)), TQT_SLOT(slotActivate(TQListViewItem *))); + connect(this, TQT_SIGNAL(clicked(TQListViewItem *, const TQPoint&, int)), TQT_SLOT(selected( TQListViewItem *))); + connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), TQT_SLOT(slotActivate(TQListViewItem *))); + connect(this, TQT_SIGNAL(contextMenuRequested(TQListViewItem *, const TQPoint &, int)), + this, TQT_SLOT(slotActivateMenu(TQListViewItem *, const TQPoint &))); + + // DND + connect(&(d->itsAutoOpenTimer), TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAutoOpen())); + setSelectionMode(KFileView::selectionMode()); + itsResolver = new KMimeTypeResolver(this); +} + +CKFileFontView::~CKFileFontView() +{ + delete itsResolver; + delete d; +} + +void CKFileFontView::setSelected(const KFileItem *info, bool enable) +{ + if (info) + { + // we can only hope that this casts works + CFontListViewItem *item = (CFontListViewItem*)info->extraData(this); + + if (item) + TDEListView::setSelected(item, enable); + } +} + +void CKFileFontView::setCurrentItem(const KFileItem *item) +{ + if (item) + { + CFontListViewItem *it = (CFontListViewItem*) item->extraData(this); + + if (it) + TDEListView::setCurrentItem(it); + } +} + +KFileItem * CKFileFontView::currentFileItem() const +{ + CFontListViewItem *current = static_cast(currentItem()); + + return current ? current->fileInfo() : NULL; +} + +void CKFileFontView::clearSelection() +{ + TDEListView::clearSelection(); +} + +void CKFileFontView::selectAll() +{ + if (KFile::NoSelection!=KFileView::selectionMode() && KFile::Single!=KFileView::selectionMode()) + TDEListView::selectAll(true); +} + +void CKFileFontView::invertSelection() +{ + TDEListView::invertSelection(); +} + +void CKFileFontView::slotActivateMenu(TQListViewItem *item,const TQPoint& pos) +{ + if (!item) + sig->activateMenu(0, pos); + else + { + CFontListViewItem *i = (CFontListViewItem*) item; + sig->activateMenu(i->fileInfo(), pos); + } +} + +void CKFileFontView::clearView() +{ + itsResolver->m_lstPendingMimeIconItems.clear(); + TDEListView::clear(); +} + +void CKFileFontView::insertItem(KFileItem *i) +{ + KFileView::insertItem(i); + + CFontListViewItem *item = new CFontListViewItem((TQListView*) this, i); + + setSortingKey(item, i); + + i->setExtraData(this, item); + + if (!i->isMimeTypeKnown()) + itsResolver->m_lstPendingMimeIconItems.append(item); +} + +void CKFileFontView::slotActivate(TQListViewItem *item) +{ + if (item) + { + const KFileItem *fi = ((CFontListViewItem*)item)->fileInfo(); + + if (fi) + sig->activate(fi); + } +} + +void CKFileFontView::selected(TQListViewItem *item) +{ + if (item && !(TDEApplication::keyboardMouseState() & (ShiftButton|ControlButton)) && + TDEGlobalSettings::singleClick()) + { + const KFileItem *fi = ((CFontListViewItem*)item)->fileInfo(); + + if (fi && (fi->isDir() || !onlyDoubleClickSelectsFiles())) + sig->activate(fi); + } +} + +void CKFileFontView::highlighted( TQListViewItem *item ) +{ + if (item) + { + const KFileItem *fi = ((CFontListViewItem*)item)->fileInfo(); + + if (fi) + sig->highlightFile(fi); + } +} + +void CKFileFontView::setSelectionMode(KFile::SelectionMode sm) +{ + disconnect(TQT_SIGNAL(selectionChanged()), this); + disconnect(TQT_SIGNAL(selectionChanged(TQListViewItem *)), this); + + switch (sm) + { + case KFile::Multi: + TQListView::setSelectionMode(TQListView::Multi); + break; + case KFile::Extended: + TQListView::setSelectionMode(TQListView::Extended); + break; + case KFile::NoSelection: + TQListView::setSelectionMode(TQListView::NoSelection); + break; + default: // fall through + case KFile::Single: + TQListView::setSelectionMode(TQListView::Single); + break; + } + + // for highlighting + if (KFile::Multi==sm || KFile::Extended==sm) + connect(this, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelectionChanged())); + else + connect(this, TQT_SIGNAL(selectionChanged(TQListViewItem *)), TQT_SLOT(highlighted(TQListViewItem * ))); +} + +bool CKFileFontView::isSelected(const KFileItem *i) const +{ + if (!i) + return false; + else + { + CFontListViewItem *item = (CFontListViewItem*) i->extraData(this); + + return (item && item->isSelected()); + } +} + +void CKFileFontView::updateView(bool b) +{ + if (b) + { + TQListViewItemIterator it((TQListView*)this); + + for (; it.current(); ++it) + { + CFontListViewItem *item=static_cast(it.current()); + + item->setPixmap(0, item->fileInfo()->pixmap(KIcon::SizeSmall)); + } + } +} + +void CKFileFontView::updateView(const KFileItem *i) +{ + if (i) + { + CFontListViewItem *item = (CFontListViewItem*) i->extraData(this); + + if (item) + { + item->init(); + setSortingKey(item, i); + } + } +} + +void CKFileFontView::setSortingKey(CFontListViewItem *item, const KFileItem *i) +{ + TQDir::SortSpec spec = KFileView::sorting(); + + if (spec&TQDir::Size) + item->setKey(sortingKey(i->size(), i->isDir(), spec)); + else + item->setKey(sortingKey(i->text(), i->isDir(), spec)); +} + +void CKFileFontView::removeItem(const KFileItem *i) +{ + if (i) + { + CFontListViewItem *item = (CFontListViewItem*) i->extraData(this); + + itsResolver->m_lstPendingMimeIconItems.remove(item); + delete item; + + KFileView::removeItem(i); + } +} + +void CKFileFontView::slotSortingChanged(int col) +{ + TQDir::SortSpec sort = sorting(); + int sortSpec = -1; + bool reversed = col == itsSortingCol && (sort & TQDir::Reversed) == 0; + itsSortingCol = col; + + switch(col) + { + case COL_NAME: + sortSpec = (sort & ~TQDir::SortByMask | TQDir::Name); + break; + case COL_SIZE: + sortSpec = (sort & ~TQDir::SortByMask | TQDir::Size); + break; + // the following columns have no equivalent in TQDir, so we set it + // to TQDir::Unsorted and remember the column (itsSortingCol) + case COL_TYPE: + sortSpec = (sort & ~TQDir::SortByMask | TQDir::Time); + break; + default: + break; + } + + if (reversed) + sortSpec|=TQDir::Reversed; + else + sortSpec&=~TQDir::Reversed; + + if (sort & TQDir::IgnoreCase) + sortSpec|=TQDir::IgnoreCase; + else + sortSpec&=~TQDir::IgnoreCase; + + KFileView::setSorting(static_cast(sortSpec)); + + KFileItem *item; + KFileItemListIterator it(*items()); + + if ( sortSpec & TQDir::Size ) + { + for (; (item = it.current()); ++it ) + { + CFontListViewItem *i = viewItem(item); + i->setKey(sortingKey(item->size(), item->isDir(), sortSpec)); + } + } + else + for (; (item = it.current()); ++it ) + { + CFontListViewItem *i = viewItem(item); + + i->setKey(sortingKey(i->text(itsSortingCol), item->isDir(), sortSpec)); + } + + TDEListView::setSorting(itsSortingCol, !reversed); + TDEListView::sort(); + + if (!itsBlockSortingSignal) + sig->changeSorting( static_cast( sortSpec ) ); +} + +void CKFileFontView::setSorting(TQDir::SortSpec spec) +{ + if (spec & TQDir::Size) + itsSortingCol=COL_SIZE; + else + itsSortingCol=COL_NAME; + + // inversed, because slotSortingChanged will reverse it + if (spec & TQDir::Reversed) + spec = (TQDir::SortSpec) (spec & ~TQDir::Reversed); + else + spec = (TQDir::SortSpec) (spec | TQDir::Reversed); + + KFileView::setSorting((TQDir::SortSpec) spec); + + // don't emit sortingChanged() when called via setSorting() + itsBlockSortingSignal = true; // can't use blockSignals() + slotSortingChanged(itsSortingCol); + itsBlockSortingSignal = false; +} + +void CKFileFontView::ensureItemVisible(const KFileItem *i) +{ + if (i) + { + CFontListViewItem *item = (CFontListViewItem*) i->extraData(this); + + if ( item ) + TDEListView::ensureItemVisible(item); + } +} + +// we're in multiselection mode +void CKFileFontView::slotSelectionChanged() +{ + sig->highlightFile(NULL); +} + +KFileItem * CKFileFontView::firstFileItem() const +{ + CFontListViewItem *item = static_cast(firstChild()); + + return item ? item->fileInfo() : NULL; +} + +KFileItem * CKFileFontView::nextItem(const KFileItem *fileItem) const +{ + if (fileItem) + { + CFontListViewItem *item = viewItem(fileItem); + + return item && item->itemBelow() ? ((CFontListViewItem*) item->itemBelow())->fileInfo() : NULL; + } + + return firstFileItem(); +} + +KFileItem * CKFileFontView::prevItem(const KFileItem *fileItem) const +{ + if (fileItem) + { + CFontListViewItem *item = viewItem(fileItem); + + return item && item->itemAbove() ? ((CFontListViewItem*) item->itemAbove())->fileInfo() : NULL; + } + + return firstFileItem(); +} + +void CKFileFontView::keyPressEvent(TQKeyEvent *e) +{ + TDEListView::keyPressEvent(e); + + if (Key_Return==e->key() || Key_Enter==e->key()) + if (e->state() & ControlButton) + e->ignore(); + else + e->accept(); +} + +// +// mimetype determination on demand +// +void CKFileFontView::mimeTypeDeterminationFinished() +{ + // anything to do? +} + +void CKFileFontView::determineIcon(CFontListViewItem *item) +{ + item->fileInfo()->determineMimeType(); + updateView(item->fileInfo()); +} + +void CKFileFontView::listingCompleted() +{ + itsResolver->start(); +} + +TQDragObject *CKFileFontView::dragObject() +{ + // create a list of the URL:s that we want to drag + KURL::List urls; + KFileItemListIterator it(* KFileView::selectedItems()); + TQPixmap pixmap; + TQPoint hotspot; + + for ( ; it.current(); ++it ) + urls.append( (*it)->url() ); + + if(urls.count()> 1) + pixmap = DesktopIcon("tdemultiple", KIcon::SizeSmall); + if(pixmap.isNull()) + pixmap = currentFileItem()->pixmap(KIcon::SizeSmall); + + hotspot.setX(pixmap.width() / 2); + hotspot.setY(pixmap.height() / 2); + + TQDragObject *dragObject=new KURLDrag(urls, widget()); + + if(dragObject) + dragObject->setPixmap(pixmap, hotspot); + + return dragObject; +} + +void CKFileFontView::slotAutoOpen() +{ + d->itsAutoOpenTimer.stop(); + + if(d->itsDropItem) + { + KFileItem *fileItem = d->itsDropItem->fileInfo(); + + if (fileItem && !fileItem->isFile() && (fileItem->isDir() || fileItem->isLink())) + sig->activate(fileItem); + } +} + +bool CKFileFontView::acceptDrag(TQDropEvent *e) const +{ +#if 0 // Following doesn't seem to work, why??? + bool ok=false; + KURL::List urls; + + + if((e->source()!=const_cast(this)) && + (TQDropEvent::Copy==e->action() || TQDropEvent::Move==e->action()) && + KURLDrag::decode(e, urls) && !urls.isEmpty()) + { + KURL::List::Iterator it; + + ok=true; + for(it=urls.begin(); ok && it!=urls.end(); ++it) + if(!CFontEngine::isAFontOrAfm(TQFile::encodeName((*it).path()))) + ok=false; + } + + return ok; +#endif + + return KURLDrag::canDecode(e) && (e->source()!= const_cast(this)) && + (TQDropEvent::Copy==e->action() || TQDropEvent::Move==e->action()); +} + +void CKFileFontView::contentsDragEnterEvent(TQDragEnterEvent *e) +{ + if (!acceptDrag(e)) // can we decode this ? + e->ignore(); // No + else + { + e->acceptAction(); // Yes + + if((dropOptions() & AutoOpenDirs)) + { + CFontListViewItem *item = dynamic_cast(itemAt(contentsToViewport(e->pos()))); + if (item) // are we over an item ? + { + d->itsDropItem = item; + d->itsAutoOpenTimer.start(autoOpenDelay()); // restart timer + } + else + { + d->itsDropItem = 0; + d->itsAutoOpenTimer.stop(); + } + } + } +} + +void CKFileFontView::contentsDragMoveEvent(TQDragMoveEvent *e) +{ + if (!acceptDrag(e)) // can we decode this ? + e->ignore(); // No + else + { + e->acceptAction(); // Yes + + if ((dropOptions() & AutoOpenDirs)) + { + CFontListViewItem *item = dynamic_cast(itemAt(contentsToViewport(e->pos()))); + + if (item) // are we over an item ? + { + if (d->itsDropItem != item) + { + d->itsDropItem = item; + d->itsAutoOpenTimer.start(autoOpenDelay()); // restart timer + } + } + else + { + d->itsDropItem = 0; + d->itsAutoOpenTimer.stop(); + } + } + } +} + +void CKFileFontView::contentsDragLeaveEvent(TQDragLeaveEvent *) +{ + d->itsDropItem = 0; + d->itsAutoOpenTimer.stop(); +} + +void CKFileFontView::contentsDropEvent(TQDropEvent *e) +{ + d->itsDropItem = 0; + d->itsAutoOpenTimer.stop(); + + if (!acceptDrag(e)) // can we decode this ? + e->ignore(); // No + else + { + e->acceptAction(); // Yes + + CFontListViewItem *item = dynamic_cast(itemAt(contentsToViewport(e->pos()))); + KFileItem *fileItem = item ? item->fileInfo() : 0; + KURL::List urls; + + emit dropped(e, fileItem); + + if(KURLDrag::decode(e, urls) && !urls.isEmpty()) + { + emit dropped(e, urls, fileItem ? fileItem->url() : KURL()); + sig->dropURLs(fileItem, e, urls); + } + } +} + +void CKFileFontView::readConfig(TDEConfig *kc, const TQString &group) +{ + restoreLayout(kc, group.isEmpty() ? TQString("CFileFontView") : group); + slotSortingChanged(sortColumn()); +} + +void CKFileFontView::writeConfig(TDEConfig *kc, const TQString &group) +{ + saveLayout(kc, group.isEmpty() ? TQString("CFileFontView") : group); +} + +///////////////////////////////////////////////////////////////// + +void CFontListViewItem::init() +{ + CFontListViewItem::setPixmap(COL_NAME, itsInf->pixmap(KIcon::SizeSmall)); + + setText(COL_NAME, itsInf->text()); + setText(COL_SIZE, itsInf->isDir() ? "" : TDEGlobal::locale()->formatNumber(itsInf->size(), 0)); + setText(COL_TYPE, itsInf->mimeComment()); +} + +void CKFileFontView::virtual_hook(int id, void *data) +{ + TDEListView::virtual_hook(id, data); + KFileView::virtual_hook(id, data); +} + +#include "KFileFontView.moc" diff --git a/kcontrol/tdefontinst/kcmfontinst/KFileFontView.h b/kcontrol/tdefontinst/kcmfontinst/KFileFontView.h new file mode 100644 index 000000000..2950d3c33 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/KFileFontView.h @@ -0,0 +1,219 @@ +#ifndef __TDEFILE_FONT_VIEW_H__ +#define __TDEFILE_FONT_VIEW_H__ + +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : CKFileFontView +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 31/05/2003 +// 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, 2003 +//////////////////////////////////////////////////////////////////////////////// + +// +// NOTE: HEAVILY copied from tdefiledetailview.cpp... +// +// Copyright (C) 1997 Stephan Kulow +// 2000, 2001 Carste + +class KFileItem; +class TQWidget; +class TQKeyEvent; + +#include +#include + +#include "tdefileview.h" + +/** + * An item for the listiew, that has a reference to its corresponding + * @ref KFileItem. + */ +class CFontListViewItem : public TDEListViewItem +{ + public: + + CFontListViewItem(TQListView *parent, const TQString &text, const TQPixmap &icon, KFileItem *fi) + : TDEListViewItem(parent, text), + itsInf(fi) + { + setPixmap(0, icon); + setText(0, text); + } + + CFontListViewItem(TQListView *parent, KFileItem *fi) + : TDEListViewItem(parent), + itsInf(fi) + { + init(); + } + + CFontListViewItem(TQListView *parent, const TQString &text, const TQPixmap &icon, KFileItem *fi, TQListViewItem *after) + : TDEListViewItem(parent, after), + itsInf(fi) + { + setPixmap(0, icon); + setText(0, text); + } + + ~CFontListViewItem() { itsInf->removeExtraData(listView()); } + + /** + * @returns the corresponding KFileItem + */ + KFileItem *fileInfo() const { return itsInf; } + + virtual TQString key( int /*column*/, bool /*ascending*/ ) const { return itsKey; } + + void setKey( const TQString& key ) { itsKey = key; } + + TQRect rect() const + { + TQRect r = listView()->itemRect(this); + + return TQRect(listView()->viewportToContents(r.topLeft()), TQSize(r.width(), r.height())); + } + + void init(); + + private: + + KFileItem *itsInf; + TQString itsKey; + + class CFontListViewItemPrivate; + + CFontListViewItemPrivate *d; +}; + +/** + * A list-view capable of showing @ref KFileItem'. Used in the filedialog + * for example. Most of the documentation is in @ref KFileView class. + * + * @see KDirOperator + * @see KCombiView + * @see KFileIconView + */ +class CKFileFontView : public TDEListView, public KFileView +{ + Q_OBJECT + + public: + + CKFileFontView(TQWidget *parent, const char *name); + virtual ~CKFileFontView(); + + virtual TQWidget * widget() { return this; } + virtual void clearView(); + virtual void setAutoUpdate(bool) {} // ### unused. remove in KDE4 + virtual void setSelectionMode( KFile::SelectionMode sm ); + virtual void updateView(bool b); + virtual void updateView(const KFileItem *i); + virtual void removeItem(const KFileItem *i); + virtual void listingCompleted(); + virtual void setSelected(const KFileItem *i, bool b); + virtual bool isSelected(const KFileItem *i) const; + virtual void clearSelection(); + virtual void selectAll(); + virtual void invertSelection(); + virtual void setCurrentItem( const KFileItem *i); + virtual KFileItem * currentFileItem() const; + virtual KFileItem * firstFileItem() const; + virtual KFileItem * nextItem(const KFileItem *i) const; + virtual KFileItem * prevItem(const KFileItem *i) const; + virtual void insertItem( KFileItem *i); + + void readConfig(TDEConfig *kc, const TQString &group); + void writeConfig(TDEConfig *kc, const TQString &group); + + // implemented to get noticed about sorting changes (for sortingIndicator) + virtual void setSorting(TQDir::SortSpec s); + void ensureItemVisible(const KFileItem *i); + + // for KMimeTypeResolver + void mimeTypeDeterminationFinished(); + void determineIcon(CFontListViewItem *item); + TQScrollView * scrollWidget() const { return (TQScrollView*) this; } + + signals: + // The user dropped something. + // fileItem points to the item dropped on or can be 0 if the + // user dropped on empty space. + void dropped(TQDropEvent *event, KFileItem *fileItem); + // The user dropped the URLs urls. + // url points to the item dropped on or can be empty if the + // user dropped on empty space. + void dropped(TQDropEvent *event, const KURL::List &urls, const KURL &url); + + protected: + + virtual void keyPressEvent(TQKeyEvent *e); + // DND support + TQDragObject * dragObject(); + void contentsDragEnterEvent(TQDragEnterEvent *e); + void contentsDragMoveEvent(TQDragMoveEvent *e); + void contentsDragLeaveEvent(TQDragLeaveEvent *e); + void contentsDropEvent(TQDropEvent *e); + bool acceptDrag(TQDropEvent *e) const; + + int itsSortingCol; + + protected slots: + + void slotSelectionChanged(); + + private slots: + + void slotSortingChanged(int c); + void selected(TQListViewItem *item); + void slotActivate(TQListViewItem *item); + void highlighted(TQListViewItem *item); + void slotActivateMenu(TQListViewItem *item, const TQPoint& pos); + void slotAutoOpen(); + + private: + + virtual void insertItem(TQListViewItem *i) { TDEListView::insertItem(i); } + virtual void setSorting(int i, bool b) { TDEListView::setSorting(i, b); } + virtual void setSelected(TQListViewItem *i, bool b) { TDEListView::setSelected(i, b); } + + inline CFontListViewItem * viewItem( const KFileItem *item ) const + { + return item ? (CFontListViewItem *) item->extraData(this) : NULL; + } + + void setSortingKey( CFontListViewItem *item, const KFileItem *i); + + bool itsBlockSortingSignal; + KMimeTypeResolver *itsResolver; + + protected: + + virtual void virtual_hook(int id, void *data); + + private: + + class CKFileFontViewPrivate; + CKFileFontViewPrivate *d; +}; + +#endif diff --git a/kcontrol/tdefontinst/kcmfontinst/Makefile.am b/kcontrol/tdefontinst/kcmfontinst/Makefile.am new file mode 100644 index 000000000..7a4c78920 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/Makefile.am @@ -0,0 +1,31 @@ +if include_fontinst_tn +FONTINST_PRINT_INC=-I$(srcdir)/../viewpart +FONTINST_PRINT_LIB=../viewpart/libkfontinstprint.la +endif + +kde_module_LTLIBRARIES = kcm_fontinst.la +kcm_fontinst_la_LIBADD = $(LIB_KIO) $(FONTINST_PRINT_LIB) $(LIBFREETYPE_LIBS) $(LIBFONTCONFIG_LIBS) ../lib/libkfontinst.la +METASOURCES = AUTO +kcm_fontinst_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries) $(KDE_RPATH) -module -avoid-version -no-undefined +AM_CPPFLAGS = -I$(srcdir)/../lib $(FONTINST_PRINT_INC) -I$(srcdir)/../../fonts $(all_includes) $(LIBFREETYPE_CFLAGS) $(LIBFONTCONFIG_CFLAGS) + +xdg_apps_DATA = kcmfontinst.desktop + +kcm_fontinst_la_SOURCES = \ + KCmFontInst.cpp \ + KFileFontIconView.cpp \ + KFileFontView.cpp \ + PrintDialog.cpp \ + SettingsDialog.cpp + +EXTRA_DIST = \ + $(xdg_apps_DATA) \ + KCmFontInst.h \ + KFileFontIconView.h \ + KFileFontView.h \ + PrintDialog.h \ + SettingsDialog.h + +noinst_HEADERS = $(EXTRA_DIST) + +KDE_ICON = AUTO diff --git a/kcontrol/tdefontinst/kcmfontinst/PrintDialog.cpp b/kcontrol/tdefontinst/kcmfontinst/PrintDialog.cpp new file mode 100644 index 000000000..afd9fa204 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/PrintDialog.cpp @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CPrintDialog +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 12/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 "PrintDialog.h" +#include +#include +#include +#include + +namespace KFI +{ + +CPrintDialog::CPrintDialog(TQWidget *parent) + : KDialogBase(Plain, i18n("Print Font Samples"), Ok|Cancel, Ok, parent, NULL, true, false) +{ + TQFrame *page=plainPage(); + TQGridLayout *layout=new TQGridLayout(page, 1, 1, 0, spacingHint()); + + layout->addWidget(new TQLabel(i18n("Output:"), page), 0, 0); + itsOutput=new TQComboBox(page); + itsOutput->insertItem(i18n("All Fonts"), 0); + itsOutput->insertItem(i18n("Selected Fonts"), 1); + layout->addWidget(itsOutput, 0, 1); + layout->addWidget(new TQLabel(i18n("Font size:"), page), 1, 0); + itsSize=new TQComboBox(page); + itsSize->insertItem(i18n("Waterfall"), 0); + itsSize->insertItem(i18n("12pt"), 1); + itsSize->insertItem(i18n("18pt"), 2); + itsSize->insertItem(i18n("24pt"), 3); + itsSize->insertItem(i18n("36pt"), 4); + itsSize->insertItem(i18n("48pt"), 5); + layout->addWidget(itsSize, 1, 1); + layout->addItem(new TQSpacerItem(2, 2), 2, 1); +} + +bool CPrintDialog::exec(bool select, int size) +{ + if(!select) + { + itsOutput->setCurrentItem(0); + itsOutput->setEnabled(false); + } + else + itsOutput->setCurrentItem(1); + itsSize->setCurrentItem(size); + return TQDialog::Accepted==TQDialog::exec(); +} + +} diff --git a/kcontrol/tdefontinst/kcmfontinst/PrintDialog.h b/kcontrol/tdefontinst/kcmfontinst/PrintDialog.h new file mode 100644 index 000000000..f63118d66 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/PrintDialog.h @@ -0,0 +1,56 @@ +#ifndef __PRINT_DIALOG_H__ +#define __PRINT_DIALOG_H__ + +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CPrintDialog +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 12/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 +#include + +namespace KFI +{ + +class CPrintDialog : public KDialogBase +{ + public: + + CPrintDialog(TQWidget *parent); + + bool exec(bool select, int size); + int chosenSize() { return itsSize->currentItem(); } + bool outputAll() { return 0==itsOutput->currentItem(); } + + private: + + TQComboBox *itsOutput, + *itsSize; +}; + +} + +#endif diff --git a/kcontrol/tdefontinst/kcmfontinst/SettingsDialog.cpp b/kcontrol/tdefontinst/kcmfontinst/SettingsDialog.cpp new file mode 100644 index 000000000..e555dc7fd --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/SettingsDialog.cpp @@ -0,0 +1,99 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CSettingsDialog +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 10/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 "SettingsDialog.h" +#include "KfiConstants.h" +#include "Misc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace KFI +{ + +CSettingsDialog::CSettingsDialog(TQWidget *parent) + : KDialogBase(parent, "settingsdialog", true, i18n("Settings"), + KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true) +{ + TQVBox *page = makeVBoxMainWidget(); + + itsDoX=new TQCheckBox(i18n("Configure fonts for legacy X applications"), page); + TQWhatsThis::add(itsDoX, i18n("

Modern applications use a system called \"FontConfig\" to obtain the list of fonts. " + "Older applications, such as OpenOffice 1.x, GIMP 1.x, etc. use the previous \"core X fonts\" mechanism for " + "this.

Selecting this option will inform the installer to create the necessary files so that these " + "older applications can use the fonts you install.

Please note, however, that this will slow down " + "the installation process.

")); + itsDoGs=new TQCheckBox(i18n("Configure fonts for Ghostscript"), page); + TQWhatsThis::add(itsDoGs, i18n("

When printing, most applications create what is know as PostScript. This is then sent to a special " + "application, named Ghostscript, which can interpret the PostScript and send the appropriate instructions " + "to your printer. If your application does not embed whatever fonts it uses into the PostScript, then " + "Ghostscript needs to be informed as to which fonts you have installed, and where they are located.

" + "

Selecting this option will create the necessary Ghostscript config files.

Please note, however, " + "that this will also slow down the installation process.

As most applications can, and do, embed " + "the fonts into the PostScript before sending this to Ghostscript, this option can safely be disabled.")); + + TDEConfig cfg(Misc::root() ? KFI_ROOT_CFG_FILE : KFI_CFG_FILE); + + itsDoX->setChecked(cfg.readBoolEntry(KFI_CFG_X_KEY, KFI_DEFAULT_CFG_X)); + itsDoGs->setChecked(cfg.readBoolEntry(KFI_CFG_GS_KEY, KFI_DEFAULT_CFG_GS)); +} + +void CSettingsDialog::slotOk() +{ + TDEConfig cfg(Misc::root() ? KFI_ROOT_CFG_FILE : KFI_CFG_FILE); + + bool oldDoX=cfg.readBoolEntry(KFI_CFG_X_KEY, KFI_DEFAULT_CFG_X), + oldDoGs=cfg.readBoolEntry(KFI_CFG_GS_KEY, KFI_DEFAULT_CFG_GS); + + cfg.writeEntry(KFI_CFG_X_KEY, itsDoX->isChecked()); + cfg.writeEntry(KFI_CFG_GS_KEY, itsDoGs->isChecked()); + cfg.sync(); + + if( ((!oldDoX && itsDoX->isChecked()) || (!oldDoGs && itsDoGs->isChecked())) && + KMessageBox::Yes==KMessageBox::questionYesNo(this, i18n("You have enabled a previously disabled option. Would you like the config " + "files updated now? (Normally they are only updated upon installing, or " + "removing, a font.)"), TQString::null, i18n("Update"),i18n("Do Not Update"))) + { + TQByteArray packedArgs; + TQDataStream stream(packedArgs, IO_WriteOnly); + + stream << KFI::SPECIAL_RECONFIG; + + TDEIO::NetAccess::synchronousRun(TDEIO::special(KFI_KIO_FONTS_PROTOCOL ":/", packedArgs), this); + } + + hide(); +} + +} diff --git a/kcontrol/tdefontinst/kcmfontinst/SettingsDialog.h b/kcontrol/tdefontinst/kcmfontinst/SettingsDialog.h new file mode 100644 index 000000000..c45667da3 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/SettingsDialog.h @@ -0,0 +1,57 @@ +#ifndef __SETTINGS_DIALOG_H__ +#define __SETTINGS_DIALOG_H__ + +//////////////////////////////////////////////////////////////////////////////// +// +// Class Name : KFI::CSettingsDialog +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 10/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 + +class TQCheckBox; + +namespace KFI +{ + +class CSettingsDialog : public KDialogBase +{ + public: + + CSettingsDialog(TQWidget *parent); + + private slots: + + void slotOk(); + + private: + + TQCheckBox *itsDoX, + *itsDoGs; +}; + +} + +#endif diff --git a/kcontrol/tdefontinst/kcmfontinst/cr16-action-newfont.png b/kcontrol/tdefontinst/kcmfontinst/cr16-action-newfont.png new file mode 100644 index 000000000..61eef357e Binary files /dev/null and b/kcontrol/tdefontinst/kcmfontinst/cr16-action-newfont.png differ diff --git a/kcontrol/tdefontinst/kcmfontinst/cr22-action-newfont.png b/kcontrol/tdefontinst/kcmfontinst/cr22-action-newfont.png new file mode 100644 index 000000000..049197a35 Binary files /dev/null and b/kcontrol/tdefontinst/kcmfontinst/cr22-action-newfont.png differ diff --git a/kcontrol/tdefontinst/kcmfontinst/cr32-action-newfont.png b/kcontrol/tdefontinst/kcmfontinst/cr32-action-newfont.png new file mode 100644 index 000000000..9cd3d57bc Binary files /dev/null and b/kcontrol/tdefontinst/kcmfontinst/cr32-action-newfont.png differ diff --git a/kcontrol/tdefontinst/kcmfontinst/kcmfontinst.desktop b/kcontrol/tdefontinst/kcmfontinst/kcmfontinst.desktop new file mode 100644 index 000000000..134e658c8 --- /dev/null +++ b/kcontrol/tdefontinst/kcmfontinst/kcmfontinst.desktop @@ -0,0 +1,235 @@ +[Desktop Entry] +Exec=tdecmshell kcmfontinst +Icon=fonts +Type=Application +DocPath=kcontrol/kcmfontinst/index.html + + +X-TDE-Library=fontinst +X-TDE-FactoryName=fontinst +X-TDE-RootOnly=true + +X-TDE-ParentApp=kcontrol + +Name=Font Installer +Name[af]=Skrif tipe Installeerder +Name[ar]=مثبت المحارف +Name[az]=Yazı Növü Qurucusu +Name[be]=Устаноўка шрыфтоў +Name[bg]=Шрифтове +Name[bn]=ফন্ট ইনস্টলার +Name[br]=Stalianer an nodrezhoù +Name[bs]=Dodavanje fontova +Name[ca]=Instal·lador de lletres +Name[cs]=Instalátor písem +Name[csb]=Instalownik fòntów +Name[cy]=Gosodydd Ffontiau +Name[da]=Skrifttype-installering +Name[de]=Schriftarteninstallation +Name[el]=Εγκαταστάτης γραμματοσειρών +Name[eo]=Tiparinstalilo +Name[es]=Instalador de tipos de letra +Name[et]=Fontide paigaldaja +Name[eu]=Letra tipoak instalatzeko tresna +Name[fa]=نصب‌کنندۀ قلم +Name[fi]=Kirjasinasentaja +Name[fr]=Installateur de polices +Name[fy]=Lettertype-Ynstalaasje +Name[ga]=Suiteálaí Clófhoirne +Name[gl]=Instalador de Fontes +Name[he]=מתקין הגופנים +Name[hi]=फ़ॉन्ट संस्थापक +Name[hr]=Instaliranje fontova +Name[hu]=Betűtípus-telepítő +Name[is]=TDE letursækir +Name[it]=Installatore dei tipi di carattere +Name[ja]=フォントインストーラ +Name[ka]=ფონტების დაყენება +Name[kk]=Қаріптерді орнату +Name[km]=កម្មវិធី​ដំឡើង​ពុម្ពអក្សរ +Name[ko]=글꼴 설치기 +Name[lo]=ຕິດຕັ້ງຮູບແບບຕົວອັກສອນ +Name[lt]=Šriftų diegiklis +Name[lv]=Fontu Instalators +Name[mk]=Инсталатор на фонтови +Name[mn]=Бичиг-Суулгалт +Name[ms]=Pemasang Fon +Name[mt]=Installatur ta' fonts +Name[nb]=Skriftinstallering +Name[nds]=Schriftoorden installeren +Name[ne]=फन्ट स्थापक +Name[nl]=Lettertype-installatie +Name[nn]=Skriftinstallering +Name[nso]=Motsenyi wa Fonto +Name[pa]=ਫੋਂਟ ਇੰਸਟਾਲਰ +Name[pl]=Instalator czcionek +Name[pt]=Instalador de Tipos de Letra +Name[pt_BR]=Instalador de Fontes +Name[ro]=Instalare fonturi +Name[ru]=Установка шрифтов +Name[rw]=Mwinjizaporogaramu Imyandikire +Name[se]=Fontasajáiduhttejeaddji +Name[sk]=Inštalátor písiem +Name[sl]=Namestilnik pisav +Name[sr]=Инсталатор фонтова +Name[sr@Latn]=Instalator fontova +Name[sv]=Installation av teckensnitt +Name[ta]=எழுத்துரு நிறுவுதல் +Name[tg]=Барпо кардани ҳарфҳо +Name[th]=ตัวติดตั้งแบบอักษร +Name[tr]=Yazıtipi Kurucusu +Name[tt]=Yazu Quydırğıç +Name[uk]=Встановлення шрифтів +Name[uz]=Shrift oʻrnatgich +Name[uz@cyrillic]=Шрифт ўрнатгич +Name[ven]=Mudzhenisi wa Fontu +Name[vi]=Cài đặt Phông chữ +Name[wa]=Astaleu di fontes +Name[xh]=Umfaki Wohlobo lwegama +Name[zh_CN]=字体安装程序 +Name[zh_TW]=字型安裝程式 +Name[zu]=Umfakeli Wohlobo lwamagama + +Comment=Install & preview fonts +Comment[af]=Installeer & voorskou skriftipes +Comment[ar]=تثبيت و معاينة المحارف +Comment[az]=Yazı növü qur & nümayiş et +Comment[be]=Устаноўка і прагляд шрыфтоў +Comment[bg]=Инсталиране и преглед на шрифтове +Comment[bn]=ফন্ট ইনস্টল এবং প্রাক্‌দর্শন করুন +Comment[br]=Staliañ ha rakgwel an nodrezhoù +Comment[bs]=Dodavanje i pregledanje fontova +Comment[ca]=Instal·la i previsualitza lletres +Comment[cs]=Instalace a náhled písem +Comment[csb]=Instalacëjô ë pòdzérk fòntów +Comment[cy]=Gosod a rhagolygu ffontiau +Comment[da]=Installér og forhåndsvis skrifttyper +Comment[de]=Schriftarten installieren und betrachten +Comment[el]=Εγκατάσταση & προεπισκόπηση γραμματοσειρών +Comment[eo]=Instalas kaj prezentas tiparojn +Comment[es]=Instalar y previsualizar tipos de letra +Comment[et]=Fontide paigaldamine ja eelvaatlus +Comment[eu]=Instalatu eta aurreikusi letra tipoak +Comment[fa]=نصب و پیش‌نمایش قلمها +Comment[fi]=Asenna ja esikatsele kirjasimia +Comment[fr]=Pour installer et afficher des polices de caractères +Comment[fy]=Lettertypen ynstallearje en besjen +Comment[ga]=Suiteáil & Réamhamharc na gClónna +Comment[gl]=Instalar e antever fontes +Comment[he]=התקנה ותצוגה מקדימה של גופנים +Comment[hi]=फ़ॉन्ट्स संस्थापित व पूर्वावलोकन करें +Comment[hr]=Instaliranje i pregled fontova +Comment[hu]=Betűtípusok telepítése, áttekintése +Comment[is]=Setja inn & forskoða letur +Comment[it]=Installa e mostra anteprime dei caratteri +Comment[ja]=フォントのインストールとプレビュー +Comment[ka]=ფონტების დაყენება და დათვალიერება +Comment[kk]=Қаріптерді орнату және қарап-шығу +Comment[km]=ដំឡើង & មើល​ពុម្ពអក្សរ​ជា​មុន +Comment[ko]=글꼴 설치, 미리보기, 관리 +Comment[lo]=ຕິດຕັ້ງແລະສະແດງຕົວຢ່າງຮູບແບບຕົວອັກສອນ +Comment[lt]=Instaliuoja ir peržiūri šriftus +Comment[lv]=Instalē un apskata fontus +Comment[mk]=Инсталирај и прегледај фонтови +Comment[mn]=Бичиг суулгах ба харах +Comment[ms]=Pasang & prapapar fon +Comment[mt]=Installa u ara fonts +Comment[nb]=Installer og forhåndsvis skrifttyper +Comment[nds]=Schriftoorden installeren & ankieken +Comment[ne]=फन्ट स्थापना र पूर्वावलोकन गर्नुहोस् +Comment[nl]=Lettertypen installeren en bekijken +Comment[nn]=Installer og vis skrifter +Comment[nso]=Tsenya & Bonelapele difonto +Comment[pa]=ਫੋਂਟ ਝਲਕ ਤੇ ਇੰਸਟਾਲ +Comment[pl]=Instalacja i podgląd czcionek +Comment[pt]=Instalar e antever tipos de letra +Comment[pt_BR]=Instalar & pré-visualizar fontes +Comment[ro]=Instalează și previzualizează fonturi +Comment[ru]=Установка и просмотр шрифтов +Comment[rw]=Kwinjiza & kugaragazambere imyandikire +Comment[se]=Sajáiduhtte ja čájet fonttaid +Comment[sk]=Inštaluje a zobrazuje písma +Comment[sl]=Namesti in prikaže pisave +Comment[sr]=Инсталација и преглед фонтова +Comment[sr@Latn]=Instalacija i pregled fontova +Comment[sv]=Installera och förhandsgranska teckensnitt +Comment[ta]=எழுத்துருக்களை நிறுவி காட்டு +Comment[tg]=Барпо кардан ва тамошои ҳарфҳо +Comment[th]=ติดตั้งและแสดงตัวอย่างแบบอักษร +Comment[tr]=Yazıtiplerini kur ve önizle +Comment[tt]=Yazu şäkellären quyu/tikşerü urını +Comment[uk]=Встановлення та перегляд шрифтів +Comment[uz]=Shriftlarni oʻrnatish va koʻrib chiqish +Comment[uz@cyrillic]=Шрифтларни ўрнатиш ва кўриб чиқиш +Comment[ven]=Dzhenisani & vhonelani phanda dzifontu +Comment[vi]=Cài đặt & xem trước phông chữ +Comment[wa]=Astalaedje et håynaedje des fontes +Comment[xh]=Faka & yenza imboniso yohlobo lwamagama +Comment[zh_CN]=安装和预览字体 +Comment[zh_TW]=安裝並預覽字型 +Comment[zu]=Fakela & buka ngaphambili izinhlobo zamagama + +Keywords=font,fonts,installer,truetype,type1,speedo,bitmap +Keywords[be]=Шрыфт,Шрыфты,Устаноўка,font,fonts,installer,truetype,type1,speedo,bitmap +Keywords[bg]=шрифт, шрифтове, преглед, печат, font, fonts, installer, truetype, type1, speedo, bitmap +Keywords[br]=nodrezh,nodrezhoù,stalier,truetype,type1,speedo,bitmap +Keywords[bs]=font,fonts,installer,truetype,type1,speedo,bitmap,fontovi,instalacija +Keywords[ca]=lletra,lletres,instal·lador,truetype,type1,speedo,bitmap +Keywords[cs]=písmo,písma,instalátor,truetype,type1,speedo,bitmap +Keywords[csb]=fòntë,font,instalownik,truetype,type1,speedo +Keywords[cy]=ffont,ffontiau,wynebfath, wynebfathau,arsefydlydd,truetype,type1,math 1,speedo,didfap +Keywords[da]=skrifttype,skrifttyper,installatør,truetype,type1,speedo,bitmap +Keywords[de]=Fonts,Schriftarten,Installation,TrueType,Type1,Speedo,Bitmapschriften +Keywords[el]=γραμματοσειρά,γραμματοσειρές,εγκαταστάτης,truetype,type1,speedo,bitmap +Keywords[eo]=tiparo,tiparoj,instalilo,ŝangebla,neŝangebla +Keywords[es]=tipo de letra,tipos de letra,instalador,truetype,type1,speedo,bitmap +Keywords[et]=font,fondid,paigaldaja,truetype,type1,speedo,bitmap +Keywords[eu]=letra-tipoa,letra-tipoak,instalatzailea,truetype,type1,speedo,bitmap +Keywords[fa]=قلم، قلمها، نصب‌کننده، قلم حقیقی، نوع۱ ،speedo، نگاشت بیت، +Keywords[fi]=kirjasin,kirjasimet,fontti,fontit,asentaja,truetype,type1,speedo,bitmap +Keywords[fr]=police,polices,installeur,installateur,truetype,type1,speedo,bitmap +Keywords[fy]=letters,lettertypen,fonts,Ynstalaasje,truetype,type1,speedo,bitmap +Keywords[ga]=cló,clónna,clófhoirne,suiteálaí,truetype,type1,speedo,mapa giotán,giotánmhapach +Keywords[gl]=fonte,fontes,instalador,truetype,type1,speedo,bitmap +Keywords[he]=גופנים,גופן, מתקין, TrueType, Type1, speedo, מפת סיביות, bitmap, font,fonts,installer,truetype,type1,speedo,bitmap +Keywords[hi]=फ़ॉन्ट,फ़ॉन्ट्स,संस्थापक,ट्रू-टाइप,टाइप-1,स्पीडो,बिटमैप +Keywords[hr]=font,fonts,installer,truetype,type1,speedo,bitmap,fontovi,instaliranje,TTF +Keywords[hu]=betűtípus,betűtípusok,telepítő,TrueType,Type1,Speedo,bittérkép +Keywords[is]=font,fonts,installer,truetype,type1,speedo,bitmap,letur +Keywords[it]=font,caratteri,installatore,truetype,type1,speedo,bitmap,tipi di carattere +Keywords[ja]=フォント,インストーラ,truetype,type1,speedo,bitmap,ビットマップ +Keywords[ka]=ფონტი,ფონტები,დასაყენებელი,truetype,type1,speedo,bitmap +Keywords[km]=ពុម្ពអក្សរ,កម្មវិធី​ដំឡើង,truetype,type1,speedo,bitmap +Keywords[lt]=šriftas,šriftai,įdiegimas,truetype,type1,speedo,bitmap +Keywords[lv]=fonti,fonts,instalēt,truetype,type1,speedo,bitmap +Keywords[mk]=font,fonts,installer,truetype,type1,speedo,bitmap,фонт,фонтови,инсталатор +Keywords[nb]=skrift,skrifter,skrifttype,skrifttyper,installer,truetype,type1,speedo,bitmap +Keywords[nds]=Schriftoort,Schriftoorden,Installeren,TrueType,Type1,Speedo,Bitmap +Keywords[ne]=फन्ट, फन्टहरू, स्थापक, ट्रु टाइप, टाइप १, स्पेडो, बिटम्याप +Keywords[nl]=letters,lettertypen,fonts,installatie,truetype,type1,speedo,bitmap +Keywords[nn]=skrift,skrifter,installering,truetype,type1,speedo,bitmap +Keywords[pa]=font,fonts,installer,truetype,type1,speedo,bitmap, ਫੋਂਟ, ਇੰਸਟਾਲਰ +Keywords[pl]=czcionka,czcionki,font,instalator,truetype,type1,speedo +Keywords[pt]=tipo de letra,tipos de letra,instalador,truetype,type1,speedo,imagem +Keywords[pt_BR]=fonte,fontes,instalador,truetype,type1,speedo,bitmap +Keywords[ro]=font,fonturi,instalator,truetype,type1,speedo,bitmap +Keywords[ru]=font,fonts,installer,truetype,type1,speedo,bitmap,шрифты +Keywords[rw]=Imyandikire,imyandikire,mwinjiza,ubwokonyabwo,ubwoko1,umuvuduko,bitimapu +Keywords[se]=fonta,fonttat,sajáiduhttejeaddji,truetype,type1,speedo,bitmap +Keywords[sk]=písmo,písma,inštalátor,truetype,type1,speedo,bitmap +Keywords[sl]=pisava,pisave,namestilnik,truetype,type1,speedo,bitmap +Keywords[sr]=font,fonts,installer,truetype,type1,speedo,bitmap,фонт,фонтови,инсталер,битмапа +Keywords[sr@Latn]=font,fonts,installer,truetype,type1,speedo,bitmap,font,fontovi,instaler,bitmapa +Keywords[sv]=teckensnitt,installation,truetype,type1,speedo,bitmap +Keywords[ta]=எழுத்துரு,எழுத்துருக்கள்,அமர்வர்,மெய்வகை,வகை1,speedo,பிட்படம் +Keywords[th]=แบบอักษร,ตัวติดตั้ง,ทรูไทป์,ไทป์1,speedo,บิตแมป +Keywords[tr]=yazıtipi,yazıtipleri,kurucu,truetype,type1,speedo,bitmap +Keywords[uk]=шрифт, шрифти,встановлення,векторний,растровий,truetype,type1,speedo +Keywords[uz]=shrift,shriftlar,oʻrnatuvchi,bitmap,truetype,type1,speedo +Keywords[uz@cyrillic]=шрифт,шрифтлар,ўрнатувчи,битмап,truetype,type1,speedo +Keywords[vi]=phông chữ,các phông chữ,trình cài đặt,truetype,kiểu 1,tốc độ gõ,mảng ảnh +Keywords[wa]=fonte,fontes,astaleu,truetype,type1,speedo,bitmap +Keywords[zh_CN]=font,fonts,installer,truetype,type1,speedo,bitmap,字体,安装程序,位图字体 +Keywords[zh_TW]=font,fonts,installer,truetype,type1,speedo,bitmap,字型,安裝程式,點陣 + +Categories=Qt;TDE;X-TDE-settings-system; -- cgit v1.2.1