diff options
Diffstat (limited to 'tdefile-plugins')
-rw-r--r-- | tdefile-plugins/Makefile.am | 1 | ||||
-rw-r--r-- | tdefile-plugins/k3bproject/Makefile.am | 27 | ||||
-rw-r--r-- | tdefile-plugins/k3bproject/tdefile_k3b.desktop | 53 | ||||
-rw-r--r-- | tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.cpp | 135 | ||||
-rw-r--r-- | tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.h | 38 |
5 files changed, 254 insertions, 0 deletions
diff --git a/tdefile-plugins/Makefile.am b/tdefile-plugins/Makefile.am new file mode 100644 index 0000000..c1ba442 --- /dev/null +++ b/tdefile-plugins/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = k3bproject
\ No newline at end of file diff --git a/tdefile-plugins/k3bproject/Makefile.am b/tdefile-plugins/k3bproject/Makefile.am new file mode 100644 index 0000000..5d070e2 --- /dev/null +++ b/tdefile-plugins/k3bproject/Makefile.am @@ -0,0 +1,27 @@ +AM_CPPFLAGS = -I$(srcdir)/../../libk3b/core \ + -I$(srcdir)/../../libk3b/core \ + -I$(srcdir)/../../libk3b/plugin \ + -I$(srcdir)/../../libk3b/tools \ + -I$(srcdir)/../../libk3b/projects \ + -I$(srcdir)/../../libk3b/projects/datacd \ + -I$(srcdir)/../../libk3bdevice \ + -I$(srcdir)/../../src/projects \ + $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_k3bprojectfileplugin.h + +kde_module_LTLIBRARIES = tdefile_k3b.la + +tdefile_k3b_la_SOURCES = tdefile_k3bprojectfileplugin.cpp +tdefile_k3b_la_LDFLAGS = $(all_libraries) $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_KIO) -module $(KDE_PLUGIN) +tdefile_k3b_la_LIBADD = $(LIB_KIO) ../../libk3b/libk3b.la ../../src/projects/kostore/libkostore.la + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +services_DATA = tdefile_k3b.desktop +servicesdir = $(kde_servicesdir) + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdefile_k3b.pot diff --git a/tdefile-plugins/k3bproject/tdefile_k3b.desktop b/tdefile-plugins/k3bproject/tdefile_k3b.desktop new file mode 100644 index 0000000..b93ae66 --- /dev/null +++ b/tdefile-plugins/k3bproject/tdefile_k3b.desktop @@ -0,0 +1,53 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Name=K3b Project Info +Name[af]=K3b Projek Informasie +Name[ar]= معلومات عن مشروع K3B +Name[bg]=Информация за K3b проект +Name[bn]=কে-থ্রি-বি প্রকল্প তথ্য +Name[br]=Titouroù raktres K3b +Name[ca]=Informació sobre el projecte de K3b +Name[cs]=Info o K3b projektu +Name[da]=K3b Projektinformation +Name[de]=K3b Projektinformationen +Name[el]=Πληροφορίες έργου K3b +Name[eo]=K3b projekta informo +Name[es]=Información de proyecto K3b +Name[et]=K3b projekti info +Name[fa]= اطلاعات پروژۀ K3b +Name[fi]=K3b-projektin kuvaus +Name[fr]=Information sur le projet K3b +Name[ga]=Eolas faoin Tionscadal K3b +Name[gl]=Informazón de Proxecto K3b +Name[hu]=K3b-projektinformáció +Name[is]=K3b verkefnisupplýsingar +Name[it]=Informazioni progetto K3b +Name[ja]=K3b プロジェクト情報 +Name[km]=ព័ត៌មានរបស់គម្រោង K3b +Name[lt]=K3b projekto informacija +Name[mk]=Информации за проект од K3b +Name[nb]=K3b-prosjektinformasjon +Name[nds]=K3b-Projektinformatschonen +Name[nl]=K3b-projectinformatie +Name[nn]=K3b-prosjektinfo +Name[pa]=K3b ਪ੍ਰੋਜੈੱਕਟ ਜਾਣਕਾਰੀ +Name[pl]=Informacja dla projektu K3b +Name[pt]=Informação do Projecto do K3b +Name[pt_BR]=Informações do Projeto do K3b +Name[ru]=Свдения о проекте K3b +Name[sk]=K3b informácie o projekte +Name[sr]=Инфо о K3b пројекту +Name[sr@Latn]=Info o K3b projektu +Name[sv]=K3b-projektinformation +Name[tr]=K3b Proje Bilgisi +Name[uk]=Інформація проекту K3b +Name[uz]=K3b loyihasi haqida maʼlumot +Name[uz@cyrillic]=K3b лойиҳаси ҳақида маълумот +Name[zh_CN]=K3b 方案信息 +Name[zh_TW]=K3b 專案資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_k3b +MimeType=application/x-k3b +PreferredGroups=General +PreferredItems=documenttype diff --git a/tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.cpp b/tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.cpp new file mode 100644 index 0000000..e625465 --- /dev/null +++ b/tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.cpp @@ -0,0 +1,135 @@ +/* + * + * $Id: sourceheader,v 1.3 2005/01/19 13:03:46 trueg Exp $ + * Copyright (C) 2005 Sebastian Trueg <trueg@k3b.org> + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See the file "COPYING" for the exact licensing terms. + */ + + +#include <config.h> + +#include "tdefile_k3bprojectfileplugin.h" +#include "kostore/koStore.h" +#include "kostore/koStoreDevice.h" + +#include <k3bdoc.h> + +#include <kgenericfactory.h> + +#include <tqtextstream.h> +#include <tqdom.h> +#include <tqfile.h> + + + +K_EXPORT_COMPONENT_FACTORY(tdefile_k3b, KGenericFactory<K3bProjectFilePlugin>("tdefile_k3b")) + + +K3bProjectFilePlugin::K3bProjectFilePlugin( TQObject *parent, const char *name, + const TQStringList &args) + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-k3b" ); + + KFileMimeTypeInfo::GroupInfo* group = addGroupInfo( info, "General", i18n("General") ); + + addItemInfo( group, "documenttype", i18n("Document Type"), TQVariant::String ); +} + + +bool K3bProjectFilePlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + if( !info.url().isLocalFile() ) { + kdDebug() << "(K3bProjectFilePluginInfo) no local file." << endl; + return false; + } + + // open the file + bool success = false; + TQDomDocument xmlDoc; + + // try opening a store + KoStore* store = KoStore::createStore( info.url().path(), KoStore::Read ); + if( store && !store->bad() && store->open( "maindata.xml" ) ) { + TQIODevice* dev = store->device(); + dev->open( IO_ReadOnly ); + if( xmlDoc.setContent( dev ) ) + success = true; + dev->close(); + store->close(); + } + else + kdDebug() << "(K3bProjectFilePluginInfo) failed to open the store." << endl; + + if( success ) { + // check the documents DOCTYPE + K3bDoc::DocType type = K3bDoc::AUDIO; + if( xmlDoc.doctype().name() == "k3b_audio_project" ) + type = K3bDoc::AUDIO; + else if( xmlDoc.doctype().name() == "k3b_data_project" ) + type = K3bDoc::DATA; + else if( xmlDoc.doctype().name() == "k3b_vcd_project" ) + type = K3bDoc::VCD; + else if( xmlDoc.doctype().name() == "k3b_mixed_project" ) + type = K3bDoc::MIXED; + else if( xmlDoc.doctype().name() == "k3b_movix_project" ) + type = K3bDoc::MOVIX; + else if( xmlDoc.doctype().name() == "k3b_movixdvd_project" ) + type = K3bDoc::MOVIX_DVD; + else if( xmlDoc.doctype().name() == "k3b_dvd_project" ) + type = K3bDoc::DVD; + else if( xmlDoc.doctype().name() == "k3b_video_dvd_project" ) + type = K3bDoc::VIDEODVD; + else { + kdDebug() << "(K3bDoc) unknown doc type: " << xmlDoc.doctype().name() << endl; + success = false; + } + + TQString stringType; + switch( type ) { + case K3bDoc::AUDIO: + stringType = i18n("Audio CD"); + break; + case K3bDoc::DATA: + stringType = i18n("Data CD"); + break; + case K3bDoc::MIXED: + stringType = i18n("Mixed Mode CD"); + break; + case K3bDoc::VCD: + stringType = i18n("Video CD"); + break; + case K3bDoc::MOVIX: + stringType = i18n("eMovix CD"); + break; + case K3bDoc::MOVIX_DVD: + stringType = i18n("eMovix DVD"); + break; + case K3bDoc::DVD: + stringType = i18n("Data DVD"); + break; + case K3bDoc::VIDEODVD: + stringType = i18n("Video DVD"); + break; + } + + // and finally display it! + KFileMetaInfoGroup group = appendGroup(info, "General"); + appendItem( group, "documenttype", stringType ); + } + + delete store; + + return success; +} + +#include "tdefile_k3bprojectfileplugin.moc" + diff --git a/tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.h b/tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.h new file mode 100644 index 0000000..dadb856 --- /dev/null +++ b/tdefile-plugins/k3bproject/tdefile_k3bprojectfileplugin.h @@ -0,0 +1,38 @@ +/* + * + * $Id: sourceheader,v 1.3 2005/01/19 13:03:46 trueg Exp $ + * Copyright (C) 2005 Sebastian Trueg <trueg@k3b.org> + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See the file "COPYING" for the exact licensing terms. + */ + +#ifndef __KFILE_K3BPROJECTFILEPLUGIN_H__ +#define __KFILE_K3BPROJECTFILEPLUGIN_H__ + +/** + * Note: For further information look into <$TDEDIR/include/tdefilemetainfo.h> + */ +#include <tdefilemetainfo.h> + +class TQStringList; + +class K3bProjectFilePlugin: public KFilePlugin +{ + Q_OBJECT + + + public: + K3bProjectFilePlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif + |