summaryrefslogtreecommitdiffstats
path: root/renamedlgplugins/images
diff options
context:
space:
mode:
Diffstat (limited to 'renamedlgplugins/images')
-rw-r--r--renamedlgplugins/images/Makefile.am21
-rw-r--r--renamedlgplugins/images/image_plugin.cpp85
-rw-r--r--renamedlgplugins/images/imagevisualizer.cpp83
-rw-r--r--renamedlgplugins/images/imagevisualizer.h66
-rw-r--r--renamedlgplugins/images/renimagedlg.desktop66
5 files changed, 321 insertions, 0 deletions
diff --git a/renamedlgplugins/images/Makefile.am b/renamedlgplugins/images/Makefile.am
new file mode 100644
index 0000000..1c07171
--- /dev/null
+++ b/renamedlgplugins/images/Makefile.am
@@ -0,0 +1,21 @@
+#SUBDIRS= kcmimage
+
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = librenimageplugin.la
+
+librenimageplugin_la_SOURCES = imagevisualizer.cpp image_plugin.cpp
+librenimageplugin_la_LIBADD = $(LIB_KIO)
+librenimageplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+pluginsdir = $(kde_servicesdir)
+plugins_DATA = renimagedlg.desktop
+
+# Install the .rc file in the Part's directory (in this case, the part
+# is KHTMLPart)
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/imagerename_plugin.pot
diff --git a/renamedlgplugins/images/image_plugin.cpp b/renamedlgplugins/images/image_plugin.cpp
new file mode 100644
index 0000000..7c347ea
--- /dev/null
+++ b/renamedlgplugins/images/image_plugin.cpp
@@ -0,0 +1,85 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Holger Freyther <freyther@yahoo.com>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+//#include "image_plugin.moc"
+
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kiconloader.h>
+#include <renamedlgplugin.h>
+#include <kio/renamedlg.h>
+#include <qlabel.h>
+#include <qdialog.h>
+#include <qwidget.h>
+#include <qstringlist.h>
+#include <kio/global.h>
+#include <qlayout.h>
+
+#include <sys/types.h>
+
+#include "imagevisualizer.h"
+
+class ImagePlugin : public RenameDlgPlugin{
+public:
+ ImagePlugin( QDialog *dialog, const char *name, const QStringList & );
+ virtual bool initialize( KIO::RenameDlg_Mode /*mod*/, const QString &/*_src*/, const QString &/*_dest*/,
+ const QString &/*mimeSrc*/,
+ const QString &/*mimeDest*/,
+ KIO::filesize_t /*sizeSrc*/,
+ KIO::filesize_t /*sizeDest*/,
+ time_t /*ctimeSrc*/,
+ time_t /*ctimeDest*/,
+ time_t /*mtimeSrc*/,
+ time_t /*mtimeDest*/ );
+};
+
+ImagePlugin::ImagePlugin( QDialog *dialog, const char *name, const QStringList &list )
+ : RenameDlgPlugin( dialog, name, list)
+{
+}
+
+bool ImagePlugin::initialize( KIO::RenameDlg_Mode mode, const QString &_src, const QString &_dest,
+ const QString &/*mimeSrc*/,
+ const QString &/*mimeDest*/,
+ KIO::filesize_t /*sizeSrc*/,
+ KIO::filesize_t /*sizeDest*/,
+ time_t /*ctimeSrc*/,
+ time_t /*ctimeDest*/,
+ time_t /*mtimeSrc*/,
+ time_t /*mtimeDest*/ )
+{
+ QGridLayout *lay = new QGridLayout(this, 2, 3, 5 );
+ if( mode & KIO::M_OVERWRITE )
+ {
+ QLabel *label = new QLabel(this );
+ label->setText(i18n("You want to overwrite the left picture with the one on the right.") );
+ label->adjustSize();
+ lay->addMultiCellWidget(label, 1, 1, 0, 2, Qt::AlignHCenter );
+ adjustSize();
+ }
+ ImageVisualizer *left= new ImageVisualizer(this, "Visualizer Left", _dest );
+ ImageVisualizer *right = new ImageVisualizer( this, "Visualizer Right", _src );
+ lay->addWidget(left, 2, 0 );
+ lay->addWidget(right, 2, 2 );
+ adjustSize();
+ return true;
+}
+
+typedef KGenericFactory<ImagePlugin, QDialog> ImagePluginFactory;
+K_EXPORT_COMPONENT_FACTORY( librenimageplugin, ImagePluginFactory("imagerename_plugin") )
diff --git a/renamedlgplugins/images/imagevisualizer.cpp b/renamedlgplugins/images/imagevisualizer.cpp
new file mode 100644
index 0000000..cb890c5
--- /dev/null
+++ b/renamedlgplugins/images/imagevisualizer.cpp
@@ -0,0 +1,83 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Holger Freyther <freyther@yahoo.com>
+ 2003 Carsten Pfeiffer <pfeiffer@kde.org>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <klocale.h>
+#include <kurl.h>
+#include <kurllabel.h>
+#include <qvbox.h>
+#include <qlabel.h>
+#include <qpixmap.h>
+#include <qimage.h>
+
+#include <kio/netaccess.h>
+
+#include "imagevisualizer.h"
+
+ImageVisualizer::ImageVisualizer( QWidget *parent, const char *name, const QString &fileName )
+ : QVBox( parent, name )
+{
+ pic = 0;
+ description = 0;
+ KURL url=KURL::fromPathOrURL( fileName );
+ setSpacing( 0 );
+ if( url.isValid() && url.isLocalFile() ) {
+ pic = new QLabel(this );
+ description = new QLabel( this );
+ loadImage( url.path() );
+ } else if( !url.isLocalFile() ) {
+ KURLLabel *label = new KURLLabel( this );
+ label->setText(i18n("This picture isn't stored\non the local host.\nClick on this label to load it.\n" ) );
+ label->setURL( url.prettyURL() );
+ connect(label, SIGNAL(leftClickedURL(const QString&)), SLOT(downloadImage(const QString&)));
+ pic = label;
+ description = new QLabel(this);
+ description->adjustSize( );
+ } else {
+ description = new QLabel(this );
+ description->setText(i18n("Unable to load image") );
+ }
+}
+
+void ImageVisualizer::loadImage( const QString& path )
+{
+ QImage img(path);
+ QPixmap pixmap(img.smoothScale(180,200, QImage::ScaleMin) );
+ pic->setText( QString::null );
+ pic->setPixmap(pixmap );
+ pic->adjustSize();
+
+ QString desc;
+ desc.append(i18n("The color depth of an image", "Depth: %1\n").arg( img.depth() ));
+ desc.append(i18n("The dimensions of an image", "Dimensions: %1x%1").arg(img.width()).arg(img.height() ));
+ description->setText(desc );
+ description->adjustSize();
+}
+
+void ImageVisualizer::downloadImage(const QString& url)
+{
+ QString tmpFile;
+ if( KIO::NetAccess::download( KURL::fromPathOrURL( url ), tmpFile , topLevelWidget()) )
+ {
+ loadImage( tmpFile );
+ KIO::NetAccess::removeTempFile( tmpFile );
+ }
+}
+
+#include "imagevisualizer.moc"
diff --git a/renamedlgplugins/images/imagevisualizer.h b/renamedlgplugins/images/imagevisualizer.h
new file mode 100644
index 0000000..391fad2
--- /dev/null
+++ b/renamedlgplugins/images/imagevisualizer.h
@@ -0,0 +1,66 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Holger Freyther <freyther@yahoo.com>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; version 2
+ of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef imagevisualizer_h
+#define imagevisualizer_h
+
+#include <qvbox.h>
+
+class QPixmap;
+class QLabel;
+class ImageVisualizer : public QVBox
+{
+ Q_OBJECT
+public:
+ ImageVisualizer(QWidget *parent, const char *name, const QString &fileName );
+
+private:
+ void loadImage( const QString& path );
+
+private slots:
+ void downloadImage( const QString& url );
+
+private:
+ QLabel *pic;
+ QLabel *description;
+};
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/renamedlgplugins/images/renimagedlg.desktop b/renamedlgplugins/images/renimagedlg.desktop
new file mode 100644
index 0000000..c96622b
--- /dev/null
+++ b/renamedlgplugins/images/renimagedlg.desktop
@@ -0,0 +1,66 @@
+[Desktop Entry]
+Type=Service
+Name=Image Displayer
+Name[ar]=عارض الصور
+Name[az]=Rəsm Nümayişçisi
+Name[bg]=Показване на изображения
+Name[bs]=Preglednik slika
+Name[ca]=Visor d'imatges
+Name[cs]=Prohlížeč obrázků
+Name[cy]=Arddangosydd Delweddau
+Name[da]=Billedfremviser
+Name[de]=Bildbetrachter
+Name[el]=Προβολή εικόνων
+Name[eo]=Bildprezentilo
+Name[es]=Muestra imágenes
+Name[et]=Pildifailide näitaja
+Name[eu]=Irudi bistaratzailea
+Name[fa]=نمایش‌دهندۀ تصویر
+Name[fi]=Kuvannäyttäjä
+Name[fo]=Myndaframvísari
+Name[fr]=Afficheur d'images
+Name[fy]=Ofbylden werjefteprogramma
+Name[ga]=Amharcán Íomhánna
+Name[gl]=Visor de Imaxes
+Name[he]=מציג תמונות
+Name[hi]=छवि प्रदर्शक
+Name[hr]=Preglednik slika
+Name[hu]=Képmegjelenítő
+Name[is]=Myndsjá
+Name[it]=Visualizzatore di immagini
+Name[ja]=イメージ表示ツール
+Name[ka]=გამოსახულებთა ამსახავი
+Name[kk]=Кескін көрсеткіш
+Name[km]=កម្មវិធី​បង្ហាញ​រូបភាព
+Name[lt]=Paveikslėlių rodytojas
+Name[lv]=Attēlu Rādītājs
+Name[mk]=Прикажувач на слики
+Name[mt]=Werrej ta' Stampi
+Name[nb]=Bildeviser
+Name[nds]=Bildwieser
+Name[ne]=छवि प्रदर्शक
+Name[nl]=Afbeeldingenweergaveprogramma
+Name[nn]=Biletvisar
+Name[nso]=Sebontshi sa Ponagalo
+Name[pa]=ਚਿੱਤਰ ਦਰਸ਼ਕ
+Name[pl]=Program wyświetlający obrazki
+Name[pt]=Visualizador de Imagens
+Name[pt_BR]=Visualizador de Imagens
+Name[ro]=Vizualizor imagini
+Name[ru]=просмотр изображений
+Name[sk]=Prehliadač obrázkov
+Name[sl]=Prikazovalnik slik
+Name[sr]=Приказивач слика
+Name[sr@Latn]=Prikazivač slika
+Name[sv]=Bildvisare
+Name[ta]=பிம்பக் காட்டி
+Name[tg]=тамошои тасвир
+Name[th]=เครื่องมือแสดงภาพ
+Name[tr]=Resim Gösterici
+Name[uk]=Перегляд зображень
+Name[vi]=Bộ hiển thị ảnh
+Name[xh]=Umbonisi wo Mfanekiso
+Name[zh_CN]=图像显示器
+Name[zh_TW]=影像顯示器
+X-KDE-Library=librenimageplugin
+ServiceTypes=RenameDlg/Plugin,image/jpeg,image/png