From 2e25fa39cd67cca2472d3eabdb478feb517d72a5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:03:37 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdefile-plugins/pdf/CMakeLists.txt | 36 +++++++++++ tdefile-plugins/pdf/Makefile.am | 22 +++++++ tdefile-plugins/pdf/configure.in.in | 16 +++++ tdefile-plugins/pdf/tdefile_pdf.cpp | 104 ++++++++++++++++++++++++++++++++ tdefile-plugins/pdf/tdefile_pdf.desktop | 64 ++++++++++++++++++++ tdefile-plugins/pdf/tdefile_pdf.h | 39 ++++++++++++ 6 files changed, 281 insertions(+) create mode 100644 tdefile-plugins/pdf/CMakeLists.txt create mode 100644 tdefile-plugins/pdf/Makefile.am create mode 100644 tdefile-plugins/pdf/configure.in.in create mode 100644 tdefile-plugins/pdf/tdefile_pdf.cpp create mode 100644 tdefile-plugins/pdf/tdefile_pdf.desktop create mode 100644 tdefile-plugins/pdf/tdefile_pdf.h (limited to 'tdefile-plugins/pdf') diff --git a/tdefile-plugins/pdf/CMakeLists.txt b/tdefile-plugins/pdf/CMakeLists.txt new file mode 100644 index 00000000..5a81d453 --- /dev/null +++ b/tdefile-plugins/pdf/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################# +# +# (C) 2010-2011 Calvin Morrison +# mutantturkey@gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/tdefile-plugins/dependencies/poppler-tqt +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +#### other data ################################# + +install( FILES tdefile_pdf.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +#### tdefile_pdf (module) ######################### + +tde_add_kpart( tdefile_pdf AUTOMOC + SOURCES tdefile_pdf.cpp + LINK tdeio-shared -L${CMAKE_BINARY_DIR}/tdefile-plugins/dependencies/poppler-tqt -lpoppler-tqt + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/pdf/Makefile.am b/tdefile-plugins/pdf/Makefile.am new file mode 100644 index 00000000..a6f38115 --- /dev/null +++ b/tdefile-plugins/pdf/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for the pdf file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) -I$(top_srcdir)/tdefile-plugins/dependencies/poppler-tqt + +# these are the headers for your project +noinst_HEADERS = tdefile_pdf.h + +kde_module_LTLIBRARIES = tdefile_pdf.la + +tdefile_pdf_la_SOURCES = tdefile_pdf.cpp +tdefile_pdf_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +tdefile_pdf_la_LIBADD = $(LIB_KIO) -L$(top_builddir)/tdefile-plugins/dependencies/poppler-tqt/ -lpoppler-tqt + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_pdf.pot + +services_DATA = tdefile_pdf.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/pdf/configure.in.in b/tdefile-plugins/pdf/configure.in.in new file mode 100644 index 00000000..ec2fff51 --- /dev/null +++ b/tdefile-plugins/pdf/configure.in.in @@ -0,0 +1,16 @@ +AC_ARG_WITH([poppler], + [AC_HELP_STRING([--with-poppler], + [Enable PDF support through poppler @<:@default=check@:>@])], + [], with_poppler=check) + +## Compile the pdf meta info plugin only if Poppler is available +#if test "x$with_poppler" != xno; then +# PKG_CHECK_MODULES(POPPLER, poppler-qt >= 0.3.1, have_poppler=yes, have_poppler=no) +# +# if test "x$with_poppler" != xcheck && test "x$have_poppler" != xyes; then +# AC_MSG_ERROR([--with-poppler was given, but test for poppler failed]) +# fi +#fi + +have_poppler=yes +AM_CONDITIONAL(include_PDF, test "x$have_poppler" = xyes) diff --git a/tdefile-plugins/pdf/tdefile_pdf.cpp b/tdefile-plugins/pdf/tdefile_pdf.cpp new file mode 100644 index 00000000..b3bacc02 --- /dev/null +++ b/tdefile-plugins/pdf/tdefile_pdf.cpp @@ -0,0 +1,104 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "tdefile_pdf.h" + +#include +#include + +typedef KGenericFactory PdfFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_pdf, PdfFactory("tdefile_pdf")) + +KPdfPlugin::KPdfPlugin(TQObject *parent, const char *name, const TQStringList &preferredItems) + : KFilePlugin(parent, name, preferredItems) +{ + kdDebug(7034) << "pdf plugin\n"; + + // set up our mime type + KFileMimeTypeInfo* info = addMimeTypeInfo( "application/pdf" ); + + // general group + KFileMimeTypeInfo::GroupInfo* group = addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Name); + item = addItemInfo(group, "Subject", i18n("Subject"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Description); + item = addItemInfo(group, "Author", i18n("Author"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Author); + addItemInfo(group, "Keywords", i18n("Key Words"), TQVariant::String); + addItemInfo(group, "Creator", i18n("Creator"), TQVariant::String); + addItemInfo(group, "Producer", i18n("Producer"), TQVariant::String); + addItemInfo(group, "CreationDate", i18n("Creation Date"), TQVariant::DateTime); + addItemInfo(group, "ModificationDate", i18n("Modified"), TQVariant::DateTime); + addItemInfo(group, "Pages", i18n("Pages"), TQVariant::Int); + addItemInfo(group, "Protected", i18n("Protected"), TQVariant::String); + addItemInfo(group, "Linearized", i18n("Linearized"), TQVariant::String); + addItemInfo(group, "Version", i18n("Version"), TQVariant::String); +} + +bool KPdfPlugin::readInfo( KFileMetaInfo& info, uint /* what */) +{ + Poppler::Document *doc = Poppler::Document::load(info.path()); + if (!doc || doc->isLocked()) + { + delete doc; + return false; + } + + KFileMetaInfoGroup generalGroup = appendGroup(info, "General"); + + appendItem(generalGroup, "Title", doc->getInfo("Title") ); + appendItem(generalGroup, "Subject", doc->getInfo("Subject") ); + appendItem(generalGroup, "Author", doc->getInfo("Author") ); + appendItem(generalGroup, "Keywords", doc->getInfo("Keywords") ); + appendItem(generalGroup, "Creator", doc->getInfo("Creator") ); + appendItem(generalGroup, "Producer", doc->getInfo("Producer") ); + + appendItem(generalGroup, "CreationDate", doc->getDate("CreationDate") ); + appendItem(generalGroup, "ModificationDate", doc->getDate("ModDate") ); + appendItem(generalGroup, "Pages", doc->getNumPages() ); + + TQString enc; + if (doc->isEncrypted()) + { + enc = i18n("Yes (Can Print:%1 Can Copy:%2 Can Change:%3 Can Add notes:%4)") + .arg(doc->okToPrint() ? i18n("Yes") : i18n("No")) + .arg(doc->okToCopy() ? i18n("Yes") : i18n("No")) + .arg(doc->okToChange() ? i18n("Yes") : i18n("No")) + .arg(doc->okToAddNotes() ? i18n("Yes") : i18n("No")); + } + else enc = i18n("No"); + + appendItem(generalGroup, "Protected", enc ); + appendItem(generalGroup, "Linearized", doc->isLinearized() ? i18n("Yes") : i18n("No") ); + TQString versionString = TQString("%1").arg( doc->getPDFVersion(), 0, 'f', 1 ); + appendItem(generalGroup, "Version", versionString ); + + delete doc; + + return true; +} + +#include "tdefile_pdf.moc" + diff --git a/tdefile-plugins/pdf/tdefile_pdf.desktop b/tdefile-plugins/pdf/tdefile_pdf.desktop new file mode 100644 index 00000000..41f4d21f --- /dev/null +++ b/tdefile-plugins/pdf/tdefile_pdf.desktop @@ -0,0 +1,64 @@ +[Desktop Entry] +Type=Service +Name=PDF Info +Name[af]=Pdf Inligting +Name[ar]=معلومات PDF +Name[br]=Titouroù PDF +Name[ca]=Informació de PDF +Name[cs]=PDF info +Name[cy]=Gybodaeth PDF +Name[da]=PDF-info +Name[de]=PDF-Info +Name[el]=Πληροφορίες PDF +Name[eo]=PDF-informo +Name[es]=Info PDF +Name[et]=PDF info +Name[fa]=اطلاعات PDF +Name[fi]=PDF-tiedot +Name[fr]=Informations PDF +Name[gl]=Inf. PDF +Name[he]=מידע PDF +Name[hi]=PDF जानकारी +Name[hr]=PDF Informacije +Name[hu]=PDF-jellemzők +Name[is]=PDF upplýsingar +Name[it]=Informazioni PDF +Name[ja]=PDF 情報 +Name[kk]=PDF мәліметі +Name[km]=ព័ត៌មាន PDF +Name[lt]=PDF informacija +Name[ms]=Maklumat PDF +Name[nds]=PDF-Info +Name[ne]=PDF सूचना +Name[nl]=PDF-info +Name[nn]=PDF-info +Name[nso]=Tshedimoso ya PDF +Name[pa]=PDF ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku PDF +Name[pt]=Informação do PDF +Name[pt_BR]=Informação sobre PDF +Name[ro]=Informaţii PDF +Name[ru]=Информация о PDF +Name[se]=PDF-dieđut +Name[sl]=Podatki o PDF +Name[sr]=PDF информације +Name[sr@Latn]=PDF informacije +Name[sv]=PDF-information +Name[ta]=PDF தகவல் +Name[tg]=Иттилоот оиди PDF +Name[th]=ข้อมูลแฟ้ม PDF +Name[tr]=PDF Bilgisi +Name[uk]=Інформація про PDF +Name[uz]=PDF haqida maʼlumot +Name[uz@cyrillic]=PDF ҳақида маълумот +Name[ven]=Mafhungo a PDF +Name[wa]=Informåcion sol documint PDF +Name[xh]=PDF Ulwazi +Name[zh_CN]=PDF 信息 +Name[zh_HK]=PDF 資訊 +Name[zh_TW]=PDF 資訊 +Name[zu]=Ulwazi lwe-PDF +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_pdf +MimeType=application/pdf +PreferredItems=Title,Subject,Author,Keywords,Creator,Producer,CreationDate,ModificationDate,Pages,Protected,Linearized,Version diff --git a/tdefile-plugins/pdf/tdefile_pdf.h b/tdefile-plugins/pdf/tdefile_pdf.h new file mode 100644 index 00000000..d23971c7 --- /dev/null +++ b/tdefile-plugins/pdf/tdefile_pdf.h @@ -0,0 +1,39 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef __KFILE_PDF_H__ +#define __KFILE_PDF_H__ + +#include +#include + +class TQStringList; + +class KPdfPlugin: public KFilePlugin +{ +Q_OBJECT + +public: + KPdfPlugin( TQObject *parent, const char *name, const TQStringList& preferredItems ); + + virtual bool readInfo(KFileMetaInfo& info, uint what); +}; + +#endif -- cgit v1.2.1