summaryrefslogtreecommitdiffstats
path: root/konq-plugins/kimgalleryplugin
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /konq-plugins/kimgalleryplugin
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/kimgalleryplugin')
-rw-r--r--konq-plugins/kimgalleryplugin/Makefile.am21
-rw-r--r--konq-plugins/kimgalleryplugin/cr16-action-imagegallery.pngbin0 -> 878 bytes
-rw-r--r--konq-plugins/kimgalleryplugin/cr22-action-imagegallery.pngbin0 -> 1443 bytes
-rw-r--r--konq-plugins/kimgalleryplugin/imgallerydialog.cpp455
-rw-r--r--konq-plugins/kimgalleryplugin/imgallerydialog.h113
-rw-r--r--konq-plugins/kimgalleryplugin/imgalleryplugin.cpp499
-rw-r--r--konq-plugins/kimgalleryplugin/imgalleryplugin.h80
-rw-r--r--konq-plugins/kimgalleryplugin/kimgalleryplugin.desktop129
-rw-r--r--konq-plugins/kimgalleryplugin/kimgalleryplugin.rc8
9 files changed, 1305 insertions, 0 deletions
diff --git a/konq-plugins/kimgalleryplugin/Makefile.am b/konq-plugins/kimgalleryplugin/Makefile.am
new file mode 100644
index 0000000..1efb965
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/Makefile.am
@@ -0,0 +1,21 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = libkimgallery.la
+libkimgallery_la_SOURCES = imgalleryplugin.cpp imgallerydialog.cpp
+libkimgallery_la_LIBADD = -lkonq
+libkimgallery_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+iconviewdir = $(kde_datadir)/konqiconview/kpartplugins
+iconview_DATA = kimgalleryplugin.rc kimgalleryplugin.desktop
+
+listviewdir = $(kde_datadir)/konqlistview/kpartplugins
+listview_DATA = kimgalleryplugin.rc kimgalleryplugin.desktop
+
+appsdir = $(kde_appsdir)/.hidden
+apps_DATA = kimgalleryplugin.desktop
+
+KDE_ICON = imagegallery
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/imgalleryplugin.pot
diff --git a/konq-plugins/kimgalleryplugin/cr16-action-imagegallery.png b/konq-plugins/kimgalleryplugin/cr16-action-imagegallery.png
new file mode 100644
index 0000000..537e4f1
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/cr16-action-imagegallery.png
Binary files differ
diff --git a/konq-plugins/kimgalleryplugin/cr22-action-imagegallery.png b/konq-plugins/kimgalleryplugin/cr22-action-imagegallery.png
new file mode 100644
index 0000000..af66538
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/cr22-action-imagegallery.png
Binary files differ
diff --git a/konq-plugins/kimgalleryplugin/imgallerydialog.cpp b/konq-plugins/kimgalleryplugin/imgallerydialog.cpp
new file mode 100644
index 0000000..54db458
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/imgallerydialog.cpp
@@ -0,0 +1,455 @@
+/* This file is part of the KDE project
+
+Copyright (C) 2001, 2003 Lukas Tinkl <lukas@kde.org>
+Andreas Schlapbach <schlpbch@iam.unibe.ch>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License version 2 as published by the Free Software Foundation.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.
+*/
+
+#include <qlabel.h>
+#include <qvbox.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <qwhatsthis.h>
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qspinbox.h>
+
+
+#include <klocale.h>
+#include <kurl.h>
+#include <kfontdialog.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+#include <klineedit.h>
+#include <knuminput.h>
+#include <kcolorbutton.h>
+#include <kurlrequester.h>
+#include <kglobalsettings.h>
+#include <kconfig.h>
+
+#include "imgallerydialog.h"
+#include "imgallerydialog.moc"
+
+KIGPDialog::KIGPDialog(QWidget *parent, const QString& path, const char *name )
+ : KDialogBase( IconList, i18n("Configure"), Default|Ok|Cancel,
+ Ok, parent, name, true, true ),
+ m_dialogOk( false )
+{
+ m_path = path;
+ setCaption(i18n("Create Image Gallery"));
+ setButtonOK( KGuiItem(i18n("Create"),"imagegallery") );
+ m_config = new KConfig("kimgallerypluginrc", false, false);
+ setupLookPage(path);
+ setupDirectoryPage(path);
+ setupThumbnailPage(path);
+}
+
+void KIGPDialog::slotDefault()
+{
+ m_title->setText(i18n("Image Gallery for %1").arg(m_path));
+ m_imagesPerRow->setValue(4);
+ m_imageName->setChecked(true);
+ m_imageSize->setChecked(false);
+ m_imageProperty->setChecked(false);
+ m_fontName->setCurrentText( KGlobalSettings::generalFont().family() );
+ m_fontSize->setValue(14);
+ m_foregroundColor->setColor( QColor( "#d0ffd0") );
+ m_backgroundColor->setColor( QColor("#333333") );
+
+ m_imageNameReq->setURL(m_path + "images.html");
+ m_recurseSubDir->setChecked( false );
+ m_recursionLevel->setEnabled( false );
+ m_copyOriginalFiles->setChecked( false );
+ m_useCommentFile->setChecked( false );
+ m_commentFileReq->setURL(m_path + "comments");
+ m_commentFileReq->setEnabled( false );
+
+ m_imageFormat->setCurrentText( "JPEG");
+ m_thumbnailSize->setValue(140);
+ m_colorDepthSet->setChecked(false);
+ m_colorDepth->setCurrentText("8");
+}
+
+void KIGPDialog::setupLookPage(const QString& path) {
+ QFrame *page = addPage( i18n("Look"), i18n("Page Look"),
+ BarIcon("colorize", KIcon::SizeMedium ) );
+
+ m_config->setGroup("Look");
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, spacingHint() );
+
+ QLabel *label;
+
+ label = new QLabel( i18n("&Page title:"), page);
+ vlay->addWidget(label);
+
+ m_title = new QLineEdit(i18n("Image Gallery for %1").arg(path), page);
+ vlay->addWidget( m_title );
+ label->setBuddy(m_title);
+
+ m_imagesPerRow = new KIntNumInput(m_config->readNumEntry("ImagesPerRow", 4), page);
+ m_imagesPerRow->setRange(1, 8, 1, true );
+ m_imagesPerRow->setLabel( i18n("I&mages per row:") );
+ vlay->addWidget( m_imagesPerRow );
+
+ QGridLayout *grid = new QGridLayout( 2, 2 );
+ vlay->addLayout( grid );
+
+ m_imageName = new QCheckBox( i18n("Show image file &name"), page);
+ m_imageName->setChecked( m_config->readBoolEntry("ImageName", true) );
+ grid->addWidget( m_imageName, 0, 0 );
+
+ m_imageSize = new QCheckBox( i18n("Show image file &size"), page);
+ m_imageSize->setChecked( m_config->readBoolEntry("ImageSize", false) );
+ grid->addWidget( m_imageSize, 0, 1 );
+
+ m_imageProperty = new QCheckBox( i18n("Show image &dimensions"), page);
+ m_imageProperty->setChecked( m_config->readBoolEntry("ImageProperty", false) );
+ grid->addWidget( m_imageProperty, 1, 0 );
+
+ QHBoxLayout *hlay11 = new QHBoxLayout( );
+ vlay->addLayout( hlay11 );
+
+ m_fontName = new QComboBox( false,page );
+ QStringList standardFonts;
+ KFontChooser::getFontList(standardFonts, 0);
+ m_fontName->insertStringList( standardFonts );
+ m_fontName->setCurrentText( m_config->readEntry("FontName", KGlobalSettings::generalFont().family() ) );
+
+ label = new QLabel( i18n("Fon&t name:"), page );
+ label->setBuddy( m_fontName );
+ hlay11->addWidget( label );
+ hlay11->addStretch( 1 );
+ hlay11->addWidget( m_fontName );
+
+ QHBoxLayout *hlay12 = new QHBoxLayout( );
+ vlay->addLayout( hlay12 );
+
+ m_fontSize = new QSpinBox( 6, 15, 1, page );
+ m_fontSize->setValue( m_config->readNumEntry("FontSize", 14) );
+
+ label = new QLabel( i18n("Font si&ze:"), page );
+ label->setBuddy( m_fontSize );
+ hlay12->addWidget( label );
+ hlay12->addStretch( 1 );
+ hlay12->addWidget( m_fontSize );
+
+ QHBoxLayout *hlay1 = new QHBoxLayout( spacingHint() );
+ vlay->addLayout( hlay1 );
+
+ m_foregroundColor = new KColorButton(page);
+ m_foregroundColor->setColor( QColor( m_config->readEntry("ForegroundColor", "#d0ffd0") ) );
+
+ label = new QLabel( i18n("&Foreground color:"), page);
+ label->setBuddy( m_foregroundColor );
+ hlay1->addWidget( label );
+ hlay1->addStretch( 1 );
+ hlay1->addWidget(m_foregroundColor);
+
+ QHBoxLayout *hlay2 = new QHBoxLayout( spacingHint() );
+ vlay->addLayout( hlay2 );
+
+ m_backgroundColor = new KColorButton(page);
+ m_backgroundColor->setColor( QColor(m_config->readEntry("BackgroundColor", "#333333") ) );
+
+ label = new QLabel( i18n("&Background color:"), page);
+ hlay2->addWidget( label );
+ label->setBuddy( m_backgroundColor );
+ hlay2->addStretch( 1 );
+ hlay2->addWidget(m_backgroundColor);
+
+ vlay->addStretch(1);
+}
+
+void KIGPDialog::setupDirectoryPage(const QString& path) {
+ QFrame *page = addPage( i18n("Folders"), i18n("Folders"),
+ BarIcon("folder", KIcon::SizeMedium ) );
+
+ m_config->setGroup("Directory");
+ QVBoxLayout *dvlay = new QVBoxLayout( page, 0, spacingHint() );
+
+ QLabel *label;
+ label = new QLabel(i18n("&Save to HTML file:"), page);
+ dvlay->addWidget( label );
+ QString whatsThis;
+ whatsThis = i18n("<p>The name of the HTML file this gallery will be saved to.");
+ QWhatsThis::add( label, whatsThis );
+
+ m_imageNameReq = new KURLRequester(path + "images.html", page);
+ label->setBuddy( m_imageNameReq );
+ dvlay->addWidget(m_imageNameReq);
+ connect( m_imageNameReq, SIGNAL(textChanged(const QString&)),
+ this, SLOT(imageUrlChanged(const QString&)) );
+ QWhatsThis::add( m_imageNameReq, whatsThis );
+
+ const bool recurseSubDir = m_config->readBoolEntry("RecurseSubDirectories", false);
+ m_recurseSubDir = new QCheckBox(i18n("&Recurse subfolders"), page);
+ m_recurseSubDir->setChecked( recurseSubDir );
+ whatsThis = i18n("<p>Whether subfolders should be included for the "
+ "image gallery creation or not.");
+ QWhatsThis::add( m_recurseSubDir, whatsThis );
+
+ const int recursionLevel = m_config->readNumEntry("RecursionLevel", 0);
+ m_recursionLevel = new KIntNumInput( recursionLevel, page );
+ m_recursionLevel->setRange( 0, 99, 1, true );
+ m_recursionLevel->setLabel( i18n("Rec&ursion depth:") );
+ if ( recursionLevel == 0 )
+ m_recursionLevel->setSpecialValueText( i18n("Endless"));
+ m_recursionLevel->setEnabled(recurseSubDir);
+ whatsThis = i18n("<p>You can limit the number of folders the "
+ "image gallery creator will traverse to by setting an "
+ "upper bound for the recursion depth.");
+ QWhatsThis::add( m_recursionLevel, whatsThis );
+
+
+ connect(m_recurseSubDir, SIGNAL( toggled(bool) ),
+ m_recursionLevel, SLOT( setEnabled(bool) ) );
+
+ dvlay->addWidget(m_recurseSubDir);
+ dvlay->addWidget(m_recursionLevel);
+
+ m_copyOriginalFiles = new QCheckBox(i18n("Copy or&iginal files"), page);
+ m_copyOriginalFiles->setChecked(m_config->readBoolEntry("CopyOriginalFiles", false) );
+ dvlay->addWidget(m_copyOriginalFiles);
+ whatsThis = i18n("<p>This makes a copy of all images and the gallery will refer "
+ "to these copies instead of the original images.");
+ QWhatsThis::add( m_copyOriginalFiles, whatsThis );
+
+
+ const bool useCommentFile = m_config->readBoolEntry("UseCommentFile", false);
+ m_useCommentFile = new QCheckBox(i18n("Use &comment file"), page);
+ m_useCommentFile->setChecked(useCommentFile);
+ dvlay->addWidget(m_useCommentFile);
+
+ whatsThis = i18n("<p>If you enable this option you can specify "
+ "a comment file which will be used for generating "
+ "subtitles for the images."
+ "<p>For details about the file format please see "
+ "the \"What's This?\" help below.");
+ QWhatsThis::add( m_useCommentFile, whatsThis );
+
+ label = new QLabel(i18n("Comments &file:"), page);
+ label->setEnabled( useCommentFile );
+ dvlay->addWidget( label );
+ whatsThis = i18n("<p>You can specify the name of the comment file here. "
+ "The comment file contains the subtitles for the images. "
+ "The format of this file is:"
+ "<p>FILENAME1:"
+ "<br>Description"
+ "<br>"
+ "<br>FILENAME2:"
+ "<br>Description"
+ "<br>"
+ "<br>and so on");
+ QWhatsThis::add( label, whatsThis );
+
+ m_commentFileReq = new KURLRequester(path + "comments", page);
+ m_commentFileReq->setEnabled(useCommentFile);
+ label->setBuddy( m_commentFileReq );
+ dvlay->addWidget(m_commentFileReq);
+ QWhatsThis::add( m_commentFileReq, whatsThis );
+
+ connect(m_useCommentFile, SIGNAL(toggled(bool)),
+ label, SLOT(setEnabled(bool)));
+ connect(m_useCommentFile, SIGNAL(toggled(bool)),
+ m_commentFileReq, SLOT(setEnabled(bool)));
+
+ dvlay->addStretch(1);
+}
+
+void KIGPDialog::setupThumbnailPage(const QString& path) {
+ QFrame *page = addPage( i18n("Thumbnails"), i18n("Thumbnails"),
+ BarIcon("thumbnail", KIcon::SizeMedium ) );
+
+ m_config->setGroup("Thumbnails");
+ QLabel *label;
+
+ QVBoxLayout *vlay = new QVBoxLayout( page, 0, spacingHint() );
+
+ QHBoxLayout *hlay3 = new QHBoxLayout( spacingHint() );
+ vlay->addLayout( hlay3 );
+
+ m_imageFormat = new QComboBox(false, page);
+ m_imageFormat->insertItem("JPEG");
+ m_imageFormat->insertItem("PNG");
+ m_imageFormat->setCurrentText( m_config->readEntry("ImageFormat", "JPEG") );
+
+ label = new QLabel( i18n("Image format f&or the thumbnails:"), page);
+ hlay3->addWidget( label );
+ label->setBuddy( m_imageFormat );
+ hlay3->addStretch( 1 );
+ hlay3->addWidget(m_imageFormat);
+
+ m_thumbnailSize = new KIntNumInput(m_config->readNumEntry("ThumbnailSize", 140), page);
+ m_thumbnailSize->setRange(10, 1000, 1, true );
+ m_thumbnailSize->setLabel( i18n("Thumbnail size:") );
+ vlay->addWidget( m_thumbnailSize );
+
+ QGridLayout *grid = new QGridLayout( 2, 2 );
+ vlay->addLayout( grid );
+
+ QHBoxLayout *hlay4 = new QHBoxLayout( spacingHint() );
+ vlay->addLayout( hlay4 );
+ const bool colorDepthSet = m_config->readBoolEntry("ColorDepthSet", false);
+ m_colorDepthSet = new QCheckBox(i18n("&Set different color depth:"), page);
+ m_colorDepthSet->setChecked(colorDepthSet);
+ hlay4->addWidget( m_colorDepthSet );
+
+ m_colorDepth = new QComboBox(false, page);
+ m_colorDepth->insertItem("1");
+ m_colorDepth->insertItem("8");
+ m_colorDepth->insertItem("16");
+ m_colorDepth->insertItem("32");
+ m_colorDepth->setCurrentText(m_config->readEntry("ColorDepth", "8"));
+ m_colorDepth->setEnabled(colorDepthSet);
+ hlay4->addWidget( m_colorDepth );
+
+ connect(m_colorDepthSet, SIGNAL( toggled(bool) ),
+ m_colorDepth, SLOT( setEnabled(bool) ) );
+
+ vlay->addStretch(1);
+
+}
+
+void KIGPDialog::writeConfig()
+{
+ m_config->setGroup("Look");
+ m_config->writeEntry("ImagesPerRow", getImagesPerRow());
+ m_config->writeEntry("ImageName", printImageName());
+ m_config->writeEntry("ImageSize", printImageSize());
+ m_config->writeEntry("ImageProperty", printImageProperty());
+ m_config->writeEntry("FontName", getFontName());
+ m_config->writeEntry("FontSize", getFontSize());
+ m_config->writeEntry("ForegroundColor", getForegroundColor().name() );
+ m_config->writeEntry("BackgroundColor", getBackgroundColor().name());
+
+ m_config->setGroup("Directory");
+ m_config->writeEntry("RecurseSubDirectories", recurseSubDirectories());
+ m_config->writeEntry("RecursionLevel", recursionLevel());
+ m_config->writeEntry("CopyOriginalFiles", copyOriginalFiles());
+ m_config->writeEntry("UseCommentFile", useCommentFile());
+
+ m_config->setGroup("Thumbnails");
+ m_config->writeEntry("ThumbnailSize", getThumbnailSize());
+ m_config->writeEntry("ColorDepth", getColorDepth());
+ m_config->writeEntry("ColorDepthSet", colorDepthSet());
+ m_config->writeEntry("ImageFormat", getImageFormat());
+ m_config->sync();
+}
+
+KIGPDialog::~KIGPDialog()
+{
+}
+
+void KIGPDialog::imageUrlChanged(const QString &url )
+{
+ enableButtonOK( !url.isEmpty());
+}
+
+bool KIGPDialog::printImageName() const
+{
+ return m_imageName->isChecked();
+}
+
+bool KIGPDialog::printImageSize() const
+{
+ return m_imageSize->isChecked();
+}
+
+bool KIGPDialog::printImageProperty() const
+{
+ return m_imageProperty->isChecked();
+}
+
+bool KIGPDialog::recurseSubDirectories() const
+{
+ return m_recurseSubDir->isChecked();
+}
+
+int KIGPDialog::recursionLevel() const
+{
+ return m_recursionLevel->value();
+}
+
+bool KIGPDialog::copyOriginalFiles() const
+{
+ return m_copyOriginalFiles->isChecked();
+}
+
+bool KIGPDialog::useCommentFile() const
+{
+ return m_useCommentFile->isChecked();
+}
+
+int KIGPDialog::getImagesPerRow() const
+{
+ return m_imagesPerRow->value();
+}
+
+int KIGPDialog::getThumbnailSize() const
+{
+ return m_thumbnailSize->value();
+}
+
+int KIGPDialog::getColorDepth() const
+{
+ return m_colorDepth->currentText().toInt();
+}
+
+bool KIGPDialog::colorDepthSet() const
+{
+ return m_colorDepthSet->isChecked();
+}
+
+const QString KIGPDialog::getTitle() const
+{
+ return m_title->text();
+}
+
+const QString KIGPDialog::getImageName() const
+{
+ return m_imageNameReq->url();
+}
+
+const QString KIGPDialog::getCommentFile() const
+{
+ return m_commentFileReq->url();
+}
+
+const QString KIGPDialog::getFontName() const
+{
+ return m_fontName->currentText();
+}
+
+const QString KIGPDialog::getFontSize() const
+{
+ return m_fontSize->text();
+}
+
+const QColor KIGPDialog::getBackgroundColor() const
+{
+ return m_backgroundColor->color();
+}
+
+const QColor KIGPDialog::getForegroundColor() const
+{
+ return m_foregroundColor->color();
+}
+
+const QString KIGPDialog::getImageFormat() const
+{
+ return m_imageFormat->currentText();
+}
diff --git a/konq-plugins/kimgalleryplugin/imgallerydialog.h b/konq-plugins/kimgalleryplugin/imgallerydialog.h
new file mode 100644
index 0000000..7aa6163
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/imgallerydialog.h
@@ -0,0 +1,113 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2001, 2003 Lukas Tinkl <lukas@kde.org>
+ Andreas Schlapbach <schlpbch@iam.unibe.ch>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef kimdialogplugin_h
+#define kimdialogplugin_h
+
+
+#include <kdialogbase.h>
+
+class QProgressDialog;
+class KURL;
+class KIntNumInput;
+class QCheckBox;
+class QLineEdit;
+class KURLRequester;
+class QSpinBox;
+class KColorButton;
+class KConfig;
+
+typedef QMap<QString,QString> CommentMap;
+
+class KIGPDialog : public KDialogBase
+{
+ Q_OBJECT
+
+ public:
+ KIGPDialog(QWidget *parent=0, const QString& path=0, const char *name=0 );
+ ~KIGPDialog();
+
+ bool isDialogOk() const;
+ bool printImageName() const;
+ bool printImageSize() const;
+ bool printImageProperty() const;
+ bool copyOriginalFiles() const;
+ bool useCommentFile() const;
+ bool recurseSubDirectories() const;
+ int recursionLevel() const;
+ bool colorDepthSet() const;
+
+ int getImagesPerRow() const;
+ int getThumbnailSize() const;
+ int getColorDepth() const;
+
+ const QString getTitle() const;
+ const QString getImageName() const;
+ const QString getCommentFile() const;
+ const QString getFontName() const;
+ const QString getFontSize() const;
+
+ const QColor getBackgroundColor() const;
+ const QColor getForegroundColor() const;
+
+ const QString getImageFormat() const;
+
+ void writeConfig();
+ protected slots:
+ void imageUrlChanged(const QString & );
+ void slotDefault();
+
+ private:
+ KColorButton *m_foregroundColor;
+ KColorButton *m_backgroundColor;
+
+ QLineEdit *m_title;
+ QString m_path;
+
+ KIntNumInput *m_imagesPerRow;
+ KIntNumInput *m_thumbnailSize;
+ KIntNumInput *m_recursionLevel;
+ QSpinBox *m_fontSize;
+
+ QCheckBox *m_copyOriginalFiles;
+ QCheckBox *m_imageName;
+ QCheckBox *m_imageSize;
+ QCheckBox *m_imageProperty;
+ QCheckBox *m_useCommentFile;
+ QCheckBox *m_recurseSubDir;
+ QCheckBox *m_colorDepthSet;
+
+ QComboBox* m_fontName;
+ QComboBox* m_imageFormat;
+ QComboBox* m_colorDepth;
+
+ KURLRequester *m_imageNameReq;
+ KURLRequester *m_commentFileReq;
+ bool m_dialogOk;
+
+ KConfig *m_config;
+
+ private:
+ void setupLookPage(const QString& path);
+ void setupDirectoryPage(const QString& path);
+ void setupThumbnailPage(const QString& path);
+};
+
+#endif
diff --git a/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp b/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp
new file mode 100644
index 0000000..43df35b
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp
@@ -0,0 +1,499 @@
+/* This file is part of the KDE project
+
+Copyright (C) 2001, 2003 Lukas Tinkl <lukas@kde.org>
+Andreas Schlapbach <schlpbch@iam.unibe.ch>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License version 2 as published by the Free Software Foundation.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.
+*/
+
+#include <qdir.h>
+#include <qtextstream.h>
+#include <qfile.h>
+#include <qfont.h>
+#include <qdatetime.h>
+#include <qpixmap.h>
+#include <qimage.h>
+#include <qprogressdialog.h>
+#include <qtextcodec.h>
+#include <qstylesheet.h>
+
+#include <kaction.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kcharsets.h>
+#include <kmessagebox.h>
+#include <kurl.h>
+#include <kapplication.h>
+#include <kimageio.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kio/netaccess.h>
+#include <kpushbutton.h>
+
+#include "imgallerydialog.h"
+#include "imgalleryplugin.h"
+
+typedef KGenericFactory<KImGalleryPlugin> KImGalleryPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkimgallery, KImGalleryPluginFactory( "imgalleryplugin" ) )
+
+KImGalleryPlugin::KImGalleryPlugin( QObject* parent, const char* name, const QStringList & )
+ : KParts::Plugin( parent, name ), m_commentMap(0)
+{
+ new KAction( i18n( "&Create Image Gallery..." ), "imagegallery", CTRL+Key_I, this,
+ SLOT( slotExecute() ), actionCollection(), "create_img_gallery" );
+}
+
+void KImGalleryPlugin::slotExecute()
+{
+ m_progressDlg=0L;
+ if ( !parent() || !parent()->inherits("KonqDirPart"))
+ {
+ KMessageBox::sorry( 0L, i18n("Could not create the plugin, please report a bug."));
+ return;
+ }
+ m_part = static_cast<KonqDirPart *>(parent());
+ if (!m_part->url().isLocalFile()) { //TODO support remote URLs too?
+ KMessageBox::sorry(m_part->widget(), i18n("Creating an image gallery works only on local folders."));
+ return;
+ }
+ kdDebug(90170) << "dialog is ok" << endl;
+ m_configDlg = new KIGPDialog(m_part->widget(), m_part->url().path(+1));
+
+ if ( m_configDlg->exec() == QDialog::Accepted ) {
+ kdDebug(90170) << "dialog is ok" << endl;
+ m_configDlg->writeConfig();
+ m_copyFiles = m_configDlg->copyOriginalFiles();
+ m_recurseSubDirectories = m_configDlg->recurseSubDirectories();
+ m_useCommentFile = m_configDlg->useCommentFile();
+ m_imagesPerRow = m_configDlg->getImagesPerRow();
+
+ KURL url(m_configDlg->getImageName());
+ if ( !url.isEmpty() && url.isValid()) {
+ m_progressDlg = new QProgressDialog(m_part->widget(), "progressDlg", true );
+ QObject::connect(m_progressDlg, SIGNAL( cancelled() ), this, SLOT( slotCancelled() ) );
+
+ m_progressDlg->setLabelText( i18n("Creating thumbnails") );
+ m_progressDlg->setCancelButton(new KPushButton(KStdGuiItem::cancel(),m_progressDlg));
+ m_cancelled = false;
+ m_progressDlg->show();
+ if ( createHtml( url, m_part->url().path(), m_configDlg->recursionLevel() > 0 ? m_configDlg->recursionLevel() + 1 : 0 , m_configDlg->getImageFormat()) ) {
+ kapp->invokeBrowser(url.url()); // Open a browser to show the result
+ } else {
+ deleteCancelledGallery(url, m_part->url().path(), m_configDlg->recursionLevel() > 0 ? m_configDlg->recursionLevel() + 1 : 0, m_configDlg->getImageFormat());
+ }
+ }
+ } else {
+ kdDebug(90170) << "dialog is not ok" << endl;
+ }
+ delete m_progressDlg;
+}
+
+bool KImGalleryPlugin::createDirectory(QDir thumb_dir, QString imgGalleryDir, QString dirName)
+{
+ if (!thumb_dir.exists()) {
+ thumb_dir.setPath( imgGalleryDir);
+ if (!(thumb_dir.mkdir(dirName, false))) {
+ KMessageBox::sorry(m_part->widget(), i18n("Couldn't create folder: %1").arg(thumb_dir.path()));
+ return false;
+ } else {
+ thumb_dir.setPath( imgGalleryDir + "/" + dirName + "/" );
+ return true;
+ }
+ } else {
+ return true;
+ }
+}
+
+void KImGalleryPlugin::createHead(QTextStream& stream)
+{
+ const QString chsetName = QTextCodec::codecForLocale()->mimeName();
+
+ stream << "<?xml version=\"1.0\" encoding=\"" + chsetName + "\" ?>" << endl;
+ stream << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">" << endl;
+ stream << "<html xmlns=\"http://www.w3.org/1999/xhtml\">" << endl;
+ stream << "<head>" << endl;
+ stream << "<title>" << QStyleSheet::escape(m_configDlg->getTitle()) << "</title>" << endl;
+ stream << "<meta http-equiv=\"content-type\" content=\"text/html; charset=" << chsetName << "\"/>" << endl;
+ stream << "<meta name=\"GENERATOR\" content=\"KDE Konqueror KImgallery plugin version " KDE_VERSION_STRING "\"/>" << endl;
+ createCSSSection(stream);
+ stream << "</head>" << endl;
+}
+
+void KImGalleryPlugin::createCSSSection(QTextStream& stream)
+{
+ const QString backgroundColor = m_configDlg->getBackgroundColor().name();
+ const QString foregroundColor = m_configDlg->getForegroundColor().name();
+ //adding a touch of style
+ stream << "<style type='text/css'>\n";
+ stream << "BODY {color: " << foregroundColor << "; background: " << backgroundColor << ";" << endl;
+ stream << " font-family: " << m_configDlg->getFontName() << ", sans-serif;" << endl;
+ stream << " font-size: " << m_configDlg->getFontSize() << "pt; margin: 8%; }" << endl;
+ stream << "H1 {color: " << foregroundColor << ";}" << endl;
+ stream << "TABLE {text-align: center; margin-left: auto; margin-right: auto;}" << endl;
+ stream << "TD { color: " << foregroundColor << "; padding: 1em}" << endl;
+ stream << "IMG { border: 1px solid " << foregroundColor << "; }" << endl;
+ stream << "</style>" << endl;
+}
+
+
+QString KImGalleryPlugin::extension(const QString& imageFormat)
+{
+ if (imageFormat == "PNG")
+ return ".png";
+ if (imageFormat == "JPEG")
+ return ".jpg";
+ Q_ASSERT(false);
+ return QString::null;
+}
+
+void KImGalleryPlugin::createBody(QTextStream& stream, const QString& sourceDirName, const QStringList& subDirList,
+ const QDir& imageDir, const KURL& url, const QString& imageFormat)
+{
+ int numOfImages = imageDir.count();
+ const QString imgGalleryDir = url.directory();
+ const QString today(KGlobal::locale()->formatDate(QDate::currentDate()));
+
+ stream << "<body>\n<h1>" << QStyleSheet::escape(m_configDlg->getTitle()) << "</h1><p>" << endl;
+ stream << i18n("<i>Number of images</i>: %1").arg(numOfImages) << "<br/>" << endl;
+ stream << i18n("<i>Created on</i>: %1").arg(today) << "</p>" << endl;
+
+ stream << "<hr/>" << endl;
+
+ if (m_recurseSubDirectories && subDirList.count() > 2) { //subDirList.count() is always >= 2 because of the "." and ".." directories
+ stream << i18n("<i>Subfolders</i>:") << "<br>" << endl;
+ for (QStringList::ConstIterator it = subDirList.begin(); it != subDirList.end(); it++) {
+ if (*it == "." || *it == "..")
+ continue; //disregard the "." and ".." directories
+ stream << "<a href=\"" << *it << "/" << url.fileName()
+ << "\">" << *it << "</a><br>" << endl;
+ }
+ stream << "<hr/>" << endl;
+ }
+
+ stream << "<table>" << endl;
+
+ //table with images
+ int imgIndex;
+ QFileInfo imginfo;
+ QPixmap imgProp;
+ for (imgIndex = 0; !m_cancelled && (imgIndex < numOfImages);) {
+ stream << "<tr>" << endl;
+
+ for (int col=0; !m_cancelled && (col < m_imagesPerRow) && (imgIndex < numOfImages); col++) {
+ const QString imgName = imageDir[imgIndex];
+
+ if (m_copyFiles) {
+ stream << "<td align='center'>\n<a href=\"images/" << imgName << "\">";
+ } else {
+ stream << "<td align='center'>\n<a href=\"" << imgName << "\">";
+ }
+
+
+ if (createThumb(imgName, sourceDirName, imgGalleryDir, imageFormat)) {
+ const QString imgPath("thumbs/" + imgName + extension(imageFormat));
+ stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << "\" ";
+ stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << "\"/>";
+ m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").arg(imgName) );
+ } else {
+ kdDebug(90170) << "Creating thumbnail for " << imgName << " failed" << endl;
+ m_progressDlg->setLabelText( i18n("Creating thumbnail for: \n%1\n failed").arg(imgName) );
+ }
+ stream << "</a>" << endl;
+
+ if (m_configDlg->printImageName()) {
+ stream << "<div>" << imgName << "</div>" << endl;
+ }
+
+ if (m_configDlg->printImageProperty()) {
+ imgProp.load( imageDir.absFilePath(imgName,true) );
+ stream << "<div>" << imgProp.width() << " x " << imgProp.height() << "</div>" << endl;
+ }
+
+ if (m_configDlg->printImageSize()) {
+ imginfo.setFile( imageDir, imgName );
+ stream << "<div>(" << (imginfo.size() / 1024) << " " << i18n("KB") << ")" << "</div>" << endl;
+ }
+
+ if (m_useCommentFile) {
+ QString imgComment = (*m_commentMap)[imgName];
+ stream << "<div>" << QStyleSheet::escape(imgComment) << "</div>" << endl;
+ }
+ stream << "</td>" << endl;
+
+ m_progressDlg->setTotalSteps( numOfImages );
+ m_progressDlg->setProgress( imgIndex );
+ kapp->processEvents();
+ imgIndex++;
+ }
+ stream << "</tr>" << endl;
+ }
+ //close the HTML
+ stream << "</table>\n</body>\n</html>" << endl;
+}
+
+
+bool KImGalleryPlugin::createHtml(const KURL& url, const QString& sourceDirName, int recursionLevel, const QString& imageFormat)
+{
+ if(m_cancelled) return false;
+
+
+ if( !parent() || !parent()->inherits("KonqDirPart"))
+ return false;
+ KonqDirPart * part = static_cast<KonqDirPart *>(parent());
+
+ QStringList subDirList;
+ if (m_recurseSubDirectories && (recursionLevel >= 0)) { //recursionLevel == 0 means endless
+ QDir toplevel_dir = QDir( sourceDirName );
+ toplevel_dir.setFilter( QDir::Dirs | QDir::Readable | QDir::Writable );
+ subDirList = toplevel_dir.entryList();
+
+ for (QStringList::ConstIterator it = subDirList.begin(); it != subDirList.end() && !m_cancelled; it++) {
+ const QString currentDir = *it;
+ if (currentDir == "." || currentDir == "..") { continue;} //disregard the "." and ".." directories
+ QDir subDir = QDir( url.directory() + "/" + currentDir );
+ if (!subDir.exists()) {
+ subDir.setPath( url.directory() );
+ if (!(subDir.mkdir(currentDir, false))) {
+ KMessageBox::sorry(part->widget(), i18n("Couldn't create folder: %1").arg(subDir.path()));
+ continue;
+ } else {
+ subDir.setPath( url.directory() + "/" + currentDir );
+ }
+ }
+ if(!createHtml( KURL( subDir.path() + "/" + url.fileName() ), sourceDirName + "/" + currentDir,
+ recursionLevel > 1 ? recursionLevel - 1 : 0, imageFormat)) { return false; }
+ }
+ }
+
+ if (m_useCommentFile) {
+ loadCommentFile();
+ }
+
+ kdDebug(90170) << "sourceDirName: " << sourceDirName << endl;
+ //We're interested in only the patterns, so look for the first |
+ //#### perhaps an accessor should be added to KImageIO instead?
+ QString filter = KImageIO::pattern(KImageIO::Reading).section('|', 0, 0);
+
+ QDir imageDir( sourceDirName, filter.latin1(),
+ QDir::Name|QDir::IgnoreCase, QDir::Files|QDir::Readable);
+
+ const QString imgGalleryDir = url.directory();
+ kdDebug(90170) << "imgGalleryDir: " << imgGalleryDir << endl;
+
+ // Create the "thumbs" subdirectory if necessary
+ QDir thumb_dir( imgGalleryDir + QString::fromLatin1("/thumbs/"));
+ if (createDirectory(thumb_dir, imgGalleryDir, "thumbs") == false)
+ return false;
+
+ // Create the "images" subdirectory if necessary
+ QDir images_dir( imgGalleryDir + QString::fromLatin1("/images/"));
+ if (m_copyFiles) {
+ if (createDirectory(images_dir, imgGalleryDir, "images") == false)
+ return false;
+ }
+
+ QFile file( url.path() );
+ kdDebug(90170) << "url.path(): " << url.path() << ", thumb_dir: "<< thumb_dir.path()
+ << ", imageDir: "<< imageDir.path() << endl;
+
+ if ( imageDir.exists() && file.open(IO_WriteOnly) ) {
+ QTextStream stream(&file);
+ stream.setEncoding(QTextStream::Locale);
+
+ createHead(stream);
+ createBody(stream, sourceDirName, subDirList, imageDir, url, imageFormat); //ugly
+
+ file.close();
+
+ return !m_cancelled;
+
+ } else {
+ KMessageBox::sorry(m_part->widget(),i18n("Couldn't open file: %1").arg(url.path(+1)));
+ return false;
+ }
+}
+
+void KImGalleryPlugin::deleteCancelledGallery(const KURL& url, const QString& sourceDirName, int recursionLevel, const QString& imageFormat)
+{
+ if (m_recurseSubDirectories && (recursionLevel >= 0)) {
+ QStringList subDirList;
+ QDir toplevel_dir = QDir( sourceDirName );
+ toplevel_dir.setFilter( QDir::Dirs );
+ subDirList = toplevel_dir.entryList();
+
+ for (QStringList::ConstIterator it = subDirList.begin(); it != subDirList.end(); it++) {
+ if (*it == "." || *it == ".." || *it == "thumbs" || (m_copyFiles && *it == "images")) {
+ continue; //disregard the "." and ".." directories
+ }
+ deleteCancelledGallery( KURL( url.directory() + "/" + *it + "/" + url.fileName() ),
+ sourceDirName + "/" + *it,
+ recursionLevel > 1 ? recursionLevel - 1 : 0, imageFormat);
+ }
+ }
+
+ const QString imgGalleryDir = url.directory();
+ QDir thumb_dir( imgGalleryDir + QString::fromLatin1("/thumbs/"));
+ QDir images_dir( imgGalleryDir + QString::fromLatin1("/images/"));
+ QDir imageDir( sourceDirName, "*.png *.PNG *.gif *.GIF *.jpg *.JPG *.jpeg *.JPEG *.bmp *.BMP",
+ QDir::Name|QDir::IgnoreCase, QDir::Files|QDir::Readable);
+ QFile file( url.path() );
+
+ // Remove the image file ..
+ file.remove();
+ // ..all the thumbnails ..
+ for (uint i=0; i < imageDir.count(); i++) {
+ const QString imgName = imageDir[i];
+ const QString imgNameFormat = imgName + extension(imageFormat);
+ bool isRemoved = thumb_dir.remove(imgNameFormat);
+ kdDebug(90170) << "removing: " << thumb_dir.path() << "/" << imgNameFormat << "; "<< isRemoved << endl;
+ }
+ // ..and the thumb directory
+ thumb_dir.rmdir(thumb_dir.path());
+
+ // ..and the images directory if images were to be copied
+ if (m_copyFiles) {
+ for (uint i=0; i < imageDir.count(); i++) {
+ const QString imgName = imageDir[i];
+ bool isRemoved = images_dir.remove(imgName);
+ kdDebug(90170) << "removing: " << images_dir.path() << "/" << imgName << "; "<< isRemoved << endl;
+ }
+ images_dir.rmdir(images_dir.path());
+ }
+}
+
+void KImGalleryPlugin::loadCommentFile()
+{
+ QFile file(m_configDlg->getCommentFile());
+ if (file.open(IO_ReadOnly)) {
+ kdDebug(90170) << "File opened."<< endl;
+
+ QTextStream* m_textStream = new QTextStream(&file);
+ m_textStream->setEncoding(QTextStream::Locale);
+
+ delete m_commentMap;
+ m_commentMap = new CommentMap;
+
+ QString picName, picComment, curLine, curLineStripped;
+ while (!m_textStream->eof()) {
+ curLine = m_textStream->readLine();
+ curLineStripped = curLine.stripWhiteSpace();
+ // Lines starting with '#' are comment
+ if (!(curLineStripped.isEmpty()) && !curLineStripped.startsWith("#")) {
+ if (curLineStripped.endsWith(":")) {
+ picComment = QString::null;
+ picName = curLineStripped.left(curLineStripped.length()-1);
+ kdDebug(90170) << "picName: " << picName << endl;
+ } else {
+ do {
+ //kdDebug(90170) << "picComment" << endl;
+ picComment += curLine + "\n";
+ curLine = m_textStream->readLine();
+ } while (!m_textStream->eof() && !(curLine.stripWhiteSpace().isEmpty()) &&
+ !curLine.stripWhiteSpace().startsWith("#"));
+ //kdDebug(90170) << "Pic comment: " << picComment << endl;
+ m_commentMap->insert(picName, picComment);
+ }
+ }
+ }
+ CommentMap::Iterator it;
+ for( it = m_commentMap->begin(); it != m_commentMap->end(); ++it ) {
+ kdDebug(90170) << "picName: " << it.key() << ", picComment: " << it.data() << endl;
+ }
+ file.close();
+ kdDebug(90170) << "File closed." << endl;
+ delete m_textStream;
+ } else {
+ KMessageBox::sorry(m_part->widget(), i18n("Couldn't open file: %1").arg(m_configDlg->getCommentFile()));
+ m_useCommentFile = false;
+ }
+}
+
+bool KImGalleryPlugin::createThumb( const QString& imgName, const QString& sourceDirName,
+ const QString& imgGalleryDir, const QString& imageFormat)
+{
+ QImage img;
+ const QString pixPath = sourceDirName + QString::fromLatin1("/") + imgName;
+
+ if (m_copyFiles) {
+ KURL srcURL = KURL::fromPathOrURL(pixPath);
+ //kdDebug(90170) << "srcURL: " << srcURL << endl;
+ KURL destURL = KURL::fromPathOrURL(imgGalleryDir + QString::fromLatin1("/images/") + imgName);
+ //kdDebug(90170) << "destURL: " << destURL << endl;
+ KIO::NetAccess::copy(srcURL, destURL, static_cast<KParts::Part *>(parent())->widget());
+ }
+
+ const QString imgNameFormat = imgName + extension(imageFormat);
+ const QString thumbDir = imgGalleryDir + QString::fromLatin1("/thumbs/");
+ int extent = m_configDlg->getThumbnailSize();
+
+ // this code is stolen from kdebase/kioslave/thumbnail/imagecreator.cpp
+ // (c) 2000 gis and malte
+
+ m_imgWidth = 120; // Setting the size of the images is
+ m_imgHeight = 90; // required to generate faster 'loading' pages
+ if ( img.load( pixPath ) )
+ {
+ int w = img.width(), h = img.height();
+ // scale to pixie size
+ // kdDebug(90170) << "w: " << w << " h: " << h << endl;
+ // Resizing if to big
+ if(w > extent || h > extent)
+ {
+ if(w > h)
+ {
+ h = (int)( (double)( h * extent ) / w );
+ if ( h == 0 ) h = 1;
+ w = extent;
+ Q_ASSERT( h <= extent );
+ }
+ else
+ {
+ w = (int)( (double)( w * extent ) / h );
+ if ( w == 0 ) w = 1;
+ h = extent;
+ Q_ASSERT( w <= extent );
+ }
+ const QImage scaleImg(img.smoothScale( w, h ));
+ if ( scaleImg.width() != w || scaleImg.height() != h )
+ {
+ kdDebug(90170) << "Resizing failed. Aborting." << endl;
+ return false;
+ }
+ img = scaleImg;
+ if (m_configDlg->colorDepthSet() == true )
+ {
+ const QImage depthImg(img.convertDepth(m_configDlg->getColorDepth()));
+ img = depthImg;
+ }
+ }
+ kdDebug(90170) << "Saving thumbnail to: " << thumbDir + imgNameFormat << endl;
+ if (!img.save(thumbDir + imgNameFormat, imageFormat.latin1()))
+ {
+ kdDebug(90170) << "Saving failed. Aborting." << endl;
+ return false;
+ }
+ m_imgWidth = w;
+ m_imgHeight = h;
+ return true;
+ }
+ return false;
+}
+
+void KImGalleryPlugin::slotCancelled()
+{
+ m_cancelled = true;
+}
+
+#include "imgalleryplugin.moc"
diff --git a/konq-plugins/kimgalleryplugin/imgalleryplugin.h b/konq-plugins/kimgalleryplugin/imgalleryplugin.h
new file mode 100644
index 0000000..6b580a0
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/imgalleryplugin.h
@@ -0,0 +1,80 @@
+/* This file is part of the KDE project
+
+Copyright (C) 2001, 2003 Lukas Tinkl <lukas@kde.org>
+Andreas Schlapbach <schlpbch@iam.unibe.ch>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License version 2 as published by the Free Software Foundation.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.
+*/
+
+#ifndef kimgalleryplugin_h
+#define kimgalleryplugin_h
+
+#include <kparts/plugin.h>
+#include <klibloader.h>
+#include <konq_dirpart.h>
+#include <kio/jobclasses.h>
+
+class QProgressDialog;
+class KURL;
+class KIGPDialog;
+
+typedef QMap<QString,QString> CommentMap;
+
+class KImGalleryPlugin : public KParts::Plugin
+{
+ Q_OBJECT
+ public:
+ KImGalleryPlugin( QObject* parent, const char* name,
+ const QStringList & );
+ ~KImGalleryPlugin() {}
+
+ public slots:
+ void slotExecute();
+ void slotCancelled();
+
+ private:
+ bool m_cancelled;
+ bool m_recurseSubDirectories;
+ bool m_copyFiles;
+ bool m_useCommentFile;
+
+ int m_imgWidth;
+ int m_imgHeight;
+ int m_imagesPerRow;
+
+ QProgressDialog *m_progressDlg;
+
+ KonqDirPart* m_part;
+
+ KIGPDialog *m_configDlg;
+
+ CommentMap* m_commentMap;
+
+ bool createDirectory(QDir thumb_dir, QString imgGalleryDir, QString dirName);
+
+ void createHead(QTextStream& stream);
+ void createCSSSection(QTextStream& stream);
+ void createBody(QTextStream& stream, const QString& sourceDirName, const QStringList& subDirList, const QDir& imageDir, const KURL& url, const QString& imageFormat);
+
+ bool createThumb( const QString& imgName, const QString& sourceDirName, const QString& imgGalleryDir, const QString& imageFormat);
+
+ bool createHtml( const KURL& url, const QString& sourceDirName, int recursionLevel, const QString& imageFormat);
+ void deleteCancelledGallery( const KURL& url, const QString& sourceDirName, int recursionLevel, const QString& imageFormat);
+ void loadCommentFile();
+
+ static QString extension(const QString& imageFormat);
+};
+
+#endif
diff --git a/konq-plugins/kimgalleryplugin/kimgalleryplugin.desktop b/konq-plugins/kimgalleryplugin/kimgalleryplugin.desktop
new file mode 100644
index 0000000..c8190e1
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/kimgalleryplugin.desktop
@@ -0,0 +1,129 @@
+[Desktop Entry]
+X-KDE-PluginInfo-Author=Lukas Tinkl,Andreas Schlapbach
+X-KDE-PluginInfo-Email=lukas@kde.org,schlpbch@iam.unibe.ch
+X-KDE-PluginInfo-Name=ImgGalleryPlugin
+X-KDE-PluginInfo-Version=3.4
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=Tools
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=LGPL
+X-KDE-PluginInfo-EnabledByDefault=true
+Name=Image Gallery
+Name[bg]=Галерия с изображения
+Name[br]=Garidell ar skeudennoù
+Name[bs]=Galerija slika
+Name[ca]=Galeria d'imatges
+Name[cs]=Obrázková galerie
+Name[cy]=Oriel Ddelweddau
+Name[da]=Billedgalleri
+Name[de]=Bildergalerie
+Name[el]=Συλλογή εικόνων
+Name[eo]=Bildprezentilo
+Name[es]=Galería de imágenes
+Name[et]=Pildigalerii
+Name[eu]=Irudi galeria
+Name[fa]=گالری تصویر
+Name[fi]=Kuvagalleria
+Name[fr]=Galerie d'images
+Name[fy]=Ofbyldengalery
+Name[ga]=Gailearaí Íomhánna
+Name[gl]=Galeria de Imaxes
+Name[he]=גלריית תמונות
+Name[hi]=छवि दीर्घा
+Name[hr]=Galerija slika
+Name[hu]=Képbemutató
+Name[is]=Myndasafn
+Name[it]=Galleria di immagini
+Name[ja]=イメージギャラリー
+Name[ka]=გამოსახულებათა გალერეა
+Name[kk]=Кескіндер галереясы
+Name[km]=វិចិត្រសាល​រូបភាព
+Name[lt]=Paveikslėlių galerija
+Name[mk]=Галерија со слики
+Name[ms]=Galeri Imej
+Name[nb]=Bildegalleri
+Name[nds]=Bildgalerie
+Name[ne]=छवि ग्यालरी
+Name[nl]=Afbeeldingengalerij
+Name[nn]=Biletgalleri
+Name[pa]=ਚਿੱਤਰ ਗੈਲਰੀ
+Name[pl]=Galeria obrazków
+Name[pt]=Galeria de Imagens
+Name[pt_BR]=Galeria de Imagens
+Name[ru]=Галерея изображений
+Name[sk]=Galéria obrázkov
+Name[sl]=Galerija slik
+Name[sr]=Галерија слика
+Name[sr@Latn]=Galerija slika
+Name[sv]=Bildgalleri
+Name[ta]=பிம்ப படத் தொகுப்பு
+Name[tg]=Силсилаи тасвирҳо
+Name[tr]=Resim Galerisi
+Name[uk]=Галерея зображень
+Name[uz]=Rasmlar galereyasi
+Name[uz@cyrillic]=Расмлар галереяси
+Name[vi]=Nơi trưng bày ảnh
+Name[zh_CN]=图像集
+Name[zh_TW]=相簿
+Comment=Easy way to generate a HTML image gallery
+Comment[af]=Maklike weg na genereer 'n Html beeld galery
+Comment[ar]=طريقة سهلة لانشاء معرض صور HTML
+Comment[az]=HTML rəsm qalereyası yaradmanın asan yolu
+Comment[bg]=Лесен начин за генериране на галерия от изображения във формат HTML
+Comment[bs]=Lagan način za generisanje HTML galerija slika
+Comment[ca]=Genera fàcilment una galeria HTML d'imatges
+Comment[cs]=Jednoduchý způsob, jak vygenerovat HTML galerii obrázků
+Comment[cy]=Ffordd hawdd i greu oriel delweddau HTML
+Comment[da]=Nem måde at oprette et HTML-billedgalleri på
+Comment[de]=Einfache Möglichkeit, um eine Bildergalerie in HTML zu erzeugen
+Comment[el]=Εύκολος τρόπος δημιουργίας μιας συλλογής εικόνων σε HTML
+Comment[eo]=Facila kielo por generi HTML bildgalieron
+Comment[es]=Una forma sencilla para generar una galería de imágenes en HTML
+Comment[et]=Kiirmeetod tekitada HTML pildigalerii
+Comment[eu]=HTML irudi galeria sortzeko bide erraza
+Comment[fa]=روش آسان تولید گالری تصویر زنگام
+Comment[fi]=Nopea tapa luoda HTML kuvagalleria
+Comment[fr]=Méthode rapide pour configurer une galerie HTML d'images
+Comment[fy]=Ienfâldige manier om in HTML-ôfbyldengalery oan te meitsjen
+Comment[gl]=Unha forma fácil de xerar unha galeria de imaxes en HTML
+Comment[he]=דרך קלה ליצור גלריית תמונות מבוססת HTML
+Comment[hi]=एचटीएमएल छवि दीर्घा बनाने का तेज तरीका
+Comment[hr]=Jednostavan način izrade HTML galerije slika
+Comment[hu]=HTML-alapú képmegjelenítő
+Comment[is]=Einföld leið til að búa til HTML myndasöfn
+Comment[it]=Modo facile per generare una galleria di immagini in HTML
+Comment[ja]=HTML イメージギャラリーを簡単に作成します
+Comment[ka]=HTML გამოსახულებათა გალერეის გენერაციის მარტივი ხერხი
+Comment[kk]=HTML кескіндер галереясын құрудың оңай жолы
+Comment[km]=វិធី​ដ៏​​ងាយ​ស្រួល​ដើម្បី​បង្កើត​វិចិត្រសាល​រូបភាព HTML​​
+Comment[lt]=Lengvas būdas HTML paveikslėlių galerijai generuoti
+Comment[mk]=Лесен начин за создавање на HTML-галерија со слики
+Comment[ms]=Cara mudah untuk menghasilkan galery imej HTML
+Comment[nb]=Lett måte å lage et bildegalleri for HTML
+Comment[nds]=En HTML-Bildgalerie gau opstellen
+Comment[ne]=एचटीएमएल छवि ग्यालरी उत्पन्न गर्ने सजिलो तरिका
+Comment[nl]=Eenvoudige manier om een HTML-afbeeldingengalerij aan te maken
+Comment[nn]=Ein enkel måte å laga eit biletgalleri som nettsider
+Comment[pl]=Tworzenie galerii obrazków w HTML-u
+Comment[pt]=Uma forma fácil de gerar uma galeria de imagens em HTML
+Comment[pt_BR]=Modo fácil de gerar uma galeria de imagens HTML
+Comment[ro]=O modalitate uşoară de a genera o galerie de imagini în HTML
+Comment[ru]=Генератор веб-страницы с галереей изображений
+Comment[sk]=Jednoduchá cesta ako vygenerovať HTML galériu obrázkov
+Comment[sl]=Preprost način ustvarjanja galerije slik v HTML
+Comment[sr]=Лак начин за прављење HTML галерије слика
+Comment[sr@Latn]=Lak način za pravljenje HTML galerije slika
+Comment[sv]=Enkelt sätt att skapa ett HTML-bildgalleri
+Comment[ta]=ஒரு HTML பிம்ப படத்தொகுப்பை இயக்குவதற்கான சுலபமான வழி
+Comment[tg]=Генератор бо веб-саҳифаҳо аз силсилаи тасвирҳо
+Comment[tr]=HTML resim galerisi oluşturmak için kolay bir yol
+Comment[uk]=Простий спосіб створити галерею зображень в HTML
+Comment[uz]=HTML rasmlar galereyasini yaratish
+Comment[uz@cyrillic]=HTML расмлар галереясини яратиш
+Comment[vi]=Cách dễ tạo ra nơi trưng bày ảnh HTML
+Comment[xh]=Indlela elula yokwenza iHTML igumbi lomboniso wemifanekiso
+Comment[zh_CN]=生成 HTML 图像集的简捷方式
+Comment[zh_TW]=簡單建立 HTML 相簿的方法
+Icon=imagegallery
+X-KDE-ParentApp=konqueror
+DocPath=konq-plugins/imgallery/index.html
diff --git a/konq-plugins/kimgalleryplugin/kimgalleryplugin.rc b/konq-plugins/kimgalleryplugin/kimgalleryplugin.rc
new file mode 100644
index 0000000..2376f8b
--- /dev/null
+++ b/konq-plugins/kimgalleryplugin/kimgalleryplugin.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartplugin>
+<kpartplugin library="libkimgallery">
+<MenuBar>
+ <Menu name="tools"><text>&amp;Tools</text>
+ <Action name="create_img_gallery"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>