diff options
Diffstat (limited to 'kfile-plugins/dvi')
-rw-r--r-- | kfile-plugins/dvi/CMakeLists.txt | 35 | ||||
-rw-r--r-- | kfile-plugins/dvi/Makefile.am | 22 | ||||
-rw-r--r-- | kfile-plugins/dvi/kfile_dvi.cpp | 150 | ||||
-rw-r--r-- | kfile-plugins/dvi/kfile_dvi.desktop | 60 | ||||
-rw-r--r-- | kfile-plugins/dvi/kfile_dvi.h | 38 |
5 files changed, 0 insertions, 305 deletions
diff --git a/kfile-plugins/dvi/CMakeLists.txt b/kfile-plugins/dvi/CMakeLists.txt deleted file mode 100644 index 116d6032..00000000 --- a/kfile-plugins/dvi/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -################################################# -# -# (C) 2010-2011 Calvin Morrison -# -# 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} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -#### other data ################################# - -install( FILES kfile_dvi.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kfile_dvi (module) ######################### - -tde_add_kpart( kfile_dvi AUTOMOC - SOURCES kfile_dvi.cpp - LINK kio-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kfile-plugins/dvi/Makefile.am b/kfile-plugins/dvi/Makefile.am deleted file mode 100644 index 61791bdc..00000000 --- a/kfile-plugins/dvi/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for the dvi file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_dvi.h - -kde_module_LTLIBRARIES = kfile_dvi.la - -kfile_dvi_la_SOURCES = kfile_dvi.cpp -kfile_dvi_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -kfile_dvi_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kfile_dvi.pot - -services_DATA = kfile_dvi.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/dvi/kfile_dvi.cpp b/kfile-plugins/dvi/kfile_dvi.cpp deleted file mode 100644 index b449ad1e..00000000 --- a/kfile-plugins/dvi/kfile_dvi.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Matthias Witzgall <[email protected]> - * - * 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. - * - */ - - -/* further informations about the dvi file format could be downloaded from: http://www.rpi.edu/~sofkam/DVI/archive/standards/dvistd0.dvi */ - -#include "kfile_dvi.h" - -#include <kgenericfactory.h> -#include <kdebug.h> -#include <klocale.h> -#include <kfilemetainfo.h> - -#include <tqstring.h> -#include <tqvariant.h> -#include <tqdatetime.h> -#include <tqfile.h> -#include <tqfileinfo.h> -#include <tqregexp.h> - - -// preprocessormacro K_EXPORT_COMPONENT_FACTORY loads shared library 'kfile_dvi.so' dynamic if necessary -typedef KGenericFactory<KDviPlugin> DviFactory; -K_EXPORT_COMPONENT_FACTORY(kfile_dvi, DviFactory("kfile_dvi")) - -KDviPlugin::KDviPlugin (TQObject * parent, const char * name, const TQStringList & preferredItems) - : KFilePlugin(parent, name, preferredItems) -{ - kdDebug(7034) << "dvi plugin" << endl; - - // set up our mime type - KFileMimeTypeInfo * info = this->addMimeTypeInfo("application/x-dvi"); - - - KFileMimeTypeInfo::GroupInfo * group = this->addGroupInfo(info, "General", "General"); - - this->addItemInfo(group, "3_Created", i18n("Created"), TQVariant::String); - this->addItemInfo(group, "6_Comment", i18n("Comment"), TQVariant::String); - this->addItemInfo(group, "7_Pages", i18n("Pages"), TQVariant::UInt); -} - -bool KDviPlugin::readInfo (KFileMetaInfo & info, uint /* what (unused in this plugin) */) -{ - if ( info.path().isEmpty() ) - return false; - KFileMetaInfoGroup GeneralGroup = appendGroup(info, "General"); - TQFile f(info.path()); - TQFileInfo f_info; - TQ_UINT16 bytes_to_read; - TQ_UINT8 comment_length; - TQString comment; - TQ_UINT16 pages; - TQ_UINT8 buffer[270]; // buffer for reading data; no data is read with more than 270 bytes - TQ_UINT32 ptr; - int i; // running index - - // open file and try to get the comment - f.open(IO_ReadOnly); - - if ( f.isOpen() == false ){ - kdDebug(7034) << "cannot open file" << endl; - return false; - } - - f_info.setFile(f); // create fileinfoobject - bytes_to_read = TQMIN(f_info.size(), 270); // check, if the file size is smaller than 270 bytes - // (if the comment is as large as possible, we don't have to - // read more than 270 bytes) - - if ( f.readBlock((char *)buffer, bytes_to_read) != bytes_to_read ){ // cast to (char *) is necessary - kdDebug(7034) << "read error (1)" << endl; - return false; - } - - if ( (buffer[0] != 247) || (buffer[1] != 2) ){ - // magic numbers are not right - kdDebug(7034) << "wrong file format" << endl;; - return false; - } - - comment_length = buffer[14]; // set up length of comment - comment.setLength(comment_length); // used to avoid permanent reallocation when extracting the comment from buffer - - for ( i = 15; i <= 14+comment_length; ++i ) // extract comment from buffer - comment[i-15] = (char)buffer[i]; - - appendItem(GeneralGroup, "6_Comment", comment.simplifyWhiteSpace() ); - - // comment is ok, now get total number of pages - f.at( f.size() - 13); - if ( f.readBlock((char *)buffer, 13) != 13 ){ - kdDebug(7034) << "read error (2)" << endl; - return false; - } - - i = 12; // reset running index i - while ( buffer[i] == 223 ){ --i; } // skip all trailing bytes - - if ( (buffer[i] != 2) || (i > 8) || (i < 5) ){ - kdDebug(7034) << "wrong file formatx" << endl; - return false; - } - - // now we know the position of the pointer to the beginning of the postamble and we can read it - ptr = buffer[i-4]; - ptr = (ptr << 8) | buffer[i-3]; - ptr = (ptr << 8) | buffer[i-2]; - ptr = (ptr << 8) | buffer[i-1]; - - // bytes for total number of pages have a offset of 27 to the beginning of the postamble - f.at(ptr + 27); - - // now read total number of pages from file - if ( f.readBlock((char *)buffer, 2) != 2 ){ - kdDebug(7034) << "read error (3)" << endl; - return false; - } - pages = buffer[0]; - pages = (pages << 8) | buffer[1]; - - appendItem(GeneralGroup, "7_Pages", TQVariant(pages) ); - - f.close(); - - // now get and set up some basic informations about the file (same informations would be displayed, if there is no dvi-plugin) - appendItem(GeneralGroup, "1_Type", TQVariant( i18n("TeX Device Independent file") ) ); // set up type of file - - appendItem(GeneralGroup, "4_Modified", TQVariant(f_info.lastModified().toString("yyyy-MM-dd hh:mm")) ); - // ISO 8601 date format (without seconds) - - return true; -} - -#include "kfile_dvi.moc" diff --git a/kfile-plugins/dvi/kfile_dvi.desktop b/kfile-plugins/dvi/kfile_dvi.desktop deleted file mode 100644 index e272eab6..00000000 --- a/kfile-plugins/dvi/kfile_dvi.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Icon= -MimeType=application/x-dvi -Name=DVI Info -Name[ar]=معلومات DVI -Name[br]=Titouroù DVI -Name[ca]=Informació de DVI -Name[cs]=DVI info -Name[cy]=Gwybodaeth DVI -Name[da]=DVI-info -Name[de]=DVI-Info -Name[el]=Πληροφορίες DVI -Name[eo]=DVI-informo -Name[es]=Info DVI -Name[et]=DVI info -Name[fa]=اطلاعات DVI -Name[fi]=DVI-tiedot -Name[fr]=Informations DVI -Name[ga]=Eolas faoi DVI -Name[gl]=Inf. DVI -Name[he]=מידע DVI -Name[hi]=DVI जानकारी -Name[hu]=DVI-jellemzők -Name[is]=DVI upplýsingar -Name[it]=Informazioni DVI -Name[ja]=DVI 情報 -Name[kk]=DVI мәліметі -Name[km]=ព័ត៌មាន DVI -Name[lt]=DVI informacija -Name[ms]=Maklumat DVI -Name[nds]=DVI-Info -Name[ne]=DVI सूचना -Name[nl]=DVI-info -Name[nn]=DVI-info -Name[pa]=DVI ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku DVI -Name[pt]=Informação do DVI -Name[pt_BR]=Informação sobre DVI -Name[ro]=Informaţii DVI -Name[ru]=Информация о DVI -Name[se]=DVI-dieđut -Name[sl]=Podatki o DVI -Name[sr]=DVI информације -Name[sr@Latn]=DVI informacije -Name[sv]=DVI-information -Name[ta]=DVI தகவல் -Name[tg]=Иттилоот оиди DVI -Name[th]=ข้อมูลแฟ้ม DVI -Name[tr]=DVI Bilgisi -Name[uk]=Інформація по DVI -Name[uz]=DVI haqida maʼlumot -Name[uz@cyrillic]=DVI ҳақида маълумот -Name[wa]=Informåcion sol documint DVI -Name[zh_CN]=DVI 信息 -Name[zh_HK]=DVI 資訊 -Name[zh_TW]=DVI 資訊 -ServiceTypes=KFilePlugin -Type=Service -X-TDE-Library=kfile_dvi -PreferredItems=Title,Author,Subject,Creator,Producer,CreationDate,ModDate,Keywords diff --git a/kfile-plugins/dvi/kfile_dvi.h b/kfile-plugins/dvi/kfile_dvi.h deleted file mode 100644 index 48aadc9a..00000000 --- a/kfile-plugins/dvi/kfile_dvi.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Matthias Witzgall <[email protected]> - * - * 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. - * - */ - - -#ifndef __KFILE_DVI_H__ -#define __KFILE_DVI_H__ - -#include <kfilemetainfo.h> - -class TQStringList; - -class KDviPlugin : public KFilePlugin -{ - Q_OBJECT - -public: - KDviPlugin ( TQObject * parent, const char * name, const TQStringList & preferredItems ); - - virtual bool readInfo (KFileMetaInfo & info, uint what); -}; - -#endif |