From 57e10fedbcb8c3e8c6590ff0935dbf017ce5587f Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 19 Jan 2010 18:22:05 +0000 Subject: Import abandoned KDE3 version of kipi plugins git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/libraries/kipi-plugins@1077221 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kipi-plugins/cdarchiving/Makefile.am | 30 + kipi-plugins/cdarchiving/actions.h | 66 + kipi-plugins/cdarchiving/autorun/Makefile.am | 6 + kipi-plugins/cdarchiving/autorun/ShellExecute.bat | 1 + kipi-plugins/cdarchiving/autorun/cdalbums.ico | Bin 0 -> 7358 bytes kipi-plugins/cdarchiving/autorun/index.htm | 5 + kipi-plugins/cdarchiving/cdarchiving.cpp | 1942 ++++++++++++++++++++ kipi-plugins/cdarchiving/cdarchiving.h | 220 +++ kipi-plugins/cdarchiving/cdarchivingdialog.cpp | 902 +++++++++ kipi-plugins/cdarchiving/cdarchivingdialog.h | 249 +++ kipi-plugins/cdarchiving/gohome.png | Bin 0 -> 5212 bytes kipi-plugins/cdarchiving/image_broken.png | Bin 0 -> 5456 bytes .../cdarchiving/kipiplugin_cdarchiving.desktop | 57 + kipi-plugins/cdarchiving/plugin_cdarchiving.cpp | 350 ++++ kipi-plugins/cdarchiving/plugin_cdarchiving.h | 72 + kipi-plugins/cdarchiving/up.png | Bin 0 -> 5462 bytes kipi-plugins/cdarchiving/valid-html401.png | Bin 0 -> 2948 bytes 17 files changed, 3900 insertions(+) create mode 100644 kipi-plugins/cdarchiving/Makefile.am create mode 100644 kipi-plugins/cdarchiving/actions.h create mode 100644 kipi-plugins/cdarchiving/autorun/Makefile.am create mode 100644 kipi-plugins/cdarchiving/autorun/ShellExecute.bat create mode 100644 kipi-plugins/cdarchiving/autorun/cdalbums.ico create mode 100644 kipi-plugins/cdarchiving/autorun/index.htm create mode 100644 kipi-plugins/cdarchiving/cdarchiving.cpp create mode 100644 kipi-plugins/cdarchiving/cdarchiving.h create mode 100644 kipi-plugins/cdarchiving/cdarchivingdialog.cpp create mode 100644 kipi-plugins/cdarchiving/cdarchivingdialog.h create mode 100644 kipi-plugins/cdarchiving/gohome.png create mode 100644 kipi-plugins/cdarchiving/image_broken.png create mode 100644 kipi-plugins/cdarchiving/kipiplugin_cdarchiving.desktop create mode 100644 kipi-plugins/cdarchiving/plugin_cdarchiving.cpp create mode 100644 kipi-plugins/cdarchiving/plugin_cdarchiving.h create mode 100644 kipi-plugins/cdarchiving/up.png create mode 100644 kipi-plugins/cdarchiving/valid-html401.png (limited to 'kipi-plugins/cdarchiving') diff --git a/kipi-plugins/cdarchiving/Makefile.am b/kipi-plugins/cdarchiving/Makefile.am new file mode 100644 index 0000000..936a2cc --- /dev/null +++ b/kipi-plugins/cdarchiving/Makefile.am @@ -0,0 +1,30 @@ +INCLUDES = $(KIPI_PLUGINS_COMMON_INCLUDE) $(LIBKIPI_CFLAGS) $(all_includes) + +METASOURCES = AUTO +SUBDIRS = autorun + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kipiplugin_cdarchiving.la +kipiplugin_cdarchiving_la_DEPENDENCIES = $(LIBKIPI_LIBS_DEP) + +# Srcs for the plugin +kipiplugin_cdarchiving_la_SOURCES = plugin_cdarchiving.cpp cdarchivingdialog.cpp cdarchiving.cpp + +# Libs needed by the plugin +kipiplugin_cdarchiving_la_LIBADD = $(LIBKIPI_LIBS) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) + +# LD flags for the plugin +kipiplugin_cdarchiving_la_LDFLAGS = $(KIPI_PLUGINS_COMMON_LDFLAGS) -module $(KDE_PLUGIN) $(all_libraries) -lkipiplugins + +# Install the desktop file needed to detect the plugin +kde_services_DATA = kipiplugin_cdarchiving.desktop + +# i18n translation messages +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kipiplugin_cdarchiving.pot + +kipiimagebrokenpicdir = $(kde_datadir)/kipi/data +kipiimagebrokenpic_DATA = image_broken.png + +kipiHTML401picdir = $(kde_datadir)/kipi +kipiHTML401pic_DATA = valid-html401.png gohome.png up.png diff --git a/kipi-plugins/cdarchiving/actions.h b/kipi-plugins/cdarchiving/actions.h new file mode 100644 index 0000000..bf00289 --- /dev/null +++ b/kipi-plugins/cdarchiving/actions.h @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////////////////// +// +// ACTIONS.H +// +// Copyright (C) 2004 Gilles Caulier +// +// 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, Cambridge, MA 02110-1301, USA. +// +////////////////////////////////////////////////////////////////////////////// + + +#ifndef ACTIONS_H +#define ACTIONS_H + +namespace KIPICDArchivingPlugin +{ + +enum Action +{ + Initialize = 0, + Progress, + Error, + ResizeImages, + BuildHTMLiface, + BuildAlbumHTMLPage, + BuildAutoRuniface, + BuildK3bProject +}; + + +class EventData +{ +public: + EventData() + { + starting = false; + success = false; + } + + Action action; + + QString albumName; + QString fileName; + QString message; + + bool starting; + bool success; + + int total; +}; + +} // NameSpace KIPICDArchivingPlugin + +#endif // ACTIONS_H diff --git a/kipi-plugins/cdarchiving/autorun/Makefile.am b/kipi-plugins/cdarchiving/autorun/Makefile.am new file mode 100644 index 0000000..d28f136 --- /dev/null +++ b/kipi-plugins/cdarchiving/autorun/Makefile.am @@ -0,0 +1,6 @@ +kipidatadir = $(kde_datadir)/kipi/data +kipidata_DATA = index.htm + +kipiautorundir = $(kde_datadir)/kipi/data/autorun +kipiautorun_DATA = cdalbums.ico ShellExecute.bat + diff --git a/kipi-plugins/cdarchiving/autorun/ShellExecute.bat b/kipi-plugins/cdarchiving/autorun/ShellExecute.bat new file mode 100644 index 0000000..5105c02 --- /dev/null +++ b/kipi-plugins/cdarchiving/autorun/ShellExecute.bat @@ -0,0 +1 @@ +start %1 diff --git a/kipi-plugins/cdarchiving/autorun/cdalbums.ico b/kipi-plugins/cdarchiving/autorun/cdalbums.ico new file mode 100644 index 0000000..b6edecf Binary files /dev/null and b/kipi-plugins/cdarchiving/autorun/cdalbums.ico differ diff --git a/kipi-plugins/cdarchiving/autorun/index.htm b/kipi-plugins/cdarchiving/autorun/index.htm new file mode 100644 index 0000000..2225ac4 --- /dev/null +++ b/kipi-plugins/cdarchiving/autorun/index.htm @@ -0,0 +1,5 @@ + + + + + diff --git a/kipi-plugins/cdarchiving/cdarchiving.cpp b/kipi-plugins/cdarchiving/cdarchiving.cpp new file mode 100644 index 0000000..1d93aad --- /dev/null +++ b/kipi-plugins/cdarchiving/cdarchiving.cpp @@ -0,0 +1,1942 @@ +////////////////////////////////////////////////////////////////////////////// +// +// CDARCHIVING.CPP +// +// Copyright (C) 2003-2004 Gilles Caulier +// Copyright (C) 2003-2004 by Gregory Kokanosky +// for images navigation mode. +// +// 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, Cambridge, MA 02110-1301, USA. +// +////////////////////////////////////////////////////////////////////////////// + +// C Ansi includes + +extern "C" +{ +#include +} + +// Include files for Qt + +#include +#include +#include +#include +#include +#include +#include +#include + +// Include files for KDE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Local includes + +#include "actions.h" +#include "cdarchiving.h" +#include "cdarchivingdialog.h" +#include "plugin_cdarchiving.h" + +namespace KIPICDArchivingPlugin +{ + +CDArchiving::CDArchiving( KIPI::Interface* interface, QObject *parent, KAction *action_cdarchiving ) + : QObject(parent) +{ + KImageIO::registerFormats(); + const KAboutData *data = KApplication::kApplication()->aboutData(); + m_hostName = QString::QString( data->appName() ); + + m_hostURL = data->homepage(); + + if (m_hostURL.isEmpty()) + { + m_hostName = "Kipi"; + m_hostURL = "http://extragear.kde.org/apps/kipi"; + } + + m_actionCDArchiving = action_cdarchiving; + m_interface = interface; + m_parent = parent; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +CDArchiving::~CDArchiving() +{ + delete m_configDlg; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::writeSettings(void) +{ + KConfig config("kipirc"); + config.setGroup("CDArchiving Settings"); + + // Albums selection dialogbox setup tab + + config.writeEntry("MediaFormat", m_configDlg->getMediaFormat()); + + // HTML interface Look dialogbox setup tab + + config.writeEntry("UseHTMLInterface", m_configDlg->getUseHTMLInterface()); + config.writeEntry("UseAutoRun", m_configDlg->getUseAutoRunWin32()); + config.writeEntry("MainPageTitle", m_configDlg->getMainTitle()); + config.writeEntry("ImagesPerRow", m_configDlg->getImagesPerRow()); + config.writeEntry("FontName", m_configDlg->getFontName()); + config.writeEntry("FontSize", m_configDlg->getFontSize()); + config.writeEntry("FontColor", m_configDlg->getForegroundColor()); + config.writeEntry("BackgroundColor", m_configDlg->getBackgroundColor()); + config.writeEntry("ThumbnailsSize", m_configDlg->getThumbnailsSize()); + config.writeEntry("ThumbnailsFormat", m_configDlg->getImageFormat()); + config.writeEntry("BordersImagesSize", m_configDlg->getBordersImagesSize()); + config.writeEntry("BordersImagesColor", m_configDlg->getBordersImagesColor()); + + // CD Informations setup tab + + config.writeEntry("VolumeID", m_configDlg->getVolumeID()); + config.writeEntry("VolumeSetID", m_configDlg->getVolumeSetID()); + config.writeEntry("SystemID", m_configDlg->getSystemID()); + config.writeEntry("ApplicationID", m_configDlg->getApplicationID()); + config.writeEntry("Publisher", m_configDlg->getPublisher()); + config.writeEntry("Preparer", m_configDlg->getPreparer()); + + // Misc dialogbox setup tab + + config.writeEntry("K3bBinPath", m_configDlg->getK3bBinPathName()); + config.writeEntry("K3bParameters", m_configDlg->getK3bParameters()); + config.writeEntry("UseOnTheFly", m_configDlg->getUseOnTheFly()); + config.writeEntry("UseCheckCD", m_configDlg->getUseCheckCD()); + config.writeEntry("UseStartWrintingProcess", m_configDlg->getUseStartBurningProcess()); + + config.sync(); +} + + +///////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::readSettings(void) +{ + KConfig config("kipirc"); + config.setGroup("CDArchiving Settings"); + + // Albums selection dialogbox setup tab + + m_configDlg->setMediaFormat( config.readEntry("MediaFormat", i18n("CD (650Mb)")) ); + + // HTML interface Look dialogbox setup tab + + m_configDlg->setUseHTMLInterface( config.readBoolEntry("UseHTMLInterface", "true") ); + m_configDlg->setUseAutoRunWin32( config.readBoolEntry("UseAutoRun", "true") ); + m_configDlg->setMainTitle( config.readEntry("MainPageTitle", i18n("KIPI Albums Archiving")) ); + m_configDlg->setImagesPerRow( config.readEntry("ImagesPerRow", "4").toInt() ); + m_configDlg->setFontName( config.readEntry("FontName", "Helvetica") ); + m_configDlg->setFontSize( config.readEntry("FontSize", "14").toInt() ); + QColor ColorFont( 208, 255, 208 ); + m_configDlg->setForegroundColor( config.readColorEntry("FontColor", &ColorFont)); + QColor ColorBackground( 51, 51, 51 ); + m_configDlg->setBackgroundColor( config.readColorEntry("BackgroundColor", &ColorBackground)); + m_configDlg->setThumbnailsSize( config.readEntry("ThumbnailsSize", "140").toInt() ); + m_configDlg->setImageFormat( config.readEntry("ThumbnailsFormat", "JPEG") ); + m_configDlg->setBordersImagesSize( config.readEntry("BordersImagesSize", "1").toInt() ); + QColor ColorBordersImages( 208, 255, 208 ); + m_configDlg->setBordersImagesColor( config.readColorEntry("BordersImagesColor", &ColorBordersImages)); + + // CD Informations setup tab + + m_configDlg->setVolumeID( config.readEntry("VolumeID", i18n("CD Albums")) ); + m_configDlg->setVolumeSetID( config.readEntry("VolumeSetIDeTitle", i18n("KIPI Album CD archiving")) ); + m_configDlg->setSystemID( config.readEntry("SystemID", i18n("LINUX")) ); + m_configDlg->setApplicationID( config.readEntry("ApplicationID", i18n("K3b CD-DVD Burning application")) ); + m_configDlg->setPublisher( config.readEntry("Publisher", m_hostName + " [" + m_hostURL + "]") ); + m_configDlg->setPreparer( config.readEntry("Preparer", i18n("KIPI CD-Archiving plugin")) ); + + // Misc dialogbox setup tab + + m_configDlg->setK3bBinPathName( config.readEntry("K3bBinPath", "k3b") ); + m_configDlg->setK3bParameters( config.readEntry("K3bParameters", "--nofork") ); + m_configDlg->setUseUseOnTheFly( config.readBoolEntry("UseOnTheFly", "true") ); + m_configDlg->setUseCheckCD( config.readBoolEntry("UseCheckCD", "true") ); + m_configDlg->setUseStartBurningProcess( config.readBoolEntry("UseStartWrintingProcess", "false") ); + + // Get the image files filters from the hosts app. + + m_imagesFileFilter = m_interface->fileExtensions(); +} + + +///////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::showDialog() +{ + KStandardDirs dir; + m_tmpFolder = dir.saveLocation("tmp", "kipi-cdarchivingplugin-" + QString::number(getpid()) + "/"); + + m_HTMLInterfaceFolder = ""; + m_HTMLInterfaceIndex = ""; + m_HTMLInterfaceAutoRunInf = ""; + m_HTMLInterfaceAutoRunFolder = ""; + + m_configDlg = new CDArchivingDialog( m_interface, kapp->activeWindow() ); + readSettings(); + + if ( m_configDlg->exec() == QDialog::Accepted ) + { + writeSettings(); + return true; + } + + return false; +} + +///////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::prepare(void) +{ + QValueList albumsList; + KIPICDArchivingPlugin::EventData *d; + + m_cancelled = false; + m_StreamMainPageAlbumPreview = ""; + + // Get config from setup dialog. + albumsList = m_configDlg->getSelectedAlbums(); + m_useHTMLInterface = m_configDlg->getUseHTMLInterface(); + m_useAutoRunWin32 = m_configDlg->getUseAutoRunWin32(); + m_K3bBinPathName = m_configDlg->getK3bBinPathName(); + m_K3bParameters = m_configDlg->getK3bParameters(); + m_useStartBurningProcess = m_configDlg->getUseStartBurningProcess(); + m_imagesPerRow = m_configDlg->getImagesPerRow(); + m_imageFormat = m_configDlg->getImageFormat(); + m_mainTitle = m_configDlg->getMainTitle(); + m_backgroundColor = m_configDlg->getBackgroundColor(); + m_foregroundColor = m_configDlg->getForegroundColor(); + m_bordersImagesColor = m_configDlg->getBordersImagesColor(); + m_fontName = m_configDlg->getFontName(); + m_fontSize = m_configDlg->getFontSize(); + m_bordersImagesSize = m_configDlg->getBordersImagesSize(); + m_thumbnailsSize = m_configDlg->getThumbnailsSize(); + m_mediaFormat = m_configDlg->getMediaFormat(); + m_useOnTheFly = m_configDlg->getUseOnTheFly(); + m_useCheckCD = m_configDlg->getUseCheckCD(); + m_volumeID = m_configDlg->getVolumeID(); + m_volumeSetID = m_configDlg->getVolumeSetID(); + m_systemID = m_configDlg->getSystemID(); + m_applicationID = m_configDlg->getApplicationID(); + m_publisher = m_configDlg->getPublisher(); + m_preparer = m_configDlg->getPreparer(); + m_albumListSize = albumsList.count(); + m_albumsList = albumsList; + + // Estimate the number of actions for the KIPI progress dialog. + + int nbActions = 1; + int num_images = 0; + + if ( m_useHTMLInterface == true ) + { + QValueList::Iterator it; + for (it = albumsList.begin(); it != albumsList.end(); ++it) + { + KIPI::ImageCollection col = (KIPI::ImageCollection)(*it); + num_images += col.images().count(); + } + nbActions = nbActions + m_albumListSize + num_images + 1; + + if ( m_useAutoRunWin32 == true ) + ++nbActions; + } + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Initialize; + d->starting = true; + d->success = false; + d->total = nbActions; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + return(true); +} + + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::stop() +{ + m_cancelled = true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::run() +{ + KIPICDArchivingPlugin::EventData *d; + + // Making HTML interface. + + if ( m_useHTMLInterface == true ) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildHTMLiface; + d->starting = true; + d->success = false; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + if ( buildHTMLInterface() == true ) + { + m_HTMLInterfaceFolder = m_tmpFolder + "/HTMLInterface"; + QString dir; + KGlobal::dirs()->addResourceType("kipi_autorun", + KGlobal::dirs()->kde_default("data") + "kipi/data"); + dir = KGlobal::dirs()->findResourceDir("kipi_autorun", "index.htm"); + m_HTMLInterfaceIndex = dir + "index.htm"; + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildHTMLiface; + d->success = true; + d->starting = false; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + // Making AutoRun options. + + if ( m_useAutoRunWin32 == true ) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildAutoRuniface; + d->starting = true; + d->success = false; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + CreateAutoRunInfFile(); + m_HTMLInterfaceAutoRunInf = m_tmpFolder + "/autorun.inf"; + m_HTMLInterfaceAutoRunFolder = dir + "/autorun"; + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildAutoRuniface; + d->starting = false; + d->success = true; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + } + } + } + + // Making K3b project file. + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildK3bProject; + d->starting = true; + d->success = false; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + if ( BuildK3bXMLprojectfile(m_HTMLInterfaceFolder, m_HTMLInterfaceIndex, + m_HTMLInterfaceAutoRunInf, m_HTMLInterfaceAutoRunFolder) == false ) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildK3bProject; + d->starting = false; + d->success = false; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return; + } + else + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildK3bProject; + d->starting = false; + d->success = true; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + } +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::invokeK3b() +{ + if (m_cancelled) return; + + m_Proc = new KProcess(); + + *m_Proc << m_K3bBinPathName << m_K3bParameters; + *m_Proc << m_tmpFolder + "/KIPICDArchiving.xml"; + + QString K3bCommandLine = m_K3bBinPathName + " " + + m_K3bParameters + " " + + m_tmpFolder + "/KIPICDArchiving.xml"; + kdDebug(51000) << "K3b is started : " << K3bCommandLine.ascii() << endl; + + connect(m_Proc, SIGNAL(processExited(KProcess *)), + this, SLOT(slotK3bDone(KProcess*))); + + if ( !m_Proc->start(KProcess::NotifyOnExit, KProcess::All ) ) + { + KIPICDArchivingPlugin::EventData *d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Cannot start K3b program : fork failed."); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return; + } + + m_actionCDArchiving->setEnabled(false); + + if ( m_useStartBurningProcess == true ) + { + QTimer::singleShot(10000, + this, SLOT(slotK3bStartBurningProcess())); + m_k3bPid = m_Proc->pid(); + } +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::slotK3bStartBurningProcess(void) +{ + QString temp, cmd; + temp.setNum(m_k3bPid); + cmd = "dcop k3b-" + temp + " K3bProject-0 burn"; + + KRun::runCommand(cmd); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::slotK3bDone(KProcess*) +{ + kdDebug(51000) << "K3b is done !!! Removing temporary folder..." << endl; + + KIPICDArchivingPlugin::EventData *d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Progress; + d->starting = true; + d->success = true; + d->message = i18n("K3b is done; removing temporary folder...."); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + if (DeleteDir(m_tmpFolder) == false) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Cannot remove temporary folder '%1'.").arg(m_tmpFolder); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + } + + m_actionCDArchiving->setEnabled(true); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::buildHTMLInterface (void) +{ + QString Path; + KIPICDArchivingPlugin::EventData *d; + KURL MainUrl; + + // Create the main target folder. + + QDir TargetDir; + QString MainTPath= m_tmpFolder + "/HTMLInterface"; + + if (TargetDir.exists (MainTPath) == true) + { + if (DeleteDir (MainTPath) == false) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Cannot remove folder '%1'.").arg(MainTPath); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } + } + + if (TargetDir.mkdir( MainTPath ) == false) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Could not create folder '%1'.").arg(MainTPath); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } + + // Build all Albums interface HTML. + + // Adding go home icon if there is more than + KGlobal::dirs()->addResourceType("kipi_data", KGlobal::dirs()->kde_default("data") + "kipi"); + QString dir = KGlobal::dirs()->findResourceDir("kipi_data", "gohome.png"); + dir = dir + "gohome.png"; + KURL srcURL(dir); + KURL destURL( MainTPath + "/gohome.png"); + KIO::file_copy(srcURL, destURL, -1, true, false, false); + + // Adding up icon + KGlobal::dirs()->addResourceType("kipi_data", KGlobal::dirs()->kde_default("data") + "kipi"); + dir = KGlobal::dirs()->findResourceDir("kipi_data", "up.png"); + dir = dir + "up.png"; + srcURL = dir; + destURL = MainTPath + QString::fromLatin1("/up.png"); + KIO::file_copy(srcURL, destURL, -1, true, false, false); + + //clear the temporary list for unique names + m_collection_name_list.clear(); + for (QValueList::iterator it = m_albumsList.begin(); + it != m_albumsList.end(); ++it) + { + KIPI::ImageCollection album = *it; + kdDebug( 51000 ) << "HTML Interface for Album: " << album.name() << endl; + + m_AlbumTitle = makeFileNameUnique(m_collection_name_list, webifyFileName(album.name())); //webifyFileName(album.name()); + m_AlbumComments = m_interface->hasFeature(KIPI::AlbumsHaveComments) ? + album.comment() : QString(); + m_AlbumCollection = m_interface->hasFeature(KIPI::AlbumsHaveCategory) ? + album.category() : QString(); + m_AlbumDate = m_interface->hasFeature(KIPI::AlbumsHaveCreationDate) ? + album.date().toString() : QString(); + + // Create the target sub folder for the current album. + QString SubTPath = m_tmpFolder + "/HTMLInterface/" + m_AlbumTitle; + KURL SubURL = SubTPath + "/index.htm"; + if (TargetDir.mkdir( SubTPath ) == false) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Could not create folder '%1'.").arg(SubTPath); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildAlbumHTMLPage; + d->starting = true; + d->success = false; + d->albumName = m_AlbumTitle; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + if ( createHtml( album, SubURL, m_imageFormat ) == false) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildAlbumHTMLPage; + d->starting = false; + d->success = false; + d->albumName = m_AlbumTitle; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + if (DeleteDir (MainTPath) == false) + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Cannot remove folder '%1'.").arg(MainTPath); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } + + return false; + } + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::BuildAlbumHTMLPage; + d->starting = false; + d->success = true; + d->albumName = m_AlbumTitle; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + } + + // Create the main interface HTML page. + + MainUrl = m_tmpFolder + "/HTMLInterface/" + "index.htm"; + QFile MainPageFile( MainUrl.path() ); + + if ( MainPageFile.open(IO_WriteOnly) ) + { + QTextStream stream(&MainPageFile); + stream.setEncoding(QTextStream::UnicodeUTF8); + createHead(stream); + createBodyMainPage(stream, MainUrl); + MainPageFile.close(); + } + else + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Could not open file '%1'.").arg(MainUrl.path(+1)); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } + + return true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::createDirectory(QDir thumb_dir, QString imgGalleryDir, QString dirName) +{ + + if (!thumb_dir.exists()) + { + thumb_dir.setPath( imgGalleryDir ); + + if (!(thumb_dir.mkdir(dirName, false))) + { + KIPICDArchivingPlugin::EventData *d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Could not create folder '%1' in '%2'.") + .arg(dirName).arg(imgGalleryDir); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } + else + { + thumb_dir.setPath( imgGalleryDir + "/" + dirName + "/" ); + return true; + } + } + else + return true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::createHead(QTextStream& stream) +{ + QString chsetName = QTextCodec::codecForLocale()->mimeName(); + + stream << "" + << endl; + stream << "" << endl; + stream << "" << endl; + stream << "" << endl; + stream << "" << endl; + stream << "formatDate(QDate::currentDate()) + + "\">" << endl; + stream << "" << m_mainTitle << "" << endl; + createCSSSection(stream); + stream << "" << endl; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::createCSSSection(QTextStream& stream) +{ + QString backgroundColor = m_backgroundColor.name(); + QString foregroundColor = m_foregroundColor.name(); + QString bordersImagesColor = m_bordersImagesColor.name(); + + // Adding a touch of style + + stream << "" << endl; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +QString CDArchiving::extension(const QString& imageFormat) +{ + if (imageFormat == "PNG") + return ".png"; + + if (imageFormat == "JPEG") + return ".jpg"; + + Q_ASSERT(false); + return ""; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::createBody(QTextStream& stream, + const KIPI::ImageCollection& album, + const KURL& targetURL, + const QString& imageFormat) +{ + KURL::List images = album.images(); + int numOfImages = images.count(); + + const QString imgGalleryDir = targetURL.directory(); + const QString today(KGlobal::locale()->formatDate(QDate::currentDate())); + + stream << "\n" << endl; + + stream << "

\""

" << endl; + + + // Page Top ------------------------------------------------------------------------- + + stream << "

" << i18n("Album ") << """ << m_AlbumTitle << """ + << "

" << endl; + + stream << "\n" << endl; + + stream << "" << endl; + stream << "
\n" << endl; + + if (m_interface->hasFeature(KIPI::AlbumsHaveComments)) + stream << i18n("Caption:") << "
\n" << endl; + + if (m_interface->hasFeature(KIPI::AlbumsHaveCategory)) + stream << i18n("Collection:") << "
\n" << endl; + + if (m_interface->hasFeature(KIPI::AlbumsHaveCreationDate)) + stream << i18n("Date:") << "
\n" << endl; + + stream << i18n("Images:") << "\n" << endl; + + stream << "
\n" << endl; + + if (m_interface->hasFeature(KIPI::AlbumsHaveComments)) + stream << EscapeSgmlText(QTextCodec::codecForLocale(), + m_AlbumComments, true, true) + << "
\n" << endl; + + if (m_interface->hasFeature(KIPI::AlbumsHaveCategory)) + stream << m_AlbumCollection << "
\n" << endl; + + if (m_interface->hasFeature(KIPI::AlbumsHaveCreationDate)) + stream << m_AlbumDate << "
\n" << endl; + + stream << numOfImages << "\n" << endl; + + stream << "
\n" << endl; + + // Page Center ----------------------------------------------------------------------- + stream << "" << endl; + + // Table with images + int imgIndex = 0; + EventData* d = 0; + + // preliminary unique name generation + QStringList fileNameList; + for ( KURL::List::iterator urlIt = images.begin() ; + !m_cancelled && (urlIt != images.end()); + ++urlIt) + { + QFileInfo imInfo( (*urlIt).fileName()); + QString imgName = makeFileNameUnique(fileNameList, webifyFileName(imInfo.baseName(TRUE))); + } + for ( KURL::List::iterator urlIt = images.begin() ; + !m_cancelled && (urlIt != images.end()); + ++urlIt, ++imgIndex) + { + // Row Start + if ((imgIndex % m_imagesPerRow) == 0) + { + stream << "" << endl; + } + + QString imgName = fileNameList[imgIndex]; + QString imgPath = (*urlIt).path(); + QFileInfo imgInfo(imgPath); + QImage imgProp = QImage(imgPath); + + stream << "" << endl; + + // Row End + if ( ((imgIndex+1) % m_imagesPerRow) == 0 || + ((imgIndex+1) == (int)(images.count())) ) + { + stream << "" << endl; + } + } + + // Close the HTML and page creation info if necessary. + + stream << "
\n"; + kdDebug(51000) << "Creating thumbnail for " << imgName << endl; + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::ResizeImages; + d->starting = true; + d->success = false; + d->fileName = imgName; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + int valRet = createThumb((*urlIt).fileName(), (*urlIt).directory(), imgName, + imgGalleryDir, imageFormat); + + if ( valRet != -1 ) + { + QString thumbPath("thumbs/" + webifyFileName(imgName) + + extension(imageFormat)); + stream << "\""info(*urlIt).description(); + + if ( !imgPageComment.isEmpty() ) + { + stream << sep + << EscapeSgmlText(QTextCodec::codecForLocale(), + imgPageComment, true, true); + } + + stream << "\">" << endl; + + QString prevImgName = ""; + QString nextImgName = ""; + + if (imgIndex != 0) + prevImgName = images[imgIndex].fileName(); + + if (imgIndex < numOfImages-1) + nextImgName = images[imgIndex].fileName(); + + + createPage(imgGalleryDir, (*urlIt), imgName, + (imgIndex > 0) ? images[imgIndex-1] : KURL(), + (imgIndex > 0) ? fileNameList[imgIndex-1] : QString(""), + (imgIndex < (int)(images.count()-1)) ? images[imgIndex+1] : KURL(), + (imgIndex < (int)(fileNameList.count()-1)) ? + fileNameList[imgIndex+1] : QString(""), + imgPageComment); + + // For each first image of current Album we add a preview in main HTML page. + + if ( imgIndex == 0) + { + QString Temp, Temp2; + Temp2 = ""; + m_StreamMainPageAlbumPreview.append ( Temp2 ); + Temp2 = "\""\n"; + m_StreamMainPageAlbumPreview.append ( Temp2 ); + Temp2 = "" + + m_AlbumTitle + "" + " [ " + Temp.setNum(numOfImages) + i18n(" images") + + " ]" + "
\n"; + m_StreamMainPageAlbumPreview.append ( Temp2 ); + } + } + + if ( valRet == -1 || valRet == 0 ) + { + kdDebug(51000) << "Creating thumbnail for " << imgName + << "failed !" << endl; + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::ResizeImages; + d->starting = false; + d->success = false; + d->fileName = imgName; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + } + else + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::ResizeImages; + d->starting = false; + d->success = true; + d->fileName = imgName; + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + } + + stream << "" << endl; + + stream << "
" << imgName << "
" << endl; + + stream << "
" << imgProp.width() << " x " << imgProp.height() << "
" << endl; + stream << "
(" << (imgInfo.size() / 1024) << " " << i18n("KB") << ") " << "
" << endl; + + stream << "
\n
\n" << endl; + + QString Temp; + KGlobal::dirs()->addResourceType("kipi_data", KGlobal::dirs()->kde_default("data") + "kipi"); + QString dir = KGlobal::dirs()->findResourceDir("kipi_data", "valid-html401.png"); + dir = dir + "valid-html401.png"; + + KURL srcURL(dir); + KURL destURL(imgGalleryDir + QString::fromLatin1("/thumbs/valid-html401.png")); + KIO::file_copy(srcURL, destURL, -1, true, false, false); + + stream << "

" << endl; + Temp = i18n("Valid HTML 4.01."); + stream << "\""" << endl; + + Temp = i18n("Album archive created with " + "%2 on %3").arg(m_hostURL).arg(m_hostName).arg(today); + + stream << Temp << endl; + stream << "

" << endl; + stream << "\n\n" << endl; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::createBodyMainPage(QTextStream& stream, KURL& url) +{ + QString Temp; + const QString today(KGlobal::locale()->formatDate(QDate::currentDate())); + + Temp = m_mainTitle; + stream << "\n

" << Temp << "

\n" << endl; + + Temp = i18n("Album list:"); + stream << Temp << "
" << endl; + stream << "


" << endl; + + stream << "

" << m_StreamMainPageAlbumPreview << "

" << endl; + + stream << "
" << endl; + + KGlobal::dirs()->addResourceType("kipi_data", KGlobal::dirs()->kde_default("data") + "kipi"); + QString dir = KGlobal::dirs()->findResourceDir("kipi_data", "valid-html401.png"); + dir = dir + "valid-html401.png"; + + KURL srcURL(dir); + KURL destURL(url.directory() + QString::fromLatin1("/valid-html401.png")); + KIO::file_copy(srcURL, destURL, -1, true, false, false); + + stream << "

" << endl; + Temp = i18n("Valid HTML 4.01."); + stream << "\""" << endl; + + Temp = i18n("Album archive created with " + "%2 on %3").arg(m_hostURL).arg(m_hostName).arg(today); + stream << Temp << endl; + stream << "

" << endl; + stream << "\n\n" << endl; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::createHtml( const KIPI::ImageCollection& album, + const KURL& targetURL, + const QString& imageFormat ) +{ + if (m_cancelled) + return false; + + // Sort the images files formats running with thumbnails construction. + + const QString imgGalleryDir = targetURL.directory(); + + // Create the "thumbs" subdirectory + + QDir thumb_dir( imgGalleryDir + QString::fromLatin1("/thumbs/")); + + if (createDirectory(thumb_dir, imgGalleryDir, "thumbs") == false) + return false; + + QDir pages_dir( imgGalleryDir + QString::fromLatin1("/pages/")); + + if (createDirectory(pages_dir, imgGalleryDir, "pages") == false) + return false; + + // Create HTML page. + + QFile file( targetURL.path() ); + + if ( file.open(IO_WriteOnly) ) + { + QTextStream stream(&file); + stream.setEncoding(QTextStream::UnicodeUTF8); + createHead(stream); + createBody(stream, album, targetURL, imageFormat); + file.close(); + return true; + } + else + { + KIPICDArchivingPlugin::EventData *d; + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Error; + d->starting = false; + d->success = false; + d->message = i18n("Could not open file '%1'.").arg(targetURL.path(+1)); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + return false; + } +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::createPage(const QString& imgGalleryDir, + const KURL& imgURL, + const QString& uniqueImgName, + const KURL& prevImgURL, + const QString& prevUniqueImgName, + const KURL& nextImgURL, + const QString& nextUniqueImgName, + const QString& comment) +{ + + const QDir pagesDir(imgGalleryDir + QString::fromLatin1("/pages/")); + const QDir thumbsDir(imgGalleryDir + QString::fromLatin1("/thumbs/")); + const QFileInfo fi (imgURL.fileName()); + const QString imgName = uniqueImgName + "." + fi.extension(FALSE); + kdDebug( 51000 ) << "CreatePage: FileName: " << imgURL.fileName() << endl; + kdDebug( 51000 ) << "CreatePage: uniqueFileName: " << imgName << endl; + kdDebug( 51000 ) << "CreatePage: uniquePrevFileName: " << prevUniqueImgName << endl; + kdDebug( 51000 ) << "CreatePage: uniqueNextFileName: " << nextUniqueImgName << endl; + + + // Html pages filenames + + const QString pageFilename = pagesDir.path() + + QString::fromLatin1("/") + + webifyFileName(uniqueImgName)+ + QString::fromLatin1(".htm"); + const QString nextPageFilename = webifyFileName(nextUniqueImgName) + + QString::fromLatin1(".htm"); + const QString prevPageFilename = webifyFileName(prevUniqueImgName) + + QString::fromLatin1(".htm"); + + // Thumbs filenames + + const QString prevThumb = QString::fromLatin1("../thumbs/") + + webifyFileName(prevUniqueImgName) + + extension(m_imageFormat); + + const QString nextThumb = QString::fromLatin1("../thumbs/") + + webifyFileName(nextUniqueImgName) + + extension(m_imageFormat); + + QFile file( pageFilename ); + + if ( pagesDir.exists() && file.open(IO_WriteOnly) ) + { + QTextStream stream(&file); + stream.setEncoding(QTextStream::UnicodeUTF8); + + QString chsetName = QTextCodec::codecForLocale()->mimeName(); + stream << "" << endl; + stream << "" << endl; + stream << "" << endl; + stream << "" << endl; + + stream << "" << endl; + + stream << "formatDate(QDate::currentDate()) + << "\">" << endl; + stream << "" << m_mainTitle << " : "<< imgName/*imgURL.fileName()*/ <<"" << endl; + + createCSSSection(stream); + + stream << "" << endl; + stream<<"" << endl;; + stream << "
"<< endl; + + QImage imgProp; + int prevW = 0; + int prevH = 0; + int nextW = 0; + int nextH = 0; + + if (imgProp.load(prevImgURL.path())) + { + prevW = imgProp.width(); + prevH = imgProp.height(); + } + + if (imgProp.load(nextImgURL.path())) + { + nextW = imgProp.width(); + nextH = imgProp.height(); + } + + // Navigation thumbs need to be 64x64 at most + + if ( prevW < prevH ) + { + prevH = (NAV_THUMB_MAX_SIZE * prevH) / prevW; + prevW = NAV_THUMB_MAX_SIZE; + } + else if ( prevW==prevH ) + { + prevH = NAV_THUMB_MAX_SIZE; + prevW = NAV_THUMB_MAX_SIZE; + } + else + { + prevW = (NAV_THUMB_MAX_SIZE * prevW) / prevH; + prevH = NAV_THUMB_MAX_SIZE; + } + + if ( nextW < nextH ) + { + nextH = (NAV_THUMB_MAX_SIZE * nextH) / nextW; + nextW = NAV_THUMB_MAX_SIZE; + } + else if ( nextW==nextH ) + { + nextH = NAV_THUMB_MAX_SIZE ; + nextW = NAV_THUMB_MAX_SIZE; + } + else + { + nextW = (NAV_THUMB_MAX_SIZE * nextW) / nextH; + nextH = NAV_THUMB_MAX_SIZE; + } + + if ( prevImgURL.isValid() ) + { + stream << "\""  |  " << endl; + } + + stream << "\""" << endl; + stream << "  |  \""" << endl; + + if ( nextImgURL.isValid() ) + { + stream << "  |  \""" << endl; + } + + stream << "


" << endl; + + // Add comment if it exists + + if ( !comment.isEmpty() ) + { + stream << "
" + << EscapeSgmlText(QTextCodec::codecForLocale(), comment, true, true) + << "
" << endl; + } + + stream <<"
" << endl; + + stream << "\""

" << endl; + + // Footer + + QString valid = i18n("Valid HTML 4.01."); + const QString today(KGlobal::locale()->formatDate(QDate::currentDate())); + + stream << "

\""" << endl; + + valid = i18n("Image gallery created with " + "%2 on %3").arg(m_hostURL).arg(m_hostName).arg(today); + + stream << valid << "
" << endl; + + stream << "" << endl; + file.close(); + + return true; + } + + return false; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +int CDArchiving::createThumb( const QString& imgName, const QString& sourceDirName, + const QString& uniqueFileName, + const QString& imgGalleryDir, const QString& imageFormat) +{ + const QString pixPath = sourceDirName + "/" + imgName; + + // Create the thumbnails for the HTML interface. + + const QString ImageNameFormat = webifyFileName(uniqueFileName) + extension(imageFormat); + const QString thumbDir = imgGalleryDir + QString::fromLatin1("/thumbs/"); + int extent = m_thumbnailsSize; + + m_imgWidth = 120; // Setting the size of the images is + m_imgHeight = 90; // required to generate faster 'loading' pages + + return (ResizeImage(pixPath, thumbDir, imageFormat, ImageNameFormat, + &m_imgWidth, &m_imgHeight, extent, false, 16, false, 100)); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +int CDArchiving::ResizeImage( const QString Path, const QString Directory, const QString ImageFormat, + const QString ImageNameFormat, int *Width, int *Height, int SizeFactor, + bool ColorDepthChange, int ColorDepthValue, bool CompressionSet, + int ImageCompression) +{ + QImage img; + bool ValRet; + bool usingBrokenImage = false; + + ValRet = img.load(Path); + + if ( ValRet == false ) // Cannot load the src image. + { + KGlobal::dirs()->addResourceType("kipi_imagebroken", KGlobal::dirs()->kde_default("data") + "kipi/data"); + QString dir = KGlobal::dirs()->findResourceDir("kipi_imagebroken", "image_broken.png"); + dir = dir + "image_broken.png"; + kdDebug ( 51000 ) << "Loading " << Path.ascii() << " failed ! Using " << dir.ascii() + << " instead..." << endl; + ValRet = img.load(dir); // Try broken image icon... + usingBrokenImage = true; + } + + if ( ValRet == true ) + { + int w = img.width(); + int h = img.height(); + + if (SizeFactor != -1) // Use original image size ? + { + // scale to pixie size + // kdDebug( 51000 ) << "w: " << w << " h: " << h << endl; + // Resizing if to big + + if ( w > SizeFactor || h > SizeFactor ) + { + if ( w > h ) + { + h = (int)( (double)( h * SizeFactor ) / w ); + + if ( h == 0 ) h = 1; + + w = SizeFactor; + Q_ASSERT( h <= SizeFactor ); + } + else + { + w = (int)( (double)( w * SizeFactor ) / h ); + + if ( w == 0 ) w = 1; + + h = SizeFactor; + Q_ASSERT( w <= SizeFactor ); + } + + const QImage scaleImg(img.smoothScale( w, h )); + + if ( scaleImg.width() != w || scaleImg.height() != h ) + { + kdDebug( 51000 ) << "Resizing failed. Aborting." << endl; + return -1; + } + + img = scaleImg; + } + + if ( ColorDepthChange == true ) + { + const QImage depthImg(img.convertDepth( ColorDepthValue )); + img = depthImg; + } + } + + kdDebug( 51000 ) << "Saving resized image to: " << Directory + ImageFormat << endl; + + if ( CompressionSet == true ) + { + if ( !img.save(Directory + ImageNameFormat, ImageFormat.latin1(), ImageCompression) ) + { + kdDebug( 51000 ) << "Saving failed with specific compression value. Aborting." << endl; + return -1; + } + } + else + { + if ( !img.save(Directory + ImageNameFormat, ImageFormat.latin1(), -1) ) + { + kdDebug( 51000 ) << "Saving failed with no compression value. Aborting." << endl; + return -1; + } + } + + *Width = w; + *Height = h; + + if ( usingBrokenImage == true ) + return 0; + else + return 1; + } + + return -1; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::BuildK3bXMLprojectfile (QString HTMLinterfaceFolder, QString IndexHtm, + QString AutoRunInf, QString AutorunFolder) +{ + QString Temp; + KIPICDArchivingPlugin::EventData *d; + QFile XMLK3bProjectFile; + + // open the K3b XML project file. + + XMLK3bProjectFile.setName ( m_tmpFolder + "/KIPICDArchiving.xml" ); + + if ( XMLK3bProjectFile.open ( IO_WriteOnly | IO_Truncate ) == false ) + return false; + + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Progress; + d->starting = true; + d->success = false; + d->message = i18n("Creating project header..."); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + + // Build K3b XML project File. + + QTextStream stream( &XMLK3bProjectFile ); + stream.setEncoding(QTextStream::UnicodeUTF8); + + // XML Header. + + Temp = "\n"; + + stream << Temp; + + if (m_mediaFormat == i18n("DVD (4,7Gb)")) + Temp = "\n" + "\n"; // Build a Data DVD project file. + else + Temp = "\n" + "\n"; // Build a Data CD project file. + + stream << Temp; + + // General section. + + Temp = "\n" + "auto\n" // Let K3b selected the good mode. + "\n"; // Simulation always disactived. + + stream << Temp; + + if (m_useOnTheFly == false) // Burning CD On The Fly ? + Temp = "\n"; + else + Temp = "\n"; + + stream << Temp; + + Temp = "\n" // Always desactived. + "\n" // Always actived. + "\n"; + + stream << Temp; + + // Option section. + + Temp = "\n" + "\n" // Always actived for Linux. + "\n"; // Always actived for Win32. + + stream << Temp; + + if (m_mediaFormat == i18n("DVD (4,7Gb)")) + Temp = "\n"; // Need this option for DVDR/RW. + else + Temp = "\n"; // Don't need this option for CDR/RW + + stream << Temp; + + Temp = "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" // Always desactived. + "\n" + "\n" + "2\n" // Always ISO level 2. + "\n" // Always desactived. + "\n" // Always desactived. + "\n" // Actived : backup. + "\n" // Disabled. + "iso8859-1\n" // Disabled (see before). + "noChange\n" + "_\n" + "auto\n" // Let K3b selected the good mode. + "none\n"; // Always 1 session for backup CD. + + stream << Temp; + + if (m_useCheckCD == false) // Checking CD after burning process ? + Temp = "\n"; + else + Temp = "\n"; + + stream << Temp; + + Temp = "\n"; + + stream << Temp; + + // Header section. + + Temp = "
\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), m_volumeID, true, true) + + "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), m_volumeSetID, true, true) + + "\n" + "1\n" + "1\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), m_systemID, true, true) + + "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), m_applicationID, true, true) + + "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), m_publisher, true, true) + + "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), m_preparer, true, true) + + "\n" + "
\n"; + + stream << Temp; + + // Files and folders section. + + Temp = "\n"; + + stream << Temp; + + if ( IndexHtm.isEmpty() == false ) // index.htm file in CD root. + { + Temp = "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), IndexHtm, true, true) + + "\n" + "\n"; + + stream << Temp; + } + + if ( AutoRunInf.isEmpty() == false ) // Autorun.inf file in CD root. + { + Temp = "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), AutoRunInf, true, true) + + "\n" + "\n"; + + stream << Temp; + } + + // Add Autorun folder name and files. + + if ( AutorunFolder.isEmpty() == false ) + AddFolderTreeToK3bXMLProjectFile(AutorunFolder, &stream); + + // Add HTMLInterface folders name and files. + + if ( HTMLinterfaceFolder.isEmpty() == false ) + AddFolderTreeToK3bXMLProjectFile(HTMLinterfaceFolder, &stream); + + //clear the temporary list for unique names + m_collection_name_list.clear(); + + for (QValueList::iterator it = m_albumsList.begin(); + !m_cancelled && (it != m_albumsList.end()); ++it) + + { + d = new KIPICDArchivingPlugin::EventData; + d->action = KIPICDArchivingPlugin::Progress; + d->starting = true; + d->success = false; + d->message = i18n("Adding Album '%1' into project...").arg( (*it).name() ); + QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); + usleep(1000); + addCollectionToK3bXMLProjectFile( *it, &stream); + } + + Temp = "\n"; + + stream << Temp; + + if (m_mediaFormat == i18n("DVD (4,7Gb)")) + Temp = "
\n"; // Close the Data DVD project file. + else + Temp = "\n"; // Close the Data CD project file. + + stream << Temp; + + // Close K3b XML project File. + + XMLK3bProjectFile.close(); + return true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::AddFolderTreeToK3bXMLProjectFile (QString dirname, QTextStream* stream) +{ + QString Temp; + + QDir dir(dirname); + dir.setFilter ( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); + + Temp = "\n"; + *stream << Temp; + + kdDebug( 51000 ) << "Directory: " << dir.dirName().latin1 () << endl; + + const QFileInfoList* fileinfolist = dir.entryInfoList(); + QFileInfoListIterator it_files(*fileinfolist); + QFileInfoListIterator it_folders(*fileinfolist); + QFileInfo* fi_files; + QFileInfo* fi_folders; + + while ( (fi_files = it_files.current()) && !m_cancelled ) // Check all files in folder. + { + if ( fi_files->fileName() == "." || fi_files->fileName() == ".." ) + { + ++it_files; + continue; + } + + if ( fi_files->isFile() ) + { + kdDebug( 51000 ) << " Filename: " << fi_files->fileName().latin1() << endl; + + Temp = "fileName(), true, true) + + "\" >\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), fi_files->absFilePath(), true, true) + + "\n" + "\n"; + + *stream << Temp; + } + + ++it_files; + } + + while ( (fi_folders = it_folders.current()) && !m_cancelled ) // Check all sub-folders in folder. + { + if ( fi_folders->fileName() == "." || fi_folders->fileName() == ".." ) + { + ++it_folders; + continue; + } + + if ( fi_folders->isDir() ) + { + kdDebug( 51000 ) << " folder: " << fi_folders->fileName().latin1() << endl; + + AddFolderTreeToK3bXMLProjectFile ( fi_folders->absFilePath(), stream ); + } + + ++it_folders; + } + + Temp = "\n"; + *stream << Temp; + + return true; +} + +bool CDArchiving::addCollectionToK3bXMLProjectFile(const KIPI::ImageCollection& collection, + QTextStream* stream) +{ + kdDebug( 51000 ) << "Adding Collection: " << collection.name() << endl; + + QString Temp; + QString collection_name; + if (m_useHTMLInterface) + collection_name = makeFileNameUnique(m_collection_name_list, webifyFileName(collection.name())); + else + collection_name = makeFileNameUnique(m_collection_name_list, collection.name()); + kdDebug( 51000 ) << "num of unique collections: "<< m_collection_name_list.size() << endl; + + Temp = "\n"; + *stream << Temp; + + KURL::List images = collection.images(); + kdDebug( 51000 ) << " Files: " << images.size() << endl; + QStringList fileNameList; + QString fName; + for (KURL::List::iterator it = images.begin(); + (it != images.end()) && !m_cancelled; + ++it) + { + + kdDebug( 51000 ) << " Filename: " << (*it).fileName() << endl; + QFileInfo fInfo((*it).fileName()); + if (m_useHTMLInterface) + fName = makeFileNameUnique(fileNameList, webifyFileName(fInfo.baseName(TRUE))) + + "." + fInfo.extension( FALSE ); + else + fName = makeFileNameUnique(fileNameList, fInfo.baseName(TRUE)) + + "." + fInfo.extension( FALSE ); + kdDebug( 51000 ) << " Unique filename: " << fName << endl; + kdDebug( 51000 ) << "num of unique files: "<< fileNameList.size() << endl; + + Temp = "\n" + "" + + EscapeSgmlText(QTextCodec::codecForLocale(), (*it).path(), true, true) + + "\n" + "\n"; + + *stream << Temp; + } + + Temp = "\n"; + *stream << Temp; + + return true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CDArchiving::CreateAutoRunInfFile(void) +{ + QString Temp; + QFile AutoRunInf; + + AutoRunInf.setName ( m_tmpFolder + "/autorun.inf" ); + + if ( AutoRunInf.open ( IO_WriteOnly | IO_Truncate ) == false ) + return false; + + QTextStream stream( &AutoRunInf ); + + Temp = "[autorun]\r\n" + "OPEN=autorun\\ShellExecute.bat HTMLInterface\\index.htm\r\n" + "ICON=autorun\\cdalbums.ico\r\n"; + + stream << Temp; + + Temp = "LABEL=" + m_volumeID + "\r\n"; + stream << Temp; + + AutoRunInf.close(); + return true; +} + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void CDArchiving::removeTmpFiles(void) +{ + DeleteDir(m_tmpFolder); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// This code can be multithreaded (in opposite to KIO::netaccess::delete(). + +bool CDArchiving::DeleteDir(QString dirname) +{ + if ( !dirname.isEmpty() ) + { + QDir dir; + + if (dir.exists ( dirname ) == true) + { + if (deldir(dirname) == false) + return false; + + if (dir.rmdir( dirname ) == false ) + return false; + } + else + return false; + } + else + return false; + + return true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// This code can be multithreaded (in opposite to KIO::netaccess::delete(). + +bool CDArchiving::deldir(QString dirname) +{ + QDir dir(dirname); + dir.setFilter ( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); + + const QFileInfoList* fileinfolist = dir.entryInfoList(); + QFileInfoListIterator it(*fileinfolist); + QFileInfo* fi; + + while ( (fi = it.current() ) ) + { + if (fi->fileName() == "." || fi->fileName() == ".." ) + { + ++it; + continue; + } + + if ( fi->isDir() ) + { + if (deldir( fi->absFilePath() ) == false) + return false; + if (dir.rmdir( fi->absFilePath() ) == false) + return false; + } + else + if ( fi->isFile() ) + if (dir.remove(fi->absFilePath() ) == false) + return false; + + ++it; + } + + return true; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// Source code from Koffice 1.3 + +QString CDArchiving::EscapeSgmlText(const QTextCodec* codec, + const QString& strIn, + const bool quot /* = false */ , + const bool apos /* = false */ ) +{ + QString strReturn; + QChar ch; + + for (uint i = 0 ; i < strIn.length() ; ++i) + { + ch=strIn[i]; + switch (ch.unicode()) + { + case 38: // & + { + strReturn += "&"; + break; + } + case 60: // < + { + strReturn += "<"; + break; + } + case 62: // > + { + strReturn += ">"; + break; + } + case 34: // " + { + if (quot) + strReturn += """; + else + strReturn += ch; + break; + } + case 39: // ' + { + // NOTE: HTML does not define ' by default (only XML/XHTML does) + if (apos) + strReturn += "'"; + else + strReturn += ch; + break; + } + default: + { + // verify that the character ch can be expressed in the + // encoding in which we will write the HTML file. + if (codec) + { + if (!codec->canEncode(ch)) + { + strReturn += QString("&#%1;").arg(ch.unicode()); + break; + } + } + strReturn += ch; + break; + } + } + } + + return strReturn; +} + + +/** + * Produce a web-friendly file name + */ + +QString CDArchiving::webifyFileName(QString fileName) +{ + fileName=fileName.lower(); + + // Remove potentially troublesome chars + fileName=fileName.replace(QRegExp("[^-0-9a-zA-Z]+"), "_"); + + return fileName; +} + +/** + * Make sure a file name is unique in list + */ +QString CDArchiving::makeFileNameUnique(QStringList& list, QString fileName) +{ + // Make sure the file name is unique + QString fileNameBase=fileName; + int count=1; + while (list.findIndex(fileName)!=-1) + { + fileName=fileNameBase + "-" + QString::number(count); + ++count; + }; + + list += fileName; + + return fileName; +} + + +} // NameSpace KIPICDArchivingPlugin + +#include "cdarchiving.moc" diff --git a/kipi-plugins/cdarchiving/cdarchiving.h b/kipi-plugins/cdarchiving/cdarchiving.h new file mode 100644 index 0000000..d87bb9d --- /dev/null +++ b/kipi-plugins/cdarchiving/cdarchiving.h @@ -0,0 +1,220 @@ +////////////////////////////////////////////////////////////////////////////// +// +// CDARCHIVING.H +// +// Copyright (C) 2003-2004 Gilles Caulier +// Copyright (C) 2003-2004 by Gregory Kokanosky +// for images navigation mode. +// +// 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, Cambridge, MA 02110-1301, USA. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef CDARCHIVING_H +#define CDARCHIVING_H + +// C Ansi includes. + +extern "C" +{ +#include +} + +// Qt includes + +#include +#include +#include +#include +#include +#include + +// KDE includes + +#include +#include + +// KIPI includes + +#include +#include + +class KProcess; + +namespace KIPICDArchivingPlugin +{ + +class CDArchivingDialog; + +const int NAV_THUMB_MAX_SIZE = 64; + +// First field is the URL, represented with KURL::prettyURL. We can't use KURL +// directly because operator<(KURL,KURL) is not defined in KDE 3.1 + +class CDArchiving : public QObject +{ + Q_OBJECT + +public: + + CDArchiving( KIPI::Interface* interface, QObject *parent=0, + KAction *action_cdarchiving=0 ); + ~CDArchiving(); + + bool prepare(void); + bool showDialog(); + + void invokeK3b(); + void removeTmpFiles(void); + + void run(void); + void stop(void); + + +public slots: + + void slotK3bDone(KProcess*); + void slotK3bStartBurningProcess(void); + +private: + + CDArchivingDialog *m_configDlg; + + KAction *m_actionCDArchiving; + + KIPI::Interface *m_interface; + + KProcess *m_Proc; + + KURL m_albumUrl; // Current album Url use in the thread. + KURL::List m_albumUrlList; // Urls of Albums list from setup dialog. + + QColor m_backgroundColor; + QColor m_bordersImagesColor; + QColor m_foregroundColor; + + QObject *m_parent; + + QString m_AlbumCollection; + QString m_AlbumComments; + QString m_AlbumDate; + QString m_AlbumTitle; + QString m_HTMLInterfaceAutoRunFolder; + QString m_HTMLInterfaceAutoRunInf; + QString m_HTMLInterfaceFolder; + QString m_HTMLInterfaceIndex; + QString m_K3bBinPathName; + QString m_K3bParameters; + QString m_StreamMainPageAlbumPreview; + QString m_applicationID; + QString m_bordersImagesSize; + QString m_fontName; + QString m_fontSize; + QString m_hostName; + QString m_hostURL; + QString m_imageFormat; + QString m_imagesFileFilter; + QString m_mainTitle; + QString m_mediaFormat; + QString m_preparer; + QString m_publisher; + QString m_systemID; + QString m_tmpFolder; + QString m_volumeID; + QString m_volumeSetID; + + QStringList m_collection_name_list; + + QValueList m_albumsList; + + bool m_cancelled; + bool m_copyFiles; + bool m_useAutoRunWin32; + bool m_useCheckCD; + bool m_useHTMLInterface; + bool m_useOnTheFly; + bool m_useStartBurningProcess; + + int m_albumListSize; + int m_imagesPerRow; + int m_imgHeight; + int m_imgWidth; + int m_targetImgHeight; + int m_targetImgWidth; + int m_thumbnailsSize; + + pid_t m_k3bPid; + +private: + + bool buildHTMLInterface (void); + + bool createDirectory(QDir thumb_dir, QString imgGalleryDir, QString dirName); + + void createHead(QTextStream& stream); + void createCSSSection(QTextStream& stream); + + void createBody(QTextStream& stream, + const KIPI::ImageCollection& album, + const KURL& targetURL, + const QString& imageFormat); + + int createThumb( const QString& imgName, const QString& sourceDirName, const QString& uniqueFileName, + const QString& imgGalleryDir, const QString& imageFormat); + + int ResizeImage( const QString Path, const QString Directory, const QString ImageFormat, + const QString ImageNameFormat, int *Width, int *Height, int SizeFactor, + bool ColorDepthChange, int ColorDepthValue, bool CompressionSet, int ImageCompression); + + bool createHtml( const KIPI::ImageCollection& album, + const KURL& targetURL, + const QString& imageFormat ); + + bool createPage(const QString& imgGalleryDir, + const KURL& imgURL, + const QString& uniqueImgName, + const KURL& prevImgURL, + const QString& prevUniqueImgName, + const KURL& nextImgURL, + const QString& nextUniqueImgName, + const QString& comment); + + void createBodyMainPage(QTextStream& stream, KURL& url); + + static QString extension(const QString& imageFormat); + + bool BuildK3bXMLprojectfile (QString HTMLinterfaceFolder, QString IndexHtm, + QString AutoRunInf, QString AutorunFolder); + + bool AddFolderTreeToK3bXMLProjectFile (QString dirname, QTextStream* stream); + bool addCollectionToK3bXMLProjectFile(const KIPI::ImageCollection& collection, QTextStream* stream); + bool CreateAutoRunInfFile(void); + bool DeleteDir(QString dirname); + bool deldir(QString dirname); + + QString EscapeSgmlText(const QTextCodec* codec, const QString& strIn, + const bool quot = false, const bool apos = false ); + + void writeSettings(void); + void readSettings(void); + + QString webifyFileName(QString fileName); + QString makeFileNameUnique(QStringList& list, QString fileName); + +}; + +} // NameSpace KIPICDArchivingPlugin + +#endif // CDARCHIVING_H diff --git a/kipi-plugins/cdarchiving/cdarchivingdialog.cpp b/kipi-plugins/cdarchiving/cdarchivingdialog.cpp new file mode 100644 index 0000000..7a61cda --- /dev/null +++ b/kipi-plugins/cdarchiving/cdarchivingdialog.cpp @@ -0,0 +1,902 @@ +/* ============================================================ + * Author: Gilles Caulier + * from digiKam project. + * Date : 2003-10-01 + * Description : a kipi plugin to export image collections + * on CD/DVD. + * + * Copyright 2003-2005 by Gilles Caulier + * Copyright 2003-2004 by Gregory Kokanosky + * + * for HTML interface navigation mode + * Copyright 2005 by Owen Hirst + * about bugfix. + * + * 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, 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. + * + * ============================================================ */ + +// Qt includes + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KDE includes + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// KIPI includes + +#include +#include +#include + +// Local includes + +#include "cdarchivingdialog.h" +#include "kpaboutdata.h" +#include "pluginsversion.h" + + +namespace KIPICDArchivingPlugin +{ + +KIO::filesize_t TargetMediaSize; + +CDArchivingDialog::CDArchivingDialog( KIPI::Interface* interface, QWidget *parent) + : KDialogBase( IconList, i18n("Configure Archive to CD"), Help|Ok|Cancel, Ok, + parent, "CDArchivingDialog", true, false ), m_interface( interface ) +{ + setCaption(i18n("Create CD/DVD Archive")); + setupSelection(); + setupLookPage(); + setupCDInfos(); + setupBurning(); + page_setupSelection->setFocus(); + resize(650, 450); + + // About data and help button. + + m_about = new KIPIPlugins::KPAboutData(I18N_NOOP("CD/DVD Archiving"), + 0, + KAboutData::License_GPL, + I18N_NOOP("An Album CD/DVD Archiving Kipi plugin.\n" + "This plugin use K3b CD/DVD burning software available at\n" + "http://www.k3b.org"), + "(c) 2003-2005, Gilles Caulier"); + + m_about->addAuthor("Gilles Caulier", I18N_NOOP("Author"), + "caulier dot gilles at gmail dot com"); + + m_about->addAuthor("Angelo Naselli", I18N_NOOP("Contributor"), + "anaselli at linux.it"); + + m_about->addAuthor("Gregory Kokanosky", I18N_NOOP("Image navigation mode patches"), + "gregory dot kokanosky at free.fr"); + + m_about->addAuthor("Owen Hirst", I18N_NOOP("Bugfix"), + "n8rider at sbcglobal.net"); + + m_helpButton = actionButton( Help ); + KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false); + helpMenu->menu()->removeItemAt(0); + helpMenu->menu()->insertItem(i18n("Plugin Handbook"), this, SLOT(slotHelp()), 0, -1, 0); + m_helpButton->setPopup( helpMenu->menu() ); +} + +CDArchivingDialog::~CDArchivingDialog() +{ + delete m_about; +} + +void CDArchivingDialog::slotHelp() +{ + KApplication::kApplication()->invokeHelp("cdarchiving", "kipi-plugins"); +} + +void CDArchivingDialog::setupSelection(void) +{ + page_setupSelection = addPage(i18n("Selection"), i18n("Album Selection"), + BarIcon("folder_image", KIcon::SizeMedium)); + + QVBoxLayout *layout = new QVBoxLayout(page_setupSelection, 0, spacingHint() ); + m_imageCollectionSelector = new KIPI::ImageCollectionSelector(page_setupSelection, m_interface); + layout->addWidget(m_imageCollectionSelector); + + //--------------------------------------------- + + QGroupBox * groupBox3 = new QGroupBox( 2, Qt::Horizontal, + i18n("Target Media Information"), + page_setupSelection ); + groupBox3->layout()->setSpacing( 6 ); + groupBox3->layout()->setMargin( 11 ); + QWhatsThis::add( groupBox3, i18n("

Information about the backup medium.") ); + + m_mediaSize = new QLabel( groupBox3 ); + m_mediaSize->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) ); + + m_mediaFormat = new QComboBox(false, groupBox3); + m_mediaFormat->insertItem(i18n("CD (650Mb)")); + m_mediaFormat->insertItem(i18n("CD (700Mb)")); + m_mediaFormat->insertItem(i18n("CD (880Mb)")); + m_mediaFormat->insertItem(i18n("DVD (4,7Gb)")); + m_mediaFormat->setCurrentText (i18n("CD (650Mb)")); + mediaFormatActived(m_mediaFormat->currentText()); + QWhatsThis::add( m_mediaFormat, i18n("

Select here the backup media format.")); + + layout->addWidget( groupBox3 ); + + //--------------------------------------------- + + connect( m_mediaFormat, SIGNAL( highlighted( const QString & ) ), + this, SLOT( mediaFormatActived( const QString & ) ) ); + + connect( m_imageCollectionSelector, SIGNAL( selectionChanged() ), + this, SLOT( slotAlbumSelected() ) ); +} + +void CDArchivingDialog::setupLookPage(void) +{ + QString whatsThis; + page_setupLook = addPage( i18n("HTML Interface"), i18n("HTML Interface Look"), + BarIcon("html", KIcon::SizeMedium ) ); + + QVBoxLayout *vlay = new QVBoxLayout( page_setupLook, 0, spacingHint() ); + + //--------------------------------------------- + + m_useHTMLInterface = new QCheckBox( i18n("Build CD HTML interface"), page_setupLook); + m_useHTMLInterface->setChecked( true ); + vlay->addWidget( m_useHTMLInterface ); + QWhatsThis::add( m_useHTMLInterface, + i18n("

This option adds a HTML interface to browse the CD's contents.") ); + + //--------------------------------------------- + + m_useAutoRunWin32 = new QCheckBox( i18n("Add \"autorun\" functionality"), page_setupLook); + m_useAutoRunWin32->setChecked( true ); + vlay->addWidget( m_useAutoRunWin32 ); + QWhatsThis::add( m_useAutoRunWin32, + i18n("

This option adds MS Windows(tm) autorunning capability to the CD.") ); + + //--------------------------------------------- + + m_labelTitle = new QLabel( i18n("Archive title:"), page_setupLook); + vlay->addWidget( m_labelTitle ); + + m_title = new QLineEdit(i18n("Album Archiving"), page_setupLook); + vlay->addWidget( m_title ); + m_labelTitle->setBuddy(m_title); + QWhatsThis::add( m_title, i18n("

Enter here the title of the CD archive.") ); + + //--------------------------------------------- + + m_imagesPerRow = new KIntNumInput(4, page_setupLook); + m_imagesPerRow->setRange(1, 8, 1, true ); + m_imagesPerRow->setLabel( i18n("I&mages per row:") ); + QWhatsThis::add( m_imagesPerRow, i18n("

Enter here the number of images per row on the album page. " + "A good value is '4'.") ); + vlay->addWidget( m_imagesPerRow ); + + QGridLayout *grid = new QGridLayout( 2, 2 ); + vlay->addLayout( grid ); + + //--------------------------------------------- + + m_thumbnailsSize = new KIntNumInput(140, page_setupLook); + m_thumbnailsSize->setRange(10, 1000, 1, true ); + m_thumbnailsSize->setLabel( i18n("Thumbnail size:") ); + vlay->addWidget( m_thumbnailsSize ); + QWhatsThis::add( m_thumbnailsSize, i18n("

The new size of thumbnails in pixels") ); + + //--------------------------------------------- + + QHBoxLayout *hlay3 = new QHBoxLayout( spacingHint() ); + vlay->addLayout( hlay3 ); + m_imageFormat = new QComboBox(false, page_setupLook); + m_imageFormat->insertItem("JPEG"); + m_imageFormat->insertItem("PNG"); + m_imageFormat->setCurrentText ("JPEG"); + whatsThis = i18n("

Select here the image file format for thumbnails.

"); + whatsThis = whatsThis + i18n("JPEG: The Joint Photographic Experts Group's file format is a " + "good Web file format but it uses lossy data compression.

" + "PNG: the Portable Network Graphics format is an extensible file format for " + "the lossless, portable, well-compressed storage of raster images. PNG provides a " + "patent-free replacement for GIF and can also replace many common uses of TIFF. " + "PNG is designed to work well in online viewing applications, such as the World " + "Wide Web, so it is fully streamable with a progressive display option. Also, " + "PNG can store gamma and chromaticity data for improved color matching on " + "heterogeneous platforms."); + QWhatsThis::add( m_imageFormat, whatsThis ); + + m_labelThumbsFileFormat = new QLabel( i18n("Thumbnail file format:"), page_setupLook); + hlay3->addWidget( m_labelThumbsFileFormat ); + m_labelThumbsFileFormat->setBuddy( m_imageFormat ); + hlay3->addStretch( 1 ); + hlay3->addWidget( m_imageFormat ); + + //--------------------------------------------- + + QHBoxLayout *hlay11 = new QHBoxLayout( ); + vlay->addLayout( hlay11 ); + + m_fontName = new QComboBox( false, page_setupLook ); + QStringList standardFonts; + KFontChooser::getFontList(standardFonts, 0); + m_fontName->insertStringList( standardFonts ); + m_fontName->setCurrentText( KGlobalSettings::generalFont().family()); + QWhatsThis::add( m_fontName, i18n("

Select here the font name used for the pages.") ); + + m_labelFontName = new QLabel( i18n("Fon&t name:"), page_setupLook ); + m_labelFontName->setBuddy( m_fontName ); + hlay11->addWidget( m_labelFontName ); + hlay11->addStretch( 1 ); + hlay11->addWidget( m_fontName ); + + //--------------------------------------------- + + QHBoxLayout *hlay12 = new QHBoxLayout( ); + vlay->addLayout( hlay12 ); + + m_fontSize = new QSpinBox( 6, 15, 1, page_setupLook ); + m_fontSize->setValue( 14 ); + QWhatsThis::add( m_fontSize, i18n("

Select here the font size used for the pages.") ); + + m_labelFontSize = new QLabel( i18n("Font si&ze:"), page_setupLook ); + m_labelFontSize->setBuddy( m_fontSize ); + hlay12->addWidget( m_labelFontSize ); + hlay12->addStretch( 1 ); + hlay12->addWidget( m_fontSize ); + + //--------------------------------------------- + + QHBoxLayout *hlay1 = new QHBoxLayout( spacingHint() ); + vlay->addLayout( hlay1 ); + + m_foregroundColor = new KColorButton(page_setupLook); + m_foregroundColor->setColor(QColor("#d0ffd0")); + QWhatsThis::add( m_foregroundColor, i18n("

Select here the foreground color used for the pages.") ); + + m_labelForegroundColor = new QLabel( i18n("&Foreground color:"), page_setupLook); + m_labelForegroundColor->setBuddy( m_foregroundColor ); + hlay1->addWidget( m_labelForegroundColor ); + hlay1->addStretch( 1 ); + hlay1->addWidget(m_foregroundColor); + + //--------------------------------------------- + + QHBoxLayout *hlay2 = new QHBoxLayout( spacingHint() ); + vlay->addLayout( hlay2 ); + + m_backgroundColor = new KColorButton(page_setupLook); + m_backgroundColor->setColor(QColor("#333333")); + QWhatsThis::add( m_backgroundColor, i18n("

Select here the background color used for the pages.") ); + + m_labelBackgroundColor = new QLabel( i18n("&Background color:"), page_setupLook); + hlay2->addWidget( m_labelBackgroundColor ); + m_labelBackgroundColor->setBuddy( m_backgroundColor ); + hlay2->addStretch( 1 ); + hlay2->addWidget(m_backgroundColor); + + //--------------------------------------------- + + QHBoxLayout *hlay13 = new QHBoxLayout( ); + vlay->addLayout( hlay13 ); + + m_bordersImagesSize = new QSpinBox( 1, 20, 1, page_setupLook ); + m_bordersImagesSize->setValue( 1 ); + QWhatsThis::add( m_bordersImagesSize, i18n("

Select here the image border's size in pixels.") ); + + m_labelImageBorderSize = new QLabel( i18n("Image border s&ize:"), page_setupLook ); + m_labelImageBorderSize->setBuddy( m_bordersImagesSize ); + hlay13->addWidget( m_labelImageBorderSize ); + hlay13->addStretch( 1 ); + hlay13->addWidget( m_bordersImagesSize ); + + //--------------------------------------------- + + QHBoxLayout *hlay4 = new QHBoxLayout( spacingHint() ); + vlay->addLayout( hlay4 ); + + m_bordersImagesColor = new KColorButton(page_setupLook); + m_bordersImagesColor->setColor(QColor("#d0ffd0")); + QWhatsThis::add( m_bordersImagesColor, i18n("

Select here the color used " + "for the image borders.") ); + + m_labelImageBorderSizeColor = new QLabel( i18n("Image bo&rder color:"), page_setupLook); + hlay4->addWidget( m_labelImageBorderSizeColor ); + m_labelImageBorderSizeColor->setBuddy( m_bordersImagesColor ); + hlay4->addStretch( 1 ); + hlay4->addWidget(m_bordersImagesColor); + + //--------------------------------------------- + + vlay->addStretch(1); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_useAutoRunWin32, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelTitle, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelThumbsFileFormat, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelFontName, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelFontSize, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelForegroundColor, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelBackgroundColor, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_title, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_imagesPerRow, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_fontSize, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_fontName, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_imageFormat, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_thumbnailsSize, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_foregroundColor, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_backgroundColor, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_bordersImagesSize, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelImageBorderSize, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_bordersImagesColor, SLOT(setEnabled(bool))); + + connect(m_useHTMLInterface, SIGNAL(toggled(bool)), + m_labelImageBorderSizeColor, SLOT(setEnabled(bool))); + +} + +void CDArchivingDialog::setupCDInfos(void) +{ + page_CDInfos = addPage( i18n("Volume Descriptor"), i18n("Media Volume Descriptor"), + BarIcon("cd", KIcon::SizeMedium ) ); + + QVBoxLayout *vlay = new QVBoxLayout( page_CDInfos, 0, spacingHint() ); + + QLabel *label; + + //--------------------------------------------- + + label = new QLabel( i18n("Volume name:"), page_CDInfos); + vlay->addWidget( label ); + + m_volume_id = new QLineEdit(i18n("CD Album"), page_CDInfos); + vlay->addWidget( m_volume_id ); + m_labelTitle->setBuddy(m_volume_id); + m_volume_id->setMaxLength(32); + QWhatsThis::add( m_volume_id, i18n("

Enter here the media volume name (32 characters max.)") ); + + //--------------------------------------------- + + label = new QLabel( i18n("Volume set name:"), page_CDInfos); + vlay->addWidget( label ); + + m_volume_set_id = new QLineEdit(i18n("Album CD archive"), page_CDInfos); + vlay->addWidget( m_volume_set_id ); + m_labelTitle->setBuddy(m_volume_set_id); + m_volume_set_id->setMaxLength(128); + QWhatsThis::add( m_volume_set_id, + i18n("

Enter here the media volume global name (128 characters max.)") ); + + //--------------------------------------------- + + label = new QLabel( i18n("System:"), page_CDInfos); + vlay->addWidget( label ); + + m_system_id = new QLineEdit(i18n("LINUX"), page_CDInfos); + vlay->addWidget( m_system_id ); + m_labelTitle->setBuddy(m_system_id); + m_system_id->setMaxLength(32); + QWhatsThis::add( m_system_id, + i18n("

Enter here the media burning system name (32 characters max.)") ); + + //--------------------------------------------- + + label = new QLabel( i18n("Application:"), page_CDInfos); + vlay->addWidget( label ); + + m_application_id = new QLineEdit(i18n("K3b CD-DVD Burning application"), page_CDInfos); + vlay->addWidget( m_application_id ); + m_labelTitle->setBuddy(m_application_id); + m_application_id->setMaxLength(128); + QWhatsThis::add( m_application_id, + i18n("

Enter here the media burning application name (128 characters max.).") ); + + + //--------------------------------------------- + + label = new QLabel( i18n("Publisher:"), page_CDInfos); + vlay->addWidget( label ); + + m_publisher = new QLineEdit(i18n("KIPI [KDE Images Program Interface]"), page_CDInfos); + vlay->addWidget( m_publisher ); + m_labelTitle->setBuddy(m_publisher); + m_publisher->setMaxLength(128); + QWhatsThis::add( m_publisher, + i18n("

Enter here the media publisher name (128 characters max.).") ); + + //--------------------------------------------- + + label = new QLabel( i18n("Preparer:"), page_CDInfos); + vlay->addWidget( label ); + + m_preparer = new QLineEdit(i18n("KIPI CD Archiving plugin"), page_CDInfos); + vlay->addWidget( m_preparer ); + m_labelTitle->setBuddy(m_preparer); + m_preparer->setMaxLength(128); + QWhatsThis::add( m_preparer, i18n("

Enter here the media preparer name (128 characters max.).") ); + + vlay->addStretch(1); +} + +void CDArchivingDialog::setupBurning(void) +{ + page_burning = addPage( i18n("Media Burning"), + i18n("CD/DVD Burning Setup"), + BarIcon("cdwriter_unmount", KIcon::SizeMedium ) ); + + QVBoxLayout *vlay = new QVBoxLayout( page_burning, 0, spacingHint() ); + + QLabel *label; + + //--------------------------------------------- + + label = new QLabel(i18n("&K3b binary path:"), page_burning); + vlay->addWidget( label ); + + m_K3bBinPath = new KURLRequester( "k3b", page_burning); + label->setBuddy( m_K3bBinPath ); + vlay->addWidget(m_K3bBinPath); + + connect( m_K3bBinPath, SIGNAL(textChanged(const QString&)), + this, SLOT(UrlChanged(const QString&))); + + QWhatsThis::add( m_K3bBinPath, i18n("

The path name to the K3b binary program.") ); + + //--------------------------------------------- + + label = new QLabel( i18n("Application parameters:"), page_burning); + vlay->addWidget( label ); + + m_K3bParameters = new QLineEdit("--nofork", page_burning); + vlay->addWidget( m_K3bParameters ); + m_labelTitle->setBuddy(m_K3bParameters); + m_K3bParameters->setMaxLength(128); + QWhatsThis::add( m_K3bParameters, + i18n("

Enter parameters which will be used when starting the " + "burning application. Newer versions of K3b might need " + "--nofork, older versions might not need it. " + "(128 characters max.).") ); + + //--------------------------------------------- + + QGroupBox * groupBoxAdvancedOptions = new QGroupBox( i18n("Advanced Burning Options"), page_burning ); + groupBoxAdvancedOptions->setColumnLayout(0, Qt::Vertical ); + groupBoxAdvancedOptions->layout()->setSpacing( 6 ); + groupBoxAdvancedOptions->layout()->setMargin( 11 ); + + QVBoxLayout * groupBoxAOLayout = new QVBoxLayout( groupBoxAdvancedOptions->layout() ); + groupBoxAOLayout->setAlignment( Qt::AlignTop ); + + m_burnOnTheFly = new QCheckBox( i18n("Media burning On-The-Fly"), groupBoxAdvancedOptions); + m_burnOnTheFly->setChecked( false ); + QWhatsThis::add( m_burnOnTheFly, i18n("

This option uses the \"On-The-Fly\" " + "media burning capability; this does not use a media image.") ); + groupBoxAOLayout->addWidget( m_burnOnTheFly ); + + m_checkCDBurn = new QCheckBox( i18n("Check media"), groupBoxAdvancedOptions); + m_checkCDBurn->setChecked( false ); + QWhatsThis::add( m_checkCDBurn, i18n("

This option verifies the media after the burning process. " + "You must use K3b release >= 0.10.0") ); + groupBoxAOLayout->addWidget( m_checkCDBurn ); + + m_startBurningProcess = new QCheckBox( i18n("Start burning process automatically"), groupBoxAdvancedOptions); + m_startBurningProcess->setChecked( false ); + m_startBurningProcess->hide(); + QWhatsThis::add( m_startBurningProcess, i18n("

This option start automatically the burning process " + "when K3b is loaded.") ); + groupBoxAOLayout->addWidget( m_startBurningProcess ); + + vlay->addWidget( groupBoxAdvancedOptions ); + + vlay->addStretch(1); +} + +void CDArchivingDialog::slotAlbumSelected() +{ + QValueList ListAlbums(m_imageCollectionSelector->selectedImageCollections()); + double size = 0; + + for ( QValueList::Iterator it = ListAlbums.begin(); it != ListAlbums.end(); ++it ) + { + KURL::List images = (*it).images(); + + for ( KURL::List::Iterator urlIt = images.begin() ; urlIt != images.end() ; ++urlIt ) + { + KIPI::ImageInfo info = m_interface->info( *urlIt ); + size += info.size(); + } + } + + TargetMediaSize = (int)(size/1024.0); + + ShowMediaCapacity(); +} + + +void CDArchivingDialog::mediaFormatActived (const QString & item ) +{ + QString Color; + + if (item == i18n("CD (650Mb)")) + MaxMediaSize = 665600; + + if (item == i18n("CD (700Mb)")) + MaxMediaSize = 716800; + + if (item == i18n("CD (880Mb)")) + MaxMediaSize = 901120; + + if (item == i18n("DVD (4,7Gb)")) + MaxMediaSize = 4928307; + + ShowMediaCapacity(); +} + +void CDArchivingDialog::ShowMediaCapacity(void) +{ + QString Color = "";; + + if (TargetMediaSize >= MaxMediaSize - (MaxMediaSize*0.1)) + Color = ""; + + if (TargetMediaSize >= MaxMediaSize) + Color = ""; + + m_mediaSize->setText( i18n("Total size: ") + Color + + i18n("%1 / %2").arg(KIO::convertSizeFromKB(TargetMediaSize)) + .arg(KIO::convertSizeFromKB (MaxMediaSize)) ); +} + +void CDArchivingDialog::slotOk() +{ + m_selectedAlbums = m_imageCollectionSelector->selectedImageCollections(); + + if (m_selectedAlbums.size() == 0) + { + KMessageBox::sorry(this, i18n("You must selected at least one Album to archive.")); + return; + } + + QFile fileK3b(getK3bBinPathName()); + + if ( !KStandardDirs::findExe( getK3bBinPathName() )) + { + KMessageBox::sorry(this, i18n("K3b binary path is not valid. Please check it.")); + return; + } + + if (TargetMediaSize >= MaxMediaSize) + { + KMessageBox::sorry(this, i18n("Target media size is too big. Please change your album selection.")); + return; + } + + accept(); +} + +void CDArchivingDialog::UrlChanged(const QString &url ) +{ + enableButtonOK( !url.isEmpty()); +} + +QString CDArchivingDialog::getK3bBinPathName() const +{ + return m_K3bBinPath->url(); +} + +QString CDArchivingDialog::getK3bParameters() const +{ + return m_K3bParameters->text(); +} + +void CDArchivingDialog::setK3bBinPathName(const QString &Value) +{ + m_K3bBinPath->setURL( Value ); +} + +void CDArchivingDialog::setK3bParameters(const QString &Value) +{ + m_K3bParameters->setText( Value ); +} + +int CDArchivingDialog::getImagesPerRow() const +{ + return m_imagesPerRow->value(); +} + +void CDArchivingDialog::setImagesPerRow(int Value) +{ + m_imagesPerRow->setValue(Value); +} + +int CDArchivingDialog::getThumbnailsSize() const +{ + return m_thumbnailsSize->value(); +} + +void CDArchivingDialog::setThumbnailsSize(int Value) +{ + m_thumbnailsSize->setValue( Value ); +} + +const QString CDArchivingDialog::getFontName() const +{ + return m_fontName->currentText(); +} + +void CDArchivingDialog::setFontName(QString Value) +{ + m_fontName->setCurrentText (Value); +} + +const QString CDArchivingDialog::getFontSize() const +{ + return m_fontSize->text(); +} + +void CDArchivingDialog::setFontSize(int Value) +{ + m_fontSize->setValue( Value ); +} + +const QColor CDArchivingDialog::getBackgroundColor() const +{ + return m_backgroundColor->color(); +} + +void CDArchivingDialog::setBackgroundColor(QColor Value) +{ + m_backgroundColor->setColor( Value ); +} + +const QColor CDArchivingDialog::getForegroundColor() const +{ + return m_foregroundColor->color(); +} + +void CDArchivingDialog::setForegroundColor(QColor Value) +{ + m_foregroundColor->setColor( Value ); +} + +const QString CDArchivingDialog::getImageFormat() const +{ + return m_imageFormat->currentText(); +} + +void CDArchivingDialog::setImageFormat(QString Value) +{ + return m_imageFormat->setCurrentText( Value ); +} + +const QString CDArchivingDialog::getMainTitle() const +{ + return m_title->text(); +} + +void CDArchivingDialog::setMainTitle(QString Value) +{ + return m_title->setText( Value ); +} + +bool CDArchivingDialog::getUseHTMLInterface() const +{ + return m_useHTMLInterface->isChecked(); +} + +void CDArchivingDialog::setUseHTMLInterface(bool Value) +{ + m_useHTMLInterface->setChecked(Value); +} + +bool CDArchivingDialog::getUseAutoRunWin32() const +{ + return m_useAutoRunWin32->isChecked(); +} + +void CDArchivingDialog::setUseAutoRunWin32(bool Value) +{ + m_useAutoRunWin32->setChecked(Value); +} + +const QString CDArchivingDialog::getVolumeID() const +{ + return m_volume_id->text(); +} + +void CDArchivingDialog::setVolumeID(QString Value) +{ + return m_volume_id->setText( Value ); +} + +const QString CDArchivingDialog::getVolumeSetID() const +{ + return m_volume_set_id->text(); +} + +void CDArchivingDialog::setVolumeSetID(QString Value) +{ + return m_volume_set_id->setText( Value ); +} + +const QString CDArchivingDialog::getSystemID() const +{ + return m_system_id->text(); +} + +void CDArchivingDialog::setSystemID(QString Value) +{ + return m_system_id->setText( Value ); +} + +const QString CDArchivingDialog::getApplicationID() const +{ + return m_application_id->text(); +} + +void CDArchivingDialog::setApplicationID(QString Value) +{ + return m_application_id->setText( Value ); +} + +const QString CDArchivingDialog::getPublisher() const +{ + return m_publisher->text(); +} + +void CDArchivingDialog::setPublisher(QString Value) +{ + return m_publisher->setText( Value ); +} + +const QString CDArchivingDialog::getPreparer() const +{ + return m_preparer->text(); +} + +void CDArchivingDialog::setPreparer(QString Value) +{ + return m_preparer->setText( Value ); +} + +const QString CDArchivingDialog::getMediaFormat() const +{ + return m_mediaFormat->currentText(); +} + +void CDArchivingDialog::setMediaFormat(QString Value) +{ + return m_mediaFormat->setCurrentText( Value ); +} + +bool CDArchivingDialog::getUseOnTheFly() const +{ + return m_burnOnTheFly->isChecked(); +} + +void CDArchivingDialog::setUseUseOnTheFly(bool Value) +{ + m_burnOnTheFly->setChecked(Value); +} + +bool CDArchivingDialog::getUseCheckCD() const +{ + return m_checkCDBurn->isChecked(); +} + +void CDArchivingDialog::setUseCheckCD(bool Value) +{ + m_checkCDBurn->setChecked(Value); +} + +bool CDArchivingDialog::getUseStartBurningProcess() const +{ + return m_startBurningProcess->isChecked(); +} + +void CDArchivingDialog::setUseStartBurningProcess(bool Value) +{ + m_startBurningProcess->setChecked(Value); +} + +const QColor CDArchivingDialog::getBordersImagesColor() const +{ + return m_bordersImagesColor->color(); +} + +void CDArchivingDialog::setBordersImagesColor(QColor Value) +{ + m_bordersImagesColor->setColor( Value ); +} + +const QString CDArchivingDialog::getBordersImagesSize() const +{ + return m_bordersImagesSize->text(); +} + +void CDArchivingDialog::setBordersImagesSize(int Value) +{ + m_bordersImagesSize->setValue( Value ); +} + +} // NameSpace KIPICDArchivingPlugin + +#include "cdarchivingdialog.moc" diff --git a/kipi-plugins/cdarchiving/cdarchivingdialog.h b/kipi-plugins/cdarchiving/cdarchivingdialog.h new file mode 100644 index 0000000..f29aefe --- /dev/null +++ b/kipi-plugins/cdarchiving/cdarchivingdialog.h @@ -0,0 +1,249 @@ +/* ============================================================ + * Author: Gilles Caulier + * from digiKam project. + * Date : 2003-10-01 + * Description : a kipi plugin to export image collections + * on CD/DVD. + * + * Copyright 2003-2005 by Gilles Caulier + * Copyright 2003-2004 by Gregory Kokanosky + * + * for HTML interface navigation mode + * Copyright 2005 by Owen Hirst + * about bugfix. + * + * 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, 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. + * + * ============================================================ */ + +#ifndef CDARCHIVINGDIALOG_H +#define CDARCHIVINGDIALOG_H + +// Qt includes + +#include + +// KDE includes + +#include +#include + +// KIPI includes + +#include "kpaboutdata.h" +#include + +class KColorButton; +class KFileItem; +class KFilePreview; +class KIntNumInput; +class KListView; +class KSqueezedTextLabel; +class KURL; +class KURLRequester; + +class QCheckBox; +class QLineEdit; +class QProgressDialog; +class QPushButton; +class QSpinBox; +class QString; + + +namespace KIPI +{ +class ImageCollectionSelector; +} + +namespace KIPICDArchivingPlugin +{ + +class CDArchivingDialog : public KDialogBase +{ + Q_OBJECT + +public: + + CDArchivingDialog( KIPI::Interface* interface, QWidget *parent=0); + ~CDArchivingDialog(); + + QString getK3bBinPathName() const; + QString getK3bParameters() const; + + void setK3bBinPathName(const QString &Value); + void setK3bParameters(const QString &Value); + + int getImagesPerRow() const; + void setImagesPerRow(int Value); + + int getThumbnailsSize() const; + void setThumbnailsSize(int Value); + + const QString getFontName() const; + void setFontName(QString Value); + + const QString getFontSize() const; + void setFontSize(int Value); + + const QString getBordersImagesSize() const; + void setBordersImagesSize(int Value); + + const QColor getBackgroundColor() const; + void setBackgroundColor(QColor Value); + + const QColor getForegroundColor() const; + void setForegroundColor(QColor Value); + + const QColor getBordersImagesColor() const; + void setBordersImagesColor(QColor Value); + + const QString getImageFormat() const; + void setImageFormat(QString Value); + + const QString getMainTitle() const; + void setMainTitle(QString Value); + + bool getUseHTMLInterface() const; + void setUseHTMLInterface(bool Value); + + bool getUseAutoRunWin32() const; + void setUseAutoRunWin32(bool Value); + + const QString getVolumeID() const; + void setVolumeID(QString Value); + + const QString getVolumeSetID() const; + void setVolumeSetID(QString Value); + + const QString getSystemID() const; + void setSystemID(QString Value); + + const QString getApplicationID() const; + void setApplicationID(QString Value); + + const QString getPublisher() const; + void setPublisher(QString Value); + + const QString getPreparer() const; + void setPreparer(QString Value); + + const QString getMediaFormat() const; + void setMediaFormat(QString Value); + + bool getUseOnTheFly() const; + void setUseUseOnTheFly(bool Value); + + bool getUseCheckCD() const; + void setUseCheckCD(bool Value); + + bool getUseStartBurningProcess() const; + void setUseStartBurningProcess(bool Value); + + QValueList getSelectedAlbums() const + { + return m_selectedAlbums; + } + + void ShowMediaCapacity(void); + +protected slots: + + void slotHelp(); + void slotAlbumSelected(void); + void mediaFormatActived( const QString& item ); + void slotOk(); + void UrlChanged(const QString &url ); + +private: + + KColorButton *m_backgroundColor; + KColorButton *m_bordersImagesColor; + KColorButton *m_foregroundColor; + + KIO::filesize_t MaxMediaSize; + + KIPI::ImageCollectionSelector *m_imageCollectionSelector; + + KIPI::Interface *m_interface; + + KIPIPlugins::KPAboutData *m_about; + + KIntNumInput *m_imagesPerRow; + KIntNumInput *m_thumbnailsSize; + + KListView *m_AlbumsList; + + KSqueezedTextLabel *m_AlbumCollection; + KSqueezedTextLabel *m_AlbumComments; + KSqueezedTextLabel *m_AlbumDate; + KSqueezedTextLabel *m_AlbumItems; + KSqueezedTextLabel *m_AlbumSize; + + KURLRequester *m_K3bBinPath; + + QCheckBox *m_burnOnTheFly; + QCheckBox *m_checkCDBurn; + QCheckBox *m_startBurningProcess; + QCheckBox *m_useAutoRunWin32; + QCheckBox *m_useHTMLInterface; + QComboBox *m_fontName; + QComboBox *m_imageFormat; + QComboBox *m_mediaFormat; + + QFrame *page_CDInfos; + QFrame *page_burning; + QFrame *page_setupLook; + QFrame *page_setupSelection; + + QLabel *m_albumPreview; + QLabel *m_labelBackgroundColor; + QLabel *m_labelFontName; + QLabel *m_labelFontSize; + QLabel *m_labelForegroundColor; + QLabel *m_labelImageBorderSize; + QLabel *m_labelImageBorderSizeColor; + QLabel *m_labelThumbsFileFormat; + QLabel *m_labelTitle; + QLabel *m_mediaSize; + + QLineEdit *m_K3bParameters; + QLineEdit *m_application_id; + QLineEdit *m_preparer; + QLineEdit *m_publisher; + QLineEdit *m_system_id; + QLineEdit *m_title; + QLineEdit *m_volume_id; + QLineEdit *m_volume_set_id; + + QProgressDialog *m_progressDlg; + + QPushButton *m_helpButton; + + QSpinBox *m_bordersImagesSize; + QSpinBox *m_fontSize; + + QString m_ImagesFilesSort; + QString m_TempFolder; + + QValueList m_selectedAlbums; + +private: + + void setupBurning(void); + void setupCDInfos(void); + void setupLookPage(void); + void setupSelection(void); +}; + +} // NameSpace KIPICDArchivingPlugin + +#endif /* CDARCHIVINGDIALOG_H */ diff --git a/kipi-plugins/cdarchiving/gohome.png b/kipi-plugins/cdarchiving/gohome.png new file mode 100644 index 0000000..acf3e4a Binary files /dev/null and b/kipi-plugins/cdarchiving/gohome.png differ diff --git a/kipi-plugins/cdarchiving/image_broken.png b/kipi-plugins/cdarchiving/image_broken.png new file mode 100644 index 0000000..5f525f8 Binary files /dev/null and b/kipi-plugins/cdarchiving/image_broken.png differ diff --git a/kipi-plugins/cdarchiving/kipiplugin_cdarchiving.desktop b/kipi-plugins/cdarchiving/kipiplugin_cdarchiving.desktop new file mode 100644 index 0000000..c9d66e0 --- /dev/null +++ b/kipi-plugins/cdarchiving/kipiplugin_cdarchiving.desktop @@ -0,0 +1,57 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=CDArchiving +Name[ca]=Arxivat de CD +Name[cs]=Archivace na CD +Name[da]=Cd-arkivering +Name[de]=Archivierung auf CD +Name[el]=ΑρχειοθέτησηCD +Name[es]=Archivador en CD +Name[et]=CD-le arhiveerimine +Name[fi]=CD-arkistointi +Name[gl]=Arquivado en CD +Name[it]=ArchiviazioneSuCD +Name[nds]=CD-Archiveren +Name[nl]=CD-archievering +Name[pa]=CD ਭੰਡਾਰ +Name[pl]=Archiwizacja na CD +Name[pt]=Arquivo em CD +Name[sr]=CD Архивирање +Name[sr@Latn]=CD Arhiviranje +Name[sv]=Cd-arkivering +Name[tg]=БойгонииCD +Name[tr]=CDArşivleme +Name[xx]=xxCDArchivingxx +Name[zh_CN]=CD 存档 +Comment=KIPI Albums CD and DVD Archiving Plugin +Comment[ca]=Connector del KIPI per arxivar àlbums en CD i DVD +Comment[cs]=KIPI modul archivace alb na CD a DVD +Comment[da]=KIPI-plugin: Arkivering af albummer på cd eller dvd +Comment[de]=Ein KIPI-Modul zum Archivieren von Bilderalben auf CD und DVD +Comment[el]=Πρόσθετο αρχειοθέτησης άλμπουμ CD και DVD του KIPI +Comment[es]=Complemento de KIPI para archivar álbumes en CD y DVD +Comment[et]=KIPI albumite CD-le ja DVD-le arhiveerimise plugin +Comment[fi]=Kipi-liitännäinen cd/dvd-levyille arkistointiin +Comment[fr]=Module externe KIPI pour archiver des albums sur CD/DVD +Comment[gl]=Plugin de Arquivado de Albuns en CD e DVD de KIPI +Comment[is]=KIPI íforrit til gera CD og DVD diska +Comment[it]=Plugin di archiviazione degli album su CD e DVD di KIPI +Comment[ja]=Kipi アルバム CD/DVD アーカイブプラグイン +Comment[nds]=KIPI-Moduul för't Archiveren op CD un DVD +Comment[nl]=KIPI-plugin voor het maken van een cd/dvd-archief +Comment[pa]=KIPI ਐਲਬਮ CD ਅਤੇ DVD ਪੁਰਾਲੇਖ ਪਲੱਗਇਨ +Comment[pl]=Wtyczka KIPI - Archiwizacja albumów na CD i DVD +Comment[pt]='Plugin' de Arquivo em CD e DVD de Álbuns do KIPI +Comment[pt_BR]=Plugin para Arquivamento de Álbuns de CD e DVD do KIPI +Comment[sr]=KIPI прикључак за архивирање албума на CD и DVD +Comment[sr@Latn]=KIPI priključak za arhiviranje albuma na CD i DVD +Comment[sv]=KIPI-insticksprogram: Arkivering av album på cd eller dvd +Comment[tg]=Модули бойгонии албомҳои CD ва DVD +Comment[tr]=KIPI Albümler CD ve DVD Arşivleme Eklentisi +Comment[xx]=xxKIPI Albums CD and DVD Archiving Pluginxx +Comment[zh_CN]=KIPI 相册 CD 和 DVD 存档插件 +Icon= +ServiceTypes=KIPI/Plugin +Type=Service +X-KDE-Library=kipiplugin_cdarchiving +author=Gilles Caulier, caulier dot gilles at gmail dot com diff --git a/kipi-plugins/cdarchiving/plugin_cdarchiving.cpp b/kipi-plugins/cdarchiving/plugin_cdarchiving.cpp new file mode 100644 index 0000000..90f0452 --- /dev/null +++ b/kipi-plugins/cdarchiving/plugin_cdarchiving.cpp @@ -0,0 +1,350 @@ +////////////////////////////////////////////////////////////////////////////// +// +// PLUGIN_CDARCHIVING.CPP +// +// Copyright (C) 2003-2004 Gilles Caulier +// +// 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, Cambridge, MA 02110-1301, USA. +// +////////////////////////////////////////////////////////////////////////////// + +// KDE includes + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// LibKipi includes + +#include + +// Local includes + +#include "actions.h" +#include "cdarchiving.h" +#include "plugin_cdarchiving.h" + +typedef KGenericFactory Factory; + +K_EXPORT_COMPONENT_FACTORY( kipiplugin_cdarchiving, + Factory("kipiplugin_cdarchiving")) + +// ----------------------------------------------------------- +Plugin_CDArchiving::Plugin_CDArchiving(QObject *parent, const char*, const QStringList&) + : KIPI::Plugin( Factory::instance(), parent, "CDArchiving") +{ + kdDebug( 51001 ) << "Plugin_CDArchiving plugin loaded" << endl; +} + +void Plugin_CDArchiving::setup( QWidget* widget ) +{ + KIPI::Plugin::setup( widget ); + + m_action_cdarchiving = new KAction (i18n("Archive to CD/DVD..."), // Menu message. + "cd", // Menu icon. + 0, + this, + SLOT(slotActivate()), + actionCollection(), + "cd_archiving"); + + addAction( m_action_cdarchiving ); + m_cdarchiving = 0; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +Plugin_CDArchiving::~Plugin_CDArchiving() +{ + // No need to delete m_cdarchiving as its a QObject child of this + // and will be deleted automatically +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void Plugin_CDArchiving::slotActivate() +{ + m_progressDlg = 0; + + KIPI::Interface* interface = dynamic_cast< KIPI::Interface* >( parent() ); + + if ( !interface ) + { + kdError( 51000 ) << "Kipi interface is null!" << endl; + return; + } + + m_cdarchiving = new KIPICDArchivingPlugin::CDArchiving( + interface, + this, m_action_cdarchiving); + + if ( m_cdarchiving->showDialog() ) + { + m_cdarchiving->prepare(); + m_cdarchiving->run(); + } +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void Plugin_CDArchiving::slotCancel() +{ + m_cdarchiving->stop(); + m_cdarchiving->removeTmpFiles(); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void Plugin_CDArchiving::customEvent(QCustomEvent *event) +{ + if (!event) return; + + if (!m_progressDlg) + { + m_progressDlg = new KIPI::BatchProgressDialog(kapp->activeWindow(), i18n("Archive to CD/DVD")); + + connect(m_progressDlg, SIGNAL(cancelClicked()), + this, SLOT(slotCancel())); + + m_current = 0; + m_progressDlg->show(); + } + + KIPICDArchivingPlugin::EventData *d = (KIPICDArchivingPlugin::EventData*) event->data(); + + if (!d) return; + + if (d->starting) + { + QString text; + + switch (d->action) + { + case(KIPICDArchivingPlugin::Initialize): + { + text = i18n("Initialising..."); + m_total = d->total; + break; + } + + case(KIPICDArchivingPlugin::BuildHTMLiface): + { + text = i18n("Making main HTML interface..."); + break; + } + + case(KIPICDArchivingPlugin::BuildAlbumHTMLPage): + { + text = i18n("Making HTML pages for Album '%1'...").arg(d->albumName); + break; + } + + case(KIPICDArchivingPlugin::BuildAutoRuniface): + { + text = i18n("Making AutoRun interface..."); + break; + } + + case(KIPICDArchivingPlugin::ResizeImages): + { + text = i18n("Creating thumbnail for '%1'...").arg(d->fileName); + break; + } + + case(KIPICDArchivingPlugin::BuildK3bProject): + { + text = i18n("Making K3b project..."); + break; + } + + case(KIPICDArchivingPlugin::Progress): + { + text = d->message; + break; + } + + default: + { + kdWarning( 51000 ) << "Plugin_CDArchiving: Unknown 'Starting' event: " << d->action << endl; + } + } + + m_progressDlg->addedAction(text, KIPI::StartingMessage); + } + else + { + QString text; + + if (d->success) + { + switch (d->action) + { + case(KIPICDArchivingPlugin::BuildHTMLiface): + { + ++m_current; + text = i18n("Main HTML interface creation completed."); + break; + } + + case(KIPICDArchivingPlugin::BuildAlbumHTMLPage): + { + ++m_current; + text = i18n("HTML page creation for Album '%1' completed.").arg(d->albumName); + break; + } + + case(KIPICDArchivingPlugin::ResizeImages): + { + ++m_current; + text = i18n("Creating thumbnail for '%1' done.").arg(d->fileName); + break; + } + + case(KIPICDArchivingPlugin::BuildAutoRuniface): + { + ++m_current; + text = i18n("AutoRun interface creation completed."); + break; + } + + case(KIPICDArchivingPlugin::BuildK3bProject): + { + ++m_current; + text = i18n("K3b project creation completed."); + break; + } + + default: + { + kdWarning( 51000 ) << "Plugin_CDArchiving: Unknown 'Success' event: " << d->action << endl; + } + } + + m_progressDlg->addedAction(text, KIPI::SuccessMessage); + } + else + { + switch (d->action) + { + case(KIPICDArchivingPlugin::ResizeImages): + { + text = i18n("Failed to create thumbnail for '%1'").arg(d->fileName); + m_progressDlg->addedAction(text, KIPI::WarningMessage); + m_progressDlg->setProgress(m_current, m_total); + break; + } + + case(KIPICDArchivingPlugin::BuildHTMLiface): + { + ++m_current; + text = i18n("Failed to create HTML interface: %1") + .arg(d->message); + m_progressDlg->addedAction(text, KIPI::ErrorMessage); + m_progressDlg->setProgress(m_current, m_total); + slotCancel(); + return; + break; + } + + case(KIPICDArchivingPlugin::BuildAlbumHTMLPage): + { + text = i18n("Failed to create HTML pages for Album '%1'") + .arg(d->albumName); + m_progressDlg->addedAction(text, KIPI::ErrorMessage); + m_progressDlg->setProgress(m_current, m_total); + slotCancel(); + return; + break; + } + + case(KIPICDArchivingPlugin::BuildK3bProject): + { + ++m_current; + text = i18n("Failed to create K3b project."); + m_progressDlg->addedAction(text, KIPI::ErrorMessage); + m_progressDlg->setProgress(m_current, m_total); + slotCancel(); + return; + break; + } + + case(KIPICDArchivingPlugin::Error): + { + text = d->message; + m_progressDlg->addedAction(text, KIPI::ErrorMessage); + m_progressDlg->setProgress(m_current, m_total); + slotCancel(); + return; + break; + } + + default: + { + kdWarning( 51000 ) << "Plugin_CDArchiving: Unknown 'Failed' event: " << d->action << endl; + } + } + } + + m_progressDlg->setProgress(m_current, m_total); + + if ( d->action == KIPICDArchivingPlugin::BuildK3bProject ) + { + m_current = 0; + +#if KDE_VERSION >= 0x30200 + m_progressDlg->setButtonCancel( KStdGuiItem::close() ); +#else + m_progressDlg->setButtonCancelText( i18n("&Close") ); +#endif + + disconnect(m_progressDlg, SIGNAL(cancelClicked()), + this, SLOT(slotCancel())); + + // Invoke K3b program. + + m_progressDlg->addedAction(i18n("Starting K3b program..."), + KIPI::StartingMessage); + m_cdarchiving->invokeK3b(); + } + } + + kapp->processEvents(); + delete d; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +KIPI::Category Plugin_CDArchiving::category( KAction* action ) const +{ + if ( action == m_action_cdarchiving ) + return KIPI::EXPORTPLUGIN; + + kdWarning( 51000 ) << "Unrecognized action for plugin category identification" << endl; + return KIPI::EXPORTPLUGIN; // no warning from compiler, please +} + + +#include "plugin_cdarchiving.moc" diff --git a/kipi-plugins/cdarchiving/plugin_cdarchiving.h b/kipi-plugins/cdarchiving/plugin_cdarchiving.h new file mode 100644 index 0000000..f5c1a00 --- /dev/null +++ b/kipi-plugins/cdarchiving/plugin_cdarchiving.h @@ -0,0 +1,72 @@ +////////////////////////////////////////////////////////////////////////////// +// +// PLUGIN_CDARCHIVING.H +// +// Copyright (C) 2003-2004 Gilles Caulier +// +// 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, Cambridge, MA 02110-1301, USA. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef PLUGIN_CDARCHIVING_H +#define PLUGIN_CDARCHIVING_H + +// LibKIPI includes. + +#include + +class QCustomEvent; + +class KAction; + +namespace KIPI +{ +class BatchProgressDialog; +} + +namespace KIPICDArchivingPlugin +{ +class CDArchiving; +class BatchProgressDialog; +} + +class Plugin_CDArchiving : public KIPI::Plugin +{ + Q_OBJECT + +public: + Plugin_CDArchiving(QObject *parent, const char* name, const QStringList &args); + virtual ~Plugin_CDArchiving(); + virtual KIPI::Category category( KAction* action ) const; + virtual void setup( QWidget* widget ); + +public slots: + void slotActivate(); + void slotCancel(); + +private: + int m_current; + int m_total; + + KIPI::BatchProgressDialog *m_progressDlg; + + KIPICDArchivingPlugin::CDArchiving *m_cdarchiving; + KAction *m_action_cdarchiving; + + void customEvent(QCustomEvent *event); +}; + + +#endif /* PLUGIN_CDARCHIVING_H */ diff --git a/kipi-plugins/cdarchiving/up.png b/kipi-plugins/cdarchiving/up.png new file mode 100644 index 0000000..89f77e6 Binary files /dev/null and b/kipi-plugins/cdarchiving/up.png differ diff --git a/kipi-plugins/cdarchiving/valid-html401.png b/kipi-plugins/cdarchiving/valid-html401.png new file mode 100644 index 0000000..3855210 Binary files /dev/null and b/kipi-plugins/cdarchiving/valid-html401.png differ -- cgit v1.2.3