From 50b48aec6ddd451a6d1709c0942477b503457663 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 3 Feb 2010 02:15:56 +0000 Subject: Added abandoned KDE3 version of K3B git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1084400 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kfile-plugins/Makefile.am | 1 + kfile-plugins/k3bproject/Makefile.am | 27 +++++ kfile-plugins/k3bproject/kfile_k3b.desktop | 53 ++++++++ .../k3bproject/kfile_k3bprojectfileplugin.cpp | 135 +++++++++++++++++++++ .../k3bproject/kfile_k3bprojectfileplugin.h | 37 ++++++ 5 files changed, 253 insertions(+) create mode 100644 kfile-plugins/Makefile.am create mode 100644 kfile-plugins/k3bproject/Makefile.am create mode 100644 kfile-plugins/k3bproject/kfile_k3b.desktop create mode 100644 kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp create mode 100644 kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h (limited to 'kfile-plugins') diff --git a/kfile-plugins/Makefile.am b/kfile-plugins/Makefile.am new file mode 100644 index 0000000..c1ba442 --- /dev/null +++ b/kfile-plugins/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = k3bproject \ No newline at end of file diff --git a/kfile-plugins/k3bproject/Makefile.am b/kfile-plugins/k3bproject/Makefile.am new file mode 100644 index 0000000..d229c41 --- /dev/null +++ b/kfile-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 = kfile_k3bprojectfileplugin.h + +kde_module_LTLIBRARIES = kfile_k3b.la + +kfile_k3b_la_SOURCES = kfile_k3bprojectfileplugin.cpp +kfile_k3b_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kfile_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 = kfile_k3b.desktop +servicesdir = $(kde_servicesdir) + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kfile_k3b.pot diff --git a/kfile-plugins/k3bproject/kfile_k3b.desktop b/kfile-plugins/k3bproject/kfile_k3b.desktop new file mode 100644 index 0000000..b0156d0 --- /dev/null +++ b/kfile-plugins/k3bproject/kfile_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-KDE-Library=kfile_k3b +MimeType=application/x-k3b +PreferredGroups=General +PreferredItems=documenttype diff --git a/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp new file mode 100644 index 0000000..b868c94 --- /dev/null +++ b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.cpp @@ -0,0 +1,135 @@ +/* + * + * $Id: sourceheader,v 1.3 2005/01/19 13:03:46 trueg Exp $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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 + +#include "kfile_k3bprojectfileplugin.h" +#include "kostore/koStore.h" +#include "kostore/koStoreDevice.h" + +#include + +#include + +#include +#include +#include + + + +K_EXPORT_COMPONENT_FACTORY(kfile_k3b, KGenericFactory("kfile_k3b")) + + +K3bProjectFilePlugin::K3bProjectFilePlugin( QObject *parent, const char *name, + const QStringList &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"), QVariant::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; + QDomDocument xmlDoc; + + // try opening a store + KoStore* store = KoStore::createStore( info.url().path(), KoStore::Read ); + if( store && !store->bad() && store->open( "maindata.xml" ) ) { + QIODevice* 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; + } + + QString 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 "kfile_k3bprojectfileplugin.moc" + diff --git a/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h new file mode 100644 index 0000000..c90b678 --- /dev/null +++ b/kfile-plugins/k3bproject/kfile_k3bprojectfileplugin.h @@ -0,0 +1,37 @@ +/* + * + * $Id: sourceheader,v 1.3 2005/01/19 13:03:46 trueg Exp $ + * Copyright (C) 2005 Sebastian Trueg + * + * This file is part of the K3b project. + * Copyright (C) 1998-2007 Sebastian Trueg + * + * 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 <$KDEDIR/include/kfilemetainfo.h> + */ +#include + +class QStringList; + +class K3bProjectFilePlugin: public KFilePlugin +{ + Q_OBJECT + + public: + K3bProjectFilePlugin( QObject *parent, const char *name, const QStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif + -- cgit v1.2.3